LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with problem using PID in FPGA

Nathan,

I have question regarding tuning PID. I would like to using Ziegler-Nichols method to tune PID. At frst stage, I set Ki and Kd to 0. I start increse the Kp until there are sustained oscilations. But the signal I received is very unstable. You can see the response in the attachment. The motor start runing after Kp = 64. Below is a table shows the relationship between duty cycle (delta) (clock tick) with output velocity (clock tick per interval)

Delta    L       R 

2000 -> 0     27 

3000 -> 44   40 

4000 -> 61   67 

5000 -> 80   85 

6000 -> 112  104 

7000 -> 120  123 

8000 -> 139  143 

9000 -> 170  161 

10000 -> 179  184 

11000 -> 199  200 

12000 -> 218 218 

 

I need an advice on how I should do with my tuning.

0 Kudos
Message 11 of 13
(910 Views)

Sorry, I don't understand your data and I don't have time to thoroughly go through your code and try to figure it out, especially since I don't have the hardware.Your data looks reasonable to me, though - it appears that as you increase Kp, the oscillations increase, and the last one looks like it's close to sustained oscillation. What is the problem? Have you tried large values of Kp than what's shown? Have you tried using the largest Kp value from your graph to calculate tuning?

 

Where did the values in the data table you show come from? If you already have the relationship between duty cycle and velocity, why do you need a PID controller?

 

Why do you refer to the duty cycle as "delta"?

0 Kudos
Message 12 of 13
(890 Views)

Nathand,

It is just my first time using PID so I am not sure if I do it correct or not. I am highly appreciate your consistent answers no matter how stupid my question is. You helped me understand a lot of thing.

 

In the lower Kp cases, the response variable looks weird to me because it is oscilate a lot then it reduce then it oscilate again. That is why I don't know what to do since it does not work like other system which is damped after a while and stable down. So I will try to increase the Kp a little bit more then working on Ki. I think I almost have a PID module now. 

 

I got the data table by turning of the PID module and setting the delta value directly. I put a case structure around the PID loop to turn it off. Then I just set the delta control value and record the reponse velocity. 

 

I mistakely called it duty cycle since actually the duty cycle = offset +/- delta. Offset is about 60000 ticks.

0 Kudos
Message 13 of 13
(878 Views)