Sign in to follow this  
Followers 0
ToddM

Totalize YPM

8 posts in this topic

Hi Folks…I have been tasked to totalize the yards a machine runs in a shift {12 hrs} The machines are capable of running 90 ypm . I can't use a proximity switch or any type of tach, in other words they aint going to spend any money on this project. I have written a few lines of code that seem to be where I want to go with this ,but I have run into a flaw in the slaw {so to speak} At 90ypm in 12 hrs I have a possibility of 64800 yards which is more than 32767. How can I put a larger number such as this into a register to display on a HMI? Below are chunks of what I have so far Rung 51 is existing code from where I am picking up my actual machine speed from the AC drive via RIO – I:6.5 is the raw data from the drive and N7:0 is the YPM x 10. Rung 52 –I:6/65 is drive running bit from the drive via RIO and the timer is just to pulse every 6 secs {or what ever I finally decide} Rung 53 – I am using the timer done bit to "sample " the yards and divide x 10 to get a YPM floating decimal F8:65 {XX.xx YPMs}and adding them up in F8:66.. Rung 54- Is just so I don't fault the PLC and get a trouble call , 'cause I'm working on this over the plant network from the shop. I hope this is enough information for smeone to point me in the right direction. Thanks for any and all help in advance….Todd

Share this post


Link to post
Share on other sites
Couple of Observations from your post. 1 - Floating point data type (valid range is + 1.175494e-38 to +3.402823e+38) with 7-digit precision. Based on this you should not have a problem until 340,282,300,000,000,000,000,000,000,000,000,000,000. 2 - If N7:0 is YPM x 10 and T4:34 is a six second interval then the math is actually as follows: A. Six seconds is 1/10 of a minute. B. So you need YPM / 10 and add to your accumulator. C. Rung 53 should be N7:0 / 100 not 10 to get yards covered in six seconds. 3 - You should also think about using an RTO in Rung 52 and add an RES in Rung 53. This way partial periods will be figured in calculations. Hope this helps. B.T.W. 100 YPM times 60 Minutes = 6,000 YPH times 12 hours = 72,000 YPShift the float should handle it wihtout problem or overflow.

Share this post


Link to post
Share on other sites
Bob...Thanks for clearing up the floating point decimal problem and the math. I'll check out the RTO and RES tommorow and see how that works. Thanks and later...Todd

Share this post


Link to post
Share on other sites
You will lose resolution by placing the result of the floating point math in rung 51 into an integer. The value in I:6.5 will need to change by more than 150 to get a change in N7:0. You should use the average of consecutive readings for your calculation. i.e. (previous + current)/2 You should use the timer accumulator to scale the totalising increment to compensate for scan variations and partial periods if using the RTO. i.e. (avg_YPM * ACC/PRE) * (PRE/6000) = Yards for the interval If the machine stops, totalise immediately and reset the RTO. edit: the last term was inverted Edited by Gerry

Share this post


Link to post
Share on other sites
Gerry... Could you please post an example? It would be most appreaceated. Thanks Todd

Share this post


Link to post
Share on other sites
This is what I had in mind. Using Preset/6000 in the calculation allows changing the interval without worrying about making other program changes. Totaliser.pdf

Share this post


Link to post
Share on other sites
Gerry...I'm going to try it tommrow if I have time to work on it. I think if I see it actually running I'll better understand it. Thanks for your help. Later...Todd

Share this post


Link to post
Share on other sites
Nice Implementation of all issues raised. I'll remember this style of logic for totalizers in future.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0