LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to increase xy-graph performance

Solved!
Go to solution

Hello,

 

I am running a continuous data acquisition with a NI-PCI 6133 (4x AI channel @ 2,5MS/s each) on a WIN 7 PC (LabView FDS 2012). Inside a while loop I am able to acquire 2000 samples per loop from each channel with a stable loop performance of around 1,25kHz. Out of this data I am calculating 24 values which will be shown on 6 xy-graphs (4 values on each graph). The data acquisition runs up to 2 minutes.

 

Data preparation and updating xy-graphs seems to be a big performance bottleneck. To clearify this I have written a simple benchmark, comparing xy-graph performance and chart diagramm performance. For the same amount of data, the chart diagramm is around 3 times faster, depending on the ability to draw only the last new value. The xy-graph has to update the whole plot each iteration.

 

If I also delete the complex data preparation of the xy-graph, the chart diagramm ist up to 6 times faster.

 

Benchmark xy-graph

Benchmark_XY-Graph_1.png

 

Benchmark chart diagramm (including data preparation for xy-graph)

Benchmark_Chart_1.png

 

Benchmark chart diagramm (without data preparation for xy-graph)

Benchmark_Chart_2.png

 

Questions

- Is there a way to optimize the data preparation part of the xy-graph?

- Is it possible to draw only the last new value of an xy-graph like a chart diagramm?

 

Why can't I not use a chart diagramm?

- Because the time base ist not constant.

 

My ideas:

1.) During a measurement I am using a chart diagramm. I know there will be some failure depending on the varying timebase. After acquisition the acquired data will be shown in xy-graphs (only one update necessary) with the right timebase.

2.) I am not showing the whole data inside a xy-graph. Maybe just the last 1000 values would be enough.

 

Benchmark xy-graph with just showing the last 1000 values

Benchmark_XY-Graph_2.png

 

Are there any other ideas how to speed up xy-graphs?

 

Thanks a lot and best regards,

Michael

0 Kudos
Message 1 of 8
(6,011 Views)

Here are the VIs of the above screenhsots.

0 Kudos
Message 2 of 8
(6,004 Views)
Solution
Accepted by topic author MichaGue_01

@MichaGue_01 wrote:

Why can't I not use a chart diagramm?

- Because the time base ist not constant.


That does not mean you can't use a chart.  You should read my nugget on Sporatic Waveform Charts.  As long as you acquire waveforms from your DAQmx device, you can just wire your waveforms directly into the chart and it will take care of the time base.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 8
(5,994 Views)

Hello,

 

thank you for your reply. That is new to me. I will give it a try.

 

Thanks a lot.

 

Best regards,

Michael

0 Kudos
Message 4 of 8
(5,966 Views)

@crossrulz,

 

your nugget is realy interesting and works for your example.

 

In my example I have a loop frequency of about 1,25kHz. dt has to be around 0,8ms. Is there a way to generate timestamps with less than 1ms on a windows pc? Another requirement (I have not mentioned yet) is to use non deterministic frequencies (i.e. 1kHz; 1,2kHz; 1,5kHz; 3kHz, 5kHz; 5,2 kHz; ...) instead of timestamps as x-axis component. Is this also possible with a chart diagramm?

 

Thanks a lot.

Michael

0 Kudos
Message 5 of 8
(5,954 Views)

Use the High resolution timer ?

 

You can do your own math to determine what the dt from the start of the graphing and just add the offest to the timestamp of teh start time.

 

And while I am at it...

 

Once the history of the chart fills up and the display starts to scroll the Waveform Data Typ chart will perform even better.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 8
(5,940 Views)

Interesting.  I'm working with a colleague who has entirely different requirements -- sampling (for hours) at 50 Hz, wants to see "backwards in time" for, say, an hour or two, willing to have multiple time bases.  I stumbled upon a Blog post, http://culverson.com/tips-and-tricks/, and thought "Hmm, what an interesting idea" (note who wrote the comment at the end of the Blog).

 

I've since implemented a variant of this using multiple time bases, each a factor of 5 longer than the previous, and have simulated taking 4 channels of data at speeds up to 500 Hz.  [Note -- I just tested it with points coming in at 1KHz.  My simulated A/D is set to send me 50 points at a time, so I'm getting plot updates at 20Hz.]

 

For this particular implementation, I'm plotting only a single channel (selectable by a Front Panel control).  Changing the Time Base is done by pushing a "Next" (longer Time Base) or "Previous" button.  Switching Channels or Time Bases is essentially instantaneous (probably less than 0.1 sec), and the graph updates fast enough that it looks like a scrolling Chart.

 

Read Culverson's description, then see if you can implement some of his ideas to fit your needs.  I was shocked at how well it worked for us.

 

Bob Schor

0 Kudos
Message 7 of 8
(5,936 Views)

@Ben wrote:

Use the High resolution timer ?


I think you mean this: http://zone.ni.com/reference/en-XX/help/371361L-01/glang/high_res_rel_sec/

That is also new for me and works fine. Thanks for the hint.


@Ben wrote:

 

You can do your own math to determine what the dt from the start of the graphing and just add the offest to the timestamp of teh start time.


That also works. Thanks a lot for your help.

 

Best regards,

Michael

0 Kudos
Message 8 of 8
(5,888 Views)