digital control lab islamic university of gaza eng: moayed mobaied dc motor

45
Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Upload: erika-banford

Post on 15-Dec-2015

221 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Digital Control LabIslamic University of GazaEng: Moayed Mobaied

DC MOTOR

Page 2: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

A Simple Electromagnet

Q - How do we reverse the poles of this electromagnet?

A – By reversing polarity of the battery!

Page 3: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

DC Motor Operation Principles

In a motor, the permanent magnetic field of the Stator surrounds the Armature field like shown here:

Page 4: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Brushed DC Motor components

Page 5: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

How the Commutator Works As the rotor turns, the commutator

terminals also turn and continuously reverse polarity of the current it gets from the stationary brushes attached to the battery.

Page 6: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Toy DC Motor, cont.

Page 7: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

A View of the Brushes

Page 8: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Inside the Motor, cont.

Page 9: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Inside the Motor, cont.

Page 10: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Motors Everywhere!

The fan in the microwave oven The dispose-all under the sink The washer The electric screwdriver The vacuum cleaner and the The electric toothbrush The hair dryer

Page 11: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Optical Encoders

• Relative position

- direction

- resolution

grating

light emitter

light sensor

decode circuitry

Page 12: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Ideal

Optical Encoders

mask/diffuser

grating

light emitter

light sensor

decode circuitry

Real

A diffuser tends to smooth these signals

Page 13: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Optical Encoders

• Relative position - direction

- resolution

grating

light emitter

light sensor

decode circuitry

Page 14: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Optical Encoders

• Relative position - direction

- resolution

grating

light emitter

light sensor

decode circuitry

A

B

A

B

A lags B

Page 15: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Optical Encoders

• Relative position - direction

- resolution

grating

light emitter

light sensor

decode circuitry

A

B A leads B

Phase lag between A and B is 90 degree

Page 16: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

DC Motor Speed 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 rotational velocity by the following equations:

Page 17: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

DC Motor Speed Modeling From the figure above we can write the following

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

moment of inertia of the rotor (J). damping ratio of the mechanical system (b).

* electromotive force constant (K=Ke=Kt)* electric resistance (R). * electric inductance (L)* input (V): Source Voltage* output (theta): position of shaft

Page 18: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Transfer Function By eliminating I(s) we can get the following open-loop

transfer function, where the rotational speed is the output and the voltage is the input

Page 19: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Modeling DC Motor Position

Page 20: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

PWM A pulse-width

modulated signal is a rectangular waveform with a varying duty cycle.

A longer duty cycle means the voltage is on for longer and the average voltage applied to the motor is higher and vice versa.

Will be implemented using the PWM generator on our microcontroller.

Page 21: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

H-Bridge DC motors only have two

leads. The direction it spins is determined by which terminal has power applied and which is connected to ground.

An H-bridge consists of four switches (in our case BJTs) and depending on which two are closed, allow the motor to operate in either direction

We chose to use an L298 chip from STMicroelectronics because it has two H-bridges in one package.

Page 22: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

PWM

Page 23: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Open-loop vs. Close-loop Control

Open-loop Control:

actual speed

desired dV

Motor

a

actual speed a

- compute V from the current error

d a

Closed-loop Control: using feedback

desired speed Controller solving for V(t)

V(t)

Motor

If desired speed d actual speed a,

So what?

Page 24: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Open loop dc response motor

Page 25: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

First, our uncompensated motor can only rotate at 0.1 rad/sec with

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 should be less than 1%.

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 may damage 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 secondsOvershoot less than 5%Steady-state error less than 1%

Page 26: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Simulation using Matlab

Page 27: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

The step function is one of most useful functions in Matlab for control design.

Given a system that can be described by either a transfer function or a set of state-space equations, the response to a step input can immediately be plotted.

A step input can be described as a change in the input from zero to a finite value at time t = 0. By default, the step command performs a unit step (i.e. the input goes from zero to one at time t = 0).

The basic command to use the step function is one of the following (depending if you have a set of state-space equations or a transfer function form): step(A,B,C,D) step(num,den)

Page 28: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

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)]; step (num,den,0:0.1:3)

title(‘ Step Response for the Open Loop System')

Page 29: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

From the plot we see 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 3 seconds to reach its steady-state speed; this does not satisfy our 2 seconds settling time criterion.

Page 30: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Evaluating the response

steady-state error

overshoot -- % of final value exceeded at first oscillation

rise time -- time to span from 10% to 90% of the final value

settling time -- time to reach within 2% of the final value

ss error -- difference from the system’s desired value

Page 31: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR
Page 32: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR
Page 33: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR
Page 34: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Close loop DC Motor Speed Control (analog)

Page 35: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

P Design Method for DC Motor Speed Control(analog)

Page 36: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

PD Design Method for DC Motor Speed Control(analog)

Page 37: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

PID Design Method for DC Motor Speed Control(analog)

Page 38: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Proportional controlLet's first try using a proportional controller with a gain of 100.

Kp=100; numa=Kp*num; dena=den; To determine the closed-loop transfer function, we use the cloop command. [numac,denac]=cloop(numa,dena); Note that numac and denac are the numerator and the denominator of the overall closed-loop transfer function. t=0:0.01:5; step(numac,denac,t)

title('Step response with Proportion Control')

Page 39: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

From the plot above we see that both the steady-state error and the overshoot are too large. 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.

Page 40: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

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; Ki=1; Kd=1; numc=[Kd, Kp, Ki]; denc=[1 0]; numa=conv(num,numc); dena=conv(den,denc); [numac,denac]=cloop(numa,dena); step(numac,denac) title('PID Control with small Ki and

Kd')

Page 41: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR
Page 42: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Tuning the gainsNow the settling time is too long. Let's increase Kd to reduce the settling time.

Page 43: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

Let's increase Kd to reduce the overshoot.

Page 44: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

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.

Page 45: Digital Control Lab Islamic University of Gaza Eng: Moayed Mobaied DC MOTOR

PID TuningHow to get the PID parameter values ?

(1) If the system has a known mathematical model (i.e., the transfer function), analytical methods can be used (e.g., root-locus method) to meet the transient and steady-state specs. (2) When the system dynamics are not precisely known, we must resort to experimental approaches.

Using only Proportional control, turn up the gain until the system oscillates w/o dying down, i.e., is marginally stable. Assume that K and P are the resulting gain and oscillation period, respectively.

Then, use

Ziegler-Nichols Tuning for second or higher order systems

for P control for PI control for PID control

Kp = 0.6 K

Ki = 2.0 / P

Kd = P / 8.0

Kp = 0.45 K

Ki = 1.2 / P

Kp = 0.5 K

Ziegler-Nichols Rules for Tuning PID Controller: