Hard Meter Number

clowens

Member
Join Date
Jan 2021
Location
Oklahoma
Posts
5
I've been beating my head against this problem intermittently for a while now. o_O

We have 3 meter with hard mechanical counters on the top that go up to 99,999,999.99 and then roll over to 0. We only use them as a verification/check against our flow computer for the indicated volume.

I'm using Wonderware v10.6 and RSLogix5000.

Currently they're typing the numbers into an analog entry on Wonderware and stored and processed as real (float) in the PLC. The problem is the nature of how the floats are stored means they're not accurate when you get up to the very large numbers. RSLogix is also rounding the decimals, sometimes to funky numbers.

I've tried using integers, but I can't get the resolution to come in, even through formatting.

I'm sure there has to be a solution to this, and reducing the resolution might be it, but I'd rather keep the resolution if possible.
 
use double-precision (64-bit) floats. I think they are called LREAL in RSLogix5k. I don't know if they are available in Wonderware, but they should be.
 
use double-precision (64-bit) floats. I think they are called LREAL in RSLogix5k. I don't know if they are available in Wonderware, but they should be.

They are called LINT (Long Integer), and are not supported by most instructions.

Good luck if the OP tries to use them !


EDIT : My apologies, you said Floats, not Integers.

BUT ! There are NO 64-bit double-precision REALs in Logix5000, just standard 32-bit.


2021-03-18_151055.jpg
 
Last edited:
Last edited:
OP did not specify a PLC model, so may or may not have access to LREAL then. That's assuming we take 'RSLogix5000' to mean Studio 5000.
 
If you insist on using REAL you're going to have to do some rollover to get your display to be correct.

You can use counters to increment for say every 1000 gallons, when the real reaches 1000, increment the counter by 1 for the (1)XXX galloons and clear the real to 0 when the real reaches the next 1000 increment the counter by 1 to (2)000 and so on. you could use whatever scale you want, it could be rollover a 100,000 gallons.

You can also accomplish this in the HMI by having a numeric entry for each numeric place. If this is to clunky use a DINT and extract the bits and insert them to your real positions.
 
Last edited:
If you're trying to do it using a DINT with two implied decimal places, the rollover would be at 10 billion. That's too large for a DINT. Can you manually reset the counters at some value less than the rollover but within the upper limit of a DINT?
 
Two cascading DINTs would be how I'd store the value. I am not sure how WunderWear will deal with that as a numeric entry though.


Agree. Use one dint to hold major and another to hold decimal values.

The LINT is unfortunately not all that useful. I actually just did a similar task where I am reading values from meter via modbus (through a gateway). The meter will wrap around after 99,999,999. I used a DINT to hold actual total since I calculated the worse case scenario would be that I would not have to worry about the DINT rollover for 50years. I will probably be retired and perhaps dead by then, and this place will be dozed down way before then.
 
Two cascading DINTs would be how I'd store the value. I am not sure how WunderWear will deal with that as a numeric entry though.


If you mean totalizing in one counter and then rolling over into the second and resetting the first, I do this as well with MicroLogix 1100s. In the HMI I then do:


Total = Counter1.ACC + (Counter2.ACC * 32767)


Where Counter1 is the main totalizer and Counter2 is the overflow. Obviously in this case, it would be higher than 32767 where they're DINTs instead of INTs. Could also have it roll over at an arbitrary number such as 1,000,000 so it would be (Counter2.ACC * 1,000,000) instead. I assume you could have this cascade as many times as you want.


EDIT: Missed the whole discussion about the decimal points, don't mind me.
 
Last edited:
I have done the 2 cascading INTs method on a SLC, had to have the HMI show 2 INT values aligned to show the entire value.

So the second INT showed all the leading 0's I would add a 1 that would be covered by the other integer.
 
I'm not sure how cascading counters will help in this case, but maybe I'm misreading the the problem. My understanding is that operators are transcribing the number they see on the meters to a variable in Wonderware. WW sends that variable to the PLC as a 32-bit floating point number which is the source of the problem as the number gets beyond seven significant digits.
That's why I suggested manual reset of the counters before their accumulated value exceeds 2,147,483647. Then a number like 12,345,678.90 can be sent to the PLC as 1,234,567,890, a DINT with two implied decimal places.
 
I wonder if storing the operator entry as a string would work, padded out to the left with zeros.

That way no digits are lost, and the value can be recovered at any point downstream.

Does the plc ever make any calculations with the value?
 

Similar Topics

Hi - I'm a newbie to the PLC world but was recently asked if we could store more than the 2G that the CompactLogix 5370 allows by its max size SD...
Replies
13
Views
1,319
It's Saturday, so I thought it would be amusing to look at times gone by, imagine if you had to carry this to site "IBM 5mb Hard Disk 1950's.
Replies
16
Views
1,844
Any help appreciated, Proposed question: I need to track parts to count the rejects in a rotating machine but having no luck tracking proper...
Replies
7
Views
2,337
Outside what used to be an RCA TV plant. Shame of a use of a good robot.
Replies
3
Views
1,687
Really interesting analysis on if, why and when Soft PLCs are going to replace standard Hard PLCs in the industry...
Replies
25
Views
6,597
Back
Top Bottom