@@ -292,43 +292,24 @@ func (s *UCEVCCSuite) Test_EVManufacturerData() {
292
292
}
293
293
294
294
func (s * UCEVCCSuite ) Test_EVCurrentLimits () {
295
- minData , maxData , defaultData , err := s .sut .CurrentLimits (s .mockRemoteEntity )
295
+ minData , maxData , standByData , err := s .sut .CurrentLimits (s .mockRemoteEntity )
296
296
assert .NotNil (s .T (), err )
297
- assert .Nil (s .T (), minData )
298
- assert .Nil (s .T (), maxData )
299
- assert .Nil (s .T (), defaultData )
297
+ assert .Equal (s .T (), 0.0 , minData )
298
+ assert .Equal (s .T (), 0.0 , maxData )
299
+ assert .Equal (s .T (), 0.0 , standByData )
300
300
301
- minData , maxData , defaultData , err = s .sut .CurrentLimits (s .evEntity )
301
+ minData , maxData , standByData , err = s .sut .CurrentLimits (s .evEntity )
302
302
assert .NotNil (s .T (), err )
303
- assert .Nil (s .T (), minData )
304
- assert .Nil (s .T (), maxData )
305
- assert .Nil (s .T (), defaultData )
306
-
307
- minData , maxData , defaultData , err = s .sut .CurrentLimits (s .evEntity )
308
- assert .NotNil (s .T (), err )
309
- assert .Nil (s .T (), minData )
310
- assert .Nil (s .T (), maxData )
311
- assert .Nil (s .T (), defaultData )
303
+ assert .Equal (s .T (), 0.0 , minData )
304
+ assert .Equal (s .T (), 0.0 , maxData )
305
+ assert .Equal (s .T (), 0.0 , standByData )
312
306
313
307
paramData := & model.ElectricalConnectionParameterDescriptionListDataType {
314
308
ElectricalConnectionParameterDescriptionData : []model.ElectricalConnectionParameterDescriptionDataType {
315
309
{
316
310
ElectricalConnectionId : util .Ptr (model .ElectricalConnectionIdType (0 )),
317
311
ParameterId : util .Ptr (model .ElectricalConnectionParameterIdType (0 )),
318
- MeasurementId : util .Ptr (model .MeasurementIdType (0 )),
319
- AcMeasuredPhases : util .Ptr (model .ElectricalConnectionPhaseNameTypeA ),
320
- },
321
- {
322
- ElectricalConnectionId : util .Ptr (model .ElectricalConnectionIdType (0 )),
323
- ParameterId : util .Ptr (model .ElectricalConnectionParameterIdType (1 )),
324
- MeasurementId : util .Ptr (model .MeasurementIdType (1 )),
325
- AcMeasuredPhases : util .Ptr (model .ElectricalConnectionPhaseNameTypeB ),
326
- },
327
- {
328
- ElectricalConnectionId : util .Ptr (model .ElectricalConnectionIdType (0 )),
329
- ParameterId : util .Ptr (model .ElectricalConnectionParameterIdType (2 )),
330
- MeasurementId : util .Ptr (model .MeasurementIdType (2 )),
331
- AcMeasuredPhases : util .Ptr (model .ElectricalConnectionPhaseNameTypeC ),
312
+ ScopeType : util .Ptr (model .ScopeTypeTypeACPowerTotal ),
332
313
},
333
314
},
334
315
}
@@ -337,92 +318,57 @@ func (s *UCEVCCSuite) Test_EVCurrentLimits() {
337
318
fErr := rFeature .UpdateData (model .FunctionTypeElectricalConnectionParameterDescriptionListData , paramData , nil , nil )
338
319
assert .Nil (s .T (), fErr )
339
320
340
- minData , maxData , defaultData , err = s .sut .CurrentLimits (s .evEntity )
321
+ minData , maxData , standByData , err = s .sut .CurrentLimits (s .evEntity )
341
322
assert .NotNil (s .T (), err )
342
- assert .Nil (s .T (), minData )
343
- assert .Nil (s .T (), maxData )
344
- assert .Nil (s .T (), defaultData )
323
+ assert .Equal (s .T (), 0.0 , minData )
324
+ assert .Equal (s .T (), 0.0 , maxData )
325
+ assert .Equal (s .T (), 0.0 , standByData )
345
326
346
327
type permittedStruct struct {
347
- defaultExists bool
348
- defaultValue , expectedDefaultValue float64
328
+ standByValue , expectedStandByValue float64
349
329
minValue , expectedMinValue float64
350
330
maxValue , expectedMaxValue float64
351
331
}
352
332
353
333
tests := []struct {
354
334
name string
355
- permitted [] permittedStruct
335
+ permitted permittedStruct
356
336
}{
357
337
{
358
- "1 Phase ISO15118" ,
359
- []permittedStruct {
360
- {true , 0.1 , 0.1 , 2 , 2 , 16 , 16 },
361
- },
362
- },
363
- {
364
- "1 Phase IEC61851" ,
365
- []permittedStruct {
366
- {true , 0.0 , 0.0 , 6 , 6 , 16 , 16 },
367
- },
368
- },
369
- {
370
- "1 Phase IEC61851 Elli" ,
371
- []permittedStruct {
372
- {false , 0.0 , 0.0 , 6 , 6 , 16 , 16 },
373
- },
338
+ "IEC 3 Phase" ,
339
+ permittedStruct {0.1 , 0.1 , 4287600 , 4287600 , 11433600 , 11433600 },
374
340
},
375
341
{
376
- "3 Phase ISO15118" ,
377
- []permittedStruct {
378
- {true , 0.1 , 0.1 , 2 , 2 , 16 , 16 },
379
- {true , 0.1 , 0.1 , 2 , 2 , 16 , 16 },
380
- {true , 0.1 , 0.1 , 2 , 2 , 16 , 16 },
381
- },
342
+ "ISO15118 VW" ,
343
+ permittedStruct {0.1 , 0.1 , 800 , 800 , 11433600 , 11433600 },
382
344
},
383
345
{
384
- "3 Phase IEC61851" ,
385
- []permittedStruct {
386
- {true , 0.0 , 0.0 , 6 , 6 , 16 , 16 },
387
- {true , 0.0 , 0.0 , 6 , 6 , 16 , 16 },
388
- {true , 0.0 , 0.0 , 6 , 6 , 16 , 16 },
389
- },
390
- },
391
- {
392
- "3 Phase IEC61851 Elli" ,
393
- []permittedStruct {
394
- {false , 0.0 , 0.0 , 6 , 6 , 16 , 16 },
395
- {false , 0.0 , 0.0 , 6 , 6 , 16 , 16 },
396
- {false , 0.0 , 0.0 , 6 , 6 , 16 , 16 },
397
- },
346
+ "ISO15118 Taycan" ,
347
+ permittedStruct {0.1 , 0.1 , 400 , 400 , 11433600 , 11433600 },
398
348
},
399
349
}
400
350
401
351
for _ , tc := range tests {
402
352
s .T ().Run (tc .name , func (t * testing.T ) {
403
353
dataSet := []model.ElectricalConnectionPermittedValueSetDataType {}
404
354
permittedData := []model.ScaledNumberSetType {}
405
- for index , data := range tc .permitted {
406
- item := model.ScaledNumberSetType {
407
- Range : []model.ScaledNumberRangeType {
408
- {
409
- Min : model .NewScaledNumberType (data .minValue ),
410
- Max : model .NewScaledNumberType (data .maxValue ),
411
- },
355
+ item := model.ScaledNumberSetType {
356
+ Range : []model.ScaledNumberRangeType {
357
+ {
358
+ Min : model .NewScaledNumberType (tc .permitted .minValue ),
359
+ Max : model .NewScaledNumberType (tc .permitted .maxValue ),
412
360
},
413
- }
414
- if data .defaultExists {
415
- item .Value = []model.ScaledNumberType {* model .NewScaledNumberType (data .defaultValue )}
416
- }
417
- permittedData = append (permittedData , item )
418
-
419
- permittedItem := model.ElectricalConnectionPermittedValueSetDataType {
420
- ElectricalConnectionId : util .Ptr (model .ElectricalConnectionIdType (0 )),
421
- ParameterId : util .Ptr (model .ElectricalConnectionParameterIdType (index )),
422
- PermittedValueSet : permittedData ,
423
- }
424
- dataSet = append (dataSet , permittedItem )
361
+ },
362
+ Value : []model.ScaledNumberType {* model .NewScaledNumberType (tc .permitted .standByValue )},
363
+ }
364
+ permittedData = append (permittedData , item )
365
+
366
+ permittedItem := model.ElectricalConnectionPermittedValueSetDataType {
367
+ ElectricalConnectionId : util .Ptr (model .ElectricalConnectionIdType (0 )),
368
+ ParameterId : util .Ptr (model .ElectricalConnectionParameterIdType (0 )),
369
+ PermittedValueSet : permittedData ,
425
370
}
371
+ dataSet = append (dataSet , permittedItem )
426
372
427
373
permData := & model.ElectricalConnectionPermittedValueSetListDataType {
428
374
ElectricalConnectionPermittedValueSetData : dataSet ,
@@ -431,18 +377,13 @@ func (s *UCEVCCSuite) Test_EVCurrentLimits() {
431
377
fErr := rFeature .UpdateData (model .FunctionTypeElectricalConnectionPermittedValueSetListData , permData , nil , nil )
432
378
assert .Nil (s .T (), fErr )
433
379
434
- minData , maxData , defaultData , err = s .sut .CurrentLimits (s .evEntity )
380
+ minData , maxData , standByData , err = s .sut .CurrentLimits (s .evEntity )
435
381
assert .Nil (s .T (), err )
436
382
437
383
assert .Nil (s .T (), err )
438
- assert .Equal (s .T (), len (tc .permitted ), len (minData ))
439
- assert .Equal (s .T (), len (tc .permitted ), len (maxData ))
440
- assert .Equal (s .T (), len (tc .permitted ), len (defaultData ))
441
- for index , item := range tc .permitted {
442
- assert .Equal (s .T (), item .expectedMinValue , minData [index ])
443
- assert .Equal (s .T (), item .expectedMaxValue , maxData [index ])
444
- assert .Equal (s .T (), item .expectedDefaultValue , defaultData [index ])
445
- }
384
+ assert .Equal (s .T (), tc .permitted .expectedMinValue , minData )
385
+ assert .Equal (s .T (), tc .permitted .expectedMaxValue , maxData )
386
+ assert .Equal (s .T (), tc .permitted .expectedStandByValue , standByData )
446
387
})
447
388
}
448
389
}
0 commit comments