1. Trang chủ
  2. » Công Nghệ Thông Tin

control example using matlab

37 144 1

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 37
Dung lượng 3,9 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

• The window that has opened is the Simulink – It is used to choose various Simulink modules to use in your simulation.. • We choose components from the library browser, and then drag t

Trang 1

Control Example using Matlab

Cruise Control

Trang 2

Modeling a Cruise Control System

• The inertia of the wheels is

Physical setup and system equations

• The problem is reduced to the simple mass and damper system

• It is assumed that friction is opposing the motion of the car

–is proportional to the car's speed

Trang 3

Modeling a Cruise Control System

• Using Newton's law, the dynamic equation for this system is:

u b

m x• + x• =

where u is the force from the engine.

• There are several different ways to describe a system of linear differential equations.

• To calculate the Transfer Function, we shall use the Stare Space representation then transform it to TF using ss2tf

Trang 4

State-space equations

• The state-space representation is

given by the equations:

where

is an n by 1 vector representing the state

(commonly position and velocity variables in mechanical systems),

u is a scalar representing the input

(commonly a force or torque in mechanical systems), and

y is a scalar representing the output

DuC

y

Bu

Adt

d

x

x x

Trang 5

State Equation for our CC model

The state vector is [ x, ] and y is x→ x• x•

The equation

um

1m

m x• + x• =

or

[ 0 1 ] x [ ] 0 u y

u m 1

0 x

m

b 0

1 0

x

x x

Trang 6

– Rise time < 5 sec

Overshoot < 10%

Steady state error < 2%

Trang 7

Matlab representation and open-loop response

Trang 8

• Next, close the loop and add some proportional control

to see if the response can be improved

Trang 9

Get the Transfer Function

• For

m = 1000; b = 50; u = 500; A = [0 1; 0 -b/m] B = [0; 1/m] C = [0 1] D = 0[num,den]= ss2tf (A,B,C,D)

• Matlab should return the following to the command window:

num =

0 0.0010 0 den =

1.0000 0.0500 0

• This is the way Matlab presents the TF

0.001s + 0 - s^2 + 0.05s + 0

Trang 10

• A step input can be described as a change in the

• 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)

Trang 11

P controller

• The steady state error is more than 10%,

and the rise time is still too slow

• Adjust the proportional gain to make the

response better

 but you will not be able to make

the steady state value go to 10m/sec

without getting rise times that are too

Trang 12

P controller

• The solution to this problem is to add some

integral control to eliminate the steady state error

• Adjust k until you get a reasonable rise time

– For example, with k = 600, the response should now look like:

Trang 13

PI controller

k = 600;

ki = 1; % small to get feeling for integral response

num1 = [k ki]; % PI has two gains

Trang 14

PI controller

• Now you can

adjust the ki value

the response looks

like the following:

As you can see, this step

response meets all of the

design criteria, and

therefore no more iteration

is needed

It is also noteworthy that

no derivative control was

needed in this example

Trang 15

Modeling a Cruise Control System

• ךוכיחה חוכ תוחפ עינמה חוכל הווש היצרניאה חוכ

Physical setup and system equations

Let’s now add Drag and assume the friction to be non velocity

dependent (the static friction, proportional to normal force).

) ( )

(

)

t Bv t

Cu dt

t

dv

) ( )

