From ceaefb2f4fd00044eb33b63f5d65e688f39424de Mon Sep 17 00:00:00 2001 From: pierrepetersmeier Date: Tue, 5 Nov 2024 14:20:40 +0100 Subject: [PATCH 01/14] Set StorageMinLvl zero --- .../scala/edu/ie3/simona/model/participant/ChpModelSpec.scala | 2 +- .../simona/model/thermal/CylindricalThermalStorageSpec.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala index 2d4a66da85..03f819e283 100644 --- a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala @@ -62,7 +62,7 @@ class ChpModelSpec "ThermalStorage", thermalBus, getQuantity(100, StandardUnits.VOLUME), - getQuantity(20, StandardUnits.VOLUME), + getQuantity(0, StandardUnits.VOLUME), getQuantity(30, StandardUnits.TEMPERATURE), getQuantity(40, StandardUnits.TEMPERATURE), getQuantity(1.15, StandardUnits.SPECIFIC_HEAT_CAPACITY), diff --git a/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala index 52cbb30f79..7219702f9f 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala @@ -34,7 +34,7 @@ class CylindricalThermalStorageSpec "ThermalStorage", null, getQuantity(100, StandardUnits.VOLUME), - getQuantity(20, StandardUnits.VOLUME), + getQuantity(0, StandardUnits.VOLUME), getQuantity(30, StandardUnits.TEMPERATURE), getQuantity(40, StandardUnits.TEMPERATURE), getQuantity(1.15, StandardUnits.SPECIFIC_HEAT_CAPACITY), From cd258ef86e7b6fb48346b57e8e61126ae4ca7c89 Mon Sep 17 00:00:00 2001 From: pierrepetersmeier Date: Thu, 21 Nov 2024 16:30:57 +0100 Subject: [PATCH 02/14] CylindricalThermalStorageSpec Storage without storageVolumeLvlMin --- .../model/thermal/CylindricalThermalStorage.scala | 2 +- .../simona/model/participant/ChpModelSpec.scala | 10 +++++----- .../thermal/CylindricalThermalStorageSpec.scala | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorage.scala b/src/main/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorage.scala index fedea75204..f225e0375f 100644 --- a/src/main/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorage.scala +++ b/src/main/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorage.scala @@ -166,7 +166,7 @@ final case class CylindricalThermalStorage( return Some(lack) } } - None + Some(zeroKWH) } } diff --git a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala index 03f819e283..75b63dbc4c 100644 --- a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala @@ -145,7 +145,7 @@ class ChpModelSpec "Check active power after calculating next state with #chpState and heat demand #heatDemand kWh:" in { val testCases = Table( ("chpState", "storageLvl", "heatDemand", "expectedActivePower"), - (chpStateNotRunning, 90, 0, 0), // tests case (false, false, true) + // (chpStateNotRunning, 90, 0, 0), // tests case (false, false, true) ( chpStateNotRunning, 90, @@ -190,7 +190,7 @@ class ChpModelSpec "Check total energy after calculating next state with #chpState and heat demand #heatDemand kWh:" in { val testCases = Table( ("chpState", "storageLvl", "heatDemand", "expectedTotalEnergy"), - (chpStateNotRunning, 90, 0, 0), // tests case (false, false, true) + /*(chpStateNotRunning, 90, 0, 0), // tests case (false, false, true)*/ ( chpStateNotRunning, 90, @@ -241,11 +241,11 @@ class ChpModelSpec chpStateNotRunning, 90, 8 * 115, - 230, + 115, ), // tests case (false, true, false) (chpStateNotRunning, 90, 10, 1025), // tests case (false, true, true) (chpStateRunning, 90, 0, 1135), // tests case (true, false, true) - (chpStateRunning, 90, 8 * 115, 230), // tests case (true, true, false) + (chpStateRunning, 90, 8 * 115, 215), // tests case (true, true, false) (chpStateRunning, 90, 10, 1125), // tests case (true, true, true) ( chpStateRunning, @@ -257,7 +257,7 @@ class ChpModelSpec chpStateRunning, 90, 9 * 115, - 230, + 100, ), // test case (_, true, false) and demand not covered together with chp ( chpStateRunning, diff --git a/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala index 7219702f9f..6e2bf76419 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala @@ -94,14 +94,14 @@ class CylindricalThermalStorageSpec val isCovering = storage.isDemandCoveredByStorage(KilowattHours(5)) val lack = storage.tryToTakeAndReturnLack(vol2Energy(CubicMeters(95))) val newLevel3 = storage._storedEnergy - val notCovering = storage.isDemandCoveredByStorage(KilowattHours(1)) + val notCovering = storage.isDemandCoveredByStorage(KilowattHours(58)) initialLevel should approximate(vol2Energy(CubicMeters(70))) newLevel1 should approximate(vol2Energy(CubicMeters(50))) surplus.value shouldBe vol2Energy(CubicMeters(5)) newLevel2 should approximate(vol2Energy(CubicMeters(100))) - lack.value shouldBe vol2Energy(CubicMeters(15)) - newLevel3 should approximate(vol2Energy(CubicMeters(20))) + lack.value shouldBe vol2Energy(CubicMeters(0)) + newLevel3 should approximate(vol2Energy(CubicMeters(5))) isCovering shouldBe true notCovering shouldBe false } @@ -110,7 +110,7 @@ class CylindricalThermalStorageSpec val storage = buildThermalStorage(storageInput, CubicMeters(70)) val usableThermalEnergy = storage.usableThermalEnergy - usableThermalEnergy should approximate(KilowattHours(5 * 115)) + usableThermalEnergy should approximate(KilowattHours(805)) } "Apply, validation, and build method work correctly" in { @@ -150,7 +150,7 @@ class CylindricalThermalStorageSpec 3600L, -42.0, 260.0, - ThermalStorage.ThermalStorageThreshold.StorageEmpty(6171L), + ThermalStorage.ThermalStorageThreshold.StorageEmpty(25886L), ), ( 0L, @@ -168,7 +168,7 @@ class CylindricalThermalStorageSpec 3600L, -42.0, 240.0, - ThermalStorage.ThermalStorageThreshold.StorageEmpty(4457L), + ThermalStorage.ThermalStorageThreshold.StorageEmpty(24171L), ), ( 0L, @@ -186,7 +186,7 @@ class CylindricalThermalStorageSpec 3600L, -5000.0, 231.0, - ThermalStorage.ThermalStorageThreshold.StorageEmpty(3601L), + ThermalStorage.ThermalStorageThreshold.StorageEmpty(3766L), ), ) From d1d2a6397251dee5c2502a8bd3ff658ef7cec770 Mon Sep 17 00:00:00 2001 From: pierrepetersmeier <155652256+pierrepetersmeier@users.noreply.github.com> Date: Fri, 22 Nov 2024 14:28:55 +0100 Subject: [PATCH 03/14] set deprecated correctly --- src/main/scala/edu/ie3/simona/model/thermal/MutableStorage.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/scala/edu/ie3/simona/model/thermal/MutableStorage.scala b/src/main/scala/edu/ie3/simona/model/thermal/MutableStorage.scala index 785c5c4d47..6854883720 100644 --- a/src/main/scala/edu/ie3/simona/model/thermal/MutableStorage.scala +++ b/src/main/scala/edu/ie3/simona/model/thermal/MutableStorage.scala @@ -53,6 +53,7 @@ trait MutableStorage { * @return * lack */ + @deprecated("Use thermal storage state instead") def tryToTakeAndReturnLack( takenEnergy: Energy ): Option[Energy] From f8adf3af8c6543a0d61fdd763c1d9f00c89674ca Mon Sep 17 00:00:00 2001 From: pierrepetersmeier <155652256+pierrepetersmeier@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:05:05 +0100 Subject: [PATCH 04/14] Try to fix ChpModelSpec and CylindricalThermalStorageSpec Part One --- .../thermal/CylindricalThermalStorage.scala | 2 +- .../model/participant/ChpModelSpec.scala | 49 ++++++++++--------- .../CylindricalThermalStorageSpec.scala | 8 +-- 3 files changed, 32 insertions(+), 27 deletions(-) diff --git a/src/main/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorage.scala b/src/main/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorage.scala index a13c9d4f84..e49dde2633 100644 --- a/src/main/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorage.scala +++ b/src/main/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorage.scala @@ -166,7 +166,7 @@ final case class CylindricalThermalStorage( return Some(lack) } } - Some(zeroKWH) + None } } diff --git a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala index 512901f1a6..1218790c5c 100644 --- a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala @@ -50,7 +50,7 @@ class ChpModelSpec val chpStateNotRunning: ChpState = ChpState(isRunning = false, 0, Kilowatts(0), KilowattHours(0)) val chpStateRunning: ChpState = - ChpState(isRunning = true, 0, Kilowatts(0), KilowattHours(0)) + ChpState(isRunning = true, 0, Kilowatts(42), KilowattHours(42)) val (storageInput, chpInput) = setupSpec() @@ -145,27 +145,27 @@ class ChpModelSpec "Check active power after calculating next state with #chpState and heat demand #heatDemand kWh:" in { val testCases = Table( ("chpState", "storageLvl", "heatDemand", "expectedActivePower"), - // (chpStateNotRunning, 90, 0, 0), // tests case (false, false, true) + (chpStateNotRunning, 90, 0, 0), // tests case (false, false, true) ( chpStateNotRunning, 90, - 8 * 115, + 10 * 115, 95, ), // tests case (false, true, false) (chpStateNotRunning, 90, 10, 0), // tests case (false, true, true) (chpStateRunning, 90, 0, 95), // tests case (true, false, true) - (chpStateRunning, 90, 8 * 115, 95), // tests case (true, true, false) + (chpStateRunning, 90, 10 * 115, 95), // tests case (true, true, false) (chpStateRunning, 90, 10, 95), // tests case (true, true, true) ( chpStateRunning, 90, - 7 * 115 + 1, + 9 * 115 + 1, 95, ), // test case (_, true, false) and demand covered together with chp ( chpStateRunning, 90, - 9 * 115, + 11 * 115, 95, ), // test case (_, true, false) and demand not covered together with chp ( @@ -190,27 +190,29 @@ class ChpModelSpec "Check total energy after calculating next state with #chpState and heat demand #heatDemand kWh:" in { val testCases = Table( ("chpState", "storageLvl", "heatDemand", "expectedTotalEnergy"), - /*(chpStateNotRunning, 90, 0, 0), // tests case (false, false, true)*/ + (chpStateNotRunning, 90, 0, 0), // tests case (false, false, true) + // Fixme Check this, why 100? ( chpStateNotRunning, 90, - 8 * 115, + 10 * 115, 100, ), // tests case (false, true, false) (chpStateNotRunning, 90, 10, 0), // tests case (false, true, true) + // Fixme Check this, why 100? (chpStateRunning, 90, 0, 100), // tests case (true, false, true) - (chpStateRunning, 90, 8 * 115, 100), // tests case (true, true, false) + (chpStateRunning, 90, 10 * 115, 100), // tests case (true, true, false) (chpStateRunning, 90, 10, 100), // tests case (true, true, true) ( chpStateRunning, 90, - 7 * 115 + 1, + 9 * 115 + 1, 100, ), // test case (_, true, false) and demand covered together with chp ( chpStateRunning, 90, - 9 * 115, + 11 * 115, 100, ), // test case (_, true, false) and demand not covered together with chp ( @@ -236,29 +238,32 @@ class ChpModelSpec "Check storage level after calculating next state with #chpState and heat demand #heatDemand kWh:" in { val testCases = Table( ("chpState", "storageLvl", "heatDemand", "expectedStoredEnergy"), - (chpStateNotRunning, 90, 0, 1035), // tests case (false, false, true) + // (chpStateNotRunning, 90, 0, 1035), // tests case (false, false, true) ( chpStateNotRunning, - 90, + 70, + // todo check this 8 * 115, - 115, + 0, ), // tests case (false, true, false) (chpStateNotRunning, 90, 10, 1025), // tests case (false, true, true) + // todo check this, why 1135? (chpStateRunning, 90, 0, 1135), // tests case (true, false, true) - (chpStateRunning, 90, 8 * 115, 215), // tests case (true, true, false) + (chpStateRunning, 70, 8 * 115, 0), // tests case (true, true, false) (chpStateRunning, 90, 10, 1125), // tests case (true, true, true) - ( - chpStateRunning, - 90, - 806, - 329, + // todo, why not +100? + (chpStateRunning, + 70, + 7 * 115 + 1, + 99, ), // test case (_, true, false) and demand covered together with chp ( chpStateRunning, - 90, + 70, 9 * 115, - 100, + 0, ), // test case (_, true, false) and demand not covered together with chp + // todo check this, why 92? ( chpStateRunning, 92, diff --git a/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala index 6e2bf76419..8baaffd23d 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala @@ -92,16 +92,16 @@ class CylindricalThermalStorageSpec storage.tryToStoreAndReturnRemainder(vol2Energy(CubicMeters(55))) val newLevel2 = storage._storedEnergy val isCovering = storage.isDemandCoveredByStorage(KilowattHours(5)) - val lack = storage.tryToTakeAndReturnLack(vol2Energy(CubicMeters(95))) + val lack = storage.tryToTakeAndReturnLack(vol2Energy(CubicMeters(115))) val newLevel3 = storage._storedEnergy - val notCovering = storage.isDemandCoveredByStorage(KilowattHours(58)) + val notCovering = storage.isDemandCoveredByStorage(KilowattHours(1)) initialLevel should approximate(vol2Energy(CubicMeters(70))) newLevel1 should approximate(vol2Energy(CubicMeters(50))) surplus.value shouldBe vol2Energy(CubicMeters(5)) newLevel2 should approximate(vol2Energy(CubicMeters(100))) - lack.value shouldBe vol2Energy(CubicMeters(0)) - newLevel3 should approximate(vol2Energy(CubicMeters(5))) + lack.value shouldBe vol2Energy(CubicMeters(15)) + newLevel3 should approximate(vol2Energy(CubicMeters(0))) isCovering shouldBe true notCovering shouldBe false } From 40a3c93fd222f52950bb1e9a9f9d1e8df474ad64 Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Thu, 28 Nov 2024 08:52:09 +0100 Subject: [PATCH 05/14] change to table driven test --- .../model/participant/ChpModelSpec.scala | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala index 1218790c5c..36a5e1b266 100644 --- a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala @@ -286,9 +286,15 @@ class ChpModelSpec } "Check time tick and running status after calculating next state with #chpState and heat demand #heatDemand kWh:" in { - val testCases = Seq( - // (ChpState, Storage Level, Heat Demand, Expected Time Tick, Expected Running Status) + val testCases = Table( ( + "chpState", + "storageLvl", + "heatDemand", + "expectedTick", + "expectedRunningStatus", + ), + ( chpStateNotRunning, 90, 0, @@ -341,23 +347,22 @@ class ChpModelSpec ), // Test case (true, true, true) and storage volume exceeds maximum ) - for ( + forAll(testCases) { ( - chpState, - storageLvl, - heatDemand, - expectedTimeTick, - expectedRunningStatus, - ) <- testCases - ) { - val chpData = buildChpRelevantData(chpState, heatDemand) - val thermalStorage = buildThermalStorage(storageInput, storageLvl) - val chpModel = buildChpModel(thermalStorage) + chpState, + storageLvl, + heatDemand, + expectedTick, + expectedRunningStatus, + ) => + val chpData = buildChpRelevantData(chpState, heatDemand) + val thermalStorage = buildThermalStorage(storageInput, storageLvl) + val chpModel = buildChpModel(thermalStorage) - val nextState = chpModel.calculateNextState(chpData) + val nextState = chpModel.calculateNextState(chpData) - nextState.lastTimeTick shouldEqual expectedTimeTick - nextState.isRunning shouldEqual expectedRunningStatus + nextState.lastTimeTick shouldEqual expectedTick + nextState.isRunning shouldEqual expectedRunningStatus } } From bd287d80a5e1cd4d0c3ebae94d22e41652994ffa Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Thu, 28 Nov 2024 08:56:31 +0100 Subject: [PATCH 06/14] fix ChpModelSpec --- .../model/participant/ChpModelSpec.scala | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala index 36a5e1b266..9948f77838 100644 --- a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala @@ -145,27 +145,27 @@ class ChpModelSpec "Check active power after calculating next state with #chpState and heat demand #heatDemand kWh:" in { val testCases = Table( ("chpState", "storageLvl", "heatDemand", "expectedActivePower"), - (chpStateNotRunning, 90, 0, 0), // tests case (false, false, true) + (chpStateNotRunning, 70, 0, 0), // tests case (false, false, true) ( chpStateNotRunning, - 90, - 10 * 115, + 70, + 8 * 115, 95, ), // tests case (false, true, false) - (chpStateNotRunning, 90, 10, 0), // tests case (false, true, true) - (chpStateRunning, 90, 0, 95), // tests case (true, false, true) - (chpStateRunning, 90, 10 * 115, 95), // tests case (true, true, false) - (chpStateRunning, 90, 10, 95), // tests case (true, true, true) + (chpStateNotRunning, 70, 10, 0), // tests case (false, true, true) + (chpStateRunning, 70, 0, 95), // tests case (true, false, true) + (chpStateRunning, 70, 8 * 115, 95), // tests case (true, true, false) + (chpStateRunning, 70, 10, 95), // tests case (true, true, true) ( chpStateRunning, - 90, - 9 * 115 + 1, + 70, + 7 * 115 + 1, 95, ), // test case (_, true, false) and demand covered together with chp ( chpStateRunning, - 90, - 11 * 115, + 70, + 9 * 115, 95, ), // test case (_, true, false) and demand not covered together with chp ( @@ -190,29 +190,29 @@ class ChpModelSpec "Check total energy after calculating next state with #chpState and heat demand #heatDemand kWh:" in { val testCases = Table( ("chpState", "storageLvl", "heatDemand", "expectedTotalEnergy"), - (chpStateNotRunning, 90, 0, 0), // tests case (false, false, true) + (chpStateNotRunning, 70, 0, 0), // tests case (false, false, true) // Fixme Check this, why 100? ( chpStateNotRunning, - 90, - 10 * 115, + 70, + 8 * 115, 100, ), // tests case (false, true, false) - (chpStateNotRunning, 90, 10, 0), // tests case (false, true, true) + (chpStateNotRunning, 70, 10, 0), // tests case (false, true, true) // Fixme Check this, why 100? - (chpStateRunning, 90, 0, 100), // tests case (true, false, true) - (chpStateRunning, 90, 10 * 115, 100), // tests case (true, true, false) - (chpStateRunning, 90, 10, 100), // tests case (true, true, true) + (chpStateRunning, 70, 0, 100), // tests case (true, false, true) + (chpStateRunning, 70, 8 * 115, 100), // tests case (true, true, false) + (chpStateRunning, 70, 10, 100), // tests case (true, true, true) ( chpStateRunning, - 90, - 9 * 115 + 1, + 70, + 7 * 115 + 1, 100, ), // test case (_, true, false) and demand covered together with chp ( chpStateRunning, - 90, - 11 * 115, + 70, + 9 * 115, 100, ), // test case (_, true, false) and demand not covered together with chp ( @@ -238,7 +238,7 @@ class ChpModelSpec "Check storage level after calculating next state with #chpState and heat demand #heatDemand kWh:" in { val testCases = Table( ("chpState", "storageLvl", "heatDemand", "expectedStoredEnergy"), - // (chpStateNotRunning, 90, 0, 1035), // tests case (false, false, true) + (chpStateNotRunning, 70, 0, 805), // tests case (false, false, true) ( chpStateNotRunning, 70, @@ -246,15 +246,15 @@ class ChpModelSpec 8 * 115, 0, ), // tests case (false, true, false) - (chpStateNotRunning, 90, 10, 1025), // tests case (false, true, true) + (chpStateNotRunning, 70, 10, 795), // tests case (false, true, true) // todo check this, why 1135? - (chpStateRunning, 90, 0, 1135), // tests case (true, false, true) + (chpStateRunning, 70, 0, 905), // tests case (true, false, true) (chpStateRunning, 70, 8 * 115, 0), // tests case (true, true, false) - (chpStateRunning, 90, 10, 1125), // tests case (true, true, true) + (chpStateRunning, 70, 10, 895), // tests case (true, true, true) // todo, why not +100? (chpStateRunning, 70, - 7 * 115 + 1, + 806, 99, ), // test case (_, true, false) and demand covered together with chp ( @@ -296,44 +296,44 @@ class ChpModelSpec ), ( chpStateNotRunning, - 90, + 70, 0, 7200, false, ), // Test case (false, false, true) ( chpStateNotRunning, - 90, + 70, 8 * 115, 7200, true, ), // Test case (false, true, false) ( chpStateNotRunning, - 90, + 70, 10, 7200, false, ), // Test case (false, true, true) - (chpStateRunning, 90, 0, 7200, true), // Test case (true, false, true) + (chpStateRunning, 70, 0, 7200, true), // Test case (true, false, true) ( chpStateRunning, - 90, + 70, 8 * 115, 7200, true, ), // Test case (true, true, false) - (chpStateRunning, 90, 10, 7200, true), // Test case (true, true, true) + (chpStateRunning, 70, 10, 7200, true), // Test case (true, true, true) ( chpStateRunning, - 90, + 70, 806, 7200, true, ), // Test case (_, true, false) and demand covered together with chp ( chpStateRunning, - 90, + 70, 9 * 115, 7200, true, From 19e32ef1e9eead1569c6300a910d0cb48b7ea685 Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Thu, 28 Nov 2024 09:32:11 +0100 Subject: [PATCH 07/14] proposal for CylindricalThermalStorageSpec to keep the thresholds from the original test --- .../CylindricalThermalStorageSpec.scala | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala index 8baaffd23d..bfab56e9d1 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala @@ -145,12 +145,12 @@ class CylindricalThermalStorageSpec ), ( 0L, - 250.0, + 20.0, 10.0, 3600L, -42.0, - 260.0, - ThermalStorage.ThermalStorageThreshold.StorageEmpty(25886L), + 30.0, + ThermalStorage.ThermalStorageThreshold.StorageEmpty(6171L), ), ( 0L, @@ -163,12 +163,12 @@ class CylindricalThermalStorageSpec ), ( 0L, - 250.0, + 20.0, -10.0, 3600L, -42.0, - 240.0, - ThermalStorage.ThermalStorageThreshold.StorageEmpty(24171L), + 10.0, + ThermalStorage.ThermalStorageThreshold.StorageEmpty(4457L), ), ( 0L, @@ -181,12 +181,12 @@ class CylindricalThermalStorageSpec ), ( 0L, - 240.0, + 10.0, -9.0, 3600L, -5000.0, - 231.0, - ThermalStorage.ThermalStorageThreshold.StorageEmpty(3766L), + 1.0, + ThermalStorage.ThermalStorageThreshold.StorageEmpty(3601L), ), ) From e3aae40babce686f17d991edc825bcaaa3806534 Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Thu, 28 Nov 2024 09:43:30 +0100 Subject: [PATCH 08/14] fmt --- .../edu/ie3/simona/model/participant/ChpModelSpec.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala index 9948f77838..e63e4f3e8c 100644 --- a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala @@ -252,7 +252,8 @@ class ChpModelSpec (chpStateRunning, 70, 8 * 115, 0), // tests case (true, true, false) (chpStateRunning, 70, 10, 895), // tests case (true, true, true) // todo, why not +100? - (chpStateRunning, + ( + chpStateRunning, 70, 806, 99, @@ -294,7 +295,7 @@ class ChpModelSpec "expectedTick", "expectedRunningStatus", ), - ( + ( chpStateNotRunning, 70, 0, From 521a8dc581b9ef39b6f8ad30cc6f1e6b17bf6276 Mon Sep 17 00:00:00 2001 From: Pierre <155652256+pierrepetersmeier@users.noreply.github.com> Date: Tue, 3 Dec 2024 10:51:40 +0100 Subject: [PATCH 09/14] Update src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala Co-authored-by: Daniel Feismann <98817556+danielfeismann@users.noreply.github.com> --- .../scala/edu/ie3/simona/model/participant/ChpModelSpec.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala index e63e4f3e8c..2c47b9fbe7 100644 --- a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala @@ -242,7 +242,6 @@ class ChpModelSpec ( chpStateNotRunning, 70, - // todo check this 8 * 115, 0, ), // tests case (false, true, false) From 745e33c6487773a646a9dab3c9c255f890211e06 Mon Sep 17 00:00:00 2001 From: Pierre <155652256+pierrepetersmeier@users.noreply.github.com> Date: Tue, 3 Dec 2024 11:13:16 +0100 Subject: [PATCH 10/14] Update src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala Co-authored-by: Daniel Feismann <98817556+danielfeismann@users.noreply.github.com> --- .../scala/edu/ie3/simona/model/participant/ChpModelSpec.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala index 2c47b9fbe7..97ee13d97b 100644 --- a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala @@ -191,7 +191,6 @@ class ChpModelSpec val testCases = Table( ("chpState", "storageLvl", "heatDemand", "expectedTotalEnergy"), (chpStateNotRunning, 70, 0, 0), // tests case (false, false, true) - // Fixme Check this, why 100? ( chpStateNotRunning, 70, From 8252fe9bdcba939b8b3a98fcaf9461adc5f18a48 Mon Sep 17 00:00:00 2001 From: Pierre <155652256+pierrepetersmeier@users.noreply.github.com> Date: Tue, 3 Dec 2024 11:13:41 +0100 Subject: [PATCH 11/14] Update src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala Co-authored-by: Daniel Feismann <98817556+danielfeismann@users.noreply.github.com> --- .../scala/edu/ie3/simona/model/participant/ChpModelSpec.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala index 97ee13d97b..587a0662fc 100644 --- a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala @@ -198,7 +198,6 @@ class ChpModelSpec 100, ), // tests case (false, true, false) (chpStateNotRunning, 70, 10, 0), // tests case (false, true, true) - // Fixme Check this, why 100? (chpStateRunning, 70, 0, 100), // tests case (true, false, true) (chpStateRunning, 70, 8 * 115, 100), // tests case (true, true, false) (chpStateRunning, 70, 10, 100), // tests case (true, true, true) From d14db08882160ad6ed29d84c236793dd289b42cb Mon Sep 17 00:00:00 2001 From: Pierre <155652256+pierrepetersmeier@users.noreply.github.com> Date: Tue, 3 Dec 2024 11:19:16 +0100 Subject: [PATCH 12/14] Update src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala Co-authored-by: Daniel Feismann <98817556+danielfeismann@users.noreply.github.com> --- .../scala/edu/ie3/simona/model/participant/ChpModelSpec.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala index 587a0662fc..afbd2856b6 100644 --- a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala @@ -248,7 +248,6 @@ class ChpModelSpec (chpStateRunning, 70, 0, 905), // tests case (true, false, true) (chpStateRunning, 70, 8 * 115, 0), // tests case (true, true, false) (chpStateRunning, 70, 10, 895), // tests case (true, true, true) - // todo, why not +100? ( chpStateRunning, 70, From 42b0f9abfc327d02253cc72b9b555924e00f738b Mon Sep 17 00:00:00 2001 From: pierrepetersmeier <155652256+pierrepetersmeier@users.noreply.github.com> Date: Tue, 3 Dec 2024 11:44:23 +0100 Subject: [PATCH 13/14] Deleted unnecessary comments in ChpModelSpec.scala. Refactoring "storedEnergy" and "expectedStoredEnergy" in CylindricalThermalStorageSpec.scala. --- .../scala/edu/ie3/simona/model/participant/ChpModelSpec.scala | 4 +--- .../simona/model/thermal/CylindricalThermalStorageSpec.scala | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala index afbd2856b6..8a43b3c6ff 100644 --- a/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/participant/ChpModelSpec.scala @@ -244,7 +244,6 @@ class ChpModelSpec 0, ), // tests case (false, true, false) (chpStateNotRunning, 70, 10, 795), // tests case (false, true, true) - // todo check this, why 1135? (chpStateRunning, 70, 0, 905), // tests case (true, false, true) (chpStateRunning, 70, 8 * 115, 0), // tests case (true, true, false) (chpStateRunning, 70, 10, 895), // tests case (true, true, true) @@ -260,13 +259,12 @@ class ChpModelSpec 9 * 115, 0, ), // test case (_, true, false) and demand not covered together with chp - // todo check this, why 92? ( chpStateRunning, 92, 1, 1150, - ), // test case (true, true, true) and storage volume exceeds maximum + ), // test case (true, true, true) CHP running, storage at lvl 92 (1058 kWh) + 100 kWh from CHP exceeds max capacity (1150 kWh). ) forAll(testCases) { diff --git a/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala index bfab56e9d1..8936620e6a 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/CylindricalThermalStorageSpec.scala @@ -232,7 +232,7 @@ class CylindricalThermalStorageSpec "expectedStoredEnergy", ), (0L, 250.0, 10.0, 3600L, 0.0, 260.0), - (0L, 250.0, -10.0, 3600L, 0.0, 240.0), + (0L, 20.0, -10.0, 3600L, 0.0, 10.0), ) forAll(cases) { From 7fa7d910e0d9a94eaca6b4144e488cb0cb2463b5 Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Tue, 10 Dec 2024 16:53:37 +0100 Subject: [PATCH 14/14] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8795209c4..a3b29efcb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -110,6 +110,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Refactoring to only use 'lastHpState' and 'relevantData' for 'ThermalGrid' calculations [#916](https://github.com/ie3-institute/simona/issues/916) - Refactor thermal calcRelevantData [#1051](https://github.com/ie3-institute/simona/issues/1051) - Removed Deployment stage from Jenkinsfile [#1063](https://github.com/ie3-institute/simona/issues/1063) +- Prepare 'ChpModelSpec' and 'CylindricalThermalStorageSpec' for Storage without storageVolumeLvlMin [#1012](https://github.com/ie3-institute/simona/issues/1012) ### Fixed - Fix rendering of references in documentation [#505](https://github.com/ie3-institute/simona/issues/505)