LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pid setting

Solved!
Go to solution

Hi,

I am using a pid loop to stabilise my electronic system where I am measuring voltage continuously using DAQ assistant.The setting on DAQ assistant is samples on demand.I have put my DAQ assistant and PIDin a while loop. the time taken by the loop is 2ms.The setting on my pid are Kc=0.1,Ki=0.3.The system is very slow to satbilise.However when I change dt(s)=5 or higher, then stbilisation process become rapid. I am having difficulty in understanding the function of dt(s) and the effect of while loop time(2ms) on the pid system.please anyone can help.

0 Kudos
Message 1 of 21
(5,501 Views)
Solution
Accepted by topic author khan1

You should leave the dt input unwired. It is useful only when you want don't want to run the PID in real time. For example, you might build a simulation for a system than runs faster than the real system. In that case you would set the dt input to the loop speed in the real system, even though the simulation is running faster, so that you would get identical results on the real system if it produced the same data as the simulation.

 

How did you determine the PID values? If they're just guesses, use a standard tuning method such as Ziegler-Nichols or Cohen-Coon to get reasonable initial values. The Integral value is the integral time, not gain, so if you make that value smaller you will increase the integral contribution, which is effectively what you're doing when you increase the dt time. The integral time is the amount of time required before the integral component is equal to the proportional component, assuming the system starts from 0 integral error and all other values (setpoint, process variable, gains) remain constant. Increasing dt makes the system act as though more time has passed between loop iterations, which increases the integral output. Logically, this has the same effect on the output as decreasing the integral time - both increase the integral output. However, if you change dt and the actual speed of the system changes, controller performance will be poor; if you leave dt unwired and change the integral time, then the system will automatically compensate for variations in loop speed.

Message 2 of 21
(5,477 Views)

Hello,

 

Nathand mentioned well. in addition, i would like to add more.

 

1) To measure or generate signals, use DAQmx VI instead of DAQ assitant.

2) Running the loop at 2ms will not help unless your system is capable.

3) LabVIEW PID gains are like below mentioned snippet.

 

 

PID gain values.png

 

4) PID tuning takes time because it requires many trials and experience so have patiance. Smiley Happy

 

Regards,

Bijay

 

Message 3 of 21
(5,463 Views)

Thank you very much for the detalied answer.My PI vauese are based on trail and error. I tried to use cohen coon method but the system doen't seem to satbilise.I set "I" and "D" to zero and increased P to get closer to the set value.I have attached the image of  the front panel.i measured the time period from the number of cycles over the time taken by the loop(3ms).is it correct?Then i   followed the coon cohen table to calculate the P and I values.Am i doing it correctly? 

0 Kudos
Message 4 of 21
(5,454 Views)

Hi,

 

If you provide more details about system and your code, i can help better.

 

Refer the provided snippet.

 

 

reference code.png

 

 

Regards,

Bijay

0 Kudos
Message 5 of 21
(5,446 Views)

Hi Bijay,

Thanks for the answer.I have attached my labview code to this post.I had previously tried to use this code but the system was very slow,therefore i started using DAQ assistan with samples on demand option.I am measruing two voltage inputs as you can see in the code and the diffrence and a multiplication of these two coefficient is then sent to the PID to stabilise my system.These two inputs are DC voltages.I am unsure how many samples i should i read and the sampling rate.I ant my PID system to be fast.

0 Kudos
Message 6 of 21
(5,433 Views)

@khan1 wrote:

Thank you very much for the detalied answer.My PI vauese are based on trail and error. I tried to use cohen coon method but the system doen't seem to satbilise.I set "I" and "D" to zero and increased P to get closer to the set value.I have attached the image of  the front panel.i measured the time period from the number of cycles over the time taken by the loop(3ms).is it correct?Then i   followed the coon cohen table to calculate the P and I values.Am i doing it correctly? 


This sounds more like the Ziegler-Nichols closed-loop approach than the Cohen-Coon method. In Cohen-Coon open-loop, you remove the PID controller entirely. From a stable state, you make a step change in the driving signal, then record data until the system is again stable. You then calculate PID gains based on the change in output relative to change in input, and the amount of time before the system reaches a new steady state.

 

In the Ziegler-Nichols closed-loop method, you leave the controller in place and set I and D to zero. You then gradually increase P until the system oscillates around the setpoint, as it looks like you have done. You then calculate the P, I, and D values based on the the period of oscillation and the P value that led to oscillation.

 

Which time period did you measure? You need the period of oscillation, not the loop rate. Also, the integral time is in minutes, not seconds or ms. Make sure you convert the period of oscillation to minutes before calculating the PID gains.

0 Kudos
Message 7 of 21
(5,425 Views)

Hi,

 

Its a picture only. attach code or snippet.

 

Use "get waveform components" VI instead of dynamic to dbl conversion. Avoid use of express VIs like filter and "wait untill next ms multiple" not required. 

 

Regards,

Bijay

0 Kudos
Message 8 of 21
(5,417 Views)

Hi,

Please find the attached code.Many thanks for helping me.

0 Kudos
Message 9 of 21
(5,412 Views)

That's great ... but i have LV 2010 so plz save the VI for previous version. i.e 2010

 

Regards,

Bijay

0 Kudos
Message 10 of 21
(5,407 Views)