Skip to content

Draft: Rl strategy for household #476

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

Merged
merged 128 commits into from
Dec 23, 2024

Conversation

HafnerMichael
Copy link
Collaborator

Pull Request

Related Issue

Closes #[issue number] (if applicable)

Description

[Provide a brief description of the changes in this PR]

Changes Proposed

  • [List the main changes or features implemented]

Testing

[Describe the testing you've done, including any specific test cases or scenarios]

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]

@HafnerMichael HafnerMichael force-pushed the RL-strategy-for-household branch 2 times, most recently from 2abd633 to ecb724c Compare November 9, 2024 14:24
@HafnerMichael HafnerMichael force-pushed the RL-strategy-for-household branch from ecb724c to 9822337 Compare November 10, 2024 09:20
@HafnerMichael HafnerMichael force-pushed the RL-strategy-for-household branch from f28b5c3 to d095806 Compare November 10, 2024 12:28
@HafnerMichael
Copy link
Collaborator Author

HafnerMichael commented Nov 10, 2024

@nick-harder I created a draft PR for you to have a overview of what I changed for the household.
Just a short summary:

  • I adapted the Building class for the RL strategy (added execute_current_dispatch and set_dispatch_plan) <- no test written so far (I dont want to have double work since Manish needs to write the building tests anyways and after that I can adapt my cases) but existing code and logic got used from the storage unit
  • Added a RL strategy for the building unit. (Logic got tested)
  • I added also a new action which determines the amount of charge/discharging. If everything is working then, I also have an idea to add another action for the PV amount, therefore also the producers can adapt there produced amount. But not sure for now if this will be still part of my thesis.

But I face/faced two issues:

  1. If I run the code the following error occurs in the learning_unit_operator:
    image
    The simulation does not crash but somehow something is wrong here...
    ✅ Solved, but not sure if it was an issue on my side or if it is a general issue.
  2. First I wanted to run a simulation (EEGH_2024_single_storage) where only one household follows the RL strategy and all the others optimize via the simple strategy that should be a valid scenario right? But if it comes to training, somehow the components of a building get initialized wrong. I get an error that the components dict cannot be accessed anymore since there is not the structure e.g {pv_plant: dict} it is now {pv_plant: PVPlant} in the init of a building. Therefore i get an AttributeError in the init of a building because the existing logic does not work anymore. I debugged it already a bit but stopped it since I don't know if my scenario is even valid or not. The only thing I found out is, that only those buildings, wich do not follow the RL_strategy get initialized wrongly and the rl strategy one still has the components as dict in it. I now test the RL_strategy with all households but I thought it should be possible to mix strategies of households or is that not possible?

maurerle and others added 3 commits November 11, 2024 08:53
This should be merged on monday.
This patch release fixes removing previous runs from the database.

see #478
@HafnerMichael HafnerMichael force-pushed the RL-strategy-for-household branch from 5ceb5b3 to 0ec28cc Compare November 12, 2024 18:33
@HafnerMichael HafnerMichael mentioned this pull request Nov 13, 2024
10 tasks
@HafnerMichael HafnerMichael force-pushed the RL-strategy-for-household branch from a8c01fc to dd8d9fe Compare November 17, 2024 18:27
HafnerMichael and others added 7 commits December 12, 2024 08:41
-improve handling of assumeException (when the overwrite strategies question in learning is answered with a "n")
-do not access self.db before initializing the engine in on_ready
-remove unrequired call for delete_similar_runs in run_learning function
-move episode init back into init of output role
-delete_similar_runs on start in output role when episode is 1
-clean up load_scenario_folder function as it doesn't require episode and other info any more
-remove not setting up the world when episode==1 since this error no longer occurs
-save last policies when exiting the loop to avoid confusion with numbering of last episode
-adjust tutorial 04 as well

Co-authored-by: Nick Harder <[email protected]>
@HafnerMichael HafnerMichael force-pushed the RL-strategy-for-household branch 3 times, most recently from f29a825 to 06527c0 Compare December 15, 2024 18:27
@HafnerMichael HafnerMichael force-pushed the RL-strategy-for-household branch from f4484c1 to 3aa12cb Compare December 16, 2024 06:09
@HafnerMichael HafnerMichael force-pushed the RL-strategy-for-household branch from 3aa12cb to 18320d7 Compare December 16, 2024 06:28
HafnerMichael and others added 7 commits December 16, 2024 08:27
… bids (#521)

Fixes the issue that a warning was raised when there were no accepted bids. This is normal behavior and should not raise a warning, as this can naturally happen. The warning is raised only of both accepted and
rejected are empty
@HafnerMichael HafnerMichael force-pushed the RL-strategy-for-household branch from 2d4e611 to 775bc06 Compare December 21, 2024 14:52
@HafnerMichael HafnerMichael merged commit 27837f5 into michael_thesis Dec 23, 2024
1 check was pending
@HafnerMichael HafnerMichael deleted the RL-strategy-for-household branch February 2, 2025 07:35
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.

8 participants