Module Documentation

fluke5440b_async

This is an asyncIO library for the Fluke 5440B calibrator. It manages all functions of the calibrator and takes care of the internal state.

class fluke5440b_async.Fluke_5440B(connection: AsyncGpib | AsyncPrologixGpibController, log_level: int = 30)[source]

The driver for the Fluke 5440B voltage calibrator. It supports both linux-gpib and the Prologix GPIB adapters.

__init__(connection: AsyncGpib | AsyncPrologixGpibController, log_level: int = 30)[source]

Create Fluke 5440B device with the GPIB connection given.

Parameters:
  • connection (AsyncGpib or AsyncPrologixGpibController) – The GPIB connection.

  • log_level (int, default=logging.WARNING) – The level of logging output. By default, only warnings or higher are output.

async acal() None[source]

Run the internal calibration routine. It will take about 6.5 minutes during which the instrument hardware is blocked. See page 3-2 of the operator manual for details.

async connect() None[source]

Connect the GPIB connection and configure the GPIB device for the DMM. This function must be called from the AsyncIO loop and takes care of connecting the GPIB adapter.

property connection: AsyncGpib | AsyncPrologixGpibController

The GPIB connection.

async disconnect() None[source]

Disconnect from the instrument and clean up. This call will also automatically remove the local lockout if set.

async get_calibration_constants() CalibrationConstants[source]

Query the calibration constants and gain shifts with respect to the previous internal calibration. See page 3-18 of the operator manual for details. :returns: A dataclass containing the constants as Decimals :rtype: CalibrationConstants

async get_current_limit() Decimal | tuple[Decimal, Decimal][source]

Get the current limit set on the instrument. It will raise an error, when in voltage boost mode. :returns: The positive and negative limit :rtype: tuple of Decimal

Raises:

DeviceError – Raised if there was an error processing the command.

async get_error() int[source]

Get the last error thrown by the instrument if any. It is recommended to check for errors after using the write() function, if the test_error parameter is not set. :returns: The last error thrown. It might be an ErrorCode or a SelfTestErrorCode. This is ambiguous and depends on the

last command.

Return type:

int

async get_id() tuple[str, str, str, str][source]

Returns the instrument name and the software version string. To emulate the *IDN? SCPI command, the result is a tuple containing the Manufacturer, Device, Serial (0) and FW version. :returns: A tuple containing the manufacturer id, device id, a zero, and the software version. :rtype: tuple of str

async get_output() Decimal[source]

Returns the output voltage currently set. :returns: The output voltage set. :rtype: Decimal

Raises:

DeviceError – Raised if there was an error processing the command.

async get_rs232_baud_rate() int | float[source]

Return the RS-232 the baud rate in bit/s. :returns: The baud rate in bit/s :rtype: float

Raises:

DeviceError – If test_error is set to True and there was an error processing the command.

async get_separator() SeparatorType[source]

Returns the separator used by the instrument to separate multiple queries. :returns: The separator used by the device. :rtype: SeparatorType

Raises:

DeviceError – Raised if there was an error processing the command.

async get_srq_mask() SrqMask[source]

Get the SRQ mask. This mask is used to determine, when the device will signal the SRQ line. :returns: The bitmask to determine the bits to signal. :rtype: SrqMask

Raises:

DeviceError – If test_error is set to True and there was an error processing the command.

async get_state() DeviceState[source]

While the instrument is running long jobs, it signals its current state. Use this to poll the state. :returns: The current device state. :rtype: DeviceState

Raises:

DeviceError – Raised if there was an error processing the command.

async get_status() StatusFlags[source]

Get the status of the instrument. The status flags contain the mode the instrument is running in, like boost mode, or the state of the external sense connection, etc. :returns: The status flags of the different settings :rtype: StatusFlags

Raises:

DeviceError – Raised if there was an error processing the command.

async get_terminator() TerminatorType[source]

Returns the line terminator sent by the instrument. :returns: The line terminator used by the device. :rtype: TerminatorType

async get_voltage_limit() tuple[Decimal, Decimal][source]

Get the voltage limit set on the instrument. It will raise an error, when in current boost mode. :returns: The positive and negative limit :rtype: tuple of Decimal

