One of the easiest methods to tune a controller is through automatic tuning. This is the principle of control tuning using Simulink auto tune feature. Unlike root locus tuning in Matlab, control tuning using Simulink auto tune feature is very easy to do and can be done in a short duration only. However, you still need to know the plant transfer function in order to proceed to the automatic tuning. For other tuning options, click THIS.
Below is the step by step procedure for control tuning using Simulink auto tune feature.
Step 1: Open Simulink Window
Simulink environment is within Matlab. To open it, open first Matlab then look for the Simulink library and click it.
Another method is to type “Simulink” in the command window.
Below window will appear after executing either above procedures.
Step 2: Start a New Model
Under File click New then Model or follow below snapshot.
A new blank model will appear
Step 3: Start Putting Block to the New Model
On Simulink Library Browser, click Continuous then drag and drop a Transfer Fcn and PID Controller block to the new model.
Under Sink drag and drop an Oscilloscope to the model.
Under Sources, drag and drop a Step block into the model.
Under Math Operations, drag and drop a Sum block into the model.
Step 4: Arrange and Connect the Blocks
To move block, left click on the block and hold then move. To rotate a block, right click on it and go to Rotate & Flip section. To connect the blocks, move the cursor on top of the arrow on the block and left click then hold and drag to the other block’s arrow. To delete a connection, left click on the connection then press keyboard delete button.
After arrangement and connections, this must be the look of the new model.
The Step block serves as the reference. The Sum symbol is the error amplifier. The PID block is the controller we are going to design while the Transfer Fcn is the plant transfer function. The scope is use to view the output waveform.
Step 5: Change Block Parameter
Double click the Step block to change parameter. If you will not change the setting , the default will be used. Don’t worry the default is already a good setting.
Double click the Sum block. Under List of signs in the Main tab, replace the right positive sign with a negative sign. A negative sign denotes a negative feedback. Click Apply then OK.
Double click on the Transfer Fnc block and change the numerator and denominator coefficients. The numerator is the numerator of the plant transfer function while the denominator is the plant transfer function denominator.
The plant transfer function must be structured as below.
In the above transfer function, the numerator coefficient is [1 1] while the denominator is [10 -2 -1]. Take note that each number is separated with a space.
Click Apply then OK.
Your circuit must look like below if you follow above procedures.
Step 6: Control Tuning Using Simulink Auto Tune Feature
Double click the PID Controller block and on below window click on Tune button.
After clicking Tune button the PID Tuner will show.
Start tuning by moving the tuner button in red box in below figure. To move the button, left click and hold. After you get the desired response, tick the automatically update block parameters. Click Apply then OK.
Step 7: Viewing the Controller Gains
After clicking OK, below window will show. The compensator gains are listed under Proportional, Integral and Derivative regions. The compensator formula is also indicated in the upper right of the window. Click OK to close the window.
Step 8: Viewing the Simulation Result
Go to the model and click Run as below snapshot.
Right after; double click on the Scope to view the response on a Step input.
Step 9: Changing Compensator Type
What we used above is PID type compensator. You can choose any type you want. Double click the PID block then under Controller section select the compensator type on the drop down list.