GenXProject / GenX.jl

GenX: a configurable power system capacity expansion model for studying low-carbon energy futures. More details at : https://genx.mit.edu
https://genxproject.github.io/GenX.jl/
GNU General Public License v2.0
266 stars 114 forks source link

[Bug]: Example systems with electrolyzers not properly configured #759

Closed joe-rodden1 closed 2 weeks ago

joe-rodden1 commented 2 weeks ago

Bug description

The inputs for the example systems (2 and 8) with electrolyzers do not appear properly configured for the latest code. The input files will not run at all as configured due to a missing Electrolyzer_Min_kt column in the Electrolyzer.csv files. Even after fixing these, the cases do not appear to be running properly. I'm either getting no electrolysis built (even when testing very low annual cost assumptions and high selling prices) or the cases are not solving at all (I unfortunately do not have CPLEX or Gurobi to check conflicts).

I wish I could provide more useful info but am pretty new to using this. I wonder if a set of new input files can be uploaded which are confirmed to work with the latest code.

Environment and Version

MacOS, Julia 1.10, main branch v0.4.1

Relevant error messages

No response

Additional context

No response

lbonaldo commented 2 weeks ago

Hi @joe-rodden1, thank you for opening this issue. I’m happy to help you troubleshoot this. Could you please double-check the GenX version you're running? Here are some steps you can follow:

$ julia --project=<path/to/env/with/GenX>
julia> Type `]` to bring up the package system
pkg> st
joe-rodden1 commented 2 weeks ago

Yep, it's v0.4.1

Joe Rodden Co-founder & CEO Lydian ( https://www.lydianlabsinc.com/ ) 630-215-6597

On Fri, Aug 23, 2024 at 9:13 AM, Luca Bonaldo < @.*** > wrote:

Hi @ joe-rodden1 ( https://github.com/joe-rodden1 ) , thank you for opening this issue. I’m happy to help you troubleshoot this. Could you please double-check the GenX version you're running? Here are some steps you can follow:

$ julia -- project = < path / to / env / with / GenX > julia > Type ] to bring up the package system pkg > st

— Reply to this email directly, view it on GitHub ( https://github.com/GenXProject/GenX.jl/issues/759#issuecomment-2307395138 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/BEWRZIOZ6NFE4DMEVXNK6B3ZS5NRTAVCNFSM6AAAAABM7KT5JSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBXGM4TKMJTHA ). You are receiving this because you were mentioned. Message ID: <GenXProject/GenX . jl/issues/759/2307395138 @ github. com>

lbonaldo commented 2 weeks ago

Could you please also share the error message together with the stacktrace?

joe-rodden1 commented 2 weeks ago

Luca, see attached:

Joe Rodden Co-founder & CEO Lydian ( https://www.lydianlabsinc.com/ ) 630-215-6597

On Fri, Aug 23, 2024 at 9:48 AM, Luca Bonaldo < @.*** > wrote:

Could you please also share the error message together with the stacktrace?

— Reply to this email directly, view it on GitHub ( https://github.com/GenXProject/GenX.jl/issues/759#issuecomment-2307451989 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/BEWRZIKWSGZKL5K7OJSH6H3ZS5RWNAVCNFSM6AAAAABM7KT5JSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBXGQ2TCOJYHE ). You are receiving this because you were mentioned. Message ID: <GenXProject/GenX . jl/issues/759/2307451989 @ github. com>

lbonaldo commented 2 weeks ago

@joe-rodden1, unfortunately, I haven't received the files yet. However, I checked the examples, and they seem to be working correctly. I think I was able to reproduce the error by running GenX <= v0.4.0 with the new examples. The Electrolyzer_Min_kt column in the Electrolyzer.csv file has been removed because GenX now retrieves that value from the Hydrogen_demand.csv policy file (you can see an example here). Could you please let me know how you're running GenX?

joe-rodden1 commented 2 weeks ago

Ah, I am just using the terminal command: julia Run.jl

I suppose the likely explanation then is that the GenX version being used by julia may be different. Is there a better way to run it that you recommend?

Joe Rodden Co-founder & CEO Lydian ( https://www.lydianlabsinc.com/ ) 630-215-6597

On Fri, Aug 23 2024 at 10:44 AM, Luca Bonaldo < @.*** > wrote:

@joe-rodden1 ( https://github.com/joe-rodden1 ) , unfortunately, I haven't received the files yet. However, I checked the examples, and they seem to be working correctly. I think I was able to reproduce the error by running GenX <= v0.4.0 with the new examples. The Electrolyzer_Min_kt column in the Electrolyzer.csv file has been removed because GenX now retrieves that value from the Hydrogen_demand.csv policy file (you can see an example here ( https://github.com/GenXProject/GenX.jl/blob/main/example_systems/2_three_zones_w_electrolyzer/policies/Hydrogen_demand.csv ) ). Could you please let me know how you're running GenX?

— Reply to this email directly, view it on GitHub ( https://github.com/GenXProject/GenX.jl/issues/759#issuecomment-2307537397 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/BEWRZIMAVJHT6BKGNDZ2VOTZS5YJPAVCNFSM6AAAAABM7KT5JSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBXGUZTOMZZG4 ). You are receiving this because you were mentioned. Message ID: <GenXProject/GenX . jl/issues/759/2307537397 @ github. com>

lbonaldo commented 2 weeks ago

The command julia Run.jl runs the Run.jl script (and therefore GenX) using the base Julia environment. You can verify this by running:

$ julia
pkg> status

Therefore, an easy fix would be to check (and if necessary, update) GenX in this environment by running:

$ julia
pkg> add/update GenX

However, my recommendation is to create a new Julia environment inside a folder you’re using to run the cases:

$ julia --project=.     # <---- This runs Julia within the environment defined in the current folder "."
pkg> add GenX   # Or use `pkg> update GenX` if needed

To run GenX installed in that environment, simply use the --project flag with the Julia command:

$ julia --project=. </path/to/Run.jl>

f you’re running multiple tests, I also suggest executing the cases within the same Julia REPL session using the include function:

$ julia --project=.
julia> include("/path/to/Run.jl")
julia> include("/path/to/Run2.jl")

In this way, the packages will be compiled within the same REPL, leading to improved performance.

https://genxproject.github.io/GenX.jl/dev/Getting_Started/examples_casestudies/#Example-cases

joe-rodden1 commented 2 weeks ago

Thanks, Luca. I was able to get the example case running now.

I'm still seeing weird results with changes. I would think that making the hydrogen price in Electrolyzer.csv higher and the investment cost lower should lead to more electrolyzer capacity built, but instead it leads to no solution. I'll keep working on it but appreciate any suggestions you have.

I am trying to run cases similar to the recent paper "Understanding the Role and Design Space of Demand Sinks in Low-carbon Power Systems". If you happened to have example files like the ones used in that analysis, I'd greatly appreciate the headstart.

Joe Rodden Co-founder & CEO Lydian ( https://www.lydianlabsinc.com/ ) 630-215-6597

On Fri, Aug 23, 2024 at 11:44 AM, Luca Bonaldo < @.*** > wrote:

The command julia Run.jl runs the Run.jl script (and therefore GenX) using the base Julia environment. You can verify this by running:

$ julia pkg> status

Therefore, an easy fix would be to check (and if necessary, update) GenX in this environment by running:

$ julia pkg> add/update GenX

However, my recommendation is to create a new Julia environment inside a folder you’re using to run the cases:

$ julia --project=. # <---- This runs Julia within the environment defined in the current folder "." pkg> add GenX # Or use pkg> update GenX if needed

To run GenX installed in that environment, simply use the --project flag with the Julia command:

$ julia --project=. </path/to/Run.jl>

f you’re running multiple tests, I also suggest executing the cases within the same Julia REPL session using the include function:

$ julia --project=. julia> include("/path/to/Run.jl") julia> include("/path/to/Run2.jl")

In this way, the packages will be compiled within the same REPL, leading to improved performance.

https:/ / genxproject. github. io/ GenX. jl/ dev/ Getting_Started/ examples_casestudies/

Example-cases (

https://genxproject.github.io/GenX.jl/dev/Getting_Started/examples_casestudies/#Example-cases )

— Reply to this email directly, view it on GitHub ( https://github.com/GenXProject/GenX.jl/issues/759#issuecomment-2307624572 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/BEWRZIKN3KRKMCFPN7KXNE3ZS57JPAVCNFSM6AAAAABM7KT5JSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBXGYZDINJXGI ). You are receiving this because you were mentioned. Message ID: <GenXProject/GenX . jl/issues/759/2307624572 @ github. com>

qluo0320github commented 2 weeks ago

Hi @joe-rodden1, did you see those weird results from GenX example cases? If so, can you share the modified inputs you are using? I do not think changing costs assumptions would result in "no solution". Did you find your model infeasible? If so, can you add "ComputeConflicts: 1" to genx_settings.yml get the conflicts? Also, making the hydrogen price in Electrolyzer.csv higher and the investment cost lower does not necessarily lead to more electrolyzer capacity built because electrolyzers are built to meet hydrogen demand. Only when hydrogen prices are high enough that it has net revenue, the system may choose to build more electrolyzer capacity than what is needed to meet hydrogen demand.

joe-rodden1 commented 2 weeks ago

Hi there,

I am looking at example case 2. The case runs totally fine as-is. However, the model doesn't solve when I simply reduce the energy demand and investment cost of the electrolyzer resources and increase the selling price (obviously from the energy consumption figure, this is no longer H2 but a generalized flexible asset). These are the only changes made. While I do not necessarily expect predictable/monotonic behavior in running these, I agree it's puzzling that just changing the costs and value would cause an infeasible.

Unfortunately I do not have Gurobi or CPLEX licenses and don't think I can use ComputeConflicts without them, unless my understanding is wrong.

(Run settings are for the successful case, obviously, but in case you need my system specs).

Thanks,

Joe

Joe Rodden Co-founder & CEO Lydian ( https://www.lydianlabsinc.com/ ) 630-215-6597

On Mon, Aug 26, 2024 at 8:13 AM, ql0320 < @.*** > wrote:

Hi @ joe-rodden1 ( https://github.com/joe-rodden1 ) , did you see those weird results from GenX example cases? If so, can you share the modified inputs you are using? I do not think changing costs assumptions would result in "no solution". Did you find your model infeasible? If so, can you add "ComputeConflicts: 1" to genx_settings.yml get the conflicts? Also, making the hydrogen price in Electrolyzer.csv higher and the investment cost lower does not necessarily lead to more electrolyzer capacity built because electrolyzers are built to meet hydrogen demand. Only when hydrogen prices are high enough that it has net revenue, the system may choose to build more electrolyzer capacity than what is needed to meet hydrogen demand.

— Reply to this email directly, view it on GitHub ( https://github.com/GenXProject/GenX.jl/issues/759#issuecomment-2310456180 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/BEWRZIPJUNFOND3TDLJ4IHDZTNAYHAVCNFSM6AAAAABM7KT5JSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJQGQ2TMMJYGA ). You are receiving this because you were mentioned. Message ID: <GenXProject/GenX . jl/issues/759/2310456180 @ github. com>

joe-rodden1 commented 2 weeks ago

Hello,

Just want to update that I've gotten my hands on a CPLEX license and have gotten this working for various investment cost assumptions between 75k and 125k/MW-yr. Below that, I'm still getting errors but I have a feeling that's because there are no maximum capacity constraints in the example case and when the resource gets cheap enough, it wants to build it in infinite amounts. I will play around with more reasonable constraints but feel free to close this out for now.

Thanks for all your help.

Joe

Joe Rodden Co-founder & CEO Lydian ( https://www.lydianlabsinc.com/ ) 630-215-6597

On Mon, Aug 26, 2024 at 2:42 PM, Joe Rodden < @.*** > wrote:

Hi there,

I am looking at example case 2. The case runs totally fine as-is. However, the model doesn't solve when I simply reduce the energy demand and investment cost of the electrolyzer resources and increase the selling price (obviously from the energy consumption figure, this is no longer H2 but a generalized flexible asset). These are the only changes made. While I do not necessarily expect predictable/monotonic behavior in running these, I agree it's puzzling that just changing the costs and value would cause an infeasible.

Unfortunately I do not have Gurobi or CPLEX licenses and don't think I can use ComputeConflicts without them, unless my understanding is wrong.

(Run settings are for the successful case, obviously, but in case you need my system specs).

Thanks,

Joe

Joe Rodden Co-founder & CEO Lydian ( https://www.lydianlabsinc.com/ ) 630-215-6597

On Mon, Aug 26, 2024 at 8:13 AM, ql0320 < notifications@ github. com ( @.*** ) > wrote:

Hi @ joe-rodden1 ( https://github.com/joe-rodden1 ) , did you see those weird results from GenX example cases? If so, can you share the modified inputs you are using? I do not think changing costs assumptions would result in "no solution". Did you find your model infeasible? If so, can you add "ComputeConflicts: 1" to genx_settings.yml get the conflicts? Also, making the hydrogen price in Electrolyzer.csv higher and the investment cost lower does not necessarily lead to more electrolyzer capacity built because electrolyzers are built to meet hydrogen demand. Only when hydrogen prices are high enough that it has net revenue, the system may choose to build more electrolyzer capacity than what is needed to meet hydrogen demand.

— Reply to this email directly, view it on GitHub ( https://github.com/GenXProject/GenX.jl/issues/759#issuecomment-2310456180 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/BEWRZIPJUNFOND3TDLJ4IHDZTNAYHAVCNFSM6AAAAABM7KT5JSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJQGQ2TMMJYGA ). You are receiving this because you were mentioned. Message ID: <GenXProject/GenX . jl/issues/759/2310456180 @ github. com>

qluo0320github commented 2 weeks ago

Yes, this is highly possible. Thanks for letting us know. Best of luck with your cases!

On Mon, Aug 26, 2024, 21:06 joe-rodden1 @.***> wrote:

Hello,

Just want to update that I've gotten my hands on a CPLEX license and have gotten this working for various investment cost assumptions between 75k and 125k/MW-yr. Below that, I'm still getting errors but I have a feeling that's because there are no maximum capacity constraints in the example case and when the resource gets cheap enough, it wants to build it in infinite amounts. I will play around with more reasonable constraints but feel free to close this out for now.

Thanks for all your help.

Joe

Joe Rodden Co-founder & CEO Lydian ( https://www.lydianlabsinc.com/ ) 630-215-6597

On Mon, Aug 26, 2024 at 2:42 PM, Joe Rodden < @.*** > wrote:

Hi there,

I am looking at example case 2. The case runs totally fine as-is. However, the model doesn't solve when I simply reduce the energy demand and investment cost of the electrolyzer resources and increase the selling price (obviously from the energy consumption figure, this is no longer H2 but a generalized flexible asset). These are the only changes made. While I do not necessarily expect predictable/monotonic behavior in running these, I agree it's puzzling that just changing the costs and value would cause an infeasible.

Unfortunately I do not have Gurobi or CPLEX licenses and don't think I can use ComputeConflicts without them, unless my understanding is wrong.

(Run settings are for the successful case, obviously, but in case you need my system specs).

Thanks,

Joe

Joe Rodden Co-founder & CEO Lydian ( https://www.lydianlabsinc.com/ ) 630-215-6597

On Mon, Aug 26, 2024 at 8:13 AM, ql0320 < notifications@ github. com ( @.*** ) > wrote:

Hi @ joe-rodden1 ( https://github.com/joe-rodden1 ) , did you see those weird results from GenX example cases? If so, can you share the modified inputs you are using? I do not think changing costs assumptions would result in "no solution". Did you find your model infeasible? If so, can you add "ComputeConflicts: 1" to genx_settings.yml get the conflicts? Also, making the hydrogen price in Electrolyzer.csv higher and the investment cost lower does not necessarily lead to more electrolyzer capacity built because electrolyzers are built to meet hydrogen demand. Only when hydrogen prices are high enough that it has net revenue, the system may choose to build more electrolyzer capacity than what is needed to meet hydrogen demand.

— Reply to this email directly, view it on GitHub (

https://github.com/GenXProject/GenX.jl/issues/759#issuecomment-2310456180 ) , or unsubscribe (

https://github.com/notifications/unsubscribe-auth/BEWRZIPJUNFOND3TDLJ4IHDZTNAYHAVCNFSM6AAAAABM7KT5JSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJQGQ2TMMJYGA ). You are receiving this because you were mentioned. Message ID: <GenXProject/GenX . jl/issues/759/2310456180 @ github. com>

— Reply to this email directly, view it on GitHub https://github.com/GenXProject/GenX.jl/issues/759#issuecomment-2311375801, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALBIOTQX4PH3GUV7CWPRG7TZTPGLFAVCNFSM6AAAAABM7KT5JSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJRGM3TKOBQGE . You are receiving this because you commented.Message ID: <GenXProject/GenX .@.***>

lbonaldo commented 2 weeks ago

Thank you, @joe-rodden1, for opening this issue! I'm glad to hear the examples are running fine. I'll go ahead and close this issue as resolved for now.