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: 

Toggling program to sort data sets during acquisition

Solved!
Go to solution

Hello,

 

I have a two-channel Gage board that I use to record analogue Time of flight signal. I already have a program that records the signal and averages it but, I am getting ready to do an new experiment that runs my detector at 40 Hz and my laser at 20 Hz. With that info, here is what I need to do:

 

1. I need to record the TOF signal, as per usual, however, I need to distinguish between my laser on data and my laser off data.

 

One idea I had is to somehow trigger the program, after the initial trigger, to indicate whether the laser is on or off. I could then use a case structure to build two arrays of data.

 

A second idea is to use a for loop. Because one rep rate is twice that of the other, I can simply add the data of all even iterations to one array and the odd data to another. However, with this I would have no idea which array contains the laser on/off data.

 

The overall program will subtract subarrays of the laser on and laser off data in order to do real time background correction. The idea is similar to a lock-in-amplifier or phase-sensitive detector except that I will be subtracting the out of phase signal. Right now I just need to distinguish between the two types of incoming data sets.

 

Thanks in advance

0 Kudos
Message 1 of 20
(2,521 Views)

No Suggestions?

0 Kudos
Message 2 of 20
(2,499 Views)

You indicate that your will be "running the laser" at 20 Hz. 

 

What I would suggest is that you use the same timing signal to control both the laser and the detector.  At each pulse of the 40 Hz clock trigger the detector and toggle the laser driver on or off.  If you always start in the same state, say laser off, then you will know which samples are with the laser on or off.

 

Collect all the data in one array.  When done use Decimate Array with two output elements to split the array into two equal parts.

 

If your laser on signal is significantly larger (even just part of the time) than the background signal, it should also be feasible to detect which array is which by the magnitude of the signals.

 

Lynn

0 Kudos
Message 3 of 20
(2,480 Views)

Sorry, my browser duplicated the previous post.

 

Lynn

0 Kudos
Message 4 of 20
(2,480 Views)

Hi Lynn,

 

If I knew how to start the laser in the same state then there would be no question. However, I don't know how to set up the program so that it starts only under certain conditions.

 

As for the time clock, I will be running both the detector and laser off of the same pulse generator. Is there no was to check a signal after the program has been triggered? I can send a square pulse to channel 2 of my card when the laser is triggered. Would that help?

 

mrphud

 

 

0 Kudos
Message 5 of 20
(2,471 Views)

If you have an available input channel, using that to record the laser control signal is a good way to synchronize the data.  It clearly lets you know when the laser is triggered.

 

Lynn

0 Kudos
Message 6 of 20
(2,460 Views)

Hi Lynn,

 

This is exactly what I would like to do. The question is, 'how to use that signal?' Like I said I have a two channel card. Channel 1 will be the detector signal. Channel two can be the laser trigger. How to go about it after that is my question.

 

mrphud

0 Kudos
Message 7 of 20
(2,457 Views)

I do not have enough information to answer your question.

 

Some of your terminology is confusing.  You have mentioned "triggering the program" and the "laser trigger." You also talk about laser off and laser on.

 

What signals do you have accessible in hardware? For example what triggers the laser? Do you have a logical signal which correlates with the on and off states of the laser? What is the duration of the test? Single pulse, multiple pulse burst, continuous on/off cycling until manually stopped?

 

Lynn

0 Kudos
Message 8 of 20
(2,454 Views)

OK.

 

Everything with will be synchronized with a Stanford Research System pulse generator. I will have one square pulse triggering my digitizer card and one pulse triggering my laser (set at different delays).

 

If I branch my laser trigger pulse I can feed that to my second channel. If I can use the signal from channel two to let the program know the laser is being triggered then I should be able to indicate laser on. This is what I meant by 'triggering the program' after it has started.

 

I plan to run this program for a certain number of cycles that would be set by user input and executed using a for loop. I will attach what I have for the program so far. Only pay attention to the first for loop.

 

mrphud

0 Kudos
Message 9 of 20
(2,449 Views)

It would be helpful to have the GageTOFAcquire.vi and 2D Waveform to 1D Array.vi subVIs also.

 

The case structure where you toggle the 1D arrays has the tunnels set to Use Default if Unwired.  That will create empty arrays on the unwired output.  When they are autoindexed into the 2D output arrays, I think they will be extended to the same length as the other arrays and filled with zeros.  I am not sure that is what you want.

 

When you post the GageTOFAcquire VI, please run it so that some typical data is on the output graph. Stop the VI. Make Current Values Default. Save. Then post.  That way we will have some dat ato look at.

 

Lynn

0 Kudos
Message 10 of 20
(2,440 Views)