Skip to content

Commit

Permalink
Merge branch '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/agent/participant/ParticipantAgentFundamentals.scala
#	src/main/scala/edu/ie3/simona/event/ResultEvent.scala
#	src/main/scala/edu/ie3/simona/model/participant/HpModel.scala
#	src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala
#	src/test/scala/edu/ie3/simona/agent/em/EmAgentIT.scala
#	src/test/scala/edu/ie3/simona/agent/grid/ThermalGridIT.scala
#	src/test/scala/edu/ie3/simona/model/participant/HpModelSpec.scala
#	src/test/scala/edu/ie3/simona/model/thermal/ThermalGridTestData.scala
#	src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.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 Nov 23, 2024
2 parents 85c0fc1 + da0dd0b commit e6b831c
Show file tree
Hide file tree
Showing 32 changed files with 441 additions and 321 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ jobs:
- name: Checkout Source
uses: actions/checkout@v4
with:
fetch-depth: 1
ref: ${{ github.event.pull_request.head.ref || github.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
fetch-depth: 0

- name: Setup Java
uses: actions/setup-java@v4
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ 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)
- Integration test for thermal grids [#878](https://github.com/ie3-institute/simona/issues/878)

### Changed
Expand Down Expand Up @@ -102,6 +104,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Refactoring of `ThermalGrid.energyGrid` to distinguish between demand of house and storage [#928](https://github.com/ie3-institute/simona/issues/928)
- Refactoring to use zeroKW and zeroKWH in thermal grid unit tests [#1023](https://github.com/ie3-institute/simona/issues/1023)
- Refactor `ResultFileHierarchy` [#1031](https://github.com/ie3-institute/simona/issues/1031)
- Removing logs in `logs/simona` [#1017](https://github.com/ie3-institute/simona/issues/1017)
- Fix implausible test cases of HpModelSpec [#1042](https://github.com/ie3-institute/simona/issues/1042)

### Fixed
- Fix rendering of references in documentation [#505](https://github.com/ie3-institute/simona/issues/505)
Expand Down Expand Up @@ -140,6 +144,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix grammar and spelling in docs and comments [#1022](https://github.com/ie3-institute/simona/issues/1022)
- 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)

## [3.0.0] - 2023-08-07

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
id "de.undercouch.download" version "5.6.0" // downloads plugin
id "kr.motd.sphinx" version "2.10.1" // documentation generation
id "com.github.johnrengelman.shadow" version "8.1.1" // fat jar
id "org.sonarqube" version "5.1.0.4882" // sonarqube
id "org.sonarqube" version "6.0.0.5145" // sonarqube
id "org.scoverage" version "8.1" // scala code coverage scoverage
id "com.github.maiflai.scalatest" version "0.32" // run scalatest without specific spec task
id 'org.hidetake.ssh' version '2.11.2'
Expand Down Expand Up @@ -145,7 +145,7 @@ dependencies {
implementation 'org.apache.commons:commons-math3:3.6.1' // apache commons math3
implementation 'org.apache.poi:poi-ooxml:5.3.0' // used for FilenameUtils
implementation 'javax.measure:unit-api:2.2'
implementation 'tech.units:indriya:2.2' // quantities
implementation 'tech.units:indriya:2.2.1' // quantities
implementation "org.typelevel:squants_${scalaVersion}:1.8.3"
implementation 'org.apache.commons:commons-csv:1.12.0'
implementation 'org.scalanlp:breeze_2.13:2.1.0' // scientific calculations (http://www.scalanlp.org/)
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
2 changes: 2 additions & 0 deletions input/samples/vn_simona/vn_simona.conf
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ simona.output.thermal = {
]
}

simona.output.log.level = "INFO"

##################################################################
# Runtime Configuration // todo refactor as this naming is misleading and partly unneeded
##################################################################
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config/config-template.conf
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ simona.output.thermal = {
}
simona.output.flex = Boolean | false

simona.output.log.level = String | "INFO"

##################################################################
# Runtime Configuration // todo refactor as this naming is misleading
##################################################################
Expand Down
18 changes: 1 addition & 17 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,8 @@
<level>INFO</level>
</filter>
</appender>
<appender name="RF" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/simona/simona.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>logs/simona/archive/simona-%d{yyyyMMdd'T'HHmmss}-${bySecond}.log</fileNamePattern>
<!-- keep 30 days' worth of history capped at 3GB total size -->
<maxHistory>10</maxHistory>
<totalSizeCap>3GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
</appender>
<!-- File appender is configured and added by edu.ie3.simona.logging.logback.LogbackConfiguration -->
<root level="debug">
<appender-ref ref="STDOUT"/>
<appender-ref ref="RF"/>
</root>
</configuration>
2 changes: 1 addition & 1 deletion src/main/scala/edu/ie3/simona/agent/ValueStore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import scala.collection.SortedMap
*/
final case class ValueStore[+D](
maxTickSpan: Long,
store: SortedMap[Long, D] = SortedMap.empty[Long, D],
private val store: SortedMap[Long, D] = SortedMap.empty[Long, D],
) {

/** Determine the lastly known data tick, if available. Includes the given
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 @@ -213,9 +213,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 @@ -446,9 +446,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
52 changes: 39 additions & 13 deletions src/main/scala/edu/ie3/simona/config/ConfigFailFast.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import scala.util.{Failure, Success, Try}
* missing config parameters where at least one is needed or check for invalid
* or contradicting parameters
*/
case object ConfigFailFast extends LazyLogging {
object ConfigFailFast extends LazyLogging {

def check(typeSafeConfig: Config, simonaConfig: SimonaConfig): Unit = {
check(typeSafeConfig)
Expand Down Expand Up @@ -139,18 +139,7 @@ case object ConfigFailFast extends LazyLogging {
/* Check if the provided combination of data source and parameters are valid */
checkWeatherDataSource(simonaConfig.simona.input.weather.datasource)

/* check if at least one data sink is defined */
checkDataSink(simonaConfig.simona.output.sink)

/* Check all output configurations for participant models */
checkParticipantsOutputConfig(
simonaConfig.simona.output.participant
)

/* Check all output configurations for thermal models */
checkThermalOutputConfig(
simonaConfig.simona.output.thermal
)
checkOutputConfig(simonaConfig.simona.output)

/* Check power flow resolution configuration */
checkPowerFlowResolutionConfiguration(simonaConfig.simona.powerflow)
Expand All @@ -162,6 +151,28 @@ case object ConfigFailFast extends LazyLogging {
checkStoragesConfig(simonaConfig.simona.runtime.participant.storage)
}

/** Checks for valid output configuration
*
* @param outputConfig
* the output configuration that should be checked
*/
private def checkOutputConfig(
outputConfig: SimonaConfig.Simona.Output
): Unit = {

/* check if at least one data sink is defined */
checkDataSink(outputConfig.sink)

/* Check all output configurations for participant models */
checkParticipantsOutputConfig(outputConfig.participant)

/* Check all output configurations for thermal models */
checkThermalOutputConfig(outputConfig.thermal)

/* Check output configurations for log */
checkLogOutputConfig(outputConfig.log)
}

/** Checks for valid sink configuration
*
* @param sink
Expand Down Expand Up @@ -698,6 +709,21 @@ case object ConfigFailFast extends LazyLogging {
checkIndividualOutputConfigs(subConfig.individualConfigs)
}

/** Check the config subtree for log output parameterization
*
* @param subConfig
* Output sub config tree for log
*/
private def checkLogOutputConfig(
subConfig: SimonaConfig.Simona.Output.Log
): Unit = {
val validLogLevels = Seq("TRACE", "DEBUG", "INFO", "WARN", "ERROR")
if (!validLogLevels.contains(subConfig.level))
throw new InvalidConfigParameterException(
s"Invalid log level \"${subConfig.level}\". Valid log levels: ${validLogLevels.mkString(", ")}"
)
}

/** Checks resolution of power flow calculation
*
* @param powerFlow
Expand Down
Loading

0 comments on commit e6b831c

Please sign in to comment.