Esempio n. 1
0
        public static void PumpTest1()
        {
            Pump<TextMessage> pump = new Pump<TextMessage>();
            pump.Initialize();
            pump.Interval = 1;
            pump.Start();

            SerialFitting<TextMessage> serial = new SerialFitting<TextMessage>();
            serial.Initialize();
            serial.SerialPort.PortName = "COM3";
            serial.Open();

            SerialFitting<TextMessage> serial2 = new SerialFitting<TextMessage>();
            serial2.Initialize();
            serial2.SerialPort.PortName = "COM7";
            serial2.Open();

            pump.AddFlow(serial, serial2);
            pump.AddFlow(serial2, serial);

            serial.AddInputNotify(new Notify(NotifyOutput));
            serial2.AddInputNotify(new Notify(NotifyOutput2));

            serial.Push(new TextMessage("bla bla"));
            serial2.Push(new TextMessage("nib nib"));

            Console.ReadLine();
        }
		public void SimpleFlowArrives()
		{
var supply = new WaterSupply();
var pump = new Pump();
var drain = new Drain();
var combinator = new DialyzingFluidFlowCombinator();
pump.PumpSpeed = 7;
combinator.ConnectOutWithIn(supply.MainFlow,pump.MainFlow);
combinator.ConnectOutWithIn(pump.MainFlow, drain.MainFlow);
combinator.CommitFlow();

			var model = new DialyzingFluidFlowModel
			{
				FlowElements = new IComponent[] { supply, pump, drain, combinator }
			};
			
			var simulator = new Simulator(model); //Important: Call after all objects have been created
			simulator.SimulateStep();

			var modelAfterStep = (DialyzingFluidFlowModel) simulator.Model;
			var supplyAfterStep = (WaterSupply)modelAfterStep.Components[0];
			var pumpAfterStep = (Pump)modelAfterStep.Components[1];
			var drainAfterStep = (Drain)modelAfterStep.Components[2];
			pumpAfterStep.MainFlow.Incoming.Backward.CustomSuctionValue.Should().Be(7);
			supplyAfterStep.MainFlow.Outgoing.Forward.Quantity.Should().Be(7);
			drainAfterStep.MainFlow.Incoming.Forward.Quantity.Should().Be(7);
		}
Esempio n. 3
0
        public static void PumpingRound()
        {
            Pump<TextMessage> pump = new Pump<TextMessage>();
            pump.Initialize();
            pump.Interval = 1;
            
            Pipe<TextMessage> p1 = new Pipe<TextMessage>();
            Pipe<TextMessage> p2 = new Pipe<TextMessage>();
            Pipe<TextMessage> p3 = new Pipe<TextMessage>();
            Pipe<TextMessage> p4 = new Pipe<TextMessage>();

            p1.Initialize();
            p2.Initialize();
            p3.Initialize();
            p4.Initialize();

            pump.AddFlow(p1, p2);
            pump.AddFlow(p2, p3);
            pump.AddFlow(p3, p4);
            pump.AddFlow(p4, p1);

            p1.AddInputNotify(new Notify(NotifyOutput));
            p2.AddInputNotify(new Notify(NotifyOutput2));
            p3.AddInputNotify(new Notify(NotifyOutput));
            p4.AddInputNotify(new Notify(NotifyOutput2));
            
            p1.Push(new TextMessage("bla bla"));

            pump.Start();            

            Console.ReadLine();
        }
Esempio n. 4
0
 public static IEnumerable<Point> GetNeededTrenches(Pump pump)
 {
     var digworthy = GetDiggableAndUnDug();
     var starts = new HashSet<Point>(pump.GetPoints());
     var goals = Bb.GlaciersSet.Where(g => Bb.tileLookup[g].WaterAmount > 5);
     var impassable = new BitArray(Bb.OurSpawns).Or(Bb.TheirSpawns).Or(Bb.OurPumps).Or(Bb.TheirPumps);
     var path = Pather.AStar(starts, p => goals.Contains(p), impassable.Not(), (c, n) => digworthy.Get(n) ? 1 : 0, p => 0);
     return path.Where(p => digworthy.Get(p));
 }
Esempio n. 5
0
        public void Test3()
        {
            var f1 = new ProcessFlowHelper.Implementation.Flow();

            f1.RatedFlow = 10;
            Pump jetpump = new Pump(f1, 20);

            CoarseScreen cs         = new CoarseScreen(f1, 1);
            var          eqtankunit = new ProcessUnit();

            eqtankunit.AddEquipment(cs);
            eqtankunit.AddEquipment(jetpump);
            eqtankunit.SetDenomination("U-001");
            eqtankunit.SetDenomination("Equalization tank process unit");

            Assert.AreEqual(253.7, eqtankunit.InstalledPower);
        }
Esempio n. 6
0
        void Connect(SaslProfile saslProfile, Open open)
        {
            ITransport transport;

#if NETFX
            if (WebSocketTransport.MatchScheme(address.Scheme))
            {
                WebSocketTransport wsTransport = new WebSocketTransport();
                wsTransport.ConnectAsync(address, null).ConfigureAwait(false).GetAwaiter().GetResult();
                transport = wsTransport;
            }
            else
#endif
            {
                TcpTransport tcpTransport = new TcpTransport();
                tcpTransport.Connect(this, this.address, DisableServerCertValidation);
                transport = tcpTransport;
            }

            try
            {
                if (saslProfile != null)
                {
                    transport = saslProfile.Open(this.address.Host, transport);
                }
                else if (this.address.User != null)
                {
                    transport = new SaslPlainProfile(this.address.User, this.address.Password).Open(this.address.Host, transport);
                }
            }
            catch
            {
                transport.Close();
                throw;
            }

            this.writer = new Writer(transport);

            // after getting the transport, move state to open pipe before starting the pump
            this.SendHeader();
            this.SendOpen(open);
            this.state = State.OpenPipe;

            this.reader = new Pump(this, transport);
            this.reader.Start();
        }
Esempio n. 7
0
 public WaterCharacteristics(Oils oil, Pipe pipe, Pump pump, double 全线总摩阻, double[] 泵流量, double[] 泵扬程, double 当量粗糙度, double 流速, double 管道起点高程, double 管道终点高程)
 {
     Ma = double.Parse(oil.OutputByYear);
     H1 = double.Parse(pump.InPressure);
     hc = 全线总摩阻;
     q  = 泵流量;
     H  = 泵扬程;
     ρ  = double.Parse(oil.Density);
     L  = double.Parse(pipe.Length);
     e  = 当量粗糙度;
     ν  = double.Parse(oil.Viscosity);
     v  = 流速;
     d  = double.Parse(pipe.OuterDiameter) - 2 * double.Parse(pipe.WallThickness);
     Z  = 管道终点高程 - 管道起点高程;
     Q  = (double.Parse(oil.OutputByYear) * 10000000 / 350 / 24 / 3600) / ρ;
     ε  = 2 * e / d;
     Re = v * d / 1000 / ν;
 }
Esempio n. 8
0
        private void Button_build(object sender, RoutedEventArgs e)
        {
            IsNumber Isnumber = new IsNumber();
            Pump     pump     = new Pump(name.Text, id, head.Text, displacement.Text, power.Text, suctionPressure.Text, runTime.Text, inPressure.Text, outPressure.Text);

            if (Isnumber.isNumber(head.Text.Trim()) == false || Isnumber.isNumber(displacement.Text.Trim()) == false || Isnumber.isNumber(power.Text.Trim()) == false || Isnumber.isNumber(suctionPressure.Text.Trim()) == false || Isnumber.isNumber(runTime.Text.Trim()) == false || Isnumber.isNumber(inPressure.Text.Trim()) == false || Isnumber.isNumber(outPressure.Text.Trim()) == false)
            {
                MessageBox.Show("输入格式有误");
            }
            else
            {
                PumpDAL dal = new PumpDAL();
                dal.delPumData(id);
                dal.addPumpData(pump);
                MessageBox.Show("添加成功");
                Close();
            }
        }
Esempio n. 9
0
        private void StartService_Timer_Tick(object sender, EventArgs e)
        {
            Pump pump    = null;
            var  station = stations[Methods.Methods.getRandom(stations.Length)];

            lock (Methods.Methods.lockObj)
            {
                if (autos.Count > 0 && isRoadToStationAcceptable(station))
                {
                    var selectedAuto = autos.Dequeue();
                    pump      = pumps.First(f => f.label.Equals(station));
                    pump.Auto = selectedAuto;
                    Methods.Methods.showAutos(autos, this.TextArea);
                    station.Text = selectedAuto.ToString();
                    transactions.Add(new Transaction(pump));
                }
            }
        }
Esempio n. 10
0
        private void _worker_DoWork(object sender, DoWorkEventArgs e)
        {
            _pump = new Pump(120.9m, 0.2f, 100); // todo: load in the default from a config file
            _pump.DispenseUpdated += pump_DispenseUpdated;

            BackgroundWorker worker = sender as BackgroundWorker;

            if (worker.CancellationPending == true)
            {
                e.Cancel = true;
                break;
            }
            else
            {
                // Perform a time consuming operation and report progress.
                System.Threading.Thread.Sleep(500);
                worker.ReportProgress(i * 10);
            }
        }
Esempio n. 11
0
    public PumpsData(SaveMaster mast)
    {
        int len = mast.pumps.Length;

        numStats      = 3;
        transforms    = new float[len * 3];
        storedBarrels = new int[len];

        for (int i = 0; i < len; i++)
        {
            Pump p = mast.pumps[i];
            //x,y,rot lol
            transforms[(i * numStats)]     = p.transform.position.x;
            transforms[(i * numStats) + 1] = p.transform.position.y;
            transforms[(i * numStats) + 2] = p.transform.rotation.eulerAngles.z;

            storedBarrels[i] = p.amntContainersStored;
        }
    }
Esempio n. 12
0
        public void Test1()
        {
            var f1 = new ProcessFlowHelper.Implementation.Flow();

            f1.RatedFlow = 10;
            Pump jetpump = new Pump(f1, 20);
            var  f2      = new ProcessFlowHelper.Implementation.Flow();

            f2.RatedFlow = 20;
            var    medi   = new Medium();
            Blower blower = new Blower(100, 90, f2);

            jetpump.SetTagNumber("P-002");
            jetpump.SetDenomination("Jetpump for equalization tank");
            Assert.AreEqual("P-002", jetpump.TagNumber);
            Assert.AreEqual(0, jetpump.DigitalInput);
            Assert.AreEqual(true, jetpump.isWorking);
            Assert.AreEqual("Jetpump for equalization tank", jetpump.Denomination);
        }
Esempio n. 13
0
        static void Main(string[] args)
        {
            int          pumps = int.Parse(Console.ReadLine());
            Queue <Pump> queue = new Queue <Pump>(pumps);

            for (int i = 0; i < pumps; i++)
            {
                string[] data     = Console.ReadLine().Split();
                int      petrol   = int.Parse(data[0]);
                int      distance = int.Parse(data[1]);

                Pump pump = new Pump(petrol, distance);
                queue.Enqueue(pump);
            }


            int index = 0;

            while (true)
            {
                int petrolInTank = 0;

                foreach (Pump pump in queue)
                {
                    int nextPumpDistance  = queue.Peek().Distance;
                    int currentPumpPetrol = queue.Peek().Petrol;
                    petrolInTank += (currentPumpPetrol - nextPumpDistance);

                    if (petrolInTank < 0)
                    {
                        queue.Enqueue(queue.Dequeue());
                        index++;
                        break;
                    }
                }

                if (petrolInTank >= 0)
                {
                    break;
                }
            }
            Console.WriteLine(index);
        }
Esempio n. 14
0
        /// <summary>
        /// 根据提取方式和系统类型获取指定的数据泵,并完成数据泵的初始化。
        /// </summary>
        /// <param name="pump">元数据。</param>
        /// <returns>数据泵。</returns>
        public static DataPumpBase GetDataPump(this Pump pump)
        {
            DataPumpBase dp = null;

            switch (pump.Type)
            {
            case EnumPump.USB:
                dp = GetUsbDataDataPump(pump);
                break;

            case EnumPump.Mirror:
                dp = GetMirrorDataPump(pump);
                break;

            default:
                break;
            }
            dp?.Initialize();
            return(dp);
        }
Esempio n. 15
0
        public ActionResult Edit(Pump Pump)
        {
            try
            {
                var _ValidationErrors = new List <ValidationError>();

                if ((m_Manager as PumpManager).Update(Pump, _ValidationErrors))
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(null);
                }
            }catch (Exception Ew)
            {
                m_Logger.TraceException(Ew.Message, Ew);
                return(null);
            }
        }
Esempio n. 16
0
 public PipeWork(Oils oil, Pipe pipe, Pump pump, double[] 泵流量, double[] 泵扬程, double 当量粗糙度, double 流速, double 管道起点高程, double 管道终点高程, double 首站进站压力)
 {
     Ma          = double.Parse(oil.OutputByYear);
     q           = 泵流量;
     H           = 泵扬程;
     ρ           = double.Parse(oil.Density);
     L           = double.Parse(pipe.Length);
     e           = 当量粗糙度;
     ν           = double.Parse(oil.Viscosity);
     v           = 流速;
     d           = double.Parse(pipe.OuterDiameter) - 2 * double.Parse(pipe.WallThickness);
     outPressure = double.Parse(pump.OutPressure);
     Zz          = 管道终点高程;
     Zq          = 管道起点高程;
     Z           = 管道终点高程 - 管道起点高程;
     Hs          = 首站进站压力;
     Q           = (Ma * 10000000 / 24 / 350 / 3600) / ρ;
     Re          = v * d / 1000 / ν;
     ε           = 2 * e / d;
 }
Esempio n. 17
0
        public async Task InsertPump(string dataSite, dynamic[] dataPump)
        {
            if (dataPump != null)
            {
                var dataToInsert = new Pump();
                for (int number = 0; number < dataPump.Length; number++)
                {
                    dataToInsert.id                   = null;
                    dataToInsert.site_id              = dataSite;
                    dataToInsert.pump_profile_id      = dataPump[number].Pump_Profile_ID;
                    dataToInsert.pump_profile_pump_id = dataPump[number].Pump_Profile_Pump_ID;
                    dataToInsert.auto_authorise       = dataPump[number].Auto_Authorise;
                    dataToInsert.allow_postpay        = dataPump[number].Allow_Postpay;
                    dataToInsert.allow_prepay         = dataPump[number].Allow_Prepay;
                    dataToInsert.allow_preauth        = dataPump[number].Allow_Preauth;
                    dataToInsert.allow_monitor        = dataPump[number].Allow_Monitor;
                    dataToInsert.pump_lights          = dataPump[number].Pump_Lights;
                    dataToInsert.pump_stacking        = dataPump[number].Pump_Stacking;
                    dataToInsert.pump_auto_stacking   = dataPump[number].Pump_Auto_Stacking;
                    dataToInsert.allow_attendant      = dataPump[number].Allow_Attendant;
                    dataToInsert.prof_price_1_level   = dataPump[number].prof_Price_1_Level;
                    dataToInsert.prof_prive_2_level   = dataPump[number].prof_Price_2_Level;
                    dataToInsert.site_profile_id      = dataPump[number].Site_Profile_ID;
                    dataToInsert.fallback_allow       = dataPump[number].Fallback_allow;
                    dataToInsert.fallback_automatic   = dataPump[number].Fallback_automatic;
                    dataToInsert.tag_reader_active    = dataPump[number].Tag_Reader_Active;
                    dataToInsert.attendant_tag_auth   = dataPump[number].Attendant_Tag_Auth;
                    dataToInsert.external_tag_auth    = dataPump[number].External_Tag_Auth;
                    dataToInsert.stack_size           = dataPump[number].Stack_Size;

                    await _context.pumps.AddAsync(dataToInsert);

                    await _context.SaveChangesAsync();

                    Logger.Info("Data pump mashok = " + string.Join(" ", dataToInsert.GetType()
                                                                    .GetProperties()
                                                                    .Select(prop => prop.GetValue(dataToInsert))));
                }
                Logger.Info("Data pump inserted");
            }
        }
 private void btnUpdateFlow_Click(object sender, EventArgs e)
 {
     if (selectedComponent != null)
     {
         if (selectedComponent is Pump)
         {
             Pump   p = (Pump)selectedComponent;
             double capacity;
             double flow;
             if (double.TryParse(tbCapacity.Text, out capacity) &&
                 double.TryParse(tbCurrentFlow.Text, out flow))
             {
                 p.SetFlow(capacity, flow);
             }
             else
             {
                 MessageBox.Show("Invalid values!");
             }
         }
         selectedComponent       = null;
         this.tbCurrentFlow.Text = "";
         this.tbCapacity.Text    = "";
         panel1.Invalidate();
     }
     else if (selectedPipeline != null)
     {
         double maxFlow;
         if (double.TryParse(tbCapacity.Text, out maxFlow))
         {
             selectedPipeline.ChangeMaxFlow(maxFlow);
         }
         else
         {
             MessageBox.Show("Invalid max value!");
         }
         selectedPipeline        = null;
         this.tbCurrentFlow.Text = "";
         this.tbCapacity.Text    = "";
         panel1.Invalidate();
     }
 }
     static void Main(string[] args)
     {
         while (true)
         {
             Pump p1 = new Pump("Pump1");
 
             // Lets make sure to subscribe to StatusChanged event before you start the pump
             // with a new vehicle.
             p1.StatusChanged += StatusChanged;
 
             p1.Start(new Vehicle());
 
             Pump p2 = new Pump("Pump2");
             p2.StatusChanged += StatusChanged;
             p2.Start(new Vehicle());
 
             //Console.Write("Finished...");
             Console.ReadLine();
         }
            
     }
        public void Remove(PumpModel pumpModel)
        {
            Pump pump = _knownPumps.Where(p => Guid.Parse(p.Identifier) == pumpModel.Id).FirstOrDefault();

            Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
            {
                if (_pairedPumps.Contains(pumpModel))
                {
                    _pairedPumps.Remove(pumpModel);
                }
            });

            if (pump != null)
            {
                DataManager dataManager = DataManager.Instance;
                dataManager.DeletePump(pump);
                _knownPumps.Remove(pump);
            }

            _bluetoothManager.Disconnect();
        }
Esempio n. 21
0
        public void PumpOfferComaprerTest()
        {
            Pump first  = new Pump(1, 1, "test", 1, 1, 1);
            Pump second = new Pump(2, 1, "test", 1, 1, 1);

            PumpOffer offerOne = new PumpOffer(first, second);
            PumpOffer offerTwo = new PumpOffer(second, first);

            List <PumpOffer> offers = new List <PumpOffer>();

            offers.Add(offerOne);
            offers.Add(offerTwo);
            Assert.Equal(2, offers.Count);

            var defaultComparer = offers.Distinct();

            Assert.Equal(2, offers.Count);

            var filtered = offers.Distinct(new PumpOfferComparer());

            Assert.Equal(1, filtered.Count());
        }
Esempio n. 22
0
        public MainController(ICoffeeMakerApi cofeeMakerApi, IBoilerApi boilerApi)
        {
            var boiler = new BoilerController(boilerApi);

            var makeCoffeeButton = new MakeCoffeeButton(cofeeMakerApi);
            var waterSensor      = new WaterSensor(cofeeMakerApi);

            _pump             = new Pump(cofeeMakerApi);
            _cupSizeSelector  = new CupSizeSelector(cofeeMakerApi);
            _volumetricSensor = new VolumetricSensor(cofeeMakerApi);
            _readyLamp        = new ReadyLamp(cofeeMakerApi);

            _boilerIsReady   = boiler.BoilerIsReady;
            _waterTankIsFull = waterSensor.IsWaterTankFull();

            _volumetricSensor.Done              += StopPourCoffee;
            makeCoffeeButton.ButtonPressed      += StartPourCoffee;
            waterSensor.WaterTaankStatusChanged += OnWaterSensorWaterTaankStatusChanged;
            boiler.BoilerStatusChanged          += OnBoilerStatusChanged;

            CheckReadyLamp();
        }
Esempio n. 23
0
        /// <summary>
        /// Check the vacuum sensor.
        /// </summary>
        /// <remarks>
        /// Engineering Notes: This step is to check if the reading of vacuum sensor is reasonable.
        /// After the initialization, the vacuum (negative pressure) should be close to zero.
        /// Failure on this test indicates possible issues on vacuum sensor, or A2D converter,
        /// or some tubing is blocked by something.
        /// </remarks>
        /// <param name="details">The string to hold details.</param>
        private void TestVacuumSensor(DetailsBuilder details)
        {
            Pump.CloseAllValves( true );

            Thread.Sleep(500); // Give the valves a chance to finish closing

            Pump.OpenValve(1, false); // Open solenoid 1
            Thread.Sleep(500); // Pause at least 500ms.

            // Read the vacuum pressure
            ushort vacuumCount = Pump.GetRawVacuum();
            int vacuumVoltage = CountToVoltage(vacuumCount);

            // Test vacuum readings
            // Vacuum count value should be in the range of 62 (200mV) to 128 (410 mV), inclusive.
            // The normal vacuum count is 77.

            // Report results
            string vacuumString = BuildCountAndUnitString(vacuumCount, vacuumVoltage, DiagnosticResources.MILLIVOLTS);
            _gdpList.Add(new GeneralDiagnosticProperty("DIAGNOSTIC_VACUUM", vacuumCount.ToString()));
            ReportDiagnostic(details, DiagnosticResources.VACUUM, vacuumString, ((vacuumCount < 62) || (vacuumCount > 128)));
        }
Esempio n. 24
0
        static void Main(string[] args)
        {
            IPump            myPump            = new Pump();
            ITightner        myTightner        = new Tightner();
            ICompressionCtrl myCompressionCtrl = new LaceCompressionCtrl(myTightner);

            INotificationDevice myGreenLed     = new LedGreen();
            INotificationDevice myReDevice     = new LedRed();
            INotificationDevice myVibrator     = new Vibrator();
            INotification       myNotification = new Notification(myGreenLed, myReDevice, myVibrator);

            IButtonHandler           myStockingCtrl = new StockingCtrl(myCompressionCtrl, myNotification);
            ICompressionEventHandler myEventHandler = new StockingCtrl(myCompressionCtrl, myNotification);

            myCompressionCtrl.AddNotificationCenter(myEventHandler);

            ConsoleKeyInfo consoleKeyInfo;

            Console.WriteLine("Compression Stocking Control User Interface");
            Console.WriteLine("A:   Compress");
            Console.WriteLine("Z:   Decompress");
            Console.WriteLine("ESC: Terminate application");

            do
            {
                consoleKeyInfo = Console.ReadKey(true); // true = do not echo character

                if (consoleKeyInfo.Key == ConsoleKey.A)
                {
                    myStockingCtrl.StartButtonPushed();
                }

                if (consoleKeyInfo.Key == ConsoleKey.Z)
                {
                    myStockingCtrl.StopButtonPushed();
                }
            } while (consoleKeyInfo.Key != ConsoleKey.Escape);
        }
Esempio n. 25
0
        private static Pump CreatePump(IDevice device, out SourceFileItem souce)
        {
            Pump pump = null;

            switch (device.DeviceType)
            {
            case EnumDeviceType.SDCard:
                pump = new Pump {
                    OSType = EnumOSType.SDCard, Type = EnumPump.SDCard
                };
                break;

            case EnumDeviceType.SIM:
                pump = new Pump {
                    OSType = EnumOSType.SIMCard, Type = EnumPump.SIMCard
                };
                break;

            case EnumDeviceType.Phone when device is Device dev:
                pump = new Pump {
                    OSType = dev.OSType, Type = EnumPump.Mirror
                };
                break;

            default:
                souce = null;
                return(null);
            }
            SourceFileItem item = new SourceFileItem();

            item.ItemType  = SourceFileItemType.NormalPath;
            item.Config    = @"/system/build.prop";
            souce          = item;
            pump.Source    = device;
            pump.ScanModel = ScanFileModel.Quick;
            return(pump);
        }
Esempio n. 26
0
        private static DataPumpBase GetUsbDataDataPump(Pump key, Int32 hash)
        {
            if (DataPumpCaches.ContainsKey(hash))
            {
                return(DataPumpCaches[hash]);
            }

            var          device   = (Device)key.Source;
            DataPumpBase dataPump = null;

            switch (key.OSType)
            {
            case EnumOSType.Android:
                if (device.IsRoot || device.Status == EnumDeviceStatus.Recovery)
                {
                    dataPump = new AndroidUsbDataPump();
                }
                else if (device.Brand.ToSafeString().ToLower() == "vivo" || device.Manufacture.ToSafeString().ToLower() == "vivo")
                {
                    dataPump = new AndroidVivoBackupDataPump();
                }
                else
                {
                    dataPump = new AndroidUsbUnrootDataPump();
                }
                break;

            case EnumOSType.IOS:
                dataPump = new IOSUsbDataPump();
                break;

            default:
                throw new NotSupportedException(key.OSType.ToString());
            }
            DataPumpCaches.Add(hash, dataPump);
            return(dataPump);
        }
        private PumpStateModel2Model GetPumpStateModel2(Pump pump)
        {
            var mongoDB    = new ControlRoomMongoContext().GetDatabase();
            var collection = mongoDB.GetCollection <PumpStateModel2Mongo>();
            var state      = collection.Find(t => t.PumpId == pump.Id.ToString())
                             .SortByDescending(t => t.DateAndTime).FirstOrDefault();

            if (state == null)
            {
                return(new PumpStateModel2Model());
            }

            var result = new PumpStateModel2Model();

            result.PumpId      = Guid.Parse(state.PumpId);
            result.IndexNo     = (int)state.IndexNo;
            result.DateAndTime = state.DateAndTime;
            result.Status      = state.Status;
            result.LEDEngine   = state.LEDEngine;
            result.StatusBar   = state.StatusBar;
            result.Speed       = state.Speed;
            result.FuelLevel   = state.FuelLevel;
            result.Battery     = state.Battery;
            result.OilPressure = state.OilPressure;
            result.Charge      = state.Charge;
            result.Frequency   = state.Frequency;
            result.KWh         = state.KWh;
            result.Temperature = state.Temperature;
            result.Pressure    = state.Pressure;
            result.Vibration   = state.Vibration;
            result.FlowMeter   = state.FlowMeter;
            result.TimeMTNHour = state.TimeMTNHour;
            result.TimeMTNMin  = state.TimeMTNMin;
            result.TimeMTNSec  = state.TimeMTNSec;
            result.LEDOffFuel  = state.LEDOffFuel;
            return(result);
        }
Esempio n. 28
0
 /// <summary>
 /// 初始化
 /// </summary>
 /// <param name="pump">提取信息。</param>
 /// <param name="extractItems">提取项列表。</param>
 private Boolean Initialization(Pump pump, ExtractItem[] extractItems)
 {
     if (pump == null)
     {
         return(false);
     }
     if (extractItems == null || extractItems.Length == 0)
     {
         return(false);
     }
     _pluginAdapter = PluginAdapter.Instance;
     if (_pluginAdapter == null)
     {
         return(false);
     }
     DataItemsCount     = 0;
     DataPump           = pump.GetDataPump();
     _extractItems      = extractItems;
     _cancelTokenSource = new CancellationTokenSource();
     _cancelToken       = _cancelTokenSource.Token;
     FileHelper.CreateExitsDirectory(pump.SourceStorePath);
     Reporter?.Reset();
     return(true);
 }
