From 1c023cd7eaa267ded0ffcd4f7c82a3d44558a13f Mon Sep 17 00:00:00 2001
From: "VKMTHD\\franzjosefkober" <franz.josef.kober@ivt.tugraz.at>
Date: Thu, 16 Sep 2021 12:58:22 +0200
Subject: [PATCH] added VehicleTypeApprovalNumber

---
 VECTO/Input Files/Engine.vb                           |  1 +
 VECTO/Input Files/Gearbox.vb                          |  1 +
 VECTO/Input Files/MockVehicleInputData.vb             |  1 +
 VECTO/Input Files/Vehicle.vb                          |  1 +
 .../VectoCommon/InputData/DeclarationInputData.cs     |  2 ++
 .../VectoCommon/Resources/XMLNames.Designer.cs        |  9 +++++++++
 VectoCommon/VectoCommon/Resources/XMLNames.resx       |  3 +++
 .../InputData/FileIO/JSON/JSONComponentInputData.cs   |  1 +
 .../InputData/FileIO/JSON/JSONVehicleData.cs          |  1 +
 .../DataProvider/XMLDeclarationVehicleDataProvider.cs |  4 +++-
 .../Impl/XMLDeclarationMultistageInputReader.cs       |  1 +
 .../DataProvider/XMLEngineeringVehicleDataProvider.cs |  1 +
 .../Utils/MockDeclarationVehicleInputData.cs          |  2 ++
 .../VectoCoreTest/XML/XMLDeclarationInputv210.cs      | 11 +++++++++++
 14 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/VECTO/Input Files/Engine.vb b/VECTO/Input Files/Engine.vb
index 7247c641b0..c5ac2f886b 100644
--- a/VECTO/Input Files/Engine.vb	
+++ b/VECTO/Input Files/Engine.vb	
@@ -681,6 +681,7 @@ Public Class DummyVehicle
 	End Property
 
 	Public ReadOnly Property XMLSource As XmlNode Implements IVehicleDeclarationInputData.XMLSource
+	Public ReadOnly Property VehicleTypeApprovalNumber As String Implements IVehicleDeclarationInputData.VehicleTypeApprovalNumber
 
 	Public Property AirdragInputData As IAirdragDeclarationInputData Implements IVehicleComponentsDeclaration.AirdragInputData
 	Public Property IVehicleComponentsEngineering_GearboxInputData As IGearboxEngineeringInputData Implements IVehicleComponentsEngineering.GearboxInputData
diff --git a/VECTO/Input Files/Gearbox.vb b/VECTO/Input Files/Gearbox.vb
index 865349697d..c4a6286c1b 100644
--- a/VECTO/Input Files/Gearbox.vb	
+++ b/VECTO/Input Files/Gearbox.vb	
@@ -879,6 +879,7 @@ Public Class MockEngineeringVehicle
     Public ReadOnly Property VehicleDeclarationType As VehicleDeclarationType Implements IVehicleDeclarationInputData.VehicleDeclarationType
     Public Property Components As IVehicleComponentsDeclaration Implements IVehicleDeclarationInputData.Components
     Public ReadOnly Property XMLSource As XmlNode Implements IVehicleDeclarationInputData.XMLSource
+    Public ReadOnly Property VehicleTypeApprovalNumber As String Implements IVehicleDeclarationInputData.VehicleTypeApprovalNumber
 
     Public Property AirdragInputData As IAirdragEngineeringInputData _
         Implements IVehicleComponentsEngineering.AirdragInputData
diff --git a/VECTO/Input Files/MockVehicleInputData.vb b/VECTO/Input Files/MockVehicleInputData.vb
index a26248bc34..23a25e9959 100644
--- a/VECTO/Input Files/MockVehicleInputData.vb	
+++ b/VECTO/Input Files/MockVehicleInputData.vb	
@@ -60,4 +60,5 @@ Public Class MockVehicleInputData
     Public ReadOnly Property BoostingLimitations As TableData Implements IVehicleDeclarationInputData.BoostingLimitations
     Public Property Components As IVehicleComponentsDeclaration Implements IVehicleDeclarationInputData.Components
     Public ReadOnly Property XMLSource As XmlNode Implements IVehicleDeclarationInputData.XMLSource
+    Public ReadOnly Property VehicleTypeApprovalNumber As String Implements IVehicleDeclarationInputData.VehicleTypeApprovalNumber
 End Class
