Skip to content

Commit 8d02194

Browse files
committed
Code cleanup
1 parent a0a37ac commit 8d02194

File tree

3 files changed

+2
-63
lines changed

3 files changed

+2
-63
lines changed

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

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,14 +1262,12 @@ public override void Initialize()
12621262
if (CylinderExhausttoCutoff == null)
12631263
{
12641264
CylinderExhausttoCutoff = SteamTable.CylinderEventExhausttoCutoff();
1265-
// Trace.TraceInformation("Default values used for CylinderExhausttoCutoff");
12661265
}
12671266

12681267

12691268
if (CylinderCompressiontoCutoff == null)
12701269
{
12711270
CylinderCompressiontoCutoff = SteamTable.CylinderEventCompressiontoCutoff();
1272-
// Trace.TraceInformation("Default values used for CylinderCompressiontoCutoff");
12731271
}
12741272

12751273
if (CylinderAdmissiontoCutoff == null)
@@ -2614,39 +2612,28 @@ private void UpdateFX(float elapsedClockSeconds)
26142612
exhaustCrankAngleRad = CylinderExhaustOpenFactor * (float)Math.PI + (float)Math.PI;
26152613
}
26162614

2617-
// Trace.TraceInformation("Cylinder {0} ExhaustCrank {1} RealCrank {2} NormalCrank {3}", i + 1, MathHelper.ToDegrees(exhaustCrankAngleRad), MathHelper.ToDegrees(realCrankAngleRad), MathHelper.ToDegrees(normalisedCrankAngleRad));
2618-
26192615
if (absSpeedMpS > 0.001)
26202616
{
26212617
if (i == 0 && ((normalisedCrankAngleRad <= MathHelper.Pi && normalisedCrankAngleRad >= exhaustCrankAngleRad) || (normalisedCrankAngleRad < 2 * MathHelper.Pi && normalisedCrankAngleRad >= exhaustCrankAngleRad)))
26222618
{
26232619
CylinderSteamExhaust1On = true;
2624-
2625-
// Trace.TraceInformation("Exhaust - Factor {0} ExhaustCrank {1} RealCrank {2} NormalCrank {3} Exhaust1On {4} Cylinder {5} i {6}", CylinderExhaustOpenFactor, MathHelper.ToDegrees(exhaustCrankAngleRad), MathHelper.ToDegrees(realCrankAngleRad), MathHelper.ToDegrees(normalisedCrankAngleRad), CylinderSteamExhaust1On, i + 1, i);
26262620
}
26272621
else if (i == 0)
26282622
{
26292623
CylinderSteamExhaust1On = false;
2630-
// Trace.TraceInformation("Test #1 {0}", CylinderSteamExhaust1On);
26312624
}
26322625

26332626
else if (i == 1 && ((normalisedCrankAngleRad <= MathHelper.Pi && normalisedCrankAngleRad >= exhaustCrankAngleRad) || (normalisedCrankAngleRad < 2 * MathHelper.Pi && normalisedCrankAngleRad >= exhaustCrankAngleRad)))
26342627
{
26352628
CylinderSteamExhaust2On = true;
2636-
// Trace.TraceInformation("Exhaust - Factor {0} ExhaustCrank {1} RealCrank {2} NormalCrank {3} Exhaust2On {4} Cylinder {5} i {6}", CylinderExhaustOpenFactor, MathHelper.ToDegrees(exhaustCrankAngleRad), MathHelper.ToDegrees(realCrankAngleRad), MathHelper.ToDegrees(normalisedCrankAngleRad), CylinderSteamExhaust2On, i + 1, i);
26372629
}
26382630
else if (i == 1)
26392631
{
26402632
CylinderSteamExhaust2On = false;
26412633
}
2642-
2643-
// Trace.TraceInformation("Exhaust - Factor {0} ExhaustCrank {1} RealCrank {2} NormalCrank {3} ExhaustOn {4} Cylinder {5}", CylinderExhaustOpenFactor, MathHelper.ToDegrees(exhaustCrankAngleRad), MathHelper.ToDegrees(realCrankAngleRad), MathHelper.ToDegrees(normalisedCrankAngleRad), SteamExhaust1On, i+1);
2644-
2645-
26462634
else if (i == 2 && ((normalisedCrankAngleRad <= MathHelper.Pi && normalisedCrankAngleRad >= exhaustCrankAngleRad) || (normalisedCrankAngleRad < 2 * MathHelper.Pi && normalisedCrankAngleRad >= exhaustCrankAngleRad)))
26472635
{
26482636
CylinderSteamExhaust3On = true;
2649-
// Trace.TraceInformation("Exhaust - Factor {0} ExhaustCrank {1} RealCrank {2} NormalCrank {3} Exhaust3On {4} Cylinder {5} i {6}", CylinderExhaustOpenFactor, MathHelper.ToDegrees(exhaustCrankAngleRad), MathHelper.ToDegrees(realCrankAngleRad), MathHelper.ToDegrees(normalisedCrankAngleRad), CylinderSteamExhaust3On, i + 1, i);
26502637
}
26512638
else if (i == 2)
26522639
{
@@ -2656,7 +2643,6 @@ private void UpdateFX(float elapsedClockSeconds)
26562643
else if (i == 3 && ((normalisedCrankAngleRad <= MathHelper.Pi && normalisedCrankAngleRad >= exhaustCrankAngleRad) || (normalisedCrankAngleRad < 2 * MathHelper.Pi && normalisedCrankAngleRad >= exhaustCrankAngleRad)))
26572644
{
26582645
CylinderSteamExhaust4On = true;
2659-
// Trace.TraceInformation("Exhaust - Factor {0} ExhaustCrank {1} RealCrank {2} NormalCrank {3} Exhaust4On {4} Cylinder {5} i {6}", CylinderExhaustOpenFactor, MathHelper.ToDegrees(exhaustCrankAngleRad), MathHelper.ToDegrees(realCrankAngleRad), MathHelper.ToDegrees(normalisedCrankAngleRad), CylinderSteamExhaust4On, i + 1, i);
26602646
}
26612647
else if (i == 3)
26622648
{
@@ -2841,35 +2827,24 @@ private void UpdateFX(float elapsedClockSeconds)
28412827
{
28422828
exhaustCrankAngleRad = CylinderExhaustOpenFactor * (float)Math.PI + (float)Math.PI;
28432829
}
2844-
2845-
// Trace.TraceInformation("Cylinder {0} ExhaustCrank {1} RealCrank {2} NormalCrank {3}", i + 1, MathHelper.ToDegrees(exhaustCrankAngleRad), MathHelper.ToDegrees(realCrankAngleRad), MathHelper.ToDegrees(normalisedCrankAngleRad));
2846-
28472830
if (absSpeedMpS > 0.001)
28482831
{
28492832
if (i == 0 && ((normalisedCrankAngleRad <= MathHelper.Pi && normalisedCrankAngleRad >= exhaustCrankAngleRad) || (normalisedCrankAngleRad < 2 * MathHelper.Pi && normalisedCrankAngleRad >= exhaustCrankAngleRad)))
28502833
{
28512834
CylinderSteamExhaust2_1On = true;
2852-
2853-
// Trace.TraceInformation("Exhaust - Factor {0} ExhaustCrank {1} RealCrank {2} NormalCrank {3} Exhaust1On {4} Cylinder {5} i {6}", CylinderExhaustOpenFactor, MathHelper.ToDegrees(exhaustCrankAngleRad), MathHelper.ToDegrees(realCrankAngleRad), MathHelper.ToDegrees(normalisedCrankAngleRad), CylinderSteamExhaust1On, i + 1, i);
28542835
}
28552836
else if (i == 0)
28562837
{
28572838
CylinderSteamExhaust2_1On = false;
2858-
// Trace.TraceInformation("Test #1 {0}", CylinderSteamExhaust1On);
28592839
}
2860-
28612840
else if (i == 1 && ((normalisedCrankAngleRad <= MathHelper.Pi && normalisedCrankAngleRad >= exhaustCrankAngleRad) || (normalisedCrankAngleRad < 2 * MathHelper.Pi && normalisedCrankAngleRad >= exhaustCrankAngleRad)))
28622841
{
28632842
CylinderSteamExhaust2_2On = true;
2864-
// Trace.TraceInformation("Exhaust - Factor {0} ExhaustCrank {1} RealCrank {2} NormalCrank {3} Exhaust2On {4} Cylinder {5} i {6}", CylinderExhaustOpenFactor, MathHelper.ToDegrees(exhaustCrankAngleRad), MathHelper.ToDegrees(realCrankAngleRad), MathHelper.ToDegrees(normalisedCrankAngleRad), CylinderSteamExhaust2On, i + 1, i);
28652843
}
28662844
else if (i == 1)
28672845
{
28682846
CylinderSteamExhaust2_2On = false;
28692847
}
2870-
2871-
// Trace.TraceInformation("Exhaust - Factor {0} ExhaustCrank {1} RealCrank {2} NormalCrank {3} ExhaustOn {4} Cylinder {5}", CylinderExhaustOpenFactor, MathHelper.ToDegrees(exhaustCrankAngleRad), MathHelper.ToDegrees(realCrankAngleRad), MathHelper.ToDegrees(normalisedCrankAngleRad), SteamExhaust1On, i+1);
2872-
28732848
}
28742849

28752850
if (TotalNumberCyindersEng2 == 2)
@@ -3090,8 +3065,6 @@ private void UpdateFX(float elapsedClockSeconds)
30903065
BoosterCylinderSteamExhaust02SteamVolumeM3pS = BoosterCylinderSteamExhaustOn && BoosterCylinderSteamExhaust02On ? (10.0f * BoosterSteamFraction) : 0.0f;
30913066
BoosterCylinderSteamExhaust02SteamVelocityMpS = 100.0f;
30923067

3093-
// Trace.TraceInformation("Booster Exhaust - ExhaustOn {0} Exhaust01On {1} Exhaust02On {2} ExhaustVolume01 {3} ExhaustVolume02 {4} SteamFraction {5} Speed {6}", BoosterCylinderSteamExhaustOn, BoosterCylinderSteamExhaust01On, BoosterCylinderSteamExhaust02On, BoosterCylinderSteamExhaust01SteamVolumeM3pS, BoosterCylinderSteamExhaust02SteamVolumeM3pS, BoosterSteamFraction, BoosterEngineSpeedRpM);
3094-
30953068
// Booster Cylinder Steam Cylinder Cocks (automatic)
30963069
BoosterCylinderCockSteam11VolumeMpS = BoosterCylinderCocksOn && BoosterCylinderCock11On ? (10.0f * BoosterSteamFraction) : 0.0f;
30973070
BoosterCylinderCock11SteamVelocityMpS = 100.0f;
@@ -5600,9 +5573,6 @@ private void UpdateCylinders(float elapsedClockSeconds, float throttle, float cu
56005573
// Geared locomotives will have to take into account gearing ratio.
56015574
RawCalculatedCylinderSteamUsageLBpS = SteamEngines[numberofengine].NumberCylinders * DrvWheelRevRpS * MotiveForceGearRatio * CylStrokesPerCycle * RawCylinderSteamWeightLbs;
56025575
CalculatedCylinderSteamUsageLBpS = RawCalculatedCylinderSteamUsageLBpS * SuperheaterSteamUsageFactor;
5603-
5604-
5605-
// Trace.TraceInformation("Steam Consumption - Eng# {0} Calc {1} Raw {2} Factor {3}", numberofengine, pS.TopH(CalculatedCylinderSteamUsageLBpS), pS.TopH(RawCalculatedCylinderSteamUsageLBpS), SuperheaterSteamUsageFactor);
56065576
}
56075577

56085578
#endregion
@@ -6147,12 +6117,6 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float loc
61476117

61486118
}
61496119

6150-
// Temporary code to compare TE and IHP
6151-
6152-
SteamEngines[i].CompareTractiveForceN = N.FromLbf((SteamEngines[i].NumberCylinders / 2.0f) * (Me.ToIn(SteamEngines[i].CylindersDiameterM) * Me.ToIn(SteamEngines[i].CylindersDiameterM) * Me.ToIn(SteamEngines[i].CylindersStrokeM) / (2.0f * Me.ToIn(SteamEngines[i].AttachedAxle.WheelRadiusM))) * (SteamEngines[i].MeanEffectivePressurePSI * CylinderEfficiencyRate) * MotiveForceGearRatio);
6153-
6154-
SteamEngines[i].CompareIndicatedHorsePower = (N.ToLbf(SteamEngines[i].RealTractiveForceN) * pS.TopH(Me.ToMi(absSpeedMpS))) / 375.0f;
6155-
61566120
// Set Max Power equal to max IHP
61576121
MaxPowerW += W.FromHp(SteamEngines[i].MaxIndicatedHorsePowerHP);
61586122

@@ -7869,21 +7833,6 @@ public override string GetDebugStatus()
78697833
}
78707834
}
78717835

