10-04-2009 12:12 PM - edited 10-04-2009 12:16 PM
I have an existing LabVIEW 8.5 VI that captures 3-phase power line waveforms from modules in a SCXI chassis. The captured waveforms are triggered by one of the analog channels and include pre-samples and post samples. The existing VI uses the DAQ Assistant and the “Trigger and Gate” express VI.
I need to modify this VI so that it captures the same kind of waveforms (with pre-samples and post samples), but triggers on the calculation results based on samples from 3 of the channels. I’ve tried both methods of feeding my custom (digital) trigger signal to the Manual Trigger input on the “Trigger and Gate” VI and feeding the trigger signal to the selector terminal on a Case Structure containing the “Trigger and Gate” VI set for “Immediate Triggering”, but it seems that the “Pre-samples” setting on the “Trigger and Gate” VI has no effect when using either of these two methods. (Tests seem to indicate that the number of pre-samples is random when using either of these methods.)
The only examples I can find are for triggering using a single channel on an acquisition device. Does anyone have any advice about how I can capture data with a fixed number of pre-samples using a custom trigger based on calculations from samples from more than one hardware channel?
Thanks,
Ron
Solved! Go to Solution.
10-05-2009 12:40 PM
Hi Ron,
Correct me if I'm wrong but it sounds like you have these 3 sine waves from your 3 phase power line and you are acquiring them through your DAQ card, at which point you are taking that data and doing some processing in software with the Trigger and Gate Express VI. My question here is what do you really want from your data? It seems that currently you are acquiring all the actual data through the DAQ but not using most of it. Is that something you need to do? Is there any reason that you are not using a reference trigger on your DAQ task? That way you do not have to acquire extraneous data. There are examples to do that, which don't use the DAQ Assistant. A good one to start with is going to be the VI named Acq&Graph Voltage-Int Clk-Dig Ref.vi which can be found in the NI Example Finder (Help»Find Examples) at the folder path Hardware Input and Output»DAQmx»Analog Measurements»Voltage. This VI does essentially what you are trying to do in your program except you would have to modify the instance of the DAQmx Trigger VI to be analog reference instead of digital.
One thing that may help is if you could post your VI and provide a description of your application and what you need from it. It may help to take a look at the way you have things set up currently.
Also, one other thing to mention about the Trigger and Gate express VI, if you set the trigger type to be immediate, you will not have a standard number of pre-trigger samples run to run. Basically, you will start looking at whatever data is available when the VI is called, which means that it doesn't wait for all n pre-trigger samples before "triggering." Another key thing to note about this VI, is that it is simply looking at the data being fed into it, which means that there is no actual communication with the hardware of your DAQ. This is more of a post-processing tool to help you extract pertinent segments of data from large data sets.
Let me know if any of this needs to be clarified and I can have a look at your code.
Chris W
10-06-2009 10:31 AM - edited 10-06-2009 10:39 AM
Hi Chris,
Thanks for your response. The existing application actually acquires 3 sets of 3-phase voltage and current samples for a total of 18 channels plus 2 other analog channels for monitoring trigger signals. The purpose of the program is to capture all 18 waveforms for viewing on a chart on a PC display for checking for sub-cycle disturbances, etc.
I started out using the DAQ Assistant and the “Trigger and Gate” express VI because they were used in the existing application, which I believe was designed by a hired NI engineer or something, while I am just a LabVIEW/DAQ beginner and the DAQ Assistant and the “Trigger and Gate” VI looked simple enough that even I could understand.
The attached VI is a trimmed-down version of the existing VI I am starting out with. A screenshot from a simulated test setup is shown below, which simulates a power line disturbance lasting about 5mS, which is triggered using a signal on the 4th channel of the DAQ hardware (4th waveform in the screenshot). The VI is set up to display 200 pre-samples and 200 post samples. I need to find a way to trigger a VI like this programmatically using my own software code, instead of using a single hardware channel on a DAQ device.
I looked at the ”Acq&Graph Voltage-Int Clk-Dig Ref” VI that you mentioned. It, like all of the other examples I have seen, seem to indicate that you must select a “trigger source”, which seems like it must be a single channel on an acquisition device. Is there a way to wire in your own code to the “Source” input on the “DAQmx Trigger” VI or something, instead of using a channel on an acquisition device?
Thanks,
Ron
10-06-2009 03:26 PM
Hi Ron,
I think there are a couple of ways you could do this, but I think the best way is to use one of the analog input channels to use as the trigger, using a VI like the one I listed. What are the conditions of your 18 signals that determine whether or not you want to acquire that window of data or not? There may be a way to do that in hardware so that we don't have to do a bunch of post acquisition math that determines which portion of the acquired data to view.
The other option is to do basically what you are doing and in your while loop, after you acquire the data, do some sort of logic/math to determine whether or not to trigger that Trigger and Gate VI. I have attached a revised version of your VI that might help to get you going to figure out a good way to implement exactly what you want. Since the "manual trigger" input of the Trigger and Gate VI triggers the acquisition immediately, what you might want to do is to actually rebuild a new array of data that is used as your trigger channel and add it to the array of data encompassing the dynamic data. This is essentially what I did to your example. Take a look and see how this works for you. Hopefully that helps.
Chris W
10-07-2009 03:59 PM - edited 10-07-2009 04:03 PM
Hi Chris,
Thanks again for your response. I wanted to capture a set of waveforms when the program sees a small disturbance on three specific voltage channels monitoring a 3-phase power line. One way to do this might be to create a trigger signal in LabVIEW code by adding the absolute values from the 3 voltage channels and running the sum of the signals through a low-pass filter to smooth it out some, which might resemble the signal from a three-phase full-wave rectifier with a capacitor filter or something. Then, I could compare this filtered analog signal with high and low limit settings using comparators or something, which would create a digital trigger signal whenever the analog signal level went outside of the limits.
It seems like this would be easily to do using the existing LabVIEW examples if I had an extra physical output channel (which I don't) to generate my custom trigger signal and an extra input channel for use as a triggering channel. I don't quite understand why there don't seem to be any LabVIEW examples for doing what I want using software, but I guess there must be a reason for it.
I wasn't able to open your VI since it appears that you can't open LabVIEW 8.6 VIs using LabVIEW 8.5. Could you please convert it so I can open it with LabVIEW 8.5?
Thanks,
Ron
10-07-2009 04:13 PM
Hi Ron,
What you are describing doing, should be able to implemented in the VI that I've attached (sorry for not converting it 8.5, I didn't realize you were using that version). The method you've described is realizable with some fairly basic array math and shouldn't be too bad, I think once you take a look at the VI that's attached you'll be able to modify that to manipulate the acquired data appropriately.
The issue with reading data with the DAQ hardware, then processing it in software to determine whether or not it's a trigger, then sending out a physical trigger with the DAQ, and then reading that trigger back in, is there would be a huge time difference between when the trigger is received and when you had acquired the original data that you wanted. It takes some time for the DAQmx driver to bring the acquired data from the DAQ card to the PC and do processing on it, then download a waveform output to the card and generate that waveform. I think that the way you were originally going about it with the Trigger and Gate VI, is going to work out the best for you. Just make the necessary data manipulations in the modified VI, and you should be good to go.
Chris W