Top Banner

of 63

DCM Sessoin

Apr 04, 2018

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/29/2019 DCM Sessoin

    1/63

    1

    DC Motor Speed Modeling

    Lecture delivered by:

    V SitaramGupta

    Session-3

  • 7/29/2019 DCM Sessoin

    2/63

    2

    DC Motor Speed ModelingThe DC motor has been the workhorse in industry for many reasons including good

    torque speed characteristics.

    It is a common actuator in control systems. It directly provides rotary motion and,coupled with wheels or drums and cables, can provide transitional motion.

    The electric circuit of the armature and the free body diagram of the rotor are

    shown in the following Figure.

    We develop here the transfer function of a separately excited armature controlled

    DC motor.

    MotorGenerator

    Mechanical

    energy

    (T, )

    VA

    RA IA

    VF

    RF

    LF

    IF L

    k

    Jmotor & load

    T

    Field circuit Armature circuit

  • 7/29/2019 DCM Sessoin

    3/63

    3

    Physical Parameters

    Electrical ResistanceR= 1

    Electrical InductanceL = 0.5 H

    Input Voltage V

    Electromotive Force Constant K = 0.01 nm/A

    Moment of Inertia of the RotorJ= 0.01 kg.m2/s2

    Damping Ratio of the Mechanical System b = 0.1 Nms

    Position of the Shaft

    The rotor and shaft are assumed to be rigid

    The motor torque T is related to the armature current by a constant Kt

    The back emf, e, is related to the rotational velocity

    KVRidtdiL

    KibJ

    Ke

    iKT

    e

    t

  • 7/29/2019 DCM Sessoin

    4/63

    4

    Speed Control

    Speed Control by Varying Circuit Resistance: The operating speed can only be

    adjusted downwards by varying the external resistance,Rext

    Speed Control by Varying Excitation Flux:

    Speed Control by Varying Applied Voltage: Wide range of control 25:1; fast

    acceleration of high inertia loads.

    Electronic Control.

    rad/s

    22

    a

    exta

    aa

    aaa

    mk

    RR

    k

    Va

    k

    IRV

    1

    2

    2

    1

    m

    m

  • 7/29/2019 DCM Sessoin

    5/63

    5

    Transfer Function

    2

    ))((

    )()()(

    )()()(

    KRLsbJs

    K

    V

    sKsVsIRLs

    sKIsbJss

    Controller PlantR u

  • 7/29/2019 DCM Sessoin

    6/63

    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.

    The electric circuit of the armature and the free body diagram

    of the rotor are shown in the following figure:

    6

    Physical setup and system equations

  • 7/29/2019 DCM Sessoin

    7/63

    7

    Specifications

    For this example, we will assume the following values for thephysical parameters.

    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/Ampelectric resistance (R) = 1 ohm

    electric inductance (L) = 0.5 H

    input (V): Source Voltage

    output (theta): position of shaft

    The rotor and shaft are assumed to be rigid

  • 7/29/2019 DCM Sessoin

    8/63

    8

    Modeling The motor torque, T, is related to the armature current, i, by a

    constant factor Kt. The back emf, e, is related to the rotationalvelocity by the following equations:

    In SI units (which we will use), Kt (armature constant) is equal

    to Ke (motor constant).

    From the figure above we can write the following equations based

    on Newton's law combined with Kirchhoff's law:

  • 7/29/2019 DCM Sessoin

    9/63

    9

    Transfer Function

    Using Laplace Transforms, the above modeling equations canbe expressed in terms of s.

    By eliminating I(s) we can get the following open-looptransfer function, where the rotational speed is the output and

    the voltage is the input.

  • 7/29/2019 DCM Sessoin

    10/63

    10

    State-Space

    In the state-space form, the equations above can beexpressed by choosing the rotational speed and electric

    current as the state variables and the voltage as an input.

    The output is chosen to be the rotational speed

  • 7/29/2019 DCM Sessoin

    11/63

    11

    Design Requirements

    First, our uncompensated motor can only rotate at 0.1rad/sec with an input voltage of 1 Volt (this will be

    demonstrated later when the open-loop response is

    simulated).

    Since the most basic requirement of a motor is that it

    should rotate at the desired speed, the steady-state

    error of the motor speed should be less than 1%.

  • 7/29/2019 DCM Sessoin

    12/63

    Design Requirements The other performance requirement is that the motor

    must accelerate to its steady-state speed as soon as it

    turns on.

    In this case, we want it to have a settling time of 2

    seconds. Since a speed faster than the reference maydamage the equipment, we want to have an overshoot

    of less than 5%.

    If we simulate the reference input (r) by an unit step

    input, then the motor speed output should have:

    Settling time less than 2 seconds, Overshoot less than

    5%, Steady-state error less than 1%

    12

  • 7/29/2019 DCM Sessoin

    13/63

    MATLAB Representation

    and open-loop response 1. Transfer Function We can represent the above transfer function into MATLAB by defining

    the numerator and denominator matrices as follows:

    Create a new m-file and enter the following commands:

    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)];

    motor=tf(num,den);

    13

  • 7/29/2019 DCM Sessoin

    14/63

    14

    Output Response

    Now let's see how the original open-loop system performs. Addthe following commands onto the end of the m-file and run it in

    the MATLAB command window:

    step(motor,0:0.1:3);

    title('Step Response for the Open Loop System'); The output plot is as follows:

  • 7/29/2019 DCM Sessoin

    15/63

    Output Response

    From the plot we see that when 1 volt is applied tothe system, the motor can only achieve a maximum

    speed of 0.1 rad/sec, ten times smaller than our

    desired speed.

    Also, it takes the motor 3 seconds to reach its steady-

    state speed; this does not satisfy our 2 seconds

    settling time criterion

    15

  • 7/29/2019 DCM Sessoin

    16/63

    16

    State Space 2. State-Space

    We can also represent the system using the state-space equations. Try thefollowing commands in a new 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];

    B=[0 1/L];

    C=[1 0];

    D=0;

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

    step(motor_ss)

    Run this m-file in theMATLAB command window, and

    you should get the same output as

    the one shown above.

  • 7/29/2019 DCM Sessoin

    17/63

    17

    PID Design Method for

    DC Motor Speed Control

  • 7/29/2019 DCM Sessoin

    18/63

    18

    Modeling

    From the main problem, the dynamic equations andthe open-loop transfer function of the DC Motor are

    and the system schematic looks like:

  • 7/29/2019 DCM Sessoin

    19/63

    Modeling

    For the original problem setup and the derivation of the above equations, please

    refer to the Modeling a DC Motor page.

    With a 1 rad/sec step input, the design criteria are:

    Settling time less than 2 seconds

    Overshoot less than 5%

    Steady-stage error less than 1%

    Now let's design a PID controller and add it into the system. First create a new m-

    file and type in the following commands.

    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)];

    motor=tf(num,den);19

    Recall that the transfer function for a

    PID controller is:

  • 7/29/2019 DCM Sessoin

    20/63

    Proportional control

    Let's first try using a proportional controller with a gain of

    100. To determine the closed-loop transfer function, we usethe feedback command. Add the following code to the end of

    your m-file:

    Kp=100;

    contr=Kp;

    sys_cl=feedback(contr*motor,1);

    Now let's see how the step response looks. Add the following

    to the end of your m-file, and run it in the command window:

    t=0:0.01:5;

    step(sys_cl,t)

    title('Step response with Proportional Control')

    You should get the following plot:20

  • 7/29/2019 DCM Sessoin

    21/63

    Response

    21

  • 7/29/2019 DCM Sessoin

    22/63

    PID control

    From the plot above we see that both the steady-stateerror and the overshoot are too large.

    Recall from the PID tutorial page that adding an

    integral term will eliminate the steady-state error and

    a derivative term will reduce the overshoot.

    Let's try a PID controller with small Ki and Kd.

    Change your m-file so it looks like the following.

    Running this new m-file gives you the following plot. J=0.01;

    b=0.1;

    K=0.01; 22

  • 7/29/2019 DCM Sessoin

    23/63

    Program

    R=1; L=0.5;

    num=K;

    den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2)];

    motor=tf(num,den);

    Kp=100;

    Ki=1;

    Kd=1;

    contr=tf([Kd Kp Ki],[1 0]); sys_cl=feedback(contr*motor,1);

    step(sys_cl)

    title('PID Control with small Ki and Kd')

    23

  • 7/29/2019 DCM Sessoin

    24/63

    Result

    24

  • 7/29/2019 DCM Sessoin

    25/63

    Tuning the gains

    Now the settling time is too long. Let's increase Ki toreduce the settling time. Go back to your m-file and

    change Ki to 200. Rerun the file and you should get a

    plot like this:

    25

  • 7/29/2019 DCM Sessoin

    26/63

    Gains

    Now we see that the response is much faster thanbefore, but the large Ki has worsened the transient

    response (big overshoot). Let's increase Kd to reduce

    the overshoot. Go back to the m-file and change Kd

    to 10. Rerun it and you should get this plot:

    26

    So now we know that if we use a

    PID controller with

    Kp=100,

    Ki=200,Kd=10,

    all of our design requirements

    will be satisfied.

  • 7/29/2019 DCM Sessoin

    27/63

    DC Motor Speed Modeling in Simulink

    Physical setup

    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 transitionalmotion.

    The electric circuit of the armature and the free body

    diagram of the rotor are shown in the following

    figure:

    27

  • 7/29/2019 DCM Sessoin

    28/63

    Specifications

    For this example, we will assume the following values for thephysical parameters.

    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/Ampelectric resistance (R) = 1 ohm

    electric inductance (L) = 0.5 H

    input (V): Source Voltage

    output (theta): position of shaft

    The rotor and shaft are assumed to be rigid

    28

  • 7/29/2019 DCM Sessoin

    29/63

    Modeling

    The motor torque, T, is related to the armaturecurrent, i, by a constant factor Kt.

    The back emf, e, is related to the rotational velocity by

    the following equations:

    In SI units (which we will use), Kt (armature constant)

    is equal to Ke (motor constant).

    29

  • 7/29/2019 DCM Sessoin

    30/63

    Building the Model

    This system will be modeled by summing the torquesacting on the rotor inertia and integrating the

    acceleration to give the velocity.

    Also, Kirchoff's laws will be applied to the armature

    circuit.

    Open Simulink and open a new model window.

    First, we will model the integrals of the rotational

    acceleration and of the rate of change of armaturecurrent.

    30

  • 7/29/2019 DCM Sessoin

    31/63

    Modeling

    Insert an Integrator block (from the Linear blocklibrary) and draw lines to and from its input and

    output terminals.

    Label the input line "d2/dt2(theta)" and the output

    line "d/dt(theta)" as shown below. To add such a

    label, double click in the empty space just above the

    line.

    Insert another Integrator block above the previousone and draw lines to and from its input and output

    terminals.

    Label the input line "d/dt(i)" and the output line "i"31

  • 7/29/2019 DCM Sessoin

    32/63

    Simulink

    32

  • 7/29/2019 DCM Sessoin

    33/63

    Model

    Next, we will start to model both Newton's law and Kirchoff'slaw. These laws applied to the motor system give the

    following equations:

    The angular acceleration is equal to 1/J multiplied by the sum

    of two terms (one pos., one neg.). Similarly, the derivative of

    current is equal to 1/L multiplied by the sum of three terms(one pos., two neg.).

    Insert two Gain blocks, (from the Linear block library) one

    attached to each of the integrators.

    33

  • 7/29/2019 DCM Sessoin

    34/63

    Model

    Edit the gain block corresponding to angular acceleration by

    double-clicking it and changing its value to "1/J".

    Change the label of this Gain block to "inertia" by clicking on

    the word "Gain" underneath the block.

    Similarly, edit the other Gain's value to "1/L" and it's label to

    Inductance.

    Insert two Sum blocks (from the Linear block library), one

    attached by a line to each of the Gain blocks.

    Edit the signs of the Sum block corresponding to rotation to

    "+-" since one term is positive and one is negative.

    Edit the signs of the other Sum block to "-+-" to represent the

    signs of the terms in Kirchoff's equation.

    34

  • 7/29/2019 DCM Sessoin

    35/63

    Simulink

    35

  • 7/29/2019 DCM Sessoin

    36/63

    Procedure

    Now, we will add in the torques which are represented inNewton's equation. First, we will add in the damping torque.

    Insert a gain block below the inertia block, select it by single-

    clicking on it, and select Flip from the Format menu (or type

    Ctrl-F) to flip it left-to-right. Set the gain value to "b" and rename this block to "damping".

    Tap a line (hold Ctrl while drawing) off the rotational

    integrator's output and connect it to the input of the damping

    gain block. Draw a line from the damping gain output to the negative input

    of the rotational Sum block.

    36

  • 7/29/2019 DCM Sessoin

    37/63

    Procedure

    Next, we will add in the torque from the armature. Insert a gain block attached to the positive input of

    the rotational Sum block with a line.

    Edit it's value to "K" to represent the motor constantand Label it "Kt".

    Continue drawing the line leading from the current

    integrator and connect it to the Kt gain block.

    37

  • 7/29/2019 DCM Sessoin

    38/63

    Simulink

    38

  • 7/29/2019 DCM Sessoin

    39/63

    Procedure

    Now, we will add in the voltage terms which are representedin Kirchoff's equation. First, we will add in the voltage drop

    across the coil resistance.

    Insert a gain block above the inductance block, and flip it left-

    to-right. Set the gain value to "R" and rename this block to

    "Resistance".

    Tap a line (hold Ctrl while drawing) off the current integrator's

    output and connect it to the input of the resistance gain block. Draw a line from the resistance gain output to the upper

    negative input of the current equation Sum block.

    39

  • 7/29/2019 DCM Sessoin

    40/63

    Procedure

    Next, we will add in the back emf from the motor. Insert a gain block attached to the other negative

    input of the current Sum block with a line.

    Edit it's value to "K" to represent the motor constantand Label it "Ke".

    Tap a line off the rotational integrator output and

    connect it to the Ke gain block.

    40

  • 7/29/2019 DCM Sessoin

    41/63

    Simulink

    41

  • 7/29/2019 DCM Sessoin

    42/63

    Procedure

    The third voltage term in the Kirchoff equation is the

    control input, V. We will apply a step input.

    Insert a Step block (from the Sources block library)

    and connect it with a line to the positive input of the

    current Sum block. To view the output speed, insert a Scope (from the

    Sinks block library) connected to the output of the

    rotational integrator.

    To provide a appropriate unit step input at t=0,

    double-click the Step block and set the Step Time to

    "0".42

  • 7/29/2019 DCM Sessoin

    43/63

    Simulink

    43

  • 7/29/2019 DCM Sessoin

    44/63

    Open-loop response

    To simulate this system, first, an appropriate simulation timemust be set. Select Parameters from the Simulation menu and

    enter "3" in the Stop Time field. 3 seconds is long enough to

    view the open-loop response. The physical parameters must

    now be set. Run the following commands at the

    MATLAB prompt:

    J=0.01;

    b=0.1; K=0.01;

    R=1;

    L=0.5;44

  • 7/29/2019 DCM Sessoin

    45/63

    Response

    Run the simulation (Ctrl-t or Start on the Simulation

    menu).

    When the simulation is finished, double-click on the

    scope and hit its autoscale button.

    You should see the following output.

    45

  • 7/29/2019 DCM Sessoin

    46/63

    Extracting a Linear Model into MATLAB

    A linear model of the system (in state space ortransfer function form) can be extracted from a

    Simulink model into MATLAB.

    This is done through the use of In and Out

    Connection blocks and the ATLAB function linmod.

    First, replace the Step Block and Scope Block with an

    In Connection Block and an Out Connection Block,

    respectively (these blocks can be found in theConnections block library).

    This defines the input and output of the system for the

    extraction process.46

  • 7/29/2019 DCM Sessoin

    47/63

    Simulink

    47

  • 7/29/2019 DCM Sessoin

    48/63

    Procedure

    Save your file as "motormod.mdl" (select Save Asfrom the File menu). MATLAB will extract the linear

    model from the saved model file, not from the open

    model window. At the MATLAB prompt, enter the

    following commands:

    [A,B,C,D]=linmod('motormodel')

    [num,den]=ss2tf(A,B,C,D)

    You should see the following output, providing bothstate-space and transfer function models of the

    system.

    48

  • 7/29/2019 DCM Sessoin

    49/63

    Matrix values

    A = -10.0000 1.0000-0.0200 -2.0000

    B = 0 2

    C = 1 0

    D = 0

    num = 0 0.0000 2.0000

    den = 1.0000 12.0000 20.0200

    49

  • 7/29/2019 DCM Sessoin

    50/63

    Procedure

    To verify the model extraction, we will generate anopen-loop step response of the extracted transfer

    function in MATLAB. Enter the following command

    in MATLAB.

    step(num,den);

    You should see the following plot which is equivalent

    to the Scope's output.

    50

  • 7/29/2019 DCM Sessoin

    51/63

    Response

    51

  • 7/29/2019 DCM Sessoin

    52/63

    Implementing Lag Compensator Control

    In the motor speed control root locus example a LagCompensator was designed with the following

    transfer function.

    To implement this in Simulink, we will contain the

    open-loop system from earlier in this page in a

    Subsystem block.

    Create a new model window in Simulink.

    Drag a Subsystem block from the Connections blocklibrary into your new model window.

    52

  • 7/29/2019 DCM Sessoin

    53/63

    Simulink

    53

  • 7/29/2019 DCM Sessoin

    54/63

    Procedure

    Double click on this block. You will see a blank window

    representing the contents of the subsystem (which is currentlyempty).

    Open your previously saved model of the Motor Speed

    system, motormod.mdl.

    Select Select All from the Edit menu (or Ctrl-A), and selectCopy from the Edit menu (or Ctrl-C).

    Select the blank subsystem window from your new model and

    select Paste from the Edit menu (or Ctrl-V). You should see

    your original system in this new subsystem window. Close this window. You should now see input and output

    terminals on the Subsystem block.

    Name this block "plant model".54

  • 7/29/2019 DCM Sessoin

    55/63

    Simulink

    55

  • 7/29/2019 DCM Sessoin

    56/63

    Procedure

    Now, we will insert a Lag Compensator into a closed-loop around the plant model. First, we will feed back

    the plant output.

    Draw a line extending from the plant output.

    Insert a Sum block and assign "+-" to it's inputs.

    Tap a line of the output line and draw it to the

    negative input of the Sum block.

    56

  • 7/29/2019 DCM Sessoin

    57/63

    Simulink

    57

  • 7/29/2019 DCM Sessoin

    58/63

    Procedure

    The output of the Sum block will provide the errorsignal. We will feed this into a Lag Compensator.

    Insert a Transfer Function Block after the summer

    and connect them with a line.

    Edit this block and change the Numerator field to

    "[50 50]" and the Denominator field to "[1 0.01]".

    Label this block "Lag Compensator".

    58

  • 7/29/2019 DCM Sessoin

    59/63

    Simulink

    59

    d

  • 7/29/2019 DCM Sessoin

    60/63

    Procedure

    Finally, we will apply a step input and view theoutput on a scope.

    Attach a step block to the free input of the feedback

    Sum block and attach a Scope block to the plant

    output.

    Double-click the Step block and set the Step Time to

    "0".

    60

    Si li k

  • 7/29/2019 DCM Sessoin

    61/63

    Simulink

    61

    You can download our version of the closed-loop

    system here

    Cl d l

  • 7/29/2019 DCM Sessoin

    62/63

    Closed-loop response

    To simulate this system, first, an appropriate simulation timemust be set. Select Parameters from the Simulation menu and

    enter "3" in the Stop Time field.

    The design requirements included a settling time of less than 2

    sec, so we simulate for 3 sec to view the output. The physical

    parameters must now be set. Run the following commands at

    the MATLAB prompt:

    J=0.01;

    b=0.1;

    K=0.01;

    R=1;

    L=0.5;62

    C l i

  • 7/29/2019 DCM Sessoin

    63/63

    Conclusion

    Run the simulation (Ctrl-t or Start on the Simulationmenu).

    When the simulation is finished, double-click on the

    scope and hit its autoscale button. You should see the

    following output