02-27-2009 02:02 PM
I am trying to create a VI that will write the data to file based on amplitude trigger. Also, I want the data to be written for 5 seconds.
Any suggestions?
See attachment.
03-02-2009
01:49 PM
- last edited on
10-03-2024
09:53 PM
by
Content Cleaner
Hey Kevin
I played around with your example and went ahead a wrote what you are looking for and posted My Example on the Dev Zone Community.
-Hunter
03-02-2009 04:21 PM
03-02-2009 09:51 PM
Huter,
Thanks again for the example.
I ran the VI example you created. It appears to be working however when I adjust the voltage threshold above the signal settings it still writes the data to file.
Any suggestions?
Kevin
03-03-2009 11:54 AM - edited 03-03-2009 11:59 AM
Kevin;
The reason this happens is due to Aliasing . When you set the amplitude to 5, it will generate a sin wave of the given amplitude, however because it is representing the sine wave as a discrete number of samples you will not likely have a point at 5 exactly, it might peak at 4.7 or 4.9. There are a few things you can do to help this.
1. Sample faster, the fast you sample the closer to the ideal peak you will get, and the closer to an ideal wave your signal will be.
2. Set your threshold slightly lower than your actually point of interest. ie set it to 4.5 and you will get all of the relevant data.
3. If your sampling rate is an integer multiple of your frequency, the wave will peak at the exact same value everytime. If you change the frequency or sampling rate slightly, ( add 1) it will peak at different points and increase the likelihood of getting a max peak.
The First Picture shows a input amplitude of 5, but the signal only goes to 4.75ish, The samples to read on the simulate signal is set to 1000/per sec and the frequency is 100.
In the second picture I set the samples to read to 1001, so the frequency is no longer a multiple and you can see how the peak is closer and varies slightly, but it still doesn't reach exactly 5.
03-03-2009 05:24 PM
Huter,
Thanks for information on aliasing but unfortunately I am still having issues with the example VI.
This is what I am trying to do:
Trigger the "write to data file" once the amplitude goes above the threshold, not below. Once threshold is exceeded write the data for 5 seconds. The current VI writes data indefinitely once the amplitude exceeds the threshold and writes data for 5 seconds once it drops below the the threshold. Also, if I hit "run" with the amplitude set below the threshold, it writes data for 5 seconds.
I've tried to update the VI you provided but I didn't have any luck.
Any suggestions on what is missing in the VI?
Thanks,
Kevin
03-04-2009
11:58 AM
- last edited on
10-03-2024
09:54 PM
by
Content Cleaner
Kevin
If you want more custom triggering I recommend you use Trigger and Gate Express VI. Take a look at the detialed help for more info.
Hunter