Skip to content

Commit

Permalink
Merge branch 'refs/heads/dev' into df/#856-tap-water
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	src/main/scala/edu/ie3/simona/model/participant/HpModel.scala
#	src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala
#	src/main/scala/edu/ie3/simona/model/thermal/ThermalHouse.scala
#	src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala
#	src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala
  • Loading branch information
danielfeismann committed Aug 29, 2024
2 parents 91873b9 + b870fe7 commit 6ae74f2
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ 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 determineState of ThermalHouse [#926](https://github.com/ie3-institute/simona/issues/926)
- Fixed Hp results leading to overheating house and other effects [#827](https://github.com/ie3-institute/simona/issues/827)
- Fixed thermal storage getting recharged when empty [#827](https://github.com/ie3-institute/simona/issues/827)
- Provide actual ambient temperature of tick to HpModel when calculate state [#882](https://github.com/ie3-institute/simona/issues/882)

## [3.0.0] - 2023-08-07

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ dependencies {
/* testing */
testImplementation 'org.spockframework:spock-core:2.3-groovy-4.0'
testImplementation 'org.scalatestplus:mockito-3-4_2.13:3.2.10.0'
testImplementation 'org.mockito:mockito-core:5.12.0' // mocking framework
testImplementation 'org.mockito:mockito-core:5.13.0' // mocking framework
testImplementation "org.scalatest:scalatest_${scalaVersion}:3.2.19"
testRuntimeOnly 'com.vladsch.flexmark:flexmark-all:0.64.8' //scalatest html output
testImplementation group: 'org.pegdown', name: 'pegdown', version: '1.6.0'
Expand Down
17 changes: 9 additions & 8 deletions src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ final case class ThermalGrid(
* @param state
* Currently applicable state
* @param lastAmbientTemperature
* Ambient temperature until this tick
* Ambient temperature valid up until (not including) the current tick
* @param ambientTemperature
* actual ambient temperature
* Current ambient temperature
* @param isRunning
* determines whether the heat pump is running or not
* @param qDot
Expand Down Expand Up @@ -295,9 +295,9 @@ final case class ThermalGrid(
* @param tick
* Current tick
* @param lastAmbientTemperature
* Ambient temperature until this tick
* Ambient temperature valid up until (not including) the current tick
* @param ambientTemperature
* actual ambient temperature
* Current ambient temperature
* @param state
* Current state of the houses
* @param isRunning
Expand Down Expand Up @@ -940,6 +940,7 @@ final case class ThermalGrid(
* @param tick
* Current tick
* @param lastAmbientTemperature
* FIXME
* Ambient temperature until this tick
* @param ambientTemperature
* actual ambient temperature
Expand Down Expand Up @@ -1151,9 +1152,9 @@ final case class ThermalGrid(
* @param tick
* Current tick
* @param lastAmbientTemperature
* Ambient temperature until this tick
* Ambient temperature valid up until (not including) the current tick
* @param ambientTemperature
* actual ambient temperature
* Current ambient temperature
* @param state
* Current state of the houses
* @param qDot
Expand Down Expand Up @@ -1316,9 +1317,9 @@ final case class ThermalGrid(
* @param formerStorageState
* Previous thermal storage state before a first update was performed
* @param lastAmbientTemperature
* Ambient temperature until this tick
* Ambient temperature valid up until (not including) the current tick
* @param ambientTemperature
* actual ambient temperature
* Current ambient temperature
* @param qDot
* Thermal influx
* @return
Expand Down
10 changes: 5 additions & 5 deletions src/main/scala/edu/ie3/simona/model/thermal/ThermalHouse.scala
Original file line number Diff line number Diff line change
Expand Up @@ -502,15 +502,15 @@ final case class ThermalHouse(
/** Update the current state of the house
*
* @param tick
* current instance in time
* Current instance in time
* @param state
* currently applicable state
* Currently applicable state
* @param lastAmbientTemperature
* Ambient temperature until this tick
* Ambient temperature valid up until (not including) the current tick
* @param ambientTemperature
* actual ambient temperature
* Current ambient temperature
* @param qDot
* new thermal influx
* New thermal influx
* @return
* Updated state and the tick in which the next threshold is reached
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ class ThermalGridWithHouseOnlySpec
tick,
testGridAmbientTemperature,
testGridAmbientTemperature,
testGridAmbientTemperature,
gridState,
externalQDot,
defaultSimulationStart,
Expand Down Expand Up @@ -278,6 +279,7 @@ class ThermalGridWithHouseOnlySpec
tick,
testGridAmbientTemperature,
testGridAmbientTemperature,
testGridAmbientTemperature,
gridState,
testGridQDotConsumption,
defaultSimulationStart,
Expand Down Expand Up @@ -374,6 +376,7 @@ class ThermalGridWithHouseOnlySpec
tick,
testGridAmbientTemperature,
testGridAmbientTemperature,
testGridAmbientTemperature,
gridState,
isNotRunning,
testGridQDotInfeed,
Expand Down Expand Up @@ -565,6 +568,7 @@ class ThermalGridWithHouseOnlySpec
ThermalGrid.startingState(thermalGrid),
testGridAmbientTemperature,
testGridAmbientTemperature,
testGridAmbientTemperature,
isNotRunning,
testGridQDotConsumption,
ThermalEnergyDemand(KilowattHours(0), KilowattHours(1)),
Expand Down Expand Up @@ -654,6 +658,7 @@ class ThermalGridWithHouseOnlySpec
ThermalGrid.startingState(thermalGrid),
testGridAmbientTemperature,
testGridAmbientTemperature,
testGridAmbientTemperature,
isNotRunning,
zeroKW,
ThermalEnergyDemand(zeroKWH, zeroKWH),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ class ThermalGridWithStorageOnlySpec
),
testGridAmbientTemperature,
testGridAmbientTemperature,
testGridAmbientTemperature,
isRunning,
testGridQDotConsumptionHigh,
ThermalEnergyDemand(zeroKWH, zeroKWH),
Expand Down Expand Up @@ -317,6 +318,7 @@ class ThermalGridWithStorageOnlySpec
ThermalGrid.startingState(thermalGrid),
testGridAmbientTemperature,
testGridAmbientTemperature,
testGridAmbientTemperature,
isRunning,
zeroKW,
ThermalEnergyDemand(zeroKWH, zeroKWH),
Expand Down
31 changes: 31 additions & 0 deletions src/test/scala/edu/ie3/simona/model/thermal/ThermalHouseSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@

package edu.ie3.simona.model.thermal

import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseThreshold.HouseTemperatureLowerBoundaryReached
import edu.ie3.simona.model.thermal.ThermalHouse.{
ThermalHouseState,
startingState,
}
import edu.ie3.simona.test.common.UnitSpec
import edu.ie3.simona.test.common.input.HpInputTestData
import edu.ie3.util.scala.quantities.DefaultQuantities.zeroKW
import edu.ie3.util.scala.quantities.WattsPerKelvin
import org.scalatest.prop.TableFor3
import squants.energy._
Expand Down Expand Up @@ -92,6 +98,31 @@ class ThermalHouseSpec extends UnitSpec with HpInputTestData {
newInnerTemperature should approximate(Temperature(29, Celsius))
}

"Check for the correct state of house when ambient temperature changes" in {
val house = thermalHouse(18, 22)
val initialHousestate = startingState(house)
val lastAmbientTemperature = Temperature(15, Celsius)
val ambientTemperature = Temperature(-20, Celsius)

val (thermalHouseState, threshold) = house.determineState(
3600L,
initialHousestate,
lastAmbientTemperature,
ambientTemperature,
zeroKW,
)

thermalHouseState match {
case ThermalHouseState(tick, temperature, qDot) =>
tick shouldBe 3600L
temperature should approximate(Kelvin(292.64986111))
qDot shouldBe zeroKW
case unexpected =>
fail(s"Expected a thermalHouseState but got none $unexpected.")
}
threshold shouldBe Some(HouseTemperatureLowerBoundaryReached(4967))
}

"Check build method" in {

val thermalTestHouse = thermalHouse(18, 22)
Expand Down

0 comments on commit 6ae74f2

Please sign in to comment.