tvermeer

Time Function for Run Time Calculations

Discussion created by tvermeer on Oct 23, 2009
Latest reply on Oct 23, 2009 by spilon

Hey Everyone,

 

I am looking into ways I could implement a simple interface for a user to see the runtime of a motor.  The motors will be configured as elements in the AF Framework. Each motor has a digital PI tag associated with it with several discrete states, lets say "Running" and "Stopped". 

 

These elements will be placed in a ProcessBook display.  I would like a user to be able to select a motor element (or just all motors elements in the display), enter a start time and end time and see how much time each motor spent in the "Running" state within the timespan. 

 

I have been told there is a funtion to do exactly this.  As far as I know it is called "TimeEQ" which takes in the Start time, End Time, State and returns the amout of time the discrete tag was in the specified state.  However, I have looked in the AF-SDK reference the PI-SDK reference, etc and have not been able to find ANY documentation on this function.  Could anyone point me in the right direction?  Perhaps the name changed?

 

I have two main ideas on how to implement this, but I am not sure what the best way is.  Here are the options I am thinking about:

 

1. Use the TimeEQ Function in VB code directly in a ProcessBook display file. (Same idea as an excel macro).  Have simple controls to input the start and end time and a button the user could click which would run the simple calculation.

 

2. Create a custom AF DataReference that would use the TimeEQ function an a Time Range Context. This could potentially use the Time Range functionality that is built into ProcessBook.  Then each motor element would have an attribute with this new data reference and when the user changed the time range in Process book the runtime attribute for each motor element on the display would update.  Does any one know if it would work as I have explained it?

 

Does anyone have any comments on these two ideas.  Which do you think is better? Any other ideas?  Do you have any examples or advice to get this working?

 

Thanks!

Outcomes