示例#1
0
        /// <summary>
        /// Wait for the DUT measured voltage to drop at or below threshold specified.
        /// </summary>
        /// <param name="MeasurementType">Type of measurement to configure power supply for (Expect DC Voltage)</param>
        /// <param name="Value">Measured voltage value required to be considered done.</param>
        /// <param name="TimeOut">Timeout specified in milliseconds.</param>
        /// <param name="DataOut">If requesting a measurement, measured value will be stored here.</param>
        /// <param name="ErrorResponse">Error reponse of instrument. (+0,"No error") is a normal response with no error</param>
        /// <returns></returns>
        public bool MeasurementDischarge(CONFigureSubsystem_e MeasurementType, double Value, int TimeOut, out string DataOut, out string ErrorResponse)
        {
            DataOut = ErrorResponse = null;
            double measurement =0;
            MyProgressBar ProgressBar = new MyProgressBar();

            Add(MeasurementType, MEASurementRange_e.DC100V, MEASurementResolution_e.DC100mV);
            SendCommand(out DataOut, out ErrorResponse);

            SetTimerInterval(TimeOut);

            ProgressBar.SetProgressMax(522);
            ProgressBar.SetLabelText("UUT Discharge Progress");
            ProgressBar.UpdateProgress(519);
            ProgressBar.Show();

            ProgressBar.Update();
            while (bTimeoutFlag != true)
            {

                Add(RootCommands_e.Read);
                SendCommand(out DataOut, out ErrorResponse);
                measurement = Convert.ToDouble(DataOut);

                ProgressBar.UpdateProgress(Convert.ToInt16(measurement * 100));
                ProgressBar.SetLabelText("UUT Discharge Progress, Voltage: " + String.Format("{0:0.00} VDC", measurement));

                if (measurement < Value) break;
                myWaitHandle.WaitOne(30);

            }
            ProgressBar.Close();

            tmr1.Stop();
            if (bTimeoutFlag == true)
            {
                //Timed out
                return false;
            }
            else
            {
                //Success
                return true;
            }
        }
示例#2
0
        /// <summary>
        /// Waits for the DUT measured voltage to reach the threshold specified. Uses a progress bar for visual display.
        /// </summary>
        /// <param name="MeasurementType">Type of measurement to configure power supply for (Expect DC Voltage)</param>
        /// <param name="Value">Measured voltage value required to be considered done.</param>
        /// <param name="TimeOut">Timeout specified in milliseconds.</param>
        /// <param name="DataOut">If requesting a measurement, measured value will be stored here.</param>
        /// <param name="ErrorResponse">Error reponse of instrument. (+0,"No error") is a normal response with no error</param>
        /// <returns></returns>
        public bool MeasurementCharge(CONFigureSubsystem_e MeasurementType, double Value, int TimeOut, out string DataOut, out string ErrorResponse)
        {
            DataOut = ErrorResponse = null;
            double PreviousMeasurement = 0;
            MyProgressBar ProgressBar = new MyProgressBar();
            bool ProgressFlag = false;

            Add(MeasurementType, MEASurementRange_e.DC10V, MEASurementResolution_e.DC100mV);
            SendCommand(out DataOut, out ErrorResponse);

            SetTimerInterval(TimeOut);

            ProgressBar.SetProgressMax(522);
            ProgressBar.SetLabelText("UUT Charging Progress");
            ProgressBar.Show();
            double measurement = 0;

            ProgressBar.Update();
            while (bTimeoutFlag != true)
            {

                Add(RootCommands_e.Read);
                SendCommand(out DataOut, out ErrorResponse);
                measurement = Convert.ToDouble(DataOut);

                ProgressBar.UpdateProgress(Convert.ToInt16(measurement * 100));
                ProgressBar.SetLabelText("UUT Charging Progress, Voltage: " + String.Format("{0:0.00} VDC",measurement));

                if (measurement > Value) break;
                if (measurement > 4.5) ProgressFlag = true;

                if (ProgressFlag == false)
                {
                    if (measurement <= (PreviousMeasurement - 0.1))
                    {
                        ProgressBar.Close();
                        ErrorResponse = "PFM Circuit not charging, Current Measurement: " + measurement.ToString() + " Previous measurement: " + PreviousMeasurement.ToString() ;
                        return false;
                    }
                }
                PreviousMeasurement = measurement;
                myWaitHandle.WaitOne(50);
            }
            tmr1.Stop();
            ProgressBar.Close();

            if (bTimeoutFlag == true)
            {
                //Timed out
                ErrorResponse = "Timed Out, PFM Voltage measures: " + measurement.ToString();
                return false;
            }
            else
            {
                //Success
                return true;
            }
        }