-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathrequirements.sysml
More file actions
90 lines (82 loc) · 2.66 KB
/
Copy pathrequirements.sysml
File metadata and controls
90 lines (82 loc) · 2.66 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
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
85
86
87
88
89
90
// Requirement identifiers and doc text as document prose: the model gives each
// requirement a short name and a doc comment; the Reqs query projects both,
// and the report renders them once as a table and once as definitions.
// The Tree query lists every requirement definition and usage under a root in
// hierarchy order, which the report renders as a third table.
package Requirements {
private import DocumentQueries::*;
private import KerML::Root::Element;
private import ScalarValues::*;
requirement def <'HLR-R001'> CrewSafety {
doc /* The mission shall safely return all three crew members to Earth. */
}
requirement def <'HLR-R002'> SoftLanding {
doc /* The mission shall achieve a soft landing
* on the lunar surface. */
}
part spec {
requirement <'R1'> r1 : CrewSafety {
doc /* Applies to every phase of the mission. */
}
requirement <'R2'> r2 : SoftLanding {
doc /* Applies to the powered descent. */
requirement <'R2.1'> descentRate {
doc /* The vertical velocity at touchdown shall not exceed 2 m/s. */
}
requirement <'R2.2'> tiltAngle {
doc /* The lander shall come to rest within 12 degrees of vertical. */
}
}
}
calc def Reqs :> Query {
in root : Element;
Project(
source = RelatedElements(
source = WhereType(source = Descendants(source = root, maxDepth = 1), type = "RequirementUsage"),
relationshipKind = "typing", direction = "outgoing", maxDepth = 1
),
properties = ("shortName", "name", "documentation")
)
}
calc def Tree :> Query {
in root : Element;
Project(
source = OrderBy(
source = Union(
source = WhereType(source = Descendants(source = root, maxDepth = 3), type = "RequirementDefinition"),
other = WhereType(source = Descendants(source = root, maxDepth = 3), type = "RequirementUsage")
),
property = "qualifiedName",
direction = "ascending",
missing = "last",
multiple = "error"
),
properties = ("shortName", "name", "documentation")
)
}
part def RequirementsReport :> Document {
attribute redefines title = "Mission Requirements";
part intro : Paragraph {
attribute redefines text = "Each requirement by identifier, first as a table and then as prose; then the specification's requirement hierarchy.";
}
part table : Table {
attribute redefines caption = "Requirements";
calc rows : Reqs {
in root = spec;
}
}
part prose : Definitions {
attribute redefines term = "shortName";
attribute redefines description = "documentation";
calc rows : Reqs {
in root = spec;
}
}
part tree : Table {
attribute redefines caption = "Requirement hierarchy";
calc rows : Tree {
in root = spec;
}
}
}
}