VirtualDMM#

class VirtualDMM(
stimulus: dict[MeasurementFunction, float] | None = None,
)[source]#

Bases: DMMDriverBase

DMM simulated in-process: no transport, server, or hardware.

Each function reads its stimulus value plus noise (0.5%, the SCPI simulator’s level). Range, NPLC, digits, and aperture settings are accepted and have no effect on readings, so any InstroDMM call works. To exercise the VISA transport as well, use SimulatedDMM with the bundled SCPI simulator.

Create a virtual DMM.

Parameters:

stimulus (dict[MeasurementFunction, float] | None)

The value each function measures before noise, in volts, amperes, or ohms. Functions left out keep their defaults (1.25 V DC, 0.5 V AC, 0.1 A DC, 0.05 A AC, 1000 ohms).

Example:

from instro.dmm import InstroDMM, MeasurementFunction
from instro.dmm.drivers import VirtualDMM

dmm = InstroDMM(name="dmm", driver=VirtualDMM({MeasurementFunction.DC_VOLTAGE: 3.3}))
with dmm:
    print(dmm.read_dc_voltage().latest)  # about 3.3

Methods

close

Nothing to disconnect.

measure_ac_current

Trigger an AC-current measurement and return the value (amperes RMS, vendor-dependent).

measure_ac_voltage

Trigger an AC-voltage measurement and return the value (volts RMS, vendor-dependent).

measure_dc_current

Trigger a DC-current measurement and return the value (amperes).

measure_dc_voltage

Trigger a DC-voltage measurement and return the value (volts).

measure_four_wire_resistance

Trigger a 4-wire-resistance measurement and return the value (ohms).

measure_resistance

Trigger a 2-wire-resistance measurement and return the value (ohms).

open

Nothing to connect to.

set_ac_current_nplc

Accepted; no effect on readings.

set_ac_current_range

Accepted; no effect on readings.

set_ac_voltage_nplc

Accepted; no effect on readings.

set_ac_voltage_range

Accepted; no effect on readings.

set_aperture_seconds

Accepted; no effect on readings.

set_dc_current_nplc

Accepted; no effect on readings.

set_dc_current_range

Accepted; no effect on readings.

set_dc_voltage_nplc

Accepted; no effect on readings.

set_dc_voltage_range

Accepted; no effect on readings.

set_digits

Accepted; no effect on readings.

set_four_wire_resistance_nplc

Accepted; no effect on readings.

set_four_wire_resistance_range

Accepted; no effect on readings.

set_measurement_function

Accept any function; InstroDMM calls the matching measure_* method to read it.

set_two_wire_resistance_nplc

Accepted; no effect on readings.

set_two_wire_resistance_range

Accepted; no effect on readings.

open() → None[source]#

Nothing to connect to.

close() → None[source]#

Nothing to disconnect.

set_measurement_function(
function: MeasurementFunction,
) → None[source]#

Accept any function; InstroDMM calls the matching measure_* method to read it.

set_digits(n: int) → None[source]#

Accepted; no effect on readings.

set_aperture_seconds(seconds: float) → None[source]#

Accepted; no effect on readings.

set_dc_voltage_range(value: float | None) → None[source]#

Accepted; no effect on readings.

set_ac_voltage_range(value: float | None) → None[source]#

Accepted; no effect on readings.

set_dc_current_range(value: float | None) → None[source]#

Accepted; no effect on readings.

set_ac_current_range(value: float | None) → None[source]#

Accepted; no effect on readings.

set_two_wire_resistance_range(value: float | None) → None[source]#

Accepted; no effect on readings.

set_four_wire_resistance_range(value: float | None) → None[source]#

Accepted; no effect on readings.

set_dc_voltage_nplc(nplc: float) → None[source]#

Accepted; no effect on readings.

set_ac_voltage_nplc(nplc: float) → None[source]#

Accepted; no effect on readings.

set_dc_current_nplc(nplc: float) → None[source]#

Accepted; no effect on readings.

set_ac_current_nplc(nplc: float) → None[source]#

Accepted; no effect on readings.

set_two_wire_resistance_nplc(nplc: float) → None[source]#

Accepted; no effect on readings.

set_four_wire_resistance_nplc(nplc: float) → None[source]#

Accepted; no effect on readings.

measure_dc_voltage() → float[source]#

Trigger a DC-voltage measurement and return the value (volts).

measure_ac_voltage() → float[source]#

Trigger an AC-voltage measurement and return the value (volts RMS, vendor-dependent).

measure_dc_current() → float[source]#

Trigger a DC-current measurement and return the value (amperes).

measure_ac_current() → float[source]#

Trigger an AC-current measurement and return the value (amperes RMS, vendor-dependent).

measure_resistance() → float[source]#

Trigger a 2-wire-resistance measurement and return the value (ohms).

measure_four_wire_resistance() → float[source]#

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).