public static bool SetEmission(bool enable, string address, string sensorCode) { try { string str = enable ? "31" : "30"; string command = string.Format("#{0}{1}U{2}", (object)address, (object)str, (object)sensorCode); XgsVacuumController.myIO.Write(command); XgsVacuumController.myIO.Read(); return(XgsVacuumController.GetEmissionStatus(address, sensorCode)); } catch (Exception ex) { throw; } }
private void btnQuit_Click(object sender, EventArgs e) { try { if (DialogResult.Yes == MessageBox.Show("Are you sure you want to cancel this test?", "Abort", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { this.PressureReading = 9999; // let this test failed this.DialogFlag = DialogResult.Abort; XgsVacuumController.Close(); this.CloseForm(); } } catch (Exception ex) { Trace.WriteLine(iteSlot + "Error at btn quit clicked!"); Trace.WriteLine(ex.Message); } }
private void FormHiVacTest_Load(object sender, EventArgs e) { try { XgsVacuumController.Init(this.ComPortStr); XgsVacuumController.SetPressureUnitAsTorr(this.Address); Thread.Sleep(1000); // Check XGS configuration // todo: set XGS CNV as gate -user label GATE1 GATE2 GATE3 GATE4 //XgsVacuumController.SetEmission(true, this.Address, this.SensorCodeImg); this.myThread = new Thread(new ThreadStart(this.DoHighVacuumTest)); this.myThread.Name = "MyThread"; this.myThread.Start(); this.timingThread = new Thread(new ThreadStart(this.DoCountdown)); this.timingThread.Name = "TimingThread"; this.timingThread.Start(); } catch (Exception ex) { int num = (int)MessageBox.Show(ex.Message + ex.StackTrace); } }
public void DoCountdown() { try { long num = 2700000L; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); long elapsedMilliseconds = stopwatch.ElapsedMilliseconds; while (elapsedMilliseconds < num) { this.UpdateTimer(stopwatch.Elapsed); Thread.Sleep(1000); } //XgsVacuumController.SetEmission(false, this.Address, this.SensorCodeImg); XgsVacuumController.Close(); this.PressureReading = 999.0; this.DialogFlag = DialogResult.Abort; this.CloseForm(); } catch (Exception ex) { throw; } }
private void DoHighVacuumTest() { try { double tcPressure = 760.0; double imgPressure = 0.001; // Get TC gauge reading string tcString = XgsVacuumController.ReadPressureAsString(this.Address, this.SensorCodeTc); // Wait for 1 secs Thread.Sleep(1000); // Get IMG reading string imgString = XgsVacuumController.ReadPressureAsString(this.Address, this.SensorCodeImg); double.TryParse(imgString, out imgPressure); // Wait until img set to emission ON while (imgPressure == 0) { Thread.Sleep(1000); imgString = XgsVacuumController.ReadPressureAsString(this.Address, this.SensorCodeImg); double.TryParse(imgString, out imgPressure); Thread.Sleep(1000); tcString = XgsVacuumController.ReadPressureAsString(this.Address, this.SensorCodeTc); this.UpdatePressureReading(tcString); } // Now IMG set to Emission ON // Wait for 30 seconds for the IMG to initiate Trace.WriteLine(iteSlot + "IMG is stabilizing..."); Thread.Sleep(30000); Trace.WriteLine(iteSlot + "... stabilized!"); // Start getting IMG pressure reading Trace.WriteLine(iteSlot + "Waiting for IMG pressure less than 5.0E-4 Torr"); while (imgPressure >= 0.00049) { // read ion gauge imgString = XgsVacuumController.ReadPressureAsString(this.Address, this.SensorCodeImg); double.TryParse(imgString, out imgPressure); this.UpdatePressureReading(imgString); if (imgPressure == 0) // if IMG is off { imgPressure = 0.001; // set dummy number to continue get pressure reading from IMG } Thread.Sleep(1000); } // Now IMG reading is less than 5E-4 Torr Trace.WriteLine(iteSlot + "IMG pressure now is less than 5.0E-4 torr"); Trace.WriteLine(iteSlot + "Getting final pressure reading from the IMG100"); this.PressureReading = XgsVacuumController.ReadPressureAsDouble(this.Address, this.SensorCodeImg); this.UpdatePressureReading(this.PressureReading.ToString()); Trace.WriteLine(string.Format("IMG pressure is = {0} Torr", this.PressureReading)); this.DialogFlag = DialogResult.OK; Thread.Sleep(3000);// wait for 3 seconds for display resting purpose. XgsVacuumController.Close(); this.CloseForm(); } catch (Exception ex) { XgsVacuumController.SetEmission(false, this.Address, this.SensorCodeImg); XgsVacuumController.Close(); this.CloseForm(); } }