Power Supplies

htf support some programmable power supplies.

Rohde + Schwarz HMP Series programmable powersupplies

The Rhode + Schwarz HMP Series are programmable powersupplies that are supported by the HILSTER Testing Framework.

The user does not need not call any methods. He can use the automatic delegation to easily set current and voltage by assigning values to the members of the same names.

The abstraction supports virtual controls that appear as class members. These are voltage<i>, actual_voltage<i>, current<i> and actual_current<i>. <i> it the port (1..4).

For most usecases using the virtual controls should be appropriate.

To setup a HMP 2020 powersupply use:

from htf.powersupply import HMP2020

h - HMP2020("COM3")

# set the voltage on port 1
h.voltage1 - 1.23
# print the measured voltage on port 1
print(h.actual_voltage1)

# set the current on port 2
h.current2 - 0.2
# print the measured current on port 2
print(h.actual_current2)
class htf.powersupply.rs_hmpseries.HMP2020(comport, baudrate=9600, parity='N', stopbits=1, timeout=1.0, command_delay=0.05, wait_after_set_voltage=False, wait_time=0.5)

HMP2020: 1 × 0 V to 32 V/0 A to 10 A; 1 × 0 V to 32 V/0 A to 5 A (188 W)

close()

Close serial connection.

disable_output()

Disable the output of the currently selected channel.

enable_output()

Enable the output of the currently selected channel.

get_actual_current()

Get the measured current of the currently selected channel.

Returns

the measured current of the currently selected channel

Return type

float

get_actual_voltage()

Get the measured voltage of the currently selected channel.

Returns

the measured voltage of the currently selected channel

Return type

float

get_current()

Get the current of the currently selected channel.

Returns

the current of the currently selected channel

Return type

float

get_idn()

Get the identifier.

Returns

the identifier of the device

Return type

str

get_voltage()

Get the voltage of the currently selected channel.

Returns

the voltage of the currently selected channel

Return type

float

select_channel(channel)

Select a channel.

Parameters

channel (int) – the channel to be selected (1 .. 4)

set_current(current)

Set the current of the currently selected channel

Parameters

current (float) – the current to be set

set_voltage(voltage, auto_enable=False)

Set the volate on the currently selected channel.

Parameters
  • volate (float) – the voltage to be set.

  • auto_enable=False (bool) – if set to True the output is enabled automatically.

class htf.powersupply.rs_hmpseries.HMP2030(comport, baudrate=9600, parity='N', stopbits=1, timeout=1.0, command_delay=0.05, wait_after_set_voltage=False, wait_time=0.5)

HMP2030: 3 × 0 V to 32 V/0 A to 5 A (188 W)

close()

Close serial connection.

disable_output()

Disable the output of the currently selected channel.

enable_output()

Enable the output of the currently selected channel.

get_actual_current()

Get the measured current of the currently selected channel.

Returns

the measured current of the currently selected channel

Return type

float

get_actual_voltage()

Get the measured voltage of the currently selected channel.

Returns

the measured voltage of the currently selected channel

Return type

float

get_current()

Get the current of the currently selected channel.

Returns

the current of the currently selected channel

Return type

float

get_idn()

Get the identifier.

Returns

the identifier of the device

Return type

str

get_voltage()

Get the voltage of the currently selected channel.

Returns

the voltage of the currently selected channel

Return type

float

select_channel(channel)

Select a channel.

Parameters

channel (int) – the channel to be selected (1 .. 4)

set_current(current)

Set the current of the currently selected channel

Parameters

current (float) – the current to be set

set_voltage(voltage, auto_enable=False)

Set the volate on the currently selected channel.

Parameters
  • volate (float) – the voltage to be set.

  • auto_enable=False (bool) – if set to True the output is enabled automatically.

class htf.powersupply.rs_hmpseries.HMP4030(comport, baudrate=9600, parity='N', stopbits=1, timeout=1.0, command_delay=0.05, wait_after_set_voltage=False, wait_time=0.5)

HMP4030: 3 × 0 V to 32 V/0 A to 10 A (384 W)

close()

Close serial connection.

disable_output()

Disable the output of the currently selected channel.

enable_output()

Enable the output of the currently selected channel.

get_actual_current()

Get the measured current of the currently selected channel.

Returns

the measured current of the currently selected channel

Return type

float

get_actual_voltage()

Get the measured voltage of the currently selected channel.

Returns

the measured voltage of the currently selected channel

Return type

float

get_current()

Get the current of the currently selected channel.

Returns

the current of the currently selected channel

Return type

float

get_idn()

Get the identifier.

Returns

the identifier of the device

Return type

str

get_voltage()

