DMM (Digital Multimeter)¤
Interface¤
Bases: Instrument
Digital multimeter instrument. Call set_measurement_function then read.
Parameters:
-
(name¤str) –Channel-name prefix for published data.
-
(driver¤DMMDriverBase) –Concrete DMM driver; owns its own transport::
dmm = InstroDMM( "main", driver=Agilent34401A("ASRL3::INSTR"), )
-
(publishers¤list[Publisher] | None, default:None) –Publishers that receive emitted Measurement/Command data.
-
–**kwargs¤Default tags applied to every emitted Measurement/Command. Pass
dataset_rid="<rid>"to auto-create a NominalCorePublisher (uses the on-disk 'default' Nominal credential).
background_interval
property
writable
¤
background_interval
Seconds between background daemon iterations (0 = no wait).
background_enable
property
writable
¤
background_enable
Whether the background daemon is enabled (must still be start()-ed).
add_publisher
¤
add_publisher(publisher: Publisher)
Register a publisher to receive this instrument's Measurement/Command data.
publish
¤
publish(data: Measurement | Command, **kwargs)
Fan data out to every configured publisher; kwargs pass through.
add_background_daemon_function
¤
add_background_daemon_function(method: Callable, *args, **kwargs)
Append method to the daemon's call list. Use define_background_daemon to replace instead.
get_channel
¤
get_channel(
channel_name: str,
length: int = 1,
wait_for_latest: bool = False,
timeout: float = 10.0,
) -> Measurement
Return the most recent length samples for channel_name from the in-memory buffer.
Parameters:
-
(channel_name¤str) –Name of the channel to retrieve.
-
(length¤int, default:1) –Number of trailing samples to return.
-
(wait_for_latest¤bool, default:False) –Block until at least
lengthnew values arrive. -
(timeout¤float, default:10.0) –Seconds to wait when
wait_for_latest=True.
Raises:
-
RuntimeError–No background buffer;
start()was not called. -
ChannelNotFoundTimeoutError–wait_for_latest=Trueand channel did not appear withintimeout. -
ChannelValueTimeoutError–wait_for_latest=Trueand values did not arrive withintimeout.
define_background_daemon
¤
define_background_daemon(method: Callable, *args, **kwargs)
Replace all daemon functions with a single method (called with the given args).
start
¤
start() -> None
Start the background daemon thread.
Raises:
-
ValueError–set_measurement_functionhas not been called.
set_measurement_function
¤
set_measurement_function(
function: MeasurementFunction, **kwargs
) -> Command
Configure the DMM for function (DC voltage, resistance, etc.).
set_digits
¤
Set resolution in digits. Requires set_measurement_function() to have been called.
set_aperture_seconds
¤
Set integration time (aperture) in seconds. Requires set_measurement_function() first.
set_aperture_nplc
¤
Set integration time as a number of power-line cycles.
Higher NPLC integrates over more AC noise (better DC/DCI/resistance
accuracy) at the cost of measurement rate. NPLC=100 is the typical
highest-accuracy setting. Requires set_measurement_function first.
set_range
¤
Set manual range; None selects auto-range. Requires set_measurement_function first.
Publishes range_mode.cmd ("AUTO"/"MANUAL") on every call and
range.cmd (float) only when a manual range is supplied — splitting them
keeps each channel single-typed, which the Nominal streaming backend requires.
read
¤
read(**kwargs) -> Measurement
Trigger a measurement under the configured function and return it. Requires set_measurement_function first.
Types & Configuration¤
DMM shared types: MeasurementFunction, DMMMeasurementConfig, RangeMode.
MeasurementFunction
¤
RangeMode
¤
DMMMeasurementConfig
dataclass
¤
DMMMeasurementConfig(
function: MeasurementFunction,
digits: int | None = None,
aperture_seconds: float | None = None,
aperture_nplc: float | None = None,
range: float | None = None,
)
DMM acquisition config. Drivers apply only the options they support; the rest are ignored or raise.
Attributes:
-
function(MeasurementFunction) –Measurement function (required).
-
digits(int | None) –Resolution in digits;
None= instrument default. -
aperture_seconds(float | None) –Integration time in seconds (vendor-dependent; mutually exclusive with
aperture_nplc). -
aperture_nplc(float | None) –Integration time in power-line cycles (vendor-dependent).
-
range(float | None) –Manual range in the active function's units;
None= auto range.
Driver Interface¤
Bases: ABC
Vendor DMM driver contract. Concrete drivers own their transport and lifecycle.
Range and NPLC are split per function (set_dc_voltage_range,
set_ac_current_nplc, …) so the driver never tracks the active
function — InstroDMM dispatches based on its own _measurement_config.
open
abstractmethod
¤
open() -> None
Open the underlying transport and put the instrument into a known state.
Concrete drivers also do one-shot setup here (e.g. *CLS to clear
the error queue, SYST:REM for remote control).
set_measurement_function
abstractmethod
¤
set_measurement_function(function: MeasurementFunction) -> None
Configure the DMM for function (DC voltage, AC current, 2-wire resistance, …).
Drivers may issue a dummy measurement to commit the mode change.
MeasurementFunction values the instrument doesn't support should
raise NotImplementedError.
set_digits
¤
set_digits(n: int) -> None
Set resolution to n digits.
Default raises NotImplementedError; override on drivers whose
SCPI exposes a direct digits/resolution control. Instruments that
only expose integration time (e.g. Keithley 2400) should leave this
as a no-implementation and direct users to set_aperture_nplc.
set_aperture_seconds
¤
set_aperture_seconds(seconds: float) -> None
Set integration time directly in seconds.
Default raises NotImplementedError. Mutually exclusive with
set_aperture_nplc on a given driver — vendors typically expose
one or the other.
set_dc_voltage_range
¤
set_dc_voltage_range(value: float | None) -> None
Set manual DC-voltage range to value volts; None selects auto-range.
set_ac_voltage_range
¤
set_ac_voltage_range(value: float | None) -> None
Set manual AC-voltage range to value volts; None selects auto-range.
set_dc_current_range
¤
set_dc_current_range(value: float | None) -> None
Set manual DC-current range to value amperes; None selects auto-range.
set_ac_current_range
¤
set_ac_current_range(value: float | None) -> None
Set manual AC-current range to value amperes; None selects auto-range.
set_two_wire_resistance_range
¤
set_two_wire_resistance_range(value: float | None) -> None
Set manual 2-wire-resistance range to value ohms; None selects auto-range.
set_four_wire_resistance_range
¤
set_four_wire_resistance_range(value: float | None) -> None
Set manual 4-wire-resistance range to value ohms; None selects auto-range.
set_dc_voltage_nplc
¤
set_dc_voltage_nplc(nplc: float) -> None
Set DC-voltage integration time to nplc power-line cycles.
set_ac_voltage_nplc
¤
set_ac_voltage_nplc(nplc: float) -> None
Set AC-voltage integration time to nplc power-line cycles.
set_dc_current_nplc
¤
set_dc_current_nplc(nplc: float) -> None
Set DC-current integration time to nplc power-line cycles.
set_ac_current_nplc
¤
set_ac_current_nplc(nplc: float) -> None
Set AC-current integration time to nplc power-line cycles.
set_two_wire_resistance_nplc
¤
set_two_wire_resistance_nplc(nplc: float) -> None
Set 2-wire-resistance integration time to nplc power-line cycles.
set_four_wire_resistance_nplc
¤
set_four_wire_resistance_nplc(nplc: float) -> None
Set 4-wire-resistance integration time to nplc power-line cycles.
measure_four_wire_resistance
¤
measure_four_wire_resistance() -> float
Trigger a 4-wire-resistance measurement and return the value (ohms).
Default raises NotImplementedError; override on drivers whose
instrument has dedicated sense leads (e.g. Agilent 34401A).
measure_dc_voltage
abstractmethod
¤
measure_dc_voltage() -> float
Trigger a DC-voltage measurement and return the value (volts).
measure_ac_voltage
abstractmethod
¤
measure_ac_voltage() -> float
Trigger an AC-voltage measurement and return the value (volts RMS, vendor-dependent).
measure_resistance
abstractmethod
¤
measure_resistance() -> float
Trigger a 2-wire-resistance measurement and return the value (ohms).
Vendor Drivers¤
Keithley 2400¤
Keithley 2400 SMU driver (DMM-style sense only).
Supports DC voltage, DC current, and 2-wire resistance. Source is held at zero to enable pure sensing. AC is not supported by the 2400.
Keithley2400
¤
Keithley2400(visa_resource: str | VisaConfig)
Bases: DMMDriverBase
Keithley 2400 SMU as a sense-only DMM.
Integration time is set via NPLC (0.01–10); the 2400 has no aperture-in-seconds. Digits aren't directly settable — use NPLC. AC is not supported.
set_measurement_function
¤
set_measurement_function(function: MeasurementFunction) -> None
Configure the 2400 sense/source for function.
set_digits
¤
set_digits(n: int) -> None
Unsupported — the 2400 has no digits SCPI; use set_aperture_nplc for resolution.
set_aperture_seconds
¤
set_aperture_seconds(seconds: float) -> None
Set integration time directly in seconds.
Default raises NotImplementedError. Mutually exclusive with
set_aperture_nplc on a given driver — vendors typically expose
one or the other.
set_ac_voltage_range
¤
set_ac_voltage_range(value: float | None) -> None
Set manual AC-voltage range to value volts; None selects auto-range.
set_ac_current_range
¤
set_ac_current_range(value: float | None) -> None
Set manual AC-current range to value amperes; None selects auto-range.
set_four_wire_resistance_range
¤
set_four_wire_resistance_range(value: float | None) -> None
Set manual 4-wire-resistance range to value ohms; None selects auto-range.
set_ac_voltage_nplc
¤
set_ac_voltage_nplc(nplc: float) -> None
Set AC-voltage integration time to nplc power-line cycles.
set_ac_current_nplc
¤
set_ac_current_nplc(nplc: float) -> None
Set AC-current integration time to nplc power-line cycles.
Agilent 34401A¤
Agilent/HP/Keysight 34401A DMM driver (SCPI over GPIB or RS-232).
Agilent34401A
¤
Agilent34401A(visa_resource: str | VisaConfig)
Bases: DMMDriverBase
Agilent/HP/Keysight 34401A DMM.
set_two_wire_resistance_range
class-attribute
instance-attribute
¤
set_two_wire_resistance_range = _store_range
set_four_wire_resistance_range
class-attribute
instance-attribute
¤
set_four_wire_resistance_range = _store_range
open
¤
open() -> None
Open transport, *CLS, then SYST:REM to disable the front panel and RS-232 echo.
set_measurement_function
¤
set_measurement_function(function: MeasurementFunction) -> None
Configure the function for subsequent reads via a dummy measurement.
set_digits
¤
set_digits(n: int) -> None
Set the digits (4, 5, or 6) used as the resolution argument in MEAS:...? commands.
set_aperture_seconds
¤
set_aperture_seconds(seconds: float) -> None
Set integration time directly in seconds.
Default raises NotImplementedError. Mutually exclusive with
set_aperture_nplc on a given driver — vendors typically expose
one or the other.
set_dc_voltage_nplc
¤
set_dc_voltage_nplc(nplc: float) -> None
Set DC-voltage integration time to nplc power-line cycles.
set_ac_voltage_nplc
¤
set_ac_voltage_nplc(nplc: float) -> None
Set AC-voltage integration time to nplc power-line cycles.
set_dc_current_nplc
¤
set_dc_current_nplc(nplc: float) -> None
Set DC-current integration time to nplc power-line cycles.
set_ac_current_nplc
¤
set_ac_current_nplc(nplc: float) -> None
Set AC-current integration time to nplc power-line cycles.