Esempio n. 1
0
        /// <summary>
        /// Makes a measurement using the external multimeter of the power supply.
        /// </summary>
        /// <param name="MeasurementType">Type of measurement to configure power supply for.</param>
        /// <param name="MeasurementRange"></param>
        /// <param name="MeasurementResolution"></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 Measurement(CONFigureSubsystem_e MeasurementType, MEASurementRange_e MeasurementRange, MEASurementResolution_e MeasurementResolution, out string DataOut, out string ErrorResponse)
        {
            Add(MeasurementType, MeasurementRange, MeasurementResolution);
            Add(RootCommands_e.Read);

            return SendCommand(out DataOut, out ErrorResponse);
        }
Esempio n. 2
0
        /// <summary>
        /// Sets the power supply voltage and current parameters, then enables the output.
        /// </summary>
        /// <param name="Voltage">The voltage to set the output at.</param>
        /// <param name="CurrentLimit">The maximum current allowed before causing an overload condition.</param>
        /// <param name="VoltageRange">Set the range according to the output voltage, 0-8VDC or up to 30VDC.</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>
        /// <param name="range">Measurement range</param>
        /// <param name="resolution">Measurement resolution</param>
        /// <returns></returns>
        public bool ApplyPower(double Voltage, double CurrentLimit, SOURceSubsystem_e VoltageRange, out string DataOut, out string ErrorResponse, MEASurementRange_e range = MEASurementRange_e.DC100mA, MEASurementResolution_e resolution = MEASurementResolution_e.DC1mA)
        {
            ErrorResponse = DataOut = null;

            Add(CONFigureSubsystem_e.CurrentDC, range, resolution);

            Add(VoltageRange);

            Add(SOURceSubsystem_e.VoltageImmediateAmplitude, Voltage);
            Add(SOURceSubsystem_e.CurrentLimit, CurrentLimit);
            Add(OUTPutSubsystem_e.EnableOutput);

            return SendCommand(out DataOut, out ErrorResponse);
        }
Esempio n. 3
0
        /// <summary>
        /// Uses the calc function in the meter to take an average reading of current draw over a set period of time.
        /// </summary>
        /// <param name="Timeoutms">Duration in millisecond to wait before disabling the calc function.</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>
        /// <param name="Range">Measurement range setting.</param>
        /// <param name="Resolution">Measurement resolution setting.</param>
        /// <returns></returns>
        public bool Average(int Timeoutms, out string DataOut, out string ErrorResponse, MEASurementRange_e Range = MEASurementRange_e.DC3A_MAX, MEASurementResolution_e Resolution = MEASurementResolution_e.DC10uA)
        {
            DataOut = ErrorResponse = null;

            if (Range != MEASurementRange_e.DC3A_MAX || Resolution != MEASurementResolution_e.DC10uA)
            {
                //Specify range on meter.
                Add(CONFigureSubsystem_e.CurrentDC, Range, Resolution);
            }
            else
            {
                //Default to max range on meter.
                Add(CONFigureSubsystem_e.CurrentDC, MEASurementRange_e.DC3A_MAX, MEASurementResolution_e.DC1mA);
            }

            Add(AgilentU3606A.INITiateSubsystem_e.CONTinuousON);

            Add(CALCulateSubsystem_e.CalcFunction, CALCulateSubstem_Fuctions_e.Average);
            Add(CALCulateSubsystem_e.CalcState, 1);

            //Check that calc function enables properly.
            if (SendCommand(out DataOut, out ErrorResponse) == false)
            {
                return false;
            }

            //At this point wait for timer to expire.
            SetTimerInterval(Timeoutms);

            myWaitHandle.WaitOne();

            Add(CALCulateSubsystem_e.CalcState, 0);
            if (SendCommand(out DataOut, out ErrorResponse) == false)
            { return false; }

            //Get the minimum, maximum, and average current measurements.  Store in structure.
            Add(CALCulateSubsystem_e.CalcAverageMin);
            if (SendCommand(out Current.MinimumValue, out ErrorResponse) == false)
            { return false; }

            Add(CALCulateSubsystem_e.CalcAverageMax);
            if (SendCommand(out Current.MaximumValue, out ErrorResponse) == false)
            { return false; }

            Add(CALCulateSubsystem_e.CalcAverage);
            if (SendCommand(out Current.AverageValue, out ErrorResponse) == false)
            { return false; }

            DataOut = currentData.AverageValue;
            return true;
        }
Esempio n. 4
0
        /// <summary>
        /// Makes a measurement using the external multimeter of the power supply.
        /// </summary>
        /// <param name="MeasurementType">Type of measurement to configure power supply for.</param>
        /// <param name="MeasurementRange"></param>
        /// <param name="MeasurementResolution"></param>
        /// <param name="SampleSize"></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 Measurement(CONFigureSubsystem_e MeasurementType, MEASurementRange_e MeasurementRange, MEASurementResolution_e MeasurementResolution, int SampleSize, out string DataOut, out string ErrorResponse)
        {
            double current = 0;
            DataOut = ErrorResponse = null;

            Add(MeasurementType, MeasurementRange, MeasurementResolution);

            for (int i = 0; i < SampleSize; i++)
            {
                Add(RootCommands_e.Read);

                if (SendCommand(out DataOut, out ErrorResponse) != true)
                {
                    return false;
                }
                current = current + Convert.ToDouble(DataOut);
            }
            current = current / SampleSize;
            DataOut = current.ToString();

            return true;
        }