@@ -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