Esempio n. 1
0
        public void RefuelMenu()//5
        {
            Console.WriteLine("To Refuel vehicle:");
            Console.WriteLine("Enter License plate:");
            string License_plate = GetFromUserLicensePlate();

            if (License_plate != null && GarageManage.EngineChecker(License_plate) == 2)
            {
                Console.WriteLine("Success Vehicle Found and ready to be fueled !");
                Console.WriteLine("Current amount of fuel is:{0}", GarageManage.GetCurrentAmountOfFuel(License_plate));
                GasType type = GetFromUserGasType();

                Console.WriteLine("Enter Amount of fuel you want to fuel:");
                float Amount_to_fuel = float.Parse(Console.ReadLine());

                if (GarageManage.RefuelVehicle(License_plate, type, Amount_to_fuel))
                {
                    Console.WriteLine("Amount of fuel after refuel: {0}", GarageManage.GetCurrentAmountOfFuel(License_plate));
                    Console.WriteLine("Success Vehicle Refueled!");
                }
                else
                {
                    Console.WriteLine("Fuel problem, (Check your fuel type)/(Check your amount of fuel)");
                    BackToMain();
                }
            }
            else
            {
                Console.WriteLine("There is no such car /or car isnt Fuel type.");
                BackToMain();
            }
        }
Esempio n. 2
0
 public Receipt(GasType gasType, float fueledLiter, float paymentAmount, DateTime timeStamp)
 {
     this.gasType       = gasType;
     this.fueledLiter   = fueledLiter;
     this.paymentAmount = paymentAmount;
     this.timeStamp     = timeStamp;
 }
