-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathviews-demo.sysml
More file actions
178 lines (139 loc) · 4.41 KB
/
Copy pathviews-demo.sysml
File metadata and controls
178 lines (139 loc) · 4.41 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
// A lander and the views that present it, one per rendering kind: see
// VIEWS-DEMO.md for the walkthrough.
package Lander {
private import ScalarValues::*;
metadata def Safety;
port def FuelPort;
port def TelemetryPort;
item def Fuel;
attribute def Signal;
#Safety part def Thruster {
attribute thrust : Real = 4500.0;
in item fuelIn : Fuel;
port supply : FuelPort;
}
part def Tank {
attribute capacity : Real = 320.0;
out item fuelOut : Fuel;
port outlet : FuelPort;
}
#Safety part def Parachute;
part def Antenna {
port downlink : TelemetryPort;
}
connection def FuelLine {
end supplier : FuelPort;
end consumer : FuelPort;
}
part def Descender {
attribute mass : Real;
attribute partCount : Integer = 4;
part tank : Tank;
part thruster : Thruster;
part parachute : Parachute;
part antenna : Antenna;
connection supply : FuelLine connect tank.outlet to thruster.supply;
flow of Fuel from tank.fuelOut to thruster.fuelIn;
}
// A machine a state view presents, states and transitions alike.
state def DescentStates {
attribute altitude : Real = 9000.0;
entry; then cruise;
state cruise;
state descent {
entry; then braking;
state braking;
state hover;
transition braking_to_hover
first braking
accept Signal
if altitude < 100.0
then hover;
}
state landed;
transition first cruise then descent;
transition first descent then landed;
}
// A behavior an action view presents, nodes and successions alike.
action def Descend {
attribute altitude : Real = 9000.0;
in item fuel : Fuel;
first start;
action deployParachute;
action burn {
in item propellant : Fuel;
action ignite;
action throttle;
first ignite;
succession first ignite then throttle;
}
fork split;
join sync;
action touchdown;
succession first start then split;
succession first split then deployParachute;
succession first split then burn;
succession first deployParachute then sync;
succession first burn then sync;
succession first sync then check;
decide check;
if altitude > 0.0 then touchdown;
else done;
succession first touchdown then done;
}
// Two landers a concern's condition is checked against: one within the mass
// budget and one over it.
part descender : Descender {
attribute :>> mass = 890.0;
}
part heavyDescender : Descender {
attribute :>> mass = 1180.0;
}
concern def MassBudget {
subject lander : Descender;
attribute maxMass = 1000.0;
require constraint {
lander.mass <= maxMass
}
}
}
package LanderViews {
private import Views::*;
private import StandardViewDefinitions::*;
viewpoint def MassPerspective {
frame concern mass : Lander::MassBudget;
}
viewpoint massPerspective : MassPerspective;
view interfaces {
expose Lander::Descender;
render asInterconnectionDiagram;
}
view partsTable {
expose Lander::Descender;
render asElementTable;
}
// The rendering kind comes from the standard view definition each of these
// specializes, with no rendering member of their own.
view descentStates : StateTransitionView {
expose Lander::DescentStates;
}
view descentFlow : ActionFlowView {
expose Lander::Descend;
}
// A filtered recursive expose, which reaches only the safety-critical
// elements of the model.
view safetyView {
expose Lander::**[@Lander::Safety];
}
// States no rendering, so a containment tree renders it, with the
// interconnection view nested as a subtree.
view overview {
expose Lander::descender;
expose Lander::heavyDescender;
view interfaceSubview :> interfaces;
// What `%view` checks the exposed landers against: the concern the
// viewpoint frames, framed by this view too.
satisfy massPerspective;
frame concern mass : Lander::MassBudget;
}
}