I want to output voltage first linearly increase to certain level and then keep constant, can anyone tell me how to achieve this? right now the best I can do is to output a step increasing voltage buy using a loop, the voltage changes each iterate, but the problem is the iterate time for the loop is 1s, which is too large so that the output votlage is not linear enough.
. I attached the vi. here.
You need to use a faster loop rate and smaller steps.
Look at the ramp function which can create an array for you to make up the smaller steps.
Thanks for your reply. I think you are correct, however, the problem is the loop has two DAQ assistants, one for outputing voltage one for accquring voltage, which limit the loop rate. I test the loop iterate one time take 1s. Is there any way I can reduce this time?
Why do they have to be in the same loop? They are totally independent of each other right now, so put them in separate loops.
Hi, I did as you said, putting them in two different loops, the loop rate increases a lot, now it only take 3ms to iterate once. However, I have one further question. I want to put them in the same loop because eventually I want to add a PID controller in this loop, the input of the PID controller is voltage from DAQ assistant analog input channel, after comparing with the reference voltage, the controller outputs a voltage through DAQ assistant analog output. I wonder is there any way that I can still achieve this PID control even putting the assistants in different loops?
I see, that's the culprit. So I think I can set a large "sample rate" and smaller "sample to read", but this may cause a problem which is the buffer is full after certain time and the vi. just stops to work.
Like I just set the sample rate to 1000Hz, while sample to read is 1, after less than 10s, the vi stops and an error pop up saying＂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.＂
is there any way to solve this?
You need to determine what loop rate you want to run it at. 1 sample at 1000 Hz it can't keep up. 1000 samples at 1000 Hz and the loop runs too slow making the steps very coarse. What if you ran 10 samples at 1000 Hz (100 iterations per second)?
You can still keep things in separate loops. There are other mechanisms for transferring data between loops so you can do things like feedback and PID control loops.