JRH

To Infinity

9 posts in this topic

Hello.  This is my first post and I hope someone has a solution.

I have a program calculating Gal/sec adding to a running total and have up to the end.  Using REAL I can accumulate up to 16,777,216 (2^24) and using DINT up to 2,147,483,648 (2^31), but I need to have my registers continue past these limits.  I've read through many topics here and have tried the Rockwell Knowledge Base but can't seem to find a solution that truly works.  I have gone so far as to transfer the DINT to a string, cut the string into pieces and reassemble them in an Odometer type concatenation.

If anyone has a suggestion, I would appreciate it.  I know I'm not the only one with this problem.

PS & BTW - I'm using Studio 5000 v24 with a 1769 L33ER

Edited by JRH

Share this post


Link to post
Share on other sites

You are pretty much on the right track.  If it were me I would have two DINTs, LowDint and HighDint.  LowDint increments as normal, then have a GEQ source A being the LowDint and source B being 1,000,000,000 to add one to the to the HighDint and set the LowDint back to 0.  Then convert both to strings and Concatenate them into a string that represents the flow total.

Share this post


Link to post
Share on other sites

Thanks TWC, but I don't think it will work for me.  I am adding the readout of a flowmeter which has a decimal (i.e. 14.82 +- var).  I tried a quick test with a GEQ of 1000 then reset, [and two running totals synced to see if the reset would lose any continuity] but since the total didn't hit 1000 exactly (was 998.xx then 1012.xx), the reset would lose that bit that was over the 1000  right before the reset.

I am also trying to put the excess over 1000 into a Remainder and add the remainder back into the total.  I get the two totals closer to each other but not completely synced.  The error will compound over time (regulatory reporting issues abound).

Share this post


Link to post
Share on other sites

I didn't catch the decimal.  Probably switching the low tag to floating and lowering the trigger will work, but how many decimals to the left and the right will you need?

Share this post


Link to post
Share on other sites

I will probably be needing 4 or 5 decimal places.

Share this post


Link to post
Share on other sites

Have you tried a Double Precision Float. It will get a higher value range and greater precision. I know that the logix controllers support the type.

Share this post


Link to post
Share on other sites
2 hours ago, JRH said:

I will probably be needing 4 or 5 decimal places.

Its hard to imagine needing 4 or 5 decimal places with an accumulated value that runs into the billions.

1 person likes this

Share this post


Link to post
Share on other sites

agreed. besides, flow rate (gal/sec) and total (gal) are two different things...

while decimal places may make sense in flow rate, they are pointless in displaying total volume that goes into billions.

i would suggest to consider fixed point math instead of floating point.

then you cam easily do what TW suggested and keep "decimal places"

Share this post


Link to post
Share on other sites

As for losing the part that's over your reset point, subtract instead of reset:

GRT LowDint 1000   SUB LowDint 1000 LowDint Add HighDint 1 HighDint

 

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