{
	"version": 1,
	"header_image": "",
	"allow_edit": false,
	"plugins": [],
	"panes": [
		{
			"title": "",
			"width": 1,
			"row": {
				"1": 1,
				"2": 1,
				"3": 1,
				"4": 1
			},
			"col": {
				"1": 1,
				"2": 1,
				"3": 1,
				"4": 1
			},
			"col_width": 4,
			"widgets": [
				{
					"type": "html",
					"settings": {
						"html": "let clock = datasources[\"Clock\"][\"numeric_value\"]; // trick to trigger the update\nlet cols = document.getElementsByClassName('gs_w')[0].getAttribute('data-sizex');\ndocument.getElementsByClassName('gs_w')[0].firstElementChild.firstElementChild.innerHTML = \"\";\n\nlet title = \"Fast Beam Interlock System\"; // Change this title. Try not to exceed the 30 chars\n\nlet fontsize = Math.round((-0.66486486*title.length+66.67567568)*cols/4);\nlet lmargin = Math.round((0.43918919*title.length-4.05405405)+3.75*cols*cols-34.75*cols+79.75);\nlet width = 100-lmargin;\n\nvar text = `<div style=\\\"position: relative; margin-top: -15px; text-align: left;\\\">\n\t\t\t<div style=\\\"position: relative;\\\">\n\t\t\t\t<img src=\\\"../img/ess-logo.svg\\\" title=\\\"Designed by Emanuele Laface with PyEpics and Freeboard. Graphics by Dirk Nordt.\\\"></img>\n\t\t\t</div>\n<div class=\\\"tw-value\\\" style=\\\"font-size: `+String(fontsize)+`px; color:#ffffff !important; position: absolute; left: `+String(lmargin)+`%; width: `+String(width)+`%; height: 100%; justify-content: center; display: flex; align-items: center;\\\" title=\\\"Designed by Emanuele Laface with PyEpics and Freeboard. Graphics by Dirk Nordt.\\\">\n\t\t\t\t`+title+`\n\t\t\t</div>\n\t\t</div>`;\n\nif (cols == 1){\n    text = \"<div style=\\\"position: static; margin-top: -15px;\\\"><img src=\\\"../img/ess-logo.svg\\\" title=\\\"Designed by Emanuele Laface with PyEpics and Freeboard. Graphics by Dirk Nordt.\\\"><div class=\\\"tw-value\\\" style=\\\"font-size: 30px; color:#ffffff !important; position: relative; bottom: 55px; left: 30px;\\\" title=\\\"Designed by Emanuele Laface with PyEpics and Freeboard. Graphics by Dirk Nordt.\\\"></div></img></div>\";\n    document.getElementsByClassName('gs_w')[0].firstElementChild.firstElementChild.innerHTML = title;\n}\n\nreturn text;",
						"height": 2
					}
				}
			]
		},
		{
			"title": "Configuration",
			"width": 1,
			"row": {
				"3": 7,
				"4": 7,
				"5": 7,
				"6": 7,
				"7": 7,
				"8": 7,
				"9": 7
			},
			"col": {
				"3": 3,
				"4": 1,
				"5": 2,
				"6": 2,
				"7": 2,
				"8": 2,
				"9": 2
			},
			"col_width": 1,
			"widgets": [
				{
					"type": "text_widget",
					"settings": {
						"title": "Beam Destination",
						"size": "regular",
						"value": "datasources[\"Interlocks\"][\"FBIS::beam_destination\"][\"value\"][\"choices\"][datasources[\"Interlocks\"][\"FBIS::beam_destination\"][\"value\"][\"index\"]];",
						"animate": true
					}
				},
				{
					"type": "text_widget",
					"settings": {
						"title": "Beam Mode",
						"size": "regular",
						"value": "datasources[\"Interlocks\"][\"FBIS::beam_mode\"][\"value\"][\"choices\"][datasources[\"Interlocks\"][\"FBIS::beam_mode\"][\"value\"][\"index\"]];",
						"animate": true
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "Beam ON",
						"value": "var g  = datasources[\"Interlocks\"][\"FBIS::beam_state_ok\"][\"value\"][\"index\"];\n\nif (g == 1) {\n    return 0;\n} else {\n    return 1;\n}",
						"green_text": "OK",
						"amber_text": "NOK"
					}
				}
			]
		},
		{
			"title": "FBIS STATUS",
			"width": 1,
			"row": {
				"3": 7,
				"4": 7,
				"6": 7,
				"7": 7
			},
			"col": {
				"3": 2,
				"4": 2,
				"6": 2,
				"7": 2
			},
			"col_width": 2,
			"widgets": [
				{
					"type": "text_widget",
					"settings": {
						"size": "regular",
						"value": "var bi  = datasources[\"Interlocks\"][\"FBIS::BI_ok\"][\"value\"][\"index\"];\nvar rbi = datasources[\"Interlocks\"][\"FBIS::RBI_ok\"][\"value\"][\"index\"];\nvar ebi = datasources[\"Interlocks\"][\"FBIS::EBI_ok\"][\"value\"][\"index\"];\n\nif (ebi == 0) {\n    return \"Emergency Beam Interlock\";\n} else if (rbi == 0) {\n    return \"Regular Beam Interlock\";\n} else if (bi == 0) {\n    return \"Beam Inhibit\";\n} else {\n    return \"Global Beam Permit OK\";\n}",
						"animate": true
					}
				}
			]
		},
		{
			"title": "SYSTEMS",
			"width": 1,
			"row": {
				"3": 31,
				"4": 7,
				"7": 31,
				"8": 31,
				"9": 31
			},
			"col": {
				"3": 1,
				"4": 4,
				"7": 1,
				"8": 1,
				"9": 1
			},
			"col_width": 1,
			"widgets": [
				{
					"type": "ragIndicator",
					"settings": {
						"title": "Insertable Devices",
						"value": "var r  = datasources[\"Interlocks\"][\"FBIS::MPSID_RBI_ok\"][\"value\"][\"index\"];\nvar g =  datasources[\"Interlocks\"][\"FBIS::MPSID_ok\"][\"value\"][\"index\"];\n\nif (g == 1) {\n    return 0;\n} else if (r == 0){\n    return 2;\n}else {\n    return 1;\n}",
						"green_text": "OK",
						"amber_text": "Inhibit",
						"red_text": "Interlock"
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "Quadrupole Magnets",
						"value": "var r  = datasources[\"Interlocks\"][\"FBIS::MPSMag_RBI_ok\"][\"value\"][\"index\"];\nvar g =  datasources[\"Interlocks\"][\"FBIS::MPSMag_ok\"][\"value\"][\"index\"];\n\nif (g == 1) {\n    return 0;\n} else if (r == 0){\n    return 2;\n}else {\n    return 1;\n}",
						"green_text": "OK",
						"amber_text": "Inhibit",
						"red_text": "Interlock"
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "Vacuum",
						"value": "var r  = datasources[\"Interlocks\"][\"FBIS::MPSVac_RBI_ok\"][\"value\"][\"index\"];\nvar g =  datasources[\"Interlocks\"][\"FBIS::MPSVac_ok\"][\"value\"][\"index\"];\n\nif (g == 1) {\n    return 0;\n} else if (r == 0){\n    return 2;\n}else {\n    return 1;\n}",
						"green_text": "OK",
						"amber_text": "Inhibit",
						"red_text": "Interlock"
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "Software Interlock",
						"value": "var r  = datasources[\"Interlocks\"][\"FBIS::SIS_RBI_ok\"][\"value\"][\"index\"];\nvar g =  datasources[\"Interlocks\"][\"FBIS::SIS_ok\"][\"value\"][\"index\"];\n\nif (g == 1) {\n    return 0;\n} else if (r == 0){\n    return 2;\n}else {\n    return 1;\n}",
						"green_text": "OK",
						"amber_text": "Inhibit",
						"red_text": "Interlock"
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "Ion Source & LEBT",
						"value": "var r  = datasources[\"Interlocks\"][\"FBIS::IS_PLC_RBI_ok\"][\"value\"][\"index\"];\nvar g =  datasources[\"Interlocks\"][\"FBIS::IS_PLC_ok\"][\"value\"][\"index\"];\n\nif (g == 1) {\n    return 0;\n} else if (r == 0){\n    return 2;\n}else {\n    return 1;\n}",
						"green_text": "OK",
						"amber_text": "Inhibit",
						"red_text": "Interlock"
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "RF Systems",
						"value": "var r  = datasources[\"Interlocks\"][\"FBIS::RF_RBI_ok\"][\"value\"][\"index\"];\nvar g =  datasources[\"Interlocks\"][\"FBIS::RF_ok\"][\"value\"][\"index\"];\n\nif (g == 1) {\n    return 0;\n} else if (r == 0){\n    return 2;\n}else {\n    return 1;\n}",
						"green_text": "OK",
						"amber_text": "Inhibit",
						"red_text": "Interlock"
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "PSS",
						"value": "var r  = datasources[\"Interlocks\"][\"FBIS::PSS_RBI_ok\"][\"value\"][\"index\"];\nvar g =  datasources[\"Interlocks\"][\"FBIS::PSS_ok\"][\"value\"][\"index\"];\n\nif (g == 1) {\n    return 0;\n} else if (r == 0){\n    return 2;\n}else {\n    return 1;\n}",
						"green_text": "OK",
						"amber_text": "Inhibit",
						"red_text": "Interlock"
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "MEBT Chopper LPS",
						"value": "var r  = datasources[\"Interlocks\"][\"FBIS::MEBT_Ch_PLC_RBI_ok\"][\"value\"][\"index\"];\nvar g =  datasources[\"Interlocks\"][\"FBIS::MEBT_Ch_PLC_ok\"][\"value\"][\"index\"];\n\nif (g == 1) {\n    return 0;\n} else if (r == 0){\n    return 2;\n}else {\n    return 1;\n}",
						"green_text": "OK",
						"amber_text": "Inhibit",
						"red_text": "Interlock"
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "LEBT Chopper Fault",
						"value": "var r  = datasources[\"Interlocks\"][\"FBIS::LEBT_Ch_Fault_RBI_ok\"][\"value\"][\"index\"];\nvar g =  datasources[\"Interlocks\"][\"FBIS::LEBT_Ch_Fault_ok\"][\"value\"][\"index\"];\n\nif (g == 1) {\n    return 0;\n} else if (r == 0){\n    return 2;\n}else {\n    return 1;\n}",
						"green_text": "OK",
						"amber_text": "Inhibit",
						"red_text": "Interlock"
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "BCMs",
						"value": "var r  = datasources[\"Interlocks\"][\"FBIS::BCM_RBI_ok\"][\"value\"][\"index\"];\nvar g =  datasources[\"Interlocks\"][\"FBIS::BCM_ok\"][\"value\"][\"index\"];\n\nif (g == 1) {\n    return 0;\n} else if (r == 0){\n    return 2;\n}else {\n    return 1;\n}",
						"green_text": "OK",
						"amber_text": "Inhibit",
						"red_text": "Interlock"
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "BPMs",
						"value": "var r  = datasources[\"Interlocks\"][\"FBIS::BPM_RBI_ok\"][\"value\"][\"index\"];\nvar g =  datasources[\"Interlocks\"][\"FBIS::BPM_ok\"][\"value\"][\"index\"];\n\nif (g == 1) {\n    return 0;\n} else if (r == 0){\n    return 2;\n}else {\n    return 1;\n}",
						"green_text": "OK",
						"amber_text": "Inhibit",
						"red_text": "Interlock"
					}
				}
			]
		},
		{
			"title": "Global Beam Permit",
			"width": 1,
			"row": {
				"3": 11,
				"4": 11,
				"6": 11,
				"7": 11,
				"8": 11
			},
			"col": {
				"3": 1,
				"4": 2,
				"6": 2,
				"7": 2,
				"8": 2
			},
			"col_width": 2,
			"widgets": [
				{
					"type": "html",
					"settings": {
						"html": "<script>\n    function setDatasource(event) {\n\t\tfreeboard.showLoadingIndicator(true);\n\t};\n</script>\n<div style=\"position:relative;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;\">\n        <select style=\"padding:0px 0px\" onchange=\"setDatasource()\" id=\"time-series\">\n            <option value=\"1M\">One Month</option>\n            <option value=\"2w\">Two Weeks</option>\n            <option value=\"1w\">One Week</option>\n            <option value=\"2d\">Two Days</option>\n            <option value=\"1d\">One Day</option>\n            <option value=\"4h\">Four Hours</option>\n            <option value=\"1h\">One Hour</option>\n            <option value=\"5m\">Five Minutes</option>\n        </select>\n</div>",
						"height": 1
					}
				},
				{
					"type": "flot_extended_plugin",
					"settings": {
						"plot_type": "line",
						"legend": true,
						"height": 2,
						"value": "var hours2 = 7200 * 1000; // shift to Lund timeslot\nvar clock = datasources[\"Clock5m\"][\"numeric_value\"] + hours2;\nvar series = document.getElementById(\"time-series\").value;\n\nswitch(series){\n    case \"1M\":\n        var dg = datasources[\"1M\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"1M\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"1M\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"1M\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 2419200; // 1000 ms * 1 month\n        break;        \n    case \"2w\":\n        var dg = datasources[\"2w\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"2w\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"2w\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"2w\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 1209600; // 1000 ms * 2 weeks\n        break;\n\tcase \"1w\":        \n        var dg = datasources[\"1w\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"1w\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"1w\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"1w\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 604800; // 1000 ms * 1 week\n        break;\n\tcase \"2d\":        \n        var dg = datasources[\"2d\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"2d\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"2d\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"2d\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 172800; // 1000 ms * 2 days\n        break;\n\tcase \"1d\":        \n        var dg = datasources[\"1d\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"1d\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"1d\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"1d\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 86400; // 1000 ms *1 day\n        break;\n\tcase \"4h\":        \n        var dg = datasources[\"4h\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"4h\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"4h\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"4h\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 14400; // 1000 ms * 4 hours\n        break;\n\tcase \"2h\":        \n        var dg = datasources[\"2h\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"2h\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"2h\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"2h\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 7200; // 1000 ms * 2 hours\n        break;        \n\tcase \"1h\":        \n        var dg = datasources[\"1h\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"1h\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"1h\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"1h\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 3600; // 1000 ms * 1h\n        break;\n\tcase \"5m\":        \n        var dg = datasources[\"5m\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"5m\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"5m\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"5m\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 300; // 1000 ms * 5 minutes\n        break;             \n}\n\nvar a       = [];\nvar a_start = [];\nvar a_end   = [];\n\nvar tmax = 2918814085000; // roughly 2060\nvar tmin = 962286085000;  // roughlt 2000\n\nif(dg.length == 0){\n    dg.push([tmax, 0]); \n    dg.push([tmin, 0]);  \n    a_start.push(tmax); // so not take into account in the minimum computation below\n    a_end.push(tmin);   // so not take into account in the maximum computation below\n} else{\n    a_start.push(clock-timespan-hours2);\n    a_end.push(clock-hours2);\n}\n\nif(di.length == 0){\n    di.push([tmax, 0]); \n    di.push([tmin, 0]);  \n    a_start.push(tmax);\n    a_end.push(tmin);\n}else{\n    a_start.push(clock-timespan-hours2);\n    a_end.push(clock-hours2);\n}\n\nif(dr.length == 0){\n    dr.push([tmax, 0]); \n    dr.push([tmin, 0]);  \n    a_start.push(tmax);\n    a_end.push(tmin);\n}else{\n    a_start.push(clock-timespan-hours2);\n    a_end.push(clock-hours2);\n}\n\nif(de.length == 0){\n    de.push([tmax, 0]); \n    de.push([tmin, 0]);  \n    a_start.push(tmax);\n    a_end.push(tmin);\n}else{\n    a_start.push(clock-timespan-hours2);\n    a_end.push(clock-hours2);\n}\n\nvar start = hours2 + Math.min(a_start[0],         a_start[1],           a_start[2],           a_start[3]);\nvar end  =  hours2 + Math.max(a_end[0],             a_end[1],             a_end[2],             a_end[3]);\n\nvar d = dg; // Assign the waveform to show\n\n///////////////////////\n// to have a waveform from the beginnig if the showed beginning is less the the real one\n// For the archiving that signal is the oppositve of the previous point\nvar opposite = 1;\nif (d[0][1] == 1){\n    opposite = 0;\n}\na.push([start,opposite]);\n///////////////////////\n\nfor (i=0; i < d.length; i++) {\n    var x = d[i][0]+hours2; \n    var y = d[i][1];\n    if (i == 0) {\n        a.push([x,opposite]); \n    }\n    if (i>0){ // add a point in order to show an horizontal line\n    \t a.push([x,d[i-1][1]]);\n    }\n    a.push([x, y]);\n}\na.push([end,d[d.length-1][1]]); // add a last point with the same value as the actual array lastpoint\n\n// check if it was empty and fill as the current status\nvar fill  = datasources[\"Interlocks\"][\"FBIS::beam_permit_ok\"][\"value\"][\"index\"];\n// the array is withou points\nif (d[0][0] == tmax){\n    a.length = 0; // delete the previous array\n    a = [];\n    if (start > tmax){ // it means that in the timespan selected there aren't any point in all the waveforms\n    \ta.push([clock,fill]);\n    \ta.push([clock-timespan,fill]);        \n    } else {           // set as start/end the min start and max end coming from other waveforms\n    \ta.push([start,fill]);\n    \ta.push([end,fill]);\n    }\n}\n\n\nswitch(series){\n    case \"1M\":\n        data = [\n            {label: 'GBP', data: a, color: 'lime'}\n        ];\n        break;\n    case \"2w\":\n        data = [\n            {label: 'GBP', data: a, color: 'lime'}\n        ];\n        break;\n\tcase \"1w\":\n        data = [\n         \t{label: 'GBP', data: a, color: 'lime'}\n        ];\n        break;\n\tcase \"2d\":\n        data = [\n\t\t\t{label: 'GBP', data: a, color: 'lime'}\n        ];\n        break;\n\tcase \"1d\":\n         data = [\n\t\t\t{label: 'GBP', data: a, color: 'lime'}\n        ];\n        break;\n\tcase \"4h\":\n         data = [\n             {label: 'GBP', data: a, color: 'lime'}\n        ];\n        break;\n\tcase \"2h\":\n         data = [\n\t\t\t{label: 'GBP', data: a, color: 'lime'}\n        ];\n        break;        \n\tcase \"1h\":\n         data = [\n\t\t\t{label: 'GBP', data: a, color: 'lime'}\n        ];\n        break;\n\tcase \"5m\":\n         data = [\n\t\t\t{label: 'GBP', data: a, color: 'lime'}\n        ];\n        break;        \n        \n}\n\nfreeboard.showLoadingIndicator(false);\nreturn data;\n",
						"xticks": "6",
						"yticks": "[[0,'NOK'], [1, 'OK  ']]",
						"x_timestamp": true,
						"points": false,
						"zoom": ""
					}
				},
				{
					"type": "flot_extended_plugin",
					"settings": {
						"plot_type": "line",
						"legend": true,
						"height": 2,
						"value": "var hours2 = 7200 * 1000; // shift to Lund timeslot\nvar clock = datasources[\"Clock5m\"][\"numeric_value\"] + hours2;\nvar series = document.getElementById(\"time-series\").value;\n\nswitch(series){\n    case \"1M\":\n        var dg = datasources[\"1M\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"1M\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"1M\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"1M\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 2419200; // 1000 ms * 1 month\n        break;        \n    case \"2w\":\n        var dg = datasources[\"2w\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"2w\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"2w\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"2w\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 1209600; // 1000 ms * 2 weeks\n        break;\n\tcase \"1w\":        \n        var dg = datasources[\"1w\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"1w\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"1w\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"1w\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 604800; // 1000 ms * 1 week\n        break;\n\tcase \"2d\":        \n        var dg = datasources[\"2d\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"2d\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"2d\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"2d\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 172800; // 1000 ms * 2 days\n        break;\n\tcase \"1d\":        \n        var dg = datasources[\"1d\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"1d\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"1d\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"1d\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 86400; // 1000 ms *1 day\n        break;\n\tcase \"4h\":        \n        var dg = datasources[\"4h\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"4h\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"4h\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"4h\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 14400; // 1000 ms * 4 hours\n        break;\n\tcase \"2h\":        \n        var dg = datasources[\"2h\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"2h\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"2h\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"2h\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 7200; // 1000 ms * 2 hours\n        break;        \n\tcase \"1h\":        \n        var dg = datasources[\"1h\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"1h\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"1h\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"1h\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 3600; // 1000 ms * 1h\n        break;\n\tcase \"5m\":        \n        var dg = datasources[\"5m\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"5m\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"5m\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"5m\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 300; // 1000 ms * 5 minutes\n        break;             \n}\n\nvar a       = [];\nvar a_start = [];\nvar a_end   = [];\n\nvar tmax = 2918814085000; // roughly 2060\nvar tmin = 962286085000;  // roughlt 2000\n\nif(dg.length == 0){\n    dg.push([tmax, 0]); \n    dg.push([tmin, 0]);  \n    a_start.push(tmax); // so not take into account in the minimum computation below\n    a_end.push(tmin);   // so not take into account in the maximum computation below\n} else{\n    a_start.push(clock-timespan-hours2);\n    a_end.push(clock-hours2);\n}\n\nif(di.length == 0){\n    di.push([tmax, 0]); \n    di.push([tmin, 0]);  \n    a_start.push(tmax);\n    a_end.push(tmin);\n}else{\n    a_start.push(clock-timespan-hours2);\n    a_end.push(clock-hours2);\n}\n\nif(dr.length == 0){\n    dr.push([tmax, 0]); \n    dr.push([tmin, 0]);  \n    a_start.push(tmax);\n    a_end.push(tmin);\n}else{\n    a_start.push(clock-timespan-hours2);\n    a_end.push(clock-hours2);\n}\n\nif(de.length == 0){\n    de.push([tmax, 0]); \n    de.push([tmin, 0]);  \n    a_start.push(tmax);\n    a_end.push(tmin);\n}else{\n    a_start.push(clock-timespan-hours2);\n    a_end.push(clock-hours2);\n}\n\nvar start = hours2 + Math.min(a_start[0],         a_start[1],           a_start[2],           a_start[3]);\nvar end  =  hours2 + Math.max(a_end[0],             a_end[1],             a_end[2],             a_end[3]);\n\nvar d = di; // Assign the waveform to show\n\n///////////////////////\n// to have a waveform from the beginnig if the showed beginning is less the the real one\n// For the archiving that signal is the oppositve of the previous point\nvar opposite = 1;\nif (d[0][1] == 1){\n    opposite = 0;\n}\na.push([start,opposite]);\n///////////////////////\n\nfor (i=0; i < d.length; i++) {\n    var x = d[i][0]+hours2; \n    var y = d[i][1];\n    if (i == 0) {\n        a.push([x,opposite]); \n    }\n    if (i>0){ // add a point in order to show an horizontal line\n    \t a.push([x,d[i-1][1]]);\n    }\n    a.push([x, y]);\n}\na.push([end,d[d.length-1][1]]); // add a last point with the same value as the actual array lastpoint\n\n// check if it was empty and fill as the current status\nvar fill  = datasources[\"Interlocks\"][\"FBIS::BI_ok\"][\"value\"][\"index\"];\n// the array is withou points\nif (d[0][0] == tmax){\n    a.length = 0; // delete the previous array\n    a = [];\n    if (start > tmax){ // it means that in the timespan selected there aren't any point in all the waveforms\n    \ta.push([clock,fill]);\n    \ta.push([clock-timespan,fill]);        \n    } else {           // set as start/end the min start and max end coming from other waveforms\n    \ta.push([start,fill]);\n    \ta.push([end,fill]);\n    }\n}\n\n\nswitch(series){\n    case \"1M\":\n        data = [\n            {label: 'BI', data: a, color: 'yellow'}\n        ];\n        break;\n    case \"2w\":\n        data = [\n            {label: 'BI', data: a, color: 'yellow'}\n        ];\n        break;\n\tcase \"1w\":\n        data = [\n         \t{label: 'BI', data: a, color: 'yellow'}\n        ];\n        break;\n\tcase \"2d\":\n        data = [\n\t\t\t{label: 'BI', data: a, color: 'yellow'}\n        ];\n        break;\n\tcase \"1d\":\n         data = [\n\t\t\t{label: 'BI', data: a, color: 'yellow'}\n        ];\n        break;\n\tcase \"4h\":\n         data = [\n             {label: 'BI', data: a, color: 'yellow'}\n        ];\n        break;\n\tcase \"2h\":\n         data = [\n\t\t\t{label: 'BI', data: a, color: 'yellow'}\n        ];\n        break;        \n\tcase \"1h\":\n         data = [\n\t\t\t{label: 'BI', data: a, color: 'yellow'}\n        ];\n        break;\n\tcase \"5m\":\n         data = [\n\t\t\t{label: 'BI', data: a, color: 'yellow'}\n        ];\n        break;        \n        \n}\n\nfreeboard.showLoadingIndicator(false);\nreturn data;\n",
						"xticks": "6",
						"yticks": "[[0,'NOK'], [1, 'OK  ']]",
						"x_timestamp": true,
						"points": false,
						"zoom": ""
					}
				},
				{
					"type": "flot_extended_plugin",
					"settings": {
						"plot_type": "line",
						"legend": true,
						"height": 2,
						"value": "var hours2 = 7200 * 1000; // shift to Lund timeslot\nvar clock = datasources[\"Clock5m\"][\"numeric_value\"] + hours2;\nvar series = document.getElementById(\"time-series\").value;\n\nswitch(series){\n    case \"1M\":\n        var dg = datasources[\"1M\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"1M\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"1M\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"1M\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 2419200; // 1000 ms * 1 month\n        break;        \n    case \"2w\":\n        var dg = datasources[\"2w\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"2w\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"2w\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"2w\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 1209600; // 1000 ms * 2 weeks\n        break;\n\tcase \"1w\":        \n        var dg = datasources[\"1w\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"1w\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"1w\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"1w\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 604800; // 1000 ms * 1 week\n        break;\n\tcase \"2d\":        \n        var dg = datasources[\"2d\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"2d\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"2d\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"2d\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 172800; // 1000 ms * 2 days\n        break;\n\tcase \"1d\":        \n        var dg = datasources[\"1d\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"1d\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"1d\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"1d\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 86400; // 1000 ms *1 day\n        break;\n\tcase \"4h\":        \n        var dg = datasources[\"4h\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"4h\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"4h\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"4h\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 14400; // 1000 ms * 4 hours\n        break;\n\tcase \"2h\":        \n        var dg = datasources[\"2h\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"2h\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"2h\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"2h\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 7200; // 1000 ms * 2 hours\n        break;        \n\tcase \"1h\":        \n        var dg = datasources[\"1h\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"1h\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"1h\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"1h\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 3600; // 1000 ms * 1h\n        break;\n\tcase \"5m\":        \n        var dg = datasources[\"5m\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"5m\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"5m\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"5m\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 300; // 1000 ms * 5 minutes\n        break;             \n}\n\nvar a       = [];\nvar a_start = [];\nvar a_end   = [];\n\nvar tmax = 2918814085000; // roughly 2060\nvar tmin = 962286085000;  // roughlt 2000\n\nif(dg.length == 0){\n    dg.push([tmax, 0]); \n    dg.push([tmin, 0]);  \n    a_start.push(tmax); // so not take into account in the minimum computation below\n    a_end.push(tmin);   // so not take into account in the maximum computation below\n} else{\n    a_start.push(clock-timespan);\n    a_end.push(clock);\n}\n\nif(di.length == 0){\n    di.push([tmax, 0]); \n    di.push([tmin, 0]);  \n    a_start.push(tmax);\n    a_end.push(tmin);\n}else{\n    a_start.push(clock-timespan);\n    a_end.push(clock);\n}\n\nif(dr.length == 0){\n    dr.push([tmax, 0]); \n    dr.push([tmin, 0]);  \n    a_start.push(tmax);\n    a_end.push(tmin);\n}else{\n    a_start.push(clock-timespan);\n    a_end.push(clock);\n}\n\nif(de.length == 0){\n    de.push([tmax, 0]); \n    de.push([tmin, 0]);  \n    a_start.push(tmax);\n    a_end.push(tmin);\n}else{\n    a_start.push(clock-timespan);\n    a_end.push(clock);\n}\n\nvar start = Math.min(a_start[0],         a_start[1],           a_start[2],           a_start[3]);\nvar end  =  Math.max(a_end[0],             a_end[1],             a_end[2],             a_end[3]);\n\nvar d = dr; // Assign the waveform to show\n\n///////////////////////\n// to have a waveform from the beginnig if the showed beginning is less the the real one\n// For the archiving that signal is the oppositve of the previous point\nvar opposite = 1;\nif (d[0][1] == 1){\n    opposite = 0;\n}\na.push([start,opposite]);\n///////////////////////\n\nfor (i=0; i < d.length; i++) {\n    var x = d[i][0]+hours2; \n    var y = d[i][1];\n    if (i == 0) {\n        a.push([x,opposite]); \n    }\n    if (i>0){ // add a point in order to show an horizontal line\n    \t a.push([x,d[i-1][1]]);\n    }\n    a.push([x, y]);\n}\na.push([end,d[d.length-1][1]]); // add a last point with the same value as the actual array lastpoint\n\n// check if it was empty and fill as the current status\nvar fill  = datasources[\"Interlocks\"][\"FBIS::RBI_ok\"][\"value\"][\"index\"];\n// the array is withou points\nif (d[0][0] == tmax){\n    a.length = 0; // delete the previous array\n    a = [];\n    if (start > tmax){ // it means that in the timespan selected there aren't any point in all the waveforms\n    \ta.push([clock,fill]);\n    \ta.push([clock-timespan,fill]);        \n    } else {           // set as start/end the min start and max end coming from other waveforms\n    \ta.push([start,fill]);\n    \ta.push([end,fill]);\n    }\n}\n\n\nswitch(series){\n    case \"1M\":\n        data = [\n            {label: 'RBI', data: a, color: 'orange'}\n        ];\n        break;\n    case \"2w\":\n        data = [\n            {label: 'RBI', data: a, color: 'orange'}\n        ];\n        break;\n\tcase \"1w\":\n        data = [\n         \t{label: 'RBI', data: a, color: 'orange'}\n        ];\n        break;\n\tcase \"2d\":\n        data = [\n\t\t\t{label: 'RBI', data: a, color: 'orange'}\n        ];\n        break;\n\tcase \"1d\":\n         data = [\n\t\t\t{label: 'RBI', data: a, color: 'orange'}\n        ];\n        break;\n\tcase \"4h\":\n         data = [\n             {label: 'RBI', data: a, color: 'orange'}\n        ];\n        break;\n\tcase \"2h\":\n         data = [\n\t\t\t{label: 'RBI', data: a, color: 'orange'}\n        ];\n        break;        \n\tcase \"1h\":\n         data = [\n\t\t\t{label: 'RBI', data: a, color: 'orange'}\n        ];\n        break;\n\tcase \"5m\":\n         data = [\n\t\t\t{label: 'RBI', data: a, color: 'orange'}\n        ];\n        break;        \n        \n}\n\nfreeboard.showLoadingIndicator(false);\nreturn data;\n",
						"xticks": "6",
						"yticks": "[[0,'NOK'], [1, 'OK  ']]",
						"x_timestamp": true,
						"zoom": ""
					}
				},
				{
					"type": "flot_extended_plugin",
					"settings": {
						"plot_type": "line",
						"legend": true,
						"height": 2,
						"value": "var hours2 = 7200 * 1000; // shift to Lund timeslot\nvar clock = datasources[\"Clock5m\"][\"numeric_value\"] + hours2;\nvar series = document.getElementById(\"time-series\").value;\n\nswitch(series){\n    case \"1M\":\n        var dg = datasources[\"1M\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"1M\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"1M\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"1M\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 2419200; // 1000 ms * 1 month\n        break;        \n    case \"2w\":\n        var dg = datasources[\"2w\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"2w\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"2w\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"2w\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 1209600; // 1000 ms * 2 weeks\n        break;\n\tcase \"1w\":        \n        var dg = datasources[\"1w\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"1w\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"1w\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"1w\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 604800; // 1000 ms * 1 week\n        break;\n\tcase \"2d\":        \n        var dg = datasources[\"2d\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"2d\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"2d\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"2d\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 172800; // 1000 ms * 2 days\n        break;\n\tcase \"1d\":        \n        var dg = datasources[\"1d\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"1d\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"1d\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"1d\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 86400; // 1000 ms *1 day\n        break;\n\tcase \"4h\":        \n        var dg = datasources[\"4h\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"4h\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"4h\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"4h\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 14400; // 1000 ms * 4 hours\n        break;\n\tcase \"2h\":        \n        var dg = datasources[\"2h\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"2h\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"2h\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"2h\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 7200; // 1000 ms * 2 hours\n        break;        \n\tcase \"1h\":        \n        var dg = datasources[\"1h\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"1h\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"1h\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"1h\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 3600; // 1000 ms * 1h\n        break;\n\tcase \"5m\":        \n        var dg = datasources[\"5m\"][\"FBIS::beam_permit_ok\"];\n        var di = datasources[\"5m\"][\"FBIS::BI_ok\"];\n        var dr = datasources[\"5m\"][\"FBIS::RBI_ok\"];\n        var de = datasources[\"5m\"][\"FBIS::EBI_ok\"];\n        var timespan = 1000 * 300; // 1000 ms * 5 minutes\n        break;             \n}\n\nvar a       = [];\nvar a_start = [];\nvar a_end   = [];\n\nvar tmax = 2918814085000; // roughly 2060\nvar tmin = 962286085000;  // roughlt 2000\n\nif(dg.length == 0){\n    dg.push([tmax, 0]); \n    dg.push([tmin, 0]);  \n    a_start.push(tmax); // so not take into account in the minimum computation below\n    a_end.push(tmin);   // so not take into account in the maximum computation below\n} else{\n    a_start.push(clock-timespan-hours2);\n    a_end.push(clock-hours2);\n}\n\nif(di.length == 0){\n    di.push([tmax, 0]); \n    di.push([tmin, 0]);  \n    a_start.push(tmax);\n    a_end.push(tmin);\n}else{\n    a_start.push(clock-timespan-hours2);\n    a_end.push(clock-hours2);\n}\n\nif(dr.length == 0){\n    dr.push([tmax, 0]); \n    dr.push([tmin, 0]);  \n    a_start.push(tmax);\n    a_end.push(tmin);\n}else{\n    a_start.push(clock-timespan-hours2);\n    a_end.push(clock-hours2);\n}\n\nif(de.length == 0){\n    de.push([tmax, 0]); \n    de.push([tmin, 0]);  \n    a_start.push(tmax);\n    a_end.push(tmin);\n}else{\n    a_start.push(clock-timespan-hours2);\n    a_end.push(clock-hours2);\n}\n\nvar start = hours2 + Math.min(a_start[0],         a_start[1],           a_start[2],           a_start[3]);\nvar end  =  hours2 + Math.max(a_end[0],             a_end[1],             a_end[2],             a_end[3]);\n\nvar d = de; // Assign the waveform to show\n\n///////////////////////\n// to have a waveform from the beginnig if the showed beginning is less the the real one\n// For the archiving that signal is the oppositve of the previous point\nvar opposite = 1;\nif (d[0][1] == 1){\n    opposite = 0;\n}\na.push([start,opposite]);\n///////////////////////\n\nfor (i=0; i < d.length; i++) {\n    var x = d[i][0]+hours2; \n    var y = d[i][1];\n    if (i == 0) {\n        a.push([x,opposite]); \n    }\n    if (i>0){ // add a point in order to show an horizontal line\n    \t a.push([x,d[i-1][1]]);\n    }\n    a.push([x, y]);\n}\na.push([end,d[d.length-1][1]]); // add a last point with the same value as the actual array lastpoint\n\n// check if it was empty and fill as the current status\nvar fill  = datasources[\"Interlocks\"][\"FBIS::EBI_ok\"][\"value\"][\"index\"];\n// the array is withou points\nif (d[0][0] == tmax){\n    a.length = 0; // delete the previous array\n    a = [];\n    if (start > tmax){ // it means that in the timespan selected there aren't any point in all the waveforms\n    \ta.push([clock,fill]);\n    \ta.push([clock-timespan,fill]);        \n    } else {           // set as start/end the min start and max end coming from other waveforms\n    \ta.push([start,fill]);\n    \ta.push([end,fill]);\n    }\n}\n\n\nswitch(series){\n    case \"1M\":\n        data = [\n            {label: 'EBI', data: a, color: 'red'}\n        ];\n        break;\n    case \"2w\":\n        data = [\n            {label: 'EBI', data: a, color: 'red'}\n        ];\n        break;\n\tcase \"1w\":\n        data = [\n         \t{label: 'EBI', data: a, color: 'red'}\n        ];\n        break;\n\tcase \"2d\":\n        data = [\n\t\t\t{label: 'EBI', data: a, color: 'red'}\n        ];\n        break;\n\tcase \"1d\":\n         data = [\n\t\t\t{label: 'EBI', data: a, color: 'red'}\n        ];\n        break;\n\tcase \"4h\":\n         data = [\n             {label: 'EBI', data: a, color: 'red'}\n        ];\n        break;\n\tcase \"2h\":\n         data = [\n\t\t\t{label: 'EBI', data: a, color: 'red'}\n        ];\n        break;        \n\tcase \"1h\":\n         data = [\n\t\t\t{label: 'EBI', data: a, color: 'red'}\n        ];\n        break;\n\tcase \"5m\":\n         data = [\n\t\t\t{label: 'EBI', data: a, color: 'red'}\n        ];\n        break;        \n        \n}\n\nfreeboard.showLoadingIndicator(false);\nreturn data;\n",
						"xticks": "6",
						"yticks": "[[0,'NOK'], [1, 'OK  ']]",
						"x_timestamp": true,
						"points": false,
						"zoom": ""
					}
				}
			]
		},
		{
			"title": "Hardware Status",
			"width": 1,
			"row": {
				"3": 13,
				"4": 15,
				"5": 7,
				"6": 7,
				"7": 7,
				"8": 7,
				"9": 7
			},
			"col": {
				"3": 3,
				"4": 1,
				"5": 4,
				"6": 4,
				"7": 4,
				"8": 4,
				"9": 4
			},
			"col_width": 1,
			"widgets": [
				{
					"type": "ragIndicator",
					"settings": {
						"title": "HW Status and Connections",
						"value": "switch (datasources[\"Interlocks\"][\"FBIS::HW_ok\"][\"value\"][\"index\"]) {\n    case 1:\n        return 0;\n    break;\n    default:\n    \treturn 2;\n}",
						"green_text": "OK",
						"amber_text": "NOK",
						"red_text": "NOKswitch (datasources[\"Interlocks\"][\"FBIS-DLN01::status\"][\"value\"][\"index\"]) {\n    case 1:\n        return 0;\n    break;\n    default:\n    \treturn 2;\n}"
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "DLN01",
						"value": "switch (datasources[\"Interlocks\"][\"FBIS-DLN01::status\"][\"value\"][\"index\"]) {\n    case 1:\n        return 0;\n    break;\n    default:\n    \treturn 2;\n}",
						"green_text": "OK",
						"amber_text": "NOK",
						"red_text": "NOK"
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "DLN02",
						"value": "switch (datasources[\"Interlocks\"][\"FBIS-DLN02::status\"][\"value\"][\"index\"]) {\n    case 1:\n        return 0;\n    break;\n    default:\n    \treturn 2;\n}",
						"green_text": "OK",
						"amber_text": "NOK",
						"red_text": "NOK"
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "SCU01",
						"value": "switch (datasources[\"Interlocks\"][\"FBIS-SCU01::status\"][\"value\"][\"index\"]) {\n    case 1:\n        return 0;\n    case 3:\n        return 0;\n        break;\n    default:\n    \treturn 2;\n}",
						"green_text": "OK",
						"amber_text": "NOK",
						"red_text": "NOK"
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "SCU02",
						"value": "switch (datasources[\"Interlocks\"][\"FBIS-SCU02::status\"][\"value\"][\"index\"]) {\n    case 1:\n        return 0;\n        break;\n    case 3:\n        return 0;\n        break;\n    default:\n    \treturn 2;\n}",
						"green_text": "OK",
						"amber_text": "NOK",
						"red_text": "NOK"
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "SCU03",
						"value": "switch (datasources[\"Interlocks\"][\"FBIS-SCU03::status\"][\"value\"][\"index\"]) {\n    case 1:\n        return 0;\n        break;\n    case 3:\n        return 0;\n        break;\n    default:\n    \treturn 2;\n}",
						"green_text": "OK",
						"amber_text": "NOK",
						"red_text": "NOK"
					}
				},
				{
					"type": "ragIndicator",
					"settings": {
						"title": "SCU04",
						"value": "switch (datasources[\"Interlocks\"][\"FBIS-SCU04::status\"][\"value\"][\"index\"]) {\n    case 1:\n        return 0;\n        break;\n    case 3:\n        return 0;\n        break;\n    default:\n    \treturn 2;\n}",
						"green_text": "OK",
						"amber_text": "NOK",
						"red_text": "NOK"
					}
				}
			]
		},
		{
			"title": "Decision Logic Nodes: Processing Units (PU)",
			"width": 1,
			"row": {
				"4": 31,
				"9": 31
			},
			"col": {
				"4": 1,
				"9": 2
			},
			"col_width": 4,
			"widgets": [
				{
					"type": "flot_extended_plugin",
					"settings": {
						"plot_type": "horiz_stacked_bar",
						"legend": true,
						"height": 3,
						"value": "var dln01_pbd = datasources[\"Interlocks\"][\"FBIS-DLN01:Ctrl-AMC-03:cfg_no_of_pbdspu_A\"][\"value\"]; \nvar dln01_pbm = datasources[\"Interlocks\"][\"FBIS-DLN01:Ctrl-AMC-03:cfg_no_of_pbmspu_A\"][\"value\"]; \nvar dln01_spu = datasources[\"Interlocks\"][\"FBIS-DLN01:Ctrl-AMC-03:cfg_no_of_spu_A\"][\"value\"]; \nvar dln01_ssp = datasources[\"Interlocks\"][\"FBIS-DLN01:Ctrl-AMC-03:cfg_no_of_sspu_A\"][\"value\"]; \nvar dln01_pus = dln01_pbd + dln01_pbm + dln01_spu + dln01_ssp;\n\n\nvar dln01_bi =  datasources[\"Interlocks\"][\"FBIS-DLN01:Ctrl-AMC-03:no_pu_bi_A\"][\"value\"]; \nvar dln01_rbi = datasources[\"Interlocks\"][\"FBIS-DLN01:Ctrl-AMC-03:no_pu_rbi_A\"][\"value\"]; \nvar dln01_ebi = datasources[\"Interlocks\"][\"FBIS-DLN01:Ctrl-AMC-03:no_pu_ebi_A\"][\"value\"];\n\nvar dln01_bi_p = (dln01_bi/dln01_pus)*100;\nvar dln01_rbi_p = (dln01_rbi/dln01_pus)*100;\nvar dln01_ebi_p = (dln01_ebi/dln01_pus)*100;\nvar dln01_ok_p = 100 - dln01_bi_p - dln01_rbi_p - dln01_ebi;\n\n\nvar dln02_pbd = datasources[\"Interlocks\"][\"FBIS-DLN02:Ctrl-AMC-03:cfg_no_of_pbdspu_A\"][\"value\"]; \nvar dln02_pbm = datasources[\"Interlocks\"][\"FBIS-DLN02:Ctrl-AMC-03:cfg_no_of_pbmspu_A\"][\"value\"]; \nvar dln02_spu = datasources[\"Interlocks\"][\"FBIS-DLN02:Ctrl-AMC-03:cfg_no_of_spu_A\"][\"value\"]; \nvar dln02_ssp = datasources[\"Interlocks\"][\"FBIS-DLN02:Ctrl-AMC-03:cfg_no_of_sspu_A\"][\"value\"]; \nvar dln02_pus = dln02_pbd + dln02_pbm + dln02_spu + dln02_ssp;\n\n\nvar dln02_bi =  datasources[\"Interlocks\"][\"FBIS-DLN02:Ctrl-AMC-03:no_pu_bi_A\"][\"value\"]; \nvar dln02_rbi = datasources[\"Interlocks\"][\"FBIS-DLN02:Ctrl-AMC-03:no_pu_rbi_A\"][\"value\"]; \nvar dln02_ebi = datasources[\"Interlocks\"][\"FBIS-DLN02:Ctrl-AMC-03:no_pu_ebi_A\"][\"value\"];\n\nvar dln02_bi_p = (dln02_bi/dln02_pus)*100;\nvar dln02_rbi_p = (dln02_rbi/dln02_pus)*100;\nvar dln02_ebi_p = (dln02_ebi/dln02_pus)*100;\nvar dln02_ok_p = 100 - dln02_bi_p - dln02_rbi_p - dln02_ebi;\n\n\nvar d = [{\n    label: 'OK',\n    color: 'green',\n    data: [[dln02_ok_p, 0], [dln01_ok_p, 1]]\n}, {\n    label: 'BI',\n    color: 'yellow',\n    data: [[dln02_bi_p, 0], [dln01_bi_p, 1]]\n}, {\n    label: 'RBI',\n    color: 'orange',\n    data: [[dln02_rbi_p, 0], [dln01_rbi_p, 1]]\n}, {\n    label: 'EBI',\n    color: 'red',\n    data: [[dln02_ebi_p, 0], [dln01_ebi_p, 1]]\n}];\n\nreturn d;",
						"xticks": "[[0, '0%'], [10, '10%'], [20, '20%'], [30, '30%'], [40, '40%'], [50, '50%'], [60, '60%'], [70, '70%'], [80, '80%'], [90, '90%'], [100, '100%'], [110, '']]",
						"yticks": "[[0, 'DLN 02 (34 PUs)'], [1, 'DLN 01 (99 PUs)']]",
						"points": false,
						"tooltip": false,
						"zoom": ""
					}
				}
			]
		}
	],
	"datasources": [
		{
			"name": "Interlocks",
			"type": "JSON",
			"settings": {
				"url": "/data/api/v2/pvget/FBIS::beam_state_ok,FBIS-DLN01::status,FBIS-DLN02::status,FBIS-SCU01::status,FBIS-SCU02::status,FBIS-SCU03::status,FBIS-SCU04::status,FBIS::beam_permit_ok,FBIS::HW_ok,FBIS::beam_destination,FBIS::beam_mode,FBIS::BI_ok,FBIS::RBI_ok,FBIS::EBI_ok,FBIS::PSS_ok,FBIS::MPSMag_ok,FBIS::MPSID_ok,FBIS::MPSVac_ok,FBIS::IS_PLC_ok,FBIS::RF_ok,FBIS::MEBT_Ch_PLC_ok,FBIS::LEBT_Ch_Fault_ok,FBIS::BCM_ok,FBIS::BPM_ok,FBIS::SIS_ok,FBIS::IS_PLC_RBI_ok,FBIS::PSS_RBI_ok,FBIS::IS_PLC_RBI_ok,FBIS::RF_RBI_ok,FBIS::MPSVac_RBI_ok,FBIS::MPSID_RBI_ok,FBIS::MPSMag_RBI_ok,FBIS::MEBT_Ch_PLC_RBI_ok,FBIS::LEBT_Ch_Fault_RBI_ok,FBIS::BCM_RBI_ok,FBIS::BPM_RBI_ok,FBIS::SIS_RBI_ok,FBIS-DLN01:Ctrl-AMC-03:cfg_no_of_pbdspu_A,FBIS-DLN01:Ctrl-AMC-03:cfg_no_of_pbmspu_A,FBIS-DLN01:Ctrl-AMC-03:cfg_no_of_spu_A,FBIS-DLN01:Ctrl-AMC-03:cfg_no_of_sspu_A,FBIS-DLN01:Ctrl-AMC-03:no_pu_bi_A,FBIS-DLN01:Ctrl-AMC-03:no_pu_ebi_A,FBIS-DLN01:Ctrl-AMC-03:no_pu_rbi_A,FBIS-DLN02:Ctrl-AMC-03:cfg_no_of_pbdspu_A,FBIS-DLN02:Ctrl-AMC-03:cfg_no_of_pbmspu_A,FBIS-DLN02:Ctrl-AMC-03:cfg_no_of_spu_A,FBIS-DLN02:Ctrl-AMC-03:cfg_no_of_sspu_A,FBIS-DLN02:Ctrl-AMC-03:no_pu_bi_A,FBIS-DLN02:Ctrl-AMC-03:no_pu_ebi_A,FBIS-DLN02:Ctrl-AMC-03:no_pu_rbi_A",
				"use_thingproxy": false,
				"refresh": 5,
				"method": "GET"
			}
		},
		{
			"name": "Clock",
			"type": "clock",
			"settings": {
				"refresh": 1,
				"name": "Clock"
			}
		},
		{
			"name": "1M",
			"type": "JSON",
			"settings": {
				"url": "/data/api/v1/archiver/FBIS::beam_permit_ok,FBIS::BI_ok,FBIS::RBI_ok,FBIS::EBI_ok/2419200/2048/freeboard",
				"use_thingproxy": false,
				"refresh": 300,
				"method": "GET",
				"name": "1M"
			}
		},
		{
			"name": "2w",
			"type": "JSON",
			"settings": {
				"url": "/data/api/v1/archiver/FBIS::beam_permit_ok,FBIS::BI_ok,FBIS::RBI_ok,FBIS::EBI_ok/1209600/1024/freeboard",
				"use_thingproxy": false,
				"refresh": 300,
				"method": "GET",
				"name": "2w"
			}
		},
		{
			"name": "1w",
			"type": "JSON",
			"settings": {
				"url": "/data/api/v1/archiver/FBIS::beam_permit_ok,FBIS::BI_ok,FBIS::RBI_ok,FBIS::EBI_ok/604800/1024/freeboard",
				"use_thingproxy": false,
				"refresh": 300,
				"method": "GET",
				"name": "1w"
			}
		},
		{
			"name": "2d",
			"type": "JSON",
			"settings": {
				"url": "/data/api/v1/archiver/FBIS::beam_permit_ok,FBIS::BI_ok,FBIS::RBI_ok,FBIS::EBI_ok/172800/512/freeboard",
				"use_thingproxy": false,
				"refresh": 300,
				"method": "GET",
				"name": "2d"
			}
		},
		{
			"name": "1d",
			"type": "JSON",
			"settings": {
				"url": "/data/api/v1/archiver/FBIS::beam_permit_ok,FBIS::BI_ok,FBIS::RBI_ok,FBIS::EBI_ok/86400/256/freeboard",
				"use_thingproxy": false,
				"refresh": 300,
				"method": "GET",
				"name": "1d"
			}
		},
		{
			"name": "4h",
			"type": "JSON",
			"settings": {
				"url": "/data/api/v1/archiver/FBIS::beam_permit_ok,FBIS::BI_ok,FBIS::RBI_ok,FBIS::EBI_ok/14400/128/freeboard",
				"use_thingproxy": false,
				"refresh": 300,
				"method": "GET",
				"name": "4h"
			}
		},
		{
			"name": "1h",
			"type": "JSON",
			"settings": {
				"url": "/data/api/v1/archiver/FBIS::beam_permit_ok,FBIS::BI_ok,FBIS::RBI_ok,FBIS::EBI_ok/3600/64/freeboard",
				"use_thingproxy": false,
				"refresh": 300,
				"method": "GET",
				"name": "1h"
			}
		},
		{
			"name": "5m",
			"type": "JSON",
			"settings": {
				"url": "/data/api/v1/archiver/FBIS::beam_permit_ok,FBIS::BI_ok,FBIS::RBI_ok,FBIS::EBI_ok/300/32/freeboard",
				"use_thingproxy": false,
				"refresh": 300,
				"method": "GET",
				"name": "5m"
			}
		},
		{
			"name": "Clock5m",
			"type": "clock",
			"settings": {
				"refresh": 300
			}
		}
	],
	"columns": 4
}