Skip to content

Commit 8ddd645

Browse files
committed
Allow use of oil input parameters
1 parent c2a5d32 commit 8ddd645

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

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

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ public class MSTSSteamLocomotive : MSTSLocomotive
297297
SmoothedData OilBurnRateSmoothKGpS = new SmoothedData(3); // Changes in Oil BurnRate take x seconds to fully react to changing needs - models increase and decrease in heat. Oil faster then steam
298298
float FuelFeedRateSmoothedKGpS = 0.0f; // Smoothed Fuel feedd Rate
299299
public float FuelBurnRateSmoothedKGpS; // Smoothed fuel burning rate
300-
float OilSpecificGravity = 0.9659f; // Assume a mid range of API for this value, say API = 15.
300+
float OilSpecificGravity = 0.9659f; // Assume a mid range of API for this value, say API = 15 @ 20 Cdeg.
301+
float WaterSpecificGravity = 1.0f; // Water @ 20 degC.
301302

302303
int NumberofTractiveForceValues = 36;
303304
float[,] TractiveForceAverageN = new float[5, 37];
@@ -383,14 +384,15 @@ public class MSTSSteamLocomotive : MSTSLocomotive
383384
float IdealFireDepthIN = 7.0f; // Assume standard coal coverage of grate = 7 inches.
384385
float FuelDensityKGpM3 = 864.5f; // Anthracite Coal : 50 - 58 (lb/ft3), 800 - 929 (kg/m3)
385386
float DamperFactorManual = 1.0f; // factor to control draft through fire when locomotive is running in Manual mode
386-
public float WaterLBpUKG = 10.0f; // lbs of water in 1 gal (uk)
387+
public float WaterLBpUKG = 10.021f; // lbs of water in 1 gal (uk)
387388
public float MaxTenderCoalMassKG = 1; // Maximum read from Eng File - - this value must be non-zero, if not defined in ENG file, can cause NaN errors
388389
public float TenderCoalMassKG // Decreased by firing and increased by refilling
389390
{
390391
get { return FuelController.CurrentValue * MaxTenderCoalMassKG; }
391392
set { FuelController.CurrentValue = value / MaxTenderCoalMassKG; }
392393
}
393394

395+
float MaxTenderOilMassL;
394396
float DamperBurnEffect; // Effect of the Damper control Used in manual firing)
395397
float Injector1Fraction = 0.0f; // Fraction (0-1) of injector 1 flow from Fireman controller or AI
396398
float Injector2Fraction = 0.0f; // Fraction (0-1) of injector of injector 2 flow from Fireman controller or AI
@@ -914,10 +916,12 @@ public override void Parse(string lowercasetoken, STFReader stf)
914916
case "engine(ortssuperheatcutoffpressurefactor": SuperheatCutoffPressureFactor = stf.ReadFloatBlock(STFReader.UNITS.None, null); break;
915917
case "engine(shovelcoalmass": ShovelMassKG = stf.ReadFloatBlock(STFReader.UNITS.Mass, null); break;
916918
case "engine(maxtendercoalmass": MaxTenderCoalMassKG = stf.ReadFloatBlock(STFReader.UNITS.Mass, null); break;
919+
case "engine(ortsmaxtenderfueloilvolume": MaxTenderOilMassL = stf.ReadFloatBlock(STFReader.UNITS.Volume, null); break;
917920
case "engine(maxtenderwatermass": MaxLocoTenderWaterMassKG = stf.ReadFloatBlock(STFReader.UNITS.Mass, null); break;
918921
case "engine(steamfiremanmaxpossiblefiringrate": MaxFiringRateKGpS = stf.ReadFloatBlock(STFReader.UNITS.MassRateDefaultLBpH, null) / 2.2046f / 3600; break;
919922
case "engine(steamfiremanismechanicalstoker": Stoker = stf.ReadFloatBlock(STFReader.UNITS.None, null); break;
920923
case "engine(ortssteamfiremanmaxpossiblefiringrate": ORTSMaxFiringRateKGpS = stf.ReadFloatBlock(STFReader.UNITS.MassRateDefaultLBpH, null) / 2.2046f / 3600; break;
924+
case "engine(ortsfueloilspecificgravity": OilSpecificGravity = stf.ReadFloatBlock(STFReader.UNITS.None, null); break;
921925
case "engine(enginecontrollers(cutoff": CutoffController.Parse(stf); break;
922926
case "engine(enginecontrollers(ortssmallejector": SmallEjectorController.Parse(stf); SmallEjectorControllerFitted = true; break;
923927
case "engine(enginecontrollers(ortslargeejector": LargeEjectorController.Parse(stf); LargeEjectorControllerFitted = true; break;
@@ -1083,6 +1087,8 @@ public override void Copy(MSTSWagon copy)
10831087
CylinderExhausttoCutoff = locoCopy.CylinderExhausttoCutoff;
10841088
CylinderCompressiontoCutoff = locoCopy.CylinderCompressiontoCutoff;
10851089
CylinderAdmissiontoCutoff = locoCopy.CylinderAdmissiontoCutoff;
1090+
OilSpecificGravity = locoCopy.OilSpecificGravity;
1091+
MaxTenderOilMassL = locoCopy.MaxTenderOilMassL;
10861092

