Contrologix RTOS accuracy

curlyandshemp

Lifetime Supporting Member
Join Date
Jul 2005
Location
Toronto
Posts
1,903
Is there anyway to improve the accuracy of the Real To String conversion instruction in contrologix?

using the instruction for a test:


rtos_1.jpg



Even the online help shows the inaccuracy of the instruction :


rt0s_2.jpg


I have to print scaled data from a mass flowmeter scaled as S.G. and send to a serial printer. Since I am dealing with S.G. the range of my numbers will be 0.999 to 1.999, so I can limit the length of the converted string to 5 characters
 
Most likely it is due to how real numbers are represented in binary.


Can you utilize building the string using DTOS instructions?
 
Oakley said:
Most likely it is due to how real numbers are represented in binary.


Can you utilize building the string using DTOS instructions?

I was thinking doing that, taking the REAL # X.XXX multiply by 1000, store as a DINT ,then convert DINT to string and insert a '.' after the first digit. But then I would have to ensure the number is not 0.XXX

seems like a lot of work
 
I'd have to think for a bit about the exact details, but I think you're on the right track.

curlyandshemp said:
I was thinking doing that, taking the REAL # X.XXX multiply by 1000, store as a DINT ,then convert DINT to string and insert a '.' after the first digit. But then I would have to ensure the number is not 0.XXX

seems like a lot of work
 
I was going to offer DINT solution right before I saw your later post.
For many years I used DINT and INT to display numbers with fixed decimal point on HMIs, particularlyfor motion systems where 2 or 3 decimals used:
same idea - take Real number, multiply by 1000 (or 100 if only 2 decimals) and send it to HMI. Most of HMI will let you specify where to put decimal point.

In your case to compensate for 0.xxx use after decimal inserted:
if STR.LEN = 4 CONCAT (ZEROSTR STR STR)
ZEROSTR will have string value of "0" - CONCAT can't use constants
 
Last edited:
Contr_Conn said:
I was going to offer DINT solution right before I saw your later post.
For many years I used DINT and INT to display numbers with fixed decimal point on HMIs, particularlyfor motion systems where 2 or 3 decimals used:
same idea - take Real number, multiply by 1000 (or 100 if only 2 decimals) and send it to HMI. Most of HMI will let you specify where to put decimal point.

In your case to compensate for 0.xxx use after decimal inserted:
if STR.LEN = 4 CONCAT (ZEROSTR STR STR)
ZEROSTR will have string value of "0" - CONCAT can't use constants

Thanks

Kinda sucks though you have to do this considering we are in the 21st Century. Maybe Rockwell needs to consider a Double Precision Floating Point number such as what Siemens had with the S5-135u PLCs in the early '90s

Thanks for answering considering you must be stuffed with turkey
 
Thanks for answering considering you must be stuffed with turkey
Yep, huge turkey is gone along with appetizers, cheesecake and other goodies my 200+ pound overweight body doesn't need...

As for math - decimal point rounding has nothing to do with 64 bit math no matter what brand you have.
Sure with 64 bit Reals mantissa will have much better accuracy than 23 bit we have today with 32 bit REAL, but do you really want to see your string as 15.300000000001 ?

Having abilitiy to specify how many decimals you want would be a nice feature...
 
Last edited:

Similar Topics

Can anyone confirm that using contrologix 5580 controller is not possible to work with powerflex 527? It's been a couple of days now that i am...
Replies
8
Views
1,206
Hello, I have a flow control PID that keeps locking up. It seems to control fine but after a while the output no longer moves. For instance...
Replies
4
Views
972
Hi everyone, I can't add any modules to the Controllogix backplane and it doesn't matter online or offline. Both is not working. Please see the...
Replies
13
Views
2,999
Hello, I have a question regarding the possibility of using messages instructions to communicate between: PLC5/80E Series D - CE Water Mark...
Replies
12
Views
3,073
I have a customer who wants to control his DCS800 drives via Ethernet, so I have bought two RETA-01 cards. At the moment they are connected via...
Replies
1
Views
1,008
Back
Top Bottom