Example #1
0
        public current MeasureChannelCurrent()
        {
            lock (ioMultiMeterCntrl)
            {
                current ch_current = new current();

                ioMultiMeterCntrl.WriteString("CALC:STAT ON", true);        //turn on the calculation function
                ioMultiMeterCntrl.WriteString("CALC:FUNC AVER", true);      //calculation function is Average


                System.Threading.Thread.Sleep(Config.Delay.Measurement); //wait for 500ms

                ioMultiMeterCntrl.WriteString("CALC:AVER:AVER?", true);
                ch_current.average = (double)ioMultiMeterCntrl.ReadNumber(IEEEASCIIType.ASCIIType_Any, true);

                ioMultiMeterCntrl.WriteString("CALC:AVER:MAX?", true);
                ch_current.max = (double)ioMultiMeterCntrl.ReadNumber(IEEEASCIIType.ASCIIType_Any, true);

                ioMultiMeterCntrl.WriteString("CALC:AVER:MIN?", true);
                ch_current.min = (double)ioMultiMeterCntrl.ReadNumber(IEEEASCIIType.ASCIIType_Any, true);


                ioMultiMeterCntrl.WriteString("CALC:STAT OFF", true);            //turn off the calculation function


                //ioMultiMeterCntrl.WriteString("FETC?", true);
                //ch_current = (double)ioMultiMeterCntrl.ReadNumber(IEEEASCIIType.ASCIIType_Any, true);

                return(ch_current);
            }
        }
Example #2
0
        private static Measurement TakeMeasurement(FormattedIO488 src, FormattedIO488 gen, int measurement, AmplitudeCalibration AmpCal)
        {
            // HP 3325B drifts so Check to see if the user wants amplitude calibration
            if (AmpCal == AmplitudeCalibration.On)
            {
                gen.WriteString("AC;");
                System.Threading.Thread.Sleep(2000);
            }

            // Take a THD reading
            src.WriteString(@":INIT;", true);
            System.Threading.Thread.Sleep(6000);
            src.WriteString(@":SENSe:DISTortion:THD?;", true);
            System.Threading.Thread.Sleep(1000);
            double thd = src.ReadNumber();

            //src.WriteString(@": INIT;");
            src.WriteString(@":SENSe:DISTortion:HARMonic:MAGNitude? 2,2;", true);
            System.Threading.Thread.Sleep(1000);
            double harm2 = src.ReadNumber();

            src.WriteString(@":SENSe:DISTortion:HARMonic:MAGNitude? 3,3;", true);
            System.Threading.Thread.Sleep(1000);
            double harm3 = src.ReadNumber();

            src.WriteString(@":SENSe:DISTortion:HARMonic:MAGNitude? 4,4;", true);
            System.Threading.Thread.Sleep(1000);
            double harm4 = src.ReadNumber();

            return(new Measurement(measurement, thd, harm2, harm3, harm4, DateTime.Now));
        }
Example #3
0
 public double ReadDouble()
 {
     try
     {
         return((double)ioobj.ReadNumber());
     }
     catch (Exception e)
     {
         return(-9.999);
     }
 }
Example #4
0
        private static double SetAndTakeSingleMeasurement(FormattedIO488 THDMeter, FormattedIO488 SigGen, double setVoltage, VoltUnits Units)
        {
            string dcOffset;

            if (Units == VoltUnits.Volts)
            {
                dcOffset = string.Format("OF {0:F3} VO; AC; ", setVoltage);
            }
            else
            {
                dcOffset = string.Format("OF {0:F3} MV; AC; ", setVoltage);
            }

            SigGen.WriteString(dcOffset, true);
            System.Threading.Thread.Sleep(1000);
            THDMeter.WriteString(@":READ?");
            double voltage = THDMeter.ReadNumber();

            if (Units == VoltUnits.Millivolts)
            {
                voltage *= 1000;
            }

            return(voltage);
        }
