Sign in to follow this  
Followers 0
Ronald V

working with decimals

10 posts in this topic

Hello all, I am a newbie to this plc thing and already have a great challenge I need to calculate following; D0=((D1*D2)*(D3/1000000))/1000 = 0,0002170 kg/pulse D1 = Number of strands = 2 D2 = Diameter of roll = 45.2 mm D3 = thickness of strands= 1200 D4 = totalized count of IN1*D0 D5 = ppm IN1*D0 = xx.xx kg/min Every time a input signal is presented at IN1 it have to be multiplied with D0 to see the KG/min In1 has a frequency between 0 and 6000 ppm The problem I have is getting D2 into the formula because of the decimal point and calculating the ppm on In1 to display the actual rate of D5 Anny suggestions are welcome Edited by Ronald V

Share this post


Link to post
Share on other sites
Hi and "welkom" to MrPLC! Best would be to use math instructions for real data (floating), but it depends on the CPU you are using. What CPU type?

Share this post


Link to post
Share on other sites
That's good, CP1L can do floating data. I suggest you go to the Download Centre and do a search for CP1L manuals. Download the programming manual. Check section 3-14, floating point math instructions. The advantage of floating point data is that you can preserve decimal point accuracy when doing calculations. This looks like a perfect formula for a Function Block, but perhaps at first you just program it in ladder, and when working you can convert the ladder to a FB. It will be a good learning curve! One tip on a sidenote; I just did a similar hardware setup, and discovered that the NQ3 comms performance is very bad using Host Link. Unfortunately because it has only one port, you cannot change comms method after you have started a project and added tags to the host. I suggest you set the comms to NT Link if you did not already...

Share this post


Link to post
Share on other sites
Thanks Pdl for your reply, I did like you said and downloaded the manual started reading and trying, indeed had some problems setting up the communication with the NQ but that’s all working now. But, I still can't get my program to work the problem is (I think) that the outcome of the last divider is a number like 0,00006754 I have to multiply this with the ppm on CIO3 but can't find a function for that. I attached the file, maybe you will have a look? test_pulsteller_v1_5.cxp Edited by Ronald V

Share this post


Link to post
Share on other sites
Do all of you math in Flt (ie convert to float for the integers etc) Then you last instruction would be *F the divides would simply be /F give it a go and let us know.

Share this post


Link to post
Share on other sites
Thanks, looks like my math portion is working now. first converted all of the variables to floating and than did the calculation. But how do I read the frequency on the CIO001 to make my application work? Looks like there is no function for reading pulses per minute (ppm) test_pulsteller_v1_6.cxp Edited by Ronald V

Share this post


Link to post
Share on other sites
There was a freq instruction (don;t quote me on the name) avail for a CJ1 CPU22, is it not avail for the CP1L ? Aint got the manuals here to check.

Share this post


Link to post
Share on other sites
found an instruction PRV, will try to do some tests tomorrow, because it is hard to test in simulation mode. will keep you posted

Share this post


Link to post
Share on other sites
You have to use High Speed Counter 0 and it is the PRV2 instruction you want to look at. See section 3-20-3 of W451-E1-03. CP1L instruction manual.

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