Simulate Speed and position control of DC Motor in MATLAB - Matlab Simulink for E & T

Latest

Thursday, August 20, 2020

Simulate Speed and position control of DC Motor in MATLAB

Simulate Speed and position control of DC Motor in MATLAB

Simulate Speed and position control of DC Motor in MATLAB


 

For best laptop for Matlab software-  https://amzn.to/39QeZ9d

Camera- https://amzn.to/39KBi02

Professional tripod- https://amzn.to/39Jg96w

 

Design requirements for DC Motor Speed

J = moment of inertia of the rotor 0.01 kg.m^2

B = motor viscous friction constant 0.1 N.m.s

Ke = electromotive force constant 0.01 V/rad/sec

Kt = motor torque constant 0.01 N.m/Amp

R = electric resistance 1 Ohm

L = electric inductance 0.5 H


Matlab Code - 

clc          % clear the command window

clear all    % clear the workspace

close all    % close all figure window

 

% The physical parameters which used in example are:

 

J = 0.01;    % moment of inertia of the rotor

b = 0.1;     % motor viscous friction constant

K = 0.01;    % electromotive force constant

R = 1;       % electric resistance

L = 0.5;     % electric inductance

 

s = tf('s');

P_motor_tf = K/((J*s+b)*(L*s+R)+K^2);   % transfer function

A = [-b/J  K/J ;  -K/L  -R/L];

B = [0 ; 1/L];

C = [1 0];

D = 0;

% Motor State Space functuion

motor_tfss = ss(A,B,C,D)

% Linear System Analyzer for LTI system response analysis

linearSystemAnalyzer('step', P_motor_tf, 0:0.1:5);  

rP_motor = 0.1/(0.5*s+1)

Output Result - 

motor_tfss =

 

  a =

          x1     x2

   x1    -10      1

   x2  -0.02     -2

 

  b =

       u1

   x1   0

   x2   2

 

  c =

       x1  x2

   y1   1   0

 

  d =

       u1

   y1   0

 

Continuous-time state-space model.

rP_motor =

 

     0.1

  ---------

  0.5 s + 1

 

Continuous-time transfer function.

Speed and position control of DC Motor in MATLAB

Matlab Code - 

clc          % clear the command window

clear all    % clear the workspace

close all    % close all figure window

 

J = 3.2284E-6;         % moment of inertia of the rotor

b = 3.5077E-6;         % motor viscous friction constant

K = 0.0274;            % electromotive force constant

R = 4;                 % electric resistance

L = 2.75E-6;           % electric inductance

s = tf('s');

P_motor_tf = K/(s*((J*s+b)*(L*s+R)+K^2))   % transfer function

A = [0 1 0;0 -b/J K/J;0 -K/L -R/L];

B = [0 ; 0 ; 1/L];

C = [1 0 0];

D = [0];

motor_ss = ss(A,B,C,D)

%%% motor_ss = ss(P_motor);

t = 0:0.001:0.2;

figure,bode(P_motor_tf)

grid

figure,step(P_motor_tf,t)

grid

isstable(P_motor_tf)

pole(P_motor_tf)

%  Identify possible feedback data here feedback =1

sys_cl = feedback(P_motor_tf,1)

 

% if you want to only one plot then no need figure command but

% you want to more then one figure then need figure command for open the new gifure window

figure,step(sys_cl,t)

grid

figure,pzmap(sys_cl)

grid

damp(sys_cl)

[Wn,zeta,poles] = damp(sys_cl);

Mp = exp((-zeta(1)*pi)/sqrt(1-zeta(1)^2))

Ts = 4/(zeta(1)*Wn(1))

Output Result - 

P_motor_tf =

 

                    0.0274

  -------------------------------------------

  8.878e-12 s^3 + 1.291e-05 s^2 + 0.0007648 s

 

Continuous-time transfer function.

A =

   1.0e+06 *

         0    0.0000         0

         0   -0.0000    0.0085

         0   -0.0100   -1.4545

B =

   1.0e+05 *

         0

         0

    3.6364

C =

     1     0     0

D =

     0

motor_ss =

 

  a =

               x1          x2          x3

   x1           0           1           0

   x2           0      -1.087        8487

   x3           0       -9964  -1.455e+06

 

  b =

              u1

   x1          0

   x2          0

   x3  3.636e+05

 

  c =

       x1  x2  x3

   y1   1   0   0

 

  d =

       u1

   y1   0

 

Continuous-time state-space model.

ans =

     0

ans =

   1.0e+06 *

         0

   -1.4545

   -0.0001

sys_cl =

 

                         0.0274

  ----------------------------------------------------

  8.878e-12 s^3 + 1.291e-05 s^2 + 0.0007648 s + 0.0274

 

Continuous-time transfer function.

                                                                      

         Pole                              Damping         Frequency                   Time Constant 

                                                                      (rad/seconds)                 (seconds)   

                                                                      

 -2.96e+01 + 3.53e+01i     6.43e-01             4.61e+01                      3.38e-02   

 -2.96e+01 - 3.53e+01i     6.43e-01              4.61e+01                      3.38e-02   

 -1.45e+06                          1.00e+00             1.45e+06                       6.88e-07   

Wn =

   1.0e+06 *

    0.0000

    0.0000

    1.4545

zeta =

    0.6429

    0.6429

    1.0000

poles =

   1.0e+06 *

  -0.0000 + 0.0000i

  -0.0000 - 0.0000i

  -1.4545 + 0.0000i

Mp =

    0.0716

Ts =

    0.1351 


Speed and position control of DC Motor in MATLAB

Speed and position control of DC Motor in MATLAB

Speed and position control of DC Motor in MATLAB

Speed and position control of DC Motor in MATLAB


Related Post – 


For more matlab code and program

Please Like, Comment, follow our blog for new updates and Share and email subscribe for latest update

! THANK YOU !

No comments:

Post a Comment

matlabsimulinkforengineer@gmail.com

Popular Posts