Skip to content

Commit 632cf03

Browse files
committed
Add derail coefficient.
1 parent f4831e5 commit 632cf03

File tree

4 files changed

+165
-79
lines changed

4 files changed

+165
-79
lines changed

Source/Orts.Simulation/Simulation/Physics/Train.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2218,7 +2218,7 @@ public void UpdateCarSteamHeat(float elapsedClockSeconds)
22182218

22192219
// Calculate Length of carriage and heat loss in main steam pipe
22202220
float CarMainSteamPipeTempF = mstsLocomotive.SteamHeatPressureToTemperaturePSItoF[car.CarSteamHeatMainPipeSteamPressurePSI];
2221-
car.CarHeatSteamMainPipeHeatLossBTU = Me.ToFt(car.CarLengthM) * (MathHelper.Pi * Me.ToFt(car.MainSteamHeatPipeOuterDiaM)) * HeatTransCoeffMainPipeBTUpFt2pHrpF * (CarMainSteamPipeTempF - C.ToF(car.CarOutsideTempC));
2221+
car.CarHeatSteamMainPipeHeatLossBTU = Me.ToFt(car.CarLengthM) * (MathHelper.Pi * Me.ToFt(car.BodyPipeOverhangDistanceM)) * HeatTransCoeffMainPipeBTUpFt2pHrpF * (CarMainSteamPipeTempF - C.ToF(car.CarOutsideTempC));
22222222

22232223
// calculate steam connecting hoses heat loss - assume 1.5" hose
22242224
float ConnectSteamHoseOuterDiaFt = Me.ToFt(car.CarConnectSteamHoseOuterDiaM);

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

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ public class MSTSWagon : TrainCar
143143
public float WheelSpeedMpS;
144144
public float WheelSpeedSlipMpS; // speed of wheel if locomotive is slipping
145145
public float SlipWarningThresholdPercent = 70;
146-
public float NumWheelsBrakingFactor = 4; // MSTS braking factor loosely based on the number of braked wheels. Not used yet.
147146
public MSTSNotchController WeightLoadController; // Used to control freight loading in freight cars
148147
public float AbsWheelSpeedMpS; // Math.Abs(WheelSpeedMpS) is used frequently in the subclasses, maybe it's more efficient to compute it once
149148

@@ -473,6 +472,24 @@ public virtual void LoadFromWagFile(string wagFilePath)
473472
CentreOfGravityM = InitialCentreOfGravityM;
474473
IsDavisFriction = DavisAN != 0 && DavisBNSpM != 0 && DavisCNSSpMM != 0; // test to see if OR thinks that Davis Values have been entered in WG file.
475474

