sysml-validate 0.10.18 → 0.14.2

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.
Files changed (121) hide show
  1. package/LICENSE +27 -27
  2. package/README.md +200 -200
  3. package/out/main.js +596 -141
  4. package/out/main.js.map +4 -4
  5. package/package.json +57 -57
  6. package/resources/sysml.dimension-table.json +1 -1
  7. package/resources/sysml.library/Domain Libraries/Analysis/.meta.json +9 -9
  8. package/resources/sysml.library/Domain Libraries/Analysis/.project.json +26 -26
  9. package/resources/sysml.library/Domain Libraries/Analysis/AnalysisTooling.sysml +33 -33
  10. package/resources/sysml.library/Domain Libraries/Analysis/SampledFunctions.sysml +118 -118
  11. package/resources/sysml.library/Domain Libraries/Analysis/StateSpaceRepresentation.sysml +143 -143
  12. package/resources/sysml.library/Domain Libraries/Analysis/TradeStudies.sysml +170 -170
  13. package/resources/sysml.library/Domain Libraries/Cause and Effect/.meta.json +7 -7
  14. package/resources/sysml.library/Domain Libraries/Cause and Effect/.project.json +22 -22
  15. package/resources/sysml.library/Domain Libraries/Cause and Effect/CausationConnections.sysml +82 -82
  16. package/resources/sysml.library/Domain Libraries/Cause and Effect/CauseAndEffect.sysml +81 -81
  17. package/resources/sysml.library/Domain Libraries/Geometry/.meta.json +7 -7
  18. package/resources/sysml.library/Domain Libraries/Geometry/.project.json +26 -26
  19. package/resources/sysml.library/Domain Libraries/Geometry/ShapeItems.sysml +898 -898
  20. package/resources/sysml.library/Domain Libraries/Geometry/SpatialItems.sysml +167 -167
  21. package/resources/sysml.library/Domain Libraries/Metadata/.meta.json +9 -9
  22. package/resources/sysml.library/Domain Libraries/Metadata/.project.json +18 -18
  23. package/resources/sysml.library/Domain Libraries/Metadata/ImageMetadata.sysml +77 -77
  24. package/resources/sysml.library/Domain Libraries/Metadata/ModelingMetadata.sysml +142 -142
  25. package/resources/sysml.library/Domain Libraries/Metadata/ParametersOfInterestMetadata.sysml +38 -38
  26. package/resources/sysml.library/Domain Libraries/Metadata/RiskMetadata.sysml +99 -99
  27. package/resources/sysml.library/Domain Libraries/Quantities and Units/.meta.json +28 -28
  28. package/resources/sysml.library/Domain Libraries/Quantities and Units/.project.json +22 -22
  29. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQ.sysml +42 -42
  30. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQAcoustics.sysml +439 -439
  31. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQAtomicNuclear.sysml +2726 -2726
  32. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQBase.sysml +206 -206
  33. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQCharacteristicNumbers.sysml +1991 -1991
  34. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQChemistryMolecular.sysml +1353 -1353
  35. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQCondensedMatter.sysml +1223 -1223
  36. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQElectromagnetism.sysml +2333 -2333
  37. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQInformation.sysml +958 -958
  38. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQLight.sysml +1537 -1537
  39. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQMechanics.sysml +1564 -1564
  40. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQSpaceTime.sysml +1169 -1169
  41. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQThermodynamics.sysml +1256 -1256
  42. package/resources/sysml.library/Domain Libraries/Quantities and Units/MeasurementRefCalculations.sysml +30 -30
  43. package/resources/sysml.library/Domain Libraries/Quantities and Units/MeasurementReferences.sysml +526 -526
  44. package/resources/sysml.library/Domain Libraries/Quantities and Units/Quantities.sysml +107 -107
  45. package/resources/sysml.library/Domain Libraries/Quantities and Units/QuantityCalculations.sysml +70 -70
  46. package/resources/sysml.library/Domain Libraries/Quantities and Units/SI.sysml +378 -378
  47. package/resources/sysml.library/Domain Libraries/Quantities and Units/SIPrefixes.sysml +48 -48
  48. package/resources/sysml.library/Domain Libraries/Quantities and Units/TensorCalculations.sysml +49 -49
  49. package/resources/sysml.library/Domain Libraries/Quantities and Units/Time.sysml +274 -274
  50. package/resources/sysml.library/Domain Libraries/Quantities and Units/USCustomaryUnits.sysml +260 -260
  51. package/resources/sysml.library/Domain Libraries/Quantities and Units/VectorCalculations.sysml +62 -62
  52. package/resources/sysml.library/Domain Libraries/Requirement Derivation/.meta.json +7 -7
  53. package/resources/sysml.library/Domain Libraries/Requirement Derivation/.project.json +18 -18
  54. package/resources/sysml.library/Domain Libraries/Requirement Derivation/DerivationConnections.sysml +62 -62
  55. package/resources/sysml.library/Domain Libraries/Requirement Derivation/RequirementDerivation.sysml +38 -38
  56. package/resources/sysml.library/Kernel Libraries/Kernel Data Type Library/.meta.json +8 -8
  57. package/resources/sysml.library/Kernel Libraries/Kernel Data Type Library/.project.json +10 -10
  58. package/resources/sysml.library/Kernel Libraries/Kernel Data Type Library/Collections.kerml +176 -176
  59. package/resources/sysml.library/Kernel Libraries/Kernel Data Type Library/ScalarValues.kerml +23 -23
  60. package/resources/sysml.library/Kernel Libraries/Kernel Data Type Library/VectorValues.kerml +63 -63
  61. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/.meta.json +22 -22
  62. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/.project.json +14 -14
  63. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/BaseFunctions.kerml +79 -79
  64. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/BooleanFunctions.kerml +22 -22
  65. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/CollectionFunctions.kerml +68 -68
  66. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/ComplexFunctions.kerml +47 -47
  67. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/ControlFunctions.kerml +116 -116
  68. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/DataFunctions.kerml +42 -42
  69. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/IntegerFunctions.kerml +43 -43
  70. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/NaturalFunctions.kerml +27 -27
  71. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/NumericalFunctions.kerml +42 -42
  72. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/OccurrenceFunctions.kerml +153 -153
  73. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/RationalFunctions.kerml +49 -49
  74. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/RealFunctions.kerml +56 -56
  75. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/ScalarFunctions.kerml +32 -32
  76. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/SequenceFunctions.kerml +110 -110
  77. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/StringFunctions.kerml +25 -25
  78. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/TrigFunctions.kerml +34 -34
  79. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/VectorFunctions.kerml +272 -272
  80. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/.meta.json +21 -21
  81. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/.project.json +14 -14
  82. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Base.kerml +94 -94
  83. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Clocks.kerml +155 -155
  84. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/ControlPerformances.kerml +134 -134
  85. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/FeatureReferencingPerformances.kerml +189 -189
  86. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/KerML.kerml +483 -483
  87. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Links.kerml +66 -66
  88. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Metaobjects.kerml +57 -57
  89. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Objects.kerml +212 -212
  90. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Observation.kerml +160 -160
  91. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Occurrences.kerml +992 -992
  92. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Performances.kerml +292 -292
  93. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/SpatialFrames.kerml +196 -196
  94. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/StatePerformances.kerml +144 -144
  95. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Transfers.kerml +280 -280
  96. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/TransitionPerformances.kerml +65 -65
  97. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Triggers.kerml +187 -187
  98. package/resources/sysml.library/LICENSE +276 -276
  99. package/resources/sysml.library/NOTICE.md +20 -20
  100. package/resources/sysml.library/Systems Library/Actions.sysml +556 -556
  101. package/resources/sysml.library/Systems Library/Allocations.sysml +28 -28
  102. package/resources/sysml.library/Systems Library/AnalysisCases.sysml +37 -37
  103. package/resources/sysml.library/Systems Library/Attributes.sysml +24 -24
  104. package/resources/sysml.library/Systems Library/Calculations.sysml +36 -36
  105. package/resources/sysml.library/Systems Library/Cases.sysml +70 -70
  106. package/resources/sysml.library/Systems Library/Connections.sysml +59 -59
  107. package/resources/sysml.library/Systems Library/Constraints.sysml +43 -43
  108. package/resources/sysml.library/Systems Library/Flows.sysml +125 -125
  109. package/resources/sysml.library/Systems Library/Interfaces.sysml +88 -88
  110. package/resources/sysml.library/Systems Library/Items.sysml +152 -152
  111. package/resources/sysml.library/Systems Library/Metadata.sysml +31 -31
  112. package/resources/sysml.library/Systems Library/Parts.sysml +80 -80
  113. package/resources/sysml.library/Systems Library/Ports.sysml +53 -53
  114. package/resources/sysml.library/Systems Library/Requirements.sysml +193 -193
  115. package/resources/sysml.library/Systems Library/StandardViewDefinitions.sysml +123 -123
  116. package/resources/sysml.library/Systems Library/States.sysml +102 -102
  117. package/resources/sysml.library/Systems Library/SysML.sysml +539 -539
  118. package/resources/sysml.library/Systems Library/UseCases.sysml +56 -56
  119. package/resources/sysml.library/Systems Library/VerificationCases.sysml +102 -102
  120. package/resources/sysml.library/Systems Library/Views.sysml +163 -163
  121. package/resources/sysml.library.index.json +1 -1
