Skip to content

Commit c356b8f

Browse files
committed
Automatic merge of T1.5.1-689-g9d41208f0 and 19 pull requests
- Pull request #570 at c59c788: Experimental glTF 2.0 support with PBR lighting - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #865 at 67014b7: Dispatcher window improvements - Pull request #874 at f8dbeab: Dynamic brake controller refactoring - Pull request #875 at 43bf33e: Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #878 at 0d65fe4: Implement Polach Adhesion - Pull request #882 at 753b622: Blueprint/train car operations UI window - Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling - Pull request #885 at c81447b: feat: Add notifications to Menu - Pull request #886 at 52c3c82: Scene viewer extension to TrackViewer - Pull request #888 at d7daf62: docs: Document player application model - Pull request #889 at 43341cf: No speed update - Pull request #890 at 39a9fa4: Allow depart early - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #893 at bf8876b: Signal errors - Pull request #894 at 794fddf: Correct Decrease Colour - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #897 at 64a29c8: feat: Improved system information collection
21 parents a7ce2e3 + 9d41208 + c59c788 + d00beb9 + 67014b7 + f8dbeab + 43bf33e + f92de76 + 0d65fe4 + 753b622 + edcc2dd + c81447b + 52c3c82 + d7daf62 + 43341cf + 39a9fa4 + 1f5ba4c + bf8876b + 794fddf + 5866028 + 64a29c8 commit c356b8f

File tree

6 files changed

+32
-29
lines changed

6 files changed

+32
-29
lines changed

Source/Documentation/Manual/physics.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ Polach algorithm is being used these values will be around the expected values o
270270

271271

272272

273-
The heart of the adhesion algorithim is the slip characteristics (pictured below).
273+
The heart of the adhesion algorithm is the slip characteristics (pictured below).
274274

275275
.. image:: images/physics-adhesion-slip.png
276276
:align: center

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

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,17 @@ public float CombinedTenderWaterVolumeUKG // Decreased by running injec
186186

187187
public float CurrentLocomotiveSteamHeatBoilerWaterCapacityL
188188
{
189-
get { return WaterController.CurrentValue * MaximumSteamHeatBoilerWaterTankCapacityL; }
189+
get {
190+
if (IsSteamHeatFitted)
191+
{
192+
return WaterController.CurrentValue * MaximumSteamHeatBoilerWaterTankCapacityL;
193+
}
194+
else
195+
{
196+
return 0;
197+
}
198+
}
199+
190200
set { WaterController.CurrentValue = value / MaximumSteamHeatBoilerWaterTankCapacityL; }
191201
}
192202
public float IsTenderRequired = 1.0f; // Flag indicates that a tender is required for operation of the locomotive. Typically tank locomotives do not require a tender. Assume by default that tender is required.
@@ -239,10 +249,11 @@ public enum SlipControlType
239249

240250
// parameters for Track Sander based upon compressor air and abrasive table for 1/2" sand blasting nozzle @ 50psi
241251
public float MaxTrackSandBoxCapacityM3 = Me3.FromFt3(40.0f); // Capacity of sandbox - assume 40.0 cu ft
242-
public float CurrentTrackSandBoxCapacityM3 = 5.0f; // This value needs to be initialised to the value above, as it reduces as sand is used.
252+
public float CurrentTrackSandBoxCapacityM3;
243253
public float TrackSanderAirComsumptionM3pS = Me3.FromFt3(195.0f) / 60.0f; // Default value - cubic feet per min (CFM) 195 ft3/m
244254
public float TrackSanderAirPressurePSI = 50.0f;
245255
public float TrackSanderSandConsumptionM3pS = Me3.FromFt3(11.6f) / 3600.0f; // Default value - 11.6 ft3/h
256+
public float SandWeightKgpM3 = 1600; // One cubic metre of sand weighs about 1.54-1.78 tonnes.
246257

