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

page 346

STC

MCR

D

U STC

L STB

MCR

• For the previous traffic light example, add a speed up signal for an emergency vehicle.

A strobe light mounted on fire trucks will cause the lights to change so that the truck doesn’t need to stop. Create the ladder logic for the state diagram created previously.

23.3.1.2 - Single State Equations

This is the most compact method, but it comes at the cost of robustness.

We can also model state diagrams with equations. To do this we can continue the traffic light example from before.

page 347

First, define state variables,

ST1 = state 1 - grn NS

ST2 = state 2 - yel NS

ST3 = state 3 - grn EW

ST4 = state 4 - yel EW

Next, write the state entrance and exit condition equations,

ST1 = ( ST1 + ST4 TON2( ST4, 4) ) ST1 S1 S2

ST2 = ( ST2 + ST1 S1 S2) ST2 TON1( ST2, 4)

ST3 = ( ST3 + ST2 TON1( ST2, 4) ) ST3 S1 S2

ST4 = ( ST4 + ST3 S1 S2) ST4 TON2( ST4, 4)

Now, simplify these for implementation in ladder logic.

ST1 = ( ST1 + ST4 TON2( ST4, 4) + FS) ( ST1 + S1 + S2)

ST2 = ( ST2 + ST1 S1 S2) ( ST2 + TON1( ST2, 4) )

ST3 = ( ST3 + ST2 TON1( ST2, 4) ) ( ST3 + S1 + S2)

ST4 = ( ST4 + ST3 S1 S2) ( ST4 + TON2( ST4, 4) )

page 348

ST4

 

 

timer on

 

 

T4:2

 

 

 

 

 

 

 

 

 

delay 4 sec

 

 

 

 

 

 

 

 

 

 

 

ST2

 

 

timer on

 

 

T4:1

 

 

 

 

 

 

 

 

 

delay 4 sec

 

 

 

 

 

TURN ON NEXT STATES FIRST

 

 

ST1

 

 

 

 

 

 

 

 

 

 

ST1

 

 

 

 

 

 

 

ST1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ST4

T4:2/DN

 

 

S1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

first scan

 

 

 

 

 

 

S2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ST2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ST5

ST2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ST1

 

 

 

 

S1

S2

 

 

 

 

 

 

T4:1/DN

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ST3

 

 

 

 

 

 

 

 

 

 

ST3

 

 

 

 

 

 

 

ST3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ST2

T4:1/DN

 

 

S1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

S2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ST4

 

 

 

 

 

 

 

 

 

 

ST4

ST4

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ST3

 

 

 

 

S1

S2

 

 

 

 

 

 

T4:2/DN

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

page 349

 

ST1

 

L1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ST2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ST4

 

L2

 

 

 

 

 

 

 

 

 

 

 

 

ST3

 

L3

 

 

 

 

 

 

 

 

 

 

 

 

ST3

 

L4

 

 

 

 

 

 

 

 

 

 

 

 

 

ST4

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ST2

 

L5

 

 

 

 

 

 

 

 

 

 

 

 

ST1

 

L6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

This method will provide the most compact code, but there are two potential problems. Consider the example above.

1.In one scan ST2 might turn on, but ST1 is calculated above it in the ladder logic, so it would not turn off until the next scan - states ST1 and ST2 would both be on for one scan.

2.If in the second scan the input that caused the transition S1 turns off (it is an input on for a brief time) then ST1 would not turn off, and both ST1 and ST2 would be on indefinately.

3.It is also possible for states that have multiple transitions to go to multiple states.

The problem of dual states will occur for at least one of the transitions in this system, and must be tolerable in any system.

The problem of inputs that are only one cycle long can be solved with a seal in or latch circuit.

The problem of parallel state branches can occur if transitions are defined to be mutually independant. This can be overcome by adding terms to the transition logic that will suppress a transition when the competing transition is active.

Consider the state diagram below and implement it in ladder logic. You should anticipate what will happen if both A and C are pushed at the same time.

page 350

STA

STC

B

D

A

C

STB

first scan

STA = ( STA + STB A) STA B

STB = ( STB + STA B + STC D + FS) STB A STB C STC = ( STC + STB C A) STC D

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