RS Logix 5000-Would like to remove several digits to the right of the decimal point ?

Join Date
Aug 2016
Location
Virginia
Posts
343
Good Afternoon ,

I have a number like .025690034 and I'm trying to keep a plate gap of .025 that has a motor driving it. This 3 phase motor keeps going up and down trying to keep the position of .025690034 , when all it needs to do is keep .025. I once used the instruction Truncate (TRN) , but that takes all the numbers to the right away of the decimal point.

Do you guys know of a simple way of doing this ?

Thanks so much ,
 
Along with The Waterboy's suggestion, you could probably try a LIM instruction too. This would incorporate a type of deadband around your setpoint.
 
Ok , what I did was take .2018163 ( Really my number ) and Multplied that by 1000. Got 201.8163 . Then I used a TRN ( in Math Conversions instruction tab ) and got 201.0. The TRN took everything off to the right of the decimal. I then multiplied it by .001 , then I got .201 .
 
What is deadband really and how would you implement it in your RS Logix 5000 code ?

Tolerance: "Close enough, stop trying."

UpperLimit = Target +0.05
LowerLimit = Target - 0.05

(Instead of 0.05, use deadband/2 if you want it to be adjustable)...

If actual value is within those LIMits, then that's good enough and quit moving...
 
Ok , what I did was take .2018163 ( Really my number ) and Multplied that by 1000. Got 201.8163 . Then I used a TRN ( in Math Conversions instruction tab ) and got 201.0. The TRN took everything off to the right of the decimal. I then multiplied it by .001 , then I got .201 .

2 things to note, the number "should" have been rounded to .202, MOV instruction will do that for you (I think... I've been on a really good vacation for a couple weeks so I have forgotten almost everything I ever knew about work), but if rounding isn't important, if you do any math on that REAL number again, or potentially even if that root number changes in the right way, you will have additional digits to the right.

Such is the world of binary math.
 

Similar Topics

Hi all, I have an issue with 1756-L62S (revision 20.13) safety lock. We can't figure out who put safety lock on our project. Before I try...
Replies
0
Views
1,024
Hi all, I have an issue with 1756-L62S (revision 20.13) safety lock. We can't figure out who put safety lock on our project. Before I try...
Replies
2
Views
2,423
Hello all Can I remove a device in RSLogix 5000 from the hardware where the EDS file is missing? How? Thanks!
Replies
1
Views
2,957
Any way to remove all "unknown" references in AOI's from entire project Logix 5000 Does anyone know if there is a way to remove all the "unknown"...
Replies
3
Views
4,504
Hey Guys, I've got an array of strings in an L75 processor that take the shape of something like this: MyString[01] = '012345.678' I'm needing...
Replies
4
Views
9,958
Back
Top Bottom