![Page 1: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/1.jpg)
11
MATLAB AND CONTROLS
PRESENTED BY:-
AGILESWARI K. RAMASAMY
DR. FARRUKH HAFIZ NAGI
![Page 2: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/2.jpg)
2
Controls & MATLAB
INRTRODUCTION Control system consists of subsystems
and processes assembled for the purpose of controlling the outputs of the processes.
DC MOTOR Physical Modeling of a DC Motor Physical Modeling of a DC Motor
in STATE SPACE Designing the full-state feedback controller Bode Plot PID CONTROLLER LTIVIEW
![Page 3: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/3.jpg)
3
A common actuator in control systems is the DC motor.
It directly provides rotary motion and, coupled with wheels or drums and cables, can provide transitional motion.
Physical Modeling of a DC Motor
![Page 4: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/4.jpg)
4
The motor torque, T, is related to the armature current, i, by a constant factor Kt. The back emf, e, is related to the rotational velocity by the following equations:
e
t
Ke
iK Kt (armature constant) = Ke (motor constant).
Physical Modeling of a DC Motor
rotational speed is the output voltage is the input
![Page 5: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/5.jpg)
5
)t(KV)t(Ri)t(dt
diL
)t(Ki)t(b)t(J
Newton's law combined with Kirchoff's law:
)s(Ks)s(V)s(I)RLs(
)s(KI)s()bJs(s
The modeling equations in Laplace Transforms
e
t
Ke
iK
Physical Modeling of a DC Motor
![Page 6: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/6.jpg)
6
Open-loop transfer function
The value of the constants:- moment of inertia of the rotor (J) = 0.01 kg.m^2/s^2
damping ratio of the mechanical system (b) = 0.1 Nms electromotive force constant (K=Ke=Kt) = 0.01 Nm/Amp electric resistance (R) = 1 ohm electric inductance (L) = 0.5 H
rotational speed is the output voltage is the input
Physical Modeling of a DC Motor
2K)RLs)(bJs(
K
)s(V
)s(
)s(V
)s(s
![Page 7: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/7.jpg)
7
Motor speed design criteria based on step
input
Settling time less than 2 seconds Overshoot less than 5% Steady-state error less than 1%
Physical Modeling of a DC Motor
![Page 8: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/8.jpg)
8
MATLAB representation of Open loop transfer function is as follows:
Create a new m-file Enter the following commands in m-file:
J=0.01 %Defining constants b=0.1 K=0.01 R=1 L=0.5 num=K %Defining the numerator den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2)] %Defining
denominator step(num,den,0:0.1:3) %Obtaining the step response title('Step Response for the Open Loop System')
Physical Modeling of a DC Motor
))Kb*R()]b*L()J*R[(ss)L*J((
K
)s(V
)s(22
![Page 9: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/9.jpg)
9
Alternative MATLAB representation J=0.01; b=0.1; K=0.01; R=1; L=0.5; num=K den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2)] T=tf(num,den) %Defining transfer
function step(T,0:0.1:3) %Obtaining step response title('Step Response for the Open Loop
System') %Title of the figure
Physical Modeling of a DC Motor
![Page 10: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/10.jpg)
10
Physical Modeling of a DC Motor
When 1 volt is applied to the system, the motor can only achieve a maximum speed of 0.1 rad/sec, ten times smaller than our desired speed.
It takes the motor 3 seconds to reach its steady-state speed; this does not satisfy our 2 seconds settling time criterion.
Overshoot less than 5%Settling time less than 2 secondsSteady-state error less than 1%
![Page 11: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/11.jpg)
11
Physical Modeling of a DC Motorin STATE SPACE
DC Motor Differential Equation is represented in state-space by choosing rotational speed and
electric current as the state variables
voltage as an input rotational speed as output
)t(KV)t(Ri)t(dt
diL
)t(Ki)t(b)t(J
State space representation
DC Motor Differential Equation
DuCxy
BuAx
![Page 12: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/12.jpg)
12
Physical Modeling of a DC Motorin STATE SPACE
MATLAB representation of Open loop transfer function using the state-space equations.
Create a new m-file Enter the following commands in m-file:
J=0.01; b=0.1; K=0.01; R=1;L=0.5; A=[-b/J K/J ; -K/L -R/L] %Defining the matrix A,B,C,D B=[0 ; 1/L] C=[1 0] D=0 step(A, B, C, D) % Obtaining the step
response
![Page 13: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/13.jpg)
13
Designing the full-state feedback controller
The schematic of full state feedback system is
CxY
BuX)BKA(X
![Page 14: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/14.jpg)
14
Designing the full-state feedback controller
The characteristic polynomial for this closed-loop system is the determinant of (sI-(A-BK)).
The matrices A and B*K are both 2x2 matrices, there should be 2 poles for the system.
The two poles will be placed at -5 + i and -5-i (note that this corresponds to a zeta = 0.98 which gives 0.1% overshoot and a sigma = 5 which leads to a 1 sec settling time).
MATLAB will find the controller matrix,K using these two poles.
Settling time less than 2 seconds Overshoot less than 5% Steady-state error less than 1%
![Page 15: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/15.jpg)
15
J=0.01; b=0.1; K=0.01; R=1;L=0.5; A=[-b/J K/J ; -K/L R/L]; B=[0 ; 1/L]; C=[1 0]; D=0; p1 = -5 + i % Pole 1 p2 = -5 - i % Pole 2 K = place(A,B,[p1 p2]) % Obtaining the value for the
controller t=0:0.01:3; %Defining the time step step(A-B*K,B,C,D,1,t) %Obtaining the step response
MATLAB representation of full state feedback system .
Designing the full-state feedback controller
![Page 16: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/16.jpg)
16
Step response with K controller
Designing the full-state feedback controller
![Page 17: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/17.jpg)
17
BODE PLOT
The main idea of frequency-based design is to use the Bode plot of the open-loop transfer function to estimate the closed-loop response.
J=0.01; b=0.1; K=0.01; R=1;L=0.5; num=K; den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2)]; bode(num,den)%Obtaining the bode
plot
MATLAB representation to draw bode plot.
![Page 18: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/18.jpg)
18
A controller will be designed to satisfy the design
requirements.
The closed loop DC motor with the controller
Overshoot less than 5%Settling time less than 2 secondsSteady-state error less than 1%
PID CONTROLLER
![Page 19: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/19.jpg)
19
PID CONTROLLER
• Transfer function of PID controller:
Kp=porportional gain
KD=derivative gain
Ki=intergral gain
![Page 20: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/20.jpg)
20
PID CONTROLLER
J=0.01; b=0.1; K=0.01; R=1;L=0.5; num=K; den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2)]; Kp=100 %Defining the Proportional
constant numa=Kp*num %Obtaining the new numerator dena=den %Obtaining the denominator [numac,denac]=cloop(numa,dena) %Obtaining the num and den
of the %closed loop system t=0:0.01:5; step(numac,denac,t) title('Step response with Proportion Control')
MATLAB representation for proportional controller.
![Page 21: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/21.jpg)
21
PID CONTROLLER
J=0.01; b=0.1; K=0.01; R=1;L=0.5; num=K; den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2)]; Kp=100 %Defining the Proportional constant numa=Kp*num %Obtaining the new numerator dena=den %Obtaining the denominator T=tf(numa,dena) %Obtaining the new OL transfer
function G=feedback(T,1) %Obtaining the new CL transfer
function t=0:0.01:5; step(G,t) title('Step response with Proportion Control')
Alternative MATLAB representation for proportional controller
![Page 22: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/22.jpg)
22
PID CONTROLLER
Step response with Proportional Control
![Page 23: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/23.jpg)
23
PID CONTROLLER Derivative control – reduce overshoot Integral control – reduce steady state
J=0.01; b=0.1; K=0.01;
R=1; L=0.5; num=K;
den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2)];
Kp=100; %Defining proportional contstant
Ki=1; Kd=1; %Defining integral and derivative constant
numc=[Kd, Kp, Ki]; %Obtaining num and den of the controller
denc=[1 0];
numa=conv(num,numc) %Obtaining the num and den of the whole % system
dena=conv(den,denc)
[numac,denac]=cloop(numa,dena) %Obtaining the num and den of the closed %loop system
step(numac,denac)
title('PID Control with small Ki and Kd')
![Page 24: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/24.jpg)
24
PID CONTROLLER Derivative control – reduce overshoot Integral control – reduce steady state
J=0.01; b=0.1; K=0.01;
R=1; L=0.5; num=K;
den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2)];
Kp=100; %Defining proportional constant
Ki=1; Kd=1; %Defining integral and derivative constant
numc=[Kd, Kp, Ki]; %Obtaining num and den of the controller
denc=[1 0];
C=Tf(numc,denc) %Transfer function of the controller
P=tf(num,den) %Transfer function of the Plant
G=series(C,P) %Transfer function of the plant and controller
T=feedback(G,1) %Closed Loop transfer function
step(T)
title('PID Control with small Ki and Kd')
![Page 25: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/25.jpg)
25
PID CONTROLLER
Step response of the system with small Ki and Kd for the PID controller
![Page 26: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/26.jpg)
26
PID CONTROLLER
Increase Ki to reduce settling time Ki=200
![Page 27: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/27.jpg)
27
PID CONTROLLER
Increase Kd to reduce overshoot Kd=10 Ki=200 Kp=100
![Page 28: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/28.jpg)
28
LTIVIEW
LTIVIEW (GUI Tools)- convenient way to obtain time and frequency response plots of LTI transfer function.
Define the transfer function in the command window
Type LTIVIEW Import the function Right click on the plot and then select the
type of responses.
![Page 29: 1 MATLAB AND CONTROLS PRESENTED BY:- AGILESWARI K. RAMASAMY DR. FARRUKH HAFIZ NAGI](https://reader035.vdocument.in/reader035/viewer/2022062804/5697bf941a28abf838c9055a/html5/thumbnails/29.jpg)
2929
THE ENDTHE END