LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stacking Plots generated on runtime - Multiple Sweeps

Solved!
Go to solution

Hello all

 

The program performs frequency sweeps, say f1 to fn, which have a constant duration. During the sweep it plots onto a waveform chart the measurments as a function of frequency not time. I've used the offset and multiplers to have the chart plot each measurement point at its assigned frequency. Using the scope update mode I will get sweep by sweep plotted as I need it. Amplitude over Frequency, for those familiar, similiar to a network analyser.   

Now I'd like to plot multiple sweeps as such. That is, I'd like that after the first sweep is ploted, the second, third and so on will be stacked onto the same chart however keeping the same x-axis and not sliding.

I've tryed the to use a graph but I can seem to find a "native" - I can envision a solution using a python node - labview solution that would dynamically [sweep after sweep] add the results of each sweep to the graph. Can anyone suggest anything? Thanks D.   

0 Kudos
Message 1 of 16
(1,982 Views)

Hi Daniel,

 


@Daniel_Novo wrote:

Now I'd like to plot multiple sweeps as such. That is, I'd like that after the first sweep is ploted, the second, third and so on will be stacked onto the same chart however keeping the same x-axis and not sliding.


This is not supported (in a good way) by a chart. (You might try to reach this goal with an array of waveforms…)

 


@Daniel_Novo wrote:

I've tryed the to use a graph but I can seem to find a "native" - I can envision a solution using a python node - labview solution that would dynamically [sweep after sweep] add the results of each sweep to the graph.


Why do you think you need a Python code to add plots to a graph?

Build an array of waveforms and plot it on a waveform graph!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 16
(1,970 Views)

Because in python I can see a path to slicing up the data streaming in from the sweeps into new arrays and stackin'm up the way I need them to be plotted. I'm not saying it is a sure thing. Specially because I would need to figure out how to get labview's APIs to plot the data as I want it. Having the python node do the ploting is something I can't imagine. But it would open up all the possibilities of matplotlib . 

 

It was already a bit of misuse to get the chart to plot amplitude over frequency the way I need it. I'm inexperienced with labview and through there was a hack out there. 


Thanks. 

D. 

0 Kudos
Message 3 of 16
(1,954 Views)

Hi Daniel,

 


@Daniel_Novo wrote:

Because in python I can see a path to slicing up the data streaming in from the sweeps into new arrays and stackin'm up the way I need them to be plotted. 


Each sweep should result in a waveform. All you need to do for "stackin'm up" is to create an array of waveforms…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 16
(1,950 Views)

Slicin'em up seems to work fine using the wafeform work around. It might not be as intuitive as using indexes but using time instead to perform the slicing works just fine. 

 

The stackin'em up bit took me a while also. Not as intuitve. You need a feedback node to get the append API to do its thing. 

Slicin'  - waveform 

stackin' - feedback node ond the append api.

 

Those are the workarounds to avoid a python node. 

 

Thanks. D. 

0 Kudos
Message 5 of 16
(1,902 Views)

Hi Daniel,

 


@Daniel_Novo wrote:

The stackin'em up bit took me a while also. Not as intuitve. You need a feedback node to get the append API to do its thing. 

Slicin'  - waveform 

stackin' - feedback node ond the append api.


Unfortunately you forgot to attach your code aka VI: what is the "append API"?

 


@Daniel_Novo wrote:

Those are the workarounds to avoid a python node


to implement basic LabVIEW code…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 16
(1,898 Views)

Well... sorry. I meant "build array". 

0 Kudos
Message 7 of 16
(1,890 Views)

Hi Daniel,

 

the graph should be connected to the output of the BuildArray node!

And you can reverse the direction of the feedback node to avoid crossing wires…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 16
(1,888 Views)

Hello GerdW,

 

Any tips on how to clear the content of the appended array? It seems only when I shut down the VI it get's cleared. I've tryed passing the content to an array indicator and then reseting, deleting, assigning a empty array constant to it but nothing seems to erase the pre-existing wafeforms from the array. The waveform history is always cleared. The graph is "reset" or cleared on command. But as soon as I restart to sweep, all the old sweeps get plotted once again. I wanted it to start anew.  

I thought of trying to pass the content of this dynamic array into a sub-VI called when the sweeping starts and then kill it when the sweeping stops to make sure the memory slot used by sub-VI is not there anymore. But I wondered if there is a more elegant way of dealing with this "ghost" data.  

 

Thanks. BR, D. 

0 Kudos
Message 9 of 16
(1,836 Views)
Solution
Accepted by topic author Daniel_Novo

Hi Daniel,

 


@Daniel_Novo wrote:

Any tips on how to clear the content of the appended array? 


There are no "ghost data"!

LabVIEW basics: Data are stored in wires and feedback nodes/shift registers!

 

Please THINK DATAFLOW: you need to clear the content of the feedback node by writing an empty array into it…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 16
(1,833 Views)