Esempio n. 29
0
        private void lst_pumps_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (lst_pumps.SelectedItems.Count > 0)
                {
                    GetNozzels(commonFunctions.ToInt(lst_pumps.SelectedItems[0].Tag.ToString()));
                    RepositoryBase <Pump> prepo = new RepositoryBase <Pump>("Pumps");
                    Pump Pump = prepo.Get(commonFunctions.ToInt(lst_pumps.SelectedItems[0].Tag.ToString()));
                    if (Pump != null)
                    {
                        lbl_id.Text = Pump.Id.ToString();

                        txt_pumpname.Text     = Pump.PumpName;
                        txt_pumporder.Value   = Pump.PumpOrderNo;
                        txt_noofnozzels.Value = Pump.NoofNozzels;
                        lbl_selectedPump.Text = Pump.PumpName;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
        private void panel1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            selectedComponent = myNetwork.GetComponent(e.Location);

            Pump p = selectedComponent as Pump;

            if (p != null)
            {
                this.tbCurrentFlow.Text = p.Flow.ToString();
                this.tbCapacity.Text    = p.Capacity.ToString();
            }

            Components.Splitter splitterComp = selectedComponent as Components.Splitter;
            if (splitterComp != null && splitterComp.IsAdjustable)
            {
                splitterTrackBar.Visible = true;
                AdjSplitLb.Visible       = true;
                AdjSplitLb1.Visible      = true;
            }
            else
            {
                splitterTrackBar.Visible = false;
                AdjSplitLb.Visible       = false;
                AdjSplitLb1.Visible      = false;
            }
            if (selectedComponent != null)
            {
                selectedPipeline    = null;
                selectedPipelineLoc = new Point(0, 0);
            }
            else
            {
                selectedPipelineLoc = e.Location;
            }
            panel1.Invalidate();
        }
	private void InitializeComponents(int x, int y, int width, int height, int tankCapacity, int pumpCapacity){
		
		this.Bounds = new Rectangle(x, y, width, height);
	  this.BackColor = Color.White;
		this.BorderStyle = BorderStyle.Fixed3D;
		_graphics = this.CreateGraphics();
		_bottomLeft = new Point(0, height);
		_bottomRight = new Point(width, height);
		_tankCapacity = tankCapacity;
		_currentWaterLevel = EMPTY;
		_itsPump = new Pump(this, pumpCapacity);
		_penWidth = this.Height/(_tankCapacity/_itsPump.PumpingCapacity);
		if(_penWidth < 1) _penWidth = 1;
    _whitePen = new Pen(Color.White, _penWidth);
		_bluePen = new Pen(Color.Blue, _penWidth);
		_highLevelSensor = new WaterLevelSensor(tankCapacity - pumpCapacity, EMPTY);
		_highLevelSensor.SensorMode = WaterLevelSensor.Mode.HighLevelIndicator;
		_highLevelSensor.Fill += new WaterLevelEventHandler(_itsPump.FillTankEventHandler);
		_highLevelSensor.Full += new WaterLevelEventHandler(_itsPump.FullTankEventHandler);
		_lowLevelSensor = new WaterLevelSensor(pumpCapacity, EMPTY);
		_lowLevelSensor.SensorMode = WaterLevelSensor.Mode.LowLevelIndicator;
		_lowLevelSensor.Drain += new WaterLevelEventHandler(_itsPump.DrainTankEventHandler);
		_lowLevelSensor.Empty += new WaterLevelEventHandler(_itsPump.EmptyTankEventHandler);
	}
Esempio n. 32
0
        protected override Boolean InitAtFirstTime()
        {
            Pump   metadata = Metadata;
            Device device   = metadata.Source as Device;

            if (device == null)
            {
                return(false);
            }
            IOSDeviceManager dm = device.DeviceManager as IOSDeviceManager;

            if (dm == null)
            {
                return(false);
            }
            String savePath = dm.CopyUserData(device, metadata.SourceStorePath, null);

            _savePath = savePath;
            if (FileHelper.IsValidDictory(savePath))
            {
                RenameUnofficialApp(savePath);
            }
            return(true);
        }
    private GameObject CreatePump(int id, int typeId, string line)
    {
        int startNodeID = FileReaderHelper.GetNextIntNumber(line);

        line = line.Remove(0, FileReaderHelper.FindNextNumberIndex(line));

        int endNodeID = FileReaderHelper.GetNextIntNumber(line);

        line = line.Remove(0, FileReaderHelper.FindNextNumberIndex(line));

        float flow = FileReaderHelper.GetNextNumber(line);

        line = line.Remove(0, FileReaderHelper.FindNextNumberIndex(line));

        float flowVelocity = FileReaderHelper.GetNextNumber(line);

        line = line.Remove(0, FileReaderHelper.FindNextNumberIndex(line));

        int curveTypeID = (int)FileReaderHelper.GetNextNumber(line);

        var startNodePos = MainSimulationManager.ComponentsHelper.GetComponentPosition(startNodeID);
        var endNodePos   = MainSimulationManager.ComponentsHelper.GetComponentPosition(endNodeID);

        GameStateManager.Instance.SetInactiveState();
        GameStateManager.Instance.SetPathCreationState();

        var obj        = LineGenerator.Instance.CreateAndReturnLineComponent(startNodePos, endNodePos, typeId);
        var pumpScript = new Pump(id, typeId, startNodeID, endNodeID, flow, flowVelocity, curveTypeID);

        obj.GetComponent <Pump>().Init(pumpScript);

        GameStateManager.Instance.SetInactiveState();
        GameStateManager.Instance.SetDragComponentsState();

        return(obj);
    }
Esempio n. 34
0
 public void DefaultPump()
 {
     Pump pump = new Pump("testPump");
     Assert.IsTrue(pump.Validate().IsValid);
 }
        private void PumpsearchButton_OnClick(object sender, RoutedEventArgs e)
        {
            PumpunitListView.ItemsSource = null;
            StringBuilder remoteip = new StringBuilder(255);
            var inipath = System.AppDomain.CurrentDomain.BaseDirectory + "config.ini";
            GetPrivateProfileString("REMOTEDB", "ip", "127.0.0.1", remoteip, 255, inipath);
            String mysqlStr = "server=" + remoteip + ";uid=pump;pwd=pumpszmmcd;database=pump_performance";
            var mysql = new SqlConnection(mysqlStr);
            try
            {
                var sql = "select * from pump_code1 where pumpno like '%" + pumpcode.Text + "%'";
                mysql.Open();
                var cmd = mysql.CreateCommand();
                cmd.CommandText = sql;
                var reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    pumps.Clear();
                    if (reader.Read())
                    {
                        Pump pump = new Pump();
                        pump.PumpNo = reader.GetString(3);
                        pump.PumpUnit = reader.GetString(4);
                        pump.PumpCode = reader.GetString(5).Replace(" ", "");
                        pump.TankNo = "1";
                        pumps.Add(pump);
                        pump = new Pump();
                        pump.PumpNo = reader.GetString(3);
                        pump.PumpUnit = reader.GetString(6);
                        pump.PumpCode = reader.GetString(7).Replace(" ", "");
                        pump.TankNo = "2";
                        pumps.Add(pump);
                        pump = new Pump();
                        pump.PumpNo = reader.GetString(3);
                        pump.PumpUnit = reader.GetString(8);
                        pump.PumpCode = reader.GetString(9).Replace(" ", "");
                        pump.TankNo = "3";
                        pumps.Add(pump);
                        pump = new Pump();
                        pump.PumpNo = reader.GetString(3);
                        pump.PumpUnit = reader.GetString(10);
                        pump.PumpCode = reader.GetString(11).Replace(" ", "");
                        pump.TankNo = "4";
                        pumps.Add(pump);

                    }

                    PumpunitListView.ItemsSource = pumps;
                    PumpunitListView.SelectedIndex = 0;
                    pumpcode.Text = pumps[0].PumpNo;
                }
                reader.Close();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(this, ex.Message /*"打开本地数据库失败,请确认配置中指向的本地数据库是否存在"*/, "错误", MessageBoxButton.OK);
            }
            finally
            {
                mysql.Close();
                //                 StartButton_OnClick(this, new RoutedEventArgs());
            }
        }
        public SetupForm(Pump aPump, IItemBrowser aBrowser)
        {
            mPump       = aPump;
            mBrowser    = aBrowser;
            InitializeComponent();

            checkBox_IgnoreCommands.Checked = mPump.IgnoreCommands;

            if (mPump.mOnCMDItemHandle != -1)
            {
                itemEditBox_OnCMD.ItemName      = mBrowser.getItemNameByHandle(mPump.mOnCMDItemHandle);
                itemEditBox_OnCMD.ItemToolTip   = mBrowser.getItemToolTipByHandle(mPump.mOnCMDItemHandle);
            }

            if (mPump.mOffCMDItemHandle != -1)
            {
                itemEditBox_OffCMD.ItemName     = mBrowser.getItemNameByHandle(mPump.mOffCMDItemHandle);
                itemEditBox_OffCMD.ItemToolTip  = mBrowser.getItemToolTipByHandle(mPump.mOffCMDItemHandle);
            }

            if (mPump.mEsdCMDItemHandle != -1)
            {
                itemEditBox_EsdCMD.ItemName     = mBrowser.getItemNameByHandle(mPump.mEsdCMDItemHandle);
                itemEditBox_EsdCMD.ItemToolTip  = mBrowser.getItemToolTipByHandle(mPump.mEsdCMDItemHandle);
            }

            spinEdit_On.Value    = mPump.OnMS;
            spinEdit_Off.Value   = mPump.OffMS;

            if (mPump.mOnItemHandle != -1)
            {
                itemEditBox_On.ItemName     = mBrowser.getItemNameByHandle(mPump.mOnItemHandle);
                itemEditBox_On.ItemToolTip  = mBrowser.getItemToolTipByHandle(mPump.mOnItemHandle);
            }

            if (mPump.mAlarmItemHandle != -1)
            {
                itemEditBox_Alarm.ItemName      = mBrowser.getItemNameByHandle(mPump.mAlarmItemHandle);
                itemEditBox_Alarm.ItemToolTip   = mBrowser.getItemToolTipByHandle(mPump.mAlarmItemHandle);
            }

            if (mPump.mPowerItemHandle != -1)
            {
                itemEditBox_Power.ItemName      = mBrowser.getItemNameByHandle(mPump.mPowerItemHandle);
                itemEditBox_Power.ItemToolTip   = mBrowser.getItemToolTipByHandle(mPump.mPowerItemHandle);
            }

            if (mPump.mRemoteItemHandle != -1)
            {
                itemEditBox_Remote.ItemName     = mBrowser.getItemNameByHandle(mPump.mRemoteItemHandle);
                itemEditBox_Remote.ItemToolTip  = mBrowser.getItemToolTipByHandle(mPump.mRemoteItemHandle);
            }

            if (mPump.mOnBtnItemHandle != -1)
            {
                itemEditBox_OnBtn.ItemName      = mBrowser.getItemNameByHandle(mPump.mOnBtnItemHandle);
                itemEditBox_OnBtn.ItemToolTip   = mBrowser.getItemToolTipByHandle(mPump.mOnBtnItemHandle);
            }

            if (mPump.mOffBtnItemHandle != -1)
            {
                itemEditBox_OffBtn.ItemName     = mBrowser.getItemNameByHandle(mPump.mOffBtnItemHandle);
                itemEditBox_OffBtn.ItemToolTip  = mBrowser.getItemToolTipByHandle(mPump.mOffBtnItemHandle);
            }
        }
