From 8061c152e0073707230ccba47c8995baf3188a37 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Thu, 8 Aug 2019 10:23:45 +0200 Subject: [PATCH] updating writing engineering xml --- .../VectoCommon/InputData/DeclarationInputData.cs | 5 +++++ VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs | 9 +++++++++ VectoCommon/VectoCommon/Resources/XMLNames.resx | 3 +++ .../Reader/DataObjectAdapter/EngineeringDataAdapter.cs | 8 +++++++- .../Engineering/Writer/XMLEngineeringADASWriterV10.cs | 9 +++++++-- .../Writer/XMLEngineeringVehicleDataWriter.cs | 7 ++----- 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs index 3d515a4b8e..c7252cc8ec 100644 --- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs +++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs @@ -288,6 +288,11 @@ namespace TUGraz.VectoCommon.InputData default: throw new ArgumentOutOfRangeException(nameof(ecoRoll), ecoRoll, null); } } + + public static string ToXMLFormat(this EcoRollType ecoRoll) + { + return GetName(ecoRoll).ToLowerInvariant(); + } } public enum TankSystem diff --git a/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs b/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs index ce02aa990a..437a42f636 100644 --- a/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs +++ b/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs @@ -2472,6 +2472,15 @@ namespace TUGraz.VectoCommon.Resources { } } + /// <summary> + /// Looks up a localized string similar to EcoRoll. + /// </summary> + public static string Vehicle_ADAS_EcoRoll { + get { + return ResourceManager.GetString("Vehicle_ADAS_EcoRoll", resourceCulture); + } + } + /// <summary> /// Looks up a localized string similar to EcoRollWithEngineStop. /// </summary> diff --git a/VectoCommon/VectoCommon/Resources/XMLNames.resx b/VectoCommon/VectoCommon/Resources/XMLNames.resx index 60c69fa803..41fb2b04a8 100644 --- a/VectoCommon/VectoCommon/Resources/XMLNames.resx +++ b/VectoCommon/VectoCommon/Resources/XMLNames.resx @@ -1104,4 +1104,7 @@ <data name="Engine_WHRType" xml:space="preserve"> <value>WHRType</value> </data> + <data name="Vehicle_ADAS_EcoRoll" xml:space="preserve"> + <value>EcoRoll</value> + </data> </root> \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs index ccca196d8f..2efaddd967 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs @@ -81,7 +81,13 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter private VehicleData.ADASData CreateADAS(IAdvancedDriverAssistantSystemsEngineering adas) { - return new VehicleData.ADASData { + return adas == null ? + new VehicleData.ADASData() { + EngineStopStart = false, + EcoRoll = EcoRollType.None, + PredictiveCruiseControl = PredictiveCruiseControlType.None + }: + new VehicleData.ADASData { EngineStopStart = adas.EngineStopStart, EcoRoll = adas.EcoRoll, PredictiveCruiseControl = adas.PredictiveCruiseControl diff --git a/VectoCore/VectoCore/OutputData/XML/Engineering/Writer/XMLEngineeringADASWriterV10.cs b/VectoCore/VectoCore/OutputData/XML/Engineering/Writer/XMLEngineeringADASWriterV10.cs index 406041579b..50323733ca 100644 --- a/VectoCore/VectoCore/OutputData/XML/Engineering/Writer/XMLEngineeringADASWriterV10.cs +++ b/VectoCore/VectoCore/OutputData/XML/Engineering/Writer/XMLEngineeringADASWriterV10.cs @@ -1,5 +1,6 @@ using System.Xml.Linq; using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Resources; using TUGraz.VectoCore.OutputData.XML.Engineering.Interfaces; using TUGraz.VectoCore.Utils; @@ -20,8 +21,12 @@ namespace TUGraz.VectoCore.OutputData.XML.Engineering.Writer { if (adas == null) { return null; } - // todo: write different ADAS options - return null; + + var ns = ComponentDataNamespace; + return new object[] { new XElement(ns + XMLNames.Vehicle_AdvancedDriverAssist, + new XElement(ns + XMLNames.Vehicle_ADAS_EngineStopStart, adas.EngineStopStart), + new XElement(ns + XMLNames.Vehicle_ADAS_EcoRoll, adas.EcoRoll.ToXMLFormat()), + new XElement(ns + XMLNames.Vehicle_ADAS_PCC, adas.PredictiveCruiseControl.ToXMLFormat()))}; } #endregion diff --git a/VectoCore/VectoCore/OutputData/XML/Engineering/Writer/XMLEngineeringVehicleDataWriter.cs b/VectoCore/VectoCore/OutputData/XML/Engineering/Writer/XMLEngineeringVehicleDataWriter.cs index bf18416897..1bb5f282e0 100644 --- a/VectoCore/VectoCore/OutputData/XML/Engineering/Writer/XMLEngineeringVehicleDataWriter.cs +++ b/VectoCore/VectoCore/OutputData/XML/Engineering/Writer/XMLEngineeringVehicleDataWriter.cs @@ -64,14 +64,11 @@ namespace TUGraz.VectoCore.OutputData.XML.Engineering.Writer CreateTorqueLimits(ns, vehicle), new XElement(ns + XMLNames.Vehicle_CurbMassExtra, vehicle.CurbMassExtra.Value()), new XElement(ns + XMLNames.Vehicle_Loading, vehicle.Loading.Value()), + Factory.GetWriter(vehicle.ADAS, Writer, vehicle.ADAS.DataSource).WriteXML(vehicle), new XElement( ns + XMLNames.Vehicle_Components, componentsWriter.WriteXML(vehicle) - ), - vehicle.ADAS == null ? null : - new XElement(ns + XMLNames.Vehicle_AdvancedDriverAssist, - Factory.GetWriter(vehicle.ADAS, Writer, vehicle.ADAS.DataSource).WriteXML(vehicle) - ), + ) }; return retVal; } -- GitLab