Historical Data Log - Relay State - Negative One?


#1

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?


#2

Yes.

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

image


#3

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/?source_topic_id=1740

#4

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.


#5

Thank you all, exactly what I was looking for!


#6

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.


#7

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


#8

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


#9

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


#10

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).


#11

Thank you, great idea and will implement!