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
273 stars 117 forks source link

Scenarios on GenX #148

Open fnbillimor opened 2 years ago

fnbillimor commented 2 years ago

Hello - I just wanted to check in on whether GenX has the functionality to incorporate multiple scenarios (i.e. weather-years with different wind/solar/demand)? Of course I could include multiple years of such data in Generator_Variability, but this I presume would intertemporally link the years.

Looking at the prior queries, not convinced I have the right forum to ask functional questions, so if there is another forum this question is better placed in please let me know.

Thanks

sambuddhac commented 2 years ago

@fnbillimor You can run sensitivity analysis with GenX by creating different scenarios. Please check out and test run the GenX/Example_Systems/MethofMorrisExample/OneZone which uses the code in src/additional_tools/method_of_morris.jl. This kind of multiple scenario sensitivity analysis uses the Method of Morris. But, currently, GenX doesn't model the stochastic scenarios with probability weights. @nspatank can tell you more on Method of Morris, and @JesseJenkins can tell you more on both Method of Morris as well as what future plans we have for scenario consideration in GenX.

JesseJenkins commented 2 years ago

@fnbillimor https://github.com/fnbillimor I am unclear if you are interested in running GenX multiple times with different weather years (doable now), selecting representative time periods that could represent multiple weather years (possible with some relatively easy modification of our time domain reduction scripts), or implement a stochastic optimization with probability distributions for scenarios spanning multiple weather years (doable for sure but would take time to implement a stochastic version of GenX). Let me know which you had in mind and we can discuss further...

Jesse Jenkins, PhD


@.***

Twitter: @JesseJenkins http://twitter.com/jessejenkins LinkedIn: jessedjenkins http://linkedin.com/in/jessedjenkins

On Mon, Feb 21, 2022 at 6:53 PM Chakrabarti, Sambuddha (Sam) < @.***> wrote:

@fnbillimor https://github.com/fnbillimor You can run sensitivity analysis with GenX by creating different scenarios. Please check out and test run the GenX/Example_Systems/MethofMorrisExample/OneZone which uses the code in src/additional_tools/method_of_morris.jl. This kind of multiple scenario sensitivity analysis uses the Method of Morris. But, currently, GenX doesn't model the stochastic scenarios with probability weights. @nspatank https://github.com/nspatank can tell you more on Method of Morris, and @JesseJenkins https://github.com/JesseJenkins can tell you more on both Method of Morris as well as what future plans we have for scenario consideration in GenX.

— Reply to this email directly, view it on GitHub https://github.com/GenXProject/GenX/issues/148#issuecomment-1047304695, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPYTSF7TUJQ7ES36CP2TYDU4LGAJANCNFSM5O7ZHA4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

fnbillimor commented 2 years ago

@JesseJenkins - Thanks for the response. To clarify, I am interested in a mean-CVAR optimisation of system costs, which would attach probabilities to scenarios across multiple weather years, so the last option would be the focus. Happy to discuss further.

JesseJenkins commented 2 years ago

If this is something you are interested in/have time to implement, it is fairly straightforward (happy to discuss how), and would be a welcome addition to the GenX suite.

On Mon, Feb 21, 2022, 8:40 PM fnbillimor @.***> wrote:

@JesseJenkins https://github.com/JesseJenkins - Thanks for the response. To clarify, I am interested in a mean-CVAR optimisation of system costs, which would attach probabilities to scenarios across multiple weather years, so the last option would be the focus. Happy to discuss further.

— Reply to this email directly, view it on GitHub https://github.com/GenXProject/GenX/issues/148#issuecomment-1047347105, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPYTSA7ORLGVYL4G27F6S3U4LSRXANCNFSM5O7ZHA4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

sambuddhac commented 2 years ago

@JesseJenkins and @fnbillimor , interested to be part of this discussion. And would be very much interested to collaborate/review/test/develop this kind of risk metric calculation. Please keep me posted.

fnbillimor commented 2 years ago

Yes, I do have some time, and would be great to chat to understand how this could be implemented.

DanielNavia1 commented 2 years ago

Hi,

I have done some very preliminary coding to allow allows GenX to read S simulated paths, where each path has T years, and each of this year/path combinations corresponds to a set of generators_data, generators_variability (reflecting weather year), fuel_prices and load_data. I am using this to do financial risk analysis of European investments in the National Energy and Climate Plans. The inputs are pre-generated by Matlab as CSV files using Renewables Ninja data and other sources. Still very preliminary, and my coding abilities are far from decent, but just in case it helps.

sambuddhac commented 2 years ago

@DanielNavia1 .... can you please send us your email here? I am interested and curious to learn more about your approach.

DanielNavia1 commented 2 years ago

@sambuddhac I sent my email to your gmail account. Quick summary of how I do this follows, but as I said this is still very preliminary!

For every year t, I run S simulations. Each simulation corresponds to a randomly chosen weather year (for generator_variability and also for load_data (profile, the scale is driven by a different module) as well as a randomly simulated commodity fuel price vector (again generated in a different module). The data for each simulation in the standard csv files, appended in columns parallel to the ones in a standard run of the model. I am using Matlab to generate the csv files, out of convenience because it is what I am using for the econometrics. Matlab choses years randomly (or a sequence of them, in some of my configurations) for weather, and writes the csv files with this arrangement.

For example, in a 1 zone model load_data.csv would have S-1 additional columns, one for each of the S-1 additional simulations and each logically showing the 8760 hourly loads for that simulation. If there were two zones, I would have an additional 2*S columns, etc. Same for generator_variability, but here at the current stage I have repeated sets of all generators-zone names, even those that are not variable (far from the most efficient way to do this). Same with fuels.

On Run.jl, with S being the number of simulations, what I basically do is:

1) Calls to load_inputs return several auxiliary dicts for the SZ loads, SG generators, and the S*fuels. So something like:

myinputs,myloads,my_genvars,my_fuelprices= load_inputs(mysetup, inpath)

I have modified load_load_data.j, load_generators_variability.jl, etc. to do this.

2) For each iteration (simulation), the corresponding section of myinputs is changed. So for example at iteration r, I have myinputs["PD"]=myloads["pD"][:,r:r+myinputs["Z"]-1] and I would read an additional Z loads from the my_loads dict.

3) Solve the model for the data just loaded. Nothing changes here because myinputs is a valid input, only it is different at each iteration.

4) Get the output. I am not interested in many of the output files the program generates automatically, and it is more convenient for me to get the outputs that I am interested as a "panel data" type of file. I just stack the output of each of the simulations (very clumsily, if you see the code).

5) After doing the S simulations, I would repeat for the next year. In my current version, this involves running some stuff outside GenX (basically because I use the resulting prices in dynamic models of electricity demand, and I am doing that with Matlab). Matlab does his calculations and then generates another S simulations for the next year, which would be fed into GenX until the final year is reached.

I attached a copy of a Run.jl (this one is only for load variability across simulations, not year, no Matlab...hopefully easier to understand) and the modified load_data in my email (my Github abilities are very limited). As I said, these were just some tests I did and it is not optimised for performance (and I am not a coder at all). I used these test runs just to check this was feasible and potentially prepare to ask for larger server, which I will need to do in any event.

Best

Daniel

DanielNavia1 commented 2 years ago

And just to clarify, I don't do stochastic optimisation at this stage. In fact, my focus is on the yearly economic dispatch for almost predetermined investments. Sorry if this was not clear in my post, I may have confused you.

Daniel