|
| 1 | +/* |
| 2 | + * © 2021. TU Dortmund University, |
| 3 | + * Institute of Energy Systems, Energy Efficiency and Energy Economics, |
| 4 | + * Research group Distribution grid planning and operation |
| 5 | +*/ |
| 6 | +package edu.ie3.datamodel.models.input.thermal; |
| 7 | + |
| 8 | +import edu.ie3.datamodel.models.OperationTime; |
| 9 | +import edu.ie3.datamodel.models.StandardUnits; |
| 10 | +import edu.ie3.datamodel.models.input.OperatorInput; |
| 11 | +import edu.ie3.util.quantities.interfaces.SpecificHeatCapacity; |
| 12 | +import java.util.Objects; |
| 13 | +import java.util.UUID; |
| 14 | +import javax.measure.quantity.Power; |
| 15 | +import javax.measure.quantity.Temperature; |
| 16 | +import javax.measure.quantity.Volume; |
| 17 | +import tech.units.indriya.ComparableQuantity; |
| 18 | + |
| 19 | +/** Thermal storage with cylindrical shape */ |
| 20 | +public abstract class AbstractStorageInput extends ThermalStorageInput { |
| 21 | + /** Available storage volume (typically in m³) */ |
| 22 | + private final ComparableQuantity<Volume> storageVolumeLvl; |
| 23 | + /** Temperature of the inlet (typically in C) */ |
| 24 | + private final ComparableQuantity<Temperature> inletTemp; |
| 25 | + /** Temperature of the outlet (typically in C) */ |
| 26 | + private final ComparableQuantity<Temperature> returnTemp; |
| 27 | + /** Specific heat capacity of the storage medium (typically in kWh/K*m³) */ |
| 28 | + private final ComparableQuantity<SpecificHeatCapacity> c; |
| 29 | + /** Maximum permissible thermal power (typically in kW) */ |
| 30 | + private final ComparableQuantity<Power> pThermalMax; |
| 31 | + |
| 32 | + /** |
| 33 | + * @param uuid Unique identifier of a cylindrical storage |
| 34 | + * @param id Identifier of the thermal unit |
| 35 | + * @param operator operator of the asset |
| 36 | + * @param operationTime operation time of the asset |
| 37 | + * @param bus Thermal bus, a thermal unit is connected to |
| 38 | + * @param storageVolumeLvl Available storage volume |
| 39 | + * @param inletTemp Temperature of the inlet |
| 40 | + * @param returnTemp Temperature of the outlet |
| 41 | + * @param c Specific heat capacity of the storage medium |
| 42 | + * @param pThermalMax Maximum thermal power of the storage |
| 43 | + */ |
| 44 | + public AbstractStorageInput( |
| 45 | + UUID uuid, |
| 46 | + String id, |
| 47 | + OperatorInput operator, |
| 48 | + OperationTime operationTime, |
| 49 | + ThermalBusInput bus, |
| 50 | + ComparableQuantity<Volume> storageVolumeLvl, |
| 51 | + ComparableQuantity<Temperature> inletTemp, |
| 52 | + ComparableQuantity<Temperature> returnTemp, |
| 53 | + ComparableQuantity<SpecificHeatCapacity> c, |
| 54 | + ComparableQuantity<Power> pThermalMax) { |
| 55 | + super(uuid, id, operator, operationTime, bus); |
| 56 | + this.storageVolumeLvl = storageVolumeLvl.to(StandardUnits.VOLUME); |
| 57 | + this.inletTemp = inletTemp.to(StandardUnits.TEMPERATURE); |
| 58 | + this.returnTemp = returnTemp.to(StandardUnits.TEMPERATURE); |
| 59 | + this.c = c.to(StandardUnits.SPECIFIC_HEAT_CAPACITY); |
| 60 | + this.pThermalMax = pThermalMax.to(StandardUnits.ACTIVE_POWER_IN); |
| 61 | + } |
| 62 | + |
| 63 | + /** |
| 64 | + * @param uuid Unique identifier of a cylindrical storage |
| 65 | + * @param id Identifier of the thermal unit |
| 66 | + * @param bus Thermal bus, a thermal unit is connected to |
| 67 | + * @param storageVolumeLvl Available storage volume |
| 68 | + * @param inletTemp Temperature of the inlet |
| 69 | + * @param returnTemp Temperature of the outlet |
| 70 | + * @param c Specific heat capacity of the storage medium |
| 71 | + * @param pThermalMax Maximum thermal power of the storage |
| 72 | + */ |
| 73 | + public AbstractStorageInput( |
| 74 | + UUID uuid, |
| 75 | + String id, |
| 76 | + ThermalBusInput bus, |
| 77 | + ComparableQuantity<Volume> storageVolumeLvl, |
| 78 | + ComparableQuantity<Temperature> inletTemp, |
| 79 | + ComparableQuantity<Temperature> returnTemp, |
| 80 | + ComparableQuantity<SpecificHeatCapacity> c, |
| 81 | + ComparableQuantity<Power> pThermalMax) { |
| 82 | + super(uuid, id, bus); |
| 83 | + this.storageVolumeLvl = storageVolumeLvl.to(StandardUnits.VOLUME); |
| 84 | + this.inletTemp = inletTemp.to(StandardUnits.TEMPERATURE); |
| 85 | + this.returnTemp = returnTemp.to(StandardUnits.TEMPERATURE); |
| 86 | + this.c = c.to(StandardUnits.SPECIFIC_HEAT_CAPACITY); |
| 87 | + this.pThermalMax = pThermalMax.to(StandardUnits.ACTIVE_POWER_IN); |
| 88 | + } |
| 89 | + |
| 90 | + public ComparableQuantity<Volume> getStorageVolumeLvl() { |
| 91 | + return storageVolumeLvl; |
| 92 | + } |
| 93 | + |
| 94 | + public ComparableQuantity<Temperature> getInletTemp() { |
| 95 | + return inletTemp; |
| 96 | + } |
| 97 | + |
| 98 | + public ComparableQuantity<Temperature> getReturnTemp() { |
| 99 | + return returnTemp; |
| 100 | + } |
| 101 | + |
| 102 | + public ComparableQuantity<SpecificHeatCapacity> getC() { |
| 103 | + return c; |
| 104 | + } |
| 105 | + |
| 106 | + public ComparableQuantity<Power> getpThermalMax() { |
| 107 | + return pThermalMax; |
| 108 | + } |
| 109 | + |
| 110 | + @Override |
| 111 | + public boolean equals(Object o) { |
| 112 | + if (this == o) return true; |
| 113 | + if (!(o instanceof AbstractStorageInput that)) return false; |
| 114 | + if (!super.equals(o)) return false; |
| 115 | + return storageVolumeLvl.equals(that.storageVolumeLvl) |
| 116 | + && inletTemp.equals(that.inletTemp) |
| 117 | + && returnTemp.equals(that.returnTemp) |
| 118 | + && c.equals(that.c) |
| 119 | + && pThermalMax.equals(that.getpThermalMax()); |
| 120 | + } |
| 121 | + |
| 122 | + @Override |
| 123 | + public int hashCode() { |
| 124 | + return Objects.hash(super.hashCode(), storageVolumeLvl, inletTemp, returnTemp, c, pThermalMax); |
| 125 | + } |
| 126 | + |
| 127 | + @Override |
| 128 | + public String toString() { |
| 129 | + return "CylindricalStorageInput{" |
| 130 | + + "uuid=" |
| 131 | + + getUuid() |
| 132 | + + ", id=" |
| 133 | + + getId() |
| 134 | + + ", operator=" |
| 135 | + + getOperator().getUuid() |
| 136 | + + ", operationTime=" |
| 137 | + + getOperationTime() |
| 138 | + + ", bus=" |
| 139 | + + getThermalBus().getUuid() |
| 140 | + + ", storageVolumeLvl=" |
| 141 | + + storageVolumeLvl |
| 142 | + + ", inletTemp=" |
| 143 | + + inletTemp |
| 144 | + + ", returnTemp=" |
| 145 | + + returnTemp |
| 146 | + + ", c=" |
| 147 | + + c |
| 148 | + + ", pThermalMax=" |
| 149 | + + pThermalMax |
| 150 | + + '}'; |
| 151 | + } |
| 152 | + |
| 153 | + /** |
| 154 | + * A builder pattern based approach to create copies of {@link AbstractStorageInput} entities with |
| 155 | + * altered field values. For detailed field descriptions refer to java docs of {@link |
| 156 | + * AbstractStorageInput} |
| 157 | + */ |
| 158 | + protected abstract static class AbstractStorageInputCopyBuilder< |
| 159 | + B extends AbstractStorageInputCopyBuilder<B>> |
| 160 | + extends ThermalStorageInputCopyBuilder<B> { |
| 161 | + |
| 162 | + private ComparableQuantity<Volume> storageVolumeLvl; |
| 163 | + private ComparableQuantity<Temperature> inletTemp; |
| 164 | + private ComparableQuantity<Temperature> returnTemp; |
| 165 | + private ComparableQuantity<SpecificHeatCapacity> c; |
| 166 | + private ComparableQuantity<Power> pThermalMax; |
| 167 | + |
| 168 | + protected AbstractStorageInputCopyBuilder(AbstractStorageInput entity) { |
| 169 | + super(entity); |
| 170 | + |
| 171 | + this.storageVolumeLvl = entity.getStorageVolumeLvl(); |
| 172 | + this.inletTemp = entity.getInletTemp(); |
| 173 | + this.returnTemp = entity.getReturnTemp(); |
| 174 | + this.c = entity.getC(); |
| 175 | + this.pThermalMax = entity.getpThermalMax(); |
| 176 | + } |
| 177 | + |
| 178 | + public B storageVolumeLvl(ComparableQuantity<Volume> storageVolumeLvl) { |
| 179 | + this.storageVolumeLvl = storageVolumeLvl; |
| 180 | + return thisInstance(); |
| 181 | + } |
| 182 | + |
| 183 | + public B inletTemp(ComparableQuantity<Temperature> inletTemp) { |
| 184 | + this.inletTemp = inletTemp; |
| 185 | + return thisInstance(); |
| 186 | + } |
| 187 | + |
| 188 | + public B returnTemp(ComparableQuantity<Temperature> returnTemp) { |
| 189 | + this.returnTemp = returnTemp; |
| 190 | + return thisInstance(); |
| 191 | + } |
| 192 | + |
| 193 | + public B c(ComparableQuantity<SpecificHeatCapacity> c) { |
| 194 | + this.c = c; |
| 195 | + return thisInstance(); |
| 196 | + } |
| 197 | + |
| 198 | + public B pThermalMax(ComparableQuantity<Power> pThermalMax) { |
| 199 | + this.pThermalMax = pThermalMax; |
| 200 | + return thisInstance(); |
| 201 | + } |
| 202 | + |
| 203 | + @Override |
| 204 | + public B scale(Double factor) { |
| 205 | + storageVolumeLvl(storageVolumeLvl.multiply(factor)); |
| 206 | + pThermalMax(pThermalMax.multiply(factor)); |
| 207 | + return thisInstance(); |
| 208 | + } |
| 209 | + |
| 210 | + public ComparableQuantity<Volume> getStorageVolumeLvl() { |
| 211 | + return storageVolumeLvl; |
| 212 | + } |
| 213 | + |
| 214 | + public ComparableQuantity<Temperature> getInletTemp() { |
| 215 | + return inletTemp; |
| 216 | + } |
| 217 | + |
| 218 | + public ComparableQuantity<Temperature> getReturnTemp() { |
| 219 | + return returnTemp; |
| 220 | + } |
| 221 | + |
| 222 | + public ComparableQuantity<SpecificHeatCapacity> getC() { |
| 223 | + return c; |
| 224 | + } |
| 225 | + |
| 226 | + public ComparableQuantity<Power> getpThermalMax() { |
| 227 | + return pThermalMax; |
| 228 | + } |
| 229 | + } |
| 230 | +} |
0 commit comments