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

Enhance LoadInput by categories (type,inhabitants,income) for markov #1095

Open
wants to merge 14 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- 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)
- 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)
Expand Down
12 changes: 12 additions & 0 deletions docs/readthedocs/models/input/participant/load.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ Model of (mainly) domestic loads.
* - cosPhiRated
- --
- Rated power factor

* - type
- --
- Type of building: house or flat

* - inhabitants
- --
- Number of inhabitants

* - income
- --
- Income of inhabitants
pierrepetersmeier marked this conversation as resolved.
Show resolved Hide resolved
pierrepetersmeier marked this conversation as resolved.
Show resolved Hide resolved

* - em
- --
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
pierrepetersmeier marked this conversation as resolved.
Show resolved Hide resolved
private static final String INHABITANTS = "inhabitants";
private static final String INCOME = "income";

public LoadInputFactory() {
super(LoadInput.class);
Expand Down Expand Up @@ -65,6 +68,9 @@ protected LoadInput buildModel(
data.getQuantity(E_CONS_ANNUAL, StandardUnits.ENERGY_IN);
final ComparableQuantity<Power> 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,
Expand All @@ -78,6 +84,9 @@ protected LoadInput buildModel(
dsm,
eConsAnnual,
sRated,
cosPhi);
cosPhi,
type,
inhabitants,
income);
}
}
118 changes: 103 additions & 15 deletions src/main/java/edu/ie3/datamodel/models/input/system/LoadInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,6 +40,12 @@ public class LoadInput extends SystemParticipantInput {
private final ComparableQuantity<Power> 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;
pierrepetersmeier marked this conversation as resolved.
Show resolved Hide resolved

/**
* Constructor for an operated load
Expand All @@ -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,
Expand All @@ -67,13 +78,19 @@ public LoadInput(
boolean dsm,
ComparableQuantity<Energy> eConsAnnual,
ComparableQuantity<Power> 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;
}

/**
Expand All @@ -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,
Expand All @@ -106,7 +125,10 @@ public LoadInput(
boolean dsm,
ComparableQuantity<Energy> eConsAnnual,
ComparableQuantity<Power> sRated,
double cosPhiRated)
double cosPhiRated,
String type,
int inhabitants,
int income)
throws ParsingException {

this(
Expand All @@ -121,7 +143,10 @@ public LoadInput(
dsm,
eConsAnnual,
sRated,
cosPhiRated);
cosPhiRated,
type,
inhabitants,
income);
}

/**
Expand All @@ -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,
Expand All @@ -148,13 +176,19 @@ public LoadInput(
boolean dsm,
ComparableQuantity<Energy> eConsAnnual,
ComparableQuantity<Power> 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;
}

/**
Expand All @@ -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 of the inhabitants per Household
pierrepetersmeier marked this conversation as resolved.
Show resolved Hide resolved
*/
public LoadInput(
UUID uuid,
Expand All @@ -183,7 +219,10 @@ public LoadInput(
boolean dsm,
ComparableQuantity<Energy> eConsAnnual,
ComparableQuantity<Power> sRated,
double cosPhiRated)
double cosPhiRated,
String type,
int inhabitants,
int income)
throws ParsingException {
this(
uuid,
Expand All @@ -195,7 +234,10 @@ public LoadInput(
dsm,
eConsAnnual,
sRated,
cosPhiRated);
cosPhiRated,
type,
inhabitants,
income);
}

public LoadProfile getLoadProfile() {
Expand All @@ -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);
}
Expand All @@ -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
Expand Down Expand Up @@ -264,6 +322,12 @@ public String toString() {
+ sRated
+ ", cosphiRated="
+ cosPhiRated
+ ", type="
+ type
+ ", inhabitants="
+ inhabitants
+ ", income="
+ income
+ '}';
}

Expand All @@ -282,6 +346,9 @@ public static class LoadInputCopyBuilder
private ComparableQuantity<Energy> eConsAnnual;
private ComparableQuantity<Power> sRated;
private double cosPhiRated;
private String type;
private int inhabitants;
private int income;

private LoadInputCopyBuilder(LoadInput entity) {
super(entity);
Expand All @@ -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) {
Expand Down Expand Up @@ -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));
Expand All @@ -338,7 +423,10 @@ public LoadInput build() {
dsm,
eConsAnnual,
sRated,
cosPhiRated);
cosPhiRated,
type,
inhabitants,
income);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
pierrepetersmeier marked this conversation as resolved.
Show resolved Hide resolved
]
Try<LoadInput, FactoryException> input = inputFactory.get(
new SystemParticipantEntityData(parameter, inputClass, nodeInput, emUnit))
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ class CsvDataSourceTest extends Specification implements CsvTestDataMeta {
"e_cons_annual",
"operator",
"dsm",
"em"
"em",
"type",
"inhabitants",
"income"
] as Set
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] || []
[] | [] || []
}
Expand Down
Loading