LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview Trigger

Hi Forum,

 

i have troubles using a trigger in Labview. I am using the Trigger and gate express vi for threshold detection and triggering . The trigger worked fine with my I7 processor i made a exe and try it on my target pc (1.8Ghz intel Atom). If i set the sampling rate on maximum 100ks/s the trigger detect the event but the pc cant write it down that fast sometimes he gets the trigger and write it to file but most of the time I just get empty (0sample) text file. What could i do to get it running? 
I attached the trigger vi where i try press the manual button with a logic.

thanks a lot

Martintrigger.PNG

0 Kudos
Message 1 of 9
(5,362 Views)

Use a producer/consumer loop pattern. Put the logic for acquiring the data (which you didn't show here) in the producer loop, and analysis and data saving in the consumer loop.

 

The downside though is that your queue will grow without bounds. How long does this test need to run for? (hint: "forever" is not an option...)

 

Mike...

 

PS: Also get rid of the save measurement express VI. That routine in a loop is inherently inefficient because each time it executes it opens the file, writes to it and then closes it back up. Open the file once outside the consumer loop, write to it as needed in the loop, and then close it when the program stops. This change might allow the consumer loop to keep up with the producer.


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 9
(5,322 Views)

Hi Mike,

 

i am really new in Labview and programming...  so producer/consumer sounds good too work. The test will run around 6h but just waiting for triggers and calcuatltion rms and thd will be written to file. I will use a state machine where one state is the acuistion here the software should look for the trigger and write it to file. Open the file outside the loop was also my idea the problem is that i would like to have 1s of data this will grow the file really fast? (100ks/s) 

Antother question how i could set the trigger on RMS value change, for example Line current drops fast (10A-5A) ---] trigger execude. with buffer.

Thanks and best

Martin

 

 

 

0 Kudos
Message 3 of 9
(5,311 Views)

Martin,

 

Look at the TDMS files. They are optimized for speed. I think the Write to Measurement FIle VI creates text files which tend to be larger and slower than the binary TDMS files.

 

How much data (how many samples and how many channels) do you save each time the trigger is located? Do you need any pre-trigger samples? Those answers as well as the sample rate determine how big the file and the memory allocations for buffers need to be.

 

If you do not need the data far from the trigger, it can be discarded. That reduces the size of the buffers and files.

 

Lynn

0 Kudos
Message 4 of 9
(5,303 Views)

Hi yes tdms should work fine

 

i would need pretrigger samples about (1s if possible 100ks/s on 6channels) i could reach this with the gate and trigger vi, that worked fine. Here i used tresholdsettings but i also would like to set a trigger on a rms rapid change like the current dropping. WOuld be great if i could somehow implement with the gate and trigger vi. Is this possible?
Thanks 
Martin

0 Kudos
Message 5 of 9
(5,293 Views)

Martin,

 

What rms signal? You have not shown any code with any rms calculations.

 

1. RMS, by definition, is an average over some number of samples. So any  rms calculation will lag behind the data going into it. This will affect the timing of any trigger.

2. While the Trigger and Gate.vi seems to have several triggering options, it does not appear to have a trigger index output. If you wish to trigger on some combination of different signals, especially when there are delays between them, the index is very useful.

3. You can convert most Express VIs to standard VIs by right clicking on the fornt panel. Then you can open the block diagram and make any changes you need.

4. While Express VIs are OK for quick and easy operations, as soon as things start to get more complicated, their limitations become apparent. You will probably need to write your own code for the RMS trigger.

 

Lynn

0 Kudos
Message 6 of 9
(5,266 Views)
Hi Lynn,

I calculate the rms value with the rms.vi i think it calculates the rms over one cycle or i am wrong? I would like to use the trigger and gate vi and change the values of the express vi to none trigger. As soon the rms value exceeds the nominal value press the manual trigger and write the data to file also give me pre trigger samples.

Same with thd calculation over one cycle, exceeds nominal value the trigger happen. I will upload the code soon I am on the pc.

Thanks a lot Lynn
Martin
0 Kudos
Message 7 of 9
(5,259 Views)

The RMS.vi calculates the rms value of all the data fed to it. It does not make any attempt to identify one cycle. If you want to do your calculations on one cycle of data, then you need to identify the limits of the cycle and extract that segment of the data.

 

I am not sure about the THD VI. It may does use FFT methods in which case it probably will not work well with less than several (5-10) cycles of the fundamental frequency signal. I checked. Harmonic Distortion Analyzer.vi from the Signal Processing >> Waveform Measurements palette uses FFT internally. The Express Distortion Measurements.vi uses Harmonic Distortion Analyzer.vi as a subVI.

 

Lynn

0 Kudos
Message 8 of 9
(5,251 Views)

Hi Lynn,

 

i tried it out it looks it its working. I am callculating the THD value and every time it reaches a pre defined value it triggers and write me the data to file:

 

0 Kudos
Message 9 of 9
(5,203 Views)