hvl_ccb.dev package¶
Submodules¶
hvl_ccb.dev.base module¶
Module with base classes for devices.
-
class
hvl_ccb.dev.base.
Device
(dev_config=None)[source]¶ Bases:
hvl_ccb.configuration.ConfigurationMixin
,abc.ABC
Base class for devices. Implement this class for a concrete device, such as measurement equipment or voltage sources.
Specifies the methods to implement for a device.
-
exception
hvl_ccb.dev.base.
DeviceExistingException
[source]¶ Bases:
Exception
Exception to indicate that a device with that name already exists.
-
class
hvl_ccb.dev.base.
DeviceSequenceMixin
(devices: Dict[str, hvl_ccb.dev.base.Device])[source]¶ Bases:
abc.ABC
Mixin that can be used on a device or other classes to provide facilities for handling multiple devices in a sequence.
-
add_device
(name: str, device: hvl_ccb.dev.base.Device) → None[source]¶ Add a new device to the device sequence.
Parameters: - name – is the name of the device.
- device – is the instantiated Device object.
Raises:
-
get_device
(name: str) → hvl_ccb.dev.base.Device[source]¶ Get a device by name.
Parameters: name – is the name of the device. Returns: the device object from this sequence.
-
get_devices
() → List[Tuple[str, hvl_ccb.dev.base.Device]][source]¶ Get list of name, device pairs according to current sequence.
Returns: A list of tuples with name and device each.
-
remove_device
(name: str) → hvl_ccb.dev.base.Device[source]¶ Remove a device from this sequence and return the device object.
Parameters: name – is the name of the device. Returns: device object or None if such device was not in the sequence. Raises: ValueError – when device with given name was not found
-
-
class
hvl_ccb.dev.base.
EmptyConfig
[source]¶ Bases:
object
Empty configuration dataclass that is the default configuration for a Device.
-
clean_values
()¶ Cleans and enforces configuration values. Does nothing by default, but may be overridden to add custom configuration value checks.
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
is_configdataclass
= True¶
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
-
class
hvl_ccb.dev.base.
SingleCommDevice
(com, dev_config=None)[source]¶ Bases:
hvl_ccb.dev.base.Device
,abc.ABC
Base class for devices with a single communication protocol.
-
com
¶ Get the communication protocol of this device.
Returns: an instance of CommunicationProtocol subtype
-
hvl_ccb.dev.crylas module¶
Device classes for a CryLas pulsed laser controller and a CryLas laser attenuator, using serial communication.
There are three modes of operation for the laser 1. Laser-internal hardware trigger (default): fixed to 20 Hz and max energy per pulse. 2. Laser-internal software trigger (for diagnosis only). 3. External trigger: required for arbitrary pulse energy or repetition rate. Switch to “external” on the front panel of laser controller for using option 3.
After switching on the laser with laser_on(), the system must stabilize for some minutes. Do not apply abrupt changes of pulse energy or repetition rate.
Manufacturer homepage: https://www.crylas.de/products/pulsed_laser.html
-
class
hvl_ccb.dev.crylas.
CryLasAttenuator
(com, dev_config=None)[source]¶ Bases:
hvl_ccb.dev.base.SingleCommDevice
Device class for the CryLas laser attenuator.
-
attenuation
¶
-
static
config_cls
()[source]¶ Return the default configdataclass class.
Returns: a reference to the default configdataclass class
-
static
default_com_cls
()[source]¶ Get the class for the default communication protocol used with this device.
Returns: the type of the standard communication protocol for this device
-
set_attenuation
(percent: Union[int, float]) → None[source]¶ Set the percentage of attenuated light (inverse of set_transmission). :param percent: percentage of attenuation, number between 0 and 100 :raises ValueError: if param percent not between 0 and 100 :raises SerialCommunicationIOError: when communication port is not opened :raises CryLasAttenuatorError: if the device does not confirm success
-
set_init_attenuation
()[source]¶ Sets the attenuation to its configured initial/default value
Raises: SerialCommunicationIOError – when communication port is not opened
-
set_transmission
(percent: Union[int, float]) → None[source]¶ Set the percentage of transmitted light (inverse of set_attenuation). :param percent: percentage of transmitted light :raises ValueError: if param percent not between 0 and 100 :raises SerialCommunicationIOError: when communication port is not opened :raises CryLasAttenuatorError: if the device does not confirm success
-
start
() → None[source]¶ Open the com, apply the config value ‘init_attenuation’
Raises: SerialCommunicationIOError – when communication port cannot be opened
-
transmission
¶
-
-
class
hvl_ccb.dev.crylas.
CryLasAttenuatorConfig
(init_attenuation: Union[int, float] = 0, response_sleep_time: Union[int, float] = 1)[source]¶ Bases:
object
Device configuration dataclass for CryLas attenuator.
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
init_attenuation
= 0¶
-
is_configdataclass
= True¶
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
response_sleep_time
= 1¶
-
-
exception
hvl_ccb.dev.crylas.
CryLasAttenuatorError
[source]¶ Bases:
Exception
General error with the CryLas Attenuator.
-
class
hvl_ccb.dev.crylas.
CryLasAttenuatorSerialCommunication
(configuration)[source]¶ Bases:
hvl_ccb.comm.serial.SerialCommunication
Specific communication protocol implementation for the CryLas attenuator. Already predefines device-specific protocol parameters in config.
-
class
hvl_ccb.dev.crylas.
CryLasAttenuatorSerialCommunicationConfig
(port: str, baudrate: int = 9600, parity: Union[str, hvl_ccb.comm.serial.SerialCommunicationParity] = <SerialCommunicationParity.NONE: 'N'>, stopbits: Union[int, hvl_ccb.comm.serial.SerialCommunicationStopbits] = <SerialCommunicationStopbits.ONE: 1>, bytesize: Union[int, hvl_ccb.comm.serial.SerialCommunicationBytesize] = <SerialCommunicationBytesize.EIGHTBITS: 8>, terminator: bytes = b'', timeout: Union[int, float] = 3)[source]¶ Bases:
hvl_ccb.comm.serial.SerialCommunicationConfig
-
baudrate
= 9600¶ Baudrate for CryLas attenuator is 9600 baud
-
bytesize
= 8¶ One byte is eight bits long
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
parity
= 'N'¶ CryLas attenuator does not use parity
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
stopbits
= 1¶ CryLas attenuator uses one stop bit
-
terminator
= b''¶ No terminator
-
timeout
= 3¶ use 3 seconds timeout as default
-
-
class
hvl_ccb.dev.crylas.
CryLasLaser
(com, dev_config=None)[source]¶ Bases:
hvl_ccb.dev.base.SingleCommDevice
CryLas laser controller device class.
-
class
AnswersShutter
(*args, **kwds)[source]¶ Bases:
aenum.Enum
Standard answers of the CryLas laser controller to ‘Shutter’ command passed via com.
-
CLOSED
= 'Shutter inaktiv'¶
-
OPENED
= 'Shutter aktiv'¶
-
-
class
AnswersStatus
(*args, **kwds)[source]¶ Bases:
aenum.Enum
Standard answers of the CryLas laser controller to ‘STATUS’ command passed via com.
-
ACTIVE
= 'STATUS: Laser active'¶
-
HEAD
= 'STATUS: Head ok'¶
-
INACTIVE
= 'STATUS: Laser inactive'¶
-
READY
= 'STATUS: System ready'¶
-
TEC1
= 'STATUS: TEC1 Regulation ok'¶
-
TEC2
= 'STATUS: TEC2 Regulation ok'¶
-
-
class
LaserStatus
(*args, **kwds)[source]¶ Bases:
aenum.Enum
Status of the CryLas laser
-
READY_INACTIVE
= 1¶
-
READ_ACTIVE
= 2¶
-
UNREADY_INACTIVE
= 0¶
-
is_inactive
¶
-
is_ready
¶
-
-
class
RepetitionRates
(*args, **kwds)[source]¶ Bases:
aenum.IntEnum
Repetition rates for the internal software trigger in Hz
-
HARDWARE
= 0¶
-
SOFTWARE_INTERNAL_SIXTY
= 60¶
-
SOFTWARE_INTERNAL_TEN
= 10¶
-
SOFTWARE_INTERNAL_TWENTY
= 20¶
-
-
ShutterStatus
¶ alias of
CryLasLaserShutterStatus
-
close_shutter
() → None[source]¶ Close the laser shutter.
Raises: - SerialCommunicationIOError – when communication port is not opened
- CryLasLaserError – if success is not confirmed by the device
-
static
config_cls
()[source]¶ Return the default configdataclass class.
Returns: a reference to the default configdataclass class
-
static
default_com_cls
()[source]¶ Get the class for the default communication protocol used with this device.
Returns: the type of the standard communication protocol for this device
-
get_pulse_energy_and_rate
() → Tuple[int, int][source]¶ Use the debug mode, return the measured pulse energy and rate.
Returns: (energy in micro joule, rate in Hz)
Raises: - SerialCommunicationIOError – when communication port is not opened
- CryLasLaserError – if the device does not answer the query
-
laser_off
() → None[source]¶ Turn the laser off.
Raises: - SerialCommunicationIOError – when communication port is not opened
- CryLasLaserError – if success is not confirmed by the device
-
laser_on
() → None[source]¶ Turn the laser on.
Raises: - SerialCommunicationIOError – when communication port is not opened
- CryLasLaserNotReadyError – if the laser is not ready to be turned on
- CryLasLaserError – if success is not confirmed by the device
-
open_shutter
() → None[source]¶ Open the laser shutter.
Raises: - SerialCommunicationIOError – when communication port is not opened
- CryLasLaserError – if success is not confirmed by the device
-
set_init_shutter_status
() → None[source]¶ Open or close the shutter, to match the configured shutter_status.
Raises: - SerialCommunicationIOError – when communication port is not opened
- CryLasLaserError – if success is not confirmed by the device
-
set_pulse_energy
(energy: int) → None[source]¶ Sets the energy of pulses (works only with external hardware trigger). Proceed with small energy steps, or the regulation may fail.
Parameters: energy – energy in micro joule
Raises: - SerialCommunicationIOError – when communication port is not opened
- CryLasLaserError – if the device does not confirm success
-
set_repetition_rate
(rate: Union[int, hvl_ccb.dev.crylas.CryLasLaser.RepetitionRates]) → None[source]¶ Sets the repetition rate of the internal software trigger.
Parameters: rate – frequency (Hz) as an integer
Raises: - ValueError – if rate is not an accepted value in RepetitionRates Enum
- SerialCommunicationIOError – when communication port is not opened
- CryLasLaserError – if success is not confirmed by the device
-
start
() → None[source]¶ Opens the communication protocol and configures the device.
Raises: SerialCommunicationIOError – when communication port cannot be opened
-
stop
() → None[source]¶ Stops the device and closes the communication protocol.
Raises: - SerialCommunicationIOError – if com port is closed unexpectedly
- CryLasLaserError – if laser_off() or close_shutter() fail
-
target_pulse_energy
¶
-
update_laser_status
() → None[source]¶ Update the laser status to LaserStatus.NOT_READY or LaserStatus.INACTIVE or LaserStatus.ACTIVE.
Note: laser never explicitly says that it is not ready ( LaserStatus.NOT_READY) in response to ‘STATUS’ command. It only says that it is ready (heated-up and implicitly inactive/off) or active (on). If it’s not either of these then the answer is Answers.HEAD. Moreover, the only time the laser explicitly says that its status is inactive ( Answers.INACTIVE) is after issuing a ‘LASER OFF’ command.
Raises: SerialCommunicationIOError – when communication port is not opened
-
update_repetition_rate
() → None[source]¶ Query the laser repetition rate.
Raises: - SerialCommunicationIOError – when communication port is not opened
- CryLasLaserError – if success is not confirmed by the device
-
update_shutter_status
() → None[source]¶ Update the shutter status (OPENED or CLOSED)
Raises: - SerialCommunicationIOError – when communication port is not opened
- CryLasLaserError – if success is not confirmed by the device
-
update_target_pulse_energy
() → None[source]¶ Query the laser pulse energy.
Raises: - SerialCommunicationIOError – when communication port is not opened
- CryLasLaserError – if success is not confirmed by the device
-
wait_until_ready
() → None[source]¶ Block execution until the laser is ready
Raises: CryLasLaserError – if the polling thread stops before the laser is ready
-
class
-
class
hvl_ccb.dev.crylas.
CryLasLaserConfig
(calibration_factor: Union[int, float] = 4.35, polling_period: Union[int, float] = 5, polling_timeout: Union[int, float] = 300, on_start_wait_until_ready: bool = False, auto_laser_on: bool = True, init_shutter_status: Union[int, hvl_ccb.dev.crylas.CryLasLaserShutterStatus] = <CryLasLaserShutterStatus.CLOSED: 0>)[source]¶ Bases:
object
Device configuration dataclass for the CryLas laser controller.
-
ShutterStatus
¶ alias of
CryLasLaserShutterStatus
-
auto_laser_on
= True¶
-
calibration_factor
= 4.35¶
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
init_shutter_status
= 0¶
-
is_configdataclass
= True¶
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
on_start_wait_until_ready
= False¶
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
polling_period
= 5¶
-
polling_timeout
= 300¶
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
-
exception
hvl_ccb.dev.crylas.
CryLasLaserError
[source]¶ Bases:
Exception
General error with the CryLas Laser.
-
exception
hvl_ccb.dev.crylas.
CryLasLaserNotReadyError
[source]¶ Bases:
hvl_ccb.dev.crylas.CryLasLaserError
Error when trying to turn on the CryLas Laser before it is ready.
-
class
hvl_ccb.dev.crylas.
CryLasLaserSerialCommunication
(configuration)[source]¶ Bases:
hvl_ccb.comm.serial.SerialCommunication
Specific communication protocol implementation for the CryLas laser controller. Already predefines device-specific protocol parameters in config.
-
READ_TEXT_SKIP_PREFIXES
= ('>', 'MODE:')¶ Prefixes of lines that are skipped when read from the serial port.
-
static
config_cls
()[source]¶ Return the default configdataclass class.
Returns: a reference to the default configdataclass class
-
query
(cmd: str, prefix: str, post_cmd: str = None) → str[source]¶ Send a command, then read the com until a line starting with prefix, or an empty line, is found. Returns the line in question.
Parameters: - cmd – query message to send to the device
- prefix – start of the line to look for in the device answer
- post_cmd – optional additional command to send after the query
Returns: line in question as a string
Raises: SerialCommunicationIOError – when communication port is not opened
-
query_all
(cmd: str, prefix: str)[source]¶ Send a command, then read the com until a line starting with prefix, or an empty line, is found. Returns a list of successive lines starting with prefix.
Parameters: - cmd – query message to send to the device
- prefix – start of the line to look for in the device answer
Returns: line in question as a string
Raises: SerialCommunicationIOError – when communication port is not opened
-
read_text
() → str[source]¶ Read first line of text from the serial port that does not start with any of self.READ_TEXT_SKIP_PREFIXES.
Returns: String read from the serial port; ‘’ if there was nothing to read. Raises: SerialCommunicationIOError – when communication port is not opened
-
-
class
hvl_ccb.dev.crylas.
CryLasLaserSerialCommunicationConfig
(port: str, baudrate: int = 19200, parity: Union[str, hvl_ccb.comm.serial.SerialCommunicationParity] = <SerialCommunicationParity.NONE: 'N'>, stopbits: Union[int, hvl_ccb.comm.serial.SerialCommunicationStopbits] = <SerialCommunicationStopbits.ONE: 1>, bytesize: Union[int, hvl_ccb.comm.serial.SerialCommunicationBytesize] = <SerialCommunicationBytesize.EIGHTBITS: 8>, terminator: bytes = b'n', timeout: Union[int, float] = 3)[source]¶ Bases:
hvl_ccb.comm.serial.SerialCommunicationConfig
-
baudrate
= 19200¶ Baudrate for CryLas laser is 19200 baud
-
bytesize
= 8¶ One byte is eight bits long
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
parity
= 'N'¶ CryLas laser does not use parity
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
stopbits
= 1¶ CryLas laser uses one stop bit
-
terminator
= b'\n'¶ The terminator is LF
-
timeout
= 3¶ use 3 seconds timeout as default
-
hvl_ccb.dev.ea_psi9000 module¶
Device class for controlling a Elektro Automatik PSI 9000 power supply over VISA.
It is necessary that a backend for pyvisa is installed. This can be NI-Visa oder pyvisa-py (up to know, all the testing was done with NI-Visa)
-
class
hvl_ccb.dev.ea_psi9000.
PSI9000
(com: Union[hvl_ccb.dev.ea_psi9000.PSI9000VisaCommunication, hvl_ccb.dev.ea_psi9000.PSI9000VisaCommunicationConfig, dict], dev_config: Union[hvl_ccb.dev.ea_psi9000.PSI9000Config, dict, None] = None)[source]¶ Bases:
hvl_ccb.dev.visa.VisaDevice
Elektro Automatik PSI 9000 power supply.
-
MS_NOMINAL_CURRENT
= 2040¶
-
MS_NOMINAL_VOLTAGE
= 80¶
-
SHUTDOWN_CURRENT_LIMIT
= 0.1¶
-
SHUTDOWN_VOLTAGE_LIMIT
= 0.1¶
-
check_master_slave_config
() → None[source]¶ Checks if the master / slave configuration and initializes if successful
Raises: PSI9000Error – if master-slave configuration failed
-
static
config_cls
()[source]¶ Return the default configdataclass class.
Returns: a reference to the default configdataclass class
-
static
default_com_cls
()[source]¶ Return the default communication protocol for this device type, which is VisaCommunication.
Returns: the VisaCommunication class
-
get_output
() → bool[source]¶ Reads the current state of the DC output of the source. Returns True, if it is enabled, false otherwise.
Returns: the state of the DC output
-
get_system_lock
() → bool[source]¶ Get the current lock state of the system. The lock state is true, if the remote control is active and false, if not.
Returns: the current lock state of the device
-
get_ui_lower_limits
() → Tuple[float, float][source]¶ Get the lower voltage and current limits. A lower power limit does not exist.
Returns: Umin in V, Imin in A
-
get_uip_upper_limits
() → Tuple[float, float, float][source]¶ Get the upper voltage, current and power limits.
Returns: Umax in V, Imax in A, Pmax in W
-
get_voltage_current_setpoint
() → Tuple[float, float][source]¶ Get the voltage and current setpoint of the current source.
Returns: Uset in V, Iset in A
-
measure_voltage_current
() → Tuple[float, float][source]¶ Measure the DC output voltage and current
Returns: Umeas in V, Imeas in A
-
set_lower_limits
(voltage_limit: float = None, current_limit: float = None) → None[source]¶ Set the lower limits for voltage and current. After writing the values a check is performed if the values are set correctly.
Parameters: - voltage_limit – is the lower voltage limit in V
- current_limit – is the lower current limit in A
Raises: PSI9000Error – if the limits are out of range
-
set_output
(target_onstate: bool) → None[source]¶ Enables / disables the DC output.
Parameters: target_onstate – enable or disable the output power Raises: PSI9000Error – if operation was not successful
-
set_system_lock
(lock: bool) → None[source]¶ Lock / unlock the device, after locking the control is limited to this class unlocking only possible when voltage and current are below the defined limits
Parameters: lock – True: locking, False: unlocking
-
set_upper_limits
(voltage_limit: float = None, current_limit: float = None, power_limit: float = None) → None[source]¶ Set the upper limits for voltage, current and power. After writing the values a check is performed if the values are set. If a parameter is left blank, the maximum configurable limit is set.
Parameters: - voltage_limit – is the voltage limit in V
- current_limit – is the current limit in A
- power_limit – is the power limit in W
Raises: PSI9000Error – if limits are out of range
-
set_voltage_current
(volt: float, current: float) → None[source]¶ Set voltage and current setpoints.
After setting voltage and current, a check is performed if writing was successful.
Parameters: - volt – is the setpoint voltage: 0..81.6 V (1.02 * 0-80 V) (absolute max, can be smaller if limits are set)
- current – is the setpoint current: 0..2080.8 A (1.02 * 0 - 2040 A) (absolute max, can be smaller if limits are set)
Raises: PSI9000Error – if the desired setpoint is out of limits
-
-
class
hvl_ccb.dev.ea_psi9000.
PSI9000Config
(spoll_interval: Union[int, float] = 0.5, spoll_start_delay: Union[int, float] = 2, power_limit: Union[int, float] = 43500, voltage_lower_limit: Union[int, float] = 0.0, voltage_upper_limit: Union[int, float] = 10.0, current_lower_limit: Union[int, float] = 0.0, current_upper_limit: Union[int, float] = 2040.0, wait_sec_system_lock: Union[int, float] = 0.5, wait_sec_settings_effect: Union[int, float] = 1, wait_sec_initialisation: Union[int, float] = 2)[source]¶ Bases:
hvl_ccb.dev.visa.VisaDeviceConfig
Elektro Automatik PSI 9000 power supply device class. The device is communicating over a VISA TCP socket.
Using this power supply, DC voltage and current can be supplied to a load with up to 2040 A and 80 V (using all four available units in parallel). The maximum power is limited by the grid, being at 43.5 kW available through the CEE63 power socket.
-
clean_values
() → None[source]¶ Cleans and enforces configuration values. Does nothing by default, but may be overridden to add custom configuration value checks.
-
current_lower_limit
= 0.0¶ Lower current limit in A, depending on the experimental setup.
-
current_upper_limit
= 2040.0¶ Upper current limit in A, depending on the experimental setup.
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
power_limit
= 43500¶ Power limit in W depending on the experimental setup. With 3x63A, this is 43.5kW. Do not change this value, if you do not know what you are doing. There is no lower power limit.
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
voltage_lower_limit
= 0.0¶ Lower voltage limit in V, depending on the experimental setup.
-
voltage_upper_limit
= 10.0¶ Upper voltage limit in V, depending on the experimental setup.
-
wait_sec_initialisation
= 2¶
-
wait_sec_settings_effect
= 1¶
-
wait_sec_system_lock
= 0.5¶
-
-
exception
hvl_ccb.dev.ea_psi9000.
PSI9000Error
[source]¶ Bases:
Exception
Base error class regarding problems with the PSI 9000 supply.
-
class
hvl_ccb.dev.ea_psi9000.
PSI9000VisaCommunication
(configuration)[source]¶ Bases:
hvl_ccb.comm.visa.VisaCommunication
Communication protocol used with the PSI 9000 power supply.
-
class
hvl_ccb.dev.ea_psi9000.
PSI9000VisaCommunicationConfig
(host: str, interface_type: Union[str, hvl_ccb.comm.visa.VisaCommunicationConfig.InterfaceType] = <InterfaceType.TCPIP_SOCKET: 1>, board: int = 0, port: int = 5025, timeout: int = 5000, chunk_size: int = 204800, open_timeout: int = 1000, write_termination: str = 'n', read_termination: str = 'n', visa_backend: str = '')[source]¶ Bases:
hvl_ccb.comm.visa.VisaCommunicationConfig
Visa communication protocol config dataclass with specification for the PSI 9000 power supply.
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
interface_type
= 1¶
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
hvl_ccb.dev.heinzinger module¶
Device classes for Heinzinger Digital Interface I/II and Heinzinger PNC power supply.
The Heinzinger Digital Interface I/II is used for many Heinzinger power units. Manufacturer homepage: https://www.heinzinger.com/products/accessories-and-more/digital-interfaces/
The Heinzinger PNC series is a series of high voltage direct current power supplies. The class HeinzingerPNC is tested with two PNChp 60000-1neg and a PNChp 1500-1neg. Check the code carefully before using it with other PNC devices, especially PNC3p or PNCcap. Manufacturer homepage: https://www.heinzinger.com/products/high-voltage/universal-high-voltage-power-supplies/
-
class
hvl_ccb.dev.heinzinger.
HeinzingerConfig
(default_number_of_recordings: Union[int, hvl_ccb.dev.heinzinger.HeinzingerConfig.RecordingsEnum] = 1, number_of_decimals: int = 6, wait_sec_stop_commands: Union[int, float] = 0.5)[source]¶ Bases:
object
Device configuration dataclass for Heinzinger power supplies.
-
class
RecordingsEnum
[source]¶ Bases:
enum.IntEnum
An enumeration.
-
EIGHT
= 8¶
-
FOUR
= 4¶
-
ONE
= 1¶
-
SIXTEEN
= 16¶
-
TWO
= 2¶
-
-
default_number_of_recordings
= 1¶
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
is_configdataclass
= True¶
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
number_of_decimals
= 6¶
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
wait_sec_stop_commands
= 0.5¶ Time to wait after subsequent commands during stop (in seconds)
-
class
-
class
hvl_ccb.dev.heinzinger.
HeinzingerDI
(com, dev_config=None)[source]¶ Bases:
hvl_ccb.dev.base.SingleCommDevice
,abc.ABC
Heinzinger Digital Interface I/II device class
Sends basic SCPI commands and reads the answer. Only the standard instruction set from the manual is implemented.
-
static
config_cls
()[source]¶ Return the default configdataclass class.
Returns: a reference to the default configdataclass class
-
static
default_com_cls
()[source]¶ Get the class for the default communication protocol used with this device.
Returns: the type of the standard communication protocol for this device
-
get_current
() → float[source]¶ Queries the set current of the Heinzinger PNC (not the measured current!).
Raises: SerialCommunicationIOError – when communication port is not opened
-
get_interface_version
() → str[source]¶ Queries the version number of the digital interface.
Raises: SerialCommunicationIOError – when communication port is not opened
-
get_number_of_recordings
() → int[source]¶ Queries the number of recordings the device is using for average value calculation.
Returns: int number of recordings Raises: SerialCommunicationIOError – when communication port is not opened
-
get_serial_number
() → str[source]¶ Ask the device for its serial number and returns the answer as a string.
Returns: string containing the device serial number Raises: SerialCommunicationIOError – when communication port is not opened
-
get_voltage
() → float[source]¶ Queries the set voltage of the Heinzinger PNC (not the measured voltage!).
Raises: SerialCommunicationIOError – when communication port is not opened
-
measure_current
() → float[source]¶ Ask the Device to measure its output current and return the measurement result.
Returns: measured current as float Raises: SerialCommunicationIOError – when communication port is not opened
-
measure_voltage
() → float[source]¶ Ask the Device to measure its output voltage and return the measurement result.
Returns: measured voltage as float Raises: SerialCommunicationIOError – when communication port is not opened
-
output_off
() → None[source]¶ Switch DC voltage output off.
Raises: SerialCommunicationIOError – when communication port is not opened
-
output_on
() → None[source]¶ Switch DC voltage output on.
Raises: SerialCommunicationIOError – when communication port is not opened
-
reset_interface
() → None[source]¶ Reset of the digital interface; only Digital Interface I: Power supply is switched to the Local-Mode (Manual operation)
Raises: SerialCommunicationIOError – when communication port is not opened
-
set_current
(value: Union[int, float]) → None[source]¶ Sets the output current of the Heinzinger PNC to the given value.
Parameters: value – current expressed in self.unit_current Raises: SerialCommunicationIOError – when communication port is not opened
-
set_number_of_recordings
(value: Union[int, hvl_ccb.dev.heinzinger.HeinzingerConfig.RecordingsEnum]) → None[source]¶ Sets the number of recordings the device is using for average value calculation. The possible values are 1, 2, 4, 8 and 16.
Raises: SerialCommunicationIOError – when communication port is not opened
-
set_voltage
(value: Union[int, float]) → None[source]¶ Sets the output voltage of the Heinzinger PNC to the given value.
Parameters: value – voltage expressed in self.unit_voltage Raises: SerialCommunicationIOError – when communication port is not opened
-
start
()[source]¶ Opens the communication protocol.
Raises: SerialCommunicationIOError – when communication port cannot be opened.
-
static
-
class
hvl_ccb.dev.heinzinger.
HeinzingerPNC
(com, dev_config=None)[source]¶ Bases:
hvl_ccb.dev.heinzinger.HeinzingerDI
Heinzinger PNC power supply device class.
The power supply is controlled over a Heinzinger Digital Interface I/II
-
class
UnitCurrent
(*args, **kwds)[source]¶ Bases:
hvl_ccb.utils.enum.AutoNumberNameEnum
-
A
= 3¶
-
UNKNOWN
= 1¶
-
mA
= 2¶
-
-
class
UnitVoltage
(*args, **kwds)[source]¶ Bases:
hvl_ccb.utils.enum.AutoNumberNameEnum
-
UNKNOWN
= 1¶
-
V
= 2¶
-
kV
= 3¶
-
-
identify_device
() → None[source]¶ Identify the device nominal voltage and current based on its serial number.
Raises: SerialCommunicationIOError – when communication port is not opened
-
max_current
¶
-
max_current_hardware
¶
-
max_voltage
¶
-
max_voltage_hardware
¶
-
set_current
(value: Union[int, float]) → None[source]¶ Sets the output current of the Heinzinger PNC to the given value.
Parameters: value – current expressed in self.unit_current Raises: SerialCommunicationIOError – when communication port is not opened
-
set_voltage
(value: Union[int, float]) → None[source]¶ Sets the output voltage of the Heinzinger PNC to the given value.
Parameters: value – voltage expressed in self.unit_voltage Raises: SerialCommunicationIOError – when communication port is not opened
-
unit_current
¶
-
unit_voltage
¶
-
class
-
exception
hvl_ccb.dev.heinzinger.
HeinzingerPNCDeviceNotRecognizedException
[source]¶ Bases:
hvl_ccb.dev.heinzinger.HeinzingerPNCError
Error indicating that the serial number of the device is not recognized.
-
exception
hvl_ccb.dev.heinzinger.
HeinzingerPNCError
[source]¶ Bases:
Exception
General error with the Heinzinger PNC voltage source.
-
exception
hvl_ccb.dev.heinzinger.
HeinzingerPNCMaxCurrentExceededException
[source]¶ Bases:
hvl_ccb.dev.heinzinger.HeinzingerPNCError
Error indicating that program attempted to set the current to a value exceeding ‘max_current’.
-
exception
hvl_ccb.dev.heinzinger.
HeinzingerPNCMaxVoltageExceededException
[source]¶ Bases:
hvl_ccb.dev.heinzinger.HeinzingerPNCError
Error indicating that program attempted to set the voltage to a value exceeding ‘max_voltage’.
-
class
hvl_ccb.dev.heinzinger.
HeinzingerSerialCommunication
(configuration)[source]¶ Bases:
hvl_ccb.comm.serial.SerialCommunication
Specific communication protocol implementation for Heinzinger power supplies. Already predefines device-specific protocol parameters in config.
-
static
config_cls
()[source]¶ Return the default configdataclass class.
Returns: a reference to the default configdataclass class
-
read_text_nonempty
(n_attempts_max: int = 40) → str[source]¶ Reads from the serial port, until a non-empty line is found, or the number of attempts is exceeded.
Parameters: - n_attempts_max – maximum number of read attempts
- attempt_interval_sec – interval between subsequent attempts in seconds
Returns: String read from the serial port; ‘’ if number of attempts is exceeded or serial port is not opened.
-
static
-
class
hvl_ccb.dev.heinzinger.
HeinzingerSerialCommunicationConfig
(port: str, baudrate: int = 9600, parity: Union[str, hvl_ccb.comm.serial.SerialCommunicationParity] = <SerialCommunicationParity.NONE: 'N'>, stopbits: Union[int, hvl_ccb.comm.serial.SerialCommunicationStopbits] = <SerialCommunicationStopbits.ONE: 1>, bytesize: Union[int, hvl_ccb.comm.serial.SerialCommunicationBytesize] = <SerialCommunicationBytesize.EIGHTBITS: 8>, terminator: bytes = b'n', timeout: Union[int, float] = 3, wait_sec_read_text_nonempty: Union[int, float] = 0.5)[source]¶ Bases:
hvl_ccb.comm.serial.SerialCommunicationConfig
-
baudrate
= 9600¶ Baudrate for Heinzinger power supplies is 9600 baud
-
bytesize
= 8¶ One byte is eight bits long
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
parity
= 'N'¶ Heinzinger does not use parity
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
stopbits
= 1¶ Heinzinger uses one stop bit
-
terminator
= b'\n'¶ The terminator is LF
-
timeout
= 3¶ use 3 seconds timeout as default
-
wait_sec_read_text_nonempty
= 0.5¶ time to wait between attempts of reading a non-empty text
-
hvl_ccb.dev.labjack module¶
Labjack Device for hvl_ccb. Originally developed and tested for LabJack T7-PRO.
Makes use of the LabJack LJM Library Python wrapper. This wrapper needs an installation of the LJM Library for Windows, Mac OS X or Linux. Go to: https://labjack.com/support/software/installers/ljm and https://labjack.com/support/software/examples/ljm/python
-
class
hvl_ccb.dev.labjack.
LabJack
(com, dev_config=None)[source]¶ Bases:
hvl_ccb.dev.base.SingleCommDevice
LabJack Device.
This class is tested with a LabJack T7-Pro and should also work with T4 and T7 devices communicating through the LJM Library. Other or older hardware versions and variants of LabJack devices are not supported.
-
class
AInRange
(*args, **kwds)[source]¶ Bases:
hvl_ccb.utils.enum.StrEnumBase
-
ONE
= 1.0¶
-
ONE_HUNDREDTH
= 0.01¶
-
ONE_TENTH
= 0.1¶
-
TEN
= 10.0¶
-
value
¶
-
-
class
CalMicroAmpere
(*args, **kwds)[source]¶ Bases:
aenum.Enum
Pre-defined microampere (uA) values for calibration current source query.
-
TEN
= '10uA'¶
-
TWO_HUNDRED
= '200uA'¶
-
-
class
CjcType
(*args, **kwds)[source]¶ Bases:
hvl_ccb.utils.enum.NameEnum
CJC slope and offset
-
internal
= (1, 0)¶
-
lm34
= (55.56, 255.37)¶
-
-
DIOChannel
¶ alias of
hvl_ccb._dev.labjack.TSeriesDIOChannel
-
class
DIOStatus
(*args, **kwds)[source]¶ Bases:
aenum.IntEnum
State of a digital I/O channel.
-
HIGH
= 1¶
-
LOW
= 0¶
-
-
class
DeviceType
(*args, **kwds)¶ Bases:
hvl_ccb.utils.enum.AutoNumberNameEnum
LabJack device types.
Can be also looked up by ambigious Product ID (p_id) or by instance name:
`python LabJackDeviceType(4) is LabJackDeviceType('T4') `
-
ANY
= 1¶
-
T4
= 2¶
-
T7
= 3¶
-
T7_PRO
= 4¶
-
get_by_p_id
= <bound method DeviceType.get_by_p_id of <aenum 'DeviceType'>>¶
-
-
class
TemperatureUnit
(*args, **kwds)[source]¶ Bases:
hvl_ccb.utils.enum.NameEnum
Temperature unit (to be returned)
-
C
= 1¶
-
F
= 2¶
-
K
= 0¶
-
-
class
ThermocoupleType
(*args, **kwds)[source]¶ Bases:
hvl_ccb.utils.enum.NameEnum
Thermocouple type; NONE means disable thermocouple mode.
-
C
= 30¶
-
E
= 20¶
-
J
= 21¶
-
K
= 22¶
-
NONE
= 0¶
-
PT100
= 40¶
-
PT1000
= 42¶
-
PT500
= 41¶
-
R
= 23¶
-
S
= 25¶
-
T
= 24¶
-
-
static
default_com_cls
()[source]¶ Get the class for the default communication protocol used with this device.
Returns: the type of the standard communication protocol for this device
-
get_ain
(*channels) → Union[float, Sequence[float]][source]¶ Read currently measured value (voltage, resistance, …) from one or more of analog inputs.
Parameters: channels – AIN number or numbers (0..254) Returns: the read value (voltage, resistance, …) as float`or `tuple of them in case multiple channels given
-
get_cal_current_source
(name: Union[str, CalMicroAmpere]) → float[source]¶ This function will return the calibration of the chosen current source, this ist not a measurement!
The value was stored during fabrication.
Parameters: name – ‘200uA’ or ‘10uA’ current source Returns: calibration of the chosen current source in ampere
-
get_digital_input
(address: Union[str, hvl_ccb._dev.labjack.TSeriesDIOChannel]) → hvl_ccb.dev.labjack.LabJack.DIOStatus[source]¶ Get the value of a digital input.
allowed names for T7 (Pro): FIO0 - FIO7, EIO0 - EIO 7, CIO0- CIO3, MIO0 - MIO2 :param address: name of the output -> ‘FIO0’ :return: HIGH when address DIO is high, and LOW when address DIO is low
-
get_product_id
() → int[source]¶ This function returns the product ID reported by the connected device.
Attention: returns 7 for both T7 and T7-Pro devices!
Returns: integer product ID of the device
-
get_product_name
(force_query_id=False) → str[source]¶ This function will return the product name based on product ID reported by the device.
Attention: returns “T7” for both T7 and T7-Pro devices!
Parameters: force_query_id – boolean flag to force get_product_id query to device instead of using cached device type from previous queries. Returns: device name string, compatible with LabJack.DeviceType
-
get_product_type
(force_query_id: bool = False) → hvl_ccb._dev.labjack.DeviceType[source]¶ This function will return the device type based on reported device type and in case of unambiguity based on configuration of device’s communication protocol (e.g. for “T7” and “T7_PRO” devices), or, if not available first matching.
Parameters: force_query_id – boolean flag to force get_product_id query to device instead of using cached device type from previous queries. Returns: DeviceType instance Raises: LabJackIdentifierDIOError – when read Product ID is unknown
-
get_sbus_rh
(number: int) → float[source]¶ Read the relative humidity value from a serial SBUS sensor.
Parameters: number – port number (0..22) Returns: relative humidity in %RH
-
get_sbus_temp
(number: int) → float[source]¶ Read the temperature value from a serial SBUS sensor.
Parameters: number – port number (0..22) Returns: temperature in Kelvin
-
get_serial_number
() → int[source]¶ Returns the serial number of the connected LabJack.
Returns: Serial number.
-
read_resistance
(channel: int) → float[source]¶ Read resistance from specified channel.
Parameters: channel – channel with resistor Returns: resistance value with 2 decimal places
-
read_thermocouple
(pos_channel: int) → float[source]¶ Read the temperature of a connected thermocouple.
Parameters: pos_channel – is the AIN number of the positive pin Returns: temperature in specified unit
-
set_ain_differential
(pos_channel: int, differential: bool) → None[source]¶ Sets an analog input to differential mode or not. T7-specific: For base differential channels, positive must be even channel from 0-12 and negative must be positive+1. For extended channels 16-127, see Mux80 datasheet.
Parameters: - pos_channel – is the AIN number (0..12)
- differential – True or False
Raises: LabJackError – if parameters are unsupported
-
set_ain_range
(channel: int, vrange: Union[Real, AInRange]) → None[source]¶ Set the range of an analog input port.
Parameters: - channel – is the AIN number (0..254)
- vrange – is the voltage range to be set
-
set_ain_resistance
(channel: int, vrange: Union[Real, AInRange], resolution: int) → None[source]¶ Set the specified channel to resistance mode. It utilized the 200uA current source of the LabJack.
Parameters: - channel – channel that should measure the resistance
- vrange – voltage range of the channel
- resolution – resolution index of the channel T4: 0-5, T7: 0-8, T7-Pro 0-12
-
set_ain_resolution
(channel: int, resolution: int) → None[source]¶ Set the resolution index of an analog input port.
Parameters: - channel – is the AIN number (0..254)
- resolution – is the resolution index within 0…`get_product_type().ain_max_resolution` range; 0 will set the resolution index to default value.
-
set_ain_thermocouple
(pos_channel: int, thermocouple: Union[None, str, ThermocoupleType], cjc_address: int = 60050, cjc_type: Union[str, CjcType] = <CjcType.internal: (1, 0)>, vrange: Union[Real, AInRange] = <AInRange.ONE_HUNDREDTH: '0.01'>, resolution: int = 10, unit: Union[str, TemperatureUnit] = <TemperatureUnit.K: 0>) → None[source]¶ Set the analog input channel to thermocouple mode.
Parameters: - pos_channel – is the analog input channel of the positive part of the differential pair
- thermocouple – None to disable thermocouple mode, or string specifying the thermocouple type
- cjc_address – modbus register address to read the CJC temperature
- cjc_type – determines cjc slope and offset, ‘internal’ or ‘lm34’
- vrange – measurement voltage range
- resolution – resolution index (T7-Pro: 0-12)
- unit – is the temperature unit to be returned (‘K’, ‘C’ or ‘F’)
Raises: LabJackError – if parameters are unsupported
-
class
hvl_ccb.dev.mbw973 module¶
Device class for controlling a MBW 973 SF6 Analyzer over a serial connection.
The MBW 973 is a gas analyzer designed for gas insulated switchgear and measures humidity, SF6 purity and SO2 contamination in one go. Manufacturer homepage: https://www.mbw.ch/products/sf6-gas-analysis/973-sf6-analyzer/
-
class
hvl_ccb.dev.mbw973.
MBW973
(com, dev_config=None)[source]¶ Bases:
hvl_ccb.dev.base.SingleCommDevice
MBW 973 dew point mirror device class.
-
static
config_cls
()[source]¶ Return the default configdataclass class.
Returns: a reference to the default configdataclass class
-
static
default_com_cls
()[source]¶ Get the class for the default communication protocol used with this device.
Returns: the type of the standard communication protocol for this device
-
is_done
() → bool[source]¶ Poll status of the dew point mirror and return True, if all measurements are done.
Returns: True, if all measurements are done; False otherwise. Raises: SerialCommunicationIOError – when communication port is not opened
-
read
(cast_type: Type[CT_co] = <class 'str'>)[source]¶ Read value from self.com and cast to cast_type. Raises ValueError if read text (str) is not convertible to cast_type, e.g. to float or to int.
Returns: Read value of cast_type type.
-
read_float
() → float[source]¶ Convenience wrapper for self.read(), with typing hint for return value.
Returns: Read float value.
-
read_int
() → int[source]¶ Convenience wrapper for self.read(), with typing hint for return value.
Returns: Read int value.
-
read_measurements
() → Dict[str, float][source]¶ Read out measurement values and return them as a dictionary.
Returns: Dictionary with values. Raises: SerialCommunicationIOError – when communication port is not opened
-
set_measuring_options
(humidity: bool = True, sf6_purity: bool = False) → None[source]¶ Send measuring options to the dew point mirror.
Parameters: - humidity – Perform humidity test or not?
- sf6_purity – Perform SF6 purity test or not?
Raises: SerialCommunicationIOError – when communication port is not opened
-
start
() → None[source]¶ Start this device. Opens the communication protocol and retrieves the set measurement options from the device.
Raises: SerialCommunicationIOError – when communication port cannot be opened.
-
start_control
() → None[source]¶ Start dew point control to acquire a new value set.
Raises: SerialCommunicationIOError – when communication port is not opened
-
write
(value) → None[source]¶ Send value to self.com.
Parameters: value – Value to send, converted to str. Raises: SerialCommunicationIOError – when communication port is not opened
-
static
-
class
hvl_ccb.dev.mbw973.
MBW973Config
(polling_interval: Union[int, float] = 2)[source]¶ Bases:
object
Device configuration dataclass for MBW973.
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
is_configdataclass
= True¶
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
polling_interval
= 2¶ Polling period for is_done status queries [in seconds].
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
-
exception
hvl_ccb.dev.mbw973.
MBW973ControlRunningException
[source]¶ Bases:
hvl_ccb.dev.mbw973.MBW973Error
Error indicating there is still a measurement running, and a new one cannot be started.
-
exception
hvl_ccb.dev.mbw973.
MBW973Error
[source]¶ Bases:
Exception
General error with the MBW973 dew point mirror device.
-
exception
hvl_ccb.dev.mbw973.
MBW973PumpRunningException
[source]¶ Bases:
hvl_ccb.dev.mbw973.MBW973Error
Error indicating the pump of the dew point mirror is still recovering gas, unable to start a new measurement.
-
class
hvl_ccb.dev.mbw973.
MBW973SerialCommunication
(configuration)[source]¶ Bases:
hvl_ccb.comm.serial.SerialCommunication
Specific communication protocol implementation for the MBW973 dew point mirror. Already predefines device-specific protocol parameters in config.
-
class
hvl_ccb.dev.mbw973.
MBW973SerialCommunicationConfig
(port: str, baudrate: int = 9600, parity: Union[str, hvl_ccb.comm.serial.SerialCommunicationParity] = <SerialCommunicationParity.NONE: 'N'>, stopbits: Union[int, hvl_ccb.comm.serial.SerialCommunicationStopbits] = <SerialCommunicationStopbits.ONE: 1>, bytesize: Union[int, hvl_ccb.comm.serial.SerialCommunicationBytesize] = <SerialCommunicationBytesize.EIGHTBITS: 8>, terminator: bytes = b'r', timeout: Union[int, float] = 3)[source]¶ Bases:
hvl_ccb.comm.serial.SerialCommunicationConfig
-
baudrate
= 9600¶ Baudrate for MBW973 is 9600 baud
-
bytesize
= 8¶ One byte is eight bits long
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
parity
= 'N'¶ MBW973 does not use parity
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
stopbits
= 1¶ MBW973 does use one stop bit
-
terminator
= b'\r'¶ The terminator is only CR
-
timeout
= 3¶ use 3 seconds timeout as default
-
hvl_ccb.dev.newport module¶
Device class for Newport SMC100PP stepper motor controller with serial communication.
The SMC100PP is a single axis motion controller/driver for stepper motors up to 48 VDC at 1.5 A rms. Up to 31 controllers can be networked through the internal RS-485 communication link.
Manufacturer homepage: https://www.newport.com/f/smc100-single-axis-dc-or-stepper-motion-controller
-
class
hvl_ccb.dev.newport.
NewportConfigCommands
(*args, **kwds)[source]¶ Bases:
hvl_ccb.utils.enum.NameEnum
Commands predefined by the communication protocol of the SMC100PP
-
AC
= 'acceleration'¶
-
BA
= 'backlash_compensation'¶
-
BH
= 'hysteresis_compensation'¶
-
FRM
= 'micro_step_per_full_step_factor'¶
-
FRS
= 'motion_distance_per_full_step'¶
-
HT
= 'home_search_type'¶
-
JR
= 'jerk_time'¶
-
OH
= 'home_search_velocity'¶
-
OT
= 'home_search_timeout'¶
-
QIL
= 'peak_output_current_limit'¶
-
SA
= 'rs485_address'¶
-
SL
= 'negative_software_limit'¶
-
SR
= 'positive_software_limit'¶
-
VA
= 'velocity'¶
-
VB
= 'base_velocity'¶
-
ZX
= 'stage_configuration'¶
-
-
exception
hvl_ccb.dev.newport.
NewportControllerError
[source]¶ Bases:
Exception
Error with the Newport controller.
-
exception
hvl_ccb.dev.newport.
NewportMotorError
[source]¶ Bases:
Exception
Error with the Newport motor.
-
class
hvl_ccb.dev.newport.
NewportSMC100PP
(com, dev_config=None)[source]¶ Bases:
hvl_ccb.dev.base.SingleCommDevice
Device class of the Newport motor controller SMC100PP
-
class
MotorErrors
(*args, **kwds)[source]¶ Bases:
aenum.Enum
Possible motor errors reported by the motor during get_state().
-
DC_VOLTAGE_TOO_LOW
= 3¶
-
FOLLOWING_ERROR
= 6¶
-
HOMING_TIMEOUT
= 5¶
-
NED_END_OF_TURN
= 11¶
-
OUTPUT_POWER_EXCEEDED
= 2¶
-
PEAK_CURRENT_LIMIT
= 9¶
-
POS_END_OF_TURN
= 10¶
-
RMS_CURRENT_LIMIT
= 8¶
-
SHORT_CIRCUIT
= 7¶
-
WRONG_ESP_STAGE
= 4¶
-
-
class
StateMessages
(*args, **kwds)[source]¶ Bases:
aenum.Enum
Possible messages returned by the controller on get_state() query.
-
CONFIG
= '14'¶
-
DISABLE_FROM_JOGGING
= '3E'¶
-
DISABLE_FROM_MOVING
= '3D'¶
-
DISABLE_FROM_READY
= '3C'¶
-
HOMING_FROM_RS232
= '1E'¶
-
HOMING_FROM_SMC
= '1F'¶
-
JOGGING_FROM_DISABLE
= '47'¶
-
JOGGING_FROM_READY
= '46'¶
-
MOVING
= '28'¶
-
NO_REF_ESP_STAGE_ERROR
= '10'¶
-
NO_REF_FROM_CONFIG
= '0C'¶
-
NO_REF_FROM_DISABLED
= '0D'¶
-
NO_REF_FROM_HOMING
= '0B'¶
-
NO_REF_FROM_JOGGING
= '11'¶
-
NO_REF_FROM_MOVING
= '0F'¶
-
NO_REF_FROM_READY
= '0E'¶
-
NO_REF_FROM_RESET
= '0A'¶
-
READY_FROM_DISABLE
= '34'¶
-
READY_FROM_HOMING
= '32'¶
-
READY_FROM_JOGGING
= '35'¶
-
READY_FROM_MOVING
= '33'¶
-
-
States
¶ alias of
NewportStates
-
static
config_cls
()[source]¶ Return the default configdataclass class.
Returns: a reference to the default configdataclass class
-
static
default_com_cls
()[source]¶ Get the class for the default communication protocol used with this device.
Returns: the type of the standard communication protocol for this device
-
exit_configuration
(add: int = None) → None[source]¶ Exit the CONFIGURATION state and go back to the NOT REFERENCED state. All configuration parameters are saved to the device”s memory.
Parameters: add – controller address (1 to 31)
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
get_acceleration
(add: int = None) → Union[int, float][source]¶ Leave the configuration state. The configuration parameters are saved to the device”s memory.
Parameters: add – controller address (1 to 31)
Returns: acceleration (preset units/s^2), value between 1e-6 and 1e12
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
get_controller_information
(add: int = None) → str[source]¶ Get information on the controller name and driver version
Parameters: add – controller address (1 to 31)
Returns: controller information
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
get_motor_configuration
(add: int = None) → Dict[str, float][source]¶ Query the motor configuration and returns it in a dictionary.
Parameters: add – controller address (1 to 31)
Returns: dictionary containing the motor’s configuration
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
get_move_duration
(dist: Union[int, float], add: int = None) → float[source]¶ Estimate the time necessary to move the motor of the specified distance.
Parameters: - dist – distance to travel
- add – controller address (1 to 31), defaults to self.address
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
get_negative_software_limit
(add: int = None) → Union[int, float][source]¶ Get the negative software limit (the maximum position that the motor is allowed to travel to towards the left).
Parameters: add – controller address (1 to 31)
Returns: negative software limit (preset units), value between -1e12 and 0
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
get_position
(add: int = None) → float[source]¶ Returns the value of the current position.
Parameters: add – controller address (1 to 31)
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
get_positive_software_limit
(add: int = None) → Union[int, float][source]¶ Get the positive software limit (the maximum position that the motor is allowed to travel to towards the right).
Parameters: add – controller address (1 to 31)
Returns: positive software limit (preset units), value between 0 and 1e12
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
get_state
(add: int = None) → StateMessages[source]¶ Check on the motor errors and the controller state
Parameters: add – controller address (1 to 31)
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
- NewportMotorError – if the motor reports an error
Returns: state message from the device (member of StateMessages)
-
go_home
(add: int = None) → None[source]¶ Move the motor to its home position.
Parameters: add – controller address (1 to 31), defaults to self.address
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
go_to_configuration
(add: int = None) → None[source]¶ This method is executed during start(). It can also be executed after a reset(). The controller is put in CONFIG state, where configuration parameters can be changed.
Parameters: add – controller address (1 to 31)
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
initialize
(add: int = None) → None[source]¶ Puts the controller from the NOT_REF state to the READY state. Sends the motor to its “home” position.
Parameters: add – controller address (1 to 31)
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
move_to_absolute_position
(pos: Union[int, float], add: int = None) → None[source]¶ Move the motor to the specified position.
Parameters: - pos – target absolute position (affected by the configured offset)
- add – controller address (1 to 31), defaults to self.address
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
move_to_relative_position
(pos: Union[int, float], add: int = None) → None[source]¶ Move the motor of the specified distance.
Parameters: - pos – distance to travel (the sign gives the direction)
- add – controller address (1 to 31), defaults to self.address
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
reset
(add: int = None) → None[source]¶ Resets the controller, equivalent to a power-up. This puts the controller back to NOT REFERENCED state, which is necessary for configuring the controller.
Parameters: add – controller address (1 to 31)
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
set_acceleration
(acc: Union[int, float], add: int = None) → None[source]¶ Leave the configuration state. The configuration parameters are saved to the device”s memory.
Parameters: - acc – acceleration (preset units/s^2), value between 1e-6 and 1e12
- add – controller address (1 to 31)
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
set_motor_configuration
(add: int = None, config: dict = None) → None[source]¶ Set the motor configuration. The motor must be in CONFIG state.
Parameters: - add – controller address (1 to 31)
- config – dictionary containing the motor’s configuration
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
set_negative_software_limit
(lim: Union[int, float], add: int = None) → None[source]¶ Set the negative software limit (the maximum position that the motor is allowed to travel to towards the left).
Parameters: - lim – negative software limit (preset units), value between -1e12 and 0
- add – controller address (1 to 31)
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
set_positive_software_limit
(lim: Union[int, float], add: int = None) → None[source]¶ Set the positive software limit (the maximum position that the motor is allowed to travel to towards the right).
Parameters: - lim – positive software limit (preset units), value between 0 and 1e12
- add – controller address (1 to 31)
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
start
()[source]¶ Opens the communication protocol and applies the config.
Raises: SerialCommunicationIOError – when communication port cannot be opened
-
stop_motion
(add: int = None) → None[source]¶ Stop a move in progress by decelerating the positioner immediately with the configured acceleration until it stops. If a controller address is provided, stops a move in progress on this controller, else stops the moves on all controllers.
Parameters: add – controller address (1 to 31)
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
wait_until_motor_initialized
(add: int = None) → None[source]¶ Wait until the motor leaves the HOMING state (at which point it should have arrived to the home position).
Parameters: add – controller address (1 to 31)
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
wait_until_move_finished
(add: int = None) → None[source]¶ Wait until the motor leaves the MOVING state (at which point it should have arrived to the target position).
Parameters: add – controller address (1 to 31)
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
class
-
class
hvl_ccb.dev.newport.
NewportSMC100PPConfig
(address: int = 1, user_position_offset: Union[int, float] = 23.987, screw_scaling: Union[int, float] = 1, exit_configuration_wait_sec: Union[int, float] = 5, move_finished_extra_wait_sec: Union[int, float] = 1, acceleration: Union[int, float] = 10, backlash_compensation: Union[int, float] = 0, hysteresis_compensation: Union[int, float] = 0.015, micro_step_per_full_step_factor: int = 100, motion_distance_per_full_step: Union[int, float] = 0.01, home_search_type: Union[int, hvl_ccb.dev.newport.NewportSMC100PPConfig.HomeSearch] = <HomeSearch.HomeSwitch: 2>, jerk_time: Union[int, float] = 0.04, home_search_velocity: Union[int, float] = 4, home_search_timeout: Union[int, float] = 27.5, home_search_polling_interval: Union[int, float] = 1, peak_output_current_limit: Union[int, float] = 0.4, rs485_address: int = 2, negative_software_limit: Union[int, float] = -23.5, positive_software_limit: Union[int, float] = 25, velocity: Union[int, float] = 4, base_velocity: Union[int, float] = 0, stage_configuration: Union[int, hvl_ccb.dev.newport.NewportSMC100PPConfig.EspStageConfig] = <EspStageConfig.EnableEspStageCheck: 3>)[source]¶ Bases:
object
Configuration dataclass for the Newport motor controller SMC100PP.
-
class
EspStageConfig
(*args, **kwds)[source]¶ Bases:
aenum.IntEnum
Different configurations to check or not the motor configuration upon power-up.
-
DisableEspStageCheck
= 1¶
-
EnableEspStageCheck
= 3¶
-
UpdateEspStageInfo
= 2¶
-
-
class
HomeSearch
(*args, **kwds)[source]¶ Bases:
aenum.IntEnum
Different methods for the motor to search its home position during initialization.
-
CurrentPosition
= 1¶
-
EndOfRunSwitch
= 4¶
-
EndOfRunSwitch_and_Index
= 3¶
-
HomeSwitch
= 2¶
-
HomeSwitch_and_Index
= 0¶
-
-
acceleration
= 10¶
-
address
= 1¶
-
backlash_compensation
= 0¶
-
base_velocity
= 0¶
-
exit_configuration_wait_sec
= 5¶
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
home_search_polling_interval
= 1¶
-
home_search_timeout
= 27.5¶
-
home_search_type
= 2¶
-
home_search_velocity
= 4¶
-
hysteresis_compensation
= 0.015¶
-
is_configdataclass
= True¶
-
jerk_time
= 0.04¶
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
micro_step_per_full_step_factor
= 100¶
-
motion_distance_per_full_step
= 0.01¶
-
motor_config
¶ Gather the configuration parameters of the motor into a dictionary.
Returns: dict containing the configuration parameters of the motor
-
move_finished_extra_wait_sec
= 1¶
-
negative_software_limit
= -23.5¶
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
peak_output_current_limit
= 0.4¶
-
positive_software_limit
= 25¶
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
rs485_address
= 2¶
-
screw_scaling
= 1¶
-
stage_configuration
= 3¶
-
user_position_offset
= 23.987¶
-
velocity
= 4¶
-
class
-
class
hvl_ccb.dev.newport.
NewportSMC100PPSerialCommunication
(configuration)[source]¶ Bases:
hvl_ccb.comm.serial.SerialCommunication
Specific communication protocol implementation Heinzinger power supplies. Already predefines device-specific protocol parameters in config.
-
class
ControllerErrors
(*args, **kwds)[source]¶ Bases:
aenum.Enum
Possible controller errors with values as returned by the device in response to sent commands.
-
ADDR_INCORRECT
= 'B'¶
-
CMD_EXEC_ERROR
= 'V'¶
-
CMD_NOT_ALLOWED
= 'D'¶
-
CMD_NOT_ALLOWED_CC
= 'X'¶
-
CMD_NOT_ALLOWED_CONFIGURATION
= 'I'¶
-
CMD_NOT_ALLOWED_DISABLE
= 'J'¶
-
CMD_NOT_ALLOWED_HOMING
= 'L'¶
-
CMD_NOT_ALLOWED_MOVING
= 'M'¶
-
CMD_NOT_ALLOWED_NOT_REFERENCED
= 'H'¶
-
CMD_NOT_ALLOWED_PP
= 'W'¶
-
CMD_NOT_ALLOWED_READY
= 'K'¶
-
CODE_OR_ADDR_INVALID
= 'A'¶
-
COM_TIMEOUT
= 'S'¶
-
DISPLACEMENT_OUT_OF_LIMIT
= 'G'¶
-
EEPROM_ACCESS_ERROR
= 'U'¶
-
ESP_STAGE_NAME_INVALID
= 'F'¶
-
HOME_STARTED
= 'E'¶
-
NO_ERROR
= '@'¶
-
PARAM_MISSING_OR_INVALID
= 'C'¶
-
POSITION_OUT_OF_LIMIT
= 'N'¶
-
-
check_for_error
(add: int) → None[source]¶ Ask the Newport controller for the last error it recorded.
This method is called after every command or query.
Parameters: add – controller address (1 to 31)
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
static
config_cls
()[source]¶ Return the default configdataclass class.
Returns: a reference to the default configdataclass class
-
query
(add: int, cmd: str, param: Union[int, float, str, None] = None) → str[source]¶ Send a query to the controller, read the answer, and check for errors. The prefix add+cmd is removed from the answer.
Parameters: - add – the controller address (1 to 31)
- cmd – the command to be sent
- param – optional parameter (int/float/str) appended to the command
Returns: the answer from the device without the prefix
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
query_multiple
(add: int, cmd: str, prefixes: List[str]) → List[str][source]¶ Send a query to the controller, read the answers, and check for errors. The prefixes are removed from the answers.
Parameters: - add – the controller address (1 to 31)
- cmd – the command to be sent
- prefixes – prefixes of each line expected in the answer
Returns: list of answers from the device without prefix
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
send_command
(add: int, cmd: str, param: Union[int, float, str, None] = None) → None[source]¶ Send a command to the controller, and check for errors.
Parameters: - add – the controller address (1 to 31)
- cmd – the command to be sent
- param – optional parameter (int/float/str) appended to the command
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
- NewportControllerError – if the controller reports an error
-
send_stop
(add: int) → None[source]¶ Send the general stop ST command to the controller, and check for errors.
Parameters: add – the controller address (1 to 31)
Returns: ControllerErrors reported by Newport Controller
Raises: - SerialCommunicationIOError – if the com is closed
- NewportSerialCommunicationError – if an unexpected answer is obtained
-
class
-
class
hvl_ccb.dev.newport.
NewportSMC100PPSerialCommunicationConfig
(port: str, baudrate: int = 57600, parity: Union[str, hvl_ccb.comm.serial.SerialCommunicationParity] = <SerialCommunicationParity.NONE: 'N'>, stopbits: Union[int, hvl_ccb.comm.serial.SerialCommunicationStopbits] = <SerialCommunicationStopbits.ONE: 1>, bytesize: Union[int, hvl_ccb.comm.serial.SerialCommunicationBytesize] = <SerialCommunicationBytesize.EIGHTBITS: 8>, terminator: bytes = b'rn', timeout: Union[int, float] = 10)[source]¶ Bases:
hvl_ccb.comm.serial.SerialCommunicationConfig
-
baudrate
= 57600¶ Baudrate for Heinzinger power supplies is 9600 baud
-
bytesize
= 8¶ One byte is eight bits long
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
parity
= 'N'¶ Heinzinger does not use parity
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
stopbits
= 1¶ Heinzinger uses one stop bit
-
terminator
= b'\r\n'¶ The terminator is CR/LF
-
timeout
= 10¶ use 10 seconds timeout as default
-
hvl_ccb.dev.pfeiffer_tpg module¶
Device class for Pfeiffer TPG controllers.
The Pfeiffer TPG control units are used to control Pfeiffer Compact Gauges. Models: TPG 251 A, TPG 252 A, TPG 256A, TPG 261, TPG 262, TPG 361, TPG 362 and TPG 366.
Manufacturer homepage: https://www.pfeiffer-vacuum.com/en/products/measurement-analysis/ measurement/activeline/controllers/
-
class
hvl_ccb.dev.pfeiffer_tpg.
PfeifferTPG
(com, dev_config=None)[source]¶ Bases:
hvl_ccb.dev.base.SingleCommDevice
Pfeiffer TPG control unit device class
-
class
PressureUnits
(*args, **kwds)[source]¶ Bases:
hvl_ccb.utils.enum.NameEnum
Enum of available pressure units for the digital display. “0” corresponds either to bar or to mbar depending on the TPG model. In case of doubt, the unit is visible on the digital display.
-
Micron
= 3¶
-
Pascal
= 2¶
-
Torr
= 1¶
-
Volt
= 5¶
-
bar
= 0¶
-
hPascal
= 4¶
-
mbar
= 0¶
-
-
class
SensorStatus
[source]¶ Bases:
enum.IntEnum
An enumeration.
-
Identification_error
= 6¶
-
No_sensor
= 5¶
-
Ok
= 0¶
-
Overrange
= 2¶
-
Sensor_error
= 3¶
-
Sensor_off
= 4¶
-
Underrange
= 1¶
-
-
class
SensorTypes
¶ Bases:
enum.Enum
An enumeration.
-
CMR
= 4¶
-
IKR
= 2¶
-
IKR11
= 2¶
-
IKR9
= 2¶
-
IMR
= 5¶
-
None
= 7¶
-
PBR
= 6¶
-
PKR
= 3¶
-
TPR
= 1¶
-
noSENSOR
= 7¶
-
noSen
= 7¶
-
-
static
config_cls
()[source]¶ Return the default configdataclass class.
Returns: a reference to the default configdataclass class
-
static
default_com_cls
()[source]¶ Get the class for the default communication protocol used with this device.
Returns: the type of the standard communication protocol for this device
-
get_full_scale_mbar
() → List[Union[int, float]][source]¶ Get the full scale range of the attached sensors
Returns: full scale range values in mbar, like [0.01, 1, 0.1, 1000, 50000, 10]
Raises: - SerialCommunicationIOError – when communication port is not opened
- PfeifferTPGError – if command fails
-
get_full_scale_unitless
() → List[int][source]¶ Get the full scale range of the attached sensors. See lookup table between command and corresponding pressure in the device user manual.
Returns: list of full scale range values, like [0, 1, 3, 3, 2, 0]
Raises: - SerialCommunicationIOError – when communication port is not opened
- PfeifferTPGError – if command fails
-
identify_sensors
() → None[source]¶ Send identification request TID to sensors on all channels.
Raises: - SerialCommunicationIOError – when communication port is not opened
- PfeifferTPGError – if command fails
-
measure
(channel: int) → Tuple[str, float][source]¶ Get the status and measurement of one sensor
Parameters: channel – int channel on which the sensor is connected, with 1 <= channel <= number_of_sensors
Returns: measured value as float if measurement successful, sensor status as string if not
Raises: - SerialCommunicationIOError – when communication port is not opened
- PfeifferTPGError – if command fails
-
measure_all
() → List[Tuple[str, float]][source]¶ Get the status and measurement of all sensors (this command is not available on all models)
Returns: list of measured values as float if measurements successful, and or sensor status as strings if not
Raises: - SerialCommunicationIOError – when communication port is not opened
- PfeifferTPGError – if command fails
-
number_of_sensors
¶
-
set_display_unit
(unit: Union[str, hvl_ccb.dev.pfeiffer_tpg.PfeifferTPG.PressureUnits]) → None[source]¶ Set the unit in which the measurements are shown on the display.
Raises: - SerialCommunicationIOError – when communication port is not opened
- PfeifferTPGError – if command fails
-
set_full_scale_mbar
(fsr: List[Union[int, float]]) → None[source]¶ Set the full scale range of the attached sensors (in unit mbar)
Parameters: fsr – full scale range values in mbar, for example [0.01, 1000]
Raises: - SerialCommunicationIOError – when communication port is not opened
- PfeifferTPGError – if command fails
-
set_full_scale_unitless
(fsr: List[int]) → None[source]¶ Set the full scale range of the attached sensors. See lookup table between command and corresponding pressure in the device user manual.
Parameters: fsr – list of full scale range values, like [0, 1, 3, 3, 2, 0]
Raises: - SerialCommunicationIOError – when communication port is not opened
- PfeifferTPGError – if command fails
-
start
() → None[source]¶ Start this device. Opens the communication protocol, and identify the sensors.
Raises: SerialCommunicationIOError – when communication port cannot be opened
-
unit
¶ The pressure unit of readings is always mbar, regardless of the display unit.
-
class
-
class
hvl_ccb.dev.pfeiffer_tpg.
PfeifferTPGConfig
(model: Union[str, hvl_ccb.dev.pfeiffer_tpg.PfeifferTPGConfig.Model] = <Model.TPG25xA: {1: 0, 10: 1, 100: 2, 1000: 3, 2000: 4, 5000: 5, 10000: 6, 50000: 7, 0.1: 8}>)[source]¶ Bases:
object
Device configuration dataclass for Pfeiffer TPG controllers.
-
class
Model
(*args, **kwargs)[source]¶ Bases:
hvl_ccb.utils.enum.NameEnum
-
TPG25xA
= {0.1: 8, 1: 0, 10: 1, 100: 2, 1000: 3, 2000: 4, 5000: 5, 10000: 6, 50000: 7}¶
-
TPGx6x
= {0.01: 0, 0.1: 1, 1: 2, 10: 3, 100: 4, 1000: 5, 2000: 6, 5000: 7, 10000: 8, 50000: 9}¶
-
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
is_configdataclass
= True¶
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
model
= {0.1: 8, 1: 0, 10: 1, 100: 2, 1000: 3, 2000: 4, 5000: 5, 10000: 6, 50000: 7}¶
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
class
-
exception
hvl_ccb.dev.pfeiffer_tpg.
PfeifferTPGError
[source]¶ Bases:
Exception
Error with the Pfeiffer TPG Controller.
-
class
hvl_ccb.dev.pfeiffer_tpg.
PfeifferTPGSerialCommunication
(configuration)[source]¶ Bases:
hvl_ccb.comm.serial.SerialCommunication
Specific communication protocol implementation for Pfeiffer TPG controllers. Already predefines device-specific protocol parameters in config.
-
static
config_cls
()[source]¶ Return the default configdataclass class.
Returns: a reference to the default configdataclass class
-
query
(cmd: str) → str[source]¶ Send a query, then read and returns the first line from the com port.
Parameters: cmd – query message to send to the device
Returns: first line read on the com
Raises: - SerialCommunicationIOError – when communication port is not opened
- PfeifferTPGError – if the device does not acknowledge the command or if the answer from the device is empty
-
send_command
(cmd: str) → None[source]¶ Send a command to the device and check for acknowledgement.
Parameters: cmd – command to send to the device
Raises: - SerialCommunicationIOError – when communication port is not opened
- PfeifferTPGError – if the answer from the device differs from the expected acknowledgement character ‘chr(6)’.
-
static
-
class
hvl_ccb.dev.pfeiffer_tpg.
PfeifferTPGSerialCommunicationConfig
(port: str, baudrate: int = 9600, parity: Union[str, hvl_ccb.comm.serial.SerialCommunicationParity] = <SerialCommunicationParity.NONE: 'N'>, stopbits: Union[int, hvl_ccb.comm.serial.SerialCommunicationStopbits] = <SerialCommunicationStopbits.ONE: 1>, bytesize: Union[int, hvl_ccb.comm.serial.SerialCommunicationBytesize] = <SerialCommunicationBytesize.EIGHTBITS: 8>, terminator: bytes = b'rn', timeout: Union[int, float] = 3)[source]¶ Bases:
hvl_ccb.comm.serial.SerialCommunicationConfig
-
baudrate
= 9600¶ Baudrate for Pfeiffer TPG controllers is 9600 baud
-
bytesize
= 8¶ One byte is eight bits long
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
parity
= 'N'¶ Pfeiffer TPG controllers do not use parity
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
stopbits
= 1¶ Pfeiffer TPG controllers use one stop bit
-
terminator
= b'\r\n'¶ The terminator is <CR><LF>
-
timeout
= 3¶ use 3 seconds timeout as default
-
hvl_ccb.dev.rs_rto1024 module¶
Python module for the Rhode & Schwarz RTO 1024 oscilloscope. The communication to the device is through VISA, type TCPIP / INSTR.
-
class
hvl_ccb.dev.rs_rto1024.
RTO1024
(com: Union[hvl_ccb.dev.rs_rto1024.RTO1024VisaCommunication, hvl_ccb.dev.rs_rto1024.RTO1024VisaCommunicationConfig, dict], dev_config: Union[hvl_ccb.dev.rs_rto1024.RTO1024Config, dict])[source]¶ Bases:
hvl_ccb.dev.visa.VisaDevice
Device class for the Rhode & Schwarz RTO 1024 oscilloscope.
-
class
TriggerModes
(*args, **kwds)[source]¶ Bases:
hvl_ccb.utils.enum.AutoNumberNameEnum
Enumeration for the three available trigger modes.
-
AUTO
= 1¶
-
FREERUN
= 3¶
-
NORMAL
= 2¶
-
-
backup_waveform
(filename: str) → None[source]¶ Backup a waveform file from the standard directory specified in the device configuration to the standard backup destination specified in the device configuration. The filename has to be specified without .bin or path.
Parameters: filename – The waveform filename without extension and path
-
static
config_cls
()[source]¶ Return the default configdataclass class.
Returns: a reference to the default configdataclass class
-
static
default_com_cls
()[source]¶ Return the default communication protocol for this device type, which is VisaCommunication.
Returns: the VisaCommunication class
-
file_copy
(source: str, destination: str) → None[source]¶ Copy a file from one destination to another on the oscilloscope drive. If the destination file already exists, it is overwritten without notice.
Parameters: - source – absolute path to the source file on the DSO filesystem
- destination – absolute path to the destination file on the DSO filesystem
Raises: RTO1024Error – if the operation did not complete
-
get_timestamps
() → List[float][source]¶ Gets the timestamps of all recorded frames in the history and returns them as a list of floats.
Returns: list of timestamps in [s] Raises: RTO1024Error – if the timestamps are invalid
-
list_directory
(path: str) → List[Tuple[str, str, int]][source]¶ List the contents of a given directory on the oscilloscope filesystem.
Parameters: path – is the path to a folder Returns: a list of filenames in the given folder
-
load_configuration
(filename: str) → None[source]¶ Load current settings from a configuration file. The filename has to be specified without base directory and ‘.dfl’ extension.
Information from the manual ReCaLl calls up the instrument settings from an intermediate memory identified by the specified number. The instrument settings can be stored to this memory using the command *SAV with the associated number. It also activates the instrument settings which are stored in a file and loaded using MMEMory:LOAD:STATe .
Parameters: filename – is the name of the settings file without path and extension
-
local_display
(state: bool) → None[source]¶ Enable or disable local display of the scope.
Parameters: state – is the desired local display state
-
prepare_ultra_segmentation
() → None[source]¶ Make ready for a new acquisition in ultra segmentation mode. This function does one acquisition without ultra segmentation to clear the history and prepare for a new measurement.
-
save_configuration
(filename: str) → None[source]¶ Save the current oscilloscope settings to a file. The filename has to be specified without path and ‘.dfl’ extension, the file will be saved to the configured settings directory.
Information from the manual SAVe stores the current instrument settings under the specified number in an intermediate memory. The settings can be recalled using the command *RCL with the associated number. To transfer the stored instrument settings to a file, use MMEMory:STORe:STATe .
Parameters: filename – is the name of the settings file without path and extension
-
save_waveform_history
(filename: str, channel: int, waveform: int = 1) → None[source]¶ Save the history of one channel and one waveform to a .bin file. This function is used after an acquisition using sequence trigger mode (with or without ultra segmentation) was performed.
Parameters: - filename – is the name (without extension) of the file
- channel – is the channel number
- waveform – is the waveform number (typically 1)
Raises: RTO1024Error – if storing waveform times out
-
set_acquire_length
(timerange: float) → None[source]¶ Defines the time of one acquisition, that is the time across the 10 divisions of the diagram.
- Range: 250E-12 … 500 [s]
- Increment: 1E-12 [s]
- *RST = 0.5 [s]
Parameters: timerange – is the time for one acquisition. Range: 250e-12 … 500 [s]
-
set_channel_position
(channel: int, position: float) → None[source]¶ Sets the vertical position of the indicated channel as a graphical value.
- Range: -5.0 … 5.0 [div]
- Increment: 0.02
- *RST = 0
Parameters: - channel – is the channel number (1..4)
- position – is the position. Positive values move the waveform up, negative values move it down.
-
set_channel_range
(channel: int, v_range: float) → None[source]¶ Sets the voltage range across the 10 vertical divisions of the diagram. Use the command alternatively instead of set_channel_scale.
- Range for range: Depends on attenuation factors and coupling. With 1:1 probe and external attenuations and 50 Ω input coupling, the range is 10 mV to 10 V. For 1 MΩ input coupling, it is 10 mV to 100 V. If the probe and/or external attenuation is changed, multiply the range values by the attenuation factors.
- Increment: 0.01
- *RST = 0.5
Parameters: - channel – is the channel number (1..4)
- v_range – is the vertical range [V]
-
set_channel_scale
(channel: int, scale: float) → None[source]¶ Sets the vertical scale for the indicated channel. The scale value is given in volts per division.
- Range for scale: depends on attenuation factor and coupling. With 1:1 probe and external attenuations and 50 Ω input coupling, the vertical scale (input sensitivity) is 1 mV/div to 1 V/div. For 1 MΩ input coupling, it is 1 mV/div to 10 V/div. If the probe and/or external attenuation is changed, multiply the values by the attenuation factors to get the actual scale range.
- Increment: 1e-3
- *RST = 0.05
See also: set_channel_range
Parameters: - channel – is the channel number (1..4)
- scale – is the vertical scaling [V/div]
-
set_channel_state
(channel: int, state: bool) → None[source]¶ Switches the channel signal on or off.
Parameters: - channel – is the input channel (1..4)
- state – is True for on, False for off
-
set_reference_point
(percentage: int) → None[source]¶ Sets the reference point of the time scale in % of the display. If the “Trigger offset” is zero, the trigger point matches the reference point. ReferencePoint = zero pint of the time scale
- Range: 0 … 100 [%]
- Increment: 1 [%]
- *RST = 50 [%]
Parameters: percentage – is the reference in %
-
set_repetitions
(number: int) → None[source]¶ Set the number of acquired waveforms with RUN Nx SINGLE. Also defines the number of waveforms used to calculate the average waveform.
- Range: 1 … 16777215
- Increment: 10
- *RST = 1
Parameters: number – is the number of waveforms to acquire
-
set_trigger_level
(channel: int, level: float, event_type: int = 1) → None[source]¶ Sets the trigger level for the specified event and source.
- Range: -10 to 10 V
- Increment: 1e-3 V
- *RST = 0 V
Parameters: - channel –
indicates the trigger source.
- 1..4 = channel 1 to 4, available for all event types 1..3
- 5 = external trigger input on the rear panel for analog signals, available for A-event type = 1
- 6..9 = not available
- level – is the voltage for the trigger level in [V].
- event_type – is the event type. 1: A-Event, 2: B-Event, 3: R-Event
-
set_trigger_mode
(mode: Union[str, hvl_ccb.dev.rs_rto1024.RTO1024.TriggerModes]) → None[source]¶ Sets the trigger mode which determines the behavior of the instrument if no trigger occurs.
Parameters: mode – is either auto, normal, or freerun. Raises: RTO1024Error – if an invalid triggermode is selected
-
set_trigger_source
(channel: int, event_type: int = 1) → None[source]¶ Set the trigger (Event A) source channel.
Parameters: - channel – is the channel number (1..4)
- event_type – is the event type. 1: A-Event, 2: B-Event, 3: R-Event
-
start
() → None[source]¶ Start the RTO1024 oscilloscope and bring it into a defined state and remote mode.
-
class
-
class
hvl_ccb.dev.rs_rto1024.
RTO1024Config
(waveforms_path: str, settings_path: str, backup_path: str, spoll_interval: Union[int, float] = 0.5, spoll_start_delay: Union[int, float] = 2, command_timeout_seconds: Union[int, float] = 60, wait_sec_short_pause: Union[int, float] = 0.1, wait_sec_enable_history: Union[int, float] = 1, wait_sec_post_acquisition_start: Union[int, float] = 2)[source]¶ Bases:
hvl_ccb.dev.visa.VisaDeviceConfig
,hvl_ccb.dev.rs_rto1024._RTO1024ConfigDefaultsBase
,hvl_ccb.dev.rs_rto1024._RTO1024ConfigBase
Configdataclass for the RTO1024 device.
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
-
class
hvl_ccb.dev.rs_rto1024.
RTO1024VisaCommunication
(configuration)[source]¶ Bases:
hvl_ccb.comm.visa.VisaCommunication
Specialization of VisaCommunication for the RTO1024 oscilloscope
-
class
hvl_ccb.dev.rs_rto1024.
RTO1024VisaCommunicationConfig
(host: str, interface_type: Union[str, hvl_ccb.comm.visa.VisaCommunicationConfig.InterfaceType] = <InterfaceType.TCPIP_INSTR: 2>, board: int = 0, port: int = 5025, timeout: int = 5000, chunk_size: int = 204800, open_timeout: int = 1000, write_termination: str = 'n', read_termination: str = 'n', visa_backend: str = '')[source]¶ Bases:
hvl_ccb.comm.visa.VisaCommunicationConfig
Configuration dataclass for VisaCommunication with specifications for the RTO1024 device class.
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
interface_type
= 2¶
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
hvl_ccb.dev.se_ils2t module¶
Device class for controlling a Schneider Electric ILS2T stepper drive over modbus TCP.
-
class
hvl_ccb.dev.se_ils2t.
ILS2T
(com, dev_config=None)[source]¶ Bases:
hvl_ccb.dev.base.SingleCommDevice
Schneider Electric ILS2T stepper drive class.
-
ACTION_JOG_VALUE
= 0¶ The single action value for ILS2T.Mode.JOG
-
class
ActionsPtp
[source]¶ Bases:
enum.IntEnum
Allowed actions in the point to point mode (ILS2T.Mode.PTP).
-
ABSOLUTE_POSITION
= 0¶
-
RELATIVE_POSITION_MOTOR
= 2¶
-
RELATIVE_POSITION_TARGET
= 1¶
-
-
DEFAULT_IO_SCANNING_CONTROL_VALUES
= {'action': 2, 'continue_after_stop_cu': 0, 'disable_driver_di': 0, 'enable_driver_en': 0, 'execute_stop_sh': 0, 'fault_reset_fr': 0, 'mode': 3, 'quick_stop_qs': 0, 'ref_16': 1500, 'ref_32': 0, 'reset_stop_ch': 0}¶ Default IO Scanning control mode values
-
class
Ref16Jog
[source]¶ Bases:
enum.Flag
Allowed values for ILS2T ref_16 register (the shown values are the integer representation of the bits), all in Jog mode = 1
-
FAST
= 4¶
-
NEG
= 2¶
-
NEG_FAST
= 6¶
-
NONE
= 0¶
-
POS
= 1¶
-
POS_FAST
= 5¶
-
-
RegAddr
¶ Modbus Register Adresses
alias of
ILS2TRegAddr
-
RegDatatype
¶ Modbus Register Datatypes
alias of
ILS2TRegDatatype
-
class
State
[source]¶ Bases:
enum.IntEnum
State machine status values
-
ON
= 6¶
-
QUICKSTOP
= 7¶
-
READY
= 4¶
-
-
static
config_cls
()[source]¶ Return the default configdataclass class.
Returns: a reference to the default configdataclass class
-
static
default_com_cls
()[source]¶ Get the class for the default communication protocol used with this device.
Returns: the type of the standard communication protocol for this device
-
disable
(log_warn: bool = True, wait_sec_max: Optional[int] = None) → bool[source]¶ Disable the driver of the stepper motor and enable the brake.
Note: the driver cannot be disabled if the motor is still running.
Parameters: - log_warn – if log a warning in case the motor cannot be disabled.
- wait_sec_max – maximal wait time for the motor to stop running and to disable it; by default, with None, use a config value
Returns: True if disable request could and was sent, False otherwise.
-
do_ioscanning_write
(**kwargs) → None[source]¶ Perform a write operation using IO Scanning mode.
Parameters: kwargs – Keyword-argument list with options to send, remaining are taken from the defaults.
-
execute_absolute_position
(position: int) → bool[source]¶ Execute a absolute position change, i.e. enable motor, perform absolute position change, wait until done and disable motor afterwards.
Check position at the end if wrong do not raise error; instead just log and return check result.
Parameters: position – absolute position of motor in user defined steps. Returns: True if actual position is as expected, False otherwise.
-
execute_relative_step
(steps: int) → bool[source]¶ Execute a relative step, i.e. enable motor, perform relative steps, wait until done and disable motor afterwards.
Check position at the end if wrong do not raise error; instead just log and return check result.
Parameters: steps – Number of steps. Returns: True if actual position is as expected, False otherwise.
-
get_error_code
() → Dict[int, Dict[str, Any]][source]¶ Read all messages in fault memory. Will read the full error message and return the decoded values. At the end the fault memory of the motor will be deleted. In addition, reset_error is called to re-enable the motor for operation.
Returns: Dictionary with all information
-
get_position
() → int[source]¶ Read the position of the drive and store into status.
Returns: Position step value
-
get_status
() → Dict[str, int][source]¶ Perform an IO Scanning read and return the status of the motor.
Returns: dict with status information.
-
get_temperature
() → int[source]¶ Read the temperature of the motor.
Returns: Temperature in degrees Celsius.
-
jog_run
(direction: bool = True, fast: bool = False) → None[source]¶ Slowly turn the motor in positive direction.
-
quickstop
() → None[source]¶ Stops the motor with high deceleration rate and falls into error state. Reset with reset_error to recover into normal state.
-
reset_error
() → None[source]¶ Resets the motor into normal state after quick stop or another error occured.
-
set_jog_speed
(slow: int = 60, fast: int = 180) → None[source]¶ Set the speed for jog mode. Default values correspond to startup values of the motor.
Parameters: - slow – RPM for slow jog mode.
- fast – RPM for fast jog mode.
-
set_max_acceleration
(rpm_minute: int) → None[source]¶ Set the maximum acceleration of the motor.
Parameters: rpm_minute – revolution per minute per minute
-
set_max_deceleration
(rpm_minute: int) → None[source]¶ Set the maximum deceleration of the motor.
Parameters: rpm_minute – revolution per minute per minute
-
set_max_rpm
(rpm: int) → None[source]¶ Set the maximum RPM.
Parameters: rpm – revolution per minute ( 0 < rpm <= RPM_MAX) Raises: ILS2TException – if RPM is out of range
-
set_ramp_type
(ramp_type: int = -1) → None[source]¶ - Set the ramp type. There are two options available:
- 0: linear ramp -1: motor optimized ramp
Parameters: ramp_type – 0: linear ramp | -1: motor optimized ramp
-
stop
() → None[source]¶ Stop this device. Disables the motor (applies brake), disables access and closes the communication protocol.
-
user_steps
(steps: int = 16384, revolutions: int = 1) → None[source]¶ Define steps per revolution. Default is 16384 steps per revolution. Maximum precision is 32768 steps per revolution.
Parameters: - steps – number of steps in revolutions.
- revolutions – number of revolutions corresponding to steps.
-
-
class
hvl_ccb.dev.se_ils2t.
ILS2TConfig
(rpm_max_init: numbers.Integral = 1500, wait_sec_post_enable: Union[float, int] = 1, wait_sec_max_disable: Union[float, int] = 10, wait_sec_post_cannot_disable: Union[float, int] = 1, wait_sec_post_relative_step: Union[float, int] = 2, wait_sec_post_absolute_position: Union[float, int] = 2)[source]¶ Bases:
object
Configuration for the ILS2T stepper motor device.
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
is_configdataclass
= True¶
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
rpm_max_init
= 1500¶ initial maximum RPM for the motor, can be set up to 3000 RPM. The user is allowed to set a new max RPM at runtime using
ILS2T.set_max_rpm()
, but the value must never exceed this configuration setting.
-
wait_sec_max_disable
= 10¶
-
wait_sec_post_absolute_position
= 2¶
-
wait_sec_post_cannot_disable
= 1¶
-
wait_sec_post_enable
= 1¶
-
wait_sec_post_relative_step
= 2¶
-
-
exception
hvl_ccb.dev.se_ils2t.
ILS2TException
[source]¶ Bases:
Exception
Exception to indicate problems with the SE ILS2T stepper motor.
-
class
hvl_ccb.dev.se_ils2t.
ILS2TModbusTcpCommunication
(configuration)[source]¶ Bases:
hvl_ccb.comm.modbus_tcp.ModbusTcpCommunication
Specific implementation of Modbus/TCP for the Schneider Electric ILS2T stepper motor.
-
class
hvl_ccb.dev.se_ils2t.
ILS2TModbusTcpCommunicationConfig
(host: str, unit: int = 255, port: int = 502)[source]¶ Bases:
hvl_ccb.comm.modbus_tcp.ModbusTcpCommunicationConfig
Configuration dataclass for Modbus/TCP communciation specific for the Schneider Electric ILS2T stepper motor.
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
unit
= 255¶ The unit has to be 255 such that IO scanning mode works.
-
-
class
hvl_ccb.dev.se_ils2t.
ILS2TRegAddr
[source]¶ Bases:
enum.IntEnum
Modbus Register Adresses for for Schneider Electric ILS2T stepper drive.
-
ACCESS_ENABLE
= 282¶
-
FLT_INFO
= 15362¶
-
FLT_MEM_DEL
= 15112¶
-
FLT_MEM_RESET
= 15114¶
-
IO_SCANNING
= 6922¶
-
JOGN_FAST
= 10506¶
-
JOGN_SLOW
= 10504¶
-
POSITION
= 7706¶
-
RAMP_ACC
= 1556¶
-
RAMP_DECEL
= 1558¶
-
RAMP_N_MAX
= 1554¶
-
RAMP_TYPE
= 1574¶
-
SCALE
= 1550¶
-
TEMP
= 7200¶
-
VOLT
= 7198¶
-
-
class
hvl_ccb.dev.se_ils2t.
ILS2TRegDatatype
(*args, **kwds)[source]¶ Bases:
aenum.Enum
Modbus Register Datatypes for Schneider Electric ILS2T stepper drive.
From the manual of the drive:
datatype byte min max INT8 1 Byte -128 127 UINT8 1 Byte 0 255 INT16 2 Byte -32_768 32_767 UINT16 2 Byte 0 65_535 INT32 4 Byte -2_147_483_648 2_147_483_647 UINT32 4 Byte 0 4_294_967_295 BITS just 32bits N/A N/A -
INT32
= (-2147483648, 2147483647)¶
-
-
exception
hvl_ccb.dev.se_ils2t.
IoScanningModeValueError
[source]¶ Bases:
hvl_ccb.dev.se_ils2t.ILS2TException
Exception to indicate that the selected IO scanning mode is invalid.
-
exception
hvl_ccb.dev.se_ils2t.
ScalingFactorValueError
[source]¶ Bases:
hvl_ccb.dev.se_ils2t.ILS2TException
Exception to indicate that a scaling factor value is invalid.
hvl_ccb.dev.sst_luminox module¶
Device class for a SST Luminox Oxygen sensor. This device can measure the oxygen concentration between 0 % and 25 %.
Furthermore, it measures the barometric pressure and internal temperature. The device supports two operating modes: in streaming mode the device measures all parameters every second, in polling mode the device measures only after a query.
Technical specification and documentation for the device can be found a the manufacturer’s page: https://www.sstsensing.com/product/luminox-optical-oxygen-sensors-2/
-
class
hvl_ccb.dev.sst_luminox.
Luminox
(com, dev_config=None)[source]¶ Bases:
hvl_ccb.dev.base.SingleCommDevice
Luminox oxygen sensor device class.
-
activate_output
(mode: hvl_ccb.dev.sst_luminox.LuminoxOutputMode) → None[source]¶ activate the selected output mode of the Luminox Sensor. :param mode: polling or streaming
-
static
config_cls
()[source]¶ Return the default configdataclass class.
Returns: a reference to the default configdataclass class
-
static
default_com_cls
()[source]¶ Get the class for the default communication protocol used with this device.
Returns: the type of the standard communication protocol for this device
-
output
= None¶
-
query_single_measurement
(measurement: Union[str, hvl_ccb.dev.sst_luminox.LuminoxMeasurementType]) → Union[float, int, str][source]¶ query one single measurement value in polling mode.
Parameters: measurement – type of measurement
Returns: value of requested measurement
Raises: - ValueError – when a wrong key for LuminoxMeasurementType is provided
- LuminoxOutputModeError – when polling mode is not activated
- LuminoxMeasurementTypeError – when expected measurement value is not read
-
read_stream
() → dict[source]¶ read values of Luminox in stream mode. Convert the single string into sepearate numbers
Returns: dictionary with all values
Raises: - LuminoxOutputModeError – when streaming mode is not activated
- LuminoxMeasurementTypeError – when any of expected measurement values is not read
-
-
class
hvl_ccb.dev.sst_luminox.
LuminoxConfig
(wait_sec_post_activate: Union[int, float] = 0.5)[source]¶ Bases:
object
Configuration for the SST Luminox oxygen sensor.
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
is_configdataclass
= True¶
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
wait_sec_post_activate
= 0.5¶
-
-
class
hvl_ccb.dev.sst_luminox.
LuminoxMeasurementType
(*args, **kwds)[source]¶ Bases:
hvl_ccb.utils.enum.ValueEnum
measurement type.
-
barometric_pressure
= 'P'¶
-
command
¶
-
date_of_manufacture
= '# 0'¶
-
partial_pressure_o2
= 'O'¶
-
percent_o2
= '%'¶
-
sensor_status
= 'e'¶
-
serial_number
= '# 1'¶
-
software_revision
= '# 2'¶
-
temperature_sensor
= 'T'¶
-
-
exception
hvl_ccb.dev.sst_luminox.
LuminoxMeasurementTypeError
[source]¶ Bases:
Exception
Wrong measurement type for requested data
-
class
hvl_ccb.dev.sst_luminox.
LuminoxOutputMode
[source]¶ Bases:
enum.Enum
output mode.
-
polling
= 1¶
-
streaming
= 0¶
-
-
exception
hvl_ccb.dev.sst_luminox.
LuminoxOutputModeError
[source]¶ Bases:
Exception
Wrong output mode for requested data
-
class
hvl_ccb.dev.sst_luminox.
LuminoxSerialCommunication
(configuration)[source]¶ Bases:
hvl_ccb.comm.serial.SerialCommunication
Specific communication protocol implementation for the SST Luminox oxygen sensor. Already predefines device-specific protocol parameters in config.
-
class
hvl_ccb.dev.sst_luminox.
LuminoxSerialCommunicationConfig
(port: str, baudrate: int = 9600, parity: Union[str, hvl_ccb.comm.serial.SerialCommunicationParity] = <SerialCommunicationParity.NONE: 'N'>, stopbits: Union[int, hvl_ccb.comm.serial.SerialCommunicationStopbits] = <SerialCommunicationStopbits.ONE: 1>, bytesize: Union[int, hvl_ccb.comm.serial.SerialCommunicationBytesize] = <SerialCommunicationBytesize.EIGHTBITS: 8>, terminator: bytes = b'rn', timeout: Union[int, float] = 3)[source]¶ Bases:
hvl_ccb.comm.serial.SerialCommunicationConfig
-
baudrate
= 9600¶ Baudrate for SST Luminox is 9600 baud
-
bytesize
= 8¶ One byte is eight bits long
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
parity
= 'N'¶ SST Luminox does not use parity
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
stopbits
= 1¶ SST Luminox does use one stop bit
-
terminator
= b'\r\n'¶ The terminator is CR LF
-
timeout
= 3¶ use 3 seconds timeout as default
-
hvl_ccb.dev.visa module¶
-
class
hvl_ccb.dev.visa.
VisaDevice
(com: Union[hvl_ccb.comm.visa.VisaCommunication, hvl_ccb.comm.visa.VisaCommunicationConfig, dict], dev_config: Union[hvl_ccb.dev.visa.VisaDeviceConfig, dict, None] = None)[source]¶ Bases:
hvl_ccb.dev.base.SingleCommDevice
Device communicating over the VISA protocol using VisaCommunication.
-
static
config_cls
()[source]¶ Return the default configdataclass class.
Returns: a reference to the default configdataclass class
-
static
default_com_cls
() → Type[hvl_ccb.comm.visa.VisaCommunication][source]¶ Return the default communication protocol for this device type, which is VisaCommunication.
Returns: the VisaCommunication class
-
get_identification
() → str[source]¶ Queries “*IDN?” and returns the identification string of the connected device.
Returns: the identification string of the connected device
-
spoll_handler
()[source]¶ Reads the status byte and decodes it. The status byte STB is defined in IEEE 488.2. It provides a rough overview of the instrument status.
Returns:
-
stop
() → None[source]¶ Stop the VisaDevice. Stops the polling thread and closes the communication protocol.
Returns:
-
wait_operation_complete
(timeout: Optional[float] = None) → bool[source]¶ Waits for a operation complete event. Returns after timeout [s] has expired or the operation complete event has been caught.
Parameters: timeout – Time in seconds to wait for the event; None for no timeout. Returns: True, if OPC event is caught, False if timeout expired
-
static
-
class
hvl_ccb.dev.visa.
VisaDeviceConfig
(spoll_interval: Union[int, float] = 0.5, spoll_start_delay: Union[int, float] = 2)[source]¶ Bases:
hvl_ccb.dev.visa._VisaDeviceConfigDefaultsBase
,hvl_ccb.dev.visa._VisaDeviceConfigBase
Configdataclass for a VISA device.
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
Parameters: - fieldname – name of the field
- value – value to assign
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
Returns: a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
Returns: a list of strings containing all optional keys.
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
Returns: a list of strings containing all required keys.
-
Module contents¶
Devices subpackage.