Esempio n. 1
0
        public double RunTest(string CH, ToolStripProgressBar bar, Label testvallabel, Label testresultlabel, ToolStripStatusLabel progresslabel)
        {
            Thread.Sleep(DmmX8_Plus.Properties.Settings.Default.WaitInMS);


            double measuredvalue = 0.00;

            if ((devReady == false) || (CH.Equals("OFF")))
            {
                progresslabel.Text = "Closed";
                //MessageBox.Show("DMM or Switch is not ready!!! Please check the device in the Keysight IO Library.", "Instrument Not Available");
                return(0.00);
            }



            SelectCH_SWA(CH);

            int loops = DmmX8_Plus.Properties.Settings.Default.NumOfSamples;

            int progressbar_start = 40;

            //Thread myThread = new Thread(RunProgressBar);
            //myThread.IsBackground = true;

            //myThread.Start(loops);

            for (int i = 0; i < loops; i++)
            {
                measuredvalue = DMM.MeasureChannelCurrent().average;

                measuredvalue  = Math.Abs(measuredvalue);
                measuredvalue *= 1000;
                measuredvalue  = Math.Round(measuredvalue, 5);

                progressbar_start += DmmX8_Plus.Properties.Settings.Default.progress_step;

                RuntoolStripProgressBar(bar, progressbar_start, 100, 1);

                testvallabel.Text = measuredvalue.ToString();

                if ((measuredvalue < DmmX8_Plus.Properties.Settings.Default.UpperLimitInMA) && (measuredvalue > DmmX8_Plus.Properties.Settings.Default.LowerLimitInMA))
                {
                    testresultlabel.Text      = "Pass";
                    testresultlabel.ForeColor = Color.LawnGreen;
                    break;
                }
                else
                {
                    testresultlabel.Text      = "Fail";
                    testresultlabel.ForeColor = Color.Red;
                }

                Thread.Sleep(DmmX8_Plus.Properties.Settings.Default.IntervalOfSamplingInMS);
            }



            return(measuredvalue);
        }
Esempio n. 2
0
        private static double PerformCurrentTest(MultiMeter dmm, Agilent sw, int channel)
        {
            double value = -1.0;

            MultiMeter.current current_meas;

            sw.SetRelayWellA_byCH(channel, true);


            current_meas = dmm.MeasureChannelCurrent(500, 500);

            value = current_meas.average;

            Console.WriteLine(string.Format("Obtain the average result of PerformCurrentTest: {0} mA on CH{1}", Math.Round(value * 1000, 4), channel));

            return(value);
        }
Esempio n. 3
0
        public static Current MeasureChannelCurrent(int ch_no)
        {
            init();

            if (!swConnected)
            {
                ConnectSwitch();
            }

            //Switch on dedicated DUT Power (switch off others)
            SwitchDutPower(ch_no, PowerSupplyState.PowerOn);

            if (!dmmConnected)
            {
                ConnectDMM();
            }

            if (AlldevReady)
            {
                try
                {
                    MultiMeter.current MEASCurrent = dmm.MeasureChannelCurrent(DelayBeforeMeasure, DelayAfterMeasure);

                    //Convert reading value to mA value
                    switch (DUTCurrent.unit)
                    {
                    case CurrentUnit.A:
                        DUTCurrent.average = (double)Math.Round((MEASCurrent.average) * MeasUnitMultipler, 2);
                        DUTCurrent.max     = (double)Math.Round((MEASCurrent.max) * MeasUnitMultipler, 2);
                        DUTCurrent.min     = (double)Math.Round((MEASCurrent.min) * MeasUnitMultipler, 2);
                        break;

                    case CurrentUnit.mA:
                        DUTCurrent.average = (double)Math.Round((MEASCurrent.average), 2);
                        DUTCurrent.max     = (double)Math.Round((MEASCurrent.max), 2);
                        DUTCurrent.min     = (double)Math.Round((MEASCurrent.min), 2);
                        break;

                    case CurrentUnit.uA:
                        DUTCurrent.average = (double)Math.Round((MEASCurrent.average) / MeasUnitMultipler, 2);
                        DUTCurrent.max     = (double)Math.Round((MEASCurrent.max) / MeasUnitMultipler, 2);
                        DUTCurrent.min     = (double)Math.Round((MEASCurrent.min) / MeasUnitMultipler, 2);
                        break;

                    case CurrentUnit.nA:
                        DUTCurrent.average = (double)Math.Round((MEASCurrent.average) / MeasUnitMultipler / MeasUnitMultipler, 2);
                        DUTCurrent.max     = (double)Math.Round((MEASCurrent.max) / MeasUnitMultipler / MeasUnitMultipler, 2);
                        DUTCurrent.min     = (double)Math.Round((MEASCurrent.min) / MeasUnitMultipler / MeasUnitMultipler, 2);
                        break;

                    default:
                        break;
                    }
                }
                catch (Exception)
                {
                }
                finally
                {
                    //Switch On all DUTs
                    sw.SetRelayWellA_ALLCLOSE();
                }
            }

            return(DUTCurrent);
        }