1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.orekit.files.ccsds.ndm.tdm;
19
20 import java.util.ArrayList;
21 import java.util.List;
22 import java.util.Map;
23 import java.util.TreeMap;
24
25 import org.orekit.errors.OrekitException;
26 import org.orekit.errors.OrekitMessages;
27 import org.orekit.files.ccsds.definitions.FrameFacade;
28 import org.orekit.files.ccsds.section.Metadata;
29 import org.orekit.frames.Frame;
30 import org.orekit.time.AbsoluteDate;
31 import org.orekit.utils.Constants;
32
33
34
35
36
37
38
39
40 public class TdmMetadata extends Metadata {
41
42
43 private String trackId;
44
45
46 private List<ObservationType> dataTypes;
47
48
49 private AbsoluteDate startTime;
50
51
52 private AbsoluteDate stopTime;
53
54
55
56
57
58 private Map<Integer, String> participants;
59
60
61 private TrackingMode mode;
62
63
64
65
66
67
68
69
70
71 private int[] path;
72
73
74 private int[] path1;
75
76
77 private int[] path2;
78
79
80 private Map<Integer, String> ephemerisNames;
81
82
83 private String transmitBand;
84
85
86 private String receiveBand;
87
88
89
90
91 private int turnaroundNumerator;
92
93
94 private int turnaroundDenominator;
95
96
97
98
99
100 private TimetagReference timetagRef;
101
102
103
104
105
106 private double integrationInterval;
107
108
109
110
111
112 private IntegrationReference integrationRef;
113
114
115
116
117 private double freqOffset;
118
119
120 private RangeMode rangeMode;
121
122
123 private double rawRangeModulus;
124
125
126 private RangeUnits rangeUnits;
127
128
129 private AngleType angleType;
130
131
132 private FrameFacade referenceFrame;
133
134
135 private String interpolationMethod;
136
137
138 private int interpolationDegree;
139
140
141 private double doppplerCountBias;
142
143
144 private double dopplerCountScale;
145
146
147 private boolean doppplerCountRollover;
148
149
150
151
152
153 private Map<Integer, Double> transmitDelays;
154
155
156
157
158
159 private Map<Integer, Double> receiveDelays;
160
161
162 private DataQuality dataQuality;
163
164
165
166
167 private double correctionAngle1;
168
169
170
171
172 private double correctionAngle2;
173
174
175
176
177 private double correctionDoppler;
178
179
180
181
182 private double correctionMagnitude;
183
184
185
186
187 private double rawCorrectionRange;
188
189
190
191
192 private double correctionRcs;
193
194
195
196
197 private double correctionReceive;
198
199
200
201
202 private double correctionTransmit;
203
204
205
206
207 private double correctionAberrationYearly;
208
209
210
211
212 private double correctionAberrationDiurnal;
213
214
215
216
217
218 private CorrectionApplied correctionsApplied;
219
220
221
222 public TdmMetadata() {
223 super(null);
224 participants = new TreeMap<>();
225 ephemerisNames = new TreeMap<>();
226 doppplerCountBias = Double.NaN;
227 dopplerCountScale = 1;
228 doppplerCountRollover = false;
229 transmitDelays = new TreeMap<>();
230 receiveDelays = new TreeMap<>();
231 }
232
233
234 @Override
235 public void validate(final double version) {
236 super.validate(version);
237 if (participants.isEmpty()) {
238 throw new OrekitException(OrekitMessages.UNINITIALIZED_VALUE_FOR_KEY, TdmMetadataKey.PARTICIPANT_1);
239 }
240 }
241
242
243
244
245 public String getTrackId() {
246 return trackId;
247 }
248
249
250
251
252 public void setTrackId(final String trackId) {
253 refuseFurtherComments();
254 this.trackId = trackId;
255 }
256
257
258
259
260 public List<ObservationType> getDataTypes() {
261 return dataTypes;
262 }
263
264
265
266
267 public void setDataTypes(final List<ObservationType> dataTypes) {
268 refuseFurtherComments();
269 this.dataTypes = new ArrayList<>();
270 this.dataTypes.addAll(dataTypes);
271 }
272
273
274
275
276 public AbsoluteDate getStartTime() {
277 return startTime;
278 }
279
280
281
282
283 public void setStartTime(final AbsoluteDate startTime) {
284 refuseFurtherComments();
285 this.startTime = startTime;
286 }
287
288
289
290
291 public AbsoluteDate getStopTime() {
292 return stopTime;
293 }
294
295
296
297
298 public void setStopTime(final AbsoluteDate stopTime) {
299 refuseFurtherComments();
300 this.stopTime = stopTime;
301 }
302
303
304
305
306 public Map<Integer, String> getParticipants() {
307 return participants;
308 }
309
310
311
312
313 public void setParticipants(final Map<Integer, String> participants) {
314 refuseFurtherComments();
315 this.participants = new TreeMap<>();
316 this.participants.putAll(participants);
317 }
318
319
320
321
322
323 public void addParticipant(final int participantNumber, final String participant) {
324 refuseFurtherComments();
325 this.participants.put(participantNumber, participant);
326 }
327
328
329
330
331 public TrackingMode getMode() {
332 return mode;
333 }
334
335
336
337
338 public void setMode(final TrackingMode mode) {
339 refuseFurtherComments();
340 this.mode = mode;
341 }
342
343
344
345
346 public int[] getPath() {
347 return safeCopy(path);
348 }
349
350
351
352
353 public void setPath(final int[] path) {
354 refuseFurtherComments();
355 this.path = safeCopy(path);
356 }
357
358
359
360
361 public int[] getPath1() {
362 return safeCopy(path1);
363 }
364
365
366
367
368 public void setPath1(final int[] path1) {
369 refuseFurtherComments();
370 this.path1 = safeCopy(path1);
371 }
372
373
374
375
376 public int[] getPath2() {
377 return safeCopy(path2);
378 }
379
380
381
382
383 public void setPath2(final int[] path2) {
384 refuseFurtherComments();
385 this.path2 = safeCopy(path2);
386 }
387
388
389
390
391 public Map<Integer, String> getEphemerisNames() {
392 return ephemerisNames;
393 }
394
395
396
397
398 public void setEphemerisNames(final Map<Integer, String> ephemerisNames) {
399 refuseFurtherComments();
400 this.ephemerisNames = new TreeMap<>();
401 this.ephemerisNames.putAll(ephemerisNames);
402 }
403
404
405
406
407
408 public void addEphemerisName(final int participantNumber, final String ephemerisName) {
409 refuseFurtherComments();
410 this.ephemerisNames.put(participantNumber, ephemerisName);
411 }
412
413
414
415
416 public String getTransmitBand() {
417 return transmitBand;
418 }
419
420
421
422
423 public void setTransmitBand(final String transmitBand) {
424 refuseFurtherComments();
425 this.transmitBand = transmitBand;
426 }
427
428
429
430
431 public String getReceiveBand() {
432 return receiveBand;
433 }
434
435
436
437
438 public void setReceiveBand(final String receiveBand) {
439 refuseFurtherComments();
440 this.receiveBand = receiveBand;
441 }
442
443
444
445
446 public int getTurnaroundNumerator() {
447 return turnaroundNumerator;
448 }
449
450
451
452
453 public void setTurnaroundNumerator(final int turnaroundNumerator) {
454 refuseFurtherComments();
455 this.turnaroundNumerator = turnaroundNumerator;
456 }
457
458
459
460
461 public int getTurnaroundDenominator() {
462 return turnaroundDenominator;
463 }
464
465
466
467
468 public void setTurnaroundDenominator(final int turnaroundDenominator) {
469 refuseFurtherComments();
470 this.turnaroundDenominator = turnaroundDenominator;
471 }
472
473
474
475
476 public TimetagReference getTimetagRef() {
477 return timetagRef;
478 }
479
480
481
482
483 public void setTimetagRef(final TimetagReference timetagRef) {
484 refuseFurtherComments();
485 this.timetagRef = timetagRef;
486 }
487
488
489
490
491 public double getIntegrationInterval() {
492 return integrationInterval;
493 }
494
495
496
497
498 public void setIntegrationInterval(final double integrationInterval) {
499 refuseFurtherComments();
500 this.integrationInterval = integrationInterval;
501 }
502
503
504
505
506 public IntegrationReference getIntegrationRef() {
507 return integrationRef;
508 }
509
510
511
512
513 public void setIntegrationRef(final IntegrationReference integrationRef) {
514 refuseFurtherComments();
515 this.integrationRef = integrationRef;
516 }
517
518
519
520
521 public double getFreqOffset() {
522 return freqOffset;
523 }
524
525
526
527
528 public void setFreqOffset(final double freqOffset) {
529 refuseFurtherComments();
530 this.freqOffset = freqOffset;
531 }
532
533
534
535
536 public RangeMode getRangeMode() {
537 return rangeMode;
538 }
539
540
541
542
543 public void setRangeMode(final RangeMode rangeMode) {
544 refuseFurtherComments();
545 this.rangeMode = rangeMode;
546 }
547
548
549
550
551
552
553 public double getRangeModulus(final RangeUnitsConverter converter) {
554 if (rangeUnits == RangeUnits.km) {
555 return rawRangeModulus * 1000;
556 } else if (rangeUnits == RangeUnits.s) {
557 return rawRangeModulus * Constants.SPEED_OF_LIGHT;
558 } else {
559 return converter.ruToMeters(this, startTime, rawRangeModulus);
560 }
561 }
562
563
564
565
566 public double getRawRangeModulus() {
567 return rawRangeModulus;
568 }
569
570
571
572
573 public void setRawRangeModulus(final double rawRangeModulus) {
574 refuseFurtherComments();
575 this.rawRangeModulus = rawRangeModulus;
576 }
577
578
579
580
581 public RangeUnits getRangeUnits() {
582 return rangeUnits;
583 }
584
585
586
587
588 public void setRangeUnits(final RangeUnits rangeUnits) {
589 refuseFurtherComments();
590 this.rangeUnits = rangeUnits;
591 }
592
593
594
595
596 public AngleType getAngleType() {
597 return angleType;
598 }
599
600
601
602
603 public void setAngleType(final AngleType angleType) {
604 refuseFurtherComments();
605 this.angleType = angleType;
606 }
607
608
609
610
611 public FrameFacade getReferenceFrame() {
612 return referenceFrame;
613 }
614
615
616
617
618 public void setReferenceFrame(final FrameFacade referenceFrame) {
619 refuseFurtherComments();
620 this.referenceFrame = referenceFrame;
621 }
622
623
624
625
626
627
628 public String getInterpolationMethod() {
629 return interpolationMethod;
630 }
631
632
633
634
635
636 public void setInterpolationMethod(final String interpolationMethod) {
637 refuseFurtherComments();
638 this.interpolationMethod = interpolationMethod;
639 }
640
641
642
643
644
645 public int getInterpolationDegree() {
646 return interpolationDegree;
647 }
648
649
650
651
652
653 public void setInterpolationDegree(final int interpolationDegree) {
654 refuseFurtherComments();
655 this.interpolationDegree = interpolationDegree;
656 }
657
658
659
660
661
662 public double getDopplerCountBias() {
663 return doppplerCountBias;
664 }
665
666
667
668
669
670 public void setDopplerCountBias(final double dopplerCountBias) {
671 refuseFurtherComments();
672 this.doppplerCountBias = dopplerCountBias;
673 }
674
675
676
677
678
679 public double getDopplerCountScale() {
680 return dopplerCountScale;
681 }
682
683
684
685
686
687 public void setDopplerCountScale(final double dopplerCountScale) {
688 refuseFurtherComments();
689 this.dopplerCountScale = dopplerCountScale;
690 }
691
692
693
694
695
696 public boolean hasDopplerCountRollover() {
697 return doppplerCountRollover;
698 }
699
700
701
702
703
704 public void setDopplerCountRollover(final boolean dopplerCountRollover) {
705 refuseFurtherComments();
706 this.doppplerCountRollover = dopplerCountRollover;
707 }
708
709
710
711
712 public Map<Integer, Double> getTransmitDelays() {
713 return transmitDelays;
714 }
715
716
717
718
719 public void setTransmitDelays(final Map<Integer, Double> transmitDelays) {
720 refuseFurtherComments();
721 this.transmitDelays = new TreeMap<>();
722 this.transmitDelays.putAll(transmitDelays);
723 }
724
725
726
727
728
729 public void addTransmitDelay(final int participantNumber, final double transmitDelay) {
730 refuseFurtherComments();
731 this.transmitDelays.put(participantNumber, transmitDelay);
732 }
733
734
735
736
737 public Map<Integer, Double> getReceiveDelays() {
738 return receiveDelays;
739 }
740
741
742
743
744 public void setReceiveDelays(final Map<Integer, Double> receiveDelays) {
745 refuseFurtherComments();
746 this.receiveDelays = new TreeMap<>();
747 this.receiveDelays.putAll(receiveDelays);
748 }
749
750
751
752
753
754 public void addReceiveDelay(final int participantNumber, final double receiveDelay) {
755 refuseFurtherComments();
756 this.receiveDelays.put(participantNumber, receiveDelay);
757 }
758
759
760
761 public DataQuality getDataQuality() {
762 return dataQuality;
763 }
764
765
766
767
768 public void setDataQuality(final DataQuality dataQuality) {
769 refuseFurtherComments();
770 this.dataQuality = dataQuality;
771 }
772
773
774
775
776 public double getCorrectionAngle1() {
777 return correctionAngle1;
778 }
779
780
781
782
783 public void setCorrectionAngle1(final double correctionAngle1) {
784 refuseFurtherComments();
785 this.correctionAngle1 = correctionAngle1;
786 }
787
788
789
790
791 public double getCorrectionAngle2() {
792 return correctionAngle2;
793 }
794
795
796
797
798 public void setCorrectionAngle2(final double correctionAngle2) {
799 refuseFurtherComments();
800 this.correctionAngle2 = correctionAngle2;
801 }
802
803
804
805
806 public double getCorrectionDoppler() {
807 return correctionDoppler;
808 }
809
810
811
812
813 public void setCorrectionDoppler(final double correctionDoppler) {
814 refuseFurtherComments();
815 this.correctionDoppler = correctionDoppler;
816 }
817
818
819
820
821 public double getCorrectionMagnitude() {
822 return correctionMagnitude;
823 }
824
825
826
827
828 public void setCorrectionMagnitude(final double correctionMagnitude) {
829 refuseFurtherComments();
830 this.correctionMagnitude = correctionMagnitude;
831 }
832
833
834
835
836
837
838 public double getCorrectionRange(final RangeUnitsConverter converter) {
839 if (rangeUnits == RangeUnits.km) {
840 return rawCorrectionRange * 1000;
841 } else if (rangeUnits == RangeUnits.s) {
842 return rawCorrectionRange * Constants.SPEED_OF_LIGHT;
843 } else {
844 return converter.ruToMeters(this, startTime, rawCorrectionRange);
845 }
846 }
847
848
849
850
851 public double getRawCorrectionRange() {
852 return rawCorrectionRange;
853 }
854
855
856
857
858 public void setRawCorrectionRange(final double rawCorrectionRange) {
859 refuseFurtherComments();
860 this.rawCorrectionRange = rawCorrectionRange;
861 }
862
863
864
865
866 public double getCorrectionRcs() {
867 return correctionRcs;
868 }
869
870
871
872
873 public void setCorrectionRcs(final double correctionRcs) {
874 refuseFurtherComments();
875 this.correctionRcs = correctionRcs;
876 }
877
878
879
880
881 public double getCorrectionAberrationYearly() {
882 return correctionAberrationYearly;
883 }
884
885
886
887
888 public void setCorrectionAberrationYearly(final double correctionAberrationYearly) {
889 refuseFurtherComments();
890 this.correctionAberrationYearly = correctionAberrationYearly;
891 }
892
893
894
895
896 public double getCorrectionAberrationDiurnal() {
897 return correctionAberrationDiurnal;
898 }
899
900
901
902
903 public void setCorrectionAberrationDiurnal(final double correctionAberrationDiurnal) {
904 refuseFurtherComments();
905 this.correctionAberrationDiurnal = correctionAberrationDiurnal;
906 }
907
908
909
910
911 public double getCorrectionReceive() {
912 return correctionReceive;
913 }
914
915
916
917
918 public void setCorrectionReceive(final double correctionReceive) {
919 refuseFurtherComments();
920 this.correctionReceive = correctionReceive;
921 }
922
923
924
925
926 public double getCorrectionTransmit() {
927 return correctionTransmit;
928 }
929
930
931
932
933 public void setCorrectionTransmit(final double correctionTransmit) {
934 refuseFurtherComments();
935 this.correctionTransmit = correctionTransmit;
936 }
937
938
939
940
941 public CorrectionApplied getCorrectionsApplied() {
942 return correctionsApplied;
943 }
944
945
946
947
948 public void setCorrectionsApplied(final CorrectionApplied correctionsApplied) {
949 refuseFurtherComments();
950 this.correctionsApplied = correctionsApplied;
951 }
952
953
954
955
956
957 private int[] safeCopy(final int[] original) {
958 return original == null ? null : original.clone();
959 }
960
961 }