hvl_ccb.dev.heinzinger¶
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 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(value)[source]¶
Bases:
enum.IntEnum
An enumeration.
- EIGHT = 8¶
- FOUR = 4¶
- ONE = 1¶
- SIXTEEN = 16¶
- TWO = 2¶
- default_number_of_recordings: Union[int, hvl_ccb.dev.heinzinger.HeinzingerConfig.RecordingsEnum] = 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: int = 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: Union[int, float] = 0.5¶
Time to wait after subsequent commands during stop (in seconds)
- class 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.
- class OutputStatus(value)[source]¶
Bases:
enum.IntEnum
Status of the voltage output
- OFF = 0¶
- ON = 1¶
- UNKNOWN = -1¶
- 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 and updates the output status.
- Raises
SerialCommunicationIOError – when communication port is not opened
- output_on() None [source]¶
Switch DC voltage output on and updates the output status.
- Raises
SerialCommunicationIOError – when communication port is not opened
- property output_status: hvl_ccb.dev.heinzinger.HeinzingerDI.OutputStatus¶
- 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
- abstract start()[source]¶
Opens the communication protocol.
- Raises
SerialCommunicationIOError – when communication port cannot be opened.
- class 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(value=<no_arg>, names=None, module=None, type=None, start=1, boundary=None)[source]¶
Bases:
hvl_ccb.utils.enum.AutoNumberNameEnum
An enumeration.
- A = 3¶
- UNKNOWN = 1¶
- mA = 2¶
- class UnitVoltage(value=<no_arg>, names=None, module=None, type=None, start=1, boundary=None)[source]¶
Bases:
hvl_ccb.utils.enum.AutoNumberNameEnum
An enumeration.
- 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
- property max_current: Union[int, float]¶
- property max_current_hardware: Union[int, float]¶
- property max_voltage: Union[int, float]¶
- property max_voltage_hardware: Union[int, float]¶
- 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
- property unit_current: hvl_ccb.dev.heinzinger.HeinzingerPNC.UnitCurrent¶
- property unit_voltage: hvl_ccb.dev.heinzinger.HeinzingerPNC.UnitVoltage¶
- exception HeinzingerPNCDeviceNotRecognizedException[source]¶
Bases:
hvl_ccb.dev.heinzinger.HeinzingerPNCError
Error indicating that the serial number of the device is not recognized.
- exception HeinzingerPNCError[source]¶
Bases:
Exception
General error with the Heinzinger PNC voltage source.
- exception HeinzingerPNCMaxCurrentExceededException[source]¶
Bases:
hvl_ccb.dev.heinzinger.HeinzingerPNCError
Error indicating that program attempted to set the current to a value exceeding ‘max_current’.
- exception HeinzingerPNCMaxVoltageExceededException[source]¶
Bases:
hvl_ccb.dev.heinzinger.HeinzingerPNCError
Error indicating that program attempted to set the voltage to a value exceeding ‘max_voltage’.
- class 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.
- class HeinzingerSerialCommunicationConfig(terminator: bytes = b'\n', encoding: str = 'utf-8', encoding_error_handling: str = 'strict', wait_sec_read_text_nonempty: Union[int, float] = 0.5, default_n_attempts_read_text_nonempty: int = 40, port: Union[str, NoneType] = None, 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>, timeout: Union[int, float] = 3)[source]¶
Bases:
hvl_ccb.comm.serial.SerialCommunicationConfig
- baudrate: int = 9600¶
Baudrate for Heinzinger power supplies is 9600 baud
- bytesize: Union[int, hvl_ccb.comm.serial.SerialCommunicationBytesize] = 8¶
One byte is eight bits long
- default_n_attempts_read_text_nonempty: int = 40¶
increased to 40 default number of attempts to read a non-empty text
- 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: Union[str, hvl_ccb.comm.serial.SerialCommunicationParity] = '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: Union[int, hvl_ccb.comm.serial.SerialCommunicationStopbits] = 1¶
Heinzinger uses one stop bit
- terminator: bytes = b'\n'¶
The terminator is LF
- timeout: Union[int, float] = 3¶
use 3 seconds timeout as default
- wait_sec_read_text_nonempty: Union[int, float] = 0.5¶
default time to wait between attempts of reading a non-empty text