Use cases & Reporting
Energy Monitoring & Attributio...
Energy Monitoring with Factry Historian
introduction in this document, we describe how to set up an example dashboard for energy monitoring we will do so using the docid\ tjw2vwpk12gu3z5awhr4a in the energy monitoring use case, we will build a basic dashboard showing the following metrics a kpi row on top, showing the total energy usage across the whole plant yesterday, today, and per line a breakdown of energy usage per hour for every input pump per production line a breakdown of energy usage per hour for every input pump per mixer, the heart of our production line to make the dashboard a bit dynamic, we will also add a variable to select a specific line or all lines you can see the end result of this dashboard on the https //demo factry io/d/vl45ff8/01 basic energy usage?orgid=2 prerequisites consult the prerequisites of docid\ pl848sr9hmhzsmdumhczn configuring grafana create a new dashboard start by creating a new dashboard in grafana configuring the dashboard variables in the newly created dashboard, navigate to settings > variables click + new variable then, configure the new variable as follows variable type custom general name line label line description select the appropriate line from the dropdown menu hide nothing custom options values separated by comma line 1 line 1,line 2 line 2 this uses https //grafana com/docs/grafana/latest/visualizations/dashboards/variables/add template variables/#add a custom variable selection options select multi value and include all option then, click save dashboard and give your dashboard a fitting name e g 01 basic energy monitoring adding the kpi row in our kpi row, we want to display the total energy usage across the whole plant yesterday, today, and per line the https //grafana com/docs/grafana/latest/visualizations/panels visualizations/visualizations/stat/ is ideal for displaying single values like kpis for each panel, click add > visualization then, select the factry historian datasource total power usage (yesterday) in the queries tab, open the query options dropdown and enter the following time shift 1d/d this will select yesterday, and round on the full day optionally, check hide time info in the same queries tab, select the measurements tab from the factry historian datasource then, configure the following database select the database that contains your faketory data measurements tick use regular expression and then enter energyusage$ this will retrieve all measurements from factry historian that end with energyusage aggregation select mean , grouped by 24h , and will with 0 under advanced settings, uncheck use engineering specs , as we will be setting them manually in this example all other query settings can remain at their defaults finally, in the transformations tab, click + add transformation and select the merge seres/tables transformation this will merge the datasets from all energyusage measurements together now, slide open the visualization selection on the right select the stat panel type and configure the following panel options title total power usage (yesterday) value options show select calculate calculation total fields numeric fields standard options kilowatt hour (kwh) color scheme single color then, click < back to dashboard and resize your stat panel to sit neatly on top total power usage (today so far) as this panel is very similar to the " total power usage (yesterday) " we just created, we will duplicate this panel on the dashboard view, hover over the previously created panel, click the ⋮ button, and click more > duplicate a duplicate stat panel is created click the ⋮ button and select edit now change the following settings in the queries tab, open the query options dropdown and enter the following relative time now/d (this will round the time to today) time shift make sure this is empty optionally, check hide time info slide open the visualization selection on the right configure the following panel options title total power usage (today) stat styles check the show percent change toggle line 1 power usage (today) duplicate the " total power usage (today) " panel we created earlier by hovering over it, clicking the ⋮ button, and clicking more > duplicate then edit the panel and change the following in the same queries tab, select the measurements tab from the factry historian datasource then, configure the following database select the database that contains your faketory data measurements tick use regular expression and then enter line 1 energyusage$ this will retrieve all measurements from factry historian where with energyusage aggregation select mean , grouped by 24h , and will with 0 slide open the visualization selection on the right configure the following panel options title line 1 power usage (today) line 2 power usage (today) this follows the same logic as line 1 above substitute line 1 with line 2 we should now have our kpi row that looks like this now would be a good time to save your dashboard adding the bulk transport pumps row on the dashboard view, click add > row click its gear icon and give it a title bulk transport pumps then, click add > visualization select the factry historian datasource in the same queries tab, select the measurements tab from the factry historian datasource then, configure the following database select the database that contains your faketory data measurements tick use regular expression and then enter ${line} /bt p/energyusage this will retrieve all measurements from factry historian that contain the value of the line variable, any bt p pump (with being any character), and end with energyusage aggregation select mean , grouped by 1h , and will with 0 under advanced settings, check use engineering specs , as we will use the engineering specifications set in factry historian slide open the visualization selection on the right and select the https //grafana com/docs/grafana/latest/visualizations/panels visualizations/visualizations/bar chart/ type configure the following panel options title bulk transport pumps for ${line} repeat options repeat by variable line repeat direction horizontal max per row 2 bar chart rotate x axis tick labels 45° show values never stacking normal bar width 0,8 then, click < back to dashboard and place your bar chart panel under the "bulk transport pumps" row try toggling the row to see if it's neatly nested underneath select line 1, line 2, or all from the dropdown meny the bar chart panels should repeat automatically, and the title should show e g bulk transport pumps for line 1 adding the mixer row for the mixer row, we follow the same logic as the "bulk transport pumps" row, with the exception of the following query in the query tab measurements ${line} /m1/p energyusage end result your basic energy dashboard show now look like this use case 2 energy attribution for this use case, we will leverage the docid 0ith2zlcais5yywhsdtje of factry historian configuration in factry historian building the batch overview dashboard building a gantt chart with subbatches showing overlays