LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

The Gains setup of the PID VI

Solved!
Go to solution

Hey guys,

 

I am trying to learning how to use the PID VI in LabVIEW and have programed a simple VI. Here is the problem: the output of the PID VI seems only related to the Kc in the program, and the other two values (Ti and Td) don't affect the output, for example ranging from 0.001 to 1000.

Is there anything I missed during the programming?

Thanks a lot.

0 Kudos
Message 1 of 7
(2,810 Views)

In the code you attached I don't see any value connected to the setpoint. Still lot more you need understand the PID then use it. Read the deltailed help file.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 7
(2,798 Views)

The setpoint, as defined in the help, is the setpoint value or desired value of the process. However, in my structural control study, there is no reference values to follow. I can use the PID controller in the Simulink (Matlab) with the same simulation, and I don't need to setup any setpoint. If there is no input of setpoint, there is still the default value. 

The question is how to make the outputs changed followiing the changes of Ti and Td, because only Kc now affects the outputs in the program. The relation between the change of Kc and output is seen to be proportional, which verifies the Vi working to some extent .

0 Kudos
Message 3 of 7
(2,793 Views)

You need to put your code into a loop.  Do not use the Run Continuously button - it is only useful for some specific debugging situations.  When you use "Run Continuously" it's as though you were clicking the "Run" button over and over again.  The PID VI contains the First Call? function to reinitialize the integrator and derivative on the first call.  When you run continuously, every call is the first call (because it's as though you restarted it each time) so you never get any derivative or integral action.  Note that all loops in LabVIEW that run indefinitely should have at least some small wait in them (use the Wait (ms) function).

0 Kudos
Message 4 of 7
(2,780 Views)

Yes, that makes sense. I think that's the reason why the Ti and Td don't affect the PID output.

I have a further question: can I use the while loop in CompactRIO? For example, there is acceleration measurement at every time step as input to the PID VI, and the output is the force for the actuator.

Thanks.

0 Kudos
Message 5 of 7
(2,759 Views)
Solution
Accepted by topic author Shapiro

Yes, of course you can use a loop on the cRIO - you must use a loop if you want your code to execute more than once.  Make sure that you put everything that needs to happen repeatedly (for example, the measurement function, and any front-panel controls that you update while the code is running in the development environment) inside the loop.  New LabVIEW users often put them outside the loop and then wonder why they're only read once and don't update again even though the code is still running.

0 Kudos
Message 6 of 7
(2,754 Views)

Thank you. I will try to put the code in the while loop.

0 Kudos
Message 7 of 7
(2,733 Views)