From 1eea86bf8c16a285fe3493cec30533b536f1910f Mon Sep 17 00:00:00 2001
From: Michael Krisper <michael.krisper@tugraz.at>
Date: Tue, 23 Aug 2016 14:34:18 +0200
Subject: [PATCH] CycleGearbox includes Inertia in DryRuns

---
 .../SimulationComponent/Impl/CycleGearbox.cs  | 22 +++++++++++--------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs
index 21fc7a86a6..558fdaeaf3 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs
@@ -193,15 +193,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 				CurrentState.TorqueLossResult = inTorqueLossResult;
 				var inAngularVelocity = outAngularVelocity * ModelData.Gears[Gear].Ratio;
 
-				if (dryRun) {
-					var dryRunResponse = NextComponent.Request(absTime, dt, inTorque, inAngularVelocity, true);
-					dryRunResponse.GearboxPowerRequest = outTorque * avgOutAngularVelocity;
-					return dryRunResponse;
-				}
-
-				// this code has to be _after_ the check for a potential gear-shift!
-				// (the above block issues dry-run requests and thus may update the CurrentState!)
-				CurrentState.TransmissionTorqueLoss = inTorque - (outTorque / ModelData.Gears[Gear].Ratio);
 				if (!inAngularVelocity.IsEqual(0)) {
 					// MQ 19.2.2016: check! inertia is related to output side, torque loss accounts to input side
 					CurrentState.InertiaTorqueLossOut =
@@ -211,6 +202,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 				} else {
 					CurrentState.InertiaTorqueLossOut = 0.SI<NewtonMeter>();
 				}
+
+				// todo mk 2016-08-23: add pto auxiliaries!!
+
+				if (dryRun) {
+					var dryRunResponse = NextComponent.Request(absTime, dt, inTorque, inAngularVelocity, true);
+					dryRunResponse.GearboxPowerRequest = outTorque * avgOutAngularVelocity;
+					return dryRunResponse;
+				}
+
+				// this code has to be _after_ the check for a potential gear-shift!
+				// (the above block issues dry-run requests and thus may update the CurrentState!)
+				CurrentState.TransmissionTorqueLoss = inTorque - (outTorque / ModelData.Gears[Gear].Ratio);
+
 				CurrentState.SetState(inTorque, inAngularVelocity, outTorque, outAngularVelocity);
 				CurrentState.Gear = Gear;
 				// end critical section
-- 
GitLab