Historical Data Log - Relay State - Negative One?

In Display Basic, I am creating a historical data log. One of my logged points is the state of a relay on the bus. Instead of it telling me “1” when the relay is energized, I am instead getting “-1” in my log. Is there a way to have it report as I intend?

Yes.

In Configure mode, click on Configure -> Runtime.
Check this box.

image

1 Like

For even more than you probably ever wanted to know on the topic of -1 vs. +1 e.g. for “true,” also see this post:

http://forums.opto22.com/t/not-as-simple-as-you-might-assume-testing-for-true-or-0-0/

1 Like

Is that what that means? I thought that setting was for adding one to all your integers so you could drive all the operators bananas.

2 Likes

Thank you all, exactly what I was looking for!

Small update - I believe this worked for me for a short while after my last post (21d ago), but I am still seeing -1 in the two variables in the log that I wanted to correct.

Are you using the SetVariableTrue command in your strategy anywhere on these variables? - that will set them to -1 as well.

I’m wrong SetVariableTrue writes a 1, not -1. I hate when that happens…

For these particular two I am using TurnOn and TurnOff as they are Digital Outputs

You could add a variable to your strategy to hold the status and log that point instead of the Digital Output:

nPointStatus = IsOn(Digital_Point); //Run this in a chart periodically (or when you write to the output).

Thank you, great idea and will implement!