AnsweredAssumed Answered

Python and PI AF SDK - Syntax for Calculated Tags

Question asked by Mattpdrexel on Jan 14, 2019
Latest reply on Jan 20, 2019 by Mattpdrexel

I'm a new PI AF SDK user interested in being able to create PI calculations within Python.

 

For example, I have a calculation that I can easily generate within PI Process Books using the following expression:

(stmeng_psatt(avg('s1.t2087a', 's1.t2088a', 's1.t2089a'))/14.696*29.92)

 

The calculation basically takes the average of 3 temperatures and computes the saturation pressure.

 

I'd like to be able to create a function in Python that performs this same calculation for me using the built in steam tables from PI.

 

The PI AF SDK indicates that there is a AFCalculation method available (AFCalculation.CalculateAtTimes Method), but I am struggling interpreting the syntax so that it works for Python. 

See below with my first crack at it.

 

I am unsure how to pass the string expression into the function.

 

Any suggestions would be helpful.

Outcomes