Second counter needed

I would like to set up an item that starts counting seconds when a PLC timer goes to 0 and ends when the same PLC timer goes to 1. This information would then be graphed as machine cycle time in Factory PMI. The data would also be retained in a database.

Is there a preferred method?

Thank you!

There are a number of ways to do this and I’ll make a number of assumptions about what you are doing…

  1. Create a bit in the PLC to represent the timer = 0 = bit = 0
  2. Turn that into a group item.
  3. Double click the item and in the item config window select “Hour meter”
  4. Set your group update rate to one second (if you are looking for one second resolution)
  5. Enable “Accumulate on zero”
  6. Enable “Retentive”
  7. Set group properties to “Select/ update - first record”

Now, every time the bit you are monitoring goes to zero the field it is writing to will increment on one second intervals and this value will be retentive. If the bit goes true it will stop counting, and if false again will continue counting.

That is just one way and there may be more direct ways such as monitoring the “done” bit of the timer directly, the accumulator value directly, etc.

But now you mentioned you wanted to monitor cycle time in FactoryPMI… So I assume that when the accumulator of your timer goes non zero you would like to insert a new record and record cycle time to it next time. So in effect you get contiguous, timestamped records of each uninterrupted cycle period…

To do that you need to change your group to log to “Updata/select - last record” That means that the counter action will only affect the last record inserted. Then you create another group with a one shot trigger (use your same accumulator state bit above but use the opposite state for the trigger) to insert a new record by setting group properties to “Insert new record”

There is a similar post under “FactorySQL design help - how do I tally production by shift”. Not quite what you are doing but parallels.

Once you have your cycle times in a datatable you can use FactoryPMI to graph the data. Not sure how deeply you have gotten into graph components yet but a good start is under “FactoryPMI - goodies” on the website which has a “Graph template window” which you can download, import, disect and/ or use. The user manual also explains how to use the charting components.

Let me know if this helps.

Yes - this helped. The box “only execute once when a trigger is active” also needed to be checked.

I missed the notion of creating the second group - thanks! I am very new with the software, but I think this solution will really get me going. I have played with the graphs and displays a little, but I am really looking forward to showing management the real time graphing.

Appreciate the help.

Yes, that’s right. Sounds like you are making great progress.