Cycle time average over 8h

Hi am trying to get average cycle time for a specific range of time.
I have purchased historian module and loging 1 everytime a part is produce.
For the range of time i can do easy i mostly need help on the average between 2 time stamp.
I can change my logging method if that make it easyer i would like to stay in historian because i dont have transaction group. Eventually i would also like to be able to remove abnormale value like everything over 10 minute.

Conceptually
To calculate an Average Cycle Time you need a time for Start Cycle and a time for End Cycle so that you can calculate Elapsed Time. Then you would add up all of the Elapsed Times and divide by the count to get the average.

You are only capturing one time - the time for End Cycle. If the next cycle starts at the end of the current cycle then that is enough. Calculating the average would be easy - it is just the total time period (e.g., 8 hours) divided by the number of End Cycle times. So if you can get a count of End Cycle events (or maybe even a sum since you are storing a 1) then that will give the average cycle time.

However, you indicated that you want to remove abnormal values. It seems like you are presuming that anything over 10 minutes includes some downtime. If you do exclude those you are still including the time spans of 9:59 which is likely to include some downtime and will skew the results as well.

If possible, you need to capture a Cycle Start time as well as the Cycle End. Often these systems grow to try to capture the downtime cause automatically as well (blocked, starved, not scheduled, breakdown, etc.).

For now though, you need to calculate the elapsed time for use in the calculation. You can calculate the elapsed time as the data is generated or you can calculate the elapsed time when you want to report it. Which is correct probably depends on how often the report is needed and how expensive the calculation and storage are.

Presuming that you would want to calculate the elapsed time as the data is generated, you could add a couple of tags - a tag that contains the cycle start (which may also be the cycle stop time, t_stamp above) and the elapsed time. When mp20part changes to 1, calculate the elapsed time and evaluate your business rules ("ignore cycle times longer than 10 seconds"). Store the result (if if passes the business rules) in the Cycle Time tag. Configure the tag to store history.

After that, write a python script to select the appropriate records from the historian and iterate through it calculating the average.

You don't need that module to log to a custom table, you just need to add a script to the value change event handler on the trigger tag (or rather, on a gateway tag change script) and just insert a new record into your custom table from there there.

It shouldn't be too hard though to just process the results from the historian. I'll get back to you, if someone else doesn't before me

3 Likes

When does the zero get logged? Is it at the beginning of the cycle?

Also a sample dataset would be helpful (CSV would work ok).

I am not sure to understand for the historian part is already done. the table shown is the historian log. The only thing i dont know how to average the diference between each time stamp. Are you saying i should make a tag that is the that diference and log it in historian.

Thank You

The reason for my question is that it would then be possible to handle both machine cycle time (time between a 0 event and a 1 event) and takt time (time between 1 events).

Good point actually the between 1 and 0 is directed by a the par recipe that i can querry and 0 and 1 is the time the operator work with this data i can provide importatn information with the TimeON and TimeOFF function of the historian.