/*
 * Copyright (C) 2007-2018 Siemens AG
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

/*******************************************************************
 *
 * @author Daniel.Peintner.EXT@siemens.com
 * @version 0.9.4 
 * @contact Richard.Kuntschke@siemens.com
 *
 * <p>Code generated by EXIdizer</p>
 * <p>Schema: V2G_CI_MsgDef.xsd</p>
 *
 *
 ********************************************************************/




#include "iso2EXIDatatypesEncoder.h"

#include "EncoderChannel.h"
#include "EXIHeaderEncoder.h"

#include "iso2EXIDatatypes.h"
#include "ErrorCodes.h"

#ifndef EXI_iso2_DATATYPES_ENCODER_C
#define EXI_iso2_DATATYPES_ENCODER_C

#if DEPLOY_ISO2_CODEC == SUPPORT_YES

static int errn;

/* Forward Declarations */
static int encode_iso2RetrievalMethodType(bitstream_t* stream, struct iso2RetrievalMethodType* iso2RetrievalMethodType);
static int encode_iso2AuthorizationResType(bitstream_t* stream, struct iso2AuthorizationResType* iso2AuthorizationResType);
static int encode_iso2MV_EVSEFinePositioningSetupParametersType(bitstream_t* stream, struct iso2MV_EVSEFinePositioningSetupParametersType* iso2MV_EVSEFinePositioningSetupParametersType);
static int encode_iso2X509DataType(bitstream_t* stream, struct iso2X509DataType* iso2X509DataType);
static int encode_iso2RSAKeyValueType(bitstream_t* stream, struct iso2RSAKeyValueType* iso2RSAKeyValueType);
static int encode_iso2DC_BidirectionalControlResType(bitstream_t* stream, struct iso2DC_BidirectionalControlResType* iso2DC_BidirectionalControlResType);
static int encode_iso2CostType(bitstream_t* stream, struct iso2CostType* iso2CostType);
static int encode_iso2ChargingStatusResType(bitstream_t* stream, struct iso2ChargingStatusResType* iso2ChargingStatusResType);
static int encode_iso2MeterInfoType(bitstream_t* stream, struct iso2MeterInfoType* iso2MeterInfoType);
static int encode_iso2AC_EVChargeParameterType(bitstream_t* stream, struct iso2AC_EVChargeParameterType* iso2AC_EVChargeParameterType);
static int encode_iso2AC_EVSEBidirectionalParameterType(bitstream_t* stream, struct iso2AC_EVSEBidirectionalParameterType* iso2AC_EVSEBidirectionalParameterType);
static int encode_iso2VehicleCheckOutResType(bitstream_t* stream, struct iso2VehicleCheckOutResType* iso2VehicleCheckOutResType);
static int encode_iso2MagneticVectorListType(bitstream_t* stream, struct iso2MagneticVectorListType* iso2MagneticVectorListType);
static int encode_iso2CableCheckResType(bitstream_t* stream, struct iso2CableCheckResType* iso2CableCheckResType);
static int encode_iso2ServiceDiscoveryReqType(bitstream_t* stream, struct iso2ServiceDiscoveryReqType* iso2ServiceDiscoveryReqType);
static int encode_iso2ServiceType(bitstream_t* stream, struct iso2ServiceType* iso2ServiceType);
static int encode_iso2ServiceParameterListType(bitstream_t* stream, struct iso2ServiceParameterListType* iso2ServiceParameterListType);
static int encode_iso2PMaxScheduleType(bitstream_t* stream, struct iso2PMaxScheduleType* iso2PMaxScheduleType);
static int encode_iso2SignaturePropertiesType(bitstream_t* stream, struct iso2SignaturePropertiesType* iso2SignaturePropertiesType);
static int encode_iso2PMaxScheduleEntryType(bitstream_t* stream, struct iso2PMaxScheduleEntryType* iso2PMaxScheduleEntryType);
static int encode_iso2SignatureType(bitstream_t* stream, struct iso2SignatureType* iso2SignatureType);
static int encode_iso2VehicleCheckInReqType(bitstream_t* stream, struct iso2VehicleCheckInReqType* iso2VehicleCheckInReqType);
static int encode_iso2ConnectChargingDeviceResType(bitstream_t* stream, struct iso2ConnectChargingDeviceResType* iso2ConnectChargingDeviceResType);
static int encode_iso2WeldingDetectionResType(bitstream_t* stream, struct iso2WeldingDetectionResType* iso2WeldingDetectionResType);
static int encode_iso2SessionStopResType(bitstream_t* stream, struct iso2SessionStopResType* iso2SessionStopResType);
static int encode_iso2VehicleCheckInResType(bitstream_t* stream, struct iso2VehicleCheckInResType* iso2VehicleCheckInResType);
static int encode_iso2ServiceListType(bitstream_t* stream, struct iso2ServiceListType* iso2ServiceListType);
static int encode_iso2CertificateUpdateResType(bitstream_t* stream, struct iso2CertificateUpdateResType* iso2CertificateUpdateResType);
static int encode_iso2FinePositioningSetupResType(bitstream_t* stream, struct iso2FinePositioningSetupResType* iso2FinePositioningSetupResType);
static int encode_iso2AC_EVBidirectionalParameterType(bitstream_t* stream, struct iso2AC_EVBidirectionalParameterType* iso2AC_EVBidirectionalParameterType);
static int encode_iso2DC_BidirectionalControlReqType(bitstream_t* stream, struct iso2DC_BidirectionalControlReqType* iso2DC_BidirectionalControlReqType);
static int encode_iso2CertificateUpdateReqType(bitstream_t* stream, struct iso2CertificateUpdateReqType* iso2CertificateUpdateReqType);
static int encode_iso2ConsumptionCostType(bitstream_t* stream, struct iso2ConsumptionCostType* iso2ConsumptionCostType);
static int encode_iso2SAScheduleListType(bitstream_t* stream, struct iso2SAScheduleListType* iso2SAScheduleListType);
static int encode_iso2MagneticVectorSetupType(bitstream_t* stream, struct iso2MagneticVectorSetupType* iso2MagneticVectorSetupType);
static int encode_iso2LFA_EVSEFinePositioningSetupParametersType(bitstream_t* stream, struct iso2LFA_EVSEFinePositioningSetupParametersType* iso2LFA_EVSEFinePositioningSetupParametersType);
static int encode_iso2PaymentOptionListType(bitstream_t* stream, struct iso2PaymentOptionListType* iso2PaymentOptionListType);
static int encode_iso2LFA_EVSEFinePositioningParametersType(bitstream_t* stream, struct iso2LFA_EVSEFinePositioningParametersType* iso2LFA_EVSEFinePositioningParametersType);
static int encode_iso2RelativeTimeIntervalType(bitstream_t* stream, struct iso2RelativeTimeIntervalType* iso2RelativeTimeIntervalType);
static int encode_iso2EVFinePositioningParametersType(bitstream_t* stream, struct iso2EVFinePositioningParametersType* iso2EVFinePositioningParametersType);
static int encode_iso2AlignmentCheckReqType(bitstream_t* stream, struct iso2AlignmentCheckReqType* iso2AlignmentCheckReqType);
static int encode_iso2CertificateInstallationReqType(bitstream_t* stream, struct iso2CertificateInstallationReqType* iso2CertificateInstallationReqType);
static int encode_iso2TransformsType(bitstream_t* stream, struct iso2TransformsType* iso2TransformsType);
static int encode_iso2ObjectType(bitstream_t* stream, struct iso2ObjectType* iso2ObjectType);
static int encode_iso2SensorOrderListType(bitstream_t* stream, struct iso2SensorOrderListType* iso2SensorOrderListType);
static int encode_iso2ChargeParameterDiscoveryReqType(bitstream_t* stream, struct iso2ChargeParameterDiscoveryReqType* iso2ChargeParameterDiscoveryReqType);
static int encode_iso2ParameterType(bitstream_t* stream, struct iso2ParameterType* iso2ParameterType);
static int encode_iso2SessionStopReqType(bitstream_t* stream, struct iso2SessionStopReqType* iso2SessionStopReqType);
static int encode_iso2SensorMeasurementsType(bitstream_t* stream, struct iso2SensorMeasurementsType* iso2SensorMeasurementsType);
static int encode_iso2DC_EVSEChargeParameterType(bitstream_t* stream, struct iso2DC_EVSEChargeParameterType* iso2DC_EVSEChargeParameterType);
static int encode_iso2SensorPackageListType(bitstream_t* stream, struct iso2SensorPackageListType* iso2SensorPackageListType);
static int encode_iso2MeasurementDataListType(bitstream_t* stream, struct iso2MeasurementDataListType* iso2MeasurementDataListType);
static int encode_iso2CertificateChainType(bitstream_t* stream, struct iso2CertificateChainType* iso2CertificateChainType);
static int encode_iso2SignaturePropertyType(bitstream_t* stream, struct iso2SignaturePropertyType* iso2SignaturePropertyType);
static int encode_iso2TransformType(bitstream_t* stream, struct iso2TransformType* iso2TransformType);
static int encode_iso2EMAIDType(bitstream_t* stream, struct iso2EMAIDType* iso2EMAIDType);
static int encode_iso2DSAKeyValueType(bitstream_t* stream, struct iso2DSAKeyValueType* iso2DSAKeyValueType);
static int encode_iso2EntryType(bitstream_t* stream, struct iso2EntryType* iso2EntryType);
static int encode_iso2MessageHeaderType(bitstream_t* stream, struct iso2MessageHeaderType* iso2MessageHeaderType);
static int encode_iso2WPT_EVChargeParameterType(bitstream_t* stream, struct iso2WPT_EVChargeParameterType* iso2WPT_EVChargeParameterType);
static int encode_iso2DisconnectChargingDeviceReqType(bitstream_t* stream, struct iso2DisconnectChargingDeviceReqType* iso2DisconnectChargingDeviceReqType);
static int encode_iso2ChargeLoopReqType(bitstream_t* stream, struct iso2ChargeLoopReqType* iso2ChargeLoopReqType);
static int encode_iso2V2GRequestType(bitstream_t* stream, struct iso2V2GRequestType* iso2V2GRequestType);
static int encode_iso2MeteringReceiptResType(bitstream_t* stream, struct iso2MeteringReceiptResType* iso2MeteringReceiptResType);
static int encode_iso2SessionSetupResType(bitstream_t* stream, struct iso2SessionSetupResType* iso2SessionSetupResType);
static int encode_iso2AC_BidirectionalControlReqType(bitstream_t* stream, struct iso2AC_BidirectionalControlReqType* iso2AC_BidirectionalControlReqType);
static int encode_iso2MV_EVSEFinePositioningParametersType(bitstream_t* stream, struct iso2MV_EVSEFinePositioningParametersType* iso2MV_EVSEFinePositioningParametersType);
static int encode_iso2ReferenceType(bitstream_t* stream, struct iso2ReferenceType* iso2ReferenceType);
static int encode_iso2EVSEEnergyTransferParameterType(bitstream_t* stream, struct iso2EVSEEnergyTransferParameterType* iso2EVSEEnergyTransferParameterType);
static int encode_iso2MeteringReceiptReqType(bitstream_t* stream, struct iso2MeteringReceiptReqType* iso2MeteringReceiptReqType);
static int encode_iso2KeyValueType(bitstream_t* stream, struct iso2KeyValueType* iso2KeyValueType);
static int encode_iso2SensorListType(bitstream_t* stream, struct iso2SensorListType* iso2SensorListType);
static int encode_iso2CurrentDemandReqType(bitstream_t* stream, struct iso2CurrentDemandReqType* iso2CurrentDemandReqType);
static int encode_iso2FinePositioningSetupReqType(bitstream_t* stream, struct iso2FinePositioningSetupReqType* iso2FinePositioningSetupReqType);
static int encode_iso2LFA_EVFinePositioningSetupParametersType(bitstream_t* stream, struct iso2LFA_EVFinePositioningSetupParametersType* iso2LFA_EVFinePositioningSetupParametersType);
static int encode_iso2SAScheduleTupleType(bitstream_t* stream, struct iso2SAScheduleTupleType* iso2SAScheduleTupleType);
static int encode_iso2WPT_EVSEChargeParameterType(bitstream_t* stream, struct iso2WPT_EVSEChargeParameterType* iso2WPT_EVSEChargeParameterType);
static int encode_iso2FinePositioningResType(bitstream_t* stream, struct iso2FinePositioningResType* iso2FinePositioningResType);
static int encode_iso2BodyBaseType(bitstream_t* stream, struct iso2BodyBaseType* iso2BodyBaseType);
static int encode_iso2ServiceDetailResType(bitstream_t* stream, struct iso2ServiceDetailResType* iso2ServiceDetailResType);
static int encode_iso2PowerDeliveryReqType(bitstream_t* stream, struct iso2PowerDeliveryReqType* iso2PowerDeliveryReqType);
static int encode_iso2PairingResType(bitstream_t* stream, struct iso2PairingResType* iso2PairingResType);
static int encode_iso2AuthorizationReqType(bitstream_t* stream, struct iso2AuthorizationReqType* iso2AuthorizationReqType);
static int encode_iso2ParameterSetType(bitstream_t* stream, struct iso2ParameterSetType* iso2ParameterSetType);
static int encode_iso2SPKIDataType(bitstream_t* stream, struct iso2SPKIDataType* iso2SPKIDataType);
static int encode_iso2PaymentDetailsResType(bitstream_t* stream, struct iso2PaymentDetailsResType* iso2PaymentDetailsResType);
static int encode_iso2SignatureMethodType(bitstream_t* stream, struct iso2SignatureMethodType* iso2SignatureMethodType);
static int encode_iso2AC_BidirectionalControlResType(bitstream_t* stream, struct iso2AC_BidirectionalControlResType* iso2AC_BidirectionalControlResType);
static int encode_iso2VehicleCheckOutReqType(bitstream_t* stream, struct iso2VehicleCheckOutReqType* iso2VehicleCheckOutReqType);
static int encode_iso2WeldingDetectionReqType(bitstream_t* stream, struct iso2WeldingDetectionReqType* iso2WeldingDetectionReqType);
static int encode_iso2AlignmentCheckResType(bitstream_t* stream, struct iso2AlignmentCheckResType* iso2AlignmentCheckResType);
static int encode_iso2PowerDemandReqType(bitstream_t* stream, struct iso2PowerDemandReqType* iso2PowerDemandReqType);
static int encode_iso2MinimumPMaxRequestType(bitstream_t* stream, struct iso2MinimumPMaxRequestType* iso2MinimumPMaxRequestType);
static int encode_iso2DisconnectChargingDeviceResType(bitstream_t* stream, struct iso2DisconnectChargingDeviceResType* iso2DisconnectChargingDeviceResType);
static int encode_iso2SessionSetupReqType(bitstream_t* stream, struct iso2SessionSetupReqType* iso2SessionSetupReqType);
static int encode_iso2PaymentDetailsReqType(bitstream_t* stream, struct iso2PaymentDetailsReqType* iso2PaymentDetailsReqType);
static int encode_iso2Generic_EVFinePositioningParametersType(bitstream_t* stream, struct iso2Generic_EVFinePositioningParametersType* iso2Generic_EVFinePositioningParametersType);
static int encode_iso2ConnectChargingDeviceReqType(bitstream_t* stream, struct iso2ConnectChargingDeviceReqType* iso2ConnectChargingDeviceReqType);
static int encode_iso2AC_EVSEChargeParameterType(bitstream_t* stream, struct iso2AC_EVSEChargeParameterType* iso2AC_EVSEChargeParameterType);
static int encode_iso2SalesTariffEntryType(bitstream_t* stream, struct iso2SalesTariffEntryType* iso2SalesTariffEntryType);
static int encode_iso2DC_EVSEBidirectionalParameterType(bitstream_t* stream, struct iso2DC_EVSEBidirectionalParameterType* iso2DC_EVSEBidirectionalParameterType);
static int encode_iso2CanonicalizationMethodType(bitstream_t* stream, struct iso2CanonicalizationMethodType* iso2CanonicalizationMethodType);
static int encode_iso2DisplayParametersType(bitstream_t* stream, struct iso2DisplayParametersType* iso2DisplayParametersType);
static int encode_iso2DC_EVBidirectionalParameterType(bitstream_t* stream, struct iso2DC_EVBidirectionalParameterType* iso2DC_EVBidirectionalParameterType);
static int encode_iso2PaymentServiceSelectionReqType(bitstream_t* stream, struct iso2PaymentServiceSelectionReqType* iso2PaymentServiceSelectionReqType);
static int encode_iso2MagneticVectorType(bitstream_t* stream, struct iso2MagneticVectorType* iso2MagneticVectorType);
static int encode_iso2PhysicalValueType(bitstream_t* stream, struct iso2PhysicalValueType* iso2PhysicalValueType);
static int encode_iso2SystemStatusReqType(bitstream_t* stream, struct iso2SystemStatusReqType* iso2SystemStatusReqType);
static int encode_iso2SystemStatusResType(bitstream_t* stream, struct iso2SystemStatusResType* iso2SystemStatusResType);
static int encode_iso2EVSEFinePositioningSetupParametersType(bitstream_t* stream, struct iso2EVSEFinePositioningSetupParametersType* iso2EVSEFinePositioningSetupParametersType);
static int encode_iso2V2GResponseType(bitstream_t* stream, struct iso2V2GResponseType* iso2V2GResponseType);
static int encode_iso2BodyType(bitstream_t* stream, struct iso2BodyType* iso2BodyType);
static int encode_iso2PreChargeResType(bitstream_t* stream, struct iso2PreChargeResType* iso2PreChargeResType);
static int encode_iso2EVSEFinePositioningParametersType(bitstream_t* stream, struct iso2EVSEFinePositioningParametersType* iso2EVSEFinePositioningParametersType);
static int encode_iso2PaymentServiceSelectionResType(bitstream_t* stream, struct iso2PaymentServiceSelectionResType* iso2PaymentServiceSelectionResType);
static int encode_iso2DigestMethodType(bitstream_t* stream, struct iso2DigestMethodType* iso2DigestMethodType);
static int encode_iso2TargetPositionType(bitstream_t* stream, struct iso2TargetPositionType* iso2TargetPositionType);
static int encode_iso2LFA_EVFinePositioningParametersType(bitstream_t* stream, struct iso2LFA_EVFinePositioningParametersType* iso2LFA_EVFinePositioningParametersType);
static int encode_iso2DC_EVChargeParameterType(bitstream_t* stream, struct iso2DC_EVChargeParameterType* iso2DC_EVChargeParameterType);
static int encode_iso2ServiceDetailReqType(bitstream_t* stream, struct iso2ServiceDetailReqType* iso2ServiceDetailReqType);
static int encode_iso2PreChargeReqType(bitstream_t* stream, struct iso2PreChargeReqType* iso2PreChargeReqType);
static int encode_iso2ManifestType(bitstream_t* stream, struct iso2ManifestType* iso2ManifestType);
static int encode_iso2AnonType_V2G_Message(bitstream_t* stream, struct iso2AnonType_V2G_Message* iso2AnonType_V2G_Message);
static int encode_iso2SelectedServiceListType(bitstream_t* stream, struct iso2SelectedServiceListType* iso2SelectedServiceListType);
static int encode_iso2Generic_EVSEFinePositioningParametersType(bitstream_t* stream, struct iso2Generic_EVSEFinePositioningParametersType* iso2Generic_EVSEFinePositioningParametersType);
static int encode_iso2CartesianCoordinatesType(bitstream_t* stream, struct iso2CartesianCoordinatesType* iso2CartesianCoordinatesType);
static int encode_iso2KeyInfoType(bitstream_t* stream, struct iso2KeyInfoType* iso2KeyInfoType);
static int encode_iso2SubCertificatesType(bitstream_t* stream, struct iso2SubCertificatesType* iso2SubCertificatesType);
static int encode_iso2ListOfRootCertificateIDsType(bitstream_t* stream, struct iso2ListOfRootCertificateIDsType* iso2ListOfRootCertificateIDsType);
static int encode_iso2EVEnergyTransferParameterType(bitstream_t* stream, struct iso2EVEnergyTransferParameterType* iso2EVEnergyTransferParameterType);
static int encode_iso2ContractSignatureEncryptedPrivateKeyType(bitstream_t* stream, struct iso2ContractSignatureEncryptedPrivateKeyType* iso2ContractSignatureEncryptedPrivateKeyType);
static int encode_iso2MagneticVectorSetupListType(bitstream_t* stream, struct iso2MagneticVectorSetupListType* iso2MagneticVectorSetupListType);
static int encode_iso2PairingReqType(bitstream_t* stream, struct iso2PairingReqType* iso2PairingReqType);
static int encode_iso2CurrentDemandResType(bitstream_t* stream, struct iso2CurrentDemandResType* iso2CurrentDemandResType);
static int encode_iso2X509IssuerSerialType(bitstream_t* stream, struct iso2X509IssuerSerialType* iso2X509IssuerSerialType);
static int encode_iso2ChargingStatusReqType(bitstream_t* stream, struct iso2ChargingStatusReqType* iso2ChargingStatusReqType);
static int encode_iso2CertificateInstallationResType(bitstream_t* stream, struct iso2CertificateInstallationResType* iso2CertificateInstallationResType);
static int encode_iso2SensorPackageType(bitstream_t* stream, struct iso2SensorPackageType* iso2SensorPackageType);
static int encode_iso2PGPDataType(bitstream_t* stream, struct iso2PGPDataType* iso2PGPDataType);
static int encode_iso2ServiceDiscoveryResType(bitstream_t* stream, struct iso2ServiceDiscoveryResType* iso2ServiceDiscoveryResType);
static int encode_iso2ServiceIDListType(bitstream_t* stream, struct iso2ServiceIDListType* iso2ServiceIDListType);
static int encode_iso2EVFinePositioningSetupParametersType(bitstream_t* stream, struct iso2EVFinePositioningSetupParametersType* iso2EVFinePositioningSetupParametersType);
static int encode_iso2ChargeParameterDiscoveryResType(bitstream_t* stream, struct iso2ChargeParameterDiscoveryResType* iso2ChargeParameterDiscoveryResType);
static int encode_iso2PowerDemandResType(bitstream_t* stream, struct iso2PowerDemandResType* iso2PowerDemandResType);
static int encode_iso2ChargingProfileType(bitstream_t* stream, struct iso2ChargingProfileType* iso2ChargingProfileType);
static int encode_iso2FinePositioningReqType(bitstream_t* stream, struct iso2FinePositioningReqType* iso2FinePositioningReqType);
static int encode_iso2SalesTariffType(bitstream_t* stream, struct iso2SalesTariffType* iso2SalesTariffType);
static int encode_iso2SensorType(bitstream_t* stream, struct iso2SensorType* iso2SensorType);
static int encode_iso2SignatureValueType(bitstream_t* stream, struct iso2SignatureValueType* iso2SignatureValueType);
static int encode_iso2SignedInfoType(bitstream_t* stream, struct iso2SignedInfoType* iso2SignedInfoType);
static int encode_iso2PowerDeliveryResType(bitstream_t* stream, struct iso2PowerDeliveryResType* iso2PowerDeliveryResType);
static int encode_iso2CableCheckReqType(bitstream_t* stream, struct iso2CableCheckReqType* iso2CableCheckReqType);
static int encode_iso2SelectedServiceType(bitstream_t* stream, struct iso2SelectedServiceType* iso2SelectedServiceType);
static int encode_iso2DiffieHellmanPublickeyType(bitstream_t* stream, struct iso2DiffieHellmanPublickeyType* iso2DiffieHellmanPublickeyType);
static int encode_iso2EVSEStatusType(bitstream_t* stream, struct iso2EVSEStatusType* iso2EVSEStatusType);



/* Complex type name='http://www.w3.org/2000/09/xmldsig#,RetrievalMethodType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transforms{0-1})',  derivedBy='RESTRICTION'.  */
static int encode_iso2RetrievalMethodType(bitstream_t* stream, struct iso2RetrievalMethodType* iso2RetrievalMethodType) {
	int grammarID = 0;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 0:
			/* FirstStartTag[ATTRIBUTE[STRING](Type), ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), END_ELEMENT] */
			if ( iso2RetrievalMethodType->Type_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2RetrievalMethodType->Type.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2RetrievalMethodType->Type.characters, iso2RetrievalMethodType->Type.charactersLen);
					}
				}
				grammarID = 1;
			} else 			if ( iso2RetrievalMethodType->URI_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2RetrievalMethodType->URI.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2RetrievalMethodType->URI.characters, iso2RetrievalMethodType->URI.charactersLen);
					}
				}
				grammarID = 2;
			} else 			if ( iso2RetrievalMethodType->Transforms_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2TransformsType(stream, &iso2RetrievalMethodType->Transforms );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1:
			/* StartTag[ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), END_ELEMENT] */
			if ( iso2RetrievalMethodType->URI_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2RetrievalMethodType->URI.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2RetrievalMethodType->URI.characters, iso2RetrievalMethodType->URI.charactersLen);
					}
				}
				grammarID = 2;
			} else 			if ( iso2RetrievalMethodType->Transforms_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2TransformsType(stream, &iso2RetrievalMethodType->Transforms );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2:
			/* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), END_ELEMENT] */
			if ( iso2RetrievalMethodType->Transforms_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2TransformsType(stream, &iso2RetrievalMethodType->Transforms );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,AuthorizationResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing))',  derivedBy='EXTENSION'.  */
static int encode_iso2AuthorizationResType(bitstream_t* stream, struct iso2AuthorizationResType* iso2AuthorizationResType) {
	int grammarID = 5;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 5:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2AuthorizationResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 6;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 6:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( iso2AuthorizationResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2AuthorizationResType->EVSEStatus );
				}
				grammarID = 7;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2AuthorizationResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 7:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2AuthorizationResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MV_EVSEFinePositioningSetupParametersType',  base type name='EVSEFinePositioningSetupParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":FrequencyChannel{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MagneticVectorSetupList{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2MV_EVSEFinePositioningSetupParametersType(bitstream_t* stream, struct iso2MV_EVSEFinePositioningSetupParametersType* iso2MV_EVSEFinePositioningSetupParametersType) {
	int grammarID = 8;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 8:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}FrequencyChannel), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetupList), END_ELEMENT] */
			if ( iso2MV_EVSEFinePositioningSetupParametersType->FrequencyChannel_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger32(stream, iso2MV_EVSEFinePositioningSetupParametersType->FrequencyChannel);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 9;
			} else 			if ( iso2MV_EVSEFinePositioningSetupParametersType->MagneticVectorSetupList_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupListType(stream, &iso2MV_EVSEFinePositioningSetupParametersType->MagneticVectorSetupList );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 9:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetupList), END_ELEMENT] */
			if ( iso2MV_EVSEFinePositioningSetupParametersType->MagneticVectorSetupList_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupListType(stream, &iso2MV_EVSEFinePositioningSetupParametersType->MagneticVectorSetupList );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,X509DataType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("http://www.w3.org/2000/09/xmldsig#":X509IssuerSerial|"http://www.w3.org/2000/09/xmldsig#":X509SKI|"http://www.w3.org/2000/09/xmldsig#":X509SubjectName|"http://www.w3.org/2000/09/xmldsig#":X509Certificate|"http://www.w3.org/2000/09/xmldsig#":X509CRL|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]))){1-UNBOUNDED}',  derivedBy='RESTRICTION'.  */
static int encode_iso2X509DataType(bitstream_t* stream, struct iso2X509DataType* iso2X509DataType) {
	int grammarID = 10;
	int done = 0;
	int wcDone = 0;
	
	unsigned int iso2X509DataType_X509IssuerSerial_currArrayIndex = 0;
	unsigned int iso2X509DataType_X509SKI_currArrayIndex = 0;
	unsigned int iso2X509DataType_X509SubjectName_currArrayIndex = 0;
	unsigned int iso2X509DataType_X509Certificate_currArrayIndex = 0;
	unsigned int iso2X509DataType_X509CRL_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 10:
			/* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerSerial), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL), START_ELEMENT_GENERIC] */
			if (iso2X509DataType_X509IssuerSerial_currArrayIndex < iso2X509DataType->X509IssuerSerial.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2X509DataType->X509IssuerSerial.array [iso2X509DataType_X509IssuerSerial_currArrayIndex++]);
				}
				grammarID = 11;
			} else 			if (iso2X509DataType_X509SKI_currArrayIndex < iso2X509DataType->X509SKI.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2X509DataType->X509SKI.array[iso2X509DataType_X509SKI_currArrayIndex].bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2X509DataType->X509SKI.array[iso2X509DataType_X509SKI_currArrayIndex].bytes, iso2X509DataType->X509SKI.array[iso2X509DataType_X509SKI_currArrayIndex].bytesLen);
							iso2X509DataType_X509SKI_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 11;
			} else 			if (iso2X509DataType_X509SubjectName_currArrayIndex < iso2X509DataType->X509SubjectName.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2X509DataType->X509SubjectName.array[iso2X509DataType_X509SubjectName_currArrayIndex].charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2X509DataType->X509SubjectName.array[iso2X509DataType_X509SubjectName_currArrayIndex].characters, iso2X509DataType->X509SubjectName.array[iso2X509DataType_X509SubjectName_currArrayIndex].charactersLen);
							iso2X509DataType_X509SubjectName_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 11;
			} else 			if (iso2X509DataType_X509Certificate_currArrayIndex < iso2X509DataType->X509Certificate.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2X509DataType->X509Certificate.array[iso2X509DataType_X509Certificate_currArrayIndex].bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2X509DataType->X509Certificate.array[iso2X509DataType_X509Certificate_currArrayIndex].bytes, iso2X509DataType->X509Certificate.array[iso2X509DataType_X509Certificate_currArrayIndex].bytesLen);
							iso2X509DataType_X509Certificate_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 11;
			} else 			if (iso2X509DataType_X509CRL_currArrayIndex < iso2X509DataType->X509CRL.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2X509DataType->X509CRL.array[iso2X509DataType_X509CRL_currArrayIndex].bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2X509DataType->X509CRL.array[iso2X509DataType_X509CRL_currArrayIndex].bytes, iso2X509DataType->X509CRL.array[iso2X509DataType_X509CRL_currArrayIndex].bytesLen);
							iso2X509DataType_X509CRL_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 11;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 11;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 11:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerSerial), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL), START_ELEMENT_GENERIC, END_ELEMENT] */
			if (iso2X509DataType_X509IssuerSerial_currArrayIndex < iso2X509DataType->X509IssuerSerial.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2X509DataType->X509IssuerSerial.array [iso2X509DataType_X509IssuerSerial_currArrayIndex++]);
				}
				grammarID = 11;
			} else 			if (iso2X509DataType_X509SKI_currArrayIndex < iso2X509DataType->X509SKI.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2X509DataType->X509SKI.array[iso2X509DataType_X509SKI_currArrayIndex].bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2X509DataType->X509SKI.array[iso2X509DataType_X509SKI_currArrayIndex].bytes, iso2X509DataType->X509SKI.array[iso2X509DataType_X509SKI_currArrayIndex].bytesLen);
							iso2X509DataType_X509SKI_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 11;
			} else 			if (iso2X509DataType_X509SubjectName_currArrayIndex < iso2X509DataType->X509SubjectName.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2X509DataType->X509SubjectName.array[iso2X509DataType_X509SubjectName_currArrayIndex].charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2X509DataType->X509SubjectName.array[iso2X509DataType_X509SubjectName_currArrayIndex].characters, iso2X509DataType->X509SubjectName.array[iso2X509DataType_X509SubjectName_currArrayIndex].charactersLen);
							iso2X509DataType_X509SubjectName_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 11;
			} else 			if (iso2X509DataType_X509Certificate_currArrayIndex < iso2X509DataType->X509Certificate.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2X509DataType->X509Certificate.array[iso2X509DataType_X509Certificate_currArrayIndex].bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2X509DataType->X509Certificate.array[iso2X509DataType_X509Certificate_currArrayIndex].bytes, iso2X509DataType->X509Certificate.array[iso2X509DataType_X509Certificate_currArrayIndex].bytesLen);
							iso2X509DataType_X509Certificate_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 11;
			} else 			if (iso2X509DataType_X509CRL_currArrayIndex < iso2X509DataType->X509CRL.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2X509DataType->X509CRL.array[iso2X509DataType_X509CRL_currArrayIndex].bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2X509DataType->X509CRL.array[iso2X509DataType_X509CRL_currArrayIndex].bytes, iso2X509DataType->X509CRL.array[iso2X509DataType_X509CRL_currArrayIndex].bytesLen);
							iso2X509DataType_X509CRL_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 11;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 11;
			} else 			if ( iso2X509DataType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 6);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,RSAKeyValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Modulus,"http://www.w3.org/2000/09/xmldsig#":Exponent)',  derivedBy='RESTRICTION'.  */
static int encode_iso2RSAKeyValueType(bitstream_t* stream, struct iso2RSAKeyValueType* iso2RSAKeyValueType) {
	int grammarID = 12;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 12:
			/* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Modulus)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2RSAKeyValueType->Modulus.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2RSAKeyValueType->Modulus.bytes, iso2RSAKeyValueType->Modulus.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 13;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 13:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Exponent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2RSAKeyValueType->Exponent.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2RSAKeyValueType->Exponent.bytes, iso2RSAKeyValueType->Exponent.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,DC_BidirectionalControlResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEPresentCurrent,"urn:iso:15118:2:2016:MsgBody":EVSEPresentVoltage,"urn:iso:15118:2:2016:MsgBody":EVSEPowerLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSECurrentLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSEVoltageLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSEMaximumChargePower{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumDischargePower{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumChargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumDischargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumVoltage{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMinimumVoltage{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2016:MsgBody":ReceiptRequired{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2DC_BidirectionalControlResType(bitstream_t* stream, struct iso2DC_BidirectionalControlResType* iso2DC_BidirectionalControlResType) {
	int grammarID = 14;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 14:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2DC_BidirectionalControlResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 15;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 15:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPresentCurrent)] */
			if ( iso2DC_BidirectionalControlResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2DC_BidirectionalControlResType->EVSEStatus );
				}
				grammarID = 16;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEPresentCurrent );
				}
				grammarID = 17;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 16:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPresentCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEPresentCurrent );
				}
				grammarID = 17;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 17:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPresentVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEPresentVoltage );
				}
				grammarID = 18;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 18:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPowerLimitAchieved)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DC_BidirectionalControlResType->EVSEPowerLimitAchieved);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 19;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 19:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSECurrentLimitAchieved)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DC_BidirectionalControlResType->EVSECurrentLimitAchieved);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 20;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 20:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEVoltageLimitAchieved)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DC_BidirectionalControlResType->EVSEVoltageLimitAchieved);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 21;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 21:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumChargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumDischargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMinimumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( iso2DC_BidirectionalControlResType->EVSEMaximumChargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMaximumChargePower );
				}
				grammarID = 22;
			} else 			if ( iso2DC_BidirectionalControlResType->EVSEMaximumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMaximumDischargePower );
				}
				grammarID = 23;
			} else 			if ( iso2DC_BidirectionalControlResType->EVSEMaximumChargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMaximumChargeCurrent );
				}
				grammarID = 24;
			} else 			if ( iso2DC_BidirectionalControlResType->EVSEMaximumDischargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMaximumDischargeCurrent );
				}
				grammarID = 25;
			} else 			if ( iso2DC_BidirectionalControlResType->EVSEMaximumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMaximumVoltage );
				}
				grammarID = 26;
			} else 			if ( iso2DC_BidirectionalControlResType->EVSEMinimumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMinimumVoltage );
				}
				grammarID = 27;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 6);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DC_BidirectionalControlResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2DC_BidirectionalControlResType->EVSEID.characters, iso2DC_BidirectionalControlResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 28;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 22:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumChargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumDischargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMinimumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( iso2DC_BidirectionalControlResType->EVSEMaximumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMaximumDischargePower );
				}
				grammarID = 23;
			} else 			if ( iso2DC_BidirectionalControlResType->EVSEMaximumChargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMaximumChargeCurrent );
				}
				grammarID = 24;
			} else 			if ( iso2DC_BidirectionalControlResType->EVSEMaximumDischargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMaximumDischargeCurrent );
				}
				grammarID = 25;
			} else 			if ( iso2DC_BidirectionalControlResType->EVSEMaximumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMaximumVoltage );
				}
				grammarID = 26;
			} else 			if ( iso2DC_BidirectionalControlResType->EVSEMinimumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMinimumVoltage );
				}
				grammarID = 27;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DC_BidirectionalControlResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2DC_BidirectionalControlResType->EVSEID.characters, iso2DC_BidirectionalControlResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 28;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 23:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumChargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumDischargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMinimumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( iso2DC_BidirectionalControlResType->EVSEMaximumChargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMaximumChargeCurrent );
				}
				grammarID = 24;
			} else 			if ( iso2DC_BidirectionalControlResType->EVSEMaximumDischargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMaximumDischargeCurrent );
				}
				grammarID = 25;
			} else 			if ( iso2DC_BidirectionalControlResType->EVSEMaximumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMaximumVoltage );
				}
				grammarID = 26;
			} else 			if ( iso2DC_BidirectionalControlResType->EVSEMinimumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMinimumVoltage );
				}
				grammarID = 27;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DC_BidirectionalControlResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2DC_BidirectionalControlResType->EVSEID.characters, iso2DC_BidirectionalControlResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 28;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 24:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumDischargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMinimumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( iso2DC_BidirectionalControlResType->EVSEMaximumDischargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMaximumDischargeCurrent );
				}
				grammarID = 25;
			} else 			if ( iso2DC_BidirectionalControlResType->EVSEMaximumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMaximumVoltage );
				}
				grammarID = 26;
			} else 			if ( iso2DC_BidirectionalControlResType->EVSEMinimumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMinimumVoltage );
				}
				grammarID = 27;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DC_BidirectionalControlResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2DC_BidirectionalControlResType->EVSEID.characters, iso2DC_BidirectionalControlResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 28;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 25:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMinimumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( iso2DC_BidirectionalControlResType->EVSEMaximumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMaximumVoltage );
				}
				grammarID = 26;
			} else 			if ( iso2DC_BidirectionalControlResType->EVSEMinimumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMinimumVoltage );
				}
				grammarID = 27;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DC_BidirectionalControlResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2DC_BidirectionalControlResType->EVSEID.characters, iso2DC_BidirectionalControlResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 28;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 26:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMinimumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( iso2DC_BidirectionalControlResType->EVSEMinimumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlResType->EVSEMinimumVoltage );
				}
				grammarID = 27;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DC_BidirectionalControlResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2DC_BidirectionalControlResType->EVSEID.characters, iso2DC_BidirectionalControlResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 28;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 27:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DC_BidirectionalControlResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2DC_BidirectionalControlResType->EVSEID.characters, iso2DC_BidirectionalControlResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 28;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 28:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAScheduleTupleID), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeterInfo), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired), END_ELEMENT] */
			if ( iso2DC_BidirectionalControlResType->SAScheduleTupleID_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2DC_BidirectionalControlResType->SAScheduleTupleID - 1));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 29;
			} else 			if ( iso2DC_BidirectionalControlResType->MeterInfo_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2MeterInfoType(stream, &iso2DC_BidirectionalControlResType->MeterInfo );
				}
				grammarID = 30;
			} else 			if ( iso2DC_BidirectionalControlResType->ReceiptRequired_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DC_BidirectionalControlResType->ReceiptRequired);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 29:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeterInfo), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired), END_ELEMENT] */
			if ( iso2DC_BidirectionalControlResType->MeterInfo_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MeterInfoType(stream, &iso2DC_BidirectionalControlResType->MeterInfo );
				}
				grammarID = 30;
			} else 			if ( iso2DC_BidirectionalControlResType->ReceiptRequired_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DC_BidirectionalControlResType->ReceiptRequired);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 30:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired), END_ELEMENT] */
			if ( iso2DC_BidirectionalControlResType->ReceiptRequired_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DC_BidirectionalControlResType->ReceiptRequired);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,CostType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":costKind,"urn:iso:15118:2:2016:MsgDataTypes":amount)',  derivedBy='RESTRICTION'.  */
static int encode_iso2CostType(bitstream_t* stream, struct iso2CostType* iso2CostType) {
	int grammarID = 31;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 31:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}costKind)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2CostType->costKind);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 32;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 32:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}amount)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CostType->amount );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,ChargingStatusResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2016:MsgBody":ReceiptRequired{0-1},"urn:iso:15118:2:2016:MsgBody":EVSETargetPower{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2ChargingStatusResType(bitstream_t* stream, struct iso2ChargingStatusResType* iso2ChargingStatusResType) {
	int grammarID = 33;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 33:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2ChargingStatusResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 34;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 34:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( iso2ChargingStatusResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2ChargingStatusResType->EVSEStatus );
				}
				grammarID = 35;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ChargingStatusResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2ChargingStatusResType->EVSEID.characters, iso2ChargingStatusResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 36;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 35:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ChargingStatusResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2ChargingStatusResType->EVSEID.characters, iso2ChargingStatusResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 36;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 36:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAScheduleTupleID), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeterInfo), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSETargetPower), END_ELEMENT] */
			if ( iso2ChargingStatusResType->SAScheduleTupleID_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2ChargingStatusResType->SAScheduleTupleID - 1));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 37;
			} else 			if ( iso2ChargingStatusResType->MeterInfo_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2MeterInfoType(stream, &iso2ChargingStatusResType->MeterInfo );
				}
				grammarID = 38;
			} else 			if ( iso2ChargingStatusResType->ReceiptRequired_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2ChargingStatusResType->ReceiptRequired);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 39;
			} else 			if ( iso2ChargingStatusResType->EVSETargetPower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusResType->EVSETargetPower );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 37:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeterInfo), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSETargetPower), END_ELEMENT] */
			if ( iso2ChargingStatusResType->MeterInfo_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2MeterInfoType(stream, &iso2ChargingStatusResType->MeterInfo );
				}
				grammarID = 38;
			} else 			if ( iso2ChargingStatusResType->ReceiptRequired_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2ChargingStatusResType->ReceiptRequired);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 39;
			} else 			if ( iso2ChargingStatusResType->EVSETargetPower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusResType->EVSETargetPower );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 38:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSETargetPower), END_ELEMENT] */
			if ( iso2ChargingStatusResType->ReceiptRequired_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2ChargingStatusResType->ReceiptRequired);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 39;
			} else 			if ( iso2ChargingStatusResType->EVSETargetPower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusResType->EVSETargetPower );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 39:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSETargetPower), END_ELEMENT] */
			if ( iso2ChargingStatusResType->EVSETargetPower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusResType->EVSETargetPower );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MeterInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MeterID,"urn:iso:15118:2:2016:MsgDataTypes":MeterReadingCharged{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MeterReadingDischarged{0-1},"urn:iso:15118:2:2016:MsgDataTypes":SigMeterReading{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MeterStatus{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TMeter{0-1})',  derivedBy='RESTRICTION'.  */
static int encode_iso2MeterInfoType(bitstream_t* stream, struct iso2MeterInfoType* iso2MeterInfoType) {
	int grammarID = 40;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 40:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeterID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2MeterInfoType->MeterID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2MeterInfoType->MeterID.characters, iso2MeterInfoType->MeterID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 41;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 41:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeterReadingCharged), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeterReadingDischarged), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SigMeterReading), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeterStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TMeter), END_ELEMENT] */
			if ( iso2MeterInfoType->MeterReadingCharged_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger64(stream, iso2MeterInfoType->MeterReadingCharged);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 42;
			} else 			if ( iso2MeterInfoType->MeterReadingDischarged_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger64(stream, iso2MeterInfoType->MeterReadingDischarged);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 43;
			} else 			if ( iso2MeterInfoType->SigMeterReading_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2MeterInfoType->SigMeterReading.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2MeterInfoType->SigMeterReading.bytes, iso2MeterInfoType->SigMeterReading.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 44;
			} else 			if ( iso2MeterInfoType->MeterStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger16(stream, iso2MeterInfoType->MeterStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 45;
			} else 			if ( iso2MeterInfoType->TMeter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger64(stream, iso2MeterInfoType->TMeter);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 42:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeterReadingDischarged), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SigMeterReading), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeterStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TMeter), END_ELEMENT] */
			if ( iso2MeterInfoType->MeterReadingDischarged_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger64(stream, iso2MeterInfoType->MeterReadingDischarged);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 43;
			} else 			if ( iso2MeterInfoType->SigMeterReading_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2MeterInfoType->SigMeterReading.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2MeterInfoType->SigMeterReading.bytes, iso2MeterInfoType->SigMeterReading.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 44;
			} else 			if ( iso2MeterInfoType->MeterStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger16(stream, iso2MeterInfoType->MeterStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 45;
			} else 			if ( iso2MeterInfoType->TMeter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger64(stream, iso2MeterInfoType->TMeter);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 43:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SigMeterReading), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeterStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TMeter), END_ELEMENT] */
			if ( iso2MeterInfoType->SigMeterReading_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2MeterInfoType->SigMeterReading.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2MeterInfoType->SigMeterReading.bytes, iso2MeterInfoType->SigMeterReading.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 44;
			} else 			if ( iso2MeterInfoType->MeterStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger16(stream, iso2MeterInfoType->MeterStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 45;
			} else 			if ( iso2MeterInfoType->TMeter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger64(stream, iso2MeterInfoType->TMeter);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 44:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeterStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TMeter), END_ELEMENT] */
			if ( iso2MeterInfoType->MeterStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger16(stream, iso2MeterInfoType->MeterStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 45;
			} else 			if ( iso2MeterInfoType->TMeter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger64(stream, iso2MeterInfoType->TMeter);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 45:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TMeter), END_ELEMENT] */
			if ( iso2MeterInfoType->TMeter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger64(stream, iso2MeterInfoType->TMeter);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,AC_EVChargeParameterType',  base type name='EVEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumVoltage))',  derivedBy='EXTENSION'.  */
static int encode_iso2AC_EVChargeParameterType(bitstream_t* stream, struct iso2AC_EVChargeParameterType* iso2AC_EVChargeParameterType) {
	int grammarID = 46;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 46:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DepartureTime)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger32(stream, iso2AC_EVChargeParameterType->DepartureTime);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 47;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 47:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumChargePower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVChargeParameterType->EVMaximumChargePower );
				}
				grammarID = 48;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 48:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVChargeParameterType->EVMaximumChargeCurrent );
				}
				grammarID = 49;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 49:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVChargeParameterType->EVMinimumChargeCurrent );
				}
				grammarID = 50;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 50:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVTargetEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumVoltage)] */
			if ( iso2AC_EVChargeParameterType->EVTargetEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVChargeParameterType->EVTargetEnergyRequest );
				}
				grammarID = 51;
			} else 			if ( iso2AC_EVChargeParameterType->EVMaximumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVChargeParameterType->EVMaximumEnergyRequest );
				}
				grammarID = 52;
			} else 			if ( iso2AC_EVChargeParameterType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVChargeParameterType->EVMinimumEnergyRequest );
				}
				grammarID = 53;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVChargeParameterType->EVMaximumVoltage );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 51:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumVoltage)] */
			if ( iso2AC_EVChargeParameterType->EVMaximumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVChargeParameterType->EVMaximumEnergyRequest );
				}
				grammarID = 52;
			} else 			if ( iso2AC_EVChargeParameterType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVChargeParameterType->EVMinimumEnergyRequest );
				}
				grammarID = 53;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVChargeParameterType->EVMaximumVoltage );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 52:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumVoltage)] */
			if ( iso2AC_EVChargeParameterType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVChargeParameterType->EVMinimumEnergyRequest );
				}
				grammarID = 53;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVChargeParameterType->EVMaximumVoltage );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 53:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVChargeParameterType->EVMaximumVoltage );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,AC_EVSEBidirectionalParameterType',  base type name='AC_EVSEChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSENominalVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSENominalFrequency),("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumDischargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSENominalFrequency))',  derivedBy='EXTENSION'.  */
static int encode_iso2AC_EVSEBidirectionalParameterType(bitstream_t* stream, struct iso2AC_EVSEBidirectionalParameterType* iso2AC_EVSEBidirectionalParameterType) {
	int grammarID = 54;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 54:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVSEBidirectionalParameterType->EVSEMaximumChargeCurrent );
				}
				grammarID = 55;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 55:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSENominalVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVSEBidirectionalParameterType->EVSENominalVoltage );
				}
				grammarID = 56;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 56:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSENominalFrequency)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVSEBidirectionalParameterType->EVSENominalFrequency );
				}
				grammarID = 57;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 57:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumDischargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVSEBidirectionalParameterType->EVSEMaximumDischargeCurrent );
				}
				grammarID = 58;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 58:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSENominalFrequency)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVSEBidirectionalParameterType->EVSENominalFrequency );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,VehicleCheckOutResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSECheckOutStatus))',  derivedBy='EXTENSION'.  */
static int encode_iso2VehicleCheckOutResType(bitstream_t* stream, struct iso2VehicleCheckOutResType* iso2VehicleCheckOutResType) {
	int grammarID = 59;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 59:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2VehicleCheckOutResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 60;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 60:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSECheckOutStatus)] */
			if ( iso2VehicleCheckOutResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2VehicleCheckOutResType->EVSEStatus );
				}
				grammarID = 61;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2VehicleCheckOutResType->EVSECheckOutStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 61:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSECheckOutStatus)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2VehicleCheckOutResType->EVSECheckOutStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MagneticVectorListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MagneticVector{1-255})',  derivedBy='RESTRICTION'.  */
static int encode_iso2MagneticVectorListType(bitstream_t* stream, struct iso2MagneticVectorListType* iso2MagneticVectorListType) {
	int grammarID = 62;
	int done = 0;
	
	unsigned int iso2MagneticVectorListType_MagneticVector_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 62:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector)] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 63;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 63:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 64;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 64:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 65;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 65:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 66;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 66:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 67;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 67:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 68;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 68:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 69;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 69:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 70;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 70:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 71;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 71:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 72;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 72:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 73;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 73:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 74;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 74:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 75;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 75:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 76;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 76:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 77;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 77:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 78;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 78:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 79;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 79:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 80;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 80:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 81;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 81:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 82;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 82:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 83;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 83:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 84;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 84:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 85;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 85:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 86;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 86:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 87;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 87:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 88;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 88:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 89;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 89:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 90;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 90:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 91;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 91:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 92;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 92:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 93;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 93:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 94;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 94:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 95;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 95:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 96;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 96:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 97;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 97:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 98;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 98:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 99;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 99:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 100;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 100:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 101;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 101:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 102;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 102:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 103;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 103:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 104;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 104:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 105;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 105:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 106;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 106:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 107;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 107:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 108;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 108:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 109;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 109:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 110;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 110:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 111;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 111:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 112;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 112:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 113;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 113:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 114;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 114:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 115;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 115:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 116;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 116:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 117;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 117:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 118;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 118:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 119;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 119:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 120;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 120:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 121;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 121:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 122;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 122:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 123;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 123:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 124;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 124:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 125;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 125:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 126;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 126:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 127;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 127:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 128;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 128:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 129;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 129:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 130;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 130:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 131;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 131:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 132;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 132:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 133;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 133:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 134;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 134:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 135;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 135:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 136;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 136:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 137;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 137:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 138;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 138:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 139;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 139:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 140;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 140:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 141;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 141:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 142;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 142:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 143;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 143:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 144;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 144:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 145;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 145:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 146;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 146:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 147;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 147:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 148;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 148:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 149;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 149:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 150;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 150:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 151;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 151:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 152;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 152:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 153;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 153:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 154;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 154:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 155;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 155:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 156;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 156:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 157;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 157:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 158;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 158:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 159;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 159:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 160;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 160:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 161;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 161:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 162;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 162:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 163;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 163:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 164;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 164:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 165;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 165:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 166;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 166:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 167;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 167:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 168;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 168:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 169;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 169:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 170;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 170:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 171;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 171:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 172;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 172:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 173;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 173:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 174;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 174:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 175;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 175:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 176;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 176:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 177;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 177:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 178;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 178:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 179;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 179:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 180;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 180:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 181;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 181:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 182;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 182:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 183;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 183:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 184;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 184:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 185;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 185:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 186;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 186:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 187;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 187:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 188;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 188:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 189;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 189:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 190;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 190:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 191;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 191:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 192;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 192:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 193;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 193:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 194;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 194:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 195;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 195:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 196;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 196:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 197;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 197:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 198;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 198:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 199;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 199:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 200;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 200:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 201;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 201:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 202;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 202:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 203;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 203:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 204;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 204:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 205;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 205:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 206;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 206:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 207;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 207:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 208;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 208:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 209;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 209:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 210;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 210:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 211;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 211:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 212;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 212:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 213;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 213:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 214;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 214:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 215;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 215:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 216;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 216:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 217;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 217:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 218;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 218:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 219;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 219:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 220;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 220:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 221;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 221:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 222;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 222:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 223;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 223:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 224;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 224:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 225;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 225:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 226;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 226:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 227;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 227:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 228;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 228:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 229;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 229:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 230;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 230:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 231;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 231:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 232;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 232:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 233;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 233:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 234;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 234:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 235;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 235:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 236;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 236:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 237;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 237:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 238;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 238:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 239;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 239:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 240;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 240:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 241;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 241:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 242;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 242:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 243;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 243:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 244;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 244:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 245;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 245:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 246;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 246:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 247;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 247:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 248;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 248:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 249;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 249:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 250;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 250:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 251;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 251:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 252;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 252:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 253;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 253:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 254;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 254:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 255;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 255:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 256;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 256:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 257;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 257:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 258;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 258:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 259;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 259:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 260;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 260:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 261;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 261:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 262;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 262:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 263;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 263:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 264;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 264:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 265;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 265:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 266;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 266:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 267;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 267:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 268;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 268:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 269;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 269:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 270;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 270:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 271;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 271:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 272;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 272:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 273;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 273:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 274;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 274:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 275;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 275:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 276;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 276:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 277;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 277:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 278;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 278:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 279;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 279:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 280;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 280:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 281;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 281:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 282;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 282:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 283;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 283:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 284;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 284:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 285;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 285:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 286;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 286:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 287;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 287:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 288;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 288:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 289;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 289:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 290;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 290:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 291;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 291:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 292;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 292:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 293;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 293:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 294;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 294:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 295;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 295:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 296;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 296:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 297;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 297:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 298;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 298:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 299;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 299:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 300;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 300:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 301;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 301:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 302;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 302:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 303;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 303:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 304;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 304:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 305;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 305:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 306;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 306:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 307;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 307:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 308;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 308:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 309;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 309:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 310;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 310:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 311;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 311:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 312;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 312:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 313;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 313:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 314;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 314:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 315;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 315:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 316;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 316:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), END_ELEMENT] */
			if (iso2MagneticVectorListType_MagneticVector_currArrayIndex < iso2MagneticVectorListType->MagneticVector.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorType(stream, &iso2MagneticVectorListType->MagneticVector.array [iso2MagneticVectorListType_MagneticVector_currArrayIndex++]);
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,CableCheckResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing))',  derivedBy='EXTENSION'.  */
static int encode_iso2CableCheckResType(bitstream_t* stream, struct iso2CableCheckResType* iso2CableCheckResType) {
	int grammarID = 5;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 5:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2CableCheckResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 6;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 6:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( iso2CableCheckResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2CableCheckResType->EVSEStatus );
				}
				grammarID = 7;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2CableCheckResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 7:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2CableCheckResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,ServiceDiscoveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":SupportedServiceIDs{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2ServiceDiscoveryReqType(bitstream_t* stream, struct iso2ServiceDiscoveryReqType* iso2ServiceDiscoveryReqType) {
	int grammarID = 317;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 317:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SupportedServiceIDs), END_ELEMENT] */
			if ( iso2ServiceDiscoveryReqType->SupportedServiceIDs_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ServiceIDListType(stream, &iso2ServiceDiscoveryReqType->SupportedServiceIDs );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ServiceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ServiceID,"urn:iso:15118:2:2016:MsgDataTypes":FreeService)',  derivedBy='RESTRICTION'.  */
static int encode_iso2ServiceType(bitstream_t* stream, struct iso2ServiceType* iso2ServiceType) {
	int grammarID = 318;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 318:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ServiceID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2ServiceType->ServiceID);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 319;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 319:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}FreeService)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2ServiceType->FreeService);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ServiceParameterListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ParameterSet{1-255})',  derivedBy='RESTRICTION'.  */
static int encode_iso2ServiceParameterListType(bitstream_t* stream, struct iso2ServiceParameterListType* iso2ServiceParameterListType) {
	int grammarID = 320;
	int done = 0;
	
	unsigned int iso2ServiceParameterListType_ParameterSet_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 320:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet)] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 321;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 321:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 322;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 322:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 323;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 323:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 324;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 324:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 325;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 325:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 326;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 326:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 327;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 327:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 328;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 328:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 329;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 329:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 330;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 330:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 331;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 331:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 332;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 332:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 333;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 333:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 334;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 334:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 335;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 335:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 336;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 336:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 337;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 337:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 338;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 338:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 339;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 339:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 340;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 340:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 341;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 341:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 342;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 342:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 343;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 343:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 344;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 344:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 345;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 345:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 346;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 346:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 347;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 347:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 348;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 348:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 349;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 349:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 350;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 350:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 351;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 351:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 352;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 352:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 353;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 353:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 354;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 354:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 355;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 355:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 356;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 356:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 357;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 357:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 358;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 358:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 359;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 359:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 360;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 360:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 361;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 361:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 362;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 362:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 363;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 363:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 364;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 364:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 365;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 365:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 366;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 366:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 367;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 367:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 368;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 368:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 369;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 369:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 370;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 370:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 371;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 371:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 372;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 372:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 373;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 373:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 374;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 374:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 375;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 375:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 376;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 376:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 377;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 377:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 378;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 378:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 379;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 379:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 380;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 380:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 381;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 381:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 382;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 382:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 383;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 383:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 384;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 384:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 385;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 385:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 386;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 386:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 387;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 387:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 388;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 388:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 389;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 389:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 390;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 390:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 391;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 391:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 392;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 392:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 393;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 393:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 394;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 394:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 395;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 395:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 396;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 396:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 397;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 397:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 398;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 398:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 399;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 399:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 400;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 400:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 401;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 401:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 402;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 402:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 403;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 403:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 404;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 404:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 405;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 405:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 406;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 406:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 407;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 407:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 408;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 408:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 409;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 409:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 410;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 410:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 411;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 411:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 412;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 412:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 413;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 413:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 414;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 414:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 415;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 415:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 416;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 416:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 417;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 417:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 418;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 418:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 419;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 419:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 420;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 420:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 421;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 421:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 422;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 422:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 423;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 423:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 424;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 424:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 425;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 425:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 426;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 426:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 427;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 427:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 428;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 428:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 429;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 429:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 430;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 430:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 431;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 431:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 432;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 432:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 433;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 433:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 434;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 434:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 435;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 435:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 436;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 436:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 437;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 437:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 438;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 438:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 439;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 439:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 440;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 440:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 441;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 441:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 442;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 442:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 443;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 443:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 444;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 444:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 445;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 445:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 446;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 446:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 447;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 447:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 448;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 448:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 449;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 449:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 450;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 450:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 451;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 451:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 452;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 452:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 453;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 453:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 454;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 454:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 455;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 455:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 456;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 456:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 457;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 457:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 458;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 458:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 459;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 459:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 460;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 460:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 461;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 461:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 462;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 462:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 463;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 463:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 464;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 464:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 465;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 465:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 466;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 466:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 467;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 467:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 468;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 468:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 469;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 469:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 470;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 470:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 471;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 471:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 472;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 472:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 473;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 473:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 474;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 474:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 475;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 475:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 476;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 476:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 477;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 477:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 478;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 478:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 479;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 479:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 480;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 480:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 481;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 481:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 482;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 482:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 483;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 483:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 484;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 484:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 485;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 485:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 486;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 486:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 487;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 487:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 488;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 488:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 489;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 489:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 490;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 490:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 491;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 491:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 492;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 492:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 493;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 493:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 494;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 494:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 495;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 495:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 496;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 496:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 497;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 497:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 498;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 498:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 499;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 499:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 500;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 500:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 501;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 501:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 502;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 502:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 503;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 503:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 504;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 504:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 505;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 505:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 506;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 506:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 507;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 507:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 508;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 508:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 509;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 509:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 510;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 510:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 511;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 511:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 512;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 512:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 513;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 513:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 514;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 514:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 515;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 515:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 516;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 516:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 517;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 517:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 518;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 518:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 519;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 519:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 520;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 520:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 521;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 521:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 522;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 522:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 523;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 523:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 524;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 524:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 525;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 525:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 526;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 526:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 527;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 527:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 528;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 528:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 529;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 529:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 530;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 530:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 531;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 531:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 532;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 532:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 533;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 533:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 534;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 534:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 535;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 535:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 536;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 536:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 537;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 537:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 538;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 538:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 539;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 539:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 540;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 540:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 541;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 541:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 542;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 542:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 543;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 543:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 544;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 544:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 545;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 545:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 546;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 546:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 547;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 547:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 548;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 548:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 549;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 549:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 550;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 550:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 551;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 551:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 552;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 552:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 553;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 553:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 554;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 554:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 555;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 555:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 556;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 556:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 557;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 557:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 558;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 558:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 559;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 559:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 560;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 560:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 561;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 561:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 562;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 562:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 563;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 563:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 564;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 564:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 565;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 565:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 566;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 566:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 567;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 567:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 568;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 568:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 569;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 569:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 570;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 570:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 571;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 571:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 572;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 572:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 573;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 573:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 574;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 574:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), END_ELEMENT] */
			if (iso2ServiceParameterListType_ParameterSet_currArrayIndex < iso2ServiceParameterListType->ParameterSet.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2ServiceParameterListType->ParameterSet.array [iso2ServiceParameterListType_ParameterSet_currArrayIndex++]);
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PMaxScheduleType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":PMaxScheduleEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
static int encode_iso2PMaxScheduleType(bitstream_t* stream, struct iso2PMaxScheduleType* iso2PMaxScheduleType) {
	int grammarID = 575;
	int done = 0;
	
	unsigned int iso2PMaxScheduleType_PMaxScheduleEntry_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 575:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PMaxScheduleEntry)] */
			if (iso2PMaxScheduleType_PMaxScheduleEntry_currArrayIndex < iso2PMaxScheduleType->PMaxScheduleEntry.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PMaxScheduleEntryType(stream, &iso2PMaxScheduleType->PMaxScheduleEntry.array [iso2PMaxScheduleType_PMaxScheduleEntry_currArrayIndex++]);
				}
				grammarID = 576;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 576:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PMaxScheduleEntry), END_ELEMENT] */
			if (iso2PMaxScheduleType_PMaxScheduleEntry_currArrayIndex < iso2PMaxScheduleType->PMaxScheduleEntry.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PMaxScheduleEntryType(stream, &iso2PMaxScheduleType->PMaxScheduleEntry.array [iso2PMaxScheduleType_PMaxScheduleEntry_currArrayIndex++]);
				}
				grammarID = 576;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertiesType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":SignatureProperty{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
static int encode_iso2SignaturePropertiesType(bitstream_t* stream, struct iso2SignaturePropertiesType* iso2SignaturePropertiesType) {
	int grammarID = 577;
	int done = 0;
	
	unsigned int iso2SignaturePropertiesType_SignatureProperty_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 577:
			/* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperty)] */
			if ( iso2SignaturePropertiesType->Id_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SignaturePropertiesType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2SignaturePropertiesType->Id.characters, iso2SignaturePropertiesType->Id.charactersLen);
					}
				}
				grammarID = 578;
			} else 			if (iso2SignaturePropertiesType_SignatureProperty_currArrayIndex < iso2SignaturePropertiesType->SignatureProperty.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2SignaturePropertyType(stream, &iso2SignaturePropertiesType->SignatureProperty.array [iso2SignaturePropertiesType_SignatureProperty_currArrayIndex++]);
				}
				grammarID = 579;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 578:
			/* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperty)] */
			if (iso2SignaturePropertiesType_SignatureProperty_currArrayIndex < iso2SignaturePropertiesType->SignatureProperty.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SignaturePropertyType(stream, &iso2SignaturePropertiesType->SignatureProperty.array [iso2SignaturePropertiesType_SignatureProperty_currArrayIndex++]);
				}
				grammarID = 579;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 579:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperty), END_ELEMENT] */
			if (iso2SignaturePropertiesType_SignatureProperty_currArrayIndex < iso2SignaturePropertiesType->SignatureProperty.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SignaturePropertyType(stream, &iso2SignaturePropertiesType->SignatureProperty.array [iso2SignaturePropertiesType_SignatureProperty_currArrayIndex++]);
				}
				grammarID = 579;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PMaxScheduleEntryType',  base type name='EntryType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":RelativeTimeInterval),("urn:iso:15118:2:2016:MsgDataTypes":PMax{1-3}))',  derivedBy='EXTENSION'.  */
static int encode_iso2PMaxScheduleEntryType(bitstream_t* stream, struct iso2PMaxScheduleEntryType* iso2PMaxScheduleEntryType) {
	int grammarID = 580;
	int done = 0;
	
	unsigned int iso2PMaxScheduleEntryType_PMax_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 580:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RelativeTimeInterval)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2RelativeTimeIntervalType(stream, &iso2PMaxScheduleEntryType->RelativeTimeInterval );
				}
				grammarID = 581;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 581:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PMax)] */
			if (iso2PMaxScheduleEntryType_PMax_currArrayIndex < iso2PMaxScheduleEntryType->PMax.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PMaxScheduleEntryType->PMax.array [iso2PMaxScheduleEntryType_PMax_currArrayIndex++]);
				}
				grammarID = 582;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 582:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PMax), END_ELEMENT] */
			if (iso2PMaxScheduleEntryType_PMax_currArrayIndex < iso2PMaxScheduleEntryType->PMax.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PMaxScheduleEntryType->PMax.array [iso2PMaxScheduleEntryType_PMax_currArrayIndex++]);
				}
				grammarID = 583;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 583:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PMax), END_ELEMENT] */
			if (iso2PMaxScheduleEntryType_PMax_currArrayIndex < iso2PMaxScheduleEntryType->PMax.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PMaxScheduleEntryType->PMax.array [iso2PMaxScheduleEntryType_PMax_currArrayIndex++]);
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":SignedInfo,"http://www.w3.org/2000/09/xmldsig#":SignatureValue,"http://www.w3.org/2000/09/xmldsig#":KeyInfo{0-1},"http://www.w3.org/2000/09/xmldsig#":Object{0-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
static int encode_iso2SignatureType(bitstream_t* stream, struct iso2SignatureType* iso2SignatureType) {
	int grammarID = 584;
	int done = 0;
	
	unsigned int iso2SignatureType_Object_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 584:
			/* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignedInfo)] */
			if ( iso2SignatureType->Id_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SignatureType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2SignatureType->Id.characters, iso2SignatureType->Id.charactersLen);
					}
				}
				grammarID = 585;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2SignedInfoType(stream, &iso2SignatureType->SignedInfo );
				}
				grammarID = 586;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 585:
			/* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignedInfo)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SignedInfoType(stream, &iso2SignatureType->SignedInfo );
				}
				grammarID = 586;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 586:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureValue)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SignatureValueType(stream, &iso2SignatureType->SignatureValue );
				}
				grammarID = 587;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 587:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyInfo), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Object), END_ELEMENT] */
			if ( iso2SignatureType->KeyInfo_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2KeyInfoType(stream, &iso2SignatureType->KeyInfo );
				}
				grammarID = 588;
			} else 			if (iso2SignatureType_Object_currArrayIndex < iso2SignatureType->Object.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2ObjectType(stream, &iso2SignatureType->Object.array [iso2SignatureType_Object_currArrayIndex++]);
				}
				grammarID = 588;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 588:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Object), END_ELEMENT] */
			if (iso2SignatureType_Object_currArrayIndex < iso2SignatureType->Object.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ObjectType(stream, &iso2SignatureType->Object.array [iso2SignatureType_Object_currArrayIndex++]);
				}
				grammarID = 588;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,VehicleCheckInReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVCheckInStatus,"urn:iso:15118:2:2016:MsgBody":ParkingMethod{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2VehicleCheckInReqType(bitstream_t* stream, struct iso2VehicleCheckInReqType* iso2VehicleCheckInReqType) {
	int grammarID = 589;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 589:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVCheckInStatus)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2VehicleCheckInReqType->EVCheckInStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 590;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 590:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ParkingMethod), END_ELEMENT] */
			if ( iso2VehicleCheckInReqType->ParkingMethod_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2VehicleCheckInReqType->ParkingMethod);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,ConnectChargingDeviceResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":EVSEElectricalChargingDeviceStatus,"urn:iso:15118:2:2016:MsgBody":EVSEMechanicalChargingDeviceStatus))',  derivedBy='EXTENSION'.  */
static int encode_iso2ConnectChargingDeviceResType(bitstream_t* stream, struct iso2ConnectChargingDeviceResType* iso2ConnectChargingDeviceResType) {
	int grammarID = 591;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 591:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2ConnectChargingDeviceResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 592;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 592:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( iso2ConnectChargingDeviceResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2ConnectChargingDeviceResType->EVSEStatus );
				}
				grammarID = 593;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2ConnectChargingDeviceResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 594;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 593:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2ConnectChargingDeviceResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 594;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 594:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEElectricalChargingDeviceStatus)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2ConnectChargingDeviceResType->EVSEElectricalChargingDeviceStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 595;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 595:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMechanicalChargingDeviceStatus)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2ConnectChargingDeviceResType->EVSEMechanicalChargingDeviceStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,WeldingDetectionResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEPresentVoltage))',  derivedBy='EXTENSION'.  */
static int encode_iso2WeldingDetectionResType(bitstream_t* stream, struct iso2WeldingDetectionResType* iso2WeldingDetectionResType) {
	int grammarID = 596;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 596:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2WeldingDetectionResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 597;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 597:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPresentVoltage)] */
			if ( iso2WeldingDetectionResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2WeldingDetectionResType->EVSEStatus );
				}
				grammarID = 598;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2WeldingDetectionResType->EVSEPresentVoltage );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 598:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPresentVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2WeldingDetectionResType->EVSEPresentVoltage );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,SessionStopResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2SessionStopResType(bitstream_t* stream, struct iso2SessionStopResType* iso2SessionStopResType) {
	int grammarID = 599;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 599:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2SessionStopResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 600;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 600:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), END_ELEMENT] */
			if ( iso2SessionStopResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2SessionStopResType->EVSEStatus );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,VehicleCheckInResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":VehicleSpace,"urn:iso:15118:2:2016:MsgBody":TargetOffset{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2VehicleCheckInResType(bitstream_t* stream, struct iso2VehicleCheckInResType* iso2VehicleCheckInResType) {
	int grammarID = 601;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 601:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2VehicleCheckInResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 602;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 602:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleSpace)] */
			if ( iso2VehicleCheckInResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2VehicleCheckInResType->EVSEStatus );
				}
				grammarID = 603;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2VehicleCheckInResType->VehicleSpace);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 604;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 603:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleSpace)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2VehicleCheckInResType->VehicleSpace);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 604;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 604:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}TargetOffset), END_ELEMENT] */
			if ( iso2VehicleCheckInResType->TargetOffset_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2TargetPositionType(stream, &iso2VehicleCheckInResType->TargetOffset );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ServiceListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Service{1-8})',  derivedBy='RESTRICTION'.  */
static int encode_iso2ServiceListType(bitstream_t* stream, struct iso2ServiceListType* iso2ServiceListType) {
	int grammarID = 605;
	int done = 0;
	
	unsigned int iso2ServiceListType_Service_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 605:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Service)] */
			if (iso2ServiceListType_Service_currArrayIndex < iso2ServiceListType->Service.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2ServiceType(stream, &iso2ServiceListType->Service.array [iso2ServiceListType_Service_currArrayIndex++]);
				}
				grammarID = 606;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 606:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Service), END_ELEMENT] */
			if (iso2ServiceListType_Service_currArrayIndex < iso2ServiceListType->Service.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ServiceType(stream, &iso2ServiceListType->Service.array [iso2ServiceListType_Service_currArrayIndex++]);
				}
				grammarID = 607;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 607:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Service), END_ELEMENT] */
			if (iso2ServiceListType_Service_currArrayIndex < iso2ServiceListType->Service.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ServiceType(stream, &iso2ServiceListType->Service.array [iso2ServiceListType_Service_currArrayIndex++]);
				}
				grammarID = 608;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 608:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Service), END_ELEMENT] */
			if (iso2ServiceListType_Service_currArrayIndex < iso2ServiceListType->Service.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ServiceType(stream, &iso2ServiceListType->Service.array [iso2ServiceListType_Service_currArrayIndex++]);
				}
				grammarID = 609;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 609:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Service), END_ELEMENT] */
			if (iso2ServiceListType_Service_currArrayIndex < iso2ServiceListType->Service.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ServiceType(stream, &iso2ServiceListType->Service.array [iso2ServiceListType_Service_currArrayIndex++]);
				}
				grammarID = 610;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 610:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Service), END_ELEMENT] */
			if (iso2ServiceListType_Service_currArrayIndex < iso2ServiceListType->Service.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ServiceType(stream, &iso2ServiceListType->Service.array [iso2ServiceListType_Service_currArrayIndex++]);
				}
				grammarID = 611;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 611:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Service), END_ELEMENT] */
			if (iso2ServiceListType_Service_currArrayIndex < iso2ServiceListType->Service.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ServiceType(stream, &iso2ServiceListType->Service.array [iso2ServiceListType_Service_currArrayIndex++]);
				}
				grammarID = 612;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 612:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Service), END_ELEMENT] */
			if (iso2ServiceListType_Service_currArrayIndex < iso2ServiceListType->Service.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ServiceType(stream, &iso2ServiceListType->Service.array [iso2ServiceListType_Service_currArrayIndex++]);
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,CertificateUpdateResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":SAProvisioningCertificateChain,"urn:iso:15118:2:2016:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2016:MsgBody":ContractSignatureEncryptedPrivateKey,"urn:iso:15118:2:2016:MsgBody":DHpublickey,"urn:iso:15118:2:2016:MsgBody":eMAID,"urn:iso:15118:2:2016:MsgBody":RetryCounter{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2CertificateUpdateResType(bitstream_t* stream, struct iso2CertificateUpdateResType* iso2CertificateUpdateResType) {
	int grammarID = 613;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 613:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2CertificateUpdateResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 614;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 614:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAProvisioningCertificateChain)] */
			if ( iso2CertificateUpdateResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2CertificateUpdateResType->EVSEStatus );
				}
				grammarID = 615;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2CertificateChainType(stream, &iso2CertificateUpdateResType->SAProvisioningCertificateChain );
				}
				grammarID = 616;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 615:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAProvisioningCertificateChain)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2CertificateChainType(stream, &iso2CertificateUpdateResType->SAProvisioningCertificateChain );
				}
				grammarID = 616;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 616:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ContractSignatureCertChain)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2CertificateChainType(stream, &iso2CertificateUpdateResType->ContractSignatureCertChain );
				}
				grammarID = 617;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 617:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ContractSignatureEncryptedPrivateKey)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2ContractSignatureEncryptedPrivateKeyType(stream, &iso2CertificateUpdateResType->ContractSignatureEncryptedPrivateKey );
				}
				grammarID = 618;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 618:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DHpublickey)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2DiffieHellmanPublickeyType(stream, &iso2CertificateUpdateResType->DHpublickey );
				}
				grammarID = 619;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 619:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}eMAID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2EMAIDType(stream, &iso2CertificateUpdateResType->eMAID );
				}
				grammarID = 620;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 620:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}RetryCounter), END_ELEMENT] */
			if ( iso2CertificateUpdateResType->RetryCounter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger16(stream, iso2CertificateUpdateResType->RetryCounter);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,FinePositioningSetupResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgDataTypes":EVSEFinePositioningSetupParameters{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2FinePositioningSetupResType(bitstream_t* stream, struct iso2FinePositioningSetupResType* iso2FinePositioningSetupResType) {
	int grammarID = 621;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 621:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2FinePositioningSetupResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 622;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 622:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEFinePositioningSetupParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVSEFinePositioningSetupParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MV_EVSEFinePositioningSetupParameters), END_ELEMENT] */
			if ( iso2FinePositioningSetupResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2FinePositioningSetupResType->EVSEStatus );
				}
				grammarID = 623;
			} else 			if ( iso2FinePositioningSetupResType->EVSEFinePositioningSetupParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2EVSEFinePositioningSetupParametersType(stream, &iso2FinePositioningSetupResType->EVSEFinePositioningSetupParameters );
				}
				grammarID = 3;
			} else 			if ( iso2FinePositioningSetupResType->LFA_EVSEFinePositioningSetupParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2LFA_EVSEFinePositioningSetupParametersType(stream, &iso2FinePositioningSetupResType->LFA_EVSEFinePositioningSetupParameters );
				}
				grammarID = 3;
			} else 			if ( iso2FinePositioningSetupResType->MV_EVSEFinePositioningSetupParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2MV_EVSEFinePositioningSetupParametersType(stream, &iso2FinePositioningSetupResType->MV_EVSEFinePositioningSetupParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 623:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEFinePositioningSetupParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVSEFinePositioningSetupParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MV_EVSEFinePositioningSetupParameters), END_ELEMENT] */
			if ( iso2FinePositioningSetupResType->EVSEFinePositioningSetupParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEFinePositioningSetupParametersType(stream, &iso2FinePositioningSetupResType->EVSEFinePositioningSetupParameters );
				}
				grammarID = 3;
			} else 			if ( iso2FinePositioningSetupResType->LFA_EVSEFinePositioningSetupParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2LFA_EVSEFinePositioningSetupParametersType(stream, &iso2FinePositioningSetupResType->LFA_EVSEFinePositioningSetupParameters );
				}
				grammarID = 3;
			} else 			if ( iso2FinePositioningSetupResType->MV_EVSEFinePositioningSetupParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2MV_EVSEFinePositioningSetupParametersType(stream, &iso2FinePositioningSetupResType->MV_EVSEFinePositioningSetupParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,AC_EVBidirectionalParameterType',  base type name='AC_EVChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='((("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumVoltage)),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumDischargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumDischargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumDischargeCurrent))',  derivedBy='EXTENSION'.  */
static int encode_iso2AC_EVBidirectionalParameterType(bitstream_t* stream, struct iso2AC_EVBidirectionalParameterType* iso2AC_EVBidirectionalParameterType) {
	int grammarID = 624;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 624:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DepartureTime)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger32(stream, iso2AC_EVBidirectionalParameterType->DepartureTime);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 625;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 625:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumChargePower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVBidirectionalParameterType->EVMaximumChargePower );
				}
				grammarID = 626;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 626:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVBidirectionalParameterType->EVMaximumChargeCurrent );
				}
				grammarID = 627;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 627:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVBidirectionalParameterType->EVMinimumChargeCurrent );
				}
				grammarID = 628;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 628:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVTargetEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumVoltage)] */
			if ( iso2AC_EVBidirectionalParameterType->EVTargetEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVBidirectionalParameterType->EVTargetEnergyRequest );
				}
				grammarID = 629;
			} else 			if ( iso2AC_EVBidirectionalParameterType->EVMaximumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVBidirectionalParameterType->EVMaximumEnergyRequest );
				}
				grammarID = 630;
			} else 			if ( iso2AC_EVBidirectionalParameterType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVBidirectionalParameterType->EVMinimumEnergyRequest );
				}
				grammarID = 631;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVBidirectionalParameterType->EVMaximumVoltage );
				}
				grammarID = 632;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 629:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumVoltage)] */
			if ( iso2AC_EVBidirectionalParameterType->EVMaximumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVBidirectionalParameterType->EVMaximumEnergyRequest );
				}
				grammarID = 630;
			} else 			if ( iso2AC_EVBidirectionalParameterType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVBidirectionalParameterType->EVMinimumEnergyRequest );
				}
				grammarID = 631;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVBidirectionalParameterType->EVMaximumVoltage );
				}
				grammarID = 632;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 630:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumVoltage)] */
			if ( iso2AC_EVBidirectionalParameterType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVBidirectionalParameterType->EVMinimumEnergyRequest );
				}
				grammarID = 631;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVBidirectionalParameterType->EVMaximumVoltage );
				}
				grammarID = 632;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 631:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVBidirectionalParameterType->EVMaximumVoltage );
				}
				grammarID = 632;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 632:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargePower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVBidirectionalParameterType->EVMaximumDischargePower );
				}
				grammarID = 633;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 633:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVBidirectionalParameterType->EVMaximumDischargeCurrent );
				}
				grammarID = 634;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 634:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumDischargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVBidirectionalParameterType->EVMinimumDischargeCurrent );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,DC_BidirectionalControlReqType',  base type name='ChargeLoopReqType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1}),("urn:iso:15118:2:2016:MsgBody":EVTargetCurrent,"urn:iso:15118:2:2016:MsgBody":EVTargetVoltage,"urn:iso:15118:2:2016:MsgBody":EVMaximumVoltage,"urn:iso:15118:2:2016:MsgBody":EVMinimumVoltage,"urn:iso:15118:2:2016:MsgBody":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgBody":EVMaximumDischargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumChargePower{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumDischargePower{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2DC_BidirectionalControlReqType(bitstream_t* stream, struct iso2DC_BidirectionalControlReqType* iso2DC_BidirectionalControlReqType) {
	int grammarID = 635;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 635:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetEnergyRequest)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVTargetEnergyRequest );
				}
				grammarID = 636;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 636:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetCurrent)] */
			if ( iso2DC_BidirectionalControlReqType->EVMaximumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVMaximumEnergyRequest );
				}
				grammarID = 637;
			} else 			if ( iso2DC_BidirectionalControlReqType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVMinimumEnergyRequest );
				}
				grammarID = 638;
			} else 			if ( iso2DC_BidirectionalControlReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2DC_BidirectionalControlReqType->DisplayParameters );
				}
				grammarID = 639;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVTargetCurrent );
				}
				grammarID = 640;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 637:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetCurrent)] */
			if ( iso2DC_BidirectionalControlReqType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVMinimumEnergyRequest );
				}
				grammarID = 638;
			} else 			if ( iso2DC_BidirectionalControlReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2DC_BidirectionalControlReqType->DisplayParameters );
				}
				grammarID = 639;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVTargetCurrent );
				}
				grammarID = 640;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 638:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetCurrent)] */
			if ( iso2DC_BidirectionalControlReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2DC_BidirectionalControlReqType->DisplayParameters );
				}
				grammarID = 639;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVTargetCurrent );
				}
				grammarID = 640;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 639:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVTargetCurrent );
				}
				grammarID = 640;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 640:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVTargetVoltage );
				}
				grammarID = 641;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 641:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVMaximumVoltage );
				}
				grammarID = 642;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 642:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVMinimumVoltage );
				}
				grammarID = 643;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 643:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVMaximumChargeCurrent );
				}
				grammarID = 644;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 644:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumDischargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumDischargePower), END_ELEMENT] */
			if ( iso2DC_BidirectionalControlReqType->EVMaximumDischargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVMaximumDischargeCurrent );
				}
				grammarID = 645;
			} else 			if ( iso2DC_BidirectionalControlReqType->EVMaximumChargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVMaximumChargePower );
				}
				grammarID = 646;
			} else 			if ( iso2DC_BidirectionalControlReqType->EVMaximumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVMaximumDischargePower );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 645:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumDischargePower), END_ELEMENT] */
			if ( iso2DC_BidirectionalControlReqType->EVMaximumChargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVMaximumChargePower );
				}
				grammarID = 646;
			} else 			if ( iso2DC_BidirectionalControlReqType->EVMaximumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVMaximumDischargePower );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 646:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumDischargePower), END_ELEMENT] */
			if ( iso2DC_BidirectionalControlReqType->EVMaximumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_BidirectionalControlReqType->EVMaximumDischargePower );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,CertificateUpdateReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2016:MsgBody":eMAID,"urn:iso:15118:2:2016:MsgBody":ListOfRootCertificateIDs)',  derivedBy='EXTENSION'.  */
static int encode_iso2CertificateUpdateReqType(bitstream_t* stream, struct iso2CertificateUpdateReqType* iso2CertificateUpdateReqType) {
	int grammarID = 647;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 647:
			/* FirstStartTag[ATTRIBUTE[STRING]({urn:iso:15118:2:2016:MsgBody}Id)] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2CertificateUpdateReqType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2CertificateUpdateReqType->Id.characters, iso2CertificateUpdateReqType->Id.charactersLen);
					}
				}
				grammarID = 648;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 648:
			/* StartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ContractSignatureCertChain)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2CertificateChainType(stream, &iso2CertificateUpdateReqType->ContractSignatureCertChain );
				}
				grammarID = 649;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 649:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}eMAID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2CertificateUpdateReqType->eMAID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2CertificateUpdateReqType->eMAID.characters, iso2CertificateUpdateReqType->eMAID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 650;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 650:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ListOfRootCertificateIDs)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2ListOfRootCertificateIDsType(stream, &iso2CertificateUpdateReqType->ListOfRootCertificateIDs );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ConsumptionCostType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":startValue,"urn:iso:15118:2:2016:MsgDataTypes":Cost{1-3})',  derivedBy='RESTRICTION'.  */
static int encode_iso2ConsumptionCostType(bitstream_t* stream, struct iso2ConsumptionCostType* iso2ConsumptionCostType) {
	int grammarID = 651;
	int done = 0;
	
	unsigned int iso2ConsumptionCostType_Cost_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 651:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}startValue)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ConsumptionCostType->startValue );
				}
				grammarID = 652;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 652:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Cost)] */
			if (iso2ConsumptionCostType_Cost_currArrayIndex < iso2ConsumptionCostType->Cost.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2CostType(stream, &iso2ConsumptionCostType->Cost.array [iso2ConsumptionCostType_Cost_currArrayIndex++]);
				}
				grammarID = 653;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 653:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Cost), END_ELEMENT] */
			if (iso2ConsumptionCostType_Cost_currArrayIndex < iso2ConsumptionCostType->Cost.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2CostType(stream, &iso2ConsumptionCostType->Cost.array [iso2ConsumptionCostType_Cost_currArrayIndex++]);
				}
				grammarID = 654;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 654:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Cost), END_ELEMENT] */
			if (iso2ConsumptionCostType_Cost_currArrayIndex < iso2ConsumptionCostType->Cost.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2CostType(stream, &iso2ConsumptionCostType->Cost.array [iso2ConsumptionCostType_Cost_currArrayIndex++]);
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SAScheduleListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SAScheduleTuple{1-3})',  derivedBy='RESTRICTION'.  */
static int encode_iso2SAScheduleListType(bitstream_t* stream, struct iso2SAScheduleListType* iso2SAScheduleListType) {
	int grammarID = 655;
	int done = 0;
	
	unsigned int iso2SAScheduleListType_SAScheduleTuple_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 655:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SAScheduleTuple)] */
			if (iso2SAScheduleListType_SAScheduleTuple_currArrayIndex < iso2SAScheduleListType->SAScheduleTuple.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SAScheduleTupleType(stream, &iso2SAScheduleListType->SAScheduleTuple.array [iso2SAScheduleListType_SAScheduleTuple_currArrayIndex++]);
				}
				grammarID = 656;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 656:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SAScheduleTuple), END_ELEMENT] */
			if (iso2SAScheduleListType_SAScheduleTuple_currArrayIndex < iso2SAScheduleListType->SAScheduleTuple.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SAScheduleTupleType(stream, &iso2SAScheduleListType->SAScheduleTuple.array [iso2SAScheduleListType_SAScheduleTuple_currArrayIndex++]);
				}
				grammarID = 657;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 657:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SAScheduleTuple), END_ELEMENT] */
			if (iso2SAScheduleListType_SAScheduleTuple_currArrayIndex < iso2SAScheduleListType->SAScheduleTuple.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SAScheduleTupleType(stream, &iso2SAScheduleListType->SAScheduleTuple.array [iso2SAScheduleListType_SAScheduleTuple_currArrayIndex++]);
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MagneticVectorSetupType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":GAID,"urn:iso:15118:2:2016:MsgDataTypes":FrequencyChannel)',  derivedBy='RESTRICTION'.  */
static int encode_iso2MagneticVectorSetupType(bitstream_t* stream, struct iso2MagneticVectorSetupType* iso2MagneticVectorSetupType) {
	int grammarID = 658;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 658:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}GAID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2MagneticVectorSetupType->GAID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2MagneticVectorSetupType->GAID.characters, iso2MagneticVectorSetupType->GAID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 659;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 659:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}FrequencyChannel)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger32(stream, iso2MagneticVectorSetupType->FrequencyChannel);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,LFA_EVSEFinePositioningSetupParametersType',  base type name='EVSEFinePositioningSetupParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NumberOfSensors,"urn:iso:15118:2:2016:MsgDataTypes":SensorList,"urn:iso:15118:2:2016:MsgDataTypes":SensorOrder,"urn:iso:15118:2:2016:MsgDataTypes":SignalPulseDuration,"urn:iso:15118:2:2016:MsgDataTypes":SignalSeparationTime,"urn:iso:15118:2:2016:MsgDataTypes":PackageSeparationTime,"urn:iso:15118:2:2016:MsgDataTypes":AlignmentOffset,"urn:iso:15118:2:2016:MsgDataTypes":SignalFrequency)',  derivedBy='EXTENSION'.  */
static int encode_iso2LFA_EVSEFinePositioningSetupParametersType(bitstream_t* stream, struct iso2LFA_EVSEFinePositioningSetupParametersType* iso2LFA_EVSEFinePositioningSetupParametersType) {
	int grammarID = 660;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 660:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}NumberOfSensors)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2LFA_EVSEFinePositioningSetupParametersType->NumberOfSensors - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 661;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 661:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorList)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SensorListType(stream, &iso2LFA_EVSEFinePositioningSetupParametersType->SensorList );
				}
				grammarID = 662;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 662:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorOrder)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SensorOrderListType(stream, &iso2LFA_EVSEFinePositioningSetupParametersType->SensorOrder );
				}
				grammarID = 663;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 663:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SignalPulseDuration)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2LFA_EVSEFinePositioningSetupParametersType->SignalPulseDuration - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 664;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 664:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SignalSeparationTime)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2LFA_EVSEFinePositioningSetupParametersType->SignalSeparationTime - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 665;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 665:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PackageSeparationTime)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2LFA_EVSEFinePositioningSetupParametersType->PackageSeparationTime - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 666;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 666:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AlignmentOffset)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2LFA_EVSEFinePositioningSetupParametersType->AlignmentOffset);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 667;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 667:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SignalFrequency)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2LFA_EVSEFinePositioningSetupParametersType->SignalFrequency);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PaymentOptionListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":PaymentOption{1-2})',  derivedBy='RESTRICTION'.  */
static int encode_iso2PaymentOptionListType(bitstream_t* stream, struct iso2PaymentOptionListType* iso2PaymentOptionListType) {
	int grammarID = 668;
	int done = 0;
	
	unsigned int iso2PaymentOptionListType_PaymentOption_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 668:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PaymentOption)] */
			if (iso2PaymentOptionListType_PaymentOption_currArrayIndex < iso2PaymentOptionListType->PaymentOption.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2PaymentOptionListType->PaymentOption.array[iso2PaymentOptionListType_PaymentOption_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 669;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 669:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PaymentOption), END_ELEMENT] */
			if (iso2PaymentOptionListType_PaymentOption_currArrayIndex < iso2PaymentOptionListType->PaymentOption.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2PaymentOptionListType->PaymentOption.array[iso2PaymentOptionListType_PaymentOption_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,LFA_EVSEFinePositioningParametersType',  base type name='EVSEFinePositioningParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NumberOfSignalPackages,"urn:iso:15118:2:2016:MsgDataTypes":SensorPackageList)',  derivedBy='EXTENSION'.  */
static int encode_iso2LFA_EVSEFinePositioningParametersType(bitstream_t* stream, struct iso2LFA_EVSEFinePositioningParametersType* iso2LFA_EVSEFinePositioningParametersType) {
	int grammarID = 670;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 670:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}NumberOfSignalPackages)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2LFA_EVSEFinePositioningParametersType->NumberOfSignalPackages - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 671;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 671:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackageList)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageListType(stream, &iso2LFA_EVSEFinePositioningParametersType->SensorPackageList );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,RelativeTimeIntervalType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":start,"urn:iso:15118:2:2016:MsgDataTypes":duration{0-1})',  derivedBy='RESTRICTION'.  */
static int encode_iso2RelativeTimeIntervalType(bitstream_t* stream, struct iso2RelativeTimeIntervalType* iso2RelativeTimeIntervalType) {
	int grammarID = 672;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 672:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}start)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger32(stream, iso2RelativeTimeIntervalType->start);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 673;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 673:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}duration), END_ELEMENT] */
			if ( iso2RelativeTimeIntervalType->duration_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger32(stream, iso2RelativeTimeIntervalType->duration);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVFinePositioningParametersType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
static int encode_iso2EVFinePositioningParametersType(bitstream_t* stream, struct iso2EVFinePositioningParametersType* iso2EVFinePositioningParametersType) {
	int grammarID = 674;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 674:
			/* FirstStartTag[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,AlignmentCheckReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVProcessing,"urn:iso:15118:2:2016:MsgBody":AlignmentCheckParameters{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2AlignmentCheckReqType(bitstream_t* stream, struct iso2AlignmentCheckReqType* iso2AlignmentCheckReqType) {
	int grammarID = 675;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 675:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVProcessing)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2AlignmentCheckReqType->EVProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 676;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 676:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AlignmentCheckParameters), END_ELEMENT] */
			if ( iso2AlignmentCheckReqType->AlignmentCheckParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2AlignmentCheckReqType->AlignmentCheckParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,CertificateInstallationReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":OEMProvisioningCert,"urn:iso:15118:2:2016:MsgBody":ListOfRootCertificateIDs)',  derivedBy='EXTENSION'.  */
static int encode_iso2CertificateInstallationReqType(bitstream_t* stream, struct iso2CertificateInstallationReqType* iso2CertificateInstallationReqType) {
	int grammarID = 677;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 677:
			/* FirstStartTag[ATTRIBUTE[STRING]({urn:iso:15118:2:2016:MsgBody}Id)] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2CertificateInstallationReqType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2CertificateInstallationReqType->Id.characters, iso2CertificateInstallationReqType->Id.charactersLen);
					}
				}
				grammarID = 678;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 678:
			/* StartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}OEMProvisioningCert)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2CertificateInstallationReqType->OEMProvisioningCert.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2CertificateInstallationReqType->OEMProvisioningCert.bytes, iso2CertificateInstallationReqType->OEMProvisioningCert.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 650;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 650:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ListOfRootCertificateIDs)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2ListOfRootCertificateIDsType(stream, &iso2CertificateInstallationReqType->ListOfRootCertificateIDs );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
static int encode_iso2TransformsType(bitstream_t* stream, struct iso2TransformsType* iso2TransformsType) {
	int grammarID = 679;
	int done = 0;
	
	unsigned int iso2TransformsType_Transform_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 679:
			/* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transform)] */
			if (iso2TransformsType_Transform_currArrayIndex < iso2TransformsType->Transform.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2TransformType(stream, &iso2TransformsType->Transform.array [iso2TransformsType_Transform_currArrayIndex++]);
				}
				grammarID = 680;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 680:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transform), END_ELEMENT] */
			if (iso2TransformsType_Transform_currArrayIndex < iso2TransformsType->Transform.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2TransformType(stream, &iso2TransformsType->Transform.array [iso2TransformsType_Transform_currArrayIndex++]);
				}
				grammarID = 680;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,ObjectType',  base type name='anyType',  content type='MIXED',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='((WC[##any])){0-UNBOUNDED}',  derivedBy='RESTRICTION'.  */
static int encode_iso2ObjectType(bitstream_t* stream, struct iso2ObjectType* iso2ObjectType) {
	int grammarID = 681;
	int done = 0;
	int wcDone = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 681:
			/* FirstStartTag[ATTRIBUTE[STRING](Encoding), ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](MimeType), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if ( iso2ObjectType->Encoding_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ObjectType->Encoding.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ObjectType->Encoding.characters, iso2ObjectType->Encoding.charactersLen);
					}
				}
				grammarID = 682;
			} else 			if ( iso2ObjectType->Id_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ObjectType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ObjectType->Id.characters, iso2ObjectType->Id.charactersLen);
					}
				}
				grammarID = 683;
			} else 			if ( iso2ObjectType->MimeType_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ObjectType->MimeType.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ObjectType->MimeType.characters, iso2ObjectType->MimeType.charactersLen);
					}
				}
				grammarID = 684;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 685;
			} else 			if ( iso2ObjectType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2ObjectType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ObjectType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ObjectType->ANY.characters, iso2ObjectType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 685;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 682:
			/* StartTag[ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](MimeType), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if ( iso2ObjectType->Id_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ObjectType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ObjectType->Id.characters, iso2ObjectType->Id.charactersLen);
					}
				}
				grammarID = 683;
			} else 			if ( iso2ObjectType->MimeType_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ObjectType->MimeType.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ObjectType->MimeType.characters, iso2ObjectType->MimeType.charactersLen);
					}
				}
				grammarID = 684;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 685;
			} else 			if ( iso2ObjectType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2ObjectType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ObjectType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ObjectType->ANY.characters, iso2ObjectType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 685;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 683:
			/* StartTag[ATTRIBUTE[STRING](MimeType), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if ( iso2ObjectType->MimeType_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ObjectType->MimeType.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ObjectType->MimeType.characters, iso2ObjectType->MimeType.charactersLen);
					}
				}
				grammarID = 684;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 685;
			} else 			if ( iso2ObjectType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2ObjectType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ObjectType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ObjectType->ANY.characters, iso2ObjectType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 685;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 684:
			/* StartTag[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 685;
			} else 			if ( iso2ObjectType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2ObjectType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ObjectType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ObjectType->ANY.characters, iso2ObjectType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 685;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 685:
			/* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 685;
			} else 			if ( iso2ObjectType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2ObjectType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ObjectType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ObjectType->ANY.characters, iso2ObjectType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 685;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorOrderListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SensorPosition{1-255})',  derivedBy='RESTRICTION'.  */
static int encode_iso2SensorOrderListType(bitstream_t* stream, struct iso2SensorOrderListType* iso2SensorOrderListType) {
	int grammarID = 686;
	int done = 0;
	
	unsigned int iso2SensorOrderListType_SensorPosition_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 686:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition)] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 687;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 687:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 688;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 688:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 689;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 689:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 690;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 690:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 691;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 691:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 692;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 692:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 693;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 693:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 694;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 694:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 695;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 695:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 696;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 696:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 697;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 697:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 698;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 698:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 699;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 699:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 700;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 700:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 701;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 701:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 702;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 702:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 703;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 703:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 704;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 704:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 705;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 705:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 706;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 706:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 707;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 707:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 708;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 708:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 709;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 709:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 710;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 710:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 711;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 711:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 712;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 712:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 713;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 713:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 714;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 714:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 715;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 715:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 716;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 716:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 717;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 717:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 718;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 718:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 719;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 719:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 720;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 720:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 721;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 721:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 722;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 722:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 723;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 723:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 724;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 724:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 725;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 725:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 726;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 726:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 727;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 727:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 728;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 728:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 729;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 729:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 730;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 730:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 731;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 731:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 732;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 732:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 733;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 733:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 734;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 734:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 735;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 735:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 736;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 736:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 737;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 737:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 738;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 738:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 739;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 739:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 740;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 740:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 741;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 741:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 742;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 742:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 743;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 743:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 744;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 744:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 745;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 745:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 746;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 746:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 747;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 747:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 748;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 748:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 749;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 749:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 750;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 750:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 751;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 751:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 752;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 752:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 753;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 753:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 754;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 754:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 755;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 755:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 756;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 756:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 757;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 757:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 758;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 758:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 759;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 759:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 760;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 760:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 761;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 761:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 762;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 762:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 763;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 763:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 764;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 764:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 765;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 765:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 766;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 766:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 767;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 767:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 768;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 768:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 769;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 769:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 770;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 770:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 771;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 771:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 772;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 772:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 773;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 773:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 774;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 774:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 775;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 775:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 776;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 776:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 777;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 777:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 778;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 778:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 779;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 779:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 780;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 780:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 781;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 781:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 782;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 782:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 783;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 783:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 784;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 784:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 785;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 785:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 786;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 786:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 787;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 787:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 788;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 788:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 789;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 789:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 790;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 790:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 791;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 791:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 792;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 792:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 793;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 793:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 794;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 794:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 795;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 795:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 796;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 796:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 797;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 797:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 798;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 798:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 799;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 799:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 800;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 800:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 801;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 801:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 802;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 802:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 803;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 803:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 804;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 804:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 805;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 805:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 806;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 806:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 807;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 807:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 808;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 808:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 809;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 809:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 810;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 810:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 811;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 811:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 812;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 812:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 813;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 813:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 814;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 814:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 815;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 815:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 816;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 816:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 817;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 817:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 818;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 818:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 819;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 819:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 820;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 820:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 821;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 821:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 822;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 822:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 823;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 823:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 824;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 824:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 825;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 825:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 826;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 826:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 827;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 827:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 828;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 828:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 829;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 829:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 830;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 830:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 831;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 831:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 832;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 832:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 833;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 833:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 834;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 834:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 835;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 835:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 836;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 836:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 837;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 837:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 838;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 838:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 839;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 839:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 840;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 840:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 841;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 841:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 842;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 842:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 843;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 843:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 844;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 844:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 845;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 845:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 846;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 846:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 847;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 847:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 848;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 848:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 849;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 849:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 850;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 850:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 851;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 851:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 852;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 852:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 853;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 853:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 854;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 854:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 855;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 855:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 856;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 856:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 857;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 857:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 858;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 858:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 859;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 859:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 860;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 860:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 861;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 861:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 862;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 862:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 863;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 863:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 864;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 864:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 865;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 865:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 866;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 866:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 867;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 867:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 868;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 868:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 869;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 869:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 870;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 870:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 871;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 871:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 872;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 872:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 873;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 873:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 874;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 874:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 875;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 875:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 876;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 876:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 877;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 877:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 878;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 878:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 879;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 879:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 880;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 880:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 881;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 881:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 882;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 882:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 883;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 883:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 884;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 884:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 885;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 885:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 886;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 886:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 887;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 887:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 888;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 888:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 889;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 889:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 890;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 890:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 891;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 891:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 892;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 892:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 893;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 893:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 894;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 894:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 895;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 895:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 896;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 896:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 897;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 897:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 898;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 898:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 899;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 899:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 900;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 900:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 901;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 901:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 902;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 902:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 903;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 903:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 904;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 904:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 905;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 905:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 906;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 906:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 907;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 907:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 908;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 908:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 909;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 909:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 910;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 910:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 911;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 911:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 912;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 912:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 913;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 913:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 914;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 914:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 915;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 915:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 916;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 916:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 917;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 917:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 918;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 918:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 919;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 919:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 920;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 920:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 921;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 921:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 922;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 922:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 923;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 923:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 924;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 924:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 925;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 925:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 926;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 926:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 927;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 927:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 928;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 928:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 929;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 929:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 930;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 930:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 931;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 931:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 932;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 932:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 933;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 933:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 934;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 934:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 935;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 935:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 936;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 936:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 937;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 937:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 938;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 938:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 939;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 939:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 940;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 940:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), END_ELEMENT] */
			if (iso2SensorOrderListType_SensorPosition_currArrayIndex < iso2SensorOrderListType->SensorPosition.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorOrderListType->SensorPosition.array[iso2SensorOrderListType_SensorPosition_currArrayIndex++] - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,ChargeParameterDiscoveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":MaxSupportingPoints{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVEnergyTransferParameter,"urn:iso:15118:2:2016:MsgBody":MinimumPMaxRequest{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2ChargeParameterDiscoveryReqType(bitstream_t* stream, struct iso2ChargeParameterDiscoveryReqType* iso2ChargeParameterDiscoveryReqType) {
	int grammarID = 941;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 941:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MaxSupportingPoints), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVBidirectionalParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVBidirectionalParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVEnergyTransferParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}WPT_EVChargeParameter)] */
			if ( iso2ChargeParameterDiscoveryReqType->MaxSupportingPoints_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 10, (uint32_t)(iso2ChargeParameterDiscoveryReqType->MaxSupportingPoints - 12));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 942;
			} else 			if ( iso2ChargeParameterDiscoveryReqType->AC_EVBidirectionalParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2AC_EVBidirectionalParameterType(stream, &iso2ChargeParameterDiscoveryReqType->AC_EVBidirectionalParameter );
				}
				grammarID = 943;
			} else 			if ( iso2ChargeParameterDiscoveryReqType->AC_EVChargeParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2AC_EVChargeParameterType(stream, &iso2ChargeParameterDiscoveryReqType->AC_EVChargeParameter );
				}
				grammarID = 943;
			} else 			if ( iso2ChargeParameterDiscoveryReqType->DC_EVBidirectionalParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2DC_EVBidirectionalParameterType(stream, &iso2ChargeParameterDiscoveryReqType->DC_EVBidirectionalParameter );
				}
				grammarID = 943;
			} else 			if ( iso2ChargeParameterDiscoveryReqType->DC_EVChargeParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					errn = encode_iso2DC_EVChargeParameterType(stream, &iso2ChargeParameterDiscoveryReqType->DC_EVChargeParameter );
				}
				grammarID = 943;
			} else 			if ( iso2ChargeParameterDiscoveryReqType->EVEnergyTransferParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					errn = encode_iso2EVEnergyTransferParameterType(stream, &iso2ChargeParameterDiscoveryReqType->EVEnergyTransferParameter );
				}
				grammarID = 943;
			} else 			if ( iso2ChargeParameterDiscoveryReqType->WPT_EVChargeParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 6);
				if(errn == 0) {
					errn = encode_iso2WPT_EVChargeParameterType(stream, &iso2ChargeParameterDiscoveryReqType->WPT_EVChargeParameter );
				}
				grammarID = 943;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 942:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVBidirectionalParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVBidirectionalParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVEnergyTransferParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}WPT_EVChargeParameter)] */
			if ( iso2ChargeParameterDiscoveryReqType->AC_EVBidirectionalParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2AC_EVBidirectionalParameterType(stream, &iso2ChargeParameterDiscoveryReqType->AC_EVBidirectionalParameter );
				}
				grammarID = 943;
			} else 			if ( iso2ChargeParameterDiscoveryReqType->AC_EVChargeParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2AC_EVChargeParameterType(stream, &iso2ChargeParameterDiscoveryReqType->AC_EVChargeParameter );
				}
				grammarID = 943;
			} else 			if ( iso2ChargeParameterDiscoveryReqType->DC_EVBidirectionalParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2DC_EVBidirectionalParameterType(stream, &iso2ChargeParameterDiscoveryReqType->DC_EVBidirectionalParameter );
				}
				grammarID = 943;
			} else 			if ( iso2ChargeParameterDiscoveryReqType->DC_EVChargeParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2DC_EVChargeParameterType(stream, &iso2ChargeParameterDiscoveryReqType->DC_EVChargeParameter );
				}
				grammarID = 943;
			} else 			if ( iso2ChargeParameterDiscoveryReqType->EVEnergyTransferParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					errn = encode_iso2EVEnergyTransferParameterType(stream, &iso2ChargeParameterDiscoveryReqType->EVEnergyTransferParameter );
				}
				grammarID = 943;
			} else 			if ( iso2ChargeParameterDiscoveryReqType->WPT_EVChargeParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					errn = encode_iso2WPT_EVChargeParameterType(stream, &iso2ChargeParameterDiscoveryReqType->WPT_EVChargeParameter );
				}
				grammarID = 943;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 943:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MinimumPMaxRequest), END_ELEMENT] */
			if ( iso2ChargeParameterDiscoveryReqType->MinimumPMaxRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MinimumPMaxRequestType(stream, &iso2ChargeParameterDiscoveryReqType->MinimumPMaxRequest );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ParameterType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":boolValue|"urn:iso:15118:2:2016:MsgDataTypes":byteValue|"urn:iso:15118:2:2016:MsgDataTypes":shortValue|"urn:iso:15118:2:2016:MsgDataTypes":intValue|"urn:iso:15118:2:2016:MsgDataTypes":physicalValue|"urn:iso:15118:2:2016:MsgDataTypes":stringValue)',  derivedBy='RESTRICTION'.  */
static int encode_iso2ParameterType(bitstream_t* stream, struct iso2ParameterType* iso2ParameterType) {
	int grammarID = 944;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 944:
			/* FirstStartTag[ATTRIBUTE[STRING]({urn:iso:15118:2:2016:MsgDataTypes}Name)] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ParameterType->Name.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ParameterType->Name.characters, iso2ParameterType->Name.charactersLen);
					}
				}
				grammarID = 945;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 945:
			/* StartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}boolValue), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}byteValue), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}shortValue), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}intValue), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}physicalValue), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}stringValue)] */
			if ( iso2ParameterType->boolValue_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2ParameterType->boolValue);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if ( iso2ParameterType->byteValue_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2ParameterType->byteValue + 128));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if ( iso2ParameterType->shortValue_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger16(stream, iso2ParameterType->shortValue);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if ( iso2ParameterType->intValue_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger32(stream, iso2ParameterType->intValue);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if ( iso2ParameterType->physicalValue_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ParameterType->physicalValue );
				}
				grammarID = 3;
			} else 			if ( iso2ParameterType->stringValue_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ParameterType->stringValue.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2ParameterType->stringValue.characters, iso2ParameterType->stringValue.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,SessionStopReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ChargingSession)',  derivedBy='EXTENSION'.  */
static int encode_iso2SessionStopReqType(bitstream_t* stream, struct iso2SessionStopReqType* iso2SessionStopReqType) {
	int grammarID = 946;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 946:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingSession)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2SessionStopReqType->ChargingSession);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorMeasurementsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SensorID,"urn:iso:15118:2:2016:MsgDataTypes":EffectiveRadiatedPower,"urn:iso:15118:2:2016:MsgDataTypes":MeasurementDataList)',  derivedBy='RESTRICTION'.  */
static int encode_iso2SensorMeasurementsType(bitstream_t* stream, struct iso2SensorMeasurementsType* iso2SensorMeasurementsType) {
	int grammarID = 947;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 947:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorMeasurementsType->SensorID - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 948;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 948:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EffectiveRadiatedPower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorMeasurementsType->EffectiveRadiatedPower + 128));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 949;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 949:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementDataList)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2MeasurementDataListType(stream, &iso2SensorMeasurementsType->MeasurementDataList );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DC_EVSEChargeParameterType',  base type name='EVSEEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSECurrentRegulationTolerance{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVSEPeakCurrentRipple,"urn:iso:15118:2:2016:MsgDataTypes":EVSEEnergyToBeDelivered{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2DC_EVSEChargeParameterType(bitstream_t* stream, struct iso2DC_EVSEChargeParameterType* iso2DC_EVSEChargeParameterType) {
	int grammarID = 950;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 950:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumChargePower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEChargeParameterType->EVSEMaximumChargePower );
				}
				grammarID = 951;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 951:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEChargeParameterType->EVSEMaximumChargeCurrent );
				}
				grammarID = 952;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 952:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMinimumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEChargeParameterType->EVSEMinimumChargeCurrent );
				}
				grammarID = 953;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 953:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEChargeParameterType->EVSEMaximumVoltage );
				}
				grammarID = 954;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 954:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMinimumVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEChargeParameterType->EVSEMinimumVoltage );
				}
				grammarID = 955;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 955:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSECurrentRegulationTolerance), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEPeakCurrentRipple)] */
			if ( iso2DC_EVSEChargeParameterType->EVSECurrentRegulationTolerance_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEChargeParameterType->EVSECurrentRegulationTolerance );
				}
				grammarID = 956;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEChargeParameterType->EVSEPeakCurrentRipple );
				}
				grammarID = 957;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 956:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEPeakCurrentRipple)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEChargeParameterType->EVSEPeakCurrentRipple );
				}
				grammarID = 957;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 957:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEEnergyToBeDelivered), END_ELEMENT] */
			if ( iso2DC_EVSEChargeParameterType->EVSEEnergyToBeDelivered_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEChargeParameterType->EVSEEnergyToBeDelivered );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorPackageListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SensorPackage{1-255})',  derivedBy='RESTRICTION'.  */
static int encode_iso2SensorPackageListType(bitstream_t* stream, struct iso2SensorPackageListType* iso2SensorPackageListType) {
	int grammarID = 958;
	int done = 0;
	
	unsigned int iso2SensorPackageListType_SensorPackage_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 958:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage)] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 959;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 959:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 960;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 960:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 961;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 961:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 962;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 962:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 963;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 963:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 964;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 964:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 965;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 965:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 966;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 966:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 967;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 967:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 968;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 968:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 969;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 969:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 970;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 970:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 971;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 971:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 972;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 972:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 973;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 973:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 974;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 974:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 975;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 975:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 976;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 976:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 977;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 977:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 978;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 978:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 979;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 979:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 980;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 980:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 981;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 981:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 982;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 982:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 983;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 983:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 984;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 984:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 985;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 985:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 986;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 986:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 987;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 987:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 988;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 988:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 989;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 989:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 990;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 990:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 991;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 991:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 992;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 992:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 993;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 993:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 994;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 994:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 995;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 995:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 996;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 996:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 997;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 997:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 998;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 998:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 999;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 999:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1000;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1000:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1001;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1001:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1002;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1002:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1003;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1003:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1004;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1004:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1005;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1005:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1006;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1006:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1007;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1007:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1008;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1008:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1009;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1009:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1010;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1010:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1011;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1011:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1012;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1012:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1013;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1013:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1014;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1014:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1015;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1015:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1016;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1016:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1017;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1017:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1018;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1018:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1019;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1019:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1020;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1020:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1021;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1021:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1022;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1022:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1023;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1023:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1024;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1024:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1025;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1025:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1026;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1026:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1027;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1027:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1028;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1028:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1029;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1029:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1030;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1030:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1031;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1031:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1032;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1032:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1033;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1033:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1034;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1034:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1035;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1035:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1036;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1036:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1037;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1037:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1038;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1038:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1039;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1039:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1040;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1040:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1041;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1041:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1042;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1042:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1043;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1043:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1044;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1044:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1045;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1045:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1046;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1046:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1047;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1047:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1048;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1048:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1049;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1049:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1050;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1050:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1051;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1051:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1052;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1052:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1053;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1053:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1054;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1054:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1055;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1055:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1056;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1056:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1057;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1057:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1058;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1058:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1059;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1059:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1060;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1060:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1061;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1061:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1062;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1062:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1063;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1063:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1064;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1064:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1065;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1065:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1066;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1066:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1067;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1067:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1068;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1068:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1069;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1069:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1070;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1070:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1071;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1071:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1072;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1072:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1073;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1073:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1074;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1074:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1075;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1075:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1076;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1076:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1077;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1077:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1078;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1078:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1079;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1079:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1080;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1080:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1081;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1081:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1082;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1082:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1083;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1083:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1084;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1084:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1085;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1085:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1086;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1086:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1087;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1087:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1088;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1088:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1089;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1089:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1090;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1090:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1091;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1091:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1092;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1092:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1093;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1093:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1094;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1094:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1095;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1095:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1096;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1096:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1097;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1097:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1098;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1098:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1099;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1099:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1100;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1100:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1101;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1101:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1102;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1102:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1103;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1103:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1104;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1104:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1105;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1105:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1106;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1106:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1107;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1107:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1108;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1108:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1109;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1109:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1110;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1110:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1111;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1111:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1112;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1112:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1113;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1113:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1114;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1114:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1115;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1115:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1116;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1116:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1117;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1117:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1118;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1118:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1119;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1119:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1120;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1120:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1121;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1121:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1122;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1122:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1123;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1123:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1124;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1124:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1125;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1125:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1126;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1126:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1127;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1127:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1128;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1128:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1129;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1129:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1130;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1130:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1131;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1131:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1132;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1132:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1133;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1133:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1134;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1134:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1135;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1135:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1136;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1136:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1137;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1137:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1138;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1138:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1139;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1139:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1140;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1140:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1141;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1141:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1142;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1142:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1143;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1143:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1144;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1144:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1145;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1145:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1146;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1146:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1147;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1147:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1148;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1148:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1149;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1149:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1150;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1150:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1151;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1151:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1152;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1152:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1153;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1153:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1154;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1154:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1155;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1155:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1156;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1156:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1157;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1157:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1158;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1158:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1159;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1159:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1160;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1160:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1161;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1161:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1162;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1162:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1163;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1163:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1164;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1164:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1165;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1165:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1166;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1166:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1167;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1167:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1168;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1168:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1169;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1169:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1170;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1170:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1171;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1171:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1172;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1172:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1173;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1173:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1174;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1174:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1175;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1175:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1176;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1176:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1177;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1177:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1178;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1178:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1179;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1179:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1180;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1180:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1181;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1181:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1182;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1182:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1183;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1183:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1184;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1184:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1185;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1185:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1186;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1186:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1187;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1187:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1188;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1188:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1189;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1189:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1190;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1190:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1191;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1191:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1192;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1192:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1193;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1193:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1194;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1194:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1195;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1195:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1196;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1196:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1197;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1197:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1198;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1198:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1199;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1199:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1200;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1200:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1201;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1201:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1202;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1202:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1203;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1203:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1204;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1204:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1205;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1205:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1206;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1206:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1207;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1207:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1208;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1208:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1209;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1209:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1210;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1210:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1211;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1211:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 1212;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1212:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), END_ELEMENT] */
			if (iso2SensorPackageListType_SensorPackage_currArrayIndex < iso2SensorPackageListType->SensorPackage.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageType(stream, &iso2SensorPackageListType->SensorPackage.array [iso2SensorPackageListType_SensorPackage_currArrayIndex++]);
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MeasurementDataListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MeasurementData{1-255})',  derivedBy='RESTRICTION'.  */
static int encode_iso2MeasurementDataListType(bitstream_t* stream, struct iso2MeasurementDataListType* iso2MeasurementDataListType) {
	int grammarID = 1213;
	int done = 0;
	
	unsigned int iso2MeasurementDataListType_MeasurementData_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 1213:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData)] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1214;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1214:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1215;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1215:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1216;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1216:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1217;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1217:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1218;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1218:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1219;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1219:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1220;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1220:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1221;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1221:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1222;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1222:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1223;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1223:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1224;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1224:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1225;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1225:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1226;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1226:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1227;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1227:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1228;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1228:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1229;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1229:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1230;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1230:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1231;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1231:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1232;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1232:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1233;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1233:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1234;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1234:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1235;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1235:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1236;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1236:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1237;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1237:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1238;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1238:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1239;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1239:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1240;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1240:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1241;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1241:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1242;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1242:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1243;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1243:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1244;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1244:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1245;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1245:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1246;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1246:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1247;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1247:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1248;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1248:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1249;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1249:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1250;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1250:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1251;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1251:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1252;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1252:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1253;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1253:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1254;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1254:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1255;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1255:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1256;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1256:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1257;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1257:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1258;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1258:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1259;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1259:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1260;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1260:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1261;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1261:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1262;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1262:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1263;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1263:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1264;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1264:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1265;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1265:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1266;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1266:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1267;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1267:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1268;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1268:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1269;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1269:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1270;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1270:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1271;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1271:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1272;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1272:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1273;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1273:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1274;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1274:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1275;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1275:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1276;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1276:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1277;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1277:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1278;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1278:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1279;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1279:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1280;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1280:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1281;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1281:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1282;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1282:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1283;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1283:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1284;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1284:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1285;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1285:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1286;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1286:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1287;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1287:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1288;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1288:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1289;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1289:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1290;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1290:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1291;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1291:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1292;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1292:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1293;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1293:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1294;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1294:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1295;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1295:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1296;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1296:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1297;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1297:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1298;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1298:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1299;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1299:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1300;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1300:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1301;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1301:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1302;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1302:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1303;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1303:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1304;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1304:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1305;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1305:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1306;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1306:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1307;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1307:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1308;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1308:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1309;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1309:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1310;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1310:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1311;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1311:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1312;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1312:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1313;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1313:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1314;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1314:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1315;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1315:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1316;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1316:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1317;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1317:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1318;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1318:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1319;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1319:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1320;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1320:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1321;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1321:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1322;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1322:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1323;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1323:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1324;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1324:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1325;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1325:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1326;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1326:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1327;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1327:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1328;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1328:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1329;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1329:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1330;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1330:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1331;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1331:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1332;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1332:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1333;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1333:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1334;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1334:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1335;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1335:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1336;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1336:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1337;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1337:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1338;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1338:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1339;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1339:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1340;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1340:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1341;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1341:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1342;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1342:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1343;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1343:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1344;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1344:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1345;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1345:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1346;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1346:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1347;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1347:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1348;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1348:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1349;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1349:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1350;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1350:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1351;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1351:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1352;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1352:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1353;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1353:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1354;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1354:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1355;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1355:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1356;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1356:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1357;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1357:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1358;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1358:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1359;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1359:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1360;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1360:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1361;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1361:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1362;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1362:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1363;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1363:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1364;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1364:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1365;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1365:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1366;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1366:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1367;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1367:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1368;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1368:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1369;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1369:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1370;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1370:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1371;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1371:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1372;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1372:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1373;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1373:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1374;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1374:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1375;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1375:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1376;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1376:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1377;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1377:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1378;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1378:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1379;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1379:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1380;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1380:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1381;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1381:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1382;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1382:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1383;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1383:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1384;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1384:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1385;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1385:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1386;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1386:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1387;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1387:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1388;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1388:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1389;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1389:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1390;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1390:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1391;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1391:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1392;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1392:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1393;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1393:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1394;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1394:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1395;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1395:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1396;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1396:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1397;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1397:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1398;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1398:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1399;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1399:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1400;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1400:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1401;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1401:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1402;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1402:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1403;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1403:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1404;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1404:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1405;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1405:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1406;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1406:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1407;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1407:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1408;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1408:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1409;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1409:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1410;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1410:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1411;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1411:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1412;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1412:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1413;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1413:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1414;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1414:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1415;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1415:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1416;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1416:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1417;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1417:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1418;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1418:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1419;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1419:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1420;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1420:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1421;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1421:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1422;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1422:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1423;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1423:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1424;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1424:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1425;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1425:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1426;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1426:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1427;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1427:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1428;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1428:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1429;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1429:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1430;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1430:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1431;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1431:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1432;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1432:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1433;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1433:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1434;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1434:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1435;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1435:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1436;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1436:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1437;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1437:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1438;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1438:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1439;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1439:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1440;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1440:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1441;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1441:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1442;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1442:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1443;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1443:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1444;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1444:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1445;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1445:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1446;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1446:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1447;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1447:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1448;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1448:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1449;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1449:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1450;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1450:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1451;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1451:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1452;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1452:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1453;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1453:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1454;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1454:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1455;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1455:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1456;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1456:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1457;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1457:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1458;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1458:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1459;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1459:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1460;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1460:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1461;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1461:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1462;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1462:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1463;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1463:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1464;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1464:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1465;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1465:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1466;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1466:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1467;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1467:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), END_ELEMENT] */
			if (iso2MeasurementDataListType_MeasurementData_currArrayIndex < iso2MeasurementDataListType->MeasurementData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MeasurementDataListType->MeasurementData.array[iso2MeasurementDataListType_MeasurementData_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,CertificateChainType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Certificate,"urn:iso:15118:2:2016:MsgDataTypes":SubCertificates{0-1})',  derivedBy='RESTRICTION'.  */
static int encode_iso2CertificateChainType(bitstream_t* stream, struct iso2CertificateChainType* iso2CertificateChainType) {
	int grammarID = 1468;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1468:
			/* FirstStartTag[ATTRIBUTE[STRING]({urn:iso:15118:2:2016:MsgDataTypes}Id), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Certificate)] */
			if ( iso2CertificateChainType->Id_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2CertificateChainType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2CertificateChainType->Id.characters, iso2CertificateChainType->Id.charactersLen);
					}
				}
				grammarID = 1469;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2CertificateChainType->Certificate.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2CertificateChainType->Certificate.bytes, iso2CertificateChainType->Certificate.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1470;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1469:
			/* StartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Certificate)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2CertificateChainType->Certificate.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2CertificateChainType->Certificate.bytes, iso2CertificateChainType->Certificate.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1470;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1470:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SubCertificates), END_ELEMENT] */
			if ( iso2CertificateChainType->SubCertificates_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SubCertificatesType(stream, &iso2CertificateChainType->SubCertificates );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertyType',  base type name='anyType',  content type='MIXED',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])){1-UNBOUNDED}',  derivedBy='RESTRICTION'.  */
static int encode_iso2SignaturePropertyType(bitstream_t* stream, struct iso2SignaturePropertyType* iso2SignaturePropertyType) {
	int grammarID = 1471;
	int done = 0;
	int wcDone = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1471:
			/* FirstStartTag[ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](Target)] */
			if ( iso2SignaturePropertyType->Id_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SignaturePropertyType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2SignaturePropertyType->Id.characters, iso2SignaturePropertyType->Id.charactersLen);
					}
				}
				grammarID = 1472;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SignaturePropertyType->Target.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2SignaturePropertyType->Target.characters, iso2SignaturePropertyType->Target.charactersLen);
					}
				}
				grammarID = 1473;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1472:
			/* StartTag[ATTRIBUTE[STRING](Target)] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SignaturePropertyType->Target.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2SignaturePropertyType->Target.characters, iso2SignaturePropertyType->Target.charactersLen);
					}
				}
				grammarID = 1473;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1473:
			/* StartTag[START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */
			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 685;
			} else 			if ( iso2SignaturePropertyType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SignaturePropertyType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2SignaturePropertyType->ANY.characters, iso2SignaturePropertyType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 1474;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 685:
			/* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 685;
			} else 			if ( iso2SignaturePropertyType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2SignaturePropertyType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SignaturePropertyType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2SignaturePropertyType->ANY.characters, iso2SignaturePropertyType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 685;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1474:
			/* Element[START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */
			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 685;
			} else 			if ( iso2SignaturePropertyType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SignaturePropertyType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2SignaturePropertyType->ANY.characters, iso2SignaturePropertyType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 1474;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformType',  base type name='anyType',  content type='MIXED',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])|"http://www.w3.org/2000/09/xmldsig#":XPath){0-UNBOUNDED}',  derivedBy='RESTRICTION'.  */
static int encode_iso2TransformType(bitstream_t* stream, struct iso2TransformType* iso2TransformType) {
	int grammarID = 1475;
	int done = 0;
	int wcDone = 0;
	
	unsigned int iso2TransformType_XPath_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 1475:
			/* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2TransformType->Algorithm.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2TransformType->Algorithm.characters, iso2TransformType->Algorithm.charactersLen);
					}
				}
				grammarID = 1476;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1476:
			/* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if (iso2TransformType_XPath_currArrayIndex < iso2TransformType->XPath.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2TransformType->XPath.array[iso2TransformType_XPath_currArrayIndex].charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2TransformType->XPath.array[iso2TransformType_XPath_currArrayIndex].characters, iso2TransformType->XPath.array[iso2TransformType_XPath_currArrayIndex].charactersLen);
							iso2TransformType_XPath_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1477;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 1477;
			} else 			if ( iso2TransformType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2TransformType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2TransformType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2TransformType->ANY.characters, iso2TransformType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 1477;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1477:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if (iso2TransformType_XPath_currArrayIndex < iso2TransformType->XPath.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2TransformType->XPath.array[iso2TransformType_XPath_currArrayIndex].charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2TransformType->XPath.array[iso2TransformType_XPath_currArrayIndex].characters, iso2TransformType->XPath.array[iso2TransformType_XPath_currArrayIndex].charactersLen);
							iso2TransformType_XPath_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1477;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 1477;
			} else 			if ( iso2TransformType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2TransformType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2TransformType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2TransformType->ANY.characters, iso2TransformType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 1477;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EMAIDType',  base type name='eMAIDType',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
static int encode_iso2EMAIDType(bitstream_t* stream, struct iso2EMAIDType* iso2EMAIDType) {
	int grammarID = 1478;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1478:
			/* FirstStartTag[ATTRIBUTE[STRING]({urn:iso:15118:2:2016:MsgDataTypes}Id)] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2EMAIDType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2EMAIDType->Id.characters, iso2EMAIDType->Id.charactersLen);
					}
				}
				grammarID = 1479;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1479:
			/* StartTag[CHARACTERS[STRING]] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2EMAIDType->CONTENT.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2EMAIDType->CONTENT.characters, iso2EMAIDType->CONTENT.charactersLen);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,DSAKeyValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("http://www.w3.org/2000/09/xmldsig#":P,"http://www.w3.org/2000/09/xmldsig#":Q){0-1},"http://www.w3.org/2000/09/xmldsig#":G{0-1},"http://www.w3.org/2000/09/xmldsig#":Y,"http://www.w3.org/2000/09/xmldsig#":J{0-1},("http://www.w3.org/2000/09/xmldsig#":Seed,"http://www.w3.org/2000/09/xmldsig#":PgenCounter){0-1})',  derivedBy='RESTRICTION'.  */
static int encode_iso2DSAKeyValueType(bitstream_t* stream, struct iso2DSAKeyValueType* iso2DSAKeyValueType) {
	int grammarID = 1480;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1480:
			/* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}P), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}G), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y)] */
			if ( iso2DSAKeyValueType->P_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DSAKeyValueType->P.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2DSAKeyValueType->P.bytes, iso2DSAKeyValueType->P.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1481;
			} else 			if ( iso2DSAKeyValueType->G_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DSAKeyValueType->G.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2DSAKeyValueType->G.bytes, iso2DSAKeyValueType->G.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1482;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DSAKeyValueType->Y.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2DSAKeyValueType->Y.bytes, iso2DSAKeyValueType->Y.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1483;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1481:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Q)] */
			if ( iso2DSAKeyValueType->Q_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DSAKeyValueType->Q.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2DSAKeyValueType->Q.bytes, iso2DSAKeyValueType->Q.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1484;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1484:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}G), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y)] */
			if ( iso2DSAKeyValueType->G_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DSAKeyValueType->G.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2DSAKeyValueType->G.bytes, iso2DSAKeyValueType->G.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1482;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DSAKeyValueType->Y.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2DSAKeyValueType->Y.bytes, iso2DSAKeyValueType->Y.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1483;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1482:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DSAKeyValueType->Y.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2DSAKeyValueType->Y.bytes, iso2DSAKeyValueType->Y.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1483;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1483:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}J), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Seed), END_ELEMENT] */
			if ( iso2DSAKeyValueType->J_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DSAKeyValueType->J.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2DSAKeyValueType->J.bytes, iso2DSAKeyValueType->J.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1485;
			} else 			if ( iso2DSAKeyValueType->Seed_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DSAKeyValueType->Seed.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2DSAKeyValueType->Seed.bytes, iso2DSAKeyValueType->Seed.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1486;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1485:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Seed), END_ELEMENT] */
			if ( iso2DSAKeyValueType->Seed_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DSAKeyValueType->Seed.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2DSAKeyValueType->Seed.bytes, iso2DSAKeyValueType->Seed.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1486;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1486:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PgenCounter)] */
			if ( iso2DSAKeyValueType->PgenCounter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DSAKeyValueType->PgenCounter.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2DSAKeyValueType->PgenCounter.bytes, iso2DSAKeyValueType->PgenCounter.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EntryType',  base type name='anyType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":RelativeTimeInterval)',  derivedBy='RESTRICTION'.  */
static int encode_iso2EntryType(bitstream_t* stream, struct iso2EntryType* iso2EntryType) {
	int grammarID = 1487;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1487:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RelativeTimeInterval)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2RelativeTimeIntervalType(stream, &iso2EntryType->RelativeTimeInterval );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgHeader,MessageHeaderType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgHeader":SessionID,"http://www.w3.org/2000/09/xmldsig#":Signature{0-1})',  derivedBy='RESTRICTION'.  */
static int encode_iso2MessageHeaderType(bitstream_t* stream, struct iso2MessageHeaderType* iso2MessageHeaderType) {
	int grammarID = 1488;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1488:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgHeader}SessionID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_HEX]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2MessageHeaderType->SessionID.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2MessageHeaderType->SessionID.bytes, iso2MessageHeaderType->SessionID.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1489;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1489:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Signature), END_ELEMENT] */
			if ( iso2MessageHeaderType->Signature_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SignatureType(stream, &iso2MessageHeaderType->Signature );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,WPT_EVChargeParameterType',  base type name='EVEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumPower,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumPower,"urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2WPT_EVChargeParameterType(bitstream_t* stream, struct iso2WPT_EVChargeParameterType* iso2WPT_EVChargeParameterType) {
	int grammarID = 1490;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1490:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DepartureTime)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger32(stream, iso2WPT_EVChargeParameterType->DepartureTime);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1491;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1491:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumPower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2WPT_EVChargeParameterType->EVMaximumPower );
				}
				grammarID = 1492;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1492:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumPower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2WPT_EVChargeParameterType->EVMinimumPower );
				}
				grammarID = 1493;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1493:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVTargetEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest), END_ELEMENT] */
			if ( iso2WPT_EVChargeParameterType->EVTargetEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2WPT_EVChargeParameterType->EVTargetEnergyRequest );
				}
				grammarID = 1494;
			} else 			if ( iso2WPT_EVChargeParameterType->EVMaximumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2WPT_EVChargeParameterType->EVMaximumEnergyRequest );
				}
				grammarID = 1495;
			} else 			if ( iso2WPT_EVChargeParameterType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2WPT_EVChargeParameterType->EVMinimumEnergyRequest );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1494:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest), END_ELEMENT] */
			if ( iso2WPT_EVChargeParameterType->EVMaximumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2WPT_EVChargeParameterType->EVMaximumEnergyRequest );
				}
				grammarID = 1495;
			} else 			if ( iso2WPT_EVChargeParameterType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2WPT_EVChargeParameterType->EVMinimumEnergyRequest );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1495:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest), END_ELEMENT] */
			if ( iso2WPT_EVChargeParameterType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2WPT_EVChargeParameterType->EVMinimumEnergyRequest );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,DisconnectChargingDeviceReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVElectricalChargingDeviceStatus,"urn:iso:15118:2:2016:MsgBody":EVMechanicalChargingDeviceStatus)',  derivedBy='EXTENSION'.  */
static int encode_iso2DisconnectChargingDeviceReqType(bitstream_t* stream, struct iso2DisconnectChargingDeviceReqType* iso2DisconnectChargingDeviceReqType) {
	int grammarID = 1496;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1496:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVElectricalChargingDeviceStatus)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2DisconnectChargingDeviceReqType->EVElectricalChargingDeviceStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1497;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1497:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMechanicalChargingDeviceStatus)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2DisconnectChargingDeviceReqType->EVMechanicalChargingDeviceStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,ChargeLoopReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2ChargeLoopReqType(bitstream_t* stream, struct iso2ChargeLoopReqType* iso2ChargeLoopReqType) {
	int grammarID = 1498;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1498:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetEnergyRequest)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargeLoopReqType->EVTargetEnergyRequest );
				}
				grammarID = 1499;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1499:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), END_ELEMENT] */
			if ( iso2ChargeLoopReqType->EVMaximumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargeLoopReqType->EVMaximumEnergyRequest );
				}
				grammarID = 1500;
			} else 			if ( iso2ChargeLoopReqType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargeLoopReqType->EVMinimumEnergyRequest );
				}
				grammarID = 1501;
			} else 			if ( iso2ChargeLoopReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2ChargeLoopReqType->DisplayParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1500:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), END_ELEMENT] */
			if ( iso2ChargeLoopReqType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargeLoopReqType->EVMinimumEnergyRequest );
				}
				grammarID = 1501;
			} else 			if ( iso2ChargeLoopReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2ChargeLoopReqType->DisplayParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1501:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), END_ELEMENT] */
			if ( iso2ChargeLoopReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2ChargeLoopReqType->DisplayParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,V2GRequestType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
static int encode_iso2V2GRequestType(bitstream_t* stream, struct iso2V2GRequestType* iso2V2GRequestType) {
	int grammarID = 674;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 674:
			/* FirstStartTag[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,MeteringReceiptResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2MeteringReceiptResType(bitstream_t* stream, struct iso2MeteringReceiptResType* iso2MeteringReceiptResType) {
	int grammarID = 599;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 599:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2MeteringReceiptResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 600;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 600:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), END_ELEMENT] */
			if ( iso2MeteringReceiptResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2MeteringReceiptResType->EVSEStatus );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,SessionSetupResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":EVSETimeStamp{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2SessionSetupResType(bitstream_t* stream, struct iso2SessionSetupResType* iso2SessionSetupResType) {
	int grammarID = 1502;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1502:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2SessionSetupResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1503;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1503:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( iso2SessionSetupResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2SessionSetupResType->EVSEStatus );
				}
				grammarID = 1504;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SessionSetupResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2SessionSetupResType->EVSEID.characters, iso2SessionSetupResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1505;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1504:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SessionSetupResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2SessionSetupResType->EVSEID.characters, iso2SessionSetupResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1505;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1505:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSETimeStamp), END_ELEMENT] */
			if ( iso2SessionSetupResType->EVSETimeStamp_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger64(stream, iso2SessionSetupResType->EVSETimeStamp);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,AC_BidirectionalControlReqType',  base type name='ChargeLoopReqType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1}),("urn:iso:15118:2:2016:MsgBody":EVOperation{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumChargePower,"urn:iso:15118:2:2016:MsgBody":EVMaximumDischargePower{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgBody":EVMaximumDischargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgBody":EVMinimumDischargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVPresentActivePower,"urn:iso:15118:2:2016:MsgBody":EVPresentReactivePower))',  derivedBy='EXTENSION'.  */
static int encode_iso2AC_BidirectionalControlReqType(bitstream_t* stream, struct iso2AC_BidirectionalControlReqType* iso2AC_BidirectionalControlReqType) {
	int grammarID = 1506;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1506:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetEnergyRequest)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVTargetEnergyRequest );
				}
				grammarID = 1507;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1507:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVOperation), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargePower)] */
			if ( iso2AC_BidirectionalControlReqType->EVMaximumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVMaximumEnergyRequest );
				}
				grammarID = 1508;
			} else 			if ( iso2AC_BidirectionalControlReqType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVMinimumEnergyRequest );
				}
				grammarID = 1509;
			} else 			if ( iso2AC_BidirectionalControlReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2AC_BidirectionalControlReqType->DisplayParameters );
				}
				grammarID = 1510;
			} else 			if ( iso2AC_BidirectionalControlReqType->EVOperation_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2AC_BidirectionalControlReqType->EVOperation);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1511;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVMaximumChargePower );
				}
				grammarID = 1512;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1508:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVOperation), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargePower)] */
			if ( iso2AC_BidirectionalControlReqType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVMinimumEnergyRequest );
				}
				grammarID = 1509;
			} else 			if ( iso2AC_BidirectionalControlReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2AC_BidirectionalControlReqType->DisplayParameters );
				}
				grammarID = 1510;
			} else 			if ( iso2AC_BidirectionalControlReqType->EVOperation_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2AC_BidirectionalControlReqType->EVOperation);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1511;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVMaximumChargePower );
				}
				grammarID = 1512;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1509:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVOperation), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargePower)] */
			if ( iso2AC_BidirectionalControlReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2AC_BidirectionalControlReqType->DisplayParameters );
				}
				grammarID = 1510;
			} else 			if ( iso2AC_BidirectionalControlReqType->EVOperation_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2AC_BidirectionalControlReqType->EVOperation);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1511;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVMaximumChargePower );
				}
				grammarID = 1512;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1510:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVOperation), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargePower)] */
			if ( iso2AC_BidirectionalControlReqType->EVOperation_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2AC_BidirectionalControlReqType->EVOperation);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1511;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVMaximumChargePower );
				}
				grammarID = 1512;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1511:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargePower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVMaximumChargePower );
				}
				grammarID = 1512;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1512:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargeCurrent)] */
			if ( iso2AC_BidirectionalControlReqType->EVMaximumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVMaximumDischargePower );
				}
				grammarID = 1513;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVMaximumChargeCurrent );
				}
				grammarID = 1514;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1513:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVMaximumChargeCurrent );
				}
				grammarID = 1514;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1514:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumDischargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumChargeCurrent)] */
			if ( iso2AC_BidirectionalControlReqType->EVMaximumDischargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVMaximumDischargeCurrent );
				}
				grammarID = 1515;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVMinimumChargeCurrent );
				}
				grammarID = 1516;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1515:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVMinimumChargeCurrent );
				}
				grammarID = 1516;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1516:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumDischargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVPresentActivePower)] */
			if ( iso2AC_BidirectionalControlReqType->EVMinimumDischargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVMinimumDischargeCurrent );
				}
				grammarID = 1517;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVPresentActivePower );
				}
				grammarID = 1518;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1517:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVPresentActivePower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVPresentActivePower );
				}
				grammarID = 1518;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1518:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVPresentReactivePower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlReqType->EVPresentReactivePower );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MV_EVSEFinePositioningParametersType',  base type name='EVSEFinePositioningParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MagneticVectorList)',  derivedBy='EXTENSION'.  */
static int encode_iso2MV_EVSEFinePositioningParametersType(bitstream_t* stream, struct iso2MV_EVSEFinePositioningParametersType* iso2MV_EVSEFinePositioningParametersType) {
	int grammarID = 1519;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1519:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorList)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorListType(stream, &iso2MV_EVSEFinePositioningParametersType->MagneticVectorList );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,ReferenceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transforms{0-1},"http://www.w3.org/2000/09/xmldsig#":DigestMethod,"http://www.w3.org/2000/09/xmldsig#":DigestValue)',  derivedBy='RESTRICTION'.  */
static int encode_iso2ReferenceType(bitstream_t* stream, struct iso2ReferenceType* iso2ReferenceType) {
	int grammarID = 1520;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1520:
			/* FirstStartTag[ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](Type), ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod)] */
			if ( iso2ReferenceType->Id_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ReferenceType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ReferenceType->Id.characters, iso2ReferenceType->Id.charactersLen);
					}
				}
				grammarID = 1521;
			} else 			if ( iso2ReferenceType->Type_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ReferenceType->Type.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ReferenceType->Type.characters, iso2ReferenceType->Type.charactersLen);
					}
				}
				grammarID = 1522;
			} else 			if ( iso2ReferenceType->URI_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ReferenceType->URI.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ReferenceType->URI.characters, iso2ReferenceType->URI.charactersLen);
					}
				}
				grammarID = 1523;
			} else 			if ( iso2ReferenceType->Transforms_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2TransformsType(stream, &iso2ReferenceType->Transforms );
				}
				grammarID = 1524;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					errn = encode_iso2DigestMethodType(stream, &iso2ReferenceType->DigestMethod );
				}
				grammarID = 1525;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1521:
			/* StartTag[ATTRIBUTE[STRING](Type), ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod)] */
			if ( iso2ReferenceType->Type_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ReferenceType->Type.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ReferenceType->Type.characters, iso2ReferenceType->Type.charactersLen);
					}
				}
				grammarID = 1522;
			} else 			if ( iso2ReferenceType->URI_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ReferenceType->URI.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ReferenceType->URI.characters, iso2ReferenceType->URI.charactersLen);
					}
				}
				grammarID = 1523;
			} else 			if ( iso2ReferenceType->Transforms_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2TransformsType(stream, &iso2ReferenceType->Transforms );
				}
				grammarID = 1524;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2DigestMethodType(stream, &iso2ReferenceType->DigestMethod );
				}
				grammarID = 1525;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1522:
			/* StartTag[ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod)] */
			if ( iso2ReferenceType->URI_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ReferenceType->URI.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ReferenceType->URI.characters, iso2ReferenceType->URI.charactersLen);
					}
				}
				grammarID = 1523;
			} else 			if ( iso2ReferenceType->Transforms_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2TransformsType(stream, &iso2ReferenceType->Transforms );
				}
				grammarID = 1524;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					errn = encode_iso2DigestMethodType(stream, &iso2ReferenceType->DigestMethod );
				}
				grammarID = 1525;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1523:
			/* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod)] */
			if ( iso2ReferenceType->Transforms_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2TransformsType(stream, &iso2ReferenceType->Transforms );
				}
				grammarID = 1524;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2DigestMethodType(stream, &iso2ReferenceType->DigestMethod );
				}
				grammarID = 1525;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1524:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2DigestMethodType(stream, &iso2ReferenceType->DigestMethod );
				}
				grammarID = 1525;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1525:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestValue)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ReferenceType->DigestValue.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2ReferenceType->DigestValue.bytes, iso2ReferenceType->DigestValue.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEEnergyTransferParameterType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
static int encode_iso2EVSEEnergyTransferParameterType(bitstream_t* stream, struct iso2EVSEEnergyTransferParameterType* iso2EVSEEnergyTransferParameterType) {
	int grammarID = 674;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 674:
			/* FirstStartTag[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,MeteringReceiptReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":SessionID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo)',  derivedBy='EXTENSION'.  */
static int encode_iso2MeteringReceiptReqType(bitstream_t* stream, struct iso2MeteringReceiptReqType* iso2MeteringReceiptReqType) {
	int grammarID = 1526;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1526:
			/* FirstStartTag[ATTRIBUTE[STRING]({urn:iso:15118:2:2016:MsgBody}Id)] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2MeteringReceiptReqType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2MeteringReceiptReqType->Id.characters, iso2MeteringReceiptReqType->Id.charactersLen);
					}
				}
				grammarID = 1527;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1527:
			/* StartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_HEX]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2MeteringReceiptReqType->SessionID.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2MeteringReceiptReqType->SessionID.bytes, iso2MeteringReceiptReqType->SessionID.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1528;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1528:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAScheduleTupleID), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeterInfo)] */
			if ( iso2MeteringReceiptReqType->SAScheduleTupleID_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2MeteringReceiptReqType->SAScheduleTupleID - 1));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1529;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2MeterInfoType(stream, &iso2MeteringReceiptReqType->MeterInfo );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1529:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeterInfo)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2MeterInfoType(stream, &iso2MeteringReceiptReqType->MeterInfo );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,KeyValueType',  base type name='anyType',  content type='MIXED',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":DSAKeyValue|"http://www.w3.org/2000/09/xmldsig#":RSAKeyValue|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]))',  derivedBy='RESTRICTION'.  */
static int encode_iso2KeyValueType(bitstream_t* stream, struct iso2KeyValueType* iso2KeyValueType) {
	int grammarID = 1530;
	int done = 0;
	int wcDone = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1530:
			/* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DSAKeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RSAKeyValue), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */
			if ( iso2KeyValueType->DSAKeyValue_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2DSAKeyValueType(stream, &iso2KeyValueType->DSAKeyValue );
				}
				grammarID = 1531;
			} else 			if ( iso2KeyValueType->RSAKeyValue_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2RSAKeyValueType(stream, &iso2KeyValueType->RSAKeyValue );
				}
				grammarID = 1531;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 1531;
			} else 			if ( iso2KeyValueType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2KeyValueType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2KeyValueType->ANY.characters, iso2KeyValueType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 1532;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1531:
			/* Element[END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if ( iso2KeyValueType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2KeyValueType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2KeyValueType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2KeyValueType->ANY.characters, iso2KeyValueType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 1531;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1532:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DSAKeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RSAKeyValue), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */
			if ( iso2KeyValueType->DSAKeyValue_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2DSAKeyValueType(stream, &iso2KeyValueType->DSAKeyValue );
				}
				grammarID = 1531;
			} else 			if ( iso2KeyValueType->RSAKeyValue_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2RSAKeyValueType(stream, &iso2KeyValueType->RSAKeyValue );
				}
				grammarID = 1531;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 1531;
			} else 			if ( iso2KeyValueType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2KeyValueType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2KeyValueType->ANY.characters, iso2KeyValueType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 1532;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Sensor{1-255})',  derivedBy='RESTRICTION'.  */
static int encode_iso2SensorListType(bitstream_t* stream, struct iso2SensorListType* iso2SensorListType) {
	int grammarID = 1533;
	int done = 0;
	
	unsigned int iso2SensorListType_Sensor_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 1533:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor)] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1534;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1534:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1535;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1535:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1536;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1536:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1537;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1537:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1538;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1538:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1539;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1539:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1540;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1540:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1541;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1541:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1542;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1542:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1543;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1543:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1544;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1544:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1545;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1545:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1546;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1546:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1547;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1547:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1548;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1548:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1549;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1549:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1550;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1550:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1551;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1551:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1552;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1552:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1553;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1553:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1554;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1554:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1555;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1555:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1556;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1556:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1557;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1557:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1558;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1558:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1559;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1559:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1560;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1560:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1561;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1561:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1562;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1562:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1563;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1563:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1564;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1564:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1565;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1565:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1566;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1566:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1567;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1567:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1568;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1568:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1569;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1569:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1570;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1570:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1571;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1571:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1572;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1572:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1573;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1573:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1574;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1574:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1575;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1575:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1576;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1576:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1577;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1577:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1578;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1578:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1579;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1579:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1580;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1580:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1581;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1581:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1582;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1582:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1583;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1583:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1584;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1584:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1585;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1585:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1586;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1586:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1587;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1587:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1588;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1588:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1589;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1589:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1590;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1590:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1591;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1591:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1592;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1592:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1593;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1593:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1594;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1594:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1595;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1595:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1596;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1596:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1597;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1597:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1598;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1598:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1599;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1599:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1600;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1600:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1601;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1601:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1602;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1602:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1603;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1603:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1604;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1604:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1605;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1605:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1606;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1606:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1607;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1607:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1608;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1608:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1609;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1609:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1610;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1610:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1611;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1611:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1612;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1612:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1613;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1613:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1614;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1614:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1615;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1615:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1616;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1616:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1617;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1617:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1618;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1618:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1619;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1619:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1620;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1620:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1621;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1621:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1622;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1622:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1623;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1623:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1624;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1624:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1625;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1625:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1626;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1626:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1627;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1627:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1628;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1628:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1629;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1629:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1630;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1630:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1631;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1631:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1632;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1632:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1633;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1633:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1634;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1634:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1635;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1635:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1636;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1636:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1637;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1637:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1638;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1638:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1639;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1639:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1640;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1640:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1641;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1641:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1642;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1642:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1643;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1643:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1644;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1644:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1645;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1645:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1646;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1646:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1647;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1647:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1648;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1648:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1649;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1649:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1650;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1650:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1651;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1651:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1652;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1652:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1653;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1653:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1654;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1654:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1655;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1655:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1656;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1656:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1657;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1657:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1658;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1658:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1659;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1659:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1660;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1660:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1661;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1661:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1662;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1662:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1663;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1663:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1664;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1664:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1665;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1665:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1666;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1666:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1667;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1667:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1668;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1668:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1669;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1669:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1670;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1670:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1671;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1671:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1672;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1672:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1673;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1673:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1674;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1674:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1675;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1675:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1676;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1676:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1677;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1677:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1678;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1678:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1679;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1679:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1680;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1680:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1681;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1681:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1682;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1682:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1683;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1683:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1684;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1684:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1685;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1685:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1686;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1686:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1687;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1687:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1688;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1688:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1689;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1689:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1690;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1690:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1691;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1691:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1692;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1692:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1693;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1693:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1694;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1694:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1695;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1695:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1696;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1696:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1697;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1697:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1698;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1698:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1699;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1699:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1700;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1700:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1701;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1701:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1702;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1702:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1703;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1703:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1704;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1704:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1705;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1705:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1706;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1706:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1707;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1707:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1708;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1708:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1709;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1709:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1710;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1710:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1711;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1711:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1712;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1712:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1713;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1713:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1714;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1714:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1715;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1715:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1716;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1716:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1717;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1717:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1718;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1718:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1719;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1719:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1720;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1720:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1721;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1721:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1722;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1722:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1723;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1723:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1724;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1724:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1725;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1725:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1726;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1726:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1727;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1727:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1728;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1728:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1729;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1729:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1730;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1730:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1731;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1731:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1732;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1732:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1733;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1733:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1734;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1734:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1735;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1735:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1736;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1736:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1737;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1737:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1738;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1738:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1739;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1739:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1740;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1740:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1741;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1741:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1742;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1742:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1743;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1743:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1744;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1744:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1745;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1745:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1746;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1746:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1747;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1747:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1748;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1748:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1749;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1749:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1750;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1750:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1751;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1751:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1752;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1752:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1753;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1753:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1754;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1754:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1755;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1755:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1756;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1756:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1757;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1757:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1758;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1758:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1759;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1759:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1760;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1760:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1761;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1761:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1762;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1762:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1763;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1763:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1764;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1764:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1765;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1765:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1766;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1766:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1767;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1767:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1768;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1768:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1769;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1769:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1770;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1770:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1771;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1771:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1772;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1772:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1773;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1773:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1774;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1774:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1775;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1775:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1776;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1776:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1777;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1777:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1778;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1778:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1779;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1779:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1780;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1780:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1781;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1781:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1782;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1782:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1783;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1783:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1784;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1784:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1785;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1785:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1786;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1786:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 1787;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1787:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), END_ELEMENT] */
			if (iso2SensorListType_Sensor_currArrayIndex < iso2SensorListType->Sensor.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorType(stream, &iso2SensorListType->Sensor.array [iso2SensorListType_Sensor_currArrayIndex++]);
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,CurrentDemandReqType',  base type name='ChargeLoopReqType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1}),("urn:iso:15118:2:2016:MsgBody":EVTargetCurrent,"urn:iso:15118:2:2016:MsgBody":EVTargetVoltage,"urn:iso:15118:2:2016:MsgBody":EVMaximumCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumPower{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumVoltage{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2CurrentDemandReqType(bitstream_t* stream, struct iso2CurrentDemandReqType* iso2CurrentDemandReqType) {
	int grammarID = 1788;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1788:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetEnergyRequest)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandReqType->EVTargetEnergyRequest );
				}
				grammarID = 1789;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1789:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetCurrent)] */
			if ( iso2CurrentDemandReqType->EVMaximumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandReqType->EVMaximumEnergyRequest );
				}
				grammarID = 1790;
			} else 			if ( iso2CurrentDemandReqType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandReqType->EVMinimumEnergyRequest );
				}
				grammarID = 1791;
			} else 			if ( iso2CurrentDemandReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2CurrentDemandReqType->DisplayParameters );
				}
				grammarID = 1792;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandReqType->EVTargetCurrent );
				}
				grammarID = 1793;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1790:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetCurrent)] */
			if ( iso2CurrentDemandReqType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandReqType->EVMinimumEnergyRequest );
				}
				grammarID = 1791;
			} else 			if ( iso2CurrentDemandReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2CurrentDemandReqType->DisplayParameters );
				}
				grammarID = 1792;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandReqType->EVTargetCurrent );
				}
				grammarID = 1793;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1791:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetCurrent)] */
			if ( iso2CurrentDemandReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2CurrentDemandReqType->DisplayParameters );
				}
				grammarID = 1792;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandReqType->EVTargetCurrent );
				}
				grammarID = 1793;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1792:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandReqType->EVTargetCurrent );
				}
				grammarID = 1793;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1793:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandReqType->EVTargetVoltage );
				}
				grammarID = 1794;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1794:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumPower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumVoltage), END_ELEMENT] */
			if ( iso2CurrentDemandReqType->EVMaximumCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandReqType->EVMaximumCurrent );
				}
				grammarID = 1795;
			} else 			if ( iso2CurrentDemandReqType->EVMaximumPower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandReqType->EVMaximumPower );
				}
				grammarID = 1796;
			} else 			if ( iso2CurrentDemandReqType->EVMaximumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandReqType->EVMaximumVoltage );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1795:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumPower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumVoltage), END_ELEMENT] */
			if ( iso2CurrentDemandReqType->EVMaximumPower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandReqType->EVMaximumPower );
				}
				grammarID = 1796;
			} else 			if ( iso2CurrentDemandReqType->EVMaximumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandReqType->EVMaximumVoltage );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1796:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumVoltage), END_ELEMENT] */
			if ( iso2CurrentDemandReqType->EVMaximumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandReqType->EVMaximumVoltage );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,FinePositioningSetupReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":EVFinePositioningSetupParameters{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2FinePositioningSetupReqType(bitstream_t* stream, struct iso2FinePositioningSetupReqType* iso2FinePositioningSetupReqType) {
	int grammarID = 1797;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1797:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVFinePositioningSetupParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVFinePositioningSetupParameters), END_ELEMENT] */
			if ( iso2FinePositioningSetupReqType->EVFinePositioningSetupParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVFinePositioningSetupParametersType(stream, &iso2FinePositioningSetupReqType->EVFinePositioningSetupParameters );
				}
				grammarID = 3;
			} else 			if ( iso2FinePositioningSetupReqType->LFA_EVFinePositioningSetupParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2LFA_EVFinePositioningSetupParametersType(stream, &iso2FinePositioningSetupReqType->LFA_EVFinePositioningSetupParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,LFA_EVFinePositioningSetupParametersType',  base type name='EVFinePositioningSetupParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NumberOfSensors,"urn:iso:15118:2:2016:MsgDataTypes":SensorList,"urn:iso:15118:2:2016:MsgDataTypes":SensorOrder,"urn:iso:15118:2:2016:MsgDataTypes":SignalPulseDuration,"urn:iso:15118:2:2016:MsgDataTypes":SignalSeparationTime,"urn:iso:15118:2:2016:MsgDataTypes":PackageSeparationTime,"urn:iso:15118:2:2016:MsgDataTypes":AlignmentOffset)',  derivedBy='EXTENSION'.  */
static int encode_iso2LFA_EVFinePositioningSetupParametersType(bitstream_t* stream, struct iso2LFA_EVFinePositioningSetupParametersType* iso2LFA_EVFinePositioningSetupParametersType) {
	int grammarID = 1798;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1798:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}NumberOfSensors)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2LFA_EVFinePositioningSetupParametersType->NumberOfSensors - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1799;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1799:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorList)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SensorListType(stream, &iso2LFA_EVFinePositioningSetupParametersType->SensorList );
				}
				grammarID = 1800;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1800:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorOrder)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SensorOrderListType(stream, &iso2LFA_EVFinePositioningSetupParametersType->SensorOrder );
				}
				grammarID = 1801;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1801:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SignalPulseDuration)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2LFA_EVFinePositioningSetupParametersType->SignalPulseDuration - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1802;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1802:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SignalSeparationTime)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2LFA_EVFinePositioningSetupParametersType->SignalSeparationTime - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1803;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1803:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PackageSeparationTime)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2LFA_EVFinePositioningSetupParametersType->PackageSeparationTime - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1804;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1804:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AlignmentOffset)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2LFA_EVFinePositioningSetupParametersType->AlignmentOffset);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SAScheduleTupleType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SAScheduleTupleID,"urn:iso:15118:2:2016:MsgDataTypes":PMaxSchedule,"urn:iso:15118:2:2016:MsgDataTypes":PMaxDischargeSchedule{0-1},"urn:iso:15118:2:2016:MsgDataTypes":SalesTariff{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BuyBackTariff{0-1})',  derivedBy='RESTRICTION'.  */
static int encode_iso2SAScheduleTupleType(bitstream_t* stream, struct iso2SAScheduleTupleType* iso2SAScheduleTupleType) {
	int grammarID = 1805;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1805:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SAScheduleTupleID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SAScheduleTupleType->SAScheduleTupleID - 1));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1806;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1806:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PMaxSchedule)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PMaxScheduleType(stream, &iso2SAScheduleTupleType->PMaxSchedule );
				}
				grammarID = 1807;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1807:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PMaxDischargeSchedule), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariff), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BuyBackTariff), END_ELEMENT] */
			if ( iso2SAScheduleTupleType->PMaxDischargeSchedule_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PMaxScheduleType(stream, &iso2SAScheduleTupleType->PMaxDischargeSchedule );
				}
				grammarID = 1808;
			} else 			if ( iso2SAScheduleTupleType->SalesTariff_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2SalesTariffType(stream, &iso2SAScheduleTupleType->SalesTariff );
				}
				grammarID = 1809;
			} else 			if ( iso2SAScheduleTupleType->BuyBackTariff_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2SalesTariffType(stream, &iso2SAScheduleTupleType->BuyBackTariff );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1808:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariff), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BuyBackTariff), END_ELEMENT] */
			if ( iso2SAScheduleTupleType->SalesTariff_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SalesTariffType(stream, &iso2SAScheduleTupleType->SalesTariff );
				}
				grammarID = 1809;
			} else 			if ( iso2SAScheduleTupleType->BuyBackTariff_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2SalesTariffType(stream, &iso2SAScheduleTupleType->BuyBackTariff );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1809:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BuyBackTariff), END_ELEMENT] */
			if ( iso2SAScheduleTupleType->BuyBackTariff_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SalesTariffType(stream, &iso2SAScheduleTupleType->BuyBackTariff );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,WPT_EVSEChargeParameterType',  base type name='EVSEEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumPower,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumPower)',  derivedBy='EXTENSION'.  */
static int encode_iso2WPT_EVSEChargeParameterType(bitstream_t* stream, struct iso2WPT_EVSEChargeParameterType* iso2WPT_EVSEChargeParameterType) {
	int grammarID = 1810;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1810:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumPower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2WPT_EVSEChargeParameterType->EVSEMaximumPower );
				}
				grammarID = 1811;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1811:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMinimumPower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2WPT_EVSEChargeParameterType->EVSEMinimumPower );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,FinePositioningResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgDataTypes":EVSEFinePositioningParameters{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2FinePositioningResType(bitstream_t* stream, struct iso2FinePositioningResType* iso2FinePositioningResType) {
	int grammarID = 1812;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1812:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2FinePositioningResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1813;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1813:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( iso2FinePositioningResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2FinePositioningResType->EVSEStatus );
				}
				grammarID = 1814;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2FinePositioningResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1815;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1814:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2FinePositioningResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1815;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1815:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Generic_EVSEFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVSEFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MV_EVSEFinePositioningParameters), END_ELEMENT] */
			if ( iso2FinePositioningResType->EVSEFinePositioningParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEFinePositioningParametersType(stream, &iso2FinePositioningResType->EVSEFinePositioningParameters );
				}
				grammarID = 3;
			} else 			if ( iso2FinePositioningResType->Generic_EVSEFinePositioningParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2Generic_EVSEFinePositioningParametersType(stream, &iso2FinePositioningResType->Generic_EVSEFinePositioningParameters );
				}
				grammarID = 3;
			} else 			if ( iso2FinePositioningResType->LFA_EVSEFinePositioningParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2LFA_EVSEFinePositioningParametersType(stream, &iso2FinePositioningResType->LFA_EVSEFinePositioningParameters );
				}
				grammarID = 3;
			} else 			if ( iso2FinePositioningResType->MV_EVSEFinePositioningParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2MV_EVSEFinePositioningParametersType(stream, &iso2FinePositioningResType->MV_EVSEFinePositioningParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,BodyBaseType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
static int encode_iso2BodyBaseType(bitstream_t* stream, struct iso2BodyBaseType* iso2BodyBaseType) {
	int grammarID = 674;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 674:
			/* FirstStartTag[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,ServiceDetailResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":ServiceID,"urn:iso:15118:2:2016:MsgBody":ServiceParameterList{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2ServiceDetailResType(bitstream_t* stream, struct iso2ServiceDetailResType* iso2ServiceDetailResType) {
	int grammarID = 1816;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1816:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2ServiceDetailResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1817;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1817:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceID)] */
			if ( iso2ServiceDetailResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2ServiceDetailResType->EVSEStatus );
				}
				grammarID = 1818;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2ServiceDetailResType->ServiceID);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1819;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1818:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2ServiceDetailResType->ServiceID);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1819;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1819:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceParameterList), END_ELEMENT] */
			if ( iso2ServiceDetailResType->ServiceParameterList_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ServiceParameterListType(stream, &iso2ServiceDetailResType->ServiceParameterList );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,PowerDeliveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ChargeProgress,"urn:iso:15118:2:2016:MsgBody":EVOperation{0-1},"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":ChargingProfile{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2PowerDeliveryReqType(bitstream_t* stream, struct iso2PowerDeliveryReqType* iso2PowerDeliveryReqType) {
	int grammarID = 1820;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1820:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargeProgress)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2PowerDeliveryReqType->ChargeProgress);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1821;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1821:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVOperation), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAScheduleTupleID), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingProfile), END_ELEMENT] */
			if ( iso2PowerDeliveryReqType->EVOperation_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2PowerDeliveryReqType->EVOperation);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1822;
			} else 			if ( iso2PowerDeliveryReqType->SAScheduleTupleID_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2PowerDeliveryReqType->SAScheduleTupleID - 1));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1823;
			} else 			if ( iso2PowerDeliveryReqType->ChargingProfile_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2ChargingProfileType(stream, &iso2PowerDeliveryReqType->ChargingProfile );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1822:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAScheduleTupleID), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingProfile), END_ELEMENT] */
			if ( iso2PowerDeliveryReqType->SAScheduleTupleID_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2PowerDeliveryReqType->SAScheduleTupleID - 1));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1823;
			} else 			if ( iso2PowerDeliveryReqType->ChargingProfile_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2ChargingProfileType(stream, &iso2PowerDeliveryReqType->ChargingProfile );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1823:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingProfile), END_ELEMENT] */
			if ( iso2PowerDeliveryReqType->ChargingProfile_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ChargingProfileType(stream, &iso2PowerDeliveryReqType->ChargingProfile );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,PairingResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":PairingParameters{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2PairingResType(bitstream_t* stream, struct iso2PairingResType* iso2PairingResType) {
	int grammarID = 1824;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1824:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2PairingResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1825;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1825:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( iso2PairingResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2PairingResType->EVSEStatus );
				}
				grammarID = 1826;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2PairingResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1827;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1826:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2PairingResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1827;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1827:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PairingParameters), END_ELEMENT] */
			if ( iso2PairingResType->PairingParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2PairingResType->PairingParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,AuthorizationReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":GenChallenge{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2AuthorizationReqType(bitstream_t* stream, struct iso2AuthorizationReqType* iso2AuthorizationReqType) {
	int grammarID = 1828;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1828:
			/* FirstStartTag[ATTRIBUTE[STRING]({urn:iso:15118:2:2016:MsgBody}Id), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}GenChallenge), END_ELEMENT] */
			if ( iso2AuthorizationReqType->Id_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2AuthorizationReqType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2AuthorizationReqType->Id.characters, iso2AuthorizationReqType->Id.charactersLen);
					}
				}
				grammarID = 1829;
			} else 			if ( iso2AuthorizationReqType->GenChallenge_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2AuthorizationReqType->GenChallenge.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2AuthorizationReqType->GenChallenge.bytes, iso2AuthorizationReqType->GenChallenge.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1829:
			/* StartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}GenChallenge), END_ELEMENT] */
			if ( iso2AuthorizationReqType->GenChallenge_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2AuthorizationReqType->GenChallenge.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2AuthorizationReqType->GenChallenge.bytes, iso2AuthorizationReqType->GenChallenge.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ParameterSetType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID,"urn:iso:15118:2:2016:MsgDataTypes":Parameter{1-16})',  derivedBy='RESTRICTION'.  */
static int encode_iso2ParameterSetType(bitstream_t* stream, struct iso2ParameterSetType* iso2ParameterSetType) {
	int grammarID = 1830;
	int done = 0;
	
	unsigned int iso2ParameterSetType_Parameter_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 1830:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSetID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2ParameterSetType->ParameterSetID);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1831;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1831:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter)] */
			if (iso2ParameterSetType_Parameter_currArrayIndex < iso2ParameterSetType->Parameter.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterType(stream, &iso2ParameterSetType->Parameter.array [iso2ParameterSetType_Parameter_currArrayIndex++]);
				}
				grammarID = 1832;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1832:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter), END_ELEMENT] */
			if (iso2ParameterSetType_Parameter_currArrayIndex < iso2ParameterSetType->Parameter.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterType(stream, &iso2ParameterSetType->Parameter.array [iso2ParameterSetType_Parameter_currArrayIndex++]);
				}
				grammarID = 1833;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1833:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter), END_ELEMENT] */
			if (iso2ParameterSetType_Parameter_currArrayIndex < iso2ParameterSetType->Parameter.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterType(stream, &iso2ParameterSetType->Parameter.array [iso2ParameterSetType_Parameter_currArrayIndex++]);
				}
				grammarID = 1834;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1834:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter), END_ELEMENT] */
			if (iso2ParameterSetType_Parameter_currArrayIndex < iso2ParameterSetType->Parameter.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterType(stream, &iso2ParameterSetType->Parameter.array [iso2ParameterSetType_Parameter_currArrayIndex++]);
				}
				grammarID = 1835;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1835:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter), END_ELEMENT] */
			if (iso2ParameterSetType_Parameter_currArrayIndex < iso2ParameterSetType->Parameter.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterType(stream, &iso2ParameterSetType->Parameter.array [iso2ParameterSetType_Parameter_currArrayIndex++]);
				}
				grammarID = 1836;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1836:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter), END_ELEMENT] */
			if (iso2ParameterSetType_Parameter_currArrayIndex < iso2ParameterSetType->Parameter.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterType(stream, &iso2ParameterSetType->Parameter.array [iso2ParameterSetType_Parameter_currArrayIndex++]);
				}
				grammarID = 1837;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1837:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter), END_ELEMENT] */
			if (iso2ParameterSetType_Parameter_currArrayIndex < iso2ParameterSetType->Parameter.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterType(stream, &iso2ParameterSetType->Parameter.array [iso2ParameterSetType_Parameter_currArrayIndex++]);
				}
				grammarID = 1838;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1838:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter), END_ELEMENT] */
			if (iso2ParameterSetType_Parameter_currArrayIndex < iso2ParameterSetType->Parameter.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterType(stream, &iso2ParameterSetType->Parameter.array [iso2ParameterSetType_Parameter_currArrayIndex++]);
				}
				grammarID = 1839;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1839:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter), END_ELEMENT] */
			if (iso2ParameterSetType_Parameter_currArrayIndex < iso2ParameterSetType->Parameter.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterType(stream, &iso2ParameterSetType->Parameter.array [iso2ParameterSetType_Parameter_currArrayIndex++]);
				}
				grammarID = 1840;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1840:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter), END_ELEMENT] */
			if (iso2ParameterSetType_Parameter_currArrayIndex < iso2ParameterSetType->Parameter.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterType(stream, &iso2ParameterSetType->Parameter.array [iso2ParameterSetType_Parameter_currArrayIndex++]);
				}
				grammarID = 1841;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1841:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter), END_ELEMENT] */
			if (iso2ParameterSetType_Parameter_currArrayIndex < iso2ParameterSetType->Parameter.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterType(stream, &iso2ParameterSetType->Parameter.array [iso2ParameterSetType_Parameter_currArrayIndex++]);
				}
				grammarID = 1842;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1842:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter), END_ELEMENT] */
			if (iso2ParameterSetType_Parameter_currArrayIndex < iso2ParameterSetType->Parameter.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterType(stream, &iso2ParameterSetType->Parameter.array [iso2ParameterSetType_Parameter_currArrayIndex++]);
				}
				grammarID = 1843;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1843:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter), END_ELEMENT] */
			if (iso2ParameterSetType_Parameter_currArrayIndex < iso2ParameterSetType->Parameter.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterType(stream, &iso2ParameterSetType->Parameter.array [iso2ParameterSetType_Parameter_currArrayIndex++]);
				}
				grammarID = 1844;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1844:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter), END_ELEMENT] */
			if (iso2ParameterSetType_Parameter_currArrayIndex < iso2ParameterSetType->Parameter.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterType(stream, &iso2ParameterSetType->Parameter.array [iso2ParameterSetType_Parameter_currArrayIndex++]);
				}
				grammarID = 1845;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1845:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter), END_ELEMENT] */
			if (iso2ParameterSetType_Parameter_currArrayIndex < iso2ParameterSetType->Parameter.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterType(stream, &iso2ParameterSetType->Parameter.array [iso2ParameterSetType_Parameter_currArrayIndex++]);
				}
				grammarID = 1846;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1846:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter), END_ELEMENT] */
			if (iso2ParameterSetType_Parameter_currArrayIndex < iso2ParameterSetType->Parameter.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterType(stream, &iso2ParameterSetType->Parameter.array [iso2ParameterSetType_Parameter_currArrayIndex++]);
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SPKIDataType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":SPKISexp,(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-1}){1-UNBOUNDED}',  derivedBy='RESTRICTION'.  */
static int encode_iso2SPKIDataType(bitstream_t* stream, struct iso2SPKIDataType* iso2SPKIDataType) {
	int grammarID = 1847;
	int done = 0;
	int wcDone = 0;
	
	unsigned int iso2SPKIDataType_SPKISexp_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 1847:
			/* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKISexp)] */
			if (iso2SPKIDataType_SPKISexp_currArrayIndex < iso2SPKIDataType->SPKISexp.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SPKIDataType->SPKISexp.array[iso2SPKIDataType_SPKISexp_currArrayIndex].bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2SPKIDataType->SPKISexp.array[iso2SPKIDataType_SPKISexp_currArrayIndex].bytes, iso2SPKIDataType->SPKISexp.array[iso2SPKIDataType_SPKISexp_currArrayIndex].bytesLen);
							iso2SPKIDataType_SPKISexp_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1848;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1848:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKISexp), START_ELEMENT_GENERIC, END_ELEMENT] */
			if (iso2SPKIDataType_SPKISexp_currArrayIndex < iso2SPKIDataType->SPKISexp.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SPKIDataType->SPKISexp.array[iso2SPKIDataType_SPKISexp_currArrayIndex].bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2SPKIDataType->SPKISexp.array[iso2SPKIDataType_SPKISexp_currArrayIndex].bytes, iso2SPKIDataType->SPKISexp.array[iso2SPKIDataType_SPKISexp_currArrayIndex].bytesLen);
							iso2SPKIDataType_SPKISexp_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1848;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 1849;
			} else 			if ( iso2SPKIDataType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1849:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKISexp), END_ELEMENT] */
			if (iso2SPKIDataType_SPKISexp_currArrayIndex < iso2SPKIDataType->SPKISexp.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SPKIDataType->SPKISexp.array[iso2SPKIDataType_SPKISexp_currArrayIndex].bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2SPKIDataType->SPKISexp.array[iso2SPKIDataType_SPKISexp_currArrayIndex].bytes, iso2SPKIDataType->SPKISexp.array[iso2SPKIDataType_SPKISexp_currArrayIndex].bytesLen);
							iso2SPKIDataType_SPKISexp_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1848;
			} else 			if ( iso2SPKIDataType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,PaymentDetailsResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":GenChallenge,"urn:iso:15118:2:2016:MsgBody":EVSETimeStamp))',  derivedBy='EXTENSION'.  */
static int encode_iso2PaymentDetailsResType(bitstream_t* stream, struct iso2PaymentDetailsResType* iso2PaymentDetailsResType) {
	int grammarID = 1850;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1850:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2PaymentDetailsResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1851;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1851:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}GenChallenge)] */
			if ( iso2PaymentDetailsResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2PaymentDetailsResType->EVSEStatus );
				}
				grammarID = 1852;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2PaymentDetailsResType->GenChallenge.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2PaymentDetailsResType->GenChallenge.bytes, iso2PaymentDetailsResType->GenChallenge.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1853;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1852:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}GenChallenge)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2PaymentDetailsResType->GenChallenge.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2PaymentDetailsResType->GenChallenge.bytes, iso2PaymentDetailsResType->GenChallenge.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1853;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1853:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSETimeStamp)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger64(stream, iso2PaymentDetailsResType->EVSETimeStamp);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureMethodType',  base type name='anyType',  content type='MIXED',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":HMACOutputLength{0-1},(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
static int encode_iso2SignatureMethodType(bitstream_t* stream, struct iso2SignatureMethodType* iso2SignatureMethodType) {
	int grammarID = 1854;
	int done = 0;
	int wcDone = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1854:
			/* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SignatureMethodType->Algorithm.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2SignatureMethodType->Algorithm.characters, iso2SignatureMethodType->Algorithm.charactersLen);
					}
				}
				grammarID = 1855;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1855:
			/* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if ( iso2SignatureMethodType->HMACOutputLength_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger64(stream, iso2SignatureMethodType->HMACOutputLength);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 685;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 685;
			} else 			if ( iso2SignatureMethodType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2SignatureMethodType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SignatureMethodType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2SignatureMethodType->ANY.characters, iso2SignatureMethodType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 1856;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 685:
			/* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 685;
			} else 			if ( iso2SignatureMethodType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2SignatureMethodType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SignatureMethodType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2SignatureMethodType->ANY.characters, iso2SignatureMethodType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 685;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1856:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if ( iso2SignatureMethodType->HMACOutputLength_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger64(stream, iso2SignatureMethodType->HMACOutputLength);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 685;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 685;
			} else 			if ( iso2SignatureMethodType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2SignatureMethodType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SignatureMethodType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2SignatureMethodType->ANY.characters, iso2SignatureMethodType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 1856;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,AC_BidirectionalControlResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":EVSETargetPower,"urn:iso:15118:2:2016:MsgBody":EVSETargetReactivePower,"urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2016:MsgBody":ReceiptRequired{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2AC_BidirectionalControlResType(bitstream_t* stream, struct iso2AC_BidirectionalControlResType* iso2AC_BidirectionalControlResType) {
	int grammarID = 1857;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1857:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2AC_BidirectionalControlResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1858;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1858:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( iso2AC_BidirectionalControlResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2AC_BidirectionalControlResType->EVSEStatus );
				}
				grammarID = 1859;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2AC_BidirectionalControlResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1860;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1859:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2AC_BidirectionalControlResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1860;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1860:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSETargetPower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlResType->EVSETargetPower );
				}
				grammarID = 1861;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1861:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSETargetReactivePower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_BidirectionalControlResType->EVSETargetReactivePower );
				}
				grammarID = 27;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 27:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2AC_BidirectionalControlResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2AC_BidirectionalControlResType->EVSEID.characters, iso2AC_BidirectionalControlResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 28;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 28:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAScheduleTupleID), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeterInfo), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired), END_ELEMENT] */
			if ( iso2AC_BidirectionalControlResType->SAScheduleTupleID_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2AC_BidirectionalControlResType->SAScheduleTupleID - 1));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 29;
			} else 			if ( iso2AC_BidirectionalControlResType->MeterInfo_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2MeterInfoType(stream, &iso2AC_BidirectionalControlResType->MeterInfo );
				}
				grammarID = 30;
			} else 			if ( iso2AC_BidirectionalControlResType->ReceiptRequired_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2AC_BidirectionalControlResType->ReceiptRequired);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 29:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeterInfo), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired), END_ELEMENT] */
			if ( iso2AC_BidirectionalControlResType->MeterInfo_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MeterInfoType(stream, &iso2AC_BidirectionalControlResType->MeterInfo );
				}
				grammarID = 30;
			} else 			if ( iso2AC_BidirectionalControlResType->ReceiptRequired_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2AC_BidirectionalControlResType->ReceiptRequired);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 30:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired), END_ELEMENT] */
			if ( iso2AC_BidirectionalControlResType->ReceiptRequired_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2AC_BidirectionalControlResType->ReceiptRequired);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,VehicleCheckOutReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVCheckOutStatus,"urn:iso:15118:2:2016:MsgBody":CheckOutTime)',  derivedBy='EXTENSION'.  */
static int encode_iso2VehicleCheckOutReqType(bitstream_t* stream, struct iso2VehicleCheckOutReqType* iso2VehicleCheckOutReqType) {
	int grammarID = 1862;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1862:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVCheckOutStatus)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2VehicleCheckOutReqType->EVCheckOutStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1863;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1863:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CheckOutTime)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger64(stream, iso2VehicleCheckOutReqType->CheckOutTime);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,WeldingDetectionReqType',  base type name='BodyBaseType',  content type='EMPTY',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
static int encode_iso2WeldingDetectionReqType(bitstream_t* stream, struct iso2WeldingDetectionReqType* iso2WeldingDetectionReqType) {
	int grammarID = 674;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 674:
			/* FirstStartTag[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,AlignmentCheckResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":AlignmentCheckParameters{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2AlignmentCheckResType(bitstream_t* stream, struct iso2AlignmentCheckResType* iso2AlignmentCheckResType) {
	int grammarID = 1864;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1864:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2AlignmentCheckResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1865;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1865:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( iso2AlignmentCheckResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2AlignmentCheckResType->EVSEStatus );
				}
				grammarID = 1866;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2AlignmentCheckResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 676;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1866:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2AlignmentCheckResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 676;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 676:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AlignmentCheckParameters), END_ELEMENT] */
			if ( iso2AlignmentCheckResType->AlignmentCheckParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2AlignmentCheckResType->AlignmentCheckParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,PowerDemandReqType',  base type name='ChargeLoopReqType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1}),("urn:iso:15118:2:2016:MsgBody":EVTargetPower,"urn:iso:15118:2:2016:MsgBody":EVInputPower,"urn:iso:15118:2:2016:MsgBody":PowerDemandParameters{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2PowerDemandReqType(bitstream_t* stream, struct iso2PowerDemandReqType* iso2PowerDemandReqType) {
	int grammarID = 1867;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1867:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetEnergyRequest)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PowerDemandReqType->EVTargetEnergyRequest );
				}
				grammarID = 1868;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1868:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetPower)] */
			if ( iso2PowerDemandReqType->EVMaximumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PowerDemandReqType->EVMaximumEnergyRequest );
				}
				grammarID = 1869;
			} else 			if ( iso2PowerDemandReqType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PowerDemandReqType->EVMinimumEnergyRequest );
				}
				grammarID = 1870;
			} else 			if ( iso2PowerDemandReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2PowerDemandReqType->DisplayParameters );
				}
				grammarID = 1871;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PowerDemandReqType->EVTargetPower );
				}
				grammarID = 1872;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1869:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetPower)] */
			if ( iso2PowerDemandReqType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PowerDemandReqType->EVMinimumEnergyRequest );
				}
				grammarID = 1870;
			} else 			if ( iso2PowerDemandReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2PowerDemandReqType->DisplayParameters );
				}
				grammarID = 1871;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PowerDemandReqType->EVTargetPower );
				}
				grammarID = 1872;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1870:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetPower)] */
			if ( iso2PowerDemandReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2PowerDemandReqType->DisplayParameters );
				}
				grammarID = 1871;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PowerDemandReqType->EVTargetPower );
				}
				grammarID = 1872;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1871:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetPower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PowerDemandReqType->EVTargetPower );
				}
				grammarID = 1872;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1872:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVInputPower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PowerDemandReqType->EVInputPower );
				}
				grammarID = 1873;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1873:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandParameters), END_ELEMENT] */
			if ( iso2PowerDemandReqType->PowerDemandParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2PowerDemandReqType->PowerDemandParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MinimumPMaxRequestType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MinimumPMaxScheduleEntry{1-3})',  derivedBy='RESTRICTION'.  */
static int encode_iso2MinimumPMaxRequestType(bitstream_t* stream, struct iso2MinimumPMaxRequestType* iso2MinimumPMaxRequestType) {
	int grammarID = 1874;
	int done = 0;
	
	unsigned int iso2MinimumPMaxRequestType_MinimumPMaxScheduleEntry_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 1874:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MinimumPMaxScheduleEntry)] */
			if (iso2MinimumPMaxRequestType_MinimumPMaxScheduleEntry_currArrayIndex < iso2MinimumPMaxRequestType->MinimumPMaxScheduleEntry.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PMaxScheduleEntryType(stream, &iso2MinimumPMaxRequestType->MinimumPMaxScheduleEntry.array [iso2MinimumPMaxRequestType_MinimumPMaxScheduleEntry_currArrayIndex++]);
				}
				grammarID = 1875;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1875:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MinimumPMaxScheduleEntry), END_ELEMENT] */
			if (iso2MinimumPMaxRequestType_MinimumPMaxScheduleEntry_currArrayIndex < iso2MinimumPMaxRequestType->MinimumPMaxScheduleEntry.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PMaxScheduleEntryType(stream, &iso2MinimumPMaxRequestType->MinimumPMaxScheduleEntry.array [iso2MinimumPMaxRequestType_MinimumPMaxScheduleEntry_currArrayIndex++]);
				}
				grammarID = 1876;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1876:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MinimumPMaxScheduleEntry), END_ELEMENT] */
			if (iso2MinimumPMaxRequestType_MinimumPMaxScheduleEntry_currArrayIndex < iso2MinimumPMaxRequestType->MinimumPMaxScheduleEntry.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PMaxScheduleEntryType(stream, &iso2MinimumPMaxRequestType->MinimumPMaxScheduleEntry.array [iso2MinimumPMaxRequestType_MinimumPMaxScheduleEntry_currArrayIndex++]);
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,DisconnectChargingDeviceResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":EVSEElectricalChargingDeviceStatus,"urn:iso:15118:2:2016:MsgBody":EVSEMechanicalChargingDeviceStatus))',  derivedBy='EXTENSION'.  */
static int encode_iso2DisconnectChargingDeviceResType(bitstream_t* stream, struct iso2DisconnectChargingDeviceResType* iso2DisconnectChargingDeviceResType) {
	int grammarID = 591;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 591:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2DisconnectChargingDeviceResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 592;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 592:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( iso2DisconnectChargingDeviceResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2DisconnectChargingDeviceResType->EVSEStatus );
				}
				grammarID = 593;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2DisconnectChargingDeviceResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 594;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 593:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2DisconnectChargingDeviceResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 594;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 594:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEElectricalChargingDeviceStatus)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2DisconnectChargingDeviceResType->EVSEElectricalChargingDeviceStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 595;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 595:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMechanicalChargingDeviceStatus)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2DisconnectChargingDeviceResType->EVSEMechanicalChargingDeviceStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,SessionSetupReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVCCID)',  derivedBy='EXTENSION'.  */
static int encode_iso2SessionSetupReqType(bitstream_t* stream, struct iso2SessionSetupReqType* iso2SessionSetupReqType) {
	int grammarID = 1877;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1877:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVCCID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_HEX]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SessionSetupReqType->EVCCID.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2SessionSetupReqType->EVCCID.bytes, iso2SessionSetupReqType->EVCCID.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,PaymentDetailsReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":eMAID,"urn:iso:15118:2:2016:MsgBody":ContractSignatureCertChain)',  derivedBy='EXTENSION'.  */
static int encode_iso2PaymentDetailsReqType(bitstream_t* stream, struct iso2PaymentDetailsReqType* iso2PaymentDetailsReqType) {
	int grammarID = 1878;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1878:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}eMAID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2PaymentDetailsReqType->eMAID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2PaymentDetailsReqType->eMAID.characters, iso2PaymentDetailsReqType->eMAID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1879;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1879:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ContractSignatureCertChain)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2CertificateChainType(stream, &iso2PaymentDetailsReqType->ContractSignatureCertChain );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,Generic_EVFinePositioningParametersType',  base type name='EVFinePositioningParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":GenericParameters)',  derivedBy='EXTENSION'.  */
static int encode_iso2Generic_EVFinePositioningParametersType(bitstream_t* stream, struct iso2Generic_EVFinePositioningParametersType* iso2Generic_EVFinePositioningParametersType) {
	int grammarID = 1880;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1880:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}GenericParameters)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2Generic_EVFinePositioningParametersType->GenericParameters );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,ConnectChargingDeviceReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVElectricalChargingDeviceStatus,"urn:iso:15118:2:2016:MsgBody":EVMechanicalChargingDeviceStatus)',  derivedBy='EXTENSION'.  */
static int encode_iso2ConnectChargingDeviceReqType(bitstream_t* stream, struct iso2ConnectChargingDeviceReqType* iso2ConnectChargingDeviceReqType) {
	int grammarID = 1496;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1496:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVElectricalChargingDeviceStatus)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2ConnectChargingDeviceReqType->EVElectricalChargingDeviceStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1497;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1497:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMechanicalChargingDeviceStatus)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2ConnectChargingDeviceReqType->EVMechanicalChargingDeviceStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,AC_EVSEChargeParameterType',  base type name='EVSEEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSENominalVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSENominalFrequency)',  derivedBy='EXTENSION'.  */
static int encode_iso2AC_EVSEChargeParameterType(bitstream_t* stream, struct iso2AC_EVSEChargeParameterType* iso2AC_EVSEChargeParameterType) {
	int grammarID = 1881;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1881:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVSEChargeParameterType->EVSEMaximumChargeCurrent );
				}
				grammarID = 1882;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1882:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSENominalVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVSEChargeParameterType->EVSENominalVoltage );
				}
				grammarID = 58;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 58:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSENominalFrequency)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2AC_EVSEChargeParameterType->EVSENominalFrequency );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SalesTariffEntryType',  base type name='EntryType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":RelativeTimeInterval),("urn:iso:15118:2:2016:MsgDataTypes":EPriceLevel{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ConsumptionCost{0-3}))',  derivedBy='EXTENSION'.  */
static int encode_iso2SalesTariffEntryType(bitstream_t* stream, struct iso2SalesTariffEntryType* iso2SalesTariffEntryType) {
	int grammarID = 1883;
	int done = 0;
	
	unsigned int iso2SalesTariffEntryType_ConsumptionCost_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 1883:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RelativeTimeInterval)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2RelativeTimeIntervalType(stream, &iso2SalesTariffEntryType->RelativeTimeInterval );
				}
				grammarID = 1884;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1884:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EPriceLevel), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ConsumptionCost), END_ELEMENT] */
			if ( iso2SalesTariffEntryType->EPriceLevel_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SalesTariffEntryType->EPriceLevel - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1885;
			} else 			if (iso2SalesTariffEntryType_ConsumptionCost_currArrayIndex < iso2SalesTariffEntryType->ConsumptionCost.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2ConsumptionCostType(stream, &iso2SalesTariffEntryType->ConsumptionCost.array [iso2SalesTariffEntryType_ConsumptionCost_currArrayIndex++]);
				}
				grammarID = 1886;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1885:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ConsumptionCost), END_ELEMENT] */
			if (iso2SalesTariffEntryType_ConsumptionCost_currArrayIndex < iso2SalesTariffEntryType->ConsumptionCost.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ConsumptionCostType(stream, &iso2SalesTariffEntryType->ConsumptionCost.array [iso2SalesTariffEntryType_ConsumptionCost_currArrayIndex++]);
				}
				grammarID = 1886;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1886:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ConsumptionCost), END_ELEMENT] */
			if (iso2SalesTariffEntryType_ConsumptionCost_currArrayIndex < iso2SalesTariffEntryType->ConsumptionCost.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ConsumptionCostType(stream, &iso2SalesTariffEntryType->ConsumptionCost.array [iso2SalesTariffEntryType_ConsumptionCost_currArrayIndex++]);
				}
				grammarID = 1887;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1887:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ConsumptionCost), END_ELEMENT] */
			if (iso2SalesTariffEntryType_ConsumptionCost_currArrayIndex < iso2SalesTariffEntryType->ConsumptionCost.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ConsumptionCostType(stream, &iso2SalesTariffEntryType->ConsumptionCost.array [iso2SalesTariffEntryType_ConsumptionCost_currArrayIndex++]);
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DC_EVSEBidirectionalParameterType',  base type name='DC_EVSEChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSECurrentRegulationTolerance{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVSEPeakCurrentRipple,"urn:iso:15118:2:2016:MsgDataTypes":EVSEEnergyToBeDelivered{0-1}),("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumDischargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumDischargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumDischargeCurrent))',  derivedBy='EXTENSION'.  */
static int encode_iso2DC_EVSEBidirectionalParameterType(bitstream_t* stream, struct iso2DC_EVSEBidirectionalParameterType* iso2DC_EVSEBidirectionalParameterType) {
	int grammarID = 1888;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1888:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumChargePower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEBidirectionalParameterType->EVSEMaximumChargePower );
				}
				grammarID = 1889;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1889:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEBidirectionalParameterType->EVSEMaximumChargeCurrent );
				}
				grammarID = 1890;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1890:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMinimumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEBidirectionalParameterType->EVSEMinimumChargeCurrent );
				}
				grammarID = 1891;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1891:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEBidirectionalParameterType->EVSEMaximumVoltage );
				}
				grammarID = 1892;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1892:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMinimumVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEBidirectionalParameterType->EVSEMinimumVoltage );
				}
				grammarID = 1893;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1893:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSECurrentRegulationTolerance), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEPeakCurrentRipple)] */
			if ( iso2DC_EVSEBidirectionalParameterType->EVSECurrentRegulationTolerance_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEBidirectionalParameterType->EVSECurrentRegulationTolerance );
				}
				grammarID = 1894;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEBidirectionalParameterType->EVSEPeakCurrentRipple );
				}
				grammarID = 1895;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1894:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEPeakCurrentRipple)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEBidirectionalParameterType->EVSEPeakCurrentRipple );
				}
				grammarID = 1895;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1895:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEEnergyToBeDelivered), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumDischargePower)] */
			if ( iso2DC_EVSEBidirectionalParameterType->EVSEEnergyToBeDelivered_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEBidirectionalParameterType->EVSEEnergyToBeDelivered );
				}
				grammarID = 1896;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEBidirectionalParameterType->EVSEMaximumDischargePower );
				}
				grammarID = 1897;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1896:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumDischargePower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEBidirectionalParameterType->EVSEMaximumDischargePower );
				}
				grammarID = 1897;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1897:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumDischargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEBidirectionalParameterType->EVSEMaximumDischargeCurrent );
				}
				grammarID = 1898;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1898:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMinimumDischargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVSEBidirectionalParameterType->EVSEMinimumDischargeCurrent );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,CanonicalizationMethodType',  base type name='anyType',  content type='MIXED',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='((WC[##any]){0-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
static int encode_iso2CanonicalizationMethodType(bitstream_t* stream, struct iso2CanonicalizationMethodType* iso2CanonicalizationMethodType) {
	int grammarID = 1899;
	int done = 0;
	int wcDone = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1899:
			/* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2CanonicalizationMethodType->Algorithm.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2CanonicalizationMethodType->Algorithm.characters, iso2CanonicalizationMethodType->Algorithm.charactersLen);
					}
				}
				grammarID = 684;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 684:
			/* StartTag[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 685;
			} else 			if ( iso2CanonicalizationMethodType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2CanonicalizationMethodType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2CanonicalizationMethodType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2CanonicalizationMethodType->ANY.characters, iso2CanonicalizationMethodType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 685;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 685:
			/* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 685;
			} else 			if ( iso2CanonicalizationMethodType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2CanonicalizationMethodType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2CanonicalizationMethodType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2CanonicalizationMethodType->ANY.characters, iso2CanonicalizationMethodType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 685;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DisplayParametersType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":CurrentRange{0-1},"urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MinimumSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ChargingPerformance{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToTargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToBulkSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToMinimumSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ChargingComplete{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkChargingComplete{0-1},"urn:iso:15118:2:2016:MsgDataTypes":InletHot{0-1})',  derivedBy='RESTRICTION'.  */
static int encode_iso2DisplayParametersType(bitstream_t* stream, struct iso2DisplayParametersType* iso2DisplayParametersType) {
	int grammarID = 1900;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1900:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}CurrentRange), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}CurrentSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MinimumSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingPerformance), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToTargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToBulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToMinimumSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}InletHot), END_ELEMENT] */
			if ( iso2DisplayParametersType->CurrentRange_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2DisplayParametersType->CurrentRange);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1901;
			} else 			if ( iso2DisplayParametersType->CurrentSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->CurrentSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1902;
			} else 			if ( iso2DisplayParametersType->TargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->TargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1903;
			} else 			if ( iso2DisplayParametersType->BulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->BulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1904;
			} else 			if ( iso2DisplayParametersType->MinimumSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 4);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->MinimumSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1905;
			} else 			if ( iso2DisplayParametersType->ChargingPerformance_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 5);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DisplayParametersType->ChargingPerformance );
				}
				grammarID = 1906;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToTargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 6);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToTargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1907;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToBulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 7);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToBulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1908;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToMinimumSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 8);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToMinimumSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1909;
			} else 			if ( iso2DisplayParametersType->ChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 9);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->ChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1910;
			} else 			if ( iso2DisplayParametersType->BulkChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 10);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->BulkChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1911;
			} else 			if ( iso2DisplayParametersType->InletHot_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 11);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->InletHot);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 4, 12);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1901:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}CurrentSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MinimumSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingPerformance), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToTargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToBulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToMinimumSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}InletHot), END_ELEMENT] */
			if ( iso2DisplayParametersType->CurrentSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->CurrentSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1902;
			} else 			if ( iso2DisplayParametersType->TargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->TargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1903;
			} else 			if ( iso2DisplayParametersType->BulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->BulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1904;
			} else 			if ( iso2DisplayParametersType->MinimumSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->MinimumSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1905;
			} else 			if ( iso2DisplayParametersType->ChargingPerformance_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 4);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DisplayParametersType->ChargingPerformance );
				}
				grammarID = 1906;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToTargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 5);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToTargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1907;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToBulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 6);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToBulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1908;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToMinimumSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 7);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToMinimumSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1909;
			} else 			if ( iso2DisplayParametersType->ChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 8);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->ChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1910;
			} else 			if ( iso2DisplayParametersType->BulkChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 9);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->BulkChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1911;
			} else 			if ( iso2DisplayParametersType->InletHot_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 10);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->InletHot);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 4, 11);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1902:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MinimumSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingPerformance), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToTargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToBulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToMinimumSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}InletHot), END_ELEMENT] */
			if ( iso2DisplayParametersType->TargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->TargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1903;
			} else 			if ( iso2DisplayParametersType->BulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->BulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1904;
			} else 			if ( iso2DisplayParametersType->MinimumSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->MinimumSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1905;
			} else 			if ( iso2DisplayParametersType->ChargingPerformance_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DisplayParametersType->ChargingPerformance );
				}
				grammarID = 1906;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToTargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 4);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToTargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1907;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToBulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 5);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToBulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1908;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToMinimumSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 6);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToMinimumSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1909;
			} else 			if ( iso2DisplayParametersType->ChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 7);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->ChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1910;
			} else 			if ( iso2DisplayParametersType->BulkChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 8);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->BulkChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1911;
			} else 			if ( iso2DisplayParametersType->InletHot_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 9);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->InletHot);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 4, 10);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1903:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MinimumSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingPerformance), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToTargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToBulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToMinimumSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}InletHot), END_ELEMENT] */
			if ( iso2DisplayParametersType->BulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->BulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1904;
			} else 			if ( iso2DisplayParametersType->MinimumSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->MinimumSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1905;
			} else 			if ( iso2DisplayParametersType->ChargingPerformance_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DisplayParametersType->ChargingPerformance );
				}
				grammarID = 1906;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToTargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToTargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1907;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToBulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 4);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToBulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1908;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToMinimumSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 5);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToMinimumSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1909;
			} else 			if ( iso2DisplayParametersType->ChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 6);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->ChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1910;
			} else 			if ( iso2DisplayParametersType->BulkChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 7);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->BulkChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1911;
			} else 			if ( iso2DisplayParametersType->InletHot_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 8);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->InletHot);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 4, 9);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1904:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MinimumSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingPerformance), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToTargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToBulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToMinimumSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}InletHot), END_ELEMENT] */
			if ( iso2DisplayParametersType->MinimumSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->MinimumSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1905;
			} else 			if ( iso2DisplayParametersType->ChargingPerformance_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DisplayParametersType->ChargingPerformance );
				}
				grammarID = 1906;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToTargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToTargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1907;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToBulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToBulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1908;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToMinimumSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 4);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToMinimumSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1909;
			} else 			if ( iso2DisplayParametersType->ChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 5);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->ChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1910;
			} else 			if ( iso2DisplayParametersType->BulkChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 6);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->BulkChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1911;
			} else 			if ( iso2DisplayParametersType->InletHot_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 7);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->InletHot);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 4, 8);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1905:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingPerformance), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToTargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToBulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToMinimumSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}InletHot), END_ELEMENT] */
			if ( iso2DisplayParametersType->ChargingPerformance_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DisplayParametersType->ChargingPerformance );
				}
				grammarID = 1906;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToTargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToTargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1907;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToBulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToBulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1908;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToMinimumSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToMinimumSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1909;
			} else 			if ( iso2DisplayParametersType->ChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 4);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->ChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1910;
			} else 			if ( iso2DisplayParametersType->BulkChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 5);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->BulkChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1911;
			} else 			if ( iso2DisplayParametersType->InletHot_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 6);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->InletHot);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 4, 7);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1906:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToTargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToBulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToMinimumSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}InletHot), END_ELEMENT] */
			if ( iso2DisplayParametersType->RemainingTimeToTargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToTargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1907;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToBulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToBulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1908;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToMinimumSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToMinimumSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1909;
			} else 			if ( iso2DisplayParametersType->ChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->ChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1910;
			} else 			if ( iso2DisplayParametersType->BulkChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->BulkChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1911;
			} else 			if ( iso2DisplayParametersType->InletHot_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->InletHot);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 6);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1907:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToBulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToMinimumSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}InletHot), END_ELEMENT] */
			if ( iso2DisplayParametersType->RemainingTimeToBulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToBulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1908;
			} else 			if ( iso2DisplayParametersType->RemainingTimeToMinimumSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToMinimumSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1909;
			} else 			if ( iso2DisplayParametersType->ChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->ChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1910;
			} else 			if ( iso2DisplayParametersType->BulkChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->BulkChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1911;
			} else 			if ( iso2DisplayParametersType->InletHot_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->InletHot);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1908:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToMinimumSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}InletHot), END_ELEMENT] */
			if ( iso2DisplayParametersType->RemainingTimeToMinimumSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DisplayParametersType->RemainingTimeToMinimumSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1909;
			} else 			if ( iso2DisplayParametersType->ChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->ChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1910;
			} else 			if ( iso2DisplayParametersType->BulkChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->BulkChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1911;
			} else 			if ( iso2DisplayParametersType->InletHot_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->InletHot);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1909:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}InletHot), END_ELEMENT] */
			if ( iso2DisplayParametersType->ChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->ChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1910;
			} else 			if ( iso2DisplayParametersType->BulkChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->BulkChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1911;
			} else 			if ( iso2DisplayParametersType->InletHot_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->InletHot);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1910:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}InletHot), END_ELEMENT] */
			if ( iso2DisplayParametersType->BulkChargingComplete_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->BulkChargingComplete);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1911;
			} else 			if ( iso2DisplayParametersType->InletHot_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->InletHot);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1911:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}InletHot), END_ELEMENT] */
			if ( iso2DisplayParametersType->InletHot_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2DisplayParametersType->InletHot);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DC_EVBidirectionalParameterType',  base type name='DC_EVChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='((("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkSOC{0-1})),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumDischargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumDischargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumDischargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumDischargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":MinimumSOC{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2DC_EVBidirectionalParameterType(bitstream_t* stream, struct iso2DC_EVBidirectionalParameterType* iso2DC_EVBidirectionalParameterType) {
	int grammarID = 1912;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1912:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DepartureTime)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger32(stream, iso2DC_EVBidirectionalParameterType->DepartureTime);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1913;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1913:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumChargeCurrent)] */
			if ( iso2DC_EVBidirectionalParameterType->EVMaximumChargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumChargePower );
				}
				grammarID = 1914;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMinimumChargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMinimumChargePower );
				}
				grammarID = 1915;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumChargeCurrent );
				}
				grammarID = 1916;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1914:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumChargeCurrent)] */
			if ( iso2DC_EVBidirectionalParameterType->EVMinimumChargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMinimumChargePower );
				}
				grammarID = 1915;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumChargeCurrent );
				}
				grammarID = 1916;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1915:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumChargeCurrent );
				}
				grammarID = 1916;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1916:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMinimumChargeCurrent );
				}
				grammarID = 1917;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1917:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumVoltage );
				}
				grammarID = 1918;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1918:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVTargetEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}CurrentSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargeCurrent)] */
			if ( iso2DC_EVBidirectionalParameterType->EVTargetEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVTargetEnergyRequest );
				}
				grammarID = 1919;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMaximumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumEnergyRequest );
				}
				grammarID = 1920;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMinimumEnergyRequest );
				}
				grammarID = 1921;
			} else 			if ( iso2DC_EVBidirectionalParameterType->CurrentSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVBidirectionalParameterType->CurrentSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1922;
			} else 			if ( iso2DC_EVBidirectionalParameterType->TargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 4);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVBidirectionalParameterType->TargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1923;
			} else 			if ( iso2DC_EVBidirectionalParameterType->BulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 5);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVBidirectionalParameterType->BulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1924;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMaximumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 6);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumDischargePower );
				}
				grammarID = 1925;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 7);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower );
				}
				grammarID = 1926;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 8);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumDischargeCurrent );
				}
				grammarID = 1927;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1919:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}CurrentSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargeCurrent)] */
			if ( iso2DC_EVBidirectionalParameterType->EVMaximumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumEnergyRequest );
				}
				grammarID = 1920;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMinimumEnergyRequest );
				}
				grammarID = 1921;
			} else 			if ( iso2DC_EVBidirectionalParameterType->CurrentSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVBidirectionalParameterType->CurrentSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1922;
			} else 			if ( iso2DC_EVBidirectionalParameterType->TargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVBidirectionalParameterType->TargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1923;
			} else 			if ( iso2DC_EVBidirectionalParameterType->BulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 4);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVBidirectionalParameterType->BulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1924;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMaximumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 5);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumDischargePower );
				}
				grammarID = 1925;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 6);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower );
				}
				grammarID = 1926;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 7);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumDischargeCurrent );
				}
				grammarID = 1927;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1920:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}CurrentSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargeCurrent)] */
			if ( iso2DC_EVBidirectionalParameterType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMinimumEnergyRequest );
				}
				grammarID = 1921;
			} else 			if ( iso2DC_EVBidirectionalParameterType->CurrentSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVBidirectionalParameterType->CurrentSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1922;
			} else 			if ( iso2DC_EVBidirectionalParameterType->TargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVBidirectionalParameterType->TargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1923;
			} else 			if ( iso2DC_EVBidirectionalParameterType->BulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVBidirectionalParameterType->BulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1924;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMaximumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumDischargePower );
				}
				grammarID = 1925;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower );
				}
				grammarID = 1926;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 6);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumDischargeCurrent );
				}
				grammarID = 1927;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1921:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}CurrentSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargeCurrent)] */
			if ( iso2DC_EVBidirectionalParameterType->CurrentSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVBidirectionalParameterType->CurrentSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1922;
			} else 			if ( iso2DC_EVBidirectionalParameterType->TargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVBidirectionalParameterType->TargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1923;
			} else 			if ( iso2DC_EVBidirectionalParameterType->BulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVBidirectionalParameterType->BulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1924;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMaximumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumDischargePower );
				}
				grammarID = 1925;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower );
				}
				grammarID = 1926;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumDischargeCurrent );
				}
				grammarID = 1927;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1922:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargeCurrent)] */
			if ( iso2DC_EVBidirectionalParameterType->TargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVBidirectionalParameterType->TargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1923;
			} else 			if ( iso2DC_EVBidirectionalParameterType->BulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVBidirectionalParameterType->BulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1924;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMaximumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumDischargePower );
				}
				grammarID = 1925;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower );
				}
				grammarID = 1926;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumDischargeCurrent );
				}
				grammarID = 1927;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1923:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargeCurrent)] */
			if ( iso2DC_EVBidirectionalParameterType->BulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVBidirectionalParameterType->BulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1924;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMaximumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumDischargePower );
				}
				grammarID = 1925;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower );
				}
				grammarID = 1926;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumDischargeCurrent );
				}
				grammarID = 1927;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1924:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargeCurrent)] */
			if ( iso2DC_EVBidirectionalParameterType->EVMaximumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumDischargePower );
				}
				grammarID = 1925;
			} else 			if ( iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower );
				}
				grammarID = 1926;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumDischargeCurrent );
				}
				grammarID = 1927;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1925:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargeCurrent)] */
			if ( iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower );
				}
				grammarID = 1926;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumDischargeCurrent );
				}
				grammarID = 1927;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1926:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMaximumDischargeCurrent );
				}
				grammarID = 1927;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1927:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumDischargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMinimumDischargeCurrent );
				}
				grammarID = 1928;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1928:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVBidirectionalParameterType->EVMinimumVoltage );
				}
				grammarID = 1929;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1929:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MinimumSOC), END_ELEMENT] */
			if ( iso2DC_EVBidirectionalParameterType->MinimumSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVBidirectionalParameterType->MinimumSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,PaymentServiceSelectionReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":SelectedPaymentOption,"urn:iso:15118:2:2016:MsgBody":SelectedEnergyTransferService,"urn:iso:15118:2:2016:MsgBody":SelectedVASList{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2PaymentServiceSelectionReqType(bitstream_t* stream, struct iso2PaymentServiceSelectionReqType* iso2PaymentServiceSelectionReqType) {
	int grammarID = 1930;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1930:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SelectedPaymentOption)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2PaymentServiceSelectionReqType->SelectedPaymentOption);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1931;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1931:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SelectedEnergyTransferService)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2PaymentServiceSelectionReqType->SelectedEnergyTransferService );
				}
				grammarID = 1932;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1932:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SelectedVASList), END_ELEMENT] */
			if ( iso2PaymentServiceSelectionReqType->SelectedVASList_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceListType(stream, &iso2PaymentServiceSelectionReqType->SelectedVASList );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MagneticVectorType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":GAID,"urn:iso:15118:2:2016:MsgDataTypes":Distance,"urn:iso:15118:2:2016:MsgDataTypes":AngleGAtoVA,"urn:iso:15118:2:2016:MsgDataTypes":RotationVAtoGA,"urn:iso:15118:2:2016:MsgDataTypes":FODStatus)',  derivedBy='RESTRICTION'.  */
static int encode_iso2MagneticVectorType(bitstream_t* stream, struct iso2MagneticVectorType* iso2MagneticVectorType) {
	int grammarID = 1933;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1933:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}GAID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2MagneticVectorType->GAID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2MagneticVectorType->GAID.characters, iso2MagneticVectorType->GAID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1934;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1934:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Distance)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2MagneticVectorType->Distance);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1935;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1935:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AngleGAtoVA)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2MagneticVectorType->AngleGAtoVA );
				}
				grammarID = 1936;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1936:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RotationVAtoGA)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2MagneticVectorType->RotationVAtoGA );
				}
				grammarID = 1937;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1937:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}FODStatus)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2MagneticVectorType->FODStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
static int encode_iso2PhysicalValueType(bitstream_t* stream, struct iso2PhysicalValueType* iso2PhysicalValueType) {
	int grammarID = 1938;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1938:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Exponent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 3, (uint32_t)(iso2PhysicalValueType->Exponent + 3));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1939;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1939:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Value)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger16(stream, iso2PhysicalValueType->Value);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,SystemStatusReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":OperationMode,"urn:iso:15118:2:2016:MsgBody":EVMechanicalChargingDeviceStatus)',  derivedBy='EXTENSION'.  */
static int encode_iso2SystemStatusReqType(bitstream_t* stream, struct iso2SystemStatusReqType* iso2SystemStatusReqType) {
	int grammarID = 1940;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1940:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}OperationMode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2SystemStatusReqType->OperationMode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1497;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1497:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMechanicalChargingDeviceStatus)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2SystemStatusReqType->EVMechanicalChargingDeviceStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,SystemStatusResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":OperationMode,"urn:iso:15118:2:2016:MsgBody":EVSEMechanicalChargingDeviceStatus))',  derivedBy='EXTENSION'.  */
static int encode_iso2SystemStatusResType(bitstream_t* stream, struct iso2SystemStatusResType* iso2SystemStatusResType) {
	int grammarID = 1941;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1941:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2SystemStatusResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1942;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1942:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}OperationMode)] */
			if ( iso2SystemStatusResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2SystemStatusResType->EVSEStatus );
				}
				grammarID = 1943;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2SystemStatusResType->OperationMode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 595;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1943:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}OperationMode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2SystemStatusResType->OperationMode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 595;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 595:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMechanicalChargingDeviceStatus)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2SystemStatusResType->EVSEMechanicalChargingDeviceStatus);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEFinePositioningSetupParametersType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
static int encode_iso2EVSEFinePositioningSetupParametersType(bitstream_t* stream, struct iso2EVSEFinePositioningSetupParametersType* iso2EVSEFinePositioningSetupParametersType) {
	int grammarID = 674;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 674:
			/* FirstStartTag[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,V2GResponseType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2V2GResponseType(bitstream_t* stream, struct iso2V2GResponseType* iso2V2GResponseType) {
	int grammarID = 599;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 599:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2V2GResponseType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 600;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 600:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), END_ELEMENT] */
			if ( iso2V2GResponseType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2V2GResponseType->EVSEStatus );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,BodyType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":BodyElement)',  derivedBy='RESTRICTION'.  */
static int encode_iso2BodyType(bitstream_t* stream, struct iso2BodyType* iso2BodyType) {
	int grammarID = 1944;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1944:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AC_BidirectionalControlReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AC_BidirectionalControlRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AlignmentCheckReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AlignmentCheckRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AuthorizationReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AuthorizationRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}BodyElement), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CableCheckReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CableCheckRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateInstallationReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateInstallationRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateUpdateReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateUpdateRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargeParameterDiscoveryReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargeParameterDiscoveryRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingStatusReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingStatusRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ConnectChargingDeviceReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ConnectChargingDeviceRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CurrentDemandReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CurrentDemandRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DC_BidirectionalControlReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DC_BidirectionalControlRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisconnectChargingDeviceReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisconnectChargingDeviceRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningSetupReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningSetupRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeteringReceiptReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeteringReceiptRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PairingReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PairingRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentDetailsReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentDetailsRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentServiceSelectionReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentServiceSelectionRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDeliveryReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDeliveryRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PreChargeReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PreChargeRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDetailReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDetailRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDiscoveryReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDiscoveryRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionSetupReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionSetupRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionStopReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionStopRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SystemStatusReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SystemStatusRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}V2GRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}V2GResponse), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckInReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckInRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckOutReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckOutRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}WeldingDetectionReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}WeldingDetectionRes)] */
			if ( iso2BodyType->AC_BidirectionalControlReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 0);
				if(errn == 0) {
					errn = encode_iso2AC_BidirectionalControlReqType(stream, &iso2BodyType->AC_BidirectionalControlReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->AC_BidirectionalControlRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 1);
				if(errn == 0) {
					errn = encode_iso2AC_BidirectionalControlResType(stream, &iso2BodyType->AC_BidirectionalControlRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->AlignmentCheckReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 2);
				if(errn == 0) {
					errn = encode_iso2AlignmentCheckReqType(stream, &iso2BodyType->AlignmentCheckReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->AlignmentCheckRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 3);
				if(errn == 0) {
					errn = encode_iso2AlignmentCheckResType(stream, &iso2BodyType->AlignmentCheckRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->AuthorizationReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 4);
				if(errn == 0) {
					errn = encode_iso2AuthorizationReqType(stream, &iso2BodyType->AuthorizationReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->AuthorizationRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 5);
				if(errn == 0) {
					errn = encode_iso2AuthorizationResType(stream, &iso2BodyType->AuthorizationRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->BodyElement_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 6);
				if(errn == 0) {
					errn = encode_iso2BodyBaseType(stream, &iso2BodyType->BodyElement );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->CableCheckReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 7);
				if(errn == 0) {
					errn = encode_iso2CableCheckReqType(stream, &iso2BodyType->CableCheckReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->CableCheckRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 8);
				if(errn == 0) {
					errn = encode_iso2CableCheckResType(stream, &iso2BodyType->CableCheckRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->CertificateInstallationReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 9);
				if(errn == 0) {
					errn = encode_iso2CertificateInstallationReqType(stream, &iso2BodyType->CertificateInstallationReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->CertificateInstallationRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 10);
				if(errn == 0) {
					errn = encode_iso2CertificateInstallationResType(stream, &iso2BodyType->CertificateInstallationRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->CertificateUpdateReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 11);
				if(errn == 0) {
					errn = encode_iso2CertificateUpdateReqType(stream, &iso2BodyType->CertificateUpdateReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->CertificateUpdateRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 12);
				if(errn == 0) {
					errn = encode_iso2CertificateUpdateResType(stream, &iso2BodyType->CertificateUpdateRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->ChargeParameterDiscoveryReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 13);
				if(errn == 0) {
					errn = encode_iso2ChargeParameterDiscoveryReqType(stream, &iso2BodyType->ChargeParameterDiscoveryReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->ChargeParameterDiscoveryRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 14);
				if(errn == 0) {
					errn = encode_iso2ChargeParameterDiscoveryResType(stream, &iso2BodyType->ChargeParameterDiscoveryRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->ChargingStatusReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 15);
				if(errn == 0) {
					errn = encode_iso2ChargingStatusReqType(stream, &iso2BodyType->ChargingStatusReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->ChargingStatusRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 16);
				if(errn == 0) {
					errn = encode_iso2ChargingStatusResType(stream, &iso2BodyType->ChargingStatusRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->ConnectChargingDeviceReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 17);
				if(errn == 0) {
					errn = encode_iso2ConnectChargingDeviceReqType(stream, &iso2BodyType->ConnectChargingDeviceReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->ConnectChargingDeviceRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 18);
				if(errn == 0) {
					errn = encode_iso2ConnectChargingDeviceResType(stream, &iso2BodyType->ConnectChargingDeviceRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->CurrentDemandReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 19);
				if(errn == 0) {
					errn = encode_iso2CurrentDemandReqType(stream, &iso2BodyType->CurrentDemandReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->CurrentDemandRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 20);
				if(errn == 0) {
					errn = encode_iso2CurrentDemandResType(stream, &iso2BodyType->CurrentDemandRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->DC_BidirectionalControlReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 21);
				if(errn == 0) {
					errn = encode_iso2DC_BidirectionalControlReqType(stream, &iso2BodyType->DC_BidirectionalControlReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->DC_BidirectionalControlRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 22);
				if(errn == 0) {
					errn = encode_iso2DC_BidirectionalControlResType(stream, &iso2BodyType->DC_BidirectionalControlRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->DisconnectChargingDeviceReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 23);
				if(errn == 0) {
					errn = encode_iso2DisconnectChargingDeviceReqType(stream, &iso2BodyType->DisconnectChargingDeviceReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->DisconnectChargingDeviceRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 24);
				if(errn == 0) {
					errn = encode_iso2DisconnectChargingDeviceResType(stream, &iso2BodyType->DisconnectChargingDeviceRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->FinePositioningReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 25);
				if(errn == 0) {
					errn = encode_iso2FinePositioningReqType(stream, &iso2BodyType->FinePositioningReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->FinePositioningRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 26);
				if(errn == 0) {
					errn = encode_iso2FinePositioningResType(stream, &iso2BodyType->FinePositioningRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->FinePositioningSetupReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 27);
				if(errn == 0) {
					errn = encode_iso2FinePositioningSetupReqType(stream, &iso2BodyType->FinePositioningSetupReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->FinePositioningSetupRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 28);
				if(errn == 0) {
					errn = encode_iso2FinePositioningSetupResType(stream, &iso2BodyType->FinePositioningSetupRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->MeteringReceiptReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 29);
				if(errn == 0) {
					errn = encode_iso2MeteringReceiptReqType(stream, &iso2BodyType->MeteringReceiptReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->MeteringReceiptRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 30);
				if(errn == 0) {
					errn = encode_iso2MeteringReceiptResType(stream, &iso2BodyType->MeteringReceiptRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->PairingReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 31);
				if(errn == 0) {
					errn = encode_iso2PairingReqType(stream, &iso2BodyType->PairingReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->PairingRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 32);
				if(errn == 0) {
					errn = encode_iso2PairingResType(stream, &iso2BodyType->PairingRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->PaymentDetailsReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 33);
				if(errn == 0) {
					errn = encode_iso2PaymentDetailsReqType(stream, &iso2BodyType->PaymentDetailsReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->PaymentDetailsRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 34);
				if(errn == 0) {
					errn = encode_iso2PaymentDetailsResType(stream, &iso2BodyType->PaymentDetailsRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->PaymentServiceSelectionReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 35);
				if(errn == 0) {
					errn = encode_iso2PaymentServiceSelectionReqType(stream, &iso2BodyType->PaymentServiceSelectionReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->PaymentServiceSelectionRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 36);
				if(errn == 0) {
					errn = encode_iso2PaymentServiceSelectionResType(stream, &iso2BodyType->PaymentServiceSelectionRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->PowerDeliveryReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 37);
				if(errn == 0) {
					errn = encode_iso2PowerDeliveryReqType(stream, &iso2BodyType->PowerDeliveryReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->PowerDeliveryRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 38);
				if(errn == 0) {
					errn = encode_iso2PowerDeliveryResType(stream, &iso2BodyType->PowerDeliveryRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->PowerDemandReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 39);
				if(errn == 0) {
					errn = encode_iso2PowerDemandReqType(stream, &iso2BodyType->PowerDemandReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->PowerDemandRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 40);
				if(errn == 0) {
					errn = encode_iso2PowerDemandResType(stream, &iso2BodyType->PowerDemandRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->PreChargeReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 41);
				if(errn == 0) {
					errn = encode_iso2PreChargeReqType(stream, &iso2BodyType->PreChargeReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->PreChargeRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 42);
				if(errn == 0) {
					errn = encode_iso2PreChargeResType(stream, &iso2BodyType->PreChargeRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->ServiceDetailReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 43);
				if(errn == 0) {
					errn = encode_iso2ServiceDetailReqType(stream, &iso2BodyType->ServiceDetailReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->ServiceDetailRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 44);
				if(errn == 0) {
					errn = encode_iso2ServiceDetailResType(stream, &iso2BodyType->ServiceDetailRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->ServiceDiscoveryReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 45);
				if(errn == 0) {
					errn = encode_iso2ServiceDiscoveryReqType(stream, &iso2BodyType->ServiceDiscoveryReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->ServiceDiscoveryRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 46);
				if(errn == 0) {
					errn = encode_iso2ServiceDiscoveryResType(stream, &iso2BodyType->ServiceDiscoveryRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->SessionSetupReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 47);
				if(errn == 0) {
					errn = encode_iso2SessionSetupReqType(stream, &iso2BodyType->SessionSetupReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->SessionSetupRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 48);
				if(errn == 0) {
					errn = encode_iso2SessionSetupResType(stream, &iso2BodyType->SessionSetupRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->SessionStopReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 49);
				if(errn == 0) {
					errn = encode_iso2SessionStopReqType(stream, &iso2BodyType->SessionStopReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->SessionStopRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 50);
				if(errn == 0) {
					errn = encode_iso2SessionStopResType(stream, &iso2BodyType->SessionStopRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->SystemStatusReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 51);
				if(errn == 0) {
					errn = encode_iso2SystemStatusReqType(stream, &iso2BodyType->SystemStatusReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->SystemStatusRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 52);
				if(errn == 0) {
					errn = encode_iso2SystemStatusResType(stream, &iso2BodyType->SystemStatusRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->V2GRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 53);
				if(errn == 0) {
					errn = encode_iso2BodyBaseType(stream, &iso2BodyType->V2GRequest );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->V2GResponse_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 54);
				if(errn == 0) {
					errn = encode_iso2V2GResponseType(stream, &iso2BodyType->V2GResponse );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->VehicleCheckInReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 55);
				if(errn == 0) {
					errn = encode_iso2VehicleCheckInReqType(stream, &iso2BodyType->VehicleCheckInReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->VehicleCheckInRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 56);
				if(errn == 0) {
					errn = encode_iso2VehicleCheckInResType(stream, &iso2BodyType->VehicleCheckInRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->VehicleCheckOutReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 57);
				if(errn == 0) {
					errn = encode_iso2VehicleCheckOutReqType(stream, &iso2BodyType->VehicleCheckOutReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->VehicleCheckOutRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 58);
				if(errn == 0) {
					errn = encode_iso2VehicleCheckOutResType(stream, &iso2BodyType->VehicleCheckOutRes );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->WeldingDetectionReq_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 59);
				if(errn == 0) {
					errn = encode_iso2WeldingDetectionReqType(stream, &iso2BodyType->WeldingDetectionReq );
				}
				grammarID = 3;
			} else 			if ( iso2BodyType->WeldingDetectionRes_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 6, 60);
				if(errn == 0) {
					errn = encode_iso2WeldingDetectionResType(stream, &iso2BodyType->WeldingDetectionRes );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,PreChargeResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEPresentVoltage))',  derivedBy='EXTENSION'.  */
static int encode_iso2PreChargeResType(bitstream_t* stream, struct iso2PreChargeResType* iso2PreChargeResType) {
	int grammarID = 596;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 596:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2PreChargeResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 597;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 597:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPresentVoltage)] */
			if ( iso2PreChargeResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2PreChargeResType->EVSEStatus );
				}
				grammarID = 598;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PreChargeResType->EVSEPresentVoltage );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 598:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPresentVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PreChargeResType->EVSEPresentVoltage );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEFinePositioningParametersType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
static int encode_iso2EVSEFinePositioningParametersType(bitstream_t* stream, struct iso2EVSEFinePositioningParametersType* iso2EVSEFinePositioningParametersType) {
	int grammarID = 674;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 674:
			/* FirstStartTag[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,PaymentServiceSelectionResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2PaymentServiceSelectionResType(bitstream_t* stream, struct iso2PaymentServiceSelectionResType* iso2PaymentServiceSelectionResType) {
	int grammarID = 599;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 599:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2PaymentServiceSelectionResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 600;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 600:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), END_ELEMENT] */
			if ( iso2PaymentServiceSelectionResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2PaymentServiceSelectionResType->EVSEStatus );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,DigestMethodType',  base type name='anyType',  content type='MIXED',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
static int encode_iso2DigestMethodType(bitstream_t* stream, struct iso2DigestMethodType* iso2DigestMethodType) {
	int grammarID = 1899;
	int done = 0;
	int wcDone = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1899:
			/* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DigestMethodType->Algorithm.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2DigestMethodType->Algorithm.characters, iso2DigestMethodType->Algorithm.charactersLen);
					}
				}
				grammarID = 684;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 684:
			/* StartTag[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 685;
			} else 			if ( iso2DigestMethodType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2DigestMethodType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DigestMethodType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2DigestMethodType->ANY.characters, iso2DigestMethodType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 685;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 685:
			/* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 685;
			} else 			if ( iso2DigestMethodType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2DigestMethodType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DigestMethodType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2DigestMethodType->ANY.characters, iso2DigestMethodType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 685;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,TargetPositionType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":TargetOffsetX,"urn:iso:15118:2:2016:MsgDataTypes":TargetOffsetY)',  derivedBy='RESTRICTION'.  */
static int encode_iso2TargetPositionType(bitstream_t* stream, struct iso2TargetPositionType* iso2TargetPositionType) {
	int grammarID = 1945;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1945:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetOffsetX)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2TargetPositionType->TargetOffsetX);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1946;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1946:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetOffsetY)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2TargetPositionType->TargetOffsetY);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,LFA_EVFinePositioningParametersType',  base type name='EVFinePositioningParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NumberOfSignalPackages,"urn:iso:15118:2:2016:MsgDataTypes":SensorPackageList)',  derivedBy='EXTENSION'.  */
static int encode_iso2LFA_EVFinePositioningParametersType(bitstream_t* stream, struct iso2LFA_EVFinePositioningParametersType* iso2LFA_EVFinePositioningParametersType) {
	int grammarID = 670;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 670:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}NumberOfSignalPackages)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2LFA_EVFinePositioningParametersType->NumberOfSignalPackages - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 671;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 671:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackageList)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SensorPackageListType(stream, &iso2LFA_EVFinePositioningParametersType->SensorPackageList );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DC_EVChargeParameterType',  base type name='EVEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkSOC{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2DC_EVChargeParameterType(bitstream_t* stream, struct iso2DC_EVChargeParameterType* iso2DC_EVChargeParameterType) {
	int grammarID = 1947;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1947:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DepartureTime)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger32(stream, iso2DC_EVChargeParameterType->DepartureTime);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1948;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1948:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumChargeCurrent)] */
			if ( iso2DC_EVChargeParameterType->EVMaximumChargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVChargeParameterType->EVMaximumChargePower );
				}
				grammarID = 1949;
			} else 			if ( iso2DC_EVChargeParameterType->EVMinimumChargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVChargeParameterType->EVMinimumChargePower );
				}
				grammarID = 1950;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVChargeParameterType->EVMaximumChargeCurrent );
				}
				grammarID = 1951;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1949:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumChargeCurrent)] */
			if ( iso2DC_EVChargeParameterType->EVMinimumChargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVChargeParameterType->EVMinimumChargePower );
				}
				grammarID = 1950;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVChargeParameterType->EVMaximumChargeCurrent );
				}
				grammarID = 1951;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1950:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVChargeParameterType->EVMaximumChargeCurrent );
				}
				grammarID = 1951;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1951:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumChargeCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVChargeParameterType->EVMinimumChargeCurrent );
				}
				grammarID = 1952;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1952:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVChargeParameterType->EVMaximumVoltage );
				}
				grammarID = 1953;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1953:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVTargetEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}CurrentSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), END_ELEMENT] */
			if ( iso2DC_EVChargeParameterType->EVTargetEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVChargeParameterType->EVTargetEnergyRequest );
				}
				grammarID = 1954;
			} else 			if ( iso2DC_EVChargeParameterType->EVMaximumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVChargeParameterType->EVMaximumEnergyRequest );
				}
				grammarID = 1955;
			} else 			if ( iso2DC_EVChargeParameterType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVChargeParameterType->EVMinimumEnergyRequest );
				}
				grammarID = 1956;
			} else 			if ( iso2DC_EVChargeParameterType->CurrentSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVChargeParameterType->CurrentSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1957;
			} else 			if ( iso2DC_EVChargeParameterType->TargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVChargeParameterType->TargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1958;
			} else 			if ( iso2DC_EVChargeParameterType->BulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVChargeParameterType->BulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 6);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1954:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}CurrentSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), END_ELEMENT] */
			if ( iso2DC_EVChargeParameterType->EVMaximumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVChargeParameterType->EVMaximumEnergyRequest );
				}
				grammarID = 1955;
			} else 			if ( iso2DC_EVChargeParameterType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVChargeParameterType->EVMinimumEnergyRequest );
				}
				grammarID = 1956;
			} else 			if ( iso2DC_EVChargeParameterType->CurrentSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVChargeParameterType->CurrentSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1957;
			} else 			if ( iso2DC_EVChargeParameterType->TargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVChargeParameterType->TargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1958;
			} else 			if ( iso2DC_EVChargeParameterType->BulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVChargeParameterType->BulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1955:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}CurrentSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), END_ELEMENT] */
			if ( iso2DC_EVChargeParameterType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2DC_EVChargeParameterType->EVMinimumEnergyRequest );
				}
				grammarID = 1956;
			} else 			if ( iso2DC_EVChargeParameterType->CurrentSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVChargeParameterType->CurrentSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1957;
			} else 			if ( iso2DC_EVChargeParameterType->TargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVChargeParameterType->TargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1958;
			} else 			if ( iso2DC_EVChargeParameterType->BulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVChargeParameterType->BulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1956:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}CurrentSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), END_ELEMENT] */
			if ( iso2DC_EVChargeParameterType->CurrentSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVChargeParameterType->CurrentSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1957;
			} else 			if ( iso2DC_EVChargeParameterType->TargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVChargeParameterType->TargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1958;
			} else 			if ( iso2DC_EVChargeParameterType->BulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVChargeParameterType->BulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1957:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), END_ELEMENT] */
			if ( iso2DC_EVChargeParameterType->TargetSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVChargeParameterType->TargetSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1958;
			} else 			if ( iso2DC_EVChargeParameterType->BulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVChargeParameterType->BulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1958:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), END_ELEMENT] */
			if ( iso2DC_EVChargeParameterType->BulkSOC_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(iso2DC_EVChargeParameterType->BulkSOC - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,ServiceDetailReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ServiceID)',  derivedBy='EXTENSION'.  */
static int encode_iso2ServiceDetailReqType(bitstream_t* stream, struct iso2ServiceDetailReqType* iso2ServiceDetailReqType) {
	int grammarID = 1959;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1959:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2ServiceDetailReqType->ServiceID);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,PreChargeReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVTargetVoltage,"urn:iso:15118:2:2016:MsgBody":EVTargetCurrent)',  derivedBy='EXTENSION'.  */
static int encode_iso2PreChargeReqType(bitstream_t* stream, struct iso2PreChargeReqType* iso2PreChargeReqType) {
	int grammarID = 1960;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1960:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PreChargeReqType->EVTargetVoltage );
				}
				grammarID = 1961;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1961:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PreChargeReqType->EVTargetCurrent );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,ManifestType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Reference{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
static int encode_iso2ManifestType(bitstream_t* stream, struct iso2ManifestType* iso2ManifestType) {
	int grammarID = 1962;
	int done = 0;
	
	unsigned int iso2ManifestType_Reference_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 1962:
			/* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference)] */
			if ( iso2ManifestType->Id_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ManifestType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ManifestType->Id.characters, iso2ManifestType->Id.charactersLen);
					}
				}
				grammarID = 1963;
			} else 			if (iso2ManifestType_Reference_currArrayIndex < iso2ManifestType->Reference.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2ReferenceType(stream, &iso2ManifestType->Reference.array [iso2ManifestType_Reference_currArrayIndex++]);
				}
				grammarID = 1964;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1963:
			/* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference)] */
			if (iso2ManifestType_Reference_currArrayIndex < iso2ManifestType->Reference.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2ReferenceType(stream, &iso2ManifestType->Reference.array [iso2ManifestType_Reference_currArrayIndex++]);
				}
				grammarID = 1964;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1964:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference), END_ELEMENT] */
			if (iso2ManifestType_Reference_currArrayIndex < iso2ManifestType->Reference.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ReferenceType(stream, &iso2ManifestType->Reference.array [iso2ManifestType_Reference_currArrayIndex++]);
				}
				grammarID = 1964;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDef,#AnonType_V2G_Message',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDef":Header,"urn:iso:15118:2:2016:MsgDef":Body)',  derivedBy='RESTRICTION'.  */
static int encode_iso2AnonType_V2G_Message(bitstream_t* stream, struct iso2AnonType_V2G_Message* iso2AnonType_V2G_Message) {
	int grammarID = 1965;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1965:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDef}Header)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2MessageHeaderType(stream, &iso2AnonType_V2G_Message->Header );
				}
				grammarID = 1966;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1966:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDef}Body)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2BodyType(stream, &iso2AnonType_V2G_Message->Body );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SelectedServiceListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SelectedService{1-16})',  derivedBy='RESTRICTION'.  */
static int encode_iso2SelectedServiceListType(bitstream_t* stream, struct iso2SelectedServiceListType* iso2SelectedServiceListType) {
	int grammarID = 1967;
	int done = 0;
	
	unsigned int iso2SelectedServiceListType_SelectedService_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 1967:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService)] */
			if (iso2SelectedServiceListType_SelectedService_currArrayIndex < iso2SelectedServiceListType->SelectedService.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2SelectedServiceListType->SelectedService.array [iso2SelectedServiceListType_SelectedService_currArrayIndex++]);
				}
				grammarID = 1968;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1968:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService), END_ELEMENT] */
			if (iso2SelectedServiceListType_SelectedService_currArrayIndex < iso2SelectedServiceListType->SelectedService.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2SelectedServiceListType->SelectedService.array [iso2SelectedServiceListType_SelectedService_currArrayIndex++]);
				}
				grammarID = 1969;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1969:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService), END_ELEMENT] */
			if (iso2SelectedServiceListType_SelectedService_currArrayIndex < iso2SelectedServiceListType->SelectedService.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2SelectedServiceListType->SelectedService.array [iso2SelectedServiceListType_SelectedService_currArrayIndex++]);
				}
				grammarID = 1970;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1970:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService), END_ELEMENT] */
			if (iso2SelectedServiceListType_SelectedService_currArrayIndex < iso2SelectedServiceListType->SelectedService.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2SelectedServiceListType->SelectedService.array [iso2SelectedServiceListType_SelectedService_currArrayIndex++]);
				}
				grammarID = 1971;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1971:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService), END_ELEMENT] */
			if (iso2SelectedServiceListType_SelectedService_currArrayIndex < iso2SelectedServiceListType->SelectedService.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2SelectedServiceListType->SelectedService.array [iso2SelectedServiceListType_SelectedService_currArrayIndex++]);
				}
				grammarID = 1972;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1972:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService), END_ELEMENT] */
			if (iso2SelectedServiceListType_SelectedService_currArrayIndex < iso2SelectedServiceListType->SelectedService.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2SelectedServiceListType->SelectedService.array [iso2SelectedServiceListType_SelectedService_currArrayIndex++]);
				}
				grammarID = 1973;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1973:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService), END_ELEMENT] */
			if (iso2SelectedServiceListType_SelectedService_currArrayIndex < iso2SelectedServiceListType->SelectedService.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2SelectedServiceListType->SelectedService.array [iso2SelectedServiceListType_SelectedService_currArrayIndex++]);
				}
				grammarID = 1974;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1974:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService), END_ELEMENT] */
			if (iso2SelectedServiceListType_SelectedService_currArrayIndex < iso2SelectedServiceListType->SelectedService.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2SelectedServiceListType->SelectedService.array [iso2SelectedServiceListType_SelectedService_currArrayIndex++]);
				}
				grammarID = 1975;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1975:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService), END_ELEMENT] */
			if (iso2SelectedServiceListType_SelectedService_currArrayIndex < iso2SelectedServiceListType->SelectedService.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2SelectedServiceListType->SelectedService.array [iso2SelectedServiceListType_SelectedService_currArrayIndex++]);
				}
				grammarID = 1976;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1976:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService), END_ELEMENT] */
			if (iso2SelectedServiceListType_SelectedService_currArrayIndex < iso2SelectedServiceListType->SelectedService.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2SelectedServiceListType->SelectedService.array [iso2SelectedServiceListType_SelectedService_currArrayIndex++]);
				}
				grammarID = 1977;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1977:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService), END_ELEMENT] */
			if (iso2SelectedServiceListType_SelectedService_currArrayIndex < iso2SelectedServiceListType->SelectedService.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2SelectedServiceListType->SelectedService.array [iso2SelectedServiceListType_SelectedService_currArrayIndex++]);
				}
				grammarID = 1978;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1978:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService), END_ELEMENT] */
			if (iso2SelectedServiceListType_SelectedService_currArrayIndex < iso2SelectedServiceListType->SelectedService.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2SelectedServiceListType->SelectedService.array [iso2SelectedServiceListType_SelectedService_currArrayIndex++]);
				}
				grammarID = 1979;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1979:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService), END_ELEMENT] */
			if (iso2SelectedServiceListType_SelectedService_currArrayIndex < iso2SelectedServiceListType->SelectedService.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2SelectedServiceListType->SelectedService.array [iso2SelectedServiceListType_SelectedService_currArrayIndex++]);
				}
				grammarID = 1980;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1980:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService), END_ELEMENT] */
			if (iso2SelectedServiceListType_SelectedService_currArrayIndex < iso2SelectedServiceListType->SelectedService.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2SelectedServiceListType->SelectedService.array [iso2SelectedServiceListType_SelectedService_currArrayIndex++]);
				}
				grammarID = 1981;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1981:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService), END_ELEMENT] */
			if (iso2SelectedServiceListType_SelectedService_currArrayIndex < iso2SelectedServiceListType->SelectedService.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2SelectedServiceListType->SelectedService.array [iso2SelectedServiceListType_SelectedService_currArrayIndex++]);
				}
				grammarID = 1982;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1982:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService), END_ELEMENT] */
			if (iso2SelectedServiceListType_SelectedService_currArrayIndex < iso2SelectedServiceListType->SelectedService.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SelectedServiceType(stream, &iso2SelectedServiceListType->SelectedService.array [iso2SelectedServiceListType_SelectedService_currArrayIndex++]);
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,Generic_EVSEFinePositioningParametersType',  base type name='EVSEFinePositioningParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":GenericParameters)',  derivedBy='EXTENSION'.  */
static int encode_iso2Generic_EVSEFinePositioningParametersType(bitstream_t* stream, struct iso2Generic_EVSEFinePositioningParametersType* iso2Generic_EVSEFinePositioningParametersType) {
	int grammarID = 1880;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1880:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}GenericParameters)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2Generic_EVSEFinePositioningParametersType->GenericParameters );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,CartesianCoordinatesType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":XCoordinate,"urn:iso:15118:2:2016:MsgDataTypes":YCoordinate,"urn:iso:15118:2:2016:MsgDataTypes":ZCoordinate)',  derivedBy='RESTRICTION'.  */
static int encode_iso2CartesianCoordinatesType(bitstream_t* stream, struct iso2CartesianCoordinatesType* iso2CartesianCoordinatesType) {
	int grammarID = 1983;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 1983:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}XCoordinate)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger16(stream, iso2CartesianCoordinatesType->XCoordinate);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1984;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1984:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}YCoordinate)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger16(stream, iso2CartesianCoordinatesType->YCoordinate);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1985;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1985:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ZCoordinate)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger16(stream, iso2CartesianCoordinatesType->ZCoordinate);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,KeyInfoType',  base type name='anyType',  content type='MIXED',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":KeyName|"http://www.w3.org/2000/09/xmldsig#":KeyValue|"http://www.w3.org/2000/09/xmldsig#":RetrievalMethod|"http://www.w3.org/2000/09/xmldsig#":X509Data|"http://www.w3.org/2000/09/xmldsig#":PGPData|"http://www.w3.org/2000/09/xmldsig#":SPKIData|"http://www.w3.org/2000/09/xmldsig#":MgmtData|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"])){1-UNBOUNDED}',  derivedBy='RESTRICTION'.  */
static int encode_iso2KeyInfoType(bitstream_t* stream, struct iso2KeyInfoType* iso2KeyInfoType) {
	int grammarID = 1986;
	int done = 0;
	int wcDone = 0;
	
	unsigned int iso2KeyInfoType_KeyName_currArrayIndex = 0;
	unsigned int iso2KeyInfoType_KeyValue_currArrayIndex = 0;
	unsigned int iso2KeyInfoType_RetrievalMethod_currArrayIndex = 0;
	unsigned int iso2KeyInfoType_X509Data_currArrayIndex = 0;
	unsigned int iso2KeyInfoType_PGPData_currArrayIndex = 0;
	unsigned int iso2KeyInfoType_SPKIData_currArrayIndex = 0;
	unsigned int iso2KeyInfoType_MgmtData_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 1986:
			/* FirstStartTag[ATTRIBUTE[STRING](Id), 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#}RetrievalMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */
			if ( iso2KeyInfoType->Id_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2KeyInfoType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2KeyInfoType->Id.characters, iso2KeyInfoType->Id.charactersLen);
					}
				}
				grammarID = 1987;
			} else 			if (iso2KeyInfoType_KeyName_currArrayIndex < iso2KeyInfoType->KeyName.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 1);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2KeyInfoType->KeyName.array[iso2KeyInfoType_KeyName_currArrayIndex].charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2KeyInfoType->KeyName.array[iso2KeyInfoType_KeyName_currArrayIndex].characters, iso2KeyInfoType->KeyName.array[iso2KeyInfoType_KeyName_currArrayIndex].charactersLen);
							iso2KeyInfoType_KeyName_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_KeyValue_currArrayIndex < iso2KeyInfoType->KeyValue.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 2);
				if(errn == 0) {
					errn = encode_iso2KeyValueType(stream, &iso2KeyInfoType->KeyValue.array [iso2KeyInfoType_KeyValue_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_RetrievalMethod_currArrayIndex < iso2KeyInfoType->RetrievalMethod.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 3);
				if(errn == 0) {
					errn = encode_iso2RetrievalMethodType(stream, &iso2KeyInfoType->RetrievalMethod.array [iso2KeyInfoType_RetrievalMethod_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_X509Data_currArrayIndex < iso2KeyInfoType->X509Data.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 4);
				if(errn == 0) {
					errn = encode_iso2X509DataType(stream, &iso2KeyInfoType->X509Data.array [iso2KeyInfoType_X509Data_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_PGPData_currArrayIndex < iso2KeyInfoType->PGPData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 5);
				if(errn == 0) {
					errn = encode_iso2PGPDataType(stream, &iso2KeyInfoType->PGPData.array [iso2KeyInfoType_PGPData_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_SPKIData_currArrayIndex < iso2KeyInfoType->SPKIData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 6);
				if(errn == 0) {
					errn = encode_iso2SPKIDataType(stream, &iso2KeyInfoType->SPKIData.array [iso2KeyInfoType_SPKIData_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_MgmtData_currArrayIndex < iso2KeyInfoType->MgmtData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 7);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2KeyInfoType->MgmtData.array[iso2KeyInfoType_MgmtData_currArrayIndex].charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2KeyInfoType->MgmtData.array[iso2KeyInfoType_MgmtData_currArrayIndex].characters, iso2KeyInfoType->MgmtData.array[iso2KeyInfoType_MgmtData_currArrayIndex].charactersLen);
							iso2KeyInfoType_MgmtData_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1988;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 1988;
			} else 			if ( iso2KeyInfoType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 9);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2KeyInfoType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2KeyInfoType->ANY.characters, iso2KeyInfoType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 1989;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1987:
			/* StartTag[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#}RetrievalMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */
			if (iso2KeyInfoType_KeyName_currArrayIndex < iso2KeyInfoType->KeyName.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2KeyInfoType->KeyName.array[iso2KeyInfoType_KeyName_currArrayIndex].charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2KeyInfoType->KeyName.array[iso2KeyInfoType_KeyName_currArrayIndex].characters, iso2KeyInfoType->KeyName.array[iso2KeyInfoType_KeyName_currArrayIndex].charactersLen);
							iso2KeyInfoType_KeyName_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_KeyValue_currArrayIndex < iso2KeyInfoType->KeyValue.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 1);
				if(errn == 0) {
					errn = encode_iso2KeyValueType(stream, &iso2KeyInfoType->KeyValue.array [iso2KeyInfoType_KeyValue_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_RetrievalMethod_currArrayIndex < iso2KeyInfoType->RetrievalMethod.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 2);
				if(errn == 0) {
					errn = encode_iso2RetrievalMethodType(stream, &iso2KeyInfoType->RetrievalMethod.array [iso2KeyInfoType_RetrievalMethod_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_X509Data_currArrayIndex < iso2KeyInfoType->X509Data.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 3);
				if(errn == 0) {
					errn = encode_iso2X509DataType(stream, &iso2KeyInfoType->X509Data.array [iso2KeyInfoType_X509Data_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_PGPData_currArrayIndex < iso2KeyInfoType->PGPData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 4);
				if(errn == 0) {
					errn = encode_iso2PGPDataType(stream, &iso2KeyInfoType->PGPData.array [iso2KeyInfoType_PGPData_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_SPKIData_currArrayIndex < iso2KeyInfoType->SPKIData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 5);
				if(errn == 0) {
					errn = encode_iso2SPKIDataType(stream, &iso2KeyInfoType->SPKIData.array [iso2KeyInfoType_SPKIData_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_MgmtData_currArrayIndex < iso2KeyInfoType->MgmtData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 6);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2KeyInfoType->MgmtData.array[iso2KeyInfoType_MgmtData_currArrayIndex].charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2KeyInfoType->MgmtData.array[iso2KeyInfoType_MgmtData_currArrayIndex].characters, iso2KeyInfoType->MgmtData.array[iso2KeyInfoType_MgmtData_currArrayIndex].charactersLen);
							iso2KeyInfoType_MgmtData_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1988;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 1988;
			} else 			if ( iso2KeyInfoType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 8);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2KeyInfoType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2KeyInfoType->ANY.characters, iso2KeyInfoType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 1989;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1988:
			/* Element[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#}RetrievalMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */
			if (iso2KeyInfoType_KeyName_currArrayIndex < iso2KeyInfoType->KeyName.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2KeyInfoType->KeyName.array[iso2KeyInfoType_KeyName_currArrayIndex].charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2KeyInfoType->KeyName.array[iso2KeyInfoType_KeyName_currArrayIndex].characters, iso2KeyInfoType->KeyName.array[iso2KeyInfoType_KeyName_currArrayIndex].charactersLen);
							iso2KeyInfoType_KeyName_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_KeyValue_currArrayIndex < iso2KeyInfoType->KeyValue.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 1);
				if(errn == 0) {
					errn = encode_iso2KeyValueType(stream, &iso2KeyInfoType->KeyValue.array [iso2KeyInfoType_KeyValue_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_RetrievalMethod_currArrayIndex < iso2KeyInfoType->RetrievalMethod.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 2);
				if(errn == 0) {
					errn = encode_iso2RetrievalMethodType(stream, &iso2KeyInfoType->RetrievalMethod.array [iso2KeyInfoType_RetrievalMethod_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_X509Data_currArrayIndex < iso2KeyInfoType->X509Data.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 3);
				if(errn == 0) {
					errn = encode_iso2X509DataType(stream, &iso2KeyInfoType->X509Data.array [iso2KeyInfoType_X509Data_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_PGPData_currArrayIndex < iso2KeyInfoType->PGPData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 4);
				if(errn == 0) {
					errn = encode_iso2PGPDataType(stream, &iso2KeyInfoType->PGPData.array [iso2KeyInfoType_PGPData_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_SPKIData_currArrayIndex < iso2KeyInfoType->SPKIData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 5);
				if(errn == 0) {
					errn = encode_iso2SPKIDataType(stream, &iso2KeyInfoType->SPKIData.array [iso2KeyInfoType_SPKIData_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_MgmtData_currArrayIndex < iso2KeyInfoType->MgmtData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 6);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2KeyInfoType->MgmtData.array[iso2KeyInfoType_MgmtData_currArrayIndex].charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2KeyInfoType->MgmtData.array[iso2KeyInfoType_MgmtData_currArrayIndex].characters, iso2KeyInfoType->MgmtData.array[iso2KeyInfoType_MgmtData_currArrayIndex].charactersLen);
							iso2KeyInfoType_MgmtData_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1988;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 1988;
			} else 			if ( iso2KeyInfoType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 8);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else 			if ( iso2KeyInfoType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 9);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2KeyInfoType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2KeyInfoType->ANY.characters, iso2KeyInfoType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 1988;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1989:
			/* Element[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#}RetrievalMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */
			if (iso2KeyInfoType_KeyName_currArrayIndex < iso2KeyInfoType->KeyName.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2KeyInfoType->KeyName.array[iso2KeyInfoType_KeyName_currArrayIndex].charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2KeyInfoType->KeyName.array[iso2KeyInfoType_KeyName_currArrayIndex].characters, iso2KeyInfoType->KeyName.array[iso2KeyInfoType_KeyName_currArrayIndex].charactersLen);
							iso2KeyInfoType_KeyName_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_KeyValue_currArrayIndex < iso2KeyInfoType->KeyValue.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 1);
				if(errn == 0) {
					errn = encode_iso2KeyValueType(stream, &iso2KeyInfoType->KeyValue.array [iso2KeyInfoType_KeyValue_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_RetrievalMethod_currArrayIndex < iso2KeyInfoType->RetrievalMethod.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 2);
				if(errn == 0) {
					errn = encode_iso2RetrievalMethodType(stream, &iso2KeyInfoType->RetrievalMethod.array [iso2KeyInfoType_RetrievalMethod_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_X509Data_currArrayIndex < iso2KeyInfoType->X509Data.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 3);
				if(errn == 0) {
					errn = encode_iso2X509DataType(stream, &iso2KeyInfoType->X509Data.array [iso2KeyInfoType_X509Data_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_PGPData_currArrayIndex < iso2KeyInfoType->PGPData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 4);
				if(errn == 0) {
					errn = encode_iso2PGPDataType(stream, &iso2KeyInfoType->PGPData.array [iso2KeyInfoType_PGPData_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_SPKIData_currArrayIndex < iso2KeyInfoType->SPKIData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 5);
				if(errn == 0) {
					errn = encode_iso2SPKIDataType(stream, &iso2KeyInfoType->SPKIData.array [iso2KeyInfoType_SPKIData_currArrayIndex++]);
				}
				grammarID = 1988;
			} else 			if (iso2KeyInfoType_MgmtData_currArrayIndex < iso2KeyInfoType->MgmtData.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 6);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2KeyInfoType->MgmtData.array[iso2KeyInfoType_MgmtData_currArrayIndex].charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2KeyInfoType->MgmtData.array[iso2KeyInfoType_MgmtData_currArrayIndex].characters, iso2KeyInfoType->MgmtData.array[iso2KeyInfoType_MgmtData_currArrayIndex].charactersLen);
							iso2KeyInfoType_MgmtData_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1988;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 1988;
			} else 			if ( iso2KeyInfoType->ANY_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 4, 8);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2KeyInfoType->ANY.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2KeyInfoType->ANY.characters, iso2KeyInfoType->ANY.charactersLen);
					}
				}
				wcDone = 1;
				grammarID = 1989;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SubCertificatesType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Certificate{1-4})',  derivedBy='RESTRICTION'.  */
static int encode_iso2SubCertificatesType(bitstream_t* stream, struct iso2SubCertificatesType* iso2SubCertificatesType) {
	int grammarID = 1990;
	int done = 0;
	
	unsigned int iso2SubCertificatesType_Certificate_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 1990:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Certificate)] */
			if (iso2SubCertificatesType_Certificate_currArrayIndex < iso2SubCertificatesType->Certificate.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SubCertificatesType->Certificate.array[iso2SubCertificatesType_Certificate_currArrayIndex].bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2SubCertificatesType->Certificate.array[iso2SubCertificatesType_Certificate_currArrayIndex].bytes, iso2SubCertificatesType->Certificate.array[iso2SubCertificatesType_Certificate_currArrayIndex].bytesLen);
							iso2SubCertificatesType_Certificate_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1991;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1991:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Certificate), END_ELEMENT] */
			if (iso2SubCertificatesType_Certificate_currArrayIndex < iso2SubCertificatesType->Certificate.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SubCertificatesType->Certificate.array[iso2SubCertificatesType_Certificate_currArrayIndex].bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2SubCertificatesType->Certificate.array[iso2SubCertificatesType_Certificate_currArrayIndex].bytes, iso2SubCertificatesType->Certificate.array[iso2SubCertificatesType_Certificate_currArrayIndex].bytesLen);
							iso2SubCertificatesType_Certificate_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1992;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1992:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Certificate), END_ELEMENT] */
			if (iso2SubCertificatesType_Certificate_currArrayIndex < iso2SubCertificatesType->Certificate.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SubCertificatesType->Certificate.array[iso2SubCertificatesType_Certificate_currArrayIndex].bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2SubCertificatesType->Certificate.array[iso2SubCertificatesType_Certificate_currArrayIndex].bytes, iso2SubCertificatesType->Certificate.array[iso2SubCertificatesType_Certificate_currArrayIndex].bytesLen);
							iso2SubCertificatesType_Certificate_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1993;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1993:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Certificate), END_ELEMENT] */
			if (iso2SubCertificatesType_Certificate_currArrayIndex < iso2SubCertificatesType->Certificate.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SubCertificatesType->Certificate.array[iso2SubCertificatesType_Certificate_currArrayIndex].bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2SubCertificatesType->Certificate.array[iso2SubCertificatesType_Certificate_currArrayIndex].bytes, iso2SubCertificatesType->Certificate.array[iso2SubCertificatesType_Certificate_currArrayIndex].bytesLen);
							iso2SubCertificatesType_Certificate_currArrayIndex++;
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ListOfRootCertificateIDsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":RootCertificateID{1-20})',  derivedBy='RESTRICTION'.  */
static int encode_iso2ListOfRootCertificateIDsType(bitstream_t* stream, struct iso2ListOfRootCertificateIDsType* iso2ListOfRootCertificateIDsType) {
	int grammarID = 1994;
	int done = 0;
	
	unsigned int iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 1994:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID)] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 1995;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1995:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 1996;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1996:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 1997;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1997:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 1998;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1998:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 1999;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1999:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 2000;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2000:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 2001;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2001:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 2002;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2002:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 2003;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2003:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 2004;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2004:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 2005;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2005:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 2006;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2006:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 2007;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2007:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 2008;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2008:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 2009;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2009:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 2010;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2010:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 2011;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2011:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 2012;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2012:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 2013;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2013:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), END_ELEMENT] */
			if (iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex < iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2X509IssuerSerialType(stream, &iso2ListOfRootCertificateIDsType->RootCertificateID.array [iso2ListOfRootCertificateIDsType_RootCertificateID_currArrayIndex++]);
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVEnergyTransferParameterType',  base type name='anyType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime)',  derivedBy='RESTRICTION'.  */
static int encode_iso2EVEnergyTransferParameterType(bitstream_t* stream, struct iso2EVEnergyTransferParameterType* iso2EVEnergyTransferParameterType) {
	int grammarID = 2014;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2014:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DepartureTime)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger32(stream, iso2EVEnergyTransferParameterType->DepartureTime);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ContractSignatureEncryptedPrivateKeyType',  base type name='encryptedPrivateKeyType',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
static int encode_iso2ContractSignatureEncryptedPrivateKeyType(bitstream_t* stream, struct iso2ContractSignatureEncryptedPrivateKeyType* iso2ContractSignatureEncryptedPrivateKeyType) {
	int grammarID = 2015;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2015:
			/* FirstStartTag[ATTRIBUTE[STRING]({urn:iso:15118:2:2016:MsgDataTypes}Id)] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ContractSignatureEncryptedPrivateKeyType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2ContractSignatureEncryptedPrivateKeyType->Id.characters, iso2ContractSignatureEncryptedPrivateKeyType->Id.charactersLen);
					}
				}
				grammarID = 2016;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2016:
			/* StartTag[CHARACTERS[BINARY_BASE64]] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2ContractSignatureEncryptedPrivateKeyType->CONTENT.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, iso2ContractSignatureEncryptedPrivateKeyType->CONTENT.bytes, iso2ContractSignatureEncryptedPrivateKeyType->CONTENT.bytesLen);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MagneticVectorSetupListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MagneticVectorSetup{1-255})',  derivedBy='RESTRICTION'.  */
static int encode_iso2MagneticVectorSetupListType(bitstream_t* stream, struct iso2MagneticVectorSetupListType* iso2MagneticVectorSetupListType) {
	int grammarID = 2017;
	int done = 0;
	
	unsigned int iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 2017:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup)] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2018;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2018:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2019;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2019:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2020;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2020:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2021;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2021:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2022;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2022:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2023;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2023:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2024;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2024:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2025;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2025:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2026;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2026:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2027;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2027:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2028;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2028:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2029;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2029:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2030;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2030:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2031;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2031:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2032;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2032:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2033;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2033:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2034;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2034:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2035;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2035:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2036;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2036:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2037;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2037:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2038;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2038:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2039;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2039:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2040;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2040:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2041;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2041:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2042;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2042:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2043;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2043:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2044;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2044:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2045;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2045:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2046;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2046:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2047;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2047:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2048;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2048:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2049;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2049:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2050;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2050:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2051;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2051:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2052;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2052:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2053;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2053:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2054;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2054:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2055;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2055:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2056;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2056:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2057;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2057:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2058;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2058:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2059;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2059:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2060;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2060:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2061;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2061:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2062;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2062:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2063;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2063:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2064;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2064:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2065;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2065:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2066;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2066:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2067;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2067:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2068;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2068:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2069;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2069:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2070;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2070:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2071;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2071:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2072;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2072:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2073;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2073:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2074;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2074:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2075;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2075:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2076;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2076:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2077;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2077:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2078;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2078:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2079;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2079:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2080;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2080:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2081;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2081:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2082;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2082:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2083;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2083:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2084;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2084:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2085;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2085:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2086;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2086:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2087;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2087:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2088;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2088:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2089;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2089:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2090;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2090:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2091;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2091:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2092;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2092:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2093;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2093:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2094;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2094:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2095;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2095:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2096;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2096:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2097;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2097:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2098;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2098:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2099;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2099:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2100;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2100:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2101;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2101:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2102;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2102:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2103;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2103:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2104;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2104:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2105;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2105:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2106;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2106:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2107;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2107:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2108;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2108:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2109;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2109:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2110;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2110:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2111;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2111:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2112;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2112:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2113;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2113:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2114;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2114:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2115;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2115:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2116;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2116:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2117;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2117:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2118;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2118:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2119;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2119:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2120;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2120:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2121;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2121:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2122;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2122:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2123;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2123:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2124;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2124:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2125;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2125:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2126;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2126:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2127;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2127:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2128;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2128:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2129;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2129:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2130;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2130:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2131;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2131:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2132;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2132:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2133;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2133:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2134;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2134:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2135;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2135:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2136;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2136:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2137;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2137:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2138;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2138:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2139;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2139:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2140;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2140:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2141;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2141:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2142;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2142:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2143;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2143:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2144;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2144:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2145;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2145:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2146;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2146:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2147;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2147:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2148;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2148:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2149;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2149:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2150;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2150:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2151;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2151:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2152;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2152:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2153;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2153:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2154;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2154:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2155;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2155:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2156;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2156:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2157;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2157:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2158;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2158:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2159;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2159:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2160;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2160:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2161;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2161:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2162;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2162:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2163;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2163:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2164;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2164:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2165;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2165:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2166;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2166:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2167;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2167:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2168;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2168:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2169;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2169:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2170;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2170:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2171;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2171:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2172;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2172:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2173;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2173:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2174;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2174:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2175;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2175:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2176;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2176:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2177;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2177:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2178;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2178:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2179;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2179:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2180;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2180:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2181;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2181:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2182;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2182:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2183;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2183:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2184;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2184:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2185;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2185:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2186;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2186:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2187;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2187:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2188;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2188:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2189;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2189:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2190;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2190:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2191;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2191:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2192;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2192:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2193;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2193:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2194;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2194:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2195;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2195:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2196;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2196:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2197;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2197:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2198;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2198:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2199;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2199:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2200;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2200:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2201;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2201:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2202;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2202:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2203;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2203:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2204;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2204:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2205;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2205:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2206;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2206:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2207;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2207:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2208;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2208:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2209;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2209:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2210;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2210:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2211;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2211:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2212;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2212:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2213;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2213:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2214;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2214:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2215;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2215:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2216;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2216:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2217;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2217:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2218;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2218:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2219;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2219:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2220;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2220:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2221;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2221:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2222;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2222:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2223;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2223:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2224;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2224:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2225;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2225:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2226;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2226:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2227;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2227:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2228;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2228:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2229;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2229:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2230;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2230:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2231;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2231:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2232;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2232:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2233;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2233:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2234;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2234:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2235;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2235:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2236;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2236:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2237;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2237:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2238;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2238:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2239;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2239:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2240;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2240:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2241;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2241:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2242;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2242:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2243;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2243:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2244;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2244:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2245;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2245:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2246;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2246:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2247;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2247:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2248;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2248:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2249;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2249:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2250;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2250:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2251;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2251:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2252;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2252:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2253;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2253:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2254;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2254:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2255;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2255:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2256;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2256:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2257;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2257:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2258;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2258:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2259;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2259:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2260;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2260:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2261;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2261:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2262;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2262:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2263;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2263:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2264;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2264:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2265;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2265:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2266;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2266:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2267;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2267:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2268;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2268:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2269;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2269:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2270;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2270:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 2271;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2271:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), END_ELEMENT] */
			if (iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex < iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MagneticVectorSetupType(stream, &iso2MagneticVectorSetupListType->MagneticVectorSetup.array [iso2MagneticVectorSetupListType_MagneticVectorSetup_currArrayIndex++]);
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,PairingReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVProcessing,"urn:iso:15118:2:2016:MsgBody":PairingParameters{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2PairingReqType(bitstream_t* stream, struct iso2PairingReqType* iso2PairingReqType) {
	int grammarID = 2272;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2272:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVProcessing)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2PairingReqType->EVProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1827;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1827:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PairingParameters), END_ELEMENT] */
			if ( iso2PairingReqType->PairingParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2PairingReqType->PairingParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,CurrentDemandResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEPresentCurrent,"urn:iso:15118:2:2016:MsgBody":EVSEPresentVoltage,"urn:iso:15118:2:2016:MsgBody":EVSEPowerLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSECurrentLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSEVoltageLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSEMaximumPower{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumVoltage{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2016:MsgBody":ReceiptRequired{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2CurrentDemandResType(bitstream_t* stream, struct iso2CurrentDemandResType* iso2CurrentDemandResType) {
	int grammarID = 2273;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2273:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2CurrentDemandResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2274;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2274:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPresentCurrent)] */
			if ( iso2CurrentDemandResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2CurrentDemandResType->EVSEStatus );
				}
				grammarID = 2275;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandResType->EVSEPresentCurrent );
				}
				grammarID = 2276;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2275:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPresentCurrent)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandResType->EVSEPresentCurrent );
				}
				grammarID = 2276;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2276:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPresentVoltage)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandResType->EVSEPresentVoltage );
				}
				grammarID = 2277;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2277:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPowerLimitAchieved)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2CurrentDemandResType->EVSEPowerLimitAchieved);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2278;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2278:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSECurrentLimitAchieved)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2CurrentDemandResType->EVSECurrentLimitAchieved);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2279;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2279:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEVoltageLimitAchieved)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2CurrentDemandResType->EVSEVoltageLimitAchieved);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2280;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2280:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumPower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( iso2CurrentDemandResType->EVSEMaximumPower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandResType->EVSEMaximumPower );
				}
				grammarID = 2281;
			} else 			if ( iso2CurrentDemandResType->EVSEMaximumCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandResType->EVSEMaximumCurrent );
				}
				grammarID = 2282;
			} else 			if ( iso2CurrentDemandResType->EVSEMaximumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandResType->EVSEMaximumVoltage );
				}
				grammarID = 27;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2CurrentDemandResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2CurrentDemandResType->EVSEID.characters, iso2CurrentDemandResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 28;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2281:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( iso2CurrentDemandResType->EVSEMaximumCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandResType->EVSEMaximumCurrent );
				}
				grammarID = 2282;
			} else 			if ( iso2CurrentDemandResType->EVSEMaximumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandResType->EVSEMaximumVoltage );
				}
				grammarID = 27;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2CurrentDemandResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2CurrentDemandResType->EVSEID.characters, iso2CurrentDemandResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 28;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2282:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( iso2CurrentDemandResType->EVSEMaximumVoltage_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2CurrentDemandResType->EVSEMaximumVoltage );
				}
				grammarID = 27;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2CurrentDemandResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2CurrentDemandResType->EVSEID.characters, iso2CurrentDemandResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 28;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 27:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2CurrentDemandResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2CurrentDemandResType->EVSEID.characters, iso2CurrentDemandResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 28;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 28:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAScheduleTupleID), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeterInfo), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired), END_ELEMENT] */
			if ( iso2CurrentDemandResType->SAScheduleTupleID_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2CurrentDemandResType->SAScheduleTupleID - 1));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 29;
			} else 			if ( iso2CurrentDemandResType->MeterInfo_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2MeterInfoType(stream, &iso2CurrentDemandResType->MeterInfo );
				}
				grammarID = 30;
			} else 			if ( iso2CurrentDemandResType->ReceiptRequired_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2CurrentDemandResType->ReceiptRequired);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 29:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeterInfo), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired), END_ELEMENT] */
			if ( iso2CurrentDemandResType->MeterInfo_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2MeterInfoType(stream, &iso2CurrentDemandResType->MeterInfo );
				}
				grammarID = 30;
			} else 			if ( iso2CurrentDemandResType->ReceiptRequired_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2CurrentDemandResType->ReceiptRequired);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 30:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired), END_ELEMENT] */
			if ( iso2CurrentDemandResType->ReceiptRequired_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2CurrentDemandResType->ReceiptRequired);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,X509IssuerSerialType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":X509IssuerName,"http://www.w3.org/2000/09/xmldsig#":X509SerialNumber)',  derivedBy='RESTRICTION'.  */
static int encode_iso2X509IssuerSerialType(bitstream_t* stream, struct iso2X509IssuerSerialType* iso2X509IssuerSerialType) {
	int grammarID = 2283;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2283:
			/* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerName)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2X509IssuerSerialType->X509IssuerName.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2X509IssuerSerialType->X509IssuerName.characters, iso2X509IssuerSerialType->X509IssuerName.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2284;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2284:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SerialNumber)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeInteger64(stream, iso2X509IssuerSerialType->X509SerialNumber);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,ChargingStatusReqType',  base type name='ChargeLoopReqType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1}),("urn:iso:15118:2:2016:MsgBody":EVMaximumChargePower{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumChargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumChargeCurrent{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2ChargingStatusReqType(bitstream_t* stream, struct iso2ChargingStatusReqType* iso2ChargingStatusReqType) {
	int grammarID = 2285;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2285:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetEnergyRequest)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVTargetEnergyRequest );
				}
				grammarID = 2286;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2286:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumChargeCurrent), END_ELEMENT] */
			if ( iso2ChargingStatusReqType->EVMaximumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMaximumEnergyRequest );
				}
				grammarID = 2287;
			} else 			if ( iso2ChargingStatusReqType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMinimumEnergyRequest );
				}
				grammarID = 2288;
			} else 			if ( iso2ChargingStatusReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2ChargingStatusReqType->DisplayParameters );
				}
				grammarID = 2289;
			} else 			if ( iso2ChargingStatusReqType->EVMaximumChargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMaximumChargePower );
				}
				grammarID = 2290;
			} else 			if ( iso2ChargingStatusReqType->EVMaximumChargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMaximumChargeCurrent );
				}
				grammarID = 2291;
			} else 			if ( iso2ChargingStatusReqType->EVMinimumChargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMinimumChargeCurrent );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 6);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2287:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumChargeCurrent), END_ELEMENT] */
			if ( iso2ChargingStatusReqType->EVMinimumEnergyRequest_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMinimumEnergyRequest );
				}
				grammarID = 2288;
			} else 			if ( iso2ChargingStatusReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2ChargingStatusReqType->DisplayParameters );
				}
				grammarID = 2289;
			} else 			if ( iso2ChargingStatusReqType->EVMaximumChargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMaximumChargePower );
				}
				grammarID = 2290;
			} else 			if ( iso2ChargingStatusReqType->EVMaximumChargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMaximumChargeCurrent );
				}
				grammarID = 2291;
			} else 			if ( iso2ChargingStatusReqType->EVMinimumChargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMinimumChargeCurrent );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2288:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumChargeCurrent), END_ELEMENT] */
			if ( iso2ChargingStatusReqType->DisplayParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2DisplayParametersType(stream, &iso2ChargingStatusReqType->DisplayParameters );
				}
				grammarID = 2289;
			} else 			if ( iso2ChargingStatusReqType->EVMaximumChargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMaximumChargePower );
				}
				grammarID = 2290;
			} else 			if ( iso2ChargingStatusReqType->EVMaximumChargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMaximumChargeCurrent );
				}
				grammarID = 2291;
			} else 			if ( iso2ChargingStatusReqType->EVMinimumChargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMinimumChargeCurrent );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2289:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumChargeCurrent), END_ELEMENT] */
			if ( iso2ChargingStatusReqType->EVMaximumChargePower_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMaximumChargePower );
				}
				grammarID = 2290;
			} else 			if ( iso2ChargingStatusReqType->EVMaximumChargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMaximumChargeCurrent );
				}
				grammarID = 2291;
			} else 			if ( iso2ChargingStatusReqType->EVMinimumChargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMinimumChargeCurrent );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2290:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumChargeCurrent), END_ELEMENT] */
			if ( iso2ChargingStatusReqType->EVMaximumChargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMaximumChargeCurrent );
				}
				grammarID = 2291;
			} else 			if ( iso2ChargingStatusReqType->EVMinimumChargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMinimumChargeCurrent );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2291:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumChargeCurrent), END_ELEMENT] */
			if ( iso2ChargingStatusReqType->EVMinimumChargeCurrent_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2ChargingStatusReqType->EVMinimumChargeCurrent );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,CertificateInstallationResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":SAProvisioningCertificateChain,"urn:iso:15118:2:2016:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2016:MsgBody":ContractSignatureEncryptedPrivateKey,"urn:iso:15118:2:2016:MsgBody":DHpublickey,"urn:iso:15118:2:2016:MsgBody":eMAID))',  derivedBy='EXTENSION'.  */
static int encode_iso2CertificateInstallationResType(bitstream_t* stream, struct iso2CertificateInstallationResType* iso2CertificateInstallationResType) {
	int grammarID = 2292;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2292:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2CertificateInstallationResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2293;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2293:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAProvisioningCertificateChain)] */
			if ( iso2CertificateInstallationResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2CertificateInstallationResType->EVSEStatus );
				}
				grammarID = 2294;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2CertificateChainType(stream, &iso2CertificateInstallationResType->SAProvisioningCertificateChain );
				}
				grammarID = 2295;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2294:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAProvisioningCertificateChain)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2CertificateChainType(stream, &iso2CertificateInstallationResType->SAProvisioningCertificateChain );
				}
				grammarID = 2295;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2295:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ContractSignatureCertChain)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2CertificateChainType(stream, &iso2CertificateInstallationResType->ContractSignatureCertChain );
				}
				grammarID = 2296;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2296:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ContractSignatureEncryptedPrivateKey)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2ContractSignatureEncryptedPrivateKeyType(stream, &iso2CertificateInstallationResType->ContractSignatureEncryptedPrivateKey );
				}
				grammarID = 2297;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2297:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DHpublickey)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2DiffieHellmanPublickeyType(stream, &iso2CertificateInstallationResType->DHpublickey );
				}
				grammarID = 2298;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2298:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}eMAID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2EMAIDType(stream, &iso2CertificateInstallationResType->eMAID );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorPackageType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":PackageIndex,"urn:iso:15118:2:2016:MsgDataTypes":SensorMeasurements{1-255})',  derivedBy='RESTRICTION'.  */
static int encode_iso2SensorPackageType(bitstream_t* stream, struct iso2SensorPackageType* iso2SensorPackageType) {
	int grammarID = 2299;
	int done = 0;
	
	unsigned int iso2SensorPackageType_SensorMeasurements_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 2299:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PackageIndex)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger32(stream, iso2SensorPackageType->PackageIndex);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2300;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2300:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements)] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2301;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2301:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2302;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2302:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2303;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2303:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2304;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2304:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2305;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2305:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2306;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2306:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2307;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2307:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2308;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2308:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2309;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2309:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2310;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2310:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2311;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2311:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2312;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2312:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2313;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2313:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2314;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2314:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2315;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2315:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2316;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2316:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2317;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2317:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2318;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2318:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2319;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2319:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2320;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2320:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2321;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2321:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2322;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2322:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2323;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2323:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2324;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2324:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2325;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2325:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2326;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2326:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2327;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2327:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2328;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2328:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2329;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2329:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2330;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2330:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2331;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2331:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2332;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2332:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2333;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2333:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2334;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2334:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2335;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2335:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2336;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2336:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2337;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2337:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2338;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2338:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2339;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2339:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2340;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2340:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2341;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2341:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2342;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2342:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2343;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2343:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2344;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2344:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2345;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2345:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2346;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2346:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2347;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2347:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2348;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2348:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2349;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2349:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2350;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2350:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2351;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2351:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2352;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2352:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2353;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2353:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2354;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2354:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2355;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2355:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2356;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2356:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2357;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2357:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2358;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2358:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2359;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2359:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2360;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2360:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2361;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2361:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2362;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2362:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2363;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2363:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2364;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2364:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2365;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2365:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2366;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2366:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2367;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2367:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2368;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2368:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2369;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2369:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2370;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2370:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2371;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2371:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2372;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2372:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2373;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2373:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2374;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2374:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2375;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2375:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2376;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2376:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2377;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2377:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2378;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2378:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2379;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2379:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2380;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2380:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2381;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2381:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2382;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2382:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2383;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2383:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2384;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2384:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2385;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2385:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2386;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2386:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2387;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2387:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2388;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2388:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2389;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2389:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2390;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2390:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2391;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2391:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2392;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2392:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2393;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2393:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2394;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2394:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2395;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2395:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2396;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2396:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2397;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2397:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2398;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2398:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2399;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2399:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2400;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2400:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2401;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2401:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2402;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2402:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2403;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2403:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2404;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2404:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2405;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2405:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2406;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2406:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2407;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2407:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2408;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2408:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2409;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2409:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2410;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2410:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2411;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2411:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2412;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2412:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2413;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2413:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2414;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2414:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2415;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2415:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2416;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2416:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2417;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2417:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2418;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2418:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2419;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2419:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2420;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2420:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2421;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2421:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2422;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2422:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2423;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2423:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2424;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2424:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2425;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2425:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2426;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2426:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2427;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2427:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2428;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2428:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2429;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2429:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2430;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2430:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2431;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2431:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2432;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2432:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2433;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2433:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2434;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2434:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2435;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2435:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2436;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2436:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2437;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2437:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2438;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2438:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2439;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2439:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2440;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2440:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2441;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2441:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2442;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2442:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2443;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2443:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2444;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2444:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2445;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2445:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2446;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2446:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2447;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2447:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2448;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2448:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2449;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2449:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2450;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2450:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2451;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2451:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2452;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2452:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2453;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2453:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2454;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2454:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2455;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2455:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2456;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2456:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2457;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2457:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2458;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2458:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2459;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2459:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2460;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2460:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2461;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2461:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2462;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2462:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2463;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2463:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2464;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2464:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2465;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2465:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2466;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2466:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2467;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2467:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2468;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2468:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2469;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2469:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2470;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2470:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2471;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2471:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2472;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2472:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2473;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2473:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2474;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2474:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2475;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2475:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2476;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2476:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2477;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2477:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2478;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2478:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2479;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2479:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2480;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2480:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2481;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2481:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2482;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2482:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2483;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2483:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2484;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2484:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2485;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2485:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2486;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2486:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2487;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2487:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2488;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2488:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2489;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2489:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2490;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2490:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2491;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2491:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2492;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2492:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2493;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2493:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2494;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2494:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2495;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2495:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2496;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2496:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2497;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2497:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2498;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2498:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2499;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2499:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2500;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2500:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2501;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2501:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2502;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2502:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2503;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2503:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2504;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2504:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2505;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2505:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2506;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2506:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2507;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2507:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2508;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2508:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2509;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2509:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2510;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2510:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2511;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2511:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2512;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2512:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2513;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2513:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2514;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2514:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2515;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2515:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2516;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2516:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2517;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2517:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2518;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2518:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2519;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2519:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2520;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2520:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2521;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2521:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2522;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2522:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2523;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2523:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2524;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2524:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2525;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2525:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2526;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2526:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2527;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2527:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2528;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2528:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2529;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2529:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2530;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2530:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2531;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2531:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2532;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2532:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2533;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2533:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2534;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2534:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2535;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2535:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2536;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2536:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2537;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2537:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2538;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2538:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2539;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2539:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2540;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2540:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2541;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2541:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2542;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2542:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2543;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2543:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2544;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2544:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2545;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2545:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2546;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2546:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2547;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2547:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2548;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2548:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2549;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2549:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2550;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2550:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2551;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2551:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2552;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2552:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2553;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2553:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 2554;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2554:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), END_ELEMENT] */
			if (iso2SensorPackageType_SensorMeasurements_currArrayIndex < iso2SensorPackageType->SensorMeasurements.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SensorMeasurementsType(stream, &iso2SensorPackageType->SensorMeasurements.array [iso2SensorPackageType_SensorMeasurements_currArrayIndex++]);
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,PGPDataType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("http://www.w3.org/2000/09/xmldsig#":PGPKeyID,"http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket{0-1},(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})|("http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket,(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED}))',  derivedBy='RESTRICTION'.  */
static int encode_iso2PGPDataType(bitstream_t* stream, struct iso2PGPDataType* iso2PGPDataType) {
	int grammarID = 2555;
	int done = 0;
	int wcDone = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2555:
			/* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyID), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket)] */
			if ( iso2PGPDataType->PGPKeyID_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2PGPDataType->PGPKeyID.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2PGPDataType->PGPKeyID.bytes, iso2PGPDataType->PGPKeyID.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2556;
			} else 			if ( iso2PGPDataType->PGPKeyPacket_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2PGPDataType->PGPKeyPacket.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2PGPDataType->PGPKeyPacket.bytes, iso2PGPDataType->PGPKeyPacket.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2557;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2556:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket), START_ELEMENT_GENERIC, END_ELEMENT] */
			if ( iso2PGPDataType->PGPKeyPacket_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2PGPDataType->PGPKeyPacket.bytesLen));
						if (errn == 0) {
							errn = encodeBytes(stream, iso2PGPDataType->PGPKeyPacket.bytes, iso2PGPDataType->PGPKeyPacket.bytesLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2557;
			} else 			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 2557;
			} else 			if ( iso2PGPDataType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2557:
			/* Element[START_ELEMENT_GENERIC, END_ELEMENT] */
			if (1==0) {
				errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
				grammarID = 2557;
			} else 			if ( iso2PGPDataType->ANY_isUsed == 0u || wcDone ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,ServiceDiscoveryResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":PaymentOptionList,"urn:iso:15118:2:2016:MsgBody":EnergyTransferServiceList,"urn:iso:15118:2:2016:MsgBody":VASList{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2ServiceDiscoveryResType(bitstream_t* stream, struct iso2ServiceDiscoveryResType* iso2ServiceDiscoveryResType) {
	int grammarID = 2558;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2558:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2ServiceDiscoveryResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2559;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2559:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentOptionList)] */
			if ( iso2ServiceDiscoveryResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2ServiceDiscoveryResType->EVSEStatus );
				}
				grammarID = 2560;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PaymentOptionListType(stream, &iso2ServiceDiscoveryResType->PaymentOptionList );
				}
				grammarID = 2561;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2560:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentOptionList)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PaymentOptionListType(stream, &iso2ServiceDiscoveryResType->PaymentOptionList );
				}
				grammarID = 2561;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2561:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EnergyTransferServiceList)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2ServiceListType(stream, &iso2ServiceDiscoveryResType->EnergyTransferServiceList );
				}
				grammarID = 2562;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2562:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VASList), END_ELEMENT] */
			if ( iso2ServiceDiscoveryResType->VASList_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ServiceListType(stream, &iso2ServiceDiscoveryResType->VASList );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ServiceIDListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ServiceID{1-10})',  derivedBy='RESTRICTION'.  */
static int encode_iso2ServiceIDListType(bitstream_t* stream, struct iso2ServiceIDListType* iso2ServiceIDListType) {
	int grammarID = 2563;
	int done = 0;
	
	unsigned int iso2ServiceIDListType_ServiceID_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 2563:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ServiceID)] */
			if (iso2ServiceIDListType_ServiceID_currArrayIndex < iso2ServiceIDListType->ServiceID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2ServiceIDListType->ServiceID.array[iso2ServiceIDListType_ServiceID_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2564;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2564:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ServiceID), END_ELEMENT] */
			if (iso2ServiceIDListType_ServiceID_currArrayIndex < iso2ServiceIDListType->ServiceID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2ServiceIDListType->ServiceID.array[iso2ServiceIDListType_ServiceID_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2565;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2565:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ServiceID), END_ELEMENT] */
			if (iso2ServiceIDListType_ServiceID_currArrayIndex < iso2ServiceIDListType->ServiceID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2ServiceIDListType->ServiceID.array[iso2ServiceIDListType_ServiceID_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2566;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2566:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ServiceID), END_ELEMENT] */
			if (iso2ServiceIDListType_ServiceID_currArrayIndex < iso2ServiceIDListType->ServiceID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2ServiceIDListType->ServiceID.array[iso2ServiceIDListType_ServiceID_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2567;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2567:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ServiceID), END_ELEMENT] */
			if (iso2ServiceIDListType_ServiceID_currArrayIndex < iso2ServiceIDListType->ServiceID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2ServiceIDListType->ServiceID.array[iso2ServiceIDListType_ServiceID_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2568;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2568:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ServiceID), END_ELEMENT] */
			if (iso2ServiceIDListType_ServiceID_currArrayIndex < iso2ServiceIDListType->ServiceID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2ServiceIDListType->ServiceID.array[iso2ServiceIDListType_ServiceID_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2569;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2569:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ServiceID), END_ELEMENT] */
			if (iso2ServiceIDListType_ServiceID_currArrayIndex < iso2ServiceIDListType->ServiceID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2ServiceIDListType->ServiceID.array[iso2ServiceIDListType_ServiceID_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2570;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2570:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ServiceID), END_ELEMENT] */
			if (iso2ServiceIDListType_ServiceID_currArrayIndex < iso2ServiceIDListType->ServiceID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2ServiceIDListType->ServiceID.array[iso2ServiceIDListType_ServiceID_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2571;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2571:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ServiceID), END_ELEMENT] */
			if (iso2ServiceIDListType_ServiceID_currArrayIndex < iso2ServiceIDListType->ServiceID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2ServiceIDListType->ServiceID.array[iso2ServiceIDListType_ServiceID_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2572;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2572:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ServiceID), END_ELEMENT] */
			if (iso2ServiceIDListType_ServiceID_currArrayIndex < iso2ServiceIDListType->ServiceID.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2ServiceIDListType->ServiceID.array[iso2ServiceIDListType_ServiceID_currArrayIndex++]);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVFinePositioningSetupParametersType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
static int encode_iso2EVFinePositioningSetupParametersType(bitstream_t* stream, struct iso2EVFinePositioningSetupParametersType* iso2EVFinePositioningSetupParametersType) {
	int grammarID = 674;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 674:
			/* FirstStartTag[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,ChargeParameterDiscoveryResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":SAScheduleList{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVSEEnergyTransferParameter))',  derivedBy='EXTENSION'.  */
static int encode_iso2ChargeParameterDiscoveryResType(bitstream_t* stream, struct iso2ChargeParameterDiscoveryResType* iso2ChargeParameterDiscoveryResType) {
	int grammarID = 2573;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2573:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2ChargeParameterDiscoveryResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2574;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2574:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( iso2ChargeParameterDiscoveryResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2ChargeParameterDiscoveryResType->EVSEStatus );
				}
				grammarID = 2575;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2ChargeParameterDiscoveryResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2576;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2575:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2ChargeParameterDiscoveryResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2576;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2576:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAScheduleList), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVSEBidirectionalParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVSEChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVSEBidirectionalParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVSEChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEEnergyTransferParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}WPT_EVSEChargeParameter)] */
			if ( iso2ChargeParameterDiscoveryResType->SAScheduleList_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2SAScheduleListType(stream, &iso2ChargeParameterDiscoveryResType->SAScheduleList );
				}
				grammarID = 2577;
			} else 			if ( iso2ChargeParameterDiscoveryResType->AC_EVSEBidirectionalParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2AC_EVSEBidirectionalParameterType(stream, &iso2ChargeParameterDiscoveryResType->AC_EVSEBidirectionalParameter );
				}
				grammarID = 3;
			} else 			if ( iso2ChargeParameterDiscoveryResType->AC_EVSEChargeParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2AC_EVSEChargeParameterType(stream, &iso2ChargeParameterDiscoveryResType->AC_EVSEChargeParameter );
				}
				grammarID = 3;
			} else 			if ( iso2ChargeParameterDiscoveryResType->DC_EVSEBidirectionalParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2DC_EVSEBidirectionalParameterType(stream, &iso2ChargeParameterDiscoveryResType->DC_EVSEBidirectionalParameter );
				}
				grammarID = 3;
			} else 			if ( iso2ChargeParameterDiscoveryResType->DC_EVSEChargeParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					errn = encode_iso2DC_EVSEChargeParameterType(stream, &iso2ChargeParameterDiscoveryResType->DC_EVSEChargeParameter );
				}
				grammarID = 3;
			} else 			if ( iso2ChargeParameterDiscoveryResType->EVSEEnergyTransferParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					errn = encode_iso2EVSEEnergyTransferParameterType(stream, &iso2ChargeParameterDiscoveryResType->EVSEEnergyTransferParameter );
				}
				grammarID = 3;
			} else 			if ( iso2ChargeParameterDiscoveryResType->WPT_EVSEChargeParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 6);
				if(errn == 0) {
					errn = encode_iso2WPT_EVSEChargeParameterType(stream, &iso2ChargeParameterDiscoveryResType->WPT_EVSEChargeParameter );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2577:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVSEBidirectionalParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVSEChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVSEBidirectionalParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVSEChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEEnergyTransferParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}WPT_EVSEChargeParameter)] */
			if ( iso2ChargeParameterDiscoveryResType->AC_EVSEBidirectionalParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2AC_EVSEBidirectionalParameterType(stream, &iso2ChargeParameterDiscoveryResType->AC_EVSEBidirectionalParameter );
				}
				grammarID = 3;
			} else 			if ( iso2ChargeParameterDiscoveryResType->AC_EVSEChargeParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2AC_EVSEChargeParameterType(stream, &iso2ChargeParameterDiscoveryResType->AC_EVSEChargeParameter );
				}
				grammarID = 3;
			} else 			if ( iso2ChargeParameterDiscoveryResType->DC_EVSEBidirectionalParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2DC_EVSEBidirectionalParameterType(stream, &iso2ChargeParameterDiscoveryResType->DC_EVSEBidirectionalParameter );
				}
				grammarID = 3;
			} else 			if ( iso2ChargeParameterDiscoveryResType->DC_EVSEChargeParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2DC_EVSEChargeParameterType(stream, &iso2ChargeParameterDiscoveryResType->DC_EVSEChargeParameter );
				}
				grammarID = 3;
			} else 			if ( iso2ChargeParameterDiscoveryResType->EVSEEnergyTransferParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					errn = encode_iso2EVSEEnergyTransferParameterType(stream, &iso2ChargeParameterDiscoveryResType->EVSEEnergyTransferParameter );
				}
				grammarID = 3;
			} else 			if ( iso2ChargeParameterDiscoveryResType->WPT_EVSEChargeParameter_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 5);
				if(errn == 0) {
					errn = encode_iso2WPT_EVSEChargeParameterType(stream, &iso2ChargeParameterDiscoveryResType->WPT_EVSEChargeParameter );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,PowerDemandResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEOutputPower,"urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2016:MsgBody":ReceiptRequired{0-1},"urn:iso:15118:2:2016:MsgBody":PowerDemandParameters{0-1}))',  derivedBy='EXTENSION'.  */
static int encode_iso2PowerDemandResType(bitstream_t* stream, struct iso2PowerDemandResType* iso2PowerDemandResType) {
	int grammarID = 2578;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2578:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2PowerDemandResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2579;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2579:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEOutputPower)] */
			if ( iso2PowerDemandResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2PowerDemandResType->EVSEStatus );
				}
				grammarID = 2580;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PowerDemandResType->EVSEOutputPower );
				}
				grammarID = 2581;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2580:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEOutputPower)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PhysicalValueType(stream, &iso2PowerDemandResType->EVSEOutputPower );
				}
				grammarID = 2581;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2581:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2PowerDemandResType->EVSEID.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2PowerDemandResType->EVSEID.characters, iso2PowerDemandResType->EVSEID.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2582;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2582:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAScheduleTupleID), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeterInfo), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandParameters), END_ELEMENT] */
			if ( iso2PowerDemandResType->SAScheduleTupleID_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2PowerDemandResType->SAScheduleTupleID - 1));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2583;
			} else 			if ( iso2PowerDemandResType->MeterInfo_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2MeterInfoType(stream, &iso2PowerDemandResType->MeterInfo );
				}
				grammarID = 2584;
			} else 			if ( iso2PowerDemandResType->ReceiptRequired_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2PowerDemandResType->ReceiptRequired);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1873;
			} else 			if ( iso2PowerDemandResType->PowerDemandParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2PowerDemandResType->PowerDemandParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 4);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2583:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeterInfo), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandParameters), END_ELEMENT] */
			if ( iso2PowerDemandResType->MeterInfo_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2MeterInfoType(stream, &iso2PowerDemandResType->MeterInfo );
				}
				grammarID = 2584;
			} else 			if ( iso2PowerDemandResType->ReceiptRequired_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2PowerDemandResType->ReceiptRequired);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1873;
			} else 			if ( iso2PowerDemandResType->PowerDemandParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2PowerDemandResType->PowerDemandParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2584:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandParameters), END_ELEMENT] */
			if ( iso2PowerDemandResType->ReceiptRequired_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[BOOLEAN]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeBoolean(stream, iso2PowerDemandResType->ReceiptRequired);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 1873;
			} else 			if ( iso2PowerDemandResType->PowerDemandParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2PowerDemandResType->PowerDemandParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1873:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandParameters), END_ELEMENT] */
			if ( iso2PowerDemandResType->PowerDemandParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ParameterSetType(stream, &iso2PowerDemandResType->PowerDemandParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ChargingProfileType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ProfileEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
static int encode_iso2ChargingProfileType(bitstream_t* stream, struct iso2ChargingProfileType* iso2ChargingProfileType) {
	int grammarID = 2585;
	int done = 0;
	
	unsigned int iso2ChargingProfileType_ProfileEntry_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 2585:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ProfileEntry)] */
			if (iso2ChargingProfileType_ProfileEntry_currArrayIndex < iso2ChargingProfileType->ProfileEntry.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2PMaxScheduleEntryType(stream, &iso2ChargingProfileType->ProfileEntry.array [iso2ChargingProfileType_ProfileEntry_currArrayIndex++]);
				}
				grammarID = 2586;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2586:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ProfileEntry), END_ELEMENT] */
			if (iso2ChargingProfileType_ProfileEntry_currArrayIndex < iso2ChargingProfileType->ProfileEntry.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2PMaxScheduleEntryType(stream, &iso2ChargingProfileType->ProfileEntry.array [iso2ChargingProfileType_ProfileEntry_currArrayIndex++]);
				}
				grammarID = 2586;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,FinePositioningReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVProcessing,"urn:iso:15118:2:2016:MsgDataTypes":EVFinePositioningParameters{0-1})',  derivedBy='EXTENSION'.  */
static int encode_iso2FinePositioningReqType(bitstream_t* stream, struct iso2FinePositioningReqType* iso2FinePositioningReqType) {
	int grammarID = 2587;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2587:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVProcessing)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2FinePositioningReqType->EVProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2588;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2588:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Generic_EVFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVFinePositioningParameters), END_ELEMENT] */
			if ( iso2FinePositioningReqType->EVFinePositioningParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 0);
				if(errn == 0) {
					errn = encode_iso2EVFinePositioningParametersType(stream, &iso2FinePositioningReqType->EVFinePositioningParameters );
				}
				grammarID = 3;
			} else 			if ( iso2FinePositioningReqType->Generic_EVFinePositioningParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 1);
				if(errn == 0) {
					errn = encode_iso2Generic_EVFinePositioningParametersType(stream, &iso2FinePositioningReqType->Generic_EVFinePositioningParameters );
				}
				grammarID = 3;
			} else 			if ( iso2FinePositioningReqType->LFA_EVFinePositioningParameters_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 3, 2);
				if(errn == 0) {
					errn = encode_iso2LFA_EVFinePositioningParametersType(stream, &iso2FinePositioningReqType->LFA_EVFinePositioningParameters );
				}
				grammarID = 3;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 3, 3);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SalesTariffType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SalesTariffID,"urn:iso:15118:2:2016:MsgDataTypes":SalesTariffDescription{0-1},"urn:iso:15118:2:2016:MsgDataTypes":NumEPriceLevels{0-1},"urn:iso:15118:2:2016:MsgDataTypes":SalesTariffEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
static int encode_iso2SalesTariffType(bitstream_t* stream, struct iso2SalesTariffType* iso2SalesTariffType) {
	int grammarID = 2589;
	int done = 0;
	
	unsigned int iso2SalesTariffType_SalesTariffEntry_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 2589:
			/* FirstStartTag[ATTRIBUTE[STRING]({urn:iso:15118:2:2016:MsgDataTypes}Id)] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SalesTariffType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2SalesTariffType->Id.characters, iso2SalesTariffType->Id.charactersLen);
					}
				}
				grammarID = 2590;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2590:
			/* StartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariffID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SalesTariffType->SalesTariffID - 1));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2591;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2591:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariffDescription), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}NumEPriceLevels), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariffEntry)] */
			if ( iso2SalesTariffType->SalesTariffDescription_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[STRING]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						/* encode string as string table miss (+2 len)*/
						errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SalesTariffType->SalesTariffDescription.charactersLen + 2));
						if (errn == 0) {
							errn = encodeCharacters(stream, iso2SalesTariffType->SalesTariffDescription.characters, iso2SalesTariffType->SalesTariffDescription.charactersLen);
						}
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2592;
			} else 			if ( iso2SalesTariffType->NumEPriceLevels_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SalesTariffType->NumEPriceLevels - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2593;
			} else 			if (iso2SalesTariffType_SalesTariffEntry_currArrayIndex < iso2SalesTariffType->SalesTariffEntry.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 2);
				if(errn == 0) {
					errn = encode_iso2SalesTariffEntryType(stream, &iso2SalesTariffType->SalesTariffEntry.array [iso2SalesTariffType_SalesTariffEntry_currArrayIndex++]);
				}
				grammarID = 2594;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2592:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}NumEPriceLevels), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariffEntry)] */
			if ( iso2SalesTariffType->NumEPriceLevels_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SalesTariffType->NumEPriceLevels - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2593;
			} else 			if (iso2SalesTariffType_SalesTariffEntry_currArrayIndex < iso2SalesTariffType->SalesTariffEntry.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2SalesTariffEntryType(stream, &iso2SalesTariffType->SalesTariffEntry.array [iso2SalesTariffType_SalesTariffEntry_currArrayIndex++]);
				}
				grammarID = 2594;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2593:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariffEntry)] */
			if (iso2SalesTariffType_SalesTariffEntry_currArrayIndex < iso2SalesTariffType->SalesTariffEntry.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SalesTariffEntryType(stream, &iso2SalesTariffType->SalesTariffEntry.array [iso2SalesTariffType_SalesTariffEntry_currArrayIndex++]);
				}
				grammarID = 2594;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2594:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariffEntry), END_ELEMENT] */
			if (iso2SalesTariffType_SalesTariffEntry_currArrayIndex < iso2SalesTariffType->SalesTariffEntry.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2SalesTariffEntryType(stream, &iso2SalesTariffType->SalesTariffEntry.array [iso2SalesTariffType_SalesTariffEntry_currArrayIndex++]);
				}
				grammarID = 2594;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SensorID,"urn:iso:15118:2:2016:MsgDataTypes":SensorPosition,"urn:iso:15118:2:2016:MsgDataTypes":SensorOrientation)',  derivedBy='RESTRICTION'.  */
static int encode_iso2SensorType(bitstream_t* stream, struct iso2SensorType* iso2SensorType) {
	int grammarID = 2595;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2595:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(iso2SensorType->SensorID - 0));
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2596;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2596:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2CartesianCoordinatesType(stream, &iso2SensorType->SensorPosition );
				}
				grammarID = 2597;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2597:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorOrientation)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2CartesianCoordinatesType(stream, &iso2SensorType->SensorOrientation );
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureValueType',  base type name='base64Binary',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
static int encode_iso2SignatureValueType(bitstream_t* stream, struct iso2SignatureValueType* iso2SignatureValueType) {
	int grammarID = 2598;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2598:
			/* FirstStartTag[ATTRIBUTE[STRING](Id), CHARACTERS[BINARY_BASE64]] */
			if ( iso2SignatureValueType->Id_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SignatureValueType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2SignatureValueType->Id.characters, iso2SignatureValueType->Id.charactersLen);
					}
				}
				grammarID = 2016;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SignatureValueType->CONTENT.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, iso2SignatureValueType->CONTENT.bytes, iso2SignatureValueType->CONTENT.bytesLen);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2016:
			/* StartTag[CHARACTERS[BINARY_BASE64]] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SignatureValueType->CONTENT.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, iso2SignatureValueType->CONTENT.bytes, iso2SignatureValueType->CONTENT.bytesLen);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignedInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":CanonicalizationMethod,"http://www.w3.org/2000/09/xmldsig#":SignatureMethod,"http://www.w3.org/2000/09/xmldsig#":Reference{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
static int encode_iso2SignedInfoType(bitstream_t* stream, struct iso2SignedInfoType* iso2SignedInfoType) {
	int grammarID = 2599;
	int done = 0;
	
	unsigned int iso2SignedInfoType_Reference_currArrayIndex = 0;
	
	while(!done) {
		switch(grammarID) {
		case 2599:
			/* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod)] */
			if ( iso2SignedInfoType->Id_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2SignedInfoType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2SignedInfoType->Id.characters, iso2SignedInfoType->Id.charactersLen);
					}
				}
				grammarID = 2600;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					errn = encode_iso2CanonicalizationMethodType(stream, &iso2SignedInfoType->CanonicalizationMethod );
				}
				grammarID = 2601;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2600:
			/* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2CanonicalizationMethodType(stream, &iso2SignedInfoType->CanonicalizationMethod );
				}
				grammarID = 2601;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2601:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureMethod)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2SignatureMethodType(stream, &iso2SignedInfoType->SignatureMethod );
				}
				grammarID = 2602;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2602:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference)] */
			if (iso2SignedInfoType_Reference_currArrayIndex < iso2SignedInfoType->Reference.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encode_iso2ReferenceType(stream, &iso2SignedInfoType->Reference.array [iso2SignedInfoType_Reference_currArrayIndex++]);
				}
				grammarID = 1964;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 1964:
			/* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference), END_ELEMENT] */
			if (iso2SignedInfoType_Reference_currArrayIndex < iso2SignedInfoType->Reference.arrayLen ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2ReferenceType(stream, &iso2SignedInfoType->Reference.array [iso2SignedInfoType_Reference_currArrayIndex++]);
				}
				grammarID = 1964;
			} else 			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,PowerDeliveryResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing))',  derivedBy='EXTENSION'.  */
static int encode_iso2PowerDeliveryResType(bitstream_t* stream, struct iso2PowerDeliveryResType* iso2PowerDeliveryResType) {
	int grammarID = 5;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 5:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 5, iso2PowerDeliveryResType->ResponseCode);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 6;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 6:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( iso2PowerDeliveryResType->EVSEStatus_isUsed == 1u ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 0);
				if(errn == 0) {
					errn = encode_iso2EVSEStatusType(stream, &iso2PowerDeliveryResType->EVSEStatus );
				}
				grammarID = 7;
			} else 			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 2, 1);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2PowerDeliveryResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 7:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 2, iso2PowerDeliveryResType->EVSEProcessing);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgBody,CableCheckReqType',  base type name='BodyBaseType',  content type='EMPTY',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
static int encode_iso2CableCheckReqType(bitstream_t* stream, struct iso2CableCheckReqType* iso2CableCheckReqType) {
	int grammarID = 674;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 674:
			/* FirstStartTag[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SelectedServiceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ServiceID,"urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID)',  derivedBy='RESTRICTION'.  */
static int encode_iso2SelectedServiceType(bitstream_t* stream, struct iso2SelectedServiceType* iso2SelectedServiceType) {
	int grammarID = 2603;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2603:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ServiceID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2SelectedServiceType->ServiceID);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2604;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2604:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSetID)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2SelectedServiceType->ParameterSetID);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DiffieHellmanPublickeyType',  base type name='dHpublickeyType',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
static int encode_iso2DiffieHellmanPublickeyType(bitstream_t* stream, struct iso2DiffieHellmanPublickeyType* iso2DiffieHellmanPublickeyType) {
	int grammarID = 2015;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2015:
			/* FirstStartTag[ATTRIBUTE[STRING]({urn:iso:15118:2:2016:MsgDataTypes}Id)] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DiffieHellmanPublickeyType->Id.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, iso2DiffieHellmanPublickeyType->Id.characters, iso2DiffieHellmanPublickeyType->Id.charactersLen);
					}
				}
				grammarID = 2016;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2016:
			/* StartTag[CHARACTERS[BINARY_BASE64]] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(iso2DiffieHellmanPublickeyType->CONTENT.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, iso2DiffieHellmanPublickeyType->CONTENT.bytes, iso2DiffieHellmanPublickeyType->CONTENT.bytesLen);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}

/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
static int encode_iso2EVSEStatusType(bitstream_t* stream, struct iso2EVSEStatusType* iso2EVSEStatusType) {
	int grammarID = 2605;
	int done = 0;
	
	
	while(!done) {
		switch(grammarID) {
		case 2605:
			/* FirstStartTag[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}NotificationMaxDelay)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeUnsignedInteger16(stream, iso2EVSEStatusType->NotificationMaxDelay);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 2606;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 2606:
			/* Element[START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSENotification)] */
			if ( 1 == 1 ) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
					if(errn == 0) {
						errn = encodeNBitUnsignedInteger(stream, 1, iso2EVSEStatusType->EVSENotification);
						/* valid EE */
						errn = encodeNBitUnsignedInteger(stream, 1, 0);
					}
				}
				grammarID = 3;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		case 3:
			/* Element[END_ELEMENT] */
			if (1==1) {
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					done = 1;
				}
				grammarID = 4;
			} else {
				errn = EXI_ERROR_UNKOWN_EVENT;
			}
			break;
		default:
			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
			break;
		}
		if(errn) {
			done = 1;
		}
	}
	return errn;
}



int encode_iso2ExiDocument(bitstream_t* stream, struct iso2EXIDocument* exiDoc) {
	errn = writeEXIHeader(stream);

	if(errn == 0) {
		/* DocContent[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AC_BidirectionalControlReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AC_BidirectionalControlRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVBidirectionalParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVSEBidirectionalParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVSEChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AlignmentCheckReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AlignmentCheckRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AuthorizationReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AuthorizationRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}BodyElement), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CableCheckReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CableCheckRes), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateInstallationReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateInstallationRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateUpdateReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateUpdateRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargeParameterDiscoveryReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargeParameterDiscoveryRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingStatusReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingStatusRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ConnectChargingDeviceReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ConnectChargingDeviceRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CurrentDemandReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CurrentDemandRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DC_BidirectionalControlReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DC_BidirectionalControlRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVBidirectionalParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVSEBidirectionalParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVSEChargeParameter), 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:2016:MsgBody}DisconnectChargingDeviceReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisconnectChargingDeviceRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVEnergyTransferParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVFinePositioningSetupParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEEnergyTransferParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEFinePositioningSetupParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningSetupReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningSetupRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Generic_EVFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Generic_EVSEFinePositioningParameters), 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({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVFinePositioningSetupParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVSEFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVSEFinePositioningSetupParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MV_EVSEFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MV_EVSEFinePositioningSetupParameters), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Manifest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeteringReceiptReq), START_ELEMENT({urn:iso:15118:2:2016: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:2016:MsgDataTypes}PMaxScheduleEntry), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PairingReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PairingRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentDetailsReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentDetailsRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentServiceSelectionReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentServiceSelectionRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDeliveryReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDeliveryRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PreChargeReq), START_ELEMENT({urn:iso:15118:2:2016: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:2016:MsgDataTypes}RelativeTimeInterval), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RetrievalMethod), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SAScheduleList), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariffEntry), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDetailReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDetailRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDiscoveryReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDiscoveryRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionSetupReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionSetupRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionStopReq), START_ELEMENT({urn:iso:15118:2:2016: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:2016:MsgBody}SystemStatusReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SystemStatusRes), 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:2016:MsgBody}V2GRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}V2GResponse), START_ELEMENT({urn:iso:15118:2:2016:MsgDef}V2G_Message), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckInReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckInRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckOutReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckOutRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}WPT_EVChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}WPT_EVSEChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}WeldingDetectionReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}WeldingDetectionRes), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data), START_ELEMENT_GENERIC] */
		if ( exiDoc->AC_BidirectionalControlReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AC_BidirectionalControlReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 0);
			if(errn == 0) {
				errn = encode_iso2AC_BidirectionalControlReqType(stream, &exiDoc->AC_BidirectionalControlReq );
			}
		} else if ( exiDoc->AC_BidirectionalControlRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AC_BidirectionalControlRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 1);
			if(errn == 0) {
				errn = encode_iso2AC_BidirectionalControlResType(stream, &exiDoc->AC_BidirectionalControlRes );
			}
		} else if ( exiDoc->AC_EVBidirectionalParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVBidirectionalParameter) */
			errn = encodeNBitUnsignedInteger(stream, 7, 2);
			if(errn == 0) {
				errn = encode_iso2AC_EVBidirectionalParameterType(stream, &exiDoc->AC_EVBidirectionalParameter );
			}
		} else if ( exiDoc->AC_EVChargeParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVChargeParameter) */
			errn = encodeNBitUnsignedInteger(stream, 7, 3);
			if(errn == 0) {
				errn = encode_iso2AC_EVChargeParameterType(stream, &exiDoc->AC_EVChargeParameter );
			}
		} else if ( exiDoc->AC_EVSEBidirectionalParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVSEBidirectionalParameter) */
			errn = encodeNBitUnsignedInteger(stream, 7, 4);
			if(errn == 0) {
				errn = encode_iso2AC_EVSEBidirectionalParameterType(stream, &exiDoc->AC_EVSEBidirectionalParameter );
			}
		} else if ( exiDoc->AC_EVSEChargeParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVSEChargeParameter) */
			errn = encodeNBitUnsignedInteger(stream, 7, 5);
			if(errn == 0) {
				errn = encode_iso2AC_EVSEChargeParameterType(stream, &exiDoc->AC_EVSEChargeParameter );
			}
		} else if ( exiDoc->AlignmentCheckReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AlignmentCheckReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 6);
			if(errn == 0) {
				errn = encode_iso2AlignmentCheckReqType(stream, &exiDoc->AlignmentCheckReq );
			}
		} else if ( exiDoc->AlignmentCheckRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AlignmentCheckRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 7);
			if(errn == 0) {
				errn = encode_iso2AlignmentCheckResType(stream, &exiDoc->AlignmentCheckRes );
			}
		} else if ( exiDoc->AuthorizationReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AuthorizationReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 8);
			if(errn == 0) {
				errn = encode_iso2AuthorizationReqType(stream, &exiDoc->AuthorizationReq );
			}
		} else if ( exiDoc->AuthorizationRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AuthorizationRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 9);
			if(errn == 0) {
				errn = encode_iso2AuthorizationResType(stream, &exiDoc->AuthorizationRes );
			}
		} else if ( exiDoc->BodyElement_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}BodyElement) */
			errn = encodeNBitUnsignedInteger(stream, 7, 10);
			if(errn == 0) {
				errn = encode_iso2BodyBaseType(stream, &exiDoc->BodyElement );
			}
		} else if ( exiDoc->CableCheckReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CableCheckReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 11);
			if(errn == 0) {
				errn = encode_iso2CableCheckReqType(stream, &exiDoc->CableCheckReq );
			}
		} else if ( exiDoc->CableCheckRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CableCheckRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 12);
			if(errn == 0) {
				errn = encode_iso2CableCheckResType(stream, &exiDoc->CableCheckRes );
			}
		} else if ( exiDoc->CanonicalizationMethod_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod) */
			errn = encodeNBitUnsignedInteger(stream, 7, 13);
			if(errn == 0) {
				errn = encode_iso2CanonicalizationMethodType(stream, &exiDoc->CanonicalizationMethod );
			}
		} else if ( exiDoc->CertificateInstallationReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateInstallationReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 14);
			if(errn == 0) {
				errn = encode_iso2CertificateInstallationReqType(stream, &exiDoc->CertificateInstallationReq );
			}
		} else if ( exiDoc->CertificateInstallationRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateInstallationRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 15);
			if(errn == 0) {
				errn = encode_iso2CertificateInstallationResType(stream, &exiDoc->CertificateInstallationRes );
			}
		} else if ( exiDoc->CertificateUpdateReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateUpdateReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 16);
			if(errn == 0) {
				errn = encode_iso2CertificateUpdateReqType(stream, &exiDoc->CertificateUpdateReq );
			}
		} else if ( exiDoc->CertificateUpdateRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateUpdateRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 17);
			if(errn == 0) {
				errn = encode_iso2CertificateUpdateResType(stream, &exiDoc->CertificateUpdateRes );
			}
		} else if ( exiDoc->ChargeParameterDiscoveryReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargeParameterDiscoveryReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 18);
			if(errn == 0) {
				errn = encode_iso2ChargeParameterDiscoveryReqType(stream, &exiDoc->ChargeParameterDiscoveryReq );
			}
		} else if ( exiDoc->ChargeParameterDiscoveryRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargeParameterDiscoveryRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 19);
			if(errn == 0) {
				errn = encode_iso2ChargeParameterDiscoveryResType(stream, &exiDoc->ChargeParameterDiscoveryRes );
			}
		} else if ( exiDoc->ChargingStatusReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingStatusReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 20);
			if(errn == 0) {
				errn = encode_iso2ChargingStatusReqType(stream, &exiDoc->ChargingStatusReq );
			}
		} else if ( exiDoc->ChargingStatusRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingStatusRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 21);
			if(errn == 0) {
				errn = encode_iso2ChargingStatusResType(stream, &exiDoc->ChargingStatusRes );
			}
		} else if ( exiDoc->ConnectChargingDeviceReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ConnectChargingDeviceReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 22);
			if(errn == 0) {
				errn = encode_iso2ConnectChargingDeviceReqType(stream, &exiDoc->ConnectChargingDeviceReq );
			}
		} else if ( exiDoc->ConnectChargingDeviceRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ConnectChargingDeviceRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 23);
			if(errn == 0) {
				errn = encode_iso2ConnectChargingDeviceResType(stream, &exiDoc->ConnectChargingDeviceRes );
			}
		} else if ( exiDoc->CurrentDemandReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CurrentDemandReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 24);
			if(errn == 0) {
				errn = encode_iso2CurrentDemandReqType(stream, &exiDoc->CurrentDemandReq );
			}
		} else if ( exiDoc->CurrentDemandRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CurrentDemandRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 25);
			if(errn == 0) {
				errn = encode_iso2CurrentDemandResType(stream, &exiDoc->CurrentDemandRes );
			}
		} else if ( exiDoc->DC_BidirectionalControlReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DC_BidirectionalControlReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 26);
			if(errn == 0) {
				errn = encode_iso2DC_BidirectionalControlReqType(stream, &exiDoc->DC_BidirectionalControlReq );
			}
		} else if ( exiDoc->DC_BidirectionalControlRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DC_BidirectionalControlRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 27);
			if(errn == 0) {
				errn = encode_iso2DC_BidirectionalControlResType(stream, &exiDoc->DC_BidirectionalControlRes );
			}
		} else if ( exiDoc->DC_EVBidirectionalParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVBidirectionalParameter) */
			errn = encodeNBitUnsignedInteger(stream, 7, 28);
			if(errn == 0) {
				errn = encode_iso2DC_EVBidirectionalParameterType(stream, &exiDoc->DC_EVBidirectionalParameter );
			}
		} else if ( exiDoc->DC_EVChargeParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVChargeParameter) */
			errn = encodeNBitUnsignedInteger(stream, 7, 29);
			if(errn == 0) {
				errn = encode_iso2DC_EVChargeParameterType(stream, &exiDoc->DC_EVChargeParameter );
			}
		} else if ( exiDoc->DC_EVSEBidirectionalParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVSEBidirectionalParameter) */
			errn = encodeNBitUnsignedInteger(stream, 7, 30);
			if(errn == 0) {
				errn = encode_iso2DC_EVSEBidirectionalParameterType(stream, &exiDoc->DC_EVSEBidirectionalParameter );
			}
		} else if ( exiDoc->DC_EVSEChargeParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVSEChargeParameter) */
			errn = encodeNBitUnsignedInteger(stream, 7, 31);
			if(errn == 0) {
				errn = encode_iso2DC_EVSEChargeParameterType(stream, &exiDoc->DC_EVSEChargeParameter );
			}
		} else if ( exiDoc->DSAKeyValue_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DSAKeyValue) */
			errn = encodeNBitUnsignedInteger(stream, 7, 32);
			if(errn == 0) {
				errn = encode_iso2DSAKeyValueType(stream, &exiDoc->DSAKeyValue );
			}
		} else if ( exiDoc->DigestMethod_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod) */
			errn = encodeNBitUnsignedInteger(stream, 7, 33);
			if(errn == 0) {
				errn = encode_iso2DigestMethodType(stream, &exiDoc->DigestMethod );
			}
		} else if ( exiDoc->DigestValue_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestValue) */
			errn = encodeNBitUnsignedInteger(stream, 7, 34);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiDoc->DigestValue.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiDoc->DigestValue.bytes, exiDoc->DigestValue.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiDoc->DisconnectChargingDeviceReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisconnectChargingDeviceReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 35);
			if(errn == 0) {
				errn = encode_iso2DisconnectChargingDeviceReqType(stream, &exiDoc->DisconnectChargingDeviceReq );
			}
		} else if ( exiDoc->DisconnectChargingDeviceRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisconnectChargingDeviceRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 36);
			if(errn == 0) {
				errn = encode_iso2DisconnectChargingDeviceResType(stream, &exiDoc->DisconnectChargingDeviceRes );
			}
		} else if ( exiDoc->EVEnergyTransferParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVEnergyTransferParameter) */
			errn = encodeNBitUnsignedInteger(stream, 7, 37);
			if(errn == 0) {
				errn = encode_iso2EVEnergyTransferParameterType(stream, &exiDoc->EVEnergyTransferParameter );
			}
		} else if ( exiDoc->EVFinePositioningParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVFinePositioningParameters) */
			errn = encodeNBitUnsignedInteger(stream, 7, 38);
			if(errn == 0) {
				errn = encode_iso2EVFinePositioningParametersType(stream, &exiDoc->EVFinePositioningParameters );
			}
		} else if ( exiDoc->EVFinePositioningSetupParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVFinePositioningSetupParameters) */
			errn = encodeNBitUnsignedInteger(stream, 7, 39);
			if(errn == 0) {
				errn = encode_iso2EVFinePositioningSetupParametersType(stream, &exiDoc->EVFinePositioningSetupParameters );
			}
		} else if ( exiDoc->EVSEEnergyTransferParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEEnergyTransferParameter) */
			errn = encodeNBitUnsignedInteger(stream, 7, 40);
			if(errn == 0) {
				errn = encode_iso2EVSEEnergyTransferParameterType(stream, &exiDoc->EVSEEnergyTransferParameter );
			}
		} else if ( exiDoc->EVSEFinePositioningParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEFinePositioningParameters) */
			errn = encodeNBitUnsignedInteger(stream, 7, 41);
			if(errn == 0) {
				errn = encode_iso2EVSEFinePositioningParametersType(stream, &exiDoc->EVSEFinePositioningParameters );
			}
		} else if ( exiDoc->EVSEFinePositioningSetupParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEFinePositioningSetupParameters) */
			errn = encodeNBitUnsignedInteger(stream, 7, 42);
			if(errn == 0) {
				errn = encode_iso2EVSEFinePositioningSetupParametersType(stream, &exiDoc->EVSEFinePositioningSetupParameters );
			}
		} else if ( exiDoc->FinePositioningReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 43);
			if(errn == 0) {
				errn = encode_iso2FinePositioningReqType(stream, &exiDoc->FinePositioningReq );
			}
		} else if ( exiDoc->FinePositioningRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 44);
			if(errn == 0) {
				errn = encode_iso2FinePositioningResType(stream, &exiDoc->FinePositioningRes );
			}
		} else if ( exiDoc->FinePositioningSetupReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningSetupReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 45);
			if(errn == 0) {
				errn = encode_iso2FinePositioningSetupReqType(stream, &exiDoc->FinePositioningSetupReq );
			}
		} else if ( exiDoc->FinePositioningSetupRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningSetupRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 46);
			if(errn == 0) {
				errn = encode_iso2FinePositioningSetupResType(stream, &exiDoc->FinePositioningSetupRes );
			}
		} else if ( exiDoc->Generic_EVFinePositioningParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Generic_EVFinePositioningParameters) */
			errn = encodeNBitUnsignedInteger(stream, 7, 47);
			if(errn == 0) {
				errn = encode_iso2Generic_EVFinePositioningParametersType(stream, &exiDoc->Generic_EVFinePositioningParameters );
			}
		} else if ( exiDoc->Generic_EVSEFinePositioningParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Generic_EVSEFinePositioningParameters) */
			errn = encodeNBitUnsignedInteger(stream, 7, 48);
			if(errn == 0) {
				errn = encode_iso2Generic_EVSEFinePositioningParametersType(stream, &exiDoc->Generic_EVSEFinePositioningParameters );
			}
		} else if ( exiDoc->KeyInfo_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyInfo) */
			errn = encodeNBitUnsignedInteger(stream, 7, 49);
			if(errn == 0) {
				errn = encode_iso2KeyInfoType(stream, &exiDoc->KeyInfo );
			}
		} else if ( exiDoc->KeyName_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyName) */
			errn = encodeNBitUnsignedInteger(stream, 7, 50);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiDoc->KeyName.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, exiDoc->KeyName.characters, exiDoc->KeyName.charactersLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiDoc->KeyValue_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyValue) */
			errn = encodeNBitUnsignedInteger(stream, 7, 51);
			if(errn == 0) {
				errn = encode_iso2KeyValueType(stream, &exiDoc->KeyValue );
			}
		} else if ( exiDoc->LFA_EVFinePositioningParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVFinePositioningParameters) */
			errn = encodeNBitUnsignedInteger(stream, 7, 52);
			if(errn == 0) {
				errn = encode_iso2LFA_EVFinePositioningParametersType(stream, &exiDoc->LFA_EVFinePositioningParameters );
			}
		} else if ( exiDoc->LFA_EVFinePositioningSetupParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVFinePositioningSetupParameters) */
			errn = encodeNBitUnsignedInteger(stream, 7, 53);
			if(errn == 0) {
				errn = encode_iso2LFA_EVFinePositioningSetupParametersType(stream, &exiDoc->LFA_EVFinePositioningSetupParameters );
			}
		} else if ( exiDoc->LFA_EVSEFinePositioningParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVSEFinePositioningParameters) */
			errn = encodeNBitUnsignedInteger(stream, 7, 54);
			if(errn == 0) {
				errn = encode_iso2LFA_EVSEFinePositioningParametersType(stream, &exiDoc->LFA_EVSEFinePositioningParameters );
			}
		} else if ( exiDoc->LFA_EVSEFinePositioningSetupParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVSEFinePositioningSetupParameters) */
			errn = encodeNBitUnsignedInteger(stream, 7, 55);
			if(errn == 0) {
				errn = encode_iso2LFA_EVSEFinePositioningSetupParametersType(stream, &exiDoc->LFA_EVSEFinePositioningSetupParameters );
			}
		} else if ( exiDoc->MV_EVSEFinePositioningParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MV_EVSEFinePositioningParameters) */
			errn = encodeNBitUnsignedInteger(stream, 7, 56);
			if(errn == 0) {
				errn = encode_iso2MV_EVSEFinePositioningParametersType(stream, &exiDoc->MV_EVSEFinePositioningParameters );
			}
		} else if ( exiDoc->MV_EVSEFinePositioningSetupParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MV_EVSEFinePositioningSetupParameters) */
			errn = encodeNBitUnsignedInteger(stream, 7, 57);
			if(errn == 0) {
				errn = encode_iso2MV_EVSEFinePositioningSetupParametersType(stream, &exiDoc->MV_EVSEFinePositioningSetupParameters );
			}
		} else if ( exiDoc->Manifest_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Manifest) */
			errn = encodeNBitUnsignedInteger(stream, 7, 58);
			if(errn == 0) {
				errn = encode_iso2ManifestType(stream, &exiDoc->Manifest );
			}
		} else if ( exiDoc->MeteringReceiptReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeteringReceiptReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 59);
			if(errn == 0) {
				errn = encode_iso2MeteringReceiptReqType(stream, &exiDoc->MeteringReceiptReq );
			}
		} else if ( exiDoc->MeteringReceiptRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeteringReceiptRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 60);
			if(errn == 0) {
				errn = encode_iso2MeteringReceiptResType(stream, &exiDoc->MeteringReceiptRes );
			}
		} else if ( exiDoc->MgmtData_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData) */
			errn = encodeNBitUnsignedInteger(stream, 7, 61);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiDoc->MgmtData.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, exiDoc->MgmtData.characters, exiDoc->MgmtData.charactersLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiDoc->Object_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Object) */
			errn = encodeNBitUnsignedInteger(stream, 7, 62);
			if(errn == 0) {
				errn = encode_iso2ObjectType(stream, &exiDoc->Object );
			}
		} else if ( exiDoc->PGPData_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData) */
			errn = encodeNBitUnsignedInteger(stream, 7, 63);
			if(errn == 0) {
				errn = encode_iso2PGPDataType(stream, &exiDoc->PGPData );
			}
		} else if ( exiDoc->PMaxScheduleEntry_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PMaxScheduleEntry) */
			errn = encodeNBitUnsignedInteger(stream, 7, 64);
			if(errn == 0) {
				errn = encode_iso2PMaxScheduleEntryType(stream, &exiDoc->PMaxScheduleEntry );
			}
		} else if ( exiDoc->PairingReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PairingReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 65);
			if(errn == 0) {
				errn = encode_iso2PairingReqType(stream, &exiDoc->PairingReq );
			}
		} else if ( exiDoc->PairingRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PairingRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 66);
			if(errn == 0) {
				errn = encode_iso2PairingResType(stream, &exiDoc->PairingRes );
			}
		} else if ( exiDoc->PaymentDetailsReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentDetailsReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 67);
			if(errn == 0) {
				errn = encode_iso2PaymentDetailsReqType(stream, &exiDoc->PaymentDetailsReq );
			}
		} else if ( exiDoc->PaymentDetailsRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentDetailsRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 68);
			if(errn == 0) {
				errn = encode_iso2PaymentDetailsResType(stream, &exiDoc->PaymentDetailsRes );
			}
		} else if ( exiDoc->PaymentServiceSelectionReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentServiceSelectionReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 69);
			if(errn == 0) {
				errn = encode_iso2PaymentServiceSelectionReqType(stream, &exiDoc->PaymentServiceSelectionReq );
			}
		} else if ( exiDoc->PaymentServiceSelectionRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentServiceSelectionRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 70);
			if(errn == 0) {
				errn = encode_iso2PaymentServiceSelectionResType(stream, &exiDoc->PaymentServiceSelectionRes );
			}
		} else if ( exiDoc->PowerDeliveryReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDeliveryReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 71);
			if(errn == 0) {
				errn = encode_iso2PowerDeliveryReqType(stream, &exiDoc->PowerDeliveryReq );
			}
		} else if ( exiDoc->PowerDeliveryRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDeliveryRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 72);
			if(errn == 0) {
				errn = encode_iso2PowerDeliveryResType(stream, &exiDoc->PowerDeliveryRes );
			}
		} else if ( exiDoc->PowerDemandReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 73);
			if(errn == 0) {
				errn = encode_iso2PowerDemandReqType(stream, &exiDoc->PowerDemandReq );
			}
		} else if ( exiDoc->PowerDemandRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 74);
			if(errn == 0) {
				errn = encode_iso2PowerDemandResType(stream, &exiDoc->PowerDemandRes );
			}
		} else if ( exiDoc->PreChargeReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PreChargeReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 75);
			if(errn == 0) {
				errn = encode_iso2PreChargeReqType(stream, &exiDoc->PreChargeReq );
			}
		} else if ( exiDoc->PreChargeRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PreChargeRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 76);
			if(errn == 0) {
				errn = encode_iso2PreChargeResType(stream, &exiDoc->PreChargeRes );
			}
		} else if ( exiDoc->RSAKeyValue_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RSAKeyValue) */
			errn = encodeNBitUnsignedInteger(stream, 7, 77);
			if(errn == 0) {
				errn = encode_iso2RSAKeyValueType(stream, &exiDoc->RSAKeyValue );
			}
		} else if ( exiDoc->Reference_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference) */
			errn = encodeNBitUnsignedInteger(stream, 7, 78);
			if(errn == 0) {
				errn = encode_iso2ReferenceType(stream, &exiDoc->Reference );
			}
		} else if ( exiDoc->RelativeTimeInterval_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RelativeTimeInterval) */
			errn = encodeNBitUnsignedInteger(stream, 7, 79);
			if(errn == 0) {
				errn = encode_iso2RelativeTimeIntervalType(stream, &exiDoc->RelativeTimeInterval );
			}
		} else if ( exiDoc->RetrievalMethod_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RetrievalMethod) */
			errn = encodeNBitUnsignedInteger(stream, 7, 80);
			if(errn == 0) {
				errn = encode_iso2RetrievalMethodType(stream, &exiDoc->RetrievalMethod );
			}
		} else if ( exiDoc->SAScheduleList_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SAScheduleList) */
			errn = encodeNBitUnsignedInteger(stream, 7, 81);
			if(errn == 0) {
				errn = encode_iso2SAScheduleListType(stream, &exiDoc->SAScheduleList );
			}
		} else if ( exiDoc->SPKIData_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData) */
			errn = encodeNBitUnsignedInteger(stream, 7, 82);
			if(errn == 0) {
				errn = encode_iso2SPKIDataType(stream, &exiDoc->SPKIData );
			}
		} else if ( exiDoc->SalesTariffEntry_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariffEntry) */
			errn = encodeNBitUnsignedInteger(stream, 7, 83);
			if(errn == 0) {
				errn = encode_iso2SalesTariffEntryType(stream, &exiDoc->SalesTariffEntry );
			}
		} else if ( exiDoc->ServiceDetailReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDetailReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 84);
			if(errn == 0) {
				errn = encode_iso2ServiceDetailReqType(stream, &exiDoc->ServiceDetailReq );
			}
		} else if ( exiDoc->ServiceDetailRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDetailRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 85);
			if(errn == 0) {
				errn = encode_iso2ServiceDetailResType(stream, &exiDoc->ServiceDetailRes );
			}
		} else if ( exiDoc->ServiceDiscoveryReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDiscoveryReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 86);
			if(errn == 0) {
				errn = encode_iso2ServiceDiscoveryReqType(stream, &exiDoc->ServiceDiscoveryReq );
			}
		} else if ( exiDoc->ServiceDiscoveryRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDiscoveryRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 87);
			if(errn == 0) {
				errn = encode_iso2ServiceDiscoveryResType(stream, &exiDoc->ServiceDiscoveryRes );
			}
		} else if ( exiDoc->SessionSetupReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionSetupReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 88);
			if(errn == 0) {
				errn = encode_iso2SessionSetupReqType(stream, &exiDoc->SessionSetupReq );
			}
		} else if ( exiDoc->SessionSetupRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionSetupRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 89);
			if(errn == 0) {
				errn = encode_iso2SessionSetupResType(stream, &exiDoc->SessionSetupRes );
			}
		} else if ( exiDoc->SessionStopReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionStopReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 90);
			if(errn == 0) {
				errn = encode_iso2SessionStopReqType(stream, &exiDoc->SessionStopReq );
			}
		} else if ( exiDoc->SessionStopRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionStopRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 91);
			if(errn == 0) {
				errn = encode_iso2SessionStopResType(stream, &exiDoc->SessionStopRes );
			}
		} else if ( exiDoc->Signature_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Signature) */
			errn = encodeNBitUnsignedInteger(stream, 7, 92);
			if(errn == 0) {
				errn = encode_iso2SignatureType(stream, &exiDoc->Signature );
			}
		} else if ( exiDoc->SignatureMethod_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureMethod) */
			errn = encodeNBitUnsignedInteger(stream, 7, 93);
			if(errn == 0) {
				errn = encode_iso2SignatureMethodType(stream, &exiDoc->SignatureMethod );
			}
		} else if ( exiDoc->SignatureProperties_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperties) */
			errn = encodeNBitUnsignedInteger(stream, 7, 94);
			if(errn == 0) {
				errn = encode_iso2SignaturePropertiesType(stream, &exiDoc->SignatureProperties );
			}
		} else if ( exiDoc->SignatureProperty_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperty) */
			errn = encodeNBitUnsignedInteger(stream, 7, 95);
			if(errn == 0) {
				errn = encode_iso2SignaturePropertyType(stream, &exiDoc->SignatureProperty );
			}
		} else if ( exiDoc->SignatureValue_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureValue) */
			errn = encodeNBitUnsignedInteger(stream, 7, 96);
			if(errn == 0) {
				errn = encode_iso2SignatureValueType(stream, &exiDoc->SignatureValue );
			}
		} else if ( exiDoc->SignedInfo_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignedInfo) */
			errn = encodeNBitUnsignedInteger(stream, 7, 97);
			if(errn == 0) {
				errn = encode_iso2SignedInfoType(stream, &exiDoc->SignedInfo );
			}
		} else if ( exiDoc->SystemStatusReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SystemStatusReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 98);
			if(errn == 0) {
				errn = encode_iso2SystemStatusReqType(stream, &exiDoc->SystemStatusReq );
			}
		} else if ( exiDoc->SystemStatusRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SystemStatusRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 99);
			if(errn == 0) {
				errn = encode_iso2SystemStatusResType(stream, &exiDoc->SystemStatusRes );
			}
		} else if ( exiDoc->Transform_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transform) */
			errn = encodeNBitUnsignedInteger(stream, 7, 100);
			if(errn == 0) {
				errn = encode_iso2TransformType(stream, &exiDoc->Transform );
			}
		} else if ( exiDoc->Transforms_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms) */
			errn = encodeNBitUnsignedInteger(stream, 7, 101);
			if(errn == 0) {
				errn = encode_iso2TransformsType(stream, &exiDoc->Transforms );
			}
		} else if ( exiDoc->V2GRequest_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}V2GRequest) */
			errn = encodeNBitUnsignedInteger(stream, 7, 102);
			if(errn == 0) {
				errn = encode_iso2BodyBaseType(stream, &exiDoc->V2GRequest );
			}
		} else if ( exiDoc->V2GResponse_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}V2GResponse) */
			errn = encodeNBitUnsignedInteger(stream, 7, 103);
			if(errn == 0) {
				errn = encode_iso2V2GResponseType(stream, &exiDoc->V2GResponse );
			}
		} else if ( exiDoc->V2G_Message_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDef}V2G_Message) */
			errn = encodeNBitUnsignedInteger(stream, 7, 104);
			if(errn == 0) {
				errn = encode_iso2AnonType_V2G_Message(stream, &exiDoc->V2G_Message );
			}
		} else if ( exiDoc->VehicleCheckInReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckInReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 105);
			if(errn == 0) {
				errn = encode_iso2VehicleCheckInReqType(stream, &exiDoc->VehicleCheckInReq );
			}
		} else if ( exiDoc->VehicleCheckInRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckInRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 106);
			if(errn == 0) {
				errn = encode_iso2VehicleCheckInResType(stream, &exiDoc->VehicleCheckInRes );
			}
		} else if ( exiDoc->VehicleCheckOutReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckOutReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 107);
			if(errn == 0) {
				errn = encode_iso2VehicleCheckOutReqType(stream, &exiDoc->VehicleCheckOutReq );
			}
		} else if ( exiDoc->VehicleCheckOutRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckOutRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 108);
			if(errn == 0) {
				errn = encode_iso2VehicleCheckOutResType(stream, &exiDoc->VehicleCheckOutRes );
			}
		} else if ( exiDoc->WPT_EVChargeParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}WPT_EVChargeParameter) */
			errn = encodeNBitUnsignedInteger(stream, 7, 109);
			if(errn == 0) {
				errn = encode_iso2WPT_EVChargeParameterType(stream, &exiDoc->WPT_EVChargeParameter );
			}
		} else if ( exiDoc->WPT_EVSEChargeParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}WPT_EVSEChargeParameter) */
			errn = encodeNBitUnsignedInteger(stream, 7, 110);
			if(errn == 0) {
				errn = encode_iso2WPT_EVSEChargeParameterType(stream, &exiDoc->WPT_EVSEChargeParameter );
			}
		} else if ( exiDoc->WeldingDetectionReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}WeldingDetectionReq) */
			errn = encodeNBitUnsignedInteger(stream, 7, 111);
			if(errn == 0) {
				errn = encode_iso2WeldingDetectionReqType(stream, &exiDoc->WeldingDetectionReq );
			}
		} else if ( exiDoc->WeldingDetectionRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}WeldingDetectionRes) */
			errn = encodeNBitUnsignedInteger(stream, 7, 112);
			if(errn == 0) {
				errn = encode_iso2WeldingDetectionResType(stream, &exiDoc->WeldingDetectionRes );
			}
		} else if ( exiDoc->X509Data_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data) */
			errn = encodeNBitUnsignedInteger(stream, 7, 113);
			if(errn == 0) {
				errn = encode_iso2X509DataType(stream, &exiDoc->X509Data );
			}
		} else {
			errn = EXI_ERROR_UNKOWN_EVENT;
		}

	}

	if(errn == 0) {
		/* flush any pending bits */
		errn = encodeFinish(stream);
	}

	return errn;
}

#if DEPLOY_ISO2_CODEC_FRAGMENT == SUPPORT_YES
int encode_iso2ExiFragment(bitstream_t* stream, struct iso2EXIFragment* exiFrag) {
	errn = writeEXIHeader(stream);

	if(errn == 0) {
		/* FragmentContent[START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AC_BidirectionalControlReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AC_BidirectionalControlRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVBidirectionalParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVSEBidirectionalParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVSEChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AlignmentCheckParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AlignmentCheckReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AlignmentCheckRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AlignmentOffset), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AngleGAtoVA), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AuthorizationReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AuthorizationRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDef}Body), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}BodyElement), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BuyBackTariff), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CableCheckReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CableCheckRes), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Certificate), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateInstallationReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateInstallationRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateUpdateReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateUpdateRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargeParameterDiscoveryReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargeParameterDiscoveryRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargeProgress), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingComplete), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingPerformance), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingProfile), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingSession), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingStatusReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingStatusRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CheckOutTime), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ConnectChargingDeviceReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ConnectChargingDeviceRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ConsumptionCost), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ContractSignatureCertChain), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ContractSignatureEncryptedPrivateKey), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Cost), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CurrentDemandReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CurrentDemandRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}CurrentRange), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}CurrentSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DC_BidirectionalControlReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DC_BidirectionalControlRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVBidirectionalParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVSEBidirectionalParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVSEChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DHpublickey), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DSAKeyValue), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DepartureTime), 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:2016:MsgBody}DisconnectChargingDeviceReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisconnectChargingDeviceRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Distance), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EPriceLevel), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVCCID), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVCheckInStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVCheckOutStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVElectricalChargingDeviceStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVEnergyTransferParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVFinePositioningSetupParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVInputPower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumChargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumDischargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumPower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumPower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMechanicalChargingDeviceStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumChargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumChargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumDischargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumDischargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumPower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVOperation), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVPresentActivePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVPresentReactivePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVProcessing), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSECheckOutStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSECurrentLimitAchieved), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSECurrentRegulationTolerance), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEElectricalChargingDeviceStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEEnergyToBeDelivered), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEEnergyTransferParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEFinePositioningSetupParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumChargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumChargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumChargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumDischargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumDischargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumDischargePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumPower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumPower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMechanicalChargingDeviceStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMinimumChargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMinimumDischargeCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMinimumPower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMinimumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMinimumVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSENominalFrequency), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSENominalVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSENotification), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEOutputPower), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEPeakCurrentRipple), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPowerLimitAchieved), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPresentCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPresentVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSETargetPower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSETargetReactivePower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSETimeStamp), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEVoltageLimitAchieved), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetCurrent), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVTargetEnergyRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetPower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetVoltage), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EffectiveRadiatedPower), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EnergyTransferServiceList), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Exponent), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Exponent), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}FODStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningSetupReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningSetupRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}FreeService), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}FrequencyChannel), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}G), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}GAID), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}GenChallenge), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}GenericParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Generic_EVFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Generic_EVSEFinePositioningParameters), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength), START_ELEMENT({urn:iso:15118:2:2016:MsgDef}Header), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}InletHot), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}J), 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({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVFinePositioningSetupParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVSEFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVSEFinePositioningSetupParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ListOfRootCertificateIDs), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MV_EVSEFinePositioningParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MV_EVSEFinePositioningSetupParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorList), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetupList), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Manifest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MaxSupportingPoints), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementDataList), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeterID), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeterInfo), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeterReadingCharged), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeterReadingDischarged), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeterStatus), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeteringReceiptReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeteringReceiptRes), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MinimumPMaxRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MinimumPMaxScheduleEntry), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MinimumSOC), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Modulus), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}NotificationMaxDelay), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}NumEPriceLevels), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}NumberOfSensors), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}NumberOfSignalPackages), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}OEMProvisioningCert), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Object), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}OperationMode), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}P), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyID), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PMax), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PMaxDischargeSchedule), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PMaxSchedule), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PMaxScheduleEntry), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PackageIndex), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PackageSeparationTime), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PairingParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PairingReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PairingRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSetID), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ParkingMethod), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentDetailsReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentDetailsRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PaymentOption), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentOptionList), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentServiceSelectionReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentServiceSelectionRes), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PgenCounter), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDeliveryReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDeliveryRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandParameters), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PreChargeReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PreChargeRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ProfileEntry), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Q), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RSAKeyValue), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RelativeTimeInterval), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToBulkSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToMinimumSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToTargetSOC), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RetrievalMethod), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}RetryCounter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RotationVAtoGA), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAProvisioningCertificateChain), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAScheduleList), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SAScheduleList), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SAScheduleTuple), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAScheduleTupleID), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SAScheduleTupleID), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKISexp), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariff), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariffDescription), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariffEntry), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariffID), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Seed), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SelectedEnergyTransferService), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SelectedPaymentOption), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SelectedVASList), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorID), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorList), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorOrder), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorOrientation), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackageList), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Service), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDetailReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDetailRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDiscoveryReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDiscoveryRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceID), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ServiceID), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceParameterList), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionID), START_ELEMENT({urn:iso:15118:2:2016:MsgHeader}SessionID), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionSetupReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionSetupRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionStopReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionStopRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SigMeterReading), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SignalFrequency), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SignalPulseDuration), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SignalSeparationTime), 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:2016:MsgDataTypes}SubCertificates), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SupportedServiceIDs), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SystemStatusReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SystemStatusRes), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TMeter), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}TargetOffset), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetOffsetX), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetOffsetY), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetSOC), 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:2016:MsgBody}V2GRequest), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}V2GResponse), START_ELEMENT({urn:iso:15118:2:2016:MsgDef}V2G_Message), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VASList), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Value), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckInReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckInRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckOutReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckOutRes), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleSpace), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}WPT_EVChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}WPT_EVSEChargeParameter), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}WeldingDetectionReq), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}WeldingDetectionRes), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerSerial), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SerialNumber), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}XCoordinate), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}YCoordinate), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ZCoordinate), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}amount), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}boolValue), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}byteValue), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}costKind), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}duration), START_ELEMENT({urn:iso:15118:2:2016:MsgBody}eMAID), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}intValue), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}physicalValue), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}shortValue), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}start), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}startValue), START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}stringValue), START_ELEMENT_GENERIC, END_DOCUMENT] */
		if ( exiFrag->AC_BidirectionalControlReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AC_BidirectionalControlReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 0);
			if(errn == 0) {
				errn = encode_iso2AC_BidirectionalControlReqType(stream, &exiFrag->AC_BidirectionalControlReq );
			}
		} else if ( exiFrag->AC_BidirectionalControlRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AC_BidirectionalControlRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 1);
			if(errn == 0) {
				errn = encode_iso2AC_BidirectionalControlResType(stream, &exiFrag->AC_BidirectionalControlRes );
			}
		} else if ( exiFrag->AC_EVBidirectionalParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVBidirectionalParameter) */
			errn = encodeNBitUnsignedInteger(stream, 9, 2);
			if(errn == 0) {
				errn = encode_iso2AC_EVBidirectionalParameterType(stream, &exiFrag->AC_EVBidirectionalParameter );
			}
		} else if ( exiFrag->AC_EVChargeParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVChargeParameter) */
			errn = encodeNBitUnsignedInteger(stream, 9, 3);
			if(errn == 0) {
				errn = encode_iso2AC_EVChargeParameterType(stream, &exiFrag->AC_EVChargeParameter );
			}
		} else if ( exiFrag->AC_EVSEBidirectionalParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVSEBidirectionalParameter) */
			errn = encodeNBitUnsignedInteger(stream, 9, 4);
			if(errn == 0) {
				errn = encode_iso2AC_EVSEBidirectionalParameterType(stream, &exiFrag->AC_EVSEBidirectionalParameter );
			}
		} else if ( exiFrag->AC_EVSEChargeParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AC_EVSEChargeParameter) */
			errn = encodeNBitUnsignedInteger(stream, 9, 5);
			if(errn == 0) {
				errn = encode_iso2AC_EVSEChargeParameterType(stream, &exiFrag->AC_EVSEChargeParameter );
			}
		} else if ( exiFrag->AlignmentCheckParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AlignmentCheckParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 6);
			if(errn == 0) {
				errn = encode_iso2ParameterSetType(stream, &exiFrag->AlignmentCheckParameters );
			}
		} else if ( exiFrag->AlignmentCheckReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AlignmentCheckReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 7);
			if(errn == 0) {
				errn = encode_iso2AlignmentCheckReqType(stream, &exiFrag->AlignmentCheckReq );
			}
		} else if ( exiFrag->AlignmentCheckRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AlignmentCheckRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 8);
			if(errn == 0) {
				errn = encode_iso2AlignmentCheckResType(stream, &exiFrag->AlignmentCheckRes );
			}
		} else if ( exiFrag->AlignmentOffset_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AlignmentOffset) */
			errn = encodeNBitUnsignedInteger(stream, 9, 9);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, exiFrag->AlignmentOffset);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->AngleGAtoVA_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}AngleGAtoVA) */
			errn = encodeNBitUnsignedInteger(stream, 9, 10);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->AngleGAtoVA );
			}
		} else if ( exiFrag->AuthorizationReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AuthorizationReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 11);
			if(errn == 0) {
				errn = encode_iso2AuthorizationReqType(stream, &exiFrag->AuthorizationReq );
			}
		} else if ( exiFrag->AuthorizationRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}AuthorizationRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 12);
			if(errn == 0) {
				errn = encode_iso2AuthorizationResType(stream, &exiFrag->AuthorizationRes );
			}
		} else if ( exiFrag->Body_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDef}Body) */
			errn = encodeNBitUnsignedInteger(stream, 9, 13);
			if(errn == 0) {
				errn = encode_iso2BodyType(stream, &exiFrag->Body );
			}
		} else if ( exiFrag->BodyElement_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}BodyElement) */
			errn = encodeNBitUnsignedInteger(stream, 9, 14);
			if(errn == 0) {
				errn = encode_iso2BodyBaseType(stream, &exiFrag->BodyElement );
			}
		} else if ( exiFrag->BulkChargingComplete_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkChargingComplete) */
			errn = encodeNBitUnsignedInteger(stream, 9, 15);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BOOLEAN]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeBoolean(stream, exiFrag->BulkChargingComplete);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->BulkSOC_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BulkSOC) */
			errn = encodeNBitUnsignedInteger(stream, 9, 16);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(exiFrag->BulkSOC - 0));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->BuyBackTariff_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}BuyBackTariff) */
			errn = encodeNBitUnsignedInteger(stream, 9, 17);
			if(errn == 0) {
				errn = encode_iso2SalesTariffType(stream, &exiFrag->BuyBackTariff );
			}
		} else if ( exiFrag->CableCheckReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CableCheckReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 18);
			if(errn == 0) {
				errn = encode_iso2CableCheckReqType(stream, &exiFrag->CableCheckReq );
			}
		} else if ( exiFrag->CableCheckRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CableCheckRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 19);
			if(errn == 0) {
				errn = encode_iso2CableCheckResType(stream, &exiFrag->CableCheckRes );
			}
		} else if ( exiFrag->CanonicalizationMethod_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod) */
			errn = encodeNBitUnsignedInteger(stream, 9, 20);
			if(errn == 0) {
				errn = encode_iso2CanonicalizationMethodType(stream, &exiFrag->CanonicalizationMethod );
			}
		} else if ( exiFrag->Certificate_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Certificate) */
			errn = encodeNBitUnsignedInteger(stream, 9, 21);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->Certificate.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->Certificate.bytes, exiFrag->Certificate.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->CertificateInstallationReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateInstallationReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 22);
			if(errn == 0) {
				errn = encode_iso2CertificateInstallationReqType(stream, &exiFrag->CertificateInstallationReq );
			}
		} else if ( exiFrag->CertificateInstallationRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateInstallationRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 23);
			if(errn == 0) {
				errn = encode_iso2CertificateInstallationResType(stream, &exiFrag->CertificateInstallationRes );
			}
		} else if ( exiFrag->CertificateUpdateReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateUpdateReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 24);
			if(errn == 0) {
				errn = encode_iso2CertificateUpdateReqType(stream, &exiFrag->CertificateUpdateReq );
			}
		} else if ( exiFrag->CertificateUpdateRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CertificateUpdateRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 25);
			if(errn == 0) {
				errn = encode_iso2CertificateUpdateResType(stream, &exiFrag->CertificateUpdateRes );
			}
		} else if ( exiFrag->ChargeParameterDiscoveryReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargeParameterDiscoveryReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 26);
			if(errn == 0) {
				errn = encode_iso2ChargeParameterDiscoveryReqType(stream, &exiFrag->ChargeParameterDiscoveryReq );
			}
		} else if ( exiFrag->ChargeParameterDiscoveryRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargeParameterDiscoveryRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 27);
			if(errn == 0) {
				errn = encode_iso2ChargeParameterDiscoveryResType(stream, &exiFrag->ChargeParameterDiscoveryRes );
			}
		} else if ( exiFrag->ChargeProgress_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargeProgress) */
			errn = encodeNBitUnsignedInteger(stream, 9, 28);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 2, exiFrag->ChargeProgress);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->ChargingComplete_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingComplete) */
			errn = encodeNBitUnsignedInteger(stream, 9, 29);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BOOLEAN]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeBoolean(stream, exiFrag->ChargingComplete);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->ChargingPerformance_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ChargingPerformance) */
			errn = encodeNBitUnsignedInteger(stream, 9, 30);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->ChargingPerformance );
			}
		} else if ( exiFrag->ChargingProfile_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingProfile) */
			errn = encodeNBitUnsignedInteger(stream, 9, 31);
			if(errn == 0) {
				errn = encode_iso2ChargingProfileType(stream, &exiFrag->ChargingProfile );
			}
		} else if ( exiFrag->ChargingSession_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingSession) */
			errn = encodeNBitUnsignedInteger(stream, 9, 32);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 1, exiFrag->ChargingSession);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->ChargingStatusReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingStatusReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 33);
			if(errn == 0) {
				errn = encode_iso2ChargingStatusReqType(stream, &exiFrag->ChargingStatusReq );
			}
		} else if ( exiFrag->ChargingStatusRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ChargingStatusRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 34);
			if(errn == 0) {
				errn = encode_iso2ChargingStatusResType(stream, &exiFrag->ChargingStatusRes );
			}
		} else if ( exiFrag->CheckOutTime_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CheckOutTime) */
			errn = encodeNBitUnsignedInteger(stream, 9, 35);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger64(stream, exiFrag->CheckOutTime);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->ConnectChargingDeviceReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ConnectChargingDeviceReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 36);
			if(errn == 0) {
				errn = encode_iso2ConnectChargingDeviceReqType(stream, &exiFrag->ConnectChargingDeviceReq );
			}
		} else if ( exiFrag->ConnectChargingDeviceRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ConnectChargingDeviceRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 37);
			if(errn == 0) {
				errn = encode_iso2ConnectChargingDeviceResType(stream, &exiFrag->ConnectChargingDeviceRes );
			}
		} else if ( exiFrag->ConsumptionCost_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ConsumptionCost) */
			errn = encodeNBitUnsignedInteger(stream, 9, 38);
			if(errn == 0) {
				errn = encode_iso2ConsumptionCostType(stream, &exiFrag->ConsumptionCost );
			}
		} else if ( exiFrag->ContractSignatureCertChain_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ContractSignatureCertChain) */
			errn = encodeNBitUnsignedInteger(stream, 9, 39);
			if(errn == 0) {
				errn = encode_iso2CertificateChainType(stream, &exiFrag->ContractSignatureCertChain );
			}
		} else if ( exiFrag->ContractSignatureEncryptedPrivateKey_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ContractSignatureEncryptedPrivateKey) */
			errn = encodeNBitUnsignedInteger(stream, 9, 40);
			if(errn == 0) {
				errn = encode_iso2ContractSignatureEncryptedPrivateKeyType(stream, &exiFrag->ContractSignatureEncryptedPrivateKey );
			}
		} else if ( exiFrag->Cost_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Cost) */
			errn = encodeNBitUnsignedInteger(stream, 9, 41);
			if(errn == 0) {
				errn = encode_iso2CostType(stream, &exiFrag->Cost );
			}
		} else if ( exiFrag->CurrentDemandReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CurrentDemandReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 42);
			if(errn == 0) {
				errn = encode_iso2CurrentDemandReqType(stream, &exiFrag->CurrentDemandReq );
			}
		} else if ( exiFrag->CurrentDemandRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}CurrentDemandRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 43);
			if(errn == 0) {
				errn = encode_iso2CurrentDemandResType(stream, &exiFrag->CurrentDemandRes );
			}
		} else if ( exiFrag->CurrentRange_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}CurrentRange) */
			errn = encodeNBitUnsignedInteger(stream, 9, 44);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, exiFrag->CurrentRange);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->CurrentSOC_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}CurrentSOC) */
			errn = encodeNBitUnsignedInteger(stream, 9, 45);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(exiFrag->CurrentSOC - 0));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->DC_BidirectionalControlReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DC_BidirectionalControlReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 46);
			if(errn == 0) {
				errn = encode_iso2DC_BidirectionalControlReqType(stream, &exiFrag->DC_BidirectionalControlReq );
			}
		} else if ( exiFrag->DC_BidirectionalControlRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DC_BidirectionalControlRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 47);
			if(errn == 0) {
				errn = encode_iso2DC_BidirectionalControlResType(stream, &exiFrag->DC_BidirectionalControlRes );
			}
		} else if ( exiFrag->DC_EVBidirectionalParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVBidirectionalParameter) */
			errn = encodeNBitUnsignedInteger(stream, 9, 48);
			if(errn == 0) {
				errn = encode_iso2DC_EVBidirectionalParameterType(stream, &exiFrag->DC_EVBidirectionalParameter );
			}
		} else if ( exiFrag->DC_EVChargeParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVChargeParameter) */
			errn = encodeNBitUnsignedInteger(stream, 9, 49);
			if(errn == 0) {
				errn = encode_iso2DC_EVChargeParameterType(stream, &exiFrag->DC_EVChargeParameter );
			}
		} else if ( exiFrag->DC_EVSEBidirectionalParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVSEBidirectionalParameter) */
			errn = encodeNBitUnsignedInteger(stream, 9, 50);
			if(errn == 0) {
				errn = encode_iso2DC_EVSEBidirectionalParameterType(stream, &exiFrag->DC_EVSEBidirectionalParameter );
			}
		} else if ( exiFrag->DC_EVSEChargeParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DC_EVSEChargeParameter) */
			errn = encodeNBitUnsignedInteger(stream, 9, 51);
			if(errn == 0) {
				errn = encode_iso2DC_EVSEChargeParameterType(stream, &exiFrag->DC_EVSEChargeParameter );
			}
		} else if ( exiFrag->DHpublickey_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DHpublickey) */
			errn = encodeNBitUnsignedInteger(stream, 9, 52);
			if(errn == 0) {
				errn = encode_iso2DiffieHellmanPublickeyType(stream, &exiFrag->DHpublickey );
			}
		} else if ( exiFrag->DSAKeyValue_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DSAKeyValue) */
			errn = encodeNBitUnsignedInteger(stream, 9, 53);
			if(errn == 0) {
				errn = encode_iso2DSAKeyValueType(stream, &exiFrag->DSAKeyValue );
			}
		} else if ( exiFrag->DepartureTime_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}DepartureTime) */
			errn = encodeNBitUnsignedInteger(stream, 9, 54);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger32(stream, exiFrag->DepartureTime);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->DigestMethod_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod) */
			errn = encodeNBitUnsignedInteger(stream, 9, 55);
			if(errn == 0) {
				errn = encode_iso2DigestMethodType(stream, &exiFrag->DigestMethod );
			}
		} else if ( exiFrag->DigestValue_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestValue) */
			errn = encodeNBitUnsignedInteger(stream, 9, 56);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->DigestValue.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->DigestValue.bytes, exiFrag->DigestValue.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->DisconnectChargingDeviceReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisconnectChargingDeviceReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 57);
			if(errn == 0) {
				errn = encode_iso2DisconnectChargingDeviceReqType(stream, &exiFrag->DisconnectChargingDeviceReq );
			}
		} else if ( exiFrag->DisconnectChargingDeviceRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisconnectChargingDeviceRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 58);
			if(errn == 0) {
				errn = encode_iso2DisconnectChargingDeviceResType(stream, &exiFrag->DisconnectChargingDeviceRes );
			}
		} else if ( exiFrag->DisplayParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}DisplayParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 59);
			if(errn == 0) {
				errn = encode_iso2DisplayParametersType(stream, &exiFrag->DisplayParameters );
			}
		} else if ( exiFrag->Distance_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Distance) */
			errn = encodeNBitUnsignedInteger(stream, 9, 60);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, exiFrag->Distance);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EPriceLevel_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EPriceLevel) */
			errn = encodeNBitUnsignedInteger(stream, 9, 61);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(exiFrag->EPriceLevel - 0));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVCCID_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVCCID) */
			errn = encodeNBitUnsignedInteger(stream, 9, 62);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_HEX]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->EVCCID.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->EVCCID.bytes, exiFrag->EVCCID.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVCheckInStatus_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVCheckInStatus) */
			errn = encodeNBitUnsignedInteger(stream, 9, 63);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 2, exiFrag->EVCheckInStatus);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVCheckOutStatus_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVCheckOutStatus) */
			errn = encodeNBitUnsignedInteger(stream, 9, 64);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 2, exiFrag->EVCheckOutStatus);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVElectricalChargingDeviceStatus_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVElectricalChargingDeviceStatus) */
			errn = encodeNBitUnsignedInteger(stream, 9, 65);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 1, exiFrag->EVElectricalChargingDeviceStatus);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVEnergyTransferParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVEnergyTransferParameter) */
			errn = encodeNBitUnsignedInteger(stream, 9, 66);
			if(errn == 0) {
				errn = encode_iso2EVEnergyTransferParameterType(stream, &exiFrag->EVEnergyTransferParameter );
			}
		} else if ( exiFrag->EVFinePositioningParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVFinePositioningParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 67);
			if(errn == 0) {
				errn = encode_iso2EVFinePositioningParametersType(stream, &exiFrag->EVFinePositioningParameters );
			}
		} else if ( exiFrag->EVFinePositioningSetupParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVFinePositioningSetupParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 68);
			if(errn == 0) {
				errn = encode_iso2EVFinePositioningSetupParametersType(stream, &exiFrag->EVFinePositioningSetupParameters );
			}
		} else if ( exiFrag->EVInputPower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVInputPower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 69);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVInputPower );
			}
		} else if ( exiFrag->EVMaximumChargeCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargeCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 70);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMaximumChargeCurrent );
			}
		} else if ( exiFrag->EVMaximumChargeCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumChargeCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 71);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMaximumChargeCurrent );
			}
		} else if ( exiFrag->EVMaximumChargePower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumChargePower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 72);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMaximumChargePower );
			}
		} else if ( exiFrag->EVMaximumChargePower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumChargePower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 73);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMaximumChargePower );
			}
		} else if ( exiFrag->EVMaximumCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 74);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMaximumCurrent );
			}
		} else if ( exiFrag->EVMaximumDischargeCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumDischargeCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 75);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMaximumDischargeCurrent );
			}
		} else if ( exiFrag->EVMaximumDischargeCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargeCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 76);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMaximumDischargeCurrent );
			}
		} else if ( exiFrag->EVMaximumDischargePower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumDischargePower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 77);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMaximumDischargePower );
			}
		} else if ( exiFrag->EVMaximumDischargePower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumDischargePower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 78);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMaximumDischargePower );
			}
		} else if ( exiFrag->EVMaximumEnergyRequest_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumEnergyRequest) */
			errn = encodeNBitUnsignedInteger(stream, 9, 79);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMaximumEnergyRequest );
			}
		} else if ( exiFrag->EVMaximumEnergyRequest_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumEnergyRequest) */
			errn = encodeNBitUnsignedInteger(stream, 9, 80);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMaximumEnergyRequest );
			}
		} else if ( exiFrag->EVMaximumPower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumPower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 81);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMaximumPower );
			}
		} else if ( exiFrag->EVMaximumPower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumPower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 82);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMaximumPower );
			}
		} else if ( exiFrag->EVMaximumVoltage_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMaximumVoltage) */
			errn = encodeNBitUnsignedInteger(stream, 9, 83);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMaximumVoltage );
			}
		} else if ( exiFrag->EVMaximumVoltage_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMaximumVoltage) */
			errn = encodeNBitUnsignedInteger(stream, 9, 84);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMaximumVoltage );
			}
		} else if ( exiFrag->EVMechanicalChargingDeviceStatus_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMechanicalChargingDeviceStatus) */
			errn = encodeNBitUnsignedInteger(stream, 9, 85);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 2, exiFrag->EVMechanicalChargingDeviceStatus);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVMinimumChargeCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumChargeCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 86);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMinimumChargeCurrent );
			}
		} else if ( exiFrag->EVMinimumChargeCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumChargeCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 87);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMinimumChargeCurrent );
			}
		} else if ( exiFrag->EVMinimumChargePower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumChargePower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 88);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMinimumChargePower );
			}
		} else if ( exiFrag->EVMinimumDischargeCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumDischargeCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 89);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMinimumDischargeCurrent );
			}
		} else if ( exiFrag->EVMinimumDischargeCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumDischargeCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 90);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMinimumDischargeCurrent );
			}
		} else if ( exiFrag->EVMinimumDischargePower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumDischargePower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 91);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMinimumDischargePower );
			}
		} else if ( exiFrag->EVMinimumEnergyRequest_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumEnergyRequest) */
			errn = encodeNBitUnsignedInteger(stream, 9, 92);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMinimumEnergyRequest );
			}
		} else if ( exiFrag->EVMinimumEnergyRequest_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumEnergyRequest) */
			errn = encodeNBitUnsignedInteger(stream, 9, 93);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMinimumEnergyRequest );
			}
		} else if ( exiFrag->EVMinimumPower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumPower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 94);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMinimumPower );
			}
		} else if ( exiFrag->EVMinimumVoltage_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVMinimumVoltage) */
			errn = encodeNBitUnsignedInteger(stream, 9, 95);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMinimumVoltage );
			}
		} else if ( exiFrag->EVMinimumVoltage_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVMinimumVoltage) */
			errn = encodeNBitUnsignedInteger(stream, 9, 96);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVMinimumVoltage );
			}
		} else if ( exiFrag->EVOperation_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVOperation) */
			errn = encodeNBitUnsignedInteger(stream, 9, 97);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 1, exiFrag->EVOperation);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVPresentActivePower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVPresentActivePower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 98);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVPresentActivePower );
			}
		} else if ( exiFrag->EVPresentReactivePower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVPresentReactivePower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 99);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVPresentReactivePower );
			}
		} else if ( exiFrag->EVProcessing_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVProcessing) */
			errn = encodeNBitUnsignedInteger(stream, 9, 100);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 2, exiFrag->EVProcessing);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVSECheckOutStatus_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSECheckOutStatus) */
			errn = encodeNBitUnsignedInteger(stream, 9, 101);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 2, exiFrag->EVSECheckOutStatus);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVSECurrentLimitAchieved_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSECurrentLimitAchieved) */
			errn = encodeNBitUnsignedInteger(stream, 9, 102);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BOOLEAN]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeBoolean(stream, exiFrag->EVSECurrentLimitAchieved);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVSECurrentRegulationTolerance_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSECurrentRegulationTolerance) */
			errn = encodeNBitUnsignedInteger(stream, 9, 103);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSECurrentRegulationTolerance );
			}
		} else if ( exiFrag->EVSEElectricalChargingDeviceStatus_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEElectricalChargingDeviceStatus) */
			errn = encodeNBitUnsignedInteger(stream, 9, 104);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 1, exiFrag->EVSEElectricalChargingDeviceStatus);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVSEEnergyToBeDelivered_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEEnergyToBeDelivered) */
			errn = encodeNBitUnsignedInteger(stream, 9, 105);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEEnergyToBeDelivered );
			}
		} else if ( exiFrag->EVSEEnergyTransferParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEEnergyTransferParameter) */
			errn = encodeNBitUnsignedInteger(stream, 9, 106);
			if(errn == 0) {
				errn = encode_iso2EVSEEnergyTransferParameterType(stream, &exiFrag->EVSEEnergyTransferParameter );
			}
		} else if ( exiFrag->EVSEFinePositioningParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEFinePositioningParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 107);
			if(errn == 0) {
				errn = encode_iso2EVSEFinePositioningParametersType(stream, &exiFrag->EVSEFinePositioningParameters );
			}
		} else if ( exiFrag->EVSEFinePositioningSetupParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEFinePositioningSetupParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 108);
			if(errn == 0) {
				errn = encode_iso2EVSEFinePositioningSetupParametersType(stream, &exiFrag->EVSEFinePositioningSetupParameters );
			}
		} else if ( exiFrag->EVSEID_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEID) */
			errn = encodeNBitUnsignedInteger(stream, 9, 109);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[STRING]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->EVSEID.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, exiFrag->EVSEID.characters, exiFrag->EVSEID.charactersLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVSEMaximumChargeCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumChargeCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 110);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMaximumChargeCurrent );
			}
		} else if ( exiFrag->EVSEMaximumChargeCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumChargeCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 111);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMaximumChargeCurrent );
			}
		} else if ( exiFrag->EVSEMaximumChargePower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumChargePower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 112);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMaximumChargePower );
			}
		} else if ( exiFrag->EVSEMaximumChargePower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumChargePower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 113);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMaximumChargePower );
			}
		} else if ( exiFrag->EVSEMaximumCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 114);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMaximumCurrent );
			}
		} else if ( exiFrag->EVSEMaximumDischargeCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumDischargeCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 115);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMaximumDischargeCurrent );
			}
		} else if ( exiFrag->EVSEMaximumDischargeCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumDischargeCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 116);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMaximumDischargeCurrent );
			}
		} else if ( exiFrag->EVSEMaximumDischargePower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumDischargePower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 117);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMaximumDischargePower );
			}
		} else if ( exiFrag->EVSEMaximumDischargePower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumDischargePower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 118);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMaximumDischargePower );
			}
		} else if ( exiFrag->EVSEMaximumPower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumPower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 119);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMaximumPower );
			}
		} else if ( exiFrag->EVSEMaximumPower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumPower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 120);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMaximumPower );
			}
		} else if ( exiFrag->EVSEMaximumVoltage_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMaximumVoltage) */
			errn = encodeNBitUnsignedInteger(stream, 9, 121);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMaximumVoltage );
			}
		} else if ( exiFrag->EVSEMaximumVoltage_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMaximumVoltage) */
			errn = encodeNBitUnsignedInteger(stream, 9, 122);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMaximumVoltage );
			}
		} else if ( exiFrag->EVSEMechanicalChargingDeviceStatus_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMechanicalChargingDeviceStatus) */
			errn = encodeNBitUnsignedInteger(stream, 9, 123);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 2, exiFrag->EVSEMechanicalChargingDeviceStatus);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVSEMinimumChargeCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMinimumChargeCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 124);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMinimumChargeCurrent );
			}
		} else if ( exiFrag->EVSEMinimumDischargeCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMinimumDischargeCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 125);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMinimumDischargeCurrent );
			}
		} else if ( exiFrag->EVSEMinimumPower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMinimumPower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 126);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMinimumPower );
			}
		} else if ( exiFrag->EVSEMinimumVoltage_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEMinimumVoltage) */
			errn = encodeNBitUnsignedInteger(stream, 9, 127);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMinimumVoltage );
			}
		} else if ( exiFrag->EVSEMinimumVoltage_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEMinimumVoltage) */
			errn = encodeNBitUnsignedInteger(stream, 9, 128);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEMinimumVoltage );
			}
		} else if ( exiFrag->EVSENominalFrequency_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSENominalFrequency) */
			errn = encodeNBitUnsignedInteger(stream, 9, 129);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSENominalFrequency );
			}
		} else if ( exiFrag->EVSENominalVoltage_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSENominalVoltage) */
			errn = encodeNBitUnsignedInteger(stream, 9, 130);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSENominalVoltage );
			}
		} else if ( exiFrag->EVSENotification_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSENotification) */
			errn = encodeNBitUnsignedInteger(stream, 9, 131);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 1, exiFrag->EVSENotification);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVSEOutputPower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEOutputPower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 132);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEOutputPower );
			}
		} else if ( exiFrag->EVSEPeakCurrentRipple_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVSEPeakCurrentRipple) */
			errn = encodeNBitUnsignedInteger(stream, 9, 133);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEPeakCurrentRipple );
			}
		} else if ( exiFrag->EVSEPowerLimitAchieved_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPowerLimitAchieved) */
			errn = encodeNBitUnsignedInteger(stream, 9, 134);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BOOLEAN]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeBoolean(stream, exiFrag->EVSEPowerLimitAchieved);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVSEPresentCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPresentCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 135);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEPresentCurrent );
			}
		} else if ( exiFrag->EVSEPresentVoltage_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEPresentVoltage) */
			errn = encodeNBitUnsignedInteger(stream, 9, 136);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSEPresentVoltage );
			}
		} else if ( exiFrag->EVSEProcessing_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEProcessing) */
			errn = encodeNBitUnsignedInteger(stream, 9, 137);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 2, exiFrag->EVSEProcessing);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVSEStatus_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEStatus) */
			errn = encodeNBitUnsignedInteger(stream, 9, 138);
			if(errn == 0) {
				errn = encode_iso2EVSEStatusType(stream, &exiFrag->EVSEStatus );
			}
		} else if ( exiFrag->EVSETargetPower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSETargetPower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 139);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSETargetPower );
			}
		} else if ( exiFrag->EVSETargetReactivePower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSETargetReactivePower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 140);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVSETargetReactivePower );
			}
		} else if ( exiFrag->EVSETimeStamp_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSETimeStamp) */
			errn = encodeNBitUnsignedInteger(stream, 9, 141);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeInteger64(stream, exiFrag->EVSETimeStamp);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVSEVoltageLimitAchieved_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVSEVoltageLimitAchieved) */
			errn = encodeNBitUnsignedInteger(stream, 9, 142);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BOOLEAN]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeBoolean(stream, exiFrag->EVSEVoltageLimitAchieved);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EVTargetCurrent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetCurrent) */
			errn = encodeNBitUnsignedInteger(stream, 9, 143);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVTargetCurrent );
			}
		} else if ( exiFrag->EVTargetEnergyRequest_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetEnergyRequest) */
			errn = encodeNBitUnsignedInteger(stream, 9, 144);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVTargetEnergyRequest );
			}
		} else if ( exiFrag->EVTargetEnergyRequest_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EVTargetEnergyRequest) */
			errn = encodeNBitUnsignedInteger(stream, 9, 145);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVTargetEnergyRequest );
			}
		} else if ( exiFrag->EVTargetPower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetPower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 146);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVTargetPower );
			}
		} else if ( exiFrag->EVTargetVoltage_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EVTargetVoltage) */
			errn = encodeNBitUnsignedInteger(stream, 9, 147);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->EVTargetVoltage );
			}
		} else if ( exiFrag->EffectiveRadiatedPower_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}EffectiveRadiatedPower) */
			errn = encodeNBitUnsignedInteger(stream, 9, 148);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(exiFrag->EffectiveRadiatedPower + 128));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->EnergyTransferServiceList_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}EnergyTransferServiceList) */
			errn = encodeNBitUnsignedInteger(stream, 9, 149);
			if(errn == 0) {
				errn = encode_iso2ServiceListType(stream, &exiFrag->EnergyTransferServiceList );
			}
		} else if ( exiFrag->Exponent_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Exponent) */
			errn = EXI_UNSUPPORTED_FRAGMENT_ELEMENT; /* overlapping name Exponent */
		} else if ( exiFrag->Exponent_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Exponent) */
			errn = EXI_UNSUPPORTED_FRAGMENT_ELEMENT; /* overlapping name Exponent */
		} else if ( exiFrag->FODStatus_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}FODStatus) */
			errn = encodeNBitUnsignedInteger(stream, 9, 152);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 2, exiFrag->FODStatus);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->FinePositioningReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 153);
			if(errn == 0) {
				errn = encode_iso2FinePositioningReqType(stream, &exiFrag->FinePositioningReq );
			}
		} else if ( exiFrag->FinePositioningRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 154);
			if(errn == 0) {
				errn = encode_iso2FinePositioningResType(stream, &exiFrag->FinePositioningRes );
			}
		} else if ( exiFrag->FinePositioningSetupReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningSetupReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 155);
			if(errn == 0) {
				errn = encode_iso2FinePositioningSetupReqType(stream, &exiFrag->FinePositioningSetupReq );
			}
		} else if ( exiFrag->FinePositioningSetupRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}FinePositioningSetupRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 156);
			if(errn == 0) {
				errn = encode_iso2FinePositioningSetupResType(stream, &exiFrag->FinePositioningSetupRes );
			}
		} else if ( exiFrag->FreeService_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}FreeService) */
			errn = encodeNBitUnsignedInteger(stream, 9, 157);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BOOLEAN]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeBoolean(stream, exiFrag->FreeService);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->FrequencyChannel_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}FrequencyChannel) */
			errn = encodeNBitUnsignedInteger(stream, 9, 158);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger32(stream, exiFrag->FrequencyChannel);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->G_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}G) */
			errn = encodeNBitUnsignedInteger(stream, 9, 159);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->G.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->G.bytes, exiFrag->G.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->GAID_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}GAID) */
			errn = encodeNBitUnsignedInteger(stream, 9, 160);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[STRING]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->GAID.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, exiFrag->GAID.characters, exiFrag->GAID.charactersLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->GenChallenge_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}GenChallenge) */
			errn = encodeNBitUnsignedInteger(stream, 9, 161);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->GenChallenge.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->GenChallenge.bytes, exiFrag->GenChallenge.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->GenericParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}GenericParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 162);
			if(errn == 0) {
				errn = encode_iso2ParameterSetType(stream, &exiFrag->GenericParameters );
			}
		} else if ( exiFrag->Generic_EVFinePositioningParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Generic_EVFinePositioningParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 163);
			if(errn == 0) {
				errn = encode_iso2Generic_EVFinePositioningParametersType(stream, &exiFrag->Generic_EVFinePositioningParameters );
			}
		} else if ( exiFrag->Generic_EVSEFinePositioningParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Generic_EVSEFinePositioningParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 164);
			if(errn == 0) {
				errn = encode_iso2Generic_EVSEFinePositioningParametersType(stream, &exiFrag->Generic_EVSEFinePositioningParameters );
			}
		} else if ( exiFrag->HMACOutputLength_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength) */
			errn = encodeNBitUnsignedInteger(stream, 9, 165);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeInteger64(stream, exiFrag->HMACOutputLength);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->Header_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDef}Header) */
			errn = encodeNBitUnsignedInteger(stream, 9, 166);
			if(errn == 0) {
				errn = encode_iso2MessageHeaderType(stream, &exiFrag->Header );
			}
		} else if ( exiFrag->InletHot_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}InletHot) */
			errn = encodeNBitUnsignedInteger(stream, 9, 167);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BOOLEAN]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeBoolean(stream, exiFrag->InletHot);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->J_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}J) */
			errn = encodeNBitUnsignedInteger(stream, 9, 168);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->J.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->J.bytes, exiFrag->J.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->KeyInfo_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyInfo) */
			errn = encodeNBitUnsignedInteger(stream, 9, 169);
			if(errn == 0) {
				errn = encode_iso2KeyInfoType(stream, &exiFrag->KeyInfo );
			}
		} else if ( exiFrag->KeyName_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyName) */
			errn = encodeNBitUnsignedInteger(stream, 9, 170);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->KeyName.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, exiFrag->KeyName.characters, exiFrag->KeyName.charactersLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->KeyValue_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyValue) */
			errn = encodeNBitUnsignedInteger(stream, 9, 171);
			if(errn == 0) {
				errn = encode_iso2KeyValueType(stream, &exiFrag->KeyValue );
			}
		} else if ( exiFrag->LFA_EVFinePositioningParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVFinePositioningParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 172);
			if(errn == 0) {
				errn = encode_iso2LFA_EVFinePositioningParametersType(stream, &exiFrag->LFA_EVFinePositioningParameters );
			}
		} else if ( exiFrag->LFA_EVFinePositioningSetupParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVFinePositioningSetupParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 173);
			if(errn == 0) {
				errn = encode_iso2LFA_EVFinePositioningSetupParametersType(stream, &exiFrag->LFA_EVFinePositioningSetupParameters );
			}
		} else if ( exiFrag->LFA_EVSEFinePositioningParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVSEFinePositioningParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 174);
			if(errn == 0) {
				errn = encode_iso2LFA_EVSEFinePositioningParametersType(stream, &exiFrag->LFA_EVSEFinePositioningParameters );
			}
		} else if ( exiFrag->LFA_EVSEFinePositioningSetupParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}LFA_EVSEFinePositioningSetupParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 175);
			if(errn == 0) {
				errn = encode_iso2LFA_EVSEFinePositioningSetupParametersType(stream, &exiFrag->LFA_EVSEFinePositioningSetupParameters );
			}
		} else if ( exiFrag->ListOfRootCertificateIDs_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ListOfRootCertificateIDs) */
			errn = encodeNBitUnsignedInteger(stream, 9, 176);
			if(errn == 0) {
				errn = encode_iso2ListOfRootCertificateIDsType(stream, &exiFrag->ListOfRootCertificateIDs );
			}
		} else if ( exiFrag->MV_EVSEFinePositioningParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MV_EVSEFinePositioningParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 177);
			if(errn == 0) {
				errn = encode_iso2MV_EVSEFinePositioningParametersType(stream, &exiFrag->MV_EVSEFinePositioningParameters );
			}
		} else if ( exiFrag->MV_EVSEFinePositioningSetupParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MV_EVSEFinePositioningSetupParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 178);
			if(errn == 0) {
				errn = encode_iso2MV_EVSEFinePositioningSetupParametersType(stream, &exiFrag->MV_EVSEFinePositioningSetupParameters );
			}
		} else if ( exiFrag->MagneticVector_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVector) */
			errn = encodeNBitUnsignedInteger(stream, 9, 179);
			if(errn == 0) {
				errn = encode_iso2MagneticVectorType(stream, &exiFrag->MagneticVector );
			}
		} else if ( exiFrag->MagneticVectorList_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorList) */
			errn = encodeNBitUnsignedInteger(stream, 9, 180);
			if(errn == 0) {
				errn = encode_iso2MagneticVectorListType(stream, &exiFrag->MagneticVectorList );
			}
		} else if ( exiFrag->MagneticVectorSetup_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetup) */
			errn = encodeNBitUnsignedInteger(stream, 9, 181);
			if(errn == 0) {
				errn = encode_iso2MagneticVectorSetupType(stream, &exiFrag->MagneticVectorSetup );
			}
		} else if ( exiFrag->MagneticVectorSetupList_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MagneticVectorSetupList) */
			errn = encodeNBitUnsignedInteger(stream, 9, 182);
			if(errn == 0) {
				errn = encode_iso2MagneticVectorSetupListType(stream, &exiFrag->MagneticVectorSetupList );
			}
		} else if ( exiFrag->Manifest_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Manifest) */
			errn = encodeNBitUnsignedInteger(stream, 9, 183);
			if(errn == 0) {
				errn = encode_iso2ManifestType(stream, &exiFrag->Manifest );
			}
		} else if ( exiFrag->MaxSupportingPoints_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MaxSupportingPoints) */
			errn = encodeNBitUnsignedInteger(stream, 9, 184);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 10, (uint32_t)(exiFrag->MaxSupportingPoints - 12));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->MeasurementData_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementData) */
			errn = encodeNBitUnsignedInteger(stream, 9, 185);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, exiFrag->MeasurementData);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->MeasurementDataList_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeasurementDataList) */
			errn = encodeNBitUnsignedInteger(stream, 9, 186);
			if(errn == 0) {
				errn = encode_iso2MeasurementDataListType(stream, &exiFrag->MeasurementDataList );
			}
		} else if ( exiFrag->MeterID_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeterID) */
			errn = encodeNBitUnsignedInteger(stream, 9, 187);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[STRING]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->MeterID.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, exiFrag->MeterID.characters, exiFrag->MeterID.charactersLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->MeterInfo_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeterInfo) */
			errn = encodeNBitUnsignedInteger(stream, 9, 188);
			if(errn == 0) {
				errn = encode_iso2MeterInfoType(stream, &exiFrag->MeterInfo );
			}
		} else if ( exiFrag->MeterReadingCharged_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeterReadingCharged) */
			errn = encodeNBitUnsignedInteger(stream, 9, 189);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger64(stream, exiFrag->MeterReadingCharged);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->MeterReadingDischarged_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeterReadingDischarged) */
			errn = encodeNBitUnsignedInteger(stream, 9, 190);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger64(stream, exiFrag->MeterReadingDischarged);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->MeterStatus_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MeterStatus) */
			errn = encodeNBitUnsignedInteger(stream, 9, 191);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeInteger16(stream, exiFrag->MeterStatus);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->MeteringReceiptReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeteringReceiptReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 192);
			if(errn == 0) {
				errn = encode_iso2MeteringReceiptReqType(stream, &exiFrag->MeteringReceiptReq );
			}
		} else if ( exiFrag->MeteringReceiptRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MeteringReceiptRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 193);
			if(errn == 0) {
				errn = encode_iso2MeteringReceiptResType(stream, &exiFrag->MeteringReceiptRes );
			}
		} else if ( exiFrag->MgmtData_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData) */
			errn = encodeNBitUnsignedInteger(stream, 9, 194);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->MgmtData.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, exiFrag->MgmtData.characters, exiFrag->MgmtData.charactersLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->MinimumPMaxRequest_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}MinimumPMaxRequest) */
			errn = encodeNBitUnsignedInteger(stream, 9, 195);
			if(errn == 0) {
				errn = encode_iso2MinimumPMaxRequestType(stream, &exiFrag->MinimumPMaxRequest );
			}
		} else if ( exiFrag->MinimumPMaxScheduleEntry_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MinimumPMaxScheduleEntry) */
			errn = encodeNBitUnsignedInteger(stream, 9, 196);
			if(errn == 0) {
				errn = encode_iso2PMaxScheduleEntryType(stream, &exiFrag->MinimumPMaxScheduleEntry );
			}
		} else if ( exiFrag->MinimumSOC_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}MinimumSOC) */
			errn = encodeNBitUnsignedInteger(stream, 9, 197);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(exiFrag->MinimumSOC - 0));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->Modulus_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Modulus) */
			errn = encodeNBitUnsignedInteger(stream, 9, 198);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->Modulus.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->Modulus.bytes, exiFrag->Modulus.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->NotificationMaxDelay_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}NotificationMaxDelay) */
			errn = encodeNBitUnsignedInteger(stream, 9, 199);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, exiFrag->NotificationMaxDelay);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->NumEPriceLevels_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}NumEPriceLevels) */
			errn = encodeNBitUnsignedInteger(stream, 9, 200);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(exiFrag->NumEPriceLevels - 0));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->NumberOfSensors_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}NumberOfSensors) */
			errn = encodeNBitUnsignedInteger(stream, 9, 201);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(exiFrag->NumberOfSensors - 0));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->NumberOfSignalPackages_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}NumberOfSignalPackages) */
			errn = encodeNBitUnsignedInteger(stream, 9, 202);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(exiFrag->NumberOfSignalPackages - 0));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->OEMProvisioningCert_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}OEMProvisioningCert) */
			errn = encodeNBitUnsignedInteger(stream, 9, 203);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->OEMProvisioningCert.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->OEMProvisioningCert.bytes, exiFrag->OEMProvisioningCert.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->Object_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Object) */
			errn = encodeNBitUnsignedInteger(stream, 9, 204);
			if(errn == 0) {
				errn = encode_iso2ObjectType(stream, &exiFrag->Object );
			}
		} else if ( exiFrag->OperationMode_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}OperationMode) */
			errn = encodeNBitUnsignedInteger(stream, 9, 205);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 1, exiFrag->OperationMode);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->P_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}P) */
			errn = encodeNBitUnsignedInteger(stream, 9, 206);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->P.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->P.bytes, exiFrag->P.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->PGPData_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData) */
			errn = encodeNBitUnsignedInteger(stream, 9, 207);
			if(errn == 0) {
				errn = encode_iso2PGPDataType(stream, &exiFrag->PGPData );
			}
		} else if ( exiFrag->PGPKeyID_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyID) */
			errn = encodeNBitUnsignedInteger(stream, 9, 208);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->PGPKeyID.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->PGPKeyID.bytes, exiFrag->PGPKeyID.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->PGPKeyPacket_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket) */
			errn = encodeNBitUnsignedInteger(stream, 9, 209);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->PGPKeyPacket.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->PGPKeyPacket.bytes, exiFrag->PGPKeyPacket.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->PMax_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PMax) */
			errn = encodeNBitUnsignedInteger(stream, 9, 210);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->PMax );
			}
		} else if ( exiFrag->PMaxDischargeSchedule_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PMaxDischargeSchedule) */
			errn = encodeNBitUnsignedInteger(stream, 9, 211);
			if(errn == 0) {
				errn = encode_iso2PMaxScheduleType(stream, &exiFrag->PMaxDischargeSchedule );
			}
		} else if ( exiFrag->PMaxSchedule_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PMaxSchedule) */
			errn = encodeNBitUnsignedInteger(stream, 9, 212);
			if(errn == 0) {
				errn = encode_iso2PMaxScheduleType(stream, &exiFrag->PMaxSchedule );
			}
		} else if ( exiFrag->PMaxScheduleEntry_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PMaxScheduleEntry) */
			errn = encodeNBitUnsignedInteger(stream, 9, 213);
			if(errn == 0) {
				errn = encode_iso2PMaxScheduleEntryType(stream, &exiFrag->PMaxScheduleEntry );
			}
		} else if ( exiFrag->PackageIndex_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PackageIndex) */
			errn = encodeNBitUnsignedInteger(stream, 9, 214);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger32(stream, exiFrag->PackageIndex);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->PackageSeparationTime_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PackageSeparationTime) */
			errn = encodeNBitUnsignedInteger(stream, 9, 215);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(exiFrag->PackageSeparationTime - 0));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->PairingParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PairingParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 216);
			if(errn == 0) {
				errn = encode_iso2ParameterSetType(stream, &exiFrag->PairingParameters );
			}
		} else if ( exiFrag->PairingReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PairingReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 217);
			if(errn == 0) {
				errn = encode_iso2PairingReqType(stream, &exiFrag->PairingReq );
			}
		} else if ( exiFrag->PairingRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PairingRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 218);
			if(errn == 0) {
				errn = encode_iso2PairingResType(stream, &exiFrag->PairingRes );
			}
		} else if ( exiFrag->Parameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Parameter) */
			errn = encodeNBitUnsignedInteger(stream, 9, 219);
			if(errn == 0) {
				errn = encode_iso2ParameterType(stream, &exiFrag->Parameter );
			}
		} else if ( exiFrag->ParameterSet_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSet) */
			errn = encodeNBitUnsignedInteger(stream, 9, 220);
			if(errn == 0) {
				errn = encode_iso2ParameterSetType(stream, &exiFrag->ParameterSet );
			}
		} else if ( exiFrag->ParameterSetID_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ParameterSetID) */
			errn = encodeNBitUnsignedInteger(stream, 9, 221);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, exiFrag->ParameterSetID);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->ParkingMethod_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ParkingMethod) */
			errn = encodeNBitUnsignedInteger(stream, 9, 222);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 2, exiFrag->ParkingMethod);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->PaymentDetailsReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentDetailsReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 223);
			if(errn == 0) {
				errn = encode_iso2PaymentDetailsReqType(stream, &exiFrag->PaymentDetailsReq );
			}
		} else if ( exiFrag->PaymentDetailsRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentDetailsRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 224);
			if(errn == 0) {
				errn = encode_iso2PaymentDetailsResType(stream, &exiFrag->PaymentDetailsRes );
			}
		} else if ( exiFrag->PaymentOption_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}PaymentOption) */
			errn = encodeNBitUnsignedInteger(stream, 9, 225);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 1, exiFrag->PaymentOption);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->PaymentOptionList_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentOptionList) */
			errn = encodeNBitUnsignedInteger(stream, 9, 226);
			if(errn == 0) {
				errn = encode_iso2PaymentOptionListType(stream, &exiFrag->PaymentOptionList );
			}
		} else if ( exiFrag->PaymentServiceSelectionReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentServiceSelectionReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 227);
			if(errn == 0) {
				errn = encode_iso2PaymentServiceSelectionReqType(stream, &exiFrag->PaymentServiceSelectionReq );
			}
		} else if ( exiFrag->PaymentServiceSelectionRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PaymentServiceSelectionRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 228);
			if(errn == 0) {
				errn = encode_iso2PaymentServiceSelectionResType(stream, &exiFrag->PaymentServiceSelectionRes );
			}
		} else if ( exiFrag->PgenCounter_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PgenCounter) */
			errn = encodeNBitUnsignedInteger(stream, 9, 229);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->PgenCounter.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->PgenCounter.bytes, exiFrag->PgenCounter.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->PowerDeliveryReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDeliveryReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 230);
			if(errn == 0) {
				errn = encode_iso2PowerDeliveryReqType(stream, &exiFrag->PowerDeliveryReq );
			}
		} else if ( exiFrag->PowerDeliveryRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDeliveryRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 231);
			if(errn == 0) {
				errn = encode_iso2PowerDeliveryResType(stream, &exiFrag->PowerDeliveryRes );
			}
		} else if ( exiFrag->PowerDemandParameters_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandParameters) */
			errn = encodeNBitUnsignedInteger(stream, 9, 232);
			if(errn == 0) {
				errn = encode_iso2ParameterSetType(stream, &exiFrag->PowerDemandParameters );
			}
		} else if ( exiFrag->PowerDemandReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 233);
			if(errn == 0) {
				errn = encode_iso2PowerDemandReqType(stream, &exiFrag->PowerDemandReq );
			}
		} else if ( exiFrag->PowerDemandRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PowerDemandRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 234);
			if(errn == 0) {
				errn = encode_iso2PowerDemandResType(stream, &exiFrag->PowerDemandRes );
			}
		} else if ( exiFrag->PreChargeReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PreChargeReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 235);
			if(errn == 0) {
				errn = encode_iso2PreChargeReqType(stream, &exiFrag->PreChargeReq );
			}
		} else if ( exiFrag->PreChargeRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}PreChargeRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 236);
			if(errn == 0) {
				errn = encode_iso2PreChargeResType(stream, &exiFrag->PreChargeRes );
			}
		} else if ( exiFrag->ProfileEntry_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ProfileEntry) */
			errn = encodeNBitUnsignedInteger(stream, 9, 237);
			if(errn == 0) {
				errn = encode_iso2PMaxScheduleEntryType(stream, &exiFrag->ProfileEntry );
			}
		} else if ( exiFrag->Q_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Q) */
			errn = encodeNBitUnsignedInteger(stream, 9, 238);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->Q.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->Q.bytes, exiFrag->Q.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->RSAKeyValue_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RSAKeyValue) */
			errn = encodeNBitUnsignedInteger(stream, 9, 239);
			if(errn == 0) {
				errn = encode_iso2RSAKeyValueType(stream, &exiFrag->RSAKeyValue );
			}
		} else if ( exiFrag->ReceiptRequired_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ReceiptRequired) */
			errn = encodeNBitUnsignedInteger(stream, 9, 240);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BOOLEAN]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeBoolean(stream, exiFrag->ReceiptRequired);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->Reference_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference) */
			errn = encodeNBitUnsignedInteger(stream, 9, 241);
			if(errn == 0) {
				errn = encode_iso2ReferenceType(stream, &exiFrag->Reference );
			}
		} else if ( exiFrag->RelativeTimeInterval_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RelativeTimeInterval) */
			errn = encodeNBitUnsignedInteger(stream, 9, 242);
			if(errn == 0) {
				errn = encode_iso2RelativeTimeIntervalType(stream, &exiFrag->RelativeTimeInterval );
			}
		} else if ( exiFrag->RemainingTimeToBulkSOC_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToBulkSOC) */
			errn = encodeNBitUnsignedInteger(stream, 9, 243);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(exiFrag->RemainingTimeToBulkSOC - 0));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->RemainingTimeToMinimumSOC_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToMinimumSOC) */
			errn = encodeNBitUnsignedInteger(stream, 9, 244);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(exiFrag->RemainingTimeToMinimumSOC - 0));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->RemainingTimeToTargetSOC_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RemainingTimeToTargetSOC) */
			errn = encodeNBitUnsignedInteger(stream, 9, 245);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(exiFrag->RemainingTimeToTargetSOC - 0));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->ResponseCode_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ResponseCode) */
			errn = encodeNBitUnsignedInteger(stream, 9, 246);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 5, exiFrag->ResponseCode);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->RetrievalMethod_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RetrievalMethod) */
			errn = encodeNBitUnsignedInteger(stream, 9, 247);
			if(errn == 0) {
				errn = encode_iso2RetrievalMethodType(stream, &exiFrag->RetrievalMethod );
			}
		} else if ( exiFrag->RetryCounter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}RetryCounter) */
			errn = encodeNBitUnsignedInteger(stream, 9, 248);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeInteger16(stream, exiFrag->RetryCounter);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->RootCertificateID_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RootCertificateID) */
			errn = encodeNBitUnsignedInteger(stream, 9, 249);
			if(errn == 0) {
				errn = encode_iso2X509IssuerSerialType(stream, &exiFrag->RootCertificateID );
			}
		} else if ( exiFrag->RotationVAtoGA_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}RotationVAtoGA) */
			errn = encodeNBitUnsignedInteger(stream, 9, 250);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->RotationVAtoGA );
			}
		} else if ( exiFrag->SAProvisioningCertificateChain_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAProvisioningCertificateChain) */
			errn = encodeNBitUnsignedInteger(stream, 9, 251);
			if(errn == 0) {
				errn = encode_iso2CertificateChainType(stream, &exiFrag->SAProvisioningCertificateChain );
			}
		} else if ( exiFrag->SAScheduleList_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAScheduleList) */
			errn = encodeNBitUnsignedInteger(stream, 9, 252);
			if(errn == 0) {
				errn = encode_iso2SAScheduleListType(stream, &exiFrag->SAScheduleList );
			}
		} else if ( exiFrag->SAScheduleList_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SAScheduleList) */
			errn = encodeNBitUnsignedInteger(stream, 9, 253);
			if(errn == 0) {
				errn = encode_iso2SAScheduleListType(stream, &exiFrag->SAScheduleList );
			}
		} else if ( exiFrag->SAScheduleTuple_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SAScheduleTuple) */
			errn = encodeNBitUnsignedInteger(stream, 9, 254);
			if(errn == 0) {
				errn = encode_iso2SAScheduleTupleType(stream, &exiFrag->SAScheduleTuple );
			}
		} else if ( exiFrag->SAScheduleTupleID_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SAScheduleTupleID) */
			errn = encodeNBitUnsignedInteger(stream, 9, 255);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(exiFrag->SAScheduleTupleID - 1));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->SAScheduleTupleID_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SAScheduleTupleID) */
			errn = encodeNBitUnsignedInteger(stream, 9, 256);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(exiFrag->SAScheduleTupleID - 1));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->SPKIData_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData) */
			errn = encodeNBitUnsignedInteger(stream, 9, 257);
			if(errn == 0) {
				errn = encode_iso2SPKIDataType(stream, &exiFrag->SPKIData );
			}
		} else if ( exiFrag->SPKISexp_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKISexp) */
			errn = encodeNBitUnsignedInteger(stream, 9, 258);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->SPKISexp.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->SPKISexp.bytes, exiFrag->SPKISexp.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->SalesTariff_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariff) */
			errn = encodeNBitUnsignedInteger(stream, 9, 259);
			if(errn == 0) {
				errn = encode_iso2SalesTariffType(stream, &exiFrag->SalesTariff );
			}
		} else if ( exiFrag->SalesTariffDescription_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariffDescription) */
			errn = encodeNBitUnsignedInteger(stream, 9, 260);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[STRING]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->SalesTariffDescription.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, exiFrag->SalesTariffDescription.characters, exiFrag->SalesTariffDescription.charactersLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->SalesTariffEntry_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariffEntry) */
			errn = encodeNBitUnsignedInteger(stream, 9, 261);
			if(errn == 0) {
				errn = encode_iso2SalesTariffEntryType(stream, &exiFrag->SalesTariffEntry );
			}
		} else if ( exiFrag->SalesTariffID_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SalesTariffID) */
			errn = encodeNBitUnsignedInteger(stream, 9, 262);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(exiFrag->SalesTariffID - 1));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->Seed_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Seed) */
			errn = encodeNBitUnsignedInteger(stream, 9, 263);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->Seed.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->Seed.bytes, exiFrag->Seed.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->SelectedEnergyTransferService_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SelectedEnergyTransferService) */
			errn = encodeNBitUnsignedInteger(stream, 9, 264);
			if(errn == 0) {
				errn = encode_iso2SelectedServiceType(stream, &exiFrag->SelectedEnergyTransferService );
			}
		} else if ( exiFrag->SelectedPaymentOption_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SelectedPaymentOption) */
			errn = encodeNBitUnsignedInteger(stream, 9, 265);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 1, exiFrag->SelectedPaymentOption);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->SelectedService_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SelectedService) */
			errn = encodeNBitUnsignedInteger(stream, 9, 266);
			if(errn == 0) {
				errn = encode_iso2SelectedServiceType(stream, &exiFrag->SelectedService );
			}
		} else if ( exiFrag->SelectedVASList_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SelectedVASList) */
			errn = encodeNBitUnsignedInteger(stream, 9, 267);
			if(errn == 0) {
				errn = encode_iso2SelectedServiceListType(stream, &exiFrag->SelectedVASList );
			}
		} else if ( exiFrag->Sensor_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Sensor) */
			errn = encodeNBitUnsignedInteger(stream, 9, 268);
			if(errn == 0) {
				errn = encode_iso2SensorType(stream, &exiFrag->Sensor );
			}
		} else if ( exiFrag->SensorID_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorID) */
			errn = encodeNBitUnsignedInteger(stream, 9, 269);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(exiFrag->SensorID - 0));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->SensorList_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorList) */
			errn = encodeNBitUnsignedInteger(stream, 9, 270);
			if(errn == 0) {
				errn = encode_iso2SensorListType(stream, &exiFrag->SensorList );
			}
		} else if ( exiFrag->SensorMeasurements_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorMeasurements) */
			errn = encodeNBitUnsignedInteger(stream, 9, 271);
			if(errn == 0) {
				errn = encode_iso2SensorMeasurementsType(stream, &exiFrag->SensorMeasurements );
			}
		} else if ( exiFrag->SensorOrder_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorOrder) */
			errn = encodeNBitUnsignedInteger(stream, 9, 272);
			if(errn == 0) {
				errn = encode_iso2SensorOrderListType(stream, &exiFrag->SensorOrder );
			}
		} else if ( exiFrag->SensorOrientation_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorOrientation) */
			errn = encodeNBitUnsignedInteger(stream, 9, 273);
			if(errn == 0) {
				errn = encode_iso2CartesianCoordinatesType(stream, &exiFrag->SensorOrientation );
			}
		} else if ( exiFrag->SensorPackage_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackage) */
			errn = encodeNBitUnsignedInteger(stream, 9, 274);
			if(errn == 0) {
				errn = encode_iso2SensorPackageType(stream, &exiFrag->SensorPackage );
			}
		} else if ( exiFrag->SensorPackageList_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPackageList) */
			errn = encodeNBitUnsignedInteger(stream, 9, 275);
			if(errn == 0) {
				errn = encode_iso2SensorPackageListType(stream, &exiFrag->SensorPackageList );
			}
		} else if ( exiFrag->SensorPosition_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SensorPosition) */
			errn = EXI_UNSUPPORTED_FRAGMENT_ELEMENT; /* overlapping name SensorPosition */
		} else if ( exiFrag->Service_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Service) */
			errn = encodeNBitUnsignedInteger(stream, 9, 277);
			if(errn == 0) {
				errn = encode_iso2ServiceType(stream, &exiFrag->Service );
			}
		} else if ( exiFrag->ServiceDetailReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDetailReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 278);
			if(errn == 0) {
				errn = encode_iso2ServiceDetailReqType(stream, &exiFrag->ServiceDetailReq );
			}
		} else if ( exiFrag->ServiceDetailRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDetailRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 279);
			if(errn == 0) {
				errn = encode_iso2ServiceDetailResType(stream, &exiFrag->ServiceDetailRes );
			}
		} else if ( exiFrag->ServiceDiscoveryReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDiscoveryReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 280);
			if(errn == 0) {
				errn = encode_iso2ServiceDiscoveryReqType(stream, &exiFrag->ServiceDiscoveryReq );
			}
		} else if ( exiFrag->ServiceDiscoveryRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceDiscoveryRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 281);
			if(errn == 0) {
				errn = encode_iso2ServiceDiscoveryResType(stream, &exiFrag->ServiceDiscoveryRes );
			}
		} else if ( exiFrag->ServiceID_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceID) */
			errn = encodeNBitUnsignedInteger(stream, 9, 282);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, exiFrag->ServiceID);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->ServiceID_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ServiceID) */
			errn = encodeNBitUnsignedInteger(stream, 9, 283);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, exiFrag->ServiceID);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->ServiceParameterList_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}ServiceParameterList) */
			errn = encodeNBitUnsignedInteger(stream, 9, 284);
			if(errn == 0) {
				errn = encode_iso2ServiceParameterListType(stream, &exiFrag->ServiceParameterList );
			}
		} else if ( exiFrag->SessionID_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionID) */
			errn = encodeNBitUnsignedInteger(stream, 9, 285);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_HEX]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->SessionID.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->SessionID.bytes, exiFrag->SessionID.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->SessionID_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgHeader}SessionID) */
			errn = encodeNBitUnsignedInteger(stream, 9, 286);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_HEX]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->SessionID.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->SessionID.bytes, exiFrag->SessionID.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->SessionSetupReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionSetupReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 287);
			if(errn == 0) {
				errn = encode_iso2SessionSetupReqType(stream, &exiFrag->SessionSetupReq );
			}
		} else if ( exiFrag->SessionSetupRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionSetupRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 288);
			if(errn == 0) {
				errn = encode_iso2SessionSetupResType(stream, &exiFrag->SessionSetupRes );
			}
		} else if ( exiFrag->SessionStopReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionStopReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 289);
			if(errn == 0) {
				errn = encode_iso2SessionStopReqType(stream, &exiFrag->SessionStopReq );
			}
		} else if ( exiFrag->SessionStopRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SessionStopRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 290);
			if(errn == 0) {
				errn = encode_iso2SessionStopResType(stream, &exiFrag->SessionStopRes );
			}
		} else if ( exiFrag->SigMeterReading_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SigMeterReading) */
			errn = encodeNBitUnsignedInteger(stream, 9, 291);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->SigMeterReading.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->SigMeterReading.bytes, exiFrag->SigMeterReading.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->SignalFrequency_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SignalFrequency) */
			errn = encodeNBitUnsignedInteger(stream, 9, 292);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, exiFrag->SignalFrequency);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->SignalPulseDuration_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SignalPulseDuration) */
			errn = encodeNBitUnsignedInteger(stream, 9, 293);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(exiFrag->SignalPulseDuration - 0));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->SignalSeparationTime_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SignalSeparationTime) */
			errn = encodeNBitUnsignedInteger(stream, 9, 294);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(exiFrag->SignalSeparationTime - 0));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->Signature_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Signature) */
			errn = encodeNBitUnsignedInteger(stream, 9, 295);
			if(errn == 0) {
				errn = encode_iso2SignatureType(stream, &exiFrag->Signature );
			}
		} else if ( exiFrag->SignatureMethod_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureMethod) */
			errn = encodeNBitUnsignedInteger(stream, 9, 296);
			if(errn == 0) {
				errn = encode_iso2SignatureMethodType(stream, &exiFrag->SignatureMethod );
			}
		} else if ( exiFrag->SignatureProperties_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperties) */
			errn = encodeNBitUnsignedInteger(stream, 9, 297);
			if(errn == 0) {
				errn = encode_iso2SignaturePropertiesType(stream, &exiFrag->SignatureProperties );
			}
		} else if ( exiFrag->SignatureProperty_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperty) */
			errn = encodeNBitUnsignedInteger(stream, 9, 298);
			if(errn == 0) {
				errn = encode_iso2SignaturePropertyType(stream, &exiFrag->SignatureProperty );
			}
		} else if ( exiFrag->SignatureValue_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureValue) */
			errn = encodeNBitUnsignedInteger(stream, 9, 299);
			if(errn == 0) {
				errn = encode_iso2SignatureValueType(stream, &exiFrag->SignatureValue );
			}
		} else if ( exiFrag->SignedInfo_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignedInfo) */
			errn = encodeNBitUnsignedInteger(stream, 9, 300);
			if(errn == 0) {
				errn = encode_iso2SignedInfoType(stream, &exiFrag->SignedInfo );
			}
		} else if ( exiFrag->SubCertificates_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}SubCertificates) */
			errn = encodeNBitUnsignedInteger(stream, 9, 301);
			if(errn == 0) {
				errn = encode_iso2SubCertificatesType(stream, &exiFrag->SubCertificates );
			}
		} else if ( exiFrag->SupportedServiceIDs_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SupportedServiceIDs) */
			errn = encodeNBitUnsignedInteger(stream, 9, 302);
			if(errn == 0) {
				errn = encode_iso2ServiceIDListType(stream, &exiFrag->SupportedServiceIDs );
			}
		} else if ( exiFrag->SystemStatusReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SystemStatusReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 303);
			if(errn == 0) {
				errn = encode_iso2SystemStatusReqType(stream, &exiFrag->SystemStatusReq );
			}
		} else if ( exiFrag->SystemStatusRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}SystemStatusRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 304);
			if(errn == 0) {
				errn = encode_iso2SystemStatusResType(stream, &exiFrag->SystemStatusRes );
			}
		} else if ( exiFrag->TMeter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TMeter) */
			errn = encodeNBitUnsignedInteger(stream, 9, 305);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeInteger64(stream, exiFrag->TMeter);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->TargetOffset_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}TargetOffset) */
			errn = encodeNBitUnsignedInteger(stream, 9, 306);
			if(errn == 0) {
				errn = encode_iso2TargetPositionType(stream, &exiFrag->TargetOffset );
			}
		} else if ( exiFrag->TargetOffsetX_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetOffsetX) */
			errn = encodeNBitUnsignedInteger(stream, 9, 307);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, exiFrag->TargetOffsetX);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->TargetOffsetY_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetOffsetY) */
			errn = encodeNBitUnsignedInteger(stream, 9, 308);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, exiFrag->TargetOffsetY);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->TargetSOC_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}TargetSOC) */
			errn = encodeNBitUnsignedInteger(stream, 9, 309);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 7, (uint32_t)(exiFrag->TargetSOC - 0));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->Transform_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transform) */
			errn = encodeNBitUnsignedInteger(stream, 9, 310);
			if(errn == 0) {
				errn = encode_iso2TransformType(stream, &exiFrag->Transform );
			}
		} else if ( exiFrag->Transforms_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms) */
			errn = encodeNBitUnsignedInteger(stream, 9, 311);
			if(errn == 0) {
				errn = encode_iso2TransformsType(stream, &exiFrag->Transforms );
			}
		} else if ( exiFrag->V2GRequest_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}V2GRequest) */
			errn = encodeNBitUnsignedInteger(stream, 9, 312);
			if(errn == 0) {
				errn = encode_iso2BodyBaseType(stream, &exiFrag->V2GRequest );
			}
		} else if ( exiFrag->V2GResponse_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}V2GResponse) */
			errn = encodeNBitUnsignedInteger(stream, 9, 313);
			if(errn == 0) {
				errn = encode_iso2V2GResponseType(stream, &exiFrag->V2GResponse );
			}
		} else if ( exiFrag->V2G_Message_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDef}V2G_Message) */
			errn = encodeNBitUnsignedInteger(stream, 9, 314);
			if(errn == 0) {
				errn = encode_iso2AnonType_V2G_Message(stream, &exiFrag->V2G_Message );
			}
		} else if ( exiFrag->VASList_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VASList) */
			errn = encodeNBitUnsignedInteger(stream, 9, 315);
			if(errn == 0) {
				errn = encode_iso2ServiceListType(stream, &exiFrag->VASList );
			}
		} else if ( exiFrag->Value_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}Value) */
			errn = encodeNBitUnsignedInteger(stream, 9, 316);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeInteger16(stream, exiFrag->Value);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->VehicleCheckInReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckInReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 317);
			if(errn == 0) {
				errn = encode_iso2VehicleCheckInReqType(stream, &exiFrag->VehicleCheckInReq );
			}
		} else if ( exiFrag->VehicleCheckInRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckInRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 318);
			if(errn == 0) {
				errn = encode_iso2VehicleCheckInResType(stream, &exiFrag->VehicleCheckInRes );
			}
		} else if ( exiFrag->VehicleCheckOutReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckOutReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 319);
			if(errn == 0) {
				errn = encode_iso2VehicleCheckOutReqType(stream, &exiFrag->VehicleCheckOutReq );
			}
		} else if ( exiFrag->VehicleCheckOutRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleCheckOutRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 320);
			if(errn == 0) {
				errn = encode_iso2VehicleCheckOutResType(stream, &exiFrag->VehicleCheckOutRes );
			}
		} else if ( exiFrag->VehicleSpace_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}VehicleSpace) */
			errn = encodeNBitUnsignedInteger(stream, 9, 321);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, exiFrag->VehicleSpace);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->WPT_EVChargeParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}WPT_EVChargeParameter) */
			errn = encodeNBitUnsignedInteger(stream, 9, 322);
			if(errn == 0) {
				errn = encode_iso2WPT_EVChargeParameterType(stream, &exiFrag->WPT_EVChargeParameter );
			}
		} else if ( exiFrag->WPT_EVSEChargeParameter_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}WPT_EVSEChargeParameter) */
			errn = encodeNBitUnsignedInteger(stream, 9, 323);
			if(errn == 0) {
				errn = encode_iso2WPT_EVSEChargeParameterType(stream, &exiFrag->WPT_EVSEChargeParameter );
			}
		} else if ( exiFrag->WeldingDetectionReq_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}WeldingDetectionReq) */
			errn = encodeNBitUnsignedInteger(stream, 9, 324);
			if(errn == 0) {
				errn = encode_iso2WeldingDetectionReqType(stream, &exiFrag->WeldingDetectionReq );
			}
		} else if ( exiFrag->WeldingDetectionRes_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}WeldingDetectionRes) */
			errn = encodeNBitUnsignedInteger(stream, 9, 325);
			if(errn == 0) {
				errn = encode_iso2WeldingDetectionResType(stream, &exiFrag->WeldingDetectionRes );
			}
		} else if ( exiFrag->X509CRL_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL) */
			errn = encodeNBitUnsignedInteger(stream, 9, 326);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->X509CRL.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->X509CRL.bytes, exiFrag->X509CRL.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->X509Certificate_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate) */
			errn = encodeNBitUnsignedInteger(stream, 9, 327);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->X509Certificate.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->X509Certificate.bytes, exiFrag->X509Certificate.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->X509Data_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data) */
			errn = encodeNBitUnsignedInteger(stream, 9, 328);
			if(errn == 0) {
				errn = encode_iso2X509DataType(stream, &exiFrag->X509Data );
			}
		} else if ( exiFrag->X509IssuerName_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerName) */
			errn = encodeNBitUnsignedInteger(stream, 9, 329);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->X509IssuerName.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, exiFrag->X509IssuerName.characters, exiFrag->X509IssuerName.charactersLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->X509IssuerSerial_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerSerial) */
			errn = encodeNBitUnsignedInteger(stream, 9, 330);
			if(errn == 0) {
				errn = encode_iso2X509IssuerSerialType(stream, &exiFrag->X509IssuerSerial );
			}
		} else if ( exiFrag->X509SKI_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI) */
			errn = encodeNBitUnsignedInteger(stream, 9, 331);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->X509SKI.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->X509SKI.bytes, exiFrag->X509SKI.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->X509SerialNumber_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SerialNumber) */
			errn = encodeNBitUnsignedInteger(stream, 9, 332);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeInteger64(stream, exiFrag->X509SerialNumber);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->X509SubjectName_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName) */
			errn = encodeNBitUnsignedInteger(stream, 9, 333);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->X509SubjectName.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, exiFrag->X509SubjectName.characters, exiFrag->X509SubjectName.charactersLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->XCoordinate_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}XCoordinate) */
			errn = encodeNBitUnsignedInteger(stream, 9, 334);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeInteger16(stream, exiFrag->XCoordinate);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->XPath_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath) */
			errn = encodeNBitUnsignedInteger(stream, 9, 335);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->XPath.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, exiFrag->XPath.characters, exiFrag->XPath.charactersLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->Y_isUsed == 1u ) { 
			/* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y) */
			errn = encodeNBitUnsignedInteger(stream, 9, 336);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BINARY_BASE64]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->Y.bytesLen));
					if (errn == 0) {
						errn = encodeBytes(stream, exiFrag->Y.bytes, exiFrag->Y.bytesLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->YCoordinate_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}YCoordinate) */
			errn = encodeNBitUnsignedInteger(stream, 9, 337);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeInteger16(stream, exiFrag->YCoordinate);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->ZCoordinate_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}ZCoordinate) */
			errn = encodeNBitUnsignedInteger(stream, 9, 338);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeInteger16(stream, exiFrag->ZCoordinate);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->amount_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}amount) */
			errn = encodeNBitUnsignedInteger(stream, 9, 339);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->amount );
			}
		} else if ( exiFrag->boolValue_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}boolValue) */
			errn = encodeNBitUnsignedInteger(stream, 9, 340);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[BOOLEAN]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeBoolean(stream, exiFrag->boolValue);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->byteValue_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}byteValue) */
			errn = encodeNBitUnsignedInteger(stream, 9, 341);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(exiFrag->byteValue + 128));
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->costKind_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}costKind) */
			errn = encodeNBitUnsignedInteger(stream, 9, 342);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[ENUMERATION]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeNBitUnsignedInteger(stream, 2, exiFrag->costKind);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->duration_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}duration) */
			errn = encodeNBitUnsignedInteger(stream, 9, 343);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger32(stream, exiFrag->duration);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->eMAID_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgBody}eMAID) */
			errn = encodeNBitUnsignedInteger(stream, 9, 344);
			if(errn == 0) {
				errn = encode_iso2EMAIDType(stream, &exiFrag->eMAID );
			}
		} else if ( exiFrag->intValue_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}intValue) */
			errn = encodeNBitUnsignedInteger(stream, 9, 345);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeInteger32(stream, exiFrag->intValue);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->physicalValue_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}physicalValue) */
			errn = encodeNBitUnsignedInteger(stream, 9, 346);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->physicalValue );
			}
		} else if ( exiFrag->shortValue_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}shortValue) */
			errn = encodeNBitUnsignedInteger(stream, 9, 347);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeInteger16(stream, exiFrag->shortValue);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->start_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}start) */
			errn = encodeNBitUnsignedInteger(stream, 9, 348);
			if(errn == 0) {
				/* FirstStartTag[CHARACTERS[UNSIGNED_INTEGER]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					errn = encodeUnsignedInteger32(stream, exiFrag->start);
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else if ( exiFrag->startValue_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}startValue) */
			errn = encodeNBitUnsignedInteger(stream, 9, 349);
			if(errn == 0) {
				errn = encode_iso2PhysicalValueType(stream, &exiFrag->startValue );
			}
		} else if ( exiFrag->stringValue_isUsed == 1u ) { 
			/* START_ELEMENT({urn:iso:15118:2:2016:MsgDataTypes}stringValue) */
			errn = encodeNBitUnsignedInteger(stream, 9, 350);
			if(errn == 0) {
				/* First(xsi:type)StartTag[CHARACTERS[STRING]] */
				errn = encodeNBitUnsignedInteger(stream, 1, 0);
				if(errn == 0) {
					/* encode string as string table miss (+2 len)*/
					errn = encodeUnsignedInteger16(stream, (uint16_t)(exiFrag->stringValue.charactersLen + 2));
					if (errn == 0) {
						errn = encodeCharacters(stream, exiFrag->stringValue.characters, exiFrag->stringValue.charactersLen);
					}
					/* valid EE */
					errn = encodeNBitUnsignedInteger(stream, 1, 0);
				}
			}
		} else {
			errn = EXI_ERROR_UNKOWN_EVENT;
		}
	}
	if(errn == 0) {
		/* EndDocument */
		errn = encodeNBitUnsignedInteger(stream, 9, 352);
	}


	if(errn == 0) {
		/* flush any pending bits */
		errn = encodeFinish(stream);
	}

	return errn;
}
#endif /* DEPLOY_ISO2_CODEC_FRAGMENT */


#endif /* DEPLOY_ISO2_CODEC */

#endif

