I have a script to do simple subtraction and the difference is incorrect. My script takes an I/O tag of 24hr total flow from a flow meter and moves the value to a memory integer tag before the next 24hr period. When the next 24hr total is updated, the previous total is subtracted from the newest total to give the previous days total flow.
The problem is the subtraction is not correct. When I do the subtraction, I find that the script subtraction is off by 20,000. The 24hr total comes from an I/O tag. The value is stored in the PLC, and intouch reads it as a 32bit integer. It is always correct when it gets to intouch. What am I doing wrong? I (like others) am learning intouch/wonderware the hard way, on the job training. I'm sure its something I'm doing wrong but I can't seem to figure it out.
Any help would be greatly appreciated.