Skip to content

Commit

Permalink
Merge pull request #923 from ie3-institute/df/#922-Fix-activation-of-…
Browse files Browse the repository at this point in the history
…Hp-when-not-under-control-of-an-EM

Fix activation of Hp when not under control of an EM
  • Loading branch information
sebastian-peter authored Aug 29, 2024
2 parents b870fe7 + 19ac89d commit 67ad290
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixing duration calculation in result events [#801](https://github.com/ie3-institute/simona/issues/801)
- Handle MobSim requests for current prices [#892](https://github.com/ie3-institute/simona/issues/892)
- Fix determineState of ThermalHouse [#926](https://github.com/ie3-institute/simona/issues/926)
- Fix activation of Hp when not under control of an EM [#922](https://github.com/ie3-institute/simona/issues/922)

## [3.0.0] - 2023-08-07

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,26 @@ trait HpAgentFundamentals
currentTick,
updatedState,
)
val updatedBaseStateData =
baseStateData.copy(stateDataStore = updatedStateDataStore)

val updatedBaseStateData = {
updatedState.maybeThermalThreshold match {
case Some(nextThreshold)
if baseStateData.foreseenDataTicks.headOption.exists {
case (_, Some(tick)) => nextThreshold.tick < tick
case _ => false
} =>
baseStateData.copy(
stateDataStore = updatedStateDataStore,
additionalActivationTicks =
baseStateData.additionalActivationTicks ++ Set(nextThreshold.tick),
)
case _ =>
baseStateData.copy(
stateDataStore = updatedStateDataStore
)
}
}

updateValueStoresInformListenersAndGoToIdleWithUpdatedBaseStateData(
scheduler,
updatedBaseStateData,
Expand Down

0 comments on commit 67ad290

Please sign in to comment.