Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed pvInput values and corresponding expected results #1177

Merged
merged 13 commits into from
Feb 17, 2025
Merged
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
126 changes: 73 additions & 53 deletions src/test/scala/edu/ie3/simona/agent/em/EmAgentIT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ import squants.motion.MetersPerSecond
import squants.thermal.Celsius

import java.time.ZonedDateTime
import scala.concurrent.duration.{FiniteDuration, SECONDS}

class EmAgentIT
extends ScalaTestWithActorTestKit
with AnyWordSpecLike
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 Down Expand Up @@ -150,7 +150,7 @@ class EmAgentIT
pvInput,
PvRuntimeConfig(
calculateMissingReactivePowerWithModel = true,
scaling = 2d,
scaling = 1d,
uuids = List.empty,
),
primaryServiceProxy.ref.toClassic,
Expand Down Expand Up @@ -260,10 +260,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 +272,8 @@ class EmAgentIT
0,
weatherService.ref.toClassic,
WeatherData(
WattsPerSquareMeter(540d),
WattsPerSquareMeter(200d),
WattsPerSquareMeter(100d),
Celsius(0d),
MetersPerSecond(0d),
),
Expand All @@ -285,18 +285,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
STORAGE: SOC 63.3 %
-> charge with 3.382 kW
PV: -3.791 kW
STORAGE: SOC 63.3 % fixme: reminder check this at the end
-> charge with 3.522 kW
-> remaining 0 kW
*/

Expand All @@ -306,8 +308,8 @@ class EmAgentIT
7200,
weatherService.ref.toClassic,
WeatherData(
WattsPerSquareMeter(300d),
WattsPerSquareMeter(500d),
WattsPerSquareMeter(50d),
WattsPerSquareMeter(150d),
Celsius(0d),
MetersPerSecond(0d),
),
Expand All @@ -318,28 +320,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 +352,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
-> charge with 0 kW
-> remaining 0.2 kW
*/

// send weather data before activation, which can happen
Expand All @@ -360,8 +364,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 +378,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 @@ -436,7 +442,7 @@ class EmAgentIT
pvInput,
PvRuntimeConfig(
calculateMissingReactivePowerWithModel = true,
scaling = 2d,
scaling = 1d,
uuids = List.empty,
),
primaryServiceProxy.ref.toClassic,
Expand Down Expand Up @@ -543,8 +549,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 +565,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.072 kW
*/

emAgentActivation ! Activation(0)
Expand All @@ -572,8 +578,8 @@ class EmAgentIT
0,
weatherService.ref.toClassic,
WeatherData(
WattsPerSquareMeter(540d),
WattsPerSquareMeter(200d),
WattsPerSquareMeter(100d),
Celsius(0d),
MetersPerSecond(0d),
),
Expand All @@ -586,19 +592,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 +616,8 @@ class EmAgentIT
7200,
weatherService.ref.toClassic,
WeatherData(
WattsPerSquareMeter(300d),
WattsPerSquareMeter(500d),
WattsPerSquareMeter(50d),
WattsPerSquareMeter(150d),
Celsius(0d),
MetersPerSecond(0d),
),
Expand All @@ -621,18 +629,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 +655,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 +668,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 +694,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 +707,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