Skip to content

Fixed em fields in input models. #1332

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

Merged
merged 1 commit into from
May 26, 2025
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Fixed handling of `CongestionResult.InputModelType` in `EntityProcessor` [#1325](https://github.com/ie3-institute/PowerSystemDataModel/issues/1325)
- -Fixed em fields in input models [#1331](https://github.com/ie3-institute/PowerSystemDataModel/issues/1331)

### Changed
- Updated dependabot workflow and added CODEOWNERS [#1328](https://github.com/ie3-institute/PowerSystemDataModel/issues/1328)
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/models/input/em.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Participants are connected to an EM each via their `em` field.
-
- String representation (e.g. name) of a control strategy
* - parentEm
* - controllingEm
-
- Reference to a superior Energy Management Unit that is controlling this EM.
Field can be empty or missing, if this EM itself is not controlled.
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/models/input/participant/bm.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Model of a biomass power plant.
- € / MWh
- Fixed feed in tariff
* - em
* - controllingEm
-
- UUID reference to an [Energy Management Unit](#em_model) that is controlling
this system participant. Field can be empty or missing, if this participant
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/models/input/participant/chp.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Combined heat and power plant.
- Whether to adapt output based on (volatile)
market price or not
* - em
* - controllingEm
-
- UUID reference to an [Energy Management Unit](em_model) that is controlling
this system participant. Field can be empty or missing, if this participant
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/models/input/participant/ev.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Model of an electric vehicle, that is occasionally connected to the grid via an
-
-
* - em
* - controllingEm
-
- UUID reference to an [Energy Management Unit](#em_model) that is controlling
this system participant. Field can be empty or missing, if this participant
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/models/input/participant/evcs.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ station and has some limitations outlined below.
- Boolean
- Vehicle to grid (V2G) support, true if the charging station supports feed in.
* - em
* - controllingEm
-
- UUID reference to an [Energy Management Unit](#em_model) that is controlling
this system participant. Field can be empty or missing, if this participant
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/models/input/participant/fixedfeedin.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ model can be derived.
-
- Rated power factor
* - em
* - controllingEm
-
- UUID reference to an [Energy Management Unit](#em_model) that is controlling
this system participant. Field can be empty or missing, if this participant
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/models/input/participant/hp.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Model of a heat pump.
-
-
* - em
* - controllingEm
-
- UUID reference to an [Energy Management Unit](#em_model) that is controlling
this system participant. Field can be empty or missing, if this participant
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/models/input/participant/load.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Model of (mainly) domestic loads.
-
- Rated power factor
* - em
* - controllingEm
-
- UUID reference to an [Energy Management Unit](#em_model) that is controlling
this system participant. Field can be empty or missing, if this participant
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/models/input/participant/pv.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Detailed model of a photovoltaic power plant.
-
- Rated power factor
* - em
* - controllingEm
-
- UUID reference to an [Energy Management Unit](#em_model) that is controlling
this system participant. Field can be empty or missing, if this participant
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/models/input/participant/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Model of an ideal electrical battery energy storage.
- Foreseen operation strategy of the storage.
Eligible input: *"market"*, *"grid"*, *"self"*
* - em
* - controllingEm
-
- UUID reference to an [Energy Management Unit](#em_model) that is controlling
this system participant. Field can be empty or missing, if this participant
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/models/input/participant/wec.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Model of a wind energy converter.
- Whether to adapt output based on (volatile)
market price or not
* - em
* - controllingEm
-
- UUID reference to an [Energy Management Unit](#em_model) that is controlling
this system participant. Field can be empty or missing, if this participant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,39 @@
*/
public class EmAssetInputEntityData extends AssetInputEntityData {

private final EmInput emUnit;
private final EmInput controllingEm;

public EmAssetInputEntityData(
Map<String, String> fieldsToAttributes,
Class<? extends UniqueEntity> entityClass,
EmInput emUnit) {
EmInput controllingEm) {
super(fieldsToAttributes, entityClass);
this.emUnit = emUnit;
this.controllingEm = controllingEm;
}

public EmAssetInputEntityData(
Map<String, String> fieldsToAttributes,
Class<? extends UniqueEntity> entityClass,
OperatorInput operator,
EmInput emUnit) {
EmInput controllingEm) {
super(fieldsToAttributes, entityClass, operator);
this.emUnit = emUnit;
this.controllingEm = controllingEm;
}

/**
* Creates a new EmAssetInputEntityData object based on a given {@link AssetInputEntityData}
* object and given em unit
*
* @param entityData The entity data object to use attributes of
* @param emUnit The em input to use
* @param controllingEm The controlling em input to use
*/
public EmAssetInputEntityData(AssetInputEntityData entityData, EmInput emUnit) {
public EmAssetInputEntityData(AssetInputEntityData entityData, EmInput controllingEm) {
super(entityData, entityData.getOperatorInput());
this.emUnit = emUnit;
this.controllingEm = controllingEm;
}

public EmInput getEmUnit() {
return emUnit;
public EmInput getControllingEm() {
return controllingEm;
}

@Override
Expand All @@ -60,11 +60,11 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
EmAssetInputEntityData that = (EmAssetInputEntityData) o;
return Objects.equals(emUnit, that.emUnit);
return Objects.equals(controllingEm, that.controllingEm);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), emUnit);
return Objects.hash(super.hashCode(), controllingEm);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
* Institute of Energy Systems, Energy Efficiency and Energy Economics,
* Research group Distribution grid planning and operation
*/
package edu.ie3.datamodel.io.factory.input.participant;
package edu.ie3.datamodel.io.factory.input;

import edu.ie3.datamodel.io.factory.input.AssetInputEntityFactory;
import edu.ie3.datamodel.io.factory.input.EmAssetInputEntityData;
import edu.ie3.datamodel.models.OperationTime;
import edu.ie3.datamodel.models.input.EmInput;
import edu.ie3.datamodel.models.input.OperatorInput;
Expand All @@ -19,7 +17,7 @@ public class EmInputFactory extends AssetInputEntityFactory<EmInput, EmAssetInpu

private static final String CONTROL_STRATEGY = "controlStrategy";

public static final String PARENT_EM = "parentem";
public static final String CONTROLLING_EM = "controllingEm";

public EmInputFactory() {
super(EmInput.class);
Expand All @@ -30,7 +28,7 @@ protected List<Set<String>> getFields(Class<?> entityClass) {
List<Set<String>> fields = new ArrayList<>(super.getFields(entityClass));

List<Set<String>> withEm =
fields.stream().map(f -> (Set<String>) expandSet(f, PARENT_EM)).toList();
fields.stream().map(f -> (Set<String>) expandSet(f, CONTROLLING_EM)).toList();

fields.addAll(withEm);

Expand All @@ -51,7 +49,7 @@ protected EmInput buildModel(
OperationTime operationTime) {
String controlStrategy = data.getField(CONTROL_STRATEGY);

EmInput parentEm = data.getEmUnit();
EmInput parentEm = data.getControllingEm();

return new EmInput(uuid, id, operator, operationTime, controlStrategy, parentEm);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected BmInput buildModel(
ReactivePowerCharacteristic qCharacteristics,
OperatorInput operator,
OperationTime operationTime) {
final EmInput em = data.getEm().orElse(null);
final EmInput em = data.getControllingEm().orElse(null);
final BmTypeInput typeInput = data.getTypeInput();
final boolean marketReaction = data.getBoolean(MARKET_REACTION);
final boolean costControlled = data.getBoolean(COST_CONTROLLED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected ChpInput buildModel(
ReactivePowerCharacteristic qCharacteristics,
OperatorInput operator,
OperationTime operationTime) {
final EmInput em = data.getEm().orElse(null);
final EmInput em = data.getControllingEm().orElse(null);
final boolean marketReaction = data.getBoolean(MARKET_REACTION);

return new ChpInput(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected EvInput buildModel(
ReactivePowerCharacteristic qCharacteristics,
OperatorInput operator,
OperationTime operationTime) {
final EmInput em = data.getEm().orElse(null);
final EmInput em = data.getControllingEm().orElse(null);

return new EvInput(
uuid, id, operator, operationTime, node, qCharacteristics, em, data.getTypeInput());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected EvcsInput buildModel(
ReactivePowerCharacteristic qCharacteristics,
OperatorInput operator,
OperationTime operationTime) {
final EmInput em = data.getEm().orElse(null);
final EmInput em = data.getControllingEm().orElse(null);
final ChargingPointType type;
try {
type = ChargingPointTypeUtils.parse(data.getField(TYPE));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected FixedFeedInInput buildModel(
ReactivePowerCharacteristic qCharacteristics,
OperatorInput operator,
OperationTime operationTime) {
final EmInput em = data.getEm().orElse(null);
final EmInput em = data.getControllingEm().orElse(null);
final ComparableQuantity<Power> sRated = data.getQuantity(S_RATED, StandardUnits.S_RATED);
final double cosPhiRated = data.getDouble(COSPHI_RATED);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected HpInput buildModel(
ReactivePowerCharacteristic qCharacteristics,
OperatorInput operator,
OperationTime operationTime) {
final EmInput em = data.getEm().orElse(null);
final EmInput em = data.getControllingEm().orElse(null);

return new HpInput(
uuid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected LoadInput buildModel(
id);
loadProfile = LoadProfile.DefaultLoadProfiles.NO_LOAD_PROFILE;
}
final EmInput em = data.getEm().orElse(null);
final EmInput em = data.getControllingEm().orElse(null);

final ComparableQuantity<Energy> eConsAnnual =
data.getQuantity(E_CONS_ANNUAL, StandardUnits.ENERGY_IN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected PvInput buildModel(
ReactivePowerCharacteristic qCharacteristics,
OperatorInput operator,
OperationTime operationTime) {
final EmInput em = data.getEm().orElse(null);
final EmInput em = data.getControllingEm().orElse(null);
final double albedo = data.getDouble(ALBEDO);
final ComparableQuantity<Angle> azimuth = data.getQuantity(AZIMUTH, StandardUnits.AZIMUTH);
final ComparableQuantity<Dimensionless> etaConv =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected StorageInput buildModel(
ReactivePowerCharacteristic qCharacteristics,
OperatorInput operator,
OperationTime operationTime) {
final EmInput em = data.getEm().orElse(null);
final EmInput em = data.getControllingEm().orElse(null);
final StorageTypeInput typeInput = data.getTypeInput();
return new StorageInput(
uuid, id, operator, operationTime, node, qCharacteristics, em, typeInput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class SystemParticipantEntityData extends NodeAssetInputEntityData {

/** Energy management unit that is managing the system participant. Can be null. */
private final EmInput em;
private final EmInput controllingEm;

/**
* Creates a new SystemParticipantEntityData object for an operated, always on system participant
Expand All @@ -31,20 +31,20 @@ public class SystemParticipantEntityData extends NodeAssetInputEntityData {
* @param fieldsToAttributes attribute map: field name to value
* @param entityClass class of the entity to be created with this data
* @param node input node
* @param em The energy management unit that is managing the system participant. Null, if the
* system participant is not managed.
* @param controllingEm The energy management unit that is managing the system participant. Null,
* if the system participant is not managed.
*/
public SystemParticipantEntityData(
Map<String, String> fieldsToAttributes,
Class<? extends UniqueEntity> entityClass,
NodeInput node,
EmInput em) {
EmInput controllingEm) {
super(fieldsToAttributes, entityClass, node);
this.em = em;
this.controllingEm = controllingEm;
}

public Optional<EmInput> getEm() {
return Optional.ofNullable(em);
public Optional<EmInput> getControllingEm() {
return Optional.ofNullable(controllingEm);
}

/**
Expand All @@ -54,38 +54,38 @@ public Optional<EmInput> getEm() {
* @param entityClass class of the entity to be created with this data
* @param operator operator input
* @param node input node
* @param em The energy management unit that is managing the system participant. Null, if the
* system participant is not managed.
* @param controllingEm The energy management unit that is managing the system participant. Null,
* if the system participant is not managed.
*/
public SystemParticipantEntityData(
Map<String, String> fieldsToAttributes,
Class<? extends UniqueEntity> entityClass,
OperatorInput operator,
NodeInput node,
EmInput em) {
EmInput controllingEm) {
super(fieldsToAttributes, entityClass, operator, node);
this.em = em;
this.controllingEm = controllingEm;
}

/**
* Creates a new SystemParticipantEntityData object based on a given {@link
* NodeAssetInputEntityData} object and given energy management unit
*
* @param nodeAssetInputEntityData The node asset entity data object to use attributes of
* @param em The energy management unit that is managing the system participant. Null, if the
* system participant is not managed.
* @param controllingEm The energy management unit that is managing the system participant. Null,
* if the system participant is not managed.
*/
public SystemParticipantEntityData(
NodeAssetInputEntityData nodeAssetInputEntityData, EmInput em) {
NodeAssetInputEntityData nodeAssetInputEntityData, EmInput controllingEm) {
super(nodeAssetInputEntityData, nodeAssetInputEntityData.getNode());
this.em = em;
this.controllingEm = controllingEm;
}

@Override
public String toString() {
return "SystemParticipantEntityData{"
+ "em="
+ getEm().map(EmInput::toString).orElse("")
+ getControllingEm().map(EmInput::toString).orElse("")
+ ", node="
+ getNode().getUuid()
+ ", operatorInput="
Expand All @@ -103,11 +103,11 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
SystemParticipantEntityData that = (SystemParticipantEntityData) o;
return getEm().equals(that.getEm());
return getControllingEm().equals(that.getControllingEm());
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), getEm());
return Objects.hash(super.hashCode(), getControllingEm());
}
}
Loading