Skip to content

Commit

Permalink
Fix dynamic brake force indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarBLG committed Jul 6, 2024
1 parent 6fd8417 commit 2d5a67d
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5456,37 +5456,20 @@ public virtual float GetDataOf(CabViewControl cvc)
var direction = 0; // Forwards
if (cvc is CVCGauge && ((CVCGauge)cvc).Orientation == 0)
direction = ((CVCGauge)cvc).Direction;
data = 0.0f;
data = DynamicBrakeForceN;
if (data > 0 && SpeedMpS > 0 || data < 0 && SpeedMpS < 0)
{
data = 0;
break;
}
data = Math.Abs(data);
switch (cvc.Units)
{
case CABViewControlUnits.AMPS:
if (MaxCurrentA == 0)
MaxCurrentA = (float)cvc.MaxValue;
if (DynamicBrakeMaxCurrentA == 0)
DynamicBrakeMaxCurrentA = (float)cvc.MinValue;
if (ThrottlePercent > 0)
{
data = 0;
}
if (DynamicBrakePercent > 0)
{
data = (DynamicBrakeForceN / MaxDynamicBrakeForceN) * DynamicBrakeMaxCurrentA;
}
data = Math.Abs(data);
DynamicBrakeMaxCurrentA = (float)cvc.MaxValue;
data = data / MaxDynamicBrakeForceN * DynamicBrakeMaxCurrentA;
break;

case CABViewControlUnits.NEWTONS:
break;

case CABViewControlUnits.KILO_NEWTONS:
data = data / 1000.0f;
data /= 1000.0f;
break;

case CABViewControlUnits.KILO_LBS:
Expand Down

0 comments on commit 2d5a67d

Please sign in to comment.