11/27/2013 10:05 AM | |
Joined: 12/11/2009 Last visit: 9/8/2022 Posts: 243 Rating:
|
an answer comes after 6 years,I was searching some vbs scripts and saw your message. I think plc and wincc writes data to same address. this is the problem. if you creat another tag with named "WART1.SDoubleCalculated", and give it another datablock or memory address, i think there won't be any problem. |
11/27/2013 1:02 PM | |
Joined: 1/29/2006 Last visit: 10/26/2023 Posts: 440 Rating:
|
Hi! The "problem" in original post is really in resolution of data formats! If you read the script, you will see, that it is basically a some sort of integrator, which adds some small (floating point) value to some integrating value, a sum. When sum becomes big enough, a smallvalue can not be added any more, due to format of fp, "Floating point" means exectly, as it says: a decimal point is really "floating" in 32 bits; Some examples: 0,000123 + 0,000123 willgive a proper resul in 32 bit fp math; both numbers, which have to be added, have appr. the same position of decimal point. 123.456.789,1 + 123.456.789,1 will also give a proper result in 32 bit fp math; BUT! 123.456.789,1 + 0,000123 will not give a proper result, because second value is too small according to first.... Of course, if you use 64 bit fp format, everything is much better, but still, at some value, adding of a very big and a very small numberwould also stop working! Have fun! uel123. |
Follow us on