Snippets

Espec North America eLRE69: Untitled snippet

Created by Myles Metzler
import json
from chamberconnectlibrary.watlowf4 import WatlowF4
from chamberconnectlibrary.watlowf4t import WatlowF4T

interface_params = {'interface':"RTU", 'baudrate':19200, 'serialport':'//./COM6'}

try:
    controller = WatlowF4T(
    	alarms=8, # the number of available alarms
        profiles=True, # the controller has programming
        loops=1, # the number of control loops (ie temperature)
        cond_event=9, # the event that enables/disables conditioning (9 is key 1)
        cond_event_toggle=False, # is the condition momentary(False), or maintained(True)
        run_module=1, # The io module that has the chamber run output
        run_io=1, # The run output on the mdoule that has the chamber run out put
        limits=[5], # A list of modules that contain limit type cards.
        loop_event=[0,2,0,0], # A list of event #'s that enable/disable a control loop
        cascade_ctl_event=[7,0,0,0], # the event that enables PTCON
        **interface_params
    )
    print 'Found a "%s" controller\n' % controller.process_controller(False)
except Exception as exc:
    controller = WatlowF4(
        profiles=True,
        loops=1,
        loop_event=[0,8],
        cond_event=7,
        limits=[1],
        **interface_params
    )
    try:
        if controller.loops:
            controller.get_loop_units(1)
        else:
            controller.get_cascade_units(1)
        print 'Found a "%s" controller\n' % controller.process_controller(False)
    except Exception:
        print 'The connected controller is Likely a WatlowF4T in compatibility mode.'
        print 'You must disable compatibility mode of the WatlowF4T to use it.'
        exit(1)

#Determine the correct number of "standard" loops
loops = [
    (i+1, 'loop')
    for i in range(controller.loops)
]

#Determine the correct number of cascade loops
loops += [
    (i+1, 'cascade')
    for i in range(controller.cascades)
]

# Print the currect status of all of the loops, both cascade and "standard"
for loop in loops:
    print '\n'
    print loop
    print json.dumps(controller.get_loop(*loop), sort_keys=True, indent=4)

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.