You are on page 1of 41

DC Motor Introduction

A mechanically commutated electric motor powered from direct current (DC). The stator and current is stationary in space by definition. The relative angle between the stator and rotor magnetic flux is maintained near 90 degrees, (which generates the maximum torque) because of the current in the rotor is switched by the commutator is stationary in space. DC motors have a rotating armature winding (winding in which a voltage is induced) but non-rotating armature magnetic field and a static field winding (winding that produce the main magnetic flux) or permanent magnet. Different connections of the field and armature winding provide different inherent speed/torque regulation characteristics. The speed of a DC motor can be controlled by changing the voltage applied to the armature or by changing the field current. The introduction of variable resistance in the armature circuit or field circuit allowed speed control. Modern DC motors are often controlled by power electronics systems called DC drives.

Brushed Dc Motor
The brushed DC motor generates torque directly from DC power supplied to the motor by using internal commutation, stationary magnets (permanent or electromagnets), and rotating electrical magnets. Like all electric motors or generators, torque is produced by the principle of Lorentz force, any current-carrying conductor placed within an external magnetic field experiences a torque or force known as Lorentz force.

The advantages of a brushed DC motor are low initial cost high reliability simple control of motor speed Disadvantages are high maintenance low life-span for high intensity uses
1|Page

Maintenance involves regularly replacing the brushes and springs which carry the electric current, as well as cleaning or replacing the commutator. These components are necessary for transferring electrical power from outside the motor to the spinning wire windings of the rotor inside the motor. Brushes are made of conductors.

Brushless
Typical brushless DC motors use a rotating permanent magnet in the rotor, and stationary electrical current/coil magnets on the motor housing for the rotor, but the symmetrical opposite is also possible. A motor controller converts DC to AC. This design is simpler than that of brushed motors because it eliminates the complication of transferring power from outside the motor to the spinning rotor. Advantages of brushless motors are long life span little or no maintenance high efficiency Disadvantages are high initial cost more complicated motor speed controllers Some of these brushless motors are sometimes called as "synchronous motors" although they have no external power supply to be synchronized with, as would be the case with normal AC synchronous motors.

Uncommutated
Other types of DC motors require no commutation.

Homopolar motor : A homopolar motor has a magnetic field along the axis of rotation and an electric current that at some point is not parallel to the magnetic field. The name homopolar refers to the absence of polarity change. Homopolar motors necessarily have a single-turn coil, which limits them to very low voltages. This has restricted the practical application of this type of motor. Ball bearing motor A ball bearing motor is an unusual electric motor that consists of two ball bearing-type bearings, with the inner races mounted on a common conductive shaft, and the outer races connected to a high current, low voltage power supply. An alternative construction fits the outer races inside a metal tube, while the inner races are mounted on a shaft with a non-conductive section (e.g. two sleeves on an insulating rod). This method has the advantage that the tube will act as a flywheel. The direction of rotation is determined by the initial spin which is usually required to get it going.

2|Page

Connection types
There are three types of electrical connections between the stator and rotor possible for DC electric motors: series, shunt/parallel and compound (various blends of series and shunt/parallel) and each has unique speed/torque characteristics appropriate for different loading torque profiles/signatures.

Series connection
A series DC motor connects the armature and field windings in series with a common D.C. power source. The motor speed varies as a non-linear function of load torque and armature current; current is common to both the stator and rotor yielding I^2 (current) squared behavior. A series motor has very high starting torque and is commonly used for starting high inertia loads, such as trains, elevators or hoists. This speed/torque characteristic is useful in applications such as dragline excavators, where the digging tool moves rapidly when unloaded but slowly when carrying a heavy load. With no mechanical load on the series motor, the current is low, the counter-EMF produced by the field winding is weak, and so the armature must turn faster to produce sufficient counterEMF to balance the supply voltage. The motor can be damaged by over speed. This is called a runaway condition. Series motors called "universal motors" can be used on alternating current. Since the armature voltage and the field direction reverse at (substantially) the same time, torque continues to be produced in the same direction. Since the speed is not related to the line frequency, universal motors can develop higher-than-synchronous speeds, making them lighter than induction motors of the same rated mechanical output. This is a valuable characteristic for hand-held power tools. Universal motors for commercial power frequency are usually small, not more than about 1 kW output. However, much larger universal motors were used for electric locomotives, fed by special low-frequency traction power networks to avoid problems with commutation under heavy and varying loads.

Shunt connection
A shunt DC motor connects the armature and field windings in parallel or shunt with a common D.C. power source. This type of motor has good speed regulation even as the load varies, but does not have the starting torque of a series DC motor. It is typically used for industrial, adjustable speed applications, such as machine tools, winding/unwinding machines and tensioners.

