Skip to content

Commit

Permalink
Merge branch 'refs/heads/df/#878-thermalGridIT' 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/thermal/ThermalGrid.scala
#	src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala
  • Loading branch information
danielfeismann committed Aug 8, 2024
2 parents f50e027 + ca0179a commit eaa5ec8
Show file tree
Hide file tree
Showing 10 changed files with 975 additions and 139 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Enhanced Newton-Raphson-PowerFlow failures with more information [#815](https://github.com/ie3-institute/simona/issues/815)
- Update RTD references and bibliography [#868](https://github.com/ie3-institute/simona/issues/868)
- Add gradle application plugin for command line execution with gradle run [#890](https://github.com/ie3-institute/simona/issues/890)
- Integration test for thermal grids [#878](https://github.com/ie3-institute/simona/issues/878)

### Changed
- Adapted to changed data source in PSDM [#435](https://github.com/ie3-institute/simona/issues/435)
Expand Down Expand Up @@ -66,6 +67,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Rewrote SystemComponentTest from groovy to scala [#646](https://github.com/ie3-institute/simona/issues/646)
- Converting remaining rst files to markdown [#838](https://github.com/ie3-institute/simona/issues/838)
- Merging both `FixedFeedInModelSpec` tests [#870](https://github.com/ie3-institute/simona/issues/870)
- Merged `HpModelTestData` with `HpTestData` to `HpInputTestData` [#872](https://github.com/ie3-institute/simona/issues/872)
- Prepare ThermalStorageTestData for Storage without storageVolumeLvlMin [#894](https://github.com/ie3-institute/simona/issues/894)

### Fixed
Expand Down Expand Up @@ -93,6 +95,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Handle MobSim requests for current prices [#892](https://github.com/ie3-institute/simona/issues/892)
- 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
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import edu.ie3.simona.event.ResultEvent
import edu.ie3.simona.event.ResultEvent.{
FlexOptionsResultEvent,
ParticipantResultEvent,
ThermalResultEvent,
}
import edu.ie3.simona.event.notifier.NotifierConfig
import edu.ie3.simona.exceptions.CriticalFailureException
Expand Down Expand Up @@ -1940,8 +1939,9 @@ protected trait ParticipantAgentFundamentals[
def buildResultEvent[R <: ResultEntity](
result: R
): Option[ResultEvent] = result match {
case thermalResult: ThermalUnitResult =>
Some(ThermalResultEvent(thermalResult))
case thermalUnitResult: ThermalUnitResult =>
Some(ResultEvent.ThermalResultEvent(thermalUnitResult))

case unsupported =>
log.debug(
s"Results of class '${unsupported.getClass.getSimpleName}' are currently not supported."
Expand Down
59 changes: 58 additions & 1 deletion src/main/scala/edu/ie3/simona/event/ResultEvent.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,18 @@ import edu.ie3.datamodel.models.result.system.{
FlexOptionsResult,
SystemParticipantResult,
}
import edu.ie3.datamodel.models.result.thermal.ThermalUnitResult
import edu.ie3.datamodel.models.result.thermal.{
CylindricalStorageResult,
ThermalHouseResult,
ThermalUnitResult,
}
import edu.ie3.simona.agent.grid.GridResultsSupport.PartialTransformer3wResult
import edu.ie3.simona.event.listener.ResultEventListener
import tech.units.indriya.ComparableQuantity

import java.time.ZonedDateTime
import java.util.UUID
import javax.measure.quantity.{Energy, Power, Temperature}

sealed trait ResultEvent extends Event with ResultEventListener.Request

Expand All @@ -44,6 +53,54 @@ object ResultEvent {
thermalResult: ThermalUnitResult
) extends ResultEvent

object ThermalHouseResult {
def unapply(result: ThermalHouseResult): Option[
(
ZonedDateTime,
UUID,
ComparableQuantity[Power],
ComparableQuantity[Temperature],
)
] = {
if (result != null) {
Some(
(
result.getTime,
result.getInputModel,
result.getqDot,
result.getIndoorTemperature,
)
)
} else {
None
}
}
}

object CylindricalThermalStorageResult {
def unapply(result: CylindricalStorageResult): Option[
(
ZonedDateTime,
UUID,
ComparableQuantity[Power],
ComparableQuantity[Energy],
)
] = {
if (result != null) {
Some(
(
result.getTime,
result.getInputModel,
result.getqDot,
result.getEnergy,
)
)
} else {
None
}
}
}

/** Event that holds all grid calculation results of a power flow calculation.
* The usage of a type is necessary here, to avoid passing in other instances
* of [[edu.ie3.datamodel.models.result.ResultEntity]] except of the wanted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import edu.ie3.simona.ontology.messages.flex.FlexibilityMessage.ProvideFlexOptio
import edu.ie3.simona.ontology.messages.flex.MinMaxFlexibilityMessage.ProvideMinMaxFlexOptions
import edu.ie3.util.quantities.PowerSystemUnits
import edu.ie3.util.scala.OperationInterval
import edu.ie3.util.scala.quantities.DefaultQuantities
import edu.ie3.util.scala.quantities.DefaultQuantities._
import squants.energy.{Energy, KilowattHours, Kilowatts}
import squants.{Power, Temperature}
Expand Down Expand Up @@ -217,7 +216,7 @@ final case class HpModel(
thermalGrid.updateState(
relevantData.currentTick,
state.thermalGridState,
state.ambientTemperature.getOrElse(relevantData.ambientTemperature),
relevantData.ambientTemperature,
newThermalPower,
houseDemand,
storageDemand,
Expand Down
Loading

0 comments on commit eaa5ec8

Please sign in to comment.