Skip to main content
PI System
Event Frames
AF Analysis

Sequencing Parallel Analyses in PI AF: Ensuring Correct Data Capture Between Event Frame Generation and Expressions

How to ensure your Event Frame Generation analysis gets the correct, up-to-date result from an Expression analysis when both are triggered in parallel in OSIsoft PI AF.

Roshan Soni

4 min read

Ensuring Accurate Data Capture in PI AF: Sequencing Analyses Between Event Frame Generation and Expressions

In the OSIsoft PI AF platform, configuring analyses to work together seamlessly is essential for ensuring clean, accurate data collection. A common challenge arises when you have an Event Frame Generation (EFG) analysis and an Expression analysis running in parallel—especially when the EFG relies on outputs from the Expression.

In this blog, we’ll explore why sequencing matters, common pitfalls, and practical solutions to guarantee that your EFG captures the correct data every time.

The Scenario

Imagine you have:

  • An Expression Analysis that performs a calculation and writes its result (e.g., a flag value MyResult) to an attribute.
  • An EFG Analysis that generates event frames whenever an event occurs (for example, when 'SomethingValue' changes), and captures the value of MyResult among other data.

Both analyses are triggered by the same event: HasChanged('SomethingValue','*').

Problem: Sometimes, the EFG triggers and collects data before the Expression analysis has updated MyResult, resulting in incorrect or stale data being captured.

Why Does This Happen?

While both analyses are triggered by the same event, the PI Asset Framework (AF) Analysis Service executes them in parallel. There is no guarantee which one completes first—so the EFG might use the previous value of MyResult, not the freshly calculated one.

How to Ensure Correct Sequence?

The goal is to make EFG execution depend on the updated result of the Expression analysis. Here are two straightforward strategies:

1. Change the EFG's Trigger to ‘MyResult’

Instead of triggering the EFG on the change of 'SomethingValue', trigger it specifically on MyResult:

  • Advantage: Ensures the EFG only starts after MyResult is available and updated.
  • How to do it:
    • Set EFG's start and/or end trigger to reference HasChanged('MyResult', '*').
  • Caveat: Only works if MyResult always updates after 'SomethingValue' changes and there are no other dependencies.

2. Move the Expression Inside the EFG as a Variable

Combine the Expression calculation into the EFG analysis itself:

  • Advantage: Guarantees the expression is evaluated as part of the EFG; removes timing uncertainty.
  • How to do it:
    • In the EFG, add a Variable that replicates the calculation logic of the Expression.
    • Reference this Variable wherever MyResult would have been used.
  • Caveat: Increases complexity if the calculation is reused elsewhere or is particularly complex.

Extra Tips for Sequencing in PI AF

  • Single Source of Truth: Where possible, encapsulate your calculations to avoid duplicated logic and potential for out-of-sync data.
  • Review Dependencies: Analyses with shared triggers should be evaluated for dependency conflicts.
  • Event Frame Properties: When capturing data at the start or end of an Event Frame, remember the recorded time may not line up exactly with when analyses finish executing.

Final Thoughts

When configuring parallel analyses in PI AF, paying close attention to the triggering sequence ensures the data captured is both timely and accurate. Whether you adjust triggers or consolidate logic, a little up-front design can prevent a lot of troubleshooting down the line!

Tags

#AFSDK
#PI AF
#Analysis
#Event Frame Generation
#Expression
#Data Sequencing

About Roshan Soni

Expert in PI System implementation, industrial automation, and data management. Passionate about helping organizations maximize the value of their process data through innovative solutions and best practices.

Sign in to comment

Join the conversation by signing in to your account.

Comments (0)

No comments yet

Be the first to share your thoughts on this article.

Related Articles

Enhancing PI ProcessBook Trends with Banding and Zones: User Needs, Workarounds, and the Road Ahead

A look at the user demand for trend banding/zoning in OSIsoft PI ProcessBook, current VBA workarounds, UI challenges, and how future PI Vision releases aim to address these visualization needs.

Roshan Soni

Migrating PIAdvCalcFilVal Uptime Calculations from PI DataLink to PI OLEDB

Learn how to translate PI DataLink's PIAdvCalcFilVal advanced calculations—like counting uptime based on conditions—into efficient PI OLEDB SQL queries. Explore three practical approaches using PIAVG, PIINTERP, and PICOunt tables, and get tips for validation and accuracy.

Roshan Soni

Understanding PI Web API WebID Encoding: Can You Generate WebIDs Client-Side?

Curious about how PI Web API generates WebIDs and whether you can encode them client-side using GUIDs or paths? This article explores the encoding mechanisms, current documentation, and best practices for handling WebIDs in your applications.

Roshan Soni