I Cannot Get Graph To Flag Or Add Vertical Lines


cadcoke5

Recommended Posts

A thermostat control program I created s functioning.  However, my efforts to show this on the graph are not working.  Specifically I am trying to either add a flag, or a vertical line.  Attached are images of my efforts on the graph settings.  I have also attached the

 

I have tried every variation of the expression I can think of, to show something.  I am not certain what to expect to see, nothing of any kind has shown up on the graph.

 

The code below is my initialization routine.  It is the only Script.

=======
Global StartTime = SysTime()  // This sets the variagble StartTime to the time this program started.
                       // This will be used to display the elapsed time on the graph.

Global DesiredTemp1_High = 999  // Used for Thermostat1 to determine its UPPER set point in DegF
Global DesiredTemp1_Low = 999  // Used for Thermostat1 to determine its LOWER set point in DegF

=======

 

The code below is in the Events tab of the Thermistor

=======

   if (Thermister1[0] < DesiredTemp1_Low) && (PowerSwitch != 1)
      PowerSwitch[0] = 1  // Turn heat ON if temperature is too low
   endif
   
   if (Thermister1[0] > DesiredTemp1_High) && (PowerSwitch != 0)
      PowerSwitch[0] = 0  // Turn heat OFF if temperature is too high
   endif

=======

 

I have two lines in my Axis Annotation;

PowerSwitch = 1

and

PowerSwitch = 0

 

 

Thanks, as always, for your great help.

-Joe

post-9190-0-04216200-1392411818_thumb.pn

post-9190-0-55459800-1392411829_thumb.pn

Link to comment
Share on other sites

I worked directly with Joe on this over a remote session, but want to give the results here for others:

 

1) you always want to use == for comparison.  Using = is assignment, though unlike C, DAQFactory won't do assignment in the middle of an expression.

2) Axis annotations won't work on Joe's graph because he doesn't have absolute time on the X axis.  Axis annotations use the time of the specified expression to determine where flags are placed.  If the X axis is not in absolute time, it won't be the right scale for displaying the annotations.  In these cases, its better to use a line annotation, though for digital out's its a little trickier.  There you have to filter the channel to just ==1 or ==0:

 

GetTime(filter(powerSwitch, powerSwitch == 1)) - starttime

 

That way the resulting array of time stamps only includes ones where powerSwitch == 1.  After the filter, use GetTime() to get the time stamp of those events, then in Joe's case, we subtract the starttime to get the relative time he is using in his X axis.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.