Skip to content

Keithley7510#

Controls a Keithley 7510 digital multimeter (TSP device) from Python: DC voltage / current measurement, TSP node handling and Lua script execution. This class inherits from MeasmaticDevice.


property configuration#

Gets the configuration of the device.

Returns#

Type Description
Any The device configuration (.NET type KeithleyTspDeviceConfigurationBase ).

Example#

dmm = measmatic.get_device('device-dmm')
config = dmm.configuration

property is_tsp_master#

Indicates whether this device is the master of its TSP link.

Returns#

Type Description
bool True if the device is the TSP master, otherwise False .

Example#

dmm = measmatic.get_device('device-dmm')
is_master = dmm.is_tsp_master

property lua_syntax#

Gets the Lua syntax variant supported by the device (the 7510 uses the syntax of devices with a graphical touchscreen).

Returns#

Type Description
Any The Lua syntax (.NET enum KeithleyTspLuaSyntax ).

Example#

dmm = measmatic.get_device('device-dmm')
syntax = dmm.lua_syntax

property master_node#

Gets the master node of the TSP link this device belongs to.

Returns#

Type Description
Any The master device (.NET type IKeithleyTspDevice ).

Example#

dmm = measmatic.get_device('device-dmm')
master = dmm.master_node

property model#

Gets the Keithley model of the device.

Returns#

Type Description
Any The model (.NET enum KeithleyModel ).

Example#

dmm = measmatic.get_device('device-dmm')
model = dmm.model

property revision#

Gets the firmware version installed on the device.

Returns#

Type Description
str The firmware revision.

Example#

dmm = measmatic.get_device('device-dmm')
revision = dmm.revision

property serial_number#

Gets the serial number of the device.

Returns#

Type Description
str The serial number.

Example#

dmm = measmatic.get_device('device-dmm')
serial = dmm.serial_number

property tsp_node_number#

Gets the TSP node number of the device.

Returns#

Type Description
int The TSP node number.

Example#

dmm = measmatic.get_device('device-dmm')
node_number = dmm.tsp_node_number

property tsp_nodes#

Gets the devices that are present as TSP nodes on this device.

Returns#

Type Description
Any The TSP node devices (.NET type IEnumerable<IKeithleyTspDevice> ).

Example#

dmm = measmatic.get_device('device-dmm')
nodes = list(dmm.tsp_nodes)

method add_node(nodeDevice: Any)#

Adds a device as TSP node to this device. The node then communicates through this device.

Parameters#

Name Description
nodeDevice The device to add (.NET type IKeithleyTspDevice ). It must have a free node number and no TSP nodes

Example#

dmm = measmatic.get_device('device-dmm')
dmm.add_node(node_device)

method change_tsp_node_number(newTspNodeNumber: int)#

Changes the TSP node number of the device.

Parameters#

Name Description
newTspNodeNumber The new TSP node number.

Example#

dmm = measmatic.get_device('device-dmm')
dmm.change_tsp_node_number(2)

method check_errors()#

Checks the error list of the device. For the 7510 this is a no-op.

Example#

dmm = measmatic.get_device('device-dmm')
dmm.check_errors()

method check_ok(response: str, funcName: str)#

Checks that a response of a Lua function contains "OK" and raises an error otherwise.

Parameters#

Name Description
response The response received from the device.
funcName The name of the function that produced the response, used in the error message.

Example#

dmm = measmatic.get_device('device-dmm')
dmm.check_ok('OK', 'my_function')

method clear_stop()#

Resets the stop flag inside the device. For the 7510 this is a no-op.

Example#

dmm = measmatic.get_device('device-dmm')
dmm.clear_stop()

method execute_lua_function(functionName: str, response: Any, responseCount: int = 1, *args: Any)#

Calls a Lua function on the device with the given arguments and reads the requested number of response lines. The arguments are converted to text and inserted verbatim into the call, so string arguments must contain their Lua quotes.

Parameters#

Name Description
functionName The name of the Lua function.
response Out parameter, returned as part of the result tuple.
responseCount The number of response lines to read. Default: 1
args The arguments passed to the Lua function.

Returns#

Type Description
str The first response line, or an empty string if no response was requested.
str All response lines.

Example#

dmm = measmatic.get_device('device-dmm')
first_line, lines = dmm.execute_lua_function('print', 1, 5)

method execute_script(scriptName: str, reader: Any, checkErrors: bool = False)#

Loads a Lua script from a text reader into the device and runs it.

Parameters#

Name Description
scriptName The name under which the script is stored on the device.
reader The reader (.NET type System.IO.TextReader ) providing the script text.
checkErrors True to check the error list of the device after the script has run. Default: false

