ChargePoint / wireshark-v2g

Dissector for the V2G Protocols
Other
48 stars 19 forks source link

Incorrect decoding of ChargeParameterDiscoveryReq #67

Closed jefjoha closed 4 months ago

jefjoha commented 5 months ago

I am working with a Vector Charging Simulator connected to an EV. During the SLAC process we get to a message, ChargeParameteerDiscoveryReq and the PCAP decoding shows the message as truncated. I have uploaded the PCAP log file with the associated message at line number 209. Can you advise if this is an issue with the dissector or a possible issue with the charger. The charger THINKS it is sending the correct data. Further, the Vector decoder decodes the data correctly.

PCAP Log with truncated charge parameter discovery response.zip

image

jhart-cpi commented 5 months ago

The XML content of the message is:

<?xml version="1.0" encoding="UTF-8"?>
<V2G_Message>
    <Header>
        <SessionID>ee9227da90347aac</SessionID>
    </Header>
    <Body>
        <ChargeParameterDiscoveryRes>
            <ResponseCode>OK</ResponseCode>
            <EVSEProcessing>Finished</EVSEProcessing>
            <SAScheduleList>
                <SAScheduleTuple>
                    <SAScheduleTupleID>1</SAScheduleTupleID>
                    <PMaxSchedule>
                        <PMaxScheduleEntry>
                            <RelativeTimeInterval>
                                <start>0</start>
                            </RelativeTimeInterval>
                            <PMax>
                                <Multiplier>0</Multiplier>
                                <Unit>W</Unit>
                                <Value>2100</Value>
                            </PMax>
                        </PMaxScheduleEntry>
                        <PMaxScheduleEntry>
                            <RelativeTimeInterval>
                                <start>3600</start>
                            </RelativeTimeInterval>
                            <PMax>
                                <Multiplier>0</Multiplier>
                                <Unit>W</Unit>
                                <Value>2000</Value>
                            </PMax>
                        </PMaxScheduleEntry>
                        <PMaxScheduleEntry>
                            <RelativeTimeInterval>
                                <start>7200</start>
                            </RelativeTimeInterval>
                            <PMax>
                                <Multiplier>0</Multiplier>
                                <Unit>W</Unit>
                                <Value>2100</Value>
                            </PMax>
                        </PMaxScheduleEntry>
                        <PMaxScheduleEntry>
                            <RelativeTimeInterval>
                                <start>10800</start>
                            </RelativeTimeInterval>
                            <PMax>
                                <Multiplier>0</Multiplier>
                                <Unit>W</Unit>
                                <Value>2000</Value>
                            </PMax>
                        </PMaxScheduleEntry>
                        <PMaxScheduleEntry>
                            <RelativeTimeInterval>
                                <start>14400</start>
                            </RelativeTimeInterval>
                            <PMax>
                                <Multiplier>0</Multiplier>
                                <Unit>W</Unit>
                                <Value>2100</Value>
                            </PMax>
                        </PMaxScheduleEntry>
                        <PMaxScheduleEntry>
                            <RelativeTimeInterval>
                                <start>18000</start>
                            </RelativeTimeInterval>
                            <PMax>
                                <Multiplier>0</Multiplier>
                                <Unit>W</Unit>
                                <Value>2000</Value>
                            </PMax>
                        </PMaxScheduleEntry>
                        <PMaxScheduleEntry>
                            <RelativeTimeInterval>
                                <start>21600</start>
                            </RelativeTimeInterval>
                            <PMax>
                                <Multiplier>0</Multiplier>
                                <Unit>W</Unit>
                                <Value>2100</Value>
                            </PMax>
                        </PMaxScheduleEntry>
                        <PMaxScheduleEntry>
                            <RelativeTimeInterval>
                                <start>25200</start>
                            </RelativeTimeInterval>
                            <PMax>
                                <Multiplier>0</Multiplier>
                                <Unit>W</Unit>
                                <Value>2000</Value>
                            </PMax>
                        </PMaxScheduleEntry>
                        <PMaxScheduleEntry>
                            <RelativeTimeInterval>
                                <start>28800</start>
                            </RelativeTimeInterval>
                            <PMax>
                                <Multiplier>0</Multiplier>
                                <Unit>W</Unit>
                                <Value>2100</Value>
                            </PMax>
                        </PMaxScheduleEntry>
                        <PMaxScheduleEntry>
                            <RelativeTimeInterval>
                                <start>32400</start>
                            </RelativeTimeInterval>
                            <PMax>
                                <Multiplier>0</Multiplier>
                                <Unit>W</Unit>
                                <Value>2000</Value>
                            </PMax>
                        </PMaxScheduleEntry>
                        <PMaxScheduleEntry>
                            <RelativeTimeInterval>
                                <start>36000</start>
                            </RelativeTimeInterval>
                            <PMax>
                                <Multiplier>0</Multiplier>
                                <Unit>W</Unit>
                                <Value>2100</Value>
                            </PMax>
                        </PMaxScheduleEntry>
                        <PMaxScheduleEntry>
                            <RelativeTimeInterval>
                                <start>39600</start>
                                <duration>46800</duration>
                            </RelativeTimeInterval>
                            <PMax>
                                <Multiplier>0</Multiplier>
                                <Unit>W</Unit>
                                <Value>2000</Value>
                            </PMax>
                        </PMaxScheduleEntry>
                    </PMaxSchedule>
                </SAScheduleTuple>
            </SAScheduleList>
            <DC_EVSEChargeParameter>
                <DC_EVSEStatus>
                    <NotificationMaxDelay>0</NotificationMaxDelay>
                    <EVSENotification>None</EVSENotification>
                    <EVSEIsolationStatus>Invalid</EVSEIsolationStatus>
                    <EVSEStatusCode>EVSE_Ready</EVSEStatusCode>
                </DC_EVSEStatus>
                <EVSEMaximumCurrentLimit>
                    <Multiplier>1</Multiplier>
                    <Unit>A</Unit>
                    <Value>8</Value>
                </EVSEMaximumCurrentLimit>
                <EVSEMaximumPowerLimit>
                    <Multiplier>3</Multiplier>
                    <Unit>W</Unit>
                    <Value>30</Value>
                </EVSEMaximumPowerLimit>
                <EVSEMaximumVoltageLimit>
                    <Multiplier>1</Multiplier>
                    <Unit>V</Unit>
                    <Value>95</Value>
                </EVSEMaximumVoltageLimit>
                <EVSEMinimumCurrentLimit>
                    <Multiplier>0</Multiplier>
                    <Unit>A</Unit>
                    <Value>0</Value>
                </EVSEMinimumCurrentLimit>
                <EVSEMinimumVoltageLimit>
                    <Multiplier>0</Multiplier>
                    <Unit>V</Unit>
                    <Value>0</Value>
                </EVSEMinimumVoltageLimit>
                <EVSECurrentRegulationTolerance>
                    <Multiplier>1</Multiplier>
                    <Unit>A</Unit>
                    <Value>5</Value>
                </EVSECurrentRegulationTolerance>
                <EVSEPeakCurrentRipple>
                    <Multiplier>0</Multiplier>
                    <Unit>A</Unit>
                    <Value>12</Value>
                </EVSEPeakCurrentRipple>
                <EVSEEnergyToBeDelivered>
                    <Multiplier>0</Multiplier>
                    <Unit>Wh</Unit>
                    <Value>16777</Value>
                </EVSEEnergyToBeDelivered>
            </DC_EVSEChargeParameter>
        </ChargeParameterDiscoveryRes>
    </Body>
</V2G_Message>

I suspect you're getting hit by a limitation of the OpenV2G codec which limits the occurrences of the PMaxScheduleEntry array to 5. See: here and here

V2G2-784 and 786 both state that either side should support in minimum 12 entries, so this seems like an incorrect limitation in the codec.

jhart-cpi commented 5 months ago

I would note that libcbv2g corrects this issue here so once https://github.com/ChargePoint/wireshark-v2g/pull/62 is integrated this issue should be fixed.

jhart-cpi commented 5 months ago

Confirmed that the pending PR fixes this codec issue:

Screenshot_20240521_182415