From 5d65b499d7881d96e1e2d046293aa8c48eb2e7d4 Mon Sep 17 00:00:00 2001 From: Johannes Bao Date: Fri, 28 Apr 2023 09:18:24 +0200 Subject: [PATCH 1/6] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3622a2799..5ab32e5a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Copy methods for container classes [#726](https://github.com/ie3-institute/PowerSystemDataModel/issues/726) +- Add rate of change for thermal storages [#679](https://github.com/ie3-institute/PowerSystemDataModel/issues/679) ### Fixed From e9f76adfe97856d4994575c649d276b7fe5a38b9 Mon Sep 17 00:00:00 2001 From: smjobaoo Date: Mon, 15 May 2023 09:11:26 +0200 Subject: [PATCH 2/6] Added inlet and outletrate --- .../input/CylindricalStorageInputFactory.java | 22 ++++++- .../ie3/datamodel/models/StandardUnits.java | 2 + .../thermal/CylindricalStorageInput.java | 57 +++++++++++++++++-- .../CylindricalStorageInputFactoryTest.groovy | 6 +- .../CylindricalStorageInputTest.groovy | 18 ++++-- .../ThermalUnitValidationUtilsTest.groovy | 11 +++- .../common/SystemParticipantTestData.groovy | 7 ++- .../common/ThermalUnitInputTestData.groovy | 8 ++- .../cylindrical_storage_input.csv | 4 +- .../_thermal/cylindrical_storage_input.csv | 4 +- 10 files changed, 119 insertions(+), 20 deletions(-) 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 cd517423c..5e4f4cba5 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 @@ -11,6 +11,7 @@ import edu.ie3.datamodel.models.input.thermal.CylindricalStorageInput; import edu.ie3.datamodel.models.input.thermal.ThermalBusInput; import edu.ie3.util.quantities.interfaces.SpecificHeatCapacity; +import edu.ie3.util.quantities.interfaces.VolumetricFlowRate; import java.util.UUID; import javax.measure.quantity.Temperature; import javax.measure.quantity.Volume; @@ -23,6 +24,8 @@ 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 OUTLET_RATE = "outletrate"; + private static final String INLET_RATE = "inletrate"; public CylindricalStorageInputFactory() { super(CylindricalStorageInput.class); @@ -30,7 +33,15 @@ public CylindricalStorageInputFactory() { @Override protected String[] getAdditionalFields() { - return new String[] {STORAGE_VOLUME_LVL, STORAGE_VOLUME_LVL_MIN, INLET_TEMP, RETURN_TEMP, C}; + return new String[] { + STORAGE_VOLUME_LVL, + STORAGE_VOLUME_LVL_MIN, + INLET_TEMP, + RETURN_TEMP, + C, + INLET_RATE, + OUTLET_RATE + }; } @Override @@ -51,6 +62,11 @@ protected CylindricalStorageInput buildModel( data.getQuantity(RETURN_TEMP, StandardUnits.TEMPERATURE); final ComparableQuantity c = data.getQuantity(C, StandardUnits.SPECIFIC_HEAT_CAPACITY); + final ComparableQuantity qIn = + data.getQuantity(INLET_RATE, StandardUnits.VOLUMETRIC_FLOW_RATE); + final ComparableQuantity qOut = + data.getQuantity(OUTLET_RATE, StandardUnits.VOLUMETRIC_FLOW_RATE); + return new CylindricalStorageInput( uuid, id, @@ -61,6 +77,8 @@ protected CylindricalStorageInput buildModel( storageVolumeLvlMin, inletTemp, returnTemp, - c); + c, + qIn, + qOut); } } diff --git a/src/main/java/edu/ie3/datamodel/models/StandardUnits.java b/src/main/java/edu/ie3/datamodel/models/StandardUnits.java index e8c8d96f7..a139775f1 100644 --- a/src/main/java/edu/ie3/datamodel/models/StandardUnits.java +++ b/src/main/java/edu/ie3/datamodel/models/StandardUnits.java @@ -137,6 +137,8 @@ public class StandardUnits { /** Length of a line in km */ public static final Unit LINE_LENGTH = KILOMETRE; + public static final Unit VOLUMETRIC_FLOW_RATE = CUBIC_METRE_PER_SECOND; + private StandardUnits() { throw new IllegalStateException("This is an Utility Class and not meant to be instantiated"); } 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 478b8ddf8..34e2c72f4 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 @@ -9,6 +9,7 @@ import edu.ie3.datamodel.models.StandardUnits; import edu.ie3.datamodel.models.input.OperatorInput; import edu.ie3.util.quantities.interfaces.SpecificHeatCapacity; +import edu.ie3.util.quantities.interfaces.VolumetricFlowRate; import java.util.Objects; import java.util.UUID; import javax.measure.quantity.Temperature; @@ -27,6 +28,10 @@ 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; + /** Flow rate of the inlet (typically in m³/s) */ + private final ComparableQuantity inletRate; + /** Flow rate of the outlet (typically in m³/s) */ + private final ComparableQuantity outletRate; /** * @param uuid Unique identifier of a cylindrical storage @@ -39,6 +44,8 @@ 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 inletRate flow rate of the inlet + * @param outletRate flow rate of the outlet */ public CylindricalStorageInput( UUID uuid, @@ -50,13 +57,17 @@ public CylindricalStorageInput( ComparableQuantity storageVolumeLvlMin, ComparableQuantity inletTemp, ComparableQuantity returnTemp, - ComparableQuantity c) { + ComparableQuantity c, + ComparableQuantity inletRate, + ComparableQuantity outletRate) { super(uuid, id, operator, operationTime, bus); this.storageVolumeLvl = storageVolumeLvl.to(StandardUnits.VOLUME); this.storageVolumeLvlMin = storageVolumeLvlMin.to(StandardUnits.VOLUME); this.inletTemp = inletTemp.to(StandardUnits.TEMPERATURE); this.returnTemp = returnTemp.to(StandardUnits.TEMPERATURE); this.c = c.to(StandardUnits.SPECIFIC_HEAT_CAPACITY); + this.inletRate = inletRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE); + this.outletRate = outletRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE); } /** @@ -68,6 +79,8 @@ public CylindricalStorageInput( * @param inletTemp Temperature of the inlet * @param returnTemp Temperature of the outlet * @param c Specific heat capacity of the storage medium + * @param inletRate flow rate of the inlet + * @param outletRate flow rate of the outlet */ public CylindricalStorageInput( UUID uuid, @@ -77,13 +90,17 @@ public CylindricalStorageInput( ComparableQuantity storageVolumeLvlMin, ComparableQuantity inletTemp, ComparableQuantity returnTemp, - ComparableQuantity c) { + ComparableQuantity c, + ComparableQuantity inletRate, + ComparableQuantity outletRate) { super(uuid, id, bus); this.storageVolumeLvl = storageVolumeLvl.to(StandardUnits.VOLUME); this.storageVolumeLvlMin = storageVolumeLvlMin.to(StandardUnits.VOLUME); this.inletTemp = inletTemp.to(StandardUnits.TEMPERATURE); this.returnTemp = returnTemp.to(StandardUnits.TEMPERATURE); this.c = c.to(StandardUnits.SPECIFIC_HEAT_CAPACITY); + this.inletRate = inletRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE); + this.outletRate = outletRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE); } public ComparableQuantity getStorageVolumeLvl() { @@ -106,6 +123,14 @@ public ComparableQuantity getC() { return c; } + public ComparableQuantity getInletRate() { + return inletRate; + } + + public ComparableQuantity getOutletRate() { + return outletRate; + } + @Override public CylindricalStorageInputCopyBuilder copy() { return new CylindricalStorageInputCopyBuilder(this); @@ -120,7 +145,9 @@ public boolean equals(Object o) { && storageVolumeLvlMin.equals(that.storageVolumeLvlMin) && inletTemp.equals(that.inletTemp) && returnTemp.equals(that.returnTemp) - && c.equals(that.c); + && c.equals(that.c) + && inletRate.equals(that.inletRate) + && outletRate.equals(that.outletRate); } @Override @@ -152,6 +179,10 @@ public String toString() { + returnTemp + ", c=" + c + + ", inletRate =" + + inletRate + + ", outletRate =" + + outletRate + '}'; } @@ -168,6 +199,8 @@ public static class CylindricalStorageInputCopyBuilder private ComparableQuantity inletTemp; private ComparableQuantity returnTemp; private ComparableQuantity c; + private ComparableQuantity inletRate; + private ComparableQuantity outletRate; private CylindricalStorageInputCopyBuilder(CylindricalStorageInput entity) { super(entity); @@ -176,6 +209,8 @@ private CylindricalStorageInputCopyBuilder(CylindricalStorageInput entity) { this.inletTemp = entity.getInletTemp(); this.returnTemp = entity.getReturnTemp(); this.c = entity.getC(); + this.inletRate = entity.getInletRate(); + this.outletRate = entity.getOutletRate(); } @Override @@ -190,7 +225,9 @@ public CylindricalStorageInput build() { storageVolumeLvlMin, inletTemp, returnTemp, - c); + c, + inletRate, + outletRate); } public CylindricalStorageInputCopyBuilder storageVolumeLvl( @@ -221,6 +258,18 @@ public CylindricalStorageInputCopyBuilder c(ComparableQuantity inletRate) { + this.inletRate = inletRate; + return this; + } + + public CylindricalStorageInputCopyBuilder outletRate( + ComparableQuantity outletRate) { + this.outletRate = outletRate; + return this; + } + @Override protected CylindricalStorageInputCopyBuilder childInstance() { return this; 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 e7d5caa21..b7bca1569 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 @@ -33,7 +33,9 @@ class CylindricalStorageInputFactoryTest extends Specification implements Facto "storagevolumelvlmin": "4", "inlettemp" : "5", "returntemp" : "6", - "c" : "7" + "c" : "7", + "inletrate" : "8", + "outletrate" : "9" ] def inputClass = CylindricalStorageInput def thermalBusInput = Mock(ThermalBusInput) @@ -55,6 +57,8 @@ 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 inletRate == getQuant(parameter["inletrate"], StandardUnits.VOLUMETRIC_FLOW_RATE) + assert outletRate == getQuant(parameter["outletrate"], StandardUnits.VOLUMETRIC_FLOW_RATE) } } } 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 21e707d69..62abc8341 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 @@ -5,6 +5,7 @@ */ package edu.ie3.datamodel.models.input.thermal +import edu.ie3.datamodel.models.StandardUnits import edu.ie3.test.common.ThermalUnitInputTestData import spock.lang.Specification @@ -16,10 +17,17 @@ class CylindricalStorageInputTest extends Specification { def cylindricalStorageInput = ThermalUnitInputTestData.cylindricStorageInput when: - def alteredUnit = cylindricalStorageInput.copy().storageVolumeLvl(ThermalUnitInputTestData.storageVolumeLvl) - .storageVolumeLvlMin(ThermalUnitInputTestData.storageVolumeLvlMin).inletTemp(ThermalUnitInputTestData.inletTemp) - .returnTemp(ThermalUnitInputTestData.returnTemp).c(ThermalUnitInputTestData.c) - .thermalBus(ThermalUnitInputTestData.thermalBus).build() + def alteredUnit = cylindricalStorageInput + .copy() + .storageVolumeLvl(ThermalUnitInputTestData.storageVolumeLvl) + .storageVolumeLvlMin(ThermalUnitInputTestData.storageVolumeLvlMin) + .inletTemp(ThermalUnitInputTestData.inletTemp) + .returnTemp(ThermalUnitInputTestData.returnTemp) + .c(ThermalUnitInputTestData.c) + .thermalBus(ThermalUnitInputTestData.thermalBus) + .inletRate(ThermalUnitInputTestData.inletRate) + .outletRate(ThermalUnitInputTestData.outletRate) + .build() then: @@ -34,6 +42,8 @@ class CylindricalStorageInputTest extends Specification { assert inletTemp == ThermalUnitInputTestData.inletTemp assert returnTemp == ThermalUnitInputTestData.returnTemp assert c == ThermalUnitInputTestData.c + assert inletRate == ThermalUnitInputTestData.inletRate + assert outletRate == ThermalUnitInputTestData.outletRate } } } diff --git a/src/test/groovy/edu/ie3/datamodel/utils/validation/ThermalUnitValidationUtilsTest.groovy b/src/test/groovy/edu/ie3/datamodel/utils/validation/ThermalUnitValidationUtilsTest.groovy index e2a4a43f3..7689c949f 100644 --- a/src/test/groovy/edu/ie3/datamodel/utils/validation/ThermalUnitValidationUtilsTest.groovy +++ b/src/test/groovy/edu/ie3/datamodel/utils/validation/ThermalUnitValidationUtilsTest.groovy @@ -17,6 +17,7 @@ import edu.ie3.util.TimeUtil import edu.ie3.util.quantities.interfaces.HeatCapacity import edu.ie3.util.quantities.interfaces.SpecificHeatCapacity import edu.ie3.util.quantities.interfaces.ThermalConductance +import edu.ie3.util.quantities.interfaces.VolumetricFlowRate import spock.lang.Specification import tech.units.indriya.ComparableQuantity import tech.units.indriya.quantity.Quantities @@ -48,6 +49,10 @@ class ThermalUnitValidationUtilsTest 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 inletRate = Quantities.getQuantity(0.2, StandardUnits.VOLUMETRIC_FLOW_RATE) + private static final ComparableQuantity outletRate = Quantities.getQuantity(1.2, StandardUnits.VOLUMETRIC_FLOW_RATE) + + // Thermal House @@ -104,8 +109,8 @@ class ThermalUnitValidationUtilsTest extends Specification { where: invalidCylindricalStorage || expectedException - new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, storageVolumeLvl, storageVolumeLvlMin, Quantities.getQuantity(100, StandardUnits.TEMPERATURE), Quantities.getQuantity(200, StandardUnits.TEMPERATURE), c) || new InvalidEntityException("Inlet temperature of the cylindrical storage cannot be lower than outlet temperature", invalidCylindricalStorage) - new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, Quantities.getQuantity(100, StandardUnits.VOLUME), Quantities.getQuantity(200, StandardUnits.VOLUME), inletTemp, returnTemp, c) || new InvalidEntityException("Minimum permissible storage volume of the cylindrical storage cannot be higher than overall available storage volume", invalidCylindricalStorage) - new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, Quantities.getQuantity(-100, StandardUnits.VOLUME), Quantities.getQuantity(-200, StandardUnits.VOLUME), inletTemp, returnTemp, Quantities.getQuantity(-1.05, StandardUnits.SPECIFIC_HEAT_CAPACITY)) || new InvalidEntityException("The following quantities have to be positive: -100 ㎥, -200 ㎥, -1.05 kWh/K*m³", invalidCylindricalStorage) + new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, storageVolumeLvl, storageVolumeLvlMin, Quantities.getQuantity(100, StandardUnits.TEMPERATURE), Quantities.getQuantity(200, StandardUnits.TEMPERATURE), c, inletRate, outletRate) || new InvalidEntityException("Inlet temperature of the cylindrical storage cannot be lower than outlet temperature", invalidCylindricalStorage) + new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, Quantities.getQuantity(100, StandardUnits.VOLUME), Quantities.getQuantity(200, StandardUnits.VOLUME), inletTemp, returnTemp, c, inletRate, outletRate) || new InvalidEntityException("Minimum permissible storage volume of the cylindrical storage cannot be higher than overall available storage volume", invalidCylindricalStorage) + new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, Quantities.getQuantity(-100, StandardUnits.VOLUME), Quantities.getQuantity(-200, StandardUnits.VOLUME), inletTemp, returnTemp, Quantities.getQuantity(-1.05, StandardUnits.SPECIFIC_HEAT_CAPACITY), inletRate, outletRate) || new InvalidEntityException("The following quantities have to be positive: -100 ㎥, -200 ㎥, -1.05 kWh/K*m³", invalidCylindricalStorage) } } diff --git a/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy b/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy index bfafb5d6b..f0289abe8 100644 --- a/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy +++ b/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy @@ -6,6 +6,7 @@ package edu.ie3.test.common import edu.ie3.datamodel.models.OperationTime +import edu.ie3.datamodel.models.StandardUnits import edu.ie3.datamodel.models.input.NodeInput import edu.ie3.datamodel.models.input.OperatorInput import edu.ie3.datamodel.models.input.container.SystemParticipants @@ -151,6 +152,8 @@ class SystemParticipantTestData { public static final ComparableQuantity returnTemp = Quantities.getQuantity(80, TEMPERATURE) public static final ComparableQuantity c = Quantities.getQuantity( 1, SPECIFIC_HEAT_CAPACITY) + private static final ComparableQuantity inletRate = Quantities.getQuantity(0.1, StandardUnits.VOLUMETRIC_FLOW_RATE) + private static final ComparableQuantity outletRate = Quantities.getQuantity(0.2, StandardUnits.VOLUMETRIC_FLOW_RATE) public static final ThermalStorageInput thermalStorage = new CylindricalStorageInput( UUID.fromString("8851813b-3a7d-4fee-874b-4df9d724e4b3"), "test_cylindricThermalStorage", @@ -159,7 +162,9 @@ class SystemParticipantTestData { storageVolumeLvlMin, inletTemp, returnTemp, - c + c, + inletRate, + outletRate ) 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 c5b7f61a8..8c44f59b6 100644 --- a/src/test/groovy/edu/ie3/test/common/ThermalUnitInputTestData.groovy +++ b/src/test/groovy/edu/ie3/test/common/ThermalUnitInputTestData.groovy @@ -14,6 +14,7 @@ import edu.ie3.util.TimeUtil import edu.ie3.util.quantities.interfaces.HeatCapacity import edu.ie3.util.quantities.interfaces.SpecificHeatCapacity import edu.ie3.util.quantities.interfaces.ThermalConductance +import edu.ie3.util.quantities.interfaces.VolumetricFlowRate import tech.units.indriya.ComparableQuantity import tech.units.indriya.quantity.Quantities @@ -54,6 +55,8 @@ class ThermalUnitInputTestData extends SystemParticipantTestData { 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 inletRate = Quantities.getQuantity(0.1, StandardUnits.VOLUMETRIC_FLOW_RATE) + private static final ComparableQuantity outletRate = Quantities.getQuantity(0.2, StandardUnits.VOLUMETRIC_FLOW_RATE) public static final cylindricStorageInput = new CylindricalStorageInput( thermalUnitUuid, @@ -65,5 +68,8 @@ class ThermalUnitInputTestData extends SystemParticipantTestData { storageVolumeLvlMin, inletTemp, returnTemp, - c) + c, + inletRate, + outletRate + ) } 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 7d9de239a..19c29aad5 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 -8851813b-3a7d-4fee-874b-4df9d724e4b3,1.0,test_cylindricThermalStorage,110.0,,,7d6f1763-0c1d-4266-a76f-59163ad3808b,80.0,1.039154027,0.3,0d95d7f2-49fb-4d49-8636-383a5220384e +uuid,c,id,inlet_rate,inlet_temp,operates_from,operates_until,operator,return_temp,outlet_rate,storage_volume_lvl,storage_volume_lvl_min,thermal_bus +8851813b-3a7d-4fee-874b-4df9d724e4b3,1.0,test_cylindricThermalStorage,0.2,110.0,,,7d6f1763-0c1d-4266-a76f-59163ad3808b,80.0,1.2,1.039154027,0.3,0d95d7f2-49fb-4d49-8636-383a5220384e 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 7d9de239a..b1b341354 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,,,7d6f1763-0c1d-4266-a76f-59163ad3808b,80.0,1.039154027,0.3,0d95d7f2-49fb-4d49-8636-383a5220384e +uuid,c,id,inlet_rate,inlet_temp,operates_from,operates_until,operator,return_temp,outlet_rate,storage_volume_lvl,storage_volume_lvl_min,thermal_bus +8851813b-3a7d-4fee-874b-4df9d724e4b3,1.0,test_cylindricThermalStorage,0.2,110.0,,,7d6f1763-0c1d-4266-a76f-59163ad3808b,80.0,1.2,1.039154027,0.3,0d95d7f2-49fb-4d49-8636-383a5220384e \ No newline at end of file From 788ffc91d3e5de9318fd438e6a736e390cf619ab Mon Sep 17 00:00:00 2001 From: Johannes Bao Date: Wed, 17 May 2023 10:00:13 +0200 Subject: [PATCH 3/6] Temporary --- .../input/CylindricalStorageInputFactory.java | 21 +++--- .../thermal/CylindricalStorageInput.java | 71 ++++++++++--------- .../common/SystemParticipantTestData.groovy | 2 +- 3 files changed, 48 insertions(+), 46 deletions(-) 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 5e4f4cba5..332c5ad02 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 @@ -13,6 +13,7 @@ import edu.ie3.util.quantities.interfaces.SpecificHeatCapacity; import edu.ie3.util.quantities.interfaces.VolumetricFlowRate; import java.util.UUID; +import javax.measure.quantity.Power; import javax.measure.quantity.Temperature; import javax.measure.quantity.Volume; import tech.units.indriya.ComparableQuantity; @@ -24,8 +25,8 @@ 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 OUTLET_RATE = "outletrate"; - private static final String INLET_RATE = "inletrate"; + private static final String FLOW_RATE = "flowrate"; + private static final String INPUT_POWER = "inputpower"; public CylindricalStorageInputFactory() { super(CylindricalStorageInput.class); @@ -39,8 +40,8 @@ protected String[] getAdditionalFields() { INLET_TEMP, RETURN_TEMP, C, - INLET_RATE, - OUTLET_RATE + FLOW_RATE, + INPUT_POWER }; } @@ -62,10 +63,10 @@ protected CylindricalStorageInput buildModel( data.getQuantity(RETURN_TEMP, StandardUnits.TEMPERATURE); final ComparableQuantity c = data.getQuantity(C, StandardUnits.SPECIFIC_HEAT_CAPACITY); - final ComparableQuantity qIn = - data.getQuantity(INLET_RATE, StandardUnits.VOLUMETRIC_FLOW_RATE); - final ComparableQuantity qOut = - data.getQuantity(OUTLET_RATE, StandardUnits.VOLUMETRIC_FLOW_RATE); + final ComparableQuantity flowRate = + data.getQuantity(FLOW_RATE, StandardUnits.VOLUMETRIC_FLOW_RATE); + final ComparableQuantity inputPower = + data.getQuantity(INPUT_POWER, StandardUnits.ACTIVE_POWER_IN); return new CylindricalStorageInput( uuid, @@ -78,7 +79,7 @@ protected CylindricalStorageInput buildModel( inletTemp, returnTemp, c, - qIn, - qOut); + flowRate, + inputPower); } } 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 34e2c72f4..e46fd3661 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 @@ -14,6 +14,7 @@ import java.util.UUID; import javax.measure.quantity.Temperature; import javax.measure.quantity.Volume; +import javax.measure.quantity.Power; import tech.units.indriya.ComparableQuantity; /** Thermal storage with cylindrical shape */ @@ -28,10 +29,10 @@ 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; - /** Flow rate of the inlet (typically in m³/s) */ - private final ComparableQuantity inletRate; - /** Flow rate of the outlet (typically in m³/s) */ - private final ComparableQuantity outletRate; + /** Flow rate of the inlet and outlet (typically in m³/s) --- Assumption: Constant volume */ + private final ComparableQuantity flowRate; + /** Maximum thermal input power (typically in kW) */ + private final ComparableQuantity inputPower; /** * @param uuid Unique identifier of a cylindrical storage @@ -58,16 +59,16 @@ public CylindricalStorageInput( ComparableQuantity inletTemp, ComparableQuantity returnTemp, ComparableQuantity c, - ComparableQuantity inletRate, - ComparableQuantity outletRate) { + ComparableQuantity flowRate, + ComparableQuantity inputPower) { super(uuid, id, operator, operationTime, bus); this.storageVolumeLvl = storageVolumeLvl.to(StandardUnits.VOLUME); this.storageVolumeLvlMin = storageVolumeLvlMin.to(StandardUnits.VOLUME); this.inletTemp = inletTemp.to(StandardUnits.TEMPERATURE); this.returnTemp = returnTemp.to(StandardUnits.TEMPERATURE); this.c = c.to(StandardUnits.SPECIFIC_HEAT_CAPACITY); - this.inletRate = inletRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE); - this.outletRate = outletRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE); + this.flowRate = flowRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE); + this.inputPower = inputPower.to(StandardUnits.ACTIVE_POWER_IN); } /** @@ -91,16 +92,16 @@ public CylindricalStorageInput( ComparableQuantity inletTemp, ComparableQuantity returnTemp, ComparableQuantity c, - ComparableQuantity inletRate, - ComparableQuantity outletRate) { + ComparableQuantity flowRate, + ComparableQuantity inputPower) { super(uuid, id, bus); this.storageVolumeLvl = storageVolumeLvl.to(StandardUnits.VOLUME); this.storageVolumeLvlMin = storageVolumeLvlMin.to(StandardUnits.VOLUME); this.inletTemp = inletTemp.to(StandardUnits.TEMPERATURE); this.returnTemp = returnTemp.to(StandardUnits.TEMPERATURE); this.c = c.to(StandardUnits.SPECIFIC_HEAT_CAPACITY); - this.inletRate = inletRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE); - this.outletRate = outletRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE); + this.flowRate = flowRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE); + this.inputPower = inputPower.to(StandardUnits.ACTIVE_POWER_IN); } public ComparableQuantity getStorageVolumeLvl() { @@ -123,12 +124,12 @@ public ComparableQuantity getC() { return c; } - public ComparableQuantity getInletRate() { - return inletRate; + public ComparableQuantity getFlowRate() { + return flowRate; } - public ComparableQuantity getOutletRate() { - return outletRate; + public ComparableQuantity getInputPower() { + return inputPower; } @Override @@ -146,14 +147,14 @@ public boolean equals(Object o) { && inletTemp.equals(that.inletTemp) && returnTemp.equals(that.returnTemp) && c.equals(that.c) - && inletRate.equals(that.inletRate) - && outletRate.equals(that.outletRate); + && flowRate.equals(that.flowRate) + && inputPower.equals(that.inputPower); } @Override public int hashCode() { return Objects.hash( - super.hashCode(), storageVolumeLvl, storageVolumeLvlMin, inletTemp, returnTemp, c); + super.hashCode(), storageVolumeLvl, storageVolumeLvlMin, inletTemp, returnTemp, c, flowRate, inputPower); } @Override @@ -179,10 +180,10 @@ public String toString() { + returnTemp + ", c=" + c - + ", inletRate =" - + inletRate - + ", outletRate =" - + outletRate + + ", flowRate =" + + flowRate + + ", inputPower =" + + inputPower + '}'; } @@ -199,8 +200,8 @@ public static class CylindricalStorageInputCopyBuilder private ComparableQuantity inletTemp; private ComparableQuantity returnTemp; private ComparableQuantity c; - private ComparableQuantity inletRate; - private ComparableQuantity outletRate; + private ComparableQuantity flowRate; + private ComparableQuantity inputPower; private CylindricalStorageInputCopyBuilder(CylindricalStorageInput entity) { super(entity); @@ -209,8 +210,8 @@ private CylindricalStorageInputCopyBuilder(CylindricalStorageInput entity) { this.inletTemp = entity.getInletTemp(); this.returnTemp = entity.getReturnTemp(); this.c = entity.getC(); - this.inletRate = entity.getInletRate(); - this.outletRate = entity.getOutletRate(); + this.flowRate = entity.getFlowRate(); + this.inputPower = entity.getInputPower(); } @Override @@ -226,8 +227,8 @@ public CylindricalStorageInput build() { inletTemp, returnTemp, c, - inletRate, - outletRate); + flowRate, + inputPower); } public CylindricalStorageInputCopyBuilder storageVolumeLvl( @@ -258,15 +259,15 @@ public CylindricalStorageInputCopyBuilder c(ComparableQuantity inletRate) { - this.inletRate = inletRate; + public CylindricalStorageInputCopyBuilder flowRate( + ComparableQuantity flowRate) { + this.flowRate = flowRate; return this; } - public CylindricalStorageInputCopyBuilder outletRate( - ComparableQuantity outletRate) { - this.outletRate = outletRate; + public CylindricalStorageInputCopyBuilder inputPower( + ComparableQuantity inputPower) { + this.inputPower = inputPower; return this; } diff --git a/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy b/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy index f0289abe8..d070e87b6 100644 --- a/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy +++ b/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy @@ -152,7 +152,7 @@ class SystemParticipantTestData { public static final ComparableQuantity returnTemp = Quantities.getQuantity(80, TEMPERATURE) public static final ComparableQuantity c = Quantities.getQuantity( 1, SPECIFIC_HEAT_CAPACITY) - private static final ComparableQuantity inletRate = Quantities.getQuantity(0.1, StandardUnits.VOLUMETRIC_FLOW_RATE) + private static final ComparableQuantity flowRate = Quantities.getQuantity(0.1, StandardUnits.VOLUMETRIC_FLOW_RATE) private static final ComparableQuantity outletRate = Quantities.getQuantity(0.2, StandardUnits.VOLUMETRIC_FLOW_RATE) public static final ThermalStorageInput thermalStorage = new CylindricalStorageInput( UUID.fromString("8851813b-3a7d-4fee-874b-4df9d724e4b3"), From 781d0f80608f8a2c4fa535ced7f6a9290cce04b3 Mon Sep 17 00:00:00 2001 From: Johannes Bao Date: Sun, 21 May 2023 21:22:15 +0200 Subject: [PATCH 4/6] Added inletFlowRate and outletFlowRate to CylindricalStorageInput --- build.gradle | 2 +- .../input/CylindricalStorageInputFactory.java | 21 +++-- .../thermal/CylindricalStorageInput.java | 86 ++++++++++--------- .../CylindricalStorageInputFactoryTest.groovy | 8 +- .../io/source/csv/CsvThermalSourceTest.groovy | 4 + .../CylindricalStorageInputTest.groovy | 8 +- .../ThermalUnitValidationUtilsTest.groovy | 10 +-- .../common/SystemParticipantTestData.groovy | 8 +- .../common/ThermalUnitInputTestData.groovy | 8 +- .../cylindrical_storage_input.csv | 2 +- .../_thermal/cylindrical_storage_input.csv | 2 +- 11 files changed, 84 insertions(+), 75 deletions(-) diff --git a/build.gradle b/build.gradle index 84f2e2da8..91bd3e385 100644 --- a/build.gradle +++ b/build.gradle @@ -50,7 +50,7 @@ repositories { dependencies { // ie³ power system utils - implementation 'com.github.ie3-institute:PowerSystemUtils:2.0' + implementation (files 'C:\\Users\\smjobaoo\\IdeaProjects\\PowerSystemUtils\\build\\libs\\PowerSystemUtils-3.0-SNAPSHOT.jar') implementation 'tech.units:indriya:2.1.4' 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 332c5ad02..a4cf63d25 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 @@ -13,7 +13,6 @@ import edu.ie3.util.quantities.interfaces.SpecificHeatCapacity; import edu.ie3.util.quantities.interfaces.VolumetricFlowRate; 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,8 +24,8 @@ 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 FLOW_RATE = "flowrate"; - private static final String INPUT_POWER = "inputpower"; + private static final String INLET_FLOW_RATE = "inletflowrate"; + private static final String OUTLET_FLOW_RATE = "outletflowrate"; public CylindricalStorageInputFactory() { super(CylindricalStorageInput.class); @@ -40,8 +39,8 @@ protected String[] getAdditionalFields() { INLET_TEMP, RETURN_TEMP, C, - FLOW_RATE, - INPUT_POWER + INLET_FLOW_RATE, + OUTLET_FLOW_RATE }; } @@ -63,10 +62,10 @@ protected CylindricalStorageInput buildModel( data.getQuantity(RETURN_TEMP, StandardUnits.TEMPERATURE); final ComparableQuantity c = data.getQuantity(C, StandardUnits.SPECIFIC_HEAT_CAPACITY); - final ComparableQuantity flowRate = - data.getQuantity(FLOW_RATE, StandardUnits.VOLUMETRIC_FLOW_RATE); - final ComparableQuantity inputPower = - data.getQuantity(INPUT_POWER, StandardUnits.ACTIVE_POWER_IN); + final ComparableQuantity inletFlowRate = + data.getQuantity(INLET_FLOW_RATE, StandardUnits.VOLUMETRIC_FLOW_RATE); + final ComparableQuantity outletFlowRate = + data.getQuantity(OUTLET_FLOW_RATE, StandardUnits.VOLUMETRIC_FLOW_RATE); return new CylindricalStorageInput( uuid, @@ -79,7 +78,7 @@ protected CylindricalStorageInput buildModel( inletTemp, returnTemp, c, - flowRate, - inputPower); + inletFlowRate, + outletFlowRate); } } 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 e46fd3661..b88bd36f4 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 @@ -14,7 +14,6 @@ import java.util.UUID; import javax.measure.quantity.Temperature; import javax.measure.quantity.Volume; -import javax.measure.quantity.Power; import tech.units.indriya.ComparableQuantity; /** Thermal storage with cylindrical shape */ @@ -29,10 +28,10 @@ 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; - /** Flow rate of the inlet and outlet (typically in m³/s) --- Assumption: Constant volume */ - private final ComparableQuantity flowRate; - /** Maximum thermal input power (typically in kW) */ - private final ComparableQuantity inputPower; + /** Flow rate of the inlet and outlet (typically in m³/s) */ + private final ComparableQuantity inletFlowRate; + /** Flow rate of the outlet and outlet (typically in m³/s) */ + private final ComparableQuantity outletFlowRate; /** * @param uuid Unique identifier of a cylindrical storage @@ -45,8 +44,8 @@ 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 inletRate flow rate of the inlet - * @param outletRate flow rate of the outlet + * @param inletFlowRate flow rate of the inlet + * @param outletFlowRate flow rate of the outlet */ public CylindricalStorageInput( UUID uuid, @@ -59,16 +58,16 @@ public CylindricalStorageInput( ComparableQuantity inletTemp, ComparableQuantity returnTemp, ComparableQuantity c, - ComparableQuantity flowRate, - ComparableQuantity inputPower) { + ComparableQuantity inletFlowRate, + ComparableQuantity outletFlowRate) { super(uuid, id, operator, operationTime, bus); this.storageVolumeLvl = storageVolumeLvl.to(StandardUnits.VOLUME); this.storageVolumeLvlMin = storageVolumeLvlMin.to(StandardUnits.VOLUME); this.inletTemp = inletTemp.to(StandardUnits.TEMPERATURE); this.returnTemp = returnTemp.to(StandardUnits.TEMPERATURE); this.c = c.to(StandardUnits.SPECIFIC_HEAT_CAPACITY); - this.flowRate = flowRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE); - this.inputPower = inputPower.to(StandardUnits.ACTIVE_POWER_IN); + this.inletFlowRate = inletFlowRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE); + this.outletFlowRate = outletFlowRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE); } /** @@ -80,8 +79,8 @@ public CylindricalStorageInput( * @param inletTemp Temperature of the inlet * @param returnTemp Temperature of the outlet * @param c Specific heat capacity of the storage medium - * @param inletRate flow rate of the inlet - * @param outletRate flow rate of the outlet + * @param inletFlowRate flow rate of the inlet + * @param outletFlowRate flow rate of the outlet */ public CylindricalStorageInput( UUID uuid, @@ -92,16 +91,16 @@ public CylindricalStorageInput( ComparableQuantity inletTemp, ComparableQuantity returnTemp, ComparableQuantity c, - ComparableQuantity flowRate, - ComparableQuantity inputPower) { + ComparableQuantity inletFlowRate, + ComparableQuantity outletFlowRate) { super(uuid, id, bus); this.storageVolumeLvl = storageVolumeLvl.to(StandardUnits.VOLUME); this.storageVolumeLvlMin = storageVolumeLvlMin.to(StandardUnits.VOLUME); this.inletTemp = inletTemp.to(StandardUnits.TEMPERATURE); this.returnTemp = returnTemp.to(StandardUnits.TEMPERATURE); this.c = c.to(StandardUnits.SPECIFIC_HEAT_CAPACITY); - this.flowRate = flowRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE); - this.inputPower = inputPower.to(StandardUnits.ACTIVE_POWER_IN); + this.inletFlowRate = inletFlowRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE); + this.outletFlowRate = outletFlowRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE); } public ComparableQuantity getStorageVolumeLvl() { @@ -124,12 +123,12 @@ public ComparableQuantity getC() { return c; } - public ComparableQuantity getFlowRate() { - return flowRate; + public ComparableQuantity getInletFlowRate() { + return inletFlowRate; } - public ComparableQuantity getInputPower() { - return inputPower; + public ComparableQuantity getOutletFlowRate() { + return outletFlowRate; } @Override @@ -147,14 +146,21 @@ public boolean equals(Object o) { && inletTemp.equals(that.inletTemp) && returnTemp.equals(that.returnTemp) && c.equals(that.c) - && flowRate.equals(that.flowRate) - && inputPower.equals(that.inputPower); + && inletFlowRate.equals(that.inletFlowRate) + && outletFlowRate.equals(that.outletFlowRate); } @Override public int hashCode() { return Objects.hash( - super.hashCode(), storageVolumeLvl, storageVolumeLvlMin, inletTemp, returnTemp, c, flowRate, inputPower); + super.hashCode(), + storageVolumeLvl, + storageVolumeLvlMin, + inletTemp, + returnTemp, + c, + inletFlowRate, + outletFlowRate); } @Override @@ -180,10 +186,10 @@ public String toString() { + returnTemp + ", c=" + c - + ", flowRate =" - + flowRate - + ", inputPower =" - + inputPower + + ", inletFlowRate =" + + inletFlowRate + + ", outletFlowPower =" + + outletFlowRate + '}'; } @@ -200,8 +206,8 @@ public static class CylindricalStorageInputCopyBuilder private ComparableQuantity inletTemp; private ComparableQuantity returnTemp; private ComparableQuantity c; - private ComparableQuantity flowRate; - private ComparableQuantity inputPower; + private ComparableQuantity inletFlowRate; + private ComparableQuantity outletFlowRate; private CylindricalStorageInputCopyBuilder(CylindricalStorageInput entity) { super(entity); @@ -210,8 +216,8 @@ private CylindricalStorageInputCopyBuilder(CylindricalStorageInput entity) { this.inletTemp = entity.getInletTemp(); this.returnTemp = entity.getReturnTemp(); this.c = entity.getC(); - this.flowRate = entity.getFlowRate(); - this.inputPower = entity.getInputPower(); + this.inletFlowRate = entity.getInletFlowRate(); + this.outletFlowRate = entity.getOutletFlowRate(); } @Override @@ -227,8 +233,8 @@ public CylindricalStorageInput build() { inletTemp, returnTemp, c, - flowRate, - inputPower); + inletFlowRate, + outletFlowRate); } public CylindricalStorageInputCopyBuilder storageVolumeLvl( @@ -259,15 +265,15 @@ public CylindricalStorageInputCopyBuilder c(ComparableQuantity flowRate) { - this.flowRate = flowRate; + public CylindricalStorageInputCopyBuilder inletFlowRate( + ComparableQuantity inletFlowRate) { + this.inletFlowRate = inletFlowRate; return this; } - public CylindricalStorageInputCopyBuilder inputPower( - ComparableQuantity inputPower) { - this.inputPower = inputPower; + public CylindricalStorageInputCopyBuilder outletFlowRate( + ComparableQuantity outletFlowRate) { + this.outletFlowRate = outletFlowRate; return this; } 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 b7bca1569..049884e85 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,8 +34,8 @@ class CylindricalStorageInputFactoryTest extends Specification implements Facto "inlettemp" : "5", "returntemp" : "6", "c" : "7", - "inletrate" : "8", - "outletrate" : "9" + "inletflowrate" : "8", + "outletflowrate" : "9" ] def inputClass = CylindricalStorageInput def thermalBusInput = Mock(ThermalBusInput) @@ -57,8 +57,8 @@ 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 inletRate == getQuant(parameter["inletrate"], StandardUnits.VOLUMETRIC_FLOW_RATE) - assert outletRate == getQuant(parameter["outletrate"], StandardUnits.VOLUMETRIC_FLOW_RATE) + assert inletFlowRate == getQuant(parameter["inletflowrate"], StandardUnits.VOLUMETRIC_FLOW_RATE) + assert outletFlowRate == getQuant(parameter["outletflowrate"], StandardUnits.VOLUMETRIC_FLOW_RATE) } } } 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 e8b8f57b4..93fe66d9a 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 @@ -71,6 +71,8 @@ class CsvThermalSourceTest extends Specification implements CsvTestDataMeta { resultingCylindricalStorageWoOperator.first().inletTemp == sptd.inletTemp resultingCylindricalStorageWoOperator.first().returnTemp == sptd.returnTemp resultingCylindricalStorageWoOperator.first().c == sptd.c + resultingCylindricalStorageWoOperator.first().inletFlowRate == sptd.inletFlowRate + resultingCylindricalStorageWoOperator.first().outletFlowRate == sptd.outletFlowRate //test method when operators and thermal buses are provided as constructor parameters when: @@ -88,6 +90,8 @@ class CsvThermalSourceTest extends Specification implements CsvTestDataMeta { resultingCylindricalStorage.first().inletTemp == sptd.inletTemp resultingCylindricalStorage.first().returnTemp == sptd.returnTemp resultingCylindricalStorage.first().c == sptd.c + resultingCylindricalStorage.first().inletFlowRate == sptd.inletFlowRate + resultingCylindricalStorage.first().outletFlowRate == sptd.outletFlowRate } def "A CsvThermalSource should build thermal unit input entity from valid and invalid input data as expected"() { 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 62abc8341..298628dc0 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 @@ -25,8 +25,8 @@ class CylindricalStorageInputTest extends Specification { .returnTemp(ThermalUnitInputTestData.returnTemp) .c(ThermalUnitInputTestData.c) .thermalBus(ThermalUnitInputTestData.thermalBus) - .inletRate(ThermalUnitInputTestData.inletRate) - .outletRate(ThermalUnitInputTestData.outletRate) + .inletFlowRate(ThermalUnitInputTestData.inletFlowRate) + .outletFlowRate(ThermalUnitInputTestData.outletFlowRate) .build() @@ -42,8 +42,8 @@ class CylindricalStorageInputTest extends Specification { assert inletTemp == ThermalUnitInputTestData.inletTemp assert returnTemp == ThermalUnitInputTestData.returnTemp assert c == ThermalUnitInputTestData.c - assert inletRate == ThermalUnitInputTestData.inletRate - assert outletRate == ThermalUnitInputTestData.outletRate + assert inletFlowRate == ThermalUnitInputTestData.inletFlowRate + assert outletFlowRate == ThermalUnitInputTestData.outletFlowRate } } } diff --git a/src/test/groovy/edu/ie3/datamodel/utils/validation/ThermalUnitValidationUtilsTest.groovy b/src/test/groovy/edu/ie3/datamodel/utils/validation/ThermalUnitValidationUtilsTest.groovy index 7689c949f..fa55f7578 100644 --- a/src/test/groovy/edu/ie3/datamodel/utils/validation/ThermalUnitValidationUtilsTest.groovy +++ b/src/test/groovy/edu/ie3/datamodel/utils/validation/ThermalUnitValidationUtilsTest.groovy @@ -49,8 +49,8 @@ class ThermalUnitValidationUtilsTest 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 inletRate = Quantities.getQuantity(0.2, StandardUnits.VOLUMETRIC_FLOW_RATE) - private static final ComparableQuantity outletRate = Quantities.getQuantity(1.2, StandardUnits.VOLUMETRIC_FLOW_RATE) + private static final ComparableQuantity inletFlowRate = Quantities.getQuantity(0.2, StandardUnits.VOLUMETRIC_FLOW_RATE) + private static final ComparableQuantity outletFlowRate = Quantities.getQuantity(1.2, StandardUnits.VOLUMETRIC_FLOW_RATE) @@ -109,8 +109,8 @@ class ThermalUnitValidationUtilsTest extends Specification { where: invalidCylindricalStorage || expectedException - new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, storageVolumeLvl, storageVolumeLvlMin, Quantities.getQuantity(100, StandardUnits.TEMPERATURE), Quantities.getQuantity(200, StandardUnits.TEMPERATURE), c, inletRate, outletRate) || new InvalidEntityException("Inlet temperature of the cylindrical storage cannot be lower than outlet temperature", invalidCylindricalStorage) - new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, Quantities.getQuantity(100, StandardUnits.VOLUME), Quantities.getQuantity(200, StandardUnits.VOLUME), inletTemp, returnTemp, c, inletRate, outletRate) || new InvalidEntityException("Minimum permissible storage volume of the cylindrical storage cannot be higher than overall available storage volume", invalidCylindricalStorage) - new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, Quantities.getQuantity(-100, StandardUnits.VOLUME), Quantities.getQuantity(-200, StandardUnits.VOLUME), inletTemp, returnTemp, Quantities.getQuantity(-1.05, StandardUnits.SPECIFIC_HEAT_CAPACITY), inletRate, outletRate) || new InvalidEntityException("The following quantities have to be positive: -100 ㎥, -200 ㎥, -1.05 kWh/K*m³", invalidCylindricalStorage) + new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, storageVolumeLvl, storageVolumeLvlMin, Quantities.getQuantity(100, StandardUnits.TEMPERATURE), Quantities.getQuantity(200, StandardUnits.TEMPERATURE), c, inletFlowRate, outletFlowRate) || new InvalidEntityException("Inlet temperature of the cylindrical storage cannot be lower than outlet temperature", invalidCylindricalStorage) + new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, Quantities.getQuantity(100, StandardUnits.VOLUME), Quantities.getQuantity(200, StandardUnits.VOLUME), inletTemp, returnTemp, c, inletFlowRate, outletFlowRate) || new InvalidEntityException("Minimum permissible storage volume of the cylindrical storage cannot be higher than overall available storage volume", invalidCylindricalStorage) + new CylindricalStorageInput(thermalUnitUuid, id, operator, operationTime, SystemParticipantTestData.thermalBus, Quantities.getQuantity(-100, StandardUnits.VOLUME), Quantities.getQuantity(-200, StandardUnits.VOLUME), inletTemp, returnTemp, Quantities.getQuantity(-1.05, StandardUnits.SPECIFIC_HEAT_CAPACITY), inletFlowRate, outletFlowRate) || new InvalidEntityException("The following quantities have to be positive: -100 ㎥, -200 ㎥, -1.05 kWh/K*m³", invalidCylindricalStorage) } } diff --git a/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy b/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy index d070e87b6..4448abba9 100644 --- a/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy +++ b/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy @@ -152,8 +152,8 @@ class SystemParticipantTestData { public static final ComparableQuantity returnTemp = Quantities.getQuantity(80, TEMPERATURE) public static final ComparableQuantity c = Quantities.getQuantity( 1, SPECIFIC_HEAT_CAPACITY) - private static final ComparableQuantity flowRate = Quantities.getQuantity(0.1, StandardUnits.VOLUMETRIC_FLOW_RATE) - private static final ComparableQuantity outletRate = Quantities.getQuantity(0.2, StandardUnits.VOLUMETRIC_FLOW_RATE) + private static final ComparableQuantity inletFlowRate = Quantities.getQuantity(0.2, StandardUnits.VOLUMETRIC_FLOW_RATE) + private static final ComparableQuantity outletFlowRate = Quantities.getQuantity(1.2, StandardUnits.VOLUMETRIC_FLOW_RATE) public static final ThermalStorageInput thermalStorage = new CylindricalStorageInput( UUID.fromString("8851813b-3a7d-4fee-874b-4df9d724e4b3"), "test_cylindricThermalStorage", @@ -163,8 +163,8 @@ class SystemParticipantTestData { inletTemp, returnTemp, c, - inletRate, - outletRate + inletFlowRate, + outletFlowRate ) 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 8c44f59b6..b1a1a745b 100644 --- a/src/test/groovy/edu/ie3/test/common/ThermalUnitInputTestData.groovy +++ b/src/test/groovy/edu/ie3/test/common/ThermalUnitInputTestData.groovy @@ -55,8 +55,8 @@ class ThermalUnitInputTestData extends SystemParticipantTestData { 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 inletRate = Quantities.getQuantity(0.1, StandardUnits.VOLUMETRIC_FLOW_RATE) - private static final ComparableQuantity outletRate = Quantities.getQuantity(0.2, StandardUnits.VOLUMETRIC_FLOW_RATE) + private static final ComparableQuantity inletFlowRate = Quantities.getQuantity(0.1, StandardUnits.VOLUMETRIC_FLOW_RATE) + private static final ComparableQuantity outletFlowRate = Quantities.getQuantity(0.2, StandardUnits.VOLUMETRIC_FLOW_RATE) public static final cylindricStorageInput = new CylindricalStorageInput( thermalUnitUuid, @@ -69,7 +69,7 @@ class ThermalUnitInputTestData extends SystemParticipantTestData { inletTemp, returnTemp, c, - inletRate, - outletRate + inletFlowRate, + outletFlowRate ) } 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 19c29aad5..42e01d1fd 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_rate,inlet_temp,operates_from,operates_until,operator,return_temp,outlet_rate,storage_volume_lvl,storage_volume_lvl_min,thermal_bus +uuid,c,id,inlet_flow_rate,inlet_temp,operates_from,operates_until,operator,return_temp,outlet_flow_rate,storage_volume_lvl,storage_volume_lvl_min,thermal_bus 8851813b-3a7d-4fee-874b-4df9d724e4b3,1.0,test_cylindricThermalStorage,0.2,110.0,,,7d6f1763-0c1d-4266-a76f-59163ad3808b,80.0,1.2,1.039154027,0.3,0d95d7f2-49fb-4d49-8636-383a5220384e 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 b1b341354..fcda7134f 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_rate,inlet_temp,operates_from,operates_until,operator,return_temp,outlet_rate,storage_volume_lvl,storage_volume_lvl_min,thermal_bus +uuid,c,id,inlet_flow_rate,inlet_temp,operates_from,operates_until,operator,return_temp,outlet_flow_rate,storage_volume_lvl,storage_volume_lvl_min,thermal_bus 8851813b-3a7d-4fee-874b-4df9d724e4b3,1.0,test_cylindricThermalStorage,0.2,110.0,,,7d6f1763-0c1d-4266-a76f-59163ad3808b,80.0,1.2,1.039154027,0.3,0d95d7f2-49fb-4d49-8636-383a5220384e \ No newline at end of file From ee75c7dc7421f4c19b864d22633270e432b93c55 Mon Sep 17 00:00:00 2001 From: smjobaoo Date: Mon, 22 May 2023 07:30:09 +0200 Subject: [PATCH 5/6] Rollback build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 91bd3e385..84f2e2da8 100644 --- a/build.gradle +++ b/build.gradle @@ -50,7 +50,7 @@ repositories { dependencies { // ie³ power system utils - implementation (files 'C:\\Users\\smjobaoo\\IdeaProjects\\PowerSystemUtils\\build\\libs\\PowerSystemUtils-3.0-SNAPSHOT.jar') + implementation 'com.github.ie3-institute:PowerSystemUtils:2.0' implementation 'tech.units:indriya:2.1.4' From 7c1abcf67c3c9313da1701d4bda1928d20626408 Mon Sep 17 00:00:00 2001 From: Johannes Bao Date: Tue, 23 May 2023 14:32:12 +0200 Subject: [PATCH 6/6] Update Docs --- .../models/input/participant/cylindricalstorage.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/readthedocs/models/input/participant/cylindricalstorage.rst b/docs/readthedocs/models/input/participant/cylindricalstorage.rst index feaed6c3d..efe877672 100644 --- a/docs/readthedocs/models/input/participant/cylindricalstorage.rst +++ b/docs/readthedocs/models/input/participant/cylindricalstorage.rst @@ -29,6 +29,10 @@ Attributes, Units and Remarks +---------------------+----------------------------+----------------------------------------------+ | c | kWh / (K :math:`\cdot` m³) | Specific heat capacity of the storage medium | +---------------------+----------------------------+----------------------------------------------+ +| inletFlowRate | m³ / h | flowrate of the inlet | ++---------------------+----------------------------+----------------------------------------------+ +| outletFlowRate | m³ / h | flowrate of the outlet | ++---------------------+----------------------------+----------------------------------------------+ Caveats ^^^^^^^