@@ -1,10 +1,10 @@
1
- {
2
- "index": {
3
- "AnalysisTooling": "AnalysisTooling.sysml",
4
- "SampledFunctions": "SampledFunctions.sysml",
5
- "StateSpaceRepresentation": "StateSpaceRepresentation.sysml",
6
- "TradeStudies": "TradeStudies.sysml"
7
- },
8
- "created": "2025-03-13T00:00:00Z",
9
- "metamodel": "https://www.omg.org/spec/SysML/20250201"
1
+ {
2
+ "index": {
3
+ "AnalysisTooling": "AnalysisTooling.sysml",
4
+ "SampledFunctions": "SampledFunctions.sysml",
5
+ "StateSpaceRepresentation": "StateSpaceRepresentation.sysml",
6
+ "TradeStudies": "TradeStudies.sysml"
7
+ },
8
+ "created": "2025-03-13T00:00:00Z",
9
+ "metamodel": "https://www.omg.org/spec/SysML/20250201"
10
10
  }
@@ -1,27 +1,27 @@
1
- {
2
- "name": "SysML Analysis Library",
3
- "version": "2.0.0",
4
- "description": "Standard analysis domain library for the Systems Modeling Language (SysML)",
5
- "usage": [
6
- {
7
- "resource": "https://www.omg.org/spec/KerML/20250201/Semantic-Library.kpar",
8
- "versionConstraint": "1.0.0"
9
- },
10
- {
11
- "resource": "https://www.omg.org/spec/KerML/20250201/Data-Type-Library.kpar",
12
- "versionConstraint": "1.0.0"
13
- },
14
- {
15
- "resource": "https://www.omg.org/spec/KerML/20250201/Function-Library.kpar",
16
- "versionConstraint": "1.0.0"
17
- },
18
- {
19
- "resource": "https://www.omg.org/spec/SysML/20250201/Systems-Library.kpar",
20
- "versionConstraint": "2.0.0"
21
- },
22
- {
23
- "resource": "https://www.omg.org/spec/KerML/20250201/Quantities-and-Units-Library.kpar",
24
- "versionConstraint": "2.0.0"
25
- }
26
- ]
1
+ {
2
+ "name": "SysML Analysis Library",
3
+ "version": "2.0.0",
4
+ "description": "Standard analysis domain library for the Systems Modeling Language (SysML)",
5
+ "usage": [
6
+ {
7
+ "resource": "https://www.omg.org/spec/KerML/20250201/Semantic-Library.kpar",
8
+ "versionConstraint": "1.0.0"
9
+ },
10
+ {
11
+ "resource": "https://www.omg.org/spec/KerML/20250201/Data-Type-Library.kpar",
12
+ "versionConstraint": "1.0.0"
13
+ },
14
+ {
15
+ "resource": "https://www.omg.org/spec/KerML/20250201/Function-Library.kpar",
16
+ "versionConstraint": "1.0.0"
17
+ },
18
+ {
19
+ "resource": "https://www.omg.org/spec/SysML/20250201/Systems-Library.kpar",
20
+ "versionConstraint": "2.0.0"
21
+ },
22
+ {
23
+ "resource": "https://www.omg.org/spec/KerML/20250201/Quantities-and-Units-Library.kpar",
24
+ "versionConstraint": "2.0.0"
25
+ }
26
+ ]
27
27
  }
@@ -1,34 +1,34 @@
1
- standard library package AnalysisTooling {
2
- doc
3
- /*
4
- * This package contains definitions for metadata annotations related
5
- * to analysis tool integration.
6
- */
7
-
8
- private import ScalarValues::*;
9
-
10
- metadata def ToolExecution {
11
- doc
12
- /*
13
- * ToolExecution metadata identifies an external analysis tool to be
14
- * used to implement the annotated action.
15
- */
16
-
17
- attribute toolName : String;
18
- attribute uri : String;
19
- }
20
-
21
- metadata def ToolVariable {
22
- doc
23
- /*
24
- * ToolVariable metadata is used in the context of an action that has
25
- * been annotated with ToolExecution metadata. It is used to annotate
26
- * a parameter or other feature of the action with the name of the
27
- * variable in the tool that is to correspond to the annotated
28
- * feature.
29
- */
30
-
31
- attribute name : String;
32
- }
33
-
1
+ standard library package AnalysisTooling {
2
+ doc
3
+ /*
4
+ * This package contains definitions for metadata annotations related
5
+ * to analysis tool integration.
6
+ */
7
+
8
+ private import ScalarValues::*;
9
+
10
+ metadata def ToolExecution {
11
+ doc
12
+ /*
13
+ * ToolExecution metadata identifies an external analysis tool to be
14
+ * used to implement the annotated action.
15
+ */
16
+
17
+ attribute toolName : String;
18
+ attribute uri : String;
19
+ }
20
+
21
+ metadata def ToolVariable {
22
+ doc
23
+ /*
24
+ * ToolVariable metadata is used in the context of an action that has
25
+ * been annotated with ToolExecution metadata. It is used to annotate
26
+ * a parameter or other feature of the action with the name of the
27
+ * variable in the tool that is to correspond to the annotated
28
+ * feature.
29
+ */
30
+
31
+ attribute name : String;
32
+ }
33
+
34
34
  }
@@ -1,119 +1,119 @@
1
- standard library package SampledFunctions {
2
- doc
3
- /*
4
- * This package provides a library model of discretely sampled mathematical functions.
5
- */
6
-
7
- private import Base::Anything;
8
- private import ScalarValues::Positive;
9
- private import Collections::KeyValuePair;
10
- private import Collections::OrderedMap;
11
- private import SequenceFunctions::size;
12
- private import ControlFunctions::forAll;
13
- private import ControlFunctions::collect;
14
- private import ControlFunctions::select;
15
-
16
- attribute def SamplePair :> KeyValuePair {
17
- doc
18
- /*
19
- * SamplePair is a key-value pair of a domain-value and a range-value, used as a sample element in SampledFunction.
20
- */
21
-
22
- attribute domainValue :>> key;
23
- attribute rangeValue :>> val;
24
- }
25
-
26
- attribute def SampledFunction :> OrderedMap {
27
- doc
28
- /*
29
- * SampledFunction is a variable-size, ordered collection of 'SamplePair' elements that represents a generic, discretely sampled,
30
- * uni-variate or multi-variate mathematical function. The function must be montonic, either strictly increasing or strictly
31
- * decreasing.
32
- *
33
- * It maps discrete domain values to discrete range values.
34
- * The domain of the function is represented by the sequence of 'domainValue' of each 'SamplePair' in 'samples', and
35
- * the range of the function is represented by the sequence of 'rangeValue' of each 'SamplePair' in 'samples'.
36
- */
37
-
38
- attribute samples: SamplePair[0..*] ordered :>> elements;
39
-
40
- assert constraint {
41
- // Note: Assumes the functions '<' and '>' are defined for the domain type.
42
- (1..size(samples)-1)->forAll { in i; (samples.domainValue#(i) < samples.domainValue#(i+1)) } or // Strictly increasing
43
- (1..size(samples)-1)->forAll { in i; (samples.domainValue#(i) > samples.domainValue#(i+1)) } // Strictly decreasing
44
- }
45
- }
46
-
47
- calc def Domain {
48
- doc
49
- /*
50
- * Domain returns the sequence of the domainValues of all samples in a SampledFunction.
51
- */
52
-
53
- in fn : SampledFunction;
54
- return : Anything[0..*] = fn.samples.domainValue;
55
- }
56
-
57
- calc def Range {
58
- doc
59
- /*
60
- * Range returns the sequence of the rangeValues of all samples in a SampledFunction.
61
- */
62
-
63
- in fn : SampledFunction;
64
- return : Anything[0..*] = fn.samples.rangeValue;
65
- }
66
-
67
- calc def Sample {
68
- doc
69
- /*
70
- * Sample returns a SampledFunction that samples a given calculation over a sequence of domainValues.
71
- */
72
-
73
- in calc calculation { in x; }
74
- in attribute domainValues [0..*];
75
- return sampling = new SampledFunction (
76
- samples = domainValues->collect { in x; new SamplePair(x, calculation(x)) }
77
- );
78
- }
79
-
80
- calc def Interpolate {
81
- doc
82
- /*
83
- * An Interpolate calculation returns an interpolated range value from a given SampledFunction for a given domain value.
84
- * If the input domain value is outside the bounds of the domainValues of the SampleFunction, null is returned.
85
- */
86
-
87
- in attribute fn : SampledFunction;
88
- in attribute value;
89
- return attribute result;
90
- }
91
-
92
- calc interpolateLinear : Interpolate {
93
- doc
94
- /*
95
- * interpolateLinear is an Interpolate calculation assuming a linear functional form between SamplePairs.
96
- */
97
-
98
- in attribute fn : SampledFunction;
99
- in attribute value;
100
-
101
- private attribute domainValues = Domain(fn);
102
- private attribute index : Positive[0..1] =
103
- (1..size(domainValues))->select { in i : Positive; domainValues#(i) <= value }#(1);
104
-
105
- private calc def Linear {
106
- in attribute lowerSample : SamplePair;
107
- in attribute upperSample : SamplePair;
108
- in attribute value;
109
- private attribute f = (value - lowerSample.domainValue) / (lowerSample.domainValue - upperSample.domainValue);
110
- return result = upperSample.rangeValue + f * (lowerSample.rangeValue - upperSample.rangeValue);
111
- }
112
-
113
- return result [0..1] =
114
- if index == null or index == size(domainValues)? null
115
- else if domainValues#(index) < domainValues#(index+1)? Linear(fn.samples#(index), fn.samples#(index+1), value)
116
- else Linear(fn.samples#(index+1), fn.samples#(index), value);
117
- }
118
-
1
+ standard library package SampledFunctions {
2
+ doc
3
+ /*
4
+ * This package provides a library model of discretely sampled mathematical functions.
5
+ */
6
+
7
+ private import Base::Anything;
8
+ private import ScalarValues::Positive;
9
+ private import Collections::KeyValuePair;
10
+ private import Collections::OrderedMap;
11
+ private import SequenceFunctions::size;
12
+ private import ControlFunctions::forAll;
13
+ private import ControlFunctions::collect;
14
+ private import ControlFunctions::select;
15
+
16
+ attribute def SamplePair :> KeyValuePair {
17
+ doc
18
+ /*
19
+ * SamplePair is a key-value pair of a domain-value and a range-value, used as a sample element in SampledFunction.
20
+ */
21
+
22
+ attribute domainValue :>> key;
23
+ attribute rangeValue :>> val;
24
+ }
25
+
26
+ attribute def SampledFunction :> OrderedMap {
27
+ doc
28
+ /*
29
+ * SampledFunction is a variable-size, ordered collection of 'SamplePair' elements that represents a generic, discretely sampled,
30
+ * uni-variate or multi-variate mathematical function. The function must be montonic, either strictly increasing or strictly
31
+ * decreasing.
32
+ *
33
+ * It maps discrete domain values to discrete range values.
34
+ * The domain of the function is represented by the sequence of 'domainValue' of each 'SamplePair' in 'samples', and
35
+ * the range of the function is represented by the sequence of 'rangeValue' of each 'SamplePair' in 'samples'.
36
+ */
37
+
38
+ attribute samples: SamplePair[0..*] ordered :>> elements;
39
+
40
+ assert constraint {
41
+ // Note: Assumes the functions '<' and '>' are defined for the domain type.
42
+ (1..size(samples)-1)->forAll { in i; (samples.domainValue#(i) < samples.domainValue#(i+1)) } or // Strictly increasing
43
+ (1..size(samples)-1)->forAll { in i; (samples.domainValue#(i) > samples.domainValue#(i+1)) } // Strictly decreasing
44
+ }
45
+ }
46
+
47
+ calc def Domain {
48
+ doc
49
+ /*
50
+ * Domain returns the sequence of the domainValues of all samples in a SampledFunction.
51
+ */
52
+
53
+ in fn : SampledFunction;
54
+ return : Anything[0..*] = fn.samples.domainValue;
55
+ }
56
+
57
+ calc def Range {
58
+ doc
59
+ /*
60
+ * Range returns the sequence of the rangeValues of all samples in a SampledFunction.
61
+ */
62
+
63
+ in fn : SampledFunction;
64
+ return : Anything[0..*] = fn.samples.rangeValue;
65
+ }
66
+
67
+ calc def Sample {
68
+ doc
69
+ /*
70
+ * Sample returns a SampledFunction that samples a given calculation over a sequence of domainValues.
71
+ */
72
+
73
+ in calc calculation { in x; }
74
+ in attribute domainValues [0..*];
75
+ return sampling = new SampledFunction (
76
+ samples = domainValues->collect { in x; new SamplePair(x, calculation(x)) }
77
+ );
78
+ }
79
+
80
+ calc def Interpolate {
81
+ doc
82
+ /*
83
+ * An Interpolate calculation returns an interpolated range value from a given SampledFunction for a given domain value.
84
+ * If the input domain value is outside the bounds of the domainValues of the SampleFunction, null is returned.
85
+ */
86
+
87
+ in attribute fn : SampledFunction;
88
+ in attribute value;
89
+ return attribute result;
90
+ }
91
+
92
+ calc interpolateLinear : Interpolate {
93
+ doc
94
+ /*
95
+ * interpolateLinear is an Interpolate calculation assuming a linear functional form between SamplePairs.
96
+ */
97
+
98
+ in attribute fn : SampledFunction;
99
+ in attribute value;
100
+
101
+ private attribute domainValues = Domain(fn);
102
+ private attribute index : Positive[0..1] =
103
+ (1..size(domainValues))->select { in i : Positive; domainValues#(i) <= value }#(1);
104
+
105
+ private calc def Linear {
106
+ in attribute lowerSample : SamplePair;
107
+ in attribute upperSample : SamplePair;
108
+ in attribute value;
109
+ private attribute f = (value - lowerSample.domainValue) / (lowerSample.domainValue - upperSample.domainValue);
110
+ return result = upperSample.rangeValue + f * (lowerSample.rangeValue - upperSample.rangeValue);
111
+ }
112
+
113
+ return result [0..1] =
114
+ if index == null or index == size(domainValues)? null
115
+ else if domainValues#(index) < domainValues#(index+1)? Linear(fn.samples#(index), fn.samples#(index+1), value)
116
+ else Linear(fn.samples#(index+1), fn.samples#(index), value);
117
+ }
118
+
119
119
  }
@@ -1,143 +1,143 @@
1
- standard library package StateSpaceRepresentation {
2
- doc
3
- /*
4
- * This package provides a model of the foundational state-space system representation,
5
- * commonly used in control systems.
6
- */
7
-
8
- private import ISQ::DurationValue;
9
- private import Quantities::VectorQuantityValue;
10
- private import VectorCalculations::*;
11
-
12
- abstract attribute def StateSpace :> VectorQuantityValue;
13
- abstract attribute def Input :> VectorQuantityValue;
14
- abstract attribute def Output :> VectorQuantityValue;
15
-
16
- abstract calc def GetNextState {
17
- in input: Input;
18
- in stateSpace: StateSpace;
19
- in timeStep: DurationValue;
20
- return : StateSpace;
21
- }
22
- abstract calc def GetOutput {
23
- in input: Input;
24
- in stateSpace: StateSpace;
25
- return : Output;
26
- }
27
-
28
- abstract action def StateSpaceEventDef {
29
- doc
30
- /*
31
- * Events to be received.
32
- */
33
- }
34
- action def ZeroCrossingEventDef :> StateSpaceEventDef;
35
-
36
- item def StateSpaceItem {
37
- doc
38
- /*
39
- * Item for SSR connection
40
- */
41
- }
42
-
43
- abstract action def StateSpaceDynamics {
44
- doc
45
- /*
46
- * StateSpaceDynamics is the simplest form of State Space Representation,
47
- * and nextState directly computes the stateSpace of the next timestep.
48
- */
49
-
50
- in attribute input: Input;
51
-
52
- abstract calc getNextState: GetNextState;
53
- abstract calc getOutput: GetOutput;
54
- attribute stateSpace: StateSpace;
55
-
56
- out attribute output: Output = getOutput(input, stateSpace);
57
- }
58
-
59
- abstract attribute def StateDerivative :> VectorQuantityValue {
60
- doc
61
- /*
62
- * The definition of the time derivative of StateSpace, which means dx/dt, where x is StateSpace
63
- */
64
-
65
- ref stateSpace: StateSpace;
66
- constraint { stateSpace.order == order }
67
- }
68
-
69
- abstract calc def GetDerivative {
70
- doc
71
- /*
72
- * Computes the time derivative of stateSpace, which corresponds dx/dt = f(u, x), where u is input and x is stateSpace.
73
- */
74
-
75
- in input: Input;
76
- in stateSpace: StateSpace;
77
- return : StateDerivative;
78
- }
79
-
80
- abstract calc def Integrate {
81
- doc
82
- /*
83
- * Integrates stateSpace to compute the next stateSpace, which corresponds to x + int dx/dt dt.
84
- * Its actual implementation should be given by a solver.
85
- */
86
-
87
- in getDerivative: GetDerivative;
88
- in input: Input;
89
- in initialState: StateSpace;
90
- in timeInterval: DurationValue;
91
- return result: StateSpace;
92
- }
93
-
94
- abstract action def ContinuousStateSpaceDynamics :> StateSpaceDynamics {
95
- doc
96
- /*
97
- * ContinuousStateSpaceDynamics represents continuous behavior.
98
- * derivative needs to return a time derivative of stateSpace, i.e. dx/dt.
99
- */
100
-
101
- abstract calc getDerivative: GetDerivative;
102
- calc :>> getNextState: GetNextState {
103
- /* We compute nextState by Integrate defined above by giving derivative calc. */
104
- calc integrate: Integrate {
105
- in getDerivative = ContinuousStateSpaceDynamics::getDerivative;
106
- in input = GetNextState::input;
107
- in initialState = GetNextState::stateSpace;
108
- in timeInterval = GetNextState::timeStep;
109
- }
110
- return result = integrate.result;
111
- }
112
-
113
- event occurrence zeroCrossingEvents[0..*] : ZeroCrossingEventDef {
114
- /* ContinuousStateSpaceDynamics may cause zero crossings anomaly. */
115
- }
116
- }
117
-
118
- abstract calc def GetDifference {
119
- doc
120
- /*
121
- * Computes difference of stateSpace by one timestep, that is x(k+1) - x(k),
122
- * where k is the timestep number.
123
- */
124
-
125
- in input: Input;
126
- in stateSpace: StateSpace;
127
- return : StateSpace;
128
- }
129
-
130
- abstract action def DiscreteStateSpaceDynamics :> StateSpaceDynamics {
131
- doc
132
- /*
133
- * DiscreteStateSpaceDynamics represents discrete behavior.
134
- * differences needs to return difference of the stateSpace for each timestep.
135
- */
136
-
137
- abstract calc getDifference: GetDifference;
138
- calc :>> getNextState: GetNextState {
139
- attribute diff: StateSpace = getDifference(input, stateSpace);
140
- return result = stateSpace + diff;
141
- }
142
- }
143
- }
1
+ standard library package StateSpaceRepresentation {
2
+ doc
3
+ /*
4
+ * This package provides a model of the foundational state-space system representation,
5
+ * commonly used in control systems.
6
+ */
7
+
8
+ private import ISQ::DurationValue;
9
+ private import Quantities::VectorQuantityValue;
10
+ private import VectorCalculations::*;
11
+
12
+ abstract attribute def StateSpace :> VectorQuantityValue;
13
+ abstract attribute def Input :> VectorQuantityValue;
14
+ abstract attribute def Output :> VectorQuantityValue;
15
+
16
+ abstract calc def GetNextState {
17
+ in input: Input;
18
+ in stateSpace: StateSpace;
19
+ in timeStep: DurationValue;
20
+ return : StateSpace;
21
+ }
22
+ abstract calc def GetOutput {
23
+ in input: Input;
24
+ in stateSpace: StateSpace;
25
+ return : Output;
26
+ }
27
+
28
+ abstract action def StateSpaceEventDef {
29
+ doc
30
+ /*
31
+ * Events to be received.
32
+ */
33
+ }
34
+ action def ZeroCrossingEventDef :> StateSpaceEventDef;
35
+
36
+ item def StateSpaceItem {
37
+ doc
38
+ /*
39
+ * Item for SSR connection
40
+ */
41
+ }
42
+
43
+ abstract action def StateSpaceDynamics {
44
+ doc
45
+ /*
46
+ * StateSpaceDynamics is the simplest form of State Space Representation,
47
+ * and nextState directly computes the stateSpace of the next timestep.
48
+ */
49
+
50
+ in attribute input: Input;
51
+
52
+ abstract calc getNextState: GetNextState;
53
+ abstract calc getOutput: GetOutput;
54
+ attribute stateSpace: StateSpace;
55
+
56
+ out attribute output: Output = getOutput(input, stateSpace);
57
+ }
58
+
59
+ abstract attribute def StateDerivative :> VectorQuantityValue {
60
+ doc
61
+ /*
62
+ * The definition of the time derivative of StateSpace, which means dx/dt, where x is StateSpace
63
+ */
64
+
65
+ ref stateSpace: StateSpace;
66
+ constraint { stateSpace.order == order }
67
+ }
68
+
69
+ abstract calc def GetDerivative {
70
+ doc
71
+ /*
72
+ * Computes the time derivative of stateSpace, which corresponds dx/dt = f(u, x), where u is input and x is stateSpace.
73
+ */
74
+
75
+ in input: Input;
76
+ in stateSpace: StateSpace;
77
+ return : StateDerivative;
78
+ }
79
+
80
+ abstract calc def Integrate {
81
+ doc
82
+ /*
83
+ * Integrates stateSpace to compute the next stateSpace, which corresponds to x + int dx/dt dt.
84
+ * Its actual implementation should be given by a solver.
85
+ */
86
+
87
+ in getDerivative: GetDerivative;
88
+ in input: Input;
89
+ in initialState: StateSpace;
90
+ in timeInterval: DurationValue;
91
+ return result: StateSpace;
92
+ }
93
+
94
+ abstract action def ContinuousStateSpaceDynamics :> StateSpaceDynamics {
95
+ doc
96
+ /*
97
+ * ContinuousStateSpaceDynamics represents continuous behavior.
98
+ * derivative needs to return a time derivative of stateSpace, i.e. dx/dt.
99
+ */
100
+
101
+ abstract calc getDerivative: GetDerivative;
102
+ calc :>> getNextState: GetNextState {
103
+ /* We compute nextState by Integrate defined above by giving derivative calc. */
104
+ calc integrate: Integrate {
105
+ in getDerivative = ContinuousStateSpaceDynamics::getDerivative;
106
+ in input = GetNextState::input;
107
+ in initialState = GetNextState::stateSpace;
108
+ in timeInterval = GetNextState::timeStep;
109
+ }
110
+ return result = integrate.result;
111
+ }
112
+
113
+ event occurrence zeroCrossingEvents[0..*] : ZeroCrossingEventDef {
114
+ /* ContinuousStateSpaceDynamics may cause zero crossings anomaly. */
115
+ }
116
+ }
117
+
118
+ abstract calc def GetDifference {
119
+ doc
120
+ /*
121
+ * Computes difference of stateSpace by one timestep, that is x(k+1) - x(k),
122
+ * where k is the timestep number.
123
+ */
124
+
125
+ in input: Input;
126
+ in stateSpace: StateSpace;
127
+ return : StateSpace;
128
+ }
129
+
130
+ abstract action def DiscreteStateSpaceDynamics :> StateSpaceDynamics {
131
+ doc
132
+ /*
133
+ * DiscreteStateSpaceDynamics represents discrete behavior.
134
+ * differences needs to return difference of the stateSpace for each timestep.
135
+ */
136
+
137
+ abstract calc getDifference: GetDifference;
138
+ calc :>> getNextState: GetNextState {
139
+ attribute diff: StateSpace = getDifference(input, stateSpace);
140
+ return result = stateSpace + diff;
141
+ }
142
+ }
143
+ }