Get the voltage of the currently selected channel.

Returns

the voltage of the currently selected channel

Return type

float

select_channel(channel)

Select a channel.

Parameters

channel (int) – the channel to be selected (1 .. 4)

set_current(current)

Set the current of the currently selected channel

Parameters

current (float) – the current to be set

set_voltage(voltage, auto_enable=False)

Set the volate on the currently selected channel.

Parameters
  • volate (float) – the voltage to be set.

  • auto_enable=False (bool) – if set to True the output is enabled automatically.

class htf.powersupply.rs_hmpseries.HMP4040(comport, baudrate=9600, parity='N', stopbits=1, timeout=1.0, command_delay=0.05, wait_after_set_voltage=False, wait_time=0.5)

HMP4040: 4 × 0 V to 32 V/0 A to 10 A (384 W)

close()

Close serial connection.

disable_output()

Disable the output of the currently selected channel.

enable_output()

Enable the output of the currently selected channel.

get_actual_current()

Get the measured current of the currently selected channel.

Returns

the measured current of the currently selected channel

Return type

float

get_actual_voltage()

Get the measured voltage of the currently selected channel.

Returns

the measured voltage of the currently selected channel

Return type

float

get_current()

Get the current of the currently selected channel.

Returns

the current of the currently selected channel

Return type

float

get_idn()

Get the identifier.

Returns

the identifier of the device

Return type

str

get_voltage()

Get the voltage of the currently selected channel.

Returns

the voltage of the currently selected channel

Return type

float

select_channel(channel)

Select a channel.

Parameters

channel (int) – the channel to be selected (1 .. 4)

set_current(current)

Set the current of the currently selected channel

Parameters

current (float) – the current to be set

set_voltage(voltage, auto_enable=False)

Set the volate on the currently selected channel.

Parameters
  • volate (float) – the voltage to be set.

  • auto_enable=False (bool) – if set to True the output is enabled automatically.

Manson HCS-3XXX

The Manson HCS-3XXX is a programmable power supply unit family.

The user does not need not call any methods. He can use the automatic delegation to easily set current and voltage by assigning values to the members of the same names.

from htf.powersupply import MansonHCS3xxx

m - MansonHCS3xxx("COM3")

# set output to 4 V
m.voltage - 4
print(m.voltage)
# set current (maximum) to 0.5 A
m.current - 0.5
print(m.current)

To store presets for current and voltage levels use the store_presets method. You can store up to three presets.

presets = {
    'P1': {'current': 12.0, 'voltage': 5.0},
    'P2': {'current': 12.0, 'voltage': 13.8},
    'P3': {'current': 12.0, 'voltage': 25.0}}
m.store_presets(presets)
class htf.powersupply.manson_hcs_3xxx.MansonHCS3xxx(port, decimal_places_for_current=1, debug=False)

MansonHCS3xxx is a hardware abstraction to the Manson HCS-3xxx power supply family using a UART to control it.

MansonHCS3xxx uses DelegatorMixin to automatically set and read it’s members voltage and current.

Parameters
  • port (str) – the comport to be used, eg. “COM3”, 3 or “/dev/ttyUSB0”, etc.

  • decimal_places_for_current=1 (int) – the number of decimal places for the current. HCS-3100, 3150, 3200 and 3202 have one decimal place. HCS-3102, 3014 and 3204 have two decimal places.

  • debug=False (bool) – if set to True debugging is enabled

close()

Close the serial member. This method is automatically called when __del__ is called.

disable_output()

Disable output.

enable_output()

Enable output.

get_current()

Read the current current from device and return the result.

Returns

the current current.

Return type

float

get_display_voltage_current_and_status()

Get the display voltage, current and status.

Returns

a dictionary containing “voltage”, “current” and “status”.

Return type

dict

get_preset_maximum_current()

Get preset maximum current for current preset.

Returns

the preset maximum current.

Return type

int

get_preset_maximum_voltage()

Get preset maximum voltage for current preset.

Returns

the preset maximum voltage.

Return type

int

get_preset_maximum_voltage_and_current()

Get the preset maximum voltage and current.

Returns

a dictionary containing “voltage” and “current”.

Return type

dict

get_preset_voltage_and_current()

Get the preset voltage and current.

Returns

a dictionary containing “voltage” and “current”.

Return type

dict

get_presets()

Get three voltage-current presets.

Returns

a dictionary containing “voltage”, “current” and “P<preset>”.

Return type

dict

get_voltage()

Read current voltage from device and return the result.

Returns

the current voltage.

Return type

float

load_preset(preset)

Load preset preset.

Parameters

preset (int) – may be 0, 1, or 2.

preset_maximum_current(current)

