Aligning PI System Data to 15-Minute Boundaries Using AF: Strategies and Solutions
Explore how to align PI System (AF) data into precise 15-minute intervals with interpolation and gap detection, covering native options, custom data references, and practical implementation strategies.
Roshan Soni
Aligning PI System Data to 15-Minute Boundaries Using AF: Strategies and Solutions
In industrial data systems, aligning process data to consistent intervals (such as 15-minute boundaries) for reporting, analysis, and regulatory needs is a frequent requirement. The OSIsoft PI System and its Asset Framework (AF) provide powerful tools for data organization, but implementing precise time-alignment—especially with custom tolerances—can pose challenges. Below, we’ll discuss approaches to tackle this alignment in AF, including interpolation windows, marking gaps, and the role of custom Data References.
The Use Case: 15-Minute Data Alignment with Tolerance
Imagine an AF solution that processes and historizes calculations, but the customer mandates that both input and calculation results must fall exactly on quarter-hour marks (e.g., 12:00, 12:15, 12:30 …), with a 1-minute tolerance. Data outside this window should be marked as gaps, and only values within ±1 minute of the interval (or interpolated to it) are considered valid.
Common Approaches
1. PI ACE (Advanced Computing Engine)
PI ACE provides robust calculation capabilities and can be programmed to scan source data, align it to exact boundaries, and filter or interpolate per custom rules. However, using ACE often means moving business logic out of AF attributes/calculations and into separate code modules—contrary to modern best practices favoring AF-centric solutions for transparency and maintenance.
Pros:
- High flexibility (custom C# or VB code)
- Direct access to raw PI data and timestamps
Cons:
- Less integration with AF templates/calculations
- Additional deployment and management overhead
2. AFPI Data Reference Retrieval Options
The AF PI Point Data Reference offers basic retrieval options, including recorded and interpolated values. While you can request interpolated values at specific times (e.g., every 15 min via the AF SDK’s InterpolatedValues), custom logic around a tolerance window or marking gaps is not available out-of-the-box.
Limitation: Interpolated retrieval will always generate a value, even if a real reading is far from the target timestamp. There's no native setting to reject/interpolate only within a specified skew (like ±1 minute), or to mark when no real data exists in the window.
3. Rolling Your Own: Custom AF Data Reference
For advanced time-alignment requirements, a custom AF Data Reference (DR) can bridge the gap. Here’s how it works:
- The DR wraps an existing attribute (e.g., a PI Point or calculation).
- Configurable parameters define the output interval (e.g., every 15 min), a skew/tolerance window (e.g., ±1 min), and the data source.
- For each interval, the DR returns:
- The actual value if a source reading falls within the window.
- An interpolated value if calculated and allowed.
- A configurable marker (e.g., "NO_DATA") if no valid data is available.
Tips for Implementation
- Override
GetValueandGetValuesin your DR class. - Use
Data.RecordedValuewithAFRetrievalMode.AtOrBefore/Afterto find the closest point. - Use
Data.InterpolatedValuefor calculating values in the window.
Example ConfigString:
<AF Attribute>;Function=TimeFilter;Period=15;MaxTimeSkew=1;MaxValues=1000
Considerations
- Custom DRs require C# coding and SDK familiarity.
- As of AF SDK 2.5+, use the
OSIsoft.AF.Datanamespace for rich data queries. - For earlier SDKs, you’ll need PI SDK references.
4. AF Attribute Historizer
Some users have implemented custom wrappers or services that periodically query, calculate, and persist values back into AF attributes or PI tags on a set interval.
Caveat: Like ACE, this can lead to duplication of logic and non-centralized configuration.
Example Scenario Breakdown
| Source Data | Interval Points | Tolerance | Result |
|---|---|---|---|
| 12:00:10, 12:14:30, ... | 12:00, 12:15... | ±1 min | Interpolate as needed, drop points >1 min away |
| Missing 12:30 reading | 12:30 | ±1 min | Mark as gap/NO_DATA |
Wrapping Up: What’s the Best Way?
- For pure AF-centric and maintainable solutions, a custom Data Reference is the recommended path.
- If project constraints dictate, use ACE or a separate historization utility.
- Always weigh maintainability and transparency—custom DRs integrate tightly with AF templates and keep configuration visible within AF.
Resources
Have you built your own time-alignment Data Reference, or faced similar alignment challenges in PI AF? Share your strategies in the comments!
Tags
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.
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