Raises:

DeviceError – Raised if there was an error processing the command.

async local() None[source]

Enable the front panel buttons, if the instrument is in local lock out.

async query(cmd: str | bytes, test_error: bool = False) str | list[str][source]

Write a string or bytestring to the instrument, then immediately read back the result. This is a combined call to write() and read(). :param cmd: The command written to the device :type cmd: str or bytes :param test_error: Check for errors by serial polling after sending the command. :type test_error: bool, default=False

Returns:

Returns either a simple string, or if multiple results are returned, a list of strings.

Return type:

str or list of str

Raises:

DeviceError – If test_error is set to True and there was an error processing the command.

async read() str | list[str][source]

Read from the device. :returns: Returns either a simple string, or if multiple results are returned, a list of strings. :rtype: str or list of str

async reset() None[source]

Place the instrument in standby, enable voltage mode, set the output voltage to 0.0, disable the divider output, the external guard mode and external sense mode. :raises DeviceError: Raised if there was an error processing the command.

async selftest_all() None[source]

Run all three self-tests. This function is a combination of selftest_digital(), selftest_analog() and selftest_hv().

Raises:

DeviceError – Raised if there was an error processing the command.

async selftest_analog() None[source]

Test the ADC, the low voltage part and the oven. It will take about 4 minutes during which the instrument hardware is blocked. See page 3-19 of the operator manual for details.

Raises:

DeviceError – Raised if there was an error processing the command.

async selftest_digital() None[source]

Test the main CPU, the front panel CPU and the guard CPU. It will take about 5 seconds during which the instrument hardware is blocked. See page 3-19 of the operator manual for details.

Raises:

DeviceError – Raised if there was an error processing the command.

async selftest_hv() None[source]

Test the ADC and the high voltage part. It will take about 1 minute during which the instrument hardware is blocked. See page 3-20 of the operator manual for details.

Raises:

DeviceError – Raised if there was an error processing the command.

async serial_poll() SerialPollFlags[source]

Poll the serial output buffer of the device. This can be used to query for the SRQ bit when device requests service, has encountered an error or is busy. :returns: The content of the serial output buffer :rtype: SerialPollFlags

async set_current_limit(value: int | float | Decimal, value2: int | float | Decimal | None = None) None[source]

Set the positive and negative current limit. :param value: Either a positive or negative number to set the positive or negative limit. :type value: int or float or Decimal :param value2: Either a positive or negative number to set the positive or negative limit. If omitted, only one limit will

be set.

Raises:
  • DeviceError – Raised if there was an error processing the command.

  • ValueError – Raised if the limits are out of bounds.

async set_divider(enabled: bool) None[source]

Enable the internal 1:10 and 1:100 divider to reduce the output noise and increase the resolution of voltages in the range -2.2 V to 2.2 V. Do not enable the external sense connection via set_internal_sense(False)(), as this will decrease the accuracy. The divider has an output impedance of 450 Ω. The load should ideally be greater than 1 GΩ to keep the loading error below 1 ppm. See page 3-10 of the operator manual for details.

Parameters:

enabled (bool) – Set to True to enable the divider.

Raises:

DeviceError – Raised if there was an error processing the command.

async set_enable_rs232(enabled: bool) None[source]

Enable the RS-232 printer port. :param enabled: True to enable the RS-232 port. :type enabled: bool

Raises:

DeviceError – If test_error is set to True and there was an error processing the command.

async set_internal_guard(enabled: bool) None[source]

If set, the guard is internally connected to the output LO terminal. Use this, if the device being calibrated has floating inputs. If calibrating devices with grounded inputs, connect the guard terminal to the input LO of the device and disable the internal guard. See page 2-14 of the operator manual for details. :param enabled: Set to True for floating devices. :type enabled: bool

Raises:

DeviceError – Raised if there was an error processing the command.

async set_internal_sense(enabled: bool) None[source]

If the load resistance is greater than 1 MΩ, 2-wire calibration can be used. Otherwise, the cable resistance will reduce the accuracy. Use internal sense for 2-wire calibrations. See page 2-13 of the operator manual for details.

