From 77075c247cbd903c25c2907aeefbf628cf5fd8c7 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Mon, 22 Feb 2016 16:30:27 +0100
Subject: [PATCH] gearbox only contains gear full load curve, intersection of
 gearbox full-load and engine full-load is used for shift polygon computation
 only

---
 .../DataObjectAdaper/DeclarationDataAdapter.cs    |  2 +-
 .../DataObjectAdaper/EngineeringDataAdapter.cs    |  2 +-
 .../SimulationComponent/Impl/CombustionEngine.cs  | 15 ---------------
 .../SimulationComponent/Impl/ShiftStrategy.cs     |  5 ++++-
 4 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/VectoCore/InputData/Reader/DataObjectAdaper/DeclarationDataAdapter.cs b/VectoCore/InputData/Reader/DataObjectAdaper/DeclarationDataAdapter.cs
index 70c72876e0..a1bf29ab51 100644
--- a/VectoCore/InputData/Reader/DataObjectAdaper/DeclarationDataAdapter.cs
+++ b/VectoCore/InputData/Reader/DataObjectAdaper/DeclarationDataAdapter.cs
@@ -177,7 +177,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper
 					new GearData {
 						LossMap = gearLossMap,
 						ShiftPolygon = shiftPolygon,
-						FullLoadCurve = gearFullLoad ?? engine.FullLoadCurve,
+						FullLoadCurve = gearFullLoad,
 						Ratio = gear.Ratio,
 						TorqueConverterActive = false
 					});
diff --git a/VectoCore/InputData/Reader/DataObjectAdaper/EngineeringDataAdapter.cs b/VectoCore/InputData/Reader/DataObjectAdaper/EngineeringDataAdapter.cs
index 870d96d6ed..2c88dfb169 100644
--- a/VectoCore/InputData/Reader/DataObjectAdaper/EngineeringDataAdapter.cs
+++ b/VectoCore/InputData/Reader/DataObjectAdaper/EngineeringDataAdapter.cs
@@ -136,7 +136,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper
 				return new KeyValuePair<uint, GearData>((uint)(i + 1), new GearData {
 					LossMap = lossMap,
 					ShiftPolygon = shiftPolygon,
-					FullLoadCurve = gearFullLoad ?? engineData.FullLoadCurve,
+					FullLoadCurve = gearFullLoad,
 					Ratio = gear.Ratio,
 					TorqueConverterActive = gear.TorqueConverterActive
 				});
diff --git a/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs
index f71711f550..371825a372 100644
--- a/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs
+++ b/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs
@@ -170,22 +170,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 			ValidatePowerDemand(totalTorqueDemand); // requires CurrentState.FullDragTorque and DynamicfullLoad to be set!
 
 			// get max. torque as limited by gearbox. gearbox only limits torqueOut!
-			//NewtonMeter deltaGbxFld = null;
 			NewtonMeter gearboxFullLoad = null;
 			var curve = DataBus.GearFullLoadCurve;
 			if (curve != null) {
 				// if the current gear has a full-load curve, limit the max. torque to the 
 				// gbx. full-load and continue (remmber the delta for further below)
 				gearboxFullLoad = curve.FullLoadStationaryTorque(avgEngineSpeed);
-				//var maxGbxTorque = VectoMath.Limit(torqueOut, -gearboxFullLoad, gearboxFullLoad);
-				//if (!torqueOut.IsEqual(maxGbxTorque)) {
-				//	deltaGbxFld = torqueOut - maxGbxTorque;
-				//}
-				//CurrentState.EngineTorqueOut = maxGbxTorque;
 			}
 
-			//CurrentState.EngineTorque = totalTorqueDemand;
-
 			var deltaFull = ComputeDelta(torqueOut, totalTorqueDemand, CurrentState.DynamicFullLoadTorque, gearboxFullLoad, true);
 			var deltaDrag = ComputeDelta(torqueOut, totalTorqueDemand, CurrentState.FullDragTorque,
 				gearboxFullLoad != null ? -gearboxFullLoad : null, false);
@@ -217,13 +209,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 			CurrentState.EngineTorque = VectoMath.Limit(totalTorqueDemand, minTorque, maxTorque);
 			CurrentState.EnginePower = CurrentState.EngineTorque * avgEngineSpeed;
 
-			//NewtonMeter deltaEngineFld = null;
-			//Watt delta = null;
-			//if (!CurrentState.EngineTorque.IsEqual(totalTorqueDemand)) {
-			//	delta = (torqueOut - CurrentState.EngineTorque) * avgEngineSpeed;
-			//}
-
-
 			if (torqueOut.IsGreater(0.SI<NewtonMeter>()) &&
 				(deltaFull * avgEngineSpeed).IsGreater(0.SI<Watt>(), Constants.SimulationSettings.EnginePowerSearchTolerance)) {
 				Log.Debug("requested engine power exceeds fullload power: delta: {0}", deltaFull);
diff --git a/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs b/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs
index 81959e699b..5168b52f21 100644
--- a/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs
+++ b/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs
@@ -196,7 +196,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 				for (var gear = (uint)Data.Gears.Count; gear > 1; gear--) {
 					var inAngularSpeed = outEngineSpeed * Data.Gears[gear].Ratio;
 
-					if (inAngularSpeed > Data.Gears[gear].FullLoadCurve.RatedSpeed || inAngularSpeed.IsEqual(0)) {
+					var ratedSpeed = Data.Gears[gear].FullLoadCurve != null
+						? Data.Gears[gear].FullLoadCurve.RatedSpeed
+						: DataBus.EngineRatedSpeed;
+					if (inAngularSpeed > ratedSpeed || inAngularSpeed.IsEqual(0)) {
 						continue;
 					}
 
-- 
GitLab