Commit b72e7428 authored by Holger Witsch's avatar Holger Witsch

It works.

Tested without real hardware behind the wago.
parent 4bf3d699
Pipeline #17717 canceled with stages
def gantry(command, element):
""" Usage: gantry [ command [element]]
Ex: gantry start pump
from bliss.config.static import get_config
__WAGO__ = None
def gantry(command="help", cmdelement="pump"):
""" Usage: gantry(command [, cmdelement])
Ex: gantry("start", "pump")
gantry("status")
gantry("info")
"""
# get the wagoname from config
global __WAGO__
config = get_config()
wagoname = config.get('gantry').to_dict()['wagoname']
__WAGO__ = config.get(wagoname)
if command == "start":
if element == "pump":
if cmdelement == "pump":
print("Starting Gantry Vacuum Pump")
# wwrite relay[3]
# wwrite relay[3] # from spec (which counted the cells from 1)
current_values = __WAGO__.get("relay")
current_values[2] = 1
__WAGO__.set("relay", current_values)
else:
print("start WHAT ?")
elif command == "stop":
if element == "pump":
if cmdelement == "pump":
print("Stopping Gantry Vacuum Pump")
# wwrite relay[3]
current_values = __WAGO__.get("relay")
current_values[2] = 0
__WAGO__.set("relay", current_values)
else:
print("stop WHAT ?")
elif command == "info":
print("\tAvailable Gantry commands:")
print("\t\tstart pump")
print("\t\tstop pump")
print("\t\tstatus")
print("\t\tstatus etel")
print("\t\tstatus pressure")
print("\t\tstatus vacuum")
elif command == "info" or command == "help":
print('\n\tAvailable Gantry commands:')
print('\t\tgantry("start", "pump")')
print('\t\tgantry("stop", "pump")')
print('\t\tgantry("status")')
print('\t\tgantry("status", "etel")')
print('\t\tgantry("status", "vacuum")')
print('\t\tgantry("status", "pressure")\n')
print('\t\tCurrently configured wago box is %s' % wagoname)
return
elif command == "status":
print("Gantry Interlock Status")
etel,vacu,pres = gantry_query_status()
if not element:
stat_etel = gantry_status(etel)
stat_vacu = gantry_status(vacu)
stat_pres = gantry_status(pres)
print(" ETEL %s" % stat_etel)
print(" VACUUM %s" % stat_vacu)
print(" PRESSURE %s" % stat_pres)
elif element == "etel":
stat_etel = gantry_status(etel)
print(" ETEL %s" % stat_etel)
elif element == "vacuum":
stat_vacu = gantry_status(vacu)
print(" VACUUM %s" % stat_vacu)
elif element == "pressure":
stat_pres = gantry_status(pres)
print(" PRESSURE %s" % stat_pres)
current_values = __WAGO__.get("relay")
etel,vacu,pres = current_values[0:3]
if cmdelement == 'pump': # pump is the default cmdelement content
print(" ETEL %s" % etel if "OK" else "TRIPPED")
print(" VACUUM %s" % vacu if "OK" else "TRIPPED")
print(" PRESSURE %s" % pres if "OK" else "TRIPPED")
elif cmdelement == "etel":
print(" ETEL %s" % etel if "OK" else "TRIPPED")
elif cmdelement == "vacuum":
print(" VACUUM %s" % vacu if "OK" else "TRIPPED")
elif cmdelement == "pressure":
print(" PRESSURE %s" % pres if "OK" else "TRIPPED")
else:
print("Error: not recognised")
else:
print("Command: not recognised")
def gantry_query_status():
"""
query status
"""
etel = vacu = pres = -1
# etel = wago_redch relay[0]
# vacu = wago_redch relay[1]
# pres = wago_redch relay[2]
etel = vacu = pres = 1
return etel, vacu, pres
def gantry_status(status):
if status == 1:
return "OK"
elif status == 0:
return "TRIPPED"
else :
return "ERROR: Bad status"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment