public class StreamingOemWriter extends Object
Each instance corresponds to a single OEM file. A new OEM ephemeris segment is
started by calling newSegment(Frame, Map)
.
The OEM metadata used by this writer is described in the following table. Many
metadata items are optional or have default values so they do not need to be specified.
At a minimum the user must supply those values that are required and for which no
default exits: Keyword.OBJECT_NAME
, and Keyword.OBJECT_ID
. The usage
column in the table indicates where the metadata item is used, either in the OEM header
or in the metadata section at the start of an OEM ephemeris segment.
The OEM metadata for the whole OEM file is set in the constructor
. Any of the metadata may
be overridden for a particular segment using the metadata
argument to newSegment(Frame, Map)
.
Keyword | Usage | Obligatory | Default | Reference |
---|---|---|---|---|
Keyword.CCSDS_OEM_VERS
| Header | Yes | CCSDS_OEM_VERS
| Table 5-2 |
Keyword.COMMENT
| Header | No | Table 5-2 | |
Keyword.CREATION_DATE
| Header | Yes | Now
| Table 5.2, 6.5.9 |
Keyword.ORIGINATOR
| Header | Yes | DEFAULT_ORIGINATOR
| Table 5-2 |
Keyword.OBJECT_NAME
| Segment | Yes | Table 5-3 | |
Keyword.OBJECT_ID
| Segment | Yes | Table 5-3 | |
Keyword.CENTER_NAME
| Segment | Yes | Guessed from the segment 's frame
| Table 5-3 |
Keyword.REF_FRAME
| Segment | Yes | Guessed from the segment 's frame
| Table 5-3, Annex A |
Keyword.REF_FRAME_EPOCH
| Segment | No | Table 5-3, 6.5.9 | |
Keyword.TIME_SYSTEM
| Segment | Yes | Guessed from timeScale set in the
constructor .
| Table 5-3, Annex A |
Keyword.START_TIME
| Segment | Yes | Date of initial state in Segment.init(...)
| Table 5-3, 6.5.9 |
Keyword.USEABLE_START_TIME
| Segment | No | Table 5-3, 6.5.9 | |
Keyword.STOP_TIME
| Segment | Yes | Target date in Segment.init(...)
| Table 5-3, 6.5.9 |
Keyword.USEABLE_STOP_TIME
| Segment | No | Table 5-3, 6.5.9 | |
Keyword.INTERPOLATION
| Segment | No | Table 5-3 | |
Keyword.INTERPOLATION_DEGREE
| Segment | No | Table 5-3 |
The Keyword.TIME_SYSTEM
must be constant for the whole file and is used
to interpret all dates except Keyword.CREATION_DATE
. The guessing algorithm
is not guaranteed to work so it is recommended to provide values for Keyword.CENTER_NAME
, Keyword.REF_FRAME
, and Keyword.TIME_SYSTEM
to
avoid any bugs associated with incorrect guesses.
Standardized values for Keyword.TIME_SYSTEM
are GMST, GPS, ME, MRT, SCLK,
TAI, TCB, TDB, TCG, TT, UT1, and UTC. Standardized values for Keyword.REF_FRAME
are EME2000, GCRF, GRC, ICRF, ITRF2000, ITRF-93, ITRF-97, MCI, TDR, TEME, and TOD.
Additionally ITRF followed by a four digit year may be used.
This class can be used as a step handler for a Propagator
, or on its own.
Either way the object name and ID must be specified. The following example shows its
use as a step handler.
Propagator propagator = ...; // pre-configured propagator
Appendable out = ...; // set-up output stream
Map<Keyword, String> metadata = new LinkedHashMap<>();
metadata.put(Keyword.OBJECT_NAME, "Vanguard");
metadata.put(Keyword.OBJECT_ID, "1958-002B");
StreamingOemWriter writer = new StreamingOemWriter(out, utc, metadata);
writer.writeHeader();
Segment segment = writer.newSegment(frame, Collections.emptyMap());
propagator.setMasterMode(step, segment);
propagator.propagate(startDate, stopDate);
Alternatively a collection of state vectors can be written without the use of a
Propagator. In this case the Keyword.START_TIME
and Keyword.STOP_TIME
need to be specified as part of the metadata.
List<TimeStampedPVCoordinates> states = ...; // pre-generated states
Appendable out = ...; // set-up output stream
Map<Keyword, String> metadata = new LinkedHashMap<>();
metadata.put(Keyword.OBJECT_NAME, "Vanguard");
metadata.put(Keyword.OBJECT_ID, "1958-002B");
StreamingOemWriter writer = new StreamingOemWriter(out, utc, metadata);
writer.writeHeader();
// manually set start and stop times for this segment
Map<Keyword, String> segmentData = new LinkedHashMap<>();
segmentData.put(Keyword.START_TIME, start.toString());
segmentData.put(Keyword.STOP_TIME, stop.toString());
Segment segment = writer.newSegment(frame, segmentData);
segment.writeMetadata(); // output metadata block
for (TimeStampedPVCoordinates state : states) {
segment.writeEphemerisLine(state);
}
OEMWriter
Modifier and Type | Class and Description |
---|---|
class |
StreamingOemWriter.Segment
A writer for a segment of an OEM.
|
Modifier and Type | Field and Description |
---|---|
static String |
CCSDS_OEM_VERS
Version number implemented.
|
static String |
DEFAULT_ORIGINATOR
Default value for
Keyword.ORIGINATOR . |
Constructor and Description |
---|
StreamingOemWriter(Appendable writer,
TimeScale timeScale,
Map<Keyword,String> metadata)
Create an OEM writer than streams data to the given output stream.
|
Modifier and Type | Method and Description |
---|---|
StreamingOemWriter.Segment |
newSegment(Frame frame,
Map<Keyword,String> segmentMetadata)
Create a writer for a new OEM ephemeris segment.
|
void |
writeHeader()
Writes the standard OEM header for the file.
|
public static final String CCSDS_OEM_VERS
public static final String DEFAULT_ORIGINATOR
Keyword.ORIGINATOR
.public StreamingOemWriter(Appendable writer, TimeScale timeScale, Map<Keyword,String> metadata)
writer
- The output stream for the OEM file. Most methods will append data
to this writer
.timeScale
- for all times in the OEM except Keyword.CREATION_DATE
. See
Section 5.2.4.5 and Annex A.metadata
- for the satellite. Can be overridden in newSegment(Frame,
Map)
for a specific segment. See StreamingOemWriter
.public void writeHeader() throws IOException
IOException
- if the stream cannot write to streampublic StreamingOemWriter.Segment newSegment(Frame frame, Map<Keyword,String> segmentMetadata)
The returned writer can only write a single ephemeris segment in an OEM. This method must be called to create a writer for each ephemeris segment.
frame
- the reference frame to use for the segment. If this value is
null
then StreamingOemWriter.Segment.handleStep(SpacecraftState,
boolean)
will throw a NullPointerException
and the
metadata item Keyword.REF_FRAME
must be specified in
the metadata.segmentMetadata
- the metadata to use for the segment. Overrides for this
segment any other source of meta data values. See StreamingOemWriter(java.lang.Appendable, org.orekit.time.TimeScale, java.util.Map<org.orekit.files.ccsds.Keyword, java.lang.String>)
for a description of which metadata are
required and how they are determined.Copyright © 2002-2020 CS GROUP. All rights reserved.