예제 #1
0
        //@@ Function for query with one additional return value as verification @@//
        public static string SendCommand(VSLeakDetector myLD, ref Boolean status, string command, string retval, string retval2)
        {
            //VSLeakDetector myLD = new VSLeakDetector(comPort);
            //myLD.iteSlot = iteSlot;
            try
            {
                //myLD.Open();
                myLD.Write(command);

                string Retval = myLD.Read();

                if (Retval.Contains(retval) && Retval.Contains(retval2))
                {
                    status = true;
                }
                else
                {
                    status = false;
                    //if (myLD != null) myLD.Close();
                    throw new Exception("Error while sending command: " + command);
                }

                //myLD.Close();
                return(Retval);
            }

            catch (Exception)
            {
                //myLD.Close();
                throw;
            }
        }
예제 #2
0
        public void UserCleanup(ref UUTData _uutData, ref CommonData _commonData)
        {
            string conStr = "Data Source=wpsqldb21;Initial Catalog=VpdOF;Persist Security Info=True;User ID=VpdTest;Password=Vpd@123";

            if (iteSlot.Contains("P1"))
            {
                SQL_XGS.Update_XGS("1", "No");
                SQL_34970A.Update_DMM_Status("1", "No", conStr);
                InstrumentIO.Close_Extleak(1);

                myLD1.Close();
                //   myLD1 = null;
            }
            else if (iteSlot.Contains("P2"))
            {
                SQL_XGS.Update_XGS("2", "No");
                SQL_34970A.Update_DMM_Status("1", "No", conStr);
                InstrumentIO.Close_Extleak(2);

                myLD2.Close();
                myLD2 = null;
            }
            else
            {
            }
        }
예제 #3
0
        public static void None(VSLeakDetector myLD, ref TestInfo myTestInfo, ref UUTData myuutdata)
        {
            switch (myTestInfo.TestLabel)
            {
            case "5.12.1 Test_IOBoard (Opt.)":
            {
                while (step <= myTestInfo.ResultsParams.NumResultParams)
                {
                    myTestInfo.ResultsParams[step].SpecMax = "Skip";
                    myTestInfo.ResultsParams[step].SpecMin = "Skip";
                    myTestInfo.ResultsParams[step].Nominal = "Skip";
                    myTestInfo.ResultsParams[step].Result  = "Skip";

                    step++;
                }

                break;
            }

            case "5.12.2 Wireless_Remote (Opt.)":
            {
                while (step <= myTestInfo.ResultsParams.NumResultParams)
                {
                    myTestInfo.ResultsParams[step].SpecMax = "Skip";
                    myTestInfo.ResultsParams[step].SpecMin = "Skip";
                    myTestInfo.ResultsParams[step].Nominal = "Skip";
                    myTestInfo.ResultsParams[step].Result  = "Skip";

                    step++;
                }

                break;
            }
            }
        }
예제 #4
0
        //@@ When the 'START' button is pressed @@//
        public void UserSetups(ref UUTData _uutData, ref CommonData _commonData)
        {
recheck_connection:

            try
            {
                if (iteSlot.Contains("P1"))
                {
                    myLD1         = new VSLeakDetector(comPort1);
                    myLD1.iteSlot = iteSlot;
                    myLD1.Open();
                    //Helper.comPort = comPort1;
                }
                else if (iteSlot.Contains("P2"))
                {
                    myLD2         = new VSLeakDetector(comPort2);
                    myLD2.iteSlot = iteSlot;
                    myLD2.Open();
                    //Helper.comPort = comPort2;
                }
                else
                {
                }

                //Initialize data acquisition system

recheck:
                string conStr = "Data Source=wpsqldb21;Initial Catalog=VpdOF;Persist Security Info=True;User ID=VpdTest;Password=Vpd@123";
                string DMMstatus = SQL_34970A.Read_DMM_Status(conStr);

                if (DMMstatus != "No")
                {
                    MessageBox.Show("DMM locked", "warning", MessageBoxButtons.OK);
                    Thread.Sleep(5000);
                    goto recheck;
                }

                InstrumentIO.DAS_initialize();

                //Accquire the voltage requirement based on the model number and channel number based on the slot number of the tester
                InstrumentIO.Init_UUT_Voltage_Switches(_uutData.Model, _uutData.Options);
            }

            catch (Agilent.TMFramework.InstrumentIO.VisaException ex)               //When there is connection error between the 34970A and the PC
            {
                DialogResult connection = MessageBox.Show(ex.Message + "\n\nPlease check the connection between the 34970A data accquisition system and the PC.", "WARNING", MessageBoxButtons.RetryCancel);

                if (connection == DialogResult.Retry)
                {
                    goto recheck_connection;
                }

                else
                {
                    Application.Exit();
                }
            }
        }
