Skip to content

Fix DHW, heating, and cooling storage update bugs (issue #156)#157

Open
LorenzoBonanni wants to merge 1 commit intonagyzoltan:masterfrom
LorenzoBonanni:master
Open

Fix DHW, heating, and cooling storage update bugs (issue #156)#157
LorenzoBonanni wants to merge 1 commit intonagyzoltan:masterfrom
LorenzoBonanni:master

Conversation

@LorenzoBonanni
Copy link

Description

This pull request fixes multiple bugs in building.py related to incorrect energy calculations for thermal storage devices (DHW, heating, and cooling).
These bugs prevent correct storage charging/discharging behavior and can result in constant zero SOC values, especially for the DHW tank when heating_storage is disabled.

The changes correct the use of the appropriate storage device in the computation of energy flows and ensure consistent handling of the algorithm_action_based_time_step_hours_ratio factor.

Issue

Fixes: #156

Changes

This PR introduces the following fixes:

1. Fix in update_dhw_storage

Incorrect line:

energy = action * self.heating_storage.capacity * self.algorithm_action_based_time_step_hours_ratio

This prevented DHW storage from charging because heating_storage.capacity is 0 when heating storage is disabled.

Corrected to:

energy = action * self.dhw_storage.capacity * self.algorithm_action_based_time_step_hours_ratio

2. Fix in update_heating_storage

Incorrect line (used cooling storage):

energy = action * self.cooling_storage.capacity * self.algorithm_action_based_time_step_hours_ratio

Corrected to use the proper storage device:

energy = action * self.heating_storage.capacity * self.algorithm_action_based_time_step_hours_ratio

3. Fix in update_cooling_storage

Missing time-step scaling factor.
Previous code:

energy = action * self.cooling_storage.capacity

Corrected to:

energy = action * self.cooling_storage.capacity * self.algorithm_action_based_time_step_hours_ratio

Screenshots

Checklist

  • I have tested the changes locally and they work as intended.
  • I have updated the documentation, if applicable.
  • I have added new tests, if applicable.
  • I have followed the project's code style and conventions.

Additional notes

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] DHW Storage is never used

1 participant