Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit demand response peak load #484

Open
wants to merge 62 commits into
base: main
Choose a base branch
from

Conversation

Manish-Khanra
Copy link
Contributor

@Manish-Khanra Manish-Khanra commented Nov 16, 2024

Pull Request

Related Issue

Closes #[issue number] (if applicable)

Description

Changes Proposed

Implementation of Flexibility Measures:

  1. Cost-Based Load Shifting: Optimize operations to minimize variable costs while considering load-shifting capabilities.
  2. Congestion Management Flexibility: Adjust operations based on grid congestion signals to reduce congestion at critical nodes.
  3. Peak Load Shifting: Curtail demand during peak load periods to adhere to capacity constraints and improve grid stability.
  4. Renewable Utilisation: Align operational load increases with renewable energy availability to enhance grid sustainability.
  5. Deprecated indexing warnings for pd.Series and replaced with .iloc.

Testing

Individual test fixtures for each flexibility measure.

Checklist

Please check all applicable items:

  • Code changes are sufficiently documented (docstrings, inline comments, doc folder updates)
  • New unit tests added for new features or bug fixes
  • Existing tests pass with the changes
  • Reinforcement learning examples are operational (for DRL-related changes)
  • Code tested with both local and Docker databases
  • Code follows project style guidelines and best practices
  • Changes are backwards compatible, or deprecation notices added
  • New dependencies added to pyproject.toml
  • A note for the release notes doc/release_notes.rst of the upcoming release is included
  • Consent to release this PR's code under the GNU Affero General Public License v3.0

Additional Notes (if applicable)

[Any additional information, concerns, or areas you want reviewers to focus on]

Screenshots (if applicable)

[Add screenshots to demonstrate visual changes]

nick-harder and others added 30 commits October 17, 2024 16:24
-convert DST to classes
-add residential components
-add new tests
-refactor code
-add dst_componnets to the world
-adjust notebook 10
-fix docstrings
-remove unrequired dst base class
-add operationl_cost constraints to heatpump, boiler, and PV
-revise all tests and add complete tests for each DST component
-remove common constraint definition outside
@kim-mskw
Copy link
Contributor

kim-mskw commented Nov 21, 2024

Discussion with @Manish-Khanra we used a big-M formulation to linearise the problem formulation. The second objective loop was reformulated to include the absolute values of the shift; otherwise, the objective value was forced to 0 due to the demand covering constraint, which led to arbitrary solutions.

Note that there are no costs included in the second objective loop, leading to multiple possible solutions with the same absolute load shift that does not violate the cost increase constraints. Hence, different solvers will most likely result in different solutions.

image

Copy link

codecov bot commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 92.27642% with 19 lines in your changes missing coverage. Please review.

Project coverage is 77.05%. Comparing base (44fb0fc) to head (dc34ee9).

Files with missing lines Patch % Lines
assume/units/dsm_load_shift.py 94.77% 7 Missing ⚠️
assume/common/forecasts.py 92.75% 5 Missing ⚠️
assume/strategies/naive_strategies.py 0.00% 3 Missing ⚠️
assume/units/hydrogen_plant.py 75.00% 2 Missing ⚠️
assume/units/steel_plant.py 93.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #484      +/-   ##
==========================================
+ Coverage   76.54%   77.05%   +0.51%     
==========================================
  Files          51       51              
  Lines        6863     7026     +163     
==========================================
+ Hits         5253     5414     +161     
- Misses       1610     1612       +2     
Flag Coverage Δ
pytest 77.05% <92.27%> (+0.51%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Manish-Khanra and others added 7 commits November 26, 2024 14:42
-remove changes in example.py
-refactor csv forecaster for better usability
-revise hinting in csvforecaster
-remove unused code
-fix naming of strategies
-fix tests
-small changes
Copy link
Member

@nick-harder nick-harder left a comment

Choose a reason for hiding this comment

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

@Manish-Khanra I have fixed several things and streamlined the code. Everything is fine, but there are some things you should address before we can merge this into main

@@ -98,15 +104,38 @@ def __init__(
self.lime_price = self.forecaster.get_price("lime")
self.co2_price = self.forecaster.get_price("co2")

# Calculate congestion forecast and set it as a forecast column in the forecaster
self.congestion_signal = self.forecaster["east_congestion_severity"]
Copy link
Member

Choose a reason for hiding this comment

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

these ones are hard coded into the steel plant, which is not ideal. This should not be the case for a general class

Copy link
Member

Choose a reason for hiding this comment

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

Please check the whole code for such hard coded parts

"log_to_console": False,
"LogToConsole": 0,
}
# Apply the flexibility function based on flexibility measure
Copy link
Member

Choose a reason for hiding this comment

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

this has been adapted, please check if correct

"LogToConsole": 0,
}
# Apply the flexibility function based on flexibility measure
if self.flexibility_measure in DSMFlex.flexibility_map:
Copy link
Member

Choose a reason for hiding this comment

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

this has been adapted, please check if correct

@@ -91,6 +91,7 @@
},
"large_2019_rl": {"scenario": "example_03a", "study_case": "base_case_2019"},
"large_2021_rl": {"scenario": "example_03b", "study_case": "base_case_2021"},
"experiment": {"scenario": "experiment", "study_case": "dst_flexibility_case"},
Copy link
Member

Choose a reason for hiding this comment

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

experiment is not the best name for the example. maybe use the example_01 form or add the data to one of the existing examples? for example from your tutorial? I believe we don't need this extra folder

@nick-harder
Copy link
Member

@Manish-Khanra also please complete the PR form above

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.

Implicity and Explicit DSM
4 participants