コード例 #1
0
 // This overides the information for each individual wagon in the extended HUD
 public override string[] GetDebugStatus(Dictionary <BrakeSystemComponent, PressureUnit> units)
 {
     // display differently depending upon whether vacuum or air braked system
     if (Car.CarBrakeSystemType == "vacuum_piped")
     {
         return(new string[] {
             DebugType,
             string.Empty,
             FormatStrings.FormatPressure(Vac.FromPress(BrakeLine1PressurePSI), PressureUnit.InHg, PressureUnit.InHg, true),
             string.Empty,
             string.Empty, // Spacer because the state above needs 2 columns.
             HandbrakePercent > 0 ? string.Format("{0:F0}%", HandbrakePercent) : string.Empty,
             FrontBrakeHoseConnected ? "I" : "T",
             string.Format("A{0} B{1}", AngleCockAOpen ? "+" : "-", AngleCockBOpen ? "+" : "-"),
         });
     }
     else  // air braked by default
     {
         return(new string[] {
             DebugType,
             string.Empty,
             FormatStrings.FormatPressure(BrakeLine1PressurePSI, PressureUnit.PSI, units[BrakeSystemComponent.BrakePipe], true),
             string.Empty,
             string.Empty,
             string.Empty,
             string.Empty,
             string.Empty,
             string.Empty, // Spacer because the state above needs 2 columns.
             (Car as MSTSWagon).HandBrakePresent ? string.Format("{0:F0}%", HandbrakePercent) : string.Empty,
             FrontBrakeHoseConnected ? "I" : "T",
             string.Format("A{0} B{1}", AngleCockAOpen ? "+" : "-", AngleCockBOpen ? "+" : "-"),
             BleedOffValveOpen ? Simulator.Catalog.GetString("Open") : string.Empty,
         });
     }
 }
コード例 #2
0
        public override string GetDebugStatus()
        {
            var status = new StringBuilder(base.GetDebugStatus());

            if (DieselEngines.HasGearBox)
            {
                status.AppendFormat("\t{0} {1}", Simulator.Catalog.GetString("Gear"), DieselEngines[0].GearBox.CurrentGearIndex);
            }
            status.AppendFormat("\t{0} {1}\t\t{2}",
                                Simulator.Catalog.GetString("Fuel"),
                                FormatStrings.FormatFuelVolume(DieselLevelL, IsMetric, IsUK), DieselEngines.GetStatus());

            if (IsSteamHeatFitted && TrainFittedSteamHeat && this.IsLeadLocomotive() && Train.PassengerCarsNumber > 0)
            {
                // Only show steam heating HUD if fitted to locomotive and the train, has passenger cars attached, and is the lead locomotive
                // Display Steam Heat info
                status.AppendFormat("\n{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10:N0}\t{11}\t{12}\n",
                                    Simulator.Catalog.GetString("StHeat:"),
                                    Simulator.Catalog.GetString("Press"),
                                    FormatStrings.FormatPressure(CurrentSteamHeatPressurePSI, PressureUnit.PSI, MainPressureUnit, true),
                                    Simulator.Catalog.GetString("TrTemp"),
                                    FormatStrings.FormatTemperature(Train.TrainCurrentCarriageHeatTempC, IsMetric, false),
                                    Simulator.Catalog.GetString("StTemp"),
                                    FormatStrings.FormatTemperature(Train.TrainCurrentSteamHeatPipeTempC, IsMetric, false),
                                    Simulator.Catalog.GetString("OutTemp"),
                                    FormatStrings.FormatTemperature(Train.TrainOutsideTempC, IsMetric, false),
                                    Simulator.Catalog.GetString("NetHt"),
                                    Train.DisplayTrainNetSteamHeatLossWpTime,
                                    Simulator.Catalog.GetString("FuelLvl"),
                                    CurrentSteamHeatFuelCapacityL);
            }


            return(status.ToString());
        }
コード例 #3
0
 public override string GetFullStatus(BrakeSystem lastCarBrakeSystem, Dictionary <BrakeSystemComponent, PressureUnit> units)
 {
     // display differently depending upon whether vacuum or air braked system
     if (Car.CarBrakeSystemType == "vacuum_piped")
     {
         var s = $" {Simulator.Catalog.GetString("V")} {FormatStrings.FormatPressure(Car.Train.EqualReservoirPressurePSIorInHg, PressureUnit.InHg, PressureUnit.InHg, true)}";
         if (lastCarBrakeSystem != null && lastCarBrakeSystem != this)
         {
             s += $" {Simulator.Catalog.GetString("EOT")} {lastCarBrakeSystem.GetStatus(units)}";
         }
         if (HandbrakePercent > 0)
         {
             s += $" {Simulator.Catalog.GetString("Handbrake")} {HandbrakePercent:F0}%";
         }
         return(s);
     }
     else // air braked by default
     {
         var s = $"{Simulator.Catalog.GetString("BP")} {FormatStrings.FormatPressure(BrakeLine1PressurePSI, PressureUnit.PSI, units[BrakeSystemComponent.BrakePipe], false)}";
         if (lastCarBrakeSystem != null && lastCarBrakeSystem != this)
         {
             s += $" {Simulator.Catalog.GetString("EOT")} {lastCarBrakeSystem.GetStatus(units)}";
         }
         if (HandbrakePercent > 0)
         {
             s += $" {Simulator.Catalog.GetString("Handbrake")} {HandbrakePercent:F0}%";
         }
         return(s);
     }
 }
