@hla4ts/spacekit 0.1.0 → 0.1.1

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.
@@ -1,546 +1,546 @@
1
- import { decodeHLAinteger64Time, encodeHLAinteger64Time } from "@hla4ts/hla-api";
2
- import { FomAttribute, FomObjectClass } from "./decorators.ts";
3
- import { SpacekitEntity } from "./entity.ts";
4
- import type { SpaceFomExecutionMode } from "@hla4ts/spacefom";
5
- import {
6
- decodeAttitudeQuaternion,
7
- decodeFloat64LE,
8
- decodeHLAunicodeString,
9
- decodeInt16LE,
10
- decodeMatrix3,
11
- decodeSpaceTimeCoordinateState,
12
- decodeVector3,
13
- encodeAttitudeQuaternion,
14
- encodeFloat64LE,
15
- encodeHLAunicodeString,
16
- encodeInt16LE,
17
- encodeMatrix3,
18
- encodeSpaceTimeCoordinateState,
19
- encodeVector3,
20
- type AttitudeQuaternion,
21
- type Matrix3,
22
- type SpaceTimeCoordinateState,
23
- type Vector3,
24
- } from "@hla4ts/spacefom";
25
-
26
- export interface ExecutionConfigurationAttributes {
27
- root_frame_name: string;
28
- scenario_time_epoch: number;
29
- current_execution_mode: SpaceFomExecutionMode;
30
- next_execution_mode: SpaceFomExecutionMode;
31
- next_mode_scenario_time: number;
32
- next_mode_cte_time: number;
33
- least_common_time_step: bigint;
34
- }
35
-
36
- @FomObjectClass({ name: ExecutionConfiguration.className, sharing: "Subscribe" })
37
- export class ExecutionConfiguration
38
- extends SpacekitEntity<ExecutionConfigurationAttributes>
39
- implements ExecutionConfigurationAttributes
40
- {
41
- static readonly className: string = "HLAobjectRoot.ExecutionConfiguration";
42
-
43
- @FomAttribute({
44
- name: "root_frame_name",
45
- dataType: "HLAunicodeString",
46
- updateType: "Static",
47
- updateCondition: "during initialization",
48
- ownership: "NoTransfer",
49
- sharing: "Subscribe",
50
- transportation: "HLAreliable",
51
- order: "TimeStamp",
52
- encode: encodeHLAunicodeString,
53
- decode: decodeHLAunicodeString,
54
- })
55
- root_frame_name: string;
56
-
57
- @FomAttribute({
58
- name: "scenario_time_epoch",
59
- dataType: "HLAfloat64LE",
60
- updateType: "Static",
61
- updateCondition: "during initialization",
62
- ownership: "NoTransfer",
63
- sharing: "Subscribe",
64
- transportation: "HLAreliable",
65
- order: "TimeStamp",
66
- encode: encodeFloat64LE,
67
- decode: decodeFloat64LE,
68
- })
69
- scenario_time_epoch: number;
70
-
71
- @FomAttribute({
72
- name: "current_execution_mode",
73
- dataType: "HLAinteger16LE",
74
- updateType: "Periodic",
75
- updateCondition: "when changes",
76
- ownership: "NoTransfer",
77
- sharing: "Subscribe",
78
- transportation: "HLAreliable",
79
- order: "TimeStamp",
80
- encode: encodeInt16LE,
81
- decode: decodeInt16LE,
82
- })
83
- current_execution_mode: SpaceFomExecutionMode;
84
-
85
- @FomAttribute({
86
- name: "next_execution_mode",
87
- dataType: "HLAinteger16LE",
88
- updateType: "Periodic",
89
- updateCondition: "when changes",
90
- ownership: "NoTransfer",
91
- sharing: "Subscribe",
92
- transportation: "HLAreliable",
93
- order: "TimeStamp",
94
- encode: encodeInt16LE,
95
- decode: decodeInt16LE,
96
- })
97
- next_execution_mode: SpaceFomExecutionMode;
98
-
99
- @FomAttribute({
100
- name: "next_mode_scenario_time",
101
- dataType: "HLAfloat64LE",
102
- updateType: "Periodic",
103
- updateCondition: "when changes",
104
- ownership: "NoTransfer",
105
- sharing: "Subscribe",
106
- transportation: "HLAreliable",
107
- order: "TimeStamp",
108
- encode: encodeFloat64LE,
109
- decode: decodeFloat64LE,
110
- })
111
- next_mode_scenario_time: number;
112
-
113
- @FomAttribute({
114
- name: "next_mode_cte_time",
115
- dataType: "HLAfloat64LE",
116
- updateType: "Periodic",
117
- updateCondition: "when changes",
118
- ownership: "NoTransfer",
119
- sharing: "Subscribe",
120
- transportation: "HLAreliable",
121
- order: "TimeStamp",
122
- encode: encodeFloat64LE,
123
- decode: decodeFloat64LE,
124
- })
125
- next_mode_cte_time: number;
126
-
127
- @FomAttribute({
128
- name: "least_common_time_step",
129
- dataType: "HLAinteger64Time",
130
- updateType: "Static",
131
- updateCondition: "during initialization",
132
- ownership: "NoTransfer",
133
- sharing: "Subscribe",
134
- transportation: "HLAreliable",
135
- order: "TimeStamp",
136
- encode: encodeHLAinteger64Time,
137
- decode: decodeHLAinteger64Time,
138
- })
139
- least_common_time_step: bigint;
140
-
141
- constructor(partial: Partial<ExecutionConfigurationAttributes> = {}) {
142
- super();
143
- this.root_frame_name = partial.root_frame_name ?? "";
144
- this.scenario_time_epoch = partial.scenario_time_epoch ?? 0;
145
- this.current_execution_mode = partial.current_execution_mode ?? 0;
146
- this.next_execution_mode = partial.next_execution_mode ?? 0;
147
- this.next_mode_scenario_time = partial.next_mode_scenario_time ?? 0;
148
- this.next_mode_cte_time = partial.next_mode_cte_time ?? 0;
149
- this.least_common_time_step = partial.least_common_time_step ?? 0n;
150
- }
151
-
152
- toAttributes(): ExecutionConfigurationAttributes {
153
- return {
154
- root_frame_name: this.root_frame_name,
155
- scenario_time_epoch: this.scenario_time_epoch,
156
- current_execution_mode: this.current_execution_mode,
157
- next_execution_mode: this.next_execution_mode,
158
- next_mode_scenario_time: this.next_mode_scenario_time,
159
- next_mode_cte_time: this.next_mode_cte_time,
160
- least_common_time_step: this.least_common_time_step,
161
- };
162
- }
163
- }
164
-
165
- export interface ReferenceFrameAttributes {
166
- name: string;
167
- parent_name: string;
168
- state: SpaceTimeCoordinateState;
169
- }
170
-
171
- @FomObjectClass({ name: ReferenceFrame.className, sharing: "Subscribe" })
172
- export class ReferenceFrame
173
- extends SpacekitEntity<ReferenceFrameAttributes>
174
- implements ReferenceFrameAttributes
175
- {
176
- static readonly className: string = "HLAobjectRoot.ReferenceFrame";
177
-
178
- @FomAttribute({
179
- name: "name",
180
- dataType: "HLAunicodeString",
181
- updateType: "Static",
182
- updateCondition: "during initialization",
183
- ownership: "NoTransfer",
184
- sharing: "Subscribe",
185
- transportation: "HLAreliable",
186
- order: "TimeStamp",
187
- encode: encodeHLAunicodeString,
188
- decode: decodeHLAunicodeString,
189
- })
190
- name: string;
191
-
192
- @FomAttribute({
193
- name: "parent_name",
194
- dataType: "HLAunicodeString",
195
- updateType: "Static",
196
- updateCondition: "during initialization",
197
- ownership: "NoTransfer",
198
- sharing: "Subscribe",
199
- transportation: "HLAreliable",
200
- order: "TimeStamp",
201
- encode: encodeHLAunicodeString,
202
- decode: decodeHLAunicodeString,
203
- })
204
- parent_name: string;
205
-
206
- @FomAttribute({
207
- name: "state",
208
- dataType: "SpaceTimeCoordinateState",
209
- updateType: "Periodic",
210
- updateCondition: "when changes",
211
- ownership: "NoTransfer",
212
- sharing: "Subscribe",
213
- transportation: "HLAreliable",
214
- order: "TimeStamp",
215
- encode: encodeSpaceTimeCoordinateState,
216
- decode: decodeSpaceTimeCoordinateState,
217
- })
218
- state: SpaceTimeCoordinateState;
219
-
220
- constructor(partial: Partial<ReferenceFrameAttributes> = {}) {
221
- super();
222
- this.name = partial.name ?? "";
223
- this.parent_name = partial.parent_name ?? "";
224
- this.state = partial.state ?? defaultState();
225
- }
226
-
227
- toAttributes(): ReferenceFrameAttributes {
228
- return {
229
- name: this.name,
230
- parent_name: this.parent_name,
231
- state: this.state,
232
- };
233
- }
234
- }
235
-
236
- export interface PhysicalEntityAttributes {
237
- name: string;
238
- type: string;
239
- status: string;
240
- parent_reference_frame: string;
241
- state: SpaceTimeCoordinateState;
242
- acceleration: Vector3;
243
- rotational_acceleration: Vector3;
244
- center_of_mass: Vector3;
245
- body_wrt_structural: AttitudeQuaternion;
246
- }
247
-
248
- @FomObjectClass({ name: PhysicalEntity.className, sharing: "PublishSubscribe" })
249
- export class PhysicalEntity
250
- extends SpacekitEntity<PhysicalEntityAttributes>
251
- implements PhysicalEntityAttributes
252
- {
253
- static readonly className: string = "HLAobjectRoot.PhysicalEntity";
254
-
255
- @FomAttribute({
256
- name: "name",
257
- dataType: "HLAunicodeString",
258
- updateType: "Static",
259
- updateCondition: "during initialization",
260
- ownership: "NoTransfer",
261
- sharing: "PublishSubscribe",
262
- transportation: "HLAreliable",
263
- order: "TimeStamp",
264
- encode: encodeHLAunicodeString,
265
- decode: decodeHLAunicodeString,
266
- })
267
- name: string;
268
-
269
- @FomAttribute({
270
- name: "type",
271
- dataType: "HLAunicodeString",
272
- updateType: "Static",
273
- updateCondition: "during initialization",
274
- ownership: "NoTransfer",
275
- sharing: "PublishSubscribe",
276
- transportation: "HLAreliable",
277
- order: "TimeStamp",
278
- encode: encodeHLAunicodeString,
279
- decode: decodeHLAunicodeString,
280
- })
281
- type: string;
282
-
283
- @FomAttribute({
284
- name: "status",
285
- dataType: "HLAunicodeString",
286
- updateType: "Static",
287
- updateCondition: "during initialization",
288
- ownership: "NoTransfer",
289
- sharing: "PublishSubscribe",
290
- transportation: "HLAreliable",
291
- order: "TimeStamp",
292
- encode: encodeHLAunicodeString,
293
- decode: decodeHLAunicodeString,
294
- })
295
- status: string;
296
-
297
- @FomAttribute({
298
- name: "parent_reference_frame",
299
- dataType: "HLAunicodeString",
300
- updateType: "Static",
301
- updateCondition: "during initialization",
302
- ownership: "NoTransfer",
303
- sharing: "PublishSubscribe",
304
- transportation: "HLAreliable",
305
- order: "TimeStamp",
306
- encode: encodeHLAunicodeString,
307
- decode: decodeHLAunicodeString,
308
- })
309
- parent_reference_frame: string;
310
-
311
- @FomAttribute({
312
- name: "state",
313
- dataType: "SpaceTimeCoordinateState",
314
- updateType: "Periodic",
315
- updateCondition: "when changes",
316
- ownership: "DivestAcquire",
317
- sharing: "PublishSubscribe",
318
- transportation: "HLAreliable",
319
- order: "TimeStamp",
320
- encode: encodeSpaceTimeCoordinateState,
321
- decode: decodeSpaceTimeCoordinateState,
322
- })
323
- state: SpaceTimeCoordinateState;
324
-
325
- @FomAttribute({
326
- name: "acceleration",
327
- dataType: "HLAfixedArray",
328
- updateType: "Periodic",
329
- updateCondition: "when changes",
330
- ownership: "DivestAcquire",
331
- sharing: "PublishSubscribe",
332
- transportation: "HLAreliable",
333
- order: "TimeStamp",
334
- encode: encodeVector3,
335
- decode: decodeVector3,
336
- })
337
- acceleration: Vector3;
338
-
339
- @FomAttribute({
340
- name: "rotational_acceleration",
341
- dataType: "HLAfixedArray",
342
- updateType: "Periodic",
343
- updateCondition: "when changes",
344
- ownership: "DivestAcquire",
345
- sharing: "PublishSubscribe",
346
- transportation: "HLAreliable",
347
- order: "TimeStamp",
348
- encode: encodeVector3,
349
- decode: decodeVector3,
350
- })
351
- rotational_acceleration: Vector3;
352
-
353
- @FomAttribute({
354
- name: "center_of_mass",
355
- dataType: "HLAfixedArray",
356
- updateType: "Static",
357
- updateCondition: "during initialization",
358
- ownership: "NoTransfer",
359
- sharing: "PublishSubscribe",
360
- transportation: "HLAreliable",
361
- order: "TimeStamp",
362
- encode: encodeVector3,
363
- decode: decodeVector3,
364
- })
365
- center_of_mass: Vector3;
366
-
367
- @FomAttribute({
368
- name: "body_wrt_structural",
369
- dataType: "HLAfixedRecord",
370
- updateType: "Static",
371
- updateCondition: "during initialization",
372
- ownership: "NoTransfer",
373
- sharing: "PublishSubscribe",
374
- transportation: "HLAreliable",
375
- order: "TimeStamp",
376
- encode: encodeAttitudeQuaternion,
377
- decode: decodeAttitudeQuaternion,
378
- })
379
- body_wrt_structural: AttitudeQuaternion;
380
-
381
- constructor(name: string, partial: Partial<PhysicalEntityAttributes> = {}) {
382
- super();
383
- this.name = name;
384
- this.type = partial.type ?? "";
385
- this.status = partial.status ?? "";
386
- this.parent_reference_frame = partial.parent_reference_frame ?? "";
387
- this.state = partial.state ?? defaultState();
388
- this.acceleration = partial.acceleration ?? [0, 0, 0];
389
- this.rotational_acceleration = partial.rotational_acceleration ?? [0, 0, 0];
390
- this.center_of_mass = partial.center_of_mass ?? [0, 0, 0];
391
- this.body_wrt_structural =
392
- partial.body_wrt_structural ?? { scalar: 1, vector: [0, 0, 0] };
393
- }
394
-
395
- toAttributes(): PhysicalEntityAttributes {
396
- return {
397
- name: this.name,
398
- type: this.type,
399
- status: this.status,
400
- parent_reference_frame: this.parent_reference_frame,
401
- state: this.state,
402
- acceleration: this.acceleration,
403
- rotational_acceleration: this.rotational_acceleration,
404
- center_of_mass: this.center_of_mass,
405
- body_wrt_structural: this.body_wrt_structural,
406
- };
407
- }
408
- }
409
-
410
- export interface DynamicalEntityAttributes extends PhysicalEntityAttributes {
411
- force: Vector3;
412
- torque: Vector3;
413
- mass: number;
414
- mass_rate: number;
415
- inertia: Matrix3;
416
- inertia_rate: Matrix3;
417
- }
418
-
419
- @FomObjectClass({ name: DynamicalEntity.className, sharing: "PublishSubscribe" })
420
- export class DynamicalEntity extends PhysicalEntity implements DynamicalEntityAttributes {
421
- static readonly className: string = "HLAobjectRoot.PhysicalEntity.DynamicalEntity";
422
-
423
- @FomAttribute({
424
- name: "force",
425
- dataType: "HLAfixedArray",
426
- updateType: "Periodic",
427
- updateCondition: "when changes",
428
- ownership: "DivestAcquire",
429
- sharing: "PublishSubscribe",
430
- transportation: "HLAreliable",
431
- order: "TimeStamp",
432
- encode: encodeVector3,
433
- decode: decodeVector3,
434
- })
435
- force: Vector3;
436
-
437
- @FomAttribute({
438
- name: "torque",
439
- dataType: "HLAfixedArray",
440
- updateType: "Periodic",
441
- updateCondition: "when changes",
442
- ownership: "DivestAcquire",
443
- sharing: "PublishSubscribe",
444
- transportation: "HLAreliable",
445
- order: "TimeStamp",
446
- encode: encodeVector3,
447
- decode: decodeVector3,
448
- })
449
- torque: Vector3;
450
-
451
- @FomAttribute({
452
- name: "mass",
453
- dataType: "HLAfloat64LE",
454
- updateType: "Periodic",
455
- updateCondition: "when changes",
456
- ownership: "DivestAcquire",
457
- sharing: "PublishSubscribe",
458
- transportation: "HLAreliable",
459
- order: "TimeStamp",
460
- encode: encodeFloat64LE,
461
- decode: decodeFloat64LE,
462
- })
463
- mass: number;
464
-
465
- @FomAttribute({
466
- name: "mass_rate",
467
- dataType: "HLAfloat64LE",
468
- updateType: "Periodic",
469
- updateCondition: "when changes",
470
- ownership: "DivestAcquire",
471
- sharing: "PublishSubscribe",
472
- transportation: "HLAreliable",
473
- order: "TimeStamp",
474
- encode: encodeFloat64LE,
475
- decode: decodeFloat64LE,
476
- })
477
- mass_rate: number;
478
-
479
- @FomAttribute({
480
- name: "inertia",
481
- dataType: "HLAfixedArray",
482
- updateType: "Periodic",
483
- updateCondition: "when changes",
484
- ownership: "DivestAcquire",
485
- sharing: "PublishSubscribe",
486
- transportation: "HLAreliable",
487
- order: "TimeStamp",
488
- encode: encodeMatrix3,
489
- decode: decodeMatrix3,
490
- })
491
- inertia: Matrix3;
492
-
493
- @FomAttribute({
494
- name: "inertia_rate",
495
- dataType: "HLAfixedArray",
496
- updateType: "Periodic",
497
- updateCondition: "when changes",
498
- ownership: "DivestAcquire",
499
- sharing: "PublishSubscribe",
500
- transportation: "HLAreliable",
501
- order: "TimeStamp",
502
- encode: encodeMatrix3,
503
- decode: decodeMatrix3,
504
- })
505
- inertia_rate: Matrix3;
506
-
507
- constructor(name: string, partial: Partial<DynamicalEntityAttributes> = {}) {
508
- super(name, partial);
509
- this.force = partial.force ?? [0, 0, 0];
510
- this.torque = partial.torque ?? [0, 0, 0];
511
- this.mass = partial.mass ?? 0;
512
- this.mass_rate = partial.mass_rate ?? 0;
513
- this.inertia = partial.inertia ?? zeroMatrix();
514
- this.inertia_rate = partial.inertia_rate ?? zeroMatrix();
515
- }
516
-
517
- override toAttributes(): DynamicalEntityAttributes {
518
- return {
519
- ...super.toAttributes(),
520
- force: this.force,
521
- torque: this.torque,
522
- mass: this.mass,
523
- mass_rate: this.mass_rate,
524
- inertia: this.inertia,
525
- inertia_rate: this.inertia_rate,
526
- };
527
- }
528
- }
529
-
530
- function defaultState(): SpaceTimeCoordinateState {
531
- return {
532
- translation: {
533
- position: [0, 0, 0],
534
- velocity: [0, 0, 0],
535
- },
536
- rotation: {
537
- attitude: { scalar: 1, vector: [0, 0, 0] },
538
- angularVelocity: [0, 0, 0],
539
- },
540
- time: 0,
541
- };
542
- }
543
-
544
- function zeroMatrix(): Matrix3 {
545
- return [0, 0, 0, 0, 0, 0, 0, 0, 0];
546
- }
1
+ import { decodeHLAinteger64Time, encodeHLAinteger64Time } from "@hla4ts/hla-api";
2
+ import { FomAttribute, FomObjectClass } from "./decorators.ts";
3
+ import { SpacekitEntity } from "./entity.ts";
4
+ import type { SpaceFomExecutionMode } from "@hla4ts/spacefom";
5
+ import {
6
+ decodeAttitudeQuaternion,
7
+ decodeFloat64LE,
8
+ decodeHLAunicodeString,
9
+ decodeInt16LE,
10
+ decodeMatrix3,
11
+ decodeSpaceTimeCoordinateState,
12
+ decodeVector3,
13
+ encodeAttitudeQuaternion,
14
+ encodeFloat64LE,
15
+ encodeHLAunicodeString,
16
+ encodeInt16LE,
17
+ encodeMatrix3,
18
+ encodeSpaceTimeCoordinateState,
19
+ encodeVector3,
20
+ type AttitudeQuaternion,
21
+ type Matrix3,
22
+ type SpaceTimeCoordinateState,
23
+ type Vector3,
24
+ } from "@hla4ts/spacefom";
25
+
26
+ export interface ExecutionConfigurationAttributes {
27
+ root_frame_name: string;
28
+ scenario_time_epoch: number;
29
+ current_execution_mode: SpaceFomExecutionMode;
30
+ next_execution_mode: SpaceFomExecutionMode;
31
+ next_mode_scenario_time: number;
32
+ next_mode_cte_time: number;
33
+ least_common_time_step: bigint;
34
+ }
35
+
36
+ @FomObjectClass({ name: ExecutionConfiguration.className, sharing: "Subscribe" })
37
+ export class ExecutionConfiguration
38
+ extends SpacekitEntity<ExecutionConfigurationAttributes>
39
+ implements ExecutionConfigurationAttributes
40
+ {
41
+ static readonly className: string = "HLAobjectRoot.ExecutionConfiguration";
42
+
43
+ @FomAttribute({
44
+ name: "root_frame_name",
45
+ dataType: "HLAunicodeString",
46
+ updateType: "Static",
47
+ updateCondition: "during initialization",
48
+ ownership: "NoTransfer",
49
+ sharing: "Subscribe",
50
+ transportation: "HLAreliable",
51
+ order: "TimeStamp",
52
+ encode: encodeHLAunicodeString,
53
+ decode: decodeHLAunicodeString,
54
+ })
55
+ root_frame_name: string;
56
+
57
+ @FomAttribute({
58
+ name: "scenario_time_epoch",
59
+ dataType: "HLAfloat64LE",
60
+ updateType: "Static",
61
+ updateCondition: "during initialization",
62
+ ownership: "NoTransfer",
63
+ sharing: "Subscribe",
64
+ transportation: "HLAreliable",
65
+ order: "TimeStamp",
66
+ encode: encodeFloat64LE,
67
+ decode: decodeFloat64LE,
68
+ })
69
+ scenario_time_epoch: number;
70
+
71
+ @FomAttribute({
72
+ name: "current_execution_mode",
73
+ dataType: "HLAinteger16LE",
74
+ updateType: "Periodic",
75
+ updateCondition: "when changes",
76
+ ownership: "NoTransfer",
77
+ sharing: "Subscribe",
78
+ transportation: "HLAreliable",
79
+ order: "TimeStamp",
80
+ encode: encodeInt16LE,
81
+ decode: decodeInt16LE,
82
+ })
83
+ current_execution_mode: SpaceFomExecutionMode;
84
+
85
+ @FomAttribute({
86
+ name: "next_execution_mode",
87
+ dataType: "HLAinteger16LE",
88
+ updateType: "Periodic",
89
+ updateCondition: "when changes",
90
+ ownership: "NoTransfer",
91
+ sharing: "Subscribe",
92
+ transportation: "HLAreliable",
93
+ order: "TimeStamp",
94
+ encode: encodeInt16LE,
95
+ decode: decodeInt16LE,
96
+ })
97
+ next_execution_mode: SpaceFomExecutionMode;
98
+
99
+ @FomAttribute({
100
+ name: "next_mode_scenario_time",
101
+ dataType: "HLAfloat64LE",
102
+ updateType: "Periodic",
103
+ updateCondition: "when changes",
104
+ ownership: "NoTransfer",
105
+ sharing: "Subscribe",
106
+ transportation: "HLAreliable",
107
+ order: "TimeStamp",
108
+ encode: encodeFloat64LE,
109
+ decode: decodeFloat64LE,
110
+ })
111
+ next_mode_scenario_time: number;
112
+
113
+ @FomAttribute({
114
+ name: "next_mode_cte_time",
115
+ dataType: "HLAfloat64LE",
116
+ updateType: "Periodic",
117
+ updateCondition: "when changes",
118
+ ownership: "NoTransfer",
119
+ sharing: "Subscribe",
120
+ transportation: "HLAreliable",
121
+ order: "TimeStamp",
122
+ encode: encodeFloat64LE,
123
+ decode: decodeFloat64LE,
124
+ })
125
+ next_mode_cte_time: number;
126
+
127
+ @FomAttribute({
128
+ name: "least_common_time_step",
129
+ dataType: "HLAinteger64Time",
130
+ updateType: "Static",
131
+ updateCondition: "during initialization",
132
+ ownership: "NoTransfer",
133
+ sharing: "Subscribe",
134
+ transportation: "HLAreliable",
135
+ order: "TimeStamp",
136
+ encode: encodeHLAinteger64Time,
137
+ decode: decodeHLAinteger64Time,
138
+ })
139
+ least_common_time_step: bigint;
140
+
141
+ constructor(partial: Partial<ExecutionConfigurationAttributes> = {}) {
142
+ super();
143
+ this.root_frame_name = partial.root_frame_name ?? "";
144
+ this.scenario_time_epoch = partial.scenario_time_epoch ?? 0;
145
+ this.current_execution_mode = partial.current_execution_mode ?? 0;
146
+ this.next_execution_mode = partial.next_execution_mode ?? 0;
147
+ this.next_mode_scenario_time = partial.next_mode_scenario_time ?? 0;
148
+ this.next_mode_cte_time = partial.next_mode_cte_time ?? 0;
149
+ this.least_common_time_step = partial.least_common_time_step ?? 0n;
150
+ }
151
+
152
+ toAttributes(): ExecutionConfigurationAttributes {
153
+ return {
154
+ root_frame_name: this.root_frame_name,
155
+ scenario_time_epoch: this.scenario_time_epoch,
156
+ current_execution_mode: this.current_execution_mode,
157
+ next_execution_mode: this.next_execution_mode,
158
+ next_mode_scenario_time: this.next_mode_scenario_time,
159
+ next_mode_cte_time: this.next_mode_cte_time,
160
+ least_common_time_step: this.least_common_time_step,
161
+ };
162
+ }
163
+ }
164
+
165
+ export interface ReferenceFrameAttributes {
166
+ name: string;
167
+ parent_name: string;
168
+ state: SpaceTimeCoordinateState;
169
+ }
170
+
171
+ @FomObjectClass({ name: ReferenceFrame.className, sharing: "Subscribe" })
172
+ export class ReferenceFrame
173
+ extends SpacekitEntity<ReferenceFrameAttributes>
174
+ implements ReferenceFrameAttributes
175
+ {
176
+ static readonly className: string = "HLAobjectRoot.ReferenceFrame";
177
+
178
+ @FomAttribute({
179
+ name: "name",
180
+ dataType: "HLAunicodeString",
181
+ updateType: "Static",
182
+ updateCondition: "during initialization",
183
+ ownership: "NoTransfer",
184
+ sharing: "Subscribe",
185
+ transportation: "HLAreliable",
186
+ order: "TimeStamp",
187
+ encode: encodeHLAunicodeString,
188
+ decode: decodeHLAunicodeString,
189
+ })
190
+ name: string;
191
+
192
+ @FomAttribute({
193
+ name: "parent_name",
194
+ dataType: "HLAunicodeString",
195
+ updateType: "Static",
196
+ updateCondition: "during initialization",
197
+ ownership: "NoTransfer",
198
+ sharing: "Subscribe",
199
+ transportation: "HLAreliable",
200
+ order: "TimeStamp",
201
+ encode: encodeHLAunicodeString,
202
+ decode: decodeHLAunicodeString,
203
+ })
204
+ parent_name: string;
205
+
206
+ @FomAttribute({
207
+ name: "state",
208
+ dataType: "SpaceTimeCoordinateState",
209
+ updateType: "Periodic",
210
+ updateCondition: "when changes",
211
+ ownership: "NoTransfer",
212
+ sharing: "Subscribe",
213
+ transportation: "HLAreliable",
214
+ order: "TimeStamp",
215
+ encode: encodeSpaceTimeCoordinateState,
216
+ decode: decodeSpaceTimeCoordinateState,
217
+ })
218
+ state: SpaceTimeCoordinateState;
219
+
220
+ constructor(partial: Partial<ReferenceFrameAttributes> = {}) {
221
+ super();
222
+ this.name = partial.name ?? "";
223
+ this.parent_name = partial.parent_name ?? "";
224
+ this.state = partial.state ?? defaultState();
225
+ }
226
+
227
+ toAttributes(): ReferenceFrameAttributes {
228
+ return {
229
+ name: this.name,
230
+ parent_name: this.parent_name,
231
+ state: this.state,
232
+ };
233
+ }
234
+ }
235
+
236
+ export interface PhysicalEntityAttributes {
237
+ name: string;
238
+ type: string;
239
+ status: string;
240
+ parent_reference_frame: string;
241
+ state: SpaceTimeCoordinateState;
242
+ acceleration: Vector3;
243
+ rotational_acceleration: Vector3;
244
+ center_of_mass: Vector3;
245
+ body_wrt_structural: AttitudeQuaternion;
246
+ }
247
+
248
+ @FomObjectClass({ name: PhysicalEntity.className, sharing: "PublishSubscribe" })
249
+ export class PhysicalEntity
250
+ extends SpacekitEntity<PhysicalEntityAttributes>
251
+ implements PhysicalEntityAttributes
252
+ {
253
+ static readonly className: string = "HLAobjectRoot.PhysicalEntity";
254
+
255
+ @FomAttribute({
256
+ name: "name",
257
+ dataType: "HLAunicodeString",
258
+ updateType: "Static",
259
+ updateCondition: "during initialization",
260
+ ownership: "NoTransfer",
261
+ sharing: "PublishSubscribe",
262
+ transportation: "HLAreliable",
263
+ order: "TimeStamp",
264
+ encode: encodeHLAunicodeString,
265
+ decode: decodeHLAunicodeString,
266
+ })
267
+ name: string;
268
+
269
+ @FomAttribute({
270
+ name: "type",
271
+ dataType: "HLAunicodeString",
272
+ updateType: "Static",
273
+ updateCondition: "during initialization",
274
+ ownership: "NoTransfer",
275
+ sharing: "PublishSubscribe",
276
+ transportation: "HLAreliable",
277
+ order: "TimeStamp",
278
+ encode: encodeHLAunicodeString,
279
+ decode: decodeHLAunicodeString,
280
+ })
281
+ type: string;
282
+
283
+ @FomAttribute({
284
+ name: "status",
285
+ dataType: "HLAunicodeString",
286
+ updateType: "Static",
287
+ updateCondition: "during initialization",
288
+ ownership: "NoTransfer",
289
+ sharing: "PublishSubscribe",
290
+ transportation: "HLAreliable",
291
+ order: "TimeStamp",
292
+ encode: encodeHLAunicodeString,
293
+ decode: decodeHLAunicodeString,
294
+ })
295
+ status: string;
296
+
297
+ @FomAttribute({
298
+ name: "parent_reference_frame",
299
+ dataType: "HLAunicodeString",
300
+ updateType: "Static",
301
+ updateCondition: "during initialization",
302
+ ownership: "NoTransfer",
303
+ sharing: "PublishSubscribe",
304
+ transportation: "HLAreliable",
305
+ order: "TimeStamp",
306
+ encode: encodeHLAunicodeString,
307
+ decode: decodeHLAunicodeString,
308
+ })
309
+ parent_reference_frame: string;
310
+
311
+ @FomAttribute({
312
+ name: "state",
313
+ dataType: "SpaceTimeCoordinateState",
314
+ updateType: "Periodic",
315
+ updateCondition: "when changes",
316
+ ownership: "DivestAcquire",
317
+ sharing: "PublishSubscribe",
318
+ transportation: "HLAreliable",
319
+ order: "TimeStamp",
320
+ encode: encodeSpaceTimeCoordinateState,
321
+ decode: decodeSpaceTimeCoordinateState,
322
+ })
323
+ state: SpaceTimeCoordinateState;
324
+
325
+ @FomAttribute({
326
+ name: "acceleration",
327
+ dataType: "HLAfixedArray",
328
+ updateType: "Periodic",
329
+ updateCondition: "when changes",
330
+ ownership: "DivestAcquire",
331
+ sharing: "PublishSubscribe",
332
+ transportation: "HLAreliable",
333
+ order: "TimeStamp",
334
+ encode: encodeVector3,
335
+ decode: decodeVector3,
336
+ })
337
+ acceleration: Vector3;
338
+
339
+ @FomAttribute({
340
+ name: "rotational_acceleration",
341
+ dataType: "HLAfixedArray",
342
+ updateType: "Periodic",
343
+ updateCondition: "when changes",
344
+ ownership: "DivestAcquire",
345
+ sharing: "PublishSubscribe",
346
+ transportation: "HLAreliable",
347
+ order: "TimeStamp",
348
+ encode: encodeVector3,
349
+ decode: decodeVector3,
350
+ })
351
+ rotational_acceleration: Vector3;
352
+
353
+ @FomAttribute({
354
+ name: "center_of_mass",
355
+ dataType: "HLAfixedArray",
356
+ updateType: "Static",
357
+ updateCondition: "during initialization",
358
+ ownership: "NoTransfer",
359
+ sharing: "PublishSubscribe",
360
+ transportation: "HLAreliable",
361
+ order: "TimeStamp",
362
+ encode: encodeVector3,
363
+ decode: decodeVector3,
364
+ })
365
+ center_of_mass: Vector3;
366
+
367
+ @FomAttribute({
368
+ name: "body_wrt_structural",
369
+ dataType: "HLAfixedRecord",
370
+ updateType: "Static",
371
+ updateCondition: "during initialization",
372
+ ownership: "NoTransfer",
373
+ sharing: "PublishSubscribe",
374
+ transportation: "HLAreliable",
375
+ order: "TimeStamp",
376
+ encode: encodeAttitudeQuaternion,
377
+ decode: decodeAttitudeQuaternion,
378
+ })
379
+ body_wrt_structural: AttitudeQuaternion;
380
+
381
+ constructor(name: string, partial: Partial<PhysicalEntityAttributes> = {}) {
382
+ super();
383
+ this.name = name;
384
+ this.type = partial.type ?? "";
385
+ this.status = partial.status ?? "";
386
+ this.parent_reference_frame = partial.parent_reference_frame ?? "";
387
+ this.state = partial.state ?? defaultState();
388
+ this.acceleration = partial.acceleration ?? [0, 0, 0];
389
+ this.rotational_acceleration = partial.rotational_acceleration ?? [0, 0, 0];
390
+ this.center_of_mass = partial.center_of_mass ?? [0, 0, 0];
391
+ this.body_wrt_structural =
392
+ partial.body_wrt_structural ?? { scalar: 1, vector: [0, 0, 0] };
393
+ }
394
+
395
+ toAttributes(): PhysicalEntityAttributes {
396
+ return {
397
+ name: this.name,
398
+ type: this.type,
399
+ status: this.status,
400
+ parent_reference_frame: this.parent_reference_frame,
401
+ state: this.state,
402
+ acceleration: this.acceleration,
403
+ rotational_acceleration: this.rotational_acceleration,
404
+ center_of_mass: this.center_of_mass,
405
+ body_wrt_structural: this.body_wrt_structural,
406
+ };
407
+ }
408
+ }
409
+
410
+ export interface DynamicalEntityAttributes extends PhysicalEntityAttributes {
411
+ force: Vector3;
412
+ torque: Vector3;
413
+ mass: number;
414
+ mass_rate: number;
415
+ inertia: Matrix3;
416
+ inertia_rate: Matrix3;
417
+ }
418
+
419
+ @FomObjectClass({ name: DynamicalEntity.className, sharing: "PublishSubscribe" })
420
+ export class DynamicalEntity extends PhysicalEntity implements DynamicalEntityAttributes {
421
+ static readonly className: string = "HLAobjectRoot.PhysicalEntity.DynamicalEntity";
422
+
423
+ @FomAttribute({
424
+ name: "force",
425
+ dataType: "HLAfixedArray",
426
+ updateType: "Periodic",
427
+ updateCondition: "when changes",
428
+ ownership: "DivestAcquire",
429
+ sharing: "PublishSubscribe",
430
+ transportation: "HLAreliable",
431
+ order: "TimeStamp",
432
+ encode: encodeVector3,
433
+ decode: decodeVector3,
434
+ })
435
+ force: Vector3;
436
+
437
+ @FomAttribute({
438
+ name: "torque",
439
+ dataType: "HLAfixedArray",
440
+ updateType: "Periodic",
441
+ updateCondition: "when changes",
442
+ ownership: "DivestAcquire",
443
+ sharing: "PublishSubscribe",
444
+ transportation: "HLAreliable",
445
+ order: "TimeStamp",
446
+ encode: encodeVector3,
447
+ decode: decodeVector3,
448
+ })
449
+ torque: Vector3;
450
+
451
+ @FomAttribute({
452
+ name: "mass",
453
+ dataType: "HLAfloat64LE",
454
+ updateType: "Periodic",
455
+ updateCondition: "when changes",
456
+ ownership: "DivestAcquire",
457
+ sharing: "PublishSubscribe",
458
+ transportation: "HLAreliable",
459
+ order: "TimeStamp",
460
+ encode: encodeFloat64LE,
461
+ decode: decodeFloat64LE,
462
+ })
463
+ mass: number;
464
+
465
+ @FomAttribute({
466
+ name: "mass_rate",
467
+ dataType: "HLAfloat64LE",
468
+ updateType: "Periodic",
469
+ updateCondition: "when changes",
470
+ ownership: "DivestAcquire",
471
+ sharing: "PublishSubscribe",
472
+ transportation: "HLAreliable",
473
+ order: "TimeStamp",
474
+ encode: encodeFloat64LE,
475
+ decode: decodeFloat64LE,
476
+ })
477
+ mass_rate: number;
478
+
479
+ @FomAttribute({
480
+ name: "inertia",
481
+ dataType: "HLAfixedArray",
482
+ updateType: "Periodic",
483
+ updateCondition: "when changes",
484
+ ownership: "DivestAcquire",
485
+ sharing: "PublishSubscribe",
486
+ transportation: "HLAreliable",
487
+ order: "TimeStamp",
488
+ encode: encodeMatrix3,
489
+ decode: decodeMatrix3,
490
+ })
491
+ inertia: Matrix3;
492
+
493
+ @FomAttribute({
494
+ name: "inertia_rate",
495
+ dataType: "HLAfixedArray",
496
+ updateType: "Periodic",
497
+ updateCondition: "when changes",
498
+ ownership: "DivestAcquire",
499
+ sharing: "PublishSubscribe",
500
+ transportation: "HLAreliable",
501
+ order: "TimeStamp",
502
+ encode: encodeMatrix3,
503
+ decode: decodeMatrix3,
504
+ })
505
+ inertia_rate: Matrix3;
506
+
507
+ constructor(name: string, partial: Partial<DynamicalEntityAttributes> = {}) {
508
+ super(name, partial);
509
+ this.force = partial.force ?? [0, 0, 0];
510
+ this.torque = partial.torque ?? [0, 0, 0];
511
+ this.mass = partial.mass ?? 0;
512
+ this.mass_rate = partial.mass_rate ?? 0;
513
+ this.inertia = partial.inertia ?? zeroMatrix();
514
+ this.inertia_rate = partial.inertia_rate ?? zeroMatrix();
515
+ }
516
+
517
+ override toAttributes(): DynamicalEntityAttributes {
518
+ return {
519
+ ...super.toAttributes(),
520
+ force: this.force,
521
+ torque: this.torque,
522
+ mass: this.mass,
523
+ mass_rate: this.mass_rate,
524
+ inertia: this.inertia,
525
+ inertia_rate: this.inertia_rate,
526
+ };
527
+ }
528
+ }
529
+
530
+ function defaultState(): SpaceTimeCoordinateState {
531
+ return {
532
+ translation: {
533
+ position: [0, 0, 0],
534
+ velocity: [0, 0, 0],
535
+ },
536
+ rotation: {
537
+ attitude: { scalar: 1, vector: [0, 0, 0] },
538
+ angularVelocity: [0, 0, 0],
539
+ },
540
+ time: 0,
541
+ };
542
+ }
543
+
544
+ function zeroMatrix(): Matrix3 {
545
+ return [0, 0, 0, 0, 0, 0, 0, 0, 0];
546
+ }