Divide By 0, breaks Try()?

So I have a tag that occasionally will be NAN in the PLC. This could be for a number of reasons, most of which involve a bad comm or a Divide by 0. Ignition will then read the tag as a bad quality and putting a try() function on the expression does not seem to help hide the bad data. When this tag is being divided by 0, the equipment has not been run yet so its efficiency really should show NAN or something equivalent. Other HMIs will show some kind of letter value for these kinds of conditions. Is there a way that Ignition can deal with this condition? Why does a try statement seem to fail?

Please help.

This was fixed in version 7.9.5. What version are you running?


Are you referring to the Try statement or the actual tag itself?

Okay, the ticket I was thinking of involved the try expression and division by None, but division by zero is a bit odd, resulting in a Tag Eval Error quality…

Hmm, so the tag should not show bad quality (Tag Evaluation Error) when showing ‘1.$’ in the PLC (Legacy Allen-Bradley ControlLogix divide by zero)?

No, sorry, I never really finished my thoughts.

The current behavior where the tag gets a Tag Eval Error seems to be the intended behavior. The try function has no effect because the divide by zero isn’t throwing any error, it results in a value of Infinite, which somewhere down the line gets considered an illegal value for the tag.

1 Like

Good to know, thanks.
You might try using a tag changed event script on problem tags with something like:
if initialChange==True:
 system.tag.write( ‘[.]thisTag’, 0.00001 )

Ok, so isNull() seems to work.