LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph Excel data with dynamic data acquisition overlay

Solved!
Go to solution

Hi All,

I've been off the Labview forum for about a year, same goes with my programming so I'm a little rusty. I'm not looking for someone to code this for me but just a quick high level plan to point me in the right direction.  I am capable of working through the Excel tutorials etc.    

 

Task 1:  Basically I have an Excel data set (2-6 columns of numbers, no time) which I want to read into Labview and throw it all to a XY graph as the base template that stays visible all of the time.  This data set is quite long, height vs length (length is 100km, 1m intervals). I essentially want a X scroll graph to show the entire data set.  

 

Task 2: Acquire a live string of serial data which is to be overlayed onto the graph template from Task 1. Essentially comparing live data to previously acquired data. 

 

In the past I have done simple projects with reading in Excel data and also reading in Serial data.  What I am unclear on is how to create the graph template with the Excel data (static) while overlaying the live data as it comes in.  This is the basic review process of an annual survey inspection.

 

Any tips on the process would be appreciated then I'll work through the nuts and bolts.

 

Cheers for any help,
Wes

 

0 Kudos
Message 1 of 10
(4,271 Views)

If you drop an XY graph on the front panel and then switch to the BD and open the context help window and hover over its terminal, you will see the data types it accepts. Specifically, you can see that one plot is 2 parallel arrays of X and Y values in a cluster and that multiple plots are an array of plots, so what you need to do is read the base data before you start and build such a cluster from it, which will give you your first plot. Then, you build a second array for the data as it comes in over time (using a shift register, functional global or whatever is relevant). Then you use build array in a loop to join them and wire the result into the graph.


___________________
Try to take over the world!
0 Kudos
Message 2 of 10
(4,253 Views)

Thanks for your help Zealot.

 

So far I have 4 sets of data imported from Excel and graphed to an XY graph over the 100km distance (comparison data).  Looks perfect.  If I understand you correctly your method will display both the old data and new live data on the graph simultaneously, is that right?  In my case I need to be able to see what's coming up ahead from the old data.  

 

To paint the full picture, we inspect a pipe line every year with a survey vessel, there are "Events" (position and text) which identify a position and remarkable feature.  I need to have the full 2012 data set fully loaded into the graph first before any live data is brought in over the top.  I.e. the graph needs to freeze the first lot of data on it's screen while the second lot comes in over the top.

 

First: So far I have the data loaded in to the graph ok over the 100km span (tick)

 

Second: I also have a semi automated annotation working which moves a single annotation point along the data set as it's associated X,Y position changes.  Once I get the live real world position string to talk with the annotation control I believe this will be another tick.  We'll be able to see the position of the survey vessel relative to last years data.  This more or less works as the graph does not remove the previous history when the annotation is updated. Also we can use this annotation automation to load in the remarkable events as text overlay.  This should be fine with some more messing around.

 

Third:  The bit I am still struggling with is sending live top and bottom of pipe data to the graph without it losing the original data. It's imperitive we have a forward looking graph of last years data with the real time data coming in at the same time.  I.e. the live data is updating at the centre of the screen with the right half showing what's coming up (from the old data already loaded in) and the left half showing the comparison of old and new data.

 

Complicated I know but that's the way of inspection!

 

Cheers for any other ideas people might have. I can post a copy of the code I have so far, but it's pretty boring.

 

Cheers,

Wes 

 

   

 

 

 

 

 

0 Kudos
Message 3 of 10
(4,249 Views)

Here's what I was thinking of. Basically you push all the data into the graph all the time.


___________________
Try to take over the world!
0 Kudos
Message 4 of 10
(4,246 Views)

Hi, any chance you can save the file for opening in Labview 8?

Cheers,
Wes

0 Kudos
Message 5 of 10
(4,226 Views)

In 8.0. Note that this is an example of the update concept, not of how you should keep the data.


___________________
Try to take over the world!
0 Kudos
Message 6 of 10
(4,215 Views)

Hi, Thanks for the simple code. So just to make sure I understand it correctly:

 

In the while loop on the first iteration the 100 piece data set passed in from the For loop is pushed to the graph with the first of the random real time data(mimicked by the shift register random number generation).  As the while loop iterates another random number is added to the data set array, clusterised with an X value and added to the original 100piece data set for delivery to the XY graph.  Something like that?

 

My question:    

Each time the while loop iterates is the XY graph re-receiving the 100 piece data set + the new data from the "real time" data set?  Logically this is how it looks to me but maybe I'm wrong.  If I'm right this poses a problem for me.  The initial data set I need to push to the graph is huge.  If each time a piece of real time data enters the program it needs to reprint the entire graph plus the new stuff, I can see this bogging down.  Every 1 second I receive a new piece of data which needs to be printed to the graph, but I don't want to be printing the entire initial data set.

 

I've attached my code, not sure if it will make sense or not.  There are 2 excel lookup tables.  To get it to work you need to input the number or rows and columns to collect from the excel files on the front panel.  Also the path of each file. Execute and it should give you a pipeline graph in pretty colours. 

 

The real time data (x,y) is collected on the serial port, broken into it's elements then used to print an annotation at that position.  Similar to my question above, every time I reprint the annotation in a new location from the incoming data, I fear the entire annotation list is reprinted, as opposed to making one change to the graph.   The annotation list and initial data I plan to import upfront is massive, not small by any means.  I don't want to be reprinting the graph data or annotation list every time my real time data iterates, which I think is what's happening now.

 

Lets see if any of that made sense.  Apologies in advance, I'll understand if that's too much to swallow.

 

Cheers,
   

 

 

 

0 Kudos
Message 7 of 10
(4,207 Views)
Solution
Accepted by topic author Wes_3DO

If you fear that your data sets will be too large, then run a test with simulated data to see how LV takes it. You might be surprised. In any case, you should be aware that the graph control will need to redraw it with any change you make anyway, and as far as I know, having a lot of data is the main thing that can make a graph control slow. If you find that you have too much data, you might need to decimate it yourself based on how much you zoom before putting it into the graph.


___________________
Try to take over the world!
Message 8 of 10
(4,198 Views)

Yep I think all of my questions are answered now, thanks. As you say, I can probably just call sections of the excel data set which make up the desired zoomed in visible section which will keep the update data lower.  Just means a bit more coding work for me, no worries.

 

Just to confirm, when the red new data was being overlayed sample by sample in your example, the white old dataset was seemlessly being redrawn each iteration but not noticably to the observer?

 

Thanks for your help, I appreciate it.

 

 

 

 

0 Kudos
Message 9 of 10
(4,193 Views)

@Sniepsy2 wrote:

Just to confirm, when the red new data was being overlayed sample by sample in your example, the white old dataset was seemlessly being redrawn each iteration but not noticably to the observer?


Yes, when you wire a value into the graph's terminal, it only updates the display on the screen once with all the data you put into it.


___________________
Try to take over the world!
0 Kudos
Message 10 of 10
(4,188 Views)