Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview with cdaq PID-Controller refrashrate 1000 Hz to slow / Error -200279

Hello everyone, 

i want to build a PID-Controller with a cdaq and the labview software,

like in this Youtube video from National instruments channel:

https://www.youtube.com/watch?v=fkbt85mBzuM&list=PLB968815D7BB78F9C&index=12

 

My problem is, that i need a faster meassurement as shown in the video.

I need to refresh the labview aplication with 1000 Hz.

I can also increase the speed of the AnalogIn modul to this rate,

ans everything works fine.

But when i used the 9263 Analog Out Modul with the pid controller, 

than i reached not higher rates than 10 times per second refrashrate. 

 

If i increase it higher, than i get after some time Problems like "buffer overflow",

because the AnalogOut Modul seems to be to slow.

 

To enclose the problem:

I connected the DAQ Assistant manager from the AnalogIn modul

directly with another DAQ Assistant manager from the AnalogOut modul.

So i want to give the meassured voltage out, as fast as possible.

 

Settings:

Analogout DAQassistant: "1 sample (on demand)"

Analogin DAQAssistant " Continuous samples", samples to read: 10, rate: 1000 Hz

 

After some seconds, i get these error:

 

 ----------------------------------------------------------------------------------------------------

RubR_0-1733227638995.png

Possible reason(s):

The application is not able to keep up with the hardware acquisition.
Increasing the buffer size, reading the data more frequently, or specifying a fixed number of samples to read instead of reading all available samples might correct the problem.

Property: RelativeTo
Corresponding Value: Current Read Position

 

 ----------------------------------------------------------------------------------------------------

 

Could some tell me, what the problem is and how i can fixe it,

to get the necessari speed?

 

best regards 

Ruben Rodermann

0 Kudos
Message 1 of 7
(163 Views)

You're not going to get a reliable 1000 Hz PID loop rate on a cDAQ system.  Using DAQ Assistants will limit you too.

 

Your 1000 Hz rate for AI is probably a sample rate that delivers data in good-sized chunks, leading to a PID loop rate noticeably less than 1000 Hz.  This is efficient for data transfer but it also *necessarily* adds latency which is typically troublesome for PID loops.

 

What are you controlling?  What kind of response bandwidth does your system have?

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 7
(145 Views)

Hello Kevin_Price,

 

we have a laser system, which is controlled by the pid conteroller.

But the analogOut voltage has to adapt in 1 ms with the pid controller.

Do you have an idea, how i can get these fast rates?

 

"

I connected the DAQ Assistant manager from the AnalogIn modul

directly with another DAQ Assistant manager from the AnalogOut modul.

So i want to give the meassured voltage out, as fast as possible."

 

Analog in works well with 1000 Hz, but not the analogOut modul (9263).

In the datasheet from the modul 9263 stants, thats 1000 Hz refrashrate is no probmel,

 

what can i do, to reach this high rates with labview?

 

Is there also another possibiulity / software to use these high refresh rates from the moduls?

 

With best regards 

Ruben- Fraunhofer ILT

0 Kudos
Message 3 of 7
(111 Views)

Hello together,

 

could please someone from the community 

sent me an example .vi to test the analogIn Modul

and it gives directly the same value to analogout modul

with 1 kHz speed? (Modul 9263 Analogout)

 

Or have someone an idea to reach the high refresh rate with

1 kHz with the Analog out 9263 modul?

 

Or have someone another idea?

 

I mean the datasheet explains: 

"100 kS/s per chanel "

So i think i should than also allowed 

to use a refrashrate with 100000 Hz. I need only 1000 Hz.

 

 

I looking forward to heraring from you guys soon!

 

with best regards 

Ruben rodermann

0 Kudos
Message 4 of 7
(98 Views)

You're not understanding a key factor.

 

For cDAQ to achieve 100kHz sample rates, it must deliver samples across the USB bus in batches.  There's a certain fixed amount of overhead associated with every negotiated USB bus access that needs to be "amortized" over a larger collection of samples.  You could not achieve sustained 100 kHz sampling if the driver only delivered 1 sample at a time.

    There's analogous overhead every time the app calls DAQmx Read so again, it's much more efficient to read samples in larger batches rather than 1 at a time.

 

However, any time you retrieve samples in bunches, you are *necessarily* building in some additional latency.  This adds difficulty and non-linearity to a software PID loop, as well as reducing your maximum control loop rate.

 

I've not done a ton of cDAQ work, but many highly experienced folks here have reached the consensus that 1000 Hz is too much to expect for 1 sample at a time acquisition and generation.  We've also reached the consensus that Windows itself won't support a reliable and regular PID loop rate of 1000 Hz.

 

You would need either an FPGA solution or at least a Real-Time OS and controller capable of that speed.  Given that you're trying to do this with DAQ Assistants now, I doubt you're ready for either of those learning curves yet.

 

Are you really sure you need a PID update rate of 1000 Hz?   What needs to be controlled at that speed?  Can you try something closer to 100 Hz, which ought to be pretty achievable (though still not perfectly regular or reliable under Windows and over USB or Ethernet).

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 5 of 7
(92 Views)

Kevin has already explained it well. The sampling rate you see in the datasheet is NOT for 1 sample software timed operation, it is for hardware timed operations where you provide it with several samples to the hardware and the hardware will guarantee that the samples are generated at the specific sampling clock rate.

 

If you need to implement PID loop at a deterministic rate, you need a FPGA based system and not cDAQ which depends on Windows computer.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 6 of 7
(79 Views)

Alternative approach- use a COTS hardware solution akin to this:

 

https://www.thinksrs.com/products/sim960.html

 

-AK2DM

 

 

 

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
Message 7 of 7
(59 Views)