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

Fix RFQ when off

parent e3cbb56d
No related branches found
Tags 2.3.14
No related merge requests found
......@@ -53,7 +53,7 @@
{
"type": "indicator",
"settings": {
"value": "timelength = datasources[\"POS\"][\"RFQ-010:RFS-EVR-101:RFSyncWdt-SP\"][\"value\"]/1000;\npwxdata = datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:Dwn6-XAxis.[0:100:-1]\"][\"value\"];\npwydata = datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:Dwn6-Cmp0.[0:100:-1]\"][\"value\"];\n\npower = datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:AI2-SMonAvg-Mag\"][\"value\"]-datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:AI3-SMonAvg-Mag\"][\"value\"]+datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:AI4-SMonAvg-Mag\"][\"value\"]-datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:AI5-SMonAvg-Mag\"][\"value\"];\n\npwdata = 0;\ncounts = 0;\n\nfor (i=0; i < pwxdata.length; i++) {\n if (pwxdata[i] > timelength) {\n break;\n }\n\tpwdata += pwydata[i];\n counts += 1;\n}\n\nif (counts == 0) {\n return 0;\n}\n\nif (pwdata/counts < 3) {\n return 0;\n}\n\nreturn 1;",
"value": "timelength = datasources[\"POS\"][\"RFQ-010:RFS-EVR-101:RFSyncWdt-SP\"][\"value\"]/1000;\npwxdata = datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:Dwn6-XAxis.[0:100:-1]\"][\"value\"];\npwydata = datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:Dwn6-Cmp0.[0:100:-1]\"][\"value\"];\n\npower = datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:AI2-SMonAvg-Mag\"][\"value\"]-datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:AI3-SMonAvg-Mag\"][\"value\"]+datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:AI4-SMonAvg-Mag\"][\"value\"]-datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:AI5-SMonAvg-Mag\"][\"value\"];\n\npwdata = 0;\ncounts = 0;\n\ntimestamp = datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:Dwn6-Cmp0.[0:100:-1]\"][\"timestamp\"];\nnow = Math.floor((new Date()).getTime() / 1000);\nenable = 1;\nif (now - timestamp > 0) {\n enable = 0;\n}\n\nfor (i=0; i < pwxdata.length; i++) {\n if (pwxdata[i] > timelength) {\n break;\n }\n\tpwdata += enable*pwydata[i];\n counts += 1;\n}\n\nif (counts == 0) {\n return 0;\n}\n\nif (pwdata/counts < 3) {\n return 0;\n}\n\nreturn 1;",
"on_text": "RFQ On",
"off_text": "RFQ Off"
}
......@@ -74,7 +74,7 @@
"plot_type": "area",
"legend": true,
"height": 4,
"value": "datasources[\"Clock\"][\"numeric_value\"];\n\ntimelength = datasources[\"POS\"][\"RFQ-010:RFS-EVR-101:RFSyncWdt-SP\"][\"value\"]/1000*2;\n\npwxdata = datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:Dwn6-XAxis.[0:100:-1]\"][\"value\"];\npwydata = datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:Dwn6-Cmp0.[0:100:-1]\"][\"value\"];\n\npwdata = [];\n\nfor (i=0; i < pwxdata.length; i++) {\n if (pwxdata[i] > timelength) {\n break;\n }\n\tpwdata.push([pwxdata[i], pwydata[i]]);\n}\n\ndata = [{label: 'Power applied', data: pwdata, color: \"green\"}];\n\nreturn data;",
"value": "datasources[\"Clock\"][\"numeric_value\"];\n\ntimelength = datasources[\"POS\"][\"RFQ-010:RFS-EVR-101:RFSyncWdt-SP\"][\"value\"]/1000*2;\n\npwxdata = datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:Dwn6-XAxis.[0:100:-1]\"][\"value\"];\npwydata = datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:Dwn6-Cmp0.[0:100:-1]\"][\"value\"];\n\ntimestamp = datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:Dwn6-Cmp0.[0:100:-1]\"][\"timestamp\"];\nnow = Math.floor((new Date()).getTime() / 1000);\nenable = 1;\nif (now - timestamp > 0) {\n enable = 0;\n}\n\npwdata = [];\n\nfor (i=0; i < pwxdata.length; i++) {\n if (pwxdata[i] > timelength) {\n break;\n }\n\tpwdata.push([pwxdata[i], enable*pwydata[i]]);\n}\n\ndata = [{label: 'Power applied', data: pwdata, color: \"green\"}];\n\nreturn data;",
"xticks": "datasources[\"Clock\"][\"numeric_value\"];\n\nvar cols = document.getElementsByClassName('gs_w')[0].getAttribute('data-sizex');\n\ntimelength = datasources[\"POS\"][\"RFQ-010:RFS-EVR-101:RFSyncWdt-SP\"][\"value\"]/1000*2;\nxdata = datasources[\"POS\"][\"RFQ-010:RFS-DIG-101:Dwn6-XAxis.[0:100:-1]\"][\"value\"];\n\nif (timelength > xdata[xdata.length-1]) {\n timelength = xdata[xdata.length-1];\n}\n\nxtick = [];\nsize = 10;\nif (cols == 1) {\n size = 4;\n}\n\nfor (i = 0; i < (size+1); i += 1) {\n xtick.push([timelength*i/size, (timelength*i/size).toFixed(3).toString()]);\n}\nxtick[size/2][1] = xtick[size/2][1]+\"<br>t [ms]\";\n\nreturn xtick;\n\n",
"yticks": "datasources[\"Clock\"][\"numeric_value\"]\n\nif (typeof axes === 'undefined') {\n return;\n}\n\nytick = [];\nfor (i = 0; i < axes.yaxis.ticks.length-1; i += 1) {\n\tytick.push([axes.yaxis.ticks[i][\"v\"], axes.yaxis.ticks[i][\"label\"]]);\n}\n\nytick.push([axes.yaxis.ticks[axes.yaxis.ticks.length-1][\"v\"], \"P [kW]\"]);\nreturn ytick;",
"zoom": "xy"
......
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