Skip to content

Commit

Permalink
Automatic merge of T1.5.1-689-g9d41208f0 and 19 pull requests
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
openrails-bot committed Nov 28, 2023
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Source/Documentation/Manual/physics.rst
Expand Up @@ -270,7 +270,7 @@ Polach algorithm is being used these values will be around the expected values o



The heart of the adhesion algorithim is the slip characteristics (pictured below).
The heart of the adhesion algorithm is the slip characteristics (pictured below).

.. image:: images/physics-adhesion-slip.png
:align: center
Expand Down
28 changes: 23 additions & 5 deletions Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs
Expand Up @@ -186,7 +186,17 @@ public enum SoundState

public float CurrentLocomotiveSteamHeatBoilerWaterCapacityL
{
get { return WaterController.CurrentValue * MaximumSteamHeatBoilerWaterTankCapacityL; }
get {
if (IsSteamHeatFitted)
{
return WaterController.CurrentValue * MaximumSteamHeatBoilerWaterTankCapacityL;
}
else
{
return 0;
}
}

set { WaterController.CurrentValue = value / MaximumSteamHeatBoilerWaterTankCapacityL; }
}
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.
Expand Down Expand Up @@ -239,10 +249,11 @@ public enum SlipControlType

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

// Vacuum Braking parameters
readonly static float OneAtmospherePSI = Bar.ToPSI(1);
Expand Down Expand Up @@ -1112,9 +1123,16 @@ public override void Parse(string lowercasetoken, STFReader stf)
case "engine(ortswaterscoopfillelevation": WaterScoopFillElevationM = stf.ReadFloatBlock(STFReader.UNITS.Distance, 0.0f); break;
case "engine(ortswaterscoopdepth": WaterScoopDepthM = stf.ReadFloatBlock(STFReader.UNITS.Distance, 0.0f); break;
case "engine(ortswaterscoopwidth": WaterScoopWidthM = stf.ReadFloatBlock(STFReader.UNITS.Distance, 0.0f); break;
case "engine(ortsmaxtracksanderboxcapacity": MaxTrackSandBoxCapacityM3 = stf.ReadFloatBlock(STFReader.UNITS.Volume, null); break;
case "engine(ortsmaxtracksandersandconsumption": TrackSanderSandConsumptionM3pS = stf.ReadFloatBlock(STFReader.UNITS.Volume, null); break;
case "engine(ortsmaxtracksanderairconsumption": TrackSanderAirComsumptionM3pS = stf.ReadFloatBlock(STFReader.UNITS.Volume, null); break;
// Convert the following default ft^3 to Me^3 units
case "engine(ortsmaxtracksanderboxcapacity": MaxTrackSandBoxCapacityM3 = stf.ReadFloatBlock(STFReader.UNITS.VolumeDefaultFT3, null);
MaxTrackSandBoxCapacityM3 = Me3.FromFt3(MaxTrackSandBoxCapacityM3);
break;
case "engine(ortsmaxtracksandersandconsumption": Me3.FromFt3( TrackSanderSandConsumptionM3pS = stf.ReadFloatBlock(STFReader.UNITS.VolumeDefaultFT3, null) );
TrackSanderSandConsumptionM3pS = Me3.FromFt3(TrackSanderSandConsumptionM3pS);
break;
case "engine(ortsmaxtracksanderairconsumption": Me3.FromFt3( TrackSanderAirComsumptionM3pS = stf.ReadFloatBlock(STFReader.UNITS.VolumeDefaultFT3, null) );
TrackSanderAirComsumptionM3pS = Me3.FromFt3(TrackSanderAirComsumptionM3pS);
break;
case "engine(ortscruisecontrol": SetUpCruiseControl(stf); break;
case "engine(ortsmultipositioncontroller": SetUpMPC(stf); break;
default:
Expand Down
4 changes: 2 additions & 2 deletions Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs
Expand Up @@ -2179,7 +2179,7 @@ private void UpdateLocomotiveLoadPhysics()
// This is a tender locomotive. A tender locomotive does not have any fuel onboard.
// Thus the loco weight only changes as boiler level goes up and down, and coal mass varies in the fire
{
MassKG = LoadEmptyMassKg + Kg.FromLb(SteamLocomotiveIdentification.BoilerMassLB) + SteamLocomotiveIdentification.FireMassKG;
MassKG = LoadEmptyMassKg + Kg.FromLb(SteamLocomotiveIdentification.BoilerMassLB) + SteamLocomotiveIdentification.FireMassKG + +(SteamLocomotiveIdentification.CurrentTrackSandBoxCapacityM3 * SteamLocomotiveIdentification.SandWeightKgpM3);
MassKG = MathHelper.Clamp(MassKG, LoadEmptyMassKg, LoadFullMassKg); // Clamp Mass to between the empty and full wagon values
// Adjust drive wheel weight
SteamLocomotiveIdentification.DrvWheelWeightKg = (MassKG / InitialMassKG) * SteamLocomotiveIdentification.InitialDrvWheelWeightKg;
Expand Down Expand Up @@ -2225,7 +2225,7 @@ private void UpdateLocomotiveLoadPhysics()
if (DieselLocomotiveIdentification != null)
{

MassKG = LoadEmptyMassKg + (DieselLocomotiveIdentification.DieselLevelL * DieselLocomotiveIdentification.DieselWeightKgpL) + DieselLocomotiveIdentification.CurrentLocomotiveSteamHeatBoilerWaterCapacityL;
MassKG = LoadEmptyMassKg + (DieselLocomotiveIdentification.DieselLevelL * DieselLocomotiveIdentification.DieselWeightKgpL) + DieselLocomotiveIdentification.CurrentLocomotiveSteamHeatBoilerWaterCapacityL + (DieselLocomotiveIdentification.CurrentTrackSandBoxCapacityM3 * DieselLocomotiveIdentification.SandWeightKgpM3);
MassKG = MathHelper.Clamp(MassKG, LoadEmptyMassKg, LoadFullMassKg); // Clamp Mass to between the empty and full wagon values
// Adjust drive wheel weight
DieselLocomotiveIdentification.DrvWheelWeightKg = (MassKG / InitialMassKG) * DieselLocomotiveIdentification.InitialDrvWheelWeightKg;
Expand Down
Expand Up @@ -955,19 +955,20 @@ void Integrate(float elapsedClockSeconds)
public virtual void Update(float timeSpan)
{
// Test to determine whether to use Polach or Pacha adhesion
var ScreenFrameRate = Simulator.SmoothedFrameRate;

// Switches between Polach (high performance) adhesion model and Pacha (low performance) adhesion model
if(ScreenFrameRate > 59)

// Switches between Polach (high performance) adhesion model and Pacha (low performance) adhesion model depending upon the PC performance
if(timeSpan < 0.025) // timespan 0.025 = 40 fps screen rate, low timeSpan and high FPS
{
UsePolachAdhesion = true;
}
else if(ScreenFrameRate < 55)
else if(timeSpan > 0.033) // timespan 0.033 = 30 fps screen rate, high timeSpan and low FPS
{
UsePolachAdhesion = false;
if (TrainSpeedMpS > 0 )
{
var ScreenFrameRate = 1 / timeSpan;
Trace.TraceInformation("Advanced adhesion model switched to low performance option due to low frame rate {0} at ElapsedClockSeconds of {1}", ScreenFrameRate, timeSpan);

}

// Set values for Pacha adhesion
Expand Down
14 changes: 0 additions & 14 deletions Source/Orts.Simulation/Simulation/Simulator.cs
Expand Up @@ -37,7 +37,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.Remoting.Messaging;
using Event = Orts.Common.Event;

namespace Orts.Simulation
Expand All @@ -60,19 +59,6 @@ namespace Orts.Simulation
/// </summary>
public class Simulator
{
/// <summary>
/// Sets the frame rate object so its value can be read from anywhere in the Simulator and used to tune simulation algorithms.
/// </summary>
/// <param name="frameRate"></param>
public static void SetFrameRate(SmoothedData frameRate)
{
FrameRate = frameRate;
}
public static float SmoothedFrameRate
{
get { return FrameRate.SmoothedValue; }
}
private static SmoothedData FrameRate;

public static GettextResourceManager Catalog { get; private set; }
public static Random Random { get; private set; }
Expand Down
2 changes: 0 additions & 2 deletions Source/RunActivity/Viewer3D/Viewer.cs
Expand Up @@ -381,8 +381,6 @@ public Viewer(Simulator simulator, Orts.Viewer3D.Processes.Game game)
SpeedpostDatFile = new SpeedpostDatFile(Simulator.RoutePath + @"\speedpost.dat", Simulator.RoutePath + @"\shapes\");
}
}
// So the frame rate can be read from anywhere in the Simulator and used to tune simulation algorithms.
Simulator.SetFrameRate(this.RenderProcess.FrameRate);

Initialize();
}
Expand Down

0 comments on commit c356b8f

Please sign in to comment.