Compound Connection
A compound DC motor connects the armature and fields windings in a shunt and a series combination to give it characteristics of both a shunt and a series DC motor. This motor is used when both a high starting torque and good speed regulation is needed. The motor can be connected in two arrangements: cumulatively or differentially. Cumulative compound motors
3|Page

connect the series field to aid the shunt field, which provides higher starting torque but less speed regulation. Differential compound DC motors have good speed regulation and are typically operated at constant speed.

4|Page

Torque and Speed Control of a DC Motor Introduction


A DC motor's speed and torque characteristics vary according to three different magnetization sources, separately excited field, self-excited field or permanent-field, which are used selectively to control the motor over the mechanical load's range. Self-excited field motors can be series, shunt, or compound wound connected to the armature.

Basic DC motor equations


Let

Eb = induced or counter emf (V) Ia = armature current (A) kb = counter emf equation constant kn = speed equation constant kT = torque equation constant n = armature speed (rpm) Rm = motor resistance () T = motor torque (Nm) Vm = motor input voltage (V) = machine's total flux (Wb)

Counter emf equation


The DC motor's counter emf is proportional to the product of the machine's total flux strength and armature speed: =

Voltage balance equation

The DC motor's input voltage must overcome the counter emf as well as the voltage drop created by the armature current across the motor resistance, that is, the combined resistance across the brushes, armature winding and series field winding, if any: = +

Torque equation

The DC motor's torque is proportional to the product of the armature current and the machine's total flux strength:

5|Page

Where,

= = ()

()

Speed equation
Since

We have

= + ( ) ( )

( )

Where,

( ) =

The four DC motor equations

= + = =

6|Page

Torque and speed characteristics Shunt wound motor


With the shunt wound motor's high-resistance field winding connected in parallel with the armature, Vm, Rm and are constant such that the no load to full load speed regulation is seldom more than 5%. Speed control is achieved three ways: Varying the field voltage

Field weakening Variable resistance in the field circuit.

Series wound motor


The series motor responds to increased load by slowing down; the current increases and the torque rises in proportional to the square of the current since the same current flows in both the armature and the field windings. If the motor is stalled, the current is limited only by the total resistance of the windings and the torque can be very high, but there is a danger of the windings becoming overheated. Series wound motors were widely used as traction motors in rail transport of every kind, but are being phased out in favor of power inverter-fed AC induction motors. The counter emf aids the armature resistance to limit the current through the armature. When power is first applied to a motor, the armature does not rotate, the counter emf is zero and the only factor limiting the armature current is the armature resistance. As the prospective current through the armature is very large, the need arises for an additional resistance in series with the armature to limit the current until the motor rotation can build up the counter emf. As the motor rotation builds up, the resistance is gradually cut out. The series wound DC motor's most notable characteristic is that it is almost entirely dependent on the torque required to drive the load. This suits large inertial loads as motor accelerates from maximum torque, torque reducing gradually as load increases. As the series motor's speed can be dangerously high, series motors are often geared or direct-connected to the load.

Permanent magnet motor


A permanent magnet DC motor is characterized by a linear relationship between stall torque when the torque is maximum with the shaft at standstill and no load speed with no applied shaft torque and maximum output speed. There is a quadratic power relationship between these two speed-axis points.

7|Page

DC Motor Speed System Modeling Contents:


Physical setup System equations Design requirements MATLAB representation

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 translational motion. The electric equivalent circuit of the armature and the free-body diagram of the rotor are shown in the following figure.

For this example, it is to be assumed that the input of the system is the voltage source (V) applied to the motor's armature, while the output is the rotational speed of the shaft d (theta)/dt. The rotor and shaft are assumed to be rigid. Assume this as a viscous friction model, that is, the friction torque is proportional to shaft angular velocity. The physical parameters for this example are: (J) (b) (Ke) (Kt) (R) (L) Moment of inertia of the rotor Motor viscous friction constant electromotive force constant motor torque constant Electric resistance Electric inductance 0.01 kg.m^2 0.1 N.m.s 0.01 V/rad/sec 0.01 N.m/Amp 1 Ohm 0.5 H

System equations
In general, the torque generated by a DC motor is proportional to the armature current and the strength of the magnetic field. In this example assume that the magnetic field is constant and, therefore, that the motor torque is proportional to only the armature current i by a constant factor Kt as shown in the equation below. This is referred to as an armature-controlled motor.
8|Page

= The back emf, e, is proportional to the angular velocity of the shaft by a constant factor Ke. = In SI units, the motor torque and back emf constants are equal, that is, Kt = Ke; therefore, we will use K to represent both the motor torque constant and the back emf constant. From the figure above, the following governing equations based on Newton's 2nd law and Kirchhoff's voltage law can be derived. + = + =

1. Transfer Function

