Download presentation
Presentation is loading. Please wait.
Published byKylan Howett Modified over 9 years ago
1
1 ATM Machine STATE ::= await_card | await_pin | await_2 nd _attempt | eject_card | await_amount | dispense_money EVENT ::= insert_card | enter_good_pin | enter_bad_pin | cancel | enter_amount | done FSM == (STATE X EVENT) ⇸ STATE no_change, control, transitions: FSM no_change = {s: STATE; e: EVENT (s, e) → s } control = no_change transitions Transitions = { (await_card, insert_card) → await_pin, (await_pin, enter_good_pin) → await_amount, (await_pin, enter_bad_pin) → await_2 nd _attempt, (await_pin, cancel) → await_card, (await_2 nd _attempt, enter_good_pin) → await_amount, (await_2 nd _attempt, enter_bad_pin) → eject_card, (eject_card, done) → await_card, (await_amount, cancel) → await_card, (await_amount, enter_amount) → dispense_money, (dispense_money, done) → await_card }
2
2 ATM – State diagram 1.Await card
3
3 ATM – State diagram 1.Await card 2. Await pin card
4
4 ATM – State diagram 1.Await card 3.Await 2 nd pin 2. Await pin card bad pin
5
5 ATM – State diagram 1.Await card 3.Await 2 nd pin 5.Await amount 2. Await pin card good pin bad pin
6
6 ATM – State diagram 1.Await card 4. Eject card 3.Await 2 nd pin 5.Await amount 2. Await pin card good pin bad pin
7
7 ATM – State diagram 1.Await card 4. Eject card 3.Await 2 nd pin 5.Await amount 2. Await pin done card good pin bad pin
8
8 ATM – State diagram 1.Await card 4. Eject card 3.Await 2 nd pin 6. Dispense money 5.Await amount 2. Await pin done card good pin bad pin good pin amount
9
9 ATM – State diagram 1.Await card 4. Eject card 3.Await 2 nd pin 6. Dispense money 5.Await amount 2. Await pin done card good pin bad pin good pin amount
10
10 ATM – State diagram 1.Await card 4. Eject card 3.Await 2 nd pin 6. Dispense money 5.Await amount 2. Await pin done card good pin bad pin good pin amount cancel
11
11 ATM – State diagram 1.Await card 4. Eject card 3.Await 2 nd pin 6. Dispense money 5.Await amount 2. Await pin done card good pin bad pin good pin amount cancel
12
12 ATM – State diagram 1.Await card 4. Eject card 3.Await 2 nd pin 6. Dispense money 5.Await amount 2. Await pin done card good pin bad pin good pin amount cancel
13
13 Insert card Enter good pin Enter bad pin cancelEnter amount Done 1. Await card 2. Await pin 3. Await 2 nd attempt 4. Eject card 5. Await amount 6. Dispense money State transition table
14
14 Insert card Enter good pin Enter bad pin cancelEnter amount Done 1. Await card 2 2. Await pin 3. Await 2 nd attempt 4. Eject card 5. Await amount 6. Dispense money State transition table
15
15 Insert card Enter good pin Enter bad pin cancelEnter amount Done 1. Await card 2 2. Await pin 5 3. Await 2 nd attempt 5 4. Eject card 5. Await amount 6. Dispense money State transition table
16
16 Insert card Enter good pin Enter bad pin cancelEnter amount Done 1. Await card 2 2. Await pin 53 3. Await 2 nd attempt 54 4. Eject card 5. Await amount 6. Dispense money State transition table
17
17 Insert card Enter good pin Enter bad pin cancelEnter amount Done 1. Await card 2 2. Await pin 531 3. Await 2 nd attempt 541 4. Eject card 5. Await amount 1 6. Dispense money State transition table
18
18 Insert card Enter good pin Enter bad pin cancelEnter amount Done 1. Await card 2 2. Await pin 531 3. Await 2 nd attempt 541 4. Eject card 5. Await amount 16 6. Dispense money State transition table
19
19 Insert card Enter good pin Enter bad pin cancelEnter amount Done 1. Await card 2 2. Await pin 531 3. Await 2 nd attempt 541 4. Eject card 1 5. Await amount 16 6. Dispense money 1 State transition table
20
20 ATM Machine STATE ::= await_card | await_pin | await_2 nd _attempt | eject_card | await_amount | dispense_money
21
21 ATM Machine STATE ::= await_card | await_pin | await_2 nd _attempt | eject_card | await_amount | dispense_money EVENT ::= insert_card | enter_good_pin | enter_bad_pin | cancel | enter_amount | done
22
22 ATM Machine STATE ::= await_card | await_pin | await_2 nd _attempt | eject_card | await_amount | dispense_money EVENT ::= insert_card | enter_good_pin | enter_bad_pin | cancel | enter_amount | done FSM == (STATE X EVENT) ⇸ STATE
23
23 ATM Machine STATE ::= await_card | await_pin | await_2 nd _attempt | eject_card | await_amount | dispense_money EVENT ::= insert_card | enter_good_pin | enter_bad_pin | cancel | enter_amount | done FSM == (STATE X EVENT) ⇸ STATE no_change, control, transitions: FSM
24
24 ATM Machine STATE ::= await_card | await_pin | await_2 nd _attempt | eject_card | await_amount | dispense_money EVENT ::= insert_card | enter_good_pin | enter_bad_pin | cancel | enter_amount | done FSM == (STATE X EVENT) ⇸ STATE no_change, control, transitions: FSM no_change = {s: STATE; e: EVENT (s, e) → s }
25
25 ATM Machine STATE ::= await_card | await_pin | await_2 nd _attempt | eject_card | await_amount | dispense_money EVENT ::= insert_card | enter_good_pin | enter_bad_pin | cancel | enter_amount | done FSM == (STATE X EVENT) ⇸ STATE no_change, control, transitions: FSM no_change = {s: STATE; e: EVENT (s, e) → s } control = no_change transitions
26
26 ATM Machine STATE ::= await_card | await_pin | await_2 nd _attempt | eject_card | await_amount | dispense_money EVENT ::= insert_card | enter_good_pin | enter_bad_pin | cancel | enter_amount | done FSM == (STATE X EVENT) ⇸ STATE no_change, control, transitions: FSM no_change = {s: STATE; e: EVENT (s, e) → s } control = no_change transitions transitions = { (await_card, insert_card) → await_pin, (await_pin, enter_good_pin) → await_amount, (await_pin, enter_bad_pin) → await_2 nd _attempt, (await_pin, cancel) → await_card,. …}
27
27 Last word for the formal methods 1.Not widely used in industry 2.Formal specifications can be examined mathematically 3.Informal specifications cannot be 4.A correct program can be shown to meet its specifications 5.Two specifications can be shown to be equivalent 6.Certain forms of incompleteness or inconsistencies can be detected automatically 7.Removes ambiguity 8.Encourages greater care in early stages 9.Focus is mainly on function and data aspects 10.A problem is that the timing, control, behavioural aspects are difficult to represent 11.Also, the methods are often difficult to learn
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.