\ No newline at end of file
diff --git a/VECTO/Input Files/Vehicle.vb b/VECTO/Input Files/Vehicle.vb
index 07d8cfa900..16b62dd115 100644
--- a/VECTO/Input Files/Vehicle.vb	
+++ b/VECTO/Input Files/Vehicle.vb	
@@ -906,6 +906,7 @@ end Property
 	End Property
 
 	Public ReadOnly Property XMLSource As XmlNode Implements IAdvancedDriverAssistantSystemDeclarationInputData.XMLSource
+	Public ReadOnly Property VehicleTypeApprovalNumber As String Implements IVehicleDeclarationInputData.VehicleTypeApprovalNumber
 
 	Public ReadOnly Property IAdvancedDriverAssistantSystemsEngineering_DataSource As DataSource Implements IAdvancedDriverAssistantSystemsEngineering.DataSource
 		Get
diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs
index 56a44754ea..52ce9c2da6 100644
--- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs
+++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs
@@ -206,6 +206,8 @@ namespace TUGraz.VectoCommon.InputData
 
 		IVehicleComponentsDeclaration Components { get; }
 		XmlNode XMLSource { get; }
+
+		string VehicleTypeApprovalNumber { get; }
 	}
 
 	public interface IVehicleComponentsDeclaration
diff --git a/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs b/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs
index d3ea3a691d..482497b4ac 100644
--- a/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs
+++ b/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs
@@ -5127,6 +5127,15 @@ namespace TUGraz.VectoCommon.Resources {
             }
         }
         
+        /// <summary>
+        ///   Looks up a localized string similar to VehicleTypeApprovalNumber.
+        /// </summary>
+        public static string Vehicle_TypeApprovalNumber {
+            get {
+                return ResourceManager.GetString("Vehicle_TypeApprovalNumber", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   Looks up a localized string similar to VehicleCategory.
         /// </summary>
diff --git a/VectoCommon/VectoCommon/Resources/XMLNames.resx b/VectoCommon/VectoCommon/Resources/XMLNames.resx
index 353a10a6a4..f23a1e9b5b 100644
--- a/VectoCommon/VectoCommon/Resources/XMLNames.resx
+++ b/VectoCommon/VectoCommon/Resources/XMLNames.resx
@@ -1833,4 +1833,7 @@
   <data name="IEPC_NrOfDesignTypeWheelMotorMeasured" xml:space="preserve">
     <value>NrOfDesignTypeWheelMotorMeasured</value>
   </data>
+  <data name="Vehicle_TypeApprovalNumber" xml:space="preserve">
+    <value>VehicleTypeApprovalNumber</value>
+  </data>
 </root>
\ No newline at end of file
diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs
index 85fb5e33d2..9404bd0661 100644
--- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs
+++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs
@@ -242,6 +242,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
 		public bool? ATEcoRollReleaseLockupClutch => VehicleData.ADAS.ATEcoRollReleaseLockupClutch;
 
 		public XmlNode XMLSource => null;
+		public string VehicleTypeApprovalNumber { get; }
 
 		public Meter Length => VehicleData.Length;
 
diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs
index 98273c4de0..6d2e596597 100644
--- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs
+++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs
@@ -294,6 +294,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
 		IVehicleComponentsEngineering IVehicleEngineeringInputData.Components => this;
 
 		XmlNode IVehicleDeclarationInputData.XMLSource => null;
+		public virtual string VehicleTypeApprovalNumber { get; }
 
 		public GearshiftPosition PTO_DriveGear => Body["GearDuringPTODrive"] != null ? new GearshiftPosition(Body["GearDuringPTODrive"].Value<uint>()) : null;
 
diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs
index abf12cd0a7..8f7ee4a175 100644
--- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs
+++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs
@@ -242,8 +242,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider
 		public virtual Dictionary<PowertrainPosition, List<Tuple<int, TableData>>> ElectricMotorTorqueLimits => null;
 		public virtual TableData BoostingLimitations => null;
 
-
 		public virtual IVehicleComponentsDeclaration Components => _components ?? (_components = ComponentReader.ComponentInputData);
+		
+		public virtual string VehicleTypeApprovalNumber => GetString(XMLNames.Vehicle_TypeApprovalNumber);
 
 		#region Implementation of IAdvancedDriverAssistantSystemDeclarationInputData
 
@@ -709,6 +710,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider
 
 
 		public virtual IVehicleComponentsDeclaration Components => _components ?? (_components = ComponentReader.ComponentInputData);
+		public virtual string VehicleTypeApprovalNumber => null;
 
 
 		#region  Non seeded Properties
diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Reader/Impl/XMLDeclarationMultistageInputReader.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Reader/Impl/XMLDeclarationMultistageInputReader.cs
index b92643ade0..772dded679 100644
--- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Reader/Impl/XMLDeclarationMultistageInputReader.cs
+++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Reader/Impl/XMLDeclarationMultistageInputReader.cs
@@ -598,6 +598,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Reader.Impl
 		public bool Articulated { get; }
 
 		public XmlNode XMLSource { get; }
+		public string VehicleTypeApprovalNumber { get; }
 
 		#endregion
 
diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringVehicleDataProvider.cs
index 5badefb1ef..fb44b35fd5 100644
--- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringVehicleDataProvider.cs
+++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringVehicleDataProvider.cs
@@ -153,6 +153,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering.DataProvider
 		public TableData BoostingLimitations => null;
 
 		IVehicleComponentsDeclaration IVehicleDeclarationInputData.Components => null;
+		public string VehicleTypeApprovalNumber => null;
 
 		IAdvancedDriverAssistantSystemDeclarationInputData IVehicleDeclarationInputData.ADAS => null;
 
diff --git a/VectoCore/VectoCoreTest/Utils/MockDeclarationVehicleInputData.cs b/VectoCore/VectoCoreTest/Utils/MockDeclarationVehicleInputData.cs
index e30e82ed3b..55fd11c660 100644
--- a/VectoCore/VectoCoreTest/Utils/MockDeclarationVehicleInputData.cs
+++ b/VectoCore/VectoCoreTest/Utils/MockDeclarationVehicleInputData.cs
@@ -67,6 +67,7 @@ namespace TUGraz.VectoCore.Tests.Utils {
 		public TableData BoostingLimitations { get; }
 		public IVehicleComponentsDeclaration Components => this;
 		public XmlNode XMLSource { get; }
+		public string VehicleTypeApprovalNumber { get; }
 
 		#endregion
 
@@ -137,6 +138,7 @@ namespace TUGraz.VectoCore.Tests.Utils {
 		IVehicleComponentsDeclaration IVehicleDeclarationInputData.Components => _components;
 
 		public XmlNode XMLSource { get; }
+		public string VehicleTypeApprovalNumber { get; }
 
 		public IVehicleComponentsEngineering Components => this;
 		public string Identifier { get; }
diff --git a/VectoCore/VectoCoreTest/XML/XMLDeclarationInputv210.cs b/VectoCore/VectoCoreTest/XML/XMLDeclarationInputv210.cs
index 2d976d80de..92adcc2dea 100644
--- a/VectoCore/VectoCoreTest/XML/XMLDeclarationInputv210.cs
+++ b/VectoCore/VectoCoreTest/XML/XMLDeclarationInputv210.cs
@@ -12,6 +12,7 @@ using TUGraz.VectoCommon.Models;
 using TUGraz.VectoCommon.Resources;
 using TUGraz.VectoCommon.Utils;
 using TUGraz.VectoCore.InputData.FileIO.XML;
+using TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Interfaces;
 using TUGraz.VectoCore.Models.Simulation;
 using TUGraz.VectoCore.Models.Simulation.Impl;
 using TUGraz.VectoCore.OutputData.FileIO;
@@ -146,6 +147,7 @@ namespace TUGraz.VectoCore.Tests.XML
 
 			var vehicle = dataProvider.JobInputData.Vehicle;
 			Assert.NotNull(vehicle);
+			TestAdditionalHeavyLorryVehicleEntries((IXMLDeclarationVehicleData)vehicle);
 			TestADASData(vehicle.ADAS);
 			Assert.IsNotNull(vehicle.Components);
 			Assert.IsNotNull(vehicle.Components.EngineInputData);
@@ -179,6 +181,15 @@ namespace TUGraz.VectoCore.Tests.XML
 			Assert.IsNull(vehicle.BoostingLimitations);//Vehicle Max Prop. Limits
 		}
 
+		private void TestAdditionalHeavyLorryVehicleEntries(IXMLDeclarationVehicleData vehicle)
+		{
+			Assert.AreEqual(LegislativeClass.N3, vehicle.LegislativeClass);
+			Assert.AreEqual(AngledriveType.None, vehicle.AngledriveType);
+			Assert.AreEqual("ASDF", vehicle.VehicleTypeApprovalNumber);
+			Assert.AreEqual(false, vehicle.VocationalVehicle);
+		}
+
+
 		private void TestADASData(IAdvancedDriverAssistantSystemDeclarationInputData adas)
 		{
 			Assert.IsNotNull(adas);
-- 
GitLab