コード例 #4
0
 public override string GetFullStatus(BrakeSystem lastCarBrakeSystem, Dictionary <BrakeSystemComponent, Pressure.Unit> units)
 {
     // display differently depending upon whether vacuum or air braked system
     if (Car.CarBrakeSystemType == "vacuum_piped")
     {
         string s = string.Format(" V {0}", FormatStrings.FormatPressure(Car.Train.EqualReservoirPressurePSIorInHg, Pressure.Unit.InHg, Pressure.Unit.InHg, true));
         if (lastCarBrakeSystem != null && lastCarBrakeSystem != this)
         {
             s += " EOT " + lastCarBrakeSystem.GetStatus(units);
         }
         if (HandbrakePercent > 0)
         {
             s += string.Format(" Handbrake {0:F0}%", HandbrakePercent);
         }
         return(s);
     }
     else // air braked by default
     {
         var s = string.Format("BP {0}", FormatStrings.FormatPressure(BrakeLine1PressurePSI, Pressure.Unit.PSI, units[BrakeSystemComponent.BrakePipe], false));
         if (lastCarBrakeSystem != null && lastCarBrakeSystem != this)
         {
             s += " EOT " + lastCarBrakeSystem.GetStatus(units);
         }
         if (HandbrakePercent > 0)
         {
             s += string.Format(" Handbrake {0:F0}%", HandbrakePercent);
         }
         return(s);
     }
 }
コード例 #5
0
        // This overides the information for each individual wagon in the extended HUD
        public override string[] GetDebugStatus(Dictionary <BrakeSystemComponent, PressureUnit> units)
        {
            // display differently depending upon whether manual brake is present or not

            if ((Car as MSTSWagon).ManualBrakePresent && LocomotiveSteamBrakeFitted)
            {
                return(new string[] {
                    DebugType,
                    string.Format("{0:F0}", FormatStrings.FormatPressure(SteamBrakeCylinderPressurePSI, PressureUnit.PSI, PressureUnit.PSI, true)),
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty, // Spacer because the state above needs 2 columns.
                    (Car as MSTSWagon).HandBrakePresent ? string.Format("{0:F0}%", HandbrakePercent) : string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                });
            }
            else if ((Car as MSTSWagon).ManualBrakePresent) // Just manual brakes fitted
            {
                return(new string[] {
                    DebugType,
                    string.Format("{0:F0} %", ManualBrakingCurrentFraction),
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty, // Spacer because the state above needs 2 columns.
                    (Car as MSTSWagon).HandBrakePresent ? string.Format("{0:F0}%", HandbrakePercent) : string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                });
            }
            else
            {
                return(new string[] {
                    DebugType,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty, // Spacer because the state above needs 2 columns.
                    (Car as MSTSWagon).HandBrakePresent ? string.Format("{0:F0}%", HandbrakePercent) : string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                });
            }
        }
コード例 #6
0
        public override string GetFullStatus(BrakeSystem lastCarBrakeSystem, Dictionary <BrakeSystemComponent, PressureUnit> units)
        {
            string s = string.Format(" BC {0}", FormatStrings.FormatPressure(CylPressurePSI, PressureUnit.PSI, units[BrakeSystemComponent.BrakeCylinder], true));

            if (HandbrakePercent > 0)
            {
                s += string.Format(" Handbrake {0:F0}%", HandbrakePercent);
            }
            return(s);
        }
コード例 #7
0
        public override string GetFullStatus(BrakeSystem lastCarBrakeSystem, Dictionary <BrakeSystemComponent, PressureUnit> units)
        {
            var s = $" {Simulator.Catalog.GetString("BC")} {FormatStrings.FormatPressure(CylPressurePSI, PressureUnit.PSI, units[BrakeSystemComponent.BrakeCylinder], true)}";

            if (HandbrakePercent > 0)
            {
                s += $" {Simulator.Catalog.GetString("Handbrake")} {HandbrakePercent:F0}%";
            }
            return(s);
        }
コード例 #8
0
 public override string GetStatus(Dictionary <BrakeSystemComponent, Pressure.Unit> units)
 {
     // display differently depending upon whether vacuum or air braked system
     if (Car.CarBrakeSystemType == "vacuum_piped")
     {
         return(string.Format(" BP {0}", FormatStrings.FormatPressure(Pressure.Vacuum.FromPressure(BrakeLine1PressurePSI), Pressure.Unit.InHg, Pressure.Unit.InHg, false)));
     }
     else  // air braked by default
     {
         return(string.Format("BP {0}", FormatStrings.FormatPressure(BrakeLine1PressurePSI, Pressure.Unit.PSI, units[BrakeSystemComponent.BrakePipe], true)));
     }
 }
