@@ -143,7 +143,6 @@ public class MSTSWagon : TrainCar
143
143
public float WheelSpeedMpS ;
144
144
public float WheelSpeedSlipMpS ; // speed of wheel if locomotive is slipping
145
145
public float SlipWarningThresholdPercent = 70 ;
146
- public float NumWheelsBrakingFactor = 4 ; // MSTS braking factor loosely based on the number of braked wheels. Not used yet.
147
146
public MSTSNotchController WeightLoadController ; // Used to control freight loading in freight cars
148
147
public float AbsWheelSpeedMpS ; // Math.Abs(WheelSpeedMpS) is used frequently in the subclasses, maybe it's more efficient to compute it once
149
148
@@ -473,6 +472,24 @@ public virtual void LoadFromWagFile(string wagFilePath)
473
472
CentreOfGravityM = InitialCentreOfGravityM ;
474
473
IsDavisFriction = DavisAN != 0 && DavisBNSpM != 0 && DavisCNSSpMM != 0 ; // test to see if OR thinks that Davis Values have been entered in WG file.
475
474
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
+
476
493
if ( FreightAnimations != null )
477
494
{
478
495
foreach ( var ortsFreightAnim in FreightAnimations . Animations )
@@ -912,6 +929,9 @@ public virtual void Parse(string lowercasetoken, STFReader stf)
912
929
CarLengthM = stf . ReadFloat ( STFReader . UNITS . Distance , null ) ;
913
930
stf . SkipRestOfBlock ( ) ;
914
931
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 ;
915
935
case "wagon(ortstrackgauge" :
916
936
stf . MustMatch ( "(" ) ;
917
937
TrackGaugeM = stf . ReadFloat ( STFReader . UNITS . Distance , null ) ;
@@ -949,7 +969,7 @@ public virtual void Parse(string lowercasetoken, STFReader stf)
949
969
case "wagon(ortsheatingwindowderatingfactor" : WindowDeratingFactor = stf . ReadFloatBlock ( STFReader . UNITS . None , null ) ; break ;
950
970
case "wagon(ortsheatingcompartmenttemperatureset" : DesiredCompartmentTempSetpointC = stf . ReadFloatBlock ( STFReader . UNITS . Temperature , null ) ; break ; // Temperature conversion is incorrect - to be checked!!!
951
971
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 ;
953
973
case "wagon(ortsheatingtrainpipeinnerdiameter" : MainSteamHeatPipeInnerDiaM = stf . ReadFloatBlock ( STFReader . UNITS . Distance , null ) ; break ;
954
974
case "wagon(ortsheatingconnectinghoseinnerdiameter" : CarConnectSteamHoseInnerDiaM = stf . ReadFloatBlock ( STFReader . UNITS . Distance , null ) ; break ;
955
975
case "wagon(ortsheatingconnectinghoseouterdiameter" : CarConnectSteamHoseOuterDiaM = stf . ReadFloatBlock ( STFReader . UNITS . Distance , null ) ; break ;
@@ -1188,7 +1208,9 @@ public virtual void Parse(string lowercasetoken, STFReader stf)
1188
1208
break ;
1189
1209
case "wagon(inside" : HasInsideView = true ; ParseWagonInside ( stf ) ; break ;
1190
1210
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 ;
1192
1214
case "wagon(ortspantographs" :
1193
1215
Pantographs . Parse ( lowercasetoken , stf ) ;
1194
1216
break ;
@@ -1255,6 +1277,11 @@ public virtual void Copy(MSTSWagon copy)
1255
1277
InitialCentreOfGravityM = copy . InitialCentreOfGravityM ;
1256
1278
UnbalancedSuperElevationM = copy . UnbalancedSuperElevationM ;
1257
1279
RigidWheelBaseM = copy . RigidWheelBaseM ;
1280
+ WagonNumAxles = copy . WagonNumAxles ;
1281
+ WagonNumBogies = copy . WagonNumBogies ;
1282
+ CarBogieCentreLengthM = copy . CarBogieCentreLengthM ;
1283
+ CarBodyLengthM = copy . CarBodyLengthM ;
1284
+ CarCouplerFaceLengthM = copy . CarCouplerFaceLengthM ;
1258
1285
AuxTenderWaterMassKG = copy . AuxTenderWaterMassKG ;
1259
1286
MassKG = copy . MassKG ;
1260
1287
InitialMassKG = copy . InitialMassKG ;
@@ -1269,7 +1296,7 @@ public virtual void Copy(MSTSWagon copy)
1269
1296
WindowDeratingFactor = copy . WindowDeratingFactor ;
1270
1297
DesiredCompartmentTempSetpointC = copy . DesiredCompartmentTempSetpointC ;
1271
1298
CompartmentHeatingPipeAreaFactor = copy . CompartmentHeatingPipeAreaFactor ;
1272
- MainSteamHeatPipeOuterDiaM = copy . MainSteamHeatPipeOuterDiaM ;
1299
+ BodyPipeOverhangDistanceM = copy . BodyPipeOverhangDistanceM ;
1273
1300
MainSteamHeatPipeInnerDiaM = copy . MainSteamHeatPipeInnerDiaM ;
1274
1301
CarConnectSteamHoseInnerDiaM = copy . CarConnectSteamHoseInnerDiaM ;
1275
1302
CarConnectSteamHoseOuterDiaM = copy . CarConnectSteamHoseOuterDiaM ;
0 commit comments