Menu

Where the "/* START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}AC_EVChargeParameter) */ " come from?

BinWatson
2023-11-07
2023-11-08
  • BinWatson

    BinWatson - 2023-11-07

    Hi,

    In the function encode_iso1ExiDocument
    ```c
    int encode_iso1ExiDocument(bitstream_t stream, struct iso1EXIDocument exiDoc) {
    errn = writeEXIHeader(stream);

    if(errn == 0) {
        /* DocContent[START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}AC_EVChargeParameter), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}AC_EVSEChargeParameter), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}AC_EVSEStatus), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}AuthorizationReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}AuthorizationRes), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}BodyElement), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}CableCheckReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}CableCheckRes), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}CertificateInstallationReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}CertificateInstallationRes), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}CertificateUpdateReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}CertificateUpdateRes), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}ChargeParameterDiscoveryReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}ChargeParameterDiscoveryRes), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}ChargingStatusReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}ChargingStatusRes), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}CurrentDemandReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}CurrentDemandRes), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}DC_EVChargeParameter), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}DC_EVPowerDeliveryParameter), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}DC_EVSEChargeParameter), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}DC_EVSEStatus), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}DC_EVStatus), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DSAKeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestValue), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}EVChargeParameter), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}EVPowerDeliveryParameter), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}EVSEChargeParameter), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}EVStatus), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}Entry), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyInfo), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Manifest), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}MeteringReceiptReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}MeteringReceiptRes), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Object), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}PMaxScheduleEntry), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}PaymentDetailsReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}PaymentDetailsRes), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}PaymentServiceSelectionReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}PaymentServiceSelectionRes), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}PowerDeliveryReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}PowerDeliveryRes), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}PreChargeReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}PreChargeRes), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RSAKeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}RelativeTimeInterval), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RetrievalMethod), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}SAScheduleList), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}SASchedules), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}SalesTariffEntry), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}ServiceDetailReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}ServiceDetailRes), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}ServiceDiscoveryReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}ServiceDiscoveryRes), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}SessionSetupReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}SessionSetupRes), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}SessionStopReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}SessionStopRes), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Signature), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperties), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperty), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignedInfo), START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}TimeInterval), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transform), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), START_ELEMENT({urn:iso:15118:2:2013:MsgDef}V2G_Message), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}WeldingDetectionReq), START_ELEMENT({urn:iso:15118:2:2013:MsgBody}WeldingDetectionRes), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data), START_ELEMENT_GENERIC] */
        if ( exiDoc->AC_EVChargeParameter_isUsed == 1u ) { 
            /* START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}AC_EVChargeParameter) */
            errn = encodeNBitUnsignedInteger(stream, 7, 0);
            if(errn == 0) {
                errn = encode_iso1AC_EVChargeParameterType(stream, &exiDoc->AC_EVChargeParameter );
            }
        } else if ( exiDoc->AC_EVSEChargeParameter_isUsed == 1u ) { 
            /* START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}AC_EVSEChargeParameter) */
            errn = encodeNBitUnsignedInteger(stream, 7, 1);
            if(errn == 0) {
                errn = encode_iso1AC_EVSEChargeParameterType(stream, &exiDoc->AC_EVSEChargeParameter );
            }
        } else if ( exiDoc->AC_EVSEStatus_isUsed == 1u ) { 
            /* START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}AC_EVSEStatus) */
            errn = encodeNBitUnsignedInteger(stream, 7, 2);
            if(errn == 0) {
                errn = encode_iso1AC_EVSEStatusType(stream, &exiDoc->AC_EVSEStatus );
            }
        } else if ( exiDoc->AuthorizationReq_isUsed == 1u ) { 
            /* START_ELEMENT({urn:iso:15118:2:2013:MsgBody}AuthorizationReq) */
            errn = encodeNBitUnsignedInteger(stream, 7, 3);
            if(errn == 0) {
                errn = encode_iso1AuthorizationReqType(stream, &exiDoc->AuthorizationReq );
            }
        } else if ( exiDoc->AuthorizationRes_isUsed == 1u ) { 
            /* START_ELEMENT({urn:iso:15118:2:2013:MsgBody}AuthorizationRes) */
            errn = encodeNBitUnsignedInteger(stream, 7, 4);
            if(errn == 0) {
                errn = encode_iso1AuthorizationResType(stream, &exiDoc->AuthorizationRes );
            }
            /*....*/
    

    ```
    We can see that encodeNBitUnsignedInteger(stream, 7, 0). How I can get that information
    / START_ELEMENT({urn:iso:15118:2:2013:MsgDataTypes}AC_EVChargeParameter) / is equal 0?

     
  • BinWatson

    BinWatson - 2023-11-08

    Hi,
    I may have fix this issue from https://www.w3.org/TR/exi-primer/#encoding:

    Note that AT(category) is accepted before AT(date) even though their order is reversed in the schema. This is because attributes in schema-informed grammars must be sorted lexicographically, first by local name and then by namespace URI. Attribute sorting reduces the number of options which, in turn, greatly simplifies grammar creation and improves compactness. Since this automaton does not include transitions on AT() or SE(), any deviations from the schema will result in an encoding error

    Because the lexicographically order of AC_EVChargeParameter、AC_EVChargeParameter is AC_EVChargeParameter、AC_EVChargeParameter. So AC_EVChargeParameter is encode as "0", AC_EVChargeParameter is encode as "1". We have 79 START_ELEMENTs.The max START_ELEMENT 79, it's binary is 0100 1111,needing at least 7-bits to represent it. When bit-packed is effective, we can use just 7-bits to represent them.

     

    Last edit: BinWatson 2023-11-08
  • Daniel Peintner

    Daniel Peintner - 2023-11-08

    Hi,

    Correct, I think you "found" the answer.

    The data exchange uses the EXI [1] format. Since we use the schema-informed EXI mode you need to understand the way EXI grammars are created and work.

    Anyhow, the OpenV2G project is exactly about that. Using the C structs you do not need to understand the internals.

    -- Daniel

    [1] https://www.w3.org/TR/exi/

     

Log in to post a comment.