Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Case Study: Designing a PID Controller for a Second-Order System (Control Design and Simulation Module)

LabVIEW 2012 Control Design and Simulation Module Help

Edition Date: June 2012

Part Number: 371894G-01

»View Product Info

This section examines the PID Design for Second Order Continuous System VI, which determines the optimal gain values KP, KI, and KD for a proportional-integral-derivative (PID) controller in a second-order continuous dynamic system. This VI is located in the labview\examples\Control and Simulation\Simulation\Optimal Control Design directory.

The following illustration shows the block diagram of this VI.

This VI constructs a dynamic system model using the SIM Construct Default System VI. In this example, the dynamic system has only three components: a controller C, a plant G1, and a reference input signal r. The SIM Optimal Design VI excites the dynamic system with the reference input signal to determine the optimal settings for the controller.

The following transfer function equation defines the plant G1.

The following illustration shows the System Matrices control that represents this equation.

The Signal Parameters Array parameter of the SIM Construct Default System VI specifies the reference input signal r that excites this system. This example excites the dynamic system with a step input signal. The following illustration shows this parameter.

Note  Notice in the previous illustration that r is the third element, or index number 2, of the Signal Parameters Array. ru and ry correspond to the first and second elements of this array, respectively. If you define a custom dynamic system, you also can define custom reference signals beginning with the third element of this array.

The following illustration shows the Problem Specification parameter of the SIM Optimal Design VI.

The System response type parameter in the previous illustration shows this example optimizes parameters for the controller C. The Inequality constraints type parameter shows this example uses the default calculations for the inequality constraint envelopes. The Cost type parameter shows this example minimizes the linear quadratic (LQ) cost function. The following equation shows this cost function JLQ.

The Weights for cost function parameter in the previous illustration shows this example uses the following weight matrix W:

This weight matrix penalizes the control action u(t) but emphasizes that this example minimizes the position error e(t). W also reflects the difference in scale between the control action range and the output range.

The following illustration shows the Inequality Constraints parameter that defines the inequality constraints envelopes.

The upper constraint envelope on the output is a line with points (0, 1.25) and (10, 1.05). The lower constraint envelope on the output has points (0, 0), (1.5, 0), and (10, 0.95). The following illustration shows these envelopes.

The following illustration shows the constraints on the control action. The upper constraint envelope is a line with points (0, 75) and (10, 20). The lower constraint envelope is a line with points (0, –75) and (10, –25).

This example does not place inequality constraints on either the rate of control action or the rate of output.

The following illustration shows the parameter bounds this example uses for each gain parameter of the PID controller.

These bounds form the parameter space in which this example searches for optimal values.

The following illustration shows the initial parameter values this example uses. Each element of this array corresponds to the same element of the Parameter Bounds array.

This example uses an initial parameters mesh to generate two additional search locations quasi-randomly. The following illustration shows this Initial Parameters Mesh.

When you run this VI, the SQP algorithm executes once using the values from the Initial Parameters parameter. The algorithm then executes two more times, using the Initial Parameters Mesh parameter to generate two sets of initial parameter values.

The following illustration shows all three sets of initial parameter values.

The first row of the following illustration is the same as the values shown in the Initial Parameters parameter. The second and third rows contain quasirandomly-generated locations within the Parameter Bounds of each parameter.

Note  The Array of Initial Parameters parameter is on the Debug Information page of the SIM Optimal Design VI.

After the SQP algorithm executes, this VI returns all possible optimal parameter values, as shown in the following illustration.

Of the parameter value sets shown in the previous illustration, one set minimizes the LQ cost function. The SIM Optimal Design VI returns this optimal set of parameter values in the Design parameters array. The following illustration shows this array and the corresponding value of the cost function.

Therefore, the optimal gain values for KP, KI, and KD are 14.7257, 11.2553, and 0.203472, respectively.


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit