Home > Net >  Reads and processes in c # NI data acquisition card, in "trying to access data is unavailable&q
Reads and processes in c # NI data acquisition card, in "trying to access data is unavailable&q

Time:09-23

My program is read 14 road AI NI acquisition card data, and displays the chart on the c # interface controls, as well as six serial frequency of once per second read other sensors and display to the chart of the control interface, interface, a total of 13 chart controls, showed a total of 26 curve, refresh every seconds, deposited into a variety of data in a SQL database at the same time, the frequency of the database is to save every second 20 records,
Now the problem is:
Attempted to read samples that are no longer available. The requested sample was previously available, but has since then overwritten. Increasing the buffer size, reading the data more frequently, or specIFying a fixed number of samples to read home reading all the available samples took correct the problem.
Baidu translated: trying to read is no longer available sample, request the sample is available before, but was later coverage, increase the buffer size, more frequently read data or to specify a fixed number of to read sample, rather than read all the available sample could correct this problem,
The picture of the error message is as follows:

Combined with the test situation, found that the problem is the root of the entire program reads the NI acquisition card program at runtime, from NI reads the data acquisition card's own memory and processing, the data has been NI data acquisition card new covers, so wrong, simply be reads and processes NI data acquisition card program is running slow or late,
I use acquisition card is NI6229, working frequency is 250 ks/s, I set the NI acquisition card in the application of sampling rate is 2000, 2000 samples per second for each channel that value, a total of 14 channels, obtain the amount of data per second is 28000 samples values, namely, 28 ks/s, speed should be very safe,
Reading acquisition card used mode is a callback mode, as long as you get 2000 number produces callback interrupt, processing data,
The error is, of course, not every data collection and processing errors, it has a certain probability, you have all test channel system work, if open, about 2000-3000 seconds will go wrong for the first time, if only one road, probably more than 20000 seconds will go wrong for the first time,
The current program has been optimized as far as possible, but the problem still exists, please feel free to comment, thank you

CodePudding user response:

Then the optimization, or reduce the sampling frequency,

An effective optimization direction, is not directly contacted with the data and UI,
Data according to the sampling frequency update; The speed of the UI as it can handle to refresh,

CodePudding user response:

Don't need a database, data can be put in memory,

A simple analogy is:
1, each 50 ms update data,
2, every 2 seconds, the UI refresh time, display the current data,

CodePudding user response:

reference 1st floor github_36000833 response:
then optimization, or to reduce the sampling frequency,

An effective optimization direction, is not directly contacted with the data and UI,
Data according to the sampling frequency update; UI as it can handle the speed to refresh,


Thank you for your reply and advice, if not to directly contacted with the data and UI, it is need to put the data in the database, first show again when the database of the data, which can cause the UI shows that efficiency curve will become low, don't know what I think like this, right?
If not in the database, directly in the memory, will lead to display the data and time to not neat,
  •  Tags:  
  • C#
  • Related