Calculate time A program or job has ran | Factory Talk View

None taken, when I first saw the touch panel applications I asked why the PMC's couldn't just track it (albeit like I said I'm not familiar with plc's or pmcs and 3 weeks ago I was an IT Administrator for a smaller company and had not even heard of either.)

I think it may have been more of an issue of them not knowing how to calculate how long a job has ran or the elapsed time. But I'm only guessing.
 
The hard part was making sure my expression to convert a number of Elapsed Seconds into Hours, Minutes, and Seconds was correct. Rounding is easy on paper but tricky on computers.

In the FactoryTalk expression language, the Modulo operator is "%". The expressions I used are:


Seconds Expression:

({system\DateAndTimeInteger} - {Event_1_Timestamp})% 60


Minutes Expression:

If (({system\DateAndTimeInteger} - {Event_1_Timestamp})% 60) >= 30 then ((({system\DateAndTimeInteger} - {Event_1_Timestamp}) % 3600) / 60) - 1
else ((({system\DateAndTimeInteger} - {Event_1_Timestamp}) % 3600) / 60)


Hours Expression:

If (({system\DateAndTimeInteger} - {Event_1_Timestamp}) % 3600) >= 1800 then ((({system\DateAndTimeInteger} - {Event_1_Timestamp}) / 3600) - 1)
else (({system\DateAndTimeInteger} - {Event_1_Timestamp}) / 3600)
 
Here's the one-screen example application. There is one Macro and one Macro button, and everything else is calculated in the Expressions for the Numeric Indicators.

The attached file is a FactoryTalk View Archive (*.APA) file ZIPPED for posting on the Forum. Unzip it then run the FactoryTalk Application Manager utility to "Restore" it, which will make it an openable FTView ME application on your FTView Studio computer. It was created and saved in FactoryTalk View version 7.0.
 
Looks great Ken, Glad to see there was a better way to do it. (outside of actually using the pmc to track it obviously)

And it looks like your solution actually sets me up perfectly for figuring out how to do a split timer as well

ie: Store IDLE Time, ARC time and Total Elapsed Time.

Again your help has been greatly appreciated!
 

Similar Topics

Hi everyone, I need to program a PLC 5 to calculate the difference in percent between the highest and lowest of either 2 or 4 floating point...
Replies
4
Views
1,988
Hi guys, Is there anywhere to calculate a redundant PLC-5 program size when converting them into CLX (redundant)? 1) In PLC 5 lets say I have...
Replies
13
Views
5,539
Hi everyone, This is my first time posting, so please forgive any omissions or mistakes. I am attempting to control the velocity of a stepper...
Replies
18
Views
1,049
Good morning, I have a question. I don't know much about ST yet I would like to calculate the average number of products per hour. how do I do...
Replies
22
Views
2,976
Can someone help me with this? I'm no good at SCL - virtually everything I've done so far has been ladder logic. The return value from the...
Replies
13
Views
1,111
Back
Top Bottom