12-05-2011 04:59 AM
Hi all,
There are a program to set vary voltage out and read it on table and write it into file, but the data duration is too long (around 4s for each cycle), how can I take sample as small as possible. Thank you.
Solved! Go to Solution.
12-05-2011 05:59 AM - edited 12-05-2011 06:00 AM
Hello,
I can't look at your E3631A vi's as you haven't included them, but you are using one loop to acquire and write data. If you split this in to two loops and use a producer/consumer (data) architecture using queues, you can increase the acquisition rate and write to the disk at a different rate. Try this one here:
https://decibel.ni.com/content/docs/DOC-8962
Or search for "producer consumer data"
Hope this helps.
Regards,
aCe
12-06-2011 12:22 AM
Thanks aCe, I will try it later
12-07-2011 01:26 AM
I try it refer to the Producer/Consumer design, but the cycle time is same (still 4s). Do I set something wrong, pls give comment. Thank you!
12-07-2011 04:05 AM - edited 12-07-2011 04:08 AM
You need to move the data acquisition loop to the producer loop (top while loop) and keep the write to file (typically slower) in the consumer loop (bottom while loop)
Also, express vi's can be detrimental to performance. Try to avoid them if possible.
12-07-2011 03:36 PM
Hi nvnewbie,
Actually, your problem has nothing to do with your data acquisition structure, although on both of your block diagrams you do not have the file input wired to Write to Measurement File, so you are not logging any data. You should wire your table to the string input to Write to Measurement File.
The delay that you are seeing is expected; the Configure Output, Configure Current Limit, and Read Output VIs within the Agilent E363X Instrument Driver Library all call the Error Query VI, which is also within the Agilent E363X Instrument Driver library. The Error Query VI has a built in 1 second delay in order to make sure that there is not a timeout when communicating to the E3631A over serial. You can see this delay for yourself if you open up your SubVIs in your block diagram.
Since you call the Configure Output, Configure Current Limit, and Read Output VIs with every iteration of your while loop, that is 3 seconds of guaranteed delay each time the while loop iterates. There are also delays built into those VIs themselves, so all of this delay adds up to 4 seconds. If you want to minimize this delay, you can edit the Error Query VI to reduce the delay, though I would expect this to cause timeout errors if you make the wait too slow. Serial is not made for high-speed communication. You can also rewrite your code to only call the Configure Output and Configure Current Limit VIs when you need to adjust the settings.
Best,
Dan N
Applications Engineer
National Instruments
12-07-2011 07:57 PM
Dear aCe,
Thanks you for support me, I got the answer from Dan.
Dear Dan,
Thanks a lot for your reply, I sure it is the answer for the issue. I just know I can explore the code inside the block, it will be helpful for my later learning.