LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Execution speed improvements of FGV over locals

 

This my first post.  I am new to LabVIEW and am currently writing my first significant application.  I am actually modifying an existing application, but am adding additional functionality.

I have read this VI Execution Speed article but still have questions https://www.ni.com/docs/en-US/bundle/labview/page/vi-execution-speed.html

 

As an example, I am populating an xy plot with several sets of data, such as saved data points and a curve fit.  I am currently using a case structure to decide when to write various elements.  As an example, I only write the curve fit one time and it remains static as other pieces of data are added to the graph. In an attempt to make things faster I did not want to redo and redraw the fit each time.  I am using locals within the case to populate the graph.  In the default case nothing if written to these locals (and I assume the graph is not redrawn)?

 

I now realize that instead using a case in which nothing is written, I could use a feedback node (to write the previous case). The in addition, in place of using a local, I could use a Functional Global Variable.

Would it be better to have several cases which write locals to populate the plot and one case which writes nothing  OR Have the several cases write to a FGV and then a default case which writes the last data to the FGV via a feedback node?

The first seems like less load as nothing is written in the default case, but the other cases do write to a local which has a front panel object that I don't need or want.

 

Iis there any benefit to hiding unused front panel objects?

Is there a way to create a local without front panel object?

Finally, with a tabbed UI, are objects on the non active tabs being redrawn and slowing the process?

 

0 Kudos
Message 1 of 3
(2,454 Views)

Good questions!

 

Starting from the bottom:


 

Iis there any benefit to hiding unused front panel objects?

Is there a way to create a local without front panel object?


 

No and No. Local variables are generally a poor way to store and move data. For the reasons you cited (FP object you do not want or need, hidden FP objects) and that they force a copy of the data and may cause a thread switch to the UI thread.

 


Finally, with a tabbed UI, are objects on the non active tabs being redrawn and slowing the process?


 

It depends. Newer versions of LV are generally smart enough that non-visible indicators are not redrawn. This may not have been true in older versions, although I do not know when the changes were made.

 

You certainly do not need to redo the fit if the data has not changed. I think the entire graph gets redrawn when any new data is written.

 

Search for Ben's extremely informative Nugget on Action Engines (AE). An Action Engine is a FGV with added capabilities. It may be a very good option for what you are trying to do. It could store all the data sets, update the graphs, and make the data available where it may be needed without extra copies. With the AE you could easily acquire and store data at one rate and update the graphs at a (slower) rate appropriate to the users eyes and brains. Updating graphs more than ~10 times per second is a waste of resources because the user cannot respond any faster than that. Also you could write a subset or reduced data set to the graph if the amount of data is larger than the number of pixels in the plot.

 

Lynn

0 Kudos
Message 2 of 3
(2,447 Views)

It is also a good idea to seaprate your data processing from your UI. You can have a task which is dedicated to updating the UI itself. You can pass the data to be updated as part of the message/event which instructs the UI task to perform th eupdate. If the data is very large and you want to avoid copies you can use a DVR and pass that instead of the data itself.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 3
(2,400 Views)