From 58926844f51680f4622cad3c959f3713d2fba998 Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Fri, 21 Feb 2025 16:16:25 +0100 Subject: [PATCH 1/3] Introduce thermal power for thermal storages --- CHANGELOG.md | 1 + .../input/thermal/cylindricalstorage.md | 6 +++- .../result/participant/cylindricalstorage.md | 2 +- .../main/input/ThermalDatamodelConcept.puml | 1 + .../input/CylindricalStorageInputFactory.java | 18 ++++++++-- .../thermal/CylindricalStorageInput.java | 35 ++++++++++++++++--- .../CylindricalStorageInputFactoryTest.groovy | 4 ++- .../ie3/datamodel/io/sink/SqlSinkTest.groovy | 2 +- .../io/source/csv/CsvThermalSourceTest.groovy | 1 + .../CylindricalStorageInputTest.groovy | 5 +-- .../ThermalValidationUtilsTest.groovy | 16 +++++---- .../common/SystemParticipantTestData.groovy | 5 ++- .../common/ThermalUnitInputTestData.groovy | 11 +++--- .../datamodel/io/sink/_sql/input_entities.sql | 1 + .../cylindrical_storage_input.csv | 4 +-- .../_thermal/cylindrical_storage_input.csv | 4 +-- 16 files changed, 88 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b35da38c7..b9d230a41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Enhance `TimeSeriesSource` with method to retrieve the previous value before a given key [#1182](https://github.com/ie3-institute/PowerSystemDataModel/issues/1182) - Added `BdewLoadProfileTimeSeries` [#1230](https://github.com/ie3-institute/PowerSystemDataModel/issues/1230) - Added `RandomLoadProfileTimeSeries` [#1232](https://github.com/ie3-institute/PowerSystemDataModel/issues/1232) +- Attribute `pThermalRated` for `ThermalStorage`s [#679](https://github.com/ie3-institute/PowerSystemDataModel/issues/679) ### Fixed - Removing opened `SwitchInput` during connectivity check [#1221](https://github.com/ie3-institute/PowerSystemDataModel/issues/1221) diff --git a/docs/readthedocs/models/input/thermal/cylindricalstorage.md b/docs/readthedocs/models/input/thermal/cylindricalstorage.md index 6e674f91b..5da1828df 100644 --- a/docs/readthedocs/models/input/thermal/cylindricalstorage.md +++ b/docs/readthedocs/models/input/thermal/cylindricalstorage.md @@ -2,7 +2,7 @@ # Cylindrical Thermal Storage -Model of a cylindrical thermal storage using a fluent to store thermal energy. +Model of a cylindrical thermal storage using a fluid to store thermal energy. ## Attributes, Units and Remarks @@ -51,6 +51,10 @@ Model of a cylindrical thermal storage using a fluent to store thermal energy. * - c - kWh / (K :math:`\cdot` m³) - Specific heat capacity of the storage medium + + * - pThermalMax + - kW + - Maximum permissible thermal power of the storage ``` diff --git a/docs/readthedocs/models/result/participant/cylindricalstorage.md b/docs/readthedocs/models/result/participant/cylindricalstorage.md index b8a83dbf7..9fe8c5df5 100644 --- a/docs/readthedocs/models/result/participant/cylindricalstorage.md +++ b/docs/readthedocs/models/result/participant/cylindricalstorage.md @@ -2,7 +2,7 @@ # Cylindrical Thermal Storage -Result of a cylindrical thermal storage using a fluent to store thermal energy. +Result of a cylindrical thermal storage using a fluid to store thermal energy. ## Attributes, Units and Remarks diff --git a/docs/uml/main/input/ThermalDatamodelConcept.puml b/docs/uml/main/input/ThermalDatamodelConcept.puml index 3f275bc5b..d94f2ce4b 100644 --- a/docs/uml/main/input/ThermalDatamodelConcept.puml +++ b/docs/uml/main/input/ThermalDatamodelConcept.puml @@ -118,6 +118,7 @@ package models { - inletTemp: ComparableQuantity [°C] - returnTemp: ComparableQuantity [°C] - c: ComparableQuantity [kWh/(K*m³)] + - pThermalMax: ComparableQuantity [kW] } CylindricalStorageInput --|> ThermalStorageInput } diff --git a/src/main/java/edu/ie3/datamodel/io/factory/input/CylindricalStorageInputFactory.java b/src/main/java/edu/ie3/datamodel/io/factory/input/CylindricalStorageInputFactory.java index 08545acd5..b41f1eecd 100644 --- a/src/main/java/edu/ie3/datamodel/io/factory/input/CylindricalStorageInputFactory.java +++ b/src/main/java/edu/ie3/datamodel/io/factory/input/CylindricalStorageInputFactory.java @@ -12,6 +12,7 @@ import edu.ie3.datamodel.models.input.thermal.ThermalBusInput; import edu.ie3.util.quantities.interfaces.SpecificHeatCapacity; import java.util.UUID; +import javax.measure.quantity.Power; import javax.measure.quantity.Temperature; import javax.measure.quantity.Volume; import tech.units.indriya.ComparableQuantity; @@ -22,6 +23,7 @@ public class CylindricalStorageInputFactory private static final String INLET_TEMP = "inletTemp"; private static final String RETURN_TEMP = "returnTemp"; private static final String C = "c"; + private static final String P_THERMAL_MAX = "pThermalMax"; public CylindricalStorageInputFactory() { super(CylindricalStorageInput.class); @@ -29,7 +31,7 @@ public CylindricalStorageInputFactory() { @Override protected String[] getAdditionalFields() { - return new String[] {STORAGE_VOLUME_LVL, INLET_TEMP, RETURN_TEMP, C}; + return new String[] {STORAGE_VOLUME_LVL, INLET_TEMP, RETURN_TEMP, C, P_THERMAL_MAX}; } @Override @@ -48,7 +50,19 @@ protected CylindricalStorageInput buildModel( data.getQuantity(RETURN_TEMP, StandardUnits.TEMPERATURE); final ComparableQuantity c = data.getQuantity(C, StandardUnits.SPECIFIC_HEAT_CAPACITY); + final ComparableQuantity pThermalMax = + data.getQuantity(P_THERMAL_MAX, StandardUnits.ACTIVE_POWER_IN); + return new CylindricalStorageInput( - uuid, id, operator, operationTime, bus, storageVolumeLvl, inletTemp, returnTemp, c); + uuid, + id, + operator, + operationTime, + bus, + storageVolumeLvl, + inletTemp, + returnTemp, + c, + pThermalMax); } } diff --git a/src/main/java/edu/ie3/datamodel/models/input/thermal/CylindricalStorageInput.java b/src/main/java/edu/ie3/datamodel/models/input/thermal/CylindricalStorageInput.java index 3b1c2c473..443f708bc 100644 --- a/src/main/java/edu/ie3/datamodel/models/input/thermal/CylindricalStorageInput.java +++ b/src/main/java/edu/ie3/datamodel/models/input/thermal/CylindricalStorageInput.java @@ -11,6 +11,7 @@ import edu.ie3.util.quantities.interfaces.SpecificHeatCapacity; import java.util.Objects; import java.util.UUID; +import javax.measure.quantity.Power; import javax.measure.quantity.Temperature; import javax.measure.quantity.Volume; import tech.units.indriya.ComparableQuantity; @@ -25,6 +26,8 @@ public class CylindricalStorageInput extends ThermalStorageInput { private final ComparableQuantity returnTemp; /** Specific heat capacity of the storage medium (typically in kWh/K*m³) */ private final ComparableQuantity c; + /** Maximum permissible thermal power (typically in kW) */ + private final ComparableQuantity pThermalMax; /** * @param uuid Unique identifier of a cylindrical storage @@ -36,6 +39,7 @@ public class CylindricalStorageInput extends ThermalStorageInput { * @param inletTemp Temperature of the inlet * @param returnTemp Temperature of the outlet * @param c Specific heat capacity of the storage medium + * @param pThermalMax Maximum thermal power of the storage */ public CylindricalStorageInput( UUID uuid, @@ -46,12 +50,14 @@ public CylindricalStorageInput( ComparableQuantity storageVolumeLvl, ComparableQuantity inletTemp, ComparableQuantity returnTemp, - ComparableQuantity c) { + ComparableQuantity c, + ComparableQuantity pThermalMax) { super(uuid, id, operator, operationTime, bus); this.storageVolumeLvl = storageVolumeLvl.to(StandardUnits.VOLUME); this.inletTemp = inletTemp.to(StandardUnits.TEMPERATURE); this.returnTemp = returnTemp.to(StandardUnits.TEMPERATURE); this.c = c.to(StandardUnits.SPECIFIC_HEAT_CAPACITY); + this.pThermalMax = pThermalMax.to(StandardUnits.ACTIVE_POWER_IN); } /** @@ -62,6 +68,7 @@ public CylindricalStorageInput( * @param inletTemp Temperature of the inlet * @param returnTemp Temperature of the outlet * @param c Specific heat capacity of the storage medium + * @param pThermalMax Maximum thermal power of the storage */ public CylindricalStorageInput( UUID uuid, @@ -70,12 +77,14 @@ public CylindricalStorageInput( ComparableQuantity storageVolumeLvl, ComparableQuantity inletTemp, ComparableQuantity returnTemp, - ComparableQuantity c) { + ComparableQuantity c, + ComparableQuantity pThermalMax) { super(uuid, id, bus); this.storageVolumeLvl = storageVolumeLvl.to(StandardUnits.VOLUME); this.inletTemp = inletTemp.to(StandardUnits.TEMPERATURE); this.returnTemp = returnTemp.to(StandardUnits.TEMPERATURE); this.c = c.to(StandardUnits.SPECIFIC_HEAT_CAPACITY); + this.pThermalMax = pThermalMax.to(StandardUnits.ACTIVE_POWER_IN); } public ComparableQuantity getStorageVolumeLvl() { @@ -94,6 +103,10 @@ public ComparableQuantity getC() { return c; } + public ComparableQuantity getpThermalMax() { + return pThermalMax; + } + @Override public CylindricalStorageInputCopyBuilder copy() { return new CylindricalStorageInputCopyBuilder(this); @@ -107,12 +120,13 @@ public boolean equals(Object o) { return storageVolumeLvl.equals(that.storageVolumeLvl) && inletTemp.equals(that.inletTemp) && returnTemp.equals(that.returnTemp) - && c.equals(that.c); + && c.equals(that.c) + && pThermalMax.equals(that.getpThermalMax()); } @Override public int hashCode() { - return Objects.hash(super.hashCode(), storageVolumeLvl, inletTemp, returnTemp, c); + return Objects.hash(super.hashCode(), storageVolumeLvl, inletTemp, returnTemp, c, pThermalMax); } @Override @@ -136,6 +150,8 @@ public String toString() { + returnTemp + ", c=" + c + + ", pThermalMax=" + + pThermalMax + '}'; } @@ -151,6 +167,7 @@ public static class CylindricalStorageInputCopyBuilder private ComparableQuantity inletTemp; private ComparableQuantity returnTemp; private ComparableQuantity c; + private ComparableQuantity pThermalMax; private CylindricalStorageInputCopyBuilder(CylindricalStorageInput entity) { super(entity); @@ -158,6 +175,7 @@ private CylindricalStorageInputCopyBuilder(CylindricalStorageInput entity) { this.inletTemp = entity.getInletTemp(); this.returnTemp = entity.getReturnTemp(); this.c = entity.getC(); + this.pThermalMax = entity.getpThermalMax(); } public CylindricalStorageInputCopyBuilder storageVolumeLvl( @@ -182,9 +200,15 @@ public CylindricalStorageInputCopyBuilder c(ComparableQuantity pThermalMax) { + this.pThermalMax = pThermalMax; + return this; + } + @Override public CylindricalStorageInputCopyBuilder scale(Double factor) { storageVolumeLvl(storageVolumeLvl.multiply(factor)); + pThermalMax(pThermalMax.multiply(factor)); return this; } @@ -199,7 +223,8 @@ public CylindricalStorageInput build() { storageVolumeLvl, inletTemp, returnTemp, - c); + c, + pThermalMax); } @Override diff --git a/src/test/groovy/edu/ie3/datamodel/io/factory/input/CylindricalStorageInputFactoryTest.groovy b/src/test/groovy/edu/ie3/datamodel/io/factory/input/CylindricalStorageInputFactoryTest.groovy index 20e516f8e..e8d7f8989 100644 --- a/src/test/groovy/edu/ie3/datamodel/io/factory/input/CylindricalStorageInputFactoryTest.groovy +++ b/src/test/groovy/edu/ie3/datamodel/io/factory/input/CylindricalStorageInputFactoryTest.groovy @@ -34,7 +34,8 @@ class CylindricalStorageInputFactoryTest extends Specification implements Facto "storagevolumelvl" : "3", "inlettemp" : "4", "returntemp" : "5", - "c" : "6" + "c" : "6", + "pThermalMax" : "7" ] def inputClass = CylindricalStorageInput def thermalBusInput = Mock(ThermalBusInput) @@ -55,6 +56,7 @@ class CylindricalStorageInputFactoryTest extends Specification implements Facto assert inletTemp == getQuant(parameter["inlettemp"], StandardUnits.TEMPERATURE) assert returnTemp == getQuant(parameter["returntemp"], StandardUnits.TEMPERATURE) assert c == getQuant(parameter["c"], StandardUnits.SPECIFIC_HEAT_CAPACITY) + assert pThermalMax == getQuant(parameter["pThermalMax"], StandardUnits.ACTIVE_POWER_IN) } } } diff --git a/src/test/groovy/edu/ie3/datamodel/io/sink/SqlSinkTest.groovy b/src/test/groovy/edu/ie3/datamodel/io/sink/SqlSinkTest.groovy index 75a0859a2..4973525e1 100644 --- a/src/test/groovy/edu/ie3/datamodel/io/sink/SqlSinkTest.groovy +++ b/src/test/groovy/edu/ie3/datamodel/io/sink/SqlSinkTest.groovy @@ -133,7 +133,7 @@ class SqlSinkTest extends Specification implements TestContainerHelper, TimeSeri GridTestData.transformerCtoG, GridTestData.lineGraphicCtoD, GridTestData.nodeGraphicC, - ThermalUnitInputTestData.cylindricStorageInput, + ThermalUnitInputTestData.cylindricalStorageInput, ThermalUnitInputTestData.thermalHouseInput, SystemParticipantTestData.evcsInput, SystemParticipantTestData.loadInput, diff --git a/src/test/groovy/edu/ie3/datamodel/io/source/csv/CsvThermalSourceTest.groovy b/src/test/groovy/edu/ie3/datamodel/io/source/csv/CsvThermalSourceTest.groovy index 915046bb6..a0e966bf7 100644 --- a/src/test/groovy/edu/ie3/datamodel/io/source/csv/CsvThermalSourceTest.groovy +++ b/src/test/groovy/edu/ie3/datamodel/io/source/csv/CsvThermalSourceTest.groovy @@ -68,6 +68,7 @@ class CsvThermalSourceTest extends Specification implements CsvTestDataMeta { inletTemp == sptd.inletTemp returnTemp == sptd.returnTemp c == sptd.c + pThermalMax == sptd.pThermalMax } //test method when operators and thermal buses are provided as constructor parameters diff --git a/src/test/groovy/edu/ie3/datamodel/models/input/thermal/CylindricalStorageInputTest.groovy b/src/test/groovy/edu/ie3/datamodel/models/input/thermal/CylindricalStorageInputTest.groovy index eee911126..98e147f29 100644 --- a/src/test/groovy/edu/ie3/datamodel/models/input/thermal/CylindricalStorageInputTest.groovy +++ b/src/test/groovy/edu/ie3/datamodel/models/input/thermal/CylindricalStorageInputTest.groovy @@ -13,7 +13,7 @@ class CylindricalStorageInputTest extends Specification { def "A CylindricalStorageInput copy method should work as expected"() { given: - def cylindricalStorageInput = ThermalUnitInputTestData.cylindricStorageInput + def cylindricalStorageInput = ThermalUnitInputTestData.cylindricalStorageInput when: def alteredUnit = cylindricalStorageInput.copy().storageVolumeLvl(ThermalUnitInputTestData.storageVolumeLvl) @@ -38,7 +38,7 @@ class CylindricalStorageInputTest extends Specification { def "Scaling a CylindricalStorageInput via builder should work as expected"() { given: - def cylindricalStorageInput = ThermalUnitInputTestData.cylindricStorageInput + def cylindricalStorageInput = ThermalUnitInputTestData.cylindricalStorageInput when: def alteredUnit = cylindricalStorageInput.copy().scale(2d).build() @@ -54,6 +54,7 @@ class CylindricalStorageInputTest extends Specification { assert inletTemp == cylindricalStorageInput.inletTemp assert returnTemp == cylindricalStorageInput.returnTemp assert c == cylindricalStorageInput.c + assert pThermalMax == cylindricalStorageInput.pThermalMax * 2d } } } diff --git a/src/test/groovy/edu/ie3/datamodel/utils/validation/ThermalValidationUtilsTest.groovy b/src/test/groovy/edu/ie3/datamodel/utils/validation/ThermalValidationUtilsTest.groovy index aee73fe73..8015f655d 100644 --- a/src/test/groovy/edu/ie3/datamodel/utils/validation/ThermalValidationUtilsTest.groovy +++ b/src/test/groovy/edu/ie3/datamodel/utils/validation/ThermalValidationUtilsTest.groovy @@ -17,6 +17,7 @@ import edu.ie3.datamodel.utils.Try import edu.ie3.test.common.SystemParticipantTestData import edu.ie3.test.common.ThermalUnitInputTestData import edu.ie3.util.TimeUtil +import edu.ie3.util.quantities.PowerSystemUnits import edu.ie3.util.quantities.interfaces.HeatCapacity import edu.ie3.util.quantities.interfaces.SpecificHeatCapacity import edu.ie3.util.quantities.interfaces.ThermalConductance @@ -24,6 +25,7 @@ import spock.lang.Specification import tech.units.indriya.ComparableQuantity import tech.units.indriya.quantity.Quantities +import javax.measure.quantity.Power import javax.measure.quantity.Temperature import javax.measure.quantity.Volume @@ -50,6 +52,7 @@ class ThermalValidationUtilsTest extends Specification { private static final ComparableQuantity inletTemp = Quantities.getQuantity(100, StandardUnits.TEMPERATURE) private static final ComparableQuantity returnTemp = Quantities.getQuantity(80, StandardUnits.TEMPERATURE) private static final ComparableQuantity c = Quantities.getQuantity(1.05, StandardUnits.SPECIFIC_HEAT_CAPACITY) + private static final ComparableQuantity pThermalMax = Quantities.getQuantity(10.2, StandardUnits.ACTIVE_POWER_IN) // Thermal House @@ -88,7 +91,7 @@ class ThermalValidationUtilsTest extends Specification { def "Smoke Test: Correct thermal cylindrical storage throws no exception"() { given: - def cylindricalStorageInput = ThermalUnitInputTestData.cylindricStorageInput + def cylindricalStorageInput = ThermalUnitInputTestData.cylindricalStorageInput when: ValidationUtils.check(cylindricalStorageInput) @@ -108,17 +111,18 @@ class ThermalValidationUtilsTest extends Specification { ex.message == expectedException.message where: - invalidCylindricalStorage || expectedSize || expectedException - new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, storageVolumeLvl, Quantities.getQuantity(100, StandardUnits.TEMPERATURE), Quantities.getQuantity(200, StandardUnits.TEMPERATURE), c) || 1 || new InvalidEntityException("Inlet temperature of the cylindrical storage cannot be lower or equal than outlet temperature", invalidCylindricalStorage) - new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, storageVolumeLvl, Quantities.getQuantity(100, StandardUnits.TEMPERATURE), Quantities.getQuantity(100, StandardUnits.TEMPERATURE), c) || 1 || new InvalidEntityException("Inlet temperature of the cylindrical storage cannot be lower or equal than outlet temperature", invalidCylindricalStorage) - new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, Quantities.getQuantity(-100, StandardUnits.VOLUME), inletTemp, returnTemp, Quantities.getQuantity(-1.05, StandardUnits.SPECIFIC_HEAT_CAPACITY)) || 1 || new InvalidEntityException("The following quantities have to be positive: -100 ㎥, -1.05 kWh/K*m³", invalidCylindricalStorage) + invalidCylindricalStorage || expectedSize || expectedException + new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, storageVolumeLvl, Quantities.getQuantity(100, StandardUnits.TEMPERATURE), Quantities.getQuantity(200, StandardUnits.TEMPERATURE), c, pThermalMax) || 1 || new InvalidEntityException("Inlet temperature of the cylindrical storage cannot be lower or equal than outlet temperature", invalidCylindricalStorage) + new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, storageVolumeLvl, Quantities.getQuantity(100, StandardUnits.TEMPERATURE), Quantities.getQuantity(100, StandardUnits.TEMPERATURE), c, pThermalMax) || 1 || new InvalidEntityException("Inlet temperature of the cylindrical storage cannot be lower or equal than outlet temperature", invalidCylindricalStorage) + new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, Quantities.getQuantity(-100, StandardUnits.VOLUME), inletTemp, returnTemp, Quantities.getQuantity(-1.05, StandardUnits.SPECIFIC_HEAT_CAPACITY), pThermalMax) || 1 || new InvalidEntityException("The following quantities have to be positive: -100 ㎥, -1.05 kWh/K*m³", invalidCylindricalStorage) + new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, Quantities.getQuantity(-100, StandardUnits.VOLUME), inletTemp, returnTemp, Quantities.getQuantity(-1.05, StandardUnits.SPECIFIC_HEAT_CAPACITY), Quantities.getQuantity(-20, PowerSystemUnits.KILOWATT)) || 1 || new InvalidEntityException("The following quantities have to be positive: -100 ㎥, -1.05 kWh/K*m³, -20 kW", invalidCylindricalStorage) } def "ThermalUnitValidationUtils.check() works for complete ThermalGrid as well"() { when: def thermalBus = ThermalUnitInputTestData.thermalBus def cylindricalStorageInput = [ - ThermalUnitInputTestData.cylindricStorageInput + ThermalUnitInputTestData.cylindricalStorageInput ] diff --git a/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy b/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy index 6953bb55e..a3dc6a8f9 100644 --- a/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy +++ b/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy @@ -173,6 +173,8 @@ class SystemParticipantTestData { public static final ComparableQuantity returnTemp = Quantities.getQuantity(80, TEMPERATURE) public static final ComparableQuantity c = Quantities.getQuantity( 1, SPECIFIC_HEAT_CAPACITY) + public static final ComparableQuantity pThermalMax = Quantities.getQuantity(20, ACTIVE_POWER_IN) + public static final ThermalStorageInput thermalStorage = new CylindricalStorageInput( UUID.fromString("8851813b-3a7d-4fee-874b-4df9d724e4b3"), "test_cylindricThermalStorage", @@ -182,7 +184,8 @@ class SystemParticipantTestData { storageVolumeLvl, inletTemp, returnTemp, - c + c, + pThermalMax, ) public static final ChpInput chpInput = new ChpInput( diff --git a/src/test/groovy/edu/ie3/test/common/ThermalUnitInputTestData.groovy b/src/test/groovy/edu/ie3/test/common/ThermalUnitInputTestData.groovy index bf3f6a521..acffbade3 100644 --- a/src/test/groovy/edu/ie3/test/common/ThermalUnitInputTestData.groovy +++ b/src/test/groovy/edu/ie3/test/common/ThermalUnitInputTestData.groovy @@ -17,6 +17,7 @@ import edu.ie3.util.quantities.interfaces.ThermalConductance import tech.units.indriya.ComparableQuantity import tech.units.indriya.quantity.Quantities +import javax.measure.quantity.Power import javax.measure.quantity.Temperature import javax.measure.quantity.Volume @@ -48,20 +49,22 @@ class ThermalUnitInputTestData extends SystemParticipantTestData { UPPER_TEMPERATURE_LIMIT, LOWER_TEMPERATURE_LIMIT) - // thermal cylindric storage input + // thermal cylindrical storage input private static final ComparableQuantity storageVolumeLvl = Quantities.getQuantity(100, StandardUnits.VOLUME) private static final ComparableQuantity inletTemp = Quantities.getQuantity(100, StandardUnits.TEMPERATURE) private static final ComparableQuantity returnTemp = Quantities.getQuantity(80, StandardUnits.TEMPERATURE) private static final ComparableQuantity c = Quantities.getQuantity(1.05, StandardUnits.SPECIFIC_HEAT_CAPACITY) + private static final ComparableQuantity pThermalMax = Quantities.getQuantity(20, StandardUnits.ACTIVE_POWER_IN) - public static final cylindricStorageInput = new CylindricalStorageInput( + public static final cylindricalStorageInput = new CylindricalStorageInput( thermalUnitUuid, - "test_cylindricStorageInput", + "testCylindricalStorageInput", operator, operationTime, thermalBus, storageVolumeLvl, inletTemp, returnTemp, - c) + c, + pThermalMax) } diff --git a/src/test/resources/edu/ie3/datamodel/io/sink/_sql/input_entities.sql b/src/test/resources/edu/ie3/datamodel/io/sink/_sql/input_entities.sql index 6018e6f7c..01481dbbc 100644 --- a/src/test/resources/edu/ie3/datamodel/io/sink/_sql/input_entities.sql +++ b/src/test/resources/edu/ie3/datamodel/io/sink/_sql/input_entities.sql @@ -89,6 +89,7 @@ CREATE TABLE public.cylindrical_storage_input return_temp double precision NOT NULL, storage_volume_lvl double precision NOT NULL, thermal_bus uuid NOT NULL, + p_thermal_max DOUBLE PRECISION NOT NULL, grid_uuid uuid NOT NULL ) WITHOUT OIDS diff --git a/src/test/resources/edu/ie3/datamodel/io/source/csv/_participants/cylindrical_storage_input.csv b/src/test/resources/edu/ie3/datamodel/io/source/csv/_participants/cylindrical_storage_input.csv index 325d29445..0b0114091 100644 --- a/src/test/resources/edu/ie3/datamodel/io/source/csv/_participants/cylindrical_storage_input.csv +++ b/src/test/resources/edu/ie3/datamodel/io/source/csv/_participants/cylindrical_storage_input.csv @@ -1,2 +1,2 @@ -uuid,c,id,inlet_temp,operates_from,operates_until,operator,return_temp,storage_volume_lvl,storage_volume_lvl_min,thermal_bus,em -8851813b-3a7d-4fee-874b-4df9d724e4b3,1.0,test_cylindricThermalStorage,110.0,,,f15105c4-a2de-4ab8-a621-4bc98e372d92,80.0,1.039154027,0.3,0d95d7f2-49fb-4d49-8636-383a5220384e,977157f4-25e5-4c72-bf34-440edc778792 +uuid,c,id,inlet_temp,operates_from,operates_until,operator,return_temp,storage_volume_lvl,storage_volume_lvl_min,p_thermal_max,thermal_bus,em +8851813b-3a7d-4fee-874b-4df9d724e4b3,1.0,test_cylindricThermalStorage,110.0,,,f15105c4-a2de-4ab8-a621-4bc98e372d92,80.0,1.039154027,0.3,20.0,0d95d7f2-49fb-4d49-8636-383a5220384e,977157f4-25e5-4c72-bf34-440edc778792 diff --git a/src/test/resources/edu/ie3/datamodel/io/source/csv/_thermal/cylindrical_storage_input.csv b/src/test/resources/edu/ie3/datamodel/io/source/csv/_thermal/cylindrical_storage_input.csv index 4a11cda89..4f57d7972 100644 --- a/src/test/resources/edu/ie3/datamodel/io/source/csv/_thermal/cylindrical_storage_input.csv +++ b/src/test/resources/edu/ie3/datamodel/io/source/csv/_thermal/cylindrical_storage_input.csv @@ -1,2 +1,2 @@ -uuid,c,id,inlet_temp,operates_from,operates_until,operator,return_temp,storage_volume_lvl,storage_volume_lvl_min,thermal_bus -8851813b-3a7d-4fee-874b-4df9d724e4b3,1.0,test_cylindricThermalStorage,110.0,,,f15105c4-a2de-4ab8-a621-4bc98e372d92,80.0,1.039154027,0.3,0d95d7f2-49fb-4d49-8636-383a5220384e +uuid,c,id,inlet_temp,operates_from,operates_until,operator,return_temp,storage_volume_lvl,storage_volume_lvl_min,thermal_bus,p_thermal_max +8851813b-3a7d-4fee-874b-4df9d724e4b3,1.0,test_cylindricThermalStorage,110.0,,,f15105c4-a2de-4ab8-a621-4bc98e372d92,80.0,1.039154027,0.3,0d95d7f2-49fb-4d49-8636-383a5220384e,20.0 From 5ccd9695b1dbdd3bc9478280369cb94486c5dd13 Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Fri, 21 Feb 2025 16:20:49 +0100 Subject: [PATCH 2/3] fix tests after renaming --- .../edu/ie3/datamodel/io/extractor/ExtractorTest.groovy | 8 ++++---- .../edu/ie3/datamodel/io/sink/CsvFileSinkTest.groovy | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/groovy/edu/ie3/datamodel/io/extractor/ExtractorTest.groovy b/src/test/groovy/edu/ie3/datamodel/io/extractor/ExtractorTest.groovy index be1cf541d..9c4968164 100644 --- a/src/test/groovy/edu/ie3/datamodel/io/extractor/ExtractorTest.groovy +++ b/src/test/groovy/edu/ie3/datamodel/io/extractor/ExtractorTest.groovy @@ -134,10 +134,10 @@ class ExtractorTest extends Specification { tutd.thermalBus.operator ] - tutd.cylindricStorageInput || [ - tutd.cylindricStorageInput.operator, - tutd.cylindricStorageInput.thermalBus, - tutd.cylindricStorageInput.thermalBus.operator + tutd.cylindricalStorageInput || [ + tutd.cylindricalStorageInput.operator, + tutd.cylindricalStorageInput.thermalBus, + tutd.cylindricalStorageInput.thermalBus.operator ] tutd.thermalHouseInput || [ diff --git a/src/test/groovy/edu/ie3/datamodel/io/sink/CsvFileSinkTest.groovy b/src/test/groovy/edu/ie3/datamodel/io/sink/CsvFileSinkTest.groovy index 7a0957607..2ee20aa57 100644 --- a/src/test/groovy/edu/ie3/datamodel/io/sink/CsvFileSinkTest.groovy +++ b/src/test/groovy/edu/ie3/datamodel/io/sink/CsvFileSinkTest.groovy @@ -165,7 +165,7 @@ class CsvFileSinkTest extends Specification implements TimeSeriesTestData { GridTestData.transformerCtoG, GridTestData.lineGraphicCtoD, GridTestData.nodeGraphicC, - ThermalUnitInputTestData.cylindricStorageInput, + ThermalUnitInputTestData.cylindricalStorageInput, ThermalUnitInputTestData.thermalHouseInput, SystemParticipantTestData.evcsInput, SystemParticipantTestData.loadInput, From 44ead93ab04ef6464b3667049973ba855b3009ca Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Fri, 21 Feb 2025 16:31:25 +0100 Subject: [PATCH 3/3] fix ThermalValidationUtils --- .../datamodel/utils/validation/ThermalValidationUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/edu/ie3/datamodel/utils/validation/ThermalValidationUtils.java b/src/main/java/edu/ie3/datamodel/utils/validation/ThermalValidationUtils.java index 15cc20d2f..a67a57ecf 100644 --- a/src/main/java/edu/ie3/datamodel/utils/validation/ThermalValidationUtils.java +++ b/src/main/java/edu/ie3/datamodel/utils/validation/ThermalValidationUtils.java @@ -254,7 +254,9 @@ private static List> checkCylindricalStorage( () -> detectZeroOrNegativeQuantities( new Quantity[] { - cylindricalStorageInput.getStorageVolumeLvl(), cylindricalStorageInput.getC() + cylindricalStorageInput.getStorageVolumeLvl(), + cylindricalStorageInput.getC(), + cylindricalStorageInput.getpThermalMax() }, cylindricalStorageInput), InvalidEntityException.class));