Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save Input and Output Channels' data for a same duration of time?

Hello, I have a voltage-input, voltage-output SISO system, and need to indentify its dynamic response (or transfer function) as a reference to a PID control. Without using the system identification toolbox, my goal is to generate/provide a sine sweep input (ranging 1Hz-5kHz for 10sec) to the system and to save the corresponding output response signal as well as the sweep input signal simultaneously.

 

I got a sample program online and am trying to modify it as attached, but I really need your advices/comments concerning several problems I am facing with:

 

1) With the below setting, the number of the acquired Input channel samples obtained is 5461, which is smaller than expected (i.e., 10000). What would I be missing in setting parameters?


- H/W: NI-USB-6341 DAQ
- AO: continuous samples with the waveform timing (1k sampling, 10000 samples => 10 sec, slower sampling just for testing purpose)
- AI: continuous samples, samples to read: 30k, rate: 1k

 

 

2) I am using flat sequence structure as a way to making the start point of saving AI and AO data same, but wonders if this is a right method or if there is other better approaches. (I had an idea of using an internal clock with "1-sample mode" for sync, but this may not work at the high speed sine sweep like 5kHz, right?)

 

 

3) I just want to provide the sine sweep just once to the system and do not require the "reset" functionality implemented in the original sample program. I failed to remove this "reset" part as I did not fully understand the sample code. If I run the attahed, the generated AO signal is periodically provided to the system. Please give me any advice to modify the program as I want.

 

 

Thanks for your help and valualble time.

 

siso.png

 

0 Kudos
Message 1 of 2
(3,032 Views)

Hello J. Kim,

 

If you want to synchronize analog input and output tasks you're going to need to use DAQmx functions. This developer zone article will give you an introduction to using DAQmx functions:

http://zone.ni.com/devzone/cda/tut/p/id/2835

 

In order to do AI-AO synchronization, you should start with an example. Open up the example finder (Help --> Find Examples). Then go to Hardware Input and Output --> DAQmx --> Synchronization --> Multi-Function-Synch AI-AO.vi. If you go through the Developer Zone I linked above and work through the example you should be able to understand enough about synchronization to get it working for your application.

 

If all you need to do is output a sine wave that changes in frequency and monitor an analog input, then you can set up the analog waveform using the code you already have, and then plug those values into the analog output portion of the example linked above, and everything should work well.

Colden
0 Kudos
Message 2 of 2
(3,019 Views)