LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Runtime waveform generation & displaying

Hello,

 

Actually I generate & display 2 waveforms (that use the same timestamp) in this way (please see the picture below)

Many blocks are used 2 times.

Is there some other, more efficient method ?

Thanks.

 

2 waveforms.JPG

0 Kudos
Message 1 of 5
(2,836 Views)

One (of many) of the problems resulting from posting a picture of your code rather than posting the actual code (as an attached VI or LabVIEW Snippet) is we cannot tell what Version of LabVIEW you are using.  So we might suggest techniques from LabVIEW 2012, and you are using LabVIEW 2009 ...

 

From the limited view of your code, I cannot figure out how the two arrays are calculated -- if I had the VI in front of me, I could execute it and probably figure it out.  If there is a relationship between Waveform 1 and Waveform 2, then one thing you could do is compute Waveform 1 and transform it "all at once" into Waveform 2 (for example, multiply t0 by Fudge Factor and add Offset to the Y array -- I'm not saying that's the thing to do, but I can't figure out what the thing to do is from the limited view you provide).

 

Bob Schor

 

 

0 Kudos
Message 2 of 5
(2,827 Views)

The overall code is rather complcated, but Ok, here it is:

Testbend_Calibration_new_concept (1).png

0 Kudos
Message 3 of 5
(2,821 Views)

I agree with your assessment of your code.  Seeing more of it, however, does help in understanding what is going on below, and it looks "wrong" to me.  This code is crying out for "improvement", encapsulation within sub-VIs, checking wires to make sure none run "backwards" (took me a while to find what the second Array's input was -- it is "Polarization + White Noise, the output of the Bloch Formula Express VI + a White Noise generator and carried "backwards" to this Array.

 

So you are generating two signals, I'll call them X and Polarization, and are plotting (on a Graph, updated every 0.1 sec) the last "Time-Span" points from each of these two Waveforms.

 

Instead of going to all that trouble, why not plot just the latest point on a Waveform Chart?  You can set the Chart Multiplier to account for the value of the your sampling time (0.1), and can set the Chart Range so that it only plots the last "TimeSpan" set of points.  You won't need to use the Dreaded Dynamic Wires, and it will just "happen".  The only difference you should notice (besides much simpler code) is that if you've got a long Time Span, you will see the points appear immediately, growing to fill the Time Span and then starting to "scroll" rather than seeing nothing for Time Span and then seeing scrolling behavior.

 

Bob Schor

0 Kudos
Message 4 of 5
(2,786 Views)

Bob_Schor a écrit :

I agree with your assessment of your code.  Seeing more of it, however, does help in understanding what is going on below, and it looks "wrong" to me.  This code is crying out for "improvement", encapsulation within sub-VIs, checking wires to make sure none run "backwards" (took me a while to find what the second Array's input was -- it is "Polarization + White Noise, the output of the Bloch Formula Express VI + a White Noise generator and carried "backwards" to this Array.

 

So you are generating two signals, I'll call them X and Polarization, and are plotting (on a Graph, updated every 0.1 sec) the last "Time-Span" points from each of these two Waveforms.

 

Instead of going to all that trouble, why not plot just the latest point on a Waveform Chart?  You can set the Chart Multiplier to account for the value of the your sampling time (0.1), and can set the Chart Range so that it only plots the last "TimeSpan" set of points.  You won't need to use the Dreaded Dynamic Wires, and it will just "happen".  The only difference you should notice (besides much simpler code) is that if you've got a long Time Span, you will see the points appear immediately, growing to fill the Time Span and then starting to "scroll" rather than seeing nothing for Time Span and then seeing scrolling behavior.

 

Bob Schor


Thanks for comments,

 

However I didn't properly understand some points:

  1. "improvement" is limited to employing sub-VIs or it means also some other actions ?
  2. checking for "backwards" ... what does it mean exactly ?
  3. Polarization + White Noise, the output of the Bloch Formula Express VI + a White Noise generator and carried "backwards" to this Array ... this signal is emulation of measured signal, that in reality comes from experiment; it's just enetered into state machine and processed in different ways in different states. What do you mean saying carried "backwards" to this Array" ?
  4. In previous realisations I used Waveform Chart. But this block has a drawback when comparing it to Waveform Graph - its X axis "runs", which makes reading a bit difficult. At other side, X axis in Graph looks like on oscilloscope: scale is static an displays real timing of signal (instead running dreaded numbers on Chart)
  5. So, according to your comment, Waveform Graph doesn't allow arrangement (as Chart does) and the only way to group 2 signals on the same Graph is the method I've enployed in my VI ? Correct ?

 

0 Kudos
Message 5 of 5
(2,773 Views)