Skip to content
Open
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 @@ -77,6 +77,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated `Couchbase` version within the tests [#1586](https://github.com/ie3-institute/PowerSystemDataModel/issues/1586)
- Use the default time pattern for persisting time series keys [#766](https://github.com/ie3-institute/PowerSystemDataModel/issues/766)
- Handled some more SonarQube Issues [#1598](https://github.com/ie3-institute/PowerSystemDataModel/issues/1598)
- Change Evcs.locationType from single element to list [#1460](https://github.com/ie3-institute/PowerSystemDataModel/issues/1460)

## [8.1.0] - 2025-07-25

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@
import edu.ie3.datamodel.models.input.system.type.chargingpoint.ChargingPointTypeUtils;
import edu.ie3.datamodel.models.input.system.type.evcslocation.EvcsLocationType;
import edu.ie3.datamodel.models.input.system.type.evcslocation.EvcsLocationTypeUtils;
import java.util.List;
import java.util.UUID;

/**
* Factory to create instances of {@link EvcsInput}s based on {@link SystemParticipantEntityData}
* and additional fields.
*
* @version 0.1
* @since 26.07.20
*/
public class EvcsInputFactory
extends SystemParticipantInputEntityFactory<EvcsInput, SystemParticipantEntityData> {
Expand Down Expand Up @@ -59,15 +57,19 @@ protected EvcsInput buildModel(
final int chargingPoints = data.getInt(CHARGING_POINTS);
final double cosPhi = data.getDouble(COS_PHI_RATED);

final EvcsLocationType locationType;
String locationFieldValue = data.getField(LOCATION_TYPE);
final List<EvcsLocationType> locationTypes;
String locationFieldValue = data.getField(LOCATION_TYPES);
try {
locationType = EvcsLocationTypeUtils.parse(locationFieldValue);
if (locationFieldValue.contains(",")) {
locationTypes = EvcsLocationTypeUtils.parse(locationFieldValue);
} else {
locationTypes = List.of(EvcsLocationTypeUtils.parseSingle(locationFieldValue));
}
} catch (ParsingException e) {
throw new FactoryException(
String.format(
"Exception while trying to parse field \"%s\" with supposed int value \"%s\"",
LOCATION_TYPE, locationFieldValue),
"Exception while trying to parse field \"%s\" with supposed value \"%s\"",
LOCATION_TYPES, locationFieldValue),
e);
}

Expand All @@ -84,7 +86,7 @@ protected EvcsInput buildModel(
type,
chargingPoints,
cosPhi,
locationType,
locationTypes,
v2gSupport,
data.getFieldsToValues());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public class FieldNamingStrategy {
public static final String COS_PHI_RATED = "cosPhiRated";
public static final String E_CONS_ANNUAL = "eConsAnnual";
public static final String FEED_IN_TARIFF = "feedInTariff";
public static final String LOCATION_TYPE = "locationType";
public static final String LOCATION_TYPES = "locationTypes";
public static final String LOAD_PROFILE = "loadProfile";
public static final String OLM_CHARACTERISTIC = "olmCharacteristic";
public static final String Q_CHARACTERISTICS = "qCharacteristics";
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/edu/ie3/datamodel/io/naming/ModelFields.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ private static void registerParticipantFields() {

addMandatory(ChpInput.class, TYPE, THERMAL_BUS, THERMAL_STORAGE);

addMandatory(EvcsInput.class, TYPE, CHARGING_POINTS, COS_PHI_RATED, LOCATION_TYPE, V2G_SUPPORT);
addMandatory(
EvcsInput.class, TYPE, CHARGING_POINTS, COS_PHI_RATED, LOCATION_TYPES, V2G_SUPPORT);

addMandatory(EvInput.class, TYPE, Q_CHARACTERISTICS);

Expand Down
10 changes: 9 additions & 1 deletion src/main/java/edu/ie3/datamodel/io/processor/Processor.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,16 @@ protected String processMethodResult(
"DayOfWeek",
"Season",
"ChargingPointType",
"EvcsLocationType" ->
"EvcsLocationTypes" ->
resultStringBuilder.append(methodReturnObject.toString());
case "List", "ArrayList" -> {
if (methodReturnObject instanceof Collection<?> collection) {
resultStringBuilder.append(
collection.stream().map(Object::toString).collect(Collectors.joining(",", "[", "]")));
} else {
resultStringBuilder.append(methodReturnObject.toString());
}
}
case "Quantity", "ComparableQuantity" ->
resultStringBuilder.append(handleQuantity((Quantity<?>) methodReturnObject, fieldName));
case "Optional" ->
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/edu/ie3/datamodel/io/sink/CsvFileSink.java
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ private String[] csvHeaderElements(String[] strings) {
}

/**
* Transforms a provided map of string to string to valid csv formatted strings (according to csv
* specification RFC 4180)
* Transforms a provided map of string to string into valid csv formatted strings (according to
* csv specification RFC 4180)
*
* @param entityFieldData a string to string map that should be processed
* @return a new map with valid csv formatted keys and values strings
Expand Down
76 changes: 40 additions & 36 deletions src/main/java/edu/ie3/datamodel/models/input/system/EvcsInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import edu.ie3.datamodel.models.input.system.characteristic.ReactivePowerCharacteristic;
import edu.ie3.datamodel.models.input.system.type.chargingpoint.ChargingPointType;
import edu.ie3.datamodel.models.input.system.type.evcslocation.EvcsLocationType;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
Expand All @@ -29,15 +30,15 @@ public class EvcsInput extends SystemParticipantInput {
/** Rated power factor */
private final double cosPhiRated;

/** Evcs location type */
private final EvcsLocationType locationType;
/** Evcs location types (minimum one required) */
private final List<EvcsLocationType> locationTypes;

/** Whether charging station supports vehicle to grid */
private final boolean v2gSupport;

/**
* @param uuid Unique identifier
* @param id Human readable identifier
* @param id Human-readable identifier
* @param operator of the asset
* @param operationTime Time for which the entity is operated
* @param node that the asset is connected to
Expand All @@ -46,7 +47,7 @@ public class EvcsInput extends SystemParticipantInput {
* @param type type of the charging points available to this charging station
* @param chargingPoints number of charging points available at this charging station
* @param cosPhiRated rated cos phi
* @param locationType the location type
* @param locationTypes the location types (minimum one required)
* @param v2gSupport whether charging station supports vehicle to grid
*/
public EvcsInput(
Expand All @@ -60,19 +61,22 @@ public EvcsInput(
ChargingPointType type,
int chargingPoints,
double cosPhiRated,
EvcsLocationType locationType,
List<EvcsLocationType> locationTypes,
boolean v2gSupport) {
super(uuid, id, operator, operationTime, node, qCharacteristics, em);
if (locationTypes == null || locationTypes.isEmpty()) {
throw new IllegalArgumentException("At least one location type must be provided");
}
this.type = type;
this.chargingPoints = chargingPoints;
this.cosPhiRated = cosPhiRated;
this.locationType = locationType;
this.locationTypes = List.copyOf(locationTypes);
this.v2gSupport = v2gSupport;
}

/**
* @param uuid Unique identifier
* @param id Human readable identifier
* @param id Human-readable identifier
* @param operator of the asset
* @param operationTime Time for which the entity is operated
* @param node that the asset is connected to
Expand All @@ -81,7 +85,7 @@ public EvcsInput(
* @param type type of the charging points available to this charging station
* @param chargingPoints number of charging points available at this charging station
* @param cosPhiRated rated cos phi
* @param locationType the location type
* @param locationTypes the location types (minimum one required)
* @param v2gSupport whether charging station supports vehicle to grid
* @param additionalInformation That were provided by the source
*/
Expand All @@ -96,29 +100,29 @@ public EvcsInput(
ChargingPointType type,
int chargingPoints,
double cosPhiRated,
EvcsLocationType locationType,
List<EvcsLocationType> locationTypes,
boolean v2gSupport,
Map<String, String> additionalInformation) {
super(uuid, id, operator, operationTime, node, qCharacteristics, em);
this.type = type;
this.chargingPoints = chargingPoints;
this.cosPhiRated = cosPhiRated;
this.locationType = locationType;
this.locationTypes = locationTypes;
this.v2gSupport = v2gSupport;
setAdditionalInformation(additionalInformation);
}

/**
* @param uuid Unique identifier
* @param id Human readable identifier
* @param id Human-readable identifier
* @param operator of the asset
* @param operationTime Time for which the entity is operated
* @param node that 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 type type of the charging points available to this charging station
* @param cosPhiRated rated cos phi
* @param locationType the location type
* @param locationTypes the location types (minimum one required)
* @param v2gSupport whether charging station supports vehicle to grid
*/
public EvcsInput(
Expand All @@ -131,7 +135,7 @@ public EvcsInput(
EmInput em,
ChargingPointType type,
double cosPhiRated,
EvcsLocationType locationType,
List<EvcsLocationType> locationTypes,
boolean v2gSupport) {
this(
uuid,
Expand All @@ -144,20 +148,20 @@ public EvcsInput(
type,
1,
cosPhiRated,
locationType,
locationTypes,
v2gSupport);
}

/**
* @param uuid Unique identifier
* @param id Human readable identifier
* @param id Human-readable identifier
* @param node that 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 type type of the charging points available to this charging station
* @param chargingPoints number of charging points available at this charging station
* @param cosPhiRated rated cos phi
* @param locationType the location type
* @param locationTypes the location types (minimum one required)
* @param v2gSupport whether charging station supports vehicle to grid
*/
public EvcsInput(
Expand All @@ -169,25 +173,28 @@ public EvcsInput(
ChargingPointType type,
int chargingPoints,
double cosPhiRated,
EvcsLocationType locationType,
List<EvcsLocationType> locationTypes,
boolean v2gSupport) {
super(uuid, id, node, qCharacteristics, em);
if (locationTypes == null || locationTypes.isEmpty()) {
throw new IllegalArgumentException("At least one location type must be provided");
}
this.type = type;
this.chargingPoints = chargingPoints;
this.cosPhiRated = cosPhiRated;
this.locationType = locationType;
this.locationTypes = List.copyOf(locationTypes);
this.v2gSupport = v2gSupport;
}

/**
* @param uuid Unique identifier
* @param id Human readable identifier
* @param id Human-readable identifier
* @param node that 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 type type of the charging points available to this charging station
* @param cosPhiRated rated cos phi
* @param locationType the location type
* @param locationTypes the location types (minimum one required)
* @param v2gSupport whether charging station supports vehicle to grid
*/
public EvcsInput(
Expand All @@ -198,9 +205,9 @@ public EvcsInput(
EmInput em,
ChargingPointType type,
double cosPhiRated,
EvcsLocationType locationType,
List<EvcsLocationType> locationTypes,
boolean v2gSupport) {
this(uuid, id, node, qCharacteristics, em, type, 1, cosPhiRated, locationType, v2gSupport);
this(uuid, id, node, qCharacteristics, em, type, 1, cosPhiRated, locationTypes, v2gSupport);
}

public ChargingPointType getType() {
Expand All @@ -215,8 +222,8 @@ public double getCosPhiRated() {
return cosPhiRated;
}

public EvcsLocationType getLocationType() {
return locationType;
public List<EvcsLocationType> getLocationTypes() {
return locationTypes;
}

public boolean getV2gSupport() {
Expand All @@ -241,13 +248,13 @@ public boolean equals(Object o) {
return chargingPoints == evcsInput.chargingPoints
&& Double.compare(evcsInput.cosPhiRated, cosPhiRated) == 0
&& type.equals(evcsInput.type)
&& locationType.equals(evcsInput.locationType)
&& locationTypes.equals(evcsInput.locationTypes)
&& v2gSupport == evcsInput.v2gSupport;
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), type, chargingPoints, cosPhiRated, locationType);
return Objects.hash(super.hashCode(), type, chargingPoints, cosPhiRated, locationTypes);
}

@Override
Expand All @@ -273,8 +280,8 @@ public String toString() {
+ chargingPoints
+ ", cosPhiRated="
+ cosPhiRated
+ ", locationType="
+ locationType
+ ", locationTypes="
+ locationTypes
+ ", v2gSupport="
+ getV2gSupport()
+ ", additionalInformation="
Expand All @@ -285,25 +292,22 @@ public String toString() {
/**
* A builder pattern based approach to create copies of {@link EvcsInput} entities with altered
* field values. For detailed field descriptions refer to java docs of {@link EvcsInput}
*
* @version 0.1
* @since 05.06.20
*/
public static class EvcsInputCopyBuilder
extends SystemParticipantInputCopyBuilder<EvcsInputCopyBuilder> {

private ChargingPointType type;
private int chargingPoints;
private double cosPhiRated;
private EvcsLocationType locationType;
private List<EvcsLocationType> locationTypes;
private boolean v2gSupport;

public EvcsInputCopyBuilder(EvcsInput entity) {
super(entity);
this.type = entity.type;
this.chargingPoints = entity.chargingPoints;
this.cosPhiRated = entity.cosPhiRated;
this.locationType = entity.locationType;
this.locationTypes = entity.locationTypes;
this.v2gSupport = entity.v2gSupport;
}

Expand All @@ -322,8 +326,8 @@ public EvcsInputCopyBuilder cosPhiRated(double cosPhiRated) {
return thisInstance();
}

public EvcsInputCopyBuilder locationType(EvcsLocationType locationType) {
this.locationType = locationType;
public EvcsInputCopyBuilder locationTypes(List<EvcsLocationType> locationTypes) {
this.locationTypes = locationTypes;
return thisInstance();
}

Expand Down Expand Up @@ -351,7 +355,7 @@ public EvcsInput build() {
type,
chargingPoints,
cosPhiRated,
locationType,
locationTypes,
v2gSupport);
}

Expand Down
Loading