-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlanechange.smv
103 lines (75 loc) · 2.04 KB
/
lanechange.smv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
-- AERE 505X: Final course project
-- Saveri Pal
-- .smv file in nuXmv
-- This is the Lane change module.
-- It contains a two-lane highway going in the same direction.
-- Three boolean variables :-
--
-- lane - denotes whether RoboCar changes lane or not.
-- car - denotes whether a car is present in the lane
-- RoboCar wishes to change to
-- life - denotes whether RoboCar is Fine or Crashed.
--
-- RoboCar detects whether a car is present in the lane it wishes
-- to change to. If yes, it does not change lane OR changes lane
-- when car detected flag is clear - ideal case
-- Else, it changes lane with a car present and
-- crashes - this is to be avoided.
MODULE main
VAR
-- declare variable set
lane : boolean; -- Changes lane/not
car : boolean; -- Is there a car in the lane I want to change to?
life : boolean; -- Fine/crashed?
ASSIGN
-- initial states
init (lane) := FALSE; -- No lane change
init (car) := FALSE; -- No car on other lane
init (life) := TRUE; -- Fine
TRANS
-- State 1 ->
-- Does not change lane, full life points
(
(!lane & !car & life) ->
-- State 1
((next(!lane)) & (next(!car)) & (next(life))) |
-- State 2
((next(lane)) & (next(!car)) & (next(life))) |
-- State 3
((next(!lane)) & (next(car)) & (next(life)))
) &
-- State 2 ->
-- Changes lane when no car present on other lane
-- No life lost; car is fine
(
(lane & !car & life) ->
-- State 1
((next(!lane)) & (next(!car)) & (next(life)))
) &
-- State 3 ->
-- Car detected on other lane
-- Does not change lane (back to State 1) OR
-- changes lane to crash in the next state 5
(
(!lane & car & life) ->
-- State 1
((next(!lane)) & (next(!car)) & (next(life))) |
--State 4
((next(lane)) & (next(car)) & (next(life)))
) &
-- State 4 ->
-- Changes lane when car present on other lane
(
(lane & car & life) ->
-- State 5
((next(lane)) & (next(car)) & (next(!life)))
) &
-- State 5 ->
-- Car crashes
(
(lane & car & !life) ->
-- State 5
((next(lane)) & (next(car)) & (next(!life)))
)
FAIRNESS
TRUE