Skip to content
This repository was archived by the owner on Jun 29, 2024. It is now read-only.

Commit f9e6366

Browse files
committed
Add another usecase, move tests, some cleanup
1 parent 9d1759b commit f9e6366

33 files changed

+1775
-1347
lines changed

emobility/api.go

-55
Original file line numberDiff line numberDiff line change
@@ -50,37 +50,6 @@ type EMobilityInterface interface {
5050
// return the current charge state of the EV
5151
EVCurrentChargeState(remoteEntity api.EntityRemoteInterface) (EVChargeStateType, error)
5252

53-
// return the number of ac connected phases of the EV or 0 if it is unknown
54-
EVConnectedPhases(remoteEntity api.EntityRemoteInterface) (uint, error)
55-
56-
// return the charged energy measurement in Wh of the connected EV
57-
//
58-
// possible errors:
59-
// - ErrDataNotAvailable if no such measurement is (yet) available
60-
// - and others
61-
EVChargedEnergy(remoteEntity api.EntityRemoteInterface) (float64, error)
62-
63-
// return the last power measurement for each phase of the connected EV
64-
//
65-
// possible errors:
66-
// - ErrDataNotAvailable if no such measurement is (yet) available
67-
// - and others
68-
EVPowerPerPhase(remoteEntity api.EntityRemoteInterface) ([]float64, error)
69-
70-
// return the last current measurement for each phase of the connected EV
71-
//
72-
// possible errors:
73-
// - ErrDataNotAvailable if no such measurement is (yet) available
74-
// - and others
75-
EVCurrentsPerPhase(remoteEntity api.EntityRemoteInterface) ([]float64, error)
76-
77-
// return the min, max, default limits for each phase of the connected EV
78-
//
79-
// possible errors:
80-
// - ErrDataNotAvailable if no such measurement is (yet) available
81-
// - and others
82-
EVCurrentLimits(remoteEntity api.EntityRemoteInterface) ([]float64, []float64, []float64, error)
83-
8453
// return the current loadcontrol obligation limits
8554
//
8655
// possible errors:
@@ -117,30 +86,6 @@ type EMobilityInterface interface {
11786
// In ISO15118-20 this is a standard feature which does not need special support on the EVSE.
11887
EVWriteLoadControlLimits(remoteEntity api.EntityRemoteInterface, limits []EVLoadLimits) error
11988

120-
// return the current communication standard type used to communicate between EVSE and EV
121-
//
122-
// if an EV is connected via IEC61851, no ISO15118 specific data can be provided!
123-
// sometimes the connection starts with IEC61851 before it switches
124-
// to ISO15118, and sometimes it falls back again. so the error return is
125-
// never absolut for the whole connection time, except if the use case
126-
// is not supported
127-
//
128-
// the values are not constant and can change due to communication problems, bugs, and
129-
// sometimes communication starts with IEC61851 before it switches to ISO
130-
//
131-
// possible errors:
132-
// - ErrDataNotAvailable if that information is not (yet) available
133-
// - ErrNotSupported if getting the communication standard is not supported
134-
// - and others
135-
EVCommunicationStandard(remoteEntity api.EntityRemoteInterface) (EVCommunicationStandardType, error)
136-
137-
// returns the identification of the currently connected EV or nil if not available
138-
//
139-
// possible errors:
140-
// - ErrDataNotAvailable if that information is not (yet) available
141-
// - and others
142-
EVIdentification(remoteEntity api.EntityRemoteInterface) (string, error)
143-
14489
// returns if the EVSE and EV combination support optimzation of self consumption
14590
//
14691
// possible errors:

emobility/evcoordinatedcharging_test.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ func Test_CoordinatedChargingScenarios(t *testing.T) {
2121
mockRemoteFeature := mocks.NewFeatureRemoteInterface(t)
2222
mockRemoteDevice.EXPECT().FeatureByEntityTypeAndRole(mock.Anything, mock.Anything, mock.Anything).Return(mockRemoteFeature)
2323
mockRemoteEntity.EXPECT().Device().Return(mockRemoteDevice)
24-
data, err := emobility.EVChargedEnergy(mockRemoteEntity)
25-
assert.NotNil(t, err)
26-
assert.Equal(t, 0.0, data)
2724

2825
localDevice, localEntity, remoteDevice, entites, _ := setupDevices(eebusService)
2926
emobility.evseEntity = entites[0]
@@ -64,7 +61,7 @@ func Test_CoordinatedChargingScenarios(t *testing.T) {
6461

6562
datagramtt.Payload.Cmd = cmd
6663

67-
err = localDevice.ProcessCmd(datagramtt, remoteDevice)
64+
err := localDevice.ProcessCmd(datagramtt, remoteDevice)
6865
assert.Nil(t, err)
6966

7067
demand, err := emobility.EVEnergyDemand(emobility.evEntity)

emobility/events.go

+18-18
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func (e *EMobility) HandleEvent(payload api.EventPayload) {
184184

185185
switch *payload.CmdClassifier {
186186
case model.CmdClassifierTypeReply:
187-
if err := evIncentiveTable.RequestConstraints(); err == nil {
187+
if _, err := evIncentiveTable.RequestConstraints(); err == nil {
188188
break
189189
}
190190

@@ -361,7 +361,7 @@ func (e *EMobility) evConnected(entity api.EntityRemoteInterface) {
361361

362362
// initialise features, e.g. subscriptions, bindings
363363
if evDeviceClassification, err := e.deviceClassification(entity); err == nil {
364-
if err := evDeviceClassification.Subscribe(); err != nil {
364+
if _, err := evDeviceClassification.Subscribe(); err != nil {
365365
logging.Log().Debug(err)
366366
}
367367

@@ -372,17 +372,17 @@ func (e *EMobility) evConnected(entity api.EntityRemoteInterface) {
372372
}
373373

374374
if evDeviceConfiguration, err := e.deviceConfiguration(entity); err == nil {
375-
if err := evDeviceConfiguration.Subscribe(); err != nil {
375+
if _, err := evDeviceConfiguration.Subscribe(); err != nil {
376376
logging.Log().Debug(err)
377377
}
378378
// get ev configuration data
379-
if err := evDeviceConfiguration.RequestDescriptions(); err != nil {
379+
if _, err := evDeviceConfiguration.RequestDescriptions(); err != nil {
380380
logging.Log().Debug(err)
381381
}
382382
}
383383

384384
if evDeviceDiagnosis, err := e.deviceDiagnosis(entity); err == nil {
385-
if err := evDeviceDiagnosis.Subscribe(); err != nil {
385+
if _, err := evDeviceDiagnosis.Subscribe(); err != nil {
386386
logging.Log().Debug(err)
387387
}
388388

@@ -393,23 +393,23 @@ func (e *EMobility) evConnected(entity api.EntityRemoteInterface) {
393393
}
394394

395395
if evElectricalConnection, err := e.electricalConnection(entity); err == nil {
396-
if err := evElectricalConnection.Subscribe(); err != nil {
396+
if _, err := evElectricalConnection.Subscribe(); err != nil {
397397
logging.Log().Debug(err)
398398
}
399399

400400
// get electrical connection parameter
401-
if err := evElectricalConnection.RequestDescriptions(); err != nil {
401+
if _, err := evElectricalConnection.RequestDescriptions(); err != nil {
402402
logging.Log().Debug(err)
403403
}
404404

405-
if err := evElectricalConnection.RequestParameterDescriptions(); err != nil {
405+
if _, err := evElectricalConnection.RequestParameterDescriptions(); err != nil {
406406
logging.Log().Debug(err)
407407
}
408408

409409
}
410410

411411
if evMeasurement, err := e.measurement(entity); err == nil {
412-
if err := evMeasurement.Subscribe(); err != nil {
412+
if _, err := evMeasurement.Subscribe(); err != nil {
413413
logging.Log().Debug(err)
414414
}
415415

@@ -421,23 +421,23 @@ func (e *EMobility) evConnected(entity api.EntityRemoteInterface) {
421421
}
422422

423423
if evLoadControl, err := e.loadControl(entity); err == nil {
424-
if err := evLoadControl.Subscribe(); err != nil {
424+
if _, err := evLoadControl.Subscribe(); err != nil {
425425
logging.Log().Debug(err)
426426
}
427427

428-
if err := evLoadControl.Bind(); err != nil {
428+
if _, err := evLoadControl.Bind(); err != nil {
429429
logging.Log().Debug(err)
430430
}
431431

432432
// get loadlimit parameter
433-
if err := evLoadControl.RequestLimitDescriptions(); err != nil {
433+
if _, err := evLoadControl.RequestLimitDescriptions(); err != nil {
434434
logging.Log().Debug(err)
435435
}
436436

437437
}
438438

439439
if evIdentification, err := e.identification(entity); err == nil {
440-
if err := evIdentification.Subscribe(); err != nil {
440+
if _, err := evIdentification.Subscribe(); err != nil {
441441
logging.Log().Debug(err)
442442
}
443443

@@ -449,11 +449,11 @@ func (e *EMobility) evConnected(entity api.EntityRemoteInterface) {
449449

450450
if e.configuration.CoordinatedChargingEnabled {
451451
if evTimeSeries, err := e.timeSeries(entity); err == nil {
452-
if err := evTimeSeries.Subscribe(); err != nil {
452+
if _, err := evTimeSeries.Subscribe(); err != nil {
453453
logging.Log().Debug(err)
454454
}
455455

456-
if err := evTimeSeries.Bind(); err != nil {
456+
if _, err := evTimeSeries.Bind(); err != nil {
457457
logging.Log().Debug(err)
458458
}
459459

@@ -465,16 +465,16 @@ func (e *EMobility) evConnected(entity api.EntityRemoteInterface) {
465465
}
466466

467467
if evIncentiveTable, err := e.incentiveTable(entity); err == nil {
468-
if err := evIncentiveTable.Subscribe(); err != nil {
468+
if _, err := evIncentiveTable.Subscribe(); err != nil {
469469
logging.Log().Debug(err)
470470
}
471471

472-
if err := evIncentiveTable.Bind(); err != nil {
472+
if _, err := evIncentiveTable.Bind(); err != nil {
473473
logging.Log().Debug(err)
474474
}
475475

476476
// get incentive table parameter
477-
if err := evIncentiveTable.RequestDescriptions(); err != nil {
477+
if _, err := evIncentiveTable.RequestDescriptions(); err != nil {
478478
logging.Log().Debug(err)
479479
}
480480

0 commit comments

Comments
 (0)