Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 52ce83d3 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

fix in gearbox: use correct gear for interpolation, add torque loss to inTorque

parent 84b165ee
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment