Change algebraic sign of feed-in tariff in input files + benchmark test#670
Change algebraic sign of feed-in tariff in input files + benchmark test#670SabineHaas wants to merge 7 commits intodevfrom
Conversation
|
Plans for feed-in benchmark test:
This could be added e.g. to AB_grid_PV but could also be a new benchmark test - how do you usually handle this / do you have an opinion about where to place the test @smartie2076 ? |
|
Yeah, your planned changes sound good. You might have to change PFs benchmark test (#613) as well with the feedin - but it can also be that no feed in occurs in that scenario.
Yes, that is a good one. Please include an assertion for the costs part as well as for the timeseries.
Good
Yeah, but also you could check
Make it a seperate benchmark test anyway. I dream of aggregating the DSO cost at some point (currently all peak demand pricing months are seperate), and then we can join it there. Do you plan to do an investment optimization as well or only a dispatch optimization? |
…atch and invest optimization
… feedin tariff + tests
|
@smartie2076 @Bachibouzouk I'm facing an issue with the benchmark test for renewable constraint (
|
smartie2076
left a comment
There was a problem hiding this comment.
Hi @SabineHaas! I actually moved some functions around because I think we should not mess with the value of the feedin tariff in energy providers. With my solution, I also have no issues with the benchmark test for the minimal renewable share. Please check #685 for my proposal (based on this branch).
|
|
||
|
|
||
| def change_sign_of_feedin_tariff_to_minus(dict_values): | ||
| r""" | ||
| Change the sign of the feed-in tariff to minus. | ||
|
|
||
| Additionally, prints a logging.warning in case of the feed-in tariff is entered as | ||
| negative value to 'energyProviders.csv'. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| dict_values: dict | ||
| All input data in dict format | ||
|
|
||
| Returns | ||
| ------- | ||
| Updated `dict_values`. | ||
| """ | ||
| # check feed-in tariff of each provider | ||
| for provider, provider_dict in dict_values[ENERGY_PROVIDERS].items(): | ||
| feedin_tariff = provider_dict[FEEDIN_TARIFF][VALUE] | ||
| # change sign of feed-in tariff and add a info msg in case it was positive and | ||
| # a warning msg in case it was negative as might have been meant to be a | ||
| # negative feed-in tariff. | ||
| if feedin_tariff > 0: | ||
| logging.info( | ||
| f"The {FEEDIN_TARIFF} of {provider} has been changed to a negative value, which means to earn money by feeding into the grid." | ||
| ) | ||
| elif feedin_tariff < 0: | ||
| logging.warning( | ||
| f"The {FEEDIN_TARIFF} of {provider} has been changed to a positive value, which means to pay for feed-in to the grid. If you intended the value to be negative (earning) please set a positive value." | ||
| ) | ||
| else: | ||
| pass | ||
| dict_values[ENERGY_PROVIDERS][provider][FEEDIN_TARIFF].update( | ||
| {VALUE: -feedin_tariff} | ||
| ) |
There was a problem hiding this comment.
I thought that one would use this part of the code to influence how the minus is interpreted:
# define feed-in sink of the DSO
define_sink(
dict_values=dict_values,
asset_key=dso + DSO_FEEDIN + AUTO_SINK,
price=dict_values[ENERGY_PROVIDERS][dso][FEEDIN_TARIFF],
inflow_direction=dict_values[ENERGY_PROVIDERS][dso][INFLOW_DIRECTION],
specific_costs={VALUE: 0, UNIT: CURR + "/" + UNIT},
energy_vector=dict_values[ENERGY_PROVIDERS][dso][ENERGY_VECTOR],
)
This would change it to the wanted behaviour:
# define feed-in sink of the DSO
define_sink(
dict_values=dict_values,
asset_key=dso + DSO_FEEDIN + AUTO_SINK,
price=-dict_values[ENERGY_PROVIDERS][dso][FEEDIN_TARIFF],
inflow_direction=dict_values[ENERGY_PROVIDERS][dso][INFLOW_DIRECTION],
specific_costs={VALUE: 0, UNIT: CURR + "/" + UNIT},
energy_vector=dict_values[ENERGY_PROVIDERS][dso][ENERGY_VECTOR],
)
I think this is also better, because we would otherwise change the data that we receive from the EPA to something else.
Have you checked with this what happens with the revenue stream or anything? Otherwise we need to check it in #613.
| feedin_tariff = dict_values[ENERGY_PROVIDERS][provider][FEEDIN_TARIFF] | ||
| electricity_price = dict_values[ENERGY_PROVIDERS][provider][ENERGY_PRICE] | ||
| diff = feedin_tariff[VALUE] - electricity_price[VALUE] | ||
| diff = electricity_price[VALUE] - abs(feedin_tariff[VALUE]) |
There was a problem hiding this comment.
If you have to pay for feed-in, ie. in your csv file you enter a negative value, and use abs() here, having to pay a lot for feedin into the grid (ie. more than if you buy electricity) would suggest an infeasible problem. This problem, however, is solvable: oemof would try to route everything into excess sinks instead.
With my above suggestion from above (changing sign when defining source only), this change could be dropped.
| diff = electricity_price[VALUE] - abs(feedin_tariff[VALUE]) | |
| diff = feedin_tariff[VALUE] - electricity_price[VALUE] |
| diff = electricity_price[VALUE] - abs(feedin_tariff[VALUE]) | ||
| if isinstance(diff, float) or isinstance(diff, int): | ||
| if diff > 0: | ||
| if diff < 0: |
There was a problem hiding this comment.
Dropped as suggested above
| if diff < 0: | |
| if diff > 0: |
| else: | ||
| boolean = [ | ||
| k > 0 for k in diff.values | ||
| k < 0 for k in diff.values |
There was a problem hiding this comment.
Dropped as suggested above:
| k < 0 for k in diff.values | |
| k > 0 for k in diff.values |
Fix #610
Changes proposed in this pull request:
dict_valuesinC0.all()C1.check_feedin_tariff()to changesThe following steps were realized, as well (if applies):
black . --exclude docs/)EXECUTE_TESTS_ON=master pytest)Please mark above checkboxes as following:
❌ Check not applicable to this PR
For more information on how to contribute check the CONTRIBUTING.md.