It’s important to create readable reports that provide actionable data to the viewer. This means ensuring that the most important information is separated from the rest of the report, visual aids are used as much as possible to aid in the understanding of the information you are presenting and color choices are made sparingly and with purpose. Ignition offers an easy-to-use Reporting Module that provides a drag-n-drop interface for building complex reports. Today we will build a sample report using simulated tags from the Ignition Dairy Demo Simulator, and we will take a look at a few of the components provided by Ignition to build your reports with.
In order to follow along you will need to activate the simulator devices in the gateway, and will need to have a database server such as MySQL installed and running to save tag history.
Open up your Gateway Web Page (typically located at localhost:8088/main/web/home ), navigate to the Configure tab and select “Devices” from under the OPC-UA Server section of the menu on the left.
Click “Create new Device” and scroll down to the bottom, select the “Simulators Dairy Demo Simulator” and click the “Next” button.
Name the device “Reporting Demo” and click the Create New Device button. You should see the device in the list now.
Open up the Designer and navigate to the tag browser. Open up the folder at Tags/Refrigeration/Compressor1 and click on the lineVoltage tag, hold shift and click on the powerDemand tag to select all of the tags between them. These are all tags that contain power consumption information for Compressor 1 that we will include in our report. With those still selected ctrl-click on the ‘tonnageCurrent’ and ‘tonnageIdeal’ tags as well, then right-click and select edit tags.
Select the History option from the left and configure the tag history options as shown below, and choosing History Provider as the database you’d like to store in.
Repeat this process for the tags at Tags/Refrigeration/Compressor2.
Preparing Your Data
In the project browser, right-click on Reports and choose New Report to create a new report. Open up the Data tab. this is where we will configure our data for use in the report.
Click the Add button and choose ‘Tag Historian Query’. In the ‘Data Key’ field on the right give your data source a name, like ‘pwr_cmpr_compressors’. Then, using the Available Historical Tags tree, Simply drag the ‘poweravguse’ tags into the ‘Selected Historical Tags’ table and name them ‘Comp 1 Avg’ and ‘Comp 2’. On the bottom panel set the Aggregation Mode to ‘closest value’.
Repeat this process for the tonnage history, including ‘Ideal’ and ‘Current’ tags in a new Data Source.
One cool feature of Ignition’s reporting module is that it also allows you to use python scripting to generate your datasources. We’ll use that to store our power usage data in a dataset with the following code:
headers = ["device","avg power","mtr amps", "pwr dmnd", "line volts"] body =  body.append(["Compressor 1", system.tag.read("Tags/Refrigeration/Compressor1/powerAvgUsage").value,system.tag.read ("Tags/Refrigeration/Compressor1/motorAmps").value,system.tag.read("Tags/Refrigeration/Compressor1/powerDemand").value,system.tag.read ("Tags/Refrigeration/Compressor1/lineVoltage").value]) body.append(["Compressor 2", system.tag.read("Tags/Refrigeration/Compressor2/powerAvgUsage").value,system.tag.read ("Tags/Refrigeration/Compressor2/motorAmps").value,system.tag.read("Tags/Refrigeration/Compressor2/powerDemand").value,system.tag.read ("Tags/Refrigeration/Compressor2/lineVoltage").value]) data["Compressor Power Data"] = system.dataset.toDataSet(headers, body)
All right, now that thats set up lets take a look at a few of the visual aids avalable in Ignition’s Reporting Module.
Use of Visual Aids
Let’s say we want to display a summary of the power usage of both of our compressors over a 24 hour period. Should we list the data in a table on our report? No. If we displayed the values numerically in a table with a timestamp and a value, no one would ever use that information because it’s not a very intuitive format. However, if the data was on a chart and anyone who looks at the chart would instantly be able to locate peak times or unexpected spikes in consumption. Ignition offers several visual aids to help communicate data effectively. We are going to use the Timeseries chart to display the compressors average power usage over the course of a day. Open up the design tab and we’ll see just how easy it is to use.
- Drag a Timeseries Chart onto the page
- In the Key Browser, Drag the ‘pwr_cmpr_compressors’ into the Data Key field of the Property Inspector.
- Finally drag in the ‘Comp 1 Avg’ and ‘Comp 2 Avg’ keys into the ‘Pens’ table.
See? I told you it was easy. Now, let’s set up a Pie Chart to show how much of the total average power usage each one is responsible for.
- Drag in a Pie Chart
- Drag the Compressor Power Data key into the Data Key field of the Property Inspector
- Drag the ‘device’ key into the Label Key field, and the ‘avg power’ key into the Value Key field
Open up the preview tab and you will be able to see the report. I could go over all of the charts and graphs Ignition has to offer, but I think you get the idea. They are all just as easy to set up, but I do want to show you the Table component before we move on. It is important to reiterate some of the data, especially if you use visual aids like charts and graphs to display it. This is because the charts and graphs help explain relationships in your data, but sometimes a snapshot of an exact numbers are necessary to make appropriate decisions.
Table set up
- Drag a Table onto the page.
- Drag the Compressor Power Data key into the Data Key field
- Click on the dark grey Details label of the Table
- In the property Inspector, set column count to 5
- Click on the light grey section of the Table and check the ‘Headers’ and ‘Summary’ boxes in the property inspector
- Repeat steps for and five for the Header and Summary rows
- Configure the Headers to read as below by double clicking a cell to edit
- Drag and drop the keys from the Key browser into their respective columns in the Details section of the table
- In the Key Browser check the box that says ‘Show Calculations’*
*This will let you show calculations on each keys data, (min, max, average, total etc)
- Drag the total of each key into it’s respective column in the Summary row
If you go to Preview mode you will now see the Table displaying all of the power usage data for both compressors, and the totals as well.
Ignition makes it very easy to set up recurring reports that are automatically generated and distributed. You can print, email, save them to a file, even run scripts when they execute. Open up the Schedule tab configure a new scheduled action. You’ll see the window is divided with a list of actions on top, and three tabs (Actions, Parameters, Schedule) on the bottom.
- Click the add button on the top half to create a new scheduled action
- Use the Schedule tab to configure the report execution times using the dropdowns or enter your own values into the fields using standard cron formatting
- (Optional) Use the Parameters tab to override the default parameter values that are set up, for example StartDate or EndDate
- Use the Actions tab and click on the Add button and choose new Save File action
Now you just set up the path you would like to save the file to and you are all set. You have created and scheduled a report in Ignition.
Keep in mind that even in reporting you should follow some of the principles of High Performance HMI development to minimize confusion. Use Neutral colors primarily, use color only when necessary, and even then choose the right color to convey your purpose. There are two colors in particular you should be wary about using in your reports, Red and Green. Instead, we should take the extra precaution and use another color that draws attention without indicating good or bad, such as Orange or Blue, when using visual aids to display important information. Is this a foolproof way to avoid confusion? No. But effective operations take actions to minimize risks wherever possible, and you’re running an effective operation, right?
It’s also important to consider that a large portion of the population has some form of colorblindness and you want them to be able to review and act on your reports as well. Using high contrast colors and reiterating data that you have displayed using visual aids in a numerical form can help communicate data more effectively to a wider audience.
Here are a couple of good practice execrises to help you get more comfortable with the interface. These are just some good ways to help you retain the information in the tutorial.
- Add Timeseries charts for each of the Tonnage Ideals and Actuals
- Display the average of the tonnage keys in a table
- Disable the Legend on the Pie Chart