diff --git a/CHANGELOG.md b/CHANGELOG.md index e46e25bc0..54f9cde2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `ThermalInput` as a distinct abstract class for all thermal models - `ThermalGrid` as a container for a completely connected thermal grid - `EmResult` and `FlexOptionsResult` for Energy Management Systems [#651](https://github.com/ie3-institute/PowerSystemDataModel/issues/651) +- `EvcsInput` now has a parameter for enabling and disabling vehicle to grid support [#681](https://github.com/ie3-institute/PowerSystemDataModel/issues/681) ### Fixed - Reduced code smells [#492](https://github.com/ie3-institute/PowerSystemDataModel/issues/492) diff --git a/src/main/java/edu/ie3/datamodel/io/factory/input/participant/EvcsInputFactory.java b/src/main/java/edu/ie3/datamodel/io/factory/input/participant/EvcsInputFactory.java index 0457b8eb3..fb7419a75 100644 --- a/src/main/java/edu/ie3/datamodel/io/factory/input/participant/EvcsInputFactory.java +++ b/src/main/java/edu/ie3/datamodel/io/factory/input/participant/EvcsInputFactory.java @@ -33,6 +33,7 @@ public class EvcsInputFactory private static final String CHARGING_POINTS = "chargingpoints"; private static final String COS_PHI_RATED = "cosphirated"; private static final String LOCATION_TYPE = "locationtype"; + private static final String V2G_SUPPORT = "v2gsupport"; public EvcsInputFactory() { super(EvcsInput.class); @@ -40,7 +41,7 @@ public EvcsInputFactory() { @Override protected String[] getAdditionalFields() { - return new String[] {TYPE, CHARGING_POINTS, COS_PHI_RATED, LOCATION_TYPE}; + return new String[] {TYPE, CHARGING_POINTS, COS_PHI_RATED, LOCATION_TYPE, V2G_SUPPORT}; } @Override @@ -77,6 +78,8 @@ protected EvcsInput buildModel( e); } + final boolean v2gSupport = data.getBoolean(V2G_SUPPORT); + return new EvcsInput( uuid, id, @@ -87,6 +90,7 @@ protected EvcsInput buildModel( type, chargingPoints, cosPhi, - locationType); + locationType, + v2gSupport); } } diff --git a/src/main/java/edu/ie3/datamodel/models/input/system/EvcsInput.java b/src/main/java/edu/ie3/datamodel/models/input/system/EvcsInput.java index 72b75224a..e08829f16 100644 --- a/src/main/java/edu/ie3/datamodel/models/input/system/EvcsInput.java +++ b/src/main/java/edu/ie3/datamodel/models/input/system/EvcsInput.java @@ -28,6 +28,9 @@ public class EvcsInput extends SystemParticipantInput { /** Evcs location type */ private final EvcsLocationType locationType; + /** Whether charging station supports vehicle to grid */ + private final boolean v2gSupport; + /** * @param uuid Unique identifier * @param id Human readable identifier @@ -39,6 +42,7 @@ public class EvcsInput extends SystemParticipantInput { * @param chargingPoints number of charging points available at this charging station * @param cosPhiRated rated cos phi * @param locationType the location type + * @param v2gSupport whether charging station supports vehicle to grid */ public EvcsInput( UUID uuid, @@ -50,12 +54,14 @@ public EvcsInput( ChargingPointType type, int chargingPoints, double cosPhiRated, - EvcsLocationType locationType) { + EvcsLocationType locationType, + boolean v2gSupport) { super(uuid, id, operator, operationTime, node, qCharacteristics); this.type = type; this.chargingPoints = chargingPoints; this.cosPhiRated = cosPhiRated; this.locationType = locationType; + this.v2gSupport = v2gSupport; } /** @@ -68,6 +74,7 @@ public EvcsInput( * @param type type of the charging points available to this charging station * @param cosPhiRated rated cos phi * @param locationType the location type + * @param v2gSupport whether charging station supports vehicle to grid */ public EvcsInput( UUID uuid, @@ -78,7 +85,8 @@ public EvcsInput( ReactivePowerCharacteristic qCharacteristics, ChargingPointType type, double cosPhiRated, - EvcsLocationType locationType) { + EvcsLocationType locationType, + boolean v2gSupport) { this( uuid, id, @@ -89,7 +97,8 @@ public EvcsInput( type, 1, cosPhiRated, - locationType); + locationType, + v2gSupport); } /** * @param uuid Unique identifier @@ -100,6 +109,7 @@ public EvcsInput( * @param chargingPoints number of charging points available at this charging station * @param cosPhiRated rated cos phi * @param locationType the location type + * @param v2gSupport whether charging station supports vehicle to grid */ public EvcsInput( UUID uuid, @@ -109,12 +119,14 @@ public EvcsInput( ChargingPointType type, int chargingPoints, double cosPhiRated, - EvcsLocationType locationType) { + EvcsLocationType locationType, + boolean v2gSupport) { super(uuid, id, node, qCharacteristics); this.type = type; this.chargingPoints = chargingPoints; this.cosPhiRated = cosPhiRated; this.locationType = locationType; + this.v2gSupport = v2gSupport; } /** @@ -125,6 +137,7 @@ public EvcsInput( * @param type type of the charging points available to this charging station * @param cosPhiRated rated cos phi * @param locationType the location type + * @param v2gSupport whether charging station supports vehicle to grid */ public EvcsInput( UUID uuid, @@ -133,8 +146,9 @@ public EvcsInput( ReactivePowerCharacteristic qCharacteristics, ChargingPointType type, double cosPhiRated, - EvcsLocationType locationType) { - this(uuid, id, node, qCharacteristics, type, 1, cosPhiRated, locationType); + EvcsLocationType locationType, + boolean v2gSupport) { + this(uuid, id, node, qCharacteristics, type, 1, cosPhiRated, locationType, v2gSupport); } public ChargingPointType getType() { @@ -153,6 +167,10 @@ public EvcsLocationType getLocationType() { return locationType; } + public boolean getV2gSupport() { + return v2gSupport; + } + @Override public EvcsInputCopyBuilder copy() { return new EvcsInputCopyBuilder(this); @@ -166,7 +184,8 @@ public boolean equals(Object o) { return chargingPoints == evcsInput.chargingPoints && Double.compare(evcsInput.cosPhiRated, cosPhiRated) == 0 && type.equals(evcsInput.type) - && locationType.equals(evcsInput.locationType); + && locationType.equals(evcsInput.locationType) + && v2gSupport == evcsInput.v2gSupport; } @Override @@ -193,6 +212,8 @@ public String toString() { + ", node=" + getNode() + "} " + + ", v2gSupport=" + + getV2gSupport() + super.toString(); } @@ -210,6 +231,7 @@ public static class EvcsInputCopyBuilder private int chargingPoints; private double cosPhiRated; private EvcsLocationType locationType; + private boolean v2gSupport; public EvcsInputCopyBuilder(EvcsInput entity) { super(entity); @@ -217,6 +239,7 @@ public EvcsInputCopyBuilder(EvcsInput entity) { this.chargingPoints = entity.chargingPoints; this.cosPhiRated = entity.cosPhiRated; this.locationType = entity.locationType; + this.v2gSupport = entity.v2gSupport; } public EvcsInputCopyBuilder type(ChargingPointType type) { @@ -239,6 +262,11 @@ public EvcsInputCopyBuilder locationType(EvcsLocationType locationType) { return this; } + public EvcsInputCopyBuilder v2gSupport(boolean v2gSupport) { + this.v2gSupport = v2gSupport; + return this; + } + @Override public EvcsInput build() { return new EvcsInput( @@ -251,7 +279,8 @@ public EvcsInput build() { type, chargingPoints, cosPhiRated, - locationType); + locationType, + v2gSupport); } @Override diff --git a/src/test/groovy/edu/ie3/datamodel/io/factory/input/participant/EvcsInputFactoryTest.groovy b/src/test/groovy/edu/ie3/datamodel/io/factory/input/participant/EvcsInputFactoryTest.groovy index f12686028..d01e29071 100644 --- a/src/test/groovy/edu/ie3/datamodel/io/factory/input/participant/EvcsInputFactoryTest.groovy +++ b/src/test/groovy/edu/ie3/datamodel/io/factory/input/participant/EvcsInputFactoryTest.groovy @@ -47,7 +47,8 @@ class EvcsInputFactoryTest extends Specification implements FactoryTestHelper { "type" : "Household", "chargingpoints" : "4", "cosphirated" : "0.95", - "locationtype" : "CHARGING_HUB_TOWN" + "locationtype" : "CHARGING_HUB_TOWN", + "v2gsupport" : "false" ] def inputClass = EvcsInput def nodeInput = Mock(NodeInput) @@ -79,6 +80,7 @@ class EvcsInputFactoryTest extends Specification implements FactoryTestHelper { assert chargingPoints == Integer.parseInt(parameter["chargingpoints"]) assert cosPhiRated == Double.parseDouble(parameter["cosphirated"]) assert locationType == EvcsLocationType.CHARGING_HUB_TOWN + assert !v2gSupport } } @@ -94,7 +96,8 @@ class EvcsInputFactoryTest extends Specification implements FactoryTestHelper { "type" : "-- invalid --", "chargingpoints" : "4", "cosphirated" : "0.95", - "locationtype" : "CHARGING_HUB_TOWN" + "locationtype" : "CHARGING_HUB_TOWN", + "v2gsupport" : "false" ] def inputClass = EvcsInput def nodeInput = Mock(NodeInput) @@ -121,7 +124,8 @@ class EvcsInputFactoryTest extends Specification implements FactoryTestHelper { "type" : "Household", "chargingpoints" : "4", "cosphirated" : "0.95", - "locationType" : "-- invalid --" + "locationType" : "-- invalid --", + "v2gsupport" : "false" ] def inputClass = EvcsInput def nodeInput = Mock(NodeInput) 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 4171950ff..fb587fe7d 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 @@ -279,7 +279,8 @@ class InputEntityProcessorTest extends Specification { "type" : SystemParticipantTestData.evcsInput.type.toString(), "cosPhiRated" : SystemParticipantTestData.evcsInput.cosPhiRated.toString(), "chargingPoints" : SystemParticipantTestData.evcsInput.chargingPoints.toString(), - "locationType" : SystemParticipantTestData.evcsInput.locationType.name() + "locationType" : SystemParticipantTestData.evcsInput.locationType.name(), + "v2gSupport" : SystemParticipantTestData.evcsInput.v2gSupport.toString() ] } 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 cb3a28799..ace6ae25b 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 @@ -314,7 +314,7 @@ class CsvSystemParticipantSourceTest extends Specification implements CsvTestDat nodes | operators || resultingSize || resultingSet [sptd.evcsInput.node] | [sptd.evcsInput.operator] || 1 || [sptd.evcsInput] [sptd.evcsInput.node] | [] || 1 || [ - new EvcsInput(sptd.evcsInput.uuid, sptd.evcsInput.id, OperatorInput.NO_OPERATOR_ASSIGNED, sptd.evcsInput.operationTime, sptd.evcsInput.node, sptd.evcsInput.qCharacteristics, sptd.evcsInput.type, sptd.evcsInput.chargingPoints, sptd.evcsInput.cosPhiRated, sptd.evcsInput.locationType) + new EvcsInput(sptd.evcsInput.uuid, sptd.evcsInput.id, OperatorInput.NO_OPERATOR_ASSIGNED, sptd.evcsInput.operationTime, sptd.evcsInput.node, sptd.evcsInput.qCharacteristics, sptd.evcsInput.type, sptd.evcsInput.chargingPoints, sptd.evcsInput.cosPhiRated, sptd.evcsInput.locationType, sptd.evcsInput.v2gSupport) ] []| [sptd.evcsInput.operator]|| 0 || [] []| []|| 0 || [] diff --git a/src/test/groovy/edu/ie3/datamodel/models/input/system/EvcsInputTest.groovy b/src/test/groovy/edu/ie3/datamodel/models/input/system/EvcsInputTest.groovy index 425080cdf..d27e95008 100644 --- a/src/test/groovy/edu/ie3/datamodel/models/input/system/EvcsInputTest.groovy +++ b/src/test/groovy/edu/ie3/datamodel/models/input/system/EvcsInputTest.groovy @@ -21,6 +21,7 @@ class EvcsInputTest extends Specification { .type(ChargingPointTypeUtils.TeslaSuperChargerV3) .cosPhiRated(0.7d).chargingPoints(1) .locationType(EvcsLocationType.CHARGING_HUB_HIGHWAY) + .v2gSupport(true) .build() then: @@ -34,6 +35,7 @@ class EvcsInputTest extends Specification { assert cosPhiRated == 0.7d assert chargingPoints == 1 assert locationType == EvcsLocationType.CHARGING_HUB_HIGHWAY + assert v2gSupport } } } diff --git a/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy b/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy index 8539d3cd4..769e6416b 100644 --- a/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy +++ b/src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy @@ -297,6 +297,7 @@ class SystemParticipantTestData { ) // charging station + public static final boolean v2gSupport = false public static final evcsInput = new EvcsInput( UUID.fromString("798028b5-caff-4da7-bcd9-1750fdd8742c"), "test_csInput", @@ -307,7 +308,8 @@ class SystemParticipantTestData { ChargingPointTypeUtils.HouseholdSocket, 4, cosPhiRated, - EvcsLocationType.HOME + EvcsLocationType.HOME, + v2gSupport ) // Energy Management diff --git a/src/test/resources/edu/ie3/datamodel/io/source/csv/_participants/evcs_input.csv b/src/test/resources/edu/ie3/datamodel/io/source/csv/_participants/evcs_input.csv index 2b544063d..0f8c9375e 100644 --- a/src/test/resources/edu/ie3/datamodel/io/source/csv/_participants/evcs_input.csv +++ b/src/test/resources/edu/ie3/datamodel/io/source/csv/_participants/evcs_input.csv @@ -1,2 +1,2 @@ -uuid,id,operator,operates_from,operates_until,node,q_characteristics,cos_phi_rated,type,charging_points,location_type -798028b5-caff-4da7-bcd9-1750fdd8742c,test_csInput,8f9682df-0744-4b58-a122-f0dc730f6510,2020-03-24T15:11:31Z[UTC],2020-03-25T15:11:31Z[UTC],4ca90220-74c2-4369-9afa-a18bf068840d,cosPhiFixed:{(0.0,0.95)},0.95,hhs,4,HOME \ No newline at end of file +uuid,id,operator,operates_from,operates_until,node,q_characteristics,cos_phi_rated,type,charging_points,location_type,v2g_support +798028b5-caff-4da7-bcd9-1750fdd8742c,test_csInput,8f9682df-0744-4b58-a122-f0dc730f6510,2020-03-24T15:11:31Z[UTC],2020-03-25T15:11:31Z[UTC],4ca90220-74c2-4369-9afa-a18bf068840d,cosPhiFixed:{(0.0,0.95)},0.95,hhs,4,HOME,false \ No newline at end of file