Skip to content

Commit

Permalink
fix thermal storage recharging condition
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfeismann committed Aug 8, 2024
1 parent 264210a commit 701aaf5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,14 @@ final case class ThermalGrid(
storage.updateState(tick, state.qDot, state)._1
val storedEnergy = updatedStorageState.storedEnergy
val soc = storedEnergy / storage.getMaxEnergyThreshold
val storageRequired =
if (soc < 0.5) {
storage.getMaxEnergyThreshold * 0.5 - storedEnergy
val storageRequired = {
if (soc == 0d) {
storage.getMaxEnergyThreshold - storedEnergy

} else {
zeroMWH
}
}

val storagePossible = storage.getMaxEnergyThreshold - storedEnergy
(
Expand Down Expand Up @@ -215,7 +217,9 @@ final case class ThermalGrid(
)
}

if (qDotHouseLastState > zeroKW | qDotStorageLastState > zeroKW) {
if (
(qDotHouseLastState > zeroKW && qDotHouseLastState == qDot) | qDotStorageLastState > zeroKW
) {
val (updatedHouseState, thermalHouseThreshold, remainingQDotHouse) =
handleInfeedHouse(tick, ambientTemperature, state, qDotHouseLastState)
val (updatedStorageState, thermalStorageThreshold) =
Expand Down

0 comments on commit 701aaf5

Please sign in to comment.