Dynamic Signal Acquisition

cancel
Showing results for 
Search instead for 
Did you mean: 

Write data file based on amplitude trigger

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.

 

 

0 Kudos
Message 1 of 7
(8,913 Views)

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

0 Kudos
Message 2 of 7
(8,893 Views)
Thanks for the help!
0 Kudos
Message 3 of 7
(8,888 Views)

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

0 Kudos
Message 4 of 7
(8,882 Views)

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. 


Message Edited by Huter on 03-03-2009 11:59 AM
Download All
0 Kudos
Message 5 of 7
(8,867 Views)

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

0 Kudos
Message 6 of 7
(8,850 Views)

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

Message Edited by Huter on 03-04-2009 11:59 AM
Download All
0 Kudos
Message 7 of 7
(8,838 Views)