From 9da32308d4a6f727f4bf40e16c03320b40f7e700 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Wed, 20 Feb 2019 10:26:42 +0100
Subject: [PATCH] adding testcase for traction interruption

---
 .../VectoCoreTest/Reports/ModDataTest.cs      |  72 +++
 .../Tractor_4x2_vehicle-class-5_5_t_0.xml     | 581 ++++++++++++++++++
 VectoCore/VectoCoreTest/VectoCoreTest.csproj  |   3 +
 3 files changed, 656 insertions(+)
 create mode 100644 VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/Tractor_4x2_vehicle-class-5_5_t_0.xml

diff --git a/VectoCore/VectoCoreTest/Reports/ModDataTest.cs b/VectoCore/VectoCoreTest/Reports/ModDataTest.cs
index acfda6e388..55d6c357ac 100644
--- a/VectoCore/VectoCoreTest/Reports/ModDataTest.cs
+++ b/VectoCore/VectoCoreTest/Reports/ModDataTest.cs
@@ -48,7 +48,9 @@ using TUGraz.VectoCore.OutputData.FileIO;
 using TUGraz.VectoCore.Tests.Integration;
 using TUGraz.VectoCore.Tests.Utils;
 using System.IO;
+using TUGraz.VectoCore.InputData.FileIO.XML.Declaration;
 using TUGraz.VectoCore.Models.Declaration;
+using TUGraz.VectoCore.Tests.Models.Simulation;
 
 namespace TUGraz.VectoCore.Tests.Reports
 {
@@ -145,6 +147,76 @@ namespace TUGraz.VectoCore.Tests.Reports
 			RunSimulation(jobName, ExecutionMode.Engineering);	
 		}
 
+		[TestCase(@"TestData\XML\XMLReaderDeclaration\Tractor_4x2_vehicle-class-5_5_t_0.xml", 1, 1.0),
+		]
+		public void TractionInterruptionTest(string filename, int idx, double expectedTractionInterruption)
+		{
+			var writer = new FileOutputWriter(filename);
+			var inputData = new XMLDeclarationInputDataProvider(filename, true); 
+			var factory = new SimulatorFactory(ExecutionMode.Declaration, inputData, writer) {
+				WriteModalResults = true,
+			};
+			var jobContainer = new JobContainer(new MockSumWriter());
+
+			jobContainer.AddRuns(factory);
+
+			var run = jobContainer.Runs[idx];
+			var modData = ((ModalDataContainer)run.Run.GetContainer().ModalData).Data;
+
+			run.Run.Run();
+
+			//Assert.IsTrue(run.Done);
+			//Assert.IsTrue(run.Success);
+			Assert.IsTrue(modData.Rows.Count > 0);
+
+			var tractionInterruptionTimes = ExtractTractionInterruptionTimes(modData);
+
+			var min = tractionInterruptionTimes.Values.Min();
+			var max = tractionInterruptionTimes.Values.Max();
+
+			Console.WriteLine("number of traction interruption intervals: {0}", tractionInterruptionTimes.Count);
+			var exceeding = tractionInterruptionTimes.Where(x => x.Value.IsGreater(expectedTractionInterruption, 0.1)).ToList();
+			Console.WriteLine("number of traction interruption times exceeding specified interval: {0}", exceeding.Count());
+			if (exceeding.Count > 0) {
+				foreach (var e in exceeding) {
+					Console.WriteLine("{0} : {1}", e.Key, e.Value);
+				}
+			}
+
+			Assert.IsTrue(min.IsEqual(expectedTractionInterruption, 0.05), "minimum traction interruption time: {0}", min);
+			Assert.IsTrue(max.IsEqual(expectedTractionInterruption, 0.1), "maximum traction interruption time: {0}", max);
+
+			
+		}
+
+		private Dictionary<Second, Second> ExtractTractionInterruptionTimes(ModalResults modData)
+		{
+			var retVal = new Dictionary<Second, Second>();
+
+			Second tracStart = null;
+			foreach (DataRow row in modData.Rows) {
+				var velocity = (MeterPerSecond)row[(int)ModalResultField.v_act];
+				if (velocity.IsEqual(0)) {
+					tracStart = null;
+					continue;
+				}
+
+				var gear = (uint)row[(int)ModalResultField.Gear];
+				var absTime = (Second)row[(int)ModalResultField.time];
+				var dt = (Second)row[(int)ModalResultField.simulationInterval];
+				if (gear == 0 && tracStart == null) {
+					tracStart = absTime - dt / 2.0;
+				}
+				if (gear != 0 && tracStart != null) {
+					var tracEnd = absTime - dt / 2.0;
+					retVal[absTime] =(tracEnd - tracStart);
+					tracStart = null;
+				}
+			}
+
+			return retVal;
+		}
+
 
 		[Category("LongRunning")]
 		[TestCase(@"TestData\Integration\VTPMode\GenericVehicle\class_5_generic vehicle.vecto")]
diff --git a/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/Tractor_4x2_vehicle-class-5_5_t_0.xml b/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/Tractor_4x2_vehicle-class-5_5_t_0.xml
new file mode 100644
index 0000000000..ce04b52502
--- /dev/null
+++ b/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/Tractor_4x2_vehicle-class-5_5_t_0.xml
@@ -0,0 +1,581 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tns:VectoInputDeclaration schemaVersion="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v1.0" xmlns:tns="urn:tugraz:ivt:VectoAPI:DeclarationInput:v1.0" xsi:schemaLocation="urn:tugraz:ivt:VectoAPI:DeclarationInput:v1.0 https://webgate.ec.europa.eu/CITnet/svn/VECTO/trunk/Share/XML/XSD/VectoInput.xsd">
+  <Vehicle id="VEH-class5_Class-5_5t0">
+    <Manufacturer>Generic Vendor</Manufacturer>
+    <ManufacturerAddress>N.A.</ManufacturerAddress>
+    <Model>class 5_Class-5_5t0</Model>
+    <VIN>standard values</VIN>
+    <Date>2017-09-26T15:33:45.0798047Z</Date>
+    <LegislativeClass>N3</LegislativeClass>
+    <VehicleCategory>Tractor</VehicleCategory>
+    <AxleConfiguration>4x2</AxleConfiguration>
+    <CurbMassChassis>8229</CurbMassChassis>
+    <GrossVehicleMass>40000</GrossVehicleMass>
+    <IdlingSpeed>100</IdlingSpeed>
+    <RetarderType>Transmission Output Retarder</RetarderType>
+    <RetarderRatio>1.000</RetarderRatio>
+    <AngledriveType>None</AngledriveType>
+    <PTO>
+      <PTOShaftsGearWheels>none</PTOShaftsGearWheels>
+      <PTOOtherElements>none</PTOOtherElements>
+    </PTO>
+    <Components>
+      <Engine>
+        <Data id="ENG-350kW_IVT_12l">
+          <Manufacturer>Generic Vendor</Manufacturer>
+          <Model>350kW_IVT_12l</Model>
+          <CertificationNumber>ENG-350kW_IVT_12l</CertificationNumber>
+          <Date>2017-09-26T15:33:45.0954248Z</Date>
+          <AppVersion>VectoCore</AppVersion>
+          <Displacement>12700</Displacement>
+          <IdlingSpeed>600</IdlingSpeed>
+          <RatedSpeed>1736</RatedSpeed>
+          <RatedPower>325032</RatedPower>
+          <MaxEngineTorque>2134</MaxEngineTorque>
+          <WHTCUrban>1.0400</WHTCUrban>
+          <WHTCRural>1.0100</WHTCRural>
+          <WHTCMotorway>1.0000</WHTCMotorway>
+          <BFColdHot>1.0000</BFColdHot>
+          <CFRegPer>1.0000</CFRegPer>
+          <CFNCV>1.0000</CFNCV>
+          <FuelType>Diesel CI</FuelType>
+          <FuelConsumptionMap>
+            <Entry engineSpeed="600.00" torque="-150.00" fuelConsumption="0.00" />
+            <Entry engineSpeed="600.00" torque="0.00" fuelConsumption="1459.00" />
+            <Entry engineSpeed="600.00" torque="216.90" fuelConsumption="3538.75" />
+            <Entry engineSpeed="600.00" torque="433.80" fuelConsumption="5936.91" />
+            <Entry engineSpeed="600.00" torque="650.70" fuelConsumption="8584.95" />
+            <Entry engineSpeed="600.00" torque="867.60" fuelConsumption="10708.27" />
+            <Entry engineSpeed="600.00" torque="1084.50" fuelConsumption="13054.00" />
+            <Entry engineSpeed="600.00" torque="1301.40" fuelConsumption="15575.45" />
+            <Entry engineSpeed="600.00" torque="1518.30" fuelConsumption="18097.57" />
+            <Entry engineSpeed="600.00" torque="1735.20" fuelConsumption="20619.68" />
+            <Entry engineSpeed="600.00" torque="1952.10" fuelConsumption="23141.80" />
+            <Entry engineSpeed="600.00" torque="2169.00" fuelConsumption="25663.92" />
+            <Entry engineSpeed="748.90" torque="-153.25" fuelConsumption="0.00" />
+            <Entry engineSpeed="748.90" torque="0.00" fuelConsumption="1771.69" />
+            <Entry engineSpeed="748.90" torque="216.90" fuelConsumption="4287.77" />
+            <Entry engineSpeed="748.90" torque="433.80" fuelConsumption="7329.06" />
+            <Entry engineSpeed="748.90" torque="650.70" fuelConsumption="10252.92" />
+            <Entry engineSpeed="748.90" torque="867.60" fuelConsumption="13214.55" />
+            <Entry engineSpeed="748.90" torque="1084.50" fuelConsumption="16271.09" />
+            <Entry engineSpeed="748.90" torque="1301.40" fuelConsumption="19504.44" />
+            <Entry engineSpeed="748.90" torque="1518.30" fuelConsumption="22715.90" />
+            <Entry engineSpeed="748.90" torque="1735.20" fuelConsumption="26067.02" />
+            <Entry engineSpeed="748.90" torque="1952.10" fuelConsumption="29381.05" />
+            <Entry engineSpeed="748.90" torque="2169.00" fuelConsumption="32699.96" />
+            <Entry engineSpeed="897.80" torque="-159.33" fuelConsumption="0.00" />
+            <Entry engineSpeed="897.80" torque="0.00" fuelConsumption="2361.15" />
+            <Entry engineSpeed="897.80" torque="216.90" fuelConsumption="5371.49" />
+            <Entry engineSpeed="897.80" torque="433.80" fuelConsumption="8747.43" />
+            <Entry engineSpeed="897.80" torque="650.70" fuelConsumption="12019.87" />
+            <Entry engineSpeed="897.80" torque="867.60" fuelConsumption="15642.49" />
+            <Entry engineSpeed="897.80" torque="1084.50" fuelConsumption="19348.62" />
+            <Entry engineSpeed="897.80" torque="1301.40" fuelConsumption="23071.10" />
+            <Entry engineSpeed="897.80" torque="1518.30" fuelConsumption="26864.31" />
+            <Entry engineSpeed="897.80" torque="1735.20" fuelConsumption="30815.18" />
+            <Entry engineSpeed="897.80" torque="1952.10" fuelConsumption="34854.40" />
+            <Entry engineSpeed="897.80" torque="2169.00" fuelConsumption="39155.09" />
+            <Entry engineSpeed="1046.70" torque="-167.79" fuelConsumption="0.00" />
+            <Entry engineSpeed="1046.70" torque="0.00" fuelConsumption="2968.21" />
+            <Entry engineSpeed="1046.70" torque="216.90" fuelConsumption="6463.69" />
+            <Entry engineSpeed="1046.70" torque="433.80" fuelConsumption="10102.67" />
+            <Entry engineSpeed="1046.70" torque="650.70" fuelConsumption="13853.76" />
+            <Entry engineSpeed="1046.70" torque="867.60" fuelConsumption="18068.71" />
+            <Entry engineSpeed="1046.70" torque="1084.50" fuelConsumption="22383.70" />
+            <Entry engineSpeed="1046.70" torque="1301.40" fuelConsumption="26543.40" />
+            <Entry engineSpeed="1046.70" torque="1518.30" fuelConsumption="30847.65" />
+            <Entry engineSpeed="1046.70" torque="1735.20" fuelConsumption="35304.67" />
+            <Entry engineSpeed="1046.70" torque="1952.10" fuelConsumption="40046.29" />
+            <Entry engineSpeed="1046.70" torque="2169.00" fuelConsumption="45162.72" />
+            <Entry engineSpeed="1195.57" torque="-178.58" fuelConsumption="0.00" />
+            <Entry engineSpeed="1195.57" torque="0.00" fuelConsumption="3297.21" />
+            <Entry engineSpeed="1195.57" torque="216.90" fuelConsumption="7191.55" />
+            <Entry engineSpeed="1195.57" torque="433.80" fuelConsumption="11289.50" />
+            <Entry engineSpeed="1195.57" torque="650.70" fuelConsumption="15720.59" />
+            <Entry engineSpeed="1195.57" torque="867.60" fuelConsumption="20580.22" />
+            <Entry engineSpeed="1195.57" torque="1084.50" fuelConsumption="25484.81" />
+            <Entry engineSpeed="1195.57" torque="1301.40" fuelConsumption="30222.77" />
+            <Entry engineSpeed="1195.57" torque="1518.30" fuelConsumption="35006.22" />
+            <Entry engineSpeed="1195.57" torque="1735.20" fuelConsumption="40026.60" />
+            <Entry engineSpeed="1195.57" torque="1952.10" fuelConsumption="45496.89" />
+            <Entry engineSpeed="1195.57" torque="2169.00" fuelConsumption="50854.10" />
+            <Entry engineSpeed="1359.19" torque="-197.42" fuelConsumption="0.00" />
+            <Entry engineSpeed="1359.19" torque="0.00" fuelConsumption="4102.15" />
+            <Entry engineSpeed="1359.19" torque="216.90" fuelConsumption="8260.52" />
+            <Entry engineSpeed="1359.19" torque="433.80" fuelConsumption="13082.44" />
+            <Entry engineSpeed="1359.19" torque="650.70" fuelConsumption="18126.41" />
+            <Entry engineSpeed="1359.19" torque="867.60" fuelConsumption="23245.61" />
+            <Entry engineSpeed="1359.19" torque="1084.50" fuelConsumption="28611.71" />
+            <Entry engineSpeed="1359.19" torque="1301.40" fuelConsumption="34186.01" />
+            <Entry engineSpeed="1359.19" torque="1518.30" fuelConsumption="39773.96" />
+            <Entry engineSpeed="1359.19" torque="1735.20" fuelConsumption="45940.37" />
+            <Entry engineSpeed="1359.19" torque="1952.10" fuelConsumption="52485.97" />
+            <Entry engineSpeed="1359.19" torque="2169.00" fuelConsumption="58360.23" />
+            <Entry engineSpeed="1484.00" torque="-216.03" fuelConsumption="0.00" />
+            <Entry engineSpeed="1484.00" torque="0.00" fuelConsumption="4684.84" />
+            <Entry engineSpeed="1484.00" torque="216.90" fuelConsumption="9190.80" />
+            <Entry engineSpeed="1484.00" torque="433.80" fuelConsumption="14455.69" />
+            <Entry engineSpeed="1484.00" torque="650.70" fuelConsumption="19929.18" />
+            <Entry engineSpeed="1484.00" torque="867.60" fuelConsumption="25556.30" />
+            <Entry engineSpeed="1484.00" torque="1084.50" fuelConsumption="31326.33" />
+            <Entry engineSpeed="1484.00" torque="1301.40" fuelConsumption="37363.82" />
+            <Entry engineSpeed="1484.00" torque="1518.30" fuelConsumption="43571.91" />
+            <Entry engineSpeed="1484.00" torque="1735.20" fuelConsumption="50460.82" />
+            <Entry engineSpeed="1484.00" torque="1952.10" fuelConsumption="57604.52" />
+            <Entry engineSpeed="1484.00" torque="2169.00" fuelConsumption="64181.14" />
+            <Entry engineSpeed="1608.90" torque="-236.34" fuelConsumption="0.00" />
+            <Entry engineSpeed="1608.90" torque="0.00" fuelConsumption="5261.40" />
+            <Entry engineSpeed="1608.90" torque="216.90" fuelConsumption="10199.91" />
+            <Entry engineSpeed="1608.90" torque="433.80" fuelConsumption="15846.19" />
+            <Entry engineSpeed="1608.90" torque="650.70" fuelConsumption="21747.18" />
+            <Entry engineSpeed="1608.90" torque="867.60" fuelConsumption="28037.21" />
+            <Entry engineSpeed="1608.90" torque="1084.50" fuelConsumption="34232.36" />
+            <Entry engineSpeed="1608.90" torque="1301.40" fuelConsumption="40669.25" />
+            <Entry engineSpeed="1608.90" torque="1518.30" fuelConsumption="47498.48" />
+            <Entry engineSpeed="1608.90" torque="1735.20" fuelConsumption="55015.01" />
+            <Entry engineSpeed="1608.90" torque="1952.10" fuelConsumption="62654.92" />
+            <Entry engineSpeed="1608.90" torque="2169.00" fuelConsumption="70071.75" />
+            <Entry engineSpeed="1733.80" torque="-253.92" fuelConsumption="0.00" />
+            <Entry engineSpeed="1733.80" torque="0.00" fuelConsumption="6010.80" />
+            <Entry engineSpeed="1733.80" torque="216.90" fuelConsumption="11536.09" />
+            <Entry engineSpeed="1733.80" torque="433.80" fuelConsumption="17479.05" />
+            <Entry engineSpeed="1733.80" torque="650.70" fuelConsumption="23999.56" />
+            <Entry engineSpeed="1733.80" torque="867.60" fuelConsumption="30943.62" />
+            <Entry engineSpeed="1733.80" torque="1084.50" fuelConsumption="37482.51" />
+            <Entry engineSpeed="1733.80" torque="1301.40" fuelConsumption="44617.51" />
+            <Entry engineSpeed="1733.80" torque="1518.30" fuelConsumption="52071.25" />
+            <Entry engineSpeed="1733.80" torque="1735.20" fuelConsumption="60004.29" />
+            <Entry engineSpeed="1733.80" torque="1952.10" fuelConsumption="68251.45" />
+            <Entry engineSpeed="1733.80" torque="2169.00" fuelConsumption="76381.09" />
+            <Entry engineSpeed="1858.61" torque="-274.22" fuelConsumption="0.00" />
+            <Entry engineSpeed="1858.61" torque="0.00" fuelConsumption="7204.51" />
+            <Entry engineSpeed="1858.61" torque="216.90" fuelConsumption="13143.55" />
+            <Entry engineSpeed="1858.61" torque="433.80" fuelConsumption="19338.96" />
+            <Entry engineSpeed="1858.61" torque="650.70" fuelConsumption="26272.46" />
+            <Entry engineSpeed="1858.61" torque="867.60" fuelConsumption="33838.94" />
+            <Entry engineSpeed="1858.61" torque="1084.50" fuelConsumption="41281.10" />
+            <Entry engineSpeed="1858.61" torque="1301.40" fuelConsumption="49065.71" />
+            <Entry engineSpeed="1858.61" torque="1518.30" fuelConsumption="57066.15" />
+            <Entry engineSpeed="1858.61" torque="1735.20" fuelConsumption="65324.35" />
+            <Entry engineSpeed="1858.61" torque="1952.10" fuelConsumption="73876.10" />
+            <Entry engineSpeed="1858.61" torque="2169.00" fuelConsumption="82384.30" />
+          </FuelConsumptionMap>
+          <FullLoadAndDragCurve>
+            <Entry engineSpeed="600.00" maxTorque="1188.00" dragTorque="-138.00" />
+            <Entry engineSpeed="800.00" maxTorque="1661.00" dragTorque="-143.00" />
+            <Entry engineSpeed="1000.00" maxTorque="2134.00" dragTorque="-152.00" />
+            <Entry engineSpeed="1200.00" maxTorque="2134.00" dragTorque="-165.00" />
+            <Entry engineSpeed="1400.00" maxTorque="2134.00" dragTorque="-187.00" />
+            <Entry engineSpeed="1600.00" maxTorque="1928.00" dragTorque="-217.00" />
+            <Entry engineSpeed="1800.00" maxTorque="1722.00" dragTorque="-244.00" />
+            <Entry engineSpeed="2000.00" maxTorque="1253.00" dragTorque="-278.00" />
+            <Entry engineSpeed="2100.00" maxTorque="1019.00" dragTorque="-296.00" />
+            <Entry engineSpeed="2200.00" maxTorque="0.00" dragTorque="-314.00" />
+          </FullLoadAndDragCurve>
+        </Data>
+        <Signature>
+          <Reference URI="#ENG-350kW_IVT_12l" xmlns="http://www.w3.org/2000/09/xmldsig#">
+            <Transforms>
+              <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithoutComments" />
+              <Transform Algorithm="urn:vecto:xml:2017:canonicalization" />
+            </Transforms>
+            <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
+            <DigestValue></DigestValue>
+          </Reference>
+        </Signature>
+      </Engine>
+      <Gearbox>
+        <Data id="GBX-GB_12-gear">
+          <Manufacturer>Generic Vendor</Manufacturer>
+          <Model>GB_12-gear</Model>
+          <CertificationNumber>GBX-GB_12-gear</CertificationNumber>
+          <Date>2017-09-26T15:33:45.0954248Z</Date>
+          <AppVersion>VectoCore</AppVersion>
+          <TransmissionType>AMT</TransmissionType>
+          <MainCertificationMethod>Standard values</MainCertificationMethod>
+          <Gears>
+            <Gear number="1">
+              <Ratio>14.930</Ratio>
+              <TorqueLossMap>
+                <Entry inputSpeed="0.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="0.00" inputTorque="-125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="0.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="0.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="50000.00" torqueLoss="2000.00" />
+              </TorqueLossMap>
+            </Gear>
+            <Gear number="2">
+              <Ratio>11.640</Ratio>
+              <TorqueLossMap>
+                <Entry inputSpeed="0.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="0.00" inputTorque="-125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="0.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="0.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="50000.00" torqueLoss="2000.00" />
+              </TorqueLossMap>
+            </Gear>
+            <Gear number="3">
+              <Ratio>9.020</Ratio>
+              <TorqueLossMap>
+                <Entry inputSpeed="0.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="0.00" inputTorque="-125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="0.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="0.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="50000.00" torqueLoss="2000.00" />
+              </TorqueLossMap>
+            </Gear>
+            <Gear number="4">
+              <Ratio>7.040</Ratio>
+              <TorqueLossMap>
+                <Entry inputSpeed="0.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="0.00" inputTorque="-125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="0.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="0.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="50000.00" torqueLoss="2000.00" />
+              </TorqueLossMap>
+            </Gear>
+            <Gear number="5">
+              <Ratio>5.640</Ratio>
+              <TorqueLossMap>
+                <Entry inputSpeed="0.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="0.00" inputTorque="-125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="0.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="0.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="50000.00" torqueLoss="2000.00" />
+              </TorqueLossMap>
+            </Gear>
+            <Gear number="6">
+              <Ratio>4.400</Ratio>
+              <TorqueLossMap>
+                <Entry inputSpeed="0.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="0.00" inputTorque="-125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="0.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="0.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="50000.00" torqueLoss="2000.00" />
+              </TorqueLossMap>
+            </Gear>
+            <Gear number="7">
+              <Ratio>3.390</Ratio>
+              <TorqueLossMap>
+                <Entry inputSpeed="0.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="0.00" inputTorque="-125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="0.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="0.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="50000.00" torqueLoss="2000.00" />
+              </TorqueLossMap>
+            </Gear>
+            <Gear number="8">
+              <Ratio>2.650</Ratio>
+              <TorqueLossMap>
+                <Entry inputSpeed="0.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="0.00" inputTorque="-125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="0.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="0.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="50000.00" torqueLoss="2000.00" />
+              </TorqueLossMap>
+            </Gear>
+            <Gear number="9">
+              <Ratio>2.050</Ratio>
+              <TorqueLossMap>
+                <Entry inputSpeed="0.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="0.00" inputTorque="-125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="0.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="0.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="50000.00" torqueLoss="2000.00" />
+              </TorqueLossMap>
+            </Gear>
+            <Gear number="10">
+              <Ratio>1.600</Ratio>
+              <TorqueLossMap>
+                <Entry inputSpeed="0.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="0.00" inputTorque="-125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="0.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="0.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="50000.00" torqueLoss="2000.00" />
+              </TorqueLossMap>
+            </Gear>
+            <Gear number="11">
+              <Ratio>1.280</Ratio>
+              <TorqueLossMap>
+                <Entry inputSpeed="0.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="0.00" inputTorque="-125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="0.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="125.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="0.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="780.00" torqueLoss="31.00" />
+                <Entry inputSpeed="5000.00" inputTorque="50000.00" torqueLoss="2000.00" />
+              </TorqueLossMap>
+            </Gear>
+            <Gear number="12">
+              <Ratio>1.000</Ratio>
+              <TorqueLossMap>
+                <Entry inputSpeed="0.00" inputTorque="-50000.00" torqueLoss="1000.00" />
+                <Entry inputSpeed="0.00" inputTorque="-250.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="0.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="250.00" torqueLoss="5.00" />
+                <Entry inputSpeed="0.00" inputTorque="50000.00" torqueLoss="1000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-50000.00" torqueLoss="1000.00" />
+                <Entry inputSpeed="5000.00" inputTorque="-845.00" torqueLoss="17.00" />
+                <Entry inputSpeed="5000.00" inputTorque="0.00" torqueLoss="17.00" />
+                <Entry inputSpeed="5000.00" inputTorque="845.00" torqueLoss="17.00" />
+                <Entry inputSpeed="5000.00" inputTorque="50000.00" torqueLoss="1000.00" />
+              </TorqueLossMap>
+            </Gear>
+          </Gears>
+        </Data>
+        <Signature>
+          <Reference URI="#GBX-GB_12-gear" xmlns="http://www.w3.org/2000/09/xmldsig#">
+            <Transforms>
+              <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithoutComments" />
+              <Transform Algorithm="urn:vecto:xml:2017:canonicalization" />
+            </Transforms>
+            <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
+            <DigestValue></DigestValue>
+          </Reference>
+        </Signature>
+      </Gearbox>
+      <Retarder>
+        <Data id="RET-RET-generic">
+          <Manufacturer>Generic Vendor</Manufacturer>
+          <Model>RET-generic</Model>
+          <CertificationNumber>standard values</CertificationNumber>
+          <Date>2017-09-26T15:33:45.0954248Z</Date>
+          <AppVersion>VectoCore</AppVersion>
+          <CertificationMethod>Standard values</CertificationMethod>
+          <RetarderLossMap>
+            <Entry retarderSpeed="0.00" torqueLoss="10.00" />
+            <Entry retarderSpeed="100.00" torqueLoss="10.00" />
+            <Entry retarderSpeed="200.00" torqueLoss="10.10" />
+            <Entry retarderSpeed="300.00" torqueLoss="10.20" />
+            <Entry retarderSpeed="400.00" torqueLoss="10.30" />
+            <Entry retarderSpeed="500.00" torqueLoss="10.50" />
+            <Entry retarderSpeed="600.00" torqueLoss="10.70" />
+            <Entry retarderSpeed="700.00" torqueLoss="11.00" />
+            <Entry retarderSpeed="800.00" torqueLoss="11.30" />
+            <Entry retarderSpeed="900.00" torqueLoss="11.60" />
+            <Entry retarderSpeed="1000.00" torqueLoss="12.00" />
+            <Entry retarderSpeed="1100.00" torqueLoss="12.40" />
+            <Entry retarderSpeed="1200.00" torqueLoss="12.90" />
+            <Entry retarderSpeed="1300.00" torqueLoss="13.40" />
+            <Entry retarderSpeed="1400.00" torqueLoss="13.90" />
+            <Entry retarderSpeed="1500.00" torqueLoss="14.50" />
+            <Entry retarderSpeed="1600.00" torqueLoss="15.10" />
+            <Entry retarderSpeed="1700.00" torqueLoss="15.80" />
+            <Entry retarderSpeed="1800.00" torqueLoss="16.50" />
+            <Entry retarderSpeed="1900.00" torqueLoss="17.20" />
+            <Entry retarderSpeed="2000.00" torqueLoss="18.00" />
+            <Entry retarderSpeed="2100.00" torqueLoss="18.80" />
+            <Entry retarderSpeed="2200.00" torqueLoss="19.70" />
+            <Entry retarderSpeed="2300.00" torqueLoss="20.60" />
+            <Entry retarderSpeed="2400.00" torqueLoss="21.50" />
+            <Entry retarderSpeed="2500.00" torqueLoss="22.50" />
+            <Entry retarderSpeed="2600.00" torqueLoss="23.50" />
+            <Entry retarderSpeed="2700.00" torqueLoss="24.60" />
+            <Entry retarderSpeed="2800.00" torqueLoss="25.70" />
+            <Entry retarderSpeed="2900.00" torqueLoss="26.80" />
+            <Entry retarderSpeed="3000.00" torqueLoss="28.00" />
+          </RetarderLossMap>
+        </Data>
+        <Signature>
+          <Reference URI="#RET-RET-generic" xmlns="http://www.w3.org/2000/09/xmldsig#">
+            <Transforms>
+              <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithoutComments" />
+              <Transform Algorithm="urn:vecto:xml:2017:canonicalization" />
+            </Transforms>
+            <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
+            <DigestValue></DigestValue>
+          </Reference>
+        </Signature>
+      </Retarder>
+      <Axlegear>
+        <Data id="AXLGEAR-2640">
+          <Manufacturer>Generic Vendor</Manufacturer>
+          <Model>N.A.</Model>
+          <CertificationNumber>AXLGEAR-2640</CertificationNumber>
+          <Date>2017-09-26T15:33:45.0954248Z</Date>
+          <AppVersion>VectoCore</AppVersion>
+          <LineType>Single portal axle</LineType>
+          <Ratio>2.640</Ratio>
+          <CertificationMethod>Standard values</CertificationMethod>
+          <TorqueLossMap>
+            <Entry inputSpeed="0.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+            <Entry inputSpeed="0.00" inputTorque="-200.00" torqueLoss="8.00" />
+            <Entry inputSpeed="0.00" inputTorque="0.00" torqueLoss="8.00" />
+            <Entry inputSpeed="0.00" inputTorque="200.00" torqueLoss="8.00" />
+            <Entry inputSpeed="0.00" inputTorque="50000.00" torqueLoss="2000.00" />
+            <Entry inputSpeed="5000.00" inputTorque="-50000.00" torqueLoss="2000.00" />
+            <Entry inputSpeed="5000.00" inputTorque="-1253.00" torqueLoss="50.00" />
+            <Entry inputSpeed="5000.00" inputTorque="0.00" torqueLoss="50.00" />
+            <Entry inputSpeed="5000.00" inputTorque="1253.00" torqueLoss="50.00" />
+            <Entry inputSpeed="5000.00" inputTorque="50000.00" torqueLoss="2000.00" />
+          </TorqueLossMap>
+        </Data>
+        <Signature>
+          <Reference URI="#AXLGEAR-2640" xmlns="http://www.w3.org/2000/09/xmldsig#">
+            <Transforms>
+              <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithoutComments" />
+              <Transform Algorithm="urn:vecto:xml:2017:canonicalization" />
+            </Transforms>
+            <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
+            <DigestValue></DigestValue>
+          </Reference>
+        </Signature>
+      </Axlegear>
+      <AxleWheels>
+        <Data>
+          <Axles>
+            <Axle axleNumber="1">
+              <AxleType>VehicleNonDriven</AxleType>
+              <TwinTyres>false</TwinTyres>
+              <Steered>true</Steered>
+              <Tyre>
+                <Data id="TYRE-315_70R225">
+                  <Manufacturer>Generic Vendor</Manufacturer>
+                  <Model>315/70 R22.5</Model>
+                  <CertificationNumber>TYRE-315/70 R22.5</CertificationNumber>
+                  <Date>2017-09-26T15:33:45.1110278Z</Date>
+                  <AppVersion>VectoCore</AppVersion>
+                  <Dimension>315/70 R22.5</Dimension>
+                  <RRCDeclared>0.0052</RRCDeclared>
+                  <FzISO>33350</FzISO>
+                </Data>
+                <Signature>
+                  <Reference URI="#TYRE-315_70R225" xmlns="http://www.w3.org/2000/09/xmldsig#">
+                    <Transforms>
+                      <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithoutComments" />
+                      <Transform Algorithm="urn:vecto:xml:2017:canonicalization" />
+                    </Transforms>
+                    <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
+                    <DigestValue></DigestValue>
+                  </Reference>
+                </Signature>
+              </Tyre>
+            </Axle>
+            <Axle axleNumber="2">
+              <AxleType>VehicleDriven</AxleType>
+              <TwinTyres>true</TwinTyres>
+              <Steered>false</Steered>
+              <Tyre>
+                <Data id="TYRE-315_70R225">
+                  <Manufacturer>Generic Vendor</Manufacturer>
+                  <Model>315/70 R22.5</Model>
+                  <CertificationNumber>TYRE-315/70 R22.5</CertificationNumber>
+                  <Date>2017-09-26T15:33:45.1110278Z</Date>
+                  <AppVersion>VectoCore</AppVersion>
+                  <Dimension>315/70 R22.5</Dimension>
+                  <RRCDeclared>0.0061</RRCDeclared>
+                  <FzISO>33350</FzISO>
+                </Data>
+                <Signature>
+                  <Reference URI="#TYRE-315_70R225" xmlns="http://www.w3.org/2000/09/xmldsig#">
+                    <Transforms>
+                      <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithoutComments" />
+                      <Transform Algorithm="urn:vecto:xml:2017:canonicalization" />
+                    </Transforms>
+                    <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
+                    <DigestValue></DigestValue>
+                  </Reference>
+                </Signature>
+              </Tyre>
+            </Axle>
+          </Axles>
+        </Data>
+      </AxleWheels>
+      <Auxiliaries>
+        <Data>
+          <Fan>
+            <Technology>Belt driven or driven via transm. - Electronically controlled visco clutch</Technology>
+          </Fan>
+          <SteeringPump>
+            <Technology>Fixed displacement with elec. control</Technology>
+          </SteeringPump>
+          <ElectricSystem>
+            <Technology>Standard technology</Technology>
+          </ElectricSystem>
+          <PneumaticSystem>
+            <Technology>Medium Supply 1-stage + ESS + AMS</Technology>
+          </PneumaticSystem>
+          <HVAC>
+            <Technology>Default</Technology>
+          </HVAC>
+        </Data>
+      </Auxiliaries>
+      <AirDrag>
+        <Data id="Airdrag-genericcabin">
+          <Manufacturer>Generic Vendor</Manufacturer>
+          <Model>N.A.</Model>
+          <CertificationNumber>generic cabin</CertificationNumber>
+          <Date>2017-09-26T15:33:45.1110278Z</Date>
+          <AppVersion>VectoCore</AppVersion>
+          <CdxA_0>5.57</CdxA_0>
+          <TransferredCdxA>5.57</TransferredCdxA>
+          <DeclaredCdxA>5.57</DeclaredCdxA>
+        </Data>
+        <Signature>
+          <Reference URI="#Airdrag-genericcabin" xmlns="http://www.w3.org/2000/09/xmldsig#">
+            <Transforms>
+              <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithoutComments" />
+              <Transform Algorithm="urn:vecto:xml:2017:canonicalization" />
+            </Transforms>
+            <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
+            <DigestValue></DigestValue>
+          </Reference>
+        </Signature>
+      </AirDrag>
+    </Components>
+  </Vehicle>
+</tns:VectoInputDeclaration>
\ No newline at end of file
diff --git a/VectoCore/VectoCoreTest/VectoCoreTest.csproj b/VectoCore/VectoCoreTest/VectoCoreTest.csproj
index 0a26d5437b..b4c63acebd 100644
--- a/VectoCore/VectoCoreTest/VectoCoreTest.csproj
+++ b/VectoCore/VectoCoreTest/VectoCoreTest.csproj
@@ -2820,6 +2820,9 @@
     <Content Include="TestData\Jobs\Tractor_4x2_vehicle-class-5_Generic vehicle.xml">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
+    <Content Include="TestData\XML\XMLReaderDeclaration\Tractor_4x2_vehicle-class-5_5_t_0.xml">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="TestData\XML\XMLReaderDeclaration\vecto_engine-input_sample.xml" />
     <Content Include="TestData\XML\XMLReaderDeclaration\vecto_engine-sample.xml" />
     <Content Include="TestData\XML\XMLReaderDeclaration\vecto_gearbox-sample.xml" />
-- 
GitLab