Skip to content

Commit

Permalink
Merge pull request #1177 from ie3-institute/mh/#1144-realistic-PvInpu…
Browse files Browse the repository at this point in the history
…tTestData-values

changed pvInput values and corresponding expected results
  • Loading branch information
danielfeismann authored Feb 17, 2025
2 parents b5e507d + cd34c1c commit 4ea6c77
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 64 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Enhance EmAggregate of SelfOpt to cope with other targetLimits [#1131](https://github.com/ie3-institute/simona/issues/1131)
- Switched to `pureconfig` [#608](https://github.com/ie3-institute/simona/issues/608)
- Removing generated methods and cleaning up in config [#1170](https://github.com/ie3-institute/simona/issues/1170)
- Changed `pvInput` values in `PvInputTestData` to more realistic values [#1144](https://github.com/ie3-institute/simona/issues/1144)

### Fixed
- Fix rendering of references in documentation [#505](https://github.com/ie3-institute/simona/issues/505)
Expand Down
128 changes: 69 additions & 59 deletions src/test/scala/edu/ie3/simona/agent/em/EmAgentIT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class EmAgentIT
with should.Matchers
with EmInputTestData
with MockitoSugar {

// start a bit later so the sun is up
protected implicit val simulationStartDate: ZonedDateTime =
TimeUtil.withDefaults.toZonedDateTime("2020-01-01T10:00:00Z")
Expand All @@ -85,11 +84,8 @@ class EmAgentIT
)

override protected val modelConfig: EmRuntimeConfig = EmRuntimeConfig(
calculateMissingReactivePowerWithModel = false,
scaling = 1d,
uuids = List("default"),
aggregateFlex = "SELF_OPT",
curtailRegenerative = false,
)

private implicit val quantityTolerance: Double = 1e-10d
Expand Down Expand Up @@ -125,7 +121,6 @@ class EmAgentIT
loadInput,
LoadRuntimeConfig(
calculateMissingReactivePowerWithModel = true,
scaling = 1d,
modelBehaviour = "fix",
reference = "power",
uuids = List.empty,
Expand All @@ -150,7 +145,6 @@ class EmAgentIT
pvInput,
PvRuntimeConfig(
calculateMissingReactivePowerWithModel = true,
scaling = 2d,
uuids = List.empty,
),
primaryServiceProxy.ref.toClassic,
Expand All @@ -173,9 +167,7 @@ class EmAgentIT
householdStorageInput,
StorageRuntimeConfig(
calculateMissingReactivePowerWithModel = true,
scaling = 1d,
uuids = List.empty,
initialSoc = 0d,
targetSoc = None,
),
primaryServiceProxy.ref.toClassic,
Expand Down Expand Up @@ -260,10 +252,10 @@ class EmAgentIT

/* TICK 0
LOAD: 0.269 kW
PV: -5.617 kW
PV: -5.842 kW
STORAGE: SOC 0 %
-> charge with 5 kW
-> remaining -0.348 kW
-> remaining -0.573 kW
*/

emAgentActivation ! Activation(0)
Expand All @@ -272,8 +264,8 @@ class EmAgentIT
0,
weatherService.ref.toClassic,
WeatherData(
WattsPerSquareMeter(540d),
WattsPerSquareMeter(200d),
WattsPerSquareMeter(100d),
Celsius(0d),
MetersPerSecond(0d),
),
Expand All @@ -285,18 +277,20 @@ class EmAgentIT
emResult.getInputModel shouldBe emInput.getUuid
emResult.getTime shouldBe 0L.toDateTime
emResult.getP should equalWithTolerance(
-0.00034885012.asMegaWatt
-0.00057340027059.asMegaWatt
)
emResult.getQ should equalWithTolerance(
0.0000882855367033.asMegaVar
)
emResult.getQ should equalWithTolerance(0.00008828554.asMegaVar)
}

scheduler.expectMessage(Completion(emAgentActivation, Some(7200)))

/* TICK 7200
LOAD: 0.269 kW (unchanged)
PV: -3.651 kW
PV: -3.791 kW
STORAGE: SOC 63.3 %
-> charge with 3.382 kW
-> charge with 3.522 kW
-> remaining 0 kW
*/

Expand All @@ -306,8 +300,8 @@ class EmAgentIT
7200,
weatherService.ref.toClassic,
WeatherData(
WattsPerSquareMeter(300d),
WattsPerSquareMeter(500d),
WattsPerSquareMeter(50d),
WattsPerSquareMeter(150d),
Celsius(0d),
MetersPerSecond(0d),
),
Expand All @@ -318,28 +312,30 @@ class EmAgentIT
case ParticipantResultEvent(emResult: EmResult) =>
emResult.getInputModel shouldBe emInput.getUuid
emResult.getTime shouldBe 7200.toDateTime
emResult.getP should equalWithTolerance(0.asMegaWatt)
emResult.getP should equalWithTolerance(
0.0.asMegaWatt
)
emResult.getQ should equalWithTolerance(0.0000882855367.asMegaVar)
}

scheduler.expectMessage(Completion(emAgentActivation, Some(13362)))
scheduler.expectMessage(Completion(emAgentActivation, Some(13115)))

/* TICK 13362
/* TICK 13115
LOAD: 0.269 kW (unchanged)
PV: -3.651 kW (unchanged)
PV: -3.791 kW (unchanged)
STORAGE: SOC 100 %
-> charge with 0 kW
-> remaining -3.382 kW
-> remaining -3.522 kW
*/

emAgentActivation ! Activation(13362)
emAgentActivation ! Activation(13115)

resultListener.expectMessageType[ParticipantResultEvent] match {
case ParticipantResultEvent(emResult: EmResult) =>
emResult.getInputModel shouldBe emInput.getUuid
emResult.getTime shouldBe 13362L.toDateTime
emResult.getTime shouldBe 13115L.toDateTime
emResult.getP should equalWithTolerance(
-0.003382375474.asMegaWatt
-0.0035233186089842434.asMegaWatt
)
emResult.getQ should equalWithTolerance(0.0000882855367.asMegaVar)
}
Expand All @@ -348,10 +344,10 @@ class EmAgentIT

/* TICK 14400
LOAD: 0.269 kW (unchanged)
PV: -0.066 kW
PV: -0.069 kW
STORAGE: SOC 100 %
-> charge with -0.202956 kW
-> remaining 0 kW
-> discharge with 0.2 kW
-> remaining 0.0 kW
*/

// send weather data before activation, which can happen
Expand All @@ -360,8 +356,8 @@ class EmAgentIT
14400,
weatherService.ref.toClassic,
WeatherData(
WattsPerSquareMeter(5d),
WattsPerSquareMeter(5d),
WattsPerSquareMeter(0.5d),
WattsPerSquareMeter(2d),
Celsius(0d),
MetersPerSecond(0d),
),
Expand All @@ -374,8 +370,10 @@ class EmAgentIT
case ParticipantResultEvent(emResult: EmResult) =>
emResult.getInputModel shouldBe emInput.getUuid
emResult.getTime shouldBe 14400L.toDateTime
emResult.getP should equalWithTolerance(0.asMegaWatt)
emResult.getQ should equalWithTolerance(0.000088285537.asMegaVar)
emResult.getP should equalWithTolerance(
0.0.asMegaWatt
)
emResult.getQ should equalWithTolerance(0.000088285536.asMegaVar)
}

scheduler.expectMessage(Completion(emAgentActivation, Some(21600)))
Expand Down Expand Up @@ -411,7 +409,6 @@ class EmAgentIT
loadInput,
LoadRuntimeConfig(
calculateMissingReactivePowerWithModel = true,
scaling = 1d,
modelBehaviour = "fix",
reference = "power",
uuids = List.empty,
Expand All @@ -436,7 +433,6 @@ class EmAgentIT
pvInput,
PvRuntimeConfig(
calculateMissingReactivePowerWithModel = true,
scaling = 2d,
uuids = List.empty,
),
primaryServiceProxy.ref.toClassic,
Expand Down Expand Up @@ -543,8 +539,8 @@ class EmAgentIT

weatherService.expectMessage(
RegisterForWeatherMessage(
hpInputModel.getNode.getGeoPosition.getY,
hpInputModel.getNode.getGeoPosition.getX,
adaptedHpInputModel.getNode.getGeoPosition.getY,
adaptedHpInputModel.getNode.getGeoPosition.getX,
)
)

Expand All @@ -559,10 +555,10 @@ class EmAgentIT

/* TICK 0
LOAD: 0.269 kW
PV: -5.617 kW
PV: -5.842 kW
Heat pump: off, can be turned on or stay off
-> set point ~3.5 kW (bigger than 50 % rated apparent power): turned on
-> remaining -0.499 kW
-> remaining -0.723 kW
*/

emAgentActivation ! Activation(0)
Expand All @@ -572,8 +568,8 @@ class EmAgentIT
0,
weatherService.ref.toClassic,
WeatherData(
WattsPerSquareMeter(540d),
WattsPerSquareMeter(200d),
WattsPerSquareMeter(100d),
Celsius(0d),
MetersPerSecond(0d),
),
Expand All @@ -586,19 +582,21 @@ class EmAgentIT
emResult.getInputModel shouldBe emInput.getUuid
emResult.getTime shouldBe 0.toDateTime
emResult.getP should equalWithTolerance(
-0.000498850118.asMegaWatt
-0.0007234002705905523.asMegaWatt
)
emResult.getQ should equalWithTolerance(
0.0010731200407782782.asMegaVar
)
emResult.getQ should equalWithTolerance(0.001073120041.asMegaVar)
}

scheduler.expectMessage(Completion(emAgentActivation, Some(7200)))

/* TICK 7200
LOAD: 0.269 kW (unchanged)
PV: -3.651 kW
PV: -3.791 kW
Heat pump: running (turned on from last request), can also be turned off
-> set point ~3.5 kW (bigger than 50 % rated apparent power): stays turned on with unchanged state
-> remaining 1.468 kW
-> remaining 1.327 kW
*/

emAgentActivation ! Activation(7200)
Expand All @@ -608,8 +606,8 @@ class EmAgentIT
7200,
weatherService.ref.toClassic,
WeatherData(
WattsPerSquareMeter(300d),
WattsPerSquareMeter(500d),
WattsPerSquareMeter(50d),
WattsPerSquareMeter(150d),
Celsius(0d),
MetersPerSecond(0d),
),
Expand All @@ -621,18 +619,22 @@ class EmAgentIT
case ParticipantResultEvent(emResult: EmResult) =>
emResult.getInputModel shouldBe emInput.getUuid
emResult.getTime shouldBe 7200.toDateTime
emResult.getP should equalWithTolerance(0.001467624526.asMegaWatt)
emResult.getQ should equalWithTolerance(0.001073120041.asMegaVar)
emResult.getP should equalWithTolerance(
0.0013266813910157566.asMegaWatt
)
emResult.getQ should equalWithTolerance(
0.0010731200407782782.asMegaVar
)
}

scheduler.expectMessage(Completion(emAgentActivation, Some(14400)))

/* TICK 14400
LOAD: 0.269 kW (unchanged)
PV: -0.066 kW
PV: -0.07 kW
Heat pump: Is still running, can still be turned off
-> flex signal is 0 MW: Heat pump is turned off
-> remaining 0.203 kW
-> remaining 0.199 kW
*/

emAgentActivation ! Activation(14400)
Expand All @@ -643,8 +645,8 @@ class EmAgentIT
14400,
weatherService.ref.toClassic,
WeatherData(
WattsPerSquareMeter(5d),
WattsPerSquareMeter(5d),
WattsPerSquareMeter(0.5d),
WattsPerSquareMeter(2d),
Celsius(0d),
MetersPerSecond(0d),
),
Expand All @@ -656,18 +658,22 @@ class EmAgentIT
case ParticipantResultEvent(emResult: EmResult) =>
emResult.getInputModel shouldBe emInput.getUuid
emResult.getTime shouldBe 14400L.toDateTime
emResult.getP should equalWithTolerance(0.000202956264.asMegaWatt)
emResult.getQ should equalWithTolerance(0.000088285537.asMegaVar)
emResult.getP should equalWithTolerance(
0.00019892577822992104.asMegaWatt
)
emResult.getQ should equalWithTolerance(
0.0000882855367033582.asMegaVar
)
}

scheduler.expectMessage(Completion(emAgentActivation, Some(21600)))

/* TICK 21600
LOAD: 0.269 kW (unchanged)
PV: -0.026 kW
PV: -0.023 kW
Heat pump: Is not running, can run or stay off
-> flex signal is 0 MW: Heat pump is turned off
-> remaining 0.242 kW
-> remaining 0.245 kW
*/

emAgentActivation ! Activation(21600)
Expand All @@ -678,8 +684,8 @@ class EmAgentIT
weatherService.ref.toClassic,
WeatherData(
// Same irradiation, but different angle of the sun
WattsPerSquareMeter(5d),
WattsPerSquareMeter(5d),
WattsPerSquareMeter(2d),
WattsPerSquareMeter(4d),
Celsius(0d),
MetersPerSecond(0d),
),
Expand All @@ -691,8 +697,12 @@ class EmAgentIT
case ParticipantResultEvent(emResult: EmResult) =>
emResult.getInputModel shouldBe emInput.getUuid
emResult.getTime shouldBe 21600.toDateTime
emResult.getP should equalWithTolerance(0.000242284024.asMegaWatt)
emResult.getQ should equalWithTolerance(0.000088285537.asMegaVar)
emResult.getP should equalWithTolerance(
0.0002450436827011999.asMegaWatt
)
emResult.getQ should equalWithTolerance(
0.0000882855367033582.asMegaVar
)
}

scheduler.expectMessage(Completion(emAgentActivation, Some(28800)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ trait PvInputTestData
nodeInputNoSlackNs04KvA,
CosPhiFixed.CONSTANT_CHARACTERISTIC,
null,
1,
0.2,
Quantities.getQuantity(12, StandardUnits.AZIMUTH),
Quantities.getQuantity(10, StandardUnits.EFFICIENCY),
Quantities.getQuantity(100, StandardUnits.SOLAR_ELEVATION_ANGLE),
12,
11,
Quantities.getQuantity(90, StandardUnits.EFFICIENCY),
Quantities.getQuantity(45, StandardUnits.SOLAR_ELEVATION_ANGLE),
0.9,
1.0,
false,
Quantities.getQuantity(10, StandardUnits.S_RATED),
0.95,
Expand Down

0 comments on commit 4ea6c77

Please sign in to comment.