control system lab 02 - PID tuning

12
Nalan Karunanayake 1 EC 350 - Control Systems Laboratory 02 DC motor Control and PID Control Model a DC motor using the physical model approach Use SIMULINK simscape to model the electromechanical system as follows, Change PSS-converter block parameter to A (Amperes). Change Model Configuration Parameter as, Solver-> ode15s RUN the simulation and observe the current produce and comment on it Model the mechanical portion of the system as follows,

Transcript of control system lab 02 - PID tuning

Page 1: control system lab 02 - PID tuning

Nalan Karunanayake 1

EC 350 - Control Systems

Laboratory 02 – DC motor Control and PID Control

Model a DC motor using the physical model approach

Use SIMULINK simscape to model the electromechanical system as follows,

Change PSS-converter block parameter to A (Amperes).

Change Model Configuration Parameter as, Solver-> ode15s

RUN the simulation and observe the current produce and comment on it

Model the mechanical portion of the system as follows,

Page 2: control system lab 02 - PID tuning

Nalan Karunanayake 2

RE-RUN the model and observe the output current and comment on it.

Modified the simulation file as follows,

Change PSS-simulink converter 1 parameter to RPM.

RE-RUN the Simulink model again and observe the scope 1 and comment on it.

Page 3: control system lab 02 - PID tuning

Nalan Karunanayake 3

Produce translational motion as follows,

What does Wheel and Axle block do?

RE-RUN the model again and observe the scope 1 and comment on it.

Disconnect PSS Simulink converter 1 from port W of the Ideal Rotational Motion Sensor and

reconnect it with port A (change the PSS Simulink converter parameter to deg)

RE-RUN the model and observe the scope 1 and comment on it.

Change the spring rate of the Translation spring to 100 and 10, RE-RUN the model and observe

the output of the scope 1 and comment on it.

PID Control System

Introduction

Recall the open-loop transfer function of the DC Motor.

𝑃(𝑠) = ∅(𝑠)

𝑉(𝑠)=

𝐾

𝑠((𝐽𝑠 + 𝑏)(𝐿𝑠 + 𝑅) + 𝐾2)

The structure of the control system has the form shown in the figure below.

Page 4: control system lab 02 - PID tuning

Nalan Karunanayake 4

Transfer function for a PID controller has the following form.

𝐶(𝑠) = 𝐾𝑝 + 𝐾𝑖

𝑠+ 𝐾𝑑𝑠 =

𝐾𝑑𝑠2 + 𝐾𝑝𝑠 + 𝐾𝑖

𝑠

A proportional controller ( ) will have the effect of reducing the rise time and will reduce but

never eliminate the steady-state error. An integral control ( ) will have the effect of eliminating

the steady-state error for a constant or step input, but it may make the transient response slower.

A derivative control ( ) will have the effect of increasing the stability of the system, reducing the

overshoot, and improving the transient response.

The effects of each of controller parameters, , , and on a closed-loop system are

summarized as in the table below.

Parameter Rise Time Overshoot Settling Time Steady State Error

Kp Decrease Increase Small Change Decrease

Ki Decrease Increase Increase Eliminate

Kd Small Change Decrease Decrease No Change

The structure of the control system has the form shown in the figure below.

Page 5: control system lab 02 - PID tuning

Nalan Karunanayake 5

Transfer function for a PID controller has the following form.

𝐶(𝑠) = 𝐾𝑝 + 𝐾𝑖

𝑠+ 𝐾𝑑𝑠 =

𝐾𝑑𝑠2 + 𝐾𝑝𝑠 + 𝐾𝑖

𝑠

Where = Proportional gain, = Integral gain and = Derivative gain

Use below coding to directly define a PID controller in MATLAB using the transfer function:

Kp = 1;

Ki = 1;

Kd = 1;

s = tf('s');

C = Kp + Ki/s + Kd*s

Alternatively MATLAB's pid controller object can be used to generate an equivalent continuous time

controller as follows:

C = pid(Kp, Ki, Kd);

1. Proportional control

The closed-loop transfer function of a system with a proportional controller is shown below

Use Matlab to answer below questions

Page 6: control system lab 02 - PID tuning

Nalan Karunanayake 6

Questions

1.1 Draw a rough sketch of the response of the system to a step reference with different

values of Kp

1.2 Comment on the effect of increasing proportional gain on overshoot and settle time?

2. PD control

The closed-loop transfer function of the given system with a PD controller is shown below

Initially set the value of Kp = 300 and test derivative gain Kd value set to 10. Change your m-file to obtain

the step response of the above system with PD control.

Questions

2.1 Draw a rough sketch of the response of the system to a step reference with different

values of Kd.

2.2 Briefly explain the use of Proportional-Derivative Controller in a particular system?

Comment on the effect of increasing derivative gain (Kd) on overshoot and settle time?

3. PI control

The closed-loop transfer function of the given system with a PI controller is shown below

Initially set the value of Kp = 30 and test integral gain Ki value set to 70. Change your m-file to obtain the

step response of the above system with PI control.

Questions

3.1 Draw a rough sketch of the response of the system to a step reference with different

values of Ki.

3.2 Explain the effect of increasing Ki in the particular system?

Page 7: control system lab 02 - PID tuning

Nalan Karunanayake 7

4. PID control

The closed-loop transfer function of the given system with a PID controller is shown below

Now modify the above m file as = 350, = 300, and = 50 to obtain the step response of the above

system with PID control.

Questions

4.1 Draw a rough sketch of the response of the system to a step reference with different

values of Kp, Ki and Kd?

Use the Matlab command “stepinfo” to obtain the precise characteristics of the step response.

4.2 Comment on the effect of Kp, Ki and Kd parameters on the system?

PID control design with Control System Toolbox

Page 8: control system lab 02 - PID tuning

Nalan Karunanayake 8

>> pidtool(sys)

Change the controller type P, PI, PID and obtain the Step Plot and comment.

From the Show Parameters, obtain the PID gains and characteristics of the system.

Change the Response Time and Phase Margin and see what happened to the Step Plot.

Tune PID controller for a DC Motor in MATLAB SIMULINK

Consider an example of designing a PID controller for a dc motor. The model of a closed loop system

uses the new PID Controller block. This block generates a voltage signal driving the dc motor to track

desired shaft rotation speed. In addition to voltage, the dc motor subsystem takes torque disturbance as

an input, allowing us to simulate how well the controller rejects disturbances.

Open the CSlab2.slx

Page 9: control system lab 02 - PID tuning

Nalan Karunanayake 9

The PID controller is a discrete-time controller running at 0.02 seconds (the red color shows the sampling

time in the model). Let’s now look at the dialog of the PID Controller block. In the upper half of the dialog

we specified basic configuration of the PID controller: type (PID, PI, PD, P, or I), time-domain, integration

methods, and sample time. In the lower part, we specified PID controller form and gains (shown at default

values).

Block documentation provides detailed information about the block and all its parameters.

Page 10: control system lab 02 - PID tuning

Nalan Karunanayake 10

Check the scope of the PID block

PID Tuning

Our first task is to tune the PID controller. Pressing the “Tune…” button in the PID Controller block

dialog, we launch PID Tuner, which linearizes the model at the default operating point and automatically

determines PID controller gains to achieve reasonable performance and robustness based on linearized

plant model.

Page 11: control system lab 02 - PID tuning

Nalan Karunanayake 11

Update the PID Tuner

Check the PID controller values again

Page 12: control system lab 02 - PID tuning

Nalan Karunanayake 12

Then again RE-RUN the Simulink model and observe the PID scope and comment on it.

How to make the system faster?

What are the drawbacks of that method?