Skip to content

Commit 1890487

Browse files
Merge pull request #683 from ie3-institute/to/#681-v2g-evcs
Add v2g support
2 parents c4efb5f + 9f8cdb4 commit 1890487

File tree

9 files changed

+61
-18
lines changed

9 files changed

+61
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
- `ThermalInput` as a distinct abstract class for all thermal models
1717
- `ThermalGrid` as a container for a completely connected thermal grid
1818
- `EmResult` and `FlexOptionsResult` for Energy Management Systems [#651](https://github.com/ie3-institute/PowerSystemDataModel/issues/651)
19+
- `EvcsInput` now has a parameter for enabling and disabling vehicle to grid support [#681](https://github.com/ie3-institute/PowerSystemDataModel/issues/681)
1920

2021
### Fixed
2122
- Reduced code smells [#492](https://github.com/ie3-institute/PowerSystemDataModel/issues/492)

src/main/java/edu/ie3/datamodel/io/factory/input/participant/EvcsInputFactory.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ public class EvcsInputFactory
3333
private static final String CHARGING_POINTS = "chargingpoints";
3434
private static final String COS_PHI_RATED = "cosphirated";
3535
private static final String LOCATION_TYPE = "locationtype";
36+
private static final String V2G_SUPPORT = "v2gsupport";
3637

3738
public EvcsInputFactory() {
3839
super(EvcsInput.class);
3940
}
4041

4142
@Override
4243
protected String[] getAdditionalFields() {
43-
return new String[] {TYPE, CHARGING_POINTS, COS_PHI_RATED, LOCATION_TYPE};
44+
return new String[] {TYPE, CHARGING_POINTS, COS_PHI_RATED, LOCATION_TYPE, V2G_SUPPORT};
4445
}
4546

4647
@Override
@@ -77,6 +78,8 @@ protected EvcsInput buildModel(
7778
e);
7879
}
7980

81+
final boolean v2gSupport = data.getBoolean(V2G_SUPPORT);
82+
8083
return new EvcsInput(
8184
uuid,
8285
id,
@@ -87,6 +90,7 @@ protected EvcsInput buildModel(
8790
type,
8891
chargingPoints,
8992
cosPhi,
90-
locationType);
93+
locationType,
94+
v2gSupport);
9195
}
9296
}

