From 86a532155a2f2617dd466e89f6b394b0bfa7ce7b Mon Sep 17 00:00:00 2001
From: "emanuele.laface@esss.se" <emanuele.laface@esss.se>
Date: Wed, 22 Jun 2022 11:08:48 +0200
Subject: [PATCH] DTL BPMs

---
 WebSites/instruments/dashboard.json | 63 ++++++++++++++++++++++++++++-
 1 file changed, 61 insertions(+), 2 deletions(-)

diff --git a/WebSites/instruments/dashboard.json b/WebSites/instruments/dashboard.json
index eb4bee6..a6bf0ca 100644
--- a/WebSites/instruments/dashboard.json
+++ b/WebSites/instruments/dashboard.json
@@ -35,12 +35,18 @@
 			"title": "Beam Current Monitors and Faraday Cups",
 			"width": 1,
 			"row": {
+				"1": 7,
+				"2": 7,
+				"3": 7,
 				"4": 7,
 				"5": 7,
 				"7": 7,
 				"9": 7
 			},
 			"col": {
+				"1": 1,
+				"2": 1,
+				"3": 1,
 				"4": 1,
 				"5": 3,
 				"7": 3,
@@ -67,6 +73,9 @@
 			"title": "MEBT BPMS",
 			"width": 1,
 			"row": {
+				"1": 21,
+				"2": 21,
+				"3": 21,
 				"4": 21,
 				"8": 19,
 				"9": 19,
@@ -74,6 +83,9 @@
 				"12": 19
 			},
 			"col": {
+				"1": 1,
+				"2": 1,
+				"3": 1,
 				"4": 1,
 				"8": 1,
 				"9": 1,
@@ -88,7 +100,7 @@
 						"plot_type": "line",
 						"legend": true,
 						"height": 6,
-						"value": "datasources[\"Clock\"][\"numeric_value\"];\n\nvar xbpm = [];\nvar ybpm = [];\n\nlet bpmpositions = [0.400, 0.762, 2.224, 2.424, 2.624, 3.436, 3.636, 3.836];\nvar xpv = \"\";\nvar ypv = \"\";\nvar value = 0;\nvar yvalue = 0;\n\nfor (i=1; i < 9; i++) {\n    xpv = \"MEBT-010:PBI-BPM-00\"+String(i)+\":XP-AvgValue\";\n    xvalue = datasources[\"BPM\"][xpv][\"value\"]/1000;\n    if (xvalue == null) {\n        xvalue = 0.0;\n    }\n    xbpm.push([bpmpositions[i-1], xvalue]);\n    ypv = \"MEBT-010:PBI-BPM-00\"+String(i)+\":YP-AvgValue\";\n    yvalue = datasources[\"BPM\"][ypv][\"value\"]/1000;\n    if (yvalue == null) {\n        yvalue = 0.0;\n    }\n    ybpm.push([bpmpositions[i-1], yvalue]);\n}\n\nlet data = [{label: 'Horizontal', data: xbpm, color: \"lime\"},\n        {label: 'Vertical', data: ybpm, color: \"yellow\"}];\n\nreturn data;",
+						"value": "datasources[\"Clock\"][\"numeric_value\"];\n\nvar xbpm = [];\nvar ybpm = [];\n\nlet bpmpositions = [0.400, 0.762, 2.224, 2.424, 2.624, 3.436, 3.636, 3.836];\nvar xpv = \"\";\nvar ypv = \"\";\nvar value = 0;\nvar yvalue = 0;\n\nfor (i=1; i < 9; i++) {\n    xpv = \"MEBT-010:PBI-BPM-00\"+String(i)+\":XP-AvgValue\";\n    xvalue = datasources[\"MEBT-BPM\"][xpv][\"value\"]/1000;\n    if (xvalue == null) {\n        xvalue = 0.0;\n    }\n    xbpm.push([bpmpositions[i-1], xvalue]);\n    ypv = \"MEBT-010:PBI-BPM-00\"+String(i)+\":YP-AvgValue\";\n    yvalue = datasources[\"MEBT-BPM\"][ypv][\"value\"]/1000;\n    if (yvalue == null) {\n        yvalue = 0.0;\n    }\n    ybpm.push([bpmpositions[i-1], yvalue]);\n}\n\nlet data = [{label: 'Horizontal', data: xbpm, color: \"lime\"},\n        {label: 'Vertical', data: ybpm, color: \"yellow\"}];\n\nreturn data;",
 						"xticks": "datasources[\"Clock\"][\"numeric_value\"];\n\nvar cols = document.getElementsByClassName('gs_w')[0].getAttribute('data-sizex');\n\nvar digits = 3;\nvar bpmxlabel = \"<br>BPM Position from MEBT start [m]\";\n\nif (cols == 2) {\n    bpmxlabel =  \"<br>BPM pos. [m]\";\n    digits = 1;\n}\nif (cols == 1) {\n    bpmxlabel =  \"<br>BPM pos. [m]\";\n    digits = 0;\n}\n\n\nvar bpmxtick = [];\n\nlet bpmpositions = [0.400, 0.762, 2.224, 2.424, 2.624, 3.436, 3.636, 3.836];\n\nfor (i = 0; i < 8; i += 1) {\n\tbpmxtick.push([bpmpositions[i], String(bpmpositions[i].toFixed(digits))]);\n}\nbpmxtick[2][1] += bpmxlabel;\n\nreturn bpmxtick;",
 						"yticks": "datasources[\"Clock\"][\"numeric_value\"];\n\nvar ytick = [];\n\nfor (i = -4; i < 4; i += 1) {\n\tytick.push([i, String(i)]);\n}\n\nytick.push([4, \"∆X,∆Y [mm]\"]);\n\nreturn ytick;",
 						"points": true,
@@ -101,11 +113,17 @@
 			"title": "MEBT Wire Scanners",
 			"width": 1,
 			"row": {
+				"1": 35,
+				"2": 35,
+				"3": 35,
 				"4": 35,
 				"13": 35,
 				"15": 35
 			},
 			"col": {
+				"1": 1,
+				"2": 1,
+				"3": 1,
 				"4": 1,
 				"13": 1,
 				"15": 1
@@ -123,6 +141,36 @@
 					}
 				}
 			]