Parameters:

enabled (bool) – Set to True for 2-wire sense.

Raises:

DeviceError – Raised if there was an error processing the command.

set_log_level(loglevel: int = 30)[source]

Set the log level of the library. By default, the level is set to warning. :param loglevel: The log level of the library :type loglevel: int, default=logging.WARNING

async set_mode(value: ModeType) None[source]

Enabled either voltage or current boost mode using an external Fluke 5205A power amplifier or a Fluke 5220A transconductance amplifier. :param value: Either normal mode, current or voltage boost. :type value: ModeType

Raises:

DeviceError – Raised if there was an error processing the command.

async set_output(value: int | float | Decimal, test_error: bool = True) None[source]

Set the output of the calibrator. If an output greater than ±22 V is set, the calibrator will automatically go to STBY for safety reasons. Call set_output_enabled(True) to re-enable the output. :param value: The value to be set :type value: int or float or Decimal :param test_error: Raise an exception if there was an error :type test_error: bool, Default=True

Raises:

DeviceError – Raised if there was an error processing the command and test_error was set to True.

async set_output_enabled(enabled: bool) None[source]

Set the output to either STANDBY or OPR. :param enabled: Set to OPR if true :type enabled: bool

Raises:

DeviceError – Raised if there was an error processing the command.

async set_rs232_baud_rate(value: int | float) None[source]

Set the baud rate of the RS-232 interface. :param value: The baud rate. :type value: {50, 75, 110, 134.5, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600}

Raises:

DeviceError – If test_error is set to True and there was an error processing the command.

async set_srq_mask(value: SrqMask) None[source]

Set the service request mask register. Each bit set, will signal the SRQ line, when a service request of the device is triggered. :param value: The bitmask to set. :type value: SrqMask

Raises:

DeviceError – If test_error is set to True and there was an error processing the command.

async set_voltage_limit(value: int | float | Decimal, value2: int | float | Decimal | None = None) None[source]

Set the positive and negative voltage limit. :param value: Either a positive or negative number to set the positive or negative limit. :type value: int or float or Decimal :param value2: Either a positive or negative number to set the positive or negative limit. If omitted, only one limit will

be set.

Raises:
  • DeviceError – Raised if there was an error processing the command.

  • ValueError – Raised if the limits are out of bounds.

async write(cmd: str | bytes, test_error: bool = False)[source]

Write a string or bytestring to the instrument. :param cmd: The command written to the device :type cmd: str or bytes :param test_error: Check for errors by serial polling after sending the command. :type test_error: bool, default=False

Raises:

DeviceError – If test_error is set to True and there was an error processing the command.

Dataclasses

class fluke5440b_async.CalibrationConstants(gain_02V: Decimal, gain_2V: Decimal, gain_10V: Decimal, gain_20V: Decimal, gain_250V: Decimal, gain_1000V: Decimal, offset_10V_pos: Decimal, offset_20V_pos: Decimal, offset_250V_pos: Decimal, offset_1000V_pos: Decimal, offset_10V_neg: Decimal, offset_20V_neg: Decimal, offset_250V_neg: Decimal, offset_1000V_neg: Decimal, gain_shift_10V: Decimal, gain_shift_20V: Decimal, gain_shift_250V: Decimal, gain_shift_1000V: Decimal, resolution_ratio: Decimal, adc_gain: Decimal)[source]

The calibration constants of the Fluke 5440B.

adc_gain: Decimal
gain_02V: Decimal
gain_1000V: Decimal
gain_10V: Decimal
gain_20V: Decimal
gain_250V: Decimal
gain_2V: Decimal
gain_shift_1000V: Decimal
gain_shift_10V: Decimal
gain_shift_20V: Decimal
gain_shift_250V: Decimal
offset_1000V_neg: Decimal
offset_1000V_pos: Decimal
offset_10V_neg: Decimal
offset_10V_pos: Decimal
offset_20V_neg: Decimal
offset_20V_pos: Decimal
offset_250V_neg: Decimal
offset_250V_pos: Decimal
resolution_ratio: Decimal

Enums and Flags

Flags are used for the status registers returned by the device.

