I am working on an application where I am controlling the ramp of a web and I want to increase the web speed by .1 feet per minute every x seconds. In the attached logic diagram I am just showing the addition of .1 to my web speed.
If web speed actual is less than web speed sp, increase web speed actual by .1
If web speed actual is less than web speed sp, decrease web speed actual by .1
If the web speed actual is equal to the web speed sp, do nothing
The problem lies in the way Siemens handles the real value
.1 Plus 0.7 = 0.8000001 not 0.80000000000000000000
Say my web speed set point is 0.8
My logic will always be speeding up and slowing my web speed because we will never truly be at the web speed set point.
I tried converting to an integer multiply .7 * 10 then adding 1 then converting back to a real but still get the same problem 0.8000001
Another problem is the extra values that are showing up after the decimal would be compounded so my ramp rate would not be steady.
I have done 3 other projects with Siemens but I have never ran into this type of task and I was wondering how a Siemens programmer would solve this problem.
Thanks
FYI In my logic diagram in the add and subtract functions I have the IN 1 and IN 2 backwards IN 1 should be the web speed actual.
If web speed actual is less than web speed sp, increase web speed actual by .1
If web speed actual is less than web speed sp, decrease web speed actual by .1
If the web speed actual is equal to the web speed sp, do nothing
The problem lies in the way Siemens handles the real value
.1 Plus 0.7 = 0.8000001 not 0.80000000000000000000
Say my web speed set point is 0.8
My logic will always be speeding up and slowing my web speed because we will never truly be at the web speed set point.
I tried converting to an integer multiply .7 * 10 then adding 1 then converting back to a real but still get the same problem 0.8000001
Another problem is the extra values that are showing up after the decimal would be compounded so my ramp rate would not be steady.
I have done 3 other projects with Siemens but I have never ran into this type of task and I was wondering how a Siemens programmer would solve this problem.
Thanks
FYI In my logic diagram in the add and subtract functions I have the IN 1 and IN 2 backwards IN 1 should be the web speed actual.
Last edited: