From 959a3fa251e66f343a66cb128cef31eacfc3cf83 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Wed, 27 Nov 2019 14:55:16 +0100
Subject: [PATCH] extend allowed adas combination to other gearbox types, write
 at ecoroll lockupclutch to json file

---
 .../Class_9_RigidTruck_AT_Decl_EcoRoll.vecto  | 61 +++++++++++++++++++
 VECTO/OutputData/JSONFileWriter.vb            |  4 +-
 .../DeclarationDataAdapter.cs                 |  9 +--
 .../Models/Declaration/ADASCombination.cs     | 28 ++++++++-
 .../Declaration/ADAS/ADAS_Combinations.csv    | 38 ++++++------
 5 files changed, 111 insertions(+), 29 deletions(-)
 create mode 100644 Generic Vehicles/Declaration Mode/Class9_RigidTruck_AT_6x2/Class_9_RigidTruck_AT_Decl_EcoRoll.vecto

diff --git a/Generic Vehicles/Declaration Mode/Class9_RigidTruck_AT_6x2/Class_9_RigidTruck_AT_Decl_EcoRoll.vecto b/Generic Vehicles/Declaration Mode/Class9_RigidTruck_AT_6x2/Class_9_RigidTruck_AT_Decl_EcoRoll.vecto
new file mode 100644
index 0000000000..7b6c7a4813
--- /dev/null
+++ b/Generic Vehicles/Declaration Mode/Class9_RigidTruck_AT_6x2/Class_9_RigidTruck_AT_Decl_EcoRoll.vecto	
@@ -0,0 +1,61 @@
+{
+  "Header": {
+    "CreatedBy": "",
+    "Date": "2017-07-03T12:21:05.6496880Z",
+    "AppVersion": "3",
+    "FileVersion": 3
+  },
+  "Body": {
+    "SavedInDeclMode": true,
+    "EngineOnlyMode": false,
+    "VehicleFile": "RigidTruck_6x2.vveh",
+    "EngineFile": "Engine_220kW.veng",
+    "GearboxFile": "APT-S Generic TqMax1200.vgbx",
+    "AuxiliaryAssembly": "Classic",
+    "AuxiliaryVersion": "CLASSIC",
+    "AdvancedAuxiliaryFilePath": "",
+    "Aux": [
+      {
+        "ID": "FAN",
+        "Type": "Fan",
+        "Technology": [
+          "Belt driven or driven via transm. - Electronically controlled visco clutch"
+        ]
+      },
+      {
+        "ID": "STP",
+        "Type": "Steering pump",
+        "Technology": [
+          "Fixed displacement"
+        ]
+      },
+      {
+        "ID": "AC",
+        "Type": "HVAC",
+        "Technology": [
+          "Default"
+        ]
+      },
+      {
+        "ID": "ES",
+        "Type": "Electric System",
+        "Technology": [
+          "Standard technology"
+        ]
+      },
+      {
+        "ID": "PS",
+        "Type": "Pneumatic System",
+        "Technology": [
+          "Medium Supply 2-stage + ESS + AMS"
+        ]
+      }
+    ],
+    "OverSpeedEcoRoll": {
+      "Mode": "Overspeed",
+      "MinSpeed": 50.0,
+      "OverSpeed": 5.0,
+      "UnderSpeed": 5.0
+    }
+  }
+}
\ No newline at end of file
diff --git a/VECTO/OutputData/JSONFileWriter.vb b/VECTO/OutputData/JSONFileWriter.vb
index 175d8201d0..997e91bc07 100644
--- a/VECTO/OutputData/JSONFileWriter.vb
+++ b/VECTO/OutputData/JSONFileWriter.vb
@@ -275,7 +275,9 @@ Public Class JSONFileWriter
         body("EngineStopStart") = vehicle.ADAS.EngineStopStart
         body("EcoRoll") = vehicle.ADAS.EcoRoll.ToString()
         body("PredictiveCruiseControl") = vehicle.ADAS.PredictiveCruiseControl.ToString()
-
+        if ( vehicle.ADAS.ATEcoRollReleaseLockupClutch.HasValue) then
+            body("ATEcoRollReleaseLockupClutch") = vehicle.ADAS.ATEcoRollReleaseLockupClutch
+        End If 
         If (Not IsNothing(airdrag.AirDragArea)) Then
             body("CdA") = airdrag.AirDragArea.Value()
         End If
diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs
index 9a7a61def0..80289b86cc 100644
--- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs
+++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs
@@ -130,14 +130,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
 
 			retVal.VocationalVehicle = data.VocationalVehicle;
 			retVal.ADAS = CreateADAS(data.ADAS);
-			// eco-roll is not allowed for MT transmissions!
-			if (retVal.ADAS.EcoRoll != EcoRollType.None && data.Components.GearboxInputData.Type == GearboxType.MT) {
-				retVal.ADAS.EcoRoll = EcoRollType.None;
-			}
-			if (retVal.ADAS.EcoRoll == EcoRollType.WithEngineStop && data.Components.GearboxInputData.Type.AutomaticTransmission()) {
-				retVal.ADAS.EcoRoll = EcoRollType.WithoutEngineStop;
-			}
-
+			
 			var axles = data.Components.AxleWheels.AxlesDeclaration;
 			if (axles.Count < mission.AxleWeightDistribution.Length) {
 				throw new VectoException(
diff --git a/VectoCore/VectoCore/Models/Declaration/ADASCombination.cs b/VectoCore/VectoCore/Models/Declaration/ADASCombination.cs
index 1aa34dd207..9080d8ebe1 100644
--- a/VectoCore/VectoCore/Models/Declaration/ADASCombination.cs
+++ b/VectoCore/VectoCore/Models/Declaration/ADASCombination.cs
@@ -46,6 +46,8 @@ namespace TUGraz.VectoCore.Models.Declaration
 	{
 		public string ID;
 		public bool AllowedForAT;
+		public bool AllowedForAMT;
+		public bool AllowedForMT;
 	}
 	public sealed class ADASCombinations : LookupData<bool, EcoRollType, PredictiveCruiseControlType, ADASCombination>
 	{
@@ -59,7 +61,12 @@ namespace TUGraz.VectoCore.Models.Declaration
 				var entry = _combinations.First(
 					x => x.EngineStopStart == enginestopstart && x.EcoRoll == ecoRoll &&
 						x.PCCType == pcc);
-				return new ADASCombination { ID = entry.ADASCombination, AllowedForAT = entry.AllowedForAT };
+				return new ADASCombination {
+					ID = entry.ADASCombination,
+					AllowedForAT = entry.AllowedForAT,
+					AllowedForMT = entry.AllowedForMT,
+					AllowedForAMT = entry.AllowedForAMT
+				};
 			} catch (Exception) {
 				throw new VectoException(string.Format(ErrorMessage, enginestopstart, ecoRoll, pcc));
 			}
@@ -87,6 +94,8 @@ namespace TUGraz.VectoCore.Models.Declaration
 					PCCType = PredictiveCruiseControlTypeHelper.Parse(row.Field<string>("predictivecruisecontrol")),
 					ADASCombination = row.Field<string>("adascombination"),
 					AllowedForAT = row.ParseBoolean("allowedat"),
+					AllowedForAMT = row.ParseBoolean("allowedamt"),
+					AllowedForMT = row.ParseBoolean("allowedmt")
 				});
 			}
 		}
@@ -99,7 +108,9 @@ namespace TUGraz.VectoCore.Models.Declaration
 			public EcoRollType EcoRoll;
 			public PredictiveCruiseControlType PCCType;
 			public string ADASCombination;
+			public bool AllowedForAMT;
 			public bool AllowedForAT;
+			public bool AllowedForMT;
 		}
 
 		public ADASCombination Lookup(IAdvancedDriverAssistantSystemDeclarationInputData adas, GearboxType gbxType)
@@ -110,6 +121,14 @@ namespace TUGraz.VectoCore.Models.Declaration
 				throw new VectoException("ADAS combination {0} not allowed for AT transmissions", entry.ID);
 			}
 
+			if (gbxType.ManualTransmission() && !entry.AllowedForMT) {
+				throw new VectoException("ADAS combination {0} not allowed for MT transmissions", entry.ID);
+			}
+
+			if (gbxType == GearboxType.AMT && !entry.AllowedForAMT) {
+				throw new VectoException("ADAS combination {0} not allowed for AMT transmissions", entry.ID);
+			}
+
 			return entry;
 		}
 
@@ -121,6 +140,13 @@ namespace TUGraz.VectoCore.Models.Declaration
 				throw new VectoException("ADAS combination {0} not allowed for AT transmissions", entry.ID);
 			}
 
