Today is...
Saturday, July 20, 2019
Welcome to Control.com, the global online
community of automation professionals.
Featured Video...
Featured Video
A demonstration of EtherCAT control of linear motors using the CTC EtherCAT master.
Our Advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive
Wonderware Subtraction Error
Script written to do simple subtraction and the resulting difference is incorrect

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.

The problem is probably that your 32 bit I/O tag is in the raw 32 bit number, while the engineering value is scaled from the 32 bit I/O tag.

You need to work in the tags engineering unit values or scale the result of your calculation into the engineering range.

good luck