diff --git a/VECTO/GUI/VehicleForm.vb b/VECTO/GUI/VehicleForm.vb index 876aa8de62b9ffa06d15b55480d32b6f4dcf9259..d008a52fabb3359b17714b71a27ea7846d0aa628 100644 --- a/VECTO/GUI/VehicleForm.vb +++ b/VECTO/GUI/VehicleForm.vb @@ -533,9 +533,7 @@ Public Class VehicleForm Case CrossWindCorrectionMode.SpeedDependentCorrectionFactor bEnabled = True - LbCdMode.Text = "Input file: Vehicle Speed [km/h], Cd Scaling Factor [-]" _ - 'TODO: MQ 20160901: check if scaling factor or absolue value! - + LbCdMode.Text = "Input file: Vehicle Speed [km/h], Cd Scaling Factor [-]" Case Else ' tCdMode.ConstCd0, tCdMode.CdOfVdecl bEnabled = False LbCdMode.Text = "" diff --git a/VECTO/Input Files/Engine.vb b/VECTO/Input Files/Engine.vb index cc105e3beecde03d7813b6ab9ef4e98196c94138..0fe8dece66939dcfd284f5ab224f354c3a96456d 100644 --- a/VECTO/Input Files/Engine.vb +++ b/VECTO/Input Files/Engine.vb @@ -290,7 +290,8 @@ Public Class Engine Public ReadOnly Property Manufacturer As String Implements IComponentInputData.Manufacturer Get - Return "N.A." ' TODO: MQ 20160919 + ' Just for the interface. Value is not available in GUI yet. + Return "N.A." End Get End Property @@ -308,6 +309,7 @@ Public Class Engine Public ReadOnly Property CertificationNumber As String Implements IComponentInputData.CertificationNumber Get + ' Just for the interface. Value is not available in GUI yet. Return "N.A." End Get End Property diff --git a/VECTO/Input Files/Gearbox.vb b/VECTO/Input Files/Gearbox.vb index 4849eba590ffb2b27050f5aafbbf51b1a7165500..86298b9f48af9c15df57585e367e3da18b6b32f8 100644 --- a/VECTO/Input Files/Gearbox.vb +++ b/VECTO/Input Files/Gearbox.vb @@ -299,7 +299,8 @@ Public Class Gearbox Public ReadOnly Property Manufacturer As String Implements IComponentInputData.Manufacturer Get - Return "N.A." ' Todo MQ 20160915 + ' Just for the interface. Value is not available in GUI yet. + Return "N.A." End Get End Property @@ -318,6 +319,7 @@ Public Class Gearbox Public ReadOnly Property CertificationNumber As String Implements IComponentInputData.CertificationNumber Get + ' Just for the interface. Value is not available in GUI yet. Return "N.A." End Get End Property diff --git a/VECTO/Input Files/Vehicle.vb b/VECTO/Input Files/Vehicle.vb index a60da3c75b80ccd14f5251135cba3a82c7333294..cf4a0695ef2fe9b00a4f04d00f08bdee49387ab1 100644 --- a/VECTO/Input Files/Vehicle.vb +++ b/VECTO/Input Files/Vehicle.vb @@ -265,13 +265,15 @@ Public Class Vehicle Public ReadOnly Property Manufacturer As String Implements IComponentInputData.Manufacturer Get - Return "N.A." ' TODO: MQ 20160908 + ' Just for the interface. Value is not available in GUI yet. + Return "N.A." End Get End Property Public ReadOnly Property Model As String Implements IComponentInputData.Model Get - Return "N.A." ' Todo: MQ 20160908 + ' Just for the interface. Value is not available in GUI yet. + Return "N.A." End Get End Property @@ -290,7 +292,8 @@ Public Class Vehicle Public ReadOnly Property CertificationNumber As String Implements IComponentInputData.CertificationNumber Get - Return "N.A." ' Todo: MQ 20160908 + ' Just for the interface. Value is not available in GUI yet. + Return "N.A." End Get End Property diff --git a/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb b/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb index 47ad622181dea7f5626b906e10ba9310a70acf07..9cd035d9f5bfa51cc7c6cf9f02303112f43f2aff 100644 --- a/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb +++ b/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb @@ -474,62 +474,4 @@ Public Class AdvancedAuxiliaries Return M9.TotalCycleFuelConsumptionCompressorOnContinuously End Get End Property - - - 'TODO:REMOVE WHEN TESTING IS COMPLETE - MK2017-06-26: what should be removed? I can't see the "pure-diagnostics" - 'PURE DIAGNOSTICS SHOULD ONLY BE USED IN MOD FOR ENGINEERING TESTS - - Public ReadOnly Property AA_D_M12_INTERP1 As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_INTERP1 - Get - Return M12.INTRP1() - End Get - End Property - - Public ReadOnly Property AA_D_M12_INTERP2 As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_INTERP2 - Get - Return M12.INTRP2() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P1X As Joule Implements IAdvancedAuxiliaries.AA_D_M12_P1X - Get - Return M12.P1X() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P1Y As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_P1Y - Get - Return M12.P1Y() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P2X As Joule Implements IAdvancedAuxiliaries.AA_D_M12_P2X - Get - Return M12.P2X() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P2Y As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_P2Y - Get - Return M12.P2Y() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P3X As Joule Implements IAdvancedAuxiliaries.AA_D_M12_P3X - Get - Return M12.P3X() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P3Y As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_P3Y - Get - Return M12.P3Y() - End Get - End Property - - Public ReadOnly Property AA_D_M12_XTAIN As Joule Implements IAdvancedAuxiliaries.AA_D_M12_XTAIN - Get - Return M12.XTAIN() - End Get - End Property End Class diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb index a07e798bf89202a68d4507932c23f8cd52a2c102..233cdb1d58a98d13321a44e3939b103f17fb3927 100644 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb +++ b/VectoCommon/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb @@ -22,18 +22,6 @@ Public Interface IAdvancedAuxiliaries ReadOnly Property AuxiliaryName As String ReadOnly Property AuxiliaryVersion As String - - 'Diagnostic Only - Remove when beta over. - ReadOnly Property AA_D_M12_P1X As Joule - ReadOnly Property AA_D_M12_P1Y As Kilogram - ReadOnly Property AA_D_M12_P2X As Joule - ReadOnly Property AA_D_M12_P2Y As Kilogram - ReadOnly Property AA_D_M12_P3X As Joule - ReadOnly Property AA_D_M12_P3Y As Kilogram - ReadOnly Property AA_D_M12_XTAIN As Joule - ReadOnly Property AA_D_M12_INTERP1 As Kilogram - ReadOnly Property AA_D_M12_INTERP2 As Kilogram - 'Additional Permenent Monitoring Signals - Required by engineering ReadOnly Property AA_NonSmartAlternatorsEfficiency As Double ReadOnly Property AA_SmartIdleCurrent_Amps As Ampere diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs index 32e606de4d9a39e2d10891d0e5c05b75217a6c78..1145e04f6ee00cd3978352618cf2db0f19f0d332 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs @@ -601,7 +601,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Case<ResponseDrivingCycleDistanceExceeded>(r => { if (!ds.IsEqual(r.MaxDistance)) { // distance has been reduced due to vehicle stop in coast/roll action => use brake action to get exactly to the stop-distance - // TODO what if no gear is enaged (and we need driveline power to get to the stop-distance? response = Driver.DrivingActionBrake(absTime, ds, DriverStrategy.BrakeTrigger.NextTargetSpeed, gradient); } }). diff --git a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs index bff1895e9200b99d2969ae2e6c21a796ffe6ce01..294c761f3a9ebf8154f4a7dea4fc3748393253a0 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs @@ -29,389 +29,373 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Xml; -using System.Xml.Linq; -using TUGraz.IVT.VectoXML; -using TUGraz.IVT.VectoXML.Writer; -using TUGraz.VectoCommon.InputData; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Resources; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.InputData.Reader; -using TUGraz.VectoCore.InputData.Reader.ComponentData; - -namespace TUGraz.VectoCore.OutputData.XML -{ - public class XMLDeclarationWriter : AbstractXMLWriter - { - private XNamespace componentNamespace; - //private readonly XNamespace _vectoNs = @"../../../API/VectoInput.xsd"; - - - public XMLDeclarationWriter(string vendor) : base(null, vendor) - { - tns = "urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v1.0"; - rootNamespace = "urn:tugraz:ivt:VectoAPI:DeclarationInput:v1.0"; - componentNamespace = "urn:tugraz:ivt:VectoAPI:DeclarationComponent:v1.0"; - } - - public XDocument GenerateVectoJob(IDeclarationInputDataProvider data) - { - var xsi = XNamespace.Get("http://www.w3.org/2001/XMLSchema-instance"); - - //<tns:VectoInputDeclaration - // xmlns="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v0.6" - // xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="0.6" - // xmlns:tns="urn:tugraz:ivt:VectoAPI:DeclarationInput:v0.6" - // xsi:schemaLocation="urn:tugraz:ivt:VectoAPI:DeclarationInput:v0.6 http://markus.quaritsch.at/VECTO/VectoInput.xsd"> - var job = new XDocument(); - job.Add(new XElement(rootNamespace + XMLNames.VectoInputDeclaration, - new XAttribute("schemaVersion", SchemaVersion), - new XAttribute(XNamespace.Xmlns + "xsi", xsi.NamespaceName), - new XAttribute("xmlns", tns), - new XAttribute(XNamespace.Xmlns + "tns", rootNamespace), - new XAttribute(xsi + "schemaLocation", - string.Format("{0} {1}VectoInput.xsd", rootNamespace, SchemaLocationBaseUrl)), - CreateDeclarationJob(data)) - ); - return job; - } - - public XDocument GenerateVectoComponent(IGearboxDeclarationInputData data, - ITorqueConverterDeclarationInputData torqueConverter) - { - return GenerateComponentDocument(CreateGearbox(data, torqueConverter, componentNamespace)); - } - - public XDocument GenerateVectoComponent(IAxleGearInputData data) - { - return GenerateComponentDocument(CreateAxlegear(data, componentNamespace)); - } - - protected XDocument GenerateComponentDocument(XElement content) - { - var xsi = XNamespace.Get("http://www.w3.org/2001/XMLSchema-instance"); - var component = new XDocument(); - component.Add(new XElement(componentNamespace + XMLNames.VectoInputDeclaration, - new XAttribute("schemaVersion", SchemaVersion), - new XAttribute(XNamespace.Xmlns + "xsi", xsi.NamespaceName), - new XAttribute("xmlns", tns), - new XAttribute(XNamespace.Xmlns + "tns", componentNamespace), - new XAttribute(xsi + "schemaLocation", - string.Format("{0} {1}VectoComponent.xsd", componentNamespace, SchemaLocationBaseUrl)), - content) - ); - return component; - } - - protected XElement[] CreateDeclarationJob(IDeclarationInputDataProvider data) - { - return new[] { - CreateVehicle(data) - }; - } - - protected XElement CreateVehicle(IDeclarationInputDataProvider data) - { - var retarder = data.RetarderInputData; - var gearbox = data.GearboxInputData; - var vehicle = data.VehicleInputData; - var angledrive = data.AngledriveInputData; - - return new XElement(tns + XMLNames.Component_Vehicle, - new XAttribute(XMLNames.Component_ID_Attr, "VEH-" + vehicle.Model), - GetDefaultComponentElements(vehicle.CertificationNumber, vehicle.Model, "N.A."), - new XElement(tns + XMLNames.Vehicle_LegislativeClass, "N3"), - new XElement(tns + XMLNames.Vehicle_VehicleCategory, vehicle.VehicleCategory.ToXMLFormat()), - new XElement(tns + XMLNames.Vehicle_AxleConfiguration, vehicle.AxleConfiguration.GetName()), - new XElement(tns + XMLNames.Vehicle_CurbMassChassis, vehicle.CurbMassChassis.ToXMLFormat(0)), - new XElement(tns + XMLNames.Vehicle_GrossVehicleMass, vehicle.GrossVehicleMassRating.ToXMLFormat(0)), - new XElement(tns + XMLNames.Vehicle_IdlingSpeed, vehicle.EngineIdleSpeed.AsRPM.ToXMLFormat(0)), - new XElement(tns + XMLNames.Vehicle_RetarderType, retarder.Type.ToXMLFormat()), - retarder.Type.IsDedicatedComponent() - ? new XElement(tns + XMLNames.Vehicle_RetarderRatio, retarder.Ratio.ToXMLFormat(3)) - : null, - new XElement(tns + XMLNames.Vehicle_AngledriveType, angledrive.Type.ToXMLFormat()), - new XElement(tns + XMLNames.Vehicle_PTO, - new XElement(tns + XMLNames.Vehicle_PTO_ShaftsGearWheels, "none"), - new XElement(tns + XMLNames.Vehicle_PTO_OtherElements, "none")), - CreateTorqueLimits(vehicle), - new XElement(tns + XMLNames.Vehicle_Components, - CreateEngine(data.EngineInputData), - CreateGearbox(gearbox, gearbox.Type.AutomaticTransmission() ? data.TorqueConverterInputData : null), - angledrive.Type == AngledriveType.SeparateAngledrive ? CreateAngleDrive(angledrive) : null, - retarder.Type.IsDedicatedComponent() ? CreateRetarder(retarder) : null, - CreateAxlegear(data.AxleGearInputData), - CreateAxleWheels(data.VehicleInputData), - CreateAuxiliaries(data.AuxiliaryInputData()), - CreateAirdrag(data.AirdragInputData) - ) - ); - } - - - protected XElement CreateEngine(IEngineDeclarationInputData data, XNamespace ns = null) - { - var id = string.Format("ENG-{0}", data.Model.RemoveWhitespace()); - var fld = FullLoadCurveReader.Create(data.FullLoadCurve, true); - return new XElement((ns ?? tns) + XMLNames.Component_Engine, - //new XAttribute(XMLNames.Component_CertificationNumber_Attr, string.Format("ENG-{0}", data.Model)), - new XElement(tns + XMLNames.ComponentDataWrapper, - new XAttribute(XMLNames.Component_ID_Attr, id), - GetDefaultComponentElements(string.Format("ENG-{0}", data.Model), data.Model), - new XElement(tns + XMLNames.Engine_Displacement, (data.Displacement.Value() * 1000 * 1000).ToXMLFormat(0)), - new XElement(tns + XMLNames.Engine_IdlingSpeed, data.IdleSpeed.AsRPM.ToXMLFormat(0)), - new XElement(tns + XMLNames.Engine_RatedSpeed, fld.RatedSpeed.AsRPM.ToXMLFormat(0)), - new XElement(tns + XMLNames.Engine_RatedPower, fld.FullLoadStationaryPower(fld.RatedSpeed).ToXMLFormat(0)), - new XElement(tns + XMLNames.Engine_MaxTorque, fld.MaxTorque.ToXMLFormat(0)), - new XElement(tns + XMLNames.Engine_WHTCUrban, data.WHTCUrban.ToXMLFormat(4)), - new XElement(tns + XMLNames.Engine_WHTCRural, data.WHTCRural.ToXMLFormat(4)), - new XElement(tns + XMLNames.Engine_WHTCMotorway, data.WHTCMotorway.ToXMLFormat(4)), - new XElement(tns + XMLNames.Engine_ColdHotBalancingFactor, data.ColdHotBalancingFactor.ToXMLFormat(4)), - new XElement(tns + XMLNames.Engine_CorrectionFactor_RegPer, "1.0000"), - new XElement(tns + XMLNames.Engine_CorrecionFactor_NCV, "1.0000"), - new XElement(tns + XMLNames.Engine_FuelType, "Diesel CI"), - new XElement(tns + XMLNames.Engine_FuelConsumptionMap, - EmbedDataTable(data.FuelConsumptionMap, AttributeMappings.FuelConsumptionMapMapping)), - new XElement(tns + XMLNames.Engine_FullLoadAndDragCurve, - EmbedDataTable(data.FullLoadCurve, AttributeMappings.EngineFullLoadCurveMapping) - ) - ), - AddSignatureDummy(id) - ); - } - - - protected XElement CreateGearbox(IGearboxDeclarationInputData gbxData, - ITorqueConverterDeclarationInputData torqueConverter, XNamespace ns = null) - { - var gears = new XElement(tns + XMLNames.Gearbox_Gears); - var i = 1; - foreach (var gearData in gbxData.Gears) { - var gear = new XElement(tns + XMLNames.Gearbox_Gears_Gear, - new XAttribute(XMLNames.Gearbox_Gear_GearNumber_Attr, i++), - new XElement(tns + XMLNames.Gearbox_Gear_Ratio, gearData.Ratio.ToXMLFormat(3)), - gearData.MaxTorque != null - ? new XElement(tns + XMLNames.Gearbox_Gears_MaxTorque, gearData.MaxTorque.Value().ToXMLFormat(0)) - : null, - gearData.MaxInputSpeed != null - ? new XElement(tns + XMLNames.Gearbox_Gear_MaxSpeed, gearData.MaxInputSpeed.AsRPM.ToXMLFormat(0)) - : null, - new XElement(tns + XMLNames.Gearbox_Gear_TorqueLossMap, - EmbedDataTable(gearData.LossMap, AttributeMappings.TransmissionLossmapMapping)) - ); - gears.Add(gear); - } - var id = string.Format("GBX-{0}", gbxData.Model.RemoveWhitespace()); - return new XElement((ns ?? tns) + XMLNames.Component_Gearbox, - //new XAttribute(XMLNames.Component_CertificationNumber_Attr, string.Format("GBX-{0}", gbxData.Model)), - new XElement(tns + XMLNames.ComponentDataWrapper, - new XAttribute(XMLNames.Component_ID_Attr, id), - GetDefaultComponentElements(string.Format("GBX-{0}", gbxData.Model), gbxData.Model), - new XElement(tns + XMLNames.Gearbox_TransmissionType, gbxData.Type.ToXMLFormat()), - new XElement(tns + XMLNames.Component_Gearbox_CertificationMethod, "Standard values"), - gears - ), - AddSignatureDummy(id), - gbxData.Type.AutomaticTransmission() ? CreateTorqueConverter(torqueConverter) : null - ); - } - - - private XElement CreateTorqueConverter(ITorqueConverterDeclarationInputData data) - { - if (data == null) { - throw new Exception("Torque Converter is required!"); - } - var id = string.Format("TC-{0}", data.Model.RemoveWhitespace()); - return new XElement(tns + XMLNames.Component_TorqueConverter, - //new XAttribute(XMLNames.Component_CertificationNumber_Attr, id), - new XElement(tns + XMLNames.ComponentDataWrapper, - new XAttribute(XMLNames.Component_ID_Attr, id), - GetDefaultComponentElements(data.CertificationNumber, data.Model), - new XElement(tns + XMLNames.Component_CertificationMethod, "Standard values"), - new XElement(tns + XMLNames.TorqueConverter_Characteristics, - EmbedDataTable(data.TCData, AttributeMappings.TorqueConverterDataMapping, - precision: new Dictionary<string, uint>() { - { TorqueConverterDataReader.Fields.SpeedRatio, 4 } - }) - ) - ), - AddSignatureDummy(id)); - } - - private XElement CreateAngleDrive(IAngledriveInputData data, XNamespace ns = null) - { - var id = string.Format("ANGL-{0}", data.Model.RemoveWhitespace()); - return new XElement((ns ??tns) + XMLNames.Component_Angledrive, - //new XAttribute(XMLNames.Component_CertificationNumber_Attr, "ANGL-" + data.Model), - new XElement(tns + XMLNames.ComponentDataWrapper, - new XAttribute(XMLNames.Component_ID_Attr, id), - GetDefaultComponentElements(data.CertificationNumber, data.Model), - new XElement(tns + XMLNames.AngleDrive_Ratio, data.Ratio.ToXMLFormat(3)), - new XElement(tns + XMLNames.Component_CertificationMethod, "Standard values"), - new XElement(tns + XMLNames.AngleDrive_TorqueLossMap, - EmbedDataTable(data.LossMap, AttributeMappings.TransmissionLossmapMapping))), - AddSignatureDummy(id)); - } - - public XElement CreateRetarder(IRetarderInputData data, XNamespace ns = null) - { - var id = string.Format("RET-{0}", data.Model.RemoveWhitespace()); - return new XElement((ns ?? tns) + XMLNames.Component_Retarder, - //new XAttribute(XMLNames.Component_CertificationNumber_Attr, "RET-none"), - new XElement(tns + XMLNames.ComponentDataWrapper, - new XAttribute(XMLNames.Component_ID_Attr, id), - GetDefaultComponentElements(data.CertificationNumber, data.Model), - new XElement(tns + XMLNames.Component_CertificationMethod, "Standard values"), - new XElement(tns + XMLNames.Retarder_RetarderLossMap, - EmbedDataTable(data.LossMap, AttributeMappings.RetarderLossmapMapping) - ) - ), - AddSignatureDummy(id) - ); - } - - public XElement CreateAxlegear(IAxleGearInputData data, XNamespace ns = null) - { - var typeId = string.Format("AXLGEAR-{0:0.000}", data.Ratio); - return new XElement((ns ?? tns) + XMLNames.Component_Axlegear, - //new XAttribute(XMLNames.Component_CertificationNumber_Attr, string.Format("AXL-{0}", data.Model)), - new XElement(tns + XMLNames.ComponentDataWrapper, - new XAttribute(XMLNames.Component_ID_Attr, typeId), - GetDefaultComponentElements(typeId, "N.A."), - new XElement(tns + "LineType", "Single portal axle"), - new XElement(tns + XMLNames.Axlegear_Ratio, data.Ratio.ToXMLFormat(3)), - new XElement(tns + XMLNames.Component_CertificationMethod, "Standard values"), - new XElement(tns + XMLNames.Axlegear_TorqueLossMap, - EmbedDataTable(data.LossMap, AttributeMappings.TransmissionLossmapMapping))), - AddSignatureDummy(typeId) - ); - } - - public XElement CreateAxleWheels(IVehicleDeclarationInputData data, XNamespace ns = null) - { - var axleData = data.Axles; - var numAxles = axleData.Count; - var axles = new List<XElement>(numAxles); - for (var i = 0; i < numAxles; i++) { - var axle = axleData[i]; - axles.Add(new XElement(tns + XMLNames.AxleWheels_Axles_Axle, - new XAttribute(XMLNames.AxleWheels_Axles_Axle_AxleNumber_Attr, i + 1), - new XElement(tns + XMLNames.AxleWheels_Axles_Axle_AxleType_Attr, - i == 1 ? AxleType.VehicleDriven.ToString() : AxleType.VehicleNonDriven.ToString()), - new XElement(tns + XMLNames.AxleWheels_Axles_Axle_TwinTyres_Attr, axle.TwinTyres), - new XElement(tns + XMLNames.AxleWheels_Axles_Axle_Steered, i == 0), - CreateTyre(axle) - )); - } - - return new XElement((ns ??tns) + XMLNames.Component_AxleWheels, - new XElement(tns + XMLNames.ComponentDataWrapper, - //new XAttribute(XMLNames.Component_ID_Attr, - // string.Format("AXLWHL-{0}", data.AxleConfiguration.GetName())), - new XElement(tns + XMLNames.AxleWheels_Axles, axles)) - ); - } - - private XElement CreateTyre(IAxleDeclarationInputData axle) - { - var id = string.Format("TYRE-{0}", axle.Wheels).RemoveWhitespace().Replace("/", "_"); - return new XElement(tns + "Tyre", - //new XAttribute(XMLNames.Component_CertificationNumber_Attr, id), - new XElement(tns + XMLNames.ComponentDataWrapper, - new XAttribute(XMLNames.Component_ID_Attr, id), - GetDefaultComponentElements(string.Format("TYRE-{0}", axle.Wheels), axle.Wheels), - new XElement(tns + XMLNames.AxleWheels_Axles_Axle_Dimension, axle.Wheels), - new XElement(tns + XMLNames.AxleWheels_Axles_Axle_RRCDeclared, axle.RollResistanceCoefficient.ToXMLFormat(4)), - new XElement(tns + XMLNames.AxleWheels_Axles_Axle_FzISO, axle.TyreTestLoad.Value().ToXMLFormat(0)) - ), - AddSignatureDummy(id)); - } - - public XElement CreateAuxiliaries(IAuxiliariesDeclarationInputData data) - { - var auxList = new Dictionary<AuxiliaryType, XElement>(); - foreach (var auxData in data.Auxiliaries) { - var entry = new XElement(tns + AuxTypeToXML(auxData.Type), +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml; +using System.Xml.Linq; +using TUGraz.IVT.VectoXML; +using TUGraz.IVT.VectoXML.Writer; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Resources; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader; +using TUGraz.VectoCore.InputData.Reader.ComponentData; + +namespace TUGraz.VectoCore.OutputData.XML +{ + public class XMLDeclarationWriter : AbstractXMLWriter + { + private XNamespace componentNamespace; + + public XMLDeclarationWriter(string vendor) : base(null, vendor) + { + tns = "urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v1.0"; + rootNamespace = "urn:tugraz:ivt:VectoAPI:DeclarationInput:v1.0"; + componentNamespace = "urn:tugraz:ivt:VectoAPI:DeclarationComponent:v1.0"; + } + + public XDocument GenerateVectoJob(IDeclarationInputDataProvider data) + { + var xsi = XNamespace.Get("http://www.w3.org/2001/XMLSchema-instance"); + + //<tns:VectoInputDeclaration + // xmlns="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v0.6" + // xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="0.6" + // xmlns:tns="urn:tugraz:ivt:VectoAPI:DeclarationInput:v0.6" + // xsi:schemaLocation="urn:tugraz:ivt:VectoAPI:DeclarationInput:v0.6 http://markus.quaritsch.at/VECTO/VectoInput.xsd"> + var job = new XDocument(); + job.Add(new XElement(rootNamespace + XMLNames.VectoInputDeclaration, + new XAttribute("schemaVersion", SchemaVersion), + new XAttribute(XNamespace.Xmlns + "xsi", xsi.NamespaceName), + new XAttribute("xmlns", tns), + new XAttribute(XNamespace.Xmlns + "tns", rootNamespace), + new XAttribute(xsi + "schemaLocation", + string.Format("{0} {1}VectoInput.xsd", rootNamespace, SchemaLocationBaseUrl)), + CreateDeclarationJob(data)) + ); + return job; + } + + public XDocument GenerateVectoComponent(IGearboxDeclarationInputData data, + ITorqueConverterDeclarationInputData torqueConverter) + { + return GenerateComponentDocument(CreateGearbox(data, torqueConverter, componentNamespace)); + } + + public XDocument GenerateVectoComponent(IAxleGearInputData data) + { + return GenerateComponentDocument(CreateAxlegear(data, componentNamespace)); + } + + protected XDocument GenerateComponentDocument(XElement content) + { + var xsi = XNamespace.Get("http://www.w3.org/2001/XMLSchema-instance"); + var component = new XDocument(); + component.Add(new XElement(componentNamespace + XMLNames.VectoInputDeclaration, + new XAttribute("schemaVersion", SchemaVersion), + new XAttribute(XNamespace.Xmlns + "xsi", xsi.NamespaceName), + new XAttribute("xmlns", tns), + new XAttribute(XNamespace.Xmlns + "tns", componentNamespace), + new XAttribute(xsi + "schemaLocation", + string.Format("{0} {1}VectoComponent.xsd", componentNamespace, SchemaLocationBaseUrl)), + content) + ); + return component; + } + + protected XElement[] CreateDeclarationJob(IDeclarationInputDataProvider data) + { + return new[] { + CreateVehicle(data) + }; + } + + protected XElement CreateVehicle(IDeclarationInputDataProvider data) + { + var retarder = data.RetarderInputData; + var gearbox = data.GearboxInputData; + var vehicle = data.VehicleInputData; + var angledrive = data.AngledriveInputData; + + return new XElement(tns + XMLNames.Component_Vehicle, + new XAttribute(XMLNames.Component_ID_Attr, "VEH-" + vehicle.Model), + GetDefaultComponentElements(vehicle.CertificationNumber, vehicle.Model, "N.A."), + new XElement(tns + XMLNames.Vehicle_LegislativeClass, "N3"), + new XElement(tns + XMLNames.Vehicle_VehicleCategory, vehicle.VehicleCategory.ToXMLFormat()), + new XElement(tns + XMLNames.Vehicle_AxleConfiguration, vehicle.AxleConfiguration.GetName()), + new XElement(tns + XMLNames.Vehicle_CurbMassChassis, vehicle.CurbMassChassis.ToXMLFormat(0)), + new XElement(tns + XMLNames.Vehicle_GrossVehicleMass, vehicle.GrossVehicleMassRating.ToXMLFormat(0)), + new XElement(tns + XMLNames.Vehicle_IdlingSpeed, vehicle.EngineIdleSpeed.AsRPM.ToXMLFormat(0)), + new XElement(tns + XMLNames.Vehicle_RetarderType, retarder.Type.ToXMLFormat()), + retarder.Type.IsDedicatedComponent() + ? new XElement(tns + XMLNames.Vehicle_RetarderRatio, retarder.Ratio.ToXMLFormat(3)) + : null, + new XElement(tns + XMLNames.Vehicle_AngledriveType, angledrive.Type.ToXMLFormat()), + new XElement(tns + XMLNames.Vehicle_PTO, + new XElement(tns + XMLNames.Vehicle_PTO_ShaftsGearWheels, "none"), + new XElement(tns + XMLNames.Vehicle_PTO_OtherElements, "none")), + CreateTorqueLimits(vehicle), + new XElement(tns + XMLNames.Vehicle_Components, + CreateEngine(data.EngineInputData), + CreateGearbox(gearbox, gearbox.Type.AutomaticTransmission() ? data.TorqueConverterInputData : null), + angledrive.Type == AngledriveType.SeparateAngledrive ? CreateAngleDrive(angledrive) : null, + retarder.Type.IsDedicatedComponent() ? CreateRetarder(retarder) : null, + CreateAxlegear(data.AxleGearInputData), + CreateAxleWheels(data.VehicleInputData), + CreateAuxiliaries(data.AuxiliaryInputData()), + CreateAirdrag(data.AirdragInputData) + ) + ); + } + + protected XElement CreateEngine(IEngineDeclarationInputData data, XNamespace ns = null) + { + var id = string.Format("ENG-{0}", data.Model.RemoveWhitespace()); + var fld = FullLoadCurveReader.Create(data.FullLoadCurve, true); + return new XElement((ns ?? tns) + XMLNames.Component_Engine, + new XElement(tns + XMLNames.ComponentDataWrapper, + new XAttribute(XMLNames.Component_ID_Attr, id), + GetDefaultComponentElements(string.Format("ENG-{0}", data.Model), data.Model), + new XElement(tns + XMLNames.Engine_Displacement, (data.Displacement.Value() * 1000 * 1000).ToXMLFormat(0)), + new XElement(tns + XMLNames.Engine_IdlingSpeed, data.IdleSpeed.AsRPM.ToXMLFormat(0)), + new XElement(tns + XMLNames.Engine_RatedSpeed, fld.RatedSpeed.AsRPM.ToXMLFormat(0)), + new XElement(tns + XMLNames.Engine_RatedPower, fld.FullLoadStationaryPower(fld.RatedSpeed).ToXMLFormat(0)), + new XElement(tns + XMLNames.Engine_MaxTorque, fld.MaxTorque.ToXMLFormat(0)), + new XElement(tns + XMLNames.Engine_WHTCUrban, data.WHTCUrban.ToXMLFormat(4)), + new XElement(tns + XMLNames.Engine_WHTCRural, data.WHTCRural.ToXMLFormat(4)), + new XElement(tns + XMLNames.Engine_WHTCMotorway, data.WHTCMotorway.ToXMLFormat(4)), + new XElement(tns + XMLNames.Engine_ColdHotBalancingFactor, data.ColdHotBalancingFactor.ToXMLFormat(4)), + new XElement(tns + XMLNames.Engine_CorrectionFactor_RegPer, "1.0000"), + new XElement(tns + XMLNames.Engine_CorrecionFactor_NCV, "1.0000"), + new XElement(tns + XMLNames.Engine_FuelType, "Diesel CI"), + new XElement(tns + XMLNames.Engine_FuelConsumptionMap, + EmbedDataTable(data.FuelConsumptionMap, AttributeMappings.FuelConsumptionMapMapping)), + new XElement(tns + XMLNames.Engine_FullLoadAndDragCurve, + EmbedDataTable(data.FullLoadCurve, AttributeMappings.EngineFullLoadCurveMapping) + ) + ), + AddSignatureDummy(id) + ); + } + + protected XElement CreateGearbox(IGearboxDeclarationInputData gbxData, + ITorqueConverterDeclarationInputData torqueConverter, XNamespace ns = null) + { + var gears = new XElement(tns + XMLNames.Gearbox_Gears); + var i = 1; + foreach (var gearData in gbxData.Gears) { + var gear = new XElement(tns + XMLNames.Gearbox_Gears_Gear, + new XAttribute(XMLNames.Gearbox_Gear_GearNumber_Attr, i++), + new XElement(tns + XMLNames.Gearbox_Gear_Ratio, gearData.Ratio.ToXMLFormat(3)), + gearData.MaxTorque != null + ? new XElement(tns + XMLNames.Gearbox_Gears_MaxTorque, gearData.MaxTorque.Value().ToXMLFormat(0)) + : null, + gearData.MaxInputSpeed != null + ? new XElement(tns + XMLNames.Gearbox_Gear_MaxSpeed, gearData.MaxInputSpeed.AsRPM.ToXMLFormat(0)) + : null, + new XElement(tns + XMLNames.Gearbox_Gear_TorqueLossMap, + EmbedDataTable(gearData.LossMap, AttributeMappings.TransmissionLossmapMapping)) + ); + gears.Add(gear); + } + var id = string.Format("GBX-{0}", gbxData.Model.RemoveWhitespace()); + return new XElement((ns ?? tns) + XMLNames.Component_Gearbox, + new XElement(tns + XMLNames.ComponentDataWrapper, + new XAttribute(XMLNames.Component_ID_Attr, id), + GetDefaultComponentElements(string.Format("GBX-{0}", gbxData.Model), gbxData.Model), + new XElement(tns + XMLNames.Gearbox_TransmissionType, gbxData.Type.ToXMLFormat()), + new XElement(tns + XMLNames.Component_Gearbox_CertificationMethod, "Standard values"), + gears + ), + AddSignatureDummy(id), + gbxData.Type.AutomaticTransmission() ? CreateTorqueConverter(torqueConverter) : null + ); + } + + private XElement CreateTorqueConverter(ITorqueConverterDeclarationInputData data) + { + if (data == null) { + throw new Exception("Torque Converter is required!"); + } + var id = string.Format("TC-{0}", data.Model.RemoveWhitespace()); + return new XElement(tns + XMLNames.Component_TorqueConverter, + new XElement(tns + XMLNames.ComponentDataWrapper, + new XAttribute(XMLNames.Component_ID_Attr, id), + GetDefaultComponentElements(data.CertificationNumber, data.Model), + new XElement(tns + XMLNames.Component_CertificationMethod, "Standard values"), + new XElement(tns + XMLNames.TorqueConverter_Characteristics, + EmbedDataTable(data.TCData, AttributeMappings.TorqueConverterDataMapping, + precision: new Dictionary<string, uint>() { + { TorqueConverterDataReader.Fields.SpeedRatio, 4 } + }) + ) + ), + AddSignatureDummy(id)); + } + + private XElement CreateAngleDrive(IAngledriveInputData data, XNamespace ns = null) + { + var id = string.Format("ANGL-{0}", data.Model.RemoveWhitespace()); + return new XElement((ns ?? tns) + XMLNames.Component_Angledrive, + new XElement(tns + XMLNames.ComponentDataWrapper, + new XAttribute(XMLNames.Component_ID_Attr, id), + GetDefaultComponentElements(data.CertificationNumber, data.Model), + new XElement(tns + XMLNames.AngleDrive_Ratio, data.Ratio.ToXMLFormat(3)), + new XElement(tns + XMLNames.Component_CertificationMethod, "Standard values"), + new XElement(tns + XMLNames.AngleDrive_TorqueLossMap, + EmbedDataTable(data.LossMap, AttributeMappings.TransmissionLossmapMapping))), + AddSignatureDummy(id)); + } + + public XElement CreateRetarder(IRetarderInputData data, XNamespace ns = null) + { + var id = string.Format("RET-{0}", data.Model.RemoveWhitespace()); + return new XElement((ns ?? tns) + XMLNames.Component_Retarder, + new XElement(tns + XMLNames.ComponentDataWrapper, + new XAttribute(XMLNames.Component_ID_Attr, id), + GetDefaultComponentElements(data.CertificationNumber, data.Model), + new XElement(tns + XMLNames.Component_CertificationMethod, "Standard values"), + new XElement(tns + XMLNames.Retarder_RetarderLossMap, + EmbedDataTable(data.LossMap, AttributeMappings.RetarderLossmapMapping) + ) + ), + AddSignatureDummy(id) + ); + } + + public XElement CreateAxlegear(IAxleGearInputData data, XNamespace ns = null) + { + var typeId = string.Format("AXLGEAR-{0:0.000}", data.Ratio); + return new XElement((ns ?? tns) + XMLNames.Component_Axlegear, + new XElement(tns + XMLNames.ComponentDataWrapper, + new XAttribute(XMLNames.Component_ID_Attr, typeId), + GetDefaultComponentElements(typeId, "N.A."), + new XElement(tns + "LineType", "Single portal axle"), + new XElement(tns + XMLNames.Axlegear_Ratio, data.Ratio.ToXMLFormat(3)), + new XElement(tns + XMLNames.Component_CertificationMethod, "Standard values"), + new XElement(tns + XMLNames.Axlegear_TorqueLossMap, + EmbedDataTable(data.LossMap, AttributeMappings.TransmissionLossmapMapping))), + AddSignatureDummy(typeId) + ); + } + + public XElement CreateAxleWheels(IVehicleDeclarationInputData data, XNamespace ns = null) + { + var axleData = data.Axles; + var numAxles = axleData.Count; + var axles = new List<XElement>(numAxles); + for (var i = 0; i < numAxles; i++) { + var axle = axleData[i]; + axles.Add(new XElement(tns + XMLNames.AxleWheels_Axles_Axle, + new XAttribute(XMLNames.AxleWheels_Axles_Axle_AxleNumber_Attr, i + 1), + new XElement(tns + XMLNames.AxleWheels_Axles_Axle_AxleType_Attr, + i == 1 ? AxleType.VehicleDriven.ToString() : AxleType.VehicleNonDriven.ToString()), + new XElement(tns + XMLNames.AxleWheels_Axles_Axle_TwinTyres_Attr, axle.TwinTyres), + new XElement(tns + XMLNames.AxleWheels_Axles_Axle_Steered, i == 0), + CreateTyre(axle) + )); + } + + return new XElement((ns ?? tns) + XMLNames.Component_AxleWheels, + new XElement(tns + XMLNames.ComponentDataWrapper, + new XElement(tns + XMLNames.AxleWheels_Axles, axles)) + ); + } + + private XElement CreateTyre(IAxleDeclarationInputData axle) + { + var id = string.Format("TYRE-{0}", axle.Wheels).RemoveWhitespace().Replace("/", "_"); + return new XElement(tns + "Tyre", + new XElement(tns + XMLNames.ComponentDataWrapper, + new XAttribute(XMLNames.Component_ID_Attr, id), + GetDefaultComponentElements(string.Format("TYRE-{0}", axle.Wheels), axle.Wheels), + new XElement(tns + XMLNames.AxleWheels_Axles_Axle_Dimension, axle.Wheels), + new XElement(tns + XMLNames.AxleWheels_Axles_Axle_RRCDeclared, axle.RollResistanceCoefficient.ToXMLFormat(4)), + new XElement(tns + XMLNames.AxleWheels_Axles_Axle_FzISO, axle.TyreTestLoad.Value().ToXMLFormat(0)) + ), + AddSignatureDummy(id)); + } + + public XElement CreateAuxiliaries(IAuxiliariesDeclarationInputData data) + { + var auxList = new Dictionary<AuxiliaryType, XElement>(); + foreach (var auxData in data.Auxiliaries) { + var entry = new XElement(tns + AuxTypeToXML(auxData.Type), auxData.Technology.Select(x => new XElement(tns + XMLNames.Auxiliaries_Auxiliary_Technology, x)).ToArray<object>()); - auxList[auxData.Type] = entry; - } - var aux = new XElement(tns + XMLNames.ComponentDataWrapper); - foreach ( - var key in - new[] { - AuxiliaryType.Fan, AuxiliaryType.SteeringPump, AuxiliaryType.ElectricSystem, AuxiliaryType.PneumaticSystem, - AuxiliaryType.HVAC - }) { - aux.Add(auxList[key]); - } - return new XElement(tns + XMLNames.Component_Auxiliaries, aux); - } - - private XElement CreateAirdrag(IAirdragDeclarationInputData data, XNamespace ns = null) - { - var id = string.Format("Airdrag-{0}", data.Model); - return new XElement((ns ?? tns) + XMLNames.Component_AirDrag, - //new XAttribute(XMLNames.Component_CertificationNumber_Attr, string.Format("AD-{0}", data.Model)), - new XElement(tns + XMLNames.ComponentDataWrapper, - new XAttribute(XMLNames.Component_ID_Attr, id), - GetDefaultComponentElements(data.Model, "N.A."), - new XElement(tns + "CdxA_0", data.AirDragArea.Value().ToXMLFormat(2)), // TODO MQ - new XElement(tns + "TransferredCdxA", data.AirDragArea.Value().ToXMLFormat(2)), // TODO MQ - new XElement(tns + XMLNames.AirDrag_DeclaredCdxA, data.AirDragArea.Value().ToXMLFormat(2))), - AddSignatureDummy(id) - ); - } - - private string AuxTypeToXML(AuxiliaryType type) - { - return type.ToString(); - } - - - private XElement AddSignatureDummy(string id) - { - return new XElement(tns + XMLNames.DI_Signature, - new XElement(di + XMLNames.DI_Signature_Reference, - new XAttribute(XMLNames.DI_Signature_Reference_URI_Attr, "#" + id), - new XElement(di + XMLNames.DI_Signature_Reference_Transforms, - new XElement(di + XMLNames.DI_Signature_Reference_Transforms_Transform, - new XAttribute(XMLNames.DI_Signature_Algorithm_Attr, - "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithoutComments")), - new XElement(di + XMLNames.DI_Signature_Reference_Transforms_Transform, - new XAttribute(XMLNames.DI_Signature_Algorithm_Attr, "urn:vecto:xml:2017:canonicalization")) - ), - new XElement(di + XMLNames.DI_Signature_Reference_DigestMethod, - new XAttribute(XMLNames.DI_Signature_Algorithm_Attr, "http://www.w3.org/2001/04/xmlenc#sha256")), - new XElement(di + XMLNames.DI_Signature_Reference_DigestValue, "") - ) - ); - } - - protected XElement[] GetDefaultComponentElements(string componentId, string makeAndModel) - { - return new[] { - new XElement(tns + XMLNames.Component_Manufacturer, Vendor), - new XElement(tns + XMLNames.Component_Model, makeAndModel), - new XElement(tns + XMLNames.Component_CertificationNumber, componentId), - new XElement(tns + XMLNames.Component_Date, XmlConvert.ToString(DateTime.Now, XmlDateTimeSerializationMode.Utc)), - new XElement(tns + XMLNames.Component_AppVersion, "VectoCore"), - }; - } - - protected XElement[] GetDefaultComponentElements(string vin, string makeAndModel, string address) - { - return new[] { - new XElement(tns + XMLNames.Component_Manufacturer, Vendor), - new XElement(tns + XMLNames.Component_ManufacturerAddress, address), - new XElement(tns + XMLNames.Component_Model, makeAndModel), - new XElement(tns + XMLNames.Vehicle_VIN, vin), - new XElement(tns + XMLNames.Component_Date, XmlConvert.ToString(DateTime.Now, XmlDateTimeSerializationMode.Utc)), - }; - } - } + auxList[auxData.Type] = entry; + } + var aux = new XElement(tns + XMLNames.ComponentDataWrapper); + foreach ( + var key in + new[] { + AuxiliaryType.Fan, AuxiliaryType.SteeringPump, AuxiliaryType.ElectricSystem, AuxiliaryType.PneumaticSystem, + AuxiliaryType.HVAC + }) { + aux.Add(auxList[key]); + } + return new XElement(tns + XMLNames.Component_Auxiliaries, aux); + } + + private XElement CreateAirdrag(IAirdragDeclarationInputData data, XNamespace ns = null) + { + var id = string.Format("Airdrag-{0}", data.Model); + return new XElement((ns ?? tns) + XMLNames.Component_AirDrag, + new XElement(tns + XMLNames.ComponentDataWrapper, + new XAttribute(XMLNames.Component_ID_Attr, id), + GetDefaultComponentElements(data.Model, "N.A."), + new XElement(tns + "CdxA_0", data.AirDragArea.Value().ToXMLFormat(2)), + new XElement(tns + "TransferredCdxA", data.AirDragArea.Value().ToXMLFormat(2)), + new XElement(tns + XMLNames.AirDrag_DeclaredCdxA, data.AirDragArea.Value().ToXMLFormat(2))), + AddSignatureDummy(id) + ); + } + + private string AuxTypeToXML(AuxiliaryType type) + { + return type.ToString(); + } + + private XElement AddSignatureDummy(string id) + { + return new XElement(tns + XMLNames.DI_Signature, + new XElement(di + XMLNames.DI_Signature_Reference, + new XAttribute(XMLNames.DI_Signature_Reference_URI_Attr, "#" + id), + new XElement(di + XMLNames.DI_Signature_Reference_Transforms, + new XElement(di + XMLNames.DI_Signature_Reference_Transforms_Transform, + new XAttribute(XMLNames.DI_Signature_Algorithm_Attr, + "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithoutComments")), + new XElement(di + XMLNames.DI_Signature_Reference_Transforms_Transform, + new XAttribute(XMLNames.DI_Signature_Algorithm_Attr, "urn:vecto:xml:2017:canonicalization")) + ), + new XElement(di + XMLNames.DI_Signature_Reference_DigestMethod, + new XAttribute(XMLNames.DI_Signature_Algorithm_Attr, "http://www.w3.org/2001/04/xmlenc#sha256")), + new XElement(di + XMLNames.DI_Signature_Reference_DigestValue, "") + ) + ); + } + + protected XElement[] GetDefaultComponentElements(string componentId, string makeAndModel) + { + return new[] { + new XElement(tns + XMLNames.Component_Manufacturer, Vendor), + new XElement(tns + XMLNames.Component_Model, makeAndModel), + new XElement(tns + XMLNames.Component_CertificationNumber, componentId), + new XElement(tns + XMLNames.Component_Date, XmlConvert.ToString(DateTime.Now, XmlDateTimeSerializationMode.Utc)), + new XElement(tns + XMLNames.Component_AppVersion, "VectoCore"), + }; + } + + protected XElement[] GetDefaultComponentElements(string vin, string makeAndModel, string address) + { + return new[] { + new XElement(tns + XMLNames.Component_Manufacturer, Vendor), + new XElement(tns + XMLNames.Component_ManufacturerAddress, address), + new XElement(tns + XMLNames.Component_Model, makeAndModel), + new XElement(tns + XMLNames.Vehicle_VIN, vin), + new XElement(tns + XMLNames.Component_Date, XmlConvert.ToString(DateTime.Now, XmlDateTimeSerializationMode.Utc)), + }; + } + } } \ No newline at end of file