Applying the Laplace transform, the above modeling equations can be expressed in terms of the Laplace variable s. ( + ) () = ()

The following open-loop transfer function is shown by eliminating I(s) between the two above equations, where the rotational speed is considered the output and the armature voltage is considered the input. () / () = = ( + )( + ) + ()

( + )() + () ()

2. State-Space

In state-space form, the governing equations above can be expressed by choosing the rotational speed and electric current as the state variables. Again the armature voltage is treated as the input and the rotational speed is chosen as the output. = + = [ ]

Design Requirements

This uncompensated motor rotates at 0.1 rad/sec in steady state for an input voltage of 1 Volt. 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 be less than 1%. Another performance requirement for this
9|Page

motor is that it must accelerate to its steady-state speed as soon as it turns on. In this case, settling time should be less than 2 seconds. Also, since a speed faster than the reference may damage the equipment, the step response should be with overshoot of less than 5%. In summary, for a unit step command in motor speed, the control system's output should meet the following requirements.

Settling time less than 2 seconds Overshoot less than 5% Steady-state error less than 1%

MATLAB Representation 1. Transfer Function


The above open-loop transfer function of the motor can be determined in MATLAB by defining the parameters and transfer function as follows. Running this code in the command window produces the output shown below. J = 0.01; b = 0.1; K = 0.01; R = 1; L = 0.5; s = tf (s); P_motor = K/ ((J*s+b) (L*s+R) +K^2)

2. State Space
The system can also be represented using the state-space equations. The following MATLAB commands create a state-space model of the motor and produce the output shown below: A= [-b/j -K/L B= [0 1/L]; C= D= [1 0; 0]; K/j -R/L];

motor_ss = ss (A,B,C,D)
10 | P a g e

motor_ss = a= x1 x1 -10 x2 1 -2

x2 -0.02

b= u1 x1 0 x2 2

c= x1 x2 y1 1 0

d= u1 y1 0

11 | P a g e

DC Motor Speed System Analysis Contents


Open-loop response LTI model characteristics Response to other types of inputs

From the main problem, the dynamic equations in the Laplace domain and the open-loop transfer function of the DC Motor are the following. ( + )() = () () ( + ) () = ()

For a 1-rad/sec step reference, the design criteria are the following.

() =

() / = ( + )( + ) + ()

Settling time less than 2 seconds Overshoot less than 5% Steady-state error less than 1%

Open Loop Response


J = 0.01; b = 0.1; K = 0.01; R = 1; L = 0.5; s = tf(s); P_motor = K/((J*s+b)(L*s+R)+K^2) Add the following ltiview command onto the end of the m-file and run it in the MATLAB command window. The string 'step' passed to the function specifies to generate a unit step response plot for the system P_motor. The range of numbers 0:0.1:5 specify that the step response plot should include data points for times from 0 to 5 seconds in steps of 0.1 seconds. The resulting plot is shown in the figure below, where some of the system's characteristics can be viewed by right clicking on the figure and choosing from the Characteristics menu such performance aspects as Settling Time and Steady State. Ltiview (step, p_ motor, 0:0.1:5);

12 | P a g e

From the plot it can be seen that 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. Also, it takes the motor 2.07 seconds to reach its steady-state speed; this does not satisfy 2 second as settling time criterion.

LTI Model Characteristics


Since open-loop transfer function has the form of a canonical second-order system, the accurate prediction of the step response characteristics observed above based on the transfer function's pole locations could be made. The location of the poles (and zeros) of the P_motor system from within the LTI Viewer can be seen by right-clicking on the plot area and selecting Plot Types > Pole/Zero from the resulting menu. Performing this action will change the LTI Viewer to the following map where the blue xs identify the locations of poles.

13 | P a g e

From the above it can be see that the open-loop transfer function has two real poles, one at s = -2 and one at s = -10. Since both poles are real, there is no oscillation in the step response (or overshoot). Furthermore, since the one pole is 5 times more negative than the other, the slower of the two poles will dominate the dynamics. That is, the pole at s = -2 primarily determines the speed of response of the system and the system behaves similarly to a first-order system. rp_motor = 0.1/(0.5*s+1)

rP_motor =

0.1 --------0.5 s + 1

Continuous-time transfer function This new model can be imported into the LTI Viewer. This is accomplished by selecting Import from the File menu at the top of the LTI Viewer window. From the resulting window choose rP_motor from the Systems in Workspace area and then click the OK button. The LTI Viewer will now show plots of both the original and the reduced transfer functions. It can then be switched back to step response plots by again choosing Plot Types from the rightclick menu. The plot annotations can be removed by right-clicking on the plot and using the Characteristics submenu. A legend can also be added by clicking the legend icon on the toolbar. Now the LTI Viewer should appear as shown below.

14 | P a g e

From the above, it can be seen that a first-order approximation of our motor system is relatively accurate. The primary difference can be seen at t = 0 where a second order system will have a derivative of zero, but our first-order model will not. With a first-order system, the settling time is equal to Where, tau is the time constant which in this case is 0.5. Therefore, our first-order model has a settling time of 2 seconds which is close to the 2.07 seconds of our actual system. =

Response to Other Types of input


While the requirements for this example are given in terms of the system's step response, it is likely that the system will in practice be subject to other types of inputs. Even so, a system's step response can give insight into how the system will respond to other types of signals. In order to determine the system's specific response to other types of inputs, Simulink or the MATLAB command lsim can be applied. Furthermore, it can be simulated by the system's response to other types of inputs straight from the LTI Viewer. This is accomplished by right-clicking on the displayed plots and choosing Plot Types > Linear Simulation.

Within this window set the End time (sec) to "5" and the Interval (sec) to "0.1". Then under the System inputs section of the window, an input signal can be imported, or one can be designed from a select set of choices. In this instance, click the Design signal button and choose a Signal type of Sine wave from within the window that appears. Then change the Frequency (Hz) to "0.2" and leave the Amplitude and Duration (secs) as their default values. Then click the Insert button at the bottom of the Signal Designer window and the Simulate button at the bottom of the Linear Simulation Tool window. The responses of our two currently identified systems to the sine wave input are then produced in the LTI Viewer window. If you double-click on the y-axis of the plot, you can then change the limits to match the figure shown below.
15 | P a g e

16 | P a g e

DC Motor Speed PID Controller Design Contents


Proportional control PID control Tuning the gains

From the main problem, the dynamic equations in the Laplace domain and the open-loop transfer function of the DC Motor are the following. ( + )() = () () ( + ) () = ()

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

() =

() / = ( + )( + ) + ()

For a 1-rad/sec step reference, the design criteria are the following.

Settling time less than 2 seconds Overshoot less than 5% Steady-state error less than 1%

The MATLAB code should be J = 0.01; b = 0.1; K = 0.01; R = 1; L = 0.5; s = tf(s); P_motor = K/((J*s+b)(L*s+R)+K^2)

17 | P a g e

Recall that the transfer function for a PID controller is: () = + + + + =

Proportional Control

First try employing a proportional controller with a gain of 100, that is, C(s) = 100. To determine the closed-loop transfer function, we use the feedback command. Kp = 100 C = pid (Kp); sys_cl = feedback (C*P_motor,1); Let's examine the closed-loop step response. The following commands should be added to the end of m-file to run it in the command window. The plot shown below must be generated. Some of the system's characteristics can be viewed by right-clicking on the figure and choosing Characteristics from the resulting menu. In the figure below, annotations have specifically been added for Settling Time, Peak Response, and Steady State. T = 0:0.1:5; step (sys_cl,t) grid title(step response with proportional control)

From the plot above both the steady-state error and the overshoot are too large. If the proportional gain Kp is increased, it will reduce the steady-state error. Increasing Kp often results
18 | P a g e

in increased overshoot, therefore, it appears that not all of the design requirements can be met with a simple proportional controller. This fact can be verified by experimenting with different values of Kp. Specifically, the SISO Design Tool can be employed by entering the command sisotool(P_motor)then opening a closedloop step response plot from the Analysis Plots tab of the Control and Estimation Tools Manager window. With the Real-Time Update box checked, it can then vary the control gain in the Compensator Editor tab and see the resulting effect on the closed-loop step response. A little experimentation verifies what we anticipated, a proportional controller is insufficient for meeting the given design requirements; derivative and/or integral terms must be added to the controller.

PID Controller
Adding an integral term will eliminate the steady-state error to a step reference and a derivative term will often reduce the overshoot. Let's try a PID controller with small Ki and Kd. Modify your m-file so that the lines defining your control are as follows. Running this new m-file gives you the plot shown below. Kp = 75; Ki = 1; Kd = 1; C = pid(Kp, Ki, Kd); sys_cl = feedback (C*P_motor, 1); step(sys_cl, [0:1:200]) title (PID Control with Small Ki and Small Kd)

Inspection of the above indicates that the steady-state error does indeed go to zero for a step input. However, the time it takes to reach steady-state is far larger than the required settling time of 2 seconds.

19 | P a g e

Tuning the Gains


In this case, the long tail on the step response graph is due to the fact that the integral gain is small and, therefore, it takes a long time for the integral action to build up and eliminate the steady-state error. This process can be sped up by increasing the value of Ki. Change Ki to 200 as in the following. Kp = 100; Ki = 200; Kd = 1; C = pid (Kp,Ki,Kd); Sys_cl = feedback (C*P_motor, 1); Step (sys_cl, 0:0.01:4) grid title(PID Control With large Ki and Small Kd)

