06-12-2014 09:43 PM
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
Martin
06-13-2014 01:44 PM
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.
06-13-2014 05:52 PM
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
06-13-2014 06:30 PM
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
06-13-2014 07:28 PM
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
06-14-2014 12:29 PM
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
06-14-2014 03:43 PM
06-14-2014 05:12 PM
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
06-17-2014 01:19 PM
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: