msl.equipment.connection_prologix module
Uses Prologix hardware to establish a connection to the equipment.
- class msl.equipment.connection_prologix.ConnectionPrologix(record)[source]
Bases:
Connection
Uses Prologix hardware to establish a connection to the equipment.
For the GPIB-ETHERNET Controller, the format of the
address
isPrologix::HOST::1234::PAD[::SAD]
, where PAD (Primary Address) is a decimal value between 0 and 30 and SAD (Secondary Address) is a decimal value between 96 and 126. SAD is optional. For example,Prologix::192.168.1.110::1234::6
orPrologix::192.168.1.110::1234::6::96
.For the GPIB-USB Controller, the format of the
address
isPrologix::PORT::PAD[::SAD]
, where PAD (Primary Address) is a decimal value between 0 and 30 and SAD (Secondary Address) is a decimal value between 96 and 126. SAD is optional. For example,Prologix::COM3::6
orPrologix::/dev/ttyUSB0::6::112
.The
properties
for a Prologix connection supports the following key-value pairs in the Connections Database and any of the key-value pairs supported byConnectionSerial
orConnectionSocket
(depending on whether a GPIB-USB or a GPIB-ETHERNET Controller is used):'eoi': int, 0 or 1 'eos': int, 0, 1, 2 or 3 'eot_char': int, an ASCII value less than 256 'eot_enable': int, 0 or 1 'mode': int, 0 or 1 [default: 1] 'read_tmo_ms': int, a timeout value between 1 and 3000 milliseconds
The
backend
value must be equal toMSL
to use this class for the communication system. This is achieved by setting the value in the Backend field for a connection record in the Connections Database to beMSL
.Do not instantiate this class directly. Use the
connect()
method to connect to the equipment.- Parameters:
record (
EquipmentRecord
) – A record from an Equipment-Register Database.
- controllers = {}
A
dict
of all Prologix Controllers that are being used to communicate with GPIB devices.
- selected_addresses = {}
A
dict
of the currently-selected GPIB address for all Prologix Controllers.
- property encoding_errors
The error handling scheme to use when encoding and decoding messages.
For example: strict, ignore, replace, xmlcharrefreplace, backslashreplace
- Type:
- property read_termination
The termination character sequence that is used for the
read()
method.Reading stops when the equipment stops sending data or the read_termination character sequence is detected. If you set the read_termination to be equal to a variable of type
str
it will automatically be encoded.
- property write_termination
The termination character sequence that is appended to
write()
messages.If you set the write_termination to be equal to a variable of type
str
it will automatically be encoded.
- property controller
ConnectionSerial
orConnectionSocket
: The connection to the Prologix Controller for this equipment.Depends on whether a GPIB-USB or a GPIB-ETHERNET Controller is being used to communicate with the equipment.
- disconnect()[source]
Calling this method does not close the underlying
ConnectionSerial
orConnectionSocket
connection to the Prologix Controller since the connection to the Prologix Controller may still be required to send messages to other devices via GPIB.Calling this method sets the
controller
to beNone
.
- group_execute_trigger(*addresses)[source]
Send the Group Execute Trigger command to equipment at the specified addresses.
Up to 15 addresses may be specified. If no address is specified then the Group Execute Trigger command is issued to the currently-addressed equipment.
- Parameters:
addresses –
The primary (and optional secondary) GPIB addresses. If a secondary address is specified then it must follow its corresponding primary address. For example:
group_execute_trigger(1, 11, 17) \(\rightarrow\) primary, primary, primary
group_execute_trigger(3, 96, 12, 21) \(\rightarrow\) primary, secondary, primary, primary
- Returns:
int
– The number of bytes written.
- query(message, **kwargs)[source]
Convenience method for performing a
write()
followed by aread()
.
- property query_auto
Whether to send
++auto 1
before and++auto 0
after aquery()
to the Prologix Controller.- Type:
- version()[source]
Get the version of the Prologix Controller.
- Returns:
str
– The type of the Controller (GPIB-USB or GPIB-ETHERNET) and the version of the firmware.
- static parse_address(address)[source]
Parse the address to determine the connection class and the GPIB address.
- Parameters:
address (
str
) – The address of aConnectionRecord
.- Returns:
dict
orNone
– If address is valid for a Prologix connection then the key-value pairs are:- class,
ConnectionSocket
orConnectionSerial
The underlying connection class to use (not instantiated).
- class,
- name,
str
The name of the connection class.
- name,
- pad,
int
The primary GPIB address.
- pad,
otherwise
None
is returned.
- msl.equipment.connection_prologix.find_prologix(*, ip: list[str] | None = None, timeout: float = 1) dict[str, str | list[str]] [source]
Find all Prologix ENET-GPIB devices that are on the network.
To resolve the MAC address of a Prologix device, the
arp
program must be installed. On Linux, installnet-tools
. On Windows and macOS,arp
should already be installed.- Parameters:
ip – The IP address(es) on the local computer to use to search for Prologix ENET-GPIB devices. If not specified, uses all network interfaces.
timeout – The maximum number of seconds to wait for a reply.
- Returns:
The information about the Prologix ENET-GPIB devices that were found.