475+
// Initialise car body lengths. Assume overhang is 2.0m each end, and bogie centres are the car length minus this value
476+
477+
478+
if (CarCouplerFaceLengthM == 0)
479+
{
480+
CarCouplerFaceLengthM = CarLengthM;
481+
}
482+
483+
if (CarBodyLengthM == 0)
484+
{
485+
CarBodyLengthM = CarCouplerFaceLengthM - 0.8f;
486+
}
487+
488+
if (CarBogieCentreLengthM == 0)
489+
{
490+
CarBogieCentreLengthM = (CarCouplerFaceLengthM - 4.3f);
491+
}
492+
476493
if (FreightAnimations != null)
477494
{
478495
foreach (var ortsFreightAnim in FreightAnimations.Animations)
@@ -912,6 +929,9 @@ public virtual void Parse(string lowercasetoken, STFReader stf)
912929
CarLengthM = stf.ReadFloat(STFReader.UNITS.Distance, null);
913930
stf.SkipRestOfBlock();
914931
break;
932+
case "wagon(ortslengthbogiecentre": CarBogieCentreLengthM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); break;
933+
case "wagon(ortslengthcarbody": CarBodyLengthM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); break;
934+
case "wagon(ortslengthcouplerface": CarCouplerFaceLengthM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); break;
915935
case "wagon(ortstrackgauge":
916936
stf.MustMatch("(");
917937
TrackGaugeM = stf.ReadFloat(STFReader.UNITS.Distance, null);
@@ -949,7 +969,7 @@ public virtual void Parse(string lowercasetoken, STFReader stf)
949969
case "wagon(ortsheatingwindowderatingfactor": WindowDeratingFactor = stf.ReadFloatBlock(STFReader.UNITS.None, null); break;
950970
case "wagon(ortsheatingcompartmenttemperatureset": DesiredCompartmentTempSetpointC = stf.ReadFloatBlock(STFReader.UNITS.Temperature, null); break; // Temperature conversion is incorrect - to be checked!!!
951971
case "wagon(ortsheatingcompartmentpipeareafactor": CompartmentHeatingPipeAreaFactor = stf.ReadFloatBlock(STFReader.UNITS.None, null); break;
952-
case "wagon(ortsheatingtrainpipeouterdiameter": MainSteamHeatPipeOuterDiaM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); break;
972+
case "wagon(ortsheatingtrainpipeouterdiameter": BodyPipeOverhangDistanceM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); break;
953973
case "wagon(ortsheatingtrainpipeinnerdiameter": MainSteamHeatPipeInnerDiaM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); break;
954974
case "wagon(ortsheatingconnectinghoseinnerdiameter": CarConnectSteamHoseInnerDiaM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); break;
955975
case "wagon(ortsheatingconnectinghoseouterdiameter": CarConnectSteamHoseOuterDiaM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); break;
@@ -1188,7 +1208,9 @@ public virtual void Parse(string lowercasetoken, STFReader stf)
11881208
break;
11891209
case "wagon(inside": HasInsideView = true; ParseWagonInside(stf); break;
11901210
case "wagon(orts3dcab": Parse3DCab(stf); break;
1191-
case "wagon(numwheels": NumWheelsBrakingFactor = stf.ReadFloatBlock(STFReader.UNITS.None, 4.0f); break;
1211+
case "wagon(numwheels": WagonNumAxles = stf.ReadFloatBlock(STFReader.UNITS.None, 4.0f); break;
1212+
case "wagon(ortsnumaxles": WagonNumAxles = stf.ReadFloatBlock(STFReader.UNITS.None, 4.0f); break;
1213+
case "wagon(ortsnumbogies": WagonNumBogies = stf.ReadFloatBlock(STFReader.UNITS.None, 4.0f); break;
11921214
case "wagon(ortspantographs":
11931215
Pantographs.Parse(lowercasetoken, stf);
11941216
break;
@@ -1255,6 +1277,11 @@ public virtual void Copy(MSTSWagon copy)
12551277
InitialCentreOfGravityM = copy.InitialCentreOfGravityM;
12561278
UnbalancedSuperElevationM = copy.UnbalancedSuperElevationM;
12571279
RigidWheelBaseM = copy.RigidWheelBaseM;
1280+
WagonNumAxles = copy.WagonNumAxles;
1281+
WagonNumBogies = copy.WagonNumBogies;
1282+
CarBogieCentreLengthM = copy.CarBogieCentreLengthM;
1283+
CarBodyLengthM = copy.CarBodyLengthM;
1284+
CarCouplerFaceLengthM = copy.CarCouplerFaceLengthM;
12581285
AuxTenderWaterMassKG = copy.AuxTenderWaterMassKG;
12591286
MassKG = copy.MassKG;
12601287
InitialMassKG = copy.InitialMassKG;
@@ -1269,7 +1296,7 @@ public virtual void Copy(MSTSWagon copy)
12691296
WindowDeratingFactor = copy.WindowDeratingFactor;
12701297
DesiredCompartmentTempSetpointC = copy.DesiredCompartmentTempSetpointC;
12711298
CompartmentHeatingPipeAreaFactor = copy.CompartmentHeatingPipeAreaFactor;
1272-
MainSteamHeatPipeOuterDiaM = copy.MainSteamHeatPipeOuterDiaM;
1299+
BodyPipeOverhangDistanceM = copy.BodyPipeOverhangDistanceM;
12731300
MainSteamHeatPipeInnerDiaM = copy.MainSteamHeatPipeInnerDiaM;
12741301
CarConnectSteamHoseInnerDiaM = copy.CarConnectSteamHoseInnerDiaM;
12751302
CarConnectSteamHoseOuterDiaM = copy.CarConnectSteamHoseOuterDiaM;

0 commit comments

Comments
 (0)