Skip to content

Commit 6641105

Browse files
authored
Merge pull request #857 from SteelFill/air-flow-meter
Adding Air Flow Meters
2 parents 45d8b7f + 9afc8c3 commit 6641105

File tree

12 files changed

+202
-54
lines changed

12 files changed

+202
-54
lines changed

Source/Documentation/Manual/appendices.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ Voltage volt V
5858
Mass Flow g/h
5959
\ kg/h
6060
\ lb/h lb/h lb/h
61+
Volumetric Flow m^3/s air flow m^3/s
62+
meters
63+
\ ft^3/min
64+
\ L/min
65+
\ L/s
6166
Speed m/s other m/s m/s meter per second
6267
\ km/h
6368
\ kph kph kilometer per hour

Source/Documentation/Manual/cabs.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,37 @@ An example of implementation of the above controls in a .cvf file follows::
679679
)
680680

681681

682+
Air Flow Meter
683+
--------------
684+
685+
.. index::
686+
single: ORTS_AIR_FLOW_METER
687+
688+
This cabview control is used on some locomotives, particularly in North America, to show the
689+
volumetric flow rate of air moving from the main res to the brake pipe during release/recharge.
690+
Such an indication can be used to determine when brake pipe charging is complete,
691+
measure the amount of brake pipe leakage, and so on.
692+
The control will only function on locomotives with air brakes.
693+
694+
Here is an example implementation of ORTS_AIR_FLOW_METER as an analog dial::
695+
696+
697+
Dial (
698+
Type ( ORTS_AIR_FLOW_METER DIAL )
699+
Position ( 258 271 1 32 )
700+
Graphic ( "white_needle.ace" )
701+
Style ( NEEDLE )
702+
ScaleRange ( 0 150 )
703+
ScalePos ( 295 65 )
704+
Units ( CUBIC_FT_MIN )
705+
Pivot ( 24 )
706+
DirIncrease ( 0 )
707+
)
708+
709+
Applicable user-defined units are CUBIC_FT_MIN, LITERS_S, LITERS_MIN, and CUBIC_M_S. Cubic meters per
710+
second will be used if no units are specified.
711+
712+
682713
Animated 2D Wipers
683714
------------------
684715

Source/Documentation/Manual/driving.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,9 @@ The following information is displayed in the basic display:
767767
Train brake HUD line has two Brake Reservoir pressure numbers: the first is
768768
the Equalization Reservoir (EQ) and the second is the Brake Cylinder (BC)
769769
pressure. The two BP numbers report the brake pressure in the lead engine
770-
and in the last car of the train. The unit of measure used for brake
770+
and in the last car of the train. Additionally, the brake flow is shown,
771+
which measures the rate of air flowing into the brake pipe during release
772+
and recharge. The unit of measure used for brake
771773
pressure is defined by the option :ref:`Pressure unit <options-pressure>`.
772774
- Engine Brake = percentage of independent engine brake. Not fully
773775
releasing the engine brake will affect train brake pressures.

Source/ORTS.Common/Conversions.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,9 @@ public static class FormatStrings
549549
public static string psi = Catalog.GetString("psi");
550550
public static string inhg = Catalog.GetString("inHg");
551551
public static string kgfpcm2 = Catalog.GetString("kgf/cm²");
552+
public static string lps = Catalog.GetString("L/s");
553+
public static string lpm = Catalog.GetString("L/min");
554+
public static string cfm = Catalog.GetString("cfm");
552555
public static string kg = Catalog.GetString("kg");
553556
public static string t = Catalog.GetString("t");
554557
public static string tonUK = Catalog.GetString("t-uk");
@@ -814,6 +817,12 @@ public static string FormatPressure(float pressure, PressureUnit inputUnit, Pres
814817
return String.Format(CultureInfo.CurrentCulture, format, pressureOut);
815818
}
816819

820+
public static string FormatAirFlow(float flowM3pS, bool isMetric)
821+
{
822+
var flow = isMetric ? flowM3pS * 1000.0f : flowM3pS * 35.3147f * 60.0f;
823+
return String.Format(CultureInfo.CurrentCulture, "{0:F0} {1}", flow, isMetric ? lps : cfm);
824+
}
825+
817826
/// <summary>
818827
/// Converts duration in floating-point seconds to whole hours, minutes and seconds (rounded down).
819828
/// </summary>

Source/Orts.Formats.Msts/CabViewFile.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ public enum CABViewControlTypes
196196
ORTS_BAILOFF,
197197
ORTS_QUICKRELEASE,
198198
ORTS_OVERCHARGE,
199+
ORTS_AIR_FLOW_METER,
199200
ORTS_BATTERY_SWITCH_COMMAND_SWITCH,
200201
ORTS_BATTERY_SWITCH_COMMAND_BUTTON_CLOSE,
201202
ORTS_BATTERY_SWITCH_COMMAND_BUTTON_OPEN,
@@ -328,6 +329,7 @@ public enum CABViewControlUnits
328329
KILO_LBS,
329330
METRES_PER_SEC,
330331
LITRES,
332+
LITERS,
331333
GALLONS,
332334
INCHES_OF_MERCURY,
333335
MILI_AMPS,
@@ -338,7 +340,14 @@ public enum CABViewControlUnits
338340
METRES,
339341
MILES,
340342
FEET,
341-
YARDS
343+
YARDS,
344+
345+
CUBIC_FT_MIN,
346+
LITRES_MIN,
347+
LITERS_MIN,
348+
LITRES_S,
349+
LITERS_S,
350+
CUBIC_M_S
342351
}
343352

344353
public enum DiscreteStates

