Skip to main content
PI System
PI AF
Industrial Data Engineering

Status-Based Totalizers in PI System: Best Practices and Implementation

Learn several approaches to create totalizers in the PI System that operate based on tag status conditions, including PI Totalizer points and AF Analytics methods.

Roshan Soni

4 min read

Status-Based Totalizers in PI System: Best Practices and Implementation

In many industrial applications, there is a need to calculate the total runtime or flow through a device—such as a valve—conditioned on the status of another tag (e.g., only when the valve is open, or a pump is running). This can become slightly complex in PI System, as there are multiple methods to implement such status-based totalization. This post explores the main approaches, their pros, cons, and provides practical advice for each.

The Classic Method: PI Totalizer Points

PI Totalizer points are a built-in feature in PI Data Archive and are designed to provide running totals of values over time. With the addition of the Sampling tab's filtering feature, you can conditionally totalize source data based on an expression. For example, you might enter an expression so that the totalizer only operates when a status tag equals TRUE.

How to Use Filtering in a Totalizer:

  1. Create a PI Totalizer point in PI SMT (System Management Tools).
  2. On the Sampling tab, check "Filter the source data with the following expression" and enter your condition. For instance, [ValveStatusTag]=1.
  3. Set the calculation basis, period, and other options as required.

Limitations:

  • Filtering in PI Totalizer points is only directly available within the Data Archive (totalizer point configuration).
  • Expressions can be limited in complexity.
  • Troubleshooting can be tricky (e.g., "Bad Total" values indicate a logic or configuration issue).

Advanced Approach: AF Analytics

PI AF Analytics allows much more sophisticated calculations than classic totalizers. However, conditional logic is more hands-on:

  1. Filtered Source Calculation:

    • First, create an AF analysis that writes a new PI point only when your status tag is TRUE (e.g., using If 'ValveStatus' = 1 Then 'Flow' Else 0).
    • Archive this filtered stream in a new PI point.
    • Use another analysis or PI totalizer on this new (filtered) point.
  2. Direct Totalization in AF Analysis:

    • For simple cases, you could use AF's built-in functions like TimeEq or Total within Analysis to compute durations or sums based on a status condition.

Example AF Expression:

TimeEq('ValveStatus', 1, 'y', '*') // Provides duration the valve was open in the past year

Pros of AF Analytics:

  • Supports centralized management and analytics logic.
  • Flexible and easy to maintain.
  • Easily integrates with AF templates and event frames.

Cons:

  • Requires at least one new PI point for archiving filtered data if you want to keep historical results.
  • Additional configuration steps are needed compared to simple PI totalizers.

Choosing Your Approach

  • Use PI totalizer filtering for quick, simple counting with straightforward status conditions.
  • Use AF Analytics for scalable, template-based, or complex calculations, especially when you need to perform multiple types of aggregation or integrate with event frames.

Troubleshooting Tips

  • If you see a "Bad Total" in a totalizer point, verify your expression, point permissions, and data quality.
  • If filtering isn't possible directly, create a filtered PI point via AF, then apply a totalizer or further analytics as needed.

Conclusion

The PI System provides multiple tools to totalize data based on the status of other tags. The best choice depends on your infrastructure, complexity, and long-term maintainability needs. For more advanced scenarios, leverage AF Analytics for flexibility and scalability. For quick wins, the classic PI totalizer point may suffice.

Have your own tips or run into challenges setting up status-based totalizers? Share your experiences in the comments below!

Tags

#PI Data Archive
#AF SDK
#PI Analytics
#totalizer
#conditional totalizing

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