コード例 #9
0
 public override string GetStatus(Dictionary <BrakeSystemComponent, PressureUnit> units)
 {
     // display differently depending upon whether vacuum or air braked system
     if (Car.CarBrakeSystemType == "vacuum_piped")
     {
         return($" {Simulator.Catalog.GetString("BP")} {FormatStrings.FormatPressure(Vac.FromPress(BrakeLine1PressurePSI), PressureUnit.InHg, PressureUnit.InHg, false)}");
     }
     else  // air braked by default
     {
         return($"{Simulator.Catalog.GetString("BP")} {FormatStrings.FormatPressure(BrakeLine1PressurePSI, PressureUnit.PSI, units[BrakeSystemComponent.BrakePipe], true)}");
     }
 }
コード例 #10
0
        public override string GetFullStatus(BrakeSystem lastCarBrakeSystem, Dictionary <BrakeSystemComponent, PressureUnit> units)
        {
            var s = string.Format("BP {0}", FormatStrings.FormatPressure(BrakeLine1PressurePSI, PressureUnit.PSI, units[BrakeSystemComponent.BrakePipe], false));

            if (lastCarBrakeSystem != null && lastCarBrakeSystem != this)
            {
                s += " EOT " + lastCarBrakeSystem.GetStatus(units);
            }
            if (HandbrakePercent > 0)
            {
                s += string.Format(" Handbrake {0:F0}%", HandbrakePercent);
            }
            return(s);
        }
コード例 #11
0
ファイル: VacuumSinglePipe.cs プロジェクト: robwor/openrails
        public override string GetFullStatus(BrakeSystem lastCarBrakeSystem, Dictionary <BrakeSystemComponent, PressureUnit> units)
        {
            string s = string.Format(" V {0}", FormatStrings.FormatPressure(Car.Train.EqualReservoirPressurePSIorInHg, PressureUnit.InHg, PressureUnit.InHg, true));

            if (lastCarBrakeSystem != null && lastCarBrakeSystem != this)
            {
                s += " EOT " + lastCarBrakeSystem.GetStatus(units);
            }
            if (HandbrakePercent > 0)
            {
                s += string.Format(" Handbrake {0:F0}%", HandbrakePercent);
            }
            return(s);
        }
コード例 #12
0
        public string GetStatus()
        {
            var result = new StringBuilder();

            result.AppendFormat(Simulator.Catalog.GetString("Status"));
            foreach (var eng in DEList)
            {
                result.AppendFormat("\t{0}", Simulator.Catalog.GetString(GetStringAttribute.GetPrettyName(eng.EngineStatus)));
            }

            result.AppendFormat("\t{0}\t{1}", Simulator.Catalog.GetParticularString("HUD", "Power"), FormatStrings.FormatPower(MaxOutputPowerW, Locomotive.IsMetric, false, false));
            foreach (var eng in DEList)
            {
                result.AppendFormat("\t{0}", FormatStrings.FormatPower(eng.MaxOutputPowerW, Locomotive.IsMetric, false, false));
            }

            result.AppendFormat("\t{0}", Simulator.Catalog.GetString("Load"));
            foreach (var eng in DEList)
            {
                result.AppendFormat("\t{0:F1}%", eng.LoadPercent);
            }

            foreach (var eng in DEList)
            {
                result.AppendFormat("\t{0:F0} {1}", eng.RealRPM, FormatStrings.rpm);
            }

            result.AppendFormat("\t{0}", Simulator.Catalog.GetString("Flow"));
            foreach (var eng in DEList)
            {
                result.AppendFormat("\t{0}/{1}", FormatStrings.FormatFuelVolume(pS.TopH(eng.DieselFlowLps), Locomotive.IsMetric, Locomotive.IsUK), FormatStrings.h);
            }

            result.Append("\t");
            foreach (var eng in DEList)
            {
                result.AppendFormat("\t{0}", FormatStrings.FormatTemperature(eng.DieselTemperatureDeg, Locomotive.IsMetric, false));
            }

            result.AppendFormat("\t{0}", Simulator.Catalog.GetString("Oil"));
            foreach (var eng in DEList)
            {
                result.AppendFormat("\t{0}", FormatStrings.FormatPressure(eng.DieselOilPressurePSI, PressureUnit.PSI, Locomotive.MainPressureUnit, true));
            }

            return(result.ToString());
        }
