Skip to content

Commit da90184

Browse files
committed
Automatic merge of T1.5.1-757-gef6c1a8c8 and 16 pull requests
- Pull request #570 at 3539862: 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 #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 #882 at a055bca: Blueprint/train car operations UI window - Pull request #885 at d9ce84b: feat: Add notifications to Menu - Pull request #886 at 6c0785b: Scene viewer extension to TrackViewer - Pull request #888 at b20b888: docs: Document player application model - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #893 at bf8876b: Signal errors - Pull request #894 at 5ff1e73: 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 0a9d939: feat: Improved system information collection - Pull request #898 at e271395: Extra line with all the arguments for debugging purposes in logfile - Pull request #899 at bb341bf: Duplex steam engines - Booster Engine addition
18 parents c274e2c + ef6c1a8 + 3539862 + d00beb9 + f8dbeab + 43bf33e + f92de76 + a055bca + d9ce84b + 6c0785b + b20b888 + 1f5ba4c + bf8876b + 5ff1e73 + 5866028 + 0a9d939 + e271395 + bb341bf commit da90184

File tree

4 files changed

+110
-16
lines changed

4 files changed

+110
-16
lines changed

Source/Orts.Formats.Msts/SoundManagmentFile.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public struct CurvePoint
198198

199199
public class VolumeCurve
200200
{
201-
public enum Controls { None, DistanceControlled, SpeedControlled, Variable1Controlled, Variable2Controlled, Variable3Controlled, BrakeCylControlled, CurveForceControlled };
201+
public enum Controls { None, DistanceControlled, SpeedControlled, Variable1Controlled, Variable2_1Controlled, Variable3_1Controlled, Variable4_1Controlled, Variable2Controlled, Variable3Controlled, BrakeCylControlled, CurveForceControlled };
202202

203203
public Controls Control = Controls.None;
204204
public float Granularity = 1.0f;
@@ -214,6 +214,9 @@ public VolumeCurve(STFReader stf)
214214
case "distancecontrolled": Control = Controls.DistanceControlled; break;
215215
case "speedcontrolled": Control = Controls.SpeedControlled; break;
216216
case "variable1controlled": Control = Controls.Variable1Controlled; break;
217+
case "variable2_1controlled": Control = Controls.Variable2_1Controlled; break;
218+
case "variable3_1controlled": Control = Controls.Variable3_1Controlled; break;
219+
case "variable4_1controlled": Control = Controls.Variable4_1Controlled; break;
217220
case "variable2controlled": Control = Controls.Variable2Controlled; break;
218221
case "variable3controlled": Control = Controls.Variable3Controlled; break;
219222
case "brakecylcontrolled": Control = Controls.BrakeCylControlled; break;
@@ -339,7 +342,7 @@ public Discrete_Trigger(STFReader f)
339342
public class Variable_Trigger : Trigger
340343
{
341344
public enum Events { Speed_Inc_Past, Speed_Dec_Past, Distance_Inc_Past, Distance_Dec_Past,
342-
Variable1_Inc_Past, Variable1_Dec_Past, Variable2_Inc_Past, Variable2_Dec_Past, Variable3_Inc_Past, Variable3_Dec_Past, BrakeCyl_Inc_Past, BrakeCyl_Dec_Past, CurveForce_Inc_Past, CurveForce_Dec_Past
345+
Variable1_Inc_Past, Variable2_1_Inc_Past, Variable3_1_Inc_Past, Variable4_1_Inc_Past, Variable1_Dec_Past, Variable2_1_Dec_Past, Variable3_1_Dec_Past, Variable4_1_Dec_Past, Variable2_Inc_Past, Variable2_Dec_Past, Variable3_Inc_Past, Variable3_Dec_Past, BrakeCyl_Inc_Past, BrakeCyl_Dec_Past, CurveForce_Inc_Past, CurveForce_Dec_Past
343346
};
344347

345348
public Events Event;
@@ -370,7 +373,13 @@ public Variable_Trigger(STFReader f)
370373
break;
371374
}
372375
case "variable1_inc_past": Event = Events.Variable1_Inc_Past; break;
376+
case "variable2_1_inc_past": Event = Events.Variable2_1_Inc_Past; break;
377+
case "variable3_1_inc_past": Event = Events.Variable3_1_Inc_Past; break;
378+
case "variable4_1_inc_past": Event = Events.Variable4_1_Inc_Past; break;
373379
case "variable1_dec_past": Event = Events.Variable1_Dec_Past; break;
380+
case "variable2_1_dec_past": Event = Events.Variable2_1_Dec_Past; break;
381+
case "variable3_1_dec_past": Event = Events.Variable3_1_Dec_Past; break;
382+
case "variable4_1_dec_past": Event = Events.Variable4_1_Dec_Past; break;
374383
case "variable2_inc_past": Event = Events.Variable2_Inc_Past; break;
375384
case "variable2_dec_past": Event = Events.Variable2_Dec_Past; break;
376385
case "variable3_inc_past": Event = Events.Variable3_Inc_Past; break;

Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs

Lines changed: 77 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ public class MSTSSteamLocomotive : MSTSLocomotive
133133
public bool SteamBoosterRunMode = false;
134134
public bool SteamBoosterIdleMode = false;
135135
public bool SteamBoosterLatchedLocked = false;
136+
public float HuDBoosterSteamConsumptionLbpS;
137+
public float BoosterSteamConsumptionLbpS;
138+
float BoosterIdleChokeSizeIn;
136139

137140
/// <summary>
138141
/// Grate limit of locomotive exceedeed?
@@ -1268,6 +1271,31 @@ public override void Initialize()
12681271
FractionBoilerAreaInsulated = 0.86f; // Rough approximation - based upon empirical graphing
12691272
}
12701273

1274+
// Define Booster choke size
1275+
// Based on information in "The Locomotive Booster - Instruction book No 102-A" by Franklin Railway Supply Company
1276+
// http://users.fini.net/~bersano/english-anglais/locomotive_booster/locomotive_booster.pdf
1277+
1278+
if (MaxBoilerPressurePSI > 300)
1279+
{
1280+
BoosterIdleChokeSizeIn = 0.375f;
1281+
}
1282+
else if (MaxBoilerPressurePSI > 275 && MaxBoilerPressurePSI <= 300)
1283+
{
1284+
BoosterIdleChokeSizeIn = 0.4375f;
1285+
}
1286+
else if (MaxBoilerPressurePSI > 250 && MaxBoilerPressurePSI <= 275)
1287+
{
1288+
BoosterIdleChokeSizeIn = 0.5f;
1289+
}
1290+
else if (MaxBoilerPressurePSI > 200 && MaxBoilerPressurePSI <= 250)
1291+
{
1292+
BoosterIdleChokeSizeIn = 0.5625f;
1293+
}
1294+
else
1295+
{
1296+
BoosterIdleChokeSizeIn = 0.625f;
1297+
}
1298+
12711299
// Set crank angle between different sides of the locomotive
12721300
if (Cylinder2CrankAngleRad == 0) // if not set by user set default values based upon the cylinder
12731301
{
@@ -2202,7 +2230,7 @@ public override void Update(float elapsedClockSeconds)
22022230
{
22032231
SteamBoosterRunMode = false;
22042232
SteamBoosterIdleMode = true;
2205-
enginethrottle = 0.2f;
2233+
enginethrottle = 0.0f;
22062234
}
22072235
// Run mode
22082236
else if (SteamBoosterAirOpen && SteamBoosterIdle && SteamBoosterLatchedLocked)
@@ -2220,6 +2248,23 @@ public override void Update(float elapsedClockSeconds)
22202248

22212249
UpdateCylinders(elapsedClockSeconds, enginethrottle, boostercutoff, absSpeedMpS, i);
22222250

2251+
// Update Booster steam consumption
2252+
if (SteamBoosterIdleMode)
2253+
{
2254+
// In Idle mode steam consumption will be calculated by steam through an orifice.
2255+
// Steam Flow (lb/hr) = 24.24 x Press(BoilerPressure + Atmosphere(psi)) x ChokeDia^2 (in) - this needs to be multiplied by Num Cyls
2256+
var BoosterPressurePSI = BoilerPressurePSI + OneAtmospherePSI;
2257+
SteamEngines[i].CylinderSteamUsageLBpS = pS.FrompH(SteamEngines[i].NumberCylinders * (24.24f * (BoosterPressurePSI) * BoosterIdleChokeSizeIn * BoosterIdleChokeSizeIn));
2258+
HuDBoosterSteamConsumptionLbpS = SteamEngines[i].CylinderSteamUsageLBpS;
2259+
2260+
}
2261+
else
2262+
{
2263+
// In run mode steam consumption calculated by cylinder model
2264+
HuDBoosterSteamConsumptionLbpS = SteamEngines[i].CylinderSteamUsageLBpS;
2265+
}
2266+
2267+
22232268
}
22242269
BoilerMassLB -= elapsedClockSeconds * SteamEngines[i].CylinderSteamUsageLBpS; // Boiler mass will be reduced by cylinder steam usage
22252270
BoilerHeatBTU -= elapsedClockSeconds * SteamEngines[i].CylinderSteamUsageLBpS * (BoilerSteamHeatBTUpLB - BoilerWaterHeatBTUpLB); // Boiler Heat will be reduced by heat required to replace the cylinder steam usage, ie create steam from hot water.
@@ -2228,6 +2273,7 @@ public override void Update(float elapsedClockSeconds)
22282273
CumulativeCylinderSteamConsumptionLbs += SteamEngines[i].CylinderSteamUsageLBpS * elapsedClockSeconds;
22292274
CylinderSteamUsageLBpS += SteamEngines[i].CylinderSteamUsageLBpS;
22302275
CylCockSteamUsageLBpS += SteamEngines[i].CylCockSteamUsageLBpS;
2276+
22312277

22322278
SteamEngines[i].MeanEffectivePressurePSI = MeanEffectivePressurePSI;
22332279

@@ -2728,18 +2774,31 @@ private void UpdateFX(float elapsedClockSeconds)
27282774
float SmokeColorUnits = (RadiationSteamLossLBpS + CalculatedCarHeaterSteamUsageLBpS + BlowerBurnEffect + (SmokeColorDamper * SmokeColorFireMass)) / PreviousTotalSteamUsageLBpS - 0.2f;
27292775
SmokeColor.Update(elapsedClockSeconds, MathHelper.Clamp(SmokeColorUnits, 0.25f, 1));
27302776

2731-
// Variable1 is proportional to angular speed, value of 10 means 1 rotation/second.
2732-
// If wheel is not slipping then use normal wheel speed, this reduces oscillations in variable1 which causes issues with sounds.
2733-
var variable1 = 0.0f;
2734-
if (WheelSlip)
2735-
{
2736-
variable1 = Math.Abs(WheelSpeedSlipMpS / DriverWheelRadiusM / MathHelper.Pi * 5);
2737-
}
2738-
else
2777+
float[] variable = new float[5];
2778+
2779+
for (int i = 0; i < SteamEngines.Count; i++)
27392780
{
2740-
variable1 = Math.Abs(WheelSpeedMpS / DriverWheelRadiusM / MathHelper.Pi * 5);
2781+
2782+
// Variable is proportional to angular speed, value of 10 means 1 rotation/second.
2783+
// If wheel is not slipping then use normal wheel speed, this reduces oscillations in variable1 which causes issues with sounds.
2784+
2785+
if (SteamEngines[i].AttachedAxle.IsWheelSlip)
2786+
{
2787+
variable[i] = Math.Abs(SteamEngines[i].AttachedAxle.SlipSpeedMpS / SteamEngines[i].AttachedAxle.WheelRadiusM / MathHelper.Pi * 5);
2788+
}
2789+
else
2790+
{
2791+
variable[i] = Math.Abs((float)SteamEngines[i].AttachedAxle.AxleSpeedMpS / SteamEngines[i].AttachedAxle.WheelRadiusM / MathHelper.Pi * 5);
2792+
}
2793+
Variable1 = ThrottlePercent == 0 ? 0 : variable[i];
27412794
}
2742-
Variable1 = ThrottlePercent == 0 ? 0 : variable1;
2795+
2796+
// Set variables for each engine
2797+
Variable1 = variable[0];
2798+
Variable2_1 = variable[1];
2799+
Variable3_1 = variable[2];
2800+
Variable4_1 = variable[3];
2801+
27432802
Variable2 = MathHelper.Clamp((CylinderCocksPressureAtmPSI - OneAtmospherePSI) / BoilerPressurePSI * 100f, 0, 100);
27442803
Variable3 = FuelRateSmoothed * 100;
27452804

@@ -5726,7 +5785,7 @@ private void UpdateAuxiliaries(float elapsedClockSeconds, float absSpeedMpS)
57265785
else
57275786
{
57285787
CylCockSteamUsageLBpS = 0.0f; // set steam usage to zero if turned off
5729-
CylCockSteamUsageDisplayLBpS = CylCockSteamUsageLBpS;
5788+
CylCockSteamUsageDisplayLBpS = 0.0f;
57305789
}
57315790

57325791
// Calculate Generator steam Usage if turned on
@@ -6533,7 +6592,7 @@ public override string GetDebugStatus()
65336592
if (!(BrakeSystem is Orts.Simulation.RollingStocks.SubSystems.Brakes.MSTS.VacuumSinglePipe))
65346593
{
65356594
// Display air compressor information
6536-
status.AppendFormat("{0}\t{1}\t{2}/{21}\t{3}\t{4}/{21}\t{5}\t{6}/{21}\t{7}\t{8}/{21}\t{9}\t{10}/{21}\t{11}\t{12}/{21}\t{13}\t{14}/{21}\t{15}\t{16}/{21}\t{17}\t{18}/{21} ({19}x{20:N1}\")\n",
6595+
status.AppendFormat("{0}\t{1}\t{2}/{23}\t{3}\t{4}/{23}\t{5}\t{6}/{23}\t{7}\t{8}/{23}\t{9}\t{10}/{23}\t{11}\t{12}/{23}\t{13}\t{14}/{23}\t{15}\t{16}/{23}\t{17}\t{18}/{23}\t{19}\t{20}/{23}\t({21}x{22:N1}\")\n",
65376596
Simulator.Catalog.GetString("Usage:"),
65386597
Simulator.Catalog.GetString("Cyl"),
65396598
FormatStrings.FormatMass(pS.TopH(Kg.FromLb(CylinderSteamUsageLBpS)), IsMetric),
@@ -6551,6 +6610,8 @@ public override string GetDebugStatus()
65516610
FormatStrings.FormatMass(pS.TopH(Kg.FromLb(StokerSteamUsageLBpS)), IsMetric),
65526611
Simulator.Catalog.GetString("BlowD"),
65536612
FormatStrings.FormatMass(pS.TopH(Kg.FromLb(BlowdownSteamUsageLBpS)), IsMetric),
6613+
Simulator.Catalog.GetString("Booster"),
6614+
FormatStrings.FormatMass(pS.TopH(Kg.FromLb(HuDBoosterSteamConsumptionLbpS)), IsMetric),
65546615
Simulator.Catalog.GetString("MaxSafe"),
65556616
FormatStrings.FormatMass(pS.TopH(Kg.FromLb(MaxSafetyValveDischargeLbspS)), IsMetric),
65566617
NumSafetyValves,
@@ -6560,7 +6621,7 @@ public override string GetDebugStatus()
65606621
else
65616622
{
65626623
// Display steam ejector information instead of air compressor
6563-
status.AppendFormat("{0}\t{1}\t{2}/{21}\t{3}\t{4}/{21}\t{5}\t{6}/{21}\t{7}\t{8}/{21}\t{9}\t{10}/{21}\t{11}\t{12}/{21}\t{13}\t{14}/{21}\t{15}\t{16}/{21}\t{17}\t{18}/{21} ({19}x{20:N1}\")\n",
6624+
status.AppendFormat("{0}\t{1}\t{2}/{23}\t{3}\t{4}/{23}\t{5}\t{6}/{23}\t{7}\t{8}/{23}\t{9}\t{10}/{23}\t{11}\t{12}/{23}\t{13}\t{14}/{23}\t{15}\t{16}/{23}\t{17}\t{18}/{23}\t{19}\t{20}/{23}\t({21}x{22:N1}\")\n",
65646625
Simulator.Catalog.GetString("Usage:"),
65656626
Simulator.Catalog.GetString("Cyl"),
65666627
FormatStrings.FormatMass(pS.TopH(Kg.FromLb(CylinderSteamUsageLBpS)), IsMetric),
@@ -6578,6 +6639,8 @@ public override string GetDebugStatus()
65786639
FormatStrings.FormatMass(pS.TopH(Kg.FromLb(StokerSteamUsageLBpS)), IsMetric),
65796640
Simulator.Catalog.GetString("BlowD"),
65806641
FormatStrings.FormatMass(pS.TopH(Kg.FromLb(BlowdownSteamUsageLBpS)), IsMetric),
6642+
Simulator.Catalog.GetString("Booster"),
6643+
FormatStrings.FormatMass(pS.TopH(Kg.FromLb(HuDBoosterSteamConsumptionLbpS)), IsMetric),
65816644
Simulator.Catalog.GetString("MaxSafe"),
65826645
FormatStrings.FormatMass(pS.TopH(Kg.FromLb(MaxSafetyValveDischargeLbspS)), IsMetric),
65836646
NumSafetyValves,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ public enum WindowState
111111
public float Variable1; // used to convey status to soundsource
112112
public float Variable2;
113113
public float Variable3;
114+
// additional engines
115+
public float Variable2_1;
116+
public float Variable3_1;
117+
public float Variable4_1;
114118

115119
// wag file data
116120
public string MainShapeFileName;

Source/RunActivity/Viewer3D/Sound.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,9 @@ private float ReadValue(Orts.Formats.Msts.VolumeCurve.Controls control, MSTSWago
14941494
case Orts.Formats.Msts.VolumeCurve.Controls.DistanceControlled: return SoundSource.DistanceSquared;
14951495
case Orts.Formats.Msts.VolumeCurve.Controls.SpeedControlled: return car.AbsSpeedMpS;
14961496
case Orts.Formats.Msts.VolumeCurve.Controls.Variable1Controlled: return car.Variable1;
1497+
case Orts.Formats.Msts.VolumeCurve.Controls.Variable2_1Controlled: return car.Variable2_1;
1498+
case Orts.Formats.Msts.VolumeCurve.Controls.Variable3_1Controlled: return car.Variable3_1;
1499+
case Orts.Formats.Msts.VolumeCurve.Controls.Variable4_1Controlled: return car.Variable4_1;
14971500
case Orts.Formats.Msts.VolumeCurve.Controls.Variable2Controlled: return car.Variable2;
14981501
case Orts.Formats.Msts.VolumeCurve.Controls.Variable3Controlled: return car.Variable3;
14991502
case Orts.Formats.Msts.VolumeCurve.Controls.BrakeCylControlled: return car.BrakeSystem.GetCylPressurePSI();
@@ -1925,6 +1928,9 @@ public override void TryTrigger( )
19251928
case Orts.Formats.Msts.Variable_Trigger.Events.Distance_Dec_Past:
19261929
case Orts.Formats.Msts.Variable_Trigger.Events.Speed_Dec_Past:
19271930
case Orts.Formats.Msts.Variable_Trigger.Events.Variable1_Dec_Past:
1931+
case Orts.Formats.Msts.Variable_Trigger.Events.Variable2_1_Dec_Past:
1932+
case Orts.Formats.Msts.Variable_Trigger.Events.Variable3_1_Dec_Past:
1933+
case Orts.Formats.Msts.Variable_Trigger.Events.Variable4_1_Dec_Past:
19281934
case Orts.Formats.Msts.Variable_Trigger.Events.Variable2_Dec_Past:
19291935
case Orts.Formats.Msts.Variable_Trigger.Events.Variable3_Dec_Past:
19301936
case Orts.Formats.Msts.Variable_Trigger.Events.BrakeCyl_Dec_Past:
@@ -1939,6 +1945,9 @@ public override void TryTrigger( )
19391945
case Orts.Formats.Msts.Variable_Trigger.Events.Distance_Inc_Past:
19401946
case Orts.Formats.Msts.Variable_Trigger.Events.Speed_Inc_Past:
19411947
case Orts.Formats.Msts.Variable_Trigger.Events.Variable1_Inc_Past:
1948+
case Orts.Formats.Msts.Variable_Trigger.Events.Variable2_1_Inc_Past:
1949+
case Orts.Formats.Msts.Variable_Trigger.Events.Variable3_1_Inc_Past:
1950+
case Orts.Formats.Msts.Variable_Trigger.Events.Variable4_1_Inc_Past:
19421951
case Orts.Formats.Msts.Variable_Trigger.Events.Variable2_Inc_Past:
19431952
case Orts.Formats.Msts.Variable_Trigger.Events.Variable3_Inc_Past:
19441953
case Orts.Formats.Msts.Variable_Trigger.Events.BrakeCyl_Inc_Past:
@@ -2005,6 +2014,15 @@ private float ReadValue()
20052014
case Orts.Formats.Msts.Variable_Trigger.Events.Variable1_Dec_Past:
20062015
case Orts.Formats.Msts.Variable_Trigger.Events.Variable1_Inc_Past:
20072016
return car.Variable1;
2017+
case Orts.Formats.Msts.Variable_Trigger.Events.Variable2_1_Dec_Past:
2018+
case Orts.Formats.Msts.Variable_Trigger.Events.Variable2_1_Inc_Past:
2019+
return car.Variable2_1;
2020+
case Orts.Formats.Msts.Variable_Trigger.Events.Variable3_1_Dec_Past:
2021+
case Orts.Formats.Msts.Variable_Trigger.Events.Variable3_1_Inc_Past:
2022+
return car.Variable3_1;
2023+
case Orts.Formats.Msts.Variable_Trigger.Events.Variable4_1_Dec_Past:
2024+
case Orts.Formats.Msts.Variable_Trigger.Events.Variable4_1_Inc_Past:
2025+
return car.Variable4_1;
20082026
case Orts.Formats.Msts.Variable_Trigger.Events.Variable2_Dec_Past:
20092027
case Orts.Formats.Msts.Variable_Trigger.Events.Variable2_Inc_Past:
20102028
return car.Variable2;

0 commit comments

Comments
 (0)