From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring the time in between two pulses (shock wave speed)

Hi

 

I am having some trouble with high speed timing to measure the speed of a shock wave or pressure wave. The wave is to travel down a tube which has pressure transducers mounted along its length (1.5 meters apart). The transducers will sense a drastic change in pressure when the wave traverses or go across them. The time the wave takes to travel the 1.5 meters is about 0.7 to 4 msec

 

The code I had developed will only count every msec and this will not give me such an accurate reading. I have tested the code with the daq equipment and it is simply not timing anything. It could be that the code itself is slower than the shock wave. I have attached a copy of my code

 

Code steps are as follows

1. First daq is the first transducer that the wave will traverse. This will send a true when pressure rises to specific amount.

2. When the first transducer signal gets to specified amount a while loop (loop repeats every msec) will start and act as a counter to get when the second transducer signal rises to a specified amount and the loop will stop and the time should display.  

 

I have looked into other ways of timing the event, but have had no ideas how. Any help is appreciated. I have also added a pic of what is the experiment's pressure response.

 

Thanks

Download All
0 Kudos
Message 1 of 12
(4,548 Views)

The code you posted is software timed ..... 

Trial5.png

 

Check out the examples in

 

Help >>> Find Examples

 

"Cont Acq Snd Pressure Samples-Int Clk.vi" and "Cont Acq&Chart Samples-Int Clk-Analog Start.vi" look promising for your app.

 

Once you get your data on the screen look at the VIs on the

 

Programming >>> Waveform >>> Waveform Meassurements >>> Waveform Monitoring

 

pallette. Look at the help for Basic level Trigger Detection.vi

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 12
(4,537 Views)

I have taken a look at the example VIs and I also found two edge seperation VI to be helpful. I did some tutorials on how to use the DAQmx functions.

 

I have developed a code to just give me the time of the edge seperation (much like the two edge seperation) but it is not running. I get an error-

 

Error -200265 occurred at DAQmx Read (Counter DBL 1Chan 1Samp).vi:1

 

Possible reason(s):

Measurements: An attempt has been made to use an invalid analog trigger source.

Ensure that the trigger source you specify matches the name of the virtual channel in the task or matches the name of a non-scannable terminal that the device can use as an analog trigger source.

Property: Start.AnlgEdge.Src
Corresponding Value: Trans1-ai0

Valid Choices: Dev1/ai1, APFI0

Task Name: _unnamedTask<E>

 

Basicly the Trans1-ai0 is the first trigger and ai 1 is the second transducer.

all i want to get is the time it takes to get from one transducer to the next. 

 

I am using the PCI 6255.

 

Message Edited by oelias23 on 03-16-2010 12:54 PM
0 Kudos
Message 3 of 12
(4,464 Views)

This discussion will probably help you.  It will show you how to set up your analog triggering properly.

 

 

Message 4 of 12
(4,453 Views)

Thanks. I have made some corrections but now i get a different error.

 

Error -200265 occurred at DAQmx Read (Counter DBL 1Chan 1Samp).vi:1

 

Possible reason(s):

Measurements: An attempt has been made to use an invalid analog trigger source.

Ensure that the trigger source you specify matches the name of the virtual channel in the task or matches the name of a non-scannable terminal that the device can use as an analog trigger source.

Property: Start.AnlgEdge.Src
Corresponding Value: empty string

Valid Choices: Dev1/ai1, APFI0

Task Name: _unnamedTask<1B>

 

Am I on the right track to get the time in between the rising edges of my two analog inputs?

0 Kudos
Message 5 of 12
(4,434 Views)

Uh, that is exactly the same error as the one you were getting before, according to your previous post..except now it would appear that you haven't wired anything to the source terminal of your analog input trigger.  That is my best guess, since I don't have access to the changes you've made.  You need to specify your trigger source, or else the VI doesn't know where to look.

 

If you want to post your code again, with the changes you made, I'll take a look.

 

Message Edited by DianeS on 03-16-2010 04:41 PM
0 Kudos
Message 6 of 12
(4,428 Views)

Ok, never mind that last post. Now I've made a new one and am getting no errors, but when I run the experiment I get nothing. The whole experiment is done in about 4 msec.

 

Equipment:

NI PCI 6255

NI BNC-2110

 

Hook up:

1st Transducer - PFI0 (this should start the trigger)

2nd Transducer - AI1

 

I have checked and rechecked that the transducers work when i set up the Physical channels in the Measurement and Automation software.

 

As I run the program I get no errors, but nothing on the graph either.

 

On the example VI Meas two edge separation, can that be configured with analog inputs? And does that VI only use a single input channel?

 

Here is the new code.

Note: that in order not to get the trigger error again i must put an "A" before PFI0 to make it "APFI0". That seems to get rid of the error.

 

Thanks for your time DianeS

0 Kudos
Message 7 of 12
(4,418 Views)

Did you carefully read the discussion I linked for you earlier?

 

You do not want to use PFI0.  That's a digital trigger.  You want to use APFI0.  That's an analog trigger.  On the 6255, APFI0 comes off pin 20.  PFI comes off pin 11.  Are you connected to pin 11, or are you connected to pin 20?  Based on what you wrote, I believe you are connected to pin 11.   If I am wrong, I apologize.

 

If you are, indeed, connected to PFI0 (pin 11) you don't have a trigger signal coming in, since you have specified the trigger source as APFI0 (as you noted that you need to, for an analog trigger), which is located on pin 20.  No trigger, no data. 

 

I want you to do EXACTLY what the NI engineer said to do in the discussion I linked to earlier.  No changes from what's laid out there.  Ok?  Your first transducer needs to be connected to ai0 and APFI0.  Your second transducer needs to be connected to ai1.  Your task must contain both ai0 AND ai1.  APFI0 will be your trigger source.

 

Don't get creative yet.  Try it exactly that way, and post back if it still doesn't work. 

 

In answer to your other question:  that example is written for counters.  I note that the 6255 has two counters.  You could always do it that way, unless you are using those counters for something else.

 

 

Message Edited by DianeS on 03-16-2010 09:38 PM
0 Kudos
Message 8 of 12
(4,403 Views)

Yes you were right. I was connecting to the digital trigger. I have updated the code now to look more like the discussion. I inserted another create channel for the first transducer. Now I have two channels being created.

 

The first transducer will hook up to ai0 and apfi0 (analog trigger)

 

For the connections. Since I am using bnc's to connect to the board, I will need some sort of Y to connect ai0 and apfi0 to the first transducer. Correct?

 

Is there a simple way to check that the tigger is working? Like turning on an led on the block diagram?

 

Thanks for the help.

0 Kudos
Message 9 of 12
(4,375 Views)

I've added some comments to your code, which I hope will help explain things.  You are on the right track now. 

 

Have a look.

 

I do not know of an easy way (like a boolean on the front panel) to determine whether or not the trigger has occurred...I expect that you'll know it's occurred because you'll have data show up on your graph.  You will want to make sure that the trigger level is set appropriately.  I know you know that, but sometimes that kind of thing can send us chasing our tails for hours.  (voice of experience there)  If you try it and it doesn't work, check your trigger level and make sure it's not set to something weird...

 

d

 

 

0 Kudos
Message 10 of 12
(4,370 Views)