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,274 +1,274 @@
1
- standard library package Time {
2
- doc
3
- /*
4
- * This package specifies concepts to support time-related quantities and metrology, beyond
5
- * the quantities duration and time as defined in [ISO 80000-3]. Representations of the
6
- * Gregorian calendar date and time of day as specified by the [ISO 8601-1] standard are used.
7
- */
8
-
9
- private import Occurrences::Occurrence;
10
- private import ScalarValues::Real;
11
- private import ScalarValues::Integer;
12
- private import ScalarValues::Natural;
13
- private import ScalarValues::String;
14
- private import Quantities::ScalarQuantityValue;
15
- private import Quantities::scalarQuantities;
16
- private import MeasurementReferences::*;
17
- public import ISQBase::DurationValue;
18
- public import ISQBase::DurationUnit;
19
- public import ISQBase::duration;
20
- public import ISQSpaceTime::TimeValue;
21
- public import ISQSpaceTime::TimeUnit;
22
- public import ISQSpaceTime::time;
23
-
24
- part universalClock : Clock[1] :> Clocks::universalClock {
25
- doc
26
- /*
27
- * universalClock is a single Clock that can be used as a default universal time reference.
28
- */
29
- }
30
-
31
- part def Clock :> Clocks::Clock {
32
- doc
33
- /*
34
- * A Clock provides a currentTime as a TimeInstantValue that advances monotonically over its lifetime.
35
- */
36
-
37
- attribute :>> currentTime : TimeInstantValue;
38
- }
39
-
40
- calc def TimeOf :> Clocks::TimeOf {
41
- doc
42
- /*
43
- * TimeOf returns a TimeInstantValue for a given Occurrence relative to a given Clock. This TimeInstantValue is the
44
- * time of the start of the Occurrence, which is considered to be synchronized with the snapshot of the Clock with a
45
- * currentTime equal to the returned timeInstant.
46
- */
47
-
48
- in o : Occurrence[1];
49
- in clock : Clock[1] default localClock;
50
- return timeInstant : TimeInstantValue[1];
51
- }
52
-
53
- calc def DurationOf :> Clocks::DurationOf {
54
- doc
55
- /*
56
- * DurationOf returns the duration of a given Occurrence relative to a given Clock, which is equal to the TimeOf
57
- * the end snapshot of the Occurrence minus the TimeOf its start snapshot.
58
- */
59
-
60
- in o : Occurrence[1];
61
- in clock : Clock[1] default localClock;
62
- return duration : DurationValue;
63
- }
64
-
65
- attribute def TimeScale :> IntervalScale {
66
- doc
67
- /*
68
- * Generic time scale to express a time instant, including a textual definition of the meaning of zero time instant value
69
- *
70
- * Attribute definitionalEpoch captures the specification of the time instant with value zero, also known as the (reference) epoch.
71
- */
72
-
73
- attribute :>> unit: DurationUnit[1];
74
- attribute definitionalEpoch: DefinitionalQuantityValue[1];
75
- attribute :>> definitionalQuantityValues = definitionalEpoch;
76
- }
77
-
78
- attribute def TimeInstantValue :> ScalarQuantityValue {
79
- doc
80
- /*
81
- * Representation of a time instant quantity
82
- *
83
- * Also known as instant (of time), or, point in time.
84
- */
85
-
86
- attribute :>> num: Real[1];
87
- attribute :>> mRef: TimeScale[1];
88
- }
89
- attribute timeInstant: TimeInstantValue :> scalarQuantities;
90
-
91
- abstract attribute def DateTime :> TimeInstantValue {
92
- doc
93
- /*
94
- * Generic representation of a time instant as a calendar date and time of day
95
- */
96
- }
97
-
98
- abstract attribute def Date :> TimeInstantValue {
99
- doc
100
- /*
101
- * Generic representation of a time instant as a calendar date
102
- */
103
- }
104
-
105
- abstract attribute def TimeOfDay :> TimeInstantValue {
106
- doc
107
- /*
108
- * Generic representation of a time instant as a time of day
109
- */
110
- }
111
-
112
- attribute <UTC> 'Coordinated Universal Time' : TimeScale {
113
- doc
114
- /*
115
- * Representation of the Coordinated Universal Time (UTC) time scale
116
- *
117
- * UTC is the primary time standard by which the world regulates clocks and time. It is within about 1 second of mean solar time
118
- * at 0° longitude and is not adjusted for daylight saving time.
119
- * UTC is obtained from International Atomic Time (TAI) by the insertion of leap seconds according to the advice of
120
- * the International Earth Rotation and Reference Systems Service (IERS) to ensure approximate agreement
121
- * with the time derived from the rotation of the Earth.
122
- *
123
- * References:
124
- * ITU-R TF.460-6 (see https://www.itu.int/rec/R-REC-TF.460/en)
125
- * BIPM technical services: Time Metrology (see https://www.bipm.org/en/time-metrology)
126
- *
127
- * Introductions:
128
- * For UTC see https://en.wikipedia.org/wiki/Coordinated_Universal_Time
129
- * For TAI see https://en.wikipedia.org/wiki/International_Atomic_Time
130
- */
131
-
132
- attribute :>> unit = SI::s;
133
- attribute :>> definitionalEpoch: DefinitionalQuantityValue { :>> num = 0; :>> definition = "UTC epoch at 1 January 1958 at 0 hour 0 minute 0 second"; }
134
- }
135
-
136
- attribute def UtcTimeInstantValue :> DateTime {
137
- :>> mRef = UTC {
138
- doc
139
- /*
140
- * Representation of a time instant expressed on the Coordinated Universal Time (UTC) time scale
141
- */
142
- }
143
- }
144
- attribute utcTimeInstant: UtcTimeInstantValue :> timeInstant;
145
-
146
- /*
147
- * Representations of a Gregorian calendar date and time of day as specified by the ISO 8601-1 standard.
148
- *
149
- * As explained in ISO 8601-1 clause 4.2.1:
150
- * ISO 8601-1 uses the Gregorian calendar for the identification of calendar days.
151
- *
152
- * The Gregorian calendar provides a time scale consisting of a series of contiguous calendar years,
153
- * each identified by a year number represented by an integer, greater than that of the
154
- * immediately preceding calendar year by 1. ISO 8601-1 allows the identification of calendar years
155
- * by their year number for years both before and after the introduction of the Gregorian calendar.
156
- *
157
- * The Gregorian calendar distinguishes common years of 365 consecutive calendar days and leap years
158
- * of 366 consecutive calendar days.
159
- *
160
- * In the Gregorian calendar each calendar year is divided into 12 sequential calendar months,
161
- * each consisting of a specific number of calendar days in the range 28 to 31. Usage of the Gregorian calendar
162
- * for identifying dates preceding its introduction (15 October 1582) should only be by mutual agreement
163
- * of the communicating partners.
164
- *
165
- * Reference: ISO 8601-1:2019 (First edition)
166
- * "Date and time — Representations for information interchange — Part 1: Basic rules"
167
- * (see https://www.iso.org/standard/70907.html)
168
- */
169
-
170
- attribute def Iso8601DateTimeEncoding :> String {
171
- doc
172
- /*
173
- * Extended string encoding of an ISO 8601-1 date and time
174
- *
175
- * The format of the string must comply with the following EBNF production:
176
- * ['+' | '-'] YYYY '-' MM '-' DD 'T' hh ':' mm ':' ss ['.' fff [fff]] ('Z' | timezoneOffset )
177
- * where:
178
- * YYYY is 4-or-more-digit year number, which can be negative for years before 0000;
179
- * MM is 2-digit month in year number, in which 01 is January, 02 is February, ..., 12 is December;
180
- * DD is 2-digit day in month number in range 01 to 28, 29, 30, 31 depending on month and leap year;
181
- * hh is 2-digit hour in day number in range 00 to 23;
182
- * mm is 2-digit minute in hour in range 00 to 59;
183
- * ss is 2-digit second in minute in range 00 to 60, in in case of leap second;
184
- * ['.' fff [fff]] is an optional 3-digit millisecond or 6-digit microsecond fraction;
185
- * timezoneOffset is ('+' | '-') hhOffset ':' mmOffset, denoting the local timezone hour and minute offset w.r.t. UTC,
186
- * in which '+' specifies an offset ahead of UTC and '-' specifies an offset behind UTC;
187
- *
188
- * Note 1: All components are expressed with leading zeros.
189
- * Note 2: 'Z' instead of timezoneOffset denotes a UTC time, i.e. zero time offset.
190
- * Note 3: The ss value may only be 60 when a leap second is inserted.
191
- *
192
- * Examples of such a date and time value are:
193
- * 2021-08-30T12:30:24Z (UTC date and time with second precision)
194
- * 2018-01-23T23:14:44.304827Z (UTC date and time with microsecond precision)
195
- * 1969-07-20T20:17:00Z (UTC date and time with second precision)
196
- * 1969-07-20T15:17:00-05:00 (local date and time with second precision for a timezone 5 hour behind UTC)
197
- * 1969-07-20T22:17:00+02:00 (local date and time with second precision for a timezone 2 hour ahead of UTC)
198
- */
199
- }
200
-
201
- attribute def Iso8601DateTime :> UtcTimeInstantValue {
202
- doc
203
- /*
204
- * Representation of an ISO 8601-1 date and time in extended string format
205
- */
206
-
207
- attribute val: Iso8601DateTimeEncoding;
208
- attribute :>> num = getElapsedUtcTime(val);
209
- private calc getElapsedUtcTime {
210
- in iso8601DateTime: Iso8601DateTimeEncoding;
211
- /* Return the number of seconds elapsed since the UTC epoch.
212
- * Can be negative when the date and time is earlier than the epoch.
213
- */
214
- return : Real;
215
- }
216
- }
217
-
218
- attribute def Iso8601DateTimeStructure :> UtcTimeInstantValue {
219
- doc
220
- /*
221
- * Representation of an ISO 8601 date and time with explicit date and time component attributes
222
- *
223
- * The total time offset is equal to the summation of hourOffset and minuteOffset.
224
- */
225
-
226
- attribute year: Integer;
227
- attribute month: Natural;
228
- attribute day: Natural;
229
- attribute hour: Natural;
230
- attribute minute: Natural;
231
- attribute second: Natural;
232
- attribute microsecond: Natural;
233
- attribute hourOffset: Integer;
234
- attribute minuteOffset: Integer;
235
- attribute :>> num = getElapsedUtcTime(year, month, day, hour, minute, second, microsecond, hourOffset, minuteOffset);
236
- private calc getElapsedUtcTime {
237
- in year: Integer;
238
- in month: Natural;
239
- in day: Natural;
240
- in hour: Natural;
241
- in minute: Natural;
242
- in second: Natural;
243
- in microsecond: Natural;
244
- in hourOffset: Integer;
245
- in minuteOffest: Integer;
246
- return : Real;
247
- }
248
- }
249
-
250
- calc convertIso8601DateTimeToStructure {
251
- doc
252
- /*
253
- * Calculation to convert an ISO 8601 date and time instant from string to component structure representation
254
- */
255
-
256
- in iso8601DateTime: Iso8601DateTime;
257
- /* Parse ISO 8601 string encoding to date and time components */
258
- return : Iso8601DateTimeStructure;
259
- }
260
-
261
- calc convertIso8601StructureToDateTime {
262
- doc
263
- /*
264
- * Calculation to convert an ISO 8601 date and time instant from component structure to string representation
265
- */
266
-
267
- in iso8601DateTimeStructure: Iso8601DateTimeStructure;
268
- attribute x: Iso8601DateTime;
269
- /* Concatenate ISO 8601 date and time components to string
270
- * year-month-dayThour:minute:second±hourOffset:minuteOffset
271
- */
272
- return : Iso8601DateTime;
273
- }
274
- }
1
+ standard library package Time {
2
+ doc
3
+ /*
4
+ * This package specifies concepts to support time-related quantities and metrology, beyond
5
+ * the quantities duration and time as defined in [ISO 80000-3]. Representations of the
6
+ * Gregorian calendar date and time of day as specified by the [ISO 8601-1] standard are used.
7
+ */
8
+
9
+ private import Occurrences::Occurrence;
10
+ private import ScalarValues::Real;
11
+ private import ScalarValues::Integer;
12
+ private import ScalarValues::Natural;
13
+ private import ScalarValues::String;
14
+ private import Quantities::ScalarQuantityValue;
15
+ private import Quantities::scalarQuantities;
16
+ private import MeasurementReferences::*;
17
+ public import ISQBase::DurationValue;
18
+ public import ISQBase::DurationUnit;
19
+ public import ISQBase::duration;
20
+ public import ISQSpaceTime::TimeValue;
21
+ public import ISQSpaceTime::TimeUnit;
22
+ public import ISQSpaceTime::time;
23
+
24
+ part universalClock : Clock[1] :> Clocks::universalClock {
25
+ doc
26
+ /*
27
+ * universalClock is a single Clock that can be used as a default universal time reference.
28
+ */
29
+ }
30
+
31
+ part def Clock :> Clocks::Clock {
32
+ doc
33
+ /*
34
+ * A Clock provides a currentTime as a TimeInstantValue that advances monotonically over its lifetime.
35
+ */
36
+
37
+ attribute :>> currentTime : TimeInstantValue;
38
+ }
39
+
40
+ calc def TimeOf :> Clocks::TimeOf {
41
+ doc
42
+ /*
43
+ * TimeOf returns a TimeInstantValue for a given Occurrence relative to a given Clock. This TimeInstantValue is the
44
+ * time of the start of the Occurrence, which is considered to be synchronized with the snapshot of the Clock with a
45
+ * currentTime equal to the returned timeInstant.
46
+ */
47
+
48
+ in o : Occurrence[1];
49
+ in clock : Clock[1] default localClock;
50
+ return timeInstant : TimeInstantValue[1];
51
+ }
52
+
53
+ calc def DurationOf :> Clocks::DurationOf {
54
+ doc
55
+ /*
56
+ * DurationOf returns the duration of a given Occurrence relative to a given Clock, which is equal to the TimeOf
57
+ * the end snapshot of the Occurrence minus the TimeOf its start snapshot.
58
+ */
59
+
60
+ in o : Occurrence[1];
61
+ in clock : Clock[1] default localClock;
62
+ return duration : DurationValue;
63
+ }
64
+
65
+ attribute def TimeScale :> IntervalScale {
66
+ doc
67
+ /*
68
+ * Generic time scale to express a time instant, including a textual definition of the meaning of zero time instant value
69
+ *
70
+ * Attribute definitionalEpoch captures the specification of the time instant with value zero, also known as the (reference) epoch.
71
+ */
72
+
73
+ attribute :>> unit: DurationUnit[1];
74
+ attribute definitionalEpoch: DefinitionalQuantityValue[1];
75
+ attribute :>> definitionalQuantityValues = definitionalEpoch;
76
+ }
77
+
78
+ attribute def TimeInstantValue :> ScalarQuantityValue {
79
+ doc
80
+ /*
81
+ * Representation of a time instant quantity
82
+ *
83
+ * Also known as instant (of time), or, point in time.
84
+ */
85
+
86
+ attribute :>> num: Real[1];
87
+ attribute :>> mRef: TimeScale[1];
88
+ }
89
+ attribute timeInstant: TimeInstantValue :> scalarQuantities;
90
+
91
+ abstract attribute def DateTime :> TimeInstantValue {
92
+ doc
93
+ /*
94
+ * Generic representation of a time instant as a calendar date and time of day
95
+ */
96
+ }
97
+
98
+ abstract attribute def Date :> TimeInstantValue {
99
+ doc
100
+ /*
101
+ * Generic representation of a time instant as a calendar date
102
+ */
103
+ }
104
+
105
+ abstract attribute def TimeOfDay :> TimeInstantValue {
106
+ doc
107
+ /*
108
+ * Generic representation of a time instant as a time of day
109
+ */
110
+ }
111
+
112
+ attribute <UTC> 'Coordinated Universal Time' : TimeScale {
113
+ doc
114
+ /*
115
+ * Representation of the Coordinated Universal Time (UTC) time scale
116
+ *
117
+ * UTC is the primary time standard by which the world regulates clocks and time. It is within about 1 second of mean solar time
118
+ * at 0° longitude and is not adjusted for daylight saving time.
119
+ * UTC is obtained from International Atomic Time (TAI) by the insertion of leap seconds according to the advice of
120
+ * the International Earth Rotation and Reference Systems Service (IERS) to ensure approximate agreement
121
+ * with the time derived from the rotation of the Earth.
122
+ *
123
+ * References:
124
+ * ITU-R TF.460-6 (see https://www.itu.int/rec/R-REC-TF.460/en)
125
+ * BIPM technical services: Time Metrology (see https://www.bipm.org/en/time-metrology)
126
+ *
127
+ * Introductions:
128
+ * For UTC see https://en.wikipedia.org/wiki/Coordinated_Universal_Time
129
+ * For TAI see https://en.wikipedia.org/wiki/International_Atomic_Time
130
+ */
131
+
132
+ attribute :>> unit = SI::s;
133
+ attribute :>> definitionalEpoch: DefinitionalQuantityValue { :>> num = 0; :>> definition = "UTC epoch at 1 January 1958 at 0 hour 0 minute 0 second"; }
134
+ }
135
+
136
+ attribute def UtcTimeInstantValue :> DateTime {
137
+ :>> mRef = UTC {
138
+ doc
139
+ /*
140
+ * Representation of a time instant expressed on the Coordinated Universal Time (UTC) time scale
141
+ */
142
+ }
143
+ }
144
+ attribute utcTimeInstant: UtcTimeInstantValue :> timeInstant;
145
+
146
+ /*
147
+ * Representations of a Gregorian calendar date and time of day as specified by the ISO 8601-1 standard.
148
+ *
149
+ * As explained in ISO 8601-1 clause 4.2.1:
150
+ * ISO 8601-1 uses the Gregorian calendar for the identification of calendar days.
151
+ *
152
+ * The Gregorian calendar provides a time scale consisting of a series of contiguous calendar years,
153
+ * each identified by a year number represented by an integer, greater than that of the
154
+ * immediately preceding calendar year by 1. ISO 8601-1 allows the identification of calendar years
155
+ * by their year number for years both before and after the introduction of the Gregorian calendar.
156
+ *
157
+ * The Gregorian calendar distinguishes common years of 365 consecutive calendar days and leap years
158
+ * of 366 consecutive calendar days.
159
+ *
160
+ * In the Gregorian calendar each calendar year is divided into 12 sequential calendar months,
161
+ * each consisting of a specific number of calendar days in the range 28 to 31. Usage of the Gregorian calendar
162
+ * for identifying dates preceding its introduction (15 October 1582) should only be by mutual agreement
163
+ * of the communicating partners.
164
+ *
165
+ * Reference: ISO 8601-1:2019 (First edition)
166
+ * "Date and time — Representations for information interchange — Part 1: Basic rules"
167
+ * (see https://www.iso.org/standard/70907.html)
168
+ */
169
+
170
+ attribute def Iso8601DateTimeEncoding :> String {
171
+ doc
172
+ /*
173
+ * Extended string encoding of an ISO 8601-1 date and time
174
+ *
175
+ * The format of the string must comply with the following EBNF production:
176
+ * ['+' | '-'] YYYY '-' MM '-' DD 'T' hh ':' mm ':' ss ['.' fff [fff]] ('Z' | timezoneOffset )
177
+ * where:
178
+ * YYYY is 4-or-more-digit year number, which can be negative for years before 0000;
179
+ * MM is 2-digit month in year number, in which 01 is January, 02 is February, ..., 12 is December;
180
+ * DD is 2-digit day in month number in range 01 to 28, 29, 30, 31 depending on month and leap year;
181
+ * hh is 2-digit hour in day number in range 00 to 23;
182
+ * mm is 2-digit minute in hour in range 00 to 59;
183
+ * ss is 2-digit second in minute in range 00 to 60, in in case of leap second;
184
+ * ['.' fff [fff]] is an optional 3-digit millisecond or 6-digit microsecond fraction;
185
+ * timezoneOffset is ('+' | '-') hhOffset ':' mmOffset, denoting the local timezone hour and minute offset w.r.t. UTC,
186
+ * in which '+' specifies an offset ahead of UTC and '-' specifies an offset behind UTC;
187
+ *
188
+ * Note 1: All components are expressed with leading zeros.
189
+ * Note 2: 'Z' instead of timezoneOffset denotes a UTC time, i.e. zero time offset.
190
+ * Note 3: The ss value may only be 60 when a leap second is inserted.
191
+ *
192
+ * Examples of such a date and time value are:
193
+ * 2021-08-30T12:30:24Z (UTC date and time with second precision)
194
+ * 2018-01-23T23:14:44.304827Z (UTC date and time with microsecond precision)
195
+ * 1969-07-20T20:17:00Z (UTC date and time with second precision)
196
+ * 1969-07-20T15:17:00-05:00 (local date and time with second precision for a timezone 5 hour behind UTC)
197
+ * 1969-07-20T22:17:00+02:00 (local date and time with second precision for a timezone 2 hour ahead of UTC)
198
+ */
199
+ }
200
+
201
+ attribute def Iso8601DateTime :> UtcTimeInstantValue {
202
+ doc
203
+ /*
204
+ * Representation of an ISO 8601-1 date and time in extended string format
205
+ */
206
+
207
+ attribute val: Iso8601DateTimeEncoding;
208
+ attribute :>> num = getElapsedUtcTime(val);
209
+ private calc getElapsedUtcTime {
210
+ in iso8601DateTime: Iso8601DateTimeEncoding;
211
+ /* Return the number of seconds elapsed since the UTC epoch.
212
+ * Can be negative when the date and time is earlier than the epoch.
213
+ */
214
+ return : Real;
215
+ }
216
+ }
217
+
218
+ attribute def Iso8601DateTimeStructure :> UtcTimeInstantValue {
219
+ doc
220
+ /*
221
+ * Representation of an ISO 8601 date and time with explicit date and time component attributes
222
+ *
223
+ * The total time offset is equal to the summation of hourOffset and minuteOffset.
224
+ */
225
+
226
+ attribute year: Integer;
227
+ attribute month: Natural;
228
+ attribute day: Natural;
229
+ attribute hour: Natural;
230
+ attribute minute: Natural;
231
+ attribute second: Natural;
232
+ attribute microsecond: Natural;
233
+ attribute hourOffset: Integer;
234
+ attribute minuteOffset: Integer;
235
+ attribute :>> num = getElapsedUtcTime(year, month, day, hour, minute, second, microsecond, hourOffset, minuteOffset);
236
+ private calc getElapsedUtcTime {
237
+ in year: Integer;
238
+ in month: Natural;
239
+ in day: Natural;
240
+ in hour: Natural;
241
+ in minute: Natural;
242
+ in second: Natural;
243
+ in microsecond: Natural;
244
+ in hourOffset: Integer;
245
+ in minuteOffest: Integer;
246
+ return : Real;
247
+ }
248
+ }
249
+
250
+ calc convertIso8601DateTimeToStructure {
251
+ doc
252
+ /*
253
+ * Calculation to convert an ISO 8601 date and time instant from string to component structure representation
254
+ */
255
+
256
+ in iso8601DateTime: Iso8601DateTime;
257
+ /* Parse ISO 8601 string encoding to date and time components */
258
+ return : Iso8601DateTimeStructure;
259
+ }
260
+
261
+ calc convertIso8601StructureToDateTime {
262
+ doc
263
+ /*
264
+ * Calculation to convert an ISO 8601 date and time instant from component structure to string representation
265
+ */
266
+
267
+ in iso8601DateTimeStructure: Iso8601DateTimeStructure;
268
+ attribute x: Iso8601DateTime;
269
+ /* Concatenate ISO 8601 date and time components to string
270
+ * year-month-dayThour:minute:second±hourOffset:minuteOffset
271
+ */
272
+ return : Iso8601DateTime;
273
+ }
274
+ }