Build an expression analysis to study efficiency deviation
- Last UpdatedJan 10, 2025
- 3 minute read
- PI System
- PI Server 2018
- PI Server
This example demonstrates how to build an expression type analysis. The analysis tracks how the efficiency of a process deviates from the target efficiency.
First, we'll calculate the hourly average efficiency, then determine how much it varies from the target efficiency.
This example creates a new PI point to store the output data (the deviation from target efficiency, as it varies over time). When you create your own analyses, it is also recommended that you create the PI points required for output data before you start to create the analysis.
Prerequisite: Create an element named Ethylene that has an attribute named Efficiency that contains a PI point data reference.
-
Under Elements, select the element for which you want to build the analysis, such as Ethylene.
-
Click the Analyses tab.
-
Create a new analysis for the element:
-
If no analyses exist, click Create a new analysis to create the first one.
-
Otherwise, click New Analysis
to create a new one.
-
-
Enter information to identify the analysis:
-
Name
The name that uniquely identifies this analysis. For example, EfficiencyCalc.
-
Analysis Type
Click Expression. The expression analysis is the simplest type of analysis; it contains one or more expressions plus scheduling information. For more information, see Expression analyses.
-
-
In the expressions table, create a variable to hold the constant value of the target efficiency:
-
In the Name column, type Target.
-
In the Expression column, enter 90.
This sets this variable to the constant value of 90.
-
-
Create a second variable to calculate the hourly average efficiency:
-
Click Add a new expression.
-
Name the variable HourlyEfficiency.
-
In the Expression column, enter the following performance equation syntax:
TagAvg('Efficiency', '*-1h', '*')
This expression calculates the average value of the attribute called Efficiency over the past hour.
-
-
Create a third variable to calculate how much the hourly efficiency deviates from the target of 90:
-
Click Add a new expression.
-
Name the variable Deviation.
-
In the Expression column, enter the following expression:
HourlyEfficiency - Target
-
-
Save the output from the Deviation variable to a PI point:
-
In the Output Attribute column, click Map.
-
Click New Attribute to create a new PI AF attribute.
-
To define the attribute as a PI point data reference, click Yes to save output history.
-
In the Name field, enter the attribute name, such as EfficiencyDifference.
-
Click OK to create the attribute.
-
-
Specify scheduling for the analysis:
-
Set the Scheduling option to Periodic.
-
Click Configure and specify a period of 30 seconds.
The calculation will run every 30 seconds.
-
-
Verify that the results look reasonable:
-
In the analyses table, right-click the analysis and then click Preview Results.
-
Enter the time range of the preview.
The default time range starts at the preceding midnight and ends at the current time, but you can enter different start and end times, if you prefer.
-
Click Generate Results.
-
-
When you are satisfied with your new analysis, click Check In on the toolbar to check in your work.
PI System Explorer saves and checks in your analysis, and then starts running the analysis.
A green circle in the Status column of the analyses table indicates that PI Analysis Service is running the analysis.
-
Optional. Backfill the PI point with results from the calculation using past data.
PI Analysis Service can back fill calculation results that have output attributes mapped to PI point data references. However, the PI point cannot contain data at the specified times. If desired, you can delete pre-existing data and then back fill that time range.
-
Right-click the analysis in the analyses table, and click Backfill/Recalculate.
-
Specify a start and end time for back filling.
-
Select Permanently delete existing data and recalculate.
-
Click Start.
-