Skip to content

Commit

Permalink
Merge branch 'df/#930-refactor-handleInfeed' into df/#878-thermalGridIT
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala
#	src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala
  • Loading branch information
danielfeismann committed Nov 23, 2024
2 parents 092a6c9 + 07746a4 commit da0dd0b
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 49 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add some quote to 'printGoodbye' [#997](https://github.com/ie3-institute/simona/issues/997)
- Add unapply method for ThermalHouseResults [#934](https://github.com/ie3-institute/simona/issues/934)
- Added `ApparentPower` to differentiate between different power types [#794](https://github.com/ie3-institute/simona/issues/794)
- Update/enhance config documentation [#1013](https://github.com/ie3-institute/simona/issues/1013)
- Integration test for thermal grids [#878](https://github.com/ie3-institute/simona/issues/878)

### Changed
Expand Down Expand Up @@ -143,6 +144,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix some minor issues and findings from inspections [#1019](https://github.com/ie3-institute/simona/issues/1019)
- Fix initialisation freezing on empty primary data [#981](https://github.com/ie3-institute/simona/issues/981)
- Shallow fetch in CI [#1041](https://github.com/ie3-institute/simona/issues/1041)
- Correct wrong use of term "wall clock time" [#727](https://github.com/ie3-institute/simona/issues/727)
- Refactoring of `ThermalGrid.handleInfeed` to fix thermal storage recharge correctly when empty [#930](https://github.com/ie3-institute/simona/issues/930)
- Refactoring of `ThermalGrid.handleInfeed` to fix thermal storage recharge correctly when empty [#930](https://github.com/ie3-institute/simona/issues/930)

Expand Down
14 changes: 7 additions & 7 deletions docs/readthedocs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ To create the output directory name, the name of the simulation is used as a str
`simona.simulationName = "vn_simona"`

### Time parameters
Starting date and time of the simulation
- Format: "YYYY-MM-DD HH:MM:SS"
Starting date and time of the simulation in ISO-8601 date and time format with offset

`simona.time.startDateTime = "2011-01-01 00:00:00"`
`simona.time.startDateTime = "2011-01-01T00:00:00Z"`

Ending date and time of the simulation
- Format: "YYYY-MM-DD HH:MM:SS"
Ending date and time of the simulation in ISO-8601 date and time format with offset

`simona.time.endDateTime = "2011-01-01 02:00:00"`
`simona.time.endDateTime = "2011-01-01T02:00:00Z"`

The preset ReadyCheckWindow should be maintained

Expand All @@ -39,7 +37,9 @@ Setting of the data source

`simona.input.grid.datasource.id = "csv"`

Specify the folder path containing the csv data of the grid components and the csv separator (e.g. "," or ";")
Specify the folder path containing the csv data of the grid components and the csv separator (e.g. "," or ";").
The directory structure is determined by the boolean `isHierarchic`.
If files are placed within [a specific set of subdirectories](https://powersystemdatamodel.readthedocs.io/en/latest/io/csvfiles.html#default-directory-hierarchy), `isHierarchic: true` needs to be set.

```
simona.input.primary.csvParams = {
Expand Down
24 changes: 12 additions & 12 deletions src/main/scala/edu/ie3/simona/agent/grid/GridAgentController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,9 @@ class GridAgentController(
* @param primaryServiceProxy
* Reference to the primary data service proxy
* @param simulationStartDate
* First wall clock time in simulation
* The simulation time at which the simulation starts
* @param simulationEndDate
* Last wall clock time in simulation
* The simulation time at which the simulation ends
* @param resolution
* Frequency of power flow calculations
* @param requestVoltageDeviationThreshold
Expand Down Expand Up @@ -512,9 +512,9 @@ class GridAgentController(
* @param primaryServiceProxy
* Reference to the primary data service proxy
* @param simulationStartDate
* First wall clock time in simulation
* The simulation time at which the simulation starts
* @param simulationEndDate
* Last wall clock time in simulation
* The simulation time at which the simulation ends
* @param resolution
* Frequency of power flow calculations
* @param requestVoltageDeviationThreshold
Expand Down Expand Up @@ -571,9 +571,9 @@ class GridAgentController(
* @param weatherService
* Reference to the weather service actor
* @param simulationStartDate
* First wall clock time in simulation
* The simulation time at which the simulation starts
* @param simulationEndDate
* Last wall clock time in simulation
* The simulation time at which the simulation ends
* @param resolution
* Frequency of power flow calculations
* @param requestVoltageDeviationThreshold
Expand Down Expand Up @@ -631,9 +631,9 @@ class GridAgentController(
* @param evMovementsService
* Reference to the ev movements service actor
* @param simulationStartDate
* First wall clock time in simulation
* The simulation time at which the simulation starts
* @param simulationEndDate
* Last wall clock time in simulation
* The simulation time at which the simulation ends
* @param resolution
* Frequency of power flow calculations
* @param requestVoltageDeviationThreshold
Expand Down Expand Up @@ -749,9 +749,9 @@ class GridAgentController(
* @param weatherService
* Reference to the weather service actor
* @param simulationStartDate
* First wall clock time in simulation
* The simulation time at which the simulation starts
* @param simulationEndDate
* Last wall clock time in simulation
* The simulation time at which the simulation ends
* @param resolution
* Frequency of power flow calculations
* @param requestVoltageDeviationThreshold
Expand Down Expand Up @@ -807,9 +807,9 @@ class GridAgentController(
* @param primaryServiceProxy
* Reference to the primary data service proxy
* @param simulationStartDate
* First wall clock time in simulation
* The simulation time at which the simulation starts
* @param simulationEndDate
* Last wall clock time in simulation
* The simulation time at which the simulation ends
* @param resolution
* Frequency of power flow calculations
* @param requestVoltageDeviationThreshold
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ object GridResultsSupport {
/** Partial result for the port at the high voltage side
*
* @param time
* Wall clock time, the result does belong to
* Simulation time of the result
* @param input
* Unique identifier of the input model
* @param currentMagnitude
Expand All @@ -638,7 +638,7 @@ object GridResultsSupport {
/** Partial result for the port at the medium voltage side
*
* @param time
* Wall clock time, the result does belong to
* Simulation time of the result
* @param input
* Unique identifier of the input model
* @param currentMagnitude
Expand All @@ -656,7 +656,7 @@ object GridResultsSupport {
/** Partial result for the port at the low voltage side
*
* @param time
* Wall clock time, the result does belong to
* Simulation time of the result
* @param input
* Unique identifier of the input model
* @param currentMagnitude
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ protected trait ParticipantAgentFundamentals[
* @param modelConfig
* Configuration for the model
* @param simulationStartDate
* Wall clock time of first instant in simulation
* Simulation time of first instant in simulation
* @param simulationEndDate
* Wall clock time of last instant in simulation
* Simulation time of last instant in simulation
* @return
*/
def buildModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,9 @@ trait HpAgentFundamentals
* @param modelConfig
* Configuration for the model
* @param simulationStartDate
* Wall clock time of first instant in simulation
* Simulation time of first instant in simulation
* @param simulationEndDate
* Wall clock time of last instant in simulation
* Simulation time of last instant in simulation
* @return
*/
override def buildModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ trait BaseStateData[+PD <: PrimaryDataWithApparentPower[PD]]
*/
val startDate: ZonedDateTime

/** The wall clock date, at which the simulation ends
/** The simulation time at which the simulation ends
*/
val endDate: ZonedDateTime

Expand Down Expand Up @@ -132,7 +132,7 @@ object BaseStateData {
* @param startDate
* The date, that fits the tick 0
* @param endDate
* The wall clock date, at which the simulation ends
* The simulation time at which the simulation ends
* @param outputConfig
* Determines the output behaviour of this model
* @param additionalActivationTicks
Expand Down Expand Up @@ -179,7 +179,7 @@ object BaseStateData {
* @param startDate
* The date, that fits the tick 0
* @param endDate
* The wall clock date, at which the simulation ends
* The simulation time at which the simulation ends
* @param model
* Physical model of the load
* @param services
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ import scala.util.{Failure, Success, Try}
* @param scheduler
* Reference to the scheduler of the simulation
* @param startDateTime
* Wall clock time of the first instant in simulation
* Simulation time of the first instant in simulation
*/
case class PrimaryServiceProxy(
scheduler: ActorRef,
Expand Down Expand Up @@ -132,7 +132,7 @@ case class PrimaryServiceProxy(
* @param primaryConfig
* Configuration for the primary source
* @param simulationStart
* Wall clock time of first instant in simulation
* Simulation time of first instant in simulation
* @return
* State data, containing the known model and time series identifiers
*/
Expand Down Expand Up @@ -505,7 +505,7 @@ object PrimaryServiceProxy {
* @param primaryConfig
* Configuration for the primary source
* @param simulationStart
* Wall clock time of the first instant in simulation
* Simulation time of the first instant in simulation
*/
final case class InitPrimaryServiceProxyStateData(
primaryConfig: PrimaryConfig,
Expand All @@ -519,7 +519,7 @@ object PrimaryServiceProxy {
* @param timeSeriesToSourceRef
* Mapping from time series identifier to [[SourceRef]]
* @param simulationStart
* Wall clock time of the first instant in simulation
* Simulation time of the first instant in simulation
* @param primaryConfig
* The configuration for the sources
* @param mappingSource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,16 @@ final case class PrimaryServiceWorker[V <: Value](
Option[Long],
) = {
/* Get the information to distribute */
val wallClockTime = tick.toDateTime(serviceBaseStateData.startDateTime)
serviceBaseStateData.source.getValue(wallClockTime).toScala match {
val simulationTime = tick.toDateTime(serviceBaseStateData.startDateTime)
serviceBaseStateData.source.getValue(simulationTime).toScala match {
case Some(value) =>
processDataAndAnnounce(tick, value, serviceBaseStateData)
case None =>
/* There is no data available in the source. */
log.warning(
s"I expected to get data for tick '{}' ({}), but data is not available",
tick,
wallClockTime,
simulationTime,
)
updateStateDataAndBuildTriggerMessages(serviceBaseStateData)
}
Expand Down Expand Up @@ -371,7 +371,7 @@ object PrimaryServiceWorker {
* @param timeSeriesUuid
* Unique identifier of the time series to read
* @param simulationStart
* Wall clock time of the beginning of simulation time
* Simulation time of the beginning of simulation time
* @param csvSep
* Column separation character of the csv files
* @param directoryPath
Expand Down Expand Up @@ -400,7 +400,7 @@ object PrimaryServiceWorker {
* @param timeSeriesUuid
* Unique identifier of the time series to read
* @param simulationStart
* Wall clock time of the beginning of simulation time
* Simulation time of the beginning of simulation time
* @param sqlParams
* Parameters regarding SQL connection and table selection
* @param databaseNamingStrategy
Expand All @@ -420,7 +420,7 @@ object PrimaryServiceWorker {
* @param activationTicks
* Linked collection of ticks, in which data is available
* @param startDateTime
* Wall clock time of the first instant in simulation
* Simulation time of the first instant in simulation
* @param source
* Implementation of [[TimeSeriesSource]] to use for actual acquisition of
* data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ final class SampleWeatherSource(
private def getWeather(
tick: Long
): WeatherData = {
val wallClockTime = tick.toDateTime
val month = wallClockTime.get(MONTH_OF_YEAR) - 1
val hour = wallClockTime.get(HOUR_OF_DAY)
val simulationTime = tick.toDateTime
val month = simulationTime.get(MONTH_OF_YEAR) - 1
val hour = simulationTime.get(HOUR_OF_DAY)
val year =
if (
wallClockTime.get(YEAR) != 2011 && !(wallClockTime
simulationTime.get(YEAR) != 2011 && !(simulationTime
.get(YEAR) == 2012 && month == 0)
) 2011
else wallClockTime.get(YEAR)
else simulationTime.get(YEAR)
val index = (((year - 2011) * 288) + (month * 24) + hour) + 1
WeatherData(
WattsPerSquareMeter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ class ParticipantAgentMock(
* @param modelConfig
* Configuration for the model
* @param simulationStartDate
* Wall clock time of first instant in simulation
* The simulation time at which the simulation starts
* @param simulationEndDate
* Wall clock time of last instant in simulation
* The simulation time at which the simulation ends
* @return
*/
override def buildModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ class ThermalGridWithHouseAndStorageSpec
testGridAmbientTemperature,
testGridAmbientTemperature,
initialGridState,
// Fixme startingState and isRunning do not match here
isRunning,
externalQDot,
onlyThermalDemandOfHouse,
Expand Down Expand Up @@ -555,7 +554,6 @@ class ThermalGridWithHouseAndStorageSpec
testGridAmbientTemperature,
testGridAmbientTemperature,
gridState,
// Fixme startingState and isRunning do not match here
isRunning,
externalQDot,
onlyThermalDemandOfHeatStorage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ class ThermalGridWithStorageOnlySpec
testGridAmbientTemperature,
testGridAmbientTemperature,
gridState,
// Fixme startingState and isRunning do not match here
isRunning,
testGridQDotInfeed,
onlyThermalDemandOfHeatStorage,
Expand Down

0 comments on commit da0dd0b

Please sign in to comment.