hvl_ccb.dev.fug.fug
Device classes for “Probus V - ADDAT30” Interfaces which are used to control power supplies from FuG Elektronik GmbH
This interface is used for many FuG power units. Manufacturer homepage: https://www.fug-elektronik.de
The Professional Series of Power Supplies from FuG is a series of low, medium and high voltage direct current power supplies as well as capacitor chargers. The class FuG is tested with a HCK 800-20 000 in Standard Mode. The addressable mode is not implemented. Check the code carefully before using it with other devices. Manufacturer homepage: https://www.fug-elektronik.de/netzgeraete/professional-series/
The documentation of the interface from the manufacturer can be found here: https://www.fug-elektronik.de/wp-content/uploads/download/de/SOFTWARE/Probus_V.zip
The provided classes support the basic and some advanced commands. The commands for calibrating the power supplies are not implemented, as they are only for very special porpoises and should not used by “normal” customers.
- class FuG(com, dev_config=None)[source]
Bases:
FuGProbusV
FuG power supply device class.
The power supply is controlled over a FuG ADDA Interface with the PROBUS V protocol
- property config_status: FuGProbusVConfigRegisters
Returns the registers for the registers with the configuration and status values
- Returns:
FuGProbusVConfigRegisters
- property current: FuGProbusVSetRegisters
Returns the registers for the current output
- Returns:
- property current_monitor: FuGProbusVMonitorRegisters
Returns the registers for the current monitor.
A typically usage will be “self.current_monitor.value” to measure the output current
- Returns:
- property di: FuGProbusVDIRegisters
Returns the registers for the digital inputs
- Returns:
FuGProbusVDIRegisters
- identify_device() None [source]
Identify the device nominal voltage and current based on its model number.
- Raises:
SerialCommunicationIOError – when communication port is not opened
- property max_current: int | float
Returns the maximal current which could provided within the test setup
- Returns:
- property max_current_hardware: int | float
Returns the maximal current which could provided with the power supply
- Returns:
- property max_voltage: int | float
Returns the maximal voltage which could provided within the test setup
- Returns:
- property max_voltage_hardware: int | float
Returns the maximal voltage which could provided with the power supply
- Returns:
- property on: FuGProbusVDORegisters
Returns the registers for the output switch to turn the output on or off
- Returns:
FuGProbusVDORegisters
- property outX0: FuGProbusVDORegisters
Returns the registers for the digital output X0
- Returns:
FuGProbusVDORegisters
- property outX1: FuGProbusVDORegisters
Returns the registers for the digital output X1
- Returns:
FuGProbusVDORegisters
- property outX2: FuGProbusVDORegisters
Returns the registers for the digital output X2
- Returns:
FuGProbusVDORegisters
- property outXCMD: FuGProbusVDORegisters
Returns the registers for the digital outputX-CMD
- Returns:
FuGProbusVDORegisters
- start(max_voltage=0, max_current=0) None [source]
Opens the communication protocol and configures the device.
- Parameters:
max_voltage – Configure here the maximal permissible voltage which is allowed in the given experimental setup
max_current – Configure here the maximal permissible current which is allowed in the given experimental setup
- property voltage: FuGProbusVSetRegisters
Returns the registers for the voltage output
- Returns:
- property voltage_monitor: FuGProbusVMonitorRegisters
Returns the registers for the voltage monitor.
A typically usage will be “self.voltage_monitor.value” to measure the output voltage
- Returns:
- class FuGConfig(wait_sec_stop_commands: int | float = 0.5)[source]
Bases:
object
Device configuration dataclass for FuG power supplies.
- 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_stop_commands: int | float = 0.5
Time to wait after subsequent commands during stop (in seconds)
- class FuGDigitalVal(value)[source]
Bases:
IntEnum
An enumeration.
- NO = 0
- OFF = 0
- ON = 1
- YES = 1
- exception FuGError(*args, **kwargs)[source]
Bases:
DeviceError
Error with the FuG voltage source.
- errorcode: str
Errorcode from the Probus, see documentation of Probus V chapter 5. Errors with three-digit errorcodes are thrown by this python module.
- class FuGErrorcodes(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
NameEnum
The power supply can return an errorcode. These errorcodes are handled by this class. The original errorcodes from the source are with one or two digits, see documentation of Probus V chapter 5. All three-digit errorcodes are from this python module.
- E0 = ('no error', 'standard response on each command')
- E1 = ('no data available', 'Customer tried to read from GPIB but there were no data prepared. (IBIG50 sent command ~T2 to ADDA)')
- E10 = ('unknown SCPI command', 'This SCPI command is not implemented')
- E100 = ('Command is not implemented', 'You tried to execute a command, which is not implemented or does not exist')
- E106 = ('The rampstate is a read-only register', 'You tried to write data to the register, which can only give you the status of the ramping.')
- E11 = ('not allowed Trigger-on-Talk', 'Not allowed attempt to Trigger-on-Talk (~T1) while ADDA was in addressable mode.')
- E115 = ('The given index to select a digital value is out of range', 'Only integer values between 0 and 1 are allowed.')
- E12 = ('invalid argument in ~Tn command', 'Only ~T1 and ~T2 is implemented.')
- E125 = ('The given index to select a ramp mode is out of range', 'Only integer values between 0 and 4 are allowed.')
- E13 = ('invalid N-value', 'Register > K8 contained an invalid value. Error code is output on an attempt to query data with ? or ~T1')
- E135 = ('The given index to select the readback channel is out of range', 'Only integer values between 0 and 6 are allowed.')
- E14 = ('register is write only', 'Some registers can only be writte to (i.e.> H0)')
- E145 = ('The given value for the AD-conversion is unknown', 'Valid values for the ad-conversion are integer values from "0" to "7".')
- E15 = ('string too long', 'i.e.serial number string too long during calibration')
- E155 = ('The given value to select a polarity is out range.', 'The value should be 0 or 1.')
- E16 = ('wrong checksum', 'checksum over command string was not correct, refer also to 4.4 of the Probus V documentation')
- E165 = ('The given index to select the terminator string is out of range', '')
- E2 = ('unknown register type', "No valid register type after '>'")
- E206 = ('This status register is read-only', 'You tried to write data to this register, which can only give you the actual status of the corresponding digital output.')
- E306 = ('The monitor register is read-only', 'You tried to write data to a monitor, which can only give you measured data.')
- E4 = ('invalid argument', 'The argument of the command was rejected .i.e. malformed number')
- E5 = ('argument out of range', 'i.e. setvalue higher than type value')
- E504 = ('Empty string as response', 'The connection is broken.')
- E505 = ('The returned register is not the requested.', 'Maybe the connection is overburden.')
- E6 = ('register is read only', 'Some registers can only be read but not written to. (i.e. monitor registers)')
- E666 = ('You cannot overwrite the most recent error in the interface of the power supply. But, well: You created an error anyway...', '')
- E7 = ('Receive Overflow', 'Command string was longer than 50 characters.')
- E8 = ('EEPROM is write protected', 'Write attempt to calibration data while the write protection switch was set to write protected.')
- E9 = ('address error', 'A non addressed command was sent to ADDA while it was in addressable mode (and vice versa).')
- class FuGMonitorModes(value)[source]
Bases:
IntEnum
An enumeration.
- T1MS = 1
15 bit + sign, 1 ms integration time
- T200MS = 6
typ. 19 bit + sign, 200 ms integration time
- T20MS = 3
17 bit + sign, 20 ms integration time
- T256US = 0
14 bit + sign, 256 us integration time
- T40MS = 4
17 bit + sign, 40 ms integration time
- T4MS = 2
15 bit + sign, 4 ms integration time
- T800MS = 7
typ. 20 bit + sign, 800 ms integration time
- T80MS = 5
typ. 18 bit + sign, 80 ms integration time
- class FuGProbusIV(com, dev_config=None)[source]
Bases:
SingleCommDevice
,ABC
FuG Probus IV device class
Sends basic SCPI commands and reads the answer. Only the special commands and PROBUS IV instruction set is implemented.
- command(command: FuGProbusIVCommands, value=None) str [source]
- Parameters:
command – one of the commands given within FuGProbusIVCommands
value – an optional value, depending on the command
- Returns:
a String if a query was performed
- static config_cls()[source]
Return the default configdataclass class.
- Returns:
a reference to the default configdataclass class
- class FuGProbusIVCommands(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
NameEnum
An enumeration.
- ADMODE = ('S', (<enum 'FuGMonitorModes'>, <class 'int'>))
- CURRENT = ('I', (<class 'int'>, <class 'float'>))
- EXECUTE = ('X', None)
- EXECUTEONX = ('G', (<enum 'FuGDigitalVal'>, <class 'int'>))
Wait for “X” to execute pending commands
- ID = ('*IDN?', None)
- OUTPUT = ('F', (<enum 'FuGDigitalVal'>, <class 'int'>))
- POLARITY = ('P', (<enum 'FuGPolarities'>, <class 'int'>))
- QUERY = ('?', None)
- READBACKCHANNEL = ('N', (<enum 'FuGReadbackChannels'>, <class 'int'>))
- RESET = ('=', None)
- TERMINATOR = ('Y', (<enum 'FuGTerminators'>, <class 'int'>))
- VOLTAGE = ('U', (<class 'int'>, <class 'float'>))
- XOUTPUTS = ('R', <class 'int'>)
TODO: the possible values are limited to 0..13
- class FuGProbusV(com, dev_config=None)[source]
Bases:
FuGProbusIV
FuG Probus V class which uses register based commands to control the power supplies
- class FuGProbusVConfigRegisters(fug, super_register: FuGProbusVRegisterGroups)[source]
Bases:
object
Configuration and Status values, acc. 4.2.5
- property execute_on_x: FuGDigitalVal
status of Execute-on-X
- Returns:
FuGDigitalVal of the status
- property most_recent_error: FuGErrorcodes
Reads the Error-Code of the most recent command
- Return FuGError:
- Raises:
FuGError – if code is not “E0”
- property readback_data: FuGReadbackChannels
Preselection of readout data for Trigger-on-Talk
- Returns:
index for the readback channel
- property srq_mask: int
SRQ-Mask, Service-Request Enable status bits for SRQ 0: no SRQ Bit 2: SRQ on change of status to CC Bit 1: SRQ on change to CV
- Returns:
representative integer value
- property srq_status: str
SRQ-Statusbyte output as a decimal number: Bit 2: PS is in CC mode Bit 1: PS is in CV mode
- Returns:
representative string
- property status: str
Statusbyte as a string of 0/1. Combined status (compatibel to Probus IV), MSB first: Bit 7: I-REG Bit 6: V-REG Bit 5: ON-Status Bit 4: 3-Reg Bit 3: X-Stat (polarity) Bit 2: Cal-Mode Bit 1: unused Bit 0: SEL-D
- Returns:
string of 0/1
- property terminator: FuGTerminators
Terminator character for answer strings from ADDA
- Returns:
FuGTerminators
- class FuGProbusVDIRegisters(fug, super_register: FuGProbusVRegisterGroups)[source]
Bases:
object
Digital Inputs acc. 4.2.4
- property analog_control: FuGDigitalVal
- Returns:
shows 1 if power supply is controlled by the analog interface
- property calibration_mode: FuGDigitalVal
- Returns:
shows 1 if power supply is in calibration mode
- property cc_mode: FuGDigitalVal
- Returns:
shows 1 if power supply is in CC mode
- property cv_mode: FuGDigitalVal
- Returns:
shows 1 if power supply is in CV mode
- property digital_control: FuGDigitalVal
- Returns:
shows 1 if power supply is digitally controlled
- property on: FuGDigitalVal
- Returns:
shows 1 if power supply ON
- property reg_3: FuGDigitalVal
For special applications.
- Returns:
input from bit 3-REG
- property x_stat: FuGPolarities
- Returns:
polarity of HVPS with polarity reversal
- class FuGProbusVDORegisters(fug, super_register: FuGProbusVRegisterGroups)[source]
Bases:
object
Digital outputs acc. 4.2.2
- property out: int | FuGDigitalVal
Status of the output according to the last setting. This can differ from the actual state if output should only pulse.
- Returns:
FuGDigitalVal
- property status: FuGDigitalVal
Returns the actual value of output. This can differ from the set value if pulse function is used.
- Returns:
FuGDigitalVal
- class FuGProbusVMonitorRegisters(fug, super_register: FuGProbusVRegisterGroups)[source]
Bases:
object
Analog monitors acc. 4.2.3
- property adc_mode: FuGMonitorModes
The programmed resolution and integration time of the AD converter
- Returns:
FuGMonitorModes
- property value: float
Value from the monitor.
- Returns:
a float value in V or A
- property value_raw: float
uncalibrated raw value from AD converter
- Returns:
float value from ADC
- class FuGProbusVRegisterGroups(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
NameEnum
An enumeration.
- CONFIG = 'K'
- INPUT = 'D'
- MONITOR_I = 'M1'
- MONITOR_V = 'M0'
- OUTPUTONCMD = 'BON'
- OUTPUTX0 = 'B0'
- OUTPUTX1 = 'B1'
- OUTPUTX2 = 'B2'
- OUTPUTXCMD = 'BX'
- SETCURRENT = 'S1'
- SETVOLTAGE = 'S0'
- class FuGProbusVSetRegisters(fug, super_register: FuGProbusVRegisterGroups)[source]
Bases:
object
Setvalue control acc. 4.2.1 for the voltage and the current output
- property actualsetvalue: float
The actual valid set value, which depends on the ramp function.
- Returns:
actual valid set value
- property high_resolution: FuGDigitalVal
Status of the high resolution mode of the output.
- Return 0:
normal operation
- Return 1:
High Res. Mode
- property rampmode: FuGRampModes
The set ramp mode to control the setvalue.
- Returns:
the mode of the ramp as instance of FuGRampModes
- property ramprate: float
The set ramp rate in V/s.
- Returns:
ramp rate in V/s
- property rampstate: FuGDigitalVal
Status of ramp function.
- Return 0:
if final setvalue is reached
- Return 1:
if still ramping up
- property setvalue: float
For the voltage or current output this setvalue was programmed.
- Returns:
the programmed setvalue
- class FuGRampModes(value)[source]
Bases:
IntEnum
An enumeration.
- FOLLOWRAMP = 1
Follow the ramp up- and downwards
- IMMEDIATELY = 0
Standard mode: no ramp
- ONLYUPWARDSOFFTOZERO = 4
Follow the ramp up- and downwards, if output is OFF set value is zero
- RAMPUPWARDS = 2
Follow the ramp only upwards, downwards immediately
- SPECIALRAMPUPWARDS = 3
Follow a special ramp function only upwards
- class FuGReadbackChannels(value)[source]
Bases:
IntEnum
An enumeration.
- CURRENT = 1
- FIRMWARE = 5
- RATEDCURRENT = 4
- RATEDVOLTAGE = 3
- SN = 6
- STATUSBYTE = 2
- VOLTAGE = 0
- class FuGSerialCommunication(configuration)[source]
Bases:
SerialCommunication
Specific communication protocol implementation for FuG 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
- query(command: str) str [source]
Send a command to the interface and handle the status message. Raises an error, if the answer starts with “E”.
- Parameters:
command – Command to send
- Raises:
FuGError – if the connection is broken or the error from the power source itself
- Returns:
Answer from the interface or empty string
- class FuGSerialCommunicationConfig(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 = 10, port: Optional[str] = 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 FuG power supplies is 9600 baud
- bytesize: int | SerialCommunicationBytesize = 8
One byte is eight bits long
- default_n_attempts_read_text_nonempty: int = 10
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: str | SerialCommunicationParity = 'N'
FuG 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: int | SerialCommunicationStopbits = 1
FuG uses one stop bit
- terminator: bytes = b'\n'
The terminator is LF
- timeout: int | float = 3
use 3 seconds timeout as default
- wait_sec_read_text_nonempty: int | float = 0.5
default time to wait between attempts of reading a non-empty text