As expected, the steady-state error is now eliminated much more quickly than before. However, the large Ki has greatly increased the overshoot. Let's increase Kd in an attempt to reduce the overshoot. Go back to the m-file and change Kd to 10 as shown in the following. Rerun your mfile and the plot shown below should be generated. Kp = 100; Ki = 200; Kd = 10; C = pid (Kp,Ki,Kd); sys_cl = feedback (C*P_motor, 1);
20 | P a g e

step(sys_cl, 0:0.01:4) grid title (PID Control with Large Ki and Large Kd)

The increased Kd reduced the resulting overshoot. If we use a PID controller with Kp = 100, Ki = 200, and Kd = 10, all of our design requirements will be satisfied.

21 | P a g e

DC Motor Speed Simulink Modeling Contents


Physical setup Building the model with Simulink Building the model with Simscape

Physical Setup
The details of the physical setup are same as in the DC Motor System Modeling section. A detailed diagram is as under

For this example, the input of the system is the voltage source (V) applied to the motor's armature, while the output is the rotational speed of the shaft d(theta)/dt. The rotor and shaft are assumed to be rigid. Furthermore assume this as a viscous friction model, that is, the friction torque is proportional to shaft angular velocity. The physical parameters for this example are: (J) (b) (Ke) (Kt) (R) (L) moment of inertia of the rotor motor viscous friction constant electromotive force constant motor torque constant electric resistance electric inductance 0.01 kg.m^2 0.1 N.m.s 0.01 V/rad/sec 0.01 N.m/Amp 1 Ohm 0.5 H

In general, the torque generated by a DC motor is proportional to the armature current and the strength of the magnetic field. In this example we will assume that the magnetic field is constant and, therefore, that the motor torque is proportional to only the armature current i by a constant factor Kt as shown in the equation below. This is referred to as an armature-controlled motor. (1) = The back emf, e, is proportional to the angular velocity of the shaft by a constant factor Ke. (2) = In SI units, the motor torque and back emf constants are equal, that is, Kt = Ke; therefore, we will use K to represent both the motor torque constant and the back emf constant.
22 | P a g e

Building the Model with Simulink


This system will be modeled by summing the torques acting on the rotor inertia and integrating the acceleration to give velocity. Also, Kirchhoffs laws will be applied to the armature circuit. First, the integrals of the rotational acceleration and of the rate of change of the armature current will be modeled. = =

To build the simulation model, open Simulink and open a new model window. Then follow the steps listed below.

Insert an Integrator block from the Simulink/Continuous library 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 below the line. Insert another Integrator block above the previous one and draw lines to and from its input and output terminals. Label the input line "d/dt(i)" and the output line "i".

Next, Newton's law and Kirchhoffs law are applied to the motor system to generate the following equations:

23 | P a g e

The angular acceleration is equal to 1 / J multiplied by the sum of two terms (one positive, one negative). Similarly, the derivative of current is equal to 1 / L multiplied by the sum of three terms (one positive, two negative). Continuing to model these equations in Simulink, follow the steps given below.

= + = +

= =

Insert two Gain blocks from the Simulink/Math Operations library, one attached to each of the integrators. 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 its label to "Inductance". Insert two Add blocks from the Simulink/Math Operations library, one attached by a line to each of the Gain blocks. Edit the signs of the Add block corresponding to rotation to "+-" since one term is positive and one is negative. Edit the signs of the other Add block to "-+-" to represent the signs of the terms in the electrical equation.

Now, the torquess which are represented in the rotational equation will be added up. First, the damping torque.
24 | P a g e

Insert a Gain block below the "Inertia" block. Next right-click on the block and select Format > Flip Block from the resulting menu to flip the block from left to right. You can also flip a selected block by holding down Ctrl-I. Set the Gain value to "b" and rename this block to "Damping". Tap a line (hold Ctrl while drawing or right-click on the line) off the rotational Integrator's output and connect it to the input of the "Damping" block. Draw a line from the "Damping" block output to the negative input of the rotational Add block. Next, torque from the armature. Insert a Gain block attached to the positive input of the rotational Add block with a line. Edit its value to "K" to represent the motor constant and Label it "Kt". Continue drawing the line leading from the current Integrator and connect it to the "Kt" block.

Now, the voltage terms which are represented in the electrical equation should be added. First, the voltage drop across the armature resistance. Insert a Gain block above the "Inductance" block and flip it from left to right. Set the Gain value to "R" and rename this block to "Resistance". Tap a line off the current Integrator's output and connect it to the input of the "Resistance" block. Draw a line from the "Resistance" block's output to the upper negative input of the current equation Add block. Next, the back emf from the motor.

Insert a Gain block attached to the other negative input of the current Add block with a line.

25 | P a g e

