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

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

fix: retarder does not apply its torque loss when used as primary retarder and clutch is open

parent 4bde6696
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
{
private readonly RetarderLossMap _lossMap;
private readonly double _ratio;
private bool _primaryRetarder;
/// <summary>
/// Creates a new Retarder.
......@@ -71,8 +72,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public IResponse Request(Second absTime, Second dt, NewtonMeter torque, PerSecond angularVelocity, bool dryRun = false)
{
if (angularVelocity == null) {
return NextComponent.Request(absTime, dt, torque, null, dryRun);
if (angularVelocity == null || (_primaryRetarder && !DataBus.ClutchClosed(absTime))) {
return NextComponent.Request(absTime, dt, torque, angularVelocity, dryRun);
}
var avgAngularSpeed = (PreviousState.InAngularVelocity + angularVelocity) / 2.0;
var retarderTorqueLoss = _lossMap.GetTorqueLoss(avgAngularSpeed * _ratio) * _ratio;
......
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