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; }
public void Pressure_Component_Is_Updated_Correctly() { byte ID = 16; PressureComponent expectedResult = new PressureComponent(0, "", "", 400); expectedResult.Set(40000); TestStandMapping mapping = new TestStandMapping(); Session session = new Session(mapping); // Value = 1337 = 0x539 session.UpdateComponents(new byte[] { ID, 0x9C, 0x40 }); Assert.AreEqual(expectedResult.Relative(), ((PressureComponent)mapping.ComponentsByID()[ID]).Relative()); }
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); } }
public AutoParametersCommand(AutoParameters ap, ComponentMapping mapping) { Dictionary <byte, Component> components = mapping.ComponentsByID(); PressureComponent chamber = (PressureComponent) components[PreferenceManager.Manager.Preferences.AutoSequenceComponentIDs.ChamberPressureID]; PressureComponent fuelLine = (PressureComponent) components[PreferenceManager.Manager.Preferences.AutoSequenceComponentIDs.ChamberPressureID]; PressureComponent oxidLine = (PressureComponent) components[PreferenceManager.Manager.Preferences.AutoSequenceComponentIDs.ChamberPressureID]; values = new List <ushort>() { ap.StartDelay, ap.IgnitionTime, ap.PreStage1Time, ap.PreStage2MaxTime, ap.PreStage2StableTime, ap.RampUpStableTime, ap.RampUpMaxTime, ap.BurnTime, ap.Shutdown1Time, ap.Shutdown2Time, ap.FlushTime, PercentageByte(ap.PreStage1FuelPosition), PercentageByte(ap.PreStage2FuelPosition), PercentageByte(ap.RampUpFuelPosition), PercentageByte(ap.Shutdown1FuelPosition), PercentageByte(ap.Shutdown2FuelPosition), PercentageByte(ap.PreStage1OxidPosition), PercentageByte(ap.PreStage2OxidPosition), PercentageByte(ap.RampUpOxidPosition), PercentageByte(ap.Shutdown1OxidPosition), PercentageByte(ap.Shutdown2OxidPosition), PressureByte(ap.PreStage2StablePressure, chamber), PressureByte(ap.ChamberPressurePressure, chamber), PressureByte(ap.EmptyFuelFeedPressureThreshold, fuelLine), PressureByte(ap.EmptyOxidFeedPressureThreshold, oxidLine) }; }
public void Validate_Correct_Volume_Calculation() { TestStandMapping mapping = new TestStandMapping(); Session session = new Session(mapping); float fuelCV = 0.0738f; float fuelDens = 786; PressureComponent p1 = (mapping.ComponentsByID()[19] as PressureComponent); PressureComponent p2 = (mapping.ComponentsByID()[21] as PressureComponent); FlowComponent fl = (mapping.ComponentsByID()[100] as FlowComponent); TankComponent tc = (mapping.ComponentsByID()[24] as TankComponent); tc.SetInputVolume(0, 4); p2.Set(0); p1.Set(670); // 670.2545453 = 10 bar fl.Compute(); tc.Compute(0); p1.Set(730); // 729.8327273 = 12 bar fl.Compute(); tc.Compute(750); p1.Set(789); // 789.4109090 = 14 bar fl.Compute(); tc.Compute(1500); p1.Set(849); // 848.9890910 = 16 bar fl.Compute(); tc.Compute(2250); p1.Set(909); // 908.5672727 = 18 bar fl.Compute(); tc.Compute(3000); float volume = tc.CurrentVolume; Assert.AreEqual(3.832606742, volume, 0.1); }
public ushort PressureByte(float val, PressureComponent component) { return(FloatByte(component.UncalibratedValue(val))); }