Open oum96-mah opened 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
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.
./inputs/timeseries
and test_site.csv
for your electricty price timeseries maingrid_electricity_price
on tab input_constants
from /kWh
to float in /kWh or title of timeseries in input file with each value in /kWh
maingrid_electricity_price
as a string, and see where it gives you an error message (that is where you need to change code)maingrid_electricity_price
to both be a string or a float: If it is a value, then use that, if it is a string, parse as stringtitle_pv
etc. to parse the new column. For this, the approach b) would be a bit easier, as then you could simple add a title_maingrid_electricy_price
in https://github.com/rl-institut/offgridders/blob/90d22741d7b4c977966ec9a2a0aacc0f909efcf0/src/B_read_from_files.py#L532 in this list https://github.com/rl-institut/offgridders/blob/90d22741d7b4c977966ec9a2a0aacc0f909efcf0/src/B_read_from_files.py#L551-L558. Maybe it is easiest to create one or multiple new functions from the lines https://github.com/rl-institut/offgridders/blob/90d22741d7b4c977966ec9a2a0aacc0f909efcf0/src/B_read_from_files.py#L567 until the end of the function, this would also make writing pytests
easier and you could re-use existing functions.pandas.series
format at the end. pandas.series
as variable_cost
in https://github.com/rl-institut/offgridders/blob/9095014d054b26e1c0a02b51d237840e1b8e9ea6/src/G2a_oemof_busses_and_componets.py#L523 and pointofcoupling_consumption_oem
. https://github.com/rl-institut/offgridders/blob/9095014d054b26e1c0a02b51d237840e1b8e9ea6/src/G2a_oemof_busses_and_componets.py#L536-L537 and https://github.com/rl-institut/offgridders/blob/9095014d054b26e1c0a02b51d237840e1b8e9ea6/src/G2a_oemof_busses_and_componets.py#L562-L563 must result in a pandas.series
again.lp
file that can be exported pandas.series
maingrid_electricity_price
. This one and the one from the beginning must run though with Offgridders. If this becomes an issue, you could also generate an imaginative pandas.series
from the scalar value in the pre-processing steps.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.
As two simple benchmark tests, I would suggest the following:
maingrid_electricity_price
maingrid_electricity_price
as a scalar, that makes sure that sum(demand)*maingrid_electricity_price==costs calculated by Offgridders
. This should already pass right now, but by creating the test you make sure that it still passes after you have introduced your changes.maingrid_electricity_price
is a timeseries, where you assess that sum(demand(t)*maingrid_electricity_price(t)) == costs calculated by Offgridders
. This will proove that your introduced algorithm works properly.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.
Hi. I have a variable electricity price for my project site. Is there a method to switch from fixed to variable price?