Skip to content

Commit 6e1f4e7

Browse files
committed
Automatic merge of T1.5.1-372-g5db5c7824 and 9 pull requests
- Pull request #570 at de7a14f: Experimental glTF 2.0 support with PBR lighting - Pull request #732 at 22f66dc: Improvements for air brakes - Pull request #751 at 00981a2: Web interface to control cab controls with external hardware - Pull request #799 at dc03850: Consolidated wind simulation - Pull request #803 at 7157e08: Various adjustments to steam adhesion - Pull request #813 at 0bb067a: Refactored garbage generators - Pull request #815 at a5cc165: chore: Add GitHub automatic release notes configuration - Pull request #816 at eae646d: Bug fix for https://bugs.launchpad.net/or/+bug/2014992 EOT can't be dismounted after train reversal - Pull request #818 at 18fd051: Allow independent drive axles for locomotives
11 parents 9c051da + 5db5c78 + de7a14f + 22f66dc + 00981a2 + dc03850 + 7157e08 + 0bb067a + a5cc165 + eae646d + 18fd051 commit 6e1f4e7

File tree

10 files changed

+455
-145
lines changed

10 files changed

+455
-145
lines changed

Source/Orts.Simulation/Simulation/AIs/AITrain.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6346,7 +6346,7 @@ public bool SwitchToPlayerControl()
63466346
if (car is MSTSLocomotive)
63476347
{
63486348
var loco = car as MSTSLocomotive;
6349-
loco.LocomotiveAxle.Reset(Simulator.GameTime, SpeedMpS);
6349+
loco.LocomotiveAxles.InitializeMoving();
63506350
loco.AntiSlip = false; // <CSComment> TODO Temporary patch until AntiSlip is re-implemented
63516351
}
63526352
if (car == Simulator.PlayerLocomotive) { leadLocomotiveIndex = j; }

Source/Orts.Simulation/Simulation/RollingStocks/MSTSDieselLocomotive.cs

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -676,11 +676,6 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
676676
if (TractionMotorType == TractionMotorTypes.AC)
677677
{
678678
AbsTractionSpeedMpS = AbsSpeedMpS;
679-
if (AbsWheelSpeedMpS > 1.1 * MaxSpeedMpS)
680-
{
681-
AverageForceN = TractiveForceN = 0;
682-
return;
683-
}
684679
}
685680
else
686681
{
@@ -771,6 +766,53 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
771766
SignalEvent(Event.EnginePowerOff);
772767
DieselEngines.HandleEvent(PowerSupplyEvent.StopEngine);
773768
}
769+
770+
ApplyDirectionToTractiveForce();
771+
772+
// Calculate the total tractive force for the locomotive - ie Traction + Dynamic Braking force.
773+
// Note typically only one of the above will only ever be non-zero at the one time.
774+
// For flipped locomotives the force is "flipped" elsewhere, whereas dynamic brake force is "flipped" below by the direction of the speed.
775+
776+
if (DynamicBrakePercent > 0 && DynamicBrakeForceCurves != null && AbsSpeedMpS > 0)
777+
{
778+
float f = DynamicBrakeForceCurves.Get(.01f * DynamicBrakePercent, AbsTractionSpeedMpS);
779+
if (f > 0 && LocomotivePowerSupply.DynamicBrakeAvailable)
780+
{
781+
DynamicBrakeForceN = f * (1 - PowerReduction);
782+
TractiveForceN -= (SpeedMpS > 0 ? 1 : SpeedMpS < 0 ? -1 : Direction == Direction.Reverse ? -1 : 1) * DynamicBrakeForceN;
783+
}
784+
else
785+
{
786+
DynamicBrakeForceN = 0f;
787+
}
788+
}
789+
else
790+
DynamicBrakeForceN = 0; // Set dynamic brake force to zero if in Notch 0 position
791+
792+
foreach (var motor in TractionMotors)
793+
{
794+
motor.UpdateTractiveForce(elapsedClockSeconds, t);
795+
}
796+
797+
if (Simulator.UseAdvancedAdhesion && !Simulator.Settings.SimpleControlPhysics)
798+
{
799+
UpdateAxleDriveForce();
800+
}
801+
}
802+
803+
protected override void UpdateAxleDriveForce()
804+
{
805+
/* TODO: connect different engines to different axles
806+
if (DieselEngines.HasGearBox && DieselTransmissionType == MSTSDieselLocomotive.DieselTransmissionTypes.Mechanic)
807+
{
808+
foreach (var de in DieselEngines)
809+
{
810+
}
811+
}
812+
else */
813+
{
814+
base.UpdateAxleDriveForce();
815+
}
774816
}
775817

776818
/// <summary>
@@ -1088,7 +1130,7 @@ public string GetDpuStatus(bool dataDpu, CABViewControlUnits loadUnits = CABView
10881130
if (FilteredMotiveForceN != 0)
10891131
data = Math.Abs(this.FilteredMotiveForceN);
10901132
else
1091-
data = Math.Abs(this.LocomotiveAxle.DriveForceN);
1133+
data = Math.Abs(TractiveForceN);
10921134
if (DynamicBrakePercent > 0)
10931135
{
10941136
data = -Math.Abs(DynamicBrakeForceN);

0 commit comments

Comments
 (0)