Esempio n. 37
0
        void Connect(SaslProfile saslProfile, Open open)
        {
            ITransport transport;
#if NETFX
            if (WebSocketTransport.MatchScheme(address.Scheme))
            {
                WebSocketTransport wsTransport = new WebSocketTransport();
                wsTransport.ConnectAsync(address).GetAwaiter().GetResult();
                transport = wsTransport;
            }
            else
#endif
            {
                TcpTransport tcpTransport = new TcpTransport();
                tcpTransport.Connect(this, this.address, DisableServerCertValidation);
                transport = tcpTransport;
            }

            if (saslProfile != null)
            {
                transport = saslProfile.Open(this.address.Host, transport);
            }
            else if (this.address.User != null)
            {
                transport = new SaslPlainProfile(this.address.User, this.address.Password).Open(this.address.Host, transport);
            }

            this.transport = transport;

            // after getting the transport, move state to open pipe before starting the pump
            this.SendHeader();
            this.SendOpen(open);
            this.state = State.OpenPipe;

            this.reader = new Pump(this);
            this.reader.Start();
        }
        public void SetUp()
        {
            pump = new Pump();

            receiver = new TransportReceiver("FakeReceiver", pump, new PushSettings("queue", "queue", true, TransportTransactionMode.SendsAtomicWithReceive), new PushRuntimeSettings(), null, null, null);
        }
Esempio n. 39
0
    public static bool WillBePumping(Pump pump)
    {
        var starts = pump.GetPoints();
        var goals = Bb.GlaciersSet.Where(g => Bb.tileLookup[g].WaterAmount > 6).ToBitArray();
        var passable = new BitArray(Bb.Water).Or(starts.ToBitArray()).Or(goals).Or(Bb.Trenches);

        return Pather.AStar(starts, p => goals.Get(p), passable, (c, n) => 1, p => 0) != null;
    }
Esempio n. 40
0
        void Connect(SaslProfile saslProfile, Open open)
        {
            ITransport transport;
            TcpTransport tcpTransport = new TcpTransport();
            tcpTransport.Connect(this, this.address, DisableServerCertValidation);
            transport = tcpTransport;

            if (saslProfile != null)
            {
                transport = saslProfile.Open(this.address.Host, transport);
            }
            else if (this.address.User != null)
            {
                transport = new SaslPlainProfile(this.address.User, this.address.Password).Open(this.address.Host, transport);
            }

            this.transport = transport;

            // after getting the transport, move state to open pipe before starting the pump
            this.SendHeader();
            this.SendOpen(open);
            this.state = State.OpenPipe;

            this.reader = new Pump(this);
            this.reader.Start();
        }