コード例 #13
0
ファイル: VacuumSinglePipe.cs プロジェクト: robwor/openrails
 public override string[] GetDebugStatus(Dictionary <BrakeSystemComponent, PressureUnit> units)
 {
     return(new string[] {
         "1V",
         FormatStrings.FormatPressure(P2V(CylPressurePSIA), PressureUnit.InHg, PressureUnit.InHg, true),
         FormatStrings.FormatPressure(P2V(BrakeLine1PressurePSI), PressureUnit.InHg, PressureUnit.InHg, true),
         FormatStrings.FormatPressure(P2V(VacResPressureAdjPSIA()), PressureUnit.InHg, PressureUnit.InHg, true),
         string.Empty,
         string.Empty,
         string.Empty,
         string.Empty,
         string.Empty,
         HandbrakePercent > 0 ? string.Format("{0:F0}%", HandbrakePercent) : string.Empty,
         FrontBrakeHoseConnected ? "I" : "T",
         string.Format("A{0} B{1}", AngleCockAOpen ? "+" : "-", AngleCockBOpen ? "+" : "-"),
     });
 }
コード例 #14
0
        public void FormattedStrings()
        {
            // Note: Only pressure is tested at the moment, mainly because of its complexity.

            Assert.AreEqual(string.Empty, FormatStrings.FormatPressure(1.2f, Pressure.Unit.None, Pressure.Unit.KPa, true));
            Assert.AreEqual(string.Empty, FormatStrings.FormatPressure(1.2f, Pressure.Unit.KPa, Pressure.Unit.None, true));

            Assert.AreEqual("1 kPa", FormatStrings.FormatPressure(1.2f, Pressure.Unit.KPa, Pressure.Unit.KPa, true));
            Assert.AreEqual("1 kPa", FormatStrings.FormatPressure(Pressure.Standard.ToBar(1.2f), Pressure.Unit.Bar, Pressure.Unit.KPa, true));
            Assert.AreEqual("1 kPa", FormatStrings.FormatPressure(Pressure.Standard.ToInHg(1.2f), Pressure.Unit.InHg, Pressure.Unit.KPa, true));
            Assert.AreEqual("1 kPa", FormatStrings.FormatPressure(Pressure.Standard.ToKgfpCm2(1.2f), Pressure.Unit.KgfpCm2, Pressure.Unit.KPa, true));
            Assert.AreEqual("1 kPa", FormatStrings.FormatPressure(Pressure.Standard.ToPSI(1.2f), Pressure.Unit.PSI, Pressure.Unit.KPa, true));

            var barResult = string.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:F1} bar", 1.2f);

            Assert.AreEqual(barResult, FormatStrings.FormatPressure(Pressure.Atmospheric.ToKPa(1.2f), Pressure.Unit.KPa, Pressure.Unit.Bar, true));
            Assert.AreEqual(barResult, FormatStrings.FormatPressure(1.2f, Pressure.Unit.Bar, Pressure.Unit.Bar, true));
            Assert.AreEqual(barResult, FormatStrings.FormatPressure(Pressure.Atmospheric.ToInHg(1.2f), Pressure.Unit.InHg, Pressure.Unit.Bar, true));
            Assert.AreEqual(barResult, FormatStrings.FormatPressure(Pressure.Atmospheric.ToKgfpCm2(1.2f), Pressure.Unit.KgfpCm2, Pressure.Unit.Bar, true));
            Assert.AreEqual(barResult, FormatStrings.FormatPressure(Pressure.Atmospheric.ToPSI(1.2f), Pressure.Unit.PSI, Pressure.Unit.Bar, true));

            var psiResult = string.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:F0} psi", 1.2f);

            Assert.AreEqual(psiResult, FormatStrings.FormatPressure(Pressure.Standard.FromPSI(1.2f), Pressure.Unit.KPa, Pressure.Unit.PSI, true));
            Assert.AreEqual(psiResult, FormatStrings.FormatPressure(Pressure.Standard.ToBar(Pressure.Standard.FromPSI(1.2f)), Pressure.Unit.Bar, Pressure.Unit.PSI, true));
            Assert.AreEqual(psiResult, FormatStrings.FormatPressure(Pressure.Standard.ToInHg(Pressure.Standard.FromPSI(1.2f)), Pressure.Unit.InHg, Pressure.Unit.PSI, true));
            Assert.AreEqual(psiResult, FormatStrings.FormatPressure(Pressure.Standard.ToKgfpCm2(Pressure.Standard.FromPSI(1.2f)), Pressure.Unit.KgfpCm2, Pressure.Unit.PSI, true));
            Assert.AreEqual(psiResult, FormatStrings.FormatPressure(Pressure.Standard.ToPSI(Pressure.Standard.FromPSI(1.2f)), Pressure.Unit.PSI, Pressure.Unit.PSI, true));

            var inhgResult = string.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:F0} inHg", 1.2f);

            Assert.AreEqual(inhgResult, FormatStrings.FormatPressure(Pressure.Standard.FromInHg(1.2f), Pressure.Unit.KPa, Pressure.Unit.InHg, true));
            Assert.AreEqual(inhgResult, FormatStrings.FormatPressure(Pressure.Standard.ToBar(Pressure.Standard.FromInHg(1.2f)), Pressure.Unit.Bar, Pressure.Unit.InHg, true));
            Assert.AreEqual(inhgResult, FormatStrings.FormatPressure(Pressure.Standard.ToInHg(Pressure.Standard.FromInHg(1.2f)), Pressure.Unit.InHg, Pressure.Unit.InHg, true));
            Assert.AreEqual(inhgResult, FormatStrings.FormatPressure(Pressure.Standard.ToKgfpCm2(Pressure.Standard.FromInHg(1.2f)), Pressure.Unit.KgfpCm2, Pressure.Unit.InHg, true));
            Assert.AreEqual(inhgResult, FormatStrings.FormatPressure(Pressure.Standard.ToPSI(Pressure.Standard.FromInHg(1.2f)), Pressure.Unit.PSI, Pressure.Unit.InHg, true));

            var kgfResult = string.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:F1} " + FormatStrings.kgfpcm2, 1.2f);

            Assert.AreEqual(kgfResult, FormatStrings.FormatPressure(Pressure.Standard.FromKgfpCm2(1.2f), Pressure.Unit.KPa, Pressure.Unit.KgfpCm2, true));
            Assert.AreEqual(kgfResult, FormatStrings.FormatPressure(Pressure.Standard.ToBar(Pressure.Standard.FromKgfpCm2(1.2f)), Pressure.Unit.Bar, Pressure.Unit.KgfpCm2, true));
            Assert.AreEqual(kgfResult, FormatStrings.FormatPressure(Pressure.Standard.ToInHg(Pressure.Standard.FromKgfpCm2(1.2f)), Pressure.Unit.InHg, Pressure.Unit.KgfpCm2, true));
            Assert.AreEqual(kgfResult, FormatStrings.FormatPressure(Pressure.Standard.ToKgfpCm2(Pressure.Standard.FromKgfpCm2(1.2f)), Pressure.Unit.KgfpCm2, Pressure.Unit.KgfpCm2, true));
            Assert.AreEqual(kgfResult, FormatStrings.FormatPressure(Pressure.Standard.ToPSI(Pressure.Standard.FromKgfpCm2(1.2f)), Pressure.Unit.PSI, Pressure.Unit.KgfpCm2, true));
        }
コード例 #15
0
ファイル: Conversions.cs プロジェクト: xiaomailong/OpenRails
        public static void FormattedStrings()
        {
            // Note: Only pressure is tested at the moment, mainly because of its complexity.

            Assert.Equal(String.Empty, FormatStrings.FormatPressure(1.2f, PressureUnit.None, PressureUnit.KPa, true));
            Assert.Equal(String.Empty, FormatStrings.FormatPressure(1.2f, PressureUnit.KPa, PressureUnit.None, true));

            Assert.Equal("1 kPa", FormatStrings.FormatPressure(1.2f, PressureUnit.KPa, PressureUnit.KPa, true));
            Assert.Equal("1 kPa", FormatStrings.FormatPressure(KPa.ToBar(1.2f), PressureUnit.Bar, PressureUnit.KPa, true));
            Assert.Equal("1 kPa", FormatStrings.FormatPressure(KPa.ToInHg(1.2f), PressureUnit.InHg, PressureUnit.KPa, true));
            Assert.Equal("1 kPa", FormatStrings.FormatPressure(KPa.ToKgfpCm2(1.2f), PressureUnit.KgfpCm2, PressureUnit.KPa, true));
            Assert.Equal("1 kPa", FormatStrings.FormatPressure(KPa.ToPSI(1.2f), PressureUnit.PSI, PressureUnit.KPa, true));

            var barResult = string.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:F1} bar", 1.2f);

            Assert.Equal(barResult, FormatStrings.FormatPressure(Bar.ToKPa(1.2f), PressureUnit.KPa, PressureUnit.Bar, true));
            Assert.Equal(barResult, FormatStrings.FormatPressure(1.2f, PressureUnit.Bar, PressureUnit.Bar, true));
            Assert.Equal(barResult, FormatStrings.FormatPressure(Bar.ToInHg(1.2f), PressureUnit.InHg, PressureUnit.Bar, true));
            Assert.Equal(barResult, FormatStrings.FormatPressure(Bar.ToKgfpCm2(1.2f), PressureUnit.KgfpCm2, PressureUnit.Bar, true));
            Assert.Equal(barResult, FormatStrings.FormatPressure(Bar.ToPSI(1.2f), PressureUnit.PSI, PressureUnit.Bar, true));

            var psiResult = string.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:F0} psi", 1.2f);

            Assert.Equal(psiResult, FormatStrings.FormatPressure(KPa.FromPSI(1.2f), PressureUnit.KPa, PressureUnit.PSI, true));
            Assert.Equal(psiResult, FormatStrings.FormatPressure(KPa.ToBar(KPa.FromPSI(1.2f)), PressureUnit.Bar, PressureUnit.PSI, true));
            Assert.Equal(psiResult, FormatStrings.FormatPressure(KPa.ToInHg(KPa.FromPSI(1.2f)), PressureUnit.InHg, PressureUnit.PSI, true));
            Assert.Equal(psiResult, FormatStrings.FormatPressure(KPa.ToKgfpCm2(KPa.FromPSI(1.2f)), PressureUnit.KgfpCm2, PressureUnit.PSI, true));
            Assert.Equal(psiResult, FormatStrings.FormatPressure(KPa.ToPSI(KPa.FromPSI(1.2f)), PressureUnit.PSI, PressureUnit.PSI, true));

            var inhgResult = string.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:F0} inHg", 1.2f);

            Assert.Equal(inhgResult, FormatStrings.FormatPressure(KPa.FromInHg(1.2f), PressureUnit.KPa, PressureUnit.InHg, true));
            Assert.Equal(inhgResult, FormatStrings.FormatPressure(KPa.ToBar(KPa.FromInHg(1.2f)), PressureUnit.Bar, PressureUnit.InHg, true));
            Assert.Equal(inhgResult, FormatStrings.FormatPressure(KPa.ToInHg(KPa.FromInHg(1.2f)), PressureUnit.InHg, PressureUnit.InHg, true));
            Assert.Equal(inhgResult, FormatStrings.FormatPressure(KPa.ToKgfpCm2(KPa.FromInHg(1.2f)), PressureUnit.KgfpCm2, PressureUnit.InHg, true));
            Assert.Equal(inhgResult, FormatStrings.FormatPressure(KPa.ToPSI(KPa.FromInHg(1.2f)), PressureUnit.PSI, PressureUnit.InHg, true));

            var kgfResult = string.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:F1} kgf/cm^2", 1.2f);

            Assert.Equal(kgfResult, FormatStrings.FormatPressure(KPa.FromKgfpCm2(1.2f), PressureUnit.KPa, PressureUnit.KgfpCm2, true));
            Assert.Equal(kgfResult, FormatStrings.FormatPressure(KPa.ToBar(KPa.FromKgfpCm2(1.2f)), PressureUnit.Bar, PressureUnit.KgfpCm2, true));
            Assert.Equal(kgfResult, FormatStrings.FormatPressure(KPa.ToInHg(KPa.FromKgfpCm2(1.2f)), PressureUnit.InHg, PressureUnit.KgfpCm2, true));
            Assert.Equal(kgfResult, FormatStrings.FormatPressure(KPa.ToKgfpCm2(KPa.FromKgfpCm2(1.2f)), PressureUnit.KgfpCm2, PressureUnit.KgfpCm2, true));
            Assert.Equal(kgfResult, FormatStrings.FormatPressure(KPa.ToPSI(KPa.FromKgfpCm2(1.2f)), PressureUnit.PSI, PressureUnit.KgfpCm2, true));
        }