Edit its value to "K" to represent the motor back emf constant and Label it "Ke". Tap a line off the rotational Integrator's output and connect it to the "Ke" block. Add In1 and Out1 blocks from the Simulink/Ports & Subsystems library and respectively label them "Voltage" and "Speed". The final design should look like the example shown in the figure below.

In order to save all of these components as a single subsystem block, first select all of the blocks, then select Create Subsystem from the Edit menu. Name the subsystem "DC Motor" and then save the model.

26 | P a g e

Building the Model with Simscape


In this section, it is alternatively shown how to build the DC Motor model using the physical modeling blocks of the Simscape extension to Simulink. The blocks in the Simscape library represent actual physical components; therefore, complex multi-domain models can be built without the need to build mathematical equations from physical principles as was done above by applying Newton's laws and Kirchhoffs laws. Open a new Simulink model and insert the following blocks to represent the electrical and mechanical elements of the DC motor. Resistor, Inductor and Rotational Electromechanical Converter blocks from the Simscape/Foundation Library/Electrical/Electrical Elements library Rotational Damper and Inertia blocks from the Simscape/Foundation Library/Mechanical/Rotational Elements library Four Connection Port blocks from the Simscape/Utilities library Double-click on the Connection Port blocks to make the location of ports 1 and 2 from the Left and the location of ports 3 and 4 from the Right. Connect and label the components as shown in the following figure. You can rotate a block in a similar manner to the way you flipped blocks, that is, by right-clicking on the block then selecting Rotate Block from the Format menu.

Complete the design of the DC motor Simscape model by assigning values to the physical parameters of each of the blocks to match our assumed values. To assign the necessary values, double-click on the Resistor, Inductor, Inertia, Rotational Damper, and Rotational Electromechanical Converter blocks and enter the following parameters and associated units:

27 | P a g e

Resistance Inductance Inertia Constant of Proportionality Damping coefficient

R [Ohm] L [H] J [kg*m^2] K [V/ (rad/s)] b [N*m/ (rad/s)]

The Rotational Damper block serves to model the viscous friction of the motor. This type of friction model was chosen because it is linear. In most cases real friction is more complicated than this. If a more complicated friction model is to be added, for instance to add Coulomb friction to the model, then a Rotational Friction block from the Simscape/Foundation Library/Mechanical/Rotational Elements library can be used. Also note that in the above a DC Motor model from the individual mechanical and electrical aspects of the motor was generated. The Simscape library also includes a DC Motor block under the Simscape/SimElectronics/Actuators library. This block is used in the DC Motor Position: Simulink Modeling section. The physical parameters must now be set. The following commands at the MATLAB prompt should be added. J = 0.01; B = 0.1; K = 0.01; R = 1; L = 0.5; These values are the same ones listed in the physical setup section. These components can be saved in a single subsystem. Select all of the blocks and then choose Create Subsystem from the Edit menu. The subsystem block color by right-clicking on the block and choosing Format > Background Color can be changed from the resulting menu. This subsystem block can then be used to simulate the DC motor.

28 | P a g e

In order to simulate the response of this system it is further necessary to add sensor blocks to the model to simulate the measurement of various physical parameters and a voltage source to provide excitation to the motor. Furthermore, blocks are needed to interface Simscape blocks with tradtional Simulink blocks since the Simscape signals represent physical quantities with units, while the Simulink signals are dimensionless numbers. Add the following blocks to the model you just built to address these functions.

Current Sensor block from the Simscape/Foundation Library/Electrical/Electrical Sensors library Controlled Voltage Source block from the Simscape/Foundation/Electrical/Electrical Sources library Two PS-Simulink Converter blocks and a Solver Configuration block from the Simscape/Utilities library Electrical Reference block from the Simscape/Foundation Library/Electrical/Electrical Elements library Ideal Rotational Motion Sensor block from the Simscape/Foundation, Library/Mechanical/Mechanical Sensors library Mechanical Rotational Reference block from the Simscape/Foundation, Library/Mechanical/Rotational Elements library Three Out1 blocks and one In1 block from the Simulink/Ports & Subsystems library

The Ideal Rotational Motion Sensor block represents a device that measures the difference in angular position and angular velocity between two nodes. Here, the block to measure the position and velocity of the motor shaft as compared to a fixed reference represented by the Mechanical Rotational Reference block is employed. The Initial angle of the Rotational Motion Sensor block can be left as the default 0 radians. The Current Sensor block represents another sensor; specifically it measures the current drawn by the motor. The ground for the electrical portion of our system is defined by the Electrical
29 | P a g e

