Skip to content

Patch/precision limit to 10e 6#791

Merged
smartie2076 merged 9 commits intodevfrom
patch/precision_limit_to_10e-6
Feb 15, 2021
Merged

Patch/precision limit to 10e 6#791
smartie2076 merged 9 commits intodevfrom
patch/precision_limit_to_10e-6

Conversation

@smartie2076
Copy link
Copy Markdown
Collaborator

@smartie2076 smartie2076 commented Feb 8, 2021

Fix #523
Fix #768

We had issues with the SOC being out of bounds with [0,1] and marginal negative flows. This PR fixes both issues. The marginal negative flows are rounded to 0 (threshold: -10^-6), large negative values raise a warning and are unchanged. Marginal positive flows (reason for SOC out of bounds) are also rounded to 0.

Compared to SOC in #768, you can see that in the now created simulation_report.pdf the SOC is always 0.

Changes proposed in this pull request:
[x] Add precision issue in RTD
[x] Function E1.cut_below_pico to round decision variables (capacities, flows) below threshold of plus/minus 10^-6 to 0, add warnings if negative value larger then threshold (invalid result). Includes pytests (#)
[x] Call E1.cut_below_pico in E1.get_flows, E1.get_optimal_cap and E1.get_storage_results (#)

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)

@smartie2076 smartie2076 added bug Something isn't working enhancement New feature or request labels Feb 8, 2021
@smartie2076
Copy link
Copy Markdown
Collaborator Author

@SabineHaas I did not run the pytests for everything yet, but it is ready for review. What do you think in general about rounding the oemof results? Is this something acceptable?

@TheOneAndra FYI. Can you read though the Model_Assumptions.rst and check if what I wrote is easy to understand?

Copy link
Copy Markdown
Collaborator

@Bachibouzouk Bachibouzouk left a comment

Choose a reason for hiding this comment

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

In the text replace lower/smaller then by lower/smaller than
Not completely done reviewing, but Ive got meetings so I'll finish later

Copy link
Copy Markdown
Contributor

@SabineHaas SabineHaas left a comment

Choose a reason for hiding this comment

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

@SabineHaas I did not run the pytests for everything yet, but it is ready for review. What do you think in general about rounding the oemof results? Is this something acceptable?

Yes, I understand the problem and find the rounding acceptable.

smartie2076 and others added 9 commits February 15, 2021 14:07
- Write function both for scalar values as well as for pd.Series. This evaluates all negative values and rounds the positive values below the threshold.
- Call the function when reading the decision variables for capacities and dispatch from the oemof results (changes `E1.get_storage_results()`, `E1.get_flow` and `E1.get_optimal_cap`
Co-authored-by: Pierre Francois <[email protected]>
Co-authored-by: Sabine Haas <[email protected]>
@smartie2076 smartie2076 force-pushed the patch/precision_limit_to_10e-6 branch from 6e4483f to 6f57ae6 Compare February 15, 2021 13:40
@smartie2076 smartie2076 merged commit fc8dff7 into dev Feb 15, 2021
@smartie2076
Copy link
Copy Markdown
Collaborator Author

I ran EXECUTE_TESTS_ON=master locally on my Ubuntu OS

@smartie2076 smartie2076 deleted the patch/precision_limit_to_10e-6 branch February 15, 2021 14:39
@smartie2076 smartie2076 mentioned this pull request Apr 14, 2021
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] SoC of storage has values greater than 1 [Bug] Marginal negative capacities or flows

4 participants