コード例 #16
0
 public override string[] GetDebugStatus(Dictionary <BrakeSystemComponent, PressureUnit> units)
 {
     return(new string[] {
         DebugType,
         this is SingleTransferPipe ? string.Empty : FormatStrings.FormatPressure(CylPressurePSI, PressureUnit.PSI, units[BrakeSystemComponent.BrakeCylinder], true),
         FormatStrings.FormatPressure(BrakeLine1PressurePSI, PressureUnit.PSI, units[BrakeSystemComponent.BrakePipe], true),
         this is SingleTransferPipe ? string.Empty : FormatStrings.FormatPressure(AuxResPressurePSI, PressureUnit.PSI, units[BrakeSystemComponent.AuxiliaryReservoir], true),
         (Car as MSTSWagon).EmergencyReservoirPresent ? FormatStrings.FormatPressure(EmergResPressurePSI, PressureUnit.PSI, units[BrakeSystemComponent.EmergencyReservoir], true) : string.Empty,
         TwoPipes ? FormatStrings.FormatPressure(BrakeLine2PressurePSI, PressureUnit.PSI, units[BrakeSystemComponent.MainPipe], true) : string.Empty,
         (Car as MSTSWagon).RetainerPositions == 0 ? string.Empty : RetainerDebugState,
         this is SingleTransferPipe ? string.Empty : Simulator.Catalog.GetString(GetStringAttribute.GetPrettyName(TripleValveState)),
         string.Empty, // Spacer because the state above needs 2 columns.
         (Car as MSTSWagon).HandBrakePresent ? string.Format("{0:F0}%", HandbrakePercent) : string.Empty,
         FrontBrakeHoseConnected ? "I" : "T",
         string.Format("A{0} B{1}", AngleCockAOpen ? "+" : "-", AngleCockBOpen ? "+" : "-"),
         BleedOffValveOpen ? Simulator.Catalog.GetString("Open") : string.Empty,
     });
 }
コード例 #17
0
        public override string GetFullStatus(BrakeSystem lastCarBrakeSystem, Dictionary <BrakeSystemComponent, PressureUnit> units)
        {
            string s = string.Format(" EQ {0}", FormatStrings.FormatPressure(Car.Train.BrakeLine1PressurePSIorInHg, PressureUnit.PSI, units[BrakeSystemComponent.EqualizingReservoir], true));

            s += string.Format(
                " BC {0} BP {1}",
                FormatStrings.FormatPressure(CylPressurePSI, PressureUnit.PSI, units[BrakeSystemComponent.BrakeCylinder], true),
                FormatStrings.FormatPressure(BrakeLine1PressurePSI, PressureUnit.PSI, units[BrakeSystemComponent.BrakePipe], true)
                );
            if (lastCarBrakeSystem != null && lastCarBrakeSystem != this)
            {
                s += " EOT " + lastCarBrakeSystem.GetStatus(units);
            }
            if (HandbrakePercent > 0)
            {
                s += string.Format(" Handbrake {0:F0}%", HandbrakePercent);
            }
            return(s);
        }
コード例 #18
0
        // This overides the information for each individual wagon in the extended HUD
        public override string[] GetDebugStatus(Dictionary <BrakeSystemComponent, PressureUnit> units)
        {
            if (!(Car as MSTSWagon).NonAutoBrakePresent)
            {
                // display as a automatic vacuum brake

                return(new string[] {
                    "1V",
                    FormatStrings.FormatPressure(Vac.FromPress(CylPressurePSIA), PressureUnit.InHg, PressureUnit.InHg, true),
                    FormatStrings.FormatPressure(Vac.FromPress(BrakeLine1PressurePSI), PressureUnit.InHg, PressureUnit.InHg, true),
                    FormatStrings.FormatPressure(Vac.FromPress(VacResPressureAdjPSIA()), PressureUnit.InHg, PressureUnit.InHg, true),
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    HandbrakePercent > 0 ? string.Format("{0:F0}%", HandbrakePercent) : string.Empty,
                    FrontBrakeHoseConnected? "I" : "T",
                    string.Format("A{0} B{1}", AngleCockAOpen? "+" : "-", AngleCockBOpen? "+" : "-"),
                });
            }
            else
            {
                // display as a straight vacuum brake

                return(new string[] {
                    "1VS",
                    FormatStrings.FormatPressure(Vac.FromPress(CylPressurePSIA), PressureUnit.InHg, PressureUnit.InHg, true),
                    FormatStrings.FormatPressure(Vac.FromPress(BrakeLine1PressurePSI), PressureUnit.InHg, PressureUnit.InHg, true),
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    HandbrakePercent > 0 ? string.Format("{0:F0}%", HandbrakePercent) : string.Empty,
                    FrontBrakeHoseConnected? "I" : "T",
                    string.Format("A{0} B{1}", AngleCockAOpen? "+" : "-", AngleCockBOpen? "+" : "-"),
                });
            }
        }
コード例 #19
0
        public override string GetDebugStatus()
        {
            var status = new StringBuilder(base.GetDebugStatus());

            status.AppendFormat("\t{0}\t\t{1}", Simulator.Catalog.GetString("Circuit breaker"), Simulator.Catalog.GetParticularString("CircuitBreaker", GetStringAttribute.GetPrettyName(ElectricPowerSupply.CircuitBreaker.State)));
            status.AppendFormat("\t{0}\t{1}", Simulator.Catalog.GetString("TCS"), ElectricPowerSupply.CircuitBreaker.TCSClosingAuthorization ? Simulator.Catalog.GetString("OK") : Simulator.Catalog.GetString("NOT OK"));
            status.AppendFormat("\t{0}\t{1}", Simulator.Catalog.GetString("Driver"), ElectricPowerSupply.CircuitBreaker.DriverClosingAuthorization ? Simulator.Catalog.GetString("OK") : Simulator.Catalog.GetString("NOT OK"));
            status.AppendFormat("\t{0}\t\t{1}\n", Simulator.Catalog.GetString("Auxiliary power"), Simulator.Catalog.GetParticularString("PowerSupply", GetStringAttribute.GetPrettyName(LocomotivePowerSupply.AuxiliaryPowerSupplyState)));

            if (IsSteamHeatFitted && Train.PassengerCarsNumber > 0 && this.IsLeadLocomotive() && Train.CarSteamHeatOn)
            {
                // Only show steam heating HUD if fitted to locomotive and the train, has passenger cars attached, and is the lead locomotive
                // Display Steam Heat info
                status.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}/{7}\t{8}\t{9}\t{10}\t{11}\t{12}\t{13}\t{14}\t{15}\t{16}\t{17}\t{18:N0}\n",
                                    Simulator.Catalog.GetString("StHeat:"),
                                    Simulator.Catalog.GetString("Press"),
                                    FormatStrings.FormatPressure(CurrentSteamHeatPressurePSI, PressureUnit.PSI, MainPressureUnit, true),
                                    Simulator.Catalog.GetString("StTemp"),
                                    FormatStrings.FormatTemperature(C.FromF(SteamHeatPressureToTemperaturePSItoF[CurrentSteamHeatPressurePSI]), IsMetric, false),
                                    Simulator.Catalog.GetString("StUse"),
                                    FormatStrings.FormatMass(pS.TopH(Kg.FromLb(CalculatedCarHeaterSteamUsageLBpS)), IsMetric),
                                    FormatStrings.h,
                                    Simulator.Catalog.GetString("WaterLvl"),
                                    FormatStrings.FormatFuelVolume(CurrentLocomotiveSteamHeatBoilerWaterCapacityL, IsMetric, IsUK),
                                    Simulator.Catalog.GetString("Last:"),
                                    Simulator.Catalog.GetString("Press"),
                                    FormatStrings.FormatPressure(Train.LastCar.CarSteamHeatMainPipeSteamPressurePSI, PressureUnit.PSI, MainPressureUnit, true),
                                    Simulator.Catalog.GetString("Temp"),
                                    FormatStrings.FormatTemperature(Train.LastCar.CarInsideTempC, IsMetric, false),
                                    Simulator.Catalog.GetString("OutTemp"),
                                    FormatStrings.FormatTemperature(CarOutsideTempC, IsMetric, false),
                                    Simulator.Catalog.GetString("NetHt"),
                                    Train.LastCar.CarNetHeatFlowRateW);
            }

            return(status.ToString());
        }
コード例 #20
0
        public override string GetDebugStatus()
        {
            var status = new StringBuilder(base.GetDebugStatus());

            status.AppendFormat("\t{0}\t\t", Simulator.Catalog.GetParticularString("CircuitBreaker", PowerSupply.CircuitBreaker.State.GetDescription()));
            status.AppendFormat("{0}\t", PowerSupply.CircuitBreaker.TCSClosingAuthorization ? Simulator.Catalog.GetString("OK") : Simulator.Catalog.GetString("NOT OK"));
            status.AppendFormat("{0}\t", PowerSupply.CircuitBreaker.DriverClosingAuthorization ? Simulator.Catalog.GetString("OK") : Simulator.Catalog.GetString("NOT OK"));
            status.AppendFormat("\t{0}\t\t{1}\n", Simulator.Catalog.GetString("Auxiliary power"), Simulator.Catalog.GetParticularString("PowerSupply", PowerSupply.AuxiliaryState.GetDescription()));

            if (IsSteamHeatFitted && Train.PassengerCarsNumber > 0 && this.IsLeadLocomotive() && Train.CarSteamHeatOn)
            {
                // Only show steam heating HUD if fitted to locomotive and the train, has passenger cars attached, and is the lead locomotive
                // Display Steam Heat info
                status.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}/{7}\t{8}\t{9}\t{10}\t{11}\t{12}\t{13}\t{14}\t{15}\t{16}\t{17}\t{18:N0}\n",
                                    Simulator.Catalog.GetString("StHeat:"),
                                    Simulator.Catalog.GetString("Press"),
                                    FormatStrings.FormatPressure(CurrentSteamHeatPressurePSI, Pressure.Unit.PSI, MainPressureUnit, true),
                                    Simulator.Catalog.GetString("StTemp"),
                                    FormatStrings.FormatTemperature(Temperature.Celsius.FromF(SteamHeatPressureToTemperaturePSItoF[CurrentSteamHeatPressurePSI]), IsMetric),
                                    Simulator.Catalog.GetString("StUse"),
                                    FormatStrings.FormatMass(Frequency.Periodic.ToHours(Mass.Kilogram.FromLb(CalculatedCarHeaterSteamUsageLBpS)), IsMetric),
                                    FormatStrings.h,
                                    Simulator.Catalog.GetString("WaterLvl"),
                                    FormatStrings.FormatFuelVolume(CurrentLocomotiveSteamHeatBoilerWaterCapacityL, IsMetric, IsUK),
                                    Simulator.Catalog.GetString("Last:"),
                                    Simulator.Catalog.GetString("Press"),
                                    FormatStrings.FormatPressure(Train.LastCar.CarSteamHeatMainPipeSteamPressurePSI, Pressure.Unit.PSI, MainPressureUnit, true),
                                    Simulator.Catalog.GetString("Temp"),
                                    FormatStrings.FormatTemperature(Train.LastCar.CarCurrentCarriageHeatTempC, IsMetric),
                                    Simulator.Catalog.GetString("OutTemp"),
                                    FormatStrings.FormatTemperature(Train.TrainOutsideTempC, IsMetric),
                                    Simulator.Catalog.GetString("NetHt"),
                                    Train.LastCar.DisplayTrainNetSteamHeatLossWpTime);
            }

            return(status.ToString());
        }
コード例 #21
0
ファイル: VacuumSinglePipe.cs プロジェクト: robwor/openrails
 public override string GetStatus(Dictionary <BrakeSystemComponent, PressureUnit> units)
 {
     return(string.Format(" BP {0}", FormatStrings.FormatPressure(P2V(BrakeLine1PressurePSI), PressureUnit.InHg, PressureUnit.InHg, false)));
 }
コード例 #22
0
 public override string GetStatus(Dictionary <BrakeSystemComponent, PressureUnit> units)
 {
     return(string.Format("BP {0}", FormatStrings.FormatPressure(BrakeLine1PressurePSI, PressureUnit.PSI, units[BrakeSystemComponent.BrakePipe], true)));
 }