Keithley6500#
Controls a Keithley 6500 series digital multimeter (6500 / 6510 with switching card slots, TSP device) from Python: DC voltage / current measurement, digitizing, relay switching on the installed cards, TSP node handling and Lua script execution. This class inherits from MeasmaticDevice.
property columns#
Gets the number of columns of the switch matrix formed by the installed switch cards.
Returns#
| Type | Description |
|---|---|
| int | The number of columns. |
Example#
dmm = measmatic.get_device('device-dmm')
columns = dmm.columns
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 6500 series 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 number_of_slots#
Gets the number of insertion slots for switch cards (1 for the 6500, 2 for other models of the series).
Returns#
| Type | Description |
|---|---|
| int | The number of slots. |
Example#
dmm = measmatic.get_device('device-dmm')
slots = dmm.number_of_slots
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 rows#
Gets the number of rows of the switch matrix formed by the installed switch cards.
Returns#
| Type | Description |
|---|---|
| int | The number of rows. |
Example#
dmm = measmatic.get_device('device-dmm')
rows = dmm.rows
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 switch_cards#
Gets the switch cards installed in the device.
Returns#
| Type | Description |
|---|---|
| Any | The installed cards (.NET type IEnumerable<IKeithleySwitchCard> ). |
Example#
dmm = measmatic.get_device('device-dmm')
cards = list(dmm.switch_cards)
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 and raises an error with the error information if there is an entry.
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 this device it does nothing (not supported by the 6510).
Example#
dmm = measmatic.get_device('device-dmm')
dmm.clear_stop()
method close_relay(row: int, column: int)#
Closes the relay at the given position of the switch matrix.
Parameters#
| Name | Description |
|---|---|
| row | The row of the relay (starts at 1). |
| column | The column of the relay (starts at 1). |
Example#
dmm = measmatic.get_device('device-dmm')
dmm.close_relay(1, 2)
method close_relay(relay: Any)#
Closes the given relay.
Parameters#
| Name | Description |
|---|---|
| relay | The relay to close (.NET type Atv.Framework.Devices.Switch.Model.SwitchRelay ). |
Example#
dmm = measmatic.get_device('device-dmm')
dmm.close_relay(relay)
method close_relay(relayList: Any)#
Closes several relays.
Parameters#
| Name | Description |
|---|---|
| relayList | The relays to close (.NET type IEnumerable<Atv.Framework.Devices.Switch.Model.SwitchRelay> ). |
Example#
dmm = measmatic.get_device('device-dmm')
dmm.close_relay([relay_a, relay_b])
method configure_pseudo_card(pseudoCardList: Any)#
Configures several pseudo cards in the switch for demo mode.
Parameters#
| Name | Description |
|---|---|
| pseudoCardList | The pseudo card configurations (.NET type List<Atv.Framework.Devices.Switch.PseudoCard> ). |
Example#
dmm = measmatic.get_device('device-dmm')
dmm.configure_pseudo_card(pseudo_cards)
method configure_pseudo_card(pseudoCard: Any)#
Configures a pseudo card (card type, slot and TSP node number) in the switch for demo mode.
Parameters#
| Name | Description |
|---|---|
| pseudoCard | The pseudo card configuration (.NET type Atv.Framework.Devices.Switch.PseudoCard ). |
Example#
dmm = measmatic.get_device('device-dmm')
dmm.configure_pseudo_card(pseudo_card)
method digitize_init(sampleRate: int, numSamples: int, voltRange: float)#
Prepares the digitizer of the device for a voltage acquisition.
Parameters#
| Name | Description |
|---|---|
| sampleRate | The sample rate in Hz (1000 to 1000000). |
| numSamples | The number of samples to acquire (10 to 10000). |
| voltRange | The voltage range in V (0.1 to 1000). |
Example#
dmm = measmatic.get_device('device-dmm')
dmm.digitize_init(100000, 1000, 10.0)
dmm.digitize_start()
dmm.digitize_wait_for()
samples = dmm.digitize_query()
method digitize_query()#
Reads the acquired samples from the default buffer of the device.
Returns#
| Type | Description |
|---|---|
| float | The acquired readings. |
Example#
dmm = measmatic.get_device('device-dmm')
samples = dmm.digitize_query()
method digitize_start()#
Starts the acquisition prepared with digitize_init .
Example#
dmm = measmatic.get_device('device-dmm')
dmm.digitize_start()
method digitize_wait_for()#
Waits until the acquisition started with digitize_start has finished.
Example#
dmm = measmatic.get_device('device-dmm')
dmm.digitize_wait_for()
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 get_switch_card(slot: int)#
Gets the switch card installed in the given slot.
Parameters#
| Name | Description |
|---|---|
| slot | The slot number. |
Returns#
| Type | Description |
|---|---|
| Any | The card (.NET type IKeithleySwitchCard ), or None if no card is installed in that slot. |
Example#
dmm = measmatic.get_device('device-dmm')
card = dmm.get_switch_card(1)
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 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 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 open_all()#
Opens all closed relays on all slots.
Example#
dmm = measmatic.get_device('device-dmm')
dmm.open_all()
method open_relay(row: int, column: int)#
Opens the relay at the given position of the switch matrix.
Parameters#
| Name | Description |
|---|---|
| row | The row of the relay (starts at 1). |
| column | The column of the relay (starts at 1). |
Example#
dmm = measmatic.get_device('device-dmm')
dmm.open_relay(1, 2)
method open_relay(relay: Any)#
Opens the given relay.
Parameters#
| Name | Description |
|---|---|
| relay | The relay to open (.NET type Atv.Framework.Devices.Switch.Model.SwitchRelay ). |
Example#
dmm = measmatic.get_device('device-dmm')
dmm.open_relay(relay)
method open_relay(relayList: Any)#
Opens several relays.
Parameters#
| Name | Description |
|---|---|
| relayList | The relays to open (.NET type IEnumerable<Atv.Framework.Devices.Switch.Model.SwitchRelay> ). |
Example#
dmm = measmatic.get_device('device-dmm')
dmm.open_relay([relay_a, relay_b])
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 reset()#
Resets the device to its default state (sends *RST ).
Example#
dmm = measmatic.get_device('device-dmm')
dmm.reset()
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 stop()#
Sends the Lua statement dummy = 1 to the device. This writes to the input buffer of the device, which a running script can detect.
Example#
dmm = measmatic.get_device('device-dmm')
dmm.stop()
method switch_relay(relay: Any)#
Switches the relay according to its desired state ( DesiredState : open or closed). A relay with an undefined desired state is left unchanged.
Parameters#
| Name | Description |
|---|---|
| relay | The relay to switch (.NET type Atv.Framework.Devices.Switch.Model.SwitchRelay ). |
Example#
dmm = measmatic.get_device('device-dmm')
dmm.switch_relay(relay)
method switch_relay(relayList: Any, switchingOrder: Any = ...)#
Switches several relays according to their desired state ( DesiredState : open or closed).
Parameters#
| Name | Description |
|---|---|
| relayList | The relays to switch (.NET type IEnumerable<Atv.Framework.Devices.Switch.Model.SwitchRelay> ). |
| switchingOrder | The order in which relays are switched if the list contains both relays to open and to close Default: ... |
Example#
dmm = measmatic.get_device('device-dmm')
dmm.switch_relay([relay_a, relay_b])
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()