Repository navigation
Expand file tree
/
Copy pathpseudostates-demo.sysml
More file actions
49 lines (43 loc) · 1.62 KB
/
Copy pathpseudostates-demo.sysml
File metadata and controls
49 lines (43 loc) · 1.62 KB
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
package PseudostatesDemo {
private import ScalarValues::*;
private import StateMachines::*;
// Pseudostates are written as the StateMachines library's metadata: an
// ordinary state usage carrying an annotation, so the notation is standard
// SysML v2. The deprecated keyword spellings (`choice evaluate;`,
// `junction route;`) lower to the same graph.
// Example 1: Choice (Dynamic Branching)
// Guards evaluated at runtime when choice is entered
state ChoiceExample {
entry; then ready;
state ready;
state idle;
#choice state evaluate;
state pathA;
state pathB;
state pathC;
succession first ready then idle;
transition first idle then evaluate;
transition first evaluate then pathA;
transition first evaluate then pathB;
transition first evaluate then pathC;
}
// Example 2: Junction (Static Branching)
// Guards pre-evaluated before junction is entered
state JunctionExample {
entry; then ready;
state ready;
state receiving;
#junction state route;
state highPriority;
state normalPriority;
state lowPriority;
succession first ready then receiving;
transition first receiving then route;
transition first route then highPriority;
transition first route then normalPriority;
transition first route then lowPriority;
}
// Key difference:
// Choice: dynamic branching (guards evaluated when entered)
// Junction: static branching (guards pre-evaluated)
}