The tenma module

Autogenerated API documentation for tenma

Complete serial driver for the Tenma 72-2535, *72-2540, *72-2545, *72-2550, 72-2930 and *72-2940 (see details below)

Note

* The driver has not been tested on the models with a *. However, the two models that has been tested, seems like are built from the same template, so there is a very high probability that the generic TenmaBase driver will work with those as well.

Implemented according to “Series Protocol V2.0 of Remote Control” (referred to in inline comments as the spec) which can be downloaded from the link below.

Manual and specification can be downloaded from here: https://www.element14.com/community/ docs/DOC-75108/l/protocol-information-for-tenma-72-2550-and-tenma-72-2535-qa-window- driver

class PyExpLabSys.drivers.tenma.TenmaBase(device, sleep_after_command=0.1)[source]

Bases: serial.serialposix.Serial

Serial driver for the Tenma 72-2535, *72-2540, *72-2545, *72-2550, 72-2930 and *72-2940 power supplies

Note

* The driver has not been tested on the models with a *. However, the two models that has been tested, seems like are built from the same template, so there is a very high probability that the generic TenmaBase driver will work with those as well.

__init__(device, sleep_after_command=0.1)[source]

Initialize driver

Parameters:
  • device (str) – The serial device to connect to e.g. COM4 or /dev/ttyUSB0
  • sleep_after_command (float) – (Optional) The time to sleep after sending a command, to make sure that the device is ready for another one. Defaults to 0.1, but quick tests suggest that 0.05 might be enough.
com(command, decode_reply=True)[source]

Send command to the device and possibly return reply

Parameters:
  • command (str) – Command as unicode object
  • decode_reply (bool) – (Optional) Whether the reply should be utf-8 decoded to return a unicode object
set_current(current)[source]

Sets the current setpoint

Parameters:current (float) – The current to set
get_current()[source]

Return the current setpoint

Returns:The current setpoint
Return type:float
set_voltage(voltage)[source]

Sets the voltage setpoint

Parameters:voltage (float) – The voltage to set
get_voltage()[source]

Return the voltage setpoint

Returns:The voltage setpoint
Return type:float
get_actual_current()[source]

Return the actual_current

Returns:The actual current
Return type:float
get_actual_voltage()[source]

Return the actual voltage

Returns:The actual coltage
Return type:float
set_beep(on_off)[source]

Turn the beep on or off

on_off (bool): The beep status to set

set_output(on_off)[source]

Turn the output of or off

on_off (bool): The otput status to set

status()[source]

Return the status

The output is a dict with the following keys and types:

status = {
    'channel1_mode': 'CV',  # or 'CC' for constand current of voltage
    'channel2_mode': 'CV',  # or 'CC' for constand current of voltage
    'beep_on': True,
    'lock_on': False,
    'output_on': True,
    'tracking_status: 'Independent',  # or 'Series' or 'Parallel'
}
Returns:See fields specification above
Return type:dict
get_identification()[source]

Return the device identification

Returns:E.g: ‘TENMA 72-2535 V2.0’
Return type:str
recall_memory(memory_number)[source]

Recall memory of panel settings

Note

Recalling memory will automaticall disable output

Parameters:number (int) – The number of the panel settings memory to recall
Raises:ValueError – On invalid memory_number
save_memory(memory_number)[source]

Recall memory of panel settings

Note

Saving to a memory slot seems to only be available for the memory slot currently active

Parameters:number (int) – The number of the panel settings memory to recall
Raises:ValueError – On invalid memory_number
set_overcurrent_protection(on_off)[source]

Set the over current protection (OCP) on or off

Parameters:on_off (bool) – The overcurrent protection mode to set
set_overvoltage_protection(on_off)[source]

Set the over voltage protection (OVP) on or off

Parameters:on_off (bool) – The overvoltage protection mode to set
class PyExpLabSys.drivers.tenma.Tenma722535(device, sleep_after_command=0.1)[source]

Bases: PyExpLabSys.drivers.tenma.TenmaBase

Driver for the Tenma 72-2535 power supply

class PyExpLabSys.drivers.tenma.Tenma722550(device, sleep_after_command=0.1)[source]

Bases: PyExpLabSys.drivers.tenma.TenmaBase

Driver for the Tenma 72-2550 power supply

class PyExpLabSys.drivers.tenma.Tenma722930(device, sleep_after_command=0.1)[source]

Bases: PyExpLabSys.drivers.tenma.TenmaBase

Driver for the Tenma 72-2930 power supply

PyExpLabSys.drivers.tenma.main()[source]

Main module function, used for testing simple functional test