Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Added rate of change in thermal storage #810

Draft
wants to merge 7 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ 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)
- Allow hierarchic grid structure for JointGridContainer [#768](https://github.com/ie3-institute/PowerSystemDataModel/issues/768)
- Add rate of change for thermal storages [#679](https://github.com/ie3-institute/PowerSystemDataModel/issues/679)

### Fixed
- Fixed wrong rated power unit hint [#804](https://github.com/ie3-institute/PowerSystemDataModel/issues/804)


### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -23,14 +24,24 @@ 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 INLET_FLOW_RATE = "inletflowrate";
private static final String OUTLET_FLOW_RATE = "outletflowrate";

public CylindricalStorageInputFactory() {
super(CylindricalStorageInput.class);
}

@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_FLOW_RATE,
OUTLET_FLOW_RATE
};
}

@Override
Expand All @@ -51,6 +62,11 @@ protected CylindricalStorageInput buildModel(
data.getQuantity(RETURN_TEMP, StandardUnits.TEMPERATURE);
final ComparableQuantity<SpecificHeatCapacity> c =
data.getQuantity(C, StandardUnits.SPECIFIC_HEAT_CAPACITY);
final ComparableQuantity<VolumetricFlowRate> inletFlowRate =
data.getQuantity(INLET_FLOW_RATE, StandardUnits.VOLUMETRIC_FLOW_RATE);
final ComparableQuantity<VolumetricFlowRate> outletFlowRate =
data.getQuantity(OUTLET_FLOW_RATE, StandardUnits.VOLUMETRIC_FLOW_RATE);

return new CylindricalStorageInput(
uuid,
id,
Expand All @@ -61,6 +77,8 @@ protected CylindricalStorageInput buildModel(
storageVolumeLvlMin,
inletTemp,
returnTemp,
c);
c,
inletFlowRate,
outletFlowRate);
}
}
2 changes: 2 additions & 0 deletions src/main/java/edu/ie3/datamodel/models/StandardUnits.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ public class StandardUnits {
/** Length of a line in km */
public static final Unit<Length> LINE_LENGTH = KILOMETRE;

public static final Unit<VolumetricFlowRate> VOLUMETRIC_FLOW_RATE = CUBIC_METRE_PER_SECOND;

private StandardUnits() {
throw new IllegalStateException("This is an Utility Class and not meant to be instantiated");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,6 +28,10 @@ public class CylindricalStorageInput extends ThermalStorageInput {
private final ComparableQuantity<Temperature> returnTemp;
/** Specific heat capacity of the storage medium (typically in kWh/K*m³) */
private final ComparableQuantity<SpecificHeatCapacity> c;
/** Flow rate of the inlet and outlet (typically in m³/s) */
private final ComparableQuantity<VolumetricFlowRate> inletFlowRate;
/** Flow rate of the outlet and outlet (typically in m³/s) */
private final ComparableQuantity<VolumetricFlowRate> outletFlowRate;

/**
* @param uuid Unique identifier of a cylindrical storage
Expand All @@ -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 inletFlowRate flow rate of the inlet
* @param outletFlowRate flow rate of the outlet
*/
public CylindricalStorageInput(
UUID uuid,
Expand All @@ -50,13 +57,17 @@ public CylindricalStorageInput(
ComparableQuantity<Volume> storageVolumeLvlMin,
ComparableQuantity<Temperature> inletTemp,
ComparableQuantity<Temperature> returnTemp,
ComparableQuantity<SpecificHeatCapacity> c) {
ComparableQuantity<SpecificHeatCapacity> c,
ComparableQuantity<VolumetricFlowRate> inletFlowRate,
ComparableQuantity<VolumetricFlowRate> 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.inletFlowRate = inletFlowRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE);
this.outletFlowRate = outletFlowRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE);
}

/**
Expand All @@ -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 inletFlowRate flow rate of the inlet
* @param outletFlowRate flow rate of the outlet
*/
public CylindricalStorageInput(
UUID uuid,
Expand All @@ -77,13 +90,17 @@ public CylindricalStorageInput(
ComparableQuantity<Volume> storageVolumeLvlMin,
ComparableQuantity<Temperature> inletTemp,
ComparableQuantity<Temperature> returnTemp,
ComparableQuantity<SpecificHeatCapacity> c) {
ComparableQuantity<SpecificHeatCapacity> c,
ComparableQuantity<VolumetricFlowRate> inletFlowRate,
ComparableQuantity<VolumetricFlowRate> 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.inletFlowRate = inletFlowRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE);
this.outletFlowRate = outletFlowRate.to(StandardUnits.VOLUMETRIC_FLOW_RATE);
}

public ComparableQuantity<Volume> getStorageVolumeLvl() {
Expand All @@ -106,6 +123,14 @@ public ComparableQuantity<SpecificHeatCapacity> getC() {
return c;
}

public ComparableQuantity<VolumetricFlowRate> getInletFlowRate() {
return inletFlowRate;
}

public ComparableQuantity<VolumetricFlowRate> getOutletFlowRate() {
return outletFlowRate;
}

@Override
public CylindricalStorageInputCopyBuilder copy() {
return new CylindricalStorageInputCopyBuilder(this);
Expand All @@ -120,13 +145,22 @@ 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)
&& inletFlowRate.equals(that.inletFlowRate)
&& outletFlowRate.equals(that.outletFlowRate);
}

@Override
public int hashCode() {
return Objects.hash(
super.hashCode(), storageVolumeLvl, storageVolumeLvlMin, inletTemp, returnTemp, c);
super.hashCode(),
storageVolumeLvl,
storageVolumeLvlMin,
inletTemp,
returnTemp,
c,
inletFlowRate,
outletFlowRate);
}

@Override
Expand All @@ -152,6 +186,10 @@ public String toString() {
+ returnTemp
+ ", c="
+ c
+ ", inletFlowRate ="
+ inletFlowRate
+ ", outletFlowPower ="
+ outletFlowRate
+ '}';
}

Expand All @@ -168,6 +206,8 @@ public static class CylindricalStorageInputCopyBuilder
private ComparableQuantity<Temperature> inletTemp;
private ComparableQuantity<Temperature> returnTemp;
private ComparableQuantity<SpecificHeatCapacity> c;
private ComparableQuantity<VolumetricFlowRate> inletFlowRate;
private ComparableQuantity<VolumetricFlowRate> outletFlowRate;

private CylindricalStorageInputCopyBuilder(CylindricalStorageInput entity) {
super(entity);
Expand All @@ -176,6 +216,8 @@ private CylindricalStorageInputCopyBuilder(CylindricalStorageInput entity) {
this.inletTemp = entity.getInletTemp();
this.returnTemp = entity.getReturnTemp();
this.c = entity.getC();
this.inletFlowRate = entity.getInletFlowRate();
this.outletFlowRate = entity.getOutletFlowRate();
}

@Override
Expand All @@ -190,7 +232,9 @@ public CylindricalStorageInput build() {
storageVolumeLvlMin,
inletTemp,
returnTemp,
c);
c,
inletFlowRate,
outletFlowRate);
}

public CylindricalStorageInputCopyBuilder storageVolumeLvl(
Expand Down Expand Up @@ -221,6 +265,18 @@ public CylindricalStorageInputCopyBuilder c(ComparableQuantity<SpecificHeatCapac
return this;
}

public CylindricalStorageInputCopyBuilder inletFlowRate(
ComparableQuantity<VolumetricFlowRate> inletFlowRate) {
this.inletFlowRate = inletFlowRate;
return this;
}

public CylindricalStorageInputCopyBuilder outletFlowRate(
ComparableQuantity<VolumetricFlowRate> outletFlowRate) {
this.outletFlowRate = outletFlowRate;
return this;
}

@Override
protected CylindricalStorageInputCopyBuilder childInstance() {
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ class CylindricalStorageInputFactoryTest extends Specification implements Facto
"storagevolumelvlmin": "4",
"inlettemp" : "5",
"returntemp" : "6",
"c" : "7"
"c" : "7",
"inletflowrate" : "8",
"outletflowrate" : "9"
]
def inputClass = CylindricalStorageInput
def thermalBusInput = Mock(ThermalBusInput)
Expand All @@ -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 inletFlowRate == getQuant(parameter["inletflowrate"], StandardUnits.VOLUMETRIC_FLOW_RATE)
assert outletFlowRate == getQuant(parameter["outletflowrate"], StandardUnits.VOLUMETRIC_FLOW_RATE)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
.inletFlowRate(ThermalUnitInputTestData.inletFlowRate)
.outletFlowRate(ThermalUnitInputTestData.outletFlowRate)
.build()


then:
Expand All @@ -34,6 +42,8 @@ class CylindricalStorageInputTest extends Specification {
assert inletTemp == ThermalUnitInputTestData.inletTemp
assert returnTemp == ThermalUnitInputTestData.returnTemp
assert c == ThermalUnitInputTestData.c
assert inletFlowRate == ThermalUnitInputTestData.inletFlowRate
assert outletFlowRate == ThermalUnitInputTestData.outletFlowRate
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -48,6 +49,10 @@ class ThermalUnitValidationUtilsTest extends Specification {
private static final ComparableQuantity<Temperature> inletTemp = Quantities.getQuantity(100, StandardUnits.TEMPERATURE)
private static final ComparableQuantity<Temperature> returnTemp = Quantities.getQuantity(80, StandardUnits.TEMPERATURE)
private static final ComparableQuantity<SpecificHeatCapacity> c = Quantities.getQuantity(1.05, StandardUnits.SPECIFIC_HEAT_CAPACITY)
private static final ComparableQuantity<VolumetricFlowRate> inletFlowRate = Quantities.getQuantity(0.2, StandardUnits.VOLUMETRIC_FLOW_RATE)
private static final ComparableQuantity<VolumetricFlowRate> outletFlowRate = Quantities.getQuantity(1.2, StandardUnits.VOLUMETRIC_FLOW_RATE)



// Thermal House

Expand Down Expand Up @@ -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, 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)
}
}
Loading