sysmlpy 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sysmlpy/__init__.py +226 -0
- sysmlpy/__main__.py +75 -0
- sysmlpy/antlr/README.md +146 -0
- sysmlpy/antlr/SysMLv2Lexer.interp +695 -0
- sysmlpy/antlr/SysMLv2Lexer.py +1123 -0
- sysmlpy/antlr/SysMLv2Lexer.tokens +444 -0
- sysmlpy/antlr/SysMLv2Parser.interp +960 -0
- sysmlpy/antlr/SysMLv2Parser.py +40750 -0
- sysmlpy/antlr/SysMLv2Parser.tokens +444 -0
- sysmlpy/antlr/SysMLv2ParserListener.py +4485 -0
- sysmlpy/antlr/SysMLv2ParserVisitor.py +2498 -0
- sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.interp +695 -0
- sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.py +1123 -0
- sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.tokens +444 -0
- sysmlpy/antlr_parser.py +185 -0
- sysmlpy/antlr_visitor.py +10864 -0
- sysmlpy/definition.py +1115 -0
- sysmlpy/examples/attribute_values.py +161 -0
- sysmlpy/examples/part_attributes.py +139 -0
- sysmlpy/examples/tuples_sequences.py +231 -0
- sysmlpy/formatting.py +47 -0
- sysmlpy/grammar/antlr4/README.md +30 -0
- sysmlpy/grammar/antlr4/SysMLv2Lexer.g4 +931 -0
- sysmlpy/grammar/antlr4/SysMLv2Lexer.interp +695 -0
- sysmlpy/grammar/antlr4/SysMLv2Lexer.py +1123 -0
- sysmlpy/grammar/antlr4/SysMLv2Lexer.tokens +444 -0
- sysmlpy/grammar/antlr4/SysMLv2Parser.g4 +2432 -0
- sysmlpy/grammar/antlr4/SysMLv2Parser.interp +960 -0
- sysmlpy/grammar/antlr4/SysMLv2Parser.py +40750 -0
- sysmlpy/grammar/antlr4/SysMLv2Parser.tokens +444 -0
- sysmlpy/grammar/antlr4/SysMLv2ParserListener.py +4485 -0
- sysmlpy/grammar/antlr4/SysMLv2ParserVisitor.py +2498 -0
- sysmlpy/grammar/antlr4/desc.xml +7 -0
- sysmlpy/grammar/antlr4/examples/camera.sysml +14 -0
- sysmlpy/grammar/antlr4/examples/toaster-system.sysml +193 -0
- sysmlpy/grammar/antlr4/examples/vehicle-model.sysml +118 -0
- sysmlpy/grammar/antlr4/pom.xml +59 -0
- sysmlpy/grammar/classes.py +8610 -0
- sysmlpy/library/LICENSE +165 -0
- sysmlpy/library/README.md +52 -0
- sysmlpy/library/__init__.py +0 -0
- sysmlpy/library/domain/Analysis/AnalysisTooling.sysml +34 -0
- sysmlpy/library/domain/Analysis/SampledFunctions.sysml +119 -0
- sysmlpy/library/domain/Analysis/StateSpaceRepresentation.sysml +143 -0
- sysmlpy/library/domain/Analysis/TradeStudies.sysml +171 -0
- sysmlpy/library/domain/Cause and Effect/CausationConnections.sysml +83 -0
- sysmlpy/library/domain/Cause and Effect/CauseAndEffect.sysml +81 -0
- sysmlpy/library/domain/Geometry/ShapeItems.sysml +899 -0
- sysmlpy/library/domain/Geometry/SpatialItems.sysml +168 -0
- sysmlpy/library/domain/Metadata/ImageMetadata.sysml +78 -0
- sysmlpy/library/domain/Metadata/ModelingMetadata.sysml +143 -0
- sysmlpy/library/domain/Metadata/ParametersOfInterestMetadata.sysml +39 -0
- sysmlpy/library/domain/Metadata/RiskMetadata.sysml +100 -0
- sysmlpy/library/domain/Quantities and Units/ISQ.sysml +42 -0
- sysmlpy/library/domain/Quantities and Units/ISQAcoustics.sysml +439 -0
- sysmlpy/library/domain/Quantities and Units/ISQAtomicNuclear.sysml +2726 -0
- sysmlpy/library/domain/Quantities and Units/ISQBase.sysml +206 -0
- sysmlpy/library/domain/Quantities and Units/ISQCharacteristicNumbers.sysml +1991 -0
- sysmlpy/library/domain/Quantities and Units/ISQChemistryMolecular.sysml +1353 -0
- sysmlpy/library/domain/Quantities and Units/ISQCondensedMatter.sysml +1223 -0
- sysmlpy/library/domain/Quantities and Units/ISQElectromagnetism.sysml +2333 -0
- sysmlpy/library/domain/Quantities and Units/ISQInformation.sysml +958 -0
- sysmlpy/library/domain/Quantities and Units/ISQLight.sysml +1537 -0
- sysmlpy/library/domain/Quantities and Units/ISQMechanics.sysml +1564 -0
- sysmlpy/library/domain/Quantities and Units/ISQSpaceTime.sysml +1169 -0
- sysmlpy/library/domain/Quantities and Units/ISQThermodynamics.sysml +1256 -0
- sysmlpy/library/domain/Quantities and Units/MeasurementRefCalculations.sysml +30 -0
- sysmlpy/library/domain/Quantities and Units/MeasurementReferences.sysml +526 -0
- sysmlpy/library/domain/Quantities and Units/Quantities.sysml +107 -0
- sysmlpy/library/domain/Quantities and Units/QuantityCalculations.sysml +70 -0
- sysmlpy/library/domain/Quantities and Units/SI.sysml +378 -0
- sysmlpy/library/domain/Quantities and Units/SIPrefixes.sysml +48 -0
- sysmlpy/library/domain/Quantities and Units/TensorCalculations.sysml +50 -0
- sysmlpy/library/domain/Quantities and Units/Time.sysml +274 -0
- sysmlpy/library/domain/Quantities and Units/USCustomaryUnits.sysml +260 -0
- sysmlpy/library/domain/Quantities and Units/VectorCalculations.sysml +62 -0
- sysmlpy/library/domain/Requirement Derivation/DerivationConnections.sysml +63 -0
- sysmlpy/library/domain/Requirement Derivation/RequirementDerivation.sysml +39 -0
- sysmlpy/library/kernel/Base.kerml +95 -0
- sysmlpy/library/kernel/BaseFunctions.kerml +80 -0
- sysmlpy/library/kernel/BooleanFunctions.kerml +22 -0
- sysmlpy/library/kernel/Clocks.kerml +156 -0
- sysmlpy/library/kernel/CollectionFunctions.kerml +68 -0
- sysmlpy/library/kernel/Collections.kerml +147 -0
- sysmlpy/library/kernel/ComplexFunctions.kerml +47 -0
- sysmlpy/library/kernel/ControlFunctions.kerml +117 -0
- sysmlpy/library/kernel/ControlPerformances.kerml +135 -0
- sysmlpy/library/kernel/DataFunctions.kerml +43 -0
- sysmlpy/library/kernel/FeatureReferencingPerformances.kerml +190 -0
- sysmlpy/library/kernel/IntegerFunctions.kerml +43 -0
- sysmlpy/library/kernel/KerML.kerml +483 -0
- sysmlpy/library/kernel/Links.kerml +67 -0
- sysmlpy/library/kernel/Metaobjects.kerml +58 -0
- sysmlpy/library/kernel/NaturalFunctions.kerml +27 -0
- sysmlpy/library/kernel/NumericalFunctions.kerml +43 -0
- sysmlpy/library/kernel/Objects.kerml +212 -0
- sysmlpy/library/kernel/Observation.kerml +161 -0
- sysmlpy/library/kernel/OccurrenceFunctions.kerml +154 -0
- sysmlpy/library/kernel/Occurrences.kerml +992 -0
- sysmlpy/library/kernel/Performances.kerml +293 -0
- sysmlpy/library/kernel/RationalFunctions.kerml +49 -0
- sysmlpy/library/kernel/RealFunctions.kerml +56 -0
- sysmlpy/library/kernel/ScalarFunctions.kerml +33 -0
- sysmlpy/library/kernel/ScalarValues.kerml +23 -0
- sysmlpy/library/kernel/SequenceFunctions.kerml +111 -0
- sysmlpy/library/kernel/SpatialFrames.kerml +197 -0
- sysmlpy/library/kernel/StatePerformances.kerml +145 -0
- sysmlpy/library/kernel/StringFunctions.kerml +25 -0
- sysmlpy/library/kernel/Transfers.kerml +281 -0
- sysmlpy/library/kernel/TransitionPerformances.kerml +66 -0
- sysmlpy/library/kernel/TrigFunctions.kerml +35 -0
- sysmlpy/library/kernel/Triggers.kerml +188 -0
- sysmlpy/library/kernel/VectorFunctions.kerml +273 -0
- sysmlpy/library/kernel/VectorValues.kerml +64 -0
- sysmlpy/library/systems/Actions.sysml +552 -0
- sysmlpy/library/systems/Allocations.sysml +29 -0
- sysmlpy/library/systems/AnalysisCases.sysml +38 -0
- sysmlpy/library/systems/Attributes.sysml +25 -0
- sysmlpy/library/systems/Calculations.sysml +37 -0
- sysmlpy/library/systems/Cases.sysml +71 -0
- sysmlpy/library/systems/Connections.sysml +60 -0
- sysmlpy/library/systems/Constraints.sysml +44 -0
- sysmlpy/library/systems/Flows.sysml +126 -0
- sysmlpy/library/systems/Interfaces.sysml +89 -0
- sysmlpy/library/systems/Items.sysml +153 -0
- sysmlpy/library/systems/Metadata.sysml +32 -0
- sysmlpy/library/systems/Parts.sysml +81 -0
- sysmlpy/library/systems/Ports.sysml +54 -0
- sysmlpy/library/systems/Requirements.sysml +194 -0
- sysmlpy/library/systems/StandardViewDefinitions.sysml +123 -0
- sysmlpy/library/systems/States.sysml +103 -0
- sysmlpy/library/systems/SysML.sysml +539 -0
- sysmlpy/library/systems/UseCases.sysml +57 -0
- sysmlpy/library/systems/VerificationCases.sysml +103 -0
- sysmlpy/library/systems/Views.sysml +164 -0
- sysmlpy/navigate.py +272 -0
- sysmlpy/store.py +547 -0
- sysmlpy/usage.py +2978 -0
- sysmlpy-0.1.0.dist-info/METADATA +230 -0
- sysmlpy-0.1.0.dist-info/RECORD +143 -0
- sysmlpy-0.1.0.dist-info/WHEEL +4 -0
- sysmlpy-0.1.0.dist-info/entry_points.txt +3 -0
- sysmlpy-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
standard library package SpatialFrames {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package models spatial frames of reference for quantifying the position of points
|
|
5
|
+
* in a three-dimensional space.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
private import Clocks::*;
|
|
9
|
+
private import ScalarValues::NumericalValue;
|
|
10
|
+
private import VectorValues::ThreeVectorValue;
|
|
11
|
+
private import VectorValues::CartesianThreeVectorValue;
|
|
12
|
+
private import VectorFunctions::isZeroVector;
|
|
13
|
+
private import Occurrences::Life;
|
|
14
|
+
private import Objects::Body;
|
|
15
|
+
private import Objects::Point;
|
|
16
|
+
private import ControlFunctions::forAll;
|
|
17
|
+
private import SequenceFunctions::includes;
|
|
18
|
+
|
|
19
|
+
private struct DefaultFrameLife[1] :> SpatialFrame, Life {
|
|
20
|
+
doc
|
|
21
|
+
/*
|
|
22
|
+
* DefaultFrameLife is the classifier of the singleton Life of the defaultFrame.
|
|
23
|
+
*/
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
feature defaultFrame : DefaultFrameLife[1] {
|
|
27
|
+
doc
|
|
28
|
+
/*
|
|
29
|
+
* defaultFrame is a fixed SpatialFrame used as a universal default.
|
|
30
|
+
*/
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
abstract struct SpatialFrame specializes Body {
|
|
34
|
+
doc
|
|
35
|
+
/*
|
|
36
|
+
* A SpatialFrame is a three-dimensional Body that provides a spatial extent that
|
|
37
|
+
* acts as a frame of reference for defining the physical position and displacement
|
|
38
|
+
* vectors of Points over time.
|
|
39
|
+
*/
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
abstract function PositionOf {
|
|
43
|
+
doc
|
|
44
|
+
/*
|
|
45
|
+
* The PositionOf a Point relative to a SpatialFrame, at a specific time relative to a given
|
|
46
|
+
* Clock, as a positionVector that is a ThreeVectorValue.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
in point : Point[1];
|
|
50
|
+
in time : NumericalValue[1];
|
|
51
|
+
in frame : SpatialFrame[1] default defaultFrame;
|
|
52
|
+
in clock : Clock[1] default frame.localClock;
|
|
53
|
+
return positionVector : ThreeVectorValue[1];
|
|
54
|
+
|
|
55
|
+
inv positionTimePrecondition {
|
|
56
|
+
doc
|
|
57
|
+
/*
|
|
58
|
+
* The given point must exist at the given time.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
TimeOf(point.startShot) <= time and
|
|
62
|
+
time <= TimeOf(point.endShot)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
inv spacePositionConstraint {
|
|
66
|
+
doc
|
|
67
|
+
/*
|
|
68
|
+
* The result positionVector is equal to the PositionOf the Point spaceShot of the
|
|
69
|
+
* frame that encloses the given point, at the given time.
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
(frame.spaceShots as Point)->forAll{in p : Point;
|
|
73
|
+
p.spaceTimeEnclosedOccurrences->includes(point) implies
|
|
74
|
+
positionVector == PositionOf(p, time, frame)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
abstract function CurrentPositionOf {
|
|
80
|
+
doc
|
|
81
|
+
/*
|
|
82
|
+
* The CurrentPositionOf a Point relative to a SpatialFrame and a Clock is the PositionOf
|
|
83
|
+
* the Point relative to the SpatialFrame at the currentTime of the Clock.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
in point : Point[1];
|
|
87
|
+
in frame : SpatialFrame[1] default defaultFrame;
|
|
88
|
+
in clock : Clock[1] default frame.localClock;
|
|
89
|
+
return positionVector : ThreeVectorValue[1] =
|
|
90
|
+
PositionOf(point, clock.currentTime, frame, clock);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function DisplacementOf {
|
|
94
|
+
doc
|
|
95
|
+
/*
|
|
96
|
+
* The DisplacementOf two Points relative to a SpatialFrame, at a specific time relative to a
|
|
97
|
+
* given Clock, is the displacementVector computed as the difference between the PositionOf the
|
|
98
|
+
* first Point and PositionOf the second Point, relative to that SpatialFrame, at that time.
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
in point1 : Point[1];
|
|
102
|
+
in point2 : Point[1];
|
|
103
|
+
in time : NumericalValue;
|
|
104
|
+
in frame : SpatialFrame[1] default defaultFrame;
|
|
105
|
+
in clock : Clock[1] default frame.localClock;
|
|
106
|
+
return displacementVector : ThreeVectorValue[1] =
|
|
107
|
+
PositionOf(point2, time, frame, clock) - PositionOf(point1, time, frame, clock);
|
|
108
|
+
|
|
109
|
+
inv zeroDisplacementConstraint {
|
|
110
|
+
doc
|
|
111
|
+
/*
|
|
112
|
+
* If either point1 or point2 occurs within the other, then the displacementVector is
|
|
113
|
+
* the zero vector.
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
(point1.spaceTimeEnclosedOccurrences->includes(point2) or
|
|
117
|
+
point2.spaceTimeEnclosedOccurrences->includes(point1)) implies
|
|
118
|
+
isZeroVector(displacementVector)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function CurrentDisplacementOf {
|
|
123
|
+
doc
|
|
124
|
+
/*
|
|
125
|
+
* The CurrentDisplacementOf two Points relative to a SpatialFrame and Clock is the DisplacementOf
|
|
126
|
+
* the Points relative to the SpatialFrame at the currentTime of the Clock.
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
in point1 : Point[1];
|
|
130
|
+
in point2 : Point[1];
|
|
131
|
+
in frame : SpatialFrame[1] default defaultFrame;
|
|
132
|
+
in clock : Clock[1] default frame.localClock;
|
|
133
|
+
return displacementVector : ThreeVectorValue[1] =
|
|
134
|
+
DisplacementOf(point1, point2, clock.currentTime, frame, clock);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
abstract struct CartesianSpatialFrame :> SpatialFrame {
|
|
138
|
+
doc
|
|
139
|
+
/*
|
|
140
|
+
* A CartesianSpatialFrame is a SpatialFrame relative to which all position and displacement
|
|
141
|
+
* vectors can be represented as CartesianThreeVectorValues.
|
|
142
|
+
*/
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
abstract function CartesianPositionOf :> PositionOf {
|
|
146
|
+
doc
|
|
147
|
+
/*
|
|
148
|
+
* The PositionOf a Point relative to a CartesianSpatialFrame is a CartesianThreeVectorValue.
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
in point : Point[1];
|
|
152
|
+
in time : NumericalValue[1];
|
|
153
|
+
in frame : CartesianSpatialFrame[1];
|
|
154
|
+
in clock : Clock[1] default frame.localClock;
|
|
155
|
+
return positionVector : CartesianThreeVectorValue[1];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
abstract function CartesianCurrentPositionOf :> CurrentPositionOf {
|
|
159
|
+
doc
|
|
160
|
+
/*
|
|
161
|
+
* The CurrentPositionOf a Point relative to a CartesianSpatialFrame is a CartesianThreeVectorValue.
|
|
162
|
+
*/
|
|
163
|
+
|
|
164
|
+
in point : Point[1];
|
|
165
|
+
in frame : CartesianSpatialFrame[1];
|
|
166
|
+
in clock : Clock[1] default frame.localClock;
|
|
167
|
+
return positionVector : CartesianThreeVectorValue[1];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function CartesianDisplacementOf :> DisplacementOf {
|
|
171
|
+
doc
|
|
172
|
+
/*
|
|
173
|
+
* The DisplacementOf two Points relative to a CartesianSpatialFrame is a CartesianThreeVectorValue.
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
in point1 : Point[1];
|
|
177
|
+
in point2 : Point[1];
|
|
178
|
+
in time : NumericalValue[1];
|
|
179
|
+
in frame : CartesianSpatialFrame[1];
|
|
180
|
+
in clock : Clock[1] default frame.localClock;
|
|
181
|
+
return displacementVector : CartesianThreeVectorValue[1];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function CartesianCurrentDisplacementOf :> CurrentDisplacementOf {
|
|
185
|
+
doc
|
|
186
|
+
/*
|
|
187
|
+
* The CurrentDisplacementOf two Points relative to a CartesianSpatialFrame is a CartesianThreeVectorValue.
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
in point1 : Point[1];
|
|
191
|
+
in point2 : Point[1];
|
|
192
|
+
in frame : CartesianSpatialFrame[1];
|
|
193
|
+
in clock : Clock[1] default frame.localClock;
|
|
194
|
+
return displacementVector : CartesianThreeVectorValue[1];
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
standard library package StatePerformances {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package contains a library model of the semantics of state-based behavior,
|
|
5
|
+
* including the performance of (behavioral) states and the transitions between them.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
private import ScalarValues::Boolean;
|
|
9
|
+
private import ScalarValues::Natural;
|
|
10
|
+
private import TransitionPerformances::TransitionPerformance;
|
|
11
|
+
private import Occurrences::Occurrence;
|
|
12
|
+
private import Occurrences::HappensDuring;
|
|
13
|
+
private import Transfers::Transfer;
|
|
14
|
+
private import Transfers::MessageTransfer;
|
|
15
|
+
private import Performances::Performance;
|
|
16
|
+
private import ControlPerformances::DecisionPerformance;
|
|
17
|
+
private import ControlFunctions::forAll;
|
|
18
|
+
private import ControlFunctions::select;
|
|
19
|
+
private import ControlFunctions::collect;
|
|
20
|
+
private import SequenceFunctions::*;
|
|
21
|
+
|
|
22
|
+
behavior StatePerformance specializes DecisionPerformance {
|
|
23
|
+
feature isTriggerDuring: Boolean default true;
|
|
24
|
+
|
|
25
|
+
abstract step middle[1..*] {
|
|
26
|
+
doc
|
|
27
|
+
/*
|
|
28
|
+
* All modeler-defined steps must subset this.
|
|
29
|
+
*/
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* Note: All steps are implicitly considered to be enclosedPerformances,
|
|
34
|
+
* and hence happening during the state performance.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
step entry[1];
|
|
38
|
+
step do[1] subsets middle;
|
|
39
|
+
step exit[1];
|
|
40
|
+
|
|
41
|
+
step nonDoMiddle[*] subsets middle = middle->excluding(do);
|
|
42
|
+
|
|
43
|
+
private succession [1] entry then [*] middle;
|
|
44
|
+
private succession [1] do.startShot then [*] nonDoMiddle.startShot;
|
|
45
|
+
private succession [*] middle then [1] exit;
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
feature incomingTransitionTrigger : MessageTransfer [0..1] default null {
|
|
49
|
+
doc
|
|
50
|
+
/*
|
|
51
|
+
* Transfer that triggered a transition into this state performance.
|
|
52
|
+
*/
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private inv { isEmpty(accepted) == isEmpty(acceptable) }
|
|
56
|
+
feature accepted: Transfer[0..1] subsets acceptable {
|
|
57
|
+
doc
|
|
58
|
+
/* A transfer to the trigger target of an outgoing transition performance
|
|
59
|
+
* for an outgoing successon that is taken for this state occurrence.
|
|
60
|
+
*/
|
|
61
|
+
}
|
|
62
|
+
feature deferrable: Transfer[0..*] subsets acceptable {
|
|
63
|
+
doc
|
|
64
|
+
/* Transfers to trigger targets of outgoing transition performances can be
|
|
65
|
+
* considered for acceptance more than once.
|
|
66
|
+
*/
|
|
67
|
+
}
|
|
68
|
+
abstract feature acceptable: Transfer[*] {
|
|
69
|
+
doc
|
|
70
|
+
/*
|
|
71
|
+
* Transfers that might be accepted.
|
|
72
|
+
*/
|
|
73
|
+
feature thatSP : StatePerformance [1] = that as StatePerformance;
|
|
74
|
+
feature accableT : Transfer redefines self;
|
|
75
|
+
feature accT : Transfer = thatSP.accepted;
|
|
76
|
+
inv { accableT == accT | incomingTransferSort(accT, accableT) }
|
|
77
|
+
inv { isDispatch implies
|
|
78
|
+
allSubstatePerformances(dispatchScope)->forAll{in oSP : StatePerformance;
|
|
79
|
+
oSP == thatSP | isEmpty(oSP.accepted) |
|
|
80
|
+
includes(thatSP.exit.startShot.successors, oSP.exit.startShot) |
|
|
81
|
+
( oSP.accepted != accableT &
|
|
82
|
+
( incomingTransferSort(oSP.accepted, accableT) |
|
|
83
|
+
includes(oSP.deferrable, accableT) ) ) } }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function allSubstatePerformances {
|
|
87
|
+
in p : Performance [1];
|
|
88
|
+
feature substatePerformances: StatePerformance [*] =
|
|
89
|
+
p.subperformances->select{in subp:Performance; subp istype StatePerformance};
|
|
90
|
+
return : StatePerformance [*] =
|
|
91
|
+
union(substatePerformances,
|
|
92
|
+
substatePerformances->collect{in sp:StatePerformance; allSubstatePerformances(sp) } );
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private succession [*] acceptable then [1] exit;
|
|
96
|
+
|
|
97
|
+
feature redefines isRunToCompletion default this.isRunToCompletion;
|
|
98
|
+
feature redefines runToCompletionScope default this.runToCompletionScope;
|
|
99
|
+
inv { isRunToCompletion implies
|
|
100
|
+
allSubtransitionPerformances(runToCompletionScope)->forAll{in tp : TransitionPerformance;
|
|
101
|
+
includes(tp.successors, entry) | includes(tp.predecessors, entry) }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function allSubtransitionPerformances {
|
|
105
|
+
in p : Performance [1];
|
|
106
|
+
feature subtransitionPerformances: TransitionPerformance [*] =
|
|
107
|
+
p.subperformances->select{in subp:Performance;
|
|
108
|
+
subp istype StateTransitionPerformance };
|
|
109
|
+
return : TransitionPerformance [*] =
|
|
110
|
+
union(subtransitionPerformances,
|
|
111
|
+
subtransitionPerformances->collect{in sp:TransitionPerformance;
|
|
112
|
+
allSubtransitionPerformances(sp) } );
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
behavior StateTransitionPerformance specializes TransitionPerformance {
|
|
117
|
+
feature isTriggerDuring: Boolean[1];
|
|
118
|
+
inv { not transitionLinkSource.isTriggerDuring | isTriggerDuring }
|
|
119
|
+
|
|
120
|
+
in feature transitionLinkSource: StatePerformance redefines TransitionPerformance::transitionLinkSource {
|
|
121
|
+
feature redefines accepted;
|
|
122
|
+
feature redefines StatePerformance::acceptable;
|
|
123
|
+
}
|
|
124
|
+
private succession [*] transitionLinkSource.nonDoMiddle then [1] Performance::self;
|
|
125
|
+
|
|
126
|
+
private feature transitionLinkTarget [0..1] : Occurrence = transitionLink.laterOccurrence {
|
|
127
|
+
inv { (that istype StatePerformance) implies
|
|
128
|
+
(that as StatePerformance).incomingTransitionTrigger == trigger }
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
feature acceptable: Transfer [*] subsets transitionLinkSource.acceptable, triggerTarget.incomingTransfersToSelf;
|
|
132
|
+
|
|
133
|
+
feature trigger redefines TransitionPerformance::trigger subsets acceptable, transitionLinkSource.accepted {
|
|
134
|
+
feature redefines endShot;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
private feature tdNum: Natural [1] = if not isTriggerDuring ? 0 else size(trigger);
|
|
138
|
+
private connector linkTriggerDuring: HappensDuring[tdNum] from [*] trigger.endShot to [0..1] transitionLinkSource;
|
|
139
|
+
|
|
140
|
+
private succession all [*] acceptable then [*] guard;
|
|
141
|
+
private succession [*] guard then [1] transitionLinkSource.exit;
|
|
142
|
+
|
|
143
|
+
private succession [accNum] accept then [1] transitionLinkSource.exit;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
standard library package StringFunctions {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines functions on String values, including those corresponding to string concatenation
|
|
5
|
+
* and comparison operators in the KerML expression notation.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
public import ScalarValues::*;
|
|
9
|
+
|
|
10
|
+
function '+' specializes ScalarFunctions::'+' { in x: String[1]; in y:String[1]; return : String[1]; }
|
|
11
|
+
|
|
12
|
+
function Length{ in x: String[1]; return : Natural[1]; }
|
|
13
|
+
function Substring{ in x: String[1]; in lower: Integer[1]; in upper: Integer[1]; return : String[1]; }
|
|
14
|
+
|
|
15
|
+
function '<' specializes ScalarFunctions::'<' { in x: String[1]; in y: String[1]; return : Boolean[1]; }
|
|
16
|
+
function '>' specializes ScalarFunctions::'>' { in x: String[1]; in y: String[1]; return : Boolean[1]; }
|
|
17
|
+
function '<=' specializes ScalarFunctions::'<=' { in x: String[1]; in y: String[1]; return : Boolean[1]; }
|
|
18
|
+
function '>=' specializes ScalarFunctions::'>=' { in x: String[1]; in y: String[1]; return : Boolean[1]; }
|
|
19
|
+
|
|
20
|
+
function '==' specializes DataFunctions::'==' { in x: String[0..1]; in y: String[0..1]; return : Boolean[1]; }
|
|
21
|
+
|
|
22
|
+
function ToString specializes BaseFunctions::ToString { in x: String[1];
|
|
23
|
+
return : String[1] = x;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
standard library package Transfers {
|
|
2
|
+
doc
|
|
3
|
+
/*
|
|
4
|
+
* This package defines the transfer interactions used to type flows.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
private import Base::Anything;
|
|
8
|
+
private import Occurrences::*;
|
|
9
|
+
private import Links::*;
|
|
10
|
+
private import Objects::BinaryLinkObject;
|
|
11
|
+
private import Performances::Performance;
|
|
12
|
+
private import Performances::performances;
|
|
13
|
+
private import ScalarValues::Boolean;
|
|
14
|
+
private import ScalarValues::Natural;
|
|
15
|
+
private import SequenceFunctions::*;
|
|
16
|
+
|
|
17
|
+
interaction Transfer specializes Performance, BinaryLink {
|
|
18
|
+
doc
|
|
19
|
+
/*
|
|
20
|
+
* A Transfer represents the transfer of a payload from the source of the interaction
|
|
21
|
+
* to the target of the interaction.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
end feature source: Occurrence redefines BinaryLink::source {
|
|
25
|
+
doc
|
|
26
|
+
/*
|
|
27
|
+
* The entity whose output is the source of the payload to be transferred.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
feature sourceOutput: Anything[0..*];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
end feature target: Occurrence redefines BinaryLink::target {
|
|
34
|
+
doc
|
|
35
|
+
/*
|
|
36
|
+
* The entity whose input is the target of the payload to be transferred.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
feature targetInput: Anything[0..*];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
feature isInstant: Boolean[1] {
|
|
43
|
+
doc
|
|
44
|
+
/*
|
|
45
|
+
* If isInstance is true, then the transfer is instantaneous.
|
|
46
|
+
*/
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
feature payload: Anything[1..*] {
|
|
50
|
+
doc
|
|
51
|
+
/*
|
|
52
|
+
* The things that are to be transferred.
|
|
53
|
+
*/
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
feature payloadNum: Natural [1] = size(payload);
|
|
57
|
+
|
|
58
|
+
private instantNum: Natural[1] = if isInstant? 1 else 0;
|
|
59
|
+
private binding instant[instantNum] of [0..1] startShot = [0..1] endShot {
|
|
60
|
+
doc
|
|
61
|
+
/*
|
|
62
|
+
* If isInstant is true, then the start and end of the transfer happen at the same time.
|
|
63
|
+
*/
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interaction MessageTransfer specializes Transfer {
|
|
68
|
+
doc
|
|
69
|
+
/*
|
|
70
|
+
* A MessageTransfer is a Transfer that does not specify where the payload is picked
|
|
71
|
+
* up and dropped off (see FlowTransfer). They are sent by SendPerformances and
|
|
72
|
+
* accepted by AcceptPerformances.
|
|
73
|
+
*/
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interaction FlowTransfer specializes Transfer disjoint from MessageTransfer {
|
|
77
|
+
doc
|
|
78
|
+
/*
|
|
79
|
+
* A FlowTransfer is a Transfer identifying an output feature of the source from which
|
|
80
|
+
* to pick up a payload and an input feature of the target to which to drop it off. They can
|
|
81
|
+
* start when the payload is available at the source and move or copy it to the target.
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
feature isMove: Boolean[1] default true {
|
|
85
|
+
doc
|
|
86
|
+
/*
|
|
87
|
+
* If isMove is true, then the entire payload leaves the source at the start
|
|
88
|
+
* of the transfer.
|
|
89
|
+
*/
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
feature isPush: Boolean[1] default true {
|
|
93
|
+
doc
|
|
94
|
+
/*
|
|
95
|
+
* If isPush is true, then the transfer begins when the payload is available
|
|
96
|
+
* at the source.
|
|
97
|
+
*/
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
connector sourceOutputLink: BinaryLinkObject[payloadNum] {
|
|
101
|
+
doc
|
|
102
|
+
/*
|
|
103
|
+
* The output of the payloads from the sourceOutput.
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
end [1] feature transferSource references source;
|
|
107
|
+
end [payloadNum] feature transferPayload references payload subsets transferSource.sourceOutput;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
connector targetInputLink: BinaryLinkObject[payloadNum] {
|
|
111
|
+
doc
|
|
112
|
+
/*
|
|
113
|
+
* The input of the payload to the targetInput.
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
end [1] feature transferTarget references target;
|
|
117
|
+
end [payloadNum] feature transferPayload references payload subsets transferTarget.targetInput;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private connector sending: HappensDuring[payloadNum] from [1] startShot to [payloadNum] sourceOutputLink {
|
|
121
|
+
doc
|
|
122
|
+
/*
|
|
123
|
+
* The start of the transfer happens during the output of each of the payloads from the
|
|
124
|
+
* source.
|
|
125
|
+
*/
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private connector moving: HappensWhile[0..*] from [0..*] sourceOutputLink.endShot to [0..1] startShot {
|
|
129
|
+
doc
|
|
130
|
+
/*
|
|
131
|
+
* If isMove is true, then all payloads leave the source at the start
|
|
132
|
+
* of the transfer.
|
|
133
|
+
*/
|
|
134
|
+
}
|
|
135
|
+
private inv { isMove implies size(moving) == size(sourceOutputLink) }
|
|
136
|
+
|
|
137
|
+
private connector pushing: HappensWhile[0..*] from [0..*] sourceOutputLink.startShot to [0..1] startShot {
|
|
138
|
+
doc
|
|
139
|
+
/*
|
|
140
|
+
* If isPush is true, then the transfer begins when the payloads are available
|
|
141
|
+
* at the source.
|
|
142
|
+
*/
|
|
143
|
+
}
|
|
144
|
+
private inv { isPush implies size(pushing) == size(sourceOutputLink) }
|
|
145
|
+
|
|
146
|
+
private connector delivering: HappensWhile[payloadNum] from [payloadNum] targetInputLink.startShot to [1] endShot {
|
|
147
|
+
doc
|
|
148
|
+
/*
|
|
149
|
+
* The input of each of the payloads to the target starts at the end of the transfer.
|
|
150
|
+
*/
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
interaction TransferBefore specializes Transfer, HappensBefore intersects Transfer, HappensBefore {
|
|
155
|
+
doc
|
|
156
|
+
/*
|
|
157
|
+
* TransferBefore is a specialization of Transfer in which the source happens before
|
|
158
|
+
* the transfer, which happens before the target.
|
|
159
|
+
*/
|
|
160
|
+
|
|
161
|
+
end feature source: Occurrence redefines Transfer::source, HappensBefore::earlierOccurrence;
|
|
162
|
+
end feature target: Occurrence redefines Transfer::target, HappensBefore::laterOccurrence;
|
|
163
|
+
|
|
164
|
+
feature self: TransferBefore redefines Performance::self;
|
|
165
|
+
|
|
166
|
+
private succession source then self;
|
|
167
|
+
private succession self then target;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
interaction FlowTransferBefore specializes TransferBefore, FlowTransfer intersects FlowTransfer, TransferBefore {
|
|
171
|
+
doc
|
|
172
|
+
/*
|
|
173
|
+
* FlowTransferBefore is a FlowTransfer that is also a TransferBefore.
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
end feature source: Occurrence redefines Transfer::source, TransferBefore::source;
|
|
177
|
+
end feature target: Occurrence redefines Transfer::target, TransferBefore::target;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
abstract step transfers: Transfer[0..*] nonunique subsets performances, binaryLinks {
|
|
181
|
+
doc
|
|
182
|
+
/*
|
|
183
|
+
* transfers is a specialization of performances and binaryLinks restricted to type
|
|
184
|
+
* Transfer.
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
end feature source: Occurrence redefines Transfer::source, binaryLinks::source;
|
|
188
|
+
end feature target: Occurrence redefines Transfer::target, binaryLinks::target;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
abstract step messageTransfers: MessageTransfer[0..*] nonunique subsets transfers {
|
|
192
|
+
doc
|
|
193
|
+
/*
|
|
194
|
+
* messageTransfers is a specialization of transfers restricted to type MessageTransfers.
|
|
195
|
+
*/
|
|
196
|
+
|
|
197
|
+
end feature source: Occurrence redefines MessageTransfer::source, transfers::source;
|
|
198
|
+
end feature target: Occurrence redefines MessageTransfer::target, transfers::target;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
abstract flow flowTransfers: FlowTransfer[0..*] nonunique subsets transfers {
|
|
202
|
+
doc
|
|
203
|
+
/*
|
|
204
|
+
* flowTransfers is a specialization of transfers restricted to type FlowTransfers.
|
|
205
|
+
* It is the default subsetting for non-succession flows.
|
|
206
|
+
*/
|
|
207
|
+
|
|
208
|
+
end feature source: Occurrence redefines FlowTransfer::source, transfers::source;
|
|
209
|
+
end feature target: Occurrence redefines FlowTransfer::target, transfers::target;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
abstract flow transfersBefore: TransferBefore[0..*] nonunique subsets transfers, happensBeforeLinks
|
|
213
|
+
intersects transfers, happensBeforeLinks {
|
|
214
|
+
doc
|
|
215
|
+
/*
|
|
216
|
+
* transfersBefore is a specialization of transfers and happensBeforeLinks restricted to
|
|
217
|
+
* type TransferBefore.
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
end feature source: Occurrence redefines TransferBefore::source, transfers::source, happensBeforeLinks::earlierOccurrence;
|
|
221
|
+
end feature target: Occurrence redefines TransferBefore::target, transfers::target, happensBeforeLinks::laterOccurrence;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
abstract flow flowTransfersBefore: FlowTransferBefore[0..*] nonunique subsets flowTransfers, transfersBefore
|
|
225
|
+
intersects flowTransfers, transfersBefore {
|
|
226
|
+
doc
|
|
227
|
+
/*
|
|
228
|
+
* flowTransfersBefore is a specialization of flowTransfers and transfersBefore that is restricted
|
|
229
|
+
* to type FlowTransferBefore. IT is the default subsetting for succession flows.
|
|
230
|
+
*/
|
|
231
|
+
|
|
232
|
+
end feature source: Occurrence redefines FlowTransferBefore::source, flowTransfers::source, transfersBefore::source;
|
|
233
|
+
end feature target: Occurrence redefines FlowTransferBefore::target, flowTransfers::target, transfersBefore::target;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
behavior SendPerformance specializes Performance {
|
|
237
|
+
doc
|
|
238
|
+
/*
|
|
239
|
+
* SendPerformances are Performance that require an outgoingTransferFromSelf
|
|
240
|
+
* from a designated sender Occurrence carrying a given payload, optionally to a designated receiver.
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
in feature payload [0..*];
|
|
244
|
+
in feature sender: Occurrence[1] default this;
|
|
245
|
+
in feature receiver: Occurrence[0..1];
|
|
246
|
+
feature sentTransfer: MessageTransfer [1] subsets sender.outgoingTransfersFromSelf {
|
|
247
|
+
feature redefines payload = SendPerformance::payload;
|
|
248
|
+
}
|
|
249
|
+
binding [0..1] receiver.incomingTransfersToSelf = [1] sentTransfer;
|
|
250
|
+
|
|
251
|
+
succession self then sentTransfer;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
behavior AcceptPerformance specializes Performance {
|
|
255
|
+
doc
|
|
256
|
+
/*
|
|
257
|
+
* AcceptPerformance is a performance that requires an incomingTransferToSelf
|
|
258
|
+
* of a desigated receiver Occurrence, providing its payload as output.
|
|
259
|
+
*/
|
|
260
|
+
inout feature payload[0..*];
|
|
261
|
+
in feature receiver: Occurrence[1] default this;
|
|
262
|
+
feature acceptedTransfer: MessageTransfer[1] subsets receiver.incomingTransfersToSelf;
|
|
263
|
+
succession acceptedTransfer then self.endShot;
|
|
264
|
+
|
|
265
|
+
binding payload = acceptedTransfer.payload;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
abstract step sendPerformances: SendPerformance[0..*] nonunique subsets performances {
|
|
269
|
+
doc
|
|
270
|
+
/*
|
|
271
|
+
* sendPerformances is a specialization of performances for SendPerformances.
|
|
272
|
+
*/
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
abstract step acceptPerformances: AcceptPerformance[0..*] nonunique subsets performances {
|
|
276
|
+
doc
|
|
277
|
+
/*
|
|
278
|
+
* acceptPerformances is a specialization of performances for AcceptPerformances.
|
|
279
|
+
*/
|
|
280
|
+
}
|
|
281
|
+
}
|