Esempio n. 41
0
    public static void ReadBoard()
    {
        if (!init)
        {
            throw new Exception("Must call Init(AI ai) before using ReadBoard()");
        }
        Reset();

        tileLookup = BaseAI.tiles.ToDictionary(t => t.ToPoint());

        foreach (Tile tile in BaseAI.tiles)
        {
            int offset = GetOffset(tile.X, tile.Y);
            Point point = new Point(tile.X, tile.Y);

            // IsSpawning
            if (tile.IsSpawning)
            {
                IsSpawning[offset] = true;
            }

            // Glaciers
            if (tile.Depth == 0 && tile.WaterAmount > 0 && tile.Owner == 3)
            {
                Glaciers[offset] = true;
                GlaciersSet.Add(point);
            }

            // Trenches
            if (tile.Depth > 0 && tile.WaterAmount == 0)
            {
                Trenches[offset] = true;
            }

            // Water
            if (tile.Depth > 0 && tile.WaterAmount > 0)
            {
                Water[offset] = true;
            }

            // Our Spawns
            if (tile.Owner == usId && tile.PumpID == -1)
            {
                OurSpawns[offset] = true;
                OurSpawnSet.Add(point);
            }

            // Their Spawns
            if (tile.Owner == themId && tile.PumpID == -1)
            {
                TheirSpawns[offset] = true;
                TheirSpawnSet.Add(point);
            }

            // Our Pumps
            if (tile.Owner == usId && tile.PumpID != -1)
            {
                OurPumps[offset] = true;
            }

            // Their Pumps
            if (tile.Owner == themId && tile.PumpID != -1)
            {
                TheirPumps[offset] = true;
            }

            // Neutral Pumps
            if (tile.Owner == 2 && tile.PumpID != -1)
            {
                NeutralPumps[offset] = true;
            }
        }

        // Units
        foreach (Unit unit in BaseAI.units)
        {
            Point point = new Point(unit.X, unit.Y);
            int offset = GetOffset(point);

            // Our Units
            if (unit.Owner == usId)
            {
                OurUnits[offset] = true;
                OurUnitsSet.Add(unit);
                switch (unit.Type)
                {
                    case 0: OurWorkersSet.Add(unit); break;
                    case 1: OurScoutsSet.Add(unit); break;
                    case 2: OurTanksSet.Add(unit); break;
                }
            }

            // Their Units
            if (unit.Owner == themId)
            {
                TheirUnits[offset] = true;
                TheirUnitsSet.Add(unit);
                switch (unit.Type)
                {
                    case 0: TheirWorkersSet.Add(unit); break;
                    case 1: TheirScoutsSet.Add(unit); break;
                    case 2: TheirTanksSet.Add(unit); break;
                }
            }
        }

        var pumps = new BitArray(OurPumps).Or(TheirPumps).Or(NeutralPumps);
        var pumpLookup = BaseAI.pumpStations.ToDictionary(p => p.Id);
        foreach (var p in pumps.ToPoints())
        {
            var tile = tileLookup[p];
            if (!pumpLookup.ContainsKey(tile.PumpID))
            {
                continue;
            }
            var ps = pumpLookup[tile.PumpID];
            pumpLookup.Remove(ps.Id);

            var pump = new Pump(ps, p);
            if (pump.station.SiegeAmount > 0)
            {
                UnderSiege[GetOffset(pump.SW.x, pump.SW.y)] = true;
                UnderSiege[GetOffset(pump.NW.x, pump.NW.y)] = true;
                UnderSiege[GetOffset(pump.SE.x, pump.SE.y)] = true;
                UnderSiege[GetOffset(pump.NE.x, pump.NE.y)] = true;
            }
            if (tile.Owner == usId)
            {
                OurPumpSet.Add(pump);
            }
            else if (tile.Owner == themId)
            {
                TheirPumpSet.Add(pump);
            }
            else
            {
                NeutralPumpSet.Add(pump);
            }
        }

        pumpPointLookup = OurPumpSet.Union(TheirPumpSet).Union(NeutralPumpSet)
            .SelectMany(pump => pump.GetPoints().Select(point => new { ump = pump, oint = point }))
            .ToDictionary(a => a.oint, a => a.ump);
    }
Esempio n. 42
0
 private void SpawnTanks(Func<IEnumerable<Point>, IEnumerable<Point>, Point> CalcSpawnPoint)
 {
     if (finalPump == null)
     {
         finalPump = FindFinalPump();
     }
     int maxTanks = 4;
     if (finalPump.station.Owner != Bb.usId)
     {
         maxTanks = 3;
     }
     bool spawned = true;
     while (players[playerID()].Oxygen >= 15 && Bb.OurTanksSet.Count < maxTanks && spawned)
     {
         var spawnPoint = CalcSpawnPoint(Bb.GetOurSpawnable().ToPoints(), finalPump.GetPoints());
         if (finalPump.GetPoints().Contains(spawnPoint))
         {
             spawned = Bb.tileLookup[spawnPoint].spawn((int)Types.Tank);
         }
         else
         {
             spawned = Bb.tileLookup[spawnPoint].spawn((int)Types.Scout);
         }
         Bb.ReadBoard();
     }
 }
Esempio n. 43
0
        public override void Start()
        {
            base.Start();

            radioSpeakerName = TextManager.Get("Tutorial.Radio.Speaker");
            engineer         = Character.Controlled;

            var toolbox = engineer.Inventory.FindItemByIdentifier("toolbox");

            toolbox.Unequip(engineer);
            engineer.Inventory.RemoveItem(toolbox);

            var repairOrder = Order.PrefabList.Find(order => order.AITag == "repairsystems");

            engineer_repairIcon      = repairOrder.SymbolSprite;
            engineer_repairIconColor = repairOrder.Color;

            var reactorOrder = Order.PrefabList.Find(order => order.AITag == "operatereactor");

            engineer_reactorIcon      = reactorOrder.SymbolSprite;
            engineer_reactorIconColor = reactorOrder.Color;

            // Other tutorial items
            tutorial_securityFinalDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_securityfinaldoorlight")).GetComponent <LightComponent>();
            tutorial_mechanicFinalDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_mechanicfinaldoorlight")).GetComponent <LightComponent>();
            tutorial_submarineSteering      = Item.ItemList.Find(i => i.HasTag("command")).GetComponent <Steering>();

            tutorial_submarineSteering.CanBeSelected = false;
            foreach (ItemComponent ic in tutorial_submarineSteering.Item.Components)
            {
                ic.CanBeSelected = false;
            }

            SetDoorAccess(null, tutorial_securityFinalDoorLight, false);
            SetDoorAccess(null, tutorial_mechanicFinalDoorLight, false);

            // Room 2
            engineer_equipmentObjectiveSensor = Item.ItemList.Find(i => i.HasTag("engineer_equipmentobjectivesensor")).GetComponent <MotionSensor>();
            engineer_equipmentCabinet         = Item.ItemList.Find(i => i.HasTag("engineer_equipmentcabinet")).GetComponent <ItemContainer>();
            engineer_firstDoor      = Item.ItemList.Find(i => i.HasTag("engineer_firstdoor")).GetComponent <Door>();
            engineer_firstDoorLight = Item.ItemList.Find(i => i.HasTag("engineer_firstdoorlight")).GetComponent <LightComponent>();

            SetDoorAccess(engineer_firstDoor, engineer_firstDoorLight, false);

            // Room 3
            engineer_reactorObjectiveSensor = Item.ItemList.Find(i => i.HasTag("engineer_reactorobjectivesensor")).GetComponent <MotionSensor>();
            tutorial_oxygenGenerator        = Item.ItemList.Find(i => i.HasTag("tutorial_oxygengenerator")).GetComponent <Powered>();
            engineer_reactor                       = Item.ItemList.Find(i => i.HasTag("engineer_reactor")).GetComponent <Reactor>();
            engineer_reactor.FireDelay             = engineer_reactor.MeltdownDelay = float.PositiveInfinity;
            engineer_reactor.FuelConsumptionRate   = 0.0f;
            engineer_reactor.OnOffSwitch.BarScroll = 1f;
            reactorOperatedProperly                = false;

            engineer_secondDoor      = Item.ItemList.Find(i => i.HasTag("engineer_seconddoor")).GetComponent <Door>();;
            engineer_secondDoorLight = Item.ItemList.Find(i => i.HasTag("engineer_seconddoorlight")).GetComponent <LightComponent>();

            SetDoorAccess(engineer_secondDoor, engineer_secondDoorLight, false);

            // Room 4
            engineer_repairJunctionBoxObjectiveSensor = Item.ItemList.Find(i => i.HasTag("engineer_repairjunctionboxobjectivesensor")).GetComponent <MotionSensor>();
            engineer_brokenJunctionBox = Item.ItemList.Find(i => i.HasTag("engineer_brokenjunctionbox"));
            engineer_thirdDoor         = Item.ItemList.Find(i => i.HasTag("engineer_thirddoor")).GetComponent <Door>();
            engineer_thirdDoorLight    = Item.ItemList.Find(i => i.HasTag("engineer_thirddoorlight")).GetComponent <LightComponent>();

            engineer_brokenJunctionBox.Indestructible = false;
            engineer_brokenJunctionBox.Condition      = 0f;

            SetDoorAccess(engineer_thirdDoor, engineer_thirdDoorLight, false);

            // Room 5
            engineer_disconnectedJunctionBoxObjectiveSensor = Item.ItemList.Find(i => i.HasTag("engineer_disconnectedjunctionboxobjectivesensor")).GetComponent <MotionSensor>();

            engineer_disconnectedJunctionBoxes    = new PowerTransfer[4];
            engineer_disconnectedConnectionPanels = new ConnectionPanel[4];

            for (int i = 0; i < engineer_disconnectedJunctionBoxes.Length; i++)
            {
                engineer_disconnectedJunctionBoxes[i]           = Item.ItemList.Find(item => item.HasTag($"engineer_disconnectedjunctionbox_{i + 1}")).GetComponent <PowerTransfer>();
                engineer_disconnectedConnectionPanels[i]        = engineer_disconnectedJunctionBoxes[i].Item.GetComponent <ConnectionPanel>();
                engineer_disconnectedConnectionPanels[i].Locked = false;

                for (int j = 0; j < engineer_disconnectedJunctionBoxes[i].PowerConnections.Count; j++)
                {
                    foreach (Wire wire in engineer_disconnectedJunctionBoxes[i].PowerConnections[j].Wires)
                    {
                        if (wire == null)
                        {
                            continue;
                        }
                        wire.Locked = true;
                    }
                }
            }

            engineer_wire_1             = Item.ItemList.Find(i => i.HasTag("engineer_wire_1"));
            engineer_wire_1.SpriteColor = Color.Transparent;
            engineer_wire_2             = Item.ItemList.Find(i => i.HasTag("engineer_wire_2"));
            engineer_wire_2.SpriteColor = Color.Transparent;
            engineer_lamp_1             = Item.ItemList.Find(i => i.HasTag("engineer_lamp_1")).GetComponent <Powered>();
            engineer_lamp_2             = Item.ItemList.Find(i => i.HasTag("engineer_lamp_2")).GetComponent <Powered>();
            engineer_fourthDoor         = Item.ItemList.Find(i => i.HasTag("engineer_fourthdoor")).GetComponent <Door>();
            engineer_fourthDoorLight    = Item.ItemList.Find(i => i.HasTag("engineer_fourthdoorlight")).GetComponent <LightComponent>();
            SetDoorAccess(engineer_fourthDoor, engineer_fourthDoorLight, false);

            // Room 6
            engineer_workingPump = Item.ItemList.Find(i => i.HasTag("engineer_workingpump")).GetComponent <Pump>();
            engineer_workingPump.Item.CurrentHull.WaterVolume += engineer_workingPump.Item.CurrentHull.Volume;
            engineer_workingPump.IsActive = true;
            tutorial_lockedDoor_1         = Item.ItemList.Find(i => i.HasTag("tutorial_lockeddoor_1")).GetComponent <Door>();
            SetDoorAccess(tutorial_lockedDoor_1, null, true);

            // Submarine
            tutorial_submarineDoor      = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoor")).GetComponent <Door>();
            tutorial_submarineDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoorlight")).GetComponent <LightComponent>();
            SetDoorAccess(tutorial_submarineDoor, tutorial_submarineDoorLight, true);

            tutorial_enteredSubmarineSensor = Item.ItemList.Find(i => i.HasTag("tutorial_enteredsubmarinesensor")).GetComponent <MotionSensor>();
            engineer_submarineJunctionBox_1 = Item.ItemList.Find(i => i.HasTag("engineer_submarinejunctionbox_1"));
            engineer_submarineJunctionBox_2 = Item.ItemList.Find(i => i.HasTag("engineer_submarinejunctionbox_2"));
            engineer_submarineJunctionBox_3 = Item.ItemList.Find(i => i.HasTag("engineer_submarinejunctionbox_3"));
            engineer_submarineReactor       = Item.ItemList.Find(i => i.HasTag("engineer_submarinereactor")).GetComponent <Reactor>();
            engineer_submarineReactor.OnOffSwitch.BarScrollValue = .25f;
            engineer_submarineReactor.IsActive = engineer_submarineReactor.AutoTemp = false;

            engineer_submarineJunctionBox_1.Indestructible = false;
            engineer_submarineJunctionBox_1.Condition      = 0f;
            engineer_submarineJunctionBox_2.Indestructible = false;
            engineer_submarineJunctionBox_2.Condition      = 0f;
            engineer_submarineJunctionBox_3.Indestructible = false;
            engineer_submarineJunctionBox_3.Condition      = 0f;
        }
Esempio n. 44
0
		public ControlSystem(Dialyzer dialyzer, ExtracorporealBloodCircuit.ExtracorporealBloodCircuit extracorporealBloodCircuit, DialyzingFluidDeliverySystem.DialyzingFluidDeliverySystem dialyzingFluidDeliverySystem)
		{
			Dialyzer = dialyzer;
			WaterPreparation = dialyzingFluidDeliverySystem.WaterPreparation;
			DialyzingFluidPreparation = dialyzingFluidDeliverySystem.DialyzingFluidPreparation;
			UltraFiltrationPump = dialyzingFluidDeliverySystem.DialyzingUltraFiltrationPump;
			SafetyBypass = dialyzingFluidDeliverySystem.SafetyBypass;
			PumpToBalanceChamber = dialyzingFluidDeliverySystem.PumpToBalanceChamber;
			HeparinPump = extracorporealBloodCircuit.HeparinPump;
			ArterialBloodPump = extracorporealBloodCircuit.ArterialBloodPump;
			VenousPressureTransducer = extracorporealBloodCircuit.VenousPressureTransducer;
			VenousSafetyDetector = extracorporealBloodCircuit.VenousSafetyDetector;
			VenousTubingValve = extracorporealBloodCircuit.VenousTubingValve;
		}