LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID using control design and simulation

I would like to use the control design and simulation addon to do PID. Using this tutorial

http://zone.ni.com/devzone/cda/tut/p/id/5855#toc2

 

ive been successful in doing pid control with my usb ni device. However, doing this requires (at least in the tutorial) that everything, even the components that make up the pid, to be in a simulation loop. I would prefer a single vi which stores its state, like in the PID toolkit, except i dont have this toolkit. Is this possible with the control design and simulation or must i implement pid myself?

 

0 Kudos
Message 1 of 7
(4,640 Views)

Since Control Design and Simulation Module 8.6, you can actually use a subsystem as standalone mode. This means that you can move subsystems outside the Control and Simulation Loop, as shown in the picture below. This would allow you create a controller with any features inside the simulation palette and easily integrate with your generic LabVIEW code. For more information, see our shipping documentation.

 

Let me know if you have more questions.

 

drag and drop.png

Message Edited by Barp on 04-29-2010 08:07 AM
Barp - Control, Simulation, RTT and HIL - National Instruments
Message 2 of 7
(4,614 Views)
Thanks, but im not sure what version im using, how do i tell? Its just installed on this computer, i didn't do that part. And ive tried dragging and dropping the 'integrator' and 'derivative' vis out of the control simulation loop, but it wont allow it.
0 Kudos
Message 3 of 7
(4,581 Views)
You can click on Help > About LabVIEW to view the version of LabVIEW that you have.
Andy Chang
National Instruments
LabVIEW Control Design and Simulation
0 Kudos
Message 4 of 7
(4,571 Views)
Oh, so control and design 8.6 is only for labview 8.6 and above?
0 Kudos
Message 5 of 7
(4,560 Views)

Here's the requirements for Control Design and Simulation Module 8.6

 

System Requirements

The Control Design and Simulation Module has the following requirements:

  • LabVIEW 8.6 Full or Professional Development System


You can definitely use native LabVIEW VIs to construct PID controller

 

previous_error = 0
integral = 0
start:
error = setpoint - actual_position
integral = integral + (error*dt)
derivative = (error - previous_error)/dt
output = (Kp*error) + (Ki*integral) + (Kd*derivative)
previous_error = error
wait(dt)
goto start

 

 

Andy Chang
National Instruments
LabVIEW Control Design and Simulation
Message 6 of 7
(4,558 Views)

Gordal,

 

The only function that is allowed to be moved outside the Control and Simulation Loop is the Simulation Subsystem. The other blocks (integrator, derivative, etc) are not allowed outside for now. To create a subsystem, select all the code you want to move outside and select "Edit>>Create simulation subsystem". Save it on disk and you should be able to move outside. Notice that subsystems outside can only run on fixed stepsize and you set that in its configuration.

 

If you decide to create your own PID, please keep in mind that you have to create some code to remove the windup effect on controllers. Please see the example: C:\Program Files\National Instruments\LabVIEW 8.6\examples\Control and Simulation\Simulation\PID\PID.llb\PID step response.vi which will show you the different ways to create your own PID with special features like anti-windup, filtering the derivative effect, and others.

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 7 of 7
(4,539 Views)