Example #5
0
        private static void SetAndTakeSingleFrequencyMeasurement(FormattedIO488 THDMeter, FormattedIO488 SigGen, out string PassFailResult, out double voltage, VoltageFrequencyValue val)
        {
            switch (val.WaveType)
            {
            case Waves.Sine:
                SigGen.WriteString("FU1;", true);
                break;

            case Waves.Square:
                SigGen.WriteString("FU2;", true);
                break;

            case Waves.Triangle:
                SigGen.WriteString("FU3;", true);
                break;

            case Waves.PosRamp:
                SigGen.WriteString("FU4;", true);
                break;
            }

            var FreqStr = string.Format("FR {0:F9} ", val.SetFrequency);

            switch (val.FrequencyUnits)
            {
            case FreqUnits.Hz:
                FreqStr += "HZ;";
                break;

            case FreqUnits.KHz:
                FreqStr += "KH;";
                break;

            case FreqUnits.MHz:
                FreqStr += "MH;";
                break;
            }

            SigGen.WriteString(FreqStr, true);

            SigGen.WriteString("AM 1.0 VO;", true);

            var DCOffsetStr = string.Format("OF {0:F2} VO; AC;", val.SetPoint);

            SigGen.WriteString(DCOffsetStr, true);

            System.Threading.Thread.Sleep(2000);

            THDMeter.WriteString(@":READ?");
            voltage = THDMeter.ReadNumber();

            if ((voltage >= val.MinValue) & (voltage <= val.MaxValue))
            {
                PassFailResult = "Pass";
            }
            else
            {
                PassFailResult = "Fail";
            }
        }
 protected Int16 ReadStandardEventByte()
 {
     if (DriverIsReady)
     {
         try {
             _driver.WriteString("*ESR?");
             return((Int16)_driver.ReadNumber(IEEEASCIIType.ASCIIType_I2, true));
         }
         catch (Exception ex) {
             Close();
             throw ex;
         }
     }
     else
     {
         throw new System.InvalidOperationException("Cannot execute ReadStandardEventByte(). Driver not initialized or is closed.");
     }
 }
 public double MeasureChannelCurrent(int ch)
 {
     lock (ioVoltCntrl)
     {
         string chNum = ch.ToString();
         double ch_current;
         ioVoltCntrl.WriteString("SENS:CURR:NPLC " + NPLC_DEFAULT + " (@" + chNum + ")", true);  //VICD -  Set the current measurement aperture
         //VICD - Future Dev - Low - Add NPLC variable control to decrease test time
         ioVoltCntrl.WriteString("MEAS:CURR? (@" + chNum + ")", true);
         ch_current = (double)ioVoltCntrl.ReadNumber(IEEEASCIIType.ASCIIType_Any, true);
         return(ch_current);
     }
 }
Example #8
0
        public double DoQueryNumber(string strQuery)
        {
            // Send the query.
            m_IoObject.WriteString(strQuery, true);
            // Get the result number.
            double fResult;

            fResult = (double)m_IoObject.ReadNumber(
                IEEEASCIIType.ASCIIType_R8, true);
            // Check for inst errors.
            CheckInstrumentErrors(strQuery);
            // Return result number.
            return(fResult);
        }
        public current MeasureChannelCurrent(int DelayBeforeMeasureMs, int DelayAfterMeasureMs)
        {
            lock (ioMultiMeterCntrl)
            {
                try
                {
                    ConfigureU3606A(DeviceMeasureMode.CURRENT);
                }
                catch (Exception ex)
                {
                    throw;
                }

                current ch_current = new current();

                ioMultiMeterCntrl.WriteString("CALC:STAT ON", true);   //turn on the calculation function
                ioMultiMeterCntrl.WriteString("CALC:FUNC AVER", true); //calculation function is Average

                System.Threading.Thread.Sleep(DelayBeforeMeasureMs);   //wait for 500ms

                //Stop statistics
                ioMultiMeterCntrl.WriteString("CALC:STAT OFF", true);

                ioMultiMeterCntrl.WriteString("CALC:AVER:AVER?", true);
                ch_current.average = (double)ioMultiMeterCntrl.ReadNumber(IEEEASCIIType.ASCIIType_Any, true);

                ioMultiMeterCntrl.WriteString("CALC:AVER:MAX?", true);
                ch_current.max = (double)ioMultiMeterCntrl.ReadNumber(IEEEASCIIType.ASCIIType_Any, true);

                ioMultiMeterCntrl.WriteString("CALC:AVER:MIN?", true);
                ch_current.min = (double)ioMultiMeterCntrl.ReadNumber(IEEEASCIIType.ASCIIType_Any, true);

                //ioMultiMeterCntrl.WriteString("FETC?", true);
                //ch_current = (double)ioMultiMeterCntrl.ReadNumber(IEEEASCIIType.ASCIIType_Any, true);


                System.Threading.Thread.Sleep(DelayAfterMeasureMs);


                return(ch_current);
            }
        }