rl-institut / offgridders

Models and optimizes capacity & dispatch of electricity supply systems, off-grid or connected to a (weak) central grid
GNU General Public License v3.0
21 stars 9 forks source link

Implement a variable electricity import price #170

Open oum96-mah opened 2 years ago

oum96-mah commented 2 years ago

Hi. I have a variable electricity price for my project site. Is there a method to switch from fixed to variable price?

smartie2076 commented 2 years ago

Hi @oum96-mah! Sadly, it is not possible to define an electricity provide with an electricity price based on the hour of the year. If you have coding experience, you could introduce this feature. Otherwise, I would recommend to check out the not-as-user-friendly Multi Vector Simulator (https://github.com/rl-institut/multi-vector-simulator/). There, you can define your energy system via csv files, and also define specific parameters (like efficiencies, dispatch prices and energy prices) as a timeseries.

Related to #169

smartie2076 commented 2 years ago

Here is a list of what would need to be done to implement a variable electricity (import) price. Variable or function names are suggestions and might be improved on, looking at existing naming conventions.

There are two options: a) Push offgridders to accept both string and float for maingrid_electricity_price b) Properly define a new parameter in case_definitions, eg. maingrid_electricity_price_is_fix== FALSE / TRUE, and depending on that require a title_maingrid_electricity_price in project_sites or not.

I explain the option a) here now, as it works well if you have a pilot site that has a variable price, or does not. The scenarios are not based on the electricity price timeseries (ie. focussing on sizing implications). If the focus was more on creating multiple cases applied to one test stite, where either the electricity price was variable or it was not (ie. impact assessment of that) then b) would be better.

smartie2076 commented 2 years ago

I highly recommend creating pytest unit-tests along the way to test if what you want to change is working or not, ie. for the different functions that you are changing.

smartie2076 commented 2 years ago

As two simple benchmark tests, I would suggest the following:

The actual values of the demand or electricity price timeseries (as long as they are not 0 all the time) does not matter. You can limit the evaluated timeframe to a day or a week, as we are not dealing with a plausibility test of renewables here.

You would probably create two duplicates of \tests\inputs and its contents for this in the test folder, and those contain the inputs to the benchmark test. You can add a new file test_benchmark_maingrid_electricity_price.py to the test folder to write the benchmark tests.