Reference block. The Controlled Voltage Source block serves as the power source for the motor where the voltage signal could be defined by connecting an input to the block. The PS-Simulink blocks convert physical signals to Simulink output signals, while the SimulinkPS block conversely converts a Simulink input signal to a physical signal. These blocks can be employed to convert the Simscape signals, which represent physical quantities with units, to Simulink signals, which don't explicitly have units attached to them. These blocks, in essence, can perform a units conversion between the physical signals and the Simulink signals. In our case, the units can be left undefined since the input and output of each of the conversion blocks have the same units. In general, the Simscape block set is employed to model the physical plant, while the Simulink block set is employed to model the controller. The Solver Configuration block is employed for defining the details of the numerical solver employed in running the Simscape simulation. Next the components must be connected and labeled so that they appear as in the figure below. Double-click on the lines which are connected to the Out1 blocks and label them "Current", "Position", and "Speed". Also double-click on the In1 block and label it "Voltage".

These components should be saved in a single subsystem with one input and three outputs. Select all of the blocks and then choose Create Subsystem from the Edit menu. Also label the subsystem and signals as shown in the following figure.

30 | P a g e

The two models generated above will behave equivalently as long as they are built using the same parameter values. The difference between them is then only the ease with which they are built and interfaced with, and how transparent they are in presenting information to the user.

DC Motor Speed; Simulink Controller Design Contents


Extracting a linear model into MATLAB Open-loop response Closed-loop response with lag compensator Closed-loop response with lead compensator

Extracting a Linear Model into MATLAB


A linear model of the system can be extracted from the Simulink model into the MATLAB workspace. This can accomplished employing the MATLAB command linmod or from directly within Simulink.

31 | P a g e

The physical parameters have to be set if they have not previously been defined in the workspace. J = 0.01; b = 0.1; K = 0.01; R = 1; L = 0.5; The inputs and outputs of the model wished to be extracted must be identified. First right-click on the signal representing the Voltage input in the Simulink model. Then choose Linearization > Input Point from the resulting menu. Similarly, right-click on the signal representing the Speed output and select Linearization > Output Point from the resulting menu. The input and output signals should now be identified on your model by arrow symbols as shown in the figure below.

32 | P a g e

In order to perform the extraction, select from the menus at the top of the model window Tools > Control Design > Linear Analysis. This will cause the Linear Analysis Tool to open. Within the Linear Analysis Tool window, the Operating Point to be linearized about can remain the default, Model Initial Condition. In order to perform the linearization, next click the Linearize button identified by the green triangle. The result of this linearization is the linsys1 object which now appears in the Linear Analysis Workspace as shown below. Furthermore, the open-loop step response of the linearized system was also generated automatically.

33 | P a g e

The reason the responses match so closely is because this Simulink model uses only linear components. This process can be used to extract linear approximations of models with nonlinear elements too. Model extraction will be further verified by looking at the model itself. The linearized model can be exported by simply dragging the object into the MATLAB Workspace. This object can then be used within MATLAB in the same manner as an object created directly from the MATLAB command line. Specifically, entering the commandzpk (linsys1) in the MATLAB command window demonstrates that the resulting model has the following form. / () = = ( + . )( + . ) s = tf(s); P_motor = K/ ((J*s+b)*(L*s+R)+K^2); zpk (P_motor)

This model matches the one generated in the DC Motor Speed: System Modeling section. This can be seen by repeating the MATLAB commands given below.

ans = 2 ------------------(s+9.997) (s+2.003) Continuous-time zero/pole/gain model.

Open Loop Response


The open-loop step response can also be generated directly within Simulink, without extracting any models to the MATLAB workspace. In order to simulate the step response, the details of the simulation must first be set. This can be accomplished by selecting Configuration Parameters from the Simulation menu. Within the resulting menu, define the length for which the simulation is to run in the Stop time field. "3" should be entered since 3 seconds will be long enough for the step response to reach steady state. Within this window various aspects of the numerical solver can be specified, but the default values should be used for this example. Next an input signal and a means for displaying the output of our simulation must be added. This is done by doing the following:

Remove the In1 and Out1 blocks. Insert a Step block from the Simulink/Sources library and connect it with a line to the Voltage input of the motor subsystem.

34 | P a g e

To view the Speed output, insert a Scope from the Simulink/Sinks library and connect it to the Speed output of the motor subsystem. To provide a appropriate unit step input at t=0, double-click the Step block and set the Step time to "0". The final model should appear as shown in the following figure.

Then run the simulation (press Ctrl-T or select Start from the Simulation menu). When the simulation is finished, double-click on the scope and hit its auto scale button. The following output should be seen.

35 | P a g e

This response is identical to that obtained by MATLAB above using the extracted model. This is again to be expected because this Simulink model includes only linear blocks.

Closed Loop Response with Lag Compensator


A lag compensator can be designed with the following transfer function. + () = + . More specifically, the steps given below should be followed:

