Skip to content

Allow parameters to be defined as timeseries for storage assets#720

Merged
MaGering merged 12 commits intodevfrom
fix/C0_storage_time_series
Dec 18, 2020
Merged

Allow parameters to be defined as timeseries for storage assets#720
MaGering merged 12 commits intodevfrom
fix/C0_storage_time_series

Conversation

@MaGering
Copy link
Copy Markdown
Collaborator

@MaGering MaGering commented Dec 16, 2020

Fix #719

With this PR it is possible to process a time series of the Storage component passed in storage_*.csv.

In energyStorage(...) of C0_data_processing.py the key 'value' leads to an error because it does not exists before the time series is read. I therefore replaced it with another condition, which is analogous to the parameter 'efficiency' of the Transformer component and adapted it accordingly:

(
FILENAME in dict_values[group][asset][subasset][parameter]
and HEADER in dict_values[group][asset][subasset][parameter]
):

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)

Please mark above checkboxes as following:

  • Open
  • Done

❌ Check not applicable to this PR

For more information on how to contribute check the CONTRIBUTING.md.

@MaGering MaGering requested a review from smartie2076 December 16, 2020 11:13
@MaGering
Copy link
Copy Markdown
Collaborator Author

Unfortunately one check is failing. Do I need to have python 3.8 installed? I don't really understand the error message. Could you give me a hint @smartie2076?

@smartie2076
Copy link
Copy Markdown
Collaborator

smartie2076 commented Dec 16, 2020

Hi @MaGering!

As a tip, instead of writing

Fix #Issue #719 [as a link]

Please write

Fix #719

(It seems that github understands that you want to mention the issue, but it does not connect those two in this fashion. Also, by writing Fix #issue and only then the number, the issue will not be closed automatically.

@MaGering
Copy link
Copy Markdown
Collaborator Author

Hi @MaGering!

As a tip, instead of writing

Fix #Issue #719 [as a link]

Please write

Fix #719

(It seems that github understands that you want to mention the issue, but it does not connect those two in this fashion. Also, by writing Fix #issue and only then the number, the issue will not be closed automatically.

Oh right! Thanks for this advise. I will change that!

- Exception needs to be tested
- Changed `energyStorage.csv`
- Added `storage_1.csv`
- Added column in `parameter_timeseries`
@smartie2076
Copy link
Copy Markdown
Collaborator

I am checking locally now if that fix works.

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 works as a quick fix for the issue. However, this is not really the proper way to do it - we would need to change A1 for that.

Current result:

"soc_min": {
    "file_name": "parameter_timeseries.csv",
    "header": "soc_min",
    "unit": "factor",
    "value": [...]
},

filename, unit and header should, however, be wrapped within value as an output of A1. As this is more work, we can leave it at that right now.

Necessary is, however, that you create a CHANGELOG.md entry. Please onle make your PR ready to merge/review green if you are sure it can be merged (see checklist), ie. initially always create a draft pull request.

Will request a PR into this one with additions.

@MaGering
Copy link
Copy Markdown
Collaborator Author

This works as a quick fix for the issue. However, this is not really the proper way to do it - we would need to change A1 for that.

Current result:

"soc_min": {
    "file_name": "parameter_timeseries.csv",
    "header": "soc_min",
    "unit": "factor",
    "value": [...]
},

filename, unit and header should, however, be wrapped within value as an output of A1. As this is more work, we can leave it at that right now.

I must admit I don't quite understand this. I checked for the Transformer's (heat pump) efficiency and it's the same structure there:
heat_pump_efficiency

What you can see in the picture is, that filename, unit and header are not wrapped within value either. For solving this in future I think it is important to find out if it is a general issue for every group or specific for Transformer and Storage.

However I'm glad that I can work with this solution for now. :)

@smartie2076
Copy link
Copy Markdown
Collaborator

This works as a quick fix for the issue. However, this is not really the proper way to do it - we would need to change A1 for that.
What you can see in the picture is, that filename, unit and header are not wrapped within value either. For solving this in future I think it is important to find out if it is a general issue for every group or specific for Transformer and Storage.

Oh, really?! Then I might have been mistaken. Even better!

@MaGering MaGering requested a review from smartie2076 December 17, 2020 16:16
@smartie2076 smartie2076 changed the title Fix KeyError: 'value' if times series is passed Allow parameters to be defined as timeseries for storage assets Dec 18, 2020
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.

Ready to be merged :)

Comment on lines +354 to +356
if parameter in dict_values[group][asset][subasset] and (
FILENAME in dict_values[group][asset][subasset][parameter]
and HEADER in dict_values[group][asset][subasset][parameter]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Usually, I would request a pytest to be created for this case. As this feature is covered with the benchmark test I created, and C0 functions are anyway lacking pytests, this is fine.

@smartie2076 smartie2076 mentioned this pull request Dec 18, 2020
1 task
@MaGering MaGering merged commit 4fcdb51 into dev Dec 18, 2020
@MaGering MaGering deleted the fix/C0_storage_time_series branch December 18, 2020 14:06
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.

[Bug] Storage component can not process time series

2 participants