hvl_ccb.dev.heinzinger

Inheritance diagram of 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, 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: IntEnum

An enumeration.

EIGHT = 8
FOUR = 4
ONE = 1
SIXTEEN = 16
TWO = 2
clean_values()[source]
default_number_of_recordings: Union[int, 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: SingleCommDevice, 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: 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: 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, 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.

stop() None[source]

Stop the device. Closes also the communication protocol.

class HeinzingerPNC(com, dev_config=None)[source]

Bases: 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, qualname=None, type=None, start=1, boundary=None)[source]

Bases: AutoNumberNameEnum

An enumeration.

A = 3
UNKNOWN = 1
mA = 2
class UnitVoltage(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: 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

start() None[source]

Opens the communication protocol and configures the device.

property unit_current: UnitCurrent
property unit_voltage: UnitVoltage
exception HeinzingerPNCDeviceNotRecognizedError[source]

Bases: HeinzingerPNCError

Error indicating that the serial number of the device is not recognized.

exception HeinzingerPNCError[source]

Bases: DeviceError

General error with the Heinzinger PNC voltage source.

exception HeinzingerPNCMaxCurrentExceededError[source]

Bases: HeinzingerPNCError

Error indicating that program attempted to set the current to a value exceeding ‘max_current’.

exception HeinzingerPNCMaxVoltageExceededError[source]

Bases: HeinzingerPNCError

Error indicating that program attempted to set the voltage to a value exceeding ‘max_voltage’.

class HeinzingerSerialCommunication(configuration)[source]

Bases: 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

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: SerialCommunicationConfig

baudrate: int = 9600

Baudrate for Heinzinger power supplies is 9600 baud

bytesize: Union[int, 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, 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, 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