From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

CompactDaq AI with Visual Basic .NET

Well, I can run at 1 sample per channel, but nothing more.  Any more than 1 makes 1<loop time<2.  I run a thread and I don't think the thread finishes before the next thread is called and then my loop times just get greater and greater even though the loop is still executing.  The following chart details the data I have obtained:

File   Samples/Channel   SampleRate
3         2                              14
4         1                              14
5         2                              100
6         1                              100
7         1                              200

Files and project attached.


Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
Download All
0 Kudos
Message 11 of 115
(2,174 Views)
The actual time is listed on the right hand column.  The second from the right is s:ms


Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
Download All
0 Kudos
Message 12 of 115
(2,174 Views)
I just ran a comparison between a CompactDAQ chassis full of thermocouples (same as the other files) reading during a test.  The channels only update every other second, which means our charts look like stair cases and it could be a 100 degree difference from one second to the next in some cases.  This is not acceptable.  We have to figure this out.

I was running at 1 S/channel, 1 task for the entire chassis, and 200 S/s rate.

Loop time was set to 1000 ms using a timer that calls a thread set to highest priority.

The program screen shot was from run 6.  the chart screen shot was from the actual test data.


Message Edited by SCXI and MS 2k3-VB.NET on 12-28-2006 04:55 PM

Message Edited by SCXI and MS 2k3-VB.NET on 12-28-2006 04:56 PM

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
Download All
0 Kudos
Message 13 of 115
(2,173 Views)
Hi Michael,

We are having difficulting running and debugging your code, primarily due to the heavy Excel involvement.  I believe that the best thing to do is for you to trim the code down as much as possible.  Ideally, having code that simply reads from all the channels and stores the values in arrays (time vs temperature).  This way, we isolate the problem and it will be much easier for us to determine what is wrong.

Thank you,
Erik
0 Kudos
Message 14 of 115
(2,155 Views)
In order to run the code, you must have a folder in the application startup path called "Data", and a folder called "Lookup Tables" with a subfolder inside that called "Tables."  Inside of the tables folder you should have Channel Configuration.xls.  Are you guys using Office 2003?  I've attached screen shots of the directorty trees..




Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
Download All
0 Kudos
Message 15 of 115
(2,152 Views)
Try this zip file.  The other one is lacking pretty much everything.  😉


Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 16 of 115
(2,151 Views)
Good Morning Michael,

We are still experiencing an error when trying to build your code: Excel.Application, Excel.Workbook, and Excel.Worksheet are undefined.  Any ideas?

Thanks!
Erik
0 Kudos
Message 17 of 115
(2,134 Views)
Michael, all,

I'm no VB expert, but here a couple of notes on the hardware that may be useful.

The 9211 is multiplexed and scans channels at 14 S/s.  If autozero is used (looks like you aren't) or the CJC is read, those count as channels.  So one channel w/o CJC can go 14 S/s, one w/ CJC can go 7 S/s, four w/o CJC 3.5 S/s, and four channels w/ CJC can go 2.8 S/s.  The hardware was designed to be very accurate, but not very fast, since temperature does not usually change quickly.  It sounds like your goal is a system with all channels sampling once per second, which should be doable under any hardware settings.

A cDAQ chassis can only execute one AI task at a time.  If you use a task per module, you will have to stop each task and start the next one in sequence, which will be quite slow, because module one's task will take at least 280 ms, followed by module two, etc., for far worse than an aggregate 1 Hz rate.

Actually, I wonder if this could be the problem.  Are you executing a single task for the entire chassis for a finite number of samples, or stopping and restarting the task every time through the loop?  Starting and stopping the task can have significant overhead, and can include acquisition of a sample, so you don't want that in your loop.  Make sure to start the task outside of your loop, read samples in the loop, and then stop the task outside the loop after it completes.  If you do this with a single task w/ 32 channels (or 40, w/ CJCs), the chassis should simultaneously acquire data on all 8 modules, and perform at or very near 3.5 S/s.

The reason the 9211 can return repeated data (unlike your E Series) is for compatibility with the much faster modules (> 100 kS/s) available in the platform.  I realize this can be confusing, but in your case (9211 only), you should be able to set sample rates in the neighborhood of 1-3 Hz and never see the repeated data.

That's one other thing--make sure you're controlling sample clock rates, not convert rate parameters that may have applied to an SCXI-based system.  CompactDAQ doesn't use a single multiplexed ADC to scan channels like an E Series or M Series connected to an SCXI chassis, and there is no chassis convert clock.

Good luck, and keep posting questions until we get things working.

Regards,
Kyle
0 Kudos
Message 18 of 115
(2,125 Views)
Are you getting a blue underlined error everywhere that "Excel" is reference?  It may have to do with the fact that your .ddls are in a different location than mine.  I had this problem also, and was instructed to go to the projet dependencies through the project explorer tree and refreshing or searching for the correct location.

Try going to project properties and looking at your references.  Remove the reference and then grab your microsoft excel object library 11.0.

"Open up solution explorer and expand your references.

Then right-click on the 'Excel' reference and choose 'Properties...'.

Then look at the 'Path' property. I think you'll find that your reference is local to your '/bin' folders. This means that you are using a local interop assembly (local IA) instead of the Primary Interop Assembly (PIA) for Excel 2003.

Excel 2003 generally will have the PIA's installed automatically, but if the Excel version is not a full install, then they will not be there. The solution is to got to the Constrol Panel > Add Remove Programs... and then find Excel or Office 2003. Finish the installation."


See this thread for details: http://www.xtremevbtalk.com/showthread.php?t=276739
Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 19 of 115
(2,130 Views)
Kyle,

I am using only one task for the entire chassis.  I started out trying to use my SCXI code which creates a new task for each module, but quickly found that it would not work well.

Should I refrain from referencing the CJC?  Will that negatively effect the quality of my data? 

I create the task when the program begins, and then call the reader object to readmultisamples within the loop.

At certain points in our test, temperature increases at up to 100 C/s.  This is why 1 Hz data is so important.

Thank you for all the information!

Message Edited by SCXI and MS 2k3-VB.NET on 01-02-2007 10:33 AM

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 20 of 115
(2,117 Views)