Ejemplo n.º 1
0
        public void Temperature_Component_Is_Updated_Correctly()
        {
            TestStandMapping mapping = new TestStandMapping();
            Session          session = new Session(mapping);

            const byte ID = 10;

            // Value = -200 = 0xFF38
            byte valMSB = 0xFF;
            byte valLSB = 0x38;

            byte[] buffer = { ID, valMSB, valLSB };

            TemperatureComponent expectedResult = new TemperatureComponent(0, "", "", x => x);

            session.UpdateComponents(buffer);
            expectedResult.Set(-200);

            Assert.AreEqual(expectedResult.Celcius(), ((TemperatureComponent)mapping.ComponentsByID()[ID]).Celcius());

            // Value = 200 = 0x00C8
            valMSB = 0x00;
            valLSB = 0xC8;
            buffer = new [] { ID, valMSB, valLSB };

            session.UpdateComponents(buffer);
            expectedResult.Set(200);

            Assert.AreEqual(expectedResult.Celcius(), ((TemperatureComponent)mapping.ComponentsByID()[ID]).Celcius());
        }
        public void EvaluateTeamTank(IsisEvaluateTeamTankEvent e, WeaponNode weapon, TeamTankNode targetTank)
        {
            TargetData targetData = e.TargetData;

            if (e.ShooterTeamKey != targetTank.teamGroup.Key)
            {
                base.Log.Debug("EvaluateTeamTank: enemy team");
                targetData.Priority += 2f;
            }
            else
            {
                base.Log.Debug("EvaluateTeamTank: same team");
                targetData.Priority++;
                HealthComponent health = targetTank.health;
                if (health.CurrentHealth != health.MaxHealth)
                {
                    base.Log.Debug("EvaluateTeamTank: not full health");
                    targetData.Priority += 2f;
                }
                TemperatureComponent temperature = targetTank.temperature;
                if (temperature.Temperature > 0f)
                {
                    base.Log.Debug("EvaluateTeamTank: positive temperature");
                    targetData.Priority += 5f;
                }
                else if (temperature.Temperature < 0f)
                {
                    base.Log.Debug("EvaluateTeamTank: negative temperature");
                    targetData.Priority += 4f;
                }
            }
        }
