From ce0340750c8836c4e3c8d9ebc94e588924f1bc2c Mon Sep 17 00:00:00 2001
From: Michael Krisper <michael.krisper@tugraz.at>
Date: Fri, 29 Apr 2022 12:27:19 +0200
Subject: [PATCH] VehicleForm: Enable/Disable field ATEcoRollLockupClutch and
 Cleaned up UpdateForm

(cherry picked from commit 5fb416dd3ada183eb0c87fa80e8742bbe6919c17)
---
 VECTO/GUI/VehicleForm.vb | 122 ++++++++++++++++++++++++++++-----------
 1 file changed, 88 insertions(+), 34 deletions(-)

diff --git a/VECTO/GUI/VehicleForm.vb b/VECTO/GUI/VehicleForm.vb
index 6711527776..907f62a905 100644
--- a/VECTO/GUI/VehicleForm.vb
+++ b/VECTO/GUI/VehicleForm.vb
@@ -521,69 +521,122 @@ Public Class VehicleForm
 	Private Sub UpdateForm(vehType As VectoSimulationJobType)
 		VehicleType = vehType
 
-		gbVehicleIdlingSpeed.Enabled = True
-		gbTankSystem.Enabled = True
-		gbAngledrive.Enabled = True
-		tcVehicleComponents.TabPages.Remove(tpGensetComponents)
-		tcVehicleComponents.TabPages.Remove(tpElectricComponents)
+		If Not tcVehicleComponents.TabPages.Contains(tpElectricComponents) Then
+			tcVehicleComponents.TabPages.Insert(2, tpElectricComponents)
+			tpElectricComponents.BindingContext = BindingContext
+		End If
+		If Not tcVehicleComponents.TabPages.Contains(tpGensetComponents) Then
+			tcVehicleComponents.TabPages.Insert(3, tpGensetComponents)
+			tpGensetComponents.BindingContext = BindingContext
+		End If
+		If Not tcVehicleComponents.TabPages.Contains(tpTorqueLimits) Then
+			tcVehicleComponents.TabPages.Insert(4, tpTorqueLimits)
+			tpTorqueLimits.BindingContext = BindingContext
+		End If
+
 
 		Select Case vehType
 			Case VectoSimulationJobType.ConventionalVehicle
 				lblTitle.Text = "Conventional Vehicle"
+
+				'Powertrain ---------------------------------------------------------------
+				gbVehicleIdlingSpeed.Enabled = True
+				gbTankSystem.Enabled = True
 				gbRetarderLosses.Enabled = True
-				cbEmPos.DataSource = EnumHelper.GetKeyValuePairs(Of PowertrainPosition) _
-					(Function(t) t.GetLabel(), Function(t) t = PowertrainPosition.HybridPositionNotSet)
+				gbAngledrive.Enabled = True
+
+				'Electric Powertrain Components -------------------------------------------
+				tcVehicleComponents.TabPages.Remove(tpElectricComponents)
+
+				'GenSet Components --------------------------------------------------------
+				tcVehicleComponents.TabPages.Remove(tpGensetComponents)
+
+				'Torque Limits ------------------------------------------------------------
+				gbEMTorqueLimits.Enabled = False
+
+				'ADAS ---------------------------------------------------------------------
 				cbEngineStopStart.Enabled = True
+				cbAtEcoRollReleaseLockupClutch.Enabled = True
 				cbEcoRoll.DataSource = EnumHelper.GetKeyValuePairs(Of EcoRollType)(Function(t) t.GetName())
 				cbEcoRoll.Enabled = True
-				gbEMTorqueLimits.Enabled = False
+
 			Case VectoSimulationJobType.ParallelHybridVehicle
-				gbRetarderLosses.Enabled = True
 				lblTitle.Text = "Parallel Hybrid Vehicle"
+
+				'Powertrain ---------------------------------------------------------------
+				gbVehicleIdlingSpeed.Enabled = True
+				gbTankSystem.Enabled = True
+				gbRetarderLosses.Enabled = True
+				gbAngledrive.Enabled = True
+
+				'Electric Powertrain Components -------------------------------------------
 				cbEmPos.DataSource = EnumHelper.GetKeyValuePairs(Of PowertrainPosition) _
 					(Function(t) t.GetLabel(), Function(x) x.IsParallelHybrid())
+
+				'GenSet Components --------------------------------------------------------
+				tcVehicleComponents.TabPages.Remove(tpGensetComponents)
+
+				'Torque Limits ------------------------------------------------------------
 				gbEMTorqueLimits.Enabled = True
+
+				'ADAS ---------------------------------------------------------------------
+				cbEngineStopStart.Enabled = True
+				cbAtEcoRollReleaseLockupClutch.Enabled = False
+				cbEcoRoll.DataSource = EnumHelper.GetKeyValuePairs(Of EcoRollType)(Function(t) t.GetName())
 				cbEcoRoll.Enabled = True