(

0 ≤ u t

:רשאכו

Trang 16

ב תכרעמ תינב Simulink

0

- ל 1

- ב שמתשהל יאדכ ןכל ,

Saturation

Trang 17

Very Short Simulink Tutorial

• In the Matlab command window write simulink

• The window that has opened is the Simulink

– It is used to choose various Simulink modules to use in your simulation

• From this window, choose the File menu , and then

New (Model).

– Now we have a blank window, in which we will build our model

– This blank window and the library browser window, will be the

windows we’ll work with

• We choose components from the library browser, and then drag them to our work window

– We’ll use only the Simulink library (also called toolbox) for now

Trang 18

Simulink Tutorial

As we can see, the Simulink library is divided into several

categories:

1 Continuous – Provides functions for continuous

time, such as integration, derivative, etc.

2 Discrete – Provides functions for discrete time.

3 Funcitons & Tables – Just what the name says.

4 Math – Simple math functions.

5 Nonlinear – Several non-linear functions, such as

switches, limiters, etc.

6 Signals & Systems – Components that work

with signals Pay attention to the mux/demux

7 Sinks – Components that handle the outputs of the

system (e.g display it on the screen).

8 Sources – Components that generate source signals

for the system.

Trang 19

Simulink Tutorial: First simulation

• Drag the Constant component

from the Simulink library

(Sources) to the work window,

and then drag the Scope

module (Sinks) in the same

manner.

• Now, click the little triangle

(output port) to the right of the

Constant module, and while

holding the mouse button

down, drag the mouse to the

left side of the scope (input

port) and then release it You

should see a pointed arrow

being drawn.

• Double click the Constant module to open its dialog window

• Now you can change this module’s parameters

• Change the constant value to 5

Trang 20

Simulink Tutorial: First simulation

• Double-click the scope to view its window

• You can choose Simulation

Parameters … from the Simulation to

change the time limits for your simulation

• Choose Start from the Simulation menu

(or press Ctrl+T, or click the play button

on the toolbar) to start the simulation

Trang 21

Simulink Tutorial: First simulation

• Choose Start from the Simulation menu

(or press Ctrl+T, or click the play button

on the toolbar) to start the simulation

• Now this is a rather silly simulation All

it does is output the constant value 5 to the

graph (the x-axis represents the simulation

time)

• Right-click on the scope’s graph window

and choose Autoscale to get the following

result:

Trang 22

Simulink Tutorial

• Now let’s try something a

little bit more complicated

• First, build the following

system (you can find the

Clock module in the Sinks

category

• The Trigonometric Function

and Sum modules reside in

the Math category):

Trang 23

Simulink Tutorial

• Now, let’s see if the

derivative is really a

cosine

• Build the following

system (the Derivative

module is located in the

Continuous category):

We can see that this is indeed a cosine, but something is wrong

at the beginning

Trang 24

– so at the first time step , the

derivative assumes that its

input has a constant value

(and so the derivative is 0 ).

Trang 25

A ′ = ⋅

• How can we solve this numerically using Simulink?

5

0

0 =

A

We’ll notice 2 simple facts:

1 If we have A, then we have A' (multiplication).

2 If we have A', then we have A (integration).

We can get out of this loop by using the initial condition We know

that A0 = 0.5, so now we can calculate A' and then recalculate the new A, and so on

Trang 26

• Note that pressing

ctrl when clicking the

mouse button on a

line, allows you to

split it into 2 lines :

• Set the simulation stop time to

3.5 seconds

–the solution goes to infinity

• and see the results in the scope:

Trang 27

ב תכרעמ תינב

Simulink Automatic Cruise Control

0

- ל 1

- ב שמתשהל יאדכ ןכל ,

Saturation

Trang 28

Automatic Cruise Control

בכרה לש היצלומיסה תא הנבנ )

plant

(

Trang 29

Automatic Cruise Control

Trang 30

Automatic Cruise Control

• הלחתהה יאנת רובע

היוצר תוריהמו

,

תכרעמה תוגהנתה תא ןחב

– רקב םע P

, רקב םע I

רקב םעו PI

.( דרפנב הרקמ לכ )

– הרעה

: תויהל הרומא היוצר הבוגת :

הריהמ ) לש ילמיסקמ ךרע - t

" " (

ךרעה לעמ ידמ הלעי אל

דימתמ בצמב שרדנה ( ןתינש לככ הנטק ספא איה דימתה בצמה תאיגש ) " " -

5.0)0( =

ω8

0

=

r

ω

ω

Trang 31

Automatic Cruise Control

P controller – No wind

Trang 32

Automatic Cruise Control

P controller – with wind

Trang 33

Automatic Cruise Control

I controller – No wind

Trang 34

Automatic Cruise Control

PI controller – No wind

Trang 35

Automatic Cruise Control

PI controller – with wind

Trang 36

Automatic Cruise Control

Trang 37

Automatic Cruise Control

Ngày đăng: 24/10/2014, 23:49

TỪ KHÓA LIÊN QUAN