-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAgentStateMachine.rct
69 lines (66 loc) · 1.51 KB
/
AgentStateMachine.rct
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
stm Agent {
uses ArrivedInterface uses GotoInterface uses RadiationLevelI requires InspectionInterface var RadiationBelief : DangerLevel
initial i0
state PollingPerceptsMessages {
}
state Inspect {
entry inspect ( )
}
junction j0
transition t1 {
from PollingPerceptsMessages
to PollingPerceptsMessages
trigger
RadiationLevel ? RadiationBelief
}
transition t2 {
from PollingPerceptsMessages
to j0
trigger
arrived ? CurrentPosition
condition CurrentPosition != waypoint_inverse ( CurrentWaypoint )
}
transition t3 {
from j0
to Inspect
condition RadiationBelief == DangerLevel :: Green
}
var CurrentPosition : nat * nat
transition t4 {
from j0
to PollingPerceptsMessages
condition RadiationBelief != DangerLevel :: Green
action goto ! ( waypoint_inverse ( 0 ) ) ; CurrentWaypoint = 0
}
transition t5 {
from j1
to PollingPerceptsMessages
condition CurrentWaypoint <= number_of_waypoints
action goto ! ( waypoint_inverse ( CurrentWaypoint ) )
}
var CurrentWaypoint : nat
junction j1
transition t6 {
from Inspect
to j1
action CurrentWaypoint = CurrentWaypoint + 1
}
transition t0 {
from i0
to s0
}
requires NumberOfWaypointsI state s0 {
}
transition t7 {
from s0
to PollingPerceptsMessages
trigger RadiationLevel ? RadiationBelief
action goto ! waypoint_inverse ( 1 ) ; CurrentWaypoint = 1
}
transition t8 {
from j1
to PollingPerceptsMessages
condition CurrentWaypoint == number_of_waypoints
action goto ! waypoint_inverse ( 0 ) ; CurrentWaypoint = 0
}
}