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:
-
apply_to_devices
(func: Callable[[hvl_ccb.dev.base.Device], object]) → Dict[str, object][source]¶ Apply a function to all devices in this sequence.
Parameters: func – is a function that takes a device as an argument. Returns: a sequence of objects returned by the called function.
-
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.
-
-
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.
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.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: (<class 'int'>, <class 'float'>) = 0.5, spoll_start_delay: (<class 'int'>, <class 'float'>) = 2, power_limit: (<class 'int'>, <class 'float'>) = 43500, voltage_lower_limit: (<class 'int'>, <class 'float'>) = 0.0, voltage_upper_limit: (<class 'int'>, <class 'float'>) = 10.0, current_lower_limit: (<class 'int'>, <class 'float'>) = 0.0, current_upper_limit: (<class 'int'>, <class 'float'>) = 2040.0)[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.
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.
-
-
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: (<class 'str'>, <aenum '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.
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.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 work with T4, T7 and DIGIT communicating through the LJM Library. Other or older hardware versions and variants of LabJack devices are not supported.
-
class
CjcType
(*args, **kwds)[source]¶ Bases:
hvl_ccb.utils.enum.NameEnum
CJC slope and offset
-
internal
= (1, 0)¶
-
lm34
= (55.56, 255.37)¶
-
-
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
(channel: int) → float[source]¶ Read the voltage of an analog input.
Parameters: channel – is the AIN number (0..254) Returns: the read voltage
-
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_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, ain_range: float) → None[source]¶ Set the range of an analog input port.
Possible values for
ain_range
are:- 10 => +- 10 V
- 1 => +- 1 V
- 0.1 => +- 0.1 V
- 0.01 => +- 0.01 V
Parameters: - channel – is the AIN number (0..254)
- ain_range – is the range specifier
-
set_ain_resolution
(channel: int, resolution: int) → None[source]¶ Set the resolution index of an analog input port.
For a T7 Pro values between 0-12 are allowed. 0 will set the resolution index to default value.
Parameters: - channel – is the AIN number (0..254)
- resolution – is the resolution index
-
set_ain_thermocouple
(pos_channel: int, thermocouple: Union[None, str, hvl_ccb.dev.labjack.LabJack.ThermocoupleType], cjc_address: int = 60050, cjc_type: Union[str, hvl_ccb.dev.labjack.LabJack.CjcType] = <CjcType.internal: (1, 0)>, vrange: float = 0.01, resolution: int = 10, unit: Union[str, hvl_ccb.dev.labjack.LabJack.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 (10, 1, 0.1, 0.01)
- 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.
-
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.
-
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?
-
static
-
class
hvl_ccb.dev.mbw973.
MBW973Config
(polling_interval: (<class 'int'>, <class '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.
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: (<class 'str'>, <aenum 'Parity'>) = <Parity.NONE: 'N'>, stopbits: (<class 'int'>, <aenum 'Stopbits'>) = <Stopbits.ONE: 1>, bytesize: (<class 'int'>, <aenum 'Bytesize'>) = <Bytesize.EIGHTBITS: 8>, terminator: bytes = b'r', timeout: (<class 'int'>, <class '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.
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.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.
-
SHORT_PAUSE_SECONDS
= 0.1¶ time for short wait periods (depends on both device and network/connection)
-
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
hvl_ccb.dev.rs_rto1024.
RTO1024Config
(waveforms_path: str, settings_path: str, backup_path: str, spoll_interval: (<class 'int'>, <class 'float'>) = 0.5, spoll_start_delay: (<class 'int'>, <class 'float'>) = 2, command_timeout_seconds: (<class 'int'>, <class 'float'>) = 60)[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.
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: (<class 'str'>, <aenum '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.
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¶
-
-
class
RegAddr
[source]¶ Bases:
enum.IntEnum
ILS2T Modbus Register Adresses
-
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
RegDatatype
(*args, **kwds)[source]¶ Bases:
aenum.Enum
Modbus Register Datatypes
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)¶
-
-
class
State
[source]¶ Bases:
enum.IntEnum
State machine status values
-
ON
= 6¶
-
QUICKSTOP
= 7¶
-
READY
= 4¶
-
-
absolute_position
(position: int) → None[source]¶ Turn the motor until it reaches the absolute position. This function does not enable or disable the motor automatically.
Parameters: position – absolute position of motor in user defined steps.
-
absolute_position_and_wait
(position: int) → None[source]¶ Enable motor, perform absolute position and wait until done, disable.
Parameters: position – absolute position of motor in user defined steps.
-
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
-
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.
-
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.
-
relative_step
(steps: int) → None[source]¶ Turn the motor the relative amount of steps. This function does not enable or disable the motor automatically. positive numbers -> CW negative numbers -> CCW
Parameters: steps – Number of steps to turn the motor.
-
relative_step_and_wait
(steps: int) → None[source]¶ Enable motor, perform relative steps and wait until done, disable.
Parameters: steps – Number of steps.
-
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
-
-
class
hvl_ccb.dev.se_ils2t.
ILS2TConfig
(rpm_max_init: int = 1500)[source]¶ Bases:
object
Configuration for the ILS2T stepper motor 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.
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.
-
-
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.
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.
-
-
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.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: 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 Returns: True, if OPC event is caught, False if timeout expired
-
static
-
class
hvl_ccb.dev.visa.
VisaDeviceConfig
(spoll_interval: (<class 'int'>, <class 'float'>) = 0.5, spoll_start_delay: (<class 'int'>, <class '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.
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.