예제 #5
0
 public static void DoWirelessTest(VSLeakDetector myLD, ref TestInfo myTestInfo, ref UUTData myuutdata)
 {
     try
     {
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #6
0
        /// <summary>
        /// This method is called when the Performance test is started
        /// </summary>
        /// <param name="_uutData"></param>
        /// <param name="_commonData"></param>
        public void UserSetups(ref UUTData _uutData, ref CommonData _commonData)
        {
            try
            {
                if (_uutData == null)
                {
                    _uutData = this.g_UUTData;
                }
                if (_commonData == null)
                {
                    _commonData = this.g_CommonData;
                }


                // Initialize Test Equipments
                mySw    = new DirectIO("GPIB0::9::INSTR"); mySw.Timeout = 10000;
                myScope = new DirectIO("GPIB0::7::INSTR"); myScope.Timeout = 10000;
                //myScope = new DirectIO("USB0::2391::6056::MY53280249::0::INSTR"); myScope.Timeout = 10000;


                //ResourceManager rmc = new ResourceManager();
                //var rs = rmc.FindRsrc("USB?*");
                //foreach (var item in rs)
                //{
                //    Trace.WriteLine(item);
                //}



                string comPort = CalLeakConfigs.Default.ComPort;
                myLD = new VSLeakDetector(comPort, 9600, System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One);
                myLD.UnlockFullCommand();
                myLD.NoSniff();     // Set the LD HighPressure test to OFF



                InstrumentIO.SetupBoardTempMeasRoute(mySw, myScope, TestPort);


                // Initialize list
                ListOfUUTLeakRate   = new List <double>();
                ListOfUUTTempFactor = new List <double>();
                ListOfUUTTemp       = new List <double>();

                // Initialize CalLeakData
                myCalLeakData              = new CalLeakData();
                myCalLeakData.PartNumber   = _uutData.Model;
                myCalLeakData.SerialNumber = _uutData.SerNum;
                myCalLeakData.TestPortId   = Convert.ToInt32(_commonData.Slot);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #7
0
 public static Boolean Wait_FineTest(VSLeakDetector myLD)
 {
     try
     {
         return(Wait_FineTest(myLD, 300));
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #8
0
        //@@ Press ZERO if UUT stuck in CONTRAFLOW @@//

        public static bool Stuck_Contra(VSLeakDetector myLD)
        {
            try
            {
                //VSLeakDetector myLD = new VSLeakDetector(comPort);
                //myLD.iteSlot = iteSlot;
                Boolean status = false;
                string  retval;
                int     IsStuck = 1;

                //myLD.Open();

                while (IsStuck > 0)
                {
repeat:
                    myLD.Write("?VALVESTATE");
                    retval = myLD.Read();

                    if (retval.Contains("CONTRAFLOW"))
                    {
                        IsStuck++;
                        Thread.Sleep(1000);
                        goto repeat;
                    }

                    if (retval.Contains("MIDSTAGE"))
                    {
                        status = true;
                        break;
                    }

                    if (IsStuck > 100)
                    {
                        myLD.Write("ZERO");
                        status = true;
                        Thread.Sleep(60000);

                        break;
                    }
                }

                //myLD.Close();
                return(status);
            }

            catch (Exception)
            {
                throw;
            }
        }
예제 #9
0
        //@@ Send command and standby for a return value, then proceed with verification by checking the return value @@//

        public static Boolean DoThis(VSLeakDetector myLD, ref TestInfo myTestInfo, string command, string retval, int i, string result)
        {
            Boolean Status = false;
            int     check  = 1;

            //VSLeakDetector myLD = new VSLeakDetector(comPort);
            //myLD.iteSlot = iteSlot;
            try
            {
                //myLD.Open();
recheck:
                myLD.Write(command);
                String Retval = myLD.Read();

                //if the return value obtained is correct, the test point will passed.
                if (Retval.Contains(retval))
                {
                    Trace.WriteLine(myLD.iteSlot + "Test point complete.");

                    myTestInfo.ResultsParams[i].Result = result;
                    Status = true;
                }
                else
                {
                    if (check < 3)
                    {
                        check++; Thread.Sleep(1000); Retval = null; goto recheck;
                    }
                    else
                    {
                        myTestInfo.ResultsParams[i].Result = "FAILED " + command;
                    }
                    //if (myLD != null) myLD.Close();
                    // throw new Exception("Error while sending command: " + command);
                }

                //myLD.Close();
                return(Status);
            }

            catch (Exception)
            {
                //myLD.Close();
                throw;
            }
        }
예제 #10
0
        //@@ Send command together with specified terminator and timeout limit and standby for a return value, then proceed with verification by checking the return value @@/

        public static Boolean DoThis(VSLeakDetector myLD, ref TestInfo myTestInfo, string command, string retval, int i, string result, string terminator, int timeout)
        {
            Boolean Status = false;

            //VSLeakDetector myLD = new VSLeakDetector(comPort);
            //myLD.iteSlot = iteSlot;
            try
            {
                //myLD.Open();
                myLD.Terminator = terminator;
                myLD.Timeout    = timeout;

                myLD.Write(command);

                string Retval = myLD.Read();

                //if the return value obtained is correct, the test point will passed.
                if (Retval.Contains(retval))
                {
                    Trace.WriteLine(myLD.iteSlot + "Test point complete.");

                    myTestInfo.ResultsParams[i].Result = result;
                    Status = true;
                }
                else
                {
                    myTestInfo.ResultsParams[i].Result = "FAILED";
                    //if (myLD != null) myLD.Close();
                    throw new Exception("Error while sending command: " + command);
                }

                //myLD.Close();
                return(Status);
            }

            catch (Exception)
            {
                //myLD.Close();
                throw;
            }
        }
예제 #11
0
        //@@ Function for query @@//
        public static string SendCommand(VSLeakDetector myLD, ref Boolean status, string command, string retval)
        {
            //VSLeakDetector myLD = new VSLeakDetector(comPort);
            //myLD.iteSlot = iteSlot;
            try
            {
                int check = 1;
recheck:
                //myLD.Open();
                myLD.Write(command);

                string Retval = myLD.Read();

                if (Retval.Contains(retval))
                {
                    status = true;
                }
                else
                {
                    if (check < 4)
                    {
                        check++;
                        Thread.Sleep(1000);
                        Retval = null;
                        goto recheck;
                    }
                    status = false;
                    //if (myLD != null) myLD.Close();
                    //  throw new Exception("Error while sending command: " + command);
                }

                //myLD.Close();
                return(Retval);
            }

            catch (Exception)
            {
                //myLD.Close();
                throw;
            }
        }
예제 #12
0
        public static Boolean Reload(VSLeakDetector myLD)
        {
            //VSLeakDetector myLD = new VSLeakDetector(comPort);
            //myLD.iteSlot = iteSlot;
            //myLD.Open();
            myLD.Terminator = "\r\n";
            myLD.Write("RELOAD");
            //Thread.Sleep(5000);
            Thread.Sleep(1000);
            Boolean status = false;
            string  retval;
            int     timeout = 1;

            while (timeout > 0)
            {
                retval = myLD.Read();
                Trace.WriteLine(timeout);
                if (retval.Contains("Agilent"))
                {
                    Trace.WriteLine(myLD.iteSlot + "Test point complete.");
                    Trace.WriteLine(timeout);
                    status = true;
                    break;
                }

                if (timeout > 15)
                {
                    //myLD.Close();
                    throw new Exception("Test point failed.");
                }

                Thread.Sleep(1000);
                timeout++;
            }

            // myLD.Close();
            return(status);
        }
예제 #13
0
        public static Boolean Wait_Test(VSLeakDetector myLD)
        {
            //VSLeakDetector myLD = new VSLeakDetector(comPort);
            //myLD.iteSlot = iteSlot;

            //myLD.Open();
            Boolean status  = false;
            int     timeout = 1;
            string  retval;

            Trace.WriteLine(myLD.iteSlot + "Wait for system to enter TEST mode...");

            while (timeout > 0)
            {
                myLD.Write("?VALVESTATE");

                retval = myLD.Read();

                if (retval.Contains("CONTRAFLOW") && retval.Contains("ok"))
                {
                    Trace.WriteLine(myLD.iteSlot + "Test point complete.");
                    status = true;
                    break;
                }

                if (timeout > 60)
                {
                    //myLD.Close();
                    throw new Exception("Test point failed.");
                }

                Thread.Sleep(1000);
                timeout++;
            }

            // myLD.Close();
            return(status);
        }
예제 #14
0
        public static Boolean Wait_SystemReady(VSLeakDetector myLD)
        {
            //VSLeakDetector myLD = new VSLeakDetector(comPort);
            //myLD.iteSlot = iteSlot;

            //myLD.Open();
            Boolean status = false;
            string  retval;
            int     timeout = 1;

            while (timeout > 0)
            {
                myLD.Write("SystemReady .");
                retval = myLD.Read();

                if (retval.Contains("-1 ok"))
                {
                    Trace.WriteLine(myLD.iteSlot + "Test point complete.");
                    status = true;
                    break;
                }

                if (timeout > 360)
                {
                    //myLD.Close();
                    //throw new Exception("Test point failed.");
                    Trace.WriteLine(myLD.iteSlot + "Test point failed.");
                    status = false;
                }

                Thread.Sleep(1000);
                timeout++;
            }

            //myLD.Close();
            return(status);
        }
예제 #15
0
        public static Boolean Wait_FineTest(VSLeakDetector myLD, int timeoutLimit)
        {
            //VSLeakDetector myLD = new VSLeakDetector(comPort);
            //myLD.iteSlot = iteSlot;

            // myLD.Open();
            Boolean status  = false;
            int     timeout = 1;
            string  retval;

            Trace.WriteLine(myLD.iteSlot + "Wait for system to enter FINETEST mode...");

            while (timeout > 0)
            {
                myLD.Write("?VALVESTATE");
                retval = myLD.Read();

                if (retval.Contains("MIDSTAGE") && retval.Contains("ok"))
                {
                    Trace.WriteLine(myLD.iteSlot + "Test point complete.");
                    status = true;
                    break;
                }

                if (timeout > timeoutLimit)
                {
                    //myLD.Close();
                    return(false);
                }

                Thread.Sleep(1000);
                timeout++;
            }

            // myLD.Close();
            return(status);
        }
예제 #16
0
        public static TestInfo DoSeq5_12(VSLeakDetector myLD, ref TestInfo myTestInfo, ref UUTData myuutdata)
        {
            try
            {
                switch (myTestInfo.TestLabel)
                {
                case "5.12.1 Test_IOBoard (Opt.)":
                {
                    if (IsIOEnabled)
                    {
                        DoIOBoardTest(myLD, ref myTestInfo, ref myuutdata);
                    }
                    else
                    {
                        step = 1;
                        while (step <= myTestInfo.ResultsParams.NumResultParams)
                        {
                            myTestInfo.ResultsParams[step].SpecMax = "Skip";
                            myTestInfo.ResultsParams[step].SpecMin = "Skip";
                            myTestInfo.ResultsParams[step].Nominal = "Skip";
                            myTestInfo.ResultsParams[step].Result  = "Skip";

                            step++;
                        }
                    }
                }
                break;

                case "5.12.2 Wireless_Remote (Opt.)":
                {
                    if (IsWirelessEnabled)
                    {
                        DoWirelessTest(myLD, ref myTestInfo, ref myuutdata);
                    }
                    else
                    {
                        step = 1;
                        while (step <= myTestInfo.ResultsParams.NumResultParams)
                        {
                            myTestInfo.ResultsParams[step].SpecMax = "Skip";
                            myTestInfo.ResultsParams[step].SpecMin = "Skip";
                            myTestInfo.ResultsParams[step].Nominal = "Skip";
                            myTestInfo.ResultsParams[step].Result  = "Skip";

                            step++;
                        }
                    }
                }
                break;

                default:
                    break;
                }

                //if (mystartupform.Customer_opt == "IO Board")
                //{
                //    IOBoard(ref myTestInfo, ref myuutdata);
                //}

                //else if (mystartupform.Customer_opt == "Wireless Remote")
                //{
                //    Wireless_Remote(ref myTestInfo, ref myuutdata);
                //}

                //else if( mystartupform.Customer_opt == "Both")
                //{
                //    Both(ref myTestInfo, ref myuutdata);
                //}

                //else
                //{
                //    None(ref myTestInfo, ref myuutdata);
                //}
            }

            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
                Helper.Fail_Test(ref myTestInfo, ex.Message, step);
                throw;
            }

            return(myTestInfo);
        }
예제 #17
0
        public static TestInfo DoSeq5_11(VSLeakDetector myLD, ref TestInfo myTestInfo, ref UUTData myuutdata)
        {
            Boolean status = false;
            string  retval;
            //VSLeakDetector myLD = new VSLeakDetector(comPort);
            //myLD.iteSlot = iteSlot;
            string Display;
            string Reading;
            int    step = 1;

            Helper.comPort = comPort;

            try
            {
                switch (myTestInfo.TestLabel)
                {
                case "5.11.1 Rough":
                {
                    //Access to full command

                    Trace.WriteLine(iteSlot + "Access to full command...");
                    Helper.SendCommand(myLD, ref status, "XYZZY", "ok");

                    //Obtain stdleak rate

                    Trace.WriteLine(iteSlot + "Obtain the stdleak rate...");
                    retval = Helper.SendCommand(myLD, ref status, "?STDLEAK", "ok");


                    //@@ Rough the UUT @@//

                    Trace.WriteLine(iteSlot + "Roughing the UUT...");
                    status = Helper.DoThis(myLD, ref myTestInfo, "ROUGH", "ok", step, "ok");

                    step++;


                    //@@ Wait for FINETEST @@//

                    status = Helper.Wait_FineTest(myLD);

                    if (status == true)
                    {
                        myTestInfo.ResultsParams[step].Result = "ok";
                    }
                    else
                    {
                        myTestInfo.ResultsParams[step].Result = "FAILED";
                    }

                    break;
                }

                case "5.11.2 OpenStdleak_btn":
                {
                    step = 1;

                    //@@ Prompt user to open stdleak @@//

                    Trace.WriteLine(iteSlot + "Waiting for user to open the stdleak...");

                    Display = "Seq 5.11.2: OPEN the stdleak through the LCD screen of the UUT.\n\nThe option can be found in the CONTROL PANEL. 'STDLEAK' will be displayed on the bottom left corner of the LCD screen\n\nEnter 'ok' after the stdleak is OPEN.";
                    Reading = Helper.LabelDisplay(Display);

                    if (Reading == "ok")
                    {
                        Trace.WriteLine(iteSlot + "Test point complete.");
                        myTestInfo.ResultsParams[step].Result = "ok";
                    }
                    else
                    {
                        myTestInfo.ResultsParams[step].Result = "FAILED";
                        //throw new Exception("Test point failed.");
                    }

                    break;
                }

                case "5.11.3 Audio_btn":
                {
                    step = 1;

                    //@@ Prompt user to press audio up button @@//

                    Trace.WriteLine(iteSlot + "Waiting for user to press the audio up button...");

                    Display = "Seq 5.11.3: Press the AUDIO UP button.\n\nThe option can be found in the CONTROL PANEL. An alarm will triggered.\n\nEnter 'ok' when done.";
                    Reading = Helper.LabelDisplay(Display);

                    if (Reading == "ok")
                    {
                        Trace.WriteLine(iteSlot + "Test point complete.");
                        myTestInfo.ResultsParams[step].Result = "ok";
                    }
                    else
                    {
                        myTestInfo.ResultsParams[step].Result = "FAILED";
                        //throw new Exception("Test point failed.");
                    }

                    break;
                }

                case "5.11.4 CloseStdleak_btn":
                {
                    step = 1;

                    //@@ Prompt user to close stdleak @@//

                    Trace.WriteLine(iteSlot + "Waiting for user to close the stdleak...");

                    Display = "Seq 5.11.4: CLOSE the stdleak through the LCD screen of the UUT.\n\nThe option can be found in the CONTROL PANEL. 'STDLEAK' will disappear after STDLEAK has fully closed.\n\nEnter 'ok' after the stdleak is CLOSE.";
                    Reading = Helper.LabelDisplay(Display);

                    if (Reading == "ok")
                    {
                        Trace.WriteLine(iteSlot + "Test point complete.");
                        myTestInfo.ResultsParams[step].Result = "ok";
                    }
                    else
                    {
                        myTestInfo.ResultsParams[step].Result = "FAILED";
                        //throw new Exception("Test point failed.");
                    }

                    break;
                }

                case "5.11.5 Audio_btn":
                {
                    step = 1;

                    //@@ Prompt user to press audio down button @@//

                    Trace.WriteLine(iteSlot + "Waiting for user to press the audio down button...");

                    Display = "Seq 5.11.5: Press the AUDIO DOWN button.\n\nThe option can be found in the CONTROL PANEL. An alarm will be triggered.\n\nEnter 'ok' when done.";
                    Reading = Helper.LabelDisplay(Display);

                    if (Reading == "ok")
                    {
                        Trace.WriteLine(iteSlot + "Test point complete.");
                        myTestInfo.ResultsParams[step].Result = "ok";
                    }
                    else
                    {
                        myTestInfo.ResultsParams[step].Result = "FAILED";
                        //throw new Exception("Test point failed.");
                    }

                    break;
                }

                case "5.11.1-5 btn_confirmation":
                {
                    step = 1;

                    //@@ Prompt user whether to continue or fail the test @@//

                    Trace.WriteLine(iteSlot + "Waiting for user for confirmation...");

                    Display = "Is everything working as expected?\n\nIf yes, enter 'ok' to proceed. Else, enter 'no'.";
                    Reading = Helper.LabelDisplay(Display);

                    if (Reading == "ok")
                    {
                        Trace.WriteLine(iteSlot + "Test point complete.");
                        myTestInfo.ResultsParams[step].Result = "ok";
                    }
                    else
                    {
                        myTestInfo.ResultsParams[step].Result = "FAILED";
                        //throw new Exception("Test point failed.");
                    }

                    break;
                }

                case "5.11.6_Init_FIL2":
                {
                    step = 1;

                    //@@ Sets the operating filament in the ion source. @@//

                    Trace.WriteLine(iteSlot + "Sets the operating filament in the ion source...");

                    status = Helper.DoThis(myLD, ref myTestInfo, "2 INIT-FILAMENT", "ok", step, "ok");
                    Thread.Sleep(2000);                         //MOD: Provide some time for the filament to initialize.

                    break;
                }

                case "5.11.7_WaitSystemReady_FIL2":
                {
                    step = 1;

                    //@@ Wait for system ready. if the system is ready, value '-1' will be returned, else '0' . The timeout is 3 mins. @@//

                    Trace.WriteLine(iteSlot + "Wait for system to get ready...");

                    status = Helper.Wait_SystemReady(myLD);

                    if (status == true)
                    {
                        myTestInfo.ResultsParams[step].Result = "ok";
                    }
                    else
                    {
                        myTestInfo.ResultsParams[step].Result = "FAILED";
                    }

                    break;
                }

                case "5.11.8_Rough_Zero_FIL2":
                {
                    step = 1;

                    while (step <= myTestInfo.ResultsParams.NumResultParams)
                    {
                        //@@ Rough the UUT @@//

                        Trace.WriteLine(iteSlot + "Roughing the UUT...");

                        status = Helper.DoThis(myLD, ref myTestInfo, "ROUGH", "ok", step, "ok");
                        step++;

                        Thread.Sleep(20000);


                        //@@ Sets the current leak rate measurement to be 0.0 atm .cc/s in the most sensitive range. @@//

                        Trace.WriteLine(iteSlot + "Sets the current leak rate measurement to be 0.0 atm .cc/s in the most sensitive range...");

                        status = Helper.DoThis(myLD, ref myTestInfo, "ZERO", "ok", step, "ok");
                        step++;

                        Thread.Sleep(5000);


                        //@@ Wait for FINETEST mode @@//

                        Trace.WriteLine(iteSlot + "Wait for system to enter FINETEST mode...");

                        status = Helper.Wait_FineTest(myLD);

                        if (status == true)
                        {
                            myTestInfo.ResultsParams[step].Result = "ok";
                        }
                        else
                        {
                            myTestInfo.ResultsParams[step].Result = "FAILED";
                        }

                        step++;
                    }

                    break;
                }

                case "5.11.9_Calibration_FIL2":
                {
                    int num = 1;

                    //@@ Calibrate the UUT. If fail, auto recalibrate. If fail 3 times consistently, fail the test @@//
                    //@@ MOD: Test 5.11.10.1 and 5.11.10.2 are combine together with 5.11.9 to create a recalibration loop. Therefore, if the initial calibration process failed, recalibration process will take places for up to maximum of 3 times.
                    while (num <= Convert.ToInt32(myTestInfo.TestParams[1].Value))
                    {
                        status = Helper.Recalibrate(myLD);

                        if (status == true)
                        {
                            Trace.WriteLine(iteSlot + "Test point complete.");

                            myTestInfo.ResultsParams[1].Result = "ok";                              //Result param = Calibrate
                            myTestInfo.ResultsParams[2].Result = "ok";                              //Result param = Wait_Finetest
                            myTestInfo.ResultsParams[3].Result = "ok";                              //Result param = Report_cal_status

                            goto pass;
                        }
                        else
                        {
                            Trace.WriteLine(iteSlot + "Number of time(s) failed: " + num);
                            num++;
                        }
                    }

                    if (num > Convert.ToInt32(myTestInfo.TestParams[1].Value))
                    {
                        myTestInfo.ResultsParams[1].Result = "FAILED";                                  //Result param = Calibrate
                        myTestInfo.ResultsParams[2].Result = "FAILED";                                  //Result param = Wait_Finetest
                        myTestInfo.ResultsParams[3].Result = "FAILED";                                  //Result param = Report_cal_status

                        //throw new Exception("Recalibration failed three times.");
                    }

pass:
                    break;
                }

                case "5.11.10_Gain_FIL2":
                {
                    step = 1;

                    while (step <= myTestInfo.ResultsParams.NumResultParams)
                    {
                        //@@ Open the stdleak @@//

                        Trace.WriteLine(iteSlot + "Open the stdleak...");

                        status = Helper.DoThis(myLD, ref myTestInfo, "STDLEAK", "ok", step, "ok");
                        step++;


                        Trace.WriteLine(iteSlot + "Provide time for the UUT to read the stdleak...");
                        Thread.Sleep(60000);


                        //@@ Obtain the gain value of the UUT @@//

                        Trace.WriteLine(iteSlot + "Obtain the gain value of the UUT...");

                        retval = Helper.SendCommand(myLD, ref status, "?GAIN", "ok");

                        if (status == true)
                        {
                            string[] response = retval.Split(new string[] { "?GAIN ", "ok" }, StringSplitOptions.RemoveEmptyEntries);
                            Gain = Convert.ToSingle(response[0]);

                            Trace.WriteLine(iteSlot + "Gain = " + Gain);
                            Trace.WriteLine(iteSlot + "Test point complete.");

                            myTestInfo.ResultsParams[step].Result = "ok";
                        }
                        else
                        {
                            myTestInfo.ResultsParams[step].Result = "FAILED";
                            //throw new Exception("Test point failed.");
                        }

                        step++;


                        //@@ Verify the gain value obtained 0.2 ~2.5 @@//

                        Trace.WriteLine(iteSlot + "Verify the gain value of filament 2...");

                        if (Gain >= Convert.ToSingle(myTestInfo.ResultsParams[step].SpecMin) && Gain <= Convert.ToSingle(myTestInfo.ResultsParams[step].SpecMax))
                        {
                            Trace.WriteLine(iteSlot + "Test point complete.");
                            myTestInfo.ResultsParams[step].Result = Convert.ToString(Gain);
                        }
                        else
                        {
                            myTestInfo.ResultsParams[step].Result = Convert.ToString(Gain);
                            //throw new Exception("Test point failed.");
                        }

                        step++;


                        //@@ Obtain the leak rate @@//

                        Trace.WriteLine(iteSlot + "Obtain the leak rate...");
                        retval = Helper.SendCommand(myLD, ref status, "?LEAK", "ok");

                        if (status == true)
                        {
                            string[] response = retval.Split(new string[] { "?LEAK ", "ok" }, StringSplitOptions.RemoveEmptyEntries);
                            Leakrate = Convert.ToDouble(response[0]);

                            Trace.WriteLine(iteSlot + "Measured leakrate = " + Leakrate + "Std .cc/s");
                            myTestInfo.ResultsParams[step].Result = "ok";
                            Trace.WriteLine(iteSlot + "Test point complete.");
                        }

                        else
                        {
                            myTestInfo.ResultsParams[step].Result = "FAILED";
                            //throw new Exception("Test point failed.");
                        }

                        step++;


                        //@@ Compare the leak rate with stdleak rate @@//
                        Trace.WriteLine(iteSlot + "Compare the obtained leak rate with the stdleak installed...");
                        retval = Helper.SendCommand(myLD, ref status, "?STDLEAKt", "ok");

                        double stdleakt    = 0;
                        double exp_stdleak = 0;

                        if (status == true)
                        {
                            string[] response  = retval.Split(new string[] { "?STDLEAKt ", "ok" }, StringSplitOptions.RemoveEmptyEntries);
                            string[] response2 = response[0].Split(new string[] { "E" }, StringSplitOptions.RemoveEmptyEntries);

                            stdleakt    = Convert.ToDouble(response[0]);
                            exp_stdleak = Convert.ToDouble(response2[1]);
                        }
                        // hairus added to get comparison stdleak properly
                        double maxLeakDiff = stdleakt + 0.2E-7;
                        double minLeakDiff = stdleakt - 0.2E-7;
                        myTestInfo.ResultsParams[step].SpecMax = maxLeakDiff.ToString();
                        myTestInfo.ResultsParams[step].SpecMin = minLeakDiff.ToString();
                        myTestInfo.ResultsParams[step].Nominal = stdleakt.ToString();

                        // set the result
                        myTestInfo.ResultsParams[step].Result = Leakrate.ToString();

                        //Trace.WriteLine(iteSlot + "Compare the obtained leak rate with the stdleak installed...");
                        //retval = Helper.SendCommand(myLD, ref status, "?STDLEAKt", "ok");

                        //double stdleak = 0;
                        //double exp_stdleak = 0;

                        //if (status == true)
                        //{
                        //    string[] response = retval.Split(new string[] { "?STDLEAKt ", "ok" }, StringSplitOptions.RemoveEmptyEntries);
                        //    string[] response2 = response[0].Split(new string[] { "E" }, StringSplitOptions.RemoveEmptyEntries);

                        //    stdleak = Convert.ToDouble(response[0]);
                        //    exp_stdleak = Convert.ToDouble(response2[1]);
                        //}

                        //if (Leakrate >= (stdleak - 0.2 * Math.Pow(10, exp_stdleak)) && Leakrate <= (stdleak + 0.2 * Math.Pow(10, exp_stdleak)))
                        //{
                        //    myTestInfo.ResultsParams[step].Result = "ok";
                        //    Trace.WriteLine(iteSlot + "Test point complete.");
                        //}

                        //else
                        //{
                        //    myTestInfo.ResultsParams[step].Result = "FAILED";
                        //    //throw new Exception("Test point failed.");
                        //}

                        step++;
                    }

                    break;
                }

                case "5.11.11_Stdleak_FIL2":
                {
                    step = 1;

                    //@@ Close the stdleak @@//

                    Trace.WriteLine(iteSlot + "Close the stdleak...");

                    status = Helper.DoThis(myLD, ref myTestInfo, "STDLEAK", "ok", step, "ok");
                    Thread.Sleep(3000);

                    int counter = 1;                //YS WONG
recheck:
                    string checker = Helper.SendCommand(myLD, ref status, "?VALVESTATE", "MIDSTAGE");
                    if (!checker.Contains("MIDSTAGE"))
                    {
                        Thread.Sleep(2000);
                        counter++;
                        if (counter > 5)
                        {
                            Trace.WriteLine("MIDSTAGE FAIL"); break;
                        }
                        else
                        {
                            goto recheck;
                        }
                    }                               // YS WONG


                    break;
                }

                case "5.11.12_Vent_FIL2":
                {
                    step = 1;

                    //@@ Vent the UUT @@//

                    Trace.WriteLine(iteSlot + "Venting the UUT...");
                    status = Helper.DoThis(myLD, ref myTestInfo, "VENT", "ok", step, "ok");

                    int counter = 1;                    // YS WONG
recheck:
                    string checker = Helper.SendCommand(myLD, ref status, "?VALVESTATE", "VENT");
                    if (!checker.Contains("VENT"))
                    {
                        Thread.Sleep(2000);
                        counter++;
                        if (counter > 5)
                        {
                            Trace.WriteLine("VENT FAIL"); break;
                        }
                        else
                        {
                            goto recheck;
                        }
                    }
                    Thread.Sleep(2000);             // YS WONG

                    break;
                }



                //Filament 1 will be selected and the tests above will repeat again from 5.11.7 to 5.11.12

                case "5.11.13_Init_FIL1":
                {
                    step = 1;

                    //@@ Sets the operating filament in the ion source. @@//

                    Trace.WriteLine(iteSlot + "Sets the operating filament in the ion source...");

                    status = Helper.DoThis(myLD, ref myTestInfo, "1 INIT-FILAMENT", "ok", step, "ok");
                    Thread.Sleep(2000);                         //MOD: Provide some time for the filament to initialize
                    break;
                }

                case "5.11.7_WaitSystemReady_FIL1":
                {
                    step = 1;

                    //@@ Wait for system ready. if the system is ready, value '-1' will be returned, else '0' . The timeout is 3 mins. @@//

                    Trace.WriteLine(iteSlot + "Wait for system to get ready...");

                    status = Helper.Wait_SystemReady(myLD);

                    if (status == true)
                    {
                        myTestInfo.ResultsParams[step].Result = "ok";
                    }
                    else
                    {
                        myTestInfo.ResultsParams[step].Result = "FAILED";
                    }

                    break;
                }

                case "5.11.8_Rough_Zero_FIL1":
                {
                    //@@ Rough the UUT @@//

                    step = 1;

                    while (step <= myTestInfo.ResultsParams.NumResultParams)
                    {
                        //@@ Rough the UUT @@//

                        Trace.WriteLine(iteSlot + "Roughing the UUT...");

                        status = Helper.DoThis(myLD, ref myTestInfo, "ROUGH", "ok", step, "ok");
                        step++;

                        Thread.Sleep(20000);


                        //@@ Sets the current leak rate measurement to be 0.0 atm .cc/s in the most sensitive range. @@//

                        Trace.WriteLine(iteSlot + "Sets the current leak rate measurement to be 0.0 atm .cc/s in the most sensitive range...");

                        status = Helper.DoThis(myLD, ref myTestInfo, "ZERO", "ok", step, "ok");
                        step++;

                        Thread.Sleep(5000);


                        //@@ Wait for FINETEST mode @@//

                        Trace.WriteLine(iteSlot + "Wait for system to enter FINETEST mode...");

                        status = Helper.Wait_FineTest(myLD);

                        if (status == true)
                        {
                            myTestInfo.ResultsParams[step].Result = "ok";
                        }
                        else
                        {
                            myTestInfo.ResultsParams[step].Result = "FAILED";
                        }

                        step++;
                    }

                    break;
                }

                case "5.11.9_Calibration_FIL1":
                {
                    step = 1;
                    int num = 1;

                    //@@ Calibrate the UUT. If fail, auto recalibrate. If fail 3 times consistently, fail the test @@//

                    while (num <= Convert.ToInt32(myTestInfo.TestParams[1].Value))
                    {
                        status = Helper.Recalibrate(myLD);

                        if (status == true)
                        {
                            Trace.WriteLine(iteSlot + "Test point complete.");

                            myTestInfo.ResultsParams[1].Result = "ok";
                            myTestInfo.ResultsParams[2].Result = "ok";
                            myTestInfo.ResultsParams[3].Result = "ok";

                            goto pass;
                        }
                        else
                        {
                            Trace.WriteLine(iteSlot + "Number of time(s) failed: " + num);
                            num++;
                        }
                    }

                    if (num > Convert.ToInt32(myTestInfo.TestParams[1].Value))
                    {
                        myTestInfo.ResultsParams[1].Result = "FAILED";
                        myTestInfo.ResultsParams[2].Result = "FAILED";
                        myTestInfo.ResultsParams[3].Result = "FAILED";

                        //throw new Exception("Recalibration failed three times.");
                    }

pass:
                    break;
                }

                case "5.11.10_Gain_FIL1":
                {
                    step = 1;

                    while (step <= myTestInfo.ResultsParams.NumResultParams)
                    {
                        //@@ Open the stdleak @@//

                        Trace.WriteLine(iteSlot + "Open the stdleak...");

                        status = Helper.DoThis(myLD, ref myTestInfo, "STDLEAK", "ok", step, "ok");
                        step++;


                        Trace.WriteLine(iteSlot + "Provide time for the UUT to read the stdleak...");
                        Thread.Sleep(60000);


                        //@@ Obtain the gain value of the UUT @@//

                        Trace.WriteLine(iteSlot + "Obtain the gain value of the UUT...");

                        retval = Helper.SendCommand(myLD, ref status, "?GAIN", "ok");

                        if (status == true)
                        {
                            string[] response = retval.Split(new string[] { "?GAIN ", "ok" }, StringSplitOptions.RemoveEmptyEntries);
                            Gain = Convert.ToSingle(response[0]);

                            Trace.WriteLine(iteSlot + "Gain = " + Gain);
                            Trace.WriteLine(iteSlot + "Test point complete.");

                            myTestInfo.ResultsParams[step].Result = "ok";
                        }
                        else
                        {
                            myTestInfo.ResultsParams[step].Result = "FAILED";
                            //throw new Exception("Test point failed.");
                        }

                        step++;


                        //@@ Verify the gain value obtained 0.2~2.5 @@//

                        Trace.WriteLine(iteSlot + "Verify the gain value of filament 1...");

                        if (Gain >= Convert.ToSingle(myTestInfo.ResultsParams[step].SpecMin) && Gain <= Convert.ToSingle(myTestInfo.ResultsParams[step].SpecMax))
                        {
                            Trace.WriteLine(iteSlot + "Test point complete.");
                            myTestInfo.ResultsParams[step].Result = Convert.ToString(Gain);
                        }
                        else
                        {
                            myTestInfo.ResultsParams[step].Result = Convert.ToString(Gain);
                            //throw new Exception("Test point failed.");
                        }

                        step++;


                        //@@ Obtain the leak rate @@//

                        Trace.WriteLine(iteSlot + "Obtain the leak rate...");
                        retval = Helper.SendCommand(myLD, ref status, "?LEAK", "ok");

                        if (status == true)
                        {
                            string[] response = retval.Split(new string[] { "?LEAK ", "ok" }, StringSplitOptions.RemoveEmptyEntries);
                            Leakrate = Convert.ToDouble(response[0]);

                            Trace.WriteLine(iteSlot + "Measured leakrate = " + Leakrate + "Std .cc/s");
                            myTestInfo.ResultsParams[step].Result = "ok";
                            Trace.WriteLine(iteSlot + "Test point complete.");
                        }

                        else
                        {
                            myTestInfo.ResultsParams[step].Result = "FAILED";
                            //throw new Exception("Test point failed.");
                        }

                        step++;


                        //@@ rate with stdleak rate @@//
                        Trace.WriteLine(iteSlot + "Compare the obtained leak rate with the stdleak installed...");
                        retval = Helper.SendCommand(myLD, ref status, "?STDLEAKt", "ok");

                        double stdleakt    = 0;
                        double exp_stdleak = 0;

                        if (status == true)
                        {
                            string[] response  = retval.Split(new string[] { "?STDLEAKt ", "ok" }, StringSplitOptions.RemoveEmptyEntries);
                            string[] response2 = response[0].Split(new string[] { "E" }, StringSplitOptions.RemoveEmptyEntries);

                            stdleakt    = Convert.ToDouble(response[0]);
                            exp_stdleak = Convert.ToDouble(response2[1]);
                        }
                        // hairus added to get comparison stdleak properly
                        double maxLeakDiff = stdleakt + 0.2E-7;
                        double minLeakDiff = stdleakt - 0.2E-7;
                        myTestInfo.ResultsParams[step].SpecMax = maxLeakDiff.ToString();
                        myTestInfo.ResultsParams[step].SpecMin = minLeakDiff.ToString();
                        myTestInfo.ResultsParams[step].Nominal = stdleakt.ToString();

                        // set the result
                        myTestInfo.ResultsParams[step].Result = Leakrate.ToString();
                        //Trace.WriteLine(iteSlot + "Compare the obtained leak rate with the stdleak installed...");
                        //retval = Helper.SendCommand(myLD, ref status, "?STDLEAKt", "ok");

                        //double stdleak = 0;
                        //double exp_stdleak = 0;

                        //if (status == true)
                        //{
                        //    string[] response = retval.Split(new string[] { "?STDLEAKt ", "ok" }, StringSplitOptions.RemoveEmptyEntries);
                        //    string[] response2 = response[0].Split(new string[] { "E" }, StringSplitOptions.RemoveEmptyEntries);

                        //    stdleak = Convert.ToDouble(response[0]);
                        //    exp_stdleak = Convert.ToDouble(response2[1]);
                        //}

                        //if (Leakrate >= (stdleak - 0.2 * Math.Pow(10, exp_stdleak)) && Leakrate <= (stdleak + 0.2 * Math.Pow(10, exp_stdleak)))
                        //{
                        //    myTestInfo.ResultsParams[step].Result = "ok";
                        //    Trace.WriteLine(iteSlot + "Test point complete.");
                        //}

                        //else
                        //{
                        //    myTestInfo.ResultsParams[step].Result = "FAILED";
                        //    //throw new Exception("Test point failed.");
                        //}

                        step++;
                    }

                    break;
                }

                case "5.11.11_Stdleak_FIL1":
                {
                    step = 1;

                    //@@ Close the stdleak @@//

                    Trace.WriteLine(iteSlot + "Close the stdleak...");

                    status = Helper.DoThis(myLD, ref myTestInfo, "STDLEAK", "ok", step, "ok");
                    Thread.Sleep(3000);
                    int counter = 1;                    // YS WONG
recheck:
                    string checker = Helper.SendCommand(myLD, ref status, "?VALVESTATE", "MIDSTAGE");
                    if (!checker.Contains("MIDSTAGE"))
                    {
                        Thread.Sleep(2000);
                        counter++;
                        if (counter > 5)
                        {
                            Trace.WriteLine("MIDSTAGE FAIL"); break;
                        }
                        else
                        {
                            goto recheck;
                        }
                    }                                   // YS WONG

                    break;
                }

                case "5.11.12_Vent_FIL1":
                {
                    step = 1;

                    //@@ Vent the UUT @@//

                    Trace.WriteLine(iteSlot + "Venting the UUT...");

                    status = Helper.DoThis(myLD, ref myTestInfo, "VENT", "ok", step, "ok");
                    int counter = 1;                    // YS WONG
recheck:
                    string checker = Helper.SendCommand(myLD, ref status, "?VALVESTATE", "VENT");
                    if (!checker.Contains("VENT"))
                    {
                        Thread.Sleep(2000);
                        counter++;
                        if (counter > 5)
                        {
                            Trace.WriteLine("VENT FAIL"); break;
                        }
                        else
                        {
                            goto recheck;
                        }
                    }
                    Thread.Sleep(2000);             // YS WONG


                    break;
                }

                case "5.11.15 Final_verification":
                {
                    step = 1;

                    //@@ Get initialization parameters from the UUT and verify them @@//

                    /*@@ Verify the reading of the initialization parameters
                     * Responds with four lines. Each begins with a <cr><lf>.
                     * The first line reports the ion chamber value.
                     * The second line reports the emission value.
                     * The third line reports the value of the offset variable.
                     * The fourth line reports the gain value. @@*/

                    Trace.WriteLine(iteSlot + "Obtain and verify the initialization parameters of the UUT...");
                    retval = Helper.SendCommand(myLD, ref status, "?ALL", "ok");

                    if (status == true)
                    {
                        //Obtain ionchamber value
                        string[] response1 = retval.Split(new string[] { "IONCHAMBER ", "EMISSION" }, StringSplitOptions.RemoveEmptyEntries);
                        //Obtain emmision current
                        string[] response2 = retval.Split(new string[] { "EMISSION ", "OFFSET" }, StringSplitOptions.RemoveEmptyEntries);
                        //Obtain midstage offset variable
                        string[] response3 = retval.Split(new string[] { "OFFSET ", "GAIN" }, StringSplitOptions.RemoveEmptyEntries);
                        string[] response5 = response3[1].Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                        //Obtain gain value
                        string[] response4 = retval.Split(new string[] { "GAIN ", "ok" }, StringSplitOptions.RemoveEmptyEntries);

                        var Ionchamber       = Convert.ToSingle(response1[1]);
                        var Emmisioncurrent  = Convert.ToSingle(response2[1]);
                        var OffsetContraFlow = Convert.ToInt32(response5[0]);
                        var OffsetMidstage   = Convert.ToInt32(response5[1]);
                        var Gain             = Convert.ToSingle(response4[1]);

                        Trace.WriteLine(iteSlot + "Ionchamber = " + Ionchamber + "   Emmission Current = " + Emmisioncurrent + "   Offset = " + OffsetMidstage + "   Gain = " + Gain);
                        myTestInfo.ResultsParams[1].Result = "ok";
                        myTestInfo.ResultsParams[2].Result = Ionchamber.ToString();
                        myTestInfo.ResultsParams[3].Result = Emmisioncurrent.ToString();
                        myTestInfo.ResultsParams[4].Result = Gain.ToString();
                        myTestInfo.ResultsParams[5].Result = OffsetContraFlow.ToString();
                        myTestInfo.ResultsParams[6].Result = OffsetMidstage.ToString();
                        //Retrieve the data for initialization parameters from the UUT and compare them with the values that wished to be set
                        //if (Ionchamber >= Convert.ToSingle(myTestInfo.TestParams[1].Value) && Ionchamber <= Convert.ToSingle(myTestInfo.TestParams[2].Value) && Emmisioncurrent >= Convert.ToSingle(myTestInfo.TestParams[3].Value) && Emmisioncurrent <= Convert.ToSingle(myTestInfo.TestParams[4].Value) && Offset >= Convert.ToInt32(myTestInfo.TestParams[5].Value) && Offset <= Convert.ToInt32(myTestInfo.TestParams[6].Value) && Gain >= Convert.ToSingle(myTestInfo.TestParams[7].Value))
                        //{
                        //    myTestInfo.ResultsParams[step].Result = "ok";
                        //    Trace.WriteLine(iteSlot + "Test point complete.");
                        //}
                        //else
                        //{
                        //    myTestInfo.ResultsParams[step].Result = "FAILED";
                        //    throw new Exception("Test point failed.");
                        //}
                    }
                    else
                    {
                        myTestInfo.ResultsParams[1].Result = "FAILED";
                        throw new Exception("Test point failed.");
                    }
                    break;
                }

                case "5.11.16 Verify_Setup":
                {
                    step = 1;

                    //@@ Retrieve the setup parameters from the UUT and compare it to the current detected leak rate @@//

                    Trace.WriteLine(iteSlot + "Obtain and verify the setup parameters of the UUT...");
                    retval = Helper.SendCommand(myLD, ref status, "?SETUP", "ok");

                    if (status == true)
                    {
                        //Obtain stdleak rate
                        string[] response  = retval.Split(new string[] { "stdleak     ", "\n\routput" }, StringSplitOptions.RemoveEmptyEntries);
                        string[] response2 = response[1].Split(new string[] { "E" }, StringSplitOptions.RemoveEmptyEntries);

                        double Setup_stdleak = Convert.ToDouble(response[1]);
                        int    Setup_exp     = Convert.ToInt32(response2[1]);

                        //Retrieve the data for setup parameters from the UUT and compare them with the values that wished to be set
                        if (Leakrate >= (Setup_stdleak - 0.2 * Math.Pow(10, Setup_stdleak)) && Leakrate <= (Setup_stdleak + 0.2 * Math.Pow(10, Setup_stdleak)))
                        {
                            myTestInfo.ResultsParams[step].Result = "ok";
                            Trace.WriteLine(iteSlot + "Test point complete.");
                        }
                        else
                        {
                            myTestInfo.ResultsParams[step].Result = "FAILED";
                            //throw new Exception("Test point failed.");
                        }
                    }
                    else
                    {
                        myTestInfo.ResultsParams[step].Result = "FAILED";
                        //throw new Exception("Test point failed.");
                    }

                    break;
                }

                case "5.11.17 Vent":
                {
                    //@@ Vent the UUT @@//

                    step = 1;

                    Trace.WriteLine(iteSlot + "Vent the UUT...");
                    status = Helper.DoThis(myLD, ref myTestInfo, "VENT", "ok", step, "ok");
checkagain:
                    retval = Helper.SendCommand(myLD, ref status, "?PRESSURES", "ok");

                    string[] resp     = retval.Split(new string[] { "(mTorr): ", "\r\nSpectrometer" }, StringSplitOptions.RemoveEmptyEntries);
                    int      Pressure = Convert.ToInt32(resp[1]);


                    Trace.WriteLine(iteSlot + "Pressure: " + Pressure + "mTorr   System Pressure: ");
                    if (!(Pressure >= 700000 && Pressure <= 760000))
                    {
                        Thread.Sleep(2000);
                        goto checkagain;
                    }
                    // YS Wong added to make sure vented properly

                    Thread.Sleep(1000);
                    break;
                }
                }
            }

            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
                Helper.Fail_Test(ref myTestInfo, ex.Message, step);
                throw;
            }


            return(myTestInfo);
        }
예제 #18
0
        //@@ Auto recalibrate when the initial calibration fails. Seq 5.11 @@//

        public static bool Recalibrate(VSLeakDetector myLD)
        {
            try
            {
                //VSLeakDetector myLD = new VSLeakDetector(comPort);
                //myLD.iteSlot = iteSlot;
                Boolean status = false;

                /*@@ Initiates a Full or Fast calibration depending on system settings. The CPU software tunes,
                 * then adjusts the gain so that the current helium signal causes the current leak rate measurement
                 * to be the same as the most recently input using INIT-STDLEAK. If the gain is 2.9 or higher, a normal
                 * calibration is performed. Success is indicated by the normal ok response. @@*/

                Trace.WriteLine(myLD.iteSlot + "Calibrating...");
                // myLD.Open();
                myLD.Write("CALIBRATE");

                string retval = myLD.Read();

                if (retval.Contains("ok"))
                {
                    //@@ Wait for 979 Calibration VI @@//

                    Trace.WriteLine(myLD.iteSlot + "Wait for system to enter FINETEST mode...");

                    int timeout = 1;
                    status = false;

                    while (timeout > 0)
                    {
                        myLD.Write("?VALVESTATE");

                        retval = myLD.Read();

                        if (retval.Contains("MIDSTAGE") && retval.Contains("ok"))
                        {
                            //@@ Report and verify the status of the last calibration. @@//

                            Trace.WriteLine(myLD.iteSlot + "Report and verify the status of the last calibration...");

                            myLD.Write("?CALOK");
                            retval = myLD.Read();

                            if (retval.Contains("Yesok"))
                            {
                                status = true;
                                break;
                            }
                        }

                        if (timeout > 300)
                        {
                            status = false;
                            break;
                        }

                        Thread.Sleep(1000);
                        timeout++;
                    }
                }

                //myLD.Close();
                return(status);
            }

            catch (Exception)
            {
                throw;
            }
        }
예제 #19
0
        /// <summary>
        /// This method is called when the test is completed
        /// </summary>
        /// <param name="_uutData"></param>
        /// <param name="_commonData"></param>
        public void UserCleanup(ref UUTData _uutData, ref CommonData _commonData)
        {
            try
            {
                // Disconnect 5V supply and TTL signal from the Sensor Board
                InstrumentIO.DisconnectTempBoardMeasRoute(mySw, TestPort);
                InstrumentIO.CloseAllTestValve(mySw);

                if (myLD != null)
                {
                    // at the end of the test, vent the Leak Detector
                    //Trace.WriteLine("Vent the Leak Detector");
                    //myLD.Vent();
                    Trace.WriteLine("Disconnecting Serial Port Communication....");
                    myLD.Close();
                    myLD = null;
                    Trace.WriteLine("   ... disconnected");
                }

                // Destruct the Test Classes
                myInitStationTest = null;
                myCalLeakTest     = null;
                mySystemCalTest   = null;
                myButtonUpTest    = null;

                // Check FinalTest outcome, Pass/Fail flag P,F,A,E and the test is in Production Mode
                if (_commonData.TestOutcome.ToUpper() == "P" && _commonData.isProdMode)
                {
                    Trace.WriteLine("Submitting Cal-Leak data summary to database...");
                    string sqlConStr = CalLeakConfigs.Default.SqlConString;
                    myCalLeakData.IsPass = true;    // Pass
                    using (SqlConnection conn = new SqlConnection(sqlConStr))
                    {
                        conn.Open();
                        var retVal = SqlHelper.SubmitFinalCalLeakData(conn, ref myCalLeakData);
                        Trace.WriteLine("CalLeak Data transfered to database.");

                        // Create certificate history for the unit
                        int    id    = Convert.ToInt32(retVal);
                        string eqIds = SqlHelper.GetCsvStringEquipmentUsed(conn, 2, 1);

                        // save UUT certificate details
                        SqlHelper.SaveCertDetails(conn, id, eqIds);
                    }

                    Trace.WriteLine("Generating new Serial Number...");
                    // Autogenerate Serial Number

                    string     modelNumber     = _uutData.Model;
                    string     serialNumber    = string.Empty;
                    DateTime   todayDate       = DateTime.Now;
                    int        workWeek        = DateTimeHelper.GetIso8601WeekOfYear(todayDate);
                    SernumInfo mySerialNumInfo = new SernumInfo();
                    mySerialNumInfo.Model = modelNumber;
                    using (SqlConnection conn = new SqlConnection(sqlConStr))
                    {
                        Trace.WriteLine("Connecting to SQL Database for serial number retrieval");
                        conn.Open();
                        Trace.WriteLine("Connection succeeded");

                        var newSernum = SqlHelper.GetNextRunningNumber(conn, ref mySerialNumInfo);
                        //serialNumber = string.Format("MY{0}{1}{2}", todayDate.ToString("yy"), todayDate.ToString("MM"), newSernum); // commented out due to serial number generation must use YYWW
                        serialNumber = string.Format("MY{0}{1}{2}", todayDate.ToString("yy"), workWeek.ToString("00"), newSernum);
                        Trace.WriteLine("New Serial Number is = " + serialNumber);
                    }

                    Trace.WriteLine("Submitting new serial number to database..");
                    DateTime date = DateTime.Now;
                    mySerialNumInfo.DummySernum   = _uutData.SerNum;
                    mySerialNumInfo.Model         = _uutData.Model;
                    mySerialNumInfo.IsPassTest    = true;
                    mySerialNumInfo.Sernum        = serialNumber;
                    mySerialNumInfo.LogDate       = date;
                    mySerialNumInfo.RunningNumber = mySerialNumInfo.RunningNumber;// +1;
                    string conStr = CalLeakConfigs.Default.SqlConString;
                    using (SqlConnection conn = new SqlConnection(conStr))
                    {
                        conn.Open();
                        var retVal = SqlHelper.SubmitAutoGeneratedSernum(conn, ref mySerialNumInfo);
                        Trace.WriteLine(retVal.ToString());
                    }
                    Trace.WriteLine("Done");
                }
                else if (_commonData.isProdMode)
                {
                    Trace.WriteLine("Submitting Cal-Leak data summary to database...");
                    string sqlConStr = CalLeakConfigs.Default.SqlConString;
                    myCalLeakData.IsPass = false;    // Failed
                    using (SqlConnection conn = new SqlConnection(sqlConStr))
                    {
                        conn.Open();
                        var retVal = SqlHelper.SubmitFinalCalLeakData(conn, ref myCalLeakData);
                        Trace.WriteLine("CalLeak Data transfered to database.");
                    }
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                _uutData = null;
                //_commonData = null;

                // todo: play sound for test completion or tower light
            }
        }
예제 #20
0
        public static TestInfo DoSeq5_1(VSLeakDetector myLD, ref TestInfo myTestInfo, ref UUTData myuutdata)
        {
            string     reading;
            userprompt my_userprompt = new userprompt();

            try
            {
                switch (myTestInfo.TestLabel)
                {
                case "5.1.1 Power":
                {
                    //@@ Ensure that the power cord is not plugged into the UUT & the main AC supply outlet. @@//

                    Trace.WriteLine(iteSlot + "Disconnect the power supply from the UUT...");

recheck:
                    string conStr = "Data Source=wpsqldb21;Initial Catalog=VpdOF;Persist Security Info=True;User ID=VpdTest;Password=Vpd@123";
                    string DMMstatus = SQL_34970A.Read_DMM_Status(conStr);

                    if (DMMstatus == "No")
                    {
                    }
                    else
                    {
                        Trace.WriteLine("DMM locked");
                        Thread.Sleep(5000);
                        goto recheck;
                    }

                    InstrumentIO.DAS_Power_OFF(myuutdata.Options);
                    myTestInfo.ResultsParams[1].Result = "ok";

                    break;
                }

                case "5.1.2 Check_PumpVoltage":
                {
                    /*@@ SKIP* Check the LD has the correct voltage mechanical pump installed (115VAC or 230VAC) or that the voltage selector switch
                     * on the vacuum pump is set to meet the rated mains AC requirements for that model LD. @@*/

                    myTestInfo.ResultsParams[1].Result = "ok";

                    break;
                }

                case "5.1.3 Check_Setup":
                {
                    //@@ Prompt user to ensure that all KF clamps, grounding straps, cable and wire connections between the PCBs, valves and pumps are in place. @@//

                    string display = "Seq 5.1.3:\nEnsure that all KF clamps, grounding straps, cable and wire connections between the PCBs,\nvalves and pumps are in place. Enter 'ok' once done.";
                    string Reading = Helper.LabelDisplay(display);

                    myTestInfo.ResultsParams[1].Result = Reading;

                    break;
                }

                case "5.1.5 Measure_Resistance":
                {
                    //Lock the DDM from other test sockets while it is been used. Before that, verify whether it is locked or not.
                    int    step      = 1;
                    int    checking  = 1;
                    string DMMstatus = "";
                    string conStr    = myTestInfo.TestParams[1].Value;
                    string res_range = myTestInfo.TestParams[2].Value;

                    Trace.WriteLine(iteSlot + "Check before Locking the DMM...");

                    while (checking > 0)
                    {
recheck:
                        DMMstatus = SQL_34970A.Read_DMM_Status(conStr);

                        if (DMMstatus == "No")
                        {
                            SQL_34970A.Update_DMM_Status(myuutdata.Options, "Yes", conStr);              //Yes = Lock     No = Unlock
                            Thread.Sleep(5000);
                            break;
                        }
                        else
                        {
                            MessageBox.Show("DMM locked", "warning", MessageBoxButtons.OK);
                            Thread.Sleep(5000);
                            goto recheck;
                        }
                    }

                    MessageBox.Show("Please flip Leak Detector switch to OFF positions", "OFF Switch", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    //@@ Measure resistance between line blade and neutral blade OFF (0.8~1.2) @@//

                    Trace.WriteLine(iteSlot + "Measure resistance between line blade and neutral blade OFF");

                    //reading = InstrumentIO.Measure_Resistance(4, res_range);
                    reading = InstrumentIO.Measure_Res_LB_NB_OFF();
                    Trace.WriteLine(iteSlot + "Test point complete.");
                    myTestInfo.ResultsParams[step].Result = reading;

                    step++;


                    //@@ Measure resistance between line blade and ground blade OFF @@//

                    Trace.WriteLine(iteSlot + "Measure resistance between line blade and ground blade OFF...");
                    reading = InstrumentIO.Measure_Resistance(2, res_range);

                    if (Convert.ToDouble(reading) > 10000000)
                    {
                        Trace.WriteLine(iteSlot + "Test point complete.");
                        myTestInfo.ResultsParams[step].Result = "100000000";
                    }
                    else
                    {
                        myTestInfo.ResultsParams[step].Result = reading;
                        //throw new Exception("Measured value out of acceptable range.");
                    }

                    step++;


                    //@@ Measure resistance between neutral blade and ground blade OFF @@//

                    Trace.WriteLine(iteSlot + "Measure resistance between neutral blade and ground blade OFF...");
                    reading = InstrumentIO.Measure_Resistance(3, res_range);

                    if (Convert.ToDouble(reading) > 10000000)
                    {
                        Trace.WriteLine(iteSlot + "Test point complete.");
                        myTestInfo.ResultsParams[step].Result = "100000000";
                    }

                    else
                    {
                        myTestInfo.ResultsParams[step].Result = reading;
                        //throw new Exception("Measured value out of acceptable range.");
                    }
                    step++;

                    MessageBox.Show("Please flip Leak Detector switch to ON positions", "ON Switch", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //@@ Measure resistance between the gnd blade and tp metal (< 0.8) @@//

                    Trace.WriteLine(iteSlot + "Measure resistance between the gnd blade and tp metal (< 0.8)...");
                    double res1 = InstrumentIO.Measure_Resistance(0, "100", "0.001");
                    //reading = InstrumentIO.Measure_Resistance(0, res_range);
                    myTestInfo.ResultsParams[step].Result = res1.ToString();
                    step++;


                    //@@ Measure resistance between the ground blade and grounding stud. (< 0.8) @@//

                    Trace.WriteLine(iteSlot + "Measure resistance between the ground blade and grounding stud. (< 0.8)...");
                    //reading = InstrumentIO.Measure_Resistance(1, res_range);
                    double res2 = InstrumentIO.Measure_Resistance(0, "100", "0.001");
                    myTestInfo.ResultsParams[step].Result = res2.ToString();
                    Trace.WriteLine(iteSlot + "Test point complete.");
                    step++;


                    //@@ Measure resistance between line blade and neutral blade ON (Based on model) @@//
                    List <string> listOfLimits = new List <string>();
                    listOfLimits.Add(myTestInfo.TestParams[3].Value);
                    listOfLimits.Add(myTestInfo.TestParams[4].Value);
                    listOfLimits.Add(myTestInfo.TestParams[5].Value);
                    listOfLimits.Add(myTestInfo.TestParams[6].Value);
                    listOfLimits.Add(myTestInfo.TestParams[7].Value);
                    listOfLimits.Add(myTestInfo.TestParams[8].Value);

                    Trace.WriteLine(iteSlot + "Measure resistance between line blade and neutral blade ON (Based on model)...");
                    string resReading = InstrumentIO.Measure_Res_LB_NB_ON(myuutdata.Model, res_range, listOfLimits.ToArray(), ref myTestInfo, step);
                    Trace.WriteLine(iteSlot + "Test point completed");
                    myTestInfo.ResultsParams[step].Result = resReading;
                    step++;


                    //@@ Measure resistance between line blade and ground blade ON @@//

                    Trace.WriteLine(iteSlot + "Measure resistance between line blade and ground blade ON...");
                    reading = InstrumentIO.Measure_Resistance(2, res_range);

                    if (Convert.ToDouble(reading) > 10000000)
                    {
                        Trace.WriteLine(iteSlot + "Test point complete.");
                        myTestInfo.ResultsParams[step].Result = "100000000";
                    }

                    else
                    {
                        myTestInfo.ResultsParams[step].Result = reading;
                        //throw new Exception("Measured value out of acceptable range.");
                    }

                    step++;


                    //@@ Measure resistance between neutral blade and ground blade ON @@//

                    Trace.WriteLine(iteSlot + "Measure resistance between neutral blade and ground blade ON...");
                    reading = InstrumentIO.Measure_Resistance(3, res_range);

                    if (Convert.ToDouble(reading) > 10000000)
                    {
                        Trace.WriteLine(iteSlot + "Test point complete.");
                        myTestInfo.ResultsParams[step].Result = "100000000";
                    }

                    else
                    {
                        myTestInfo.ResultsParams[step].Result = reading;
                        //throw new Exception("Measured value out of acceptable range.");
                    }

                    step++;

                    //Unlock DMM

                    Trace.WriteLine(iteSlot + "Unlocking the DMM...");
                    conStr = myTestInfo.TestParams[1].Value;

                    // SQL_34970A.Update_DMM_Status(myuutdata.Options, "No", conStr);
                    step++;
                }
                break;
                }
            }

            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
                Helper.Fail_Test(ref myTestInfo, ex.Message, 1);
                throw;
            }

            return(myTestInfo);
        }
예제 #21
0
        public static TestInfo DoSeq5_13(VSLeakDetector myLD, ref TestInfo myTestInfo, ref UUTData myuutdata)
        {
            Boolean status = false;
            string  reading;
            int     step = 1;

            //Helper.comPort = comPort;

            try
            {
                switch (myTestInfo.TestLabel)
                {
                case "5.13.1 Power":
                {
                    //Lock the DMM

                    int    checking = 1;
                    string conStr   = myTestInfo.TestParams[1].Value;

                    while (checking > 0)
                    {
                        string DMMstatus = SQL_34970A.Read_DMM_Status(conStr);

                        if (DMMstatus == "No")
                        {
                            SQL_34970A.Update_DMM_Status(myuutdata.Options, "Yes", conStr);            //Yes = Lock     No = Unlock
                            break;
                        }

                        Thread.Sleep(5000);
                    }


                    //@@ Disconnect power from the UUT @@//

                    Trace.WriteLine(iteSlot + "Disconnect power from the UUT...");
                    if (iteSlot.Contains("P1"))
                    {
                        InstrumentIO.DAS_Power_OFF("1");
                        Trace.WriteLine(iteSlot + "Unlocking the DMM...");
                        SQL_34970A.Update_DMM_Status("1", "No", conStr);
                    }
                    else
                    {
                        InstrumentIO.DAS_Power_OFF("2");
                        Trace.WriteLine(iteSlot + "Unlocking the DMM...");
                        SQL_34970A.Update_DMM_Status("2", "No", conStr);
                    }
                    Trace.WriteLine(iteSlot + "Test point complete.");
                    myTestInfo.ResultsParams[step].Result = "ok";


                    break;
                }

                case "5.13.3 Measure_Resistane":
                {
                    string res_range = myTestInfo.TestParams[2].Value;

                    //@@ Measure resistance between the gnd blade and tp metal (< 0.8) @@//

                    Trace.WriteLine(iteSlot + "Measure resistance between the gnd blade and tp metal (< 0.8)...");
                    double res1 = InstrumentIO.Measure_Resistance(0, "100", "0.001");
                    //reading = InstrumentIO.Measure_Resistance(0, res_range);
                    myTestInfo.ResultsParams[step].Result = res1.ToString();
                    //Trace.WriteLine(iteSlot + "Test point complete.");
                    //if (Convert.ToDouble(reading) < 0.8)
                    //{

                    //    myTestInfo.ResultsParams[step].Result = reading;
                    //}

                    //else
                    //{
                    //    myTestInfo.ResultsParams[step].Result = reading;
                    //    //throw new Exception("Measured value out of acceptable range.");
                    //}

                    step++;


                    //@@ Measure resistance between the ground blade and grounding stud. (< 0.8) @@//

                    Trace.WriteLine(iteSlot + "Measure resistance between the ground blade and grounding stud. (< 0.8)...");
                    //reading = InstrumentIO.Measure_Resistance(1, res_range);
                    double res2 = InstrumentIO.Measure_Resistance(0, "100", "0.001");
                    myTestInfo.ResultsParams[step].Result = res2.ToString();
                    Trace.WriteLine(iteSlot + "Test point complete.");
                    //if (Convert.ToDouble(reading) < 0.8)
                    //{

                    //    myTestInfo.ResultsParams[step].Result = reading;
                    //}

                    //else
                    //{
                    //    myTestInfo.ResultsParams[step].Result = reading;
                    //    //throw new Exception("Measured value out of acceptable range.");
                    //}

                    step++;


                    //@@ Measure resistance between line blade and neutral blade ON (Based on model) @@//
                    List <string> listOfLimits = new List <string>();
                    listOfLimits.Add(myTestInfo.TestParams[3].Value);
                    listOfLimits.Add(myTestInfo.TestParams[4].Value);
                    listOfLimits.Add(myTestInfo.TestParams[5].Value);
                    listOfLimits.Add(myTestInfo.TestParams[6].Value);
                    listOfLimits.Add(myTestInfo.TestParams[7].Value);
                    listOfLimits.Add(myTestInfo.TestParams[8].Value);

                    Trace.WriteLine(iteSlot + "Measure resistance between line blade and neutral blade ON (Based on model)...");
                    string resReading = InstrumentIO.Measure_Res_LB_NB_ON(myuutdata.Model, res_range, listOfLimits.ToArray(), ref myTestInfo, step);
                    Trace.WriteLine(iteSlot + "Test point completed");
                    myTestInfo.ResultsParams[step].Result = resReading;
                    step++;


                    //@@ Measure resistance between line blade and ground blade ON @@//

                    Trace.WriteLine(iteSlot + "Measure resistance between line blade and ground blade ON...");
                    reading = InstrumentIO.Measure_Resistance(2, res_range);

                    if (Convert.ToDouble(reading) > 10000000)
                    {
                        Trace.WriteLine(iteSlot + "Test point complete.");
                        myTestInfo.ResultsParams[step].Result = "100000000";
                    }

                    else
                    {
                        myTestInfo.ResultsParams[step].Result = reading;
                        //throw new Exception("Measured value out of acceptable range.");
                    }

                    step++;


                    //@@ Measure resistance between neutral blade and ground blade ON @@//

                    Trace.WriteLine(iteSlot + "Measure resistance between neutral blade and ground blade ON...");
                    reading = InstrumentIO.Measure_Resistance(3, res_range);

                    if (Convert.ToDouble(reading) > 10000000)
                    {
                        Trace.WriteLine(iteSlot + "Test point complete.");
                        myTestInfo.ResultsParams[step].Result = "100000000";
                    }

                    else
                    {
                        myTestInfo.ResultsParams[step].Result = reading;
                        //throw new Exception("Measured value out of acceptable range.");
                    }

                    step++;

                    MessageBox.Show("Please flip Leak Detector switch to OFF positions", "OFF Switch", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    //@@ Measure resistance between line blade and neutral blade OFF (0.8~1.2) @@//

                    Trace.WriteLine(iteSlot + "Measure resistance between line blade and neutral blade OFF");

                    //reading = InstrumentIO.Measure_Resistance(4, res_range);
                    reading = InstrumentIO.Measure_Res_LB_NB_OFF();
                    Trace.WriteLine(iteSlot + "Test point complete.");
                    myTestInfo.ResultsParams[step].Result = reading;

                    step++;


                    //@@ Measure resistance between line blade and ground blade OFF @@//

                    Trace.WriteLine(iteSlot + "Measure resistance between line blade and ground blade OFF...");
                    reading = InstrumentIO.Measure_Resistance(2, res_range);

                    if (Convert.ToDouble(reading) > 10000000)
                    {
                        Trace.WriteLine(iteSlot + "Test point complete.");
                        myTestInfo.ResultsParams[step].Result = "100000000";
                    }
                    else
                    {
                        myTestInfo.ResultsParams[step].Result = reading;
                        //throw new Exception("Measured value out of acceptable range.");
                    }

                    step++;


                    //@@ Measure resistance between neutral blade and ground blade OFF @@//

                    Trace.WriteLine(iteSlot + "Measure resistance between neutral blade and ground blade OFF...");
                    reading = InstrumentIO.Measure_Resistance(3, res_range);

                    if (Convert.ToDouble(reading) > 10000000)
                    {
                        Trace.WriteLine(iteSlot + "Test point complete.");
                        myTestInfo.ResultsParams[step].Result = "100000000";
                    }

                    else
                    {
                        myTestInfo.ResultsParams[step].Result = reading;
                        //throw new Exception("Measured value out of acceptable range.");
                    }

                    //Unlock DMM

                    step++;
                }

                break;
                }
            }

            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
                Helper.Fail_Test(ref myTestInfo, ex.Message, step);
                throw;
            }

            return(myTestInfo);
        }