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

Fix hp results leading to overheating house and other effects #853

Draft
wants to merge 50 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
891ab88
add maybeThermalThreshold to nextActivationTicks
danielfeismann Jul 17, 2024
5b9f652
changelog
danielfeismann Jul 17, 2024
989b7b6
provide heat pump the latest entry of weather data
danielfeismann Jul 17, 2024
8b41023
adapt handleInfeed to check for lastState qDot
danielfeismann Jul 17, 2024
e4457dc
fix energyDemand evaluation for demand only below target temperature
danielfeismann Jul 19, 2024
374a2ee
format and exception
danielfeismann Jul 19, 2024
280fed5
Revert "format and exception"
danielfeismann Jul 19, 2024
f51dd61
format and exception
danielfeismann Jul 19, 2024
a297697
refactor handleInfeed to comply with case where thermal storage has b…
danielfeismann Jul 19, 2024
77941f9
fix HpModelSpec to check for targetTemperature
danielfeismann Jul 19, 2024
cde52e4
adapt HpModelSpec to check for targetTemperature
danielfeismann Jul 19, 2024
6244e79
fmt
danielfeismann Jul 19, 2024
81ef30d
refactor energyDemand
danielfeismann Jul 19, 2024
ab0806c
refactor EmAgentIT
danielfeismann Jul 19, 2024
8c6aed6
rollback HpModelSpec
danielfeismann Jul 22, 2024
44873d2
fix energyDemand
danielfeismann Jul 22, 2024
ec7d3f7
update EmAgentIT
danielfeismann Jul 22, 2024
5dcc230
adapt EmAgentIT
danielfeismann Jul 22, 2024
3cc1aa6
Merge branch 'refs/heads/dev' into df/#827_fix_hp_overheating_house
danielfeismann Jul 22, 2024
a3959cb
rollback EmAgentIT changes
danielfeismann Jul 22, 2024
07574aa
Revert "rollback EmAgentIT changes"
danielfeismann Jul 22, 2024
1d7ae94
adapt EmAgentIT comments
danielfeismann Jul 22, 2024
fd1630e
use actual state when determine energyDemand for next period
danielfeismann Jul 22, 2024
9cd94e8
only charge storage if it has still available capacity
danielfeismann Jul 22, 2024
a001dc0
use the actual result tick for thermalhouse and thermal storage results
danielfeismann Jul 22, 2024
ae8185e
use the actual result tick for thermalhouse and thermal storage resul…
danielfeismann Jul 22, 2024
43d114b
fmt
danielfeismann Jul 22, 2024
eb15119
Merge branch 'dev' into df/#827_fix_hp_overheating_house
danielfeismann Jul 25, 2024
08499be
Merge branch 'refs/heads/dev' into df/#827_fix_hp_overheating_house
danielfeismann Jul 26, 2024
5349900
using updatedState for energyDemand
danielfeismann Aug 1, 2024
ad2bac9
fmt
danielfeismann Aug 1, 2024
d85279a
codacy
danielfeismann Aug 1, 2024
2c9f44c
Merge branch 'refs/heads/dev' into df/#827_fix_hp_overheating_house
danielfeismann Aug 5, 2024
de0d415
Merge branch 'refs/heads/dev' into df/#827_fix_hp_overheating_house
danielfeismann Aug 8, 2024
62b0f7a
Merge branch 'dev' into df/#827_fix_hp_overheating_house
danielfeismann Aug 13, 2024
658cb24
Merge branch 'refs/heads/dev' into df/#827_fix_hp_overheating_house
danielfeismann Aug 20, 2024
650c6f9
provide correct ambientTemperature when determining energyDemand of T…
danielfeismann Aug 20, 2024
1abf675
Merge branch 'refs/heads/dev' into df/#827_fix_hp_overheating_house
danielfeismann Aug 20, 2024
f7256ae
add scaladoc
danielfeismann Aug 21, 2024
a9a6296
split handleInfeed into different methods to reduce complexity
danielfeismann Aug 21, 2024
550b5b2
fmt
danielfeismann Aug 21, 2024
afe0572
improve imports
danielfeismann Aug 21, 2024
cbb75d0
Merge branch 'dev' into df/#827_fix_hp_overheating_house
danielfeismann Aug 21, 2024
bbc3a73
Merge branch 'dev' into df/#827_fix_hp_overheating_house
danielfeismann Aug 23, 2024
452f6c1
introduce updated HpModelSpec
danielfeismann Aug 23, 2024
020caf0
Merge branch 'refs/heads/dev' into df/#827_fix_hp_overheating_house
danielfeismann Sep 19, 2024
d049e65
rollback change to fallback to latest weatherData
danielfeismann Sep 19, 2024
52e1f58
fmt
danielfeismann Sep 19, 2024
c93dee0
fix method inputs
danielfeismann Sep 19, 2024
6747d86
Merge branch 'refs/heads/dev' into df/#827_fix_hp_overheating_house
danielfeismann Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Finally fixing `RuntimeEventListenerSpec` [#849](https://github.com/ie3-institute/simona/issues/849)
- Fixed result output for thermal houses and cylindrical storages [#844](https://github.com/ie3-institute/simona/issues/844)
- Fixed FixedFeedModelSpec [#861](https://github.com/ie3-institute/simona/issues/861)
- Fixed Hp results leading to overheating house and other effects [#827](https://github.com/ie3-institute/simona/issues/827)

## [3.0.0] - 2023-08-07

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/edu/ie3/simona/agent/ValueStore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import scala.collection.SortedMap
*/
final case class ValueStore[+D](
maxTickSpan: Long,
private val store: SortedMap[Long, D] = SortedMap.empty[Long, D],
store: SortedMap[Long, D] = SortedMap.empty[Long, D],
) {

/** Determine the lastly known data tick, if available. Includes the given
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 + nextThreshold.tick,
)
case _ =>
baseStateData.copy(
stateDataStore = updatedStateDataStore
)
}
}

updateValueStoresInformListenersAndGoToIdleWithUpdatedBaseStateData(
scheduler,
updatedBaseStateData,
Expand Down Expand Up @@ -385,25 +403,44 @@ trait HpAgentFundamentals
tick: Long,
): HpRelevantData = {
/* extract weather data from secondary data, which should have been requested and received before */
val weatherData =
baseStateData.receivedSecondaryDataStore
val weatherData = {
val currentWeatherData = baseStateData.receivedSecondaryDataStore
.last(tick)
.flatMap { case (receivedTick, receivedValues) =>
if (receivedTick != tick)
log.debug(
s"The model ${baseStateData.model.getUuid} needs to do calculations with values received " +
s"in tick $receivedTick, as no weather data has been received in tick $tick."
)
receivedValues.collectFirst {
// filter secondary data for weather data
case (_, data: WeatherData) => data
if (receivedTick == tick) {
receivedValues.collectFirst { case (_, data: WeatherData) =>
data
}
} else None
}

// If current weather data is not found, fallback to the latest entry where the map is not empty
currentWeatherData
.orElse {
val latestEntry =
baseStateData.receivedSecondaryDataStore.store.toSeq.findLast {
case (_, receivedValues) => receivedValues.nonEmpty
}

latestEntry.flatMap { case (receivedTick, receivedValues) =>
if (tick - receivedTick > 3600) {
log.warning(
s"The model ${baseStateData.model.getUuid} is using weather data from tick $receivedTick, " +
s"but there is a discrepancy of ${tick - receivedTick} seconds compared to the current tick $tick."
)
}

receivedValues.collectFirst { case (_, data: WeatherData) =>
data
}
}
}
.getOrElse(
.getOrElse {
throw new InconsistentStateException(
s"The model ${baseStateData.model} was not provided with needed weather data."
)
)
}
}

HpRelevantData(
tick,
Expand Down
Loading