-				If Not tcVehicleComponents.TabPages.Contains(tpElectricComponents) Then
-					tcVehicleComponents.TabPages.Insert(2, tpElectricComponents)
-					tpElectricComponents.BindingContext = BindingContext
-				End If
+
 			Case VectoSimulationJobType.SerialHybridVehicle
-				gbRetarderLosses.Enabled = False
 				lblTitle.Text = "Serial Hybrid Vehicle"
+
+				'Powertrain ---------------------------------------------------------------
+				gbVehicleIdlingSpeed.Enabled = True
+				gbTankSystem.Enabled = True
+				gbRetarderLosses.Enabled = False
+				gbAngledrive.Enabled = True
+
+				'Electric Powertrain Components -------------------------------------------
 				cbEmPos.DataSource = EnumHelper.GetKeyValuePairs(Of PowertrainPosition) _
 					(Function(t) t.GetLabel(), Function(x) x.IsSerialHybrid())
+
+				'GenSet Components --------------------------------------------------------
+				'-
+
+				'Torque Limits ------------------------------------------------------------
+				gbEMTorqueLimits.Enabled = False
 				tpTorqueLimits.Enabled = False
-				cbEngineStopStart.Checked = False
+
+				'ADAS ---------------------------------------------------------------------
 				cbEngineStopStart.Enabled = False
-				cbEcoRoll.DataSource = {New With {.Key = EcoRollType.None, .Value = EcoRollType.None.GetName()}}
+				cbAtEcoRollReleaseLockupClutch.Enabled = False
 				cbEcoRoll.Enabled = False
-				gbEMTorqueLimits.Enabled = False
-				If Not tcVehicleComponents.TabPages.Contains(tpElectricComponents) Then
-					tcVehicleComponents.TabPages.Insert(2, tpElectricComponents)
-					tpElectricComponents.BindingContext = BindingContext
-				End If
-				If Not tcVehicleComponents.TabPages.Contains(tpGensetComponents) Then
-					tcVehicleComponents.TabPages.Insert(3, tpGensetComponents)
-				End If
+				cbEcoRoll.SelectedIndex = -1
+
 			Case VectoSimulationJobType.BatteryElectricVehicle
-				gbRetarderLosses.Enabled = False
 				lblTitle.Text = "Battery Electric Vehicle"
+
+				'Powertrain ---------------------------------------------------------------
 				gbVehicleIdlingSpeed.Enabled = False
 				gbTankSystem.Enabled = False
+				gbRetarderLosses.Enabled = False
 				gbAngledrive.Enabled = False
-				tpTorqueLimits.Enabled = False
+
+				'Electric Powertrain Components -------------------------------------------
 				cbEmPos.DataSource = EnumHelper.GetKeyValuePairs(Of PowertrainPosition) _
 					(Function(t) t.GetLabel(), Function(x) x.IsBatteryElectric())
-				cbEngineStopStart.Checked = False
+
+				'GenSet Components --------------------------------------------------------
+				tcVehicleComponents.TabPages.Remove(tpGensetComponents)
+
+				'Torque Limits ------------------------------------------------------------
+				gbEMTorqueLimits.Enabled = False
+				tcVehicleComponents.TabPages.Remove(tpTorqueLimits)
+
+				'ADAS ---------------------------------------------------------------------
 				cbEngineStopStart.Enabled = False
-				cbEcoRoll.DataSource = {New With {.Key = EcoRollType.None, .Value = EcoRollType.None.GetName()}}
+				cbAtEcoRollReleaseLockupClutch.Enabled = False
 				cbEcoRoll.Enabled = False
-				gbEMTorqueLimits.Enabled = False
-				If Not tcVehicleComponents.TabPages.Contains(tpElectricComponents) Then
-					tcVehicleComponents.TabPages.Insert(2, tpElectricComponents)
-					tpElectricComponents.BindingContext = BindingContext
-				End If
+				cbEcoRoll.SelectedIndex = -1
+
 			Case Else
 				If Not tcVehicleComponents.TabPages.Contains(tpElectricComponents) Then
 					tcVehicleComponents.TabPages.Insert(2, tpElectricComponents)
@@ -595,6 +648,7 @@ Public Class VehicleForm
 				End If
 
 		End Select
+
 	End Sub
 
 	Private Function CreateListViewItem(axleNumber As Integer, share As Double, twinTire As Boolean, rrc As Double,
@@ -1247,7 +1301,7 @@ Public Class VehicleForm
 			gbRetarderLosses.Enabled = False
 			TbRtRatio.Text = ""
 			TbRtPath.Text = ""
-			CbRtType.SelectedIndex = 0
+			CbRtType.SelectedIndex = -1
 			CType(CbRtType.DataSource, DataView).RowFilter = $"Key <> {CInt(RetarderType.AxlegearInputRetarder)}"
 		ElseIf PowertrainPosition.BatteryElectricE3.Equals(cbEmPos.SelectedValue) Then
 			gbRetarderLosses.Enabled = True
-- 
GitLab