1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.orekit.files.ccsds;
19
20 import java.util.ArrayList;
21 import java.util.Arrays;
22 import java.util.Collection;
23 import java.util.Collections;
24 import java.util.HashMap;
25 import java.util.List;
26 import java.util.Map;
27
28 import org.apache.commons.math3.linear.MatrixUtils;
29 import org.apache.commons.math3.linear.RealMatrix;
30 import org.orekit.errors.OrekitException;
31 import org.orekit.errors.OrekitMessages;
32 import org.orekit.files.general.SatelliteInformation;
33 import org.orekit.frames.Frame;
34 import org.orekit.frames.LOFType;
35 import org.orekit.orbits.PositionAngle;
36 import org.orekit.time.AbsoluteDate;
37
38
39
40
41
42
43
44
45
46 public abstract class OGMFile extends ODMFile {
47
48
49 private AbsoluteDate epoch;
50
51
52 private double a;
53
54
55 private double e;
56
57
58 private double i;
59
60
61 private double raan;
62
63
64 private double pa;
65
66
67 private double anomaly;
68
69
70 private PositionAngle anomalyType;
71
72
73 private double mass;
74
75
76 private double solarRadArea;
77
78
79 private double solarRadCoeff;
80
81
82 private double dragArea;
83
84
85 private double dragCoeff;
86
87
88 private LOFType covRefLofType;
89
90
91
92 private Frame covRefFrame;
93
94
95 private RealMatrix covarianceMatrix;
96
97
98 private Map<String, String> userDefinedParameters;
99
100
101 private boolean hasKeplerianElements;
102
103
104 private List<String> epochComment;
105
106
107 private List<String> keplerianElementsComment;
108
109
110 private List<String> spacecraftComment;
111
112
113 private List<String> covarianceComment;
114
115
116 OGMFile() {
117 mass = Double.NaN;
118 userDefinedParameters = new HashMap<String, String>();
119 epochComment = Collections.emptyList();
120 keplerianElementsComment = Collections.emptyList();
121 spacecraftComment = Collections.emptyList();
122 covarianceComment = Collections.emptyList();
123 };
124
125
126
127
128 public AbsoluteDate getEpoch() {
129 return epoch;
130 }
131
132
133
134
135 void setEpoch(final AbsoluteDate epoch) {
136 this.epoch = epoch;
137 }
138
139
140
141
142 public double getA() {
143 return a;
144 }
145
146
147
148
149 void setA(final double a) {
150 this.a = a;
151 }
152
153
154
155
156 public double getE() {
157 return e;
158 }
159
160
161
162
163 void setE(final double e) {
164 this.e = e;
165 }
166
167
168
169
170 public double getI() {
171 return i;
172 }
173
174
175
176
177 void setI(final double i) {
178 this.i = i;
179 }
180
181
182
183
184 public double getRaan() {
185 return raan;
186 }
187
188
189
190
191 void setRaan(final double raan) {
192 this.raan = raan;
193 }
194
195
196
197
198 public double getPa() {
199 return pa;
200 }
201
202
203
204
205 void setPa(final double pa) {
206 this.pa = pa;
207 }
208
209
210
211
212 public double getAnomaly() {
213 return anomaly;
214 }
215
216
217
218
219 void setAnomaly(final double anomaly) {
220 this.anomaly = anomaly;
221 }
222
223
224
225
226 public PositionAngle getAnomalyType() {
227 return anomalyType;
228 }
229
230
231
232
233 void setAnomalyType(final String anomalyType) {
234 this.anomalyType = PositionAngle.valueOf(anomalyType);
235 }
236
237
238
239
240
241 public double getMass() throws OrekitException {
242 if (Double.isNaN(mass)) {
243 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_SPACECRAFT_MASS);
244 }
245 return mass;
246 }
247
248
249
250
251 void setMass(final double mass) {
252 this.mass = mass;
253 }
254
255
256
257
258 public double getSolarRadArea() {
259 return solarRadArea;
260 }
261
262
263
264
265 void setSolarRadArea(final double solarRadArea) {
266 this.solarRadArea = solarRadArea;
267 }
268
269
270
271
272 public double getSolarRadCoeff() {
273 return solarRadCoeff;
274 }
275
276
277
278
279 void setSolarRadCoeff(final double solarRadCoeff) {
280 this.solarRadCoeff = solarRadCoeff;
281 }
282
283
284
285
286 public double getDragArea() {
287 return dragArea;
288 }
289
290
291
292
293 void setDragArea(final double dragArea) {
294 this.dragArea = dragArea;
295 }
296
297
298
299
300 public double getDragCoeff() {
301 return dragCoeff;
302 }
303
304
305
306
307 void setDragCoeff(final double dragCoeff) {
308 this.dragCoeff = dragCoeff;
309 }
310
311
312
313
314
315
316
317
318
319
320
321 public LOFType getCovRefLofType() {
322 return covRefLofType;
323 }
324
325
326
327
328 void setCovRefLofType(final LOFType covRefLofType) {
329 this.covRefLofType = covRefLofType;
330 this.covRefFrame = null;
331 }
332
333
334
335
336
337
338
339
340
341 public Frame getCovRefFrame() {
342 return covRefFrame;
343 }
344
345
346
347
348 void setCovRefFrame(final Frame covRefFrame) {
349 this.covRefLofType = null;
350 this.covRefFrame = covRefFrame;
351 }
352
353
354
355
356 public RealMatrix getCovarianceMatrix() {
357 return covarianceMatrix;
358 }
359
360
361
362
363
364
365
366
367
368 void setCovarianceMatrixEntry(final int j, final int k, final double entry) {
369 covarianceMatrix.setEntry(j, k, entry);
370 covarianceMatrix.setEntry(k, j, entry);
371 }
372
373
374
375
376 public Map<String, String> getUserDefinedParameters() {
377 return userDefinedParameters;
378 }
379
380
381
382
383
384 void setUserDefinedParameters(final String keyword,
385 final String value) {
386 userDefinedParameters.put(keyword, value);
387 }
388
389
390
391
392 public boolean hasKeplerianElements() {
393 return hasKeplerianElements;
394 }
395
396
397
398
399 void setHasKeplerianElements(final boolean hasKeplerianElements) {
400 this.hasKeplerianElements = hasKeplerianElements;
401 }
402
403
404
405
406 public boolean hasCovarianceMatrix() {
407 return covarianceMatrix != null;
408 }
409
410
411
412 void createCovarianceMatrix() {
413 covarianceMatrix = MatrixUtils.createRealMatrix(6, 6);
414 }
415
416
417
418
419 public List<String> getEpochComment() {
420 return Collections.unmodifiableList(epochComment);
421 }
422
423
424
425
426 void setEpochComment(final List<String> comment) {
427 epochComment = new ArrayList<String>(comment);
428 }
429
430
431
432
433 public List<String> getKeplerianElementsComment() {
434 return Collections.unmodifiableList(keplerianElementsComment);
435 }
436
437
438
439
440 void setKeplerianElementsComment(final List<String> comment) {
441 keplerianElementsComment = new ArrayList<String>(comment);
442 }
443
444
445
446
447 public List<String> getSpacecraftComment() {
448 return Collections.unmodifiableList(spacecraftComment);
449 }
450
451
452
453
454 void setSpacecraftComment(final List<String> comment) {
455 spacecraftComment = new ArrayList<String>(comment);
456 }
457
458
459
460
461 public List<String> getCovarianceComment() {
462 return Collections.unmodifiableList(covarianceComment);
463 }
464
465
466
467
468 void setCovarianceComment(final List<String> comment) {
469 covarianceComment = new ArrayList<String>(comment);
470 }
471
472
473
474
475 public abstract ODMMetaData getMetaData();
476
477
478 @Override
479 public Collection<SatelliteInformation> getSatellites() {
480 return Arrays.asList(new SatelliteInformation(getMetaData().getObjectID()));
481 }
482
483
484 @Override
485 public int getSatelliteCount() {
486 return 1;
487 }
488
489
490 @Override
491 public SatelliteInformation getSatellite(final String satId) {
492 if (getMetaData().getObjectID().equals(satId)) {
493 return new SatelliteInformation(satId);
494 }
495 return null;
496 }
497
498 }