Skip to content

Commit

Permalink
Merge branch 'dev' into pp/#753-new-test-grid-for-simona
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
danielfeismann committed Mar 8, 2024
2 parents fb3d28c + 8eba29b commit d4df491
Show file tree
Hide file tree
Showing 95 changed files with 453 additions and 655 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Printing logs of failed tests [#747](https://github.com/ie3-institute/simona/issues/747)
- Models for measurements within the grid structure [#89](https://github.com/ie3-institute/simona/issues/89)
- Config possibility for transformer control groups [#90](https://github.com/ie3-institute/simona/issues/90)
- Implemented scaling of all relevant input parameters [#764](https://github.com/ie3-institute/simona/issues/764)
- Consider scaling factor with flex options [#734](https://github.com/ie3-institute/simona/issues/734)
- New Test Grid for Simona [#753](https://github.com/ie3-institute/simona/issues/753)

### Changed
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ repositories {
dependencies {

// ie³ internal repository
implementation('com.github.ie3-institute:PowerSystemUtils:2.0') {
implementation('com.github.ie3-institute:PowerSystemUtils:2.2.1') {
exclude group: 'org.apache.logging.log4j'
exclude group: 'org.slf4j'
/* Exclude our own nested dependencies */
exclude group: 'com.github.ie3-institute'
}
implementation('com.github.ie3-institute:PowerSystemDataModel:4.1.0') {
implementation('com.github.ie3-institute:PowerSystemDataModel:5.0.1') {
exclude group: 'org.apache.logging.log4j'
exclude group: 'org.slf4j'
/* Exclude our own nested dependencies */
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Using the default configuration the universally unique identifier can be set to

uuids = ["default"]

Choosing the scaling factor of the power output:
Choosing the scaling factor of relevant participant parameters such as rated power or annual power consumption:

scaling = 1.0

Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/models/load_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ A list of valid UUIDs of load models, the following configuration should be appl

#### ``scaling``

Universal multiplication factor, that is applied to the models' calculation results. It may be a positive real number.
Universal factor that is applied to the models' relevant parameters such as maximum power or energy consumption. It may be a positive real number.

#### ``modelBehaviour``

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"uuid","p","q","time"
4df88950-dc48-4905-b41f-63d0757eae03,3.999998968803,0.0,2011-01-01T00:00:00Z
"p","q","time"
3.999998968803,0.0,2011-01-01T00:00:00Z
4 changes: 2 additions & 2 deletions input/samples/vn_simona/fullGrid/time_series_mapping.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"uuid","participant","time_series"
e0fa5c16-1078-44d4-a23d-377ccff59c4a,4642d648-b0dd-4597-a3bd-2cc1fce74f27,8c04e94e-76b0-4369-a55c-f5e1117fb83e
"participant","time_series"
4642d648-b0dd-4597-a3bd-2cc1fce74f27,8c04e94e-76b0-4369-a55c-f5e1117fb83e
4 changes: 2 additions & 2 deletions input/samples/vn_simona/vn_simona.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ simona.simulationName = "vn_simona"
##################################################################
# Time Parameters
##################################################################
simona.time.startDateTime = "2011-01-01 00:00:00"
simona.time.endDateTime = "2011-01-01 02:00:00"
simona.time.startDateTime = "2011-01-01T00:00:00Z"
simona.time.endDateTime = "2011-01-01T02:00:00Z"
simona.time.schedulerReadyCheckWindow = 900

##################################################################
Expand Down
12 changes: 6 additions & 6 deletions src/main/resources/config/config-template.conf
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ BaseCsvParams {
#@define extends CsvParams
PrimaryDataCsvParams {
base: CsvParams
timePattern: string | "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]'Z'" # default pattern from PSDM:TimeBasedSimpleValueFactory
timePattern: string | "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]X" # default pattern from PSDM:TimeBasedSimpleValueFactory
}

#@define abstract
Expand Down Expand Up @@ -138,8 +138,8 @@ TransformerControlGroup {
# Agentsim
##################################################################
simona.simulationName = "string"
simona.time.startDateTime = "2011-05-01 00:00:00"
simona.time.endDateTime = "2011-05-01 01:00:00"
simona.time.startDateTime = "2011-05-01T00:00:00Z"
simona.time.endDateTime = "2011-05-01T01:00:00Z"
#@optional
simona.time.schedulerReadyCheckWindow = int

Expand All @@ -154,15 +154,15 @@ simona.input.primary = {
url: string
port: Int
database: string
timePattern: string | "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]'Z'" # default pattern from PSDM:TimeBasedSimpleValueFactory
timePattern: string | "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]X" # default pattern from PSDM:TimeBasedSimpleValueFactory
}
#@optional
sqlParams = {
jdbcUrl: string
userName: string
password: string
schemaName: string | "public"
timePattern: string | "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]'Z'" # default pattern from PSDM:TimeBasedSimpleValueFactory
timePattern: string | "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]X" # default pattern from PSDM:TimeBasedSimpleValueFactory
}
#@optional
couchbaseParams = {
Expand All @@ -172,7 +172,7 @@ simona.input.primary = {
password: string
coordinateColumnName: string
keyPrefix: string
timePattern: string | "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]'Z'" # default pattern from PSDM:TimeBasedSimpleValueFactory
timePattern: string | "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]X" # default pattern from PSDM:TimeBasedSimpleValueFactory
}
}
simona.input.grid.datasource.id = "string"
Expand Down
12 changes: 6 additions & 6 deletions src/main/scala/edu/ie3/simona/config/SimonaConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ object SimonaConfig {
SimonaConfig.PrimaryDataCsvParams(
timePattern =
if (c.hasPathOrNull("timePattern")) c.getString("timePattern")
else "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]'Z'",
else "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]X",
csvSep = $_reqStr(parentPath, c, "csvSep", $tsCfgValidator),
directoryPath =
$_reqStr(parentPath, c, "directoryPath", $tsCfgValidator),
Expand Down Expand Up @@ -1209,7 +1209,7 @@ object SimonaConfig {
password = $_reqStr(parentPath, c, "password", $tsCfgValidator),
timePattern =
if (c.hasPathOrNull("timePattern")) c.getString("timePattern")
else "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]'Z'",
else "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]X",
url = $_reqStr(parentPath, c, "url", $tsCfgValidator),
userName = $_reqStr(parentPath, c, "userName", $tsCfgValidator),
)
Expand Down Expand Up @@ -1249,7 +1249,7 @@ object SimonaConfig {
port = $_reqInt(parentPath, c, "port", $tsCfgValidator),
timePattern =
if (c.hasPathOrNull("timePattern")) c.getString("timePattern")
else "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]'Z'",
else "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]X",
url = $_reqStr(parentPath, c, "url", $tsCfgValidator),
)
}
Expand Down Expand Up @@ -1308,7 +1308,7 @@ object SimonaConfig {
else "public",
timePattern =
if (c.hasPathOrNull("timePattern")) c.getString("timePattern")
else "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]'Z'",
else "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]X",
userName = $_reqStr(parentPath, c, "userName", $tsCfgValidator),
)
}
Expand Down Expand Up @@ -2642,14 +2642,14 @@ object SimonaConfig {
SimonaConfig.Simona.Time(
endDateTime =
if (c.hasPathOrNull("endDateTime")) c.getString("endDateTime")
else "2011-05-01 01:00:00",
else "2011-05-01T01:00:00Z",
schedulerReadyCheckWindow =
if (c.hasPathOrNull("schedulerReadyCheckWindow"))
Some(c.getInt("schedulerReadyCheckWindow"))
else None,
startDateTime =
if (c.hasPathOrNull("startDateTime")) c.getString("startDateTime")
else "2011-05-01 00:00:00",
else "2011-05-01T00:00:00Z",
)
}
}
Expand Down
63 changes: 0 additions & 63 deletions src/main/scala/edu/ie3/simona/io/grid/CsvGridSource.scala

This file was deleted.

13 changes: 10 additions & 3 deletions src/main/scala/edu/ie3/simona/io/grid/GridProvider.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ package edu.ie3.simona.io.grid

import com.typesafe.scalalogging.LazyLogging
import edu.ie3.datamodel.io.naming.FileNamingStrategy
import edu.ie3.datamodel.io.source.csv.CsvJointGridContainerSource
import edu.ie3.datamodel.io.source.csv.{
CsvJointGridContainerSource,
CsvThermalGridSource,
}
import edu.ie3.datamodel.models.input.container.{
JointGridContainer,
ThermalGrid,
Expand All @@ -18,6 +21,7 @@ import edu.ie3.datamodel.utils.validation.ValidationUtils
import edu.ie3.simona.config.SimonaConfig

import java.nio.file.Path
import scala.jdk.CollectionConverters._
import scala.util.{Failure, Success, Try}

/** Takes [[edu.ie3.simona.config.SimonaConfig.Simona.Input.Grid.Datasource]] as
Expand Down Expand Up @@ -81,12 +85,15 @@ object GridProvider extends LazyLogging {
case GridSourceType.CSV =>
gridDataSource.csvParams match {
case Some(params) =>
CsvGridSource
.readThermalGrids(
CsvThermalGridSource
.read(
params.csvSep,
Path.of(params.directoryPath),
new FileNamingStrategy(),
)
.asScala
.map(thermalGrid => thermalGrid.bus() -> thermalGrid)
.toMap
case None =>
throw new RuntimeException(
"CSVGridSource requires csv params to be set!"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ object PlainResult {
* the simulation run id
* @param time
* the current time, formatted by [[PlainWriter.createSimpleTimeStamp]]
* @param uuid
* the uuid identifying this result event
* @param inputModel
* the uuid of the model that created this event
* @param vMag
Expand All @@ -37,7 +35,6 @@ object PlainResult {
final case class PlainNodeResult(
simRunId: UUID,
time: String,
uuid: UUID,
inputModel: UUID,
vMag: Double,
vAng: Double,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ sealed trait PlainWriter[F <: ResultEntity, P <: PlainResult] {
}

object PlainWriter {
private lazy val timeFormatter =
DateTimeFormatter
.ofPattern("yyyy-MM-dd HH:mm:ss")
.withZone(ZoneId.of("UTC"))
private lazy val timeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME

/** Converts [[NodeResult]]s into [[PlainNodeResult]]s and vice versa
* @param simRunId
Expand All @@ -59,7 +56,6 @@ object PlainWriter {
PlainNodeResult(
simRunId,
createSimpleTimeStamp(full.getTime),
full.getUuid,
full.getInputModel,
full.getvMag.getValue.doubleValue(),
full.getvAng.getValue.doubleValue(),
Expand All @@ -68,7 +64,6 @@ object PlainWriter {

override def createFull(plain: PlainNodeResult): NodeResult = {
new NodeResult(
plain.uuid,
ZonedDateTime.parse(plain.time, timeFormatter),
plain.inputModel,
Quantities.getQuantity(plain.vMag, PowerSystemUnits.PU),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ trait ApparentPowerAndHeatParticipant[
calculateApparentPower(tick, voltage, modelState, data)
val heat =
if (isInOperation(tick))
calculateHeat(tick, modelState, data) * scalingFactor
calculateHeat(tick, modelState, data)
else
Megawatts(0d)

Expand Down
2 changes: 0 additions & 2 deletions src/main/scala/edu/ie3/simona/model/participant/BMModel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ final case class BMModel(
uuid: UUID,
id: String,
operationInterval: OperationInterval,
override val scalingFactor: Double,
qControl: QControl,
sRated: Power,
cosPhi: Double,
Expand All @@ -44,7 +43,6 @@ final case class BMModel(
uuid,
id,
operationInterval,
scalingFactor,
qControl,
sRated,
cosPhi,
Expand Down
19 changes: 8 additions & 11 deletions src/main/scala/edu/ie3/simona/model/participant/ChpModel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ import java.time.ZonedDateTime
* the element's human readable id
* @param operationInterval
* Interval, in which the system is in operation
* @param scalingFactor
* Scaling the output of the system
* @param qControl
* Type of reactive power control
* @param sRated
Expand All @@ -51,7 +49,6 @@ final case class ChpModel(
uuid: UUID,
id: String,
operationInterval: OperationInterval,
override val scalingFactor: Double,
qControl: QControl,
sRated: Power,
cosPhiRated: Double,
Expand All @@ -61,7 +58,6 @@ final case class ChpModel(
uuid,
id,
operationInterval,
scalingFactor,
qControl,
sRated,
cosPhiRated,
Expand Down Expand Up @@ -378,27 +374,28 @@ object ChpModel {
scalingFactor: Double,
thermalStorage: ThermalStorage with MutableStorage,
): ChpModel = {
val scaledInput = chpInput.copy().scale(scalingFactor).build()

val operationInterval = SystemComponent.determineOperationInterval(
simulationStartDate,
simulationEndDate,
chpInput.getOperationTime,
scaledInput.getOperationTime,
)

val model = new ChpModel(
chpInput.getUuid,
chpInput.getId,
scaledInput.getUuid,
scaledInput.getId,
operationInterval,
scalingFactor,
qControl,
Kilowatts(
chpInput.getType.getsRated
scaledInput.getType.getsRated
.to(PowerSystemUnits.KILOWATT)
.getValue
.doubleValue
),
chpInput.getType.getCosPhiRated,
scaledInput.getType.getCosPhiRated,
Kilowatts(
chpInput.getType.getpThermal
scaledInput.getType.getpThermal
.to(PowerSystemUnits.KILOWATT)
.getValue
.doubleValue
Expand Down
Loading

0 comments on commit d4df491

Please sign in to comment.