LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with capturing specific portion of waveform

Solved!
Go to solution

I am trying to make a measurement of a voltage signal using a USB-6356, the signal has a duty cycle of 40% and sometimes the value can be pretty low.  I want to measure the RMS value of just the on portion of the signal, I was able to mostly do this by setting the trigger level and adjusting how many samples to capture, however sometimes the signal might have noise that causes it to trigger earlier or the signal just gets too low so the trigger has to stay low.  Below are some images of the waveform

 

waveform.png

0 Kudos
Message 1 of 8
(1,525 Views)
Solution
Accepted by topic author rocksolidsr

Hi rocksolidsr,

 

You could look into setting up an analog trigger with hysteresis (see Section E from this webpage). That's what that function is for so *should* help with the false trigger https://www.ni.com/en-us/support/documentation/supplemental/21/ni-daqmx-data-acquisition-triggering-...

 

Eric

0 Kudos
Message 2 of 8
(1,505 Views)

Thank you that did seem to help! I did see that article but I couldn't find the DAQmx Trigger Property, sometimes I get lost in those property node settings.

 

Is there a way to start capturing after a certain amount, so that I don't capture that spot at the beginning where it is ramping up.  I could just adjust the trigger but was hoping that I could leave that at one level without having to adjust when the signal gets lower.  I will be taking a series of measurements at different locations on a disc and as I get towards the end the signal gets lower.

rocksolidsr_0-1613587609996.png

 

0 Kudos
Message 3 of 8
(1,477 Views)

A lot of thoughts come to mind, but it's kind of a flowchart -- answers to some of the first questions determine which direction to navigate.

 

1. Is the total duration of the signal pretty consistent?

 

2. Is this a post-processing exercise or do you need to do this live, in near real time?

 

3. Is the lowest trigger level you need sufficiently above the noise floor between "pulses"?

 

4. What's the frequency and waveform shape of the signal you're capturing?   In some situations you can get a pretty decent RMS measurement even if you can't sample fast enough to reproduce a single waveform cycle accurately.  As long as the sample points shift around so you catch different phase points of different cycles, you may be able to get a good approximation of true RMS.

 

I'd want to aim for some conservative bounding of the problem.  What's the max time from the earliest trigger point to the start of steady-state amplitude?  What's the min time from trigger point to the end of steady-state amplitude?    Use info like this to decide how many initial samples to ignore and how many after that to keep and analyze.   Try to build in 5-10% margin on these times.  You'll probably get a better RMS result by analyzing 75% of the steady-state time which includes *none* of the transient than you'll get from analyzing 100% of the steady-state time that also includes (this number is just to illustrate, but you get the idea) 5% of the transient.

 

It's partly seat-of-the-pants and empirical, but it's the kind of direction I'd be inclined to try heading in.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 4 of 8
(1,455 Views)

1. Is the total duration of the signal pretty consistent?

The signal is continuous for as long as I would like

 

2. Is this a post-processing exercise or do you need to do this live, in near real time?

near real time

 

3. Is the lowest trigger level you need sufficiently above the noise floor between "pulses"?

at the moment I would say yes, but I will need to do more experimentation with different devices to see how "low" they go

 

4. What's the frequency and waveform shape of the signal you're capturing?   In some situations you can get a pretty decent RMS measurement even if you can't sample fast enough to reproduce a single waveform cycle accurately.  As long as the sample points shift around so you catch different phase points of different cycles, you may be able to get a good approximation of true RMS.

The frequency is around 32kHz and turning on and off at 25Hz with 40% duty cycle

 

What's the max time from the earliest trigger point to the start of steady-state amplitude?

I would say probably 2-5ms

 

What's the min time from trigger point to the end of steady-state amplitude?   

The on portion of the signal is on for 16ms

 

Use info like this to decide how many initial samples to ignore and how many after that to keep and analyze.  

How would I ignore samples

 

0 Kudos
Message 5 of 8
(1,435 Views)
Solution
Accepted by topic author rocksolidsr

I think you're probably in good shape then.

 

Let's just say for example that you configure to acquire 12 msec of post-trigger data sampling at 1.0 MHz.  So you get 12000 samples.  To be on the safe side, ignore the first 4 msec worth which *might* include some of the transient.  So you take an array subset of the data starting from index 4000, with an 8000 length.   Now you have 8 msec worth of data samples that should be soilidly within the steady-state region.

 

Your 32 kHz signal cycles 32 times per msec.  So 8 msec gives you >250 cycles.  Also, your 1 MHz sample rate gives you ~31 samples per cycle, normally plenty to be a good representation of a reasonably well-behaved waveform.

 

I would do a few sanity checks offline though.  Start by capturing, say, 100 msec worth of data at your highest sample rate and save it to file.  Start doing a bunch of offline analysis to figure out how long the steady-state portion is, where it starts and ends, where various trigger levels would have caused triggering, etc.

 

Then you can try doing RMS calculations on a variety of data subsets.  Calculate it for the entire steady-state region.  Then calculate for regions that are half that size -- try the first half, the middle half, and the last half.    Try it again at half the sample rate by ignoring every other point.

   All this is to get a feel for how stable the RMS calculation is relative to your limitations.  Of course, the calcs won't match exactly and perfectly -- remember you have a contribution from noise that you can estimate by calculating the RMS of the noise you're getting during the "off" times.

   I think you'll probably find that the amount your signal RMS calcs vary is due *mostly* to the noise with a relatively minor contribution from whether you include all the data or only half of it (for example.  Surely you're welcome to try other things besides my top-of-the-head suggestions above.)

 

The offline analysis is meant to build confidence in the approach you plan to take with your near-real-time analysis.  If you want an RMS measurement of *every* pulse, you need to be able to keep up with a ~1 MHz data stream and do some processing every 40 msec.  That too sounds very do-able.

 

I'd advise some variety of producer-consumer structure to deliver data from your data acq loop over to a parallel processing loop.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 6 of 8
(1,427 Views)

thank you for the advice I will give that a try!


0 Kudos
Message 7 of 8
(1,387 Views)

Is there any easy way to capture say the average peak to peak value of a waveform, because I do not want to capture the initial spikes, see image below

 

rocksolidsr_1-1619199388638.png

 

0 Kudos
Message 8 of 8
(1,332 Views)