LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why this XY graph is running slow?

Hello

 

I'm building a subvi named "subvi_gráficos.vi", that will filter and show data from a soldering machine.

I'm testing my subvi with a old data from that machine (Dados.txt).

But when I run my code, I'm noticing that my main.vi is running kinda slow. The main.vi is a VI that I built to test if the subvi is ok.

 

Can you please tell me why the code is running slow?

 

That's worrying me, because if the code runs slow when the soldering machine is on, maybe I will lose data.

 

MainMainSubviSubvi

 

 

Download All
0 Kudos
Message 1 of 6
(2,296 Views)

The stuff in the main before the subVI can be put outside the loop.

 

The buffering of the array size seems a bit weird. It might actually slow things down, as LV might need a copy of the array. Not exactly sure what the point is...

 

You're using Index & Bundle Cluster Array. That's a big big big waste of CPU. Why not simply put the array in a cluster, and build an array for those cluster? That will be a lot faster.

 

What is slow? You're processing 24000X6 values. That will take some time.

 

Message 2 of 6
(2,281 Views)

In your main loop you're adding to the array in an uncontrolled manner, that array will grow very fast and soon you'll be processing millions of numbers.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 3 of 6
(2,257 Views)

@Yamaeda wrote:

In your main loop you're adding to the array in an uncontrolled manner, that array will grow very fast and soon you'll be processing millions of numbers.

/Y


Good catch. The uninitialized shift register.

 

So not only will it run slow. It will run slower and slower until you get an Out Of Memory.

Message 4 of 6
(2,245 Views)

The main.vi it's only a test VI, the only thing that will be used from it is the XY Graph display.

The important VI is "subvi_graficos.vi" (implemented in the machine)

A doubt: how can I do the "simulation" of process the data (.txt) and build a XY Graph over time (simulating the real machine process) without the uninitialized shift register?

 

And didn't knew about the Index & Bundle Cluster Array. The array of cluster seems more reasonable. Thanks @wiebe@CARYA

0 Kudos
Message 5 of 6
(2,182 Views)

@mthheitor wrote:

A doubt: how can I do the "simulation" of process the data (.txt) and build a XY Graph over time (simulating the real machine process) without the uninitialized shift register?


There's no easy answer to that, AFAIC.

 

You're algorithm needs to be adapted to handle the data in a point by point way. Meaning it will need an initialize to reset the first time (or for a 2nd set of data), and remember it's state over different runs. For instance a PtByPt average will run, and then remember the number of samples and the average. Then the next run, it can use that data to add the new data to the average.

 

The sate will be kept in an uninitialized shift register or feedback node. Or if you're into OO, put the state in the class's private data, and put the class object in a shift register. This has added benefits when upscaling, for instance if you have an array of inputs to process. The non-OO version can't do that, and when you have >1 instances, you'd need to make it reentrant, or the instances will communicate with each other.

 

Another option is to simply read all the data, and then pass it once to the algorithm. You're doing that now, but only after running several small iterations. Not sure it if's feasible as a final solution. 

Message 6 of 6
(2,162 Views)