Ejemplo n.º 3
0
        public TestStandMapping()
        {
            PT_N2   = new PressureComponent(16, "PT_N2", "PT-N2", 400);
            PT_IPA  = new PressureComponent(17, "PT_IPA", "PT-IPA", 50);
            PT_N2O  = new PressureComponent(18, "PT_N2O", "PT-N2O", 50);
            PT_FUEL = new PressureComponent(19, "PT_FUEL", "PT-FUEL", 50);
            PT_OX   = new PressureComponent(20, "PT_OX", "PT-OX", 50);
            PT_CHAM = new PressureComponent(21, "PT_CHAM", "PT-CHAM", 50);

            TC_IPA = new TemperatureComponent(8, "TC_IPA", "TC-IPA", x => x);
            TC_N2O = new TemperatureComponent(9, "TC_N2O", "TC-N2O", x => x);
            TC_1   = new TemperatureComponent(10, "TC_1", "TC-1", x => x);
            TC_2   = new TemperatureComponent(11, "TC_2", "TC-2", x => x);
            TC_3   = new TemperatureComponent(12, "TC_3", "TC-3", x => x);
            TC_4   = new TemperatureComponent(13, "TC_4", "TC-4", x => x);
            TC_5   = new TemperatureComponent(14, "TC_5", "TC-5", x => x);
            TC_6   = new TemperatureComponent(15, "TC_6", "TC-6", x => x);

            LOAD = new LoadComponent(0, "LOAD", "Load cell");

            SV_IPA = new SolenoidComponent(4, "SV_IPA", "SV-IPA", "SV_IPA_SYMBOL");
            SV_N2O = new SolenoidComponent(5, "SV_N2O", "SV-N2O", "SV_N2O_SYMBOL");
            MV_IPA = new ServoComponent(6, "MV_IPA", "MV-IPA", "MV_IPA_SYMBOL");
            MV_N2O = new ServoComponent(7, "MV_N2O", "MV-N2O", "MV_N2O_SYMBOL");

            TARGET_MV_IPA = new SimpleComponent(25, 2, false, "TARGET-MV-IPA", "TARGET-MV-IPA [%]", x => ((float)x) / ushort.MaxValue * 100.0f);
            TARGET_MV_N2O = new SimpleComponent(26, 2, false, "TARGET-MV-N20", "TARGET-MV-N20 [%]", x => ((float)x) / ushort.MaxValue * 100.0f);

            SN_N2O_FILL = new SolenoidComponent(2, "SN_N2O_FILL", "SN-N2O-FILL", "SN_N2O_FILL_SYMBOL");
            SN_FLUSH    = new SolenoidComponent(3, "SN_FLUSH", "SN-FLUSH", "SN_FLUSH_SYMBOL");

            BATTERY = new VoltageComponent(22, "BATTERY", "BATTERY", 12.0f, 14.8f);

            FLO_IPA = new FlowComponent(100, "FLO_IPA", "FLO-IPA", ref PT_FUEL, ref PT_CHAM, () => PreferenceManager.Manager.Preferences.Fluid.Fuel);
            FLO_N2O = new FlowComponent(101, "FLO_N2O", "FLO-N2O", ref PT_N2O, ref PT_CHAM, () => PreferenceManager.Manager.Preferences.Fluid.Oxid);

            T_IPA = new TankComponent(24, "FUEL", "FUEL", "FUEL_GRADIENT", ref FLO_IPA, "Fuel");
            T_N2O = new LevelComponent(1, "OXID", "OXID", "OXID_GRADIENT", 20);

            STACK_HEALTH = new StackHealthComponent(23, "STACK_MAIN", "STACK_ACTUATOR", "STACK_SENSOR", "STACK-HEALTH");
            _states      = new List <State>
            {
                new State(0, "Idle"),
                new State(1, "Ignition"),
                new State(2, "Pre-Stage 1"),
                new State(3, "Pre-Stage 2"),
                new State(4, "Ramp up"),
                new State(5, "Regulated"),
                new State(6, "Shutdown 1"),
                new State(7, "Shutdown 2"),
                new State(8, "Flush")
            };
            EmergencyState = _states[6];

            PreferenceManager.Manager.Preferences.AutoSequenceComponentIDs.ChamberPressureID      = PT_CHAM.BoardID;
            PreferenceManager.Manager.Preferences.AutoSequenceComponentIDs.FuelLinePressureID     = PT_FUEL.BoardID;
            PreferenceManager.Manager.Preferences.AutoSequenceComponentIDs.OxidizerLinePressureID = PT_OX.BoardID;
        }
Ejemplo n.º 4
0
        private void LoadUI()
        {
            //clear current, and dispose em
            Control.ControlCollection ct = flowLayoutPanel1.Controls;
            this.flowLayoutPanel1.Controls.Clear();
            foreach (Control c in ct)
            {
                c.Dispose();
            }

            //re- add from settings
            try
            {
                foreach (var item in settings.CurrentSettings.Components)
                {
                    if (item.GetType() == typeof(PHEZOItem))
                    {
                        PHComponent pHComponent = new PHComponent((PHEZOItem)item);
                        this.flowLayoutPanel1.Controls.Add(pHComponent.GetTile());
                    }
                    else if (item.GetType() == typeof(PHAnalogItem))
                    {
                        PHComponent pHComponent = new PHComponent((PHAnalogItem)item);
                        this.flowLayoutPanel1.Controls.Add(pHComponent.GetTile());
                    }
                    else if (item.GetType() == typeof(W1TempItem))
                    {
                        TemperatureComponent tempComponent = new TemperatureComponent((W1TempItem)item);
                        this.flowLayoutPanel1.Controls.Add(tempComponent.GetTile());
                    }
                    else if (item.GetType() == typeof(IntervalRelayItem))
                    {
                        TimerComponent tempComponent = new TimerComponent((IntervalRelayItem)item);
                        this.flowLayoutPanel1.Controls.Add(tempComponent.GetTile());
                    }
                    else if (item.GetType() == typeof(PressureItem))
                    {
                        PressureComponent tempComponent = new PressureComponent((PressureItem)item);
                        this.flowLayoutPanel1.Controls.Add(tempComponent.GetTile());
                    }
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }