diff --git a/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs b/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs index b63b0b225857819c156ddd5e360007c260a066d6..e138d9ede983943150c1a936eb9910b5650ff502 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs @@ -60,7 +60,13 @@ namespace TUGraz.VectoCore.OutputData.XML protected readonly XNamespace tns; protected readonly XNamespace di; - private bool allSuccess = true; + + private bool _allSuccess = true; + + private KilogramPerMeter _weightedCo2 = 0.SI<KilogramPerMeter>(); + + private Kilogram _weightedPayload = 0.SI<Kilogram>(); + public XMLCustomerReport() { @@ -82,9 +88,15 @@ namespace TUGraz.VectoCore.OutputData.XML new XElement(tns + XMLNames.Vehicle_GrossVehicleMass, XMLHelper.ValueAsUnit(modelData.VehicleData.GrossVehicleWeight, XMLNames.Unit_t, 1)), new XElement(tns + XMLNames.Vehicle_CurbMassChassis, XMLHelper.ValueAsUnit(modelData.VehicleData.CurbWeight, XMLNames.Unit_kg)), new XElement(tns + XMLNames.Vehicle_ZeroEmissionVehicle, modelData.VehicleData.ZeroEmissionVehicle), + new XElement(tns + XMLNames.Vehicle_HybridElectricHDV, modelData.VehicleData.HybridElectricHDV), + new XElement(tns + XMLNames.Vehicle_DualFuelVehicle, modelData.VehicleData.DualFuelVehicle), + exempted ? ExemptedData(modelData) : new[] { new XElement(tns + XMLNames.Vehicle_AxleConfiguration, modelData.VehicleData.AxleConfiguration.GetName()), new XElement(tns + XMLNames.Report_Vehicle_VehicleGroup, modelData.VehicleData.VehicleClass.GetClassNumber()), + new XElement(tns + XMLNames.Vehicle_VocationalVehicle, modelData.VehicleData.VocationalVehicle), + new XElement(tns + XMLNames.Vehicle_SleeperCab, modelData.VehicleData.SleeperCab), + }.Concat(ComponentData(modelData)) ); if (exempted) { @@ -97,8 +109,6 @@ namespace TUGraz.VectoCore.OutputData.XML private XElement[] ExemptedData(VectoRunData modelData) { return new[] { - new XElement(tns + XMLNames.Vehicle_HybridElectricHDV, modelData.VehicleData.HybridElectricHDV), - new XElement(tns + XMLNames.Vehicle_DualFuelVehicle, modelData.VehicleData.DualFuelVehicle), modelData.VehicleData.HybridElectricHDV ? new XElement(tns + XMLNames.Vehicle_MaxNetPower1, XMLHelper.ValueAsUnit(modelData.VehicleData.MaxNetPower1, XMLNames.Unit_W)) : null, modelData.VehicleData.HybridElectricHDV ? new XElement(tns + XMLNames.Vehicle_MaxNetPower2, XMLHelper.ValueAsUnit(modelData.VehicleData.MaxNetPower2, XMLNames.Unit_W)) : null }; @@ -123,7 +133,10 @@ namespace TUGraz.VectoCore.OutputData.XML new XElement(tns + XMLNames.Report_Vehicle_AxleRatio, modelData.AxleGearData.AxleGear.Ratio.ToXMLFormat(3)), new XElement( tns + XMLNames.Report_Vehicle_AverageRRC, - modelData.VehicleData.AverageRollingResistanceTruck.ToXMLFormat(4)) + modelData.VehicleData.AverageRollingResistanceTruck.ToXMLFormat(4), + new XElement(tns + XMLNames.Report_Vehicle_AverageRRCLabel), + DeclarationData.Wheels.TyreClass.Lookup(modelData.VehicleData.AverageRollingResistanceTruck) + ) }; } @@ -141,7 +154,9 @@ namespace TUGraz.VectoCore.OutputData.XML DeclarationReport<XMLDeclarationReport.ResultEntry>.ResultContainer<XMLDeclarationReport.ResultEntry> entry) { foreach (var resultEntry in entry.ResultEntry) { - allSuccess &= resultEntry.Value.Status == VectoRun.Status.Success; + _allSuccess &= resultEntry.Value.Status == VectoRun.Status.Success; + _weightedPayload += resultEntry.Value.Payload * resultEntry.Value.WeightingFactor; + _weightedCo2 += resultEntry.Value.CO2Total / resultEntry.Value.Distance * resultEntry.Value.WeightingFactor; Results.Add(new XElement(tns + XMLNames.Report_Result_Result, new XAttribute(XMLNames.Report_Result_Status_Attr, resultEntry.Value.Status == VectoRun.Status.Success ? "success" : "error"), @@ -195,7 +210,23 @@ namespace TUGraz.VectoCore.OutputData.XML var xsi = XNamespace.Get("http://www.w3.org/2001/XMLSchema-instance"); var retVal = new XDocument(); var results = new XElement(Results); - results.AddFirst(new XElement(tns + XMLNames.Report_Result_Status, allSuccess ? "success" : "error")); + results.AddFirst(new XElement(tns + XMLNames.Report_Result_Status, _allSuccess ? "success" : "error")); + var summary = _weightedPayload > 0 + ? new XElement( + "Summary", + new XElement( + "SpecificCO2Emissions", + new XAttribute(XMLNames.Report_Results_Unit_Attr, "gCO2/tkm"), + (_weightedCo2 / _weightedPayload).ConvertToGrammPerTonKilometer().ToXMLFormat(1) + ), + new XElement( + "AveragePayload", + new XAttribute(XMLNames.Report_Results_Unit_Attr, XMLNames.Unit_t), + _weightedPayload.ConvertToTon().ToXMLFormat(3) + ) + ) + : null; + results.Add(summary); var vehicle = new XElement(VehiclePart); vehicle.Add(InputDataIntegrity); retVal.Add(new XProcessingInstruction("xml-stylesheet", "href=\"https://webgate.ec.europa.eu/CITnet/svn/VECTO/trunk/Share/XML/CSS/VectoReports.css\"")); @@ -210,6 +241,7 @@ namespace TUGraz.VectoCore.OutputData.XML vehicle, new XElement(tns + "ResultDataSignature", resultSignature), results, + summary, GetApplicationInfo()) ) ); diff --git a/VectoCore/VectoCore/OutputData/XML/XMLManufacturerReport.cs b/VectoCore/VectoCore/OutputData/XML/XMLManufacturerReport.cs index eea58b1522ac3d5000bce5e942f11682f9d03503..3900e4740c5247eb59d15d88cd47d232a8f08233 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLManufacturerReport.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLManufacturerReport.cs @@ -37,6 +37,7 @@ using System.Reflection; using System.Xml; using System.Xml.Linq; using TUGraz.IVT.VectoXML.Writer; +using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Resources; using TUGraz.VectoCommon.Utils; @@ -65,10 +66,6 @@ namespace TUGraz.VectoCore.OutputData.XML private bool _allSuccess = true; - private KilogramPerMeter _weightedCo2 = 0.SI<KilogramPerMeter>(); - - private Kilogram _weightedPayload = 0.SI<Kilogram>(); - public XMLManufacturerReport() { di = "http://www.w3.org/2000/09/xmldsig#"; @@ -89,12 +86,17 @@ namespace TUGraz.VectoCore.OutputData.XML new XElement(tns + XMLNames.Vehicle_GrossVehicleMass, XMLHelper.ValueAsUnit(modelData.VehicleData.GrossVehicleWeight, XMLNames.Unit_t, 1)), new XElement(tns + XMLNames.Vehicle_CurbMassChassis, XMLHelper.ValueAsUnit(modelData.VehicleData.CurbWeight, XMLNames.Unit_kg)), new XElement(tns + XMLNames.Vehicle_ZeroEmissionVehicle, modelData.VehicleData.ZeroEmissionVehicle), + new XElement(tns + XMLNames.Vehicle_HybridElectricHDV, modelData.VehicleData.HybridElectricHDV), + new XElement(tns + XMLNames.Vehicle_DualFuelVehicle, modelData.VehicleData.DualFuelVehicle), exempted ? ExemptedData(modelData) : new[] { - new XElement(tns + XMLNames.Report_Vehicle_VehicleGroup, modelData.VehicleData.VehicleClass.GetClassNumber()), new XElement(tns + XMLNames.Vehicle_AxleConfiguration, modelData.VehicleData.AxleConfiguration.GetName()), + new XElement(tns + XMLNames.Report_Vehicle_VehicleGroup, modelData.VehicleData.VehicleClass.GetClassNumber()), + new XElement(tns + XMLNames.Vehicle_VocationalVehicle, modelData.VehicleData.VocationalVehicle), + new XElement(tns + XMLNames.Vehicle_SleeperCab, modelData.VehicleData.SleeperCab), new XElement(tns + XMLNames.Vehicle_PTO, modelData.PTO != null), + GetADAS(modelData.VehicleData.ADAS), GetTorqueLimits(modelData.EngineData), VehicleComponents(modelData) } @@ -106,6 +108,16 @@ namespace TUGraz.VectoCore.OutputData.XML modelData.InputDataHash == null ? CreateDummySig() : new XElement(modelData.InputDataHash)); } + private XElement GetADAS(VehicleData.ADASData adasData) + { + return new XElement(tns + XMLNames.Vehicle_ADAS, + new XElement(tns + XMLNames.Vehicle_ADAS_EngineStopStart, adasData.EngineStopStart), + new XElement(tns + XMLNames.Vehicle_ADAS_EcoRollWithoutEngineStop, adasData.EcoRollWithoutengineStop), + new XElement(tns + XMLNames.Vehicle_ADAS_EcoRollWithEngineStopStart, adasData.EcoRollWithEngineStop), + new XElement(tns + XMLNames.Vehicle_ADAS_PCC, adasData.PredictiveCruiseControl != PredictiveCruiseControlType.None) + ); + } + private XElement VehicleComponents(VectoRunData modelData) { return new XElement(tns + XMLNames.Vehicle_Components, @@ -124,8 +136,6 @@ namespace TUGraz.VectoCore.OutputData.XML private XElement[] ExemptedData(VectoRunData modelData) { return new [] { - new XElement(tns + XMLNames.Vehicle_HybridElectricHDV, modelData.VehicleData.HybridElectricHDV), - new XElement(tns + XMLNames.Vehicle_DualFuelVehicle, modelData.VehicleData.DualFuelVehicle), modelData.VehicleData.HybridElectricHDV ? new XElement(tns + XMLNames.Vehicle_MaxNetPower1, XMLHelper.ValueAsUnit(modelData.VehicleData.MaxNetPower1, XMLNames.Unit_W)) : null, modelData.VehicleData.HybridElectricHDV ? new XElement(tns + XMLNames.Vehicle_MaxNetPower2, XMLHelper.ValueAsUnit(modelData.VehicleData.MaxNetPower2, XMLNames.Unit_W)) : null }; @@ -184,7 +194,7 @@ namespace TUGraz.VectoCore.OutputData.XML new XElement(tns + XMLNames.Gearbox_TransmissionType, gearboxData.Type.ToXMLFormat()), new XElement(tns + XMLNames.Report_GetGearbox_GearsCount, gearboxData.Gears.Count), new XElement(tns + XMLNames.Report_Gearbox_TransmissionRatioFinalGear, - gearboxData.Gears.Last().Value.Ratio.ToXMLFormat(3)) + gearboxData.Gears[gearboxData.Gears.Keys.Max()].Ratio.ToXMLFormat(3)) ); } @@ -311,8 +321,6 @@ namespace TUGraz.VectoCore.OutputData.XML { foreach (var resultEntry in entry.ResultEntry) { _allSuccess &= resultEntry.Value.Status == VectoRun.Status.Success; - _weightedPayload += resultEntry.Value.Payload * resultEntry.Value.WeightingFactor; - _weightedCo2 += resultEntry.Value.CO2Total / resultEntry.Value.Distance * resultEntry.Value.WeightingFactor; Results.Add(new XElement(tns + XMLNames.Report_Result_Result, new XAttribute(XMLNames.Report_Result_Status_Attr, resultEntry.Value.Status == VectoRun.Status.Success ? "success" : "error"), @@ -389,21 +397,6 @@ namespace TUGraz.VectoCore.OutputData.XML var retVal = new XDocument(); var results = new XElement(Results); results.AddFirst(new XElement(tns + XMLNames.Report_Result_Status, _allSuccess ? "success" : "error")); - var summary = _weightedPayload > 0 - ? new XElement( - "Summary", - new XElement( - "SpecificCO2Emissions", - new XAttribute(XMLNames.Report_Results_Unit_Attr, "gCO2/tkm"), - (_weightedCo2 / _weightedPayload).ConvertToGrammPerTonKilometer().ToXMLFormat(1) - ), - new XElement( - "AveragePayload", - new XAttribute(XMLNames.Report_Results_Unit_Attr, XMLNames.Unit_t), - _weightedPayload.ConvertToTon().ToXMLFormat(3) - ) - ) - : null; var vehicle = new XElement(VehiclePart); vehicle.Add(InputDataIntegrity); retVal.Add(new XProcessingInstruction("xml-stylesheet", "href=\"https://webgate.ec.europa.eu/CITnet/svn/VECTO/trunk/Share/XML/CSS/VectoReports.css\"")); @@ -417,7 +410,6 @@ namespace TUGraz.VectoCore.OutputData.XML new XElement(tns + "Data", vehicle, results, - summary, GetApplicationInfo()) ) ); diff --git a/VectoCore/VectoCore/Resources/XSD/VectoOutputCustomer.0.7.xsd b/VectoCore/VectoCore/Resources/XSD/VectoOutputCustomer.0.7.xsd index cd1b99f2fb584c3cff67ce7f978a59101e467f45..1d2c9ca7d38856b87337adca5f5e2d8f8fafa8d3 100644 --- a/VectoCore/VectoCore/Resources/XSD/VectoOutputCustomer.0.7.xsd +++ b/VectoCore/VectoCore/Resources/XSD/VectoOutputCustomer.0.7.xsd @@ -90,7 +90,45 @@ </xs:simpleType> </xs:element> <xs:choice> - <xs:element name="Result" type="ResultType" maxOccurs="unbounded"/> + <xs:sequence> + <xs:element name="Result" type="ResultType" maxOccurs="unbounded"/> + <xs:element name="Summary" minOccurs="0"> + <xs:complexType> + <xs:sequence> + <xs:element name="SpecificCO2Emissions"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:double"> + <xs:attribute name="unit" use="required"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="gCO2/tkm"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + <xs:element name="AveragePayload"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:double"> + <xs:attribute name="unit" use="required"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="t"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:sequence> <xs:element name="ExemptedVehicle"> <xs:complexType/> </xs:element> @@ -156,6 +194,16 @@ <xs:documentation>P269</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="HybridElectricHDV" type="xs:boolean"> + <xs:annotation> + <xs:documentation>P279</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="DualFuelVehicle" type="xs:boolean"> + <xs:annotation> + <xs:documentation>P280</xs:documentation> + </xs:annotation> + </xs:element> <xs:choice> <xs:sequence> <xs:element name="AxleConfiguration" type="vdecdef:VehicleAxleConfigurationDeclarationType"> @@ -168,6 +216,42 @@ <xs:documentation>VECTO</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="VocationalVehicle" type="xs:boolean"> + <xs:annotation> + <xs:documentation>P270</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="SleeperCab" type="xs:boolean"> + <xs:annotation> + <xs:documentation>P267</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="ADAS"> + <xs:complexType> + <xs:sequence> + <xs:element name="EngineStopStart" type="xs:boolean"> + <xs:annotation> + <xs:documentation>P271 - bool</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="EcoRollWithoutEngineStop" type="xs:boolean"> + <xs:annotation> + <xs:documentation>P272 - bool</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="EcoRollWithEngineStop" type="xs:boolean"> + <xs:annotation> + <xs:documentation>P273 - bool</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="PredictiveCruiseControl" type="xs:boolean"> + <xs:annotation> + <xs:documentation>P274 - enum</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> <xs:element name="EngineRatedPower"> <xs:annotation> <xs:documentation>P250</xs:documentation> @@ -227,19 +311,17 @@ <xs:documentation>P150</xs:documentation> </xs:annotation> </xs:element> - <xs:element name="AverageRRC" type="vdecdef:TyreRRCISOType"/> + <xs:element name="AverageRRCMotorVehicleTyres" type="vdecdef:TyreRRCISOType"/> + <xs:element name="AverageFuelEfficiencyLabelMotorVehicleTyres"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="1"/> + <xs:maxLength value="1"/> + </xs:restriction> + </xs:simpleType> + </xs:element> </xs:sequence> <xs:sequence> - <xs:element name="HybridElectricHDV" type="xs:boolean"> - <xs:annotation> - <xs:documentation>P279</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="DualFuelVehicle" type="xs:boolean"> - <xs:annotation> - <xs:documentation>P280</xs:documentation> - </xs:annotation> - </xs:element> <xs:element name="MaxNetPower1" minOccurs="0"> <xs:annotation> <xs:documentation>P277</xs:documentation> diff --git a/VectoCore/VectoCore/Resources/XSD/VectoOutputManufacturer.0.7.xsd b/VectoCore/VectoCore/Resources/XSD/VectoOutputManufacturer.0.7.xsd index 3469c1f13d35cfbed91faae3a698fe87eebdf368..ba4b164b5ff6acbd416e2e276302c0f95e3cb915 100644 --- a/VectoCore/VectoCore/Resources/XSD/VectoOutputManufacturer.0.7.xsd +++ b/VectoCore/VectoCore/Resources/XSD/VectoOutputManufacturer.0.7.xsd @@ -396,7 +396,7 @@ <xs:choice> <xs:sequence> <xs:element name="Result" type="ResultType" maxOccurs="unbounded"/> - <xs:element name="Summary"> + <xs:element name="Summary" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="SpecificCO2Emissions"> @@ -595,16 +595,36 @@ <xs:documentation>P269</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="HybridElectricHDV" type="xs:boolean"> + <xs:annotation> + <xs:documentation>P279</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="DualFuelVehicle" type="xs:boolean"> + <xs:annotation> + <xs:documentation>P280</xs:documentation> + </xs:annotation> + </xs:element> <xs:choice> <xs:sequence> + <xs:element name="AxleConfiguration" type="vdecdef:VehicleAxleConfigurationDeclarationType"> + <xs:annotation> + <xs:documentation>P037</xs:documentation> + </xs:annotation> + </xs:element> <xs:element name="VehicleGroup" type="VehicleGroupType"> <xs:annotation> <xs:documentation>VECTO</xs:documentation> </xs:annotation> </xs:element> - <xs:element name="AxleConfiguration" type="vdecdef:VehicleAxleConfigurationDeclarationType"> + <xs:element name="VocationalVehicle"> <xs:annotation> - <xs:documentation>P037</xs:documentation> + <xs:documentation>P270</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="SleeperCab" type="xs:boolean"> + <xs:annotation> + <xs:documentation>P267</xs:documentation> </xs:annotation> </xs:element> <xs:element name="PTO" type="xs:boolean"> @@ -612,6 +632,32 @@ <xs:documentation>P247</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="ADAS"> + <xs:complexType> + <xs:sequence> + <xs:element name="EngineStopStart" type="xs:boolean"> + <xs:annotation> + <xs:documentation>P271 - bool</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="EcoRollWithoutEngineStop" type="xs:boolean"> + <xs:annotation> + <xs:documentation>P272 - bool</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="EcoRollWithEngineStop" type="xs:boolean"> + <xs:annotation> + <xs:documentation>P273 - bool</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="PredictiveCruiseControl" type="xs:boolean"> + <xs:annotation> + <xs:documentation>P274 - enum</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> <xs:element name="TorqueLimits" type="TorqueLimitsType" minOccurs="0"/> <xs:element name="Components"> <xs:complexType> @@ -630,16 +676,6 @@ </xs:element> </xs:sequence> <xs:sequence> - <xs:element name="HybridElectricHDV" type="xs:boolean"> - <xs:annotation> - <xs:documentation>P279</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="DualFuelVehicle" type="xs:boolean"> - <xs:annotation> - <xs:documentation>P280</xs:documentation> - </xs:annotation> - </xs:element> <xs:element name="MaxNetPower1" minOccurs="0"> <xs:annotation> <xs:documentation>P277</xs:documentation>