+			if (gbxType.ManualTransmission() && !entry.AllowedForMT) {
+				throw new VectoException("ADAS combination {0} not allowed for MT transmissions", entry.ID);
+			}
+
+			if (gbxType == GearboxType.AMT && !entry.AllowedForAMT) {
+				throw new VectoException("ADAS combination {0} not allowed for AMT transmissions", entry.ID);
+			}
 			return entry;
 		}
 	}
diff --git a/VectoCore/VectoCore/Resources/Declaration/ADAS/ADAS_Combinations.csv b/VectoCore/VectoCore/Resources/Declaration/ADAS/ADAS_Combinations.csv
index 67f1e73608..42a6258851 100644
--- a/VectoCore/VectoCore/Resources/Declaration/ADAS/ADAS_Combinations.csv
+++ b/VectoCore/VectoCore/Resources/Declaration/ADAS/ADAS_Combinations.csv
@@ -1,19 +1,19 @@
-ADAS Combination , Engine Stop Start , EcoRoll without Engine Stop , EcoRoll with Engine Stop , Predictive Cruise Control , Allowed AT
-0                , 0                 , 0                           , 0                        , none                      , 1
-1                , 1                 , 0                           , 0                        , none                      , 1
-2                , 0                 , 1                           , 0                        , none                      , 1
-3                , 0                 , 0                           , 1                        , none                      , 0
-4/1              , 0                 , 0                           , 0                        , "1_2"                     , 1
-4/2              , 0                 , 0                           , 0                        , "1_2_3"                   , 1
-5                , 1                 , 1                           , 0                        , none                      , 1
-6                , 1                 , 0                           , 1                        , none                      , 0
-7/1              , 1                 , 0                           , 0                        , "1_2"                     , 1
-7/2              , 1                 , 0                           , 0                        , "1_2_3"                   , 1
-8/1              , 0                 , 1                           , 0                        , "1_2"                     , 1
-8/2              , 0                 , 1                           , 0                        , "1_2_3"                   , 1
-9/1              , 0                 , 0                           , 1                        , "1_2"                     , 0
-9/2              , 0                 , 0                           , 1                        , "1_2_3"                   , 0
-10/1             , 1                 , 1                           , 0                        , "1_2"                     , 1
-10/2             , 1                 , 1                           , 0                        , "1_2_3"                   , 1
-11/1             , 1                 , 0                           , 1                        , "1_2"                     , 0
-11/2             , 1                 , 0                           , 1                        , "1_2_3"                   , 0
\ No newline at end of file
+ADAS Combination , Engine Stop Start , EcoRoll without Engine Stop , EcoRoll with Engine Stop , Predictive Cruise Control , Allowed AMT , Allowed AT , Allowed MT
+0                , 0                 , 0                           , 0                        , none                      , 1           , 1          , 1
+1                , 1                 , 0                           , 0                        , none                      , 1           , 1          , 1
+2                , 0                 , 1                           , 0                        , none                      , 1           , 1          , 0
+3                , 0                 , 0                           , 1                        , none                      , 1           , 0          , 0
+4/1              , 0                 , 0                           , 0                        , "1_2"                     , 1           , 1          , 1
+4/2              , 0                 , 0                           , 0                        , "1_2_3"                   , 1           , 1          , 1
+5                , 1                 , 1                           , 0                        , none                      , 1           , 1          , 0
+6                , 1                 , 0                           , 1                        , none                      , 1           , 0          , 0
+7/1              , 1                 , 0                           , 0                        , "1_2"                     , 1           , 1          , 1
+7/2              , 1                 , 0                           , 0                        , "1_2_3"                   , 1           , 1          , 1
+8/1              , 0                 , 1                           , 0                        , "1_2"                     , 1           , 1          , 0
+8/2              , 0                 , 1                           , 0                        , "1_2_3"                   , 1           , 1          , 0
+9/1              , 0                 , 0                           , 1                        , "1_2"                     , 1           , 0          , 0
+9/2              , 0                 , 0                           , 1                        , "1_2_3"                   , 1           , 0          , 0
+10/1             , 1                 , 1                           , 0                        , "1_2"                     , 1           , 1          , 0
+10/2             , 1                 , 1                           , 0                        , "1_2_3"                   , 1           , 1          , 0
+11/1             , 1                 , 0                           , 1                        , "1_2"                     , 1           , 0          , 0
+11/2             , 1                 , 0                           , 1                        , "1_2_3"                   , 1           , 0          , 0
\ No newline at end of file
-- 
GitLab