From 52ce83d3a1a53d7d8624b8de5a32d9be8932c470 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Fri, 28 Dec 2018 10:56:25 +0100 Subject: [PATCH] fix in gearbox: use correct gear for interpolation, add torque loss to inTorque --- .../Models/SimulationComponent/Impl/Gearbox.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs index 2af103d1b4..384dd74c1c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs @@ -181,7 +181,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl _engageTime = absTime + dt; } - var gear = NextGear.Gear; + var gear = Disengaged ? NextGear.Gear : Gear; var avgOutAngularVelocity = (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0; var inTorqueLossResult = ModelData.Gears[gear].LossMap.GetTorqueLoss(avgOutAngularVelocity, outTorque); if (avgOutAngularVelocity.IsEqual(0, 1e-9)) { @@ -189,7 +189,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } var inAngularVelocity = outAngularVelocity * ModelData.Gears[gear].Ratio; - var inTorque = outTorque / ModelData.Gears[gear].Ratio + inTorqueLossResult.Value; + var avgInAngularVelocity = (PreviousState.InAngularVelocity + inAngularVelocity) / 2.0; + var inTorque = !avgInAngularVelocity.IsEqual(0) + ? outTorque * (avgOutAngularVelocity / avgInAngularVelocity) + : outTorque / ModelData.Gears[Gear].Ratio; + inTorque += inTorqueLossResult.Value; + //var inTorque = outTorque / ModelData.Gears[gear].Ratio + inTorqueLossResult.Value; + var inertiaTorqueLossOut = !inAngularVelocity.IsEqual(0) ? Formulas.InertiaPower(outAngularVelocity, PreviousState.OutAngularVelocity, ModelData.Inertia, dt) / avgOutAngularVelocity @@ -197,7 +203,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl inTorque += inertiaTorqueLossOut / ModelData.Gears[gear].Ratio; var halted = DataBus.DrivingAction == DrivingAction.Halt; - var driverDeceleratingNegTorque = DataBus.DriverBehavior == DrivingBehavior.Braking && + var driverDeceleratingNegTorque = DataBus.DriverBehavior == DrivingBehavior.Braking && DataBus.DrivingAction == DrivingAction.Brake && (DataBus.BrakePower.IsGreater(0) || inTorque.IsSmaller(0)); var vehiclespeedBelowThreshold = DataBus.VehicleSpeed.IsSmaller(Constants.SimulationSettings.ClutchDisengageWhenHaltingSpeed); -- GitLab