Example#

from System.IO import StringReader
dmm = measmatic.get_device('device-dmm')
dmm.execute_script('my_script', StringReader('print("hello")'))

method execute_script_file(scriptName: str, fileName: str, checkErrors: bool = False)#

Loads a Lua script from a file into the device and runs it.

Parameters#

Name Description
scriptName The name under which the script is stored on the device.
fileName The path of the script file.
checkErrors True to check the error list of the device after the script has run. Default: false

Example#

dmm = measmatic.get_device('device-dmm')
dmm.execute_script_file('my_script', 'C:\\scripts\\my_script.lua')

method execute_script_string(scriptName: str, script: str, checkErrors: bool = False)#

Loads a Lua script given as text into the device and runs it.

Parameters#

Name Description
scriptName The name under which the script is stored on the device.
script The script text.
checkErrors True to check the error list of the device after the script has run. Default: false

Example#

dmm = measmatic.get_device('device-dmm')
dmm.execute_script_string('my_script', 'print("hello")')

method is_tsp_node_number_occupied(tspNodeNumber: int)#

Checks whether a device on the TSP link already uses the given node number. The check is done by a query to the TSP master, independent of the configuration.

Parameters#

Name Description
tspNodeNumber The TSP node number to check.

Returns#

Type Description
bool True if the node number is used, otherwise False .

Example#

dmm = measmatic.get_device('device-dmm')
occupied = dmm.is_tsp_node_number_occupied(2)

method load_script(scriptName: str, reader: Any)#

Loads a Lua script from a text reader into the device without running it. The reader is closed afterwards.

Parameters#

Name Description
scriptName The name under which the script is stored on the device.
reader The reader (.NET type System.IO.TextReader ) providing the script text.

Example#

from System.IO import StringReader
dmm = measmatic.get_device('device-dmm')
dmm.load_script('my_script', StringReader('print("hello")'))

method load_script_file(scriptName: str, fileName: str)#

Loads a Lua script from a file into the device without running it.

Parameters#

Name Description
scriptName The name under which the script is stored on the device.
fileName The path of the script file.

Example#

dmm = measmatic.get_device('device-dmm')
dmm.load_script_file('my_script', 'C:\\scripts\\my_script.lua')

method load_script_string(scriptName: str, script: str)#

Loads a Lua script given as text into the device without running it.

Parameters#

Name Description
scriptName The name under which the script is stored on the device.
script The script text.

Example#

dmm = measmatic.get_device('device-dmm')
dmm.load_script_string('my_script', 'print("hello")')

method measure_current()#

Performs a single measurement with the current measurement function and returns the reading.

Returns#

Type Description
float The measured value in amperes.

Example#

dmm = measmatic.get_device('device-dmm')
current = dmm.measure_current()

method measure_voltage()#

Performs a single measurement with the current measurement function and returns the reading.

Returns#

Type Description
float The measured value in volts.

Example#

dmm = measmatic.get_device('device-dmm')
voltage = dmm.measure_voltage()

method node_exists(tspNodeNumber: int)#

Looks up whether a TSP node with the given number exists.

Parameters#

Name Description
tspNodeNumber The TSP node number.

Returns#

Type Description
bool True if the TSP node exists, otherwise False .

Example#

dmm = measmatic.get_device('device-dmm')
exists = dmm.node_exists(2)

method node_prefix()#

Returns the prefix that must be prepended to commands so that they are executed on this TSP node and not on the master.

Returns#

Type Description
str The command prefix.

Example#

dmm = measmatic.get_device('device-dmm')
prefix = dmm.node_prefix()

method request_stop()#

Asks a running Lua script to stop. The stop is cooperative: the script has to check for it.

Example#

dmm = measmatic.get_device('device-dmm')
dmm.request_stop()

method run_script(scriptName: str)#

Runs a Lua script that was previously loaded into the device.

Parameters#

Name Description
scriptName The name of the loaded script.

Example#

dmm = measmatic.get_device('device-dmm')
dmm.run_script('my_script')

method scan_tsp_bus()#

Scans the TSP bus and returns the numbers of all devices present on it.

Returns#

Type Description
Any The node numbers found (.NET type IEnumerable<int> ).

Example#

dmm = measmatic.get_device('device-dmm')
node_numbers = list(dmm.scan_tsp_bus())

method to_log_string()#

Generates a string with detailed information about the device, intended for logging.

Returns#

Type Description
str The device information.

Example#

dmm = measmatic.get_device('device-dmm')
info = dmm.to_log_string()