04-28-2010 02:49 PM
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?
04-29-2010 08:05 AM - edited 04-29-2010 08:07 AM
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.
04-30-2010 02:48 PM
04-30-2010 03:55 PM
04-30-2010 04:47 PM
04-30-2010 04:53 PM
Here's the requirements for Control Design and Simulation Module 8.6
The Control Design and Simulation Module has the following requirements:
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
05-01-2010 12:49 PM
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.