Source/Orts.Simulation/Simulation/RollingStocks/MSTSDieselLocomotive.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,11 +1159,11 @@ public string GetDpuStatus(bool dataDpu, CABViewControlUnits loadUnits = CABView
11591159
status.AppendFormat((data < 0 ? "???" : " ") + "\t");
11601160

11611161
// BP
1162-
var brakeInfoValue = brakeValue(Simulator.Catalog.GetString("BP"), Simulator.Catalog.GetString("EOT"));
1162+
var brakeInfoValue = brakeValue(Simulator.Catalog.GetString("BP"), Simulator.Catalog.GetString("Flow"));
1163+
status.AppendFormat("{0:F0}\t", brakeInfoValue);
1164+
// Air flow meter
1165+
brakeInfoValue = brakeValue(Simulator.Catalog.GetString("Flow"), Simulator.Catalog.GetString("EOT"));
11631166
status.AppendFormat("{0:F0}\t", brakeInfoValue);
1164-
1165-
// Flow.
1166-
// TODO:The BP air flow that feeds the brake tube is not yet modeled in Open Rails.
11671167

11681168
// Remote
11691169
if (dataDpu)
@@ -1261,6 +1261,7 @@ private static void SetDPULabels(bool dpuFull, int numberOfEngines)
12611261
labels.AppendFormat("{0}\t", Simulator.Catalog.GetString("Throttle"));
12621262
labels.AppendFormat("{0}\t", Simulator.Catalog.GetString("Load"));
12631263
labels.AppendFormat("{0}\t", Simulator.Catalog.GetString("BP"));
1264+
labels.AppendFormat("{0}\t", Simulator.Catalog.GetString("Flow"));
12641265
if (!dpuFull)
12651266
{
12661267
labels.AppendFormat("{0}", Simulator.Catalog.GetString("Remote"));

Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public enum SoundState
131131
public float MaxSpeedMpS = 1e3f;
132132
public float UnloadingSpeedMpS;
133133
public float MainResPressurePSI = 130;
134+
public float BrakePipeFlowM3pS;
134135
public float MaximumMainReservoirPipePressurePSI;
135136
public bool CompressorIsOn;
136137
public bool CompressorIsMechanical = false;
@@ -146,6 +147,9 @@ public enum SoundState
146147
public bool OnLineCabRadio;
147148
public string OnLineCabRadioURL;
148149

150+
public float FilteredBrakePipeFlowM3pS;
151+
public IIRFilter AFMFilter;
152+
149153
// Water trough filling
150154
public bool HasWaterScoop = false; // indicates whether loco + tender have a water scoop or not
151155
public float ScoopMaxPickupSpeedMpS = 200.0f; // Maximum scoop pickup speed - used in steam locomotive viewer
@@ -417,7 +421,7 @@ public float OdometerM
417421
protected const float DefaultMainResVolume = 0.78f; // Value to be inserted if .eng parameters are corrected
418422
protected const float DefaultMaxMainResPressure = 140; // Max value to be inserted if .eng parameters are corrected
419423

420-
public List<CabView> CabViewList = new List<CabView>();
424+
public List<CabView> CabViewList = new List<CabView>();
421425
public CabView3D CabView3D;
422426

423427
public MSTSNotchController SteamHeatController = new MSTSNotchController(0, 1, 0.1f);
@@ -482,6 +486,7 @@ public MSTSLocomotive(Simulator simulator, string wagPath)
482486
LocomotiveAxles.Add(new Axle());
483487
CurrentFilter = new IIRFilter(IIRFilter.FilterTypes.Butterworth, 1, IIRFilter.HzToRad(0.5f), 0.001f);
484488
AdhesionFilter = new IIRFilter(IIRFilter.FilterTypes.Butterworth, 1, IIRFilter.HzToRad(1f), 0.001f);
489+
AFMFilter = new IIRFilter(IIRFilter.FilterTypes.Butterworth, 1, IIRFilter.HzToRad(0.1f), 1.0f);
485490

486491
TrainBrakeController = new ScriptedBrakeController(this);
487492
EngineBrakeController = new ScriptedBrakeController(this);
@@ -5418,6 +5423,32 @@ public virtual float GetDataOf(CabViewControl cvc)
54185423
data = (TrainBrakeController == null || !TrainBrakeController.OverchargeButtonPressed) ? 0 : 1;
54195424
break;
54205425
}
5426+
case CABViewControlTypes.ORTS_AIR_FLOW_METER:
5427+
{
5428+
switch (cvc.Units)
5429+
{
5430+
case CABViewControlUnits.CUBIC_FT_MIN:
5431+
data = this.FilteredBrakePipeFlowM3pS * 35.3147f * 60.0f;
5432+
break;
5433+
5434+
case CABViewControlUnits.LITRES_S:
5435+
case CABViewControlUnits.LITERS_S:
5436+
data = this.FilteredBrakePipeFlowM3pS * 1000.0f;
5437+
break;
5438+
5439+
case CABViewControlUnits.LITRES_MIN:
5440+
case CABViewControlUnits.LITERS_MIN:
5441+
data = this.FilteredBrakePipeFlowM3pS * 1000.0f * 60.0f;
5442+
break;
5443+
5444+
case CABViewControlUnits.CUBIC_M_S:
5445+
default:
5446+
data = this.FilteredBrakePipeFlowM3pS;
5447+
break;
5448+
5449+
}
5450+
break;
5451+
}
54215452
case CABViewControlTypes.FRICTION_BRAKING:
54225453
{
54235454
data = (BrakeSystem == null) ? 0.0f : BrakeSystem.GetCylPressurePSI();
@@ -5541,7 +5572,6 @@ public virtual float GetDataOf(CabViewControl cvc)
55415572

55425573
}
55435574
}
5544-
55455575
}
55465576
else
55475577
{

0 commit comments

Comments
 (0)