From fb36ac15ee8a4ac850c36b0b941d3e08d4eb1e1b Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Fri, 13 Nov 2020 09:22:34 +0100
Subject: [PATCH]  fix testcases after merge and re-running all testcases

---
 .../Simulation/Impl/PCCEcoRollEngineStopPreprocessor.cs      | 2 +-
 .../Models/SimulationComponent/Impl/AMTShiftStrategy.cs      | 1 +
 .../Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs   | 4 +++-
 .../Models/SimulationComponent/Strategies/HybridStrategy.cs  | 5 ++---
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PCCEcoRollEngineStopPreprocessor.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PCCEcoRollEngineStopPreprocessor.cs
index 45cf006c38..2c1894114e 100644
--- a/VectoCore/VectoCore/Models/Simulation/Impl/PCCEcoRollEngineStopPreprocessor.cs
+++ b/VectoCore/VectoCore/Models/Simulation/Impl/PCCEcoRollEngineStopPreprocessor.cs
@@ -102,7 +102,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
 						data.VehicleData.DynamicTyreRadius;
 			var possible = new List<GearshiftPosition>();
 			foreach (var gear in data.GearboxData.GearList) {
-				if (!gear.TorqueConverterLocked.Value) {
+				if (gear.TorqueConverterLocked.HasValue && !gear.TorqueConverterLocked.Value) {
 					continue;
 				}
 
diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs
index 7ce923cd2e..623a394fdb 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs
@@ -67,6 +67,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 									runData.VehicleData.DynamicTyreRadius;
 			var minEngineSpeed = (runData.EngineData.FullLoadCurves[0].RatedSpeed - runData.EngineData.IdleSpeed) *
 								Constants.SimulationSettings.ClutchClosingSpeedNorm + runData.EngineData.IdleSpeed;
+			MaxStartGear = GearboxModelData.GearList.First();
 			foreach (var gear in GearboxModelData.GearList.Reverse()) {
 				var gearData = GearboxModelData.Gears[gear.Gear];
 				if (GearshiftParams.StartSpeed * transmissionRatio * gearData.Ratio > minEngineSpeed) {
diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs
index 4ae7bc7faf..fadc468956 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs
@@ -255,6 +255,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 			var totalTransmissionRatio = DataBus.ElectricMotorInfo(PowertrainPosition.BatteryElectricB2).ElectricMotorSpeed / DataBus.VehicleInfo.VehicleSpeed;
 			//var totalTransmissionRatio = outAngularVelocity / DataBus.VehicleSpeed;
 
+			var results = new List<Tuple<GearshiftPosition, double>>();
 			foreach (var tryNextGear in GearList.IterateGears(GearList.Successor(currentGear), GearList.Successor(currentGear, (uint)shiftStrategyParameters.AllowedGearRangeFC))) {
 				//for (var i = 1; i <= shiftStrategyParameters.AllowedGearRangeFC; i++) {
 				//var tryNextGear = (uint)(currentGear + i);
@@ -304,7 +305,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 				var fcNext = GetFCRating(response);
 				results.Add(Tuple.Create(tryNextGear, fcNext));
 
-				if (reserve < GearshiftParams.TorqueReserve ||
+				//if (reserve < GearshiftParams.TorqueReserve ||
 				//	!fcNext.IsGreater(fcCurrent * shiftStrategyParameters.RatingFactorCurrentGear) || !fcNext.IsSmaller(minFc)) {
 				//	continue;
 				//}
@@ -468,6 +469,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 			//	return currentGear;
 			//}
 
+			var results = new List<Tuple<GearshiftPosition, double>>();
 			foreach (var tryNextGear in GearList.IterateGears(GearList.Predecessor(currentGear), GearList.Predecessor(currentGear, (uint)shiftStrategyParameters.AllowedGearRangeFC))) {
 				//for (var i = 1; i <= shiftStrategyParameters.AllowedGearRangeFC; i++) {
 				//var tryNextGear = (uint)(currentGear - i);
diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs
index 2515818882..c2ab832cc4 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs
@@ -215,6 +215,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
 				(DataBus.EngineInfo as CombustionEngine).PreviousState.EngineTorqueOut;
 			TestPowertrain.CombustionEngine.PreviousState.DynamicFullLoadTorque =
 				(DataBus.EngineInfo as CombustionEngine).PreviousState.DynamicFullLoadTorque;
+			(TestPowertrain.CombustionEngine.EngineAux as EngineAuxiliary).PreviousState.AngularSpeed =
+				((DataBus.EngineInfo as CombustionEngine).EngineAux as EngineAuxiliary).PreviousState.AngularSpeed;
 
 			TestPowertrain.Gearbox.PreviousState.InAngularVelocity =
 				(DataBus.GearboxInfo as Gearbox).PreviousState.InAngularVelocity;
@@ -1332,9 +1334,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
 			return tmp;
 		}
 
-				(TestPowertrain.CombustionEngine.EngineAux as EngineAuxiliary).PreviousState.AngularSpeed =
-					((DataBus.EngineInfo as CombustionEngine).EngineAux as EngineAuxiliary).PreviousState.AngularSpeed;
-
 		private void CalcualteCosts(IResponse resp, Second dt, HybridResultEntry tmp, bool allowIceOff, bool dryRun)
 		{
 			tmp.IgnoreReason = 0;
-- 
GitLab