src/main/java/edu/ie3/datamodel/models/input/system/EvcsInput.java

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public class EvcsInput extends SystemParticipantInput {
2828
/** Evcs location type */
2929
private final EvcsLocationType locationType;
3030

31+
/** Whether charging station supports vehicle to grid */
32+
private final boolean v2gSupport;
33+
3134
/**
3235
* @param uuid Unique identifier
3336
* @param id Human readable identifier
@@ -39,6 +42,7 @@ public class EvcsInput extends SystemParticipantInput {
3942
* @param chargingPoints number of charging points available at this charging station
4043
* @param cosPhiRated rated cos phi
4144
* @param locationType the location type
45+
* @param v2gSupport whether charging station supports vehicle to grid
4246
*/
4347
public EvcsInput(
4448
UUID uuid,
@@ -50,12 +54,14 @@ public EvcsInput(
5054
ChargingPointType type,
5155
int chargingPoints,
5256
double cosPhiRated,
53-
EvcsLocationType locationType) {
57+
EvcsLocationType locationType,
58+
boolean v2gSupport) {
5459
super(uuid, id, operator, operationTime, node, qCharacteristics);
5560
this.type = type;
5661
this.chargingPoints = chargingPoints;
5762
this.cosPhiRated = cosPhiRated;
5863
this.locationType = locationType;
64+
this.v2gSupport = v2gSupport;
5965
}
6066

6167
/**
@@ -68,6 +74,7 @@ public EvcsInput(
6874
* @param type type of the charging points available to this charging station
6975
* @param cosPhiRated rated cos phi
7076
* @param locationType the location type
77+
* @param v2gSupport whether charging station supports vehicle to grid
7178
*/
7279
public EvcsInput(
7380
UUID uuid,
@@ -78,7 +85,8 @@ public EvcsInput(
7885
ReactivePowerCharacteristic qCharacteristics,
7986
ChargingPointType type,
8087
double cosPhiRated,
81-
EvcsLocationType locationType) {
88+
EvcsLocationType locationType,
89+
boolean v2gSupport) {
8290
this(
8391
uuid,
8492
id,
@@ -89,7 +97,8 @@ public EvcsInput(
8997
type,
9098
1,
9199
cosPhiRated,
92-
locationType);
100+
locationType,
101+
v2gSupport);
93102
}
94103
/**
95104
* @param uuid Unique identifier
@@ -100,6 +109,7 @@ public EvcsInput(
100109
* @param chargingPoints number of charging points available at this charging station
101110
* @param cosPhiRated rated cos phi
102111
* @param locationType the location type
112+
* @param v2gSupport whether charging station supports vehicle to grid
103113
*/
104114
public EvcsInput(
105115
UUID uuid,
@@ -109,12 +119,14 @@ public EvcsInput(
109119
ChargingPointType type,
110120
int chargingPoints,
111121
double cosPhiRated,
112-
EvcsLocationType locationType) {
122+
EvcsLocationType locationType,
123+
boolean v2gSupport) {
113124
super(uuid, id, node, qCharacteristics);
114125
this.type = type;
115126
this.chargingPoints = chargingPoints;
116127
this.cosPhiRated = cosPhiRated;
117128
this.locationType = locationType;
129+
this.v2gSupport = v2gSupport;
118130
}
119131

120132
/**
@@ -125,6 +137,7 @@ public EvcsInput(
125137
* @param type type of the charging points available to this charging station
126138
* @param cosPhiRated rated cos phi
127139
* @param locationType the location type
140+
* @param v2gSupport whether charging station supports vehicle to grid
128141
*/
129142
public EvcsInput(
130143
UUID uuid,
@@ -133,8 +146,9 @@ public EvcsInput(
133146
ReactivePowerCharacteristic qCharacteristics,
134147
ChargingPointType type,
135148
double cosPhiRated,
136-
EvcsLocationType locationType) {
137-
this(uuid, id, node, qCharacteristics, type, 1, cosPhiRated, locationType);
149+
EvcsLocationType locationType,
150+
boolean v2gSupport) {
151+
this(uuid, id, node, qCharacteristics, type, 1, cosPhiRated, locationType, v2gSupport);
138152
}
139153

140154
public ChargingPointType getType() {
@@ -153,6 +167,10 @@ public EvcsLocationType getLocationType() {
153167
return locationType;
154168
}
155169

170+
public boolean getV2gSupport() {
171+
return v2gSupport;
172+
}
173+
156174
@Override
157175
public EvcsInputCopyBuilder copy() {
158176
return new EvcsInputCopyBuilder(this);
@@ -166,7 +184,8 @@ public boolean equals(Object o) {
166184
return chargingPoints == evcsInput.chargingPoints
167185
&& Double.compare(evcsInput.cosPhiRated, cosPhiRated) == 0
168186
&& type.equals(evcsInput.type)
169-
&& locationType.equals(evcsInput.locationType);
187+
&& locationType.equals(evcsInput.locationType)
188+
&& v2gSupport == evcsInput.v2gSupport;
170189
}
171190

172191
@Override
@@ -193,6 +212,8 @@ public String toString() {
193212
+ ", node="
194213
+ getNode()
195214
+ "} "
215+
+ ", v2gSupport="
216+
+ getV2gSupport()
196217
+ super.toString();
197218
}
198219

@@ -210,13 +231,15 @@ public static class EvcsInputCopyBuilder
210231
private int chargingPoints;
211232
private double cosPhiRated;
212233
private EvcsLocationType locationType;
234+
private boolean v2gSupport;
213235

214236
public EvcsInputCopyBuilder(EvcsInput entity) {
215237
super(entity);
216238
this.type = entity.type;
217239
this.chargingPoints = entity.chargingPoints;
218240
this.cosPhiRated = entity.cosPhiRated;
219241
this.locationType = entity.locationType;
242+
this.v2gSupport = entity.v2gSupport;
220243
}
221244

222245
public EvcsInputCopyBuilder type(ChargingPointType type) {
@@ -239,6 +262,11 @@ public EvcsInputCopyBuilder locationType(EvcsLocationType locationType) {
239262
return this;
240263
}
241264

265+
public EvcsInputCopyBuilder v2gSupport(boolean v2gSupport) {
266+
this.v2gSupport = v2gSupport;
267+
return this;
268+
}
269+
242270
@Override
243271
public EvcsInput build() {
244272
return new EvcsInput(
@@ -251,7 +279,8 @@ public EvcsInput build() {
251279
type,
252280
chargingPoints,
253281
cosPhiRated,
254-
locationType);
282+
locationType,
283+
v2gSupport);
255284
}
256285

257286
@Override

src/test/groovy/edu/ie3/datamodel/io/factory/input/participant/EvcsInputFactoryTest.groovy

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ class EvcsInputFactoryTest extends Specification implements FactoryTestHelper {
4747
"type" : "Household",
4848
"chargingpoints" : "4",
4949
"cosphirated" : "0.95",
50-
"locationtype" : "CHARGING_HUB_TOWN"
50+
"locationtype" : "CHARGING_HUB_TOWN",
51+
"v2gsupport" : "false"
5152
]
5253
def inputClass = EvcsInput
5354
def nodeInput = Mock(NodeInput)
@@ -79,6 +80,7 @@ class EvcsInputFactoryTest extends Specification implements FactoryTestHelper {
7980
assert chargingPoints == Integer.parseInt(parameter["chargingpoints"])
8081
assert cosPhiRated == Double.parseDouble(parameter["cosphirated"])
8182
assert locationType == EvcsLocationType.CHARGING_HUB_TOWN
83+
assert !v2gSupport
8284
}
8385
}
8486

@@ -94,7 +96,8 @@ class EvcsInputFactoryTest extends Specification implements FactoryTestHelper {
9496
"type" : "-- invalid --",
9597
"chargingpoints" : "4",
9698
"cosphirated" : "0.95",
97-
"locationtype" : "CHARGING_HUB_TOWN"
99+
"locationtype" : "CHARGING_HUB_TOWN",
100+
"v2gsupport" : "false"
98101
]
99102
def inputClass = EvcsInput
100103
def nodeInput = Mock(NodeInput)
@@ -121,7 +124,8 @@ class EvcsInputFactoryTest extends Specification implements FactoryTestHelper {
121124
"type" : "Household",
122125
"chargingpoints" : "4",
123126
"cosphirated" : "0.95",
124-
"locationType" : "-- invalid --"
127+
"locationType" : "-- invalid --",
128+
"v2gsupport" : "false"
125129
]
126130
def inputClass = EvcsInput
127131
def nodeInput = Mock(NodeInput)

src/test/groovy/edu/ie3/datamodel/io/processor/input/InputEntityProcessorTest.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ class InputEntityProcessorTest extends Specification {
279279
"type" : SystemParticipantTestData.evcsInput.type.toString(),
280280
"cosPhiRated" : SystemParticipantTestData.evcsInput.cosPhiRated.toString(),
281281
"chargingPoints" : SystemParticipantTestData.evcsInput.chargingPoints.toString(),
282-
"locationType" : SystemParticipantTestData.evcsInput.locationType.name()
282+
"locationType" : SystemParticipantTestData.evcsInput.locationType.name(),
283+
"v2gSupport" : SystemParticipantTestData.evcsInput.v2gSupport.toString()
283284
]
284285
}
285286

src/test/groovy/edu/ie3/datamodel/io/source/csv/CsvSystemParticipantSourceTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ class CsvSystemParticipantSourceTest extends Specification implements CsvTestDat
314314
nodes | operators || resultingSize || resultingSet
315315
[sptd.evcsInput.node] | [sptd.evcsInput.operator] || 1 || [sptd.evcsInput]
316316
[sptd.evcsInput.node] | [] || 1 || [
317-
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)
317+
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)
318318
]
319319
[]| [sptd.evcsInput.operator]|| 0 || []
320320
[]| []|| 0 || []

src/test/groovy/edu/ie3/datamodel/models/input/system/EvcsInputTest.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class EvcsInputTest extends Specification {
2121
.type(ChargingPointTypeUtils.TeslaSuperChargerV3)
2222
.cosPhiRated(0.7d).chargingPoints(1)
2323
.locationType(EvcsLocationType.CHARGING_HUB_HIGHWAY)
24+
.v2gSupport(true)
2425
.build()
2526

2627
then:
@@ -34,6 +35,7 @@ class EvcsInputTest extends Specification {
3435
assert cosPhiRated == 0.7d
3536
assert chargingPoints == 1
3637
assert locationType == EvcsLocationType.CHARGING_HUB_HIGHWAY
38+
assert v2gSupport
3739
}
3840
}
3941
}

src/test/groovy/edu/ie3/test/common/SystemParticipantTestData.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ class SystemParticipantTestData {
297297
)
298298

299299
// charging station
300+
public static final boolean v2gSupport = false
300301
public static final evcsInput = new EvcsInput(
301302
UUID.fromString("798028b5-caff-4da7-bcd9-1750fdd8742c"),
302303
"test_csInput",
@@ -307,7 +308,8 @@ class SystemParticipantTestData {
307308
ChargingPointTypeUtils.HouseholdSocket,
308309
4,
309310
cosPhiRated,
310-
EvcsLocationType.HOME
311+
EvcsLocationType.HOME,
312+
v2gSupport
311313
)
312314

313315
// Energy Management
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
uuid,id,operator,operates_from,operates_until,node,q_characteristics,cos_phi_rated,type,charging_points,location_type
2-
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
1+
uuid,id,operator,operates_from,operates_until,node,q_characteristics,cos_phi_rated,type,charging_points,location_type,v2g_support
2+
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

0 commit comments

Comments
 (0)