Commit 8f0e37a5 authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

sw: Updated turning on and off of ELMA crate in pts.py

parent c2a76b5d
...@@ -66,20 +66,6 @@ import re ...@@ -66,20 +66,6 @@ import re
# Import ptsdefine module to avoid wrong `make's # Import ptsdefine module to avoid wrong `make's
from ptsdefine import * from ptsdefine import *
##-------------------------------------------------------------------------------------------------
## Method to turn on the ELMA crate.
##-------------------------------------------------------------------------------------------------
## It calls the get-fan-speeds script to check if the crate is on.
##-------------------------------------------------------------------------------------------------
def men_is_on():
on = 0
subprocess.call("cd shell; ./get-fan-speeds", shell=True, stdout=fnull, stderr=fnull)
btxt = tuple(open("log/fan-speeds","r"))
for i in range(1,len(btxt)):
if btxt[i].find("INTEGER: 0") == -1:
on = on + 1
return on
##------------------------------------------------------------------------------------------------- ##-------------------------------------------------------------------------------------------------
## Method to turn on the VME crate. ## Method to turn on the VME crate.
##------------------------------------------------------------------------------------------------- ##-------------------------------------------------------------------------------------------------
...@@ -87,15 +73,8 @@ def men_is_on(): ...@@ -87,15 +73,8 @@ def men_is_on():
## power to the VME backplane. ## power to the VME backplane.
##------------------------------------------------------------------------------------------------- ##-------------------------------------------------------------------------------------------------
def men_on(): def men_on():
tmo = 1 print("Switching on the ELMA crate")
while men_is_on() == 0: subprocess.call("shell/men-on", shell=True, stdout=fnull, stderr=fnull)
print "Try:%d Switching ON the VME Crate" % (tmo)
subprocess.call("shell/men-on", shell=True, stdout=fnull, stderr=fnull)
tmo = tmo + 1
if tmo > 10:
print "FATAL ERROR: VME Crate: Unable to switch ON"
sys.exit(1)
time.sleep(1)
##------------------------------------------------------------------------------------------------- ##-------------------------------------------------------------------------------------------------
## Method to turn off the VME crate. ## Method to turn off the VME crate.
...@@ -104,15 +83,8 @@ def men_on(): ...@@ -104,15 +83,8 @@ def men_on():
## power to the VME backplane. ## power to the VME backplane.
##------------------------------------------------------------------------------------------------- ##-------------------------------------------------------------------------------------------------
def men_off(): def men_off():
tmo = 1 print("Switching off the ELMA crate")
while men_is_on() != 0: subprocess.call("shell/men-off", shell=True, stdout=fnull, stderr=fnull)
print "Try:%d Switching OFF the VME Crate" % (tmo)
subprocess.call("shell/men-off", shell=True, stdout=fnull, stderr=fnull)
tmo = tmo + 1
if tmo > 10:
print "FATAL ERROR: VME Crate: Unable to switch OFF"
sys.exit(1)
time.sleep(1)
##------------------------------------------------------------------------------------------------- ##-------------------------------------------------------------------------------------------------
## Main "method" of PTS ## Main "method" of PTS
......
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