Set maximum voltage for current preset.

preset_maximum_voltage(voltage)

Set maximum voltage for current preset.

query(query, answer_lines=1)

Send a command and wait for the answer.

Parameters
  • query (str) – the query to be sent.

  • answer_lines=1 (int) – the number of lines to be received.

Returns

the answer line(s).

Return type

str

Raises

manson_hcs_3xxx.TimeoutException – if a communication time-out occurred.

set_current(current)

Set the output current to current.

Parameters

current (int, float or str) – the current in units of amperes as int(), float() or string, eg. 0, 0.5, “0.5” or even “0.5 mA” work.

set_voltage(voltage)

Set the output voltage to voltage.

Parameters

voltage (int, float or str) – the voltage in units of volts as int(), float() or string, eg. 23, 23.0, “23.0” or even “23.0 V” work. voltage may have on decimal point. If voltage is None the output is disabled.

store_presets(presets)

Store three voltage-current presets.

Parameters

presets (dict) – a dictionary containing the key P1, P2 and P3. Each key contains “voltage” and “current” keys.

exception htf.powersupply.manson_hcs_3xxx.TimeoutException

Exception that is raised if a communication time-out occurred.

KORAD KA3005P

The KORAD KA3005P is a programmable power supply unit.

To use the implementation you do not need to call any methods. Simply use the automatic delegation to easily set current and voltages by assigning values to the members of the same name.

from htf.powersupply import KORAD_KA3005P

k - KORAD_KA3005P("COM3")

# set output to 4 V
k.voltage - 4
print(k.voltage)
# set current (maximum) to 0.5 A
k.current - 0.5
print(k.current)
class htf.powersupply.korad_ka3005p.KORAD_KA3005P(port, debug=False)

KORAD_KA3005P is a hardware abstraction to the KORAD KA3005P power supply unit using a UART to control it.

KORAD_KA3005P uses DelegatorMixin to automatically set and read it’s members voltage and current.

Parameters
  • port (str) – the comport to be used, eg. “COM3”, 3 or “/dev/ttyUSB0”, etc.

  • debug=False (bool) – if set to True debugging is enabled.

close()

Close the serial member. This method is automatically called when __del__ is called.

disable_output()

Disable output.

enable_output()

Enable output.

Raises

SetOutputException – if output was not set.

get_current_current(channel=1)

Read the current current from device and return the result.

Parameters

channel (int) – the channel to use. Shall always be 1.

Returns

the current current.

Return type

float

get_current_voltage(channel=1)

Read current voltage from device and return the result.

Parameters

channel=1 (int) – the channel to use. Shall always be 1.

Returns

the current voltage.

Return type

float

get_id()

Return the KORAD id.

Returns

the KORAD id.

Return type

str

get_status()

Read device status and return a dictionary.

Returns

the status dictionary containing the keys “ch1 mode”, “ch2 mode”, “tracking mode”, “beep”,

”lock” and “output”.

Return type

dict

query(query, length_of_answer=None, retries=3)

Send a command and wait for the answer.

Parameters
  • query (str) – the query to be sent.

  • length_of_answer=None (int) – the maximum number of bytes to be received.

  • retries=3 (int) – the number of retries.

Returns

the answer.

Return type

str

Raises

korad_ka3005p.TimeoutException – if a communication time-out occurred.

send_command(command)

Directly send a command to the power supply unit.

Parameters

command (str) – the command to be sent.

set_current(current, channel=1)

Set the output current for a given channel.

Parameters
  • current (int, float or str) – the current in units of amperes as int(), float() or string, eg. 0, 0.5, “0.5” or even “0.5 mA” work.

  • channel (int) – the channel to use. Shall always be 1.

Raises

SetCurrentException – if current was not set.

set_voltage(voltage, channel=1)

Set the output voltage for a given channel.

If voltage is None the output is disabled. If voltage is not None the output is enabled. If voltage changes the output is first disabled, changed, and then enabled again.

Parameters
  • voltage (float or None) – the voltage in units of volts as int(), float() or string, eg. 23, 23.0, “23.0”

  • even "23.0 V" work. (or) –

  • channel (int) – the channel to use. Shall always be 1.

Raises

SetVoltageException – if voltage was not set.

exception htf.powersupply.korad_ka3005p.SetCurrentException

Exception that is raised if current was not set.

exception htf.powersupply.korad_ka3005p.SetOutputException

Exception that is raised if the output was not set.

exception htf.powersupply.korad_ka3005p.SetVoltageException

Exception that is raised if voltage was not set.

exception htf.powersupply.korad_ka3005p.TimeoutException

Exception that is raised if a communication time-out occurred.