12-03-2024 06:10 AM - edited 12-03-2024 06:11 AM
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:
----------------------------------------------------------------------------------------------------
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
12-03-2024 11:33 AM
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
12-04-2024 05:17 AM
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
12-04-2024 08:26 AM
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
12-04-2024 10:05 AM - edited 12-04-2024 10:05 AM
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