Showing results for 
Search instead for 
Did you mean: 

understanding FPGA DID VI

Problem understanding FPGA PID VI

The integral and derivative actions of PID do not seem to track equations shown in documentation.

Derivative – PV set using triangle wave 0 – 10 – 0 at approx. 1 Hz the derivative of PV should alternate between +20 v/s and -20 v/s. The PID output maxes out at +/- 1 when Kd is set to 128. (Kp = Ki = 0.) Based on documentation the PID output should be +/- 20 when Kd = 1, and then 20*128 = 2560 when Kd = 128. Not sure why the effective gain is so small.

Integral – The error is set by setting SP = constant = 10, and varying PV using triangle signal noted above. The error is then a triangle that varies from +10 to 0, again over ½ second. The integral, therefore, should be varying from +2.50 to -2.50 over the complete cycle.

 Issue 1: The integral effect on PID output does not change sign when error integral goes negative. It appears that there is some absolute value function that only allows positive integral action regardless of error integration.  Likewise, if Ki is set to negative number the integral PID action only goes in negative direction. This implies that as the PV crosses over the SP level the integral action will keep adding to PID output that will then drive PV further past SP.

Issue 2: Unlike the derivative effective small gain, the effective integral gain is very large. With the Ki set to the smallest number available using FP 16.8, (approx. .0039). the PID output varies from 0 – 12.5 with the actual integral varying from -2.5 to +2.5. Not sure why the effective gain is so large.

0 Kudos
Message 1 of 6

Check your units. Are you configuring the gains in the PID configuration dialog, or are you wiring in values? You'll get different results. When you enter gains into the PID configuration, it automatically normalizes them for you (and displays the results, if I remember correctly); if you wire in the gains, it assumes they're already normalized and uses them directly. The formula for normalization is in the help. One part of that normalization is inversion of the integral time to get integral gain - that is, you enter an integral time (in minutes, I think), not gain, in the dialog. A larger integral time is a slower integral response, and it sounds like that's causing some confusion for you here.

0 Kudos
Message 2 of 6

Thanks for the ideas. We are wiring the gains (Kp, Ki & Kd) and using the normalized form. The problem with the integral component is too much effective influence on PID output in direct proportion to Ki value, as oppsed to inversely proportional. For the derivative the problem is the opposite with very little PID influence, yet still proportional to Kd.

Thanks again.

0 Kudos
Message 3 of 6

Can you share any of your code? I've used the FPGA PID before without problems, although not recently. Seems like there's just some misunderstanding of how the gains work but I'm not sure where the issue is.


Have you tried a simple VI, running with the FPGA simulated so you don't need to compile, where you directly enter values for the process variable and setpoint, and show or graph the PID output? Then you can experiment with individual parameters easily, while keeping the setpoint and process variable fixed. If you can upload an image of such a graph, along with the gains and parameters you're using, it might help identify the problem.

0 Kudos
Message 4 of 6

Hi Guys, 


I am using the FPGA(PID) VI too. I ran into some issues lately.

I am streaming the Process Variable over the internet via a udp connection. My manipulated variable is supposed to be the current that is being varied from the C/AO0 of the RIO FPGA functionality.

Problem is when I run the program and I probe the global variables PV: Kinect Data and MV: Current (mA) in the top while loop, I can read the data. Not so in the PID Processing Loop.

Can anyone tell me what I am missing?



0 Kudos
Message 5 of 6

Hi Lexicondi,


What are the values that you get on the probes on the Processing Loop? did you get any errors?

I think you might find this document useful in case you haven't alreafy checked it before, it comes out with an explanation of how to set the parameters for the FPGA PID vi. I also think that it might be useful to check your variables to see if you are able to see them in other applications.


0 Kudos
Message 6 of 6