Hi folks,
I am building a PI ACE calc to perform calculations on tags that are not initially specified in the PI ACE calculation configuration. This is how I am planning it:
- Calculation context is started
- In the initialization phase, it search for tags and build a point list for the tags that match a certain attribute mask (using PI-SDK)
- Every N minutes (clock based), perform the calcs and output the results.
- A separate thread would be continuously searching for new tags to be included in the next calculation time
However, I believe I should leverage the power of PI point caching in ACE, and this is one thing that SDK is not going to give me. Is there any way to add PI ACE points on the fly into the calculation?
Also, I am concerned about performance. The type of calculation (formula used) will depend on some tag attributes. Is it a good practice to read a pipoint attribute every time a perform a calculation or it would be better to store the specific attribute value in arrays (considering that reading an array is usually faster than reading an object attribute)? Any recommendation regarding pipoint attribute reading performance?
Best regards,
Fabiano
Hi Fabiano
Just a quick word on how I did it when I needed to have a variable amount of input tags per context, for a context based ACE calculation.
I think you need to initialize the number of input tags you're going to use, in the actual code. A good thing here is that you can initialize aliases in the module database. If you create a setup with the maximum number of aliases/tags needed, you can fill PI tags into the aliases you need and just fill a dummy-tag into the rest of them.
Make sure you create a dummy-tag which has some default value, and which is never being updated.
Then you can either create a module database property specifying the number of actual aliases/tags in use, and just use those aliases in your code. Or you can search through all your aliases and just ignore using the ones containing the dummy-tag.
It's not 100% what you need, but maybe you can use it to get one step closer to your goal.