Ejemplo n.º 1
0
        private void DoExperiment1(ref TestInfo myTestInfo, ref UUTData myUUTData, ref CommonData myCommonData)
        {
            try
            {
                var loop  = Convert.ToInt32(myTestInfo.TestParams[1].Value);
                var delay = Convert.ToInt32(myTestInfo.TestParams[2].Value);

                // Close all Test Valves
                InstrumentIO.CloseAllTestValve(mySw);
                Thread.Sleep(5000);
                InstrumentIO.OpenTestValve(mySw, 0);    // open NIST valve
                Thread.Sleep(5000);
                // Configure Thermocouple measurement
                InstrumentIO.ConfigureThermocouple(mySw);

                myTestInfo.ResultsParams = new PIResultsArray();
                List <PIResult> listOfPIResult = new List <PIResult>();
                for (int i = 0; i < loop; i++)
                {
                    listOfPIResult.Add(new PIResult
                    {
                        Label   = string.Format("NistLeakRate#{0}", i + 1),
                        SpecMin = "1E-7",
                        SpecMax = "2E-7",
                        Nominal = "1.5E-7",
                        Unit    = "std cc/sec"
                    });
                }
                for (int i = 0; i < loop; i++)
                {
                    listOfPIResult.Add(new PIResult
                    {
                        Label   = string.Format("NISTTemp#{0}", i + 1),
                        SpecMin = "15",
                        SpecMax = "30",
                        Nominal = "22.5",
                        Unit    = "Deg C"
                    });
                }
                for (int i = 0; i < loop; i++)
                {
                    listOfPIResult.Add(new PIResult
                    {
                        Label   = string.Format("UUTTemp#{0}", i + 1),
                        SpecMin = "15",
                        SpecMax = "30",
                        Nominal = "22.5",
                        Unit    = "Deg C"
                    });
                }
                for (int i = 0; i < loop; i++)
                {
                    listOfPIResult.Add(new PIResult
                    {
                        Label   = string.Format("UUTSensorTemp#{0}", i + 1),
                        SpecMin = "15",
                        SpecMax = "30",
                        Nominal = "22.5",
                        Unit    = "Deg C"
                    });
                }

                myTestInfo.ResultsParams.PIResArray      = listOfPIResult.ToArray();
                myTestInfo.ResultsParams.NumResultParams = listOfPIResult.Count;


                // Test start here
                for (int i = 1; i <= loop; i++)  // loop 5760 * 60 * 60  with 5sec delay = 8hrs
                {
                    /* Read
                     * (1) leak rate NIST,
                     * (2) Temp NIST
                     * (3) Temp UUT
                     * (4) Temp Sensor Board
                     */
                    var leakRate    = Convert.ToDouble(myLD.ReadLeakRate().Trim());
                    var nistTemp    = InstrumentIO.MeasureCalLeakTemp(mySw, 0);
                    var uutTemp     = InstrumentIO.MeasureCalLeakTemp(mySw, 1);
                    var uutSensTemp = InstrumentIO.MeasureBoardTemperature(mySw, myScope, 1);

                    Trace.WriteLine(string.Format("NIST Leak Rate #{0} = {1}std cc/sec   &    NIST Temp #{0} = {2} Deg C   &    DUT Temp #{0} = {3} Deg C   &   Board Temp #{0} = {4} Deg C", i, leakRate, nistTemp, uutTemp, uutSensTemp));
                    myTestInfo.ResultsParams[i].Result              = Math.Round(leakRate, 8).ToString();
                    myTestInfo.ResultsParams[i + loop].Result       = Math.Round(nistTemp, 3).ToString();
                    myTestInfo.ResultsParams[i + (loop * 2)].Result = Math.Round(uutTemp, 3).ToString();
                    myTestInfo.ResultsParams[i + (loop * 3)].Result = Math.Round(uutSensTemp, 3).ToString();

                    // Delay 5 seconds, maybe
                    Thread.Sleep(delay * 1000);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        private void DoTempTest(ref TestInfo myTestInfo, ref UUTData myUUTData, ref CommonData myCommonData)
        {
            try
            {
                int    loop       = int.Parse(myTestInfo.TestParams[1].Value);
                int    delay      = int.Parse(myTestInfo.TestParams[2].Value);
                double deltaSpec  = double.Parse(myTestInfo.TestParams[3].Value);
                double deltaSpec2 = double.Parse(myTestInfo.TestParams[4].Value);
                int    trial      = Convert.ToInt32(myTestInfo.TestParams[5].Value);

                int slot = Convert.ToInt32(myCommonData.Slot);  // UUT Slot

                // Configure Thermocouple measurement
                Trace.WriteLine("Starting to initialize thermocouple and DUT's Temperature board.");
                InstrumentIO.ConfigureThermocouple(mySw);

                Trace.WriteLine("Measuring Thermocouple.");
                Trace.WriteLine("... waiting for the DUT's thermocouple to stabilized.");
                Trace.WriteLine("Loop 10 times");
                int counter = 0;
                Repeat : List <double> tempReadings = new List <double>();
                for (int i = 0; i < loop; i++)
                {
                    var dutTemp = InstrumentIO.MeasureCalLeakTemp(mySw, slot);
                    tempReadings.Add(dutTemp);
                    Trace.WriteLine("DUT Temperature: " + Math.Round(dutTemp, 2).ToString());
                    Thread.Sleep(delay);
                }
                Trace.WriteLine("DUT Average Temperature: " + tempReadings.Average().ToString());
                Trace.WriteLine("DUT Max Temperature: " + tempReadings.Max().ToString());
                Trace.WriteLine("DUT Min Temperature: " + tempReadings.Min().ToString());
                Trace.WriteLine("DUT Delta Temperature: " + (tempReadings.Max() - tempReadings.Min()).ToString());

                var delta = tempReadings.Max() - tempReadings.Min();
                counter++;

                if (delta > deltaSpec && counter < trial)
                {
                    goto Repeat;
                }

                // Measure Board Temperature
                Trace.WriteLine("Measuring DUT Board Temperature.");
                Trace.WriteLine("... waiting for the DUT's board's temperature to stabilized.");
                Trace.WriteLine("Loop 10 times");
                //InstrumentIO.SetupBoardTempMeasRoute(mySw, myScope, slot);   // setup route for BoardTemp supply and output 5V and TTL signal output
                int counter2 = 0;

                Repeat2 : List <double> tempReadings2 = new List <double>();
                for (int i = 0; i < loop; i++)   // repeat 10times to make sure the temp is stable
                {
                    var boardTemp = InstrumentIO.MeasureBoardTemperature(mySw, myScope, slot);
                    boardTemp = Math.Round(boardTemp, 2);
                    tempReadings2.Add(boardTemp);
                    Trace.WriteLine("Board Temperature: " + boardTemp.ToString());
                    Thread.Sleep(delay);
                }
                Trace.WriteLine("Board Average Temperature: " + tempReadings2.Average().ToString());
                Trace.WriteLine("Board Max Temperature: " + tempReadings2.Max().ToString());
                Trace.WriteLine("Board Min Temperature: " + tempReadings2.Min().ToString());
                Trace.WriteLine("Board Delta Temperature: " + (tempReadings2.Max() - tempReadings2.Min()).ToString());
                var delta2 = tempReadings2.Max() - tempReadings2.Min();
                counter2++;
                if (delta2 > deltaSpec2 && counter2 < trial)
                {
                    goto Repeat2;
                }
                var boardTempFinal = InstrumentIO.MeasureBoardTemperature(mySw, myScope, slot);
                //InstrumentIO.DisconnectTempBoardMeasRoute(mySw, slot);


                // Save result
                if (counter == trial)   // more than 3 times try to get stable temperature, considered failed
                {
                    myTestInfo.ResultsParams[1].Result = "TIMEOUT";
                }
                else
                {
                    myTestInfo.ResultsParams[1].Result = "PASS";
                }
                //var averageTemperature = tempReadings.Average();
                var finalCanTemp = InstrumentIO.MeasureCalLeakTemp(mySw, 1);
                myTestInfo.ResultsParams[2].Result = Math.Round(delta, 3).ToString();
                myTestInfo.ResultsParams[3].Result = Math.Round(finalCanTemp, 1).ToString();

                myTestInfo.ResultsParams[4].Result = Math.Round(delta2, 3).ToString();
                //var boardTempAve = tempReadings2.Average();

                myTestInfo.ResultsParams[5].Result = Math.Round(boardTempFinal, 1).ToString();

                // Get Temperature difference between Can's temperature and board temperature. (Factor)
                double diffTemp = boardTempFinal - finalCanTemp;
                //myTestInfo.ResultsParams[6].Result = Math.Round(diffTemp, 3).ToString();
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 3
0
        private void DoExternalCal(ref TestInfo myTestInfo, ref UUTData myUUTData, ref CommonData myCommonData)
        {
            try
            {
                var delay = Convert.ToInt32(myTestInfo.TestParams[1].Value);

                // Make sure all valve is closed.
                InstrumentIO.CloseAllTestValve(mySw);
                string retVal = string.Empty;

                // Rough vacuum
                Trace.WriteLine("Roughing in progress...");
                myLD.Rough();
                Thread.Sleep(10000);
                //bool isContraFlow = myLD.WaitForContraFlow(ref retVal);
                bool isMidStage = myLD.WaitForFineTest(ref retVal);
                if (!isMidStage)
                {
                    myTestInfo.ResultsParams[1].Result = retVal;
                    Trace.WriteLine("Unable to set to MIDSTAGE state.");
                }

                Thread.Sleep(5000);
                // Once in Fine-Test mode, let the leak rate to stabilize
                double zeroleakrate = Convert.ToDouble(myLD.ReadLeakRate());
                int    timerys      = 0;
                while (zeroleakrate > 5E-10)
                {
                    Thread.Sleep(1000);
                    zeroleakrate = Convert.ToDouble(myLD.ReadLeakRate());
                    Trace.WriteLine("calibration wait time: " + timerys);
                    timerys++;
                    if (timerys == 180)
                    {
                        Trace.WriteLine("Zero-ing");
                        myLD.Zero();
                        Thread.Sleep(2000);
                        //MessageBox.Show("to reach 5E-10 in 15 minutes","Fail",MessageBoxButtons.OK);
                        //myTestInfo.ResultsParams[1].Result = "FAIL";
                        break;
                    }
                }


                // Set LD to Hold state
                myLD.Hold();
                Thread.Sleep(5000);

                // Open NIST Valve
                Trace.WriteLine("Open NIST Test Valve.");
                InstrumentIO.OpenTestValve(mySw, 0);
                Thread.Sleep(1000);

                // Now set the LD to TEST mode
                var stat = myLD.Rough();
                Thread.Sleep(10000);
                isMidStage = myLD.WaitForFineTest(ref retVal);
                if (!isMidStage)
                {
                    myTestInfo.ResultsParams[1].Result = retVal;
                    Trace.WriteLine("Unable to set to MIDSTAGE state.");
                }
                else
                {
                    myTestInfo.ResultsParams[1].Result = "FINETEST";
                    // Delay 2 minutes for the LD to stabilize.
                    Trace.WriteLine("Waiting for the VS Leak Detector to stabilize in 2 minutes");
                    Thread.Sleep(delay * 1000);   // wait for 2 minutes (120,000 miliseconds)
                    Trace.WriteLine("VS Leak Detector is now stabilized");

                    var  stab       = "";
                    bool stabilized = myLD.WaitForStabilizedReading(ref stab);
                    if (stabilized)
                    {
                        Trace.WriteLine("Leak rate reading is stabilized!");
                    }
                    else
                    {
                        Trace.WriteLine("Timeout to get stable leak rate reading!");
                    }

                    // Now calibrate the VS Leak Detector.
                    string calStatus = myLD.Calibrate();        // Default timeout for calibration is 300seconds, change to overload method and provide new Timeout value
                    Thread.Sleep(10000);
                    bool isCalibrationOK = myLD.CalIsOK();
                    if (isCalibrationOK)
                    {
                        Trace.WriteLine("Last calibration status is OK");
                    }
                    else
                    {
                        Trace.WriteLine("Fail Calibration!!");
                    }

                    // Check the LeakRate
                    Trace.WriteLine("Read back the LeakRate from the VS Leak Detector");
                    var leakRate = Convert.ToDouble(myLD.ReadLeakRate().Trim());
                    Trace.WriteLine(string.Format("NIST LeakRate Measurement = {0}", leakRate));
                    var storedLeakRate = Convert.ToDouble(myLD.GetExternalLeakValue().Trim());
                    var leakDelta      = leakRate - storedLeakRate;//Math.Abs(storedLeakRate - leakRate);
                    Trace.WriteLine("Difference between measured and stored leak rate = " + leakDelta.ToString());

                    // Save Result
                    myTestInfo.ResultsParams[2].Result = leakRate.ToString();
                    double lowerLimit = storedLeakRate - 0.2E-7;
                    double upperLimit = storedLeakRate + 0.2E-7;
                    myTestInfo.ResultsParams[2].SpecMax = Math.Round(upperLimit, 9).ToString();
                    myTestInfo.ResultsParams[2].SpecMin = Math.Round(lowerLimit, 9).ToString();
                    myTestInfo.ResultsParams[3].Result  = Math.Round(leakDelta, 10).ToString();
                    if (leakDelta > 0.2E-7)   // If more than +-2 division.
                    {
                        // Calibrate fail.
                        // todo: do we need to recalibrate or just proceed.
                    }
                }

                // Close all Test Valves
                InstrumentIO.CloseAllTestValve(mySw);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 4
0
        private void StoreLeakRate(ref TestInfo myTestInfo, ref UUTData myUUTData, ref CommonData myCommonData)
        {
            try
            {
                Trace.WriteLine("Measuring NIST Temperature...");
                var nistLeakTemp = InstrumentIO.MeasureCalLeakTemp(mySw, 0);
                Trace.WriteLine("NIST Temperature = " + nistLeakTemp.ToString());

                int nistLeakTempInt = Convert.ToInt32(nistLeakTemp);
                Trace.WriteLine("NIST Temperature = " + nistLeakTempInt.ToString());
                double leakRate = TestHelper.GetLeakRateFromTempMap(nistLeakTempInt, myNistData);
                Trace.WriteLine(String.Format("NIST Leak Rate @{0}deg C = {1}", nistLeakTempInt, leakRate));

                Trace.WriteLine("External Cal-Leak configuration in progress...");
                Trace.WriteLine("Set VS Leak Detector to use External Cal Leak");
                myLD.UseExtCalLeakRef();    // Set LD to use External CAL Leak

                //leakRate = Math.Round(leakRate, 8);     // the number in scientific must follow exactly this format (X.XE-7 or X.XE-8), else error will occurs
                string leakRateMod = "";
                string strLeakRate = "";
                if (leakRate < 1E-7)
                {
                    leakRateMod = Math.Round(leakRate * 100000000, 1).ToString();
                    Trace.WriteLine("External Cal-Leak value to be stored in VS Leak Detector = " + leakRateMod.ToString() + "E-8");
                    strLeakRate = string.Format("{0}E-8", leakRateMod);
                    Trace.WriteLine("Storing leak rate value....");
                    myLD.SetExtCalLeakValue(strLeakRate);
                    Trace.WriteLine("Done!");

                    Trace.WriteLine("Leak rate = " + strLeakRate);
                }
                else
                {
                    leakRateMod = Math.Round(leakRate * 10000000, 1).ToString();
                    Trace.WriteLine("External Cal-Leak value to be stored in VS Leak Detector = " + leakRateMod.ToString() + "E-7");
                    strLeakRate = string.Format("{0}E-7", leakRateMod);
                    Trace.WriteLine("Storing leak rate value....");
                    myLD.SetExtCalLeakValue(strLeakRate);
                    Trace.WriteLine("Done!");

                    Trace.WriteLine("Leak rate = " + strLeakRate);
                }



                var storedVal = myLD.GetExternalLeakValue().Trim();
                Trace.WriteLine("Readback Leak Rate Value from Leak Detector = " + storedVal.ToString());

                if (double.Parse(strLeakRate) == double.Parse(storedVal))
                {
                    // pass
                    myTestInfo.ResultsParams[1].Result = "PASS";
                    myTestInfo.ResultsParams[2].Result = storedVal;
                }
                else
                {
                    // FAIL
                    myTestInfo.ResultsParams[1].Result = "FAIL";
                    myTestInfo.ResultsParams[2].Result = storedVal;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 5
0
        private void DoLeakRateProfilingTest(ref TestInfo myTestInfo, ref UUTData myUUTData, ref CommonData myCommonData)
        {
            try
            {
                var slope        = Convert.ToDouble(myTestInfo.TestParams[1].Value);
                var refTemp      = Convert.ToDouble(myTestInfo.TestParams[2].Value);
                var loop         = Convert.ToInt32(myTestInfo.TestParams[3].Value);
                var acquireDelay = Convert.ToInt32(myTestInfo.TestParams[4].Value);
                //var holdDelay = Convert.ToInt32(myTestInfo.TestParams[5].Value);

                int slot = Convert.ToInt32(myCommonData.Slot);

                // Step #1: Measure leak rate and calculate normalized leak rate
                // Close all valves
                Trace.WriteLine("Verifying test valves are closed...");
                InstrumentIO.CloseAllTestValve(mySw);
                Thread.Sleep(5000);
                Trace.WriteLine("All valves are closed");
                // hold valve
                Trace.WriteLine("Set VS Leak Detector to HOLD mode");
                myLD.Hold();
                Thread.Sleep(5000);
                // Open Test Port
                Trace.WriteLine(String.Format("Open SLOT#{0} DUT's Test Valve", slot));
                InstrumentIO.OpenTestValve(mySw, slot);
                Thread.Sleep(1000);
                myLD.Rough();   // rough the LD
                //Thread.Sleep(holdDelay * 1000);

                // once LD in FineTest
                myTestInfo.ResultsParams = new PIResultsArray();
                List <PIResult> listOfPIResult = new List <PIResult>();
                for (int i = 0; i < loop; i++)
                {
                    listOfPIResult.Add(new PIResult
                    {
                        Label   = string.Format("LeakRate#{0}", i + 1),
                        SpecMin = "1E-7", SpecMax = "2E-7", Nominal = "1.5E-7",
                        Unit    = "std cc/sec"
                    });
                }
                for (int i = 0; i < loop; i++)
                {
                    listOfPIResult.Add(new PIResult
                    {
                        Label   = string.Format("Temp#{0}", i + 1),
                        SpecMin = "15",
                        SpecMax = "30",
                        Nominal = "22.5",
                        Unit    = "Deg C"
                    });
                }
                myTestInfo.ResultsParams.PIResArray      = listOfPIResult.ToArray();
                myTestInfo.ResultsParams.NumResultParams = listOfPIResult.Count;


                // Loop measurement for DUT's Leak Rate
                var listOfLeakRate  = new List <double>();
                var listOftemp      = new List <double>();
                var listOfBoardTemp = new List <double>();
                // Configure Thermocouple measurement
                InstrumentIO.ConfigureThermocouple(mySw);
                Trace.WriteLine(String.Format("Measuring DUT's Leak Rate and Temperature for {0} times.", loop));
                int cnt1 = 0;
                int cnt2 = 0;
                for (int i = 1; i <= loop; i++)
                {
                    // read LeakRate
                    double leakRate  = Convert.ToDouble(myLD.ReadLeakRate());
                    var    dutTemp   = InstrumentIO.MeasureCalLeakTemp(mySw, slot);
                    var    boardTemp = InstrumentIO.MeasureBoardTemperature(mySw, myScope, slot);

                    Trace.WriteLine(string.Format("Leak Rate #{0} = {1}std cc/sec   &    DUT Temp #{0} = {2} Deg C   &   Board Temp #{0} = {3} Deg C", i, leakRate, dutTemp, boardTemp));
                    listOfLeakRate.Add(leakRate);
                    listOftemp.Add(dutTemp);
                    listOfBoardTemp.Add(boardTemp);
                    Thread.Sleep(acquireDelay * 1000);     // delay in miliseconds

                    myTestInfo.ResultsParams[i].Result        = Math.Round(leakRate, 8).ToString();
                    myTestInfo.ResultsParams[i + loop].Result = Math.Round(dutTemp, 3).ToString();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 6
0
        private void DoLeakRateTest(ref TestInfo myTestInfo, ref UUTData myUUTData, ref CommonData myCommonData)
        {
            try
            {
                var slope          = Convert.ToDouble(myTestInfo.TestParams[1].Value);
                var refTemp        = Convert.ToDouble(myTestInfo.TestParams[2].Value);
                var loop           = Convert.ToInt32(myTestInfo.TestParams[3].Value);
                var acquireDelay   = Convert.ToInt32(myTestInfo.TestParams[4].Value);
                var stabilizeDelay = Convert.ToInt32(myTestInfo.TestParams[5].Value);

                int slot = Convert.ToInt32(myCommonData.Slot);

                // Step #1: Measure leak rate and calculate normalized leak rate
                // Close all valves
                Trace.WriteLine("Verifying test valves are closed...");
                InstrumentIO.CloseAllTestValve(mySw);
                Thread.Sleep(3000);
                Trace.WriteLine("All valves are closed");
                // hold valve
                Trace.WriteLine("Set VS Leak Detector to HOLD mode");
                myLD.Hold();
                Thread.Sleep(3000);
                // Open Test Port
                Trace.WriteLine(String.Format("Open SLOT#{0} DUT's Test Valve", slot));
                InstrumentIO.OpenTestValve(mySw, slot);
                Thread.Sleep(2000);
                myLD.Rough();

                string status     = "";
                bool   isMidStage = myLD.WaitForFineTest(ref status);
                if (!isMidStage)
                {
                    myTestInfo.ResultsParams[1].Result = status;
                    Trace.WriteLine("Unable to set to MIDSTAGE state.");
                }

                bool isReadingStabilized = myLD.WaitForStabilizedReading(ref status);
                if (!isReadingStabilized)
                {
                    Trace.WriteLine("Timeout to get stable leak rate reading");
                }
                Thread.Sleep(stabilizeDelay * 1000);

                // Loop measurement for DUT's Leak Rate
                var listOfLeakRate  = new List <double>();
                var listOftemp      = new List <double>();
                var listOfBoardTemp = new List <double>();
                // Configure Thermocouple measurement
                InstrumentIO.ConfigureThermocouple(mySw);
                Trace.WriteLine(String.Format("Measuring DUT's Leak Rate and Temperature for {0} times.", loop));
                for (int i = 0; i < loop; i++)
                {
                    // read LeakRate
                    double leakRate  = Convert.ToDouble(myLD.ReadLeakRate());
                    var    dutTemp   = InstrumentIO.MeasureCalLeakTemp(mySw, slot);
                    var    boardTemp = InstrumentIO.MeasureBoardTemperature(mySw, myScope, slot);

                    Trace.WriteLine(string.Format("Leak Rate #{0} = {1}std cc/sec   &    DUT Temp #{0} = {2} Deg C   &   Board Temp #{0} = {3} Deg C", i + 1, leakRate, dutTemp, boardTemp));
                    listOfLeakRate.Add(leakRate);
                    listOftemp.Add(dutTemp);
                    listOfBoardTemp.Add(boardTemp);
                    Thread.Sleep(acquireDelay * 1000);     // delay in miliseconds
                }

                // calculate normalized leak rate
                var aveLeakRate = listOfLeakRate.Average();
                Trace.WriteLine("Average Leak Rate = " + aveLeakRate.ToString());

                var aveTemp = listOftemp.Average();
                Trace.WriteLine("Average DUT's Temperature = " + aveTemp.ToString());

                var aveBoardTemp = listOfBoardTemp.Average();
                Trace.WriteLine("Average Board's Temperature = " + aveBoardTemp.ToString());

                Trace.WriteLine(string.Format("Calculating DUT Normalized Leak Rate at {0} Deg Celcius reference temperature", refTemp));
                var normLeakRateDouble = TestHelper.CalculateNormLeakRate(slope, refTemp, aveLeakRate, aveTemp);
                Trace.WriteLine("Normalized Leak Rate = " + normLeakRateDouble.ToString());

                // store result
                var normLeakRate = Math.Round(normLeakRateDouble, 9);
                Trace.WriteLine("Normalized Leak Rate = " + normLeakRate.ToString());
                //myTestInfo.ResultsParams[1].Result = normLeakRate.ToString();
                myTestInfo.ResultsParams[1].Result = Math.Round(aveLeakRate, 9).ToString();

                // Step #2: Temperature measurement to get Factor (Delta DegC between board and cal leak can's temperature
                // Get Can's temp
                //var cansTemp = InstrumentIO.MeasureCalLeakTemp(mySw, slot);
                Trace.WriteLine("DUT Temperature (Thermocouple)  :  " + aveTemp.ToString());
                myTestInfo.ResultsParams[2].Result = Math.Round(aveTemp, 1).ToString();
                // Measure Board Temperature
                //InstrumentIO.SetupBoardTempMeasRoute(mySw, myScope, slot);   // setup route for BoardTemp supply and output 5V and TTL signal output

                myTestInfo.ResultsParams[3].Result = Math.Round(aveBoardTemp, 1).ToString();
                //InstrumentIO.DisconnectTempBoardMeasRoute(mySw, slot);
                Trace.WriteLine("DUT Temperature (PCB)           :  " + aveBoardTemp.ToString());
                // calc temp difference
                var deltaTemp = aveBoardTemp - aveTemp;
                Trace.WriteLine("Temperature Difference          :  " + deltaTemp.ToString());
                // store result
                myTestInfo.ResultsParams[4].Result = Math.Round(deltaTemp, 1).ToString();

                // Close Test Valve
                InstrumentIO.CloseTestValve(mySw, slot);

                // Set LeakRate and Factor properties to be used for averaging at the end of the test
                UUTLeakRate   = Math.Round(aveLeakRate, 9);//normLeakRateDouble;
                UUTTempFactor = deltaTemp;
                UUTTemp       = aveTemp;
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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
            }
        }
Ejemplo n.º 10
0
        public static TestInfo DoSeq5_2(VSLeakDetector myLD, ref TestInfo myTestInfo, ref UUTData myuutdata, ref CommonData myCommonData)
        {
            string Display;
            string reading;
            string retval;
            int    step = 1;

            Helper.comPort = comPort;

            //VSLeakDetector myLD = new VSLeakDetector(comPort);

            try
            {
                switch (myTestInfo.TestLabel)
                {
                case "5.2.4 Communication_Setup":
                {
                    step = 1;

                    //@@ Connect the power cord to the main AC supply. @@//

                    Trace.WriteLine("Power ON the UUT...");

                    InstrumentIO.DAS_Power_ON(myuutdata.Options);

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

                    Trace.WriteLine("Test point complete.");

                    step++;


                    //@@ Serial port communication test @@//

                    Trace.WriteLine("Verify the serial port communication between the UUT and the PC...");

                    //myLD.Open();
                    int timeout = 1;
                    myLD.Timeout    = 1000;
                    myLD.Terminator = "\r\n";

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

                        if (retval.Contains("ok"))
                        {
                            myTestInfo.ResultsParams[step].Result = "ok";
                            Trace.WriteLine("Test point complete.");

                            break;
                        }

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

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

                    //myLD.Close();
                    break;
                }

                case "5.2.4 PreheatSetup":
                {
                    string conStr1 = "Data Source=wpsqldb21;Initial Catalog=VpdOF;Persist Security Info=True;User ID=VpdTest;Password=Vpd@123";
                    SQL_34970A.Update_DMM_Status(myuutdata.Options, "No", conStr1);
                    string SN            = myuutdata.SerNum;
                    string Model         = myuutdata.Model;
                    MyForm myPreheatForm = new MyForm(myLD);
                    //myPreheatForm.comPort = comPort;
                    myPreheatForm.ShowDialog();

                    string disValue = myPreheatForm.Pvvalue;
                    if (disValue == "Abort")
                    {
                        MessageBox.Show("Aborted by user", "ABORTED", MessageBoxButtons.OK);
                        myCommonData.Mode = "Abort";
                    }

                    disValue = disValue.Trim(new Char[] { ' ', '?', 'P', 'V' });
                    disValue = disValue.TrimEnd(new Char[] { ' ', 'o', 'k', '\r', '\n' });
                    myTestInfo.ResultsParams[1].Result = disValue;
                    myTestInfo.ResultsParams[2].Result = Convert.ToString(myPreheatForm.checkvolt);
                    string conStr = "Data Source=wpsqldb21;Initial Catalog=VpdOF;Persist Security Info=True;User ID=VpdTest;Password=Vpd@123";
                    using (SqlConnection my_sql = new SqlConnection(conStr))
                    {
                        my_sql.Open();

                        SqlCommand command = new SqlCommand("insert into PV(LOT,MODEL,PREHEAT,RESULT,DAC,FIRMWARE,ION_SOURCE)" +
                                                            "VALUES('" + SN + "','" + Model + "','" + myPreheatForm.checkvolt + "','PASS','" + disValue + "','1.04'" + ",'" + myPreheatForm.ISsn + "')", my_sql);
                        command.ExecuteNonQuery();
                        my_sql.Close();
                    }

                    break;
                }

                case "5.2.5 Measure_DCVoltage":
                {
                    step = 1;

                    //Lock DMM

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

                    //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);
                    //}


                    //@@ Measure the voltage between the black and red wire of the chasis fan connector. The acceptable range is 22.8V ~ 25.2V @@//

                    Trace.WriteLine("Measuring the voltage of the chasis fan connector...");
                    FormDcPowerSupply dcvForm = new FormDcPowerSupply();
                    dcvForm.StartPosition = FormStartPosition.Manual;
                    dcvForm.Location      = new System.Drawing.Point(locX, locY);
                    dcvForm.ShowDialog();
                    double dcvReading = 0;
                    if (dcvForm.DialogResult == DialogResult.OK)
                    {
                        dcvReading = dcvForm.DcVolt;
                    }
                    else
                    {
                        dcvReading = dcvForm.DcVolt;
                        //throw new Exception("24V measurement canceled by user!");
                    }

                    myTestInfo.ResultsParams[1].Result = dcvReading.ToString();
                    //reading = InstrumentIO.Measure_DCV("");

                    //if (Convert.ToDouble(reading) >= 22.8 && Convert.ToDouble(reading) <= 25.2)
                    //{
                    //    Trace.WriteLine("Test point complete.");
                    //    myTestInfo.ResultsParams[step].Result = reading;
                    //}

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

                    //Unlock DMM

                    //Trace.WriteLine("Unlocking the DMM...");
                    //SQL_34970A.Update_DMM_Status(myuutdata.Options, "No", conStr);

                    break;
                }

                case "5.2.6 Check_Fan":
                {
                    step = 1;

                    //@@ To verify the condition of both fans @@//

                    Trace.WriteLine("Verify the condition of both fans...");

                    Display = "Seq 5.2.6:\nPlease verify the condition of BOTH fans. Are they running as expected? \n\nEnter 'ok' if pass. Else 'no'";
                    reading = Helper.LabelDisplay(Display);

                    if (reading == "ok")
                    {
                        Trace.WriteLine("Test point complete.");
                        myTestInfo.ResultsParams[step].Result = reading;
                    }

                    else if (reading == "no")
                    {
                        myTestInfo.ResultsParams[step].Result = reading;
                        //throw new Exception("One or both fans are not functioning properly.");
                    }

                    break;
                }
                }
            }

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

            return(myTestInfo);
        }
Ejemplo n.º 11
0
        public static TestInfo DoSeq5_9(VSLeakDetector myLD, ref TestInfo myTestInfo, ref UUTData myuutdata)
        {
            Boolean status = false;
            string  retval = "";
            int     step   = 1;

            //VSLeakDetector myLD = new VSLeakDetector(comPort);
            //myLD.iteSlot = iteSlot;
            Helper.comPort = comPort;

            try
            {
                switch (myTestInfo.TestLabel)
                {
                case "5.9.1 Calibration":
                {
                    step = 1;

                    //Access to full command

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


                    //Obtain stdleak reading

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

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

                    /*@@ 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(iteSlot + "Rough process will be triggered if UUT is not in FINE TEST mode.");

                    //myLD.Open();
                    myLD.Write("?VALVESTATE");
                    retval = myLD.Read();
                    //myLD.Close();

                    if (!retval.Contains("MIDSTAGE"))
                    {
                        Trace.WriteLine(iteSlot + "Roughing the UUT...");
                        Helper.SendCommand(myLD, ref status, "ROUGH", "ok");
                    }

                    status = Helper.Wait_FineTest(myLD);
                    //Wait for stabilization
                    Trace.WriteLine(iteSlot + "Wait for stabilization...");
                    Thread.Sleep(60000);


                    if (status == true)
                    {
                        Trace.WriteLine(iteSlot + "Initiates a FULL or FAST calibration based on system configurations...");
                        status = Helper.DoThis(myLD, ref myTestInfo, "CALIBRATE", "ok", step, "ok");
                    }

                    step++;
                    Thread.Sleep(3000);


                    //@@ Wait for 979 Calibration VI @@//

                    status = Helper.Wait_FineTest(myLD);

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

                    break;
                }

                case "5.9.2 Verify_Calibration":
                {
                    step = 1;

                    //@@ Report and verify the status of the last calibration. @@//

                    Trace.WriteLine(iteSlot + "Report and verify the status of the last calibration...");
                    status = Helper.DoThis(myLD, ref myTestInfo, "?CALOK", "Yesok", step, "ok");

                    break;
                }

                case "5.9.3 Verify_LeakReading":
                {
                    step = 1;

                    while (step <= myTestInfo.ResultsParams.NumResultParams)
                    {
                        //@@ Turn ON internal calibrated leak @@//
                        Thread.Sleep(2000);
                        Trace.WriteLine(iteSlot + "Open the stdleak...");

                        Helper.SendCommand(myLD, ref status, "STDLEAK", "ok");
                        if (status == false)
                        {
                            break;
                        }
                        //Helper.DoThis(myLD, ref myTestInfo, "STDLEAK", "ok", step, "ok");
                        //Thread.Sleep(13000);
stdleakcheck:
                        status = Helper.DoThis(myLD, ref myTestInfo, "?VALVESTATE", "STDLEAK", step, "ok");
                        if (status == false)
                        {
                            //ys wong
                            Thread.Sleep(1000);
                            goto stdleakcheck;
                        }
                        step++;


                        Trace.WriteLine(iteSlot + "Provide time for the UUT to read the Stdleak...");
                        // Hairus added to dynamically wait until the stdleak reading is stabilized.
                        //myLD = new VSLeakDetector(comPort);
                        // myLD.iteSlot = iteSlot;
                        // myLD.Open();
                        //bool isStdLeakState = myLD.WaitForStdLeakState(ref retval);
                        // Thread.Sleep(5000);
                        //bool isLeakStabilized = myLD.WaitForStabilizedReading(ref retval, 120, 0.97, 10);
                        Thread.Sleep(6000);
                        //myLD.Close();

                        //@@ Obtain the leakrate reading @@//
readleakagain:
                        Trace.WriteLine(iteSlot + "Obtain the leakrate...");
                        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 leak rate = " + 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_stdleakt = 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_stdleakt = Convert.ToDouble(response2[1]);
                        }

                        // set max and minimum limit reading for the leak rate verification compared to stdleakt
                        // The displayed leak rate value shall be no more than +-0.2 from the ?STDLEAKt (temperature compensated cal leak) value.
                        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
                        int cycle = 1;
recheckintcal:
                        if (!((minLeakDiff <= Leakrate) & (Leakrate <= maxLeakDiff)))
                        {
                            status = false;

                            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 leak rate = " + Leakrate + "Std .cc/s");
                                if (cycle >= 4)
                                {
                                    myTestInfo.ResultsParams[step].Result = "FAILED";
                                    break;
                                }
                                goto recheckintcal;
                            }

                            else
                            {
                                myTestInfo.ResultsParams[step].Result = "FAILED";
                                //throw new Exception("Test point failed.");
                            }
                        }
                        myTestInfo.ResultsParams[step].Result = Leakrate.ToString();
                        //if (Leakrate >= (stdleak - 0.2 * Math.Pow(10, exp_stdleakt)) && Leakrate <= (stdleak + 0.2 * Math.Pow(10, exp_stdleakt)))
                        //{
                        //    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.9.4":
                {
                    step = 1;

                    //@@ Close the internal calibrate leak @@//

                    Trace.WriteLine(iteSlot + "Close the stdleak...");
                    status = Helper.DoThis(myLD, ref myTestInfo, "STDLEAK", "ok", step, "ok");

                    step++;

                    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

                    // wait until the LD fully closed STDLEAK before vent to atmospheric
                    //Thread.Sleep(5000);

                    ////////////@@ Vent the UUT @@//
                    Thread.Sleep(1000);
                    Trace.WriteLine(iteSlot + "Venting 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: ");
                    // commented out below manual limit checking, use test executive to do the limit checking and display the result correctly
                    if (!(Pressure >= 700000 && Pressure <= 760000))
                    {
                        Thread.Sleep(2000);
                        goto checkagain;
                    }

                    Thread.Sleep(1000);

                    break;
                }

                case "5.9.5 Init_Extleak":
                {
                    step = 1;
                    //while (step <= myTestInfo.ResultsParams.NumResultParams)// again why need to do while loop here..
                    //{
                    //@@ Initiate external calibrated leak @@//
                    Trace.WriteLine(iteSlot + "Roughing the UUT...");
                    status = Helper.DoThis(myLD, ref myTestInfo, "ROUGH", "ok", step, "ok");

                    Thread.Sleep(5000);
                    status = Helper.DoThis(myLD, ref myTestInfo, "KEEP", "ok", step, "ok");
                    Thread.Sleep(3000);
                    Trace.WriteLine(iteSlot + "Initiate external leak rate...");
                    if (myLD.iteSlot.Contains("P1"))
                    {
                        Helper.DoThis(myLD, ref myTestInfo, External_leak_Parameters.Ext_leakrate1 + " INIT-EXTLEAK", "ok", step, "ok");
                    }
                    else
                    {
                        Helper.DoThis(myLD, ref myTestInfo, External_leak_Parameters.Ext_leakrate2 + " INIT-EXTLEAK", "ok", step, "ok");
                    }
                    step++;

                    Trace.WriteLine(iteSlot + "Open the external calibrated leak...");
                    InstrumentIO.Open_Extleak(slotNum); //Open external calibrated leak valve
                    Thread.Sleep(2000);                 // give some time to valve to fully open before roughing.



                    //@@ Rough the UUT @@//

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


                    //@@ Wait for fine test @@//

                    int repeat = 1;
again:
                    Thread.Sleep(7000);
                    //status = Helper.Wait_FineTest(myLD, 120);
                    string check = Helper.SendCommand(myLD, ref status, "?VALVESTATE", "MIDSTAGE");


                    if (check.Contains("MIDSTAGE"))
                    {
                        myTestInfo.ResultsParams[step].Result = "ok";
                    }
                    else
                    {
                        //InstrumentIO.Close_Extleak(slotNum);
                        //Thread.Sleep(2000);
                        //InstrumentIO.Open_Extleak(slotNum);
                        if (repeat >= 4)
                        {
                            myTestInfo.ResultsParams[step].Result = "FAILED";
                            break;
                        }
                        repeat++;
                        goto again;
                    }


                    step++;


                    Trace.WriteLine(iteSlot + "Gives UUT time to read the leak rate...");
                    //myLD = new VSLeakDetector(comPort);
                    //myLD.iteSlot = iteSlot;
                    //myLD.Open();
                    // bool isLeakrateStabilized = myLD.WaitForStabilizedReading(ref retval, 120, 0.97, 10);
                    //myLD.Close();
                    //Thread.Sleep(20000);

                    //@@ Midstage leak rate? @@//
                    // recheck:
                    Trace.WriteLine(iteSlot + "Obtain midstage leak rate...");
                    Thread.Sleep(10000);
                    //retval = Helper.SendCommand(myLD, ref status, "?LEAK", "ok");

                    if (status == true)
                    {
                        int i = 1;
recheck:
                        Thread.Sleep(4000);
                        retval = Helper.SendCommand(myLD, ref status, "?LEAK", "ok");
                        string[] response = retval.Split(new string[] { "?LEAK ", "ok" }, StringSplitOptions.RemoveEmptyEntries);
                        Midstage_leak = Convert.ToDouble(response[0]);

                        Trace.WriteLine(iteSlot + "Measured leak rate = " + Midstage_leak + "Std .cc/s");

                        //myTestInfo.ResultsParams[step].Result = "ok"; // display midstage leak value instead of 'ok' text.
                        double extStdLeakRate = 0;
                        if (myLD.iteSlot.Contains("P1"))
                        {
                            extStdLeakRate = Convert.ToDouble(External_leak_Parameters.Ext_leakrate1);
                        }
                        else
                        {
                            extStdLeakRate = Convert.ToDouble(External_leak_Parameters.Ext_leakrate2);
                        }
                        double maxLeakRate = extStdLeakRate + 0.00000002;
                        double minLeakRate = extStdLeakRate - 0.00000002;
                        myTestInfo.ResultsParams[step].Result  = Midstage_leak.ToString();
                        myTestInfo.ResultsParams[step].SpecMax = maxLeakRate.ToString();
                        myTestInfo.ResultsParams[step].SpecMin = minLeakRate.ToString();
                        myTestInfo.ResultsParams[step].Nominal = extStdLeakRate.ToString();

                        if ((minLeakRate < Midstage_leak) && (Midstage_leak < maxLeakRate))
                        {
                            myTestInfo.ResultsParams[step].Result = Midstage_leak.ToString();
                        }
                        else
                        {
                            i++;
                            if (i < 120)
                            {
                                Helper.DoThis(myLD, ref myTestInfo, "ROUGH", "ok", step, "ok");
                                Thread.Sleep(4000);
                                goto recheck;
                            }
                        }
                    }
                    else
                    {
                        myTestInfo.ResultsParams[step].Result = "FAILED";
                        //throw new Exception("Test point failed.");
                    }
                    step++;
                }
                break;
                //}

                case "5.9.6 Fastvgain":
                {
                    step = 1;

                    /*@@ An integer that scales the leak rate to account for deviations in helium compression ratios between contraflow and midstage modes
                     * in fast turbo speed. @@*/

                    Trace.WriteLine(iteSlot + "Scales the leak rate to account for deviations in helium compression ratios between contraflow and midstage modes...");
                    status = Helper.DoThis(myLD, ref myTestInfo, "1 INIT-FAST-VGAIN", "ok", step, "ok");

                    break;
                }

                case "5.9.7 Sniff":
                {
                    step = 1;

                    //@@ Turns the HIGH PRESSURE TEST mode ON. @@//

                    Trace.WriteLine(iteSlot + "Turns the HIGH PRESSURE TEST mode ON....");
                    status = Helper.DoThis(myLD, ref myTestInfo, "SNIFF", "ok", step, "ok");

                    // 6 Nov 17: With London FW rev L01.01, the SNIFF command will not change LD from Fine-Test to Test mode.
                    // If we send ROUGH command it will change it to Test mode. This is some kind of bug in this LD01.01 revision.
                    // below code only for temporary.
                    string val = Helper.SendCommand(myLD, ref status, "ROUGH", "ok");
                    Thread.Sleep(2000);
                    // end temporary

                    break;
                }

                case "5.9.8 Measure_Contra":
                {
                    step = 1;

                    //@@ Wait for Contraflow mode @@//
                    Thread.Sleep(20000);
                    status = Helper.Wait_Test(myLD);

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

                    // experiment, for VGain enhancement. #1
                    var listOfVGainLimits = new List <string>();
                    listOfVGainLimits.Add(myTestInfo.TestParams[1].Value);                       // portable LD 110
                    listOfVGainLimits.Add(myTestInfo.TestParams[2].Value);                       // portable LD 220
                    listOfVGainLimits.Add(myTestInfo.TestParams[3].Value);                       // mobile/bench RVP LD 110
                    listOfVGainLimits.Add(myTestInfo.TestParams[4].Value);                       // mobile/bench RVP LD 220
                    listOfVGainLimits.Add(myTestInfo.TestParams[5].Value);                       // mobile/bench Scroll Pump LD 110
                    listOfVGainLimits.Add(myTestInfo.TestParams[6].Value);                       // mobile/bench Scroll Pump LD 220
                    string[] limitsArray   = listOfVGainLimits.ToArray();
                    string   csvVGainLimit = Helper.GetVgainLimit(myuutdata.Model, limitsArray); // Get VGain limits for specific LD model
                    double   vGainLsl      = Convert.ToDouble(csvVGainLimit.Split(',').FirstOrDefault());
                    double   vGainUsl      = Convert.ToDouble(csvVGainLimit.Split(',').LastOrDefault());
                    double   vGainNominal  = vGainLsl + ((vGainUsl - vGainLsl) / 2);
                    // expected contra-leak for vgain at nominal
                    double expContraSniffLeak = vGainNominal * Midstage_leak;
                    Trace.WriteLine(iteSlot + "Provide time for the UUT to read the leak rate...");
                    //myLD = new VSLeakDetector(comPort);
                    //myLD.iteSlot = iteSlot;
                    //myLD.Open();
                    //bool isReadingMet = myLD.WaitForSpecificReading(ref retval, 120, expContraSniffLeak, 1);   //ys wong
                    //myLD.Close();

                    //// EXPERIMENT #2 WAIT FOR STABILIZED LEAK RATE AT E-6
                    //Trace.WriteLine(iteSlot + "Provide time for the UUT to read the leak rate...");
                    //myLD = new VSLeakDetector(comPort);
                    //myLD.iteSlot = iteSlot;
                    //myLD.Open();
                    //isReadingMet = myLD.WaitForStabilizedReading(ref retval, 120, 0.9, 5);
                    //myLD.Close();

                    // Original from ATP
                    //Trace.WriteLine(iteSlot + "Provide time for the UUT to read the leak rate...");
                    Thread.Sleep(20000);

                    //@@ Contraflow leak value @@//
again:
                    Trace.WriteLine(iteSlot + "Obtain contraflow leak rate...");
                    retval = Helper.SendCommand(myLD, ref status, "?LEAK", "ok");

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

                        Trace.WriteLine(iteSlot + "Measured leak rate = " + Contra_leak + "Std .cc/s");

                        if (Contra_leak == 0.00E-00)
                        {
                            goto again;
                        }
                        myTestInfo.ResultsParams[step].Result              =
                            myTestInfo.ResultsParams[step].SpecMax         =
                                myTestInfo.ResultsParams[step].SpecMin     =
                                    myTestInfo.ResultsParams[step].Nominal = Contra_leak.ToString();
                        //myTestInfo.ResultsParams[step].Result = "ok";
                    }
                    else
                    {
                        myTestInfo.ResultsParams[step].Result = "FAILED";
                        //throw new Exception("Test point failed.");
                    }
                    break;
                }

                case "5.9.11 Fastvgain":
                {
                    step = 1;

                    /*@@ An integer that scales the leak rate to account for deviations in helium compression ratios between contraflow and midstage modes
                     * in fast turbo speed. @@*/

                    Vgain = Math.Round(Contra_leak / Midstage_leak, 0, MidpointRounding.AwayFromZero);

                    Trace.WriteLine(iteSlot + "Scales the leak rate to account for deviations in helium compression ratios between contraflow and midstage modes...");
                    Trace.WriteLine(iteSlot + "Vgain = " + Vgain);

                    status = Helper.DoThis(myLD, ref myTestInfo, Vgain + " INIT-FAST-VGAIN", "ok", step, "ok");

                    Thread.Sleep(2000);
                    break;
                }

                case "5.9.12 Measure_Contra":
                {
                    step = 1;

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

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

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

                        //add in pressures //YS Wong
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: ");
                        // commented out below manual limit checking, use test executive to do the limit checking and display the result correctly
                        if (!(Pressure >= 700000 && Pressure <= 760000))
                        {
                            Thread.Sleep(2000);
                            goto checkagain;
                        }

                        Thread.Sleep(1000);


                        //@@ Rough the UUT @@//

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

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


                        //@@ Wait for Contraflow mode @@//

                        status = Helper.Wait_Test(myLD);

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

                        step++;


                        Trace.WriteLine(iteSlot + "Provide time for the UUT to read the leak rate...");
                        //myLD = new VSLeakDetector(comPort);
                        //myLD.iteSlot = iteSlot;
                        //myLD.Open();
                        //  bool isreadingStabilized = myLD.WaitForStabilizedReading(ref retval, 120, 0.97, 10);   YS Wong
                        //myLD.Close();

                        Thread.Sleep(25000);


                        //@@ Contraflow leak value @@//

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

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

                            Trace.WriteLine(iteSlot + "Measured leak rate = " + Contra_leak + "Std .cc/s");
                            myTestInfo.ResultsParams[step].Result              =
                                myTestInfo.ResultsParams[step].SpecMax         =
                                    myTestInfo.ResultsParams[step].SpecMin     =
                                        myTestInfo.ResultsParams[step].Nominal = Contra_leak.ToString();
                        }
                        else
                        {
                            myTestInfo.ResultsParams[step].Result = "FAILED";
                            //throw new Exception("Test point failed.");
                        }
                        step++;
                    }

                    break;
                }

                case "5.9.13 Measure_Midstage":
                {
                    step = 1;

                    while (step <= myTestInfo.ResultsParams.NumResultParams)
                    {
                        //@@ Turns the HIGH PRESSURE TEST function OFF @@//

                        Trace.WriteLine(iteSlot + "Turns the HIGH PRESSURE TEST function OFF...");

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


                        //@@ Wait for FINETEST MODE @@//

                        status = Helper.Wait_FineTest(myLD);

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

                        step++;


                        Trace.WriteLine(iteSlot + "Gives UUT time to read the leak rate...");
                        //myLD = new VSLeakDetector(comPort);
                        //myLD.iteSlot = iteSlot;
                        //myLD.Open();
                        // ys wong              //bool isreadingStabilized = myLD.WaitForStabilizedReading(ref retval, 120, 0.97, 10);
                        //myLD.Close();

                        Thread.Sleep(20000);

//midstage check not exist??
                        //@@ Midstage leak? @@//

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

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

                            Trace.WriteLine(iteSlot + "Measured leak rate = " + Midstage_leak + "Std .cc/s");
                            myTestInfo.ResultsParams[step].Result              =
                                myTestInfo.ResultsParams[step].SpecMax         =
                                    myTestInfo.ResultsParams[step].SpecMin     =
                                        myTestInfo.ResultsParams[step].Nominal = Midstage_leak.ToString();
                        }
                        else
                        {
                            myTestInfo.ResultsParams[step].Result = "FAILED";
                            //throw new Exception("Test point failed.");
                        }
                        step++;
                    }

                    break;
                }

                case "5.9.14 Verify_Contra_Midstage":
                {
                    step = 1;

                    //@@ Compare the contraflow leak rate and the midstage leak rate @@//

                    Trace.WriteLine(iteSlot + "Compare the contraflow leak rate and the midstage leak rate...");
                    if (Midstage_leak < 1E-07)
                    {
                        double diff = Math.Abs(Midstage_leak - Contra_leak);

                        myTestInfo.ResultsParams[step].Result = diff.ToString();
                        // good result, difference must be <=0.2E-08
                        myTestInfo.ResultsParams[step].SpecMax = "0.000000002";
                        myTestInfo.ResultsParams[step].SpecMin = "0";
                        myTestInfo.ResultsParams[step].Nominal = "0";
                    }
                    else if (Midstage_leak >= 1E-07)
                    {
                        double diff = Math.Abs(Midstage_leak - Contra_leak);

                        myTestInfo.ResultsParams[step].Result = diff.ToString();
                        // good result, difference must be <=0.2E-07
                        myTestInfo.ResultsParams[step].SpecMax = "0.00000002";
                        myTestInfo.ResultsParams[step].SpecMin = "0";
                        myTestInfo.ResultsParams[step].Nominal = "0";
                    }

                    //if((Midstage_leak < 1E-07 && Math.Abs(Midstage_leak - Contra_leak) <= 0.2E-8) || (Midstage_leak >= 1E-07 && Math.Abs(Midstage_leak - Contra_leak) <= 0.2E-7))
                    //{
                    //    Trace.WriteLine(iteSlot + "Test point complete.");
                    //    myTestInfo.ResultsParams[step].Result = "ok";
                    //}
                    else
                    {
                        // only magic will reach here
                        myTestInfo.ResultsParams[step].Result = "FAILED";
                        //throw new Exception("Test point failed.");
                    }

                    break;
                }

                case "5.9.15 Verify_Vgain":
                {
                    step = 1;
                    // Hairus added to get VGain from PluginSequence test params instead of hardcoded
                    var listOfVGainLimits = new List <string>();
                    listOfVGainLimits.Add(myTestInfo.TestParams[1].Value);          // portable LD 110
                    listOfVGainLimits.Add(myTestInfo.TestParams[2].Value);          // portable LD 220
                    listOfVGainLimits.Add(myTestInfo.TestParams[3].Value);          // mobile/bench RVP LD 110
                    listOfVGainLimits.Add(myTestInfo.TestParams[4].Value);          // mobile/bench RVP LD 220
                    listOfVGainLimits.Add(myTestInfo.TestParams[5].Value);          // mobile/bench Scroll Pump LD 110
                    listOfVGainLimits.Add(myTestInfo.TestParams[6].Value);          // mobile/bench Scroll Pump LD 220
                    string[] limitsArray = listOfVGainLimits.ToArray();
                    //@@ Based on model number, verify the vgain value @@//

                    Trace.WriteLine(iteSlot + "Verify the vgain value based on the model number of the UUT...");
                    //status = Helper.GetModel_Vgain(myuutdata.Model, Vgain);   // remove hardcoded value
                    string csvVGainLimit = Helper.GetVgainLimit(myuutdata.Model, limitsArray);
                    double vGainLsl      = Convert.ToDouble(csvVGainLimit.Split(',').FirstOrDefault());
                    double vGainUsl      = Convert.ToDouble(csvVGainLimit.Split(',').LastOrDefault());
                    double vGainNominal  = vGainLsl + ((vGainUsl - vGainLsl) / 2);
                    // set result spec limits dynamically
                    myTestInfo.ResultsParams[step].SpecMin = vGainLsl.ToString();
                    myTestInfo.ResultsParams[step].Nominal = vGainNominal.ToString();
                    myTestInfo.ResultsParams[step].SpecMax = vGainUsl.ToString();

                    // retreive the calculated vgain and set as result
                    myTestInfo.ResultsParams[step].Result = Vgain.ToString();

                    //if (status == true)
                    //{
                    //    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.9.16 Vent":
                {
                    step = 1;

                    //@@ Vent the UUT @@//

                    Trace.WriteLine(iteSlot + "Venting 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: ");
                    // commented out below manual limit checking, use test executive to do the limit checking and display the result correctly
                    if (!(Pressure >= 700000 && Pressure <= 760000))
                    {
                        Thread.Sleep(2000);
                        goto checkagain;
                    }

                    Thread.Sleep(800);
                    break;
                }

                case "5.9.17 Remove_Extleak":
                {
                    step = 1;

                    //@@ Close the external calibrated leak on the test port @@//

                    Trace.WriteLine(iteSlot + "Closing the external calibrated leak on the test port...");
                    InstrumentIO.Close_Extleak(slotNum);

                    Trace.WriteLine(iteSlot + "Test point complete.");
                    myTestInfo.ResultsParams[step].Result = "ok";

                    break;
                }
                }
            }

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

            return(myTestInfo);
        }