LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID control in FPGA

Solved!
Go to solution

Hi,

New year wishes to all.

the Pid control block of FPGA(I think even in windows), LabVIEW is differentiating the Process variable instead of differentiating the error, Is that same?

 

 

Regard,

N. Madhan Kumar.

Download All
0 Kudos
Message 1 of 12
(7,790 Views)

Two pictures of equations doesn't really tell us anything about what LabVIEW is doing.

 

But think about it.

 

Error is Setpoint - Present Value.  Setpoint is constant while Present value changes in time.  So if you are differentiating the error, the result is the same as differentiating the present value.  When you differentiate a constant, it's value is zero.  so dE/dt becomes equal to dPV/dt.

0 Kudos
Message 2 of 12
(7,771 Views)
I agree with your point. but this holds good only for a static set point. I am working on a Linear time invariant system(LTI), My set point to the system is a sine wave of frequency from 1 Hz to 200 Hz, so in that case how the above explanation suits,?
0 Kudos
Message 3 of 12
(7,765 Views)
It is not the same (in the case when the setpoint changes as you have described) but there is a good reason for doing it. A step change in setpoint causes a large error derivative to become very large and this will cause a very high output at that instant - I think it's known as 'derivative kick'.

Having the derivative term act on the process variable stops step changes from causing a large output (which could make the system unstable or saturate actuators). I think you could also perhaps limit dE/dt - but you'd still get a step in the output.

If your set-point is not stepping, as you have suggested, then you may get better performance if you act on the derivative of the error as it will compensate better for the changes in the setpoint.

LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 4 of 12
(7,741 Views)
So how can i implement the correct , working PID Controller. My setpoint and process variable both are sinewave only.
0 Kudos
Message 5 of 12
(7,714 Views)
Solution
Accepted by topic author nmadhaneie

I don't have the control design / PID toolkits installed at the moment as I rarely use them nowadays but when I last did it, I ended up implementing my own. This should be a good starting point:

03-01-2014 13-47-31.png

 

It is about as basic of a parallel PID implementation as I can come up with (for Windows - hence the doubles, if on the FPGA you'll probably be using floats). You may wish to extend to allow the controller to reset (as per the LabVIEW implementation by reinitialising the shift registers).

 

I've attached the VI (LV2012).


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 6 of 12
(7,698 Views)

Sorry i had marked it as a solution accidently,

This is the Function of PID i agree, infact i am also using this same logic(with feedback node, instead of shift register, wiith SP,Output and PV inside the while loop and surely not giving a true constant to the stop button Smiley Tongue ) for windows, in the case of Fpga and Periodic waveform input I didnt find this as a good option.

 

 

0 Kudos
Message 7 of 12
(7,680 Views)
Yes - it is supposed to be a True constant to the stop button so that it executes only once before exiting. The VI I have provided is designed to be run as a SubVI at the point in your main control loop where you want your controller output to be generated.

The reason for the while loop is to allow the use of the uninitialised shift register (which has the same as a feedback node) to store the old error value and the integrated error.

Why was it not a good option? What problems are you having implementing your controller on the FPGA?

LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 8 of 12
(7,667 Views)
oh ok, now i got ur point regarding that Vi.

i m beginner in FPGA, so i m little confused about the timing to be specified for dt.

Is that same as my loop time?

And one more thing is i m using the Pid toolkit, in that they are specifying the Pid gains in terms of kp, Ti, Td.
how should i calculate the Ti, and Td if i need to use that prebuilt block?
0 Kudos
Message 9 of 12
(7,650 Views)

@nmadhaneie wrote:
I agree with your point. but this holds good only for a static set point. I am working on a Linear time invariant system(LTI), My set point to the system is a sine wave of frequency from 1 Hz to 200 Hz, so in that case how the above explanation suits,?

I think Sam's response is stated pretty well.

Generally the Setpoint is constant.  Yes it is going to occasionally change in a stepwise fashion.

 

If you are changing the setpoint continuously, then you have a completely different problem, and perhaps a PID algorithm is not the best solution for it.  But maybe the PID is going to be okay for you.  If you are dealing with a conitnually changing setpoint, that is adjusted with the proportional part of the algorithm already.  Are you sure you even need to used the derivative part of the algorithm?

 

Are you have any particular problems now using the subVI's that NI provided with LabVIEW FPGA, or is this all just a theoretical question about implementation?

0 Kudos
Message 10 of 12
(7,642 Views)