Skip to main content
PI System
Asset Framework
Templates
Expression Analysis

How to Reference Child Element Attributes in PI AF Templates

Learn how to reference child element attributes in PI AF templates, using path syntax and rollup analysis for optimal expression analyses.

Roshan Soni

4 min read

How to Reference Child Element Attributes in PI AF Templates

When working with PI Asset Framework (PI AF), leveraging templates can significantly enhance the scalability and efficiency of your data management tasks. However, one common challenge is accessing attributes of child elements from a parent element’s template. This is particularly relevant when you want to perform expression analyses that involve attributes from these child elements.

The Context

Consider a scenario where you are developing a template for a Power Conversion System (PCS) element, which may have two or three associated inverter child elements. Each inverter has attributes, such as digital alarm tags, that you wish to utilize in an expression analysis on the parent PCS element. How can you reference these child attributes effectively?

Using Path Syntax in AFSDK

PI AF provides a robust set of functionalities for path syntax, allowing you to reference child element attributes directly within expression analyses. Here’s how you can do it:

  • Simple Indexing: If you need to reference an attribute within the first or second child element, you could use syntax like '.\[@index=1]|AttributeName' to access the AttributeName of the first child.

  • Advanced Path Filtering: For more dynamic referencing, such as when child elements or attributes have specific naming or categorization, the Advanced Framework SDK (AFSDK) path syntax capabilities unfold further potential. Consider an example where you want to target alarm attributes. You can use a path like:

    .\Elements[@Name=*Inverter][Index=1]|Attributes[@Category=Alarms][Index=-1]
    

    This path targets the last attribute classified under the "Alarms" category of the first child element named with a suffix "Inverter".

Rollup Analysis: An Alternative Approach

While path syntax is beneficial, there may be scenarios where using a rollup analysis is more advantageous. Rollup analyses aggregate data from multiple attributes into a single result, which could be beneficial if your goal is to summarize or aggregate alarms from all inverters:

  • Advantages: Rollup analysis will automatically summarize and calculate aggregate values for specified attributes, which are periodically updated.

  • Considerations: Implementing a rollup analysis requires an extra PI tag to store the calculations, and it introduces a dependency on the rollup analysis itself.

Conclusion

Referencing child element attributes within a template can bolster your analytic capabilities in PI AF. Whether you choose path syntax or rollup analysis should be dictated by the specific needs of your monitoring setup and dependency preferences. Embrace these tools to make your PI AF solution more comprehensive and insightful.

Resources

Tags

#PI AF SDK
#Child Elements
#Expression Analysis
#Templates

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