msl.equipment.connection_prologix module
Uses Prologix hardware to establish a connection to the equipment.
- class msl.equipment.connection_prologix.ConnectionPrologix(record)[source]
Bases:
ConnectionUses Prologix hardware to establish a connection to the equipment.
For the GPIB-ETHERNET Controller, the format of the
addressisPrologix::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::6orPrologix::192.168.1.110::1234::6::96.For the GPIB-USB Controller, the format of the
addressisPrologix::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::6orPrologix::/dev/ttyUSB0::6::112.The
propertiesfor a Prologix connection supports the following key-value pairs in the Connections Database and any of the key-value pairs supported byConnectionSerialorConnectionSocket(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
backendvalue must be equal toMSLto 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
dictof all Prologix Controllers that are being used to communicate with GPIB devices.
- selected_addresses = {}
A
dictof 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
strit 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
strit will automatically be encoded.
- property controller
ConnectionSerialorConnectionSocket: 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
ConnectionSerialorConnectionSocketconnection 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
controllerto 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 1before and++auto 0after 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:
dictorNone– If address is valid for a Prologix connection then the key-value pairs are:- class,
ConnectionSocketorConnectionSerial 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
Noneis 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
arpprogram must be installed. On Linux, installnet-tools. On Windows and macOS,arpshould 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.