Skip to content

Commit

Permalink
Merge pull request #963 from cesarBLG/dynamic_brake_force
Browse files Browse the repository at this point in the history
Fix dynamic brake force indicator
  • Loading branch information
cesarBLG authored Jul 16, 2024
2 parents 3c01d62 + 2d5a67d commit 3f93a37
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 @@ -5458,37 +5458,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 3f93a37

Please sign in to comment.