7872-
// Comparison of TE and IHP - to be deleted
7873-
for (int i = 0; i < SteamEngines.Count; i++)
7874-
{
7875-
status.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\n",
7876-
Simulator.Catalog.GetString("ForceCom:"),
7877-
Simulator.Catalog.GetString("Eng#:"),
7878-
i + 1,
7879-
Simulator.Catalog.GetString("CompTE"),
7880-
FormatStrings.FormatForce(SteamEngines[i].CompareTractiveForceN, IsMetric),
7881-
Simulator.Catalog.GetString("CompIHP"),
7882-
FormatStrings.FormatPower(W.FromHp(SteamEngines[i].CompareIndicatedHorsePower), IsMetric, false, false)
7883-
);
7884-
}
7885-
7886-
78877836
status.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}\t{12}\n",
78887837
Simulator.Catalog.GetString("ForceTot:"),
78897838
Simulator.Catalog.GetString("TheorTE"),

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies/SteamEngine.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -361,16 +361,6 @@ public enum AuxiliarySteamEngineTypes
361361
/// </summary>
362362
public float DisplayTractiveForceN;
363363

364-
/// <summary>
365-
/// Steam Engine average tractive force
366-
/// </summary>
367-
public float CompareTractiveForceN;
368-
369-
/// <summary>
370-
/// Steam Engine average tractive force
371-
/// </summary>
372-
public float CompareIndicatedHorsePower;
373-
374364
/// <summary>
375365
/// Steam Engine maximum indicated horsepower
376366
/// </summary>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ public void Initialize()
247247
if (locomotive.EngineType == TrainCar.EngineTypes.Steam)
248248
{
249249
axle.WheelSlipThresholdTimeS = 0.1f;
250-
axle.WheelSlipWarningThresholdTimeS = 0.05f;
250+
axle.WheelSlipWarningThresholdTimeS = axle.WheelSlipThresholdTimeS * 0.75f;
251251
}
252-
else
252+
else // diesel and electric locomotives
253253
{
254254
axle.WheelSlipThresholdTimeS = 1;
255255
axle.WheelSlipWarningThresholdTimeS = 1;

0 commit comments

Comments
 (0)