API for the Omega CN7500 example driver

Driver for the Omega CN7500 process controller, for communication using the Modbus RTU protocol.

omegacn7500.SETPOINT_MAX = 999.9

Default value for maximum allowed setpoint.

omegacn7500.TIME_MAX = 900

Default value for maximum allowed step time.

omegacn7500.CONTROL_MODES = {0: 'PID', 1: 'ON/OFF', 2: 'Manual Tuning', 3: 'Program'}

Description of the control mode numerical values.

omegacn7500.REGISTER_START = {'setpoint': 8192, 'cycles': 4176, 'linkpattern': 4192, 'actualstep': 4160, 'time': 8320}

Register address start values for pattern related parameters.

omegacn7500.REGISTER_OFFSET_PER_PATTERN = {'setpoint': 8, 'cycles': 1, 'linkpattern': 1, 'actualstep': 1, 'time': 8}

Increase in register address value per pattern number (for pattern related parameters).

omegacn7500.REGISTER_OFFSET_PER_STEP = {'setpoint': 1, 'cycles': 0, 'linkpattern': 0, 'actualstep': 0, 'time': 1}

Increase in register address value per step number (for pattern related parameters).

class omegacn7500.OmegaCN7500(portname, slaveaddress)[source]

Bases: minimalmodbus.Instrument

Instrument class for Omega CN7500 process controller.

Communicates via Modbus RTU protocol (via RS485), using the minimalmodbus Python module.

This driver is intended to enable control of the OMEGA CN7500 controller from the command line.

Args:
  • portname (str): port name

    • examples:
    • OS X: ‘/dev/tty.usbserial’
    • Linux: ‘/dev/ttyUSB0’
    • Windows: ‘/com3’
  • slaveaddress (int): slave address in the range 1 to 247 (in decimal)

The controller can be used to follow predefined temperature programs, called patterns. Eight patterns (numbered 0-7) are available, each having eight temperature steps (numbered 0-7).

Each pattern have these parameters:

  • Temperature for each step (8 parameters)
  • Time for each step (8 parameters)
  • Link to another pattern
  • Number of cycles (repetitions of this pattern)
  • Actual step (which step to stop at)
Attributes:

Implemented with these function codes (in decimal):

Description Modbus function code
Read registers 3
Write one register 6
Read bits 2
Write one bit 5
get_pv()[source]

Return the process value (PV).

get_output1()[source]

Return the output value for output1 [in %].

run()[source]

Put the process controller in run mode.

stop()[source]

Stop the process controller.

is_running()[source]

Return True if the controller is running.

get_setpoint()[source]

Return the setpoint value (float).

set_setpoint(setpointvalue)[source]

Set the setpoint.

Args:
setpointvalue (float): Setpoint [most often in degrees]
get_control_mode()[source]

Get the name of the current operation mode.

Returns:
A string decribing the controlmode.

The returned string is one of the items in CONTROL_MODES.

set_control_mode(modevalue)[source]

Set the control method using the corresponding integer value.

Args:
modevalue(int): 0-3

The modevalue is one of the keys in CONTROL_MODES.

get_start_pattern_no()[source]

Return the starting pattern number (int).

set_start_pattern_no(patternnumber)[source]

Set the starting pattern number.

Args:
patternnumber (integer): 0-7
get_pattern_step_setpoint(patternnumber, stepnumber)[source]

Get the setpoint value for a step.

Args:
  • patternnumber (integer): 0-7
  • stepnumber (integer): 0-7
Returns:
The setpoint value (float).
set_pattern_step_setpoint(patternnumber, stepnumber, setpointvalue)[source]

Set the setpoint value for a step.

Args:
  • patternnumber (integer): 0-7
  • stepnumber (integer): 0-7
  • setpointvalue (float): Setpoint value
get_pattern_step_time(patternnumber, stepnumber)[source]

Get the step time.

Args:
  • patternnumber (integer): 0-7
  • stepnumber (integer): 0-7
Returns:
The step time (int??).
set_pattern_step_time(patternnumber, stepnumber, timevalue)[source]

Set the step time.

Args:
  • patternnumber (integer): 0-7
  • stepnumber (integer): 0-7
  • timevalue (integer??): 0-900
get_pattern_actual_step(patternnumber)[source]

Get the ‘actual step’ parameter for a given pattern.

Args:
patternnumber (integer): 0-7
Returns:
The ‘actual step’ parameter (int).
set_pattern_actual_step(patternnumber, value)[source]

Set the ‘actual step’ parameter for a given pattern.

Args:
  • patternnumber (integer): 0-7
  • value (integer): 0-7
get_pattern_additional_cycles(patternnumber)[source]

Get the number of additional cycles for a given pattern.

Args:
patternnumber (integer): 0-7
Returns:
The number of additional cycles (int).
set_pattern_additional_cycles(patternnumber, value)[source]

Set the number of additional cycles for a given pattern.

Args:
  • patternnumber (integer): 0-7
  • value (integer): 0-99

Get the ‘linked pattern’ value for a given pattern.

Args:
patternnumber (integer): From 0-7
Returns:
The ‘linked pattern’ value (int).

Set the ‘linked pattern’ value for a given pattern.

Args:
  • patternnumber (integer): 0-7
  • value (integer): 0-8. A value=8 sets the link parameter to OFF.
get_all_pattern_variables(patternnumber)[source]

Get all variables for a given pattern at one time.

Args:
patternnumber (integer): 0-7
Returns:
A descriptive multiline string.
set_all_pattern_variables(patternnumber, sp0, ti0, sp1, ti1, sp2, ti2, sp3, ti3, sp4, ti4, sp5, ti5, sp6, ti6, sp7, ti7, actual_step, additional_cycles, link_pattern)[source]

Set all variables for a given pattern at one time.

Args:
  • patternnumber (integer): 0-7
  • sp[n] (float): setpoint value for step n
  • ti[n] (integer??): step time for step n, 0-900
  • actual_step (int): ?
  • additional_cycles(int): ?
  • link_pattern(int): ?