247258
// Vacuum Braking parameters
248259
readonly static float OneAtmospherePSI = Bar.ToPSI(1);
@@ -1112,9 +1123,16 @@ public override void Parse(string lowercasetoken, STFReader stf)
11121123
case "engine(ortswaterscoopfillelevation": WaterScoopFillElevationM = stf.ReadFloatBlock(STFReader.UNITS.Distance, 0.0f); break;
11131124
case "engine(ortswaterscoopdepth": WaterScoopDepthM = stf.ReadFloatBlock(STFReader.UNITS.Distance, 0.0f); break;
11141125
case "engine(ortswaterscoopwidth": WaterScoopWidthM = stf.ReadFloatBlock(STFReader.UNITS.Distance, 0.0f); break;
1115-
case "engine(ortsmaxtracksanderboxcapacity": MaxTrackSandBoxCapacityM3 = stf.ReadFloatBlock(STFReader.UNITS.Volume, null); break;
1116-
case "engine(ortsmaxtracksandersandconsumption": TrackSanderSandConsumptionM3pS = stf.ReadFloatBlock(STFReader.UNITS.Volume, null); break;
1117-
case "engine(ortsmaxtracksanderairconsumption": TrackSanderAirComsumptionM3pS = stf.ReadFloatBlock(STFReader.UNITS.Volume, null); break;
1126+
// Convert the following default ft^3 to Me^3 units
1127+
case "engine(ortsmaxtracksanderboxcapacity": MaxTrackSandBoxCapacityM3 = stf.ReadFloatBlock(STFReader.UNITS.VolumeDefaultFT3, null);
1128+
MaxTrackSandBoxCapacityM3 = Me3.FromFt3(MaxTrackSandBoxCapacityM3);
1129+
break;
1130+
case "engine(ortsmaxtracksandersandconsumption": Me3.FromFt3( TrackSanderSandConsumptionM3pS = stf.ReadFloatBlock(STFReader.UNITS.VolumeDefaultFT3, null) );
1131+
TrackSanderSandConsumptionM3pS = Me3.FromFt3(TrackSanderSandConsumptionM3pS);
1132+
break;
1133+
case "engine(ortsmaxtracksanderairconsumption": Me3.FromFt3( TrackSanderAirComsumptionM3pS = stf.ReadFloatBlock(STFReader.UNITS.VolumeDefaultFT3, null) );
1134+
TrackSanderAirComsumptionM3pS = Me3.FromFt3(TrackSanderAirComsumptionM3pS);
1135+
break;
11181136
case "engine(ortscruisecontrol": SetUpCruiseControl(stf); break;
11191137
case "engine(ortsmultipositioncontroller": SetUpMPC(stf); break;
11201138
default:

Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,7 +2179,7 @@ private void UpdateLocomotiveLoadPhysics()
21792179
// This is a tender locomotive. A tender locomotive does not have any fuel onboard.
21802180
// Thus the loco weight only changes as boiler level goes up and down, and coal mass varies in the fire
21812181
{
2182-
MassKG = LoadEmptyMassKg + Kg.FromLb(SteamLocomotiveIdentification.BoilerMassLB) + SteamLocomotiveIdentification.FireMassKG;
2182+
MassKG = LoadEmptyMassKg + Kg.FromLb(SteamLocomotiveIdentification.BoilerMassLB) + SteamLocomotiveIdentification.FireMassKG + +(SteamLocomotiveIdentification.CurrentTrackSandBoxCapacityM3 * SteamLocomotiveIdentification.SandWeightKgpM3);
21832183
MassKG = MathHelper.Clamp(MassKG, LoadEmptyMassKg, LoadFullMassKg); // Clamp Mass to between the empty and full wagon values
21842184
// Adjust drive wheel weight
21852185
SteamLocomotiveIdentification.DrvWheelWeightKg = (MassKG / InitialMassKG) * SteamLocomotiveIdentification.InitialDrvWheelWeightKg;
@@ -2225,7 +2225,7 @@ private void UpdateLocomotiveLoadPhysics()
22252225
if (DieselLocomotiveIdentification != null)
22262226
{
22272227

2228-
MassKG = LoadEmptyMassKg + (DieselLocomotiveIdentification.DieselLevelL * DieselLocomotiveIdentification.DieselWeightKgpL) + DieselLocomotiveIdentification.CurrentLocomotiveSteamHeatBoilerWaterCapacityL;
2228+
MassKG = LoadEmptyMassKg + (DieselLocomotiveIdentification.DieselLevelL * DieselLocomotiveIdentification.DieselWeightKgpL) + DieselLocomotiveIdentification.CurrentLocomotiveSteamHeatBoilerWaterCapacityL + (DieselLocomotiveIdentification.CurrentTrackSandBoxCapacityM3 * DieselLocomotiveIdentification.SandWeightKgpM3);
22292229
MassKG = MathHelper.Clamp(MassKG, LoadEmptyMassKg, LoadFullMassKg); // Clamp Mass to between the empty and full wagon values
22302230
// Adjust drive wheel weight
22312231
DieselLocomotiveIdentification.DrvWheelWeightKg = (MassKG / InitialMassKG) * DieselLocomotiveIdentification.InitialDrvWheelWeightKg;

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -955,19 +955,20 @@ void Integrate(float elapsedClockSeconds)
955955
public virtual void Update(float timeSpan)
956956
{
957957
// Test to determine whether to use Polach or Pacha adhesion
958-
var ScreenFrameRate = Simulator.SmoothedFrameRate;
959-
960-
// Switches between Polach (high performance) adhesion model and Pacha (low performance) adhesion model
961-
if(ScreenFrameRate > 59)
958+
959+
// Switches between Polach (high performance) adhesion model and Pacha (low performance) adhesion model depending upon the PC performance
960+
if(timeSpan < 0.025) // timespan 0.025 = 40 fps screen rate, low timeSpan and high FPS
962961
{
963962
UsePolachAdhesion = true;
964963
}
965-
else if(ScreenFrameRate < 55)
964+
else if(timeSpan > 0.033) // timespan 0.033 = 30 fps screen rate, high timeSpan and low FPS
966965
{
967966
UsePolachAdhesion = false;
968967
if (TrainSpeedMpS > 0 )
969968
{
969+
var ScreenFrameRate = 1 / timeSpan;
970970
Trace.TraceInformation("Advanced adhesion model switched to low performance option due to low frame rate {0} at ElapsedClockSeconds of {1}", ScreenFrameRate, timeSpan);
971+
971972
}
972973

973974
// Set values for Pacha adhesion

Source/Orts.Simulation/Simulation/Simulator.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
using System.Collections.Generic;
3838
using System.Diagnostics;
3939
using System.IO;
40-
using System.Runtime.Remoting.Messaging;
4140
using Event = Orts.Common.Event;
4241

4342
namespace Orts.Simulation
@@ -60,19 +59,6 @@ namespace Orts.Simulation
6059
/// </summary>
6160
public class Simulator
6261
{
63-
/// <summary>
64-
/// Sets the frame rate object so its value can be read from anywhere in the Simulator and used to tune simulation algorithms.
65-
/// </summary>
66-
/// <param name="frameRate"></param>
67-
public static void SetFrameRate(SmoothedData frameRate)
68-
{
69-
FrameRate = frameRate;
70-
}
71-
public static float SmoothedFrameRate
72-
{
73-
get { return FrameRate.SmoothedValue; }
74-
}
75-
private static SmoothedData FrameRate;
7662

7763
public static GettextResourceManager Catalog { get; private set; }
7864
public static Random Random { get; private set; }

Source/RunActivity/Viewer3D/Viewer.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,6 @@ public Viewer(Simulator simulator, Orts.Viewer3D.Processes.Game game)
381381
SpeedpostDatFile = new SpeedpostDatFile(Simulator.RoutePath + @"\speedpost.dat", Simulator.RoutePath + @"\shapes\");
382382
}
383383
}
384-
// So the frame rate can be read from anywhere in the Simulator and used to tune simulation algorithms.
385-
Simulator.SetFrameRate(this.RenderProcess.FrameRate);
386384

387385
Initialize();
388386
}

0 commit comments

Comments
 (0)