LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform Chart Drops to Zero Periodically

Hello. I'm trying to measure current, but it keeps dropping periodically on the waveform chart. Any ideas on how to fix this?

Download All
0 Kudos
Message 1 of 10
(440 Views)

Maybe it's telling you the truth.

0 Kudos
Message 2 of 10
(400 Views)

 


@rsr_17 wrote:

Hello. I'm trying to measure current, but it keeps dropping periodically on the waveform chart. Any ideas on how to fix this?


The zero-phase filter is designed for offline analysis. From the function help:

...With a zero phase filter, the output sequence Filtered X has no phase distortion. Although the zero phase filter is non-causal, it is useful in offline applications such as filtering a sound file saved on disk.

You will get the expected filtered output on your chart if you apply a continuous low-pass Butterworth filter using the waveform conditioning VI:

dsbNI_0-1756159368892.png

 

Continuous LP Filter.png

 

When debugging future issues, search for the first block that produces unexpected outputs when fed expected inputs.
When posting to the forums, please upload a simple VI that reproduces the issue. Save the VI with typical data saved as default value(s) - that way we don't need hardware to help. 

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
Message 3 of 10
(389 Views)

We typically don't debug images, so for better help, attach your VI. Save for previous, 2020 or below, and make sure all controls have typical default values.

 

From the code picture alone, we can tell that you don't have much experience with LabVIEW, Maybe once you clean up the code, other things might fall into place.

 

  • The stop terminal belongs inside the loop and be latch action. No need for a local variable.
  • Your FOR loop acts as a glorified "index array " function. because only the last array element will survive the non-indexing output tunnel
  • If you only want one channel, why are you reading N channels?
  • If you are only interested in the array data, why are you reding waveforms, just to throw away the decorations (x0, dx) later unseen? Once you remove this, timing information is lost and your selected filter frequencies probably have no meaning relative to the data.
  • Your filter needs to be setup only once before the loop, no need to redo the same calculation with every iteration of the loop. Sisyphean!
  • How does the chart look if you bypass the filter? What are you actually trying to achieve with it?
  • What is the loop rate and how many points do you get with each iteration?
  • Can you replace the IO with a simulated signal that resembles the real signal for testing?
0 Kudos
Message 4 of 10
(371 Views)

dsb@NI wrote:

 


this is a realy nice demo!

I would visualize the raw and the filtered data in a stacked chart, for comparison, e.g. 

Spoiler
alexderjuengere_0-1756216439052.png
when set the .vi to "run continously":

iir-labview.gif

 

 

 

 

0 Kudos
Message 5 of 10
(310 Views)

Great point. I attached the VI. I also don't have much LabVIEW experience, so your feedback is greatly appreciated. See below in blue for answers to your questions.

 

  • If you only want one channel, why are you reading N channels? Only one channel is needed. The NChan option seemed to produce the best results purely from looking at the chart
  • How does the chart look if you bypass the filter? What are you actually trying to achieve with it? There is significant noise without the filter (pic below). It's difficult to comprehend what is going on. Are you asking what I'm trying to achieve with the filter specifically or the code overall?
  • What is the loop rate and how many points do you get with each iteration? The loop rate appears to be 100000 Hz. The method it is calculated is included in the VI
  • Can you replace the IO with a simulated signal that resembles the real signal for testing? The current measured should peak then be relatively uniform. Is it possible to use the uniform white noise subVI simulate this well?

    rsr_17_0-1756330309628.png

     

0 Kudos
Message 6 of 10
(247 Views)

Based on your answers, I updated your VI:

dsbNI_0-1756383840972.png


Key changes:

  • 1 Channel: Read 1 channel, Filter 1 channel, Chart 1 channel
  • Set number of Samples to Read = 250 (this leads to a loop rate of 1 Hz)
  • Use Waveform Datatype to preserve timing

Question:
Are you measuring current or voltage? Your code adds a voltage channel to the DAQmx task. Do you need to scale voltage to current? Even if you have a shunt resistor of 1 Ohm, I would add the scaling, so that it is explicit in the code.

Good luck!

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
0 Kudos
Message 7 of 10
(216 Views)

dsb@NI wrote:

Based on your answers, I updated your VI:

As much as I request including the VI with forum posts, I should have attached the updated VI, so here it is.

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
0 Kudos
Message 8 of 10
(200 Views)

@rsr_17 wrote:

Great point. I attached the VI.


You did not use "save fore previous" as requested and attached a 2025 version, thus I cannot look at your VI.

0 Kudos
Message 9 of 10
(191 Views)

@rsr_17 wrote:
  • If you only want one channel, why are you reading N channels? Only one channel is needed. The NChan option seemed to produce the best results purely from looking at the chart

That makes absolutely no sense! What differs? What is your definition of "best"?

 


@rsr_17 wrote:
  • How does the chart look if you bypass the filter? What are you actually trying to achieve with it? There is significant noise without the filter (pic below). It's difficult to comprehend what is going on. Are you asking what I'm trying to achieve with the filter specifically or the code overall?

What is the meaning of the data and what result do you ultimately need.

 


@rsr_17 wrote:
  • What is the loop rate and how many points do you get with each iteration? The loop rate appears to be 100000 Hz. The method it is calculated is included in the VI

 

Your loop is free running, will be highly irregular, and will vary dramatically between different machine hardware. This rate is not deterministic. You did not answer my question on how many points you get with each iteration. There is a big difference between 1 point a 100kHz and a million points at 100kHz.

0 Kudos
Message 10 of 10
(184 Views)