Skip to content

Commit ebcd9c9

Browse files
committed
Automatic merge of T1.6-rc2-41-gacd714487 and 10 pull requests
- Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc) - Pull request #1091 at 2391bc0: Automatic speed control - Pull request #1107 at f5eb3dc: Fix DPMode when last remote is moved to front. - Pull request #1110 at 387388e: Fix Activity Runner persists after loading exception - Pull request #1114 at 9a4a873: Fix color of DB in DrivingInfo when in setup with DPU fenced. - Pull request #1115 at 01c0838: Do not activate ETS switch if no suitable cars are attached - Pull request #1116 at 721d118: Fix Potential Hang in AnimatedPart.SetFrameWrap - Pull request #1082 at 5845a1a: Allow variable water level in glass gauge - Pull request #1104 at 03ccdc6: Handle simple adhesion within the axle module - Pull request #1081 at 689494b: Brake cuts power unification
12 parents bb4e1a1 + acd7144 + e10390b + 2391bc0 + f5eb3dc + 387388e + 9a4a873 + 01c0838 + 721d118 + 5845a1a + 03ccdc6 + 689494b commit ebcd9c9

File tree

3 files changed

+32
-30
lines changed

3 files changed

+32
-30
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2663,7 +2663,7 @@ public float GetAvailableDynamicBrakeForceN(float d)
26632663
}
26642664
protected virtual void UpdateDynamicBrakeForce(float elapsedClockSeconds)
26652665
{
2666-
if (ThrottlePercent <= 0 && TractionForceN <= 0 && LocomotivePowerSupply.DynamicBrakeAvailable && Direction != Direction.N && DynamicBrakePercent >= 0)
2666+
if (ThrottlePercent <= 0 && TractionForceN == 0 && LocomotivePowerSupply.DynamicBrakeAvailable && Direction != Direction.N && DynamicBrakePercent >= 0)
26672667
{
26682668
if (DynamicBrakeCommandStartTime == null)
26692669
{
@@ -2753,7 +2753,7 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds)
27532753
}
27542754
else if (SlipControlSystem == SlipControlType.CutPower)
27552755
{
2756-
if (TractionForceN > 0)
2756+
if (!DynamicBrake)
27572757
{
27582758
if (axle.HuDIsWheelSlip) SlipControlActive[i] = true;
27592759
}
@@ -2767,7 +2767,7 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds)
27672767
}
27682768
else if (SlipControlSystem == SlipControlType.ReduceForce)
27692769
{
2770-
if (TractionForceN > 0 && axle.DriveForceN != 0 && AdvancedAdhesionModel)
2770+
if (!DynamicBrake && axle.DriveForceN != 0 && AdvancedAdhesionModel)
27712771
{
27722772
if (axle.SlipPercent > axle.SlipWarningTresholdPercent) SlipControlActive[i] = true;
27732773
}
@@ -3166,6 +3166,8 @@ protected virtual void UpdateAxles(float elapsedClockSeconds)
31663166
// TODO: Rolling friction should be handled by the axle module
31673167

31683168
TractiveForceN = LocomotiveAxles.DriveForceN;
3169+
if (DynamicBrake) DynamicBrakeForceN = Math.Abs(TractiveForceN);
3170+
else TractionForceN = Math.Abs(TractiveForceN);
31693171
MotiveForceN = LocomotiveAxles.AxleMotiveForceN;
31703172
BrakeForceN = LocomotiveAxles.AxleBrakeForceN;
31713173

@@ -5139,14 +5141,7 @@ public virtual float GetDataOf(CabViewControl cvc)
51395141
if (LocomotiveAxles.Count > 0)
51405142
{
51415143
data = 0.0f;
5142-
if (TractionForceN > 0)
5143-
{
5144-
//float rangeFactor = direction == 0 ? (float)cvc.MaxValue : (float)cvc.MinValue;
5145-
float rangeFactor = direction == 0 ? MaxCurrentA : (float)cvc.MinValue;
5146-
data = TractionForceN / MaxForceN * rangeFactor;
5147-
data = Math.Abs(data);
5148-
}
5149-
if (DynamicBrakeForceN > 0)
5144+
if (DynamicBrake)
51505145
{
51515146
float rangeFactor;
51525147
if (cvc.ControlType.Type == CABViewControlTypes.AMMETER_ABS)
@@ -5165,6 +5160,13 @@ public virtual float GetDataOf(CabViewControl cvc)
51655160
}
51665161
data = DynamicBrakeForceN / MaxDynamicBrakeForceN * rangeFactor;
51675162
}
5163+
else
5164+
{
5165+
//float rangeFactor = direction == 0 ? (float)cvc.MaxValue : (float)cvc.MinValue;
5166+
float rangeFactor = direction == 0 ? MaxCurrentA : (float)cvc.MinValue;
5167+
data = TractionForceN / MaxForceN * rangeFactor;
5168+
data = Math.Abs(data);
5169+
}
51685170
if (direction == 1)
51695171
data = -data;
51705172
if (cvc.ControlType.Type == CABViewControlTypes.AMMETER_ABS) data = Math.Abs(data);
@@ -5184,16 +5186,16 @@ public virtual float GetDataOf(CabViewControl cvc)
51845186
if (DynamicBrakeMaxCurrentA == 0)
51855187
DynamicBrakeMaxCurrentA = (float)cvc.MinValue;
51865188
data = 0.0f;
5187-
if (TractionForceN > 0)
5188-
{
5189-
data = TractiveForceN / MaxForceN * MaxCurrentA;
5190-
data = Math.Abs(data);
5191-
}
5192-
if (DynamicBrakeForceN > 0)
5189+
if (DynamicBrake)
51935190
{
51945191
data = DynamicBrakeForceN / MaxDynamicBrakeForceN * DynamicBrakeMaxCurrentA;
51955192
data = -Math.Abs(data); // Ensure that dynamic force is seen as a "-ve force", changes colour on the load meter
51965193
}
5194+
else
5195+
{
5196+
data = TractiveForceN / MaxForceN * MaxCurrentA;
5197+
data = Math.Abs(data);
5198+
}
51975199
if (direction == 1)
51985200
data = -data;
51995201
break;
@@ -5205,7 +5207,7 @@ public virtual float GetDataOf(CabViewControl cvc)
52055207
direction = ((CVCGauge)cvc).Direction;
52065208
data = 0.0f;
52075209
data = TractiveForceN;
5208-
if (DynamicBrakeForceN > 0)
5210+
if (DynamicBrake)
52095211
{
52105212
data = DynamicBrakeForceN;
52115213
}
@@ -5217,13 +5219,13 @@ public virtual float GetDataOf(CabViewControl cvc)
52175219
MaxCurrentA = (float)cvc.MaxValue;
52185220
if (DynamicBrakeMaxCurrentA == 0)
52195221
DynamicBrakeMaxCurrentA = (float)cvc.MinValue;
5220-
if (TractionForceN > 0)
5222+
if (DynamicBrake)
52215223
{
5222-
data = (data / MaxForceN) * MaxCurrentA;
5224+
data = (DynamicBrakeForceN / MaxDynamicBrakeForceN) * DynamicBrakeMaxCurrentA;
52235225
}
5224-
if (DynamicBrakeForceN > 0)
5226+
else
52255227
{
5226-
data = (DynamicBrakeForceN / MaxDynamicBrakeForceN) * DynamicBrakeMaxCurrentA;
5228+
data = (data / MaxForceN) * MaxCurrentA;
52275229
}
52285230
data = Math.Abs(data);
52295231
break;
@@ -5261,13 +5263,13 @@ public virtual float GetDataOf(CabViewControl cvc)
52615263
MaxCurrentA = (float)cvc.MaxValue;
52625264
if (DynamicBrakeMaxCurrentA == 0)
52635265
DynamicBrakeMaxCurrentA = (float)cvc.MinValue;
5264-
if (TractionForceN > 0)
5266+
if (DynamicBrake)
52655267
{
5266-
data = (data / MaxForceN) * MaxCurrentA;
5268+
data = (data / MaxDynamicBrakeForceN) * DynamicBrakeMaxCurrentA;
52675269
}
5268-
if (DynamicBrakeForceN > 0)
5270+
else
52695271
{
5270-
data = (data / MaxDynamicBrakeForceN) * DynamicBrakeMaxCurrentA;
5272+
data = (data / MaxForceN) * MaxCurrentA;
52715273
}
52725274
break;
52735275

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/CruiseControl.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,10 +1483,10 @@ public float GetDataOf(CabViewControl cvc)
14831483
data = Locomotive.TractiveForceN;
14841484
break;
14851485
case CABViewControlTypes.ORTS_MOTIVE_FORCE_KILONEWTON:
1486-
if (Locomotive.TractionForceN >0)
1487-
data = (float)Math.Round(Locomotive.TractionForceN / 1000, 0);
1488-
else if (Locomotive.DynamicBrakeForceN > 0)
1486+
if (Locomotive.DynamicBrake)
14891487
data = -(float)Math.Round(Locomotive.DynamicBrakeForceN / 1000, 0);
1488+
else
1489+
data = (float)Math.Round(Locomotive.TractionForceN / 1000, 0);
14901490
break;
14911491
case CABViewControlTypes.ORTS_MAXIMUM_FORCE:
14921492
data = Locomotive.MaxForceN;

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions/Axle.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1446,7 +1446,7 @@ public void UpdateSimpleAdhesion(float elapsedClockSeconds)
14461446
// Simple adhesion, simple wheelslip conditions
14471447
if (Car is MSTSLocomotive locomotive && !locomotive.AdvancedAdhesionModel)
14481448
{
1449-
if (!locomotive.AntiSlip) axleOutForceN *= locomotive.Adhesion1;
1449+
if (!locomotive.AntiSlip && locomotive.SlipControlSystem != MSTSLocomotive.SlipControlType.Full) axleOutForceN *= locomotive.Adhesion1;
14501450
else SlipPercent = 100;
14511451
}
14521452
else if (!Car.Simulator.UseAdvancedAdhesion || Car.Simulator.Settings.SimpleControlPhysics || !Car.Train.IsPlayerDriven)

0 commit comments

Comments
 (0)