Skip to content

Commit

Permalink
Merge branch 'dev' into sp/#1202-flex-result-to-em
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-peter authored Feb 18, 2025
2 parents 5202f66 + 6ad5199 commit 09cd24e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 32 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Removing generated methods and cleaning up in config [#1170](https://github.com/ie3-institute/simona/issues/1170)
- Changed `pvInput` values in `PvInputTestData` to more realistic values [#1144](https://github.com/ie3-institute/simona/issues/1144)
- Refactor `RuntimeConfig` [#1172](https://github.com/ie3-institute/simona/issues/1172)
- Renamed some methods and variables within `ThermalGrid` and `ThermalHouse` [#1193](https://github.com/ie3-institute/simona/issues/1193)

### Fixed
- Fix rendering of references in documentation [#505](https://github.com/ie3-institute/simona/issues/505)
Expand Down
12 changes: 6 additions & 6 deletions src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ final case class ThermalGrid(
house.zip(lastHpState.thermalGridState.houseState) match {
case Some((thermalHouse, lastHouseState)) =>
val (updatedHouseState, _) =
thermalHouse.determineState(
thermalHouse.updateState(
relevantData,
lastHouseState,
lastHpState.ambientTemperature.getOrElse(
Expand Down Expand Up @@ -476,7 +476,7 @@ final case class ThermalGrid(
): (Option[ThermalHouseState], Option[ThermalThreshold], Power) = {
(house, state.houseState) match {
case (Some(thermalHouse), Some(lastHouseState)) =>
val (newState, threshold) = thermalHouse.determineState(
val (newState, threshold) = thermalHouse.updateState(
relevantData,
lastHouseState,
lastAmbientTemperature,
Expand All @@ -489,7 +489,7 @@ final case class ThermalGrid(
)
) {
val (fullHouseState, maybeFullHouseThreshold) =
thermalHouse.determineState(
thermalHouse.updateState(
relevantData,
lastHouseState,
lastAmbientTemperature,
Expand Down Expand Up @@ -580,8 +580,8 @@ final case class ThermalGrid(
/* House will be left with no influx in all cases. Determine if and when a threshold is reached */
val maybeUpdatedHouseState =
house.zip(lastThermalGridState.houseState).map {
case (house, houseState) =>
house.determineState(
case (thermalHouse, houseState) =>
thermalHouse.updateState(
relevantData,
houseState,
lastAmbientTemperature,
Expand Down Expand Up @@ -678,7 +678,7 @@ final case class ThermalGrid(
)
),
)
val revisedHouseState = thermalHouse.determineState(
val revisedHouseState = thermalHouse.updateState(
relevantData,
formerHouseState.getOrElse(
throw new InconsistentStateException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import edu.ie3.simona.model.participant.HpModel.HpRelevantData
import edu.ie3.simona.model.thermal.ThermalGrid.ThermalEnergyDemand
import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseThreshold.{
HouseTemperatureLowerBoundaryReached,
HouseTemperatureUpperBoundaryReached,
HouseTemperatureTargetOrUpperBoundaryReached,
}
import edu.ie3.simona.model.thermal.ThermalHouse.{
ThermalHouseState,
Expand Down Expand Up @@ -234,7 +234,7 @@ final case class ThermalHouse(
* @return
* Updated state and the tick in which the next threshold is reached
*/
def determineState(
def updateState(
relevantData: HpRelevantData,
state: ThermalHouseState,
lastAmbientTemperature: Temperature,
Expand Down Expand Up @@ -315,7 +315,7 @@ final case class ThermalHouse(
upperBoundaryTemperature,
innerTemperature,
resultingQDot,
).map(HouseTemperatureUpperBoundaryReached)
).map(HouseTemperatureTargetOrUpperBoundaryReached)
} else {
/* House is in perfect balance */
None
Expand Down Expand Up @@ -399,7 +399,7 @@ object ThermalHouse {
final case class HouseTemperatureLowerBoundaryReached(
override val tick: Long
) extends ThermalThreshold
final case class HouseTemperatureUpperBoundaryReached(
final case class HouseTemperatureTargetOrUpperBoundaryReached(
override val tick: Long
) extends ThermalThreshold
}
Expand Down
28 changes: 14 additions & 14 deletions src/test/scala/edu/ie3/simona/model/participant/HpModelSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import edu.ie3.simona.model.thermal.ThermalGrid.ThermalGridState
import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseState
import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseThreshold.{
HouseTemperatureLowerBoundaryReached,
HouseTemperatureUpperBoundaryReached,
HouseTemperatureTargetOrUpperBoundaryReached,
}
import edu.ie3.simona.model.thermal.ThermalStorage.ThermalStorageState
import edu.ie3.simona.ontology.messages.flex.MinMaxFlexibilityMessage.ProvideMinMaxFlexOptions
Expand Down Expand Up @@ -55,7 +55,7 @@ class HpModelSpec
true,
95,
15.6,
Some(HouseTemperatureUpperBoundaryReached(31711)),
Some(HouseTemperatureTargetOrUpperBoundaryReached(31711)),
),
(
HpState(
Expand All @@ -70,7 +70,7 @@ class HpModelSpec
true,
95,
16.4,
Some(HouseTemperatureUpperBoundaryReached(30642)),
Some(HouseTemperatureTargetOrUpperBoundaryReached(30642)),
),
(
HpState(
Expand All @@ -85,7 +85,7 @@ class HpModelSpec
true,
95,
18.0,
Some(HouseTemperatureUpperBoundaryReached(27771)),
Some(HouseTemperatureTargetOrUpperBoundaryReached(27771)),
),
(
HpState(
Expand Down Expand Up @@ -450,7 +450,7 @@ class HpModelSpec
Some(ThermalHouseState(0L, Celsius(21), Kilowatts(0))),
Some(ThermalStorageState(0L, KilowattHours(0), Kilowatts(0))),
),
Some(HouseTemperatureUpperBoundaryReached(0L)),
Some(HouseTemperatureTargetOrUpperBoundaryReached(0L)),
),
(95.0, 0.0, 95.0),
),
Expand All @@ -471,7 +471,7 @@ class HpModelSpec
Some(ThermalHouseState(0L, Celsius(21), Kilowatts(0))),
Some(ThermalStorageState(0L, KilowattHours(20), Kilowatts(0))),
),
Some(HouseTemperatureUpperBoundaryReached(0L)),
Some(HouseTemperatureTargetOrUpperBoundaryReached(0L)),
),
(95.0, 0.0, 95.0),
),
Expand All @@ -494,7 +494,7 @@ class HpModelSpec
Some(ThermalHouseState(0L, Celsius(21), Kilowatts(0))),
Some(ThermalStorageState(0L, KilowattHours(0), Kilowatts(0))),
),
Some(HouseTemperatureUpperBoundaryReached(0L)),
Some(HouseTemperatureTargetOrUpperBoundaryReached(0L)),
),
(95.0, 0.0, 95.0),
),
Expand All @@ -515,7 +515,7 @@ class HpModelSpec
Some(ThermalHouseState(0L, Celsius(21), Kilowatts(0))),
Some(ThermalStorageState(0L, KilowattHours(20), Kilowatts(0))),
),
Some(HouseTemperatureUpperBoundaryReached(0L)),
Some(HouseTemperatureTargetOrUpperBoundaryReached(0L)),
),
(0.0, 0.0, 95.0),
),
Expand All @@ -539,7 +539,7 @@ class HpModelSpec
Some(ThermalHouseState(0L, Celsius(21), Kilowatts(0))),
Some(ThermalStorageState(0L, KilowattHours(0), Kilowatts(0))),
),
Some(HouseTemperatureUpperBoundaryReached(0L)),
Some(HouseTemperatureTargetOrUpperBoundaryReached(0L)),
),
(95.0, 0.0, 95.0),
),
Expand All @@ -560,7 +560,7 @@ class HpModelSpec
Some(ThermalHouseState(0L, Celsius(21), Kilowatts(0))),
Some(ThermalStorageState(0L, KilowattHours(20), Kilowatts(0))),
),
Some(HouseTemperatureUpperBoundaryReached(0L)),
Some(HouseTemperatureTargetOrUpperBoundaryReached(0L)),
),
(95.0, 0.0, 95.0),
),
Expand All @@ -583,7 +583,7 @@ class HpModelSpec
Some(ThermalHouseState(0L, Celsius(21), Kilowatts(0))),
Some(ThermalStorageState(0L, KilowattHours(0), Kilowatts(0))),
),
Some(HouseTemperatureUpperBoundaryReached(0L)),
Some(HouseTemperatureTargetOrUpperBoundaryReached(0L)),
),
(95.0, 0.0, 95.0),
),
Expand All @@ -605,7 +605,7 @@ class HpModelSpec
Some(ThermalHouseState(0L, Celsius(21), Kilowatts(0))),
Some(ThermalStorageState(0L, KilowattHours(20), Kilowatts(0))),
),
Some(HouseTemperatureUpperBoundaryReached(0L)),
Some(HouseTemperatureTargetOrUpperBoundaryReached(0L)),
),
(0.0, 0.0, 95.0),
),
Expand All @@ -628,7 +628,7 @@ class HpModelSpec
ThermalStorageState(0L, KilowattHours(500), Kilowatts(0))
),
),
Some(HouseTemperatureUpperBoundaryReached(0L)),
Some(HouseTemperatureTargetOrUpperBoundaryReached(0L)),
),
(0.0, 0.0, 95.0),
),
Expand All @@ -651,7 +651,7 @@ class HpModelSpec
ThermalStorageState(0L, KilowattHours(500), Kilowatts(0))
),
),
Some(HouseTemperatureUpperBoundaryReached(0L)),
Some(HouseTemperatureTargetOrUpperBoundaryReached(0L)),
),
(0.0, 0.0, 0.0),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import edu.ie3.simona.model.thermal.ThermalGrid.ThermalGridState
import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseState
import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseThreshold.{
HouseTemperatureLowerBoundaryReached,
HouseTemperatureUpperBoundaryReached,
HouseTemperatureTargetOrUpperBoundaryReached,
}
import edu.ie3.simona.model.thermal.ThermalStorage.ThermalStorageState
import edu.ie3.simona.model.thermal.ThermalStorage.ThermalStorageThreshold.{
Expand Down Expand Up @@ -354,7 +354,7 @@ class ThermalGridWithHouseAndStorageSpec
),
testGridQDotInfeed,
),
Some(HouseTemperatureUpperBoundaryReached(3600L)),
Some(HouseTemperatureTargetOrUpperBoundaryReached(3600L)),
)
)
val maybeStorageState = Some(
Expand Down Expand Up @@ -488,7 +488,11 @@ class ThermalGridWithHouseAndStorageSpec
Some(
(
ThermalHouseState(houseTick, _, revisedQDotHouse),
Some(HouseTemperatureUpperBoundaryReached(houseWarmTick)),
Some(
HouseTemperatureTargetOrUpperBoundaryReached(
houseWarmTick
)
),
)
),
Some(
Expand Down Expand Up @@ -562,7 +566,7 @@ class ThermalGridWithHouseAndStorageSpec
case _ => fail("Thermal grid state has been calculated wrong.")
}
reachedThreshold shouldBe Some(
HouseTemperatureUpperBoundaryReached(7372L)
HouseTemperatureTargetOrUpperBoundaryReached(7372L)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import edu.ie3.simona.model.thermal.ThermalGrid.ThermalGridState
import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseState
import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseThreshold.{
HouseTemperatureLowerBoundaryReached,
HouseTemperatureUpperBoundaryReached,
HouseTemperatureTargetOrUpperBoundaryReached,
}
import edu.ie3.simona.test.common.UnitSpec
import edu.ie3.util.scala.quantities.DefaultQuantities.{zeroKW, zeroKWh}
Expand Down Expand Up @@ -216,7 +216,7 @@ class ThermalGridWithHouseOnlySpec extends UnitSpec with ThermalHouseTestData {
case _ => fail("Thermal grid state has been calculated wrong.")
}
reachedThreshold shouldBe Some(
HouseTemperatureUpperBoundaryReached(7372L)
HouseTemperatureTargetOrUpperBoundaryReached(7372L)
)
}
}
Expand All @@ -238,7 +238,9 @@ class ThermalGridWithHouseOnlySpec extends UnitSpec with ThermalHouseTestData {
Some(ThermalHouseState(tick, innerTemperature, qDot)),
None,
),
Some(HouseTemperatureUpperBoundaryReached(thresholdTick)),
Some(
HouseTemperatureTargetOrUpperBoundaryReached(thresholdTick)
),
) =>
tick shouldBe 0L
innerTemperature should approximate(Celsius(18.9999d))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ThermalHouseSpec extends UnitSpec with HpInputTestData {
val initialHousestate = startingState(house)
val lastAmbientTemperature = Temperature(15, Celsius)

val (thermalHouseState, threshold) = house.determineState(
val (thermalHouseState, threshold) = house.updateState(
relevantData,
initialHousestate,
lastAmbientTemperature,
Expand Down

0 comments on commit 09cd24e

Please sign in to comment.