Skip to content
Snippets Groups Projects
Commit 83953762 authored by BRONES Romain's avatar BRONES Romain
Browse files

refactor comlbp operation

parent 8f5461cd
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,6 @@ import tango
import logging
import numpy as np
import time
import FofbTool.Utils
# Get the module logger
......@@ -315,64 +314,70 @@ def ack_combpm(node_tangopath):
# OPERATIONS ON COMLBP
###################################################################################################
def stop_comlbp(cellnodename):
def stop_comlbp(node_tangopath):
"""
Stop the communication with LBP on the specified cellnode.
PARAMETERS
----------
cellnodename: str
The target fofbnode, ie 'cellnode-c09'
node_tangopath: str
The target fofbnode tango path, ie 'ans/dg/fofb-cellnode-c09'
"""
prx=FofbTool.Utils.get_prx_from_nodename(cellnodename)
if prx is None:
logger.error("Failed to stop ComLBP on {}".format(p))
return
try:
prx=tango.DeviceProxy(node_tangopath)
prx.ping()
except tango.DevFailed:
logger.error("Failed to obtain tango proxy or to ping to {}".format(node_tangopath))
return None
logger.info("Stopping ComLBP on {}".format(cellnodename))
logger.info("Stopping ComLBP on {}".format(node_tangopath))
for n in range(4):
prx["comlbp{}_control".format(n)] = 1
time.sleep(1)
for n in range(4):
prx["comlbp{}_control".format(n)] = 0
def start_comlbp(cellnodename):
def start_comlbp(node_tangopath):
"""
Start the communication with LBP on the specified cellnode.
PARAMETERS
----------
cellnodename: str
The target fofbnode, ie 'cellnode-c09'
node_tangopath: str
The target fofbnode tango path, ie 'ans/dg/fofb-cellnode-c09'
"""
prx=FofbTool.Utils.get_prx_from_nodename(cellnodename)
if prx is None:
logger.error("Failed to start ComLBP on {}".format(p))
return
try:
prx=tango.DeviceProxy(node_tangopath)
prx.ping()
except tango.DevFailed:
logger.error("Failed to obtain tango proxy or to ping to {}".format(node_tangopath))
return None
logger.info("Starting ComLBP on {}".format(cellnodename))
logger.info("Starting ComLBP on {}".format(node_tangopath))
for n in range(4):
prx["comlbp{}_control".format(n)] = 0x10
def reset_comlbp(cellnodename):
def reset_comlbp(node_tangopath):
"""
Reset the communication with LBP on the specified cellnode.
PARAMETERS
----------
cellnodename: str
The target fofbnode, ie 'cellnode-c09'
node_tangopath: str
The target fofbnode tango path, ie 'ans/dg/fofb-cellnode-c09'
"""
prx=FofbTool.Utils.get_prx_from_nodename(cellnodename)
if prx is None:
logger.error("Failed to reset ComLBP on {}".format(p))
return
try:
prx=tango.DeviceProxy(node_tangopath)
prx.ping()
except tango.DevFailed:
logger.error("Failed to obtain tango proxy or to ping to {}".format(node_tangopath))
return None
logger.info("Reset ComLBP on {}".format(cellnodename))
logger.info("Reset ComLBP on {}".format(node_tangopath))
for n in range(4):
prx["comlbp{}_control".format(n)] = 0x3
......
......@@ -258,8 +258,8 @@ def stop_all_comlbp(force=False):
for n,p in FofbTool.Configuration.config["tangopath.fofbnodes"].items():
if 'cellnode' in n:
try:
FofbTool.Operation.reset_comlbp(n)
FofbTool.Operation.stop_comlbp(n)
FofbTool.Operation.reset_comlbp(p)
FofbTool.Operation.stop_comlbp(p)
except (tango.DevFailed, TypeError):
logger.error("Could not stop cpmlbp on {}".format(n))
......@@ -300,7 +300,7 @@ def start_all_comlbp():
for n,p in FofbTool.Configuration.config["tangopath.fofbnodes"].items():
if 'cellnode' in n:
try:
FofbTool.Operation.start_comlbp(n)
FofbTool.Operation.start_comlbp(p)
except (tango.DevFailed, TypeError):
logger.error("Could not start LBP on {}".format(n))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment