Skip to content

Implementation for Keysight DAQ970A with DAQM901A modules

Daniel Joseph Antrim requested to merge dantrim_add_daq970a_meter into devel

What

This MR adds support for the IMeter implementation for the Keysight DAQ970A benchtop DMM/DAQ, assuming it is loaded with the 20-channel general purpose multiplexer modules DAQM901A. Information about both the DAQ970A and DAQM901A modules are found in the programming guide.

Statistics Computation

In addition to the usual IMeter interface, there are additional methods that leverage some extra features related to measurement of averages/statistics. The Keysight DAQ970A can return the following statistics across the measurements that are stored in memory and for each channel: average, standard deviation, minimum, maximum, and peak-to-peak.

The default behavior of an instance of KeysightDAQ970A is to not compute any such statistic, but simply perform a single-shot measurement across the specified channels given to the measureX methods (measureDCV, measureDCI, measureRES, and measureCAP). Enabling (disabling) the statistics computation across channel measurements is done by setting the number of triggers to a value greater than 1 via the KeysightDAQ970A::setTrigCount(unsigned). This will configure the number of measurements to perform across each channel. By default, if the statistics computation is enabled, then all statistics are computed and stored, with the average being returned by the measureX method being called. The other statistics are obtained by subsequent calls to getStdDeviation(), getMinimum(), and/or getMaximum().

If you only care about a single statistic to be computed, one can call KeysightDAQ970A::setMeasurementStat(Statistic), with the Statistic enum defined as:

enum class Statistic {
   All,
   Average,
   StdDeviation,
   Minimum,
   Maximum
};

and specifying a single statistic to be computed over the channel measurements. Subsequent calls to measureX will then return the measurements associated with the set Statistic. If you never call KeysightDAQ970A::setMeasurementStat, the default behavior is to compute all statistics and store them.

Typical Recipe for Measurements Without Statistics Computation (Single-shot measurement)

The usual behavior of performing single-shot measurements is as follows,

std::shared_ptr<KeysightDAQ970A> meter = ...; // get instance

// single channel
unsigned channel{101};
double single_value = meter->measureDCV(channel);

// multiple channels at once
std::vector<unsigned> channels{101, 102, 103, 104};
std::vector<double> values = meter->measureDCV(channels);
assert(values.size() == channels.size()); // one value for each channel

In the above snippet, the assert statements are illustrative only -- users should not need to call that in their own code.

Typical Recipe for Measurement of All Statistics

The time it takes to perform the computation of all statistics versus just a single statistic is not seen to be noticeable in human time, so most of the time it is probably simplest to just compute all statistics. The recipe for this is as follows:

std::shared_ptr<KeysightDAQ970A> meter = ...; // get instance
meter->setTrigCount(10); // perform statistic computation over a sample of 10 measurements per channel

// single channel
unsigned channel{101};
double average_value = meter->measureDCV(channel); // computes all statistics over 10 measurements over the single channel (returns the average, stores the other statistics) 
std::vector<double> stddev_values = meter->getStdDeviation(); // get the stored standard deviation value of the most recent measurement over the single channel
assert(stddev_values.size() == 1); // the container of std. dev. values should be size 1 since we only sampled a single channel

// multiple channels at a time
std::vector<unsigned> channels{101, 102, 103, 104};
std::vector<double> average_values = meter->measureDCV(channels); // computes all statistics within each channel (returns the average, stores the other statistics)
std::vector<double> stddev_values = meter->getStdDeviation(); // get the stored standard deviation values of the most recent measurement over each channel
assert(stddev_values.size() == channels.size()); // since we called `measureDCV` with a vector of channels, there should be one std. dev. value for each channel

In the above snippet, the assert statements are illustrative only -- users should not need to call that in their own code.

Typical Recipe for Measurement of a Single Statistic

If you wish to only measure a single sample statistic, one should call the KeysightDAQ970A::setMeasurementStat function as shown in the following snippet:

std::shared_ptr<KeysightDAQ970A> meter = ...; // get instance
meter->setTrigCount(10); // perform statistic computation over a sample of 10 measurements per channel
meter->setMeasurementStat(KeysightDAQ970A::Statistic::StdDeviation);

// single channel
unsigned channel{101};
double stddev_value = meter->measureDCV(channel); // computes only the standard deviation and returns it

// multiple channels at a time
std::vector<unsigned> channels{101, 102, 103, 104};
std::vector<double> stddev_values = meter->measureDCV(channels); // computes only the standard deviation of each of the channels' sets of measurements and returns the values
assert(stddev_values.size() == channels.size()); // since we called `measureDCV` with a vector of channels, there should be one std. dev. value for each channel

In the above snippet, the assert statements are illustrative only -- users should not need to call that in their own code.

Todo:

Edited by Daniel Joseph Antrim

Merge request reports