diff --git a/grafana/dashboards/SustronicsPilot3.3.json b/grafana/dashboards/SustronicsPilot3.3.json index 478acb4db9f9275b156c0bf53d5d05869b6fce83..4a892f7591e77784c761684b5c674a7715ad7080 100644 --- a/grafana/dashboards/SustronicsPilot3.3.json +++ b/grafana/dashboards/SustronicsPilot3.3.json @@ -22,115 +22,17 @@ "id": 1, "links": [], "panels": [ - { - "datasource": { - "type": "influxdb", - "uid": "b3860bbb-0b28-4a3c-b8d8-0723cb4f180f" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 4, - "x": 0, - "y": 0 - }, - "id": 19, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "percentChangeColorMode": "standard", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showPercentChange": false, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.6.0-229466", - "targets": [ - { - "groupBy": [ - { - "params": [ - "$__interval" - ], - "type": "time" - }, - { - "params": [ - "beacon_t::tag" - ], - "type": "tag" - }, - { - "params": [ - "null" - ], - "type": "fill" - } - ], - "measurement": "sustronics", - "orderByTime": "ASC", - "policy": "default", - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": [ - "battery" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] - } - ], - "title": "Battery level", - "type": "stat" - }, { "collapsed": false, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 3 + "y": 0 }, "id": 8, "panels": [], - "title": "Real-time measurment - pH", + "title": "pH - real-time measurment", "type": "row" }, { @@ -146,7 +48,7 @@ "h": 10, "w": 24, "x": 0, - "y": 4 + "y": 1 }, "id": 15, "options": { @@ -268,7 +170,7 @@ "h": 10, "w": 24, "x": 0, - "y": 14 + "y": 11 }, "id": 18, "options": { @@ -303,7 +205,7 @@ "autorange": false, "range": [ 0, - 4000 + 2000 ], "tickmode": "auto", "type": "linear" @@ -314,7 +216,7 @@ "overlaying": "y", "range": [ 0, - 300 + 250 ], "side": "right", "tickmode": "auto", @@ -376,7 +278,7 @@ }, { "params": [ - "*(${LSB_ADC})" + "*(${ADC_LSB})" ], "type": "math" }, @@ -400,7 +302,7 @@ }, { "params": [ - "*(${LSB_ADC})" + "*(${ADC_LSB})" ], "type": "math" }, @@ -421,7 +323,7 @@ ] } ], - "title": "voltage@pH", + "title": "voltage@pH (LSB=${ADC_LSB})", "type": "nline-plotlyjs-panel" }, { @@ -437,7 +339,7 @@ "h": 10, "w": 24, "x": 0, - "y": 24 + "y": 21 }, "id": 13, "options": { @@ -481,7 +383,7 @@ }, "onclick": "// Event handling\n/*\n// 'data', 'variables', 'options', 'utils', and 'event' are passed as arguments\n\ntry {\n const { type: eventType, data: eventData } = event;\n const { timeZone, dayjs, locationService, getTemplateSrv } = utils;\n\n switch (eventType) {\n case 'click':\n console.log('Click event:', eventData.points);\n break;\n case 'select':\n console.log('Selection event:', eventData.range);\n break;\n case 'zoom':\n console.log('Zoom event:', eventData);\n break;\n default:\n console.log('Unhandled event type:', eventType, eventData);\n }\n\n console.log('Current time zone:', timeZone);\n console.log('From time:', dayjs(variables.__from).format());\n console.log('To time:', dayjs(variables.__to).format());\n\n // Example of using locationService\n // locationService.partial({ 'var-example': 'test' }, true);\n\n} catch (error) {\n console.error('Error in onclick handler:', error);\n}\n*/\n ", "resScale": 2, - "script": "function polynominalValue(coefs, arg) {\n val = 0;\n pow = 0;\n for (const coef of coefs) {\n val += coef * Math.pow(arg, pow);\n pow += 1;\n }\n return val;\n}\n\nlet phCoefficient = variables.pH_coefs;\nlet adc_lsb = variables.LSB_ADC.query\nconsole.log(adc_lsb)\nvar coefs = phCoefficient.current.text.split(';').map(parseFloat).reverse();\n\nlet current_x = data.series[0].fields[1].values[0]\nlet current_y = polynominalValue(coefs, current_x)\n\nlet x = Array.from({length: 4096}, (_, i) => (i));\nvar y = [];\n\nlet x_volts = [];\n\nfor (const element of x) {\n y.push(polynominalValue(coefs, element))\n x_volts.push(element*adc_lsb)\n\n}\n\n\nreturn {\n data: [{\n x: x_volts,\n y: y,\n type: 'scatter',\n mode: 'lines',\n name: 'Polynominal'\n },\n {\n x: [current_x*adc_lsb, current_x*adc_lsb],\n y: [current_y, current_y],\n type: 'scatter',\n mode: \"markers\",\n marker: {\n symbol: \"x\",\n color: \"#4090DD\",\n size: 8\n },\n name: 'Current readout'\n }],\n layout: {\n xaxis: { title: 'Voltage @ADC [mV]'},\n yaxis: { title: 'pH'}\n }\n}\n\nreturn {} ", + "script": "function polynominalValue(coefs, arg) {\n val = 0;\n pow = 0;\n for (const coef of coefs) {\n val += coef * Math.pow(arg, pow);\n pow += 1;\n }\n return val;\n}\n\nlet phCoefficient = variables.pH_coefs;\nlet adc_lsb = eval(variables.ADC_LSB.query)\nvar coefs = phCoefficient.current.text.split(';').map(parseFloat).reverse();\n\nlet current_x = data.series[0].fields[1].values[0]\nlet current_y = polynominalValue(coefs, current_x)\n\nlet x = Array.from({length: 4096}, (_, i) => (i));\nvar y = [];\n\nlet x_volts = [];\n\nfor (const element of x) {\n y.push(polynominalValue(coefs, element))\n x_volts.push(element*adc_lsb)\n\n}\n\n\nreturn {\n data: [{\n x: x_volts,\n y: y,\n type: 'scatter',\n mode: 'lines',\n name: 'Polynominal'\n },\n {\n x: [current_x*adc_lsb, current_x*adc_lsb],\n y: [current_y, current_y],\n type: 'scatter',\n mode: \"markers\",\n marker: {\n symbol: \"x\",\n color: \"#4090DD\",\n size: 8\n },\n name: 'Current readout'\n }],\n layout: {\n xaxis: { title: 'Voltage @ADC [mV]'},\n yaxis: { title: 'pH'}\n }\n}\n\nreturn {} ", "syncTimeRange": false, "timeCol": "" }, @@ -526,11 +428,11 @@ "h": 1, "w": 24, "x": 0, - "y": 34 + "y": 31 }, "id": 17, "panels": [], - "title": "Real-time measurment - temperature", + "title": "Temperature - real-time measurment", "type": "row" }, { @@ -546,7 +448,7 @@ "h": 10, "w": 11, "x": 0, - "y": 35 + "y": 32 }, "id": 14, "options": { @@ -667,14 +569,159 @@ "uid": "b3860bbb-0b28-4a3c-b8d8-0723cb4f180f" }, "fieldConfig": { - "defaults": {}, + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 3, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "always", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "links": [], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, "overrides": [] }, "gridPos": { "h": 10, "w": 13, "x": 11, - "y": 35 + "y": 32 + }, + "id": 4, + "options": { + "alertThreshold": true, + "legend": { + "calcs": [ + "mean", + "lastNotNull", + "max", + "min" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "asc" + } + }, + "pluginVersion": "11.6.0-229466", + "targets": [ + { + "alias": "Temp@ROUnit_$tag_beacon_t", + "datasource": { + "type": "influxdb", + "uid": "b3860bbb-0b28-4a3c-b8d8-0723cb4f180f" + }, + "groupBy": [ + { + "params": [ + "$interval2" + ], + "type": "time" + }, + { + "params": [ + "beacon_t::tag" + ], + "type": "tag" + } + ], + "measurement": "sustronics", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "temp" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "*(${ADC_LSB})" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "key": "beacon_t::tag", + "operator": "=~", + "value": "/^$ROUnit$/" + } + ] + } + ], + "title": "Voltage@ADC_Temperature [mV]", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "b3860bbb-0b28-4a3c-b8d8-0723cb4f180f" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 11, + "x": 0, + "y": 42 }, "id": 12, "options": { @@ -739,7 +786,7 @@ }, "onclick": "// Event handling\n/*\n// 'data', 'variables', 'options', 'utils', and 'event' are passed as arguments\n\ntry {\n const { type: eventType, data: eventData } = event;\n const { timeZone, dayjs, locationService, getTemplateSrv } = utils;\n\n switch (eventType) {\n case 'click':\n console.log('Click event:', eventData.points);\n break;\n case 'select':\n console.log('Selection event:', eventData.range);\n break;\n case 'zoom':\n console.log('Zoom event:', eventData);\n break;\n default:\n console.log('Unhandled event type:', eventType, eventData);\n }\n\n console.log('Current time zone:', timeZone);\n console.log('From time:', dayjs(variables.__from).format());\n console.log('To time:', dayjs(variables.__to).format());\n\n // Example of using locationService\n // locationService.partial({ 'var-example': 'test' }, true);\n\n} catch (error) {\n console.error('Error in onclick handler:', error);\n}\n*/\n ", "resScale": 2, - "script": "function polynominalValue(coefs, arg) {\n val = 0;\n pow = 0;\n for (const coef of coefs) {\n val += coef * Math.pow(arg, pow);\n pow += 1;\n }\n return val;\n}\n\nlet phCoefficient = variables.Temp_coefs;\nlet adc_lsb = variables.LSB_ADC.query;\nconsole.log(adc_lsb);\nvar coefs = phCoefficient.current.text.split(';').map(parseFloat).reverse();\n\nlet current_x = data.series[0].fields[1].values[0]\nlet current_y = polynominalValue(coefs, current_x)\n\nlet x = Array.from({length: 4096}, (_, i) => (i));\nvar y = [];\n\nlet x_volts = [];\n\nfor (const element of x) {\n y.push(polynominalValue(coefs, element))\n x_volts.push(element*adc_lsb)\n\n}\n\n\nreturn {\n data: [{\n x: x_volts,\n y: y,\n type: 'scatter',\n mode: 'lines',\n name: 'Polynominal'\n },\n {\n x: [current_x*adc_lsb, current_x*adc_lsb],\n y: [current_y, current_y],\n type: 'scatter',\n mode: \"markers\",\n marker: {\n symbol: \"x\",\n color: \"#4090DD\",\n size: 8\n },\n name: 'Current readout'\n }],\n layout: {\n xaxis: { title: 'Voltage @ADC [mV]'},\n yaxis: { title: 'Temp'}\n }\n}\n\nreturn {} ", + "script": "function polynominalValue(coefs, arg) {\n val = 0;\n pow = 0;\n for (const coef of coefs) {\n val += coef * Math.pow(arg, pow);\n pow += 1;\n }\n return val;\n}\n\nlet phCoefficient = variables.Temp_coefs;\nlet adc_lsb = eval(variables.ADC_LSB.query);\n// console.log(adc_lsb);\nvar coefs = phCoefficient.current.text.split(';').map(parseFloat).reverse();\n\nlet current_x = data.series[0].fields[1].values[0]\nlet current_y = polynominalValue(coefs, current_x)\n\nlet x = Array.from({length: 4096}, (_, i) => (i));\nvar y = [];\n\nlet x_volts = [];\n\nfor (const element of x) {\n y.push(polynominalValue(coefs, element))\n x_volts.push(element*adc_lsb)\n\n}\n\n\nreturn {\n data: [{\n x: x_volts,\n y: y,\n type: 'scatter',\n mode: 'lines',\n name: 'Polynominal'\n },\n {\n x: [current_x*adc_lsb, current_x*adc_lsb],\n y: [current_y, current_y],\n type: 'scatter',\n mode: \"markers\",\n marker: {\n symbol: \"x\",\n color: \"#4090DD\",\n size: 8\n },\n name: 'Current readout'\n }],\n layout: {\n xaxis: { title: 'Voltage @ADC [mV]'},\n yaxis: { title: 'Temp'}\n }\n}\n\nreturn {} ", "syncTimeRange": false, "timeCol": "" }, @@ -778,6 +825,19 @@ "title": "Temperature calibration", "type": "nline-plotlyjs-panel" }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 52 + }, + "id": 20, + "panels": [], + "title": "Battery voltage level", + "type": "row" + }, { "datasource": { "type": "influxdb", @@ -786,42 +846,8 @@ "fieldConfig": { "defaults": { "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 3, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "always", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } + "mode": "thresholds" }, - "links": [], "mappings": [], "thresholds": { "mode": "absolute", @@ -839,46 +865,36 @@ "overrides": [] }, "gridPos": { - "h": 9, + "h": 3, "w": 24, "x": 0, - "y": 45 + "y": 53 }, - "id": 4, + "id": 19, + "maxPerRow": 4, "options": { - "alertThreshold": true, - "legend": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { "calcs": [ - "mean", - "lastNotNull", - "max", - "min" + "lastNotNull" ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true + "fields": "", + "values": false }, - "tooltip": { - "hideZeros": false, - "mode": "multi", - "sort": "asc" - } + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, "pluginVersion": "11.6.0-229466", + "repeat": "ROUnit", + "repeatDirection": "h", "targets": [ { - "alias": "Temp@ROUnit_$tag_beacon_t", - "datasource": { - "type": "influxdb", - "uid": "b3860bbb-0b28-4a3c-b8d8-0723cb4f180f" - }, "groupBy": [ - { - "params": [ - "$interval2" - ], - "type": "time" - }, { "params": [ "beacon_t::tag" @@ -895,33 +911,23 @@ [ { "params": [ - "temp" + "battery" ], "type": "field" }, - { - "params": [], - "type": "last" - }, { "params": [ - "*(${LSB_ADC})" + "*${BATTERY_LSB}" ], "type": "math" } ] ], - "tags": [ - { - "key": "beacon_t::tag", - "operator": "=~", - "value": "/^$ROUnit$/" - } - ] + "tags": [] } ], - "title": "Voltage@ADC_Temperature [mV]", - "type": "timeseries" + "title": "Battery level@${ROUnit} (LSB=${BATTERY_LSB}))", + "type": "stat" }, { "collapsed": false, @@ -929,7 +935,7 @@ "h": 1, "w": 24, "x": 0, - "y": 54 + "y": 56 }, "id": 7, "panels": [], @@ -942,7 +948,7 @@ "h": 1, "w": 24, "x": 0, - "y": 55 + "y": 57 }, "id": 9, "panels": [ @@ -976,7 +982,7 @@ "h": 3, "w": 2, "x": 1, - "y": 224 + "y": 374 }, "id": 6, "options": { @@ -1040,7 +1046,7 @@ "h": 1, "w": 24, "x": 0, - "y": 56 + "y": 58 }, "id": 16, "panels": [ @@ -1053,7 +1059,7 @@ "h": 14, "w": 12, "x": 0, - "y": 201 + "y": 351 }, "id": 10, "options": { @@ -1078,7 +1084,7 @@ "h": 13, "w": 11, "x": 12, - "y": 201 + "y": 351 }, "id": 11, "options": { @@ -1144,7 +1150,9 @@ { "current": { "text": "All", - "value": "$__all" + "value": [ + "$__all" + ] }, "datasource": { "type": "influxdb", @@ -1163,7 +1171,9 @@ { "current": { "text": "All", - "value": "$__all" + "value": [ + "$__all" + ] }, "datasource": { "type": "influxdb", @@ -1247,26 +1257,32 @@ }, { "current": { - "text": "2", - "value": "2" + "text": "1800/4096", + "value": "1800/4096" }, + "hide": 2, "label": "LSB@ADC[mV]", - "name": "LSB_ADC", - "options": [ - { - "selected": true, - "text": "2", - "value": "2" - } - ], - "query": "2", - "type": "textbox" + "name": "ADC_LSB", + "query": "1800/4096", + "skipUrlSync": true, + "type": "constant" + }, + { + "current": { + "text": "1800/4096*(2.2+1.65)/1.65", + "value": "1800/4096*(2.2+1.65)/1.65" + }, + "hide": 2, + "name": "BATTERY_LSB", + "query": "1800/4096*(2.2+1.65)/1.65", + "skipUrlSync": true, + "type": "constant" } ] }, "time": { - "from": "2025-03-17T12:53:30.526Z", - "to": "2025-03-17T13:23:30.526Z" + "from": "now-15m", + "to": "now" }, "timepicker": { "refresh_intervals": [ @@ -1286,5 +1302,5 @@ "timezone": "", "title": "SustronicsPilot3.3", "uid": "1Mar-DTiz", - "version": 17 + "version": 51 } \ No newline at end of file