Skip to content

Feature/energy system max demand fulfillment #824

Merged
ciaradunks merged 13 commits intodevfrom
feature/energy_system_max_demand_fulfillment
Apr 6, 2021
Merged

Feature/energy system max demand fulfillment #824
ciaradunks merged 13 commits intodevfrom
feature/energy_system_max_demand_fulfillment

Conversation

@ciaradunks
Copy link
Copy Markdown
Contributor

@ciaradunks ciaradunks commented Mar 9, 2021

Fix #782

Changes proposed in this pull request:

The following steps were realized, as well (if applies):

  • Use in-line comments to explain your code
  • Write docstrings to your code (example docstring)
  • For new functionalities: Explain in readthedocs
  • Write test(s) for your new patch of code (pytests, assertion debug messages)
  • Update the CHANGELOG.md
  • Apply black (black . --exclude docs/)
  • Check if benchmark tests pass locally (EXECUTE_TESTS_ON=master pytest)

@ciaradunks ciaradunks changed the title Create function Feature/energy system max demand fulfillment Mar 9, 2021
@ciaradunks ciaradunks requested a review from smartie2076 March 9, 2021 14:59
Copy link
Copy Markdown
Collaborator

@smartie2076 smartie2076 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be really handy to have!

Some comments below

@smartie2076 smartie2076 requested a review from SabineHaas March 12, 2021 09:05
Copy link
Copy Markdown
Collaborator

@smartie2076 smartie2076 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closer to completion!

Notes:

  • I think there is an indentiation error in the check itself (you can try that out by defining two busses and defining the different options that the test can fail)
  • You can decrease the lines you have to write in the tests when you define the dict before the invidivual test functions, and then use deepcopy within

@ciaradunks
Copy link
Copy Markdown
Contributor Author

ciaradunks commented Mar 16, 2021

ToDo:

  • adapt test_check_energy_system_can_fulfill_max_demand_insufficient_capacities()
  • return peak_generation and peak_demand parameters in check_energy_system_can_fulfill_max_demand_insufficient_capacities()
  • adapt text in test_check_energy_system_can_fulfill_max_demand_insufficient_capacities() to include peak_demand and peak_generation values

This PR is almost complete. All tests are passing except test_check_energy_system_can_fulfill_max_demand_with_storage(). For some reason, it is still returning skip_check and opt_cap_storage as False even though dict_values[ENERGY_STORAGE][item][OPTIMIZE_CAP][VALUE] is True.

Copy link
Copy Markdown
Collaborator

@smartie2076 smartie2076 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You said this is almost ready for review - please remember to also update the changelog.md ;)

Can you also add your test in this section: https://multi-vector-simulator.readthedocs.io/en/latest/Model_Assumptions.html#input-verification

Copy link
Copy Markdown
Collaborator

@smartie2076 smartie2076 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an error message when I run ``:

  File "d:\pycharmprojects\mvs_eland\src\multi_vector_simulator\C1_verification.py", line 810, in check_energy_system_can_fulfill_max_demand
    dict_values[ENERGY_CONSUMPTION][item][DISPATCHABILITY][VALUE] is False:
KeyError: 'dispatchable'

This also results in my pytests not being started:

=========================================================================== short test summary info ============================================================================
ERROR tests/test_benchmark_scenarios.py - KeyError: 'dispatchable'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================================== 2 warnings, 1 error in 18.98s =========================================================================

@ciaradunks
Copy link
Copy Markdown
Contributor Author

@smartie2076 this is because dict_values[ENERGY_CONSUMPTION][item][DISPATCHABILITY] does not exist, even for the excess sinks. Does a demand always require a csv timeseries input? If so that could be the check instead e.g.:

        if item in dict_values[ENERGY_CONSUMPTION]:
            _# filename parameter only exists in demand dicts so filters out excess sinks_
            if FILENAME in dict_values[ENERGY_CONSUMPTION][item]:
                  peak_demand += dict_values[ENERGY_CONSUMPTION][item][TIMESERIES_PEAK][VALUE]

Let me know what you think or if I am mistaken.

@ciaradunks ciaradunks force-pushed the feature/energy_system_max_demand_fulfillment branch 11 times, most recently from c7b075d to 89fb30f Compare March 22, 2021 16:05
@ciaradunks ciaradunks marked this pull request as ready for review March 22, 2021 16:40
@ciaradunks ciaradunks force-pushed the feature/energy_system_max_demand_fulfillment branch from 89fb30f to 12ded73 Compare March 22, 2021 17:26
Copy link
Copy Markdown
Collaborator

@smartie2076 smartie2076 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two minor things, but also a bigger proposal I still need to add - I am sorry! The explaination is in the comments.

I ran the master tests locally, and all but the known FileExistsError tests ran though sucessfully.

Have you been able to produce the warning with specific input data? I just now have not been able to do that (I only get the simulation to terminate), but I am not sure why. My input file (tests/inputs) is pretty large however, so maybe I am overseeing something...

@ciaradunks ciaradunks force-pushed the feature/energy_system_max_demand_fulfillment branch from 89f756d to 2224f52 Compare March 23, 2021 14:31
@SabineHaas SabineHaas mentioned this pull request Mar 23, 2021
9 tasks
@ciaradunks ciaradunks force-pushed the feature/energy_system_max_demand_fulfillment branch from c6770e7 to 5692f1e Compare March 23, 2021 16:39
@ciaradunks
Copy link
Copy Markdown
Contributor Author

@smartie2076 now it is failing again, to do with the 'dispatchable' key... I havent got the chance to look in so much detail, but I can look on Thursday. Maybe keeping the check whether the 'dispatchable' key exists is still necessary. Asides from this, the next thing (and maybe final) to do is the benchmark test which I will look into as well on Thursday.

@ciaradunks ciaradunks force-pushed the feature/energy_system_max_demand_fulfillment branch 2 times, most recently from 5fd2ee8 to 7c3156e Compare March 29, 2021 11:55
@ciaradunks ciaradunks force-pushed the feature/energy_system_max_demand_fulfillment branch from 7c3156e to 85e6c82 Compare March 29, 2021 12:19
@ciaradunks
Copy link
Copy Markdown
Contributor Author

@smartie2076 I have merged the branch containing the fixes into this branch, and have created additional tests for dispatchable/non-dispatchable production assets. All tests have passed locally except I still get the windows errors in D0

@smartie2076
Copy link
Copy Markdown
Collaborator

Merged #844 previously into this branch.

Copy link
Copy Markdown
Collaborator

@smartie2076 smartie2076 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost ready to merge - small addition to the changelog needed and a list of all tests of the created function in its docstrings.

I am not sure if you did a merge error in C0 lines 1788 to 1794.

@ciaradunks ciaradunks force-pushed the feature/energy_system_max_demand_fulfillment branch 6 times, most recently from c178405 to e797008 Compare April 6, 2021 14:36
@ciaradunks ciaradunks force-pushed the feature/energy_system_max_demand_fulfillment branch from e797008 to c7192a4 Compare April 6, 2021 14:48
Copy link
Copy Markdown
Collaborator

@smartie2076 smartie2076 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One entry has to be added to the changelog, then ready to merge!

@ciaradunks ciaradunks force-pushed the feature/energy_system_max_demand_fulfillment branch from f56380d to abac09f Compare April 6, 2021 15:42
@ciaradunks ciaradunks merged commit fcc8ae5 into dev Apr 6, 2021
@ciaradunks ciaradunks deleted the feature/energy_system_max_demand_fulfillment branch April 6, 2021 15:47
@smartie2076 smartie2076 mentioned this pull request May 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add check that the energy system can fulfill the max demand

2 participants