class fluke5440b_async.flags.SerialPollFlags(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

The register returned by a serial poll.

DOING_STATE_CHANGE = 4
ERROR_CONDITION = 32
MSG_RDY = 8
NONE = 0
OUTPUT_SETTLED = 16
SRQ = 64
class fluke5440b_async.flags.SrqMask(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

The register to control the service request interrupts.

DOING_STATE_CHANGE = 4
ERROR_CONDITION = 32
MSG_RDY = 8
NONE = 0
OUTPUT_SETTLED = 16
class fluke5440b_async.flags.StatusFlags(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

The internal status register that holds the device configuration.

CURRENT_BOOST_MODE = 2
DIVIDER_ENABLED = 8
INTERNAL_GUARD_ENABLED = 64
INTERNAL_SENSE_ENABLED = 16
OUTPUT_ENABLED = 32
REAR_OUTPUT_ENABLED = 128
VOLTAGE_BOOST_MODE = 4
VOLTAGE_MODE = 1

Enums are used to represent the device functions and settings.

class fluke5440b_async.enums.DeviceState(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

The internal device state.

CALIBRATING_ADC = 16
CALIBRATING_GAIN_10V_NEG = 53
CALIBRATING_GAIN_10V_POS = 48
CALIBRATING_GAIN_20V_NEG = 52
CALIBRATING_GAIN_20V_POS = 49
CALIBRATING_GAIN_HV_NEG = 51
CALIBRATING_GAIN_HV_POS = 50
CAL_N1_N2_RATIO = 96
EXT_CAL_02V = 69
EXT_CAL_02V_NULL = 85
EXT_CAL_1000V = 67
EXT_CAL_1000V_NULL = 83
EXT_CAL_10V = 64
EXT_CAL_10V_NULL = 80
EXT_CAL_20V = 65
EXT_CAL_20V_NULL = 81
EXT_CAL_250V = 66
EXT_CAL_250V_NULL = 82
EXT_CAL_2V = 68
EXT_CAL_2V_NULL = 84
IDLE = 0
PRINTING = 208
RESETTING = 240
SELF_TEST_FRONTPANEL_CPU = 113
SELF_TEST_GUARD_CPU = 114
SELF_TEST_HIGH_VOLTAGE = 129
SELF_TEST_LOW_VOLTAGE = 128
SELF_TEST_MAIN_CPU = 112
SELF_TEST_OVEN = 130
WRITING_TO_NVRAM = 224
ZEROING_1000V_NEG = 39
ZEROING_1000V_POS = 38
ZEROING_10V_NEG = 33
ZEROING_10V_POS = 32
ZEROING_20V_NEG = 35
ZEROING_20V_POS = 34
ZEROING_250V_NEG = 37
ZEROING_250V_POS = 36
class fluke5440b_async.enums.ErrorCode(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

The error codes used by the Fluke 5440B.

BOOST_INTERFACE_CONNECTION_ERROR = 144
BOOST_INTERFACE_CURRENT_TRIP = 147
BOOST_INTERFACE_MISSING = 145
BOOST_INTERFACE_VOLTAGE_TRIP = 146
BUFFER_OVERFLOW = 157
DIVIDER_OUT_OF_RANGE = 171
GPIB_HANDSHAKE_ERROR = 152
INVALID_CHARACTER = 158
INVALID_COMMAND = 175
INVALID_GUARD_MODE = 173
INVALID_PARAMETER = 156
INVALID_SENSE_MODE = 172
LIMIT_OUT_OF_RANGE = 170
NONE = 0
OUTPUT_OUTSIDE_LIMITS = 169
PARAMETER_OUT_OF_RANGE = 168
RS232_ERROR = 160
SEPARATOR_ERROR = 154
TERMINATOR_ERROR = 153
UNKNOWN_COMMAND = 155
class fluke5440b_async.enums.ModeType(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

The output modes. Voltage boost means a connected Fluke 5205A power amplifier and current boost means a connected Fluke 5220A transconductance amplifier.

CURRENT_BOOST = 'BSTC'
NORMAL = 'BSTO'
VOLTAGE_BOOST = 'BSTV'
class fluke5440b_async.enums.SelfTestErrorCode(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

The error codes thrown by the self-test routine. See page 4-8 of the service manual for details.

ANALOG_MEASURE_FAULT_CHECK_ANALOG_BUSS = 72
ANALOG_MEASURE_FAULT_CHECK_ZERO_AMP = 73
ANALOG_MEASURE_FAULT_GAIN_SHIFT_TOO_LARGE = 75
ANALOG_MEASURE_FAULT_UNABLE_TO_ZERO_RANGE = 74
BOARD_ACK_FAULT_CHECK_DAC_BOARD = 48
BOARD_ACK_FAULT_CHECK_OUTPUT_BOARD = 51
BOARD_ACK_FAULT_CHECK_PREAMP_BOARD = 49
BOARD_ACK_FAULT_CHECK_SAMPLE_BOARD = 50
BOOST_INTERFACE_ERROR_CHECK_MISSING_REAR_CABLE = 145
BOOST_INTERFACE_ERROR_CHECK_REAR_CONNECTOR = 144
BOOST_INTERFACE_ERROR_CURRENT_TRIP = 147
BOOST_INTERFACE_ERROR_VOLTAGE_TRIP = 146
CAL_SWITCH_LOCKED = 174
DAC_ANALOG_FAULT_CHECK_0V_OUTPUT = 87
DAC_ANALOG_FAULT_CHECK_10V_OUTPUT = 90
DAC_ANALOG_FAULT_CHECK_5V_DAC_CKT = 93
DAC_ANALOG_FAULT_CHECK_5V_DAC_REC = 96
DAC_ANALOG_FAULT_CHECK_DAC_FILTER = 92
DAC_ANALOG_FAULT_CHECK_DAC_OVEN = 95
DAC_ANALOG_FAULT_CHECK_NEG_10V_OUTPUT = 91
DAC_ANALOG_FAULT_CHECK_NEG_5V_REGULATOR = 89
DAC_ANALOG_FAULT_CHECK_REFERENCE = 88
DAC_ANALOG_FAULT_CHECK_SECOND_SPEED = 94
DAC_DIGITAL_FAULT_BIAS_SIGNAL = 83
DAC_DIGITAL_FAULT_CHECK_A_TO_D = 80
DAC_DIGITAL_FAULT_CHECK_FIRST_SWITCH = 81
DAC_DIGITAL_FAULT_SECOND_SWITCH = 82
FIL_BOUT_BRDS_FAULT_CHECK_1100V_RANGE = 132
FIL_BOUT_BRDS_FAULT_CHECK_275V_RANGE = 129
FIL_BOUT_BRDS_FAULT_CHECK_550V_RANGE = 130
FIL_BOUT_BRDS_FAULT_CHECK_875V_RANGE = 131
FIL_BOUT_BRDS_FAULT_CHECK_NEG_275V_RANGE = 128
FRONT_COMMUNICATION_FAULT = 64
FRONT_DIGITAL_FAULT_MEMORY = 32
FRONT_DIGITAL_FAULT_PROCESSOR = 33
GRD_PWR_SUPPLY_FAULT_CHECK_20V_OVEN = 97
GUARD_COMMUNICATION_FAULT_CHECK_GARBLED_DATA = 56
GUARD_COMMUNICATION_FAULT_GUARD_NOT_ANSWERING = 57
IEEE488_REMOTE_ERROR_EXPECTING_BAD_CHARACTER = 158
IEEE488_REMOTE_ERROR_EXPECTING_BUFFER_OVERFLOW = 157
IEEE488_REMOTE_ERROR_EXPECTING_HEADER = 155
IEEE488_REMOTE_ERROR_EXPECTING_NUMBER = 156
IEEE488_REMOTE_ERROR_EXPECTING_SEPARATOR = 154
IEEE488_REMOTE_ERROR_EXPECTING_TERMINATOR = 153
IEEE488_REMOTE_ERROR_SOURCE_HANDSHAKE = 152
INSIDE_GUARD_FAULT_CHECK_ADDRESS_BUS = 42
INSIDE_GUARD_FAULT_CHECK_DATA_BUS = 41
INSIDE_GUARD_FAULT_CHECK_GUARD_CONTROL_BUS = 43
INSIDE_GUARD_FAULT_CHECK_GUARD_MEMORY = 40
MAIN_CONTROL_FAULT_CHECK_MAIN_CONTROLLER = 16
MAIN_CONTROL_FAULT_CHECK_MAIN_MEMORY = 17
MAIN_CONTROL_FAULT_CHECK_MAIN_NV_MEMORY = 18
MAIN_INTERRUPT_FAULT_CHECK_INPUT_FR_FRONT = 27
MAIN_INTERRUPT_FAULT_CHECK_INPUT_FR_GUARD = 30
MAIN_INTERRUPT_FAULT_CHECK_MAIN_CLOCK = 28
MAIN_INTERRUPT_FAULT_CHECK_NVMEMORY_TIMER = 25
MAIN_INTERRUPT_FAULT_CHECK_REMOTE_INPUT = 29
MAIN_INTERRUPT_FAULT_CHECK_SERIAL_INPUT = 26
MAIN_INTERRUPT_FAULT_CHECK_SERIAL_OUTPUT_TIMER = 24
NONE = 0
OUTPUT_BOARDS_FAULT_CHECK_02V_RANGE = 115
OUTPUT_BOARDS_FAULT_CHECK_2V_RANGE = 113
OUTPUT_BOARDS_FAULT_CHECK_CURR_LIM_CKT = 114
OUTPUT_BOARDS_FAULT_CHECK_ZERO_AMP = 112
OUTPUT_LIMIT_FAULT = 136
OUTPUT_LIMIT_FAULT_OUTPUT_OVER_VOLTAGE = 137
OUTPUT_LIMIT_FAULT_OUTPUT_UNDER_VOLTAGE = 138
POWER_SUPPLY_FAULT_CHECK_GUARDED_POWER = 9
POWER_SUPPLY_FAULT_TEST_UNGUARDED_POWER = 8
PREAMP_ANALOG_FAULT_CHECK_INTCAL_CONFIG = 104
PREAMP_ANALOG_FAULT_CHECK_PREAMP_OVEN = 110
PREAMP_OUT_BRDS_FAULT_CHECK_250V_RANGE = 116
PREAMP_OUT_BRDS_FAULT_CHECK_STANDBY_CONFIG = 109
PREAMP_SAMPLE_STRING_FAULT_CHECK_HIGH_V_INTCAL = 123
RS232C_SERIAL_ERROR = 160
SAMPLE_STRING_FAULT_CHECK_10V_INTCAL = 120
SAMPLE_STRING_FAULT_CHECK_1KV_RANGE = 122
SAMPLE_STRING_FAULT_CHECK_20V_INTCAL = 121
USER_ENTRY_ERROR_DIVIDER_OUT_OF_RANGE = 171
USER_ENTRY_ERROR_INSTRUMENT_IS_BUSY = 175
USER_ENTRY_ERROR_IN_OUTPUT_TERMINAL_GUARD = 173
USER_ENTRY_ERROR_IN_OUTPUT_TERMINAL_SENSE = 172
USER_ENTRY_ERROR_LIMITS_OUT_OF_RANGE = 170
USER_ENTRY_ERROR_NUMBER_OUT_OF_RANGE = 168
USER_ENTRY_ERROR_OUTPUT_OUT_OF_RANGE = 169
class fluke5440b_async.enums.SeparatorType(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

The separator used to distinguish multiple return values.

COLON = 1
COMMA = 0
class fluke5440b_async.enums.TerminatorType(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

The line terminator used by the instrument.

CR_LF = 3
CR_LF_EOI = 1
EOI = 0
LF = 4
LF_EOI = 2

Errors

Custom errors raised by the Fluke 5440B.

exception fluke5440b_async.errors.DeviceError(message: str, error_code: ErrorCode)[source]

The device returned an error during operation.

exception fluke5440b_async.errors.Fluke5440bError[source]

The base class for all Fluke 5540B exceptions

exception fluke5440b_async.errors.SelftestError(selftest: str, error_code: SelfTestErrorCode)[source]

The device returned an error during self-test. See page 4-8 of the service manual for details.