Skip to content
Snippets Groups Projects
Commit 8583a6a0 authored by Emanuele Laface's avatar Emanuele Laface
Browse files

Split TS2 in two screens

parent 59fb05ed
No related branches found
No related tags found
No related merge requests found
Pipeline #29971 passed
Showing
with 55 additions and 7 deletions
...@@ -14,7 +14,8 @@ from threading import Thread, Event ...@@ -14,7 +14,8 @@ from threading import Thread, Event
from screens.pos import posScreen from screens.pos import posScreen
from screens.interlocks import interlocksScreen from screens.interlocks import interlocksScreen
from screens.instruments import instrumentsScreen from screens.instruments import instrumentsScreen
from screens.ts2 import ts2Screen from screens.ts2_cav import ts2_cavScreen
from screens.ts2_screens import ts2_screensScreen
PORT_NUMBER = 8080 PORT_NUMBER = 8080
ARCHIVER_SERVER = os.environ.get('ARCHIVER_SERVER', 'archiver-01.tn.esss.lu.se') ARCHIVER_SERVER = os.environ.get('ARCHIVER_SERVER', 'archiver-01.tn.esss.lu.se')
...@@ -206,8 +207,10 @@ try: ...@@ -206,8 +207,10 @@ try:
interlocksThread.start() interlocksThread.start()
instrumentsThread = instrumentsScreen(stop_signal) instrumentsThread = instrumentsScreen(stop_signal)
instrumentsThread.start() instrumentsThread.start()
ts2Thread = ts2Screen(stop_signal) ts2_cavThread = ts2_cavScreen(stop_signal)
ts2Thread.start() ts2_cavThread.start()
ts2_screensThread = ts2_screensScreen(stop_signal)
ts2_screensThread.start()
server = HTTPServer(('', PORT_NUMBER), myHandler) server = HTTPServer(('', PORT_NUMBER), myHandler)
print ('Started httpserver on port ' , PORT_NUMBER) print ('Started httpserver on port ' , PORT_NUMBER)
......
import epics
import json
import time
from threading import Thread
class ts2_cavScreen(Thread):
def __init__(self, stop_signal):
Thread.__init__(self)
self.stop_signal = stop_signal
def run(self):
pvs = ['TS2-010CRM:Cryo-TE-010:MeasValue', 'TS2-010CRM:Cryo-TE-011:MeasValue', 'TS2-010CRM:Cryo-TE-012:MeasValue', 'TS2-010CRM:Cryo-TE-013:MeasValue', 'TS2-010CRM:Cryo-TE-014:MeasValue', 'TS2-010CRM:Cryo-TE-015:MeasValue', 'TS2-010CRM:Cryo-TE-018:MeasValue', 'TS2-010CRM:Cryo-TE-019:MeasValue', 'TS2-010CRM:Cryo-TE-020:MeasValue', 'TS2-010CRM:Cryo-TE-021:MeasValue', 'TS2-010CRM:Cryo-TE-022:MeasValue', 'TS2-010CRM:Cryo-TE-023:MeasValue', 'TS2-010CRM:Cryo-TE-024:MeasValue', 'TS2-010CRM:Cryo-TE-025:MeasValue', 'TS2-010CRM:Cryo-TE-028:MeasValue', 'TS2-010CRM:Cryo-TE-029:MeasValue', 'TS2-010CRM:Cryo-TE-030:MeasValue', 'TS2-010CRM:Cryo-TE-031:MeasValue', 'TS2-010CRM:Cryo-TE-032:MeasValue', 'TS2-010CRM:Cryo-TE-033:MeasValue', 'TS2-010CRM:Cryo-TE-034:MeasValue', 'TS2-010CRM:Cryo-TE-035:MeasValue', 'TS2-010CRM:Cryo-TE-038:MeasValue', 'TS2-010CRM:Cryo-TE-039:MeasValue', 'TS2-010CRM:Cryo-TE-041:MeasValue', 'TS2-010CRM:Cryo-TE-042:MeasValue', 'TS2-010CRM:Cryo-TE-043:MeasValue', 'TS2-010CRM:Cryo-TE-044:MeasValue', 'TS2-010CRM:Cryo-TE-045:MeasValue', 'TS2-010CRM:Cryo-TE-048:MeasValue', 'TS2-010CRM:Cryo-TE-049:MeasValue' ]
epics_dict={}
for pv in pvs:
epics_dict[pv]=epics.PV(pv, auto_monitor=True)
while(not self.stop_signal.isSet()):
json_dict={}
for pv in epics_dict:
json_dict[pv]={}
if epics_dict[pv].connected:
json_dict[pv]['units']=epics_dict[pv].units
try:
json_dict[pv]['value']=round(epics_dict[pv].value,3)
except:
json_dict[pv]['value']=epics_dict[pv].value
else:
json_dict[pv]['units']='n.c.'
json_dict[pv]['value']=''
tmp_json = json.dumps(json_dict)
tmp_json = tmp_json.replace('NaN','0')
tmp_json = tmp_json.replace('Infinity','0')
with open('/var/www/data/ts2_cav.json','w') as datafile:
datafile.write(tmp_json)
time.sleep(0.5)
for pv in epics_dict:
epics_dict[pv].clear_auto_monitor()
epics_dict[pv].disconnect()
...@@ -3,13 +3,13 @@ import json ...@@ -3,13 +3,13 @@ import json
import time import time
from threading import Thread from threading import Thread
class ts2Screen(Thread): class ts2_screensScreen(Thread):
def __init__(self, stop_signal): def __init__(self, stop_signal):
Thread.__init__(self) Thread.__init__(self)
self.stop_signal = stop_signal self.stop_signal = stop_signal
def run(self): def run(self):
pvs = ['CrS-TICP:Cryo-TE-31491:Val', 'TS2-010CDL:Cryo-TE-82313:MeasValue', 'TS2-010CDL:Cryo-TE-82360:MeasValue', 'TS2-010CRM:Cryo-TE-068:MeasValue', 'TS2-010CRM:Cryo-TE-063:MeasValue', 'TS2-010CRM:Cryo-TE-069:MeasValue', 'TS2-010CRM:Cryo-TE-064:MeasValue', 'TS2-010CDL:Cryo-TE-82365:MeasValue', 'TS2-010CDL:Cryo-TE-82314:MeasValue', 'CrS-TICP:Cryo-TE-31492:Val', 'TS2-010CRM:Cryo-TE-010:MeasValue', 'TS2-010CRM:Cryo-TE-011:MeasValue', 'TS2-010CRM:Cryo-TE-012:MeasValue', 'TS2-010CRM:Cryo-TE-013:MeasValue', 'TS2-010CRM:Cryo-TE-014:MeasValue', 'TS2-010CRM:Cryo-TE-015:MeasValue', 'TS2-010CRM:Cryo-TE-018:MeasValue', 'TS2-010CRM:Cryo-TE-019:MeasValue', 'TS2-010CRM:Cryo-TE-020:MeasValue', 'TS2-010CRM:Cryo-TE-021:MeasValue', 'TS2-010CRM:Cryo-TE-022:MeasValue', 'TS2-010CRM:Cryo-TE-023:MeasValue', 'TS2-010CRM:Cryo-TE-024:MeasValue', 'TS2-010CRM:Cryo-TE-025:MeasValue', 'TS2-010CRM:Cryo-TE-028:MeasValue', 'TS2-010CRM:Cryo-TE-029:MeasValue', 'TS2-010CRM:Cryo-TE-030:MeasValue', 'TS2-010CRM:Cryo-TE-031:MeasValue', 'TS2-010CRM:Cryo-TE-032:MeasValue', 'TS2-010CRM:Cryo-TE-033:MeasValue', 'TS2-010CRM:Cryo-TE-034:MeasValue', 'TS2-010CRM:Cryo-TE-035:MeasValue', 'TS2-010CRM:Cryo-TE-038:MeasValue', 'TS2-010CRM:Cryo-TE-039:MeasValue', 'TS2-010CRM:Cryo-TE-041:MeasValue', 'TS2-010CRM:Cryo-TE-042:MeasValue', 'TS2-010CRM:Cryo-TE-043:MeasValue', 'TS2-010CRM:Cryo-TE-044:MeasValue', 'TS2-010CRM:Cryo-TE-045:MeasValue', 'TS2-010CRM:Cryo-TE-048:MeasValue', 'TS2-010CRM:Cryo-TE-049:MeasValue' ] pvs = ['CrS-TICP:Cryo-TE-31491:Val', 'TS2-010CDL:Cryo-TE-82313:MeasValue', 'TS2-010CDL:Cryo-TE-82360:MeasValue', 'TS2-010CRM:Cryo-TE-068:MeasValue', 'TS2-010CRM:Cryo-TE-063:MeasValue', 'TS2-010CRM:Cryo-TE-069:MeasValue', 'TS2-010CRM:Cryo-TE-064:MeasValue', 'TS2-010CDL:Cryo-TE-82365:MeasValue', 'TS2-010CDL:Cryo-TE-82314:MeasValue', 'CrS-TICP:Cryo-TE-31492:Val']
epics_dict={} epics_dict={}
for pv in pvs: for pv in pvs:
...@@ -32,7 +32,7 @@ class ts2Screen(Thread): ...@@ -32,7 +32,7 @@ class ts2Screen(Thread):
tmp_json = json.dumps(json_dict) tmp_json = json.dumps(json_dict)
tmp_json = tmp_json.replace('NaN','0') tmp_json = tmp_json.replace('NaN','0')
tmp_json = tmp_json.replace('Infinity','0') tmp_json = tmp_json.replace('Infinity','0')
with open('/var/www/data/ts2.json','w') as datafile: with open('/var/www/data/ts2_screens.json','w') as datafile:
datafile.write(tmp_json) datafile.write(tmp_json)
time.sleep(0.5) time.sleep(0.5)
......
<li><a href="/">Public Operations Screen</a></li> <li><a href="/">Public Operations Screen</a></li>
<li><a href="/interlocks/">High Voltage Interlocks</a></li> <li><a href="/interlocks/">High Voltage Interlocks</a></li>
<li><a href="/instruments/">Beam Instruments</a></li> <li><a href="/instruments/">Beam Instruments</a></li>
<li><a href="/ts2/">Test Stand 2</a></li> <li><a href="#">Test Stand 2</a></li>
<ul>
<li><a href="/ts2_cav/">Cavities</a></li>
<li><a href="/ts2_screens/">Thermal Screens</a></li>
</ul>
<li><a href="/pvs/">PV Search Engine</a></li> <li><a href="/pvs/">PV Search Engine</a></li>
File moved
File moved
File moved
File moved
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