diff --git a/CHANGELOG.md b/CHANGELOG.md index b43cb834c8..7af9619bda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -101,6 +101,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed FixedFeedModelSpec [#861](https://github.com/ie3-institute/simona/issues/861) - 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 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 diff --git a/src/main/scala/edu/ie3/simona/agent/participant/hp/HpAgentFundamentals.scala b/src/main/scala/edu/ie3/simona/agent/participant/hp/HpAgentFundamentals.scala index 9add5d8ddc..fa7281857d 100644 --- a/src/main/scala/edu/ie3/simona/agent/participant/hp/HpAgentFundamentals.scala +++ b/src/main/scala/edu/ie3/simona/agent/participant/hp/HpAgentFundamentals.scala @@ -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 + nextThreshold.tick, + ) + case _ => + baseStateData.copy( + stateDataStore = updatedStateDataStore + ) + } + } + updateValueStoresInformListenersAndGoToIdleWithUpdatedBaseStateData( scheduler, updatedBaseStateData,