From 887f07b816e122c5e5a924ad1d340a2bcddd97ac Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <quaritsch@ivt.tugraz.at>
Date: Wed, 8 Feb 2023 18:45:44 +0100
Subject: [PATCH] do not read engineering values in declaration mode

---
 VECTO/GUI/IEPCForm.vb              | 8 +++++++-
 VECTO/GUI/VehicleForm.vb           | 6 +++++-
 VECTO/Input Files/IEPCInputData.vb | 2 +-
 VECTO/Input Files/VectoJob.vb      | 5 +++--
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/VECTO/GUI/IEPCForm.vb b/VECTO/GUI/IEPCForm.vb
index 279d609a14..82162f4a15 100644
--- a/VECTO/GUI/IEPCForm.vb
+++ b/VECTO/GUI/IEPCForm.vb
@@ -42,9 +42,12 @@ Public Class IEPCForm
 		cbDifferentialIncluded.Checked = inputData.DifferentialIncluded
 		cbDesignTypeWheelMotor.Checked = inputData.DesignTypeWheelMotor
 		tbNumberOfDesignTypeWheelMotor.Text = inputData.NrOfDesignTypeWheelMotorMeasured.Value.ToGUIFormat()
-		tbThermalOverload.Text = inputData.OverloadRecoveryFactor.ToGUIFormat()
+		
 		tbRatedPower.Text = inputData.R85RatedPower.ConvertToKiloWatt().Value.ToGUIFormat()
 		cbEmType.SelectedValue = inputData.ElectricMachineType
+		if Not Cfg.DeclMode Then
+		    tbThermalOverload.Text = inputData.OverloadRecoveryFactor.ToGUIFormat()
+		End If
 
 		Dim voltageLevel = inputData.VoltageLevels.First()
 		SetFirstVoltageLevel(voltageLevel)
@@ -521,6 +524,9 @@ Public Class IEPCForm
 	End Function
 
 	Private Function ValidateOverloadRecoveryFactor() As Boolean
+		if cfg.DeclMode Then
+			return true
+		End If
 		If Not ValidDoubleValue(tbThermalOverload.Text) Then
 			ShowErrorMessageBox("Thermal Overload Recovery Factor", tbThermalOverload)
 			Return False
diff --git a/VECTO/GUI/VehicleForm.vb b/VECTO/GUI/VehicleForm.vb
index 8877015d40..69a254dea1 100644
--- a/VECTO/GUI/VehicleForm.vb
+++ b/VECTO/GUI/VehicleForm.vb
@@ -499,7 +499,11 @@ Public Class VehicleForm
 			For Each entry As IElectricStorageEngineeringInputData In vehicle.Components.ElectricStorage.ElectricStorageElements.OrderBy(Function(x) x.StringId)
 				lvREESSPacks.Items.Add(CreateREESSPackListViewItem(GetRelativePath(entry.REESSPack.DataSource.SourceFile, basePath), entry.Count, entry.StringId))
 			Next
-			tbInitialSoC.Text = (vehicle.InitialSOC * 100).ToGUIFormat()
+			if (cfg.DeclMode) Then 
+				tbInitialSoC.Text = string.Empty
+			Else 
+				tbInitialSoC.Text = (vehicle.InitialSOC * 100).ToGUIFormat()
+			End If
 
 			if (vehicle.VehicleType = VectoSimulationJobType.ParallelHybridVehicle OrElse vehicle.VehicleType = VectoSimulationJobType.BatteryElectricVehicle OrElse vehicle.VehicleType = VectoSimulationJobType.SerialHybridVehicle) then
 			Dim em As ElectricMachineEntry(Of IElectricMotorEngineeringInputData) = vehicle.Components.ElectricMachines.Entries.First(Function(x) x.Position <> PowertrainPosition.GEN)
diff --git a/VECTO/Input Files/IEPCInputData.vb b/VECTO/Input Files/IEPCInputData.vb
index 72e5b9e6ba..2d78c5e3b8 100644
--- a/VECTO/Input Files/IEPCInputData.vb	
+++ b/VECTO/Input Files/IEPCInputData.vb	
@@ -49,7 +49,7 @@ Public Class IEPCInputData
         _wheelMotorMeasured = designTypeWheelMotorMeasured
         _nrDesignTypeWheelMotor = nrOfDesignTypeWheelMotorMeasured.ToInt(Nothing)
         _differentialIncluded = differentialIncluded
-        _overloadRecoverFactor = thermalOverloadRecoverFactor.ToDouble()
+        _overloadRecoverFactor = thermalOverloadRecoverFactor.ToDouble(0)
 
     End Sub
     
diff --git a/VECTO/Input Files/VectoJob.vb b/VECTO/Input Files/VectoJob.vb
index c153748e96..4e76eaa564 100644
--- a/VECTO/Input Files/VectoJob.vb	
+++ b/VECTO/Input Files/VectoJob.vb	
@@ -551,10 +551,11 @@ Public Class VectoJob
                 If Not vehicleInputData.SavedInDeclarationMode Then
                     result.Add(New ValidationResult("Vehicle File is not in Declaration Mode"))
                 End If
-                If Not engineInputData.SavedInDeclarationMode Then
+                If  Not (vectoJob.JobType = VectoSimulationJobType.BatteryElectricVehicle OrElse vectoJob.JobType = VectoSimulationJobType.IEPC_E) AndAlso Not engineInputData.SavedInDeclarationMode Then
                     result.Add(New ValidationResult("Engine File is not in Declaration Mode"))
                 End If
-                If Not gearboxInputData.SavedInDeclarationMode Then
+                If Not vectoJob.JobType = VectoSimulationJobType.BatteryElectricVehicle _ 
+                   AndAlso gearboxInputData IsNot Nothing AndAlso Not gearboxInputData.SavedInDeclarationMode Then
                     result.Add(New ValidationResult("Gearbox File is not in Declaration Mode"))
                 End If
                 If result.Any() Then
-- 
GitLab