There is no way to send a negative number directly to a digital PI tag. Or more accurately, sending a negative integer to a digital state tag will result in a system digital state being written to the tag. For more details on why that happens, see this KB article.
Scott Robertson recently introduced me to a clever work-around for this issue. Instead of sending the negative number directly to the digital state tag you can instead do the following:
- Store the value in an integer PI Tag. We will call this PI Tag JANET.
- Reference JANET in an AF attribute. We will call the AF attribute CHRISSY.
- Use an enumeration set for CHRISSY that translates the integer into a string, and then you have two options:
- Write the string from CHRISSY back to a second digital PI Tag using a PI Analysis Service Expression. We will call the second PI Tag JACK.
- Use CHRISSY directly and save yourself a PI Tag.
If you do not have PI AF Server at your site, then you have one option:
- Store the integer value in JANET like before.
- Create JACK as a digital Performance Equation (PE) tag that uses a long, nested IF THEN ELSE statement to perform the translation from the integer to the digital state.
If you are new to enumeration sets, then these videos will help you get started: