LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pulse Measurement vi issues

I have a vi I built that acquires 3 analog signals and displays all 3 in a waveform chart.  It works great at a good speed until I put in the Pulse Measurement VI so I could get a pulse width off one of the signals. 

As soon as I do that, the update speed on the chart slows to 1 update per second.   The pulse width works but the updates are way too slow. 

I have built a test vi that isolates just one signal and only tries to update the chart and acquire the pulse width since this is the root of my problem. (attached). 

I am a very low-end LabVIEW user, so this has got me stumped, it's obvious I don't understand what is going on.    I have tried many different combinations of sample rates and samples to no avail.  If it runs it runs with a 1 second update on the chart, if I lower the input frequency (square wave) to below 2Hz it says it cannot acquire enough transitions to measure.  I need this to work for a frequency input between 0.25Hz and about 10Hz. 

Any help would be very much appreciated. 

 

thanks,

 

 

0 Kudos
Message 1 of 9
(528 Views)

Your uploaded VI is in LabVIEW 2025.  Most of us on the forum do not use the most recent version.  If you'd like us to look at it, you'd have better luck if you back-save it to an earlier version.  I recommend 2019.

 

However, you say "chart", not "graph".  LabVIEW has two main types of plot. 

 

A "chart" takes in the most recent point(s) wired into it, and adds to the plot.  Points are only erased when the chart limit is reached (I believe it's 1024 by default). 

 

A "graph" takes an array of points and displays those.  Each time you wire in a new set of points, all previous ones are erased and only the new one is wired in.

 

If you truly are using a "chart" then your problem is most likely that you're not sending a complete waveform containing all your points to the "Pulse measurement" VI, but rather a waveform containing very few points (maybe only 1) and it can't operate on that, since the measurement VI needs to see data from at least one complete pulse.

 

This is of course all just guesses until we can see your VI in an earlier version.

0 Kudos
Message 2 of 9
(495 Views)

Saved in a prior version here (19). 

 

I substituted a graph and have just stated playing with it but initially got the same error. 

 

Thanks,

 

 

0 Kudos
Message 3 of 9
(469 Views)

Hi MWD,

 

thanks for downconversion!

 


@MWDFixer wrote:

if I lower the input frequency (square wave) to below 2Hz it says it cannot acquire enough transitions to measure.  I need this to work for a frequency input between 0.25Hz and about 10Hz. 


PulseDetection needs atleast one complete pulse for correct data analysis, so you need to acquire >4s of data for 0.25Hz pulses…

Reading just 100 samples at 1kS/s (as is your default setting in the VI) will not work!

 


@MWDFixer wrote:

It works great at a good speed until I put in the Pulse Measurement VI so I could get a pulse width off one of the signals. 

As soon as I do that, the update speed on the chart slows to 1 update per second.   The pulse width works but the updates are way too slow. 

  1. Replace the chart by a graph.
  2. Run the VI until the graph shows some waveforms.
  3. Stop the VI and set ALL values as default (Edit->Make current values default).
  4. Save the VI and attach again (for LV2019).

 

Now we have some typical data for our own testing…

 

Which computer do you use? (OS, RAM, CPU, …)

 

I did some testing on my own:

This VI runs in a VM with a 6-core i712800H and needs ~0.13s for 10000 iterations: each PulseDetection needs about 10µs…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 9
(466 Views)

Thanks for the feedback on this, it is much appreciated. 

 

The vi is working if I tweak the samples/sec but my problem now is the graph only updates after it gets the number of samples it is set to which is 1-4 seconds depending on the setting.  That is way too slow for the user to get feedback. I initially was using a chart control to have this update constantly but that would buffer for a while before updating also.  I would ideally like this to look like a scope screen where it constantly updates.  I'm not sure if I just need a faster module or what.  I am using a USB-6003 which has 100 ks/s speed if I recall.  I am not sure how to speed this up.  

0 Kudos
Message 5 of 9
(355 Views)

Hi MWD,

 


@MWDFixer wrote:
I would ideally like this to look like a scope screen where it constantly updates.  I'm not sure if I just need a faster module or what.  I am using a USB-6003 which has 100 ks/s speed if I recall.
I am not sure how to speed this up.  

There's no way to "speed up": when you want to measure pulses of a 0.25Hz signal then you need to wait for (atleast) 4s!

 

You can make the VI "more user friendly" by separating DAQ + UI update from signal analysis:

  1. Read the signal in a loop and display the measured samples in a graph or chart. Collect all samples in a larger array or waveform.
  2. Once you have measured enough samples you can stop the loop and do your signal analysis on the collected large waveform. This will be done quite fast, so the user will not notice the delay between end of DAQ loop and end of signal analysis…

 

Best regards,
GerdW


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

I was thinking the same thing actually, but I would need it to repeat infinitely while only updating the pulse measurements once per loop. 

 

I'll give it a shot, some of this graphic stuff is hard for this .NET guy to wrap my head around. 

 

I appreciate the help. 

 

SC

0 Kudos
Message 7 of 9
(342 Views)

That did not work as I anticipated but I probably am not doing this correctly. 

I am fine with an update on the pulse data every 5th iteration, but this also runs very slowly.  (VI attached so you can see my mess)

 

Can you give me a hint on how to do this by triggering a timer on pulse transition so I can just time the pulse width and update that instead of this pulse measurement VI or will that basically be the same thing?  

 

Thanks again,

 

Scott

0 Kudos
Message 8 of 9
(332 Views)

Hi Scott,

 


@MWDFixer wrote:

Can you give me a hint on how to do this by triggering a timer on pulse transition so I can just time the pulse width and update that instead of this pulse measurement VI or will that basically be the same thing?  


Doing it this way is not correct:

There is a palette full of waveform functions, and there is a function to concatenate smaller waveforms to build a larger one!

 

Why is that VI sooo large?

Why don't you use some subVIs?

Why do you focus on coloring the block diagram instead on focusing on clean code?

Why do you use ExpressVIs functions (ToDDT,FromDDT) to get one sample from a waveform? (GetWaveformComponents, IndexArray)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 9
(318 Views)