Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/df/#878-thermalGridIT' into df/#878
Browse files Browse the repository at this point in the history
-thermalGridIT
  • Loading branch information
danielfeismann committed Aug 29, 2024
2 parents 5e5b5c1 + bbe4c0a commit d5c0195
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 23 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
41 changes: 21 additions & 20 deletions src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import edu.ie3.datamodel.models.result.thermal.{
CylindricalStorageResult,
ThermalHouseResult,
}
import edu.ie3.simona.exceptions.InvalidParameterException
import edu.ie3.simona.exceptions.agent.InconsistentStateException
import edu.ie3.simona.model.thermal.ThermalGrid.{
ThermalEnergyDemand,
Expand Down Expand Up @@ -48,9 +49,9 @@ final case class ThermalGrid(
* @param tick
* Questioned instance in time
* @param lastAmbientTemperature
* Ambient temperature until this tick
* Ambient temperature valid up until (not including) the current tick
* @param ambientTemperature
* Ambient temperature in the instance in question
* Current ambient temperature in the instance in question
* @param state
* Currently applicable state of the thermal grid
* @return
Expand Down Expand Up @@ -152,17 +153,17 @@ 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
* Determines whether the heat pump is running or not
* @param qDot
* Thermal energy balance
* @param houseDemand
* determines if the thermal house has heat demand
* Determines if the thermal house has heat demand
* @param storageDemand
* determines if the thermal storage has heat demand
* Determines if the thermal storage has heat demand
* @return
* The updated state of the grid
*/
Expand Down Expand Up @@ -201,19 +202,19 @@ 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
* determines whether the heat pump is running or not
* Determines whether the heat pump is running or not
* @param qDot
* Infeed to the grid
* @param houseDemand
* determines if the thermal house has heat demand
* Determines if the thermal house has heat demand
* @param storageDemand
* determines if the thermal storage has heat demand
* Determines if the thermal storage has heat demand
* @return
* Updated thermal grid state
*/
Expand Down Expand Up @@ -352,9 +353,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 thermal grid
* @param qDotHouse
Expand Down Expand Up @@ -405,9 +406,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 @@ -504,9 +505,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 @@ -580,9 +581,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
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ final case class ThermalHouse(
* @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 qDot
* New thermal influx
* @return
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 d5c0195

Please sign in to comment.