LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform x scale offset is drifting

Solved!
Go to solution

Hi,

I've been working on an application that plots tides on a time series Waveform Chart, using the xScale.Offset parameter.

The graph seems to drift to the right, ie

- latest measurement shows 20:00hrs when it is actually 1530hrs

- previous measurements originally shown at midday drift to 1400hrs, and so on

 

The attached jpgs hopefully explain.

 

I tried reducing (by 3x) the rate the graphs are updated, this didn't seem to make a difference.

 

Anyone have any ideas?

 

thanks

Download All
0 Kudos
Message 1 of 6
(3,551 Views)

It might be easier to see what is going on if you post your VI and the rest of your VI's.

 

Is this used as a subVI in another VI?

 

It makes sense that the waveform would shift because you are defining the offset of your graph based on the current time whenever this VI runs. 

 

Message 2 of 6
(3,547 Views)

There is about 20 VI's (I didn't write this app, just modifying it), and to run the application needs real data...? Not sure what you want me to post?

 

I can post the Display VI if you like (attached), yes it is a subVI of another VI which feeds it data, with a different case, every 3 sec (was every 1 sec)

 

After a while the offset no longer sets the graph to the correct time, and the old data has shifted in time.

 

thanks for the reply

0 Kudos
Message 3 of 6
(3,538 Views)
Solution
Accepted by topic author torres

I probably don't need to see the other VI's.

 

The problem with this one is that every time it is called (and putting data into the graphs) it is resetting the the X scale range, and setting a new time offset.  You should really only be setting the offset once at the very beginning, and perhaps the x scale range once per day.

 

I'm not sure you really want to be using a waveform chart.

 

A waveform chart is designed for data that is equally spaced, and you feed it one or more points at a time and it holds a history of the data it previously received.  Two key properties of the graph are the offset (point in time which the zeroth point is) and the scaling (time between data points.)  If your data isn't coming in at precisely the same interval, (let's say every 3.1 seconds when your scaling is set for 3, or a point that is a few seconds late for some reason) your new data won't be at the time the chart thinks it is.  Couple that with a offset that is constantly getting updated every time it is called.  Zero point is now and the offset is now.  Okay.  next point is 3 seconds later.  You reset the offset to now.  So the zeroth point looks like now (3 seconds after you really got it) and the next point (the one you just got) looks like it is 3 seconds from now.

 

A waveform graph is like a chart, equally spaced data, but it doesn't maintain a history.  You feed it all the data at once and it clears itself everytime you write new data to it.  For point by point applications, you need to maintain your own buffer of data.

 

I think you really want an XY graph.  It is the most flexible.  The X points don't have to be equally spaced.  It doesn't have a history, so you'll have to create your own by building arrays with new data or using the Build XY graph express VI.  Here, every point that comes in, you store an X value (the time) and the Y value (the data).  You should only need to set the Xscale range once, or perhaps once per day.  Look up all 3 types of charts/graphs in LabVIEW help.  Especially the XY graph as it as several different ways of building the data in arrays or clusters for different situations.

Message 4 of 6
(3,513 Views)
Alright, thanks, I will work on changing it to an XY graph as you suggest.
0 Kudos
Message 5 of 6
(3,496 Views)

I have implemented with an XY graph now and it seems to be working quite well. Thanks for the tip.

 

I store new readings into an array using a shift register, and check that the current time (seconds of day) is greater than the previous time in order to re-initialise the array at midnight. Then I plot the array.

 

cheers

Message Edited by torres on 12-14-2009 08:50 PM
0 Kudos
Message 6 of 6
(3,464 Views)