Tutorials on the PID Optimizer Program

Dingyu Xue and Wenbin Dong

Northeastern University, P R China

E-mail: xuedingyu@mail.neu.edu.cn

กก

1. What is PID Optimizer?

PID optimizer is a MATLAB based interface which optimizes PID parameters for the plant model defined by the user.  In the package, Simulink is used in modelling the plant, which can be SISO continuous/discrete/hybrid, and linear/nonlinear of any complexity.  The optimization criteria are ITAE, ISE, IAE and others, which will be defined later in the tutorial.

One may install the package to a MATLAB directory and include the path with "File/Set Path" menu item.  Then type pid_optimizer under MATLAB prompt, the design interface will be displayed below. 

2. Meaningful Optimization Criteria

The block diagram of the controlled system is shown below.

The user may construct the plant model with Simulink.  The optimized controller parameters can be obtained by minimizing one of the following criteria

         

The ITAE criterion is recommended for a good controller.  

3. Optimization Problem Solvers and Other Specifications

The following optimization tools are used.

Plain MATLAB

Commercial Optimization Toolbox, GADS Toolbox,

Free Fminsearchbnd Toolbox, free GAOT Toolbox and PSO Toolbox. 

The free toolboxes can be downloaded from The MathWorks website, in the "MATLAB File-exchange" pages.

When the user click the "More specification" button in the main interface, the following dialog box can be shown and the user may specify further requests to the optimization process.

 

4. How to run the program?

The following procedures can be taken to design an optimum PID.

4.1 Define the plant model

The plant model can either be a linear transfer function with/without delay, or a nonlinear one described by Simulink. 

4.1.1 If the plant model is linear, for instance

                                     

one may click "Linear model" radio-button in the interface to enter the linear model, which leads to a dialog box shown below.  One may enter numerator and denominator parameters, delay constant and also specify discrete-time models with the box, then click "Apply" button. The Simulink model tf_contmodel.mdl or tf_discmodel.mdl may be established.

4.1.2 Nonlinear model

If the plant model is nonlinear, which can be either a block diagram or a math model of the form

one may model it with Simulink as shown below, and it should be noted that only one inport block and one outport block are allowed in the block diagram.  One should save the Simulink model, say test1.mdl for the system.

Then one may click the "Nonlinear model" in the main interface and fill plant model name, say pid_test1.mdl, into the following edit box, which automatically embed the model into the internal PID control block diagram.  To check the embedded, click "Show Plant" button.

4.2 Specifying useful parameters

The "Terminate time" edit box accept the final simulation time, instead of infinity in the criteria definitions.  The default value is 10.  One may also select other parameters, for instance, controller structure from the "PI/PD/PID" list, and criterion from the "ISE/ITAE/IAE/ITSE/IT^2SE" list.  One may also provide initial estimates on the controller parameters in the "Controller parameters" edit box. Also other parameters such as um in the saturation actuator, overshoot requirement, etc, which all can be done with "More specification" button, which leads to a further dialog box expressed later.

Note that, although discrete PID type controllers can be optimized as well, it is to the author's experience that the continuous controller should be optimized in the design stage.  Later in simulation and testing stage, discrete systems can be used.

4.3 Generate the objective/constraint functions

If there is no overshoot requirement, unconstrained optimization problem can be established.  Otherwise constrained optimization problem is posed.  One may click "Create ObjFun Files" button to generate automatically the relevant M-files.  One may also click "View ObjFun Files" button to open in M-editor the created files.

4.4 Getting the optimum controllers

One may click "Optimize" button to design the controller.  Meanwhile, one may click "Show Scopes" button to Visualization the whole optimization process.  When the optimized parameters are obtained, the results are shown in the "Controller parameters" edit box.  One may use the results as initial values to further optimize the parameters, if necessary.

4.5 Further investigations on the controller

In the actual optimization process, the step signals are used as the excitation signal of the system.  Once the controller is optimized, one may further investigate the performance of the controller.  For instance one may use a multi-stairs input signal to drive the system to simulation the responses.  This can be done by clicking "Multi-stair simulation" button, where a new dialog box shown below is given.  One can fill in the dialog box to specify the input signals and perform simulation of the system.

5. Demonstrative Examples

5.1 Linear plant model

Consider again the following linear plant model,

One may use the following steps to design the controller

(1) Click the "Linear model" and fill in the appeared dialog box as shown before

(2) Select PID from the list box below

(3) Click "Create ObjFun Files" to generate the objective function

(4) Click "Optimize" button to design the controller

The following design windows are given and the user may visualize the whole optimization process.

(5) The user can further investigate the system, by clicking "Multi-stairs simulation" and fill in the box with the following signals.

(6) Click "Simulate" button, the multi-stairs simulation results can be obtained as

It should be noted that the multi-stair simulation result is not satisfactory, especially that the step response from -1 to 3 is not good, due to the big step change, and the default small (-5,5) range of actuator saturation.  To solve the problem, one should do another design, for big step magnitudes. For instance, click "More specifications" button and fill in "4" to the set-point value edit box, then return to step (3) above.  A new controller can be designed and the improved multi-stair simulation results are shown below.

 

5.2 Linear non-minimum-phase plant model

Consider a non-minimum phase plant of

one can enter the model easily with the linear model dialog box given above.  Use the steps shown above, it is not likely to find suitable controller, due to poor automatic initial parameters selection. Thus evolution optimization may be useful in finding the optimum solutions.  One may select GADS Toolbox or GAOT Toolbox from "More specifications" dialog box.  Then repeat steps (3), (4) to find the optimal controller.  Please note that the require computation effort is heavier than the traditional search functions.  The optimal response and multi-stairs simulations are shown below

 

5.3 Nonlinear plant model

Use the test1.mdl model describe above.  The following procedures can be used:

(1) In the main interface, click "Nonlinear model" to load the pid_test1.mdl model

(2) Select PID controller, select a termination time of 10

(3) Generate Objective function with "Create ObjFun Files" button

(4) Start design process with "Optimize" button to find the optimal controller

กก

กก