10871093
SteamEngines.Copy(locoCopy.SteamEngines);
10881094
}
@@ -1276,6 +1282,12 @@ public override void Initialize()
12761282
CutoffInitialPressureDropRatioUpper = SteamTable.CutoffInitialPressureUpper();
12771283
CutoffInitialPressureDropRatioLower = SteamTable.CutoffInitialPressureLower();
12781284

1285+
// Set Oil mass - if an oil locomotive
1286+
if (SteamLocomotiveFuelType == SteamLocomotiveFuelTypes.Oil && MaxTenderOilMassL != 0)
1287+
{
1288+
MaxTenderCoalMassKG = MaxTenderOilMassL * OilSpecificGravity;
1289+
}
1290+
12791291
// Assign default steam table values if cylinder event is not in ENG file
12801292
if (CylinderExhausttoCutoff == null)
12811293
{
@@ -1477,9 +1489,9 @@ public override void Initialize()
14771489
// Set to compound operation intially
14781490

14791491
// include check to see if it is a balanced compound locomotive, ie number of HP cylinders = number of LP cylinders
1480-
if(SteamEngines[i].NumberCylinders != SteamEngines[i].LPNumberCylinders && Simulator.Settings.VerboseConfigurationMessages)
1492+
if (SteamEngines[i].NumberCylinders != SteamEngines[i].LPNumberCylinders && Simulator.Settings.VerboseConfigurationMessages)
14811493
{
1482-
1494+
14831495
Trace.TraceInformation("This doesn't appear to be a balanced compound locomotive, ie LP Cylinders = HP Cylinders. Game performnce may not be realistic.");
14841496
SteamEngines[i].NumberCylinders = 2;
14851497
SteamEngines[i].LPNumberCylinders = 2;
@@ -2029,13 +2041,13 @@ public override void Initialize()
20292041

20302042
for (int i = 0; i < SteamEngines.Count; i++)
20312043
{
2032-
if (SteamEngines[i].MaxIndicatedHorsePowerHP == 0 && SteamEngines.Count == 1 && MaxIndicatedHorsePowerHP != 0)
2033-
// if MaxIHP is not set in ENG file, then set a default
2044+
if (SteamEngines[i].MaxIndicatedHorsePowerHP == 0 && SteamEngines.Count == 1 && MaxIndicatedHorsePowerHP != 0)
2045+
// if MaxIHP is not set in ENG file, then set a default
20342046
{
20352047
SteamEngines[i].MaxIndicatedHorsePowerHP = MaxIndicatedHorsePowerHP;
20362048
}
20372049
else if (SteamEngines[i].MaxIndicatedHorsePowerHP == 0)
2038-
{
2050+
{
20392051
// Max IHP = (Max TE x Speed) / 375.0, use a factor of 0.85 to calculate max TE
20402052
SteamEngines[i].MaxIndicatedHorsePowerHP = MaxSpeedFactor * (SteamEngines[i].MaxTractiveEffortLbf * MaxLocoSpeedMpH) / 375.0f; // To be checked what MaxTractive Effort is for the purposes of this formula.
20412053
MaxIndicatedHorsePowerHP += SteamEngines[i].MaxIndicatedHorsePowerHP;
@@ -2065,7 +2077,7 @@ public override void Initialize()
20652077
// Check to see if MaxIHP is in fact limited by the boiler
20662078
if (MaxIndicatedHorsePowerHP > MaxBoilerOutputHP)
20672079
{
2068-
// MaxIndicatedHorsePowerHP = MaxBoilerOutputHP; // Set maxIHp to limit set by boiler - No need to limit IHP, naturally limited by steam production?????
2080+
// MaxIndicatedHorsePowerHP = MaxBoilerOutputHP; // Set maxIHp to limit set by boiler - No need to limit IHP, naturally limited by steam production?????
20692081
ISBoilerLimited = true;
20702082
}
20712083
else

0 commit comments

Comments
 (0)