Use cases & Reporting
Energy Monitoring & Attributio...
Energy Attribution with Factry Historian
introduction in this document, we will describe how to set up a dashboard for energy attribution on the level of a batch we will do so using the docid\ tjw2vwpk12gu3z5awhr4a for the energy attribution use case, we will build a basic dashboard showing the following metrics an overview of recent mixing batches, with energy usage per batch a detailed view of subbatches (process steps) of the selected batch energy usage per recipe to make the dashboard dynamic, we will also add a variable to select a specific line and batch you can see the end result of this dashboard on the https //demo factry io/d/vllczxg/02 energy attribution?orgid=2 prerequisites consult the prerequisites of docid\ pl848sr9hmhzsmdumhczn building a grafana dashboard 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 2 selection options select multi value next, configure an additional variable variable type query general name batch label batch query options data source select the factry historian datasource query type simple assets /${line}\\\\\\\mixer/ event types mixing batch property batchid then, click save dashboard and give your dashboard a fitting name e g energy attribution adding the mixing batch overview click add > visualization then, select the factry historian datasource in the queries tab, query a, select the events tab, then configure the following query type simple assets /${line}\\\\\\\mixer/ event types mixing batch then, in the transformations tab, add the following transformations click + add transformation and select series to rows organize fields by name (click the eye icon to clean up some default fields returned by the datasource) now, slide open the visualization selection on the right select the table visualization and configure the following options panel options title mixing batch overview table show table header now, copy your dashboard url and click + add field override and configure it fields with name batchid + add override property data link title view details url paste your dashboard url and append the following get parameter \&var batch=${ data fields batchid} click back to dashboard and resize your table to fit the top left adding the sub batch overview click add > visualization then, select the factry historian datasource in the queries tab, query a, select the events tab, then configure the following query type simple assets /${line}\\\\\\\mixer/ event types emptying step, filling step, mixing step where parent\ batchid in $batch toggle include parent event then, in the transformations tab, add the following transformations click + add transformation and select series to rows organize fields by name (click the eye icon to clean up some default fields returned by the datasource) now, slide open the visualization selection on the right select the table visualization and configure the following options panel options title ${batch} sub batch overview table show table header click back to dashboard and resize your table to fit the top right adding energy usage per recipe in the final panel, we will compare the average energy consumption per recipe over the select dashboard timerange to keep our queries performant, we will reuse data from the mixing batch overview panel and use transformations to shape our data click add > visualization then, select dashboard as the data source select the following source panel mixing batch overview data all data transform off adhocfilter off then, go to the transformations tab and select the following transformations group by total energy (kwh) mean recipe group by sort by field recipe 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 energy usage per recipe bar chart x axis recipe rotate x axis tick labels 45° end result your energy attribution dashboard should now look like this if you click a batchid in the mixing batch overview panel, the list of subbatches on the right will populate with the 3 steps per batch