Matlab- Design and develop a linear model for a DC motor - Matlab Simulink for E & T

Latest

Friday, July 31, 2020

Matlab- Design and develop a linear model for a DC motor


Matlab- Design and develop a linear model for a DC motor

Modelling a DC Motor

·In this we will figure out how to build up a linear model for a DC motor.

·How to dissect the model under MATLAB (poles and zeros, frequency response, time-domain response, etc.),

·how to design a controller

·How to simulate the open-loop and closed-loop systems in MATLAB

 

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

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

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

 

Physical System

Consider a DC motor, whose electric circuit of the armature and the single line diagram of the rotor are displayed figure below -.

Representation of the DC motor.
Representation of the DC motor.

 

ØThe rotor and the shaft are expected to be inelastic.

ØConsider the following values for the these all physical parameters:

Parameters

Values (Units)

Damping (friction) of the mechanical system (b)

= 0.1 Nms

Moment of inertia of the rotor ( J )

= 0.01 kg

Electromotive force constantK

= 0.01 Nm/A

Electric resistance (( R )

= 1 Ω

Electric inductance  ( L )  

= 0.5 H

 

Ø The input is the armature voltage V in Volts (driven by a voltage source).

Ø Measured variables are the angular velocity of the shaft ω in radians per second.

Ø Shaft angle θ in radians.

System Equations

The motor torque , T , is related to the armature current , i , by a constant factor K  :

T = Ki

The back electromotive force (emf), = Vb, is related to the angular velocity by:

From above Figure we can write the following equations established on the Newton’s law joined with the Kirchhoff’s law:


Transfer Function (tf)

Using the Laplace transform,

Equations can be written as:

J s2 θ(s) +b J s θ(s) = KI(s),

LsI(s) +RI(s) = V(s) – K s θ(s)

Where s denotes the Laplace operator.

From above equation we can express I (s):

And substitute it in and to find:


This equation for the DC motor is presented in this figure

DC Motor
DC Motor

From above equation,

The transfer function (tf) from the input voltage, V (s) , to the output angle, θ, directly follows:

it is easy to see that the transfer function from the input voltage, V (s) , to the angular velocity , ω , is:

Steps by Steps MATLAB Representation of DC motor

ØThe above transfer function can be gone into MATLAB .m file by characterizing the numerator and denominator polynomials, utilizing the shows of the MATLAB’s Control Toolbox.

ØThe coefficients of a polynomial ins.

Ø Besides, we will utilize of the function conv(A,B), which processes the product (convolution) of the polynomials A and B.

Ø Open the M-file and define all parameters and its values. It previously covers the explanation of the motor constants.

ØThe transfer function (tf) can be entered in MATLAB .m file in a number of different ways.

Ø As Ga(s) can be conveyed as Gv(s).( 1/s)

Ø we can enter these two transfer functions separately and combine them in series:

Ø Rather than utilizing convolution, the first of the over three commands can be supplanted by the product of two transfer functions.

Ø Another chance (maybe the most helpful one) is to characterize the transfer function in a representative manner.

Ø First present a framework speaking to the Laplace operator s (differentiator) and afterward enter transfer function as an algebraic articulation:

v It is advantageous label the inputs and outputs by the names of the physical variables.

v Now from the workspace, we have both the velocity (Gv) and the position (Ga) transfer functions defined in the workspace. 

Analysis

The Control System Toolbox offers a variation of functions that permit us to inspect the framework's qualities

Time-Domain and Frequency Responses

As we may need plot the reactions for the speed and angle in one figure, it helpful to set the two transfer functions into a single scheme with one input, the voltage, and two yields, the velocity and the angle: 

Alternative way is to initially change over Ga into its state-space portrayal and afterward include one additional yield being equivalent to the second state (the velocity):

Note that this augmentation of the state-space model with an additional yield must be done in one set command so as to keep the measurements reliable.

Presently, we can plot the impulse, frequency and step reactions of the motor model:

Matlab Program-


>> open the editor window in matlab (shortcut key ctrl+N)

>> write down thw following matlab code in editor window


clc

close all

close all

 

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

b = 0.1          % damping (friction) of the mechanical system in Nms)

K = 0.01         % electromotive force constant in (Nm/A)

R = 1            % electric resistance in ohm

L=0.5            % electric inductance in (H)

sys = tf(K,conv([L R],[J b]))

Gv = feedback (sys,K)

Ga = tf(1,[1 0])*Gv

sys = tf(K,[L R])*tf(1,[J b])

s = tf([1 0],1)

Gv = K/((L*s + R)*(J*s + b) + K^2)

Ga = Gv/s

Gv.InputName = 'Voltage'

Gv.OutputName = 'Velocity'

Ga.InputName = 'Voltage'

Ga.OutputName = 'Angle'

G = [Gv; Ga]

G = ss(Ga)

set(G,'c',[0 1 0; 0 0 1],'d',[0;0], 'OutputName' , { ' Velocity ' ; ' Angle ' } )

figure ;

step(G);

grid on

figure ;

impulse(G);

grid on

figure ;

bode(G);

grid on


After complete write code then save the code and run 

for run press F5 key and output show in command window

Results / output -

J =

    0.0100

b =

    0.1000

K =

    0.0100

R =

     1

L =

    0.5000

sys =

 

            0.01

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

  0.005 s^2 + 0.06 s + 0.1

 

Continuous-time transfer function.

Gv =

 

             0.01

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

  0.005 s^2 + 0.06 s + 0.1001

 

Continuous-time transfer function.

Ga =

 

               0.01

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

  0.005 s^3 + 0.06 s^2 + 0.1001 s

 

Continuous-time transfer function.

sys =

 

            0.01

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

  0.005 s^2 + 0.06 s + 0.1

 

Continuous-time transfer function.

s =

 

  s

 

Continuous-time transfer function.

Gv =

 

             0.01

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

  0.005 s^2 + 0.06 s + 0.1001

 

Continuous-time transfer function.

Ga =

 

               0.01

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

  0.005 s^3 + 0.06 s^2 + 0.1001 s

 

Continuous-time transfer function.

Gv =

 

  From input "Voltage" to output:

             0.01

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

  0.005 s^2 + 0.06 s + 0.1001

 

Continuous-time transfer function.

Gv =

 

  From input "Voltage" to output "Velocity":

             0.01

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

  0.005 s^2 + 0.06 s + 0.1001

 

Continuous-time transfer function.

Ga =

 

  From input "Voltage" to output:

               0.01

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

  0.005 s^3 + 0.06 s^2 + 0.1001 s

 

Continuous-time transfer function.

Ga =

 

  From input "Voltage" to output "Angle":

               0.01

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

  0.005 s^3 + 0.06 s^2 + 0.1001 s

 

Continuous-time transfer function.

G =

 

  From input "Voltage" to output...

                         0.01

   Velocity:  ---------------------------

              0.005 s^2 + 0.06 s + 0.1001

 

                        0.01

   Angle:  -------------------------------

           0.005 s^3 + 0.06 s^2 + 0.1001 s

 

Continuous-time transfer function.

G =

 

  a =

           x1      x2      x3

   x1     -12  -5.005       0

   x2       4       0       0

   x3       0       1       0

 

  b =

       Voltage

   x1      0.5

   x2        0

   x3        0

 

  c =

          x1  x2  x3

   Angle   0   0   1

 

  d =

          Voltage

   Angle        0

 

Continuous-time state-space model.











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