+		},
+		{
+			"title": "DTL1 BPMs",
+			"width": 1,
+			"row": {
+				"1": 53,
+				"2": 53,
+				"4": 53
+			},
+			"col": {
+				"1": 1,
+				"2": 1,
+				"4": 1
+			},
+			"col_width": 4,
+			"widgets": [
+				{
+					"type": "flot_extended_plugin",
+					"settings": {
+						"plot_type": "line",
+						"legend": true,
+						"height": 6,
+						"value": "datasources[\"Clock\"][\"numeric_value\"];\n\nvar xbpm = [];\nvar ybpm = [];\n\nlet bpmpositions = [0.230, 1.290, 1.695, 3.325, 4.128, 6.923];\nvar xpv = \"\";\nvar ypv = \"\";\nvar value = 0;\nvar yvalue = 0;\n\nfor (i=1; i < 7; i++) {\n    xpv = \"DTL-010:PBI-BPM-00\"+String(i)+\":XP-AvgValue\";\n    xvalue = datasources[\"DTL1-BPM\"][xpv][\"value\"]/1000;\n    if (xvalue == null) {\n        xvalue = 0.0;\n    }\n    xbpm.push([bpmpositions[i-1], xvalue]);\n    ypv = \"DTL-010:PBI-BPM-00\"+String(i)+\":YP-AvgValue\";\n    yvalue = datasources[\"DTL1-BPM\"][ypv][\"value\"]/1000;\n    if (yvalue == null) {\n        yvalue = 0.0;\n    }\n    ybpm.push([bpmpositions[i-1], yvalue]);\n}\n\nlet data = [{label: 'Horizontal', data: xbpm, color: \"lime\"},\n        {label: 'Vertical', data: ybpm, color: \"yellow\"}];\n\nreturn data;",
+						"xticks": "datasources[\"Clock\"][\"numeric_value\"];\n\nvar cols = document.getElementsByClassName('gs_w')[0].getAttribute('data-sizex');\n\nvar digits = 3;\nvar bpmxlabel = \"<br>BPM Position from DTL1 start [m]\";\n\nif (cols == 2) {\n    bpmxlabel =  \"<br>BPM pos. [m]\";\n    digits = 1;\n}\nif (cols == 1) {\n    bpmxlabel =  \"<br>BPM pos. [m]\";\n    digits = 0;\n}\n\n\nvar bpmxtick = [];\n\nlet bpmpositions = [0.230, 1.290, 1.695, 3.325, 4.128, 6.923];\n\nfor (i = 0; i < 6; i += 1) {\n\tbpmxtick.push([bpmpositions[i], String(bpmpositions[i].toFixed(digits))]);\n}\nbpmxtick[3][1] += bpmxlabel;\n\nreturn bpmxtick;",
+						"yticks": "datasources[\"Clock\"][\"numeric_value\"];\n\nvar ytick = [];\n\nfor (i = -4; i < 4; i += 1) {\n\tytick.push([i, String(i)]);\n}\n\nytick.push([4, \"∆X,∆Y [mm]\"]);\n\nreturn ytick;",
+						"points": true,
+						"zoom": "xy"
+					}
+				}
+			]
 		}
 	],
 	"datasources": [
@@ -144,7 +192,7 @@
 			}
 		},
 		{
-			"name": "BPM",
+			"name": "MEBT-BPM",
 			"type": "JSON",
 			"settings": {
 				"url": "/data/api/v2/pvget/MEBT-010:PBI-BPM-001:XP-AvgValue,MEBT-010:PBI-BPM-002:XP-AvgValue,MEBT-010:PBI-BPM-003:XP-AvgValue,MEBT-010:PBI-BPM-004:XP-AvgValue,MEBT-010:PBI-BPM-005:XP-AvgValue,MEBT-010:PBI-BPM-006:XP-AvgValue,MEBT-010:PBI-BPM-007:XP-AvgValue,MEBT-010:PBI-BPM-008:XP-AvgValue,MEBT-010:PBI-BPM-001:YP-AvgValue,MEBT-010:PBI-BPM-002:YP-AvgValue,MEBT-010:PBI-BPM-003:YP-AvgValue,MEBT-010:PBI-BPM-004:YP-AvgValue,MEBT-010:PBI-BPM-005:YP-AvgValue,MEBT-010:PBI-BPM-006:YP-AvgValue,MEBT-010:PBI-BPM-007:YP-AvgValue,MEBT-010:PBI-BPM-008:YP-AvgValue",
@@ -162,6 +210,17 @@
 				"refresh": 10,
 				"method": "GET"
 			}
+		},
+		{
+			"name": "DTL1-BPM",
+			"type": "JSON",
+			"settings": {
+				"url": "/data/api/v2/pvget/DTL-010:PBI-BPM-001:XP-AvgValue,DTL-010:PBI-BPM-001:YP-AvgValue,DTL-010:PBI-BPM-002:XP-AvgValue,DTL-010:PBI-BPM-002:YP-AvgValue,DTL-010:PBI-BPM-003:XP-AvgValue,DTL-010:PBI-BPM-003:YP-AvgValue,DTL-010:PBI-BPM-004:XP-AvgValue,DTL-010:PBI-BPM-004:YP-AvgValue,DTL-010:PBI-BPM-005:XP-AvgValue,DTL-010:PBI-BPM-005:YP-AvgValue,DTL-010:PBI-BPM-006:XP-AvgValue,DTL-010:PBI-BPM-006:YP-AvgValue",
+				"use_thingproxy": true,
+				"refresh": 10,
+				"method": "GET",
+				"name": "DTL1-BPM"
+			}
 		}
 	],
 	"columns": 4
-- 
GitLab