Repository navigation
[Edge] Evcs.Ocpp.Server: fix meter values, StopTransaction and reconnect handling - #4151
Conversation
…ect handling - Voltage and Frequency are converted to mV/mHz as required by the channels - SampledValues without unit no longer throw a NullPointerException - Power calculated from energy had a swapped time difference and could divide by zero - StopTransaction for an unknown session no longer throws a NullPointerException - Closing an old connection no longer resets EVCS that are already bound to a new session
…in lostSession loop - handleMeterValuesRequest: Unit.valueOf threw IllegalArgumentException on unknown units and aborted the whole MeterValues request; EnumUtils.toEnum returns null for missing or unknown units, so the value is treated as base unit (unit is optional in OCPP 1.6) - MyJsonServer.lostSession: stop iterating ocppSessions after the matching entry was found - ComponentManagerImplTest: remove unused JsonUtils import Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (61.12%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #4151 +/- ##
==============================================
+ Coverage 30.98% 56.84% +25.87%
- Complexity 0 21321 +21321
==============================================
Files 577 4076 +3499
Lines 17906 186809 +168903
Branches 3208 15776 +12568
==============================================
+ Hits 5547 106181 +100634
- Misses 12113 76305 +64192
- Partials 246 4323 +4077 🚀 New features to boost your workflow:
|
sfeilmeier
left a comment
There was a problem hiding this comment.
Thank you!
Please be aware that we are slowly deprecating EVCS in favour of EVSE; but your contribution will survice this transition.
|
Hi, thanks for the fixes in #4151. During an independent differential verification campaign, we observed an interesting state transition in the energy-derived power calculation for EVCS configurations without The Using synthetic test vectors:
The derived power at D is 4400 W using the replaced reference, compared with 6000 W if B remains the reference. Both values correspond to different averaging windows. Is this reference replacement intentional, or should non-newer samples preserve the existing reference? We recognize the OCPP 1.6 chronological replay expectations for charge points. This is therefore a question about receiver-side robustness and sample-admission policy, not a protocol compliance finding. Happy to share our JUnit test cases and execution evidence if useful. |
While running OCPP 1.6 charge points against
Evcs.Ocpp.Serverwe ran into a few problems inCoreEventHandlerImplandMyJsonServer. Each fix is covered by a unit test that fails on currentdevelop. The bundle had no tests so far, so this also adds a small test setup (DummyOcppEvcs,MyConfig).Voltage in millivolt
ElectricityMeter.ChannelId.VOLTAGEis in mV, but the OCPPVoltagemeasurand (V) was written unscaled, so 230 V showed up as 0.23 V. It is now multiplied by 1000. Note that recorded voltage values of OCPP charge points will be 1000 times higher from now on.Frequency in millihertz
Same for
ElectricityMeter.ChannelId.FREQUENCY(integer, mHz): the measurand (Hz) was passed on as the raw string, so a decimal value like50.02threw anIllegalArgumentExceptioninsetNextValue()and the wholeMeterValuesrequest failed. It is now converted to mHz.Optional unit
unitis optional in an OCPP 1.6SampledValue. For measurands other than energy the library then returnsnull, which threw aNullPointerExceptioninUnit.valueOf(unitString.toUpperCase())and also dropped the wholeMeterValuesrequest. Values without a unit are now taken as they are, i.e. in the base unit (W, A, var, ...).Power calculated from energy
If an EVCS does not list
Power.Active.Importas supported, the power is derived fromEnergy.Active.Import.Register. The arguments ofDuration.between()were swapped, so the calculated power was negative. Two meter values with the same timestamp divided by zero. The arguments are now in the right order, and for a time difference of zero or less the last power value is kept.StopTransaction for an unknown session
handleStopTransactionRequest()called_setStatus()without checking whether an EVCS was found for the session and connector, which threw aNullPointerException.Reconnect before the old connection is closed
When a charge point reconnects (e.g. after a WiFi dropout) before its old WebSocket connection has timed out, the new session is registered first. When the old connection is closed later,
lostSession()was still called on the EVCS components, although they already belonged to the new session. That cleared their session and server reference, so no more charging limits could be sent until the charge point reconnected again.lostSession()is now only called for components that are still bound to the closed session.Tests