To generate the closed-loop step response with this compensator in Simulink, begin with the "Motor_Model.mdl" file described above. The lag compensator can then be put in series with the motor subsystem and will feed back the motor's speed for comparison to a desired reference.

Remove the Input and Output ports of the model. Insert a Sum block from the Simulink/Math Operations library. Then double-click on the block and enter "|+-" for its List of signs where the symbol "|" serves as a spacer between ports of the block. Insert a Transfer Function block from the Simulink/Continuous library. Then doubleclick on the block and edit the Numerator coefficients field to "[44 44]" and the Denominator coefficients field to "[1 0.01]". Insert a Step block from the Simulink/Sources library. Then double-click on the block and set the Step time to "0". Insert a Scope block from the Simulink/Sinks library. Then connect and label the components as shown in the following figure

36 | P a g e

Then run the simulation (press Ctrl-T or select Start from the Simulation menu). When the simulation is finished, double-click on the scope and hit its auto scale button. The following output can be seen.

Closed Loop Response with Lead Compensator


It is shown in the above and in other sections of this example that the lag compensator, designed meets all of the given design requirements. Instead of a lag compensator, a lead compensator could have been designed to meet the given requirements. More specifically, a lead compensator could have been designed to achieve a similar DC gain and phase margin to that achieved by the lag compensator, but with a larger gain crossover frequency. The DC gains and phase margins are similar. So it indicates that the responses under lag and lead control would have similar amounts of error in steady state and similar amounts of overshoot. The difference in response would come in that the larger gain crossover frequency provided by the lead compensator would
37 | P a g e

make the system response faster than with the lag compensator. The following lead compensator can be used specifically. + () = + To see the precise effect of the lead compensator as compared to above lag compensator, let's modify Simulink model from above as follows:

Disconnect the Step block and Scope block from the rest of the model. Copy the blocks forming the closed-loop of the model: the Sum block, the Transfer Function block, and the DC Motor subsystem. Then paste a copy of this loop below the original blocks. Double-click on the Transfer Function block and edit the Numerator coefficients field to "[160000 5.6e6]" and the Denominator coefficients field to "[1 1035]". Insert a Mux block from the Simulink\Signal Routing library and connect the outputs of the two Motor subsystem blocks to the inputs of the Mux and connect the output of the Mux to the Scope. Connect the Step block to the Sum block of the original feedback system. Then branch off from this line and connect it to the Sum block of the lead compensated system as well. The Mux block serves to bundle the two signals into a single line, this way the Scope will plot both speed signals on the same set of axes. When you are done, your model should appear as follows.

38 | P a g e

Running the simulation and observing the output produced by the scope, it can be seen that both responses have a steady-state error that approaches zero. Zooming in on the graphs a figure like the one shown below can be generated. Comparing the two graphs, the purple response belonging to the lead compensated system has a much smaller settle time and slightly larger, but similar, overshoot as compared to the yellow response produced by the lag compensated system.

It is generally preferred that a system respond to a command quickly. Why then might we prefer to use the lag compensator even though it is slower than the lead compensator? The advantage of the lag compensator in this case is that by responding more slowly it requires less control effort than the lead compensator. Less control effort means that less power is consumed and that the various components can be sized smaller since they do not have to supply as much energy or withstand the higher voltages and current required of the lead compensator. This simulation can now be modified to explicitly for observing the control effort requirements of the two feedback systems. This can be done by sending various signals to the workspace for plotting and further manipulation if desired. Specifically, delete the Scope and Mux blocks from the Simulink model. Then insert four To Workspace blocks from the Simulink\Sinks library. Double-click on each of the blocks and change their Save format from Structure to Array. A Variable name can also be specified within each block. The blocks can then be connected to the existing model and label them as shown below.

39 | P a g e

Then change the simulation stop time to 1 second and run the model. The act of running the simulation will send to the MATLAB workspace a series of arrays corresponding to the variables set-up in your model with the To Workspace blocks. Furthermore, the time vector used by that run of the simulation is stored in the default variable tout. You can now plot the results of your simulation from the workspace. Enter the following code to see how to specifically plot the control effort variables. subplot(2,1,1) plot(tout,ulag); xlabel(time (seconds)) ylabel(control effort (volts)) title(Control Effort Under Lag Compensation) subplot(2,1,2) plot(tout,ulead); xlabel(time (seconds)) ylabel(control effort (volts)) titlt(Control Effort Under Lead Compensation)

40 | P a g e

Examination of the above shows that the control effort required by the lead compensator is above 150,000 Volts, which is well above anything that could be supplied or withstood by a typical DC motor. This exemplifies the tradeoff inherent between achieving small tracking error and keeping the amount of control effort required small. Optimal control techniques have been developed to achieve an optimal balance between competing goals.

41 | P a g e

You might also like