Beispiel #1
0
        private void Bg2_DoWork(object sender, DoWorkEventArgs e)
        {
            // myDmm = new MeasureVoltage();

            double volts;

            volts = Math.Abs(myDmm.Measure());

            // this is a aprroximated voltage that will in theory is to low to be measured on the cap when charge is applied . hopefully this will check if leads are connected or the saftey cover is closed
            //this value was determined experimentally
            if (volts > 5)
            {
                if (Measure1(myDmm) == true)
                {
                    Application.Current.Dispatcher.Invoke(() => Test240.Text = "240V Test Passed");

                    if (TurnOffPower(power))
                    {
                        if (PowerWeco(power, 480))
                        {
                            power480 = true;

                            if (Measure2(myDmm) == true)
                            {
                                pass = true;
                            }
                            else
                            {
                                fail = true;
                            }
                        }
                        else
                        {
                            power480 = false;
                        }
                    }

                    else
                    {
                        powerOn = true;
                    }
                }

                else
                {
                    fail240 = true;
                }
            }

            else
            {
                coverOpen = true;
            }

            if (TurnOffPower(power))
            {
                powerOn = false;
            }
        }
Beispiel #2
0
        void Launch()
        {
            pass = false;
            fail = false;


            myDmm = new MeasureVoltage();

            dcVoltage1 = Math.Abs(myDmm.Measure());

            if (dcVoltage1 == 0.00000000)
            {
                meterConnected    = false;
                SerialNumber.Text = "";

                MessageBox.Show("Connect Meter USB");
            }

            else
            {
                meterConnected = true;
                BackgroundWorker bg = new BackgroundWorker();
                bg.DoWork             += Bg_DoWork;
                bg.RunWorkerCompleted += Bg_RunWorkerCompleted;
                bg.RunWorkerAsync();
            }
        }
Beispiel #3
0
        bool Measure2(MeasureVoltage dmm)
        {
            dcVoltage2 = 0.0;
            double reading;
            int    i;

            for (i = 1; i <= 5; i++)
            {
                reading = Math.Abs(dmm.Measure());

                dcVoltage2 = (dcVoltage2 + reading);
                Application.Current.Dispatcher.Invoke(() => Voltages2.Add(Convert.ToString(reading + " Volts")));
                if (reading == 0.00)
                {
                    Application.Current.Dispatcher.Invoke(() => MessageBox.Show("Connect Meter USB"));
                    TurnOffPower(power);
                    meterConnected = false;
                    return(false);
                }
                if (reading < 340 || reading > 375)
                {
                    dcVoltage2 = reading;
                    return(false);
                }
            }
            dcVoltage2 = dcVoltage2 / (i - 1);
            return(true);
        }