Esempio n. 3
0
 //Refueling the vehicle
 public static bool RefuelVehicle(string License_plate, GasType type, float Amount_to_fuel)
 {
     foreach (var item in GarageVehicleList)
     {
         if (item.GetLicensePlate() == License_plate)
         {
             if (item.GetGasType() == type)
             {
                 if ((item.GetCurrentAmountOfFuel() + Amount_to_fuel) <= item.GasTankSize())
                 {
                     item.SetCurrentAmountOfFuel((item.GetCurrentAmountOfFuel() + Amount_to_fuel));
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             }
             else
             {
                 return(false);
             }
         }
     }
     return(false);
 }
Esempio n. 4
0
 public double CalUValue(GasType gasType, double thickness, double delta_t = 15, double emissivity_1 = 0.84, double emissivity_2 = 0.84, double height = 1.0,
                         double t_kelvin = 273.15, double pressure = 101325)
 {
     _gasType   = gasType;
     _thickness = thickness;
     return(CalConvectiveConductance(delta_t, height, t_kelvin, pressure) + CalRadiativeConductance(emissivity_1, emissivity_2, t_kelvin));
 }
Esempio n. 5
0
        public void AddNextGas(float amount, GasType gas)
        {
            nextGasses[gas] += amount;

            if (nextGasses[gas] < 0) // This shouldn't happen unless someone calls this directly but lets just make sure
            {
                nextGasses[gas] = 0;
            }
        }
Esempio n. 6
0
 public static void SetGas(GasType in_Type, float in_Percentage)
 {
     foreach (Gas gas in Instance.AllGases)
     {
         if (gas.GasType.Equals(in_Type))
         {
             gas.Percentage = in_Percentage;
         }
     }
 }
Esempio n. 7
0
        private void ProcessData(byte[] tarGz)
        {
            string temporaryDir  = TemporaryPrefix + unique++.ToString();
            string temporaryInfo = temporaryDir + @"/nfo.txt";
            string temporaryProg = temporaryDir + @"/PROG.LST";

            int id = -1;

            using (var stream = new MemoryStream(tarGz))
            {
                var archive = TarArchive.CreateInputTarArchive(stream);

                try
                {
                    archive.ExtractContents(temporaryDir);
                }
                catch (TarException e)
                {
                    Logger.WriteLine(this, e.Message);
                }

                using (StreamReader sr = new StreamReader(temporaryInfo))
                {
                    id = int.Parse(sr.ReadLine());

                    string  notes    = sr.ReadLine();
                    string  customer = sr.ReadLine();
                    string  material = sr.ReadLine();
                    GasType gas      = (GasType)int.Parse(sr.ReadLine());
                    string  path     = sr.ReadLine();

                    int n = int.Parse(sr.ReadLine());

                    for (int i = 0; i < n; ++i)
                    {
                        string[] info = sr.ReadLine().Split(' ', '$');
                    }

                    byte[] prog = File.ReadAllBytes(temporaryProg);

                    m_orders.Add(new Order(
                                     id,
                                     material,
                                     gas,
                                     notes,
                                     prog
                                     ));

                    m_pulled.Add(id);
                    // InternalSetUpdated();
                }
                archive.Close();
                Logger.WriteLine(this, "Получен .TAR от сервера.");
            }
        }
Esempio n. 8
0
 public static Gas GetGas(GasType in_Type)
 {
     foreach (Gas gas in Instance.AllGases)
     {
         if (gas.GasType.Equals(in_Type))
         {
             return(gas);
         }
     }
     return(new Gas(GasType.Null));
 }
Esempio n. 9
0
 private bool checkUpdateThreshold(GasType g, float multiplier = 2000)
 {
     //If the delta since the last update was sent is greater than 2, send another update.
     if (
         Math.Abs(normalizeGasAmount(gasMixture.gasses[(int)g], multiplier) -
                  normalizeGasAmount(lastSentGasses[g], multiplier)) >= 1)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 10
0
 public void AddGas(float amount, GasType gas)
 {
     if (amount == 1.0f)
     {
         gasMixture.SetNextTemperature(5000f);
         LogManager.Log("Temp increase");
     }
     else
     {
         gasMixture.AddNextGas(amount, gas);
     }
 }
Esempio n. 11
0
 public void AddGas(float amount, GasType gas)
 {
     if (amount == 1.0f)
     {
         gasMixture.SetNextTemperature(5000f);
         LogManager.Log("Temp increase");
     }
     else
     {
         gasMixture.AddNextGas(amount, gas);
     }
 }
Esempio n. 12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EnergyWindowMaterialGas" /> class.
        /// </summary>
        /// <param name="thickness">Thickness of the gas layer in meters. Default value is 0.0125. (default to 0.0125D).</param>
        /// <param name="gasType">gasType.</param>
        /// <param name="identifier">Text string for a unique object ID. This identifier remains constant as the object is mutated, copied, and serialized to different formats (eg. dict, idf, osm). This identifier is also used to reference the object across a Model. It must be &lt; 100 characters, use only ASCII characters and exclude (, ; ! \\n \\t). (required).</param>
        /// <param name="displayName">Display name of the object with no character restrictions..</param>
        public EnergyWindowMaterialGas
        (
            string identifier,                                                                      // Required parameters
            string displayName = default, double thickness = 0.0125D, GasType gasType = GasType.Air // Optional parameters
        ) : base(identifier: identifier, displayName: displayName)                                  // BaseClass
        {
            this.Thickness = thickness;
            this.GasType   = gasType;

            // Set non-required readonly properties with defaultValue
            this.Type = "EnergyWindowMaterialGas";
        }
Esempio n. 13
0
        public IGasProperties GetGasProperties(GasType g)
        {
            foreach (GasType type in gasProperties.Keys)
            {
                if (type == g)
                {
                    return(gasProperties[g]);
                }
            }

            return(null);
        }
Esempio n. 14
0
        public IGasProperties GetGasProperties(GasType g)
        {
            foreach (GasType type in gasProperties.Keys)
            {
                if (type == g)
                {
                    return gasProperties[g];
                }
            }

            return null;
        }
Esempio n. 15
0
 public static MaterialPropertiesGas GasMaterialProperties(GasType gasType = GasType.Undefined, double conductivity = 0.0, string description = "", double specificHeat = 0.0, double density = 0.0, double convectionCoefficient = 0.0, double vapourDiffusionFactor = 0.0)
 {
     return(new MaterialPropertiesGas
     {
         GasType = gasType,
         Conductivity = conductivity,
         Description = description,
         SpecificHeat = specificHeat,
         Density = density,
         ConvectionCoefficient = convectionCoefficient,
         VapourDiffusionFactor = vapourDiffusionFactor,
     });
 }
 private SubmitPriceModel ToPriceSubmission(long gasStationId, GasType gasType)
 {
     return(new SubmitPriceModel
     {
         Amount = decimal.Parse(gasType.price, CultureInfo.InvariantCulture),
         FuelType = gasType.name switch
         {
             "Pb98 (E5)" => FuelType.Pb98,
             "Pb95 (E5)" => FuelType.Pb95,
             "ON (B7)" => FuelType.Diesel,
             "LPG" => FuelType.Gas,
             _ => FuelType.None,
         },
Esempio n. 17
0
 public Order(
     int id,
     string material,
     GasType gas,
     string notes,
     byte[] program
     )
 {
     Id       = id;
     Material = material;
     Gas      = gas;
     Notes    = notes;
     Prog     = program;
     Written  = false;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="EnergyWindowMaterialGas" /> class.
        /// </summary>
        /// <param name="thickness">Thickness of the gas layer in meters. Default: 0.0125. (default to 0.0125D).</param>
        /// <param name="gasType">gasType.</param>
        /// <param name="identifier">Text string for a unique object ID. This identifier remains constant as the object is mutated, copied, and serialized to different formats (eg. dict, idf, osm). This identifier is also used to reference the object across a Model. It must be &lt; 100 characters, use only ASCII characters and exclude (, ; ! \\n \\t). (required).</param>
        /// <param name="displayName">Display name of the object with no character restrictions..</param>
        /// <param name="userData">Optional dictionary of user data associated with the object.All keys and values of this dictionary should be of a standard data type to ensure correct serialization of the object (eg. str, float, int, list)..</param>
        public EnergyWindowMaterialGas
        (
            string identifier,                                                                                                 // Required parameters
            string displayName = default, Object userData = default, double thickness = 0.0125D, GasType gasType = GasType.Air // Optional parameters
        ) : base(identifier: identifier, displayName: displayName, userData: userData)                                         // BaseClass
        {
            this.Thickness = thickness;
            this.GasType   = gasType;

            // Set non-required readonly properties with defaultValue
            this.Type = "EnergyWindowMaterialGas";

            // check if object is valid, only check for inherited class
            if (this.GetType() == typeof(EnergyWindowMaterialGas))
            {
                this.IsValid(throwException: true);
            }
        }
Esempio n. 19
0
 public virtual void SetAtmosDisplay(GasType type, byte amount)
 {
     if (gasAmounts.Keys.Contains(type))
     {
         if (amount == 0)
         {
             gasAmounts.Remove(type);
         }
         else
         {
             gasAmounts[type] = amount;
         }
     }
     else
     {
         gasAmounts.Add(type, amount);
     }
 }
Esempio n. 20
0
        void DisplayTankInfo(List <GasTank> tanks, GasType gasType)
        {
            if (tanks == null || tanks.Count == 0)
            {
                Print(string.Format("No {0} tanks on this grid", gasType));
                return;
            }

            double volume = 0, fillratio = 0;

            foreach (var tank in tanks)
            {
                volume    += tank.MyGasTank.FilledRatio * tank.MyGasTank.Capacity;
                fillratio += tank.MyGasTank.FilledRatio;
            }

            Print(string.Format("{0}: {1}", gasType, DoubleToString(volume)));
            Print(string.Format("Tanks: {0} Fill: {1}%", tanks.Count, Math.Round(fillratio / tanks.Count * 100, 1)));
        }
Esempio n. 21
0
//    private void FindSurroundings(float3 centerPosition, ref DynamicBuffer<SurroundingAtmosGas> buffer,
//        GasType type)
//    {
//        NativeArray<AtmosGas> surroundings = new NativeArray<AtmosGas>(9, Allocator.Temp);
//
//        Entities.WithAll<AtmosGas, Translation>().ForEach((Entity entity, ref Translation position, ref AtmosGas gas) =>
//        {
//            for (int i = 0; i < directions.Count; i++)
//            {
//                if (position.Value.Equals(centerPosition + directions[i]) && gas.Type.Equals(type))
//                {
//                    gas.exists = true;
//                    surroundings[i] = gas;
//                }
//            }
//        });
//
//        buffer.Clear();
//        for (var i = 0; i < surroundings.Length; i++)
//        {
//            AtmosGas gas = surroundings[i];
//            buffer.Add(gas);
//        }
//
//        surroundings.Dispose();
//    }
    private void FindSurroundings(float3 centerPosition, ref DynamicBuffer <SurroundingAtmosGas> buffer,
                                  GasType type)
    {
//        NativeArray<AtmosGas> surroundings = new NativeArray<AtmosGas>(9, Allocator.Temp);

        buffer.ResizeUninitialized(9);
        for (int i = 0; i < _gasses.Count; i++)
        {
            if (_gasses[i][0].Type == type)
            {
                for (int j = 0; j < directions.Count; j++)
                {
                    buffer[j] = _gasses[i].ContainsKey(centerPosition + directions[i])
                        ? _gasses[i][centerPosition + directions[i]]
                        : new AtmosGas {
                        exists = false
                    };
                }
            }
        }

        //        surroundings.Dispose();
    }
Esempio n. 22
0
 private bool checkUpdateThreshold(GasType g, float multiplier = 2000)
 {
     //If the delta since the last update was sent is greater than 2, send another update.
     if (
         Math.Abs(normalizeGasAmount(gasMixture.gasses[(int)g], multiplier) -
                  normalizeGasAmount(lastSentGasses[g], multiplier)) >= 1)
         return true;
     return false;
 }
Esempio n. 23
0
 public float GasAmount(GasType type)
 {
     return(gasMixture.gasses[(int)type]);
 }
Esempio n. 24
0
        public override GasType SetGasType(int input)
        {
            type = (GasType)input;

            return(type);
        }
Esempio n. 25
0
 public float MassOf(GasType gas)
 {
     return(_atmosManager.GetGasProperties(gas).MolecularMass *gasses[gas]);
 }
Esempio n. 26
0
 public float GetGasAmount(Point position, GasType type)
 {
     var t = (Tile)GetTileAt(position.X, position.Y);
     return (float)t.gasCell.gasses[type];
 }
Esempio n. 27
0
 public Gas(GasType gastype, float pricePerLiter, Tank[] tanks)
 {
     this.gastype       = gastype;
     this.pricePerLiter = pricePerLiter;
     this.tanks         = tanks;
 }
Esempio n. 28
0
        internal List <GasEndPoint> GetGasEndPoints(string eventCode, DockingStationAction dsAction, StringBuilder explanation, List <string> explanationCodes, List <string> errorCodes)
        {
            Log.Debug(string.Format("{0}.GetGasEndPoints, {1}", Name, eventCode));
            //explanationCodes.Clear();
            //errorCodes.Clear(); // SGF  20-Feb-2013  INS-3821

            ISC.iNet.DS.DomainModel.Instrument dockedInstrument = Master.Instance.SwitchService.Instrument;
            DockingStation dockingStation = Configuration.DockingStation;

            List <GasEndPoint> gasEndPoints = new List <GasEndPoint>();

            foreach (InstalledComponent installedComponent in dockedInstrument.InstalledComponents)
            {
                if (!(installedComponent.Component is Sensor))
                {
                    continue;
                }

                Sensor sensor = (Sensor)installedComponent.Component;
                if (!sensor.Enabled)
                {
                    Log.Info(string.Format("{0}: Ignoring disabled sensor {1}", Name, sensor.Uid));
                    continue;
                }

                // SGF  21-May-2012  INS-3078 -- Comment out the following if statement
                //if (!GasOperationsSupported(sensor))
                //{
                //    Log.Debug( string.Format( "{0}.GasOperationsSupported returned False for sensor {1}. Ignoring sensor.", Name, sensor.SerialNumber ) );
                //    continue;
                //}

                if (sensor.CalibrationGas.Code.Length == 0)
                {
                    throw new ApplicationException("Sensor " + sensor.Uid + " has null calibration gas code.");
                }

                // SGF  03-Nov-2010  Single Sensor Cal and Bump
                if (dsAction is InstrumentGasAction)
                {
                    InstrumentGasAction gasAction = (InstrumentGasAction)dsAction;
                    if (gasAction.ComponentCodes.Count != 0 && !gasAction.ComponentCodes.Contains(sensor.Type.Code))
                    {
                        Log.Debug(string.Format("{0}: Component type {1} is not included in the defined list of components to test. Ignoring sensor.", Name, sensor.Type.Code));
                        continue;
                    }
                }

                Log.Debug(string.Format("{0}: Looking for sensor {1}'s cal gas ({2})", Name, sensor.Uid, sensor.CalibrationGas.Code));

                _empty     = _expired = _gasFound = _freshFound = _zeroFound = false;
                _gasNeeded = true;  // SGF  21-May-2012  INS-3078

                // INS-8630 RHP v7.5 clear the messages for every installed component to avoid confusion
                explanationCodes.Clear();
                errorCodes.Clear(); // SGF  20-Feb-2013  INS-3821

                // Loop thru the cylinders for the docking station and if the cylinder contains the gas that
                // the sensor needs, add that cylinder as a gas end point in the docking station action.
                FindInstalledCylinderGases(eventCode, gasEndPoints, dockingStation, installedComponent, explanation, explanationCodes, errorCodes);

                if (!_freshFound && !_zeroFound)
                {
                    // Present which type of air should be, but is not, available.  If the port1 restrictions
                    // only allow for zero air, present 'ZERO AIR'; otherwise, present 'FRESH AIR'.
                    if (Configuration.DockingStation.Port1Restrictions == PortRestrictions.ZeroAir)
                    {
                        explanationCodes.Add("ZEROAIR");
                        errorCodes.Add(string.Format("{0} ({1})", "ZEROAIR", GasCode.O2));     // SGF  20-Feb-2013  INS-3821
                    }
                    else if (Configuration.DockingStation.Port1Restrictions == PortRestrictions.FreshAir)
                    {
                        GasType gasType = GasType.Cache[GasCode.FreshAir];
                        if (gasType != null)
                        {
                            explanationCodes.Add(gasType.Symbol);
                            errorCodes.Add(string.Format("{0} ({1})", gasType.Symbol, gasType.Code));     // SGF  20-Feb-2013  INS-3821
                        }
                    }

                    else // SGF  19-Jan-2012  INS-1913 & INS-1914
                    {
                        // either fresh air or zero air is allowed; present which type is connected, if something is connected.
                        GasEndPoint gasEndPoint = dockingStation.GasEndPoints[0];
                        Cylinder    cyl         = gasEndPoint.Cylinder;
                        if (cyl.IsZeroAir)
                        {
                            explanationCodes.Add("ZEROAIR");
                            errorCodes.Add(string.Format("{0} ({1})", "ZEROAIR", GasCode.O2));     // SGF  20-Feb-2013  INS-3821
                        }
                        else //suresh 14-Mar-2012 INS-4427 (DEV)
                        {
                            // If port 1 cylinder is not Zero Air then we report that 'Fresh air' is unavailable
                            GasType gasType = GasType.Cache[GasCode.FreshAir];
                            if (gasType != null)
                            {
                                explanationCodes.Add(gasType.Symbol);
                                errorCodes.Add(string.Format("{0} ({1})", gasType.Symbol, gasType.Code));     // SGF  20-Feb-2013  INS-3821
                            }
                        }
                    }

                    if (_expired)
                    {
                        explanationCodes.Add("Expired");
                        errorCodes.Add("Expired");  // INS-8630 RHP v7.5 - Notify iNet on the expired state
                    }
                    else if (_empty)
                    {
                        explanationCodes.Add(PressureLevel.Empty.ToString());
                        errorCodes.Add(PressureLevel.Empty.ToString());     // INS-8630 RHP v7.5 - Notify iNet on the empty state
                    }
                    explanation.Append("Fresh air not found for sensor " + sensor.Uid + '\n');

                    Log.Debug(string.Format("{0}: Returning nothing: gasFound={1}, freshFound={2}, expired={3}, empty={4}", Name, _gasFound, _freshFound, _expired, _empty));
                    return(new List <GasEndPoint>());
                }

                if (_gasNeeded && !_gasFound)    // SGF  21-May-2012  INS-3078 -- add the '_gasNeeded' clause to the if-condition
                {
                    // If gas not found, IDS needs the symbol for that gas for display on its LCD.
                    // Look it up in our cache.  For Fresh Air, we just return the gas code;
                    // The IDS knows to look for that as a special case.
                    if (sensor.CalibrationGas.Code == GasCode.FreshAir)
                    {
                        GasType gasType = GasType.Cache[GasCode.FreshAir];
                        if (gasType != null)
                        {
                            explanationCodes.Add(gasType.Symbol);
                            errorCodes.Add(string.Format("{0} ({1})", gasType.Symbol, gasType.Code));     // SGF  20-Feb-2013  INS-3821
                        }
                    }
                    // DSW-1758 RHP v9.6.1 - Added (! (_expired || _empty) ) since gas symbol has already been added to explanationCodes for Empty/Expired states.
                    else if (!(_expired || _empty))
                    {
                        // If we're doing a bump test, and this is a combustible sensor either in LEL or PPM mode,
                        // and docking station has a CombustibleBumpTestGas setting, then make sure we report that the
                        // gas type not found is the CombustibleBumpTestGas and not the sensor cal gas.
                        string sensorGasCode = sensor.CalibrationGas.Code;
                        if ((eventCode == EventCode.BumpTest) &&
                            (sensor.Type.Code == SensorCode.CombustibleLEL || sensor.Type.Code == SensorCode.CombustiblePPM) &&
                            (Configuration.DockingStation.CombustibleBumpTestGas.Length > 0))
                        {
                            sensorGasCode = Configuration.DockingStation.CombustibleBumpTestGas;
                        }
                        GasType gasType = GasType.Cache[sensorGasCode];
                        if (gasType != null)
                        {
                            explanationCodes.Add(gasType.Symbol);
                            errorCodes.Add(string.Format("{0} ({1})", gasType.Symbol, gasType.Code));     // SGF  20-Feb-2013  INS-3821
                        }
                    }

                    if (_expired)
                    {
                        explanationCodes.Add("Expired");
                        errorCodes.Add("Expired");  // INS-8630 RHP v7.5 - Notify iNet on the expired state
                    }
                    else if (_empty)
                    {
                        explanationCodes.Add(PressureLevel.Empty.ToString());
                        errorCodes.Add(PressureLevel.Empty.ToString());     // INS-8630 RHP v7.5 - Notify iNet on the empty state
                    }

                    explanation.Append("Could not find cylinder needed for sensor " + sensor.Uid + ", CalGasCode=\"" + sensor.CalibrationGas.Code + "\" (");
                    for (int i = 0; i < explanationCodes.Count; i++)
                    {
                        if (i > 0)
                        {
                            explanation.Append(" ");
                        }
                        explanation.Append(explanationCodes[i]);
                    }
                    explanation.Append(")\n");

                    Log.Debug(string.Format("{0}: Returning nothing: gasFound={1}, freshFound={2}, expired={3}, empty={4}", Name, _gasFound, _freshFound, _expired, _empty));
                    return(new List <GasEndPoint>());
                }

                // Zero air is required for CO2 sensors; Only zero air is used to zero CO2, never fresh air.
                if ((sensor.CalibrationGas.Code == GasCode.CO2) && !_zeroFound)
                {
                    GasType gasType = GasType.Cache[GasCode.O2];
                    if (gasType != null)
                    {
                        explanationCodes.Add("ZEROAIR");                                   // SGF  5-Feb-2013  INS-3837
                        errorCodes.Add(string.Format("{0} ({1})", "ZEROAIR", GasCode.O2)); // SGF  20-Feb-2013  INS-3821
                    }
                    if (_expired)
                    {
                        explanationCodes.Add("Expired");
                    }
                    else if (_empty)
                    {
                        explanationCodes.Add(PressureLevel.Empty.ToString());
                    }
                    explanation.Append("Zero air not found for CO2 sensor " + sensor.Uid + '\n');
                    Log.Debug(string.Format("{0}: Returning nothing: gasFound={1}, freshFound={2}, expired={3}, empty={4}", Name, _gasFound, _freshFound, _expired, _empty));
                    return(new List <GasEndPoint>());;
                }
            }

            Log.Debug(string.Format("{0}.GetGasEndPoints returned {1} gas end points", Name, gasEndPoints.Count));
            return(gasEndPoints);
        }
Esempio n. 29
0
        public void InformationSorter(Vehicle vehicle)
        {
            string License_P = vehicle.GetLicensePlate();

            Vehicle.VehicleType vhicle_T = vehicle.GetTypeOfVehicle();
            Console.WriteLine("============================================================");
            Console.WriteLine("Vehicle Full Information:");
            Console.WriteLine("Vehicle License Plate:{0}", License_P);
            Console.WriteLine("Vehicle Type:{0}", vhicle_T);
            if (vhicle_T == (Vehicle.VehicleType) 1)
            {
                AmountCarDoors amount_ocd = vehicle.GetAmountOfDoors();
                Color          c          = vehicle.GetColor();
                Console.WriteLine("Amount of doors: {0}", amount_ocd);
                Console.WriteLine("Color: {0}", c);
            }
            if (vhicle_T == (Vehicle.VehicleType) 2)
            {
                bool  is_carring_Dangerous_Subs = vehicle.GetDangerousSubstance();
                float Max_Cargo_Weight          = vehicle.GetMaxCargoWeight();

                Console.WriteLine("Is carring dangerous Substance: {0}", is_carring_Dangerous_Subs);
                Console.WriteLine("Max cargo weight: {0}", Max_Cargo_Weight);
            }
            if (vhicle_T == (Vehicle.VehicleType) 3)
            {
                int         Engine_V  = vehicle.GetEngineVolume();
                LicenseType License_T = vehicle.GetLicenseType();

                Console.WriteLine("Engine volume: {0}", Engine_V);
                Console.WriteLine("License type: {0}", License_T);
            }
            Console.WriteLine("Model: {0}", vehicle.GetModel());
            Console.WriteLine("Current PSI: {0}", vehicle.GetCurrentPSI());


            if (vehicle.GetEngineType() == (Engine)1)
            {
                float Current_Amount_Of_E = vehicle.GetCurrentAmountOfEnergy();
                Console.WriteLine("Engine Type: {0}", vehicle.GetEngineType());
                Console.WriteLine("Current amount of energy: {0}", Current_Amount_Of_E);
            }
            if (vehicle.GetEngineType() == (Engine)2)
            {
                float   Current_Amount_Of_F = vehicle.GetCurrentAmountOfFuel();
                GasType Gas_T = vehicle.GetGasType();
                Console.WriteLine("Engine Type: {0}", vehicle.GetEngineType());
                Console.WriteLine("Current amount of Fuel: {0}", Current_Amount_Of_F);
                Console.WriteLine("Fuel Type: {0}", Gas_T);
            }
            int tires = vehicle.typeOfTire;

            if (tires == 1)
            {
                Console.WriteLine("Type of tires:{0} Manufacturer is: Michelin ", tires);
            }
            if (tires == 2)
            {
                Console.WriteLine("Type of tires:{0} Manufacturer is: Pirelli ", tires);
            }
            if (tires == 3)
            {
                Console.WriteLine("Type of tires:{0} Manufacturer is: Dunlop", tires);
            }
            if (tires == 4)
            {
                Console.WriteLine("Type of tires:{0} Manufacturer is: GoodYear ", tires);
            }
            if (tires == 5)
            {
                Console.WriteLine("Type of tires:{0} Manufacturer is: Kumho ", tires);
            }
            if (tires == 6)
            {
                Console.WriteLine("Type of tires:{0} Manufacturer is: Hankook ", tires);
            }

            Console.WriteLine("============================================================");
        }
Esempio n. 30
0
        //Vehicle Creator ->Contacts factory ->Creates Vehicle->Adds it to GarageList.
        public Vehicle GetVehicleDetails(string License_plate)
        {
            float          amountOfEnergy     = 0;
            GasType        Gas_type           = 0;
            float          amountOfGas        = 0;
            Color          color              = 0;
            AmountCarDoors amount             = 0;
            bool           isCarringDangerous = true;
            float          MaximumCarryWeight = 0;
            int            typeOfTires        = 0;
            LicenseType    type           = 0;
            int            EngineCapacity = 0;
            string         model;

            Console.WriteLine("Enter owners name:");
            string owner_name = GetFromUserName();

            Console.WriteLine("Enter owners phone:");
            string owner_phone = GetFromUserPhone();

            Vehicle.VehicleType Vehicle_type = GetFromUserVehicleType();
            model = GetFromUserModel();

            //Acumilating details depends on the engine type selected.
            Engine Engine_type = GetFromUserEngineType();

            if (Engine_type == (Engine)2)//fuel info
            {
                Gas_type    = GetFromUserGasType();
                amountOfGas = GetCurrentAmountOfGas();
            }
            if (Engine_type == (Engine)1)//electric info
            {
                amountOfEnergy = GetCurrentAmountOfEnergy();
            }

            //Acumilating details depending on the vehicle type selected
            if (Vehicle_type == (Vehicle.VehicleType) 1) //car
            {
                color       = GetCarColorFromUser();
                amount      = GetAmountOfDoorsFromUser();
                typeOfTires = GetTypeOfTire();
            }
            if (Vehicle_type == (Vehicle.VehicleType) 2) //truck
            {
                isCarringDangerous = IsCarringDangerousSubstance();
                MaximumCarryWeight = GetMaximumCarryWeight();
                typeOfTires        = GetTypeOfTire();
            }
            if (Vehicle_type == (Vehicle.VehicleType) 3)//motorcycle
            {
                type           = GetLicenseType();
                EngineCapacity = GetEngineVolume();
                typeOfTires    = GetTypeOfTire();
            }
            //addressing the factory with the request to create a vehicle with the specifications.
            if (Engine_type == (Engine)1)
            {
                var vehicle = GarageManage.StartElectricAssembly(Engine_type, License_plate, owner_name, owner_phone, model, amountOfEnergy, Vehicle_type, typeOfTires, type, EngineCapacity, isCarringDangerous, MaximumCarryWeight, color, amount);

                return(vehicle);
            }
            if (Engine_type == (Engine)2)
            {
                var vehicle = GarageManage.StartFuelAssembly(Engine_type, License_plate, owner_name, owner_phone, model, amountOfGas, Vehicle_type, typeOfTires, type, EngineCapacity, isCarringDangerous, MaximumCarryWeight, color, amount);
                return(vehicle);
            }
            return(null);
        }
Esempio n. 31
0
        public void AddNextGas(float amount, GasType gas)
        {
            nextGasses[gas] += amount;

            if (nextGasses[gas] < 0) // This shouldn't happen unless someone calls this directly but lets just make sure
                nextGasses[gas] = 0;
        }
        } // end-Prepare

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private bool Purge()
        {
            const string funcMsg = "Purge: ";

            bool     purgeDone      = false;
            int      purgeStepTime  = 2;       // 2 seconds is a guess; configure as necessary
            TimeSpan maxPurgeLength = new TimeSpan(0, 0, _purge1Seconds);
            TimeSpan elapsedTime    = new TimeSpan(0, 0, 0);
            DateTime purgeStartTime; // initialized immediately prior to each loop which this is used
            DateTime cylinderStartTime = DateTime.UtcNow;

            try
            {
                // Indicate that the purging process is now in progress
                ConsoleState consoleState;
                if (_purgeType == PurgeType.PreCalibration || _purgeType == PurgeType.PostCalibration)
                {
                    consoleState = ConsoleState.CalibratingInstrument;
                }
                else if (_purgeType == PurgeType.CylinderSwitch)
                {
                    consoleState = (_returnGasResponseEvent is InstrumentCalibrationEvent) ? ConsoleState.CalibratingInstrument : ConsoleState.BumpingInstrument;
                }
                else
                {
                    consoleState = ConsoleState.BumpingInstrument;
                }

                Master.Instance.ConsoleService.UpdateState(consoleState, ConsoleServiceResources.PURGING);

                _instrumentController.OpenGasEndPoint(_airEndPoint, _desiredFlow);

                switch (_purgeType)
                {
                // Constant purge only
                case PurgeType.PreCalibration:     // prior to zeroing, we do a fixed-time purge.
                    Log.Debug(string.Format("{0}Purging for {1} seconds.", funcMsg, _purge1Seconds));

                    purgeStartTime = DateTime.UtcNow;
                    while (elapsedTime < maxPurgeLength)
                    {
                        if (!Master.Instance.ControllerWrapper.IsDocked())
                        {
                            throw new InstrumentNotDockedException();
                        }

                        Thread.Sleep(1000);       // Wait for the purge.

                        // See if ResourceService determined that cylinder was empty while we slept.
                        CheckAir(_airEndPoint);       // throws if empty cylinder is detected

                        elapsedTime = DateTime.UtcNow - purgeStartTime;
                    }
                    purgeDone = true;
                    break;

                // Constant purge followed by a "smart purge"
                case PurgeType.PostCalibration:
                case PurgeType.PostBump:
                    // constant purge
                    if (_purge1Seconds > 0)
                    {
                        Log.Debug(string.Format("{0}Purging for {1} seconds.", funcMsg, _purge1Seconds));

                        purgeStartTime = DateTime.UtcNow;
                        while (elapsedTime < maxPurgeLength)
                        {
                            if (!Master.Instance.ControllerWrapper.IsDocked())
                            {
                                throw new InstrumentNotDockedException();
                            }

                            Thread.Sleep(1000);                                       // Wait for the purge.

                            // See if ResourceService determined that cylinder was empty while we slept.
                            CheckAir(_airEndPoint);                                       // throws if empty cylinder is detected

                            elapsedTime = DateTime.UtcNow - purgeStartTime;
                        }
                    }

                    // smart purge
                    if (_purge2Seconds > 0)
                    {
                        Log.Debug(string.Format("{0}Purging for a maximum of {1} seconds.", funcMsg, _purge2Seconds));

                        // reset as constant purge above may have used these
                        elapsedTime    = new TimeSpan(0, 0, 0);
                        maxPurgeLength = new TimeSpan(0, 0, _purge2Seconds);

                        purgeStartTime = DateTime.UtcNow;
                        while (elapsedTime < maxPurgeLength && purgeDone == false)
                        {
                            // See if the instrument is in alarm.  If it is not, the purge can end early.
                            if (IsInstrumentInAlarm(_returnGasResponseEvent.DockedInstrument, null) == false)
                            {
                                purgeDone = true;
                            }
                            else
                            {
                                CheckAir(_airEndPoint);                                           // throws if empty cylinder is detected
                                Log.Debug(string.Format("{0}Purging for {1} seconds.", funcMsg, purgeStepTime));
                                Thread.Sleep(purgeStepTime * 1000);
                            }
                            elapsedTime = DateTime.UtcNow - purgeStartTime;
                        }

                        if (purgeDone)
                        {
                            Log.Debug(string.Format("{0}Instrument is NOT in alarm after {1} seconds.", funcMsg, elapsedTime.TotalSeconds));
                        }
                        else
                        {
                            Log.Debug(string.Format("{0}Instrument is IN ALARM after {1} seconds.  MAXIMUM PURGE TIME EXCEEDED.", funcMsg, elapsedTime.TotalSeconds));
                        }

                        if (!purgeDone && _purgeType == PurgeType.PostBump)
                        {
                            // If we got here, that must mean that the PurgeAfterBump setting is enabled.
                            Log.Debug(string.Format("{0}PUTTING SENSORS INTO BUMP FAULT THAT ARE STILL IN ALARM.", funcMsg));
                            // See if the instrument is still in alarm.  Report a purgeDone of 'false' if the instrument is still in alarm.
                            // Put sensors into bump fault that are still in alarm.
                            purgeDone = !IsInstrumentInAlarm(_returnGasResponseEvent.DockedInstrument, _returnGasResponseEvent as InstrumentBumpTestEvent);

                            if (purgeDone)
                            {
                                Log.Debug(string.Format("{0}Instrument was NOT in alarm for the final check.", funcMsg));
                            }
                        }
                    }
                    else
                    {
                        // If PurgeAfterBump setting is disabled than we can report that the purge completed successfully.
                        purgeDone = true;
                    }

                    break;

                // Smart purge only
                case PurgeType.PreBump:
                    Log.Debug(string.Format("{0}Purging for a maximum of {1} seconds.", funcMsg, _purge1Seconds));

                    purgeStartTime = DateTime.UtcNow;
                    while (elapsedTime < maxPurgeLength && purgeDone == false)
                    {
                        // See if the instrument is in alarm.  If it is not, the purge can end early.
                        if (IsInstrumentInAlarm(_returnGasResponseEvent.DockedInstrument, null) == false)
                        {
                            purgeDone = true;
                        }
                        else
                        {
                            CheckAir(_airEndPoint);                                       // throws if empty cylinder is detected
                            Log.Debug(string.Format("{0}Purging for {1} seconds.", funcMsg, purgeStepTime));
                            Thread.Sleep(purgeStepTime * 1000);
                        }
                        elapsedTime = DateTime.UtcNow - purgeStartTime;
                    }

                    if (purgeDone)
                    {
                        Log.Debug(string.Format("{0}Instrument is NOT in alarm after {1} seconds.", funcMsg, elapsedTime.TotalSeconds));
                    }
                    else
                    {
                        Log.Debug(string.Format("{0}Instrument is IN ALARM after {1} seconds.  MAXIMUM PURGE TIME EXCEEDED.", funcMsg, elapsedTime.TotalSeconds));
                    }

                    break;

                case PurgeType.O2Recovery:
                    Log.Debug(string.Format("{0}Purging O2 sensors for recovery from depravation for a maximum of {1} seconds.", funcMsg, _purge1Seconds));

                    // From all the InstalledComponents, get a sub-list of just the O2 sensors.
                    // Then, from the list of O2 sensors, whittle it down to just O2 sensors that we have SGRs for.
                    // SGRs might be missing, for example, if we just did a bump test, but one or more sensors were
                    // already in a cal-fault state. (Which could happen with dualsense sensors where one in the pair
                    // is not working.) Those failed sensors would not have been bump tested, so there will be no SGR,
                    // and since the sensoris not "working", we don't have to worry about getting its reading.
                    List <InstalledComponent> o2Components = _returnGasResponseEvent.DockedInstrument.InstalledComponents.FindAll(c => c.Component.Enabled && c.Component.Type.Code == SensorCode.O2);
                    o2Components = o2Components.FindAll(o2 => _returnGasResponseEvent.GetSensorGasResponseByUid(o2.Component.Uid) != null);

                    purgeStartTime = DateTime.UtcNow;
                    while (elapsedTime < maxPurgeLength && purgeDone == false)
                    {
                        Thread.Sleep(1000);

                        CheckAir(_airEndPoint);       // throws if empty cylinder is detected

                        // SGF  24-Aug-2011  INS-2314 -- check O2 sensors for their current readings
                        int numO2SensorsPassed = 0;
                        foreach (InstalledComponent ic in o2Components)
                        {
                            Sensor            sensor = (Sensor)ic.Component;
                            SensorGasResponse sgr    = _returnGasResponseEvent.GetSensorGasResponseByUid(sensor.Uid);
                            sgr.Status = Status.O2RecoveryFailed;

                            sgr.O2HighReading = _instrumentController.GetSensorReading(ic.Position, sensor.Resolution);
                            sgr.Time          = DateTime.UtcNow;
                            Log.Debug(string.Format("{0}O2 sensor UID={1} O2HighReading={2}.", funcMsg, sensor.Uid, sgr.O2HighReading.ToString()));

                            // SGF  24-Aug-2011  INS-2314 -- getting rid of the test for the high threshold, since we don't use cylinders with higher than normal O2 levels
                            if (OXYGEN_FRESH_AIR_TEST_LOW_PASS_PCT <= sgr.O2HighReading)
                            {
                                Log.Debug(string.Format("{0}O2 sensor UID={1} reading is within normal range.", funcMsg, sensor.Uid));
                                // INETQA-4149 INS-7625 SSAM v7.6 IsO2HighBumpPassed flag is set to true if O2 sensor passes the recovery purge.
                                // Else if recovery fails, calibration is initiated to recover the O2 sensor.
                                sgr.IsO2HighBumpPassed = true;
                                sgr.Status             = Status.Passed;
                                numO2SensorsPassed++;
                            }
                        }

                        if (numO2SensorsPassed == o2Components.Count)
                        {
                            purgeDone = true;     // All O2 sensors pass the recovery test; time to short-circuit the purge
                        }
                        elapsedTime = DateTime.UtcNow - purgeStartTime;
                    }

                    // For any O2 sensors that failed to recover above, mark the SGR status as O2RecoveryFailed
                    foreach (InstalledComponent ic in o2Components)
                    {
                        SensorGasResponse sgr = _returnGasResponseEvent.GetSensorGasResponseByUid(ic.Component.Uid);
                        sgr.SpanCoef = _instrumentController.GetSensorSpanCoeff(ic.Position);
                        sgr.UsedGasEndPoints.Add(new UsedGasEndPoint(_airEndPoint, CylinderUsage.BumpHigh, elapsedTime));
                        if (sgr.Status == Status.O2RecoveryFailed)
                        {
                            Log.Warning(string.Format("{0} O2 SENSOR (UID={1}) FAILED TO RECOVER FROM DEPRAVATION.", funcMsg, ic.Component.Uid));
                        }
                    }

                    GasType gasType = GasType.Cache[GasCode.O2];
                    Master.Instance.ConsoleService.UpdateState(ConsoleState.BumpingInstrument, gasType.Symbol);

                    break;     // end-PurgeType.O2Recovery

                // Purge between use of different gas endpoints
                case PurgeType.CylinderSwitch:
                    Log.Debug(string.Format("{0}Purging for {1} seconds.", funcMsg, _purge1Seconds));

                    purgeStartTime = DateTime.UtcNow;
                    while (elapsedTime < maxPurgeLength && purgeDone == false)
                    {
                        // See if the sensor readings have met the purge complete criterion. If it has, the purge can end early.
                        // During a calibration, this is a Constant purge only
                        if (_returnGasResponseEvent is InstrumentBumpTestEvent)
                        {
                            purgeDone = IsInstrumentPurgeCriterionMet();
                        }

                        Thread.Sleep(1000);     // Wait for the purge.

                        // See if ResourceService determined that cylinder was empty while we slept.
                        CheckAir(_airEndPoint);     // throws if empty cylinder is detected
                        elapsedTime = DateTime.UtcNow - purgeStartTime;
                    }

                    if (_returnGasResponseEvent is InstrumentCalibrationEvent)
                    {
                        purgeDone = true;       // For Calibration, its fixed time purge
                    }
                    Log.Debug(string.Concat("CYLINDER-SWITCH purge ", purgeDone ? "PASSED" : "FAILED"));

                    break;
                } // end-switch
            }
            catch (CommunicationAbortedException cae)   // undocked?
            {
                throw new InstrumentNotDockedException(cae);
            }
            catch (InstrumentNotDockedException)
            {
                throw;
            }
            catch (FlowFailedException ffe)   // ran out of gas during the purge?
            {
                Log.Warning(Name + " throwing FlowFailedException for position " + ffe.GasEndPoint.Position);
                throw;
            }
            catch (Exception ex)
            {
                throw new UnableToPurgeException(ex);
            }
            finally
            {
                _instrumentController.CloseGasEndPoint(_airEndPoint);

                //Purge is alway run at max voltage which satisfies condition of bad kink tubing even
                //there is no issue with tubing.  So, explicitly set "Pump.IsBadPumpTubing" to false
                //once purge operation is complete.
                Pump.IsBadPumpTubing = false;

                if (_returnGasResponseEvent != null)
                {
                    // SGF  06-Jun-2011  INS-1735
                    // Add a new UsedGasEndPoint object to the return event if the duration is greater than 0.
                    TimeSpan durationInUse = DateTime.UtcNow - cylinderStartTime;
                    if (durationInUse.CompareTo(TimeSpan.MinValue) > 0)
                    {
                        _returnGasResponseEvent.UsedGasEndPoints.Add(new UsedGasEndPoint(_airEndPoint, CylinderUsage.Purge, durationInUse));
                    }
                }

                Log.Debug(string.Format("{0}Finished", funcMsg));
            }

            return(purgeDone);
        }
Esempio n. 33
0
 public float MassOf(GasType gas)
 {
     return (_atmosManager.GetGasProperties(gas).MolecularMass * gasses[gas]);
 }
Esempio n. 34
0
 public float GasAmount(GasType type)
 {
     return gasMixture.gasses[(int)type];
 }
Esempio n. 35
0
 public void AddGasAt(Point position, GasType type, int amount)
 {
     tileArray[position.X, position.Y].gasCell.AddGas(amount, type);
 }
Esempio n. 36
0
 public Gas(GasType type)
 {
     this.GasType = type;
     Percentage   = 0;
 }
Esempio n. 37
0
        // INS-8630 RHP v7.5 - Updated method signature to include errorCodes and explanationCodes to display ISC Cylinder Part Number on LCD and to send the same as Alert
        private void FindInstalledCylinderGases(string eventCode, List <GasEndPoint> gasEndPoints,
                                                DockingStation dockingStation, InstalledComponent installedComponent,
                                                StringBuilder explanation,
                                                List <string> explanationCodes,
                                                List <string> errorCodes)
        {
            Sensor sensor = installedComponent.Component as Sensor;

            // INS-8630 RHP v7.5 - Initialize outside the loop since if no gas is found on entire loop, then we still need to pass expired/empty if either are true.
            _expired = _empty = false;

            // SGF  21-May-2012  INS-3078
            _gasNeeded = IsGasOperationSupported(eventCode, sensor);

            foreach (GasEndPoint gasEndPoint in dockingStation.GasEndPoints)
            {
                Cylinder cyl = gasEndPoint.Cylinder;

                // If we are examining the fresh air/zero air port to possibly add a gas to the gas end points list,
                // make sure that the type of fresh air/zero air is allowed based on port 1 descriptions.  For example,
                // if the installed cylinder is fresh air, make sure the port 1 restrictions allow for fresh
                // air to be specified on this port.
                //
                if (gasEndPoint.Position == Controller.FRESH_AIR_GAS_PORT)
                {
                    if (cyl.IsFreshAir && ((dockingStation.Port1Restrictions & PortRestrictions.FreshAir) != PortRestrictions.FreshAir))
                    {
                        Log.Debug(Name + ": FRESH AIR attached to Port 1; defined Port 1 Restrictions prohibit the use of FRESH AIR");
                        continue;
                    }

                    if (cyl.IsZeroAir && ((dockingStation.Port1Restrictions & PortRestrictions.ZeroAir) != PortRestrictions.ZeroAir))
                    {
                        Log.Debug(Name + ": ZERO AIR attached to Port 1; defined Port 1 Restrictions prohibit the use of ZERO AIR");
                        continue;
                    }
                }

                // Reset each time through loop. At end of loop, they'll be
                // set for the last cylinder matching desired gas that was looked at.
                //_expired = _empty = false; - INS-8630 RHP v7.5 Commented since if no gas is found on entire loop, then we still need to pass expired/empty if either are true.
                bool alreadyAdded = false;

                string msg = string.Format("{0} Examining port {1} ({2}), fid={3},pn={4},Fresh={5},ZeroAir={6},Exp={7},Pressure={8}",
                                           Name, gasEndPoint.Position, gasEndPoint.InstallationType.ToString(), cyl.FactoryId, cyl.PartNumber, cyl.IsFreshAir, cyl.IsZeroAir,
                                           cyl.ExpirationDate.ToShortDateString(), cyl.Pressure.ToString());
                Log.Debug(msg);

                msg = "......";
                foreach (GasConcentration gasCon in gasEndPoint.Cylinder.GasConcentrations)
                {
                    msg += "[" + gasCon.Type.Code + " ";
                    msg += (gasCon.Concentration == double.MinValue) ? "fresh" : gasCon.Concentration.ToString();
                    msg += "]";
                }
                Log.Debug(msg);

                string sensorGasCode = sensor.CalibrationGas.Code;

                // If we're doing a bump test, we use Chlorine for the calibration gas.
                if (sensor.Type.Code == SensorCode.ClO2 && eventCode == EventCode.BumpTest)
                {
                    sensorGasCode = GasCode.Cl2;
                    Log.Debug("...Sensor is CLO2. Looking for cylinders containing Chlorine instead of cal gas.");
                }

                bool containsGas = gasEndPoint.Cylinder.ContainsGas(sensorGasCode);

                if (Configuration.DockingStation.UseExpiredCylinders && (eventCode == EventCode.BumpTest))
                {
                    Log.Debug("...UseExpiredCylinders=true; Ignoring expiration date");
                }
                else if (Configuration.ToLocalTime(gasEndPoint.Cylinder.ExpirationDate) <= Configuration.GetLocalTime())
                {
                    //Log.Debug( "...Skipping expired cylinder" );
                    explanation.Append("Cylinder has expired." + '\n');
                    explanation.Append("Cylinder id =" + gasEndPoint.Cylinder.FactoryId + '\n');
                    explanation.Append("Port number: " + gasEndPoint.Position + '\n');

                    // INS-8630 RHP v7.5 - IDS is expected to display expired cylinder details on LCD
                    if (containsGas)
                    {
                        // INS-8630 RHP v7.5 - Multiple cylinder with the same gas code may be expired, in such scenarios IDS message
                        // should display the first cylinder it identifies.
                        if (!(_expired || _empty))
                        {
                            // For ISC cylinder IDS should display the cylinder part NUmber, so add the part number to explanation codes
                            if (!explanationCodes.Contains(gasEndPoint.Cylinder.PartNumber) && !string.IsNullOrEmpty(gasEndPoint.Cylinder.PartNumber))
                            {
                                explanationCodes.Add(gasEndPoint.Cylinder.PartNumber);
                                errorCodes.Add(string.Format("{0} ({1})", gasEndPoint.Cylinder.PartNumber, gasEndPoint.Position)); // see INS-3821
                            }
                            else
                            {
                                // For Non ISC Pass the gas code. But I believe that both ISC and Non-ISC cylinders have their own PArt numbers.
                                // So this condition may not be required ?
                                GasType gs = GasType.Cache[GasCode.FreshAir];
                                if (!explanationCodes.Contains(gasEndPoint.Cylinder.PartNumber) && gs != null)
                                {
                                    explanationCodes.Add(gs.Symbol);
                                    errorCodes.Add(string.Format("{0} ({1})", gs.Symbol, gs.Code));
                                }
                            }
                            _expired = true;
                        }
                        continue;
                    }
                }

                if (gasEndPoint.Cylinder.Pressure == PressureLevel.Empty)
                {
                    //Log.Debug( "...Skipping cylinder; Pressure is " + gasEndPoint.Cylinder.Pressure );
                    explanation.Append("Cylinder is empty." + '\n');
                    explanation.Append("Cylinder id =" + gasEndPoint.Cylinder.FactoryId + '\n');
                    explanation.Append("Port number: " + gasEndPoint.Position + '\n');

                    // INS-8630 RHP v7.5 - IDS is expected to display empty cylinder details on LCD
                    if (containsGas)
                    {
                        // INS-8630 RHP v7.5 - Multiple cylinder with the same gas code may be expired, in such scenarios IDS message
                        // should display the first cylinder it identifies.
                        if (!(_expired || _empty))
                        {
                            // For ISC cylinder IDS should display the cylinder part NUmber, so add the part number to explanation codes
                            if (!explanationCodes.Contains(gasEndPoint.Cylinder.PartNumber) && !string.IsNullOrEmpty(gasEndPoint.Cylinder.PartNumber))
                            {
                                explanationCodes.Add(gasEndPoint.Cylinder.PartNumber);
                                errorCodes.Add(string.Format("{0} ({1})", gasEndPoint.Cylinder.PartNumber, gasEndPoint.Position));  // see INS-3821
                            }
                            else
                            {
                                // For Non ISC Pass the gas code. But I believe that both ISC and Non-ISC cylinders have their own PArt numbers.
                                // So this condition may not be required ?
                                GasType gs = GasType.Cache[GasCode.FreshAir];
                                if (!explanationCodes.Contains(gasEndPoint.Cylinder.PartNumber) && gs != null)
                                {
                                    explanationCodes.Add(gs.Symbol);
                                    errorCodes.Add(string.Format("{0} ({1})", gs.Symbol, gs.Code));
                                }
                            }
                            _empty = true;
                        }
                        continue;
                    }
                }

                //string sensorGasCode = sensor.CalibrationGas.Code;

                if (eventCode == EventCode.BumpTest)
                {
                    // If we're doing a bump test, and this is a combustible sensor either in LEL or PPM mode,
                    // and docking station has a CombustibleBumpTestGas setting, then ignore the sensor's cal
                    // gas code and instead only look for cylinders that match the CombustibleBumpTestGas setting.
                    if ((sensor.Type.Code == SensorCode.CombustibleLEL || sensor.Type.Code == SensorCode.CombustiblePPM) &&
                        (Configuration.DockingStation.CombustibleBumpTestGas.Length > 0))
                    {
                        sensorGasCode = Configuration.DockingStation.CombustibleBumpTestGas;
                        Log.Debug(string.Format("...Sensor is combustible and CombustibleBumpTestGas setting is {0}.", sensorGasCode));
                        Log.Debug(string.Format("...Overriding sensor cal gas. Looking for cylinders containing {0}.", sensorGasCode));
                    }
                    // If we're doing a bump test, we use Chlorine for the calibration gas.
                    else if (sensor.Type.Code == SensorCode.ClO2)
                    {
                        sensorGasCode = GasCode.Cl2;
                        Log.Debug("...Sensor is CLO2. Looking for cylinders containing Chlorine instead of cal gas.");
                    }
                }

                containsGas = gasEndPoint.Cylinder.ContainsGas(sensorGasCode);

                // Ensure bump tests for O2 sensors use concentrations of 19% O2 or less.
                // Zero air cylinders should not be selected for gasFound, but should be selected for zeroFound.
                if (containsGas && (eventCode == EventCode.BumpTest && sensor.CalibrationGas.Code == GasCode.O2))
                {
                    // The following Find should always succeed because containsGas is true.
                    GasConcentration gasConcentration = cyl.GasConcentrations.Find(gc => gc.Type.Code == sensorGasCode);
                    // Parts per million (ppm) of X divided by 10,000 = percentage concentration of X
                    if ((gasConcentration.Concentration / 10000.0) > 19.0)
                    {
                        Log.Debug("...Not allowed to use O2 concentration higher than 19%.");

                        containsGas = false;
                    }
                }

                // Ensure cylinder concentration is not higher than 60% for potentially explosive cal gases
                double lelMultiplier = GasType.Cache[sensorGasCode].LELMultiplier;
                if (containsGas && lelMultiplier > 0.0)
                {
                    double cylinderPPM = -1.0;
                    foreach (GasConcentration gasConcentration in cyl.GasConcentrations)
                    {
                        if (gasConcentration.Type.Code == sensorGasCode)
                        {
                            cylinderPPM = gasConcentration.Concentration;
                            break;
                        }
                    }

                    if (cylinderPPM < 0)   // this should never happen.  Which means we better check anyways.
                    {
                        Log.Debug("...Skipping cylinder. Does not contain " + sensorGasCode);
                        continue;
                    }

                    double cylinderLEL = cylinderPPM * lelMultiplier;
                    if (cylinderLEL > 60.0)                        // cylinder is higher than 60%?  Don't use it.
                    {
                        Log.Debug(string.Format("...Skipping cylinder. Contains {0} with too high LEL concentration ({1}%)",
                                                sensorGasCode, Math.Round(cylinderLEL, 1)));
                        Log.Debug("...Not allowed to use LEL concentration higher than 60%.");
                        continue;
                    }
                }

                // The gas is found if the cylinder contains a gas with a matching code, or
                // if the cylinder is fresh air and the sensor is an O2 sensor.
                // Fresh air is not acceptable as O2 if doing a bump test.
                // Zero air is not acceptable for an O2 bump test.
                if (containsGas || ((sensor.CalibrationGas.Code == GasCode.O2) && !(eventCode == EventCode.BumpTest) && gasEndPoint.Cylinder.IsFreshAir))
                {
                    Log.Debug("...Gas found.");
                    if (HasCylinder(gasEndPoint, gasEndPoints) == false)
                    {
                        gasEndPoints.Add(gasEndPoint);
                    }
                    _gasFound    = true;
                    alreadyAdded = true;
                }

                // Nitrogen is acceptable for doing O2 bump tests.
                if (sensor.CalibrationGas.Code == GasCode.O2 &&
                    (eventCode == EventCode.BumpTest) &&
                    gasEndPoint.Cylinder.ContainsOnlyGas(GasCode.N2) == true)
                {
                    Log.Debug("...Gas found.");
                    if (HasCylinder(gasEndPoint, gasEndPoints) == false)
                    {
                        gasEndPoints.Add(gasEndPoint);
                    }
                    _gasFound = true;
                }

                if (gasEndPoint.Cylinder.IsFreshAir)
                {
                    Log.Debug("...Fresh air found.");
                    if (!alreadyAdded)
                    {
                        if (HasCylinder(gasEndPoint, gasEndPoints) == false)
                        {
                            gasEndPoints.Add(gasEndPoint);
                        }
                    }
                    _freshFound  = true;
                    alreadyAdded = true;
                }

                if (gasEndPoint.Cylinder.IsZeroAir)
                {
                    Log.Debug("...Zero Air found.");
                    if (!alreadyAdded)
                    {
                        if (HasCylinder(gasEndPoint, gasEndPoints) == false)
                        {
                            gasEndPoints.Add(gasEndPoint);
                        }
                    }
                    _zeroFound   = true;
                    alreadyAdded = true;
                }
            }   // end-foreach  Gasendpoints

            // BEGIN INS-8630 RHP v7.5 - Loop through the entire list of installed cylinders.
            // if _gasFound is set to true, then the desired gas is found and hence we can reset _expired and _empty.
            // There may be cases where a docking station may have more than one gas code of the same kind assigned to it as a part of installed cylinders and
            // put of which one of the cylinders may be expired/empty and other may be full.
            if (_empty && _gasFound)
            {
                _empty = false;
            }
            else if (_expired && _gasFound)
            {
                _expired = false;
            }
            // END INS-8630 RHP v7.5
        }
Esempio n. 38
0
 public virtual GasType SetGasType(int input)
 {
     type = (GasType)input;
     return(type);
 }
Esempio n. 39
0
 public IGasProperties GetGasProperties(GasType g)
 {
     return gasProperties[(int)g];
 }
Esempio n. 40
0
 public virtual void SetAtmosDisplay(GasType type, byte amount)
 {
     if (gasAmounts.Keys.Contains(type))
     {
         if (amount == 0)
             gasAmounts.Remove(type);
         else
             gasAmounts[type] = amount;
     }
     else
         gasAmounts.Add(type, amount);
 }