diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs index 597facb0ec9b49295800f82ea1cecbf4fb4ecfbc..e2d90735040a41debb4f3063b729ae1b03347d30 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs @@ -321,7 +321,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected override void DoCommitSimulationStep() { if (Gear != 0) { - if (CurrentState.TorqueLossResult.Extrapolated) { + if (CurrentState.TorqueLossResult != null && CurrentState.TorqueLossResult.Extrapolated) { Log.Warn( "Gear {0} LossMap data was extrapolated: range for loss map is not sufficient: n:{1}, torque:{2}", Gear, CurrentState.OutAngularVelocity.ConvertTo().Rounds.Per.Minute, CurrentState.OutTorque); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs index 1291bf478f8ea64d42a7f0031f1ba645d6d83d80..2cdf01fee8ba92c88a0e05f18ad1114c6e244ec4 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs @@ -347,7 +347,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var avgOutAngularVelocity = (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0; var inTorqueLossResult = ModelData.Gears[Gear].LossMap.GetTorqueLoss(avgOutAngularVelocity, outTorque); - CurrentState.TorqueLossResult = inTorqueLossResult; + var inTorque = outTorque / ModelData.Gears[Gear].Ratio + inTorqueLossResult.Value; var inAngularVelocity = outAngularVelocity * ModelData.Gears[Gear].Ratio; @@ -395,6 +395,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } else { CurrentState.InertiaTorqueLossOut = 0.SI<NewtonMeter>(); } + CurrentState.TorqueLossResult = inTorqueLossResult; CurrentState.SetState(inTorque, inAngularVelocity, outTorque, outAngularVelocity); CurrentState.Gear = Gear; // end critical section