1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.files.ccsds.ndm.cdm;
18
19 import java.util.ArrayList;
20 import java.util.List;
21
22 import org.hipparchus.geometry.euclidean.threed.Vector3D;
23 import org.orekit.errors.OrekitException;
24 import org.orekit.errors.OrekitMessages;
25 import org.orekit.files.ccsds.definitions.PocMethodFacade;
26 import org.orekit.files.ccsds.definitions.TimeSystem;
27 import org.orekit.time.AbsoluteDate;
28
29
30
31
32
33 public class CdmRelativeMetadata {
34
35
36 private TimeSystem timeSystem;
37
38
39 private List<String> comment;
40
41
42 private AbsoluteDate tca;
43
44
45 private double missDistance;
46
47
48 private double relativeSpeed;
49
50
51
52 private double mahalanobisDistance;
53
54
55 private double relativePositionR;
56
57
58 private double relativePositionT;
59
60
61 private double relativePositionN;
62
63
64 private double relativeVelocityR;
65
66
67 private double relativeVelocityT;
68
69
70 private double relativeVelocityN;
71
72
73 private AbsoluteDate startScreenPeriod;
74
75
76 private AbsoluteDate stopScreenPeriod;
77
78
79 private ScreenVolumeShape screenVolumeShape;
80
81
82 private double screenVolumeRadius;
83
84
85 private ScreenVolumeFrame screenVolumeFrame;
86
87
88 private double screenVolumeX;
89
90
91 private double screenVolumeY;
92
93
94 private double screenVolumeZ;
95
96
97 private AbsoluteDate screenEntryTime;
98
99
100 private AbsoluteDate screenExitTime;
101
102
103 private double collisionProbability;
104
105
106 private PocMethodFacade collisionProbabilityMethod;
107
108
109 private String conjunctionId;
110
111
112 private double approachAngle;
113
114
115 private ScreenType screenType;
116
117
118 private double maxCollisionProbability;
119
120
121 private PocMethodFacade maxCollisionProbabilityMethod;
122
123
124 private double sefiCollisionProbability;
125
126
127 private PocMethodFacade sefiCollisionProbabilityMethod;
128
129
130 private String sefiFragmentationModel;
131
132
133 private double screenPcThreshold;
134
135
136
137 private int[] collisionPercentile;
138
139
140 private String previousMessageId;
141
142
143 private AbsoluteDate previousMessageEpoch;
144
145
146 private AbsoluteDate nextMessageEpoch;
147
148
149
150 public CdmRelativeMetadata() {
151 this.comment = new ArrayList<>();
152
153 this.relativeSpeed = Double.NaN;
154 this.relativePositionR = Double.NaN;
155 this.relativePositionT = Double.NaN;
156 this.relativePositionN = Double.NaN;
157
158 this.relativeVelocityR = Double.NaN;
159 this.relativeVelocityT = Double.NaN;
160 this.relativeVelocityN = Double.NaN;
161
162 this.approachAngle = Double.NaN;
163 this.screenVolumeRadius = Double.NaN;
164 this.screenPcThreshold = Double.NaN;
165 this.mahalanobisDistance = Double.NaN;
166
167
168 this.screenVolumeX = Double.NaN;
169 this.screenVolumeY = Double.NaN;
170 this.screenVolumeZ = Double.NaN;
171 this.collisionProbability = Double.NaN;
172 this.maxCollisionProbability = Double.NaN;
173 this.sefiCollisionProbability = Double.NaN;
174
175 }
176
177
178
179 public void validate() {
180 checkNotNull(tca, CdmRelativeMetadataKey.TCA);
181 checkNotNull(missDistance, CdmRelativeMetadataKey.MISS_DISTANCE);
182 checkScreenVolumeConditions();
183 }
184
185
186
187
188
189 public String getConjunctionId() {
190 return conjunctionId;
191 }
192
193
194
195
196
197 public void setConjunctionId(final String conjunctionId) {
198 this.conjunctionId = conjunctionId;
199 }
200
201
202
203
204
205 public AbsoluteDate getTca() {
206 return tca;
207 }
208
209
210
211
212
213 public void setTca(final AbsoluteDate tca) {
214 this.tca = tca;
215 }
216
217
218
219
220
221 public double getMissDistance() {
222 return missDistance;
223 }
224
225
226
227
228
229 public void setMissDistance(final double missDistance) {
230 this.missDistance = missDistance;
231 }
232
233
234
235
236
237 public double getRelativeSpeed() {
238 return relativeSpeed;
239 }
240
241
242
243
244
245 public void setRelativeSpeed(final double relativeSpeed) {
246 this.relativeSpeed = relativeSpeed;
247 }
248
249
250
251
252
253
254 public Vector3D getRelativeVelocity() {
255 return new Vector3D(relativeVelocityR, relativeVelocityT, relativeVelocityN);
256 }
257
258
259
260
261
262
263 public Vector3D getRelativePosition() {
264 return new Vector3D(relativePositionR, relativePositionT, relativePositionN);
265 }
266
267
268
269
270
271 public void setRelativePositionR(final double relativePositionR) {
272 this.relativePositionR = relativePositionR;
273 }
274
275
276
277
278
279 public void setRelativePositionT(final double relativePositionT) {
280 this.relativePositionT = relativePositionT;
281 }
282
283
284
285
286
287 public void setRelativePositionN(final double relativePositionN) {
288 this.relativePositionN = relativePositionN;
289 }
290
291
292
293
294
295 public void setRelativeVelocityR(final double relativeVelocityR) {
296 this.relativeVelocityR = relativeVelocityR;
297 }
298
299
300
301
302
303 public void setRelativeVelocityT(final double relativeVelocityT) {
304 this.relativeVelocityT = relativeVelocityT;
305 }
306
307
308
309
310
311 public void setRelativeVelocityN(final double relativeVelocityN) {
312 this.relativeVelocityN = relativeVelocityN;
313 }
314
315
316
317
318
319 public AbsoluteDate getStartScreenPeriod() {
320 return startScreenPeriod;
321 }
322
323
324
325
326
327 public void setStartScreenPeriod(final AbsoluteDate startScreenPeriod) {
328 this.startScreenPeriod = startScreenPeriod;
329 }
330
331
332
333
334
335 public AbsoluteDate getStopScreenPeriod() {
336 return stopScreenPeriod;
337 }
338
339
340
341
342
343 public void setStopScreenPeriod(final AbsoluteDate stopScreenPeriod) {
344 this.stopScreenPeriod = stopScreenPeriod;
345 }
346
347
348
349
350
351 public ScreenVolumeFrame getScreenVolumeFrame() {
352 return screenVolumeFrame;
353 }
354
355
356
357
358
359 public void setScreenVolumeFrame(final ScreenVolumeFrame screenVolumeFrame) {
360 this.screenVolumeFrame = screenVolumeFrame;
361 }
362
363
364
365
366
367 public ScreenVolumeShape getScreenVolumeShape() {
368 return screenVolumeShape;
369 }
370
371
372
373
374
375 public void setScreenVolumeShape(final ScreenVolumeShape screenVolumeShape) {
376 this.screenVolumeShape = screenVolumeShape;
377 }
378
379
380
381
382
383 public double getScreenVolumeX() {
384 return screenVolumeX;
385 }
386
387
388
389
390
391 public void setScreenVolumeX(final double screenVolumeX) {
392 this.screenVolumeX = screenVolumeX;
393 }
394
395
396
397
398
399 public double getScreenVolumeY() {
400 return screenVolumeY;
401 }
402
403
404
405
406
407 public void setScreenVolumeY(final double screenVolumeY) {
408 this.screenVolumeY = screenVolumeY;
409 }
410
411
412
413
414
415 public double getScreenVolumeZ() {
416 return screenVolumeZ;
417 }
418
419
420
421
422
423 public void setScreenVolumeZ(final double screenVolumeZ) {
424 this.screenVolumeZ = screenVolumeZ;
425 }
426
427
428
429
430
431 public AbsoluteDate getScreenEntryTime() {
432 return screenEntryTime;
433 }
434
435
436
437
438
439 public void setScreenEntryTime(final AbsoluteDate screenEntryTime) {
440 this.screenEntryTime = screenEntryTime;
441 }
442
443
444
445
446
447 public AbsoluteDate getScreenExitTime() {
448 return screenExitTime;
449 }
450
451
452
453
454
455 public void setScreenExitTime(final AbsoluteDate screenExitTime) {
456 this.screenExitTime = screenExitTime;
457 }
458
459
460
461
462
463 public double getCollisionProbability() {
464 return collisionProbability;
465 }
466
467
468
469
470
471 public void setCollisionProbability(final double collisionProbability) {
472 this.collisionProbability = collisionProbability;
473 }
474
475
476
477
478
479 public PocMethodFacade getCollisionProbaMethod() {
480 return collisionProbabilityMethod;
481 }
482
483
484
485
486
487 public void setCollisionProbaMethod(final PocMethodFacade collisionProbaMethod) {
488 this.collisionProbabilityMethod = collisionProbaMethod;
489 }
490
491
492
493
494
495 public void checkNotNull(final Object field, final Enum<?> key) {
496 if (field == null) {
497 throw new OrekitException(OrekitMessages.UNINITIALIZED_VALUE_FOR_KEY, key.name());
498 }
499 }
500
501
502
503
504
505 public void setTimeSystem(final TimeSystem timeSystem) {
506 this.timeSystem = timeSystem;
507 }
508
509
510
511
512
513 public TimeSystem getTimeSystem() {
514 return timeSystem;
515 }
516
517
518
519
520 public void addComment(final String comments) {
521 this.comment.add(comments);
522 }
523
524
525
526
527 public List<String> getComment() {
528 return comment;
529 }
530
531
532
533
534 public double getApproachAngle() {
535 return approachAngle;
536 }
537
538
539
540
541 public void setApproachAngle(final double approachAngle) {
542 this.approachAngle = approachAngle;
543 }
544
545
546
547
548 public ScreenType getScreenType() {
549 return screenType;
550 }
551
552
553
554
555 public void setScreenType(final ScreenType screenType) {
556 this.screenType = screenType;
557 }
558
559
560
561
562 public double getMaxCollisionProbability() {
563 return maxCollisionProbability;
564 }
565
566
567
568
569 public void setMaxCollisionProbability(final double maxCollisionProbability) {
570 this.maxCollisionProbability = maxCollisionProbability;
571 }
572
573
574
575
576 public PocMethodFacade getMaxCollisionProbabilityMethod() {
577 return maxCollisionProbabilityMethod;
578 }
579
580
581
582
583 public void setMaxCollisionProbabilityMethod(final PocMethodFacade pocMethodFacade) {
584 this.maxCollisionProbabilityMethod = pocMethodFacade;
585 }
586
587
588
589
590 public double getSefiCollisionProbability() {
591 return sefiCollisionProbability;
592 }
593
594
595
596
597 public void setSefiCollisionProbability(final double sefiCollisionProbability) {
598 this.sefiCollisionProbability = sefiCollisionProbability;
599 }
600
601
602
603
604 public PocMethodFacade getSefiCollisionProbabilityMethod() {
605 return sefiCollisionProbabilityMethod;
606 }
607
608
609
610
611 public void setSefiCollisionProbabilityMethod(final PocMethodFacade pocMethodFacade) {
612 this.sefiCollisionProbabilityMethod = pocMethodFacade;
613 }
614
615
616
617
618 public String getSefiFragmentationModel() {
619 return sefiFragmentationModel;
620 }
621
622
623
624
625 public void setSefiFragmentationModel(final String sefiFragmentationModel) {
626 this.sefiFragmentationModel = sefiFragmentationModel;
627 }
628
629
630
631
632
633 public double getMahalanobisDistance() {
634 return mahalanobisDistance;
635 }
636
637
638
639
640
641 public void setMahalanobisDistance(final double mahalanobisDistance) {
642 this.mahalanobisDistance = mahalanobisDistance;
643 }
644
645
646
647
648 public double getScreenVolumeRadius() {
649 return screenVolumeRadius;
650 }
651
652
653
654
655 public void setScreenVolumeRadius(final double screenVolumeRadius) {
656 this.screenVolumeRadius = screenVolumeRadius;
657 }
658
659
660
661
662 public double getScreenPcThreshold() {
663 return screenPcThreshold;
664 }
665
666
667
668
669 public void setScreenPcThreshold(final double screenPcThreshold) {
670 this.screenPcThreshold = screenPcThreshold;
671 }
672
673 public void checkScreenVolumeConditions() {
674
675 if (this.getScreenType() == ScreenType.SHAPE) {
676
677 if (this.getScreenEntryTime() == null) {
678 throw new OrekitException(OrekitMessages.CCSDS_MISSING_KEYWORD, CdmRelativeMetadataKey.SCREEN_ENTRY_TIME);
679 }
680
681 if (this.getScreenExitTime() == null) {
682 throw new OrekitException(OrekitMessages.CCSDS_MISSING_KEYWORD, CdmRelativeMetadataKey.SCREEN_EXIT_TIME);
683 }
684
685 if (this.getScreenVolumeShape() == null) {
686 throw new OrekitException(OrekitMessages.CCSDS_MISSING_KEYWORD, CdmRelativeMetadataKey.SCREEN_VOLUME_SHAPE);
687 }
688
689 if (this.getScreenVolumeShape() == ScreenVolumeShape.SPHERE) {
690
691 if (Double.isNaN(this.getScreenVolumeRadius())) {
692 throw new OrekitException(OrekitMessages.CCSDS_MISSING_KEYWORD, CdmRelativeMetadataKey.SCREEN_VOLUME_RADIUS);
693 }
694
695 } else if (this.getScreenVolumeShape() == ScreenVolumeShape.ELLIPSOID || this.getScreenVolumeShape() == ScreenVolumeShape.BOX) {
696
697 if (this.getScreenVolumeFrame() == null) {
698 throw new OrekitException(OrekitMessages.CCSDS_MISSING_KEYWORD, CdmRelativeMetadataKey.SCREEN_VOLUME_FRAME);
699 }
700 if (Double.isNaN(this.getScreenVolumeX())) {
701 throw new OrekitException(OrekitMessages.CCSDS_MISSING_KEYWORD, CdmRelativeMetadataKey.SCREEN_VOLUME_X);
702 }
703 if (Double.isNaN(this.getScreenVolumeY())) {
704 throw new OrekitException(OrekitMessages.CCSDS_MISSING_KEYWORD, CdmRelativeMetadataKey.SCREEN_VOLUME_Y);
705 }
706 if (Double.isNaN(this.getScreenVolumeZ())) {
707 throw new OrekitException(OrekitMessages.CCSDS_MISSING_KEYWORD, CdmRelativeMetadataKey.SCREEN_VOLUME_Z);
708 }
709 }
710
711 } else if (this.getScreenType() == ScreenType.PC || this.getScreenType() == ScreenType.PC_MAX) {
712
713 if (Double.isNaN(this.getScreenPcThreshold())) {
714 throw new OrekitException(OrekitMessages.CCSDS_MISSING_KEYWORD, CdmRelativeMetadataKey.SCREEN_PC_THRESHOLD);
715 }
716 }
717
718 }
719
720
721
722
723
724 public int[] getCollisionPercentile() {
725 return collisionPercentile == null ? null : collisionPercentile.clone();
726 }
727
728
729
730
731
732 public void setCollisionPercentile(final int[] collisionPercentile) {
733 this.collisionPercentile = collisionPercentile == null ? null : collisionPercentile.clone();;
734 }
735
736
737
738
739 public String getPreviousMessageId() {
740 return previousMessageId;
741 }
742
743
744
745
746 public void setPreviousMessageId(final String previousMessageId) {
747 this.previousMessageId = previousMessageId;
748 }
749
750
751
752
753 public AbsoluteDate getPreviousMessageEpoch() {
754 return previousMessageEpoch;
755 }
756
757
758
759
760 public void setPreviousMessageEpoch(final AbsoluteDate previousMessageEpoch) {
761 this.previousMessageEpoch = previousMessageEpoch;
762 }
763
764
765
766
767 public AbsoluteDate getNextMessageEpoch() {
768 return nextMessageEpoch;
769 }
770
771
772
773
774 public void setNextMessageEpoch(final AbsoluteDate nextMessageEpoch) {
775 this.nextMessageEpoch = nextMessageEpoch;
776 }
777 }