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

Add timestamps to PVs

parent 339f5ccc
No related branches found
No related tags found
No related merge requests found
Pipeline #30698 passed
......@@ -41,12 +41,14 @@ class mybeautifulScreen(Thread):
os.rename('/var/www/data/tmp-my_image.png', '/var/www/data/my_image.png') # Swap the tmp image with the final one. This trick is used to avoid blinking image in the final page.
json_dict[pv]['units']=epics_dict[pv].units # I set the units for all the PVs
json_dict[pv]['timestamp']=epics_dict[pv].timestamp # I set the units for all the PVs
try:
json_dict[pv]['value']=round(epics_dict[pv].value,3) # Where possible I round the value to three decimal digits
except:
json_dict[pv]['value']=epics_dict[pv].value
else:
json_dict[pv]['units']='n.c.' # If the PV is disconnected I assign n.c. as unit an blank value
json_dict[pv]['timestamp']='' # If the PV is disconnected I assign n.c. as unit an blank value
json_dict[pv]['value']=''
tmp_json = json.dumps(json_dict) # Create the JSON from dictionary
......
......@@ -91,6 +91,7 @@ class instrumentsScreen(Thread):
json_dict[pv]={}
if epics_dict[pv].connected:
json_dict[pv]['units']=epics_dict[pv].units
json_dict[pv]['timestamp']=epics_dict[pv].timestamp
if pv=='ISrc-010:PBI-BCM-001:AI4-Compressed':
y_data=list(epics_dict[pv].value*bcm_correction)
x_data=list(linspace(0,12.8,len(y_data)))
......@@ -133,18 +134,22 @@ class instrumentsScreen(Thread):
continue
if pv=='LEBT-010:PBI-NPM-001:HCAM-SCALEFACT':
json_dict[pv]['units']='n.c.'
json_dict[pv]['timestamp']=''
json_dict[pv]['value']=''
continue
if pv=='LEBT-010:PBI-NPM-002:VCAM-SCALEFACT':
json_dict[pv]['units']='n.c.'
json_dict[pv]['timestamp']=''
json_dict[pv]['value']=''
continue
if pv=='LEBT-020:PBI-NPM-001:HCAM-SCALEFACT':
json_dict[pv]['units']='n.c.'
json_dict[pv]['timestamp']=''
json_dict[pv]['value']=''
continue
if pv=='LEBT-020:PBI-NPM-002:VCAM-SCALEFACT':
json_dict[pv]['units']='n.c.'
json_dict[pv]['timestamp']=''
json_dict[pv]['value']=''
continue
......@@ -177,6 +182,7 @@ class instrumentsScreen(Thread):
json_dict[pv]['value']=epics_dict[pv].value
else:
json_dict[pv]['units']='n.c.'
json_dict[pv]['timestamp']=''
json_dict[pv]['value']=''
tmp_json = json.dumps(json_dict)
......
......@@ -21,12 +21,14 @@ class interlocksScreen(Thread):
json_dict[pv]={}
if epics_dict[pv].connected:
json_dict[pv]['units']=epics_dict[pv].units
json_dict[pv]['timestamp']=epics_dict[pv].timestamp
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]['timestamp']=''
json_dict[pv]['value']=''
tmp_json = json.dumps(json_dict)
......
......@@ -22,6 +22,7 @@ class posScreen(Thread):
json_dict[pv]={}
if epics_dict[pv].connected:
json_dict[pv]['units']=epics_dict[pv].units
json_dict[pv]['timestamp']=epics_dict[pv].timestamp
if pv=='ISrc-010:PBI-BCM-001:AI4-Compressed':
y_data_array=epics_dict[pv].value
y_data=list(y_data_array)
......@@ -62,6 +63,7 @@ class posScreen(Thread):
json_dict[pv]['value']=epics_dict[pv].value
else:
json_dict[pv]['units']='n.c.'
json_dict[pv]['timestamp']=''
json_dict[pv]['value']=''
try:
json_dict['ISrc-010:TS-EVG-01:Mxc1-Frequency-RB']['value']=int(json_dict['ISrc-010:TS-EVG-01:Mxc1-Frequency-RB']['value'])
......
......@@ -21,12 +21,14 @@ class ts2_cavScreen(Thread):
json_dict[pv]={}
if epics_dict[pv].connected:
json_dict[pv]['units']=epics_dict[pv].units
json_dict[pv]['timestamp']=epics_dict[pv].timestamp
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]['timestamp']=''
json_dict[pv]['value']=''
tmp_json = json.dumps(json_dict)
......
......@@ -21,12 +21,14 @@ class ts2_screensScreen(Thread):
json_dict[pv]={}
if epics_dict[pv].connected:
json_dict[pv]['units']=epics_dict[pv].units
json_dict[pv]['timestamp']=epics_dict[pv].timestamp
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]['timestamp']=''
json_dict[pv]['value']=''
tmp_json = json.dumps(json_dict)
......
......@@ -21,12 +21,14 @@ class ts2_tpcircuitsScreen(Thread):
json_dict[pv]={}
if epics_dict[pv].connected:
json_dict[pv]['units']=epics_dict[pv].units
json_dict[pv]['timestamp']=epics_dict[pv].timestamp
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]['timestamp']=''
json_dict[pv]['value']=''
tmp_json = json.dumps(json_dict)
......
......@@ -86,18 +86,16 @@
"col_width": 1,
"widgets": [
{
"type": "text_widget",
"type": "html",
"settings": {
"title": "Shift Leader",
"size": "regular",
"value": "datasources[\"POS\"][\"NSO-LCR:Ops:MSL\"][\"value\"]",
"animate": true
"html": "var date = new Date(datasources[\"POS\"][\"NSO-LCR:Ops:MSL\"][\"timestamp\"]*1e3);\nreturn \"<div class=\\\"widget\\\" data-bind=\\\"widget: true, css:{fillsize:fillSize}\\\"><div class=\\\"tw-display\\\"><div class=\\\"tw-tr\\\"><h2 class=\\\"section-title tw-title tw-td\\\">Shift Leader</h2></div><div class=\\\"tw-tr\\\"><div class=\\\"tw-value-wrapper tw-td\\\"><div class=\\\"tw-value\\\" style=\\\"font-size: 30px; max-width: 100%;\\\" title=\\\" \"+date+\"\\\">\"+datasources[\"POS\"][\"NSO-LCR:Ops:MSL\"][\"value\"]+\"</div><div class=\\\"tw-unit\\\" style=\\\"display: none;\\\"></div></div></div><div class=\\\"tw-tr\\\"><div class=\\\"tw-sparkline tw-td\\\" style=\\\"display: none;\\\"></div></div></div></div>\"",
"height": 1
}
},
{
"type": "html",
"settings": {
"html": "return \"<div class=\\\"tw-value\\\" style=\\\"font-size: 16px; width=100%; margin-top:10px; margin-left:10px; margin-right:10px;\\\">\"+ datasources[\"POS\"][\"NSO-LCR:Ops:Msg\"][\"value\"] +\"</div>\"",
"html": "var date = new Date(datasources[\"POS\"][\"NSO-LCR:Ops:Msg\"][\"timestamp\"]*1e3);\nreturn \"<div class=\\\"tw-value\\\" style=\\\"font-size: 16px; width=100%; margin-top:10px; margin-left:10px; margin-right:10px;\\\" title=\\\"\"+date+\"\\\">\"+ datasources[\"POS\"][\"NSO-LCR:Ops:Msg\"][\"value\"] +\"</div>\"",
"height": 1
}
}
......@@ -127,18 +125,16 @@
"col_width": 1,
"widgets": [
{
"type": "text_widget",
"type": "html",
"settings": {
"title": "Shift Leader",
"size": "regular",
"value": "datasources[\"POS\"][\"NSO-LCR:Ops:TSSL\"][\"value\"]",
"animate": true
"html": "var date = new Date(datasources[\"POS\"][\"NSO-LCR:Ops:TSSL\"][\"timestamp\"]*1e3);\nreturn \"<div class=\\\"widget\\\" data-bind=\\\"widget: true, css:{fillsize:fillSize}\\\"><div class=\\\"tw-display\\\"><div class=\\\"tw-tr\\\"><h2 class=\\\"section-title tw-title tw-td\\\">Shift Leader</h2></div><div class=\\\"tw-tr\\\"><div class=\\\"tw-value-wrapper tw-td\\\"><div class=\\\"tw-value\\\" style=\\\"font-size: 30px; max-width: 100%;\\\" title=\\\" \"+date+\"\\\">\"+datasources[\"POS\"][\"NSO-LCR:Ops:TSSL\"][\"value\"]+\"</div><div class=\\\"tw-unit\\\" style=\\\"display: none;\\\"></div></div></div><div class=\\\"tw-tr\\\"><div class=\\\"tw-sparkline tw-td\\\" style=\\\"display: none;\\\"></div></div></div></div>\"",
"height": 1
}
},
{
"type": "html",
"settings": {
"html": "return \"<div class=\\\"tw-value\\\" style=\\\"font-size: 16px; width=100%; margin-top:10px; margin-left:10px; margin-right:10px;\\\">\"+ datasources[\"POS\"][\"NSO-LCR:Ops:TSMsg\"][\"value\"] +\"</div>\"",
"html": "var date = new Date(datasources[\"POS\"][\"NSO-LCR:Ops:TSMsg\"][\"timestamp\"]*1e3);\nreturn \"<div class=\\\"tw-value\\\" style=\\\"font-size: 16px; width=100%; margin-top:10px; margin-left:10px; margin-right:10px;\\\" title=\\\"\"+date+\"\\\">\"+ datasources[\"POS\"][\"NSO-LCR:Ops:TSMsg\"][\"value\"] +\"</div>\"",
"height": 1
}
}
......@@ -276,7 +272,7 @@
"width": 1,
"row": {
"1": 23,
"2": 17,
"2": 19,
"3": 13,
"4": 7,
"5": 11,
......@@ -285,7 +281,7 @@
},
"col": {
"1": 1,
"2": 1,
"2": 2,
"3": 2,
"4": 2,
"5": 2,
......@@ -386,7 +382,7 @@
},
"col": {
"1": 1,
"2": 2,
"2": 1,
"3": 1,
"4": 3,
"5": 1,
......
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