diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b7e6acbf..e47f141e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Enhancing `VoltageLevel` with `equals` method [#1063](https://github.com/ie3-institute/PowerSystemDataModel/issues/1063) - `ConnectorValidationUtils` checks if parallel devices is > 0 [#1077](https://github.com/ie3-institute/PowerSystemDataModel/issues/1077) - `GridContainerValidationUtils` checks the connectivity for all defined operation time intervals [#1091](https://github.com/ie3-institute/PowerSystemDataModel/issues/1091) +- Enhance LoadInput by categories for markov [#1089](https://github.com/ie3-institute/PowerSystemDataModel/issues/1089) ### Fixed - Fixed `MappingEntryies` not getting processed by adding `Getter` methods for record fields [#1084](https://github.com/ie3-institute/PowerSystemDataModel/issues/1084) diff --git a/docs/readthedocs/models/input/participant/load.md b/docs/readthedocs/models/input/participant/load.md index a153e8392..72cd972e2 100644 --- a/docs/readthedocs/models/input/participant/load.md +++ b/docs/readthedocs/models/input/participant/load.md @@ -59,6 +59,14 @@ Model of (mainly) domestic loads. * - cosPhiRated - -- - Rated power factor + + * - type + - -- + - Type of building: house or flat + + * - inhabitants + - -- + - Number of inhabitants * - em - -- @@ -68,6 +76,10 @@ Model of (mainly) domestic loads. ``` +## Markov + +The parameters `building_type` and `inhabitants` are for the Markov load agent (stochastic load modeling). + ## Caveats Nothing - at least not known. diff --git a/src/main/java/edu/ie3/datamodel/io/factory/input/participant/LoadInputFactory.java b/src/main/java/edu/ie3/datamodel/io/factory/input/participant/LoadInputFactory.java index 6c1d295be..bf3b678e7 100644 --- a/src/main/java/edu/ie3/datamodel/io/factory/input/participant/LoadInputFactory.java +++ b/src/main/java/edu/ie3/datamodel/io/factory/input/participant/LoadInputFactory.java @@ -30,6 +30,9 @@ public class LoadInputFactory private static final String E_CONS_ANNUAL = "eConsAnnual"; private static final String S_RATED = "sRated"; private static final String COS_PHI = "cosPhiRated"; + private static final String TYPE = "type"; + private static final String INHABITANTS = "inhabitants"; + private static final String INCOME = "income"; public LoadInputFactory() { super(LoadInput.class); @@ -65,6 +68,9 @@ protected LoadInput buildModel( data.getQuantity(E_CONS_ANNUAL, StandardUnits.ENERGY_IN); final ComparableQuantity sRated = data.getQuantity(S_RATED, StandardUnits.S_RATED); final double cosPhi = data.getDouble(COS_PHI); + final String type = data.getField(TYPE); + final int inhabitants = data.getInt(INHABITANTS); + final int income = data.getInt(INCOME); return new LoadInput( uuid, @@ -78,6 +84,9 @@ protected LoadInput buildModel( dsm, eConsAnnual, sRated, - cosPhi); + cosPhi, + type, + inhabitants, + income); } } diff --git a/src/main/java/edu/ie3/datamodel/models/input/system/LoadInput.java b/src/main/java/edu/ie3/datamodel/models/input/system/LoadInput.java index 81df5ea95..b0ccae64b 100644 --- a/src/main/java/edu/ie3/datamodel/models/input/system/LoadInput.java +++ b/src/main/java/edu/ie3/datamodel/models/input/system/LoadInput.java @@ -11,7 +11,9 @@ import edu.ie3.datamodel.models.input.NodeInput; import edu.ie3.datamodel.models.input.OperatorInput; import edu.ie3.datamodel.models.input.system.characteristic.ReactivePowerCharacteristic; +import edu.ie3.datamodel.models.profile.BdewStandardLoadProfile; import edu.ie3.datamodel.models.profile.LoadProfile; +import edu.ie3.datamodel.models.profile.NbwTemperatureDependantLoadProfile; import edu.ie3.datamodel.models.profile.StandardLoadProfile; import edu.ie3.datamodel.models.timeseries.individual.IndividualTimeSeries; import edu.ie3.datamodel.models.timeseries.repetitive.RepetitiveTimeSeries; @@ -38,6 +40,12 @@ public class LoadInput extends SystemParticipantInput { private final ComparableQuantity sRated; /** Rated power factor */ private final double cosPhiRated; + /** Type of the Househould */ + private final String type; + /** Number of inhabitants of the Household */ + private final int inhabitants; + /** Income of the inhabitants per Household */ + private final int income; /** * Constructor for an operated load @@ -54,6 +62,9 @@ public class LoadInput extends SystemParticipantInput { * @param eConsAnnual Annually consumed energy (typically in kWh) * @param sRated Rated apparent power (in kVA) * @param cosPhiRated Rated power factor + * @param type of the Household + * @param inhabitants Number of inhabitants of the Household + * @param income of the inhabitants per Household */ public LoadInput( UUID uuid, @@ -67,13 +78,19 @@ public LoadInput( boolean dsm, ComparableQuantity eConsAnnual, ComparableQuantity sRated, - double cosPhiRated) { + double cosPhiRated, + String type, + int inhabitants, + int income) { super(uuid, id, operator, operationTime, node, qCharacteristics, em); this.loadProfile = loadProfile; this.dsm = dsm; this.eConsAnnual = eConsAnnual.to(StandardUnits.ENERGY_IN); this.sRated = sRated.to(StandardUnits.S_RATED); this.cosPhiRated = cosPhiRated; + this.type = type; + this.inhabitants = inhabitants; + this.income = income; } /** @@ -86,13 +103,15 @@ public LoadInput( * @param node the asset is connected to * @param qCharacteristics Description of a reactive power characteristic * @param em The {@link EmInput} controlling this system participant. Null, if not applicable. - * @param loadProfileKey Load profile key corresponding to {@link - * edu.ie3.datamodel.models.profile.BdewStandardLoadProfile} or {@link - * edu.ie3.datamodel.models.profile.NbwTemperatureDependantLoadProfile} + * @param loadProfileKey Load profile key corresponding to {@link BdewStandardLoadProfile} or + * {@link NbwTemperatureDependantLoadProfile} * @param dsm True, if demand side management is activated for this load * @param eConsAnnual Annually consumed energy (typically in kWh) * @param sRated Rated apparent power (in kVA) * @param cosPhiRated Rated power factor + * @param type of the Household + * @param inhabitants Number of inhabitants of the Household + * @param income of the inhabitants per Household */ public LoadInput( UUID uuid, @@ -106,7 +125,10 @@ public LoadInput( boolean dsm, ComparableQuantity eConsAnnual, ComparableQuantity sRated, - double cosPhiRated) + double cosPhiRated, + String type, + int inhabitants, + int income) throws ParsingException { this( @@ -121,7 +143,10 @@ public LoadInput( dsm, eConsAnnual, sRated, - cosPhiRated); + cosPhiRated, + type, + inhabitants, + income); } /** @@ -137,6 +162,9 @@ public LoadInput( * @param eConsAnnual Annually consumed energy (typically in kWh) * @param sRated Rated apparent power (in kVA) * @param cosPhiRated Rated power factor + * @param type of the Household + * @param inhabitants Number of inhabitants of the Household + * @param income of the inhabitants per Household */ public LoadInput( UUID uuid, @@ -148,13 +176,19 @@ public LoadInput( boolean dsm, ComparableQuantity eConsAnnual, ComparableQuantity sRated, - double cosPhiRated) { + double cosPhiRated, + String type, + int inhabitants, + int income) { super(uuid, id, node, qCharacteristics, em); this.loadProfile = loadProfile; this.dsm = dsm; this.eConsAnnual = eConsAnnual.to(StandardUnits.ENERGY_IN); this.sRated = sRated.to(StandardUnits.S_RATED); this.cosPhiRated = cosPhiRated; + this.type = type; + this.inhabitants = inhabitants; + this.income = income; } /** @@ -165,13 +199,15 @@ public LoadInput( * @param node the asset is connected to * @param qCharacteristics Description of a reactive power characteristic * @param em The {@link EmInput} controlling this system participant. Null, if not applicable. - * @param loadProfileKey load profile key corresponding to {@link - * edu.ie3.datamodel.models.profile.BdewStandardLoadProfile} or {@link - * edu.ie3.datamodel.models.profile.NbwTemperatureDependantLoadProfile} + * @param loadProfileKey load profile key corresponding to {@link BdewStandardLoadProfile} or + * {@link NbwTemperatureDependantLoadProfile} * @param dsm True, if demand side management is activated for this load * @param eConsAnnual Annually consumed energy (typically in kWh) * @param sRated Rated apparent power (in kVA) * @param cosPhiRated Rated power factor + * @param type of the Household + * @param inhabitants Number of inhabitants of the Household + * @param income Household income */ public LoadInput( UUID uuid, @@ -183,7 +219,10 @@ public LoadInput( boolean dsm, ComparableQuantity eConsAnnual, ComparableQuantity sRated, - double cosPhiRated) + double cosPhiRated, + String type, + int inhabitants, + int income) throws ParsingException { this( uuid, @@ -195,7 +234,10 @@ public LoadInput( dsm, eConsAnnual, sRated, - cosPhiRated); + cosPhiRated, + type, + inhabitants, + income); } public LoadProfile getLoadProfile() { @@ -218,6 +260,18 @@ public double getCosPhiRated() { return cosPhiRated; } + public String getType() { + return type; + } + + public int getInhabitants() { + return inhabitants; + } + + public int getIncome() { + return income; + } + public LoadInputCopyBuilder copy() { return new LoadInputCopyBuilder(this); } @@ -231,12 +285,16 @@ public boolean equals(Object o) { && Double.compare(loadInput.cosPhiRated, cosPhiRated) == 0 && eConsAnnual.equals(loadInput.eConsAnnual) && loadProfile.equals(loadInput.loadProfile) - && sRated.equals(loadInput.sRated); + && sRated.equals(loadInput.sRated) + && type.equals(loadInput.type) + && Integer.compare(loadInput.inhabitants, inhabitants) == 0 + && Integer.compare(loadInput.income, income) == 0; } @Override public int hashCode() { - return Objects.hash(super.hashCode(), dsm, eConsAnnual, sRated, cosPhiRated); + return Objects.hash( + super.hashCode(), dsm, eConsAnnual, sRated, cosPhiRated, type, inhabitants, income); } @Override @@ -264,6 +322,12 @@ public String toString() { + sRated + ", cosphiRated=" + cosPhiRated + + ", type=" + + type + + ", inhabitants=" + + inhabitants + + ", income=" + + income + '}'; } @@ -282,6 +346,9 @@ public static class LoadInputCopyBuilder private ComparableQuantity eConsAnnual; private ComparableQuantity sRated; private double cosPhiRated; + private String type; + private int inhabitants; + private int income; private LoadInputCopyBuilder(LoadInput entity) { super(entity); @@ -290,6 +357,9 @@ private LoadInputCopyBuilder(LoadInput entity) { this.eConsAnnual = entity.geteConsAnnual(); this.sRated = entity.getsRated(); this.cosPhiRated = entity.getCosPhiRated(); + this.type = entity.getType(); + this.inhabitants = entity.getInhabitants(); + this.income = entity.getIncome(); } public LoadInputCopyBuilder loadprofile(StandardLoadProfile standardLoadProfile) { @@ -317,6 +387,21 @@ public LoadInputCopyBuilder cosPhiRated(double cosPhiRated) { return this; } + public LoadInputCopyBuilder type(String type) { + this.type = type; + return this; + } + + public LoadInputCopyBuilder inhabitants(int inhabitants) { + this.inhabitants = inhabitants; + return this; + } + + public LoadInputCopyBuilder income(int income) { + this.income = income; + return this; + } + @Override public LoadInputCopyBuilder scale(Double factor) { eConsAnnual(eConsAnnual.multiply(factor)); @@ -338,7 +423,10 @@ public LoadInput build() { dsm, eConsAnnual, sRated, - cosPhiRated); + cosPhiRated, + type, + inhabitants, + income); } @Override diff --git a/src/test/groovy/edu/ie3/datamodel/io/factory/input/participant/LoadInputFactoryTest.groovy b/src/test/groovy/edu/ie3/datamodel/io/factory/input/participant/LoadInputFactoryTest.groovy index c429ed541..d7f7ab1c6 100644 --- a/src/test/groovy/edu/ie3/datamodel/io/factory/input/participant/LoadInputFactoryTest.groovy +++ b/src/test/groovy/edu/ie3/datamodel/io/factory/input/participant/LoadInputFactoryTest.groovy @@ -50,7 +50,10 @@ class LoadInputFactoryTest extends Specification implements FactoryTestHelper { "dsm" : "true", "econsannual" : "3", "srated" : "4", - "cosphirated" : "5" + "cosphirated" : "5", + "type" : "house", + "inhabitants" : "1", + "income" : "900" ] Try input = inputFactory.get( new SystemParticipantEntityData(parameter, inputClass, nodeInput, emUnit)) @@ -76,6 +79,9 @@ class LoadInputFactoryTest extends Specification implements FactoryTestHelper { assert eConsAnnual == getQuant(parameter["econsannual"], StandardUnits.ENERGY_IN) assert sRated == getQuant(parameter["srated"], StandardUnits.S_RATED) assert cosPhiRated == Double.parseDouble(parameter["cosphirated"]) + assert type == parameter["type"] + assert inhabitants == Integer.parseInt(parameter["inhabitants"]) + assert income == Integer.parseInt(parameter["income"]) } where: diff --git a/src/test/groovy/edu/ie3/datamodel/io/processor/input/InputEntityProcessorTest.groovy b/src/test/groovy/edu/ie3/datamodel/io/processor/input/InputEntityProcessorTest.groovy index 24b1a8198..99ecb0d93 100644 --- a/src/test/groovy/edu/ie3/datamodel/io/processor/input/InputEntityProcessorTest.groovy +++ b/src/test/groovy/edu/ie3/datamodel/io/processor/input/InputEntityProcessorTest.groovy @@ -249,7 +249,10 @@ class InputEntityProcessorTest extends Specification { "qCharacteristics" : SystemParticipantTestData.cosPhiFixedSerialized, "sRated" : SystemParticipantTestData.loadInput.sRated.getValue().doubleValue().toString(), "loadProfile" : SystemParticipantTestData.loadInput.loadProfile.key, - "controllingEm" : SystemParticipantTestData.loadInput.controllingEm.map((UniqueEntity::getUuid).andThen(UUID::toString)).orElse("") + "controllingEm" : SystemParticipantTestData.loadInput.controllingEm.map((UniqueEntity::getUuid).andThen(UUID::toString)).orElse(""), + "type" : SystemParticipantTestData.loadInput.type.toString(), + "inhabitants" : SystemParticipantTestData.loadInput.inhabitants.toString(), + "income" : SystemParticipantTestData.loadInput.income.toString() ] StorageInput | SystemParticipantTestData.storageInput || [ "uuid" : SystemParticipantTestData.storageInput.uuid.toString(), diff --git a/src/test/groovy/edu/ie3/datamodel/io/source/csv/CsvDataSourceTest.groovy b/src/test/groovy/edu/ie3/datamodel/io/source/csv/CsvDataSourceTest.groovy index c1dbe8bf2..b9d28ec00 100644 --- a/src/test/groovy/edu/ie3/datamodel/io/source/csv/CsvDataSourceTest.groovy +++ b/src/test/groovy/edu/ie3/datamodel/io/source/csv/CsvDataSourceTest.groovy @@ -71,7 +71,10 @@ class CsvDataSourceTest extends Specification implements CsvTestDataMeta { "e_cons_annual", "operator", "dsm", - "em" + "em", + "type", + "inhabitants", + "income" ] as Set } diff --git a/src/test/groovy/edu/ie3/datamodel/io/source/csv/CsvSystemParticipantSourceTest.groovy b/src/test/groovy/edu/ie3/datamodel/io/source/csv/CsvSystemParticipantSourceTest.groovy index 91486c5eb..ed3414e03 100644 --- a/src/test/groovy/edu/ie3/datamodel/io/source/csv/CsvSystemParticipantSourceTest.groovy +++ b/src/test/groovy/edu/ie3/datamodel/io/source/csv/CsvSystemParticipantSourceTest.groovy @@ -330,7 +330,7 @@ class CsvSystemParticipantSourceTest extends Specification implements CsvTestDat where: nodes | operators || resultingSet - [sptd.loadInput.node] | [] || [new LoadInput(sptd.loadInput.uuid, sptd.loadInput.id, OperatorInput.NO_OPERATOR_ASSIGNED, sptd.loadInput.operationTime, sptd.loadInput.node, sptd.loadInput.qCharacteristics, sptd.emInput, sptd.loadInput.loadProfile, sptd.loadInput.dsm, sptd.loadInput.eConsAnnual, sptd.loadInput.sRated, sptd.loadInput.cosPhiRated)] + [sptd.loadInput.node] | [] || [new LoadInput(sptd.loadInput.uuid, sptd.loadInput.id, OperatorInput.NO_OPERATOR_ASSIGNED, sptd.loadInput.operationTime, sptd.loadInput.node, sptd.loadInput.qCharacteristics, sptd.emInput, sptd.loadInput.loadProfile, sptd.loadInput.dsm, sptd.loadInput.eConsAnnual, sptd.loadInput.sRated, sptd.loadInput.cosPhiRated, sptd.loadInput.type, sptd.loadInput.inhabitants, sptd.loadInput.income)] [] | [sptd.loadInput.operator] || [] [] | [] || [] } diff --git a/src/test/groovy/edu/ie3/test/common/SampleJointGrid.groovy b/src/test/groovy/edu/ie3/test/common/SampleJointGrid.groovy index ea7ea00ec..ea0c70fa8 100644 --- a/src/test/groovy/edu/ie3/test/common/SampleJointGrid.groovy +++ b/src/test/groovy/edu/ie3/test/common/SampleJointGrid.groovy @@ -95,7 +95,10 @@ class SampleJointGrid extends SystemParticipantTestData { false, eConsAnnual, sRated, - cosPhiRated) + cosPhiRated, + type, + inhabitants, + income) final LoadInput loadInput1 = new LoadInput( @@ -110,7 +113,10 @@ class SampleJointGrid extends SystemParticipantTestData { false, eConsAnnual, sRated, - cosPhiRated) + cosPhiRated, + type, + inhabitants, + income) // Storage final StorageInput storageInput = diff --git a/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy b/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy index eca3b3d39..20963d4a2 100644 --- a/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy +++ b/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy @@ -257,6 +257,9 @@ class SystemParticipantTestData { // Load protected static final ComparableQuantity eConsAnnual = Quantities.getQuantity(4000, ENERGY_IN) protected static final StandardLoadProfile standardLoadProfile = BdewStandardLoadProfile.H0 + protected static final String type = "house" + protected static final int inhabitants = 1 + protected static final int income = 900 public static final LoadInput loadInput = new LoadInput( UUID.fromString("eaf77f7e-9001-479f-94ca-7fb657766f5f"), "test_loadInput", @@ -269,7 +272,10 @@ class SystemParticipantTestData { false, eConsAnnual, sRated, - cosPhiRated + cosPhiRated, + type, + inhabitants, + income ) // Storage diff --git a/src/test/resources/edu/ie3/datamodel/io/source/csv/_participants/load_input.csv b/src/test/resources/edu/ie3/datamodel/io/source/csv/_participants/load_input.csv index 8fc693e31..25b053aeb 100644 --- a/src/test/resources/edu/ie3/datamodel/io/source/csv/_participants/load_input.csv +++ b/src/test/resources/edu/ie3/datamodel/io/source/csv/_participants/load_input.csv @@ -1,2 +1,2 @@ -uuid,cos_phi_rated,dsm,e_cons_annual,id,node,operates_from,operates_until,operator,q_characteristics,s_rated,load_profile,em -eaf77f7e-9001-479f-94ca-7fb657766f5f,0.95,false,4000.0,test_loadInput,4ca90220-74c2-4369-9afa-a18bf068840d,2020-03-24T15:11:31Z,2020-03-25T15:11:31Z,8f9682df-0744-4b58-a122-f0dc730f6510,"cosPhiFixed:{(0.00,0.95)}",25.0,h0,977157f4-25e5-4c72-bf34-440edc778792 +uuid,cos_phi_rated,dsm,e_cons_annual,id,node,operates_from,operates_until,operator,q_characteristics,s_rated,load_profile,em,type,inhabitants,income +eaf77f7e-9001-479f-94ca-7fb657766f5f,0.95,false,4000.0,test_loadInput,4ca90220-74c2-4369-9afa-a18bf068840d,2020-03-24T15:11:31Z,2020-03-25T15:11:31Z,8f9682df-0744-4b58-a122-f0dc730f6510,"cosPhiFixed:{(0.00,0.95)}",25.0,h0,977157f4-25e5-4c72-bf34-440edc778792,house,1,900