Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
(EOD).Mechatronics.pdf
Скачиваний:
82
Добавлен:
23.08.2013
Размер:
5.07 Mб
Скачать

page 48

Calculate the position of a 5 Kg mass if a force of 2N is applied for 5 seconds and then removed. There is a one second delay between the time that the force is applied, and when the effects are apparent on the mass.

5.2 DISCRETE CONTROLLERS

The system models we developed before allow us to predict how a system will behave. A separate, and important topic is computer control.

With no controller we would set an input, and hope for an output. For example, push the gas pedal and hope for the right speed.

A controller looks at the desired system condition, and the actual system condition, and then adjusts the input to bring the desired and actual closer. For example cruise control.

The diagram below is a representation of a simple control system add to in the previous tank example,

page 49

hdesired

+

e

Controller

θ

Process

hactual

 

 

 

 

 

(valve/tank)

 

 

 

-

 

 

 

 

 

 

 

Feedback

 

 

 

To make notations more generic we will associate stock variables for desired and actual positions, as well as error, and controller output. We will also add the discrete timestep subscripts used before,

rn = hdesired

cn = hactual

en = rn cn

mn = θ

We have already dealt with deriving an equation for the process. In this case it was the valve tank combination discussed before. By itself the tank is an open loop system, we set the valve angle and hope for a liquid level.

•Next, we need to find an equation for the controller. This equation can be highly dependent upon the control method to be used. If we are to use a computer it is best to have a simple equation, as shown below, (NOTE: the form of the equation, and the values of the coefficients change the nature of the control problem).

The basic difference equation is,

mn mn – 1 = K0en + K1en – 1 + K2en – 2 + K3en – 3 + K4en – 4 +

The ‘output oriented’ form is shown below,

mn = mn – 1 + K0en + K1en – 1 + K2en – 2 + K3en – 3 + K4en – 4 +

The controllers (equations) that follow will be put in the above form. These controllers can also be used individually, or combined to get more complex properties.

Keep in mind that the typical objective of a control system is to minimize the error between the input and output. Another common goal is to do this as quickly, or efficiently as possible. One constraint we must observe is that the system should not become unstable.

page 50

5.2.1 A Proportional Controller

• One of the simplest controllers is the proportional control,

The basic proportional equation is, m = Ke

This can be put in discrete form easily, mn = Ken

Finally this can be put into the general form seen before, mn mn – 1 = Ken Ken – 1

mn = mn – 1 + Ken Ken – 1

Note: This form will be more useful when dealing with more complex controllers.

The magnitude of K will determine how fast the system responds. If the value is too large the system will oscillate and/or become unstable (i.e. flood or go empty). If too small the system error will be very large. (ie, the tank will never reach the right height.)

This type of controller will always have a small error between the actual and desired values.

For the water tank (from before) add a controller, and try varying ‘K’ values.

 

 

 

 

 

T

Ko

 

 

 

 

K

 

 

Ko

K

 

 

 

 

A

 

 

 

 

A

 

 

 

 

e

-----

+ θ

 

 

 

 

i

 

T -----

i

h

 

= h

 

 

 

 

 

e

+

 

 

 

 

 

-----

-----

 

n

 

n – 1

 

 

 

 

n – 1

 

 

Ko

 

 

Ko

page 51

• We could implement this controller using the Basic stamp chip. (Note: not a full implementation)

GND

+5V

+5V

23

 

potentiometer

21

220

 

20

 

 

 

 

1uF

 

10K

10K

 

10K

 

19

-

 

 

 

 

+

 

+5V

10K

motor

 

 

10K

 

e_last=0 ‘set previous error to zero k=2 ‘ set multiplier

r=100 ‘desired water height m_last=0 ‘ last control output value loop:

high 15 ‘discharge the capacitor pause 1 ‘ wait for 1ms

rctime 15,1,c ‘measure charge time e_now=r-c ‘ calculate the error

m_now=m_last+k*e_now-k*e_last ‘ the controller equation e_last=e_now

m_last=m_now

pwm 14,m,100 ‘set the output voltage goto loop

Соседние файлы в предмете Электротехника