10-25-2018 08:50 AM
I have a project with quite a waveform graphs, each graph showing up to 256 waveforms. Obviously you can't show all graphs at the same time or it would be just one big mess, so I made a selector to choose which waveform is visible.
The problem is, that my code to change the visibility of the plots takes quite a long time to run through at the first time (carefull with the example VI, labview will hang for several seconds after selecting a value). Interestingly only at the first time, after that the while loop runs through smoothly. Even after stopping and restarting the VI with another array it works quite fine, you have to close LabView completely to get this behaviour back.
Can you explain to me what is happening there? And is there some way to speed up this first run?
Best regards
jusaca
PS: One other question regarding the waveform graph:
How can I change the appearance of plot 0? In comparison to all of the other plots it has a white area beneath the plot...
10-25-2018 09:05 AM
You are graphing all of the data and then hiding most of it in a loop (causing your initial delay). Instead of writing all of the data to your graph, use your selector to index the array and only write the relevant data.
10-25-2018 10:30 AM - edited 10-25-2018 10:42 AM
The first mistake is your use of an inner while loop instead of a FOR loop. Most likely you'll get better performance if you disable FP updates during the inner loop execution, but that still seems incredibly inefficient. You should also limit the event queue to 1 for any "rapidfire" event, such as a slider change. (Currently you lock the front panel until the event completes). Why would you stuff many megabytes into a front panel object (graph) and using it as data storage if you never display more than a very small fraction of it?
All you probably need is to keep the 2D array in a shift register and update it whenever the data changes. Execute the even (1) when the data changes, (2) when the slider is moved.
Here is a nonfunctional template that you can adapt to your needs.
@jusaca wrote:
How can I change the appearance of plot 0? In comparison to all of the other plots it has a white area beneath the plot...
Don't apply a "fill to -inf" with white.
10-25-2018 10:43 AM
Use the property, Defer Panel Updates.
Defer it before you loop through the plots, then turn panel updates back on after you are done looping.
It will speed up the process tremendously.
But when I run your code on my PC, it actually is behaving pretty quickly.
10-25-2018 10:52 AM - edited 10-25-2018 10:54 AM
I was thinking about something like that, but I'm not sure how to implement it - the processing state machine runs asynchronously from the GUI loop, so when I get the value change event I have no access to the (already existing) shift register with the data. Thats why I figured using the graph as storage might be a good idea - I get the idea that might be a mistake 😉
Don't apply a "fill to -inf" with white.
Ah, that easy! Thanks already 😉
//
Ah, that's way easier to implement - I will try this first, before changing larger parts of the code. Thanks!
Best regards
jusaca