Class StreamingOemWriter
- java.lang.Object
-
- org.orekit.files.ccsds.StreamingOemWriter
-
public class StreamingOemWriter extends Object
A writer for OEM files.Each instance corresponds to a single OEM file. A new OEM ephemeris segment is started by calling
newSegment(Frame, Map)
.Metadata
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
, andKeyword.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 themetadata
argument tonewSegment(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
'sframe
Table 5-3 Keyword.REF_FRAME
Segment Yes Guessed from the segment
'sframe
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 theconstructor
.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 exceptKeyword.CREATION_DATE
. The guessing algorithm is not guaranteed to work so it is recommended to provide values forKeyword.CENTER_NAME
,Keyword.REF_FRAME
, andKeyword.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 forKeyword.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.Examples
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.
Alternatively a collection of state vectors can be written without the use of a Propagator. In this case thePropagator 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);
Keyword.START_TIME
andKeyword.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); }
- Author:
- Evan Ward
- See Also:
- CCSDS 502.0-B-2 Orbit Data
Messages,
CCSDS 500.0-G-3 Navigation
Data Definitions and Conventions,
OEMWriter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
StreamingOemWriter.Segment
A writer for a segment of an OEM.
-
Field Summary
Fields Modifier and Type Field Description static String
CCSDS_OEM_VERS
Version number implemented.static String
DEFAULT_ORIGINATOR
Default value forKeyword.ORIGINATOR
.
-
Constructor Summary
Constructors Constructor Description StreamingOemWriter(Appendable writer, TimeScale timeScale, Map<Keyword,String> metadata)
Create an OEM writer than streams data to the given output stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Field Detail
-
CCSDS_OEM_VERS
public static final String CCSDS_OEM_VERS
Version number implemented.- See Also:
- Constant Field Values
-
DEFAULT_ORIGINATOR
public static final String DEFAULT_ORIGINATOR
Default value forKeyword.ORIGINATOR
.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StreamingOemWriter
public StreamingOemWriter(Appendable writer, TimeScale timeScale, Map<Keyword,String> metadata)
Create an OEM writer than streams data to the given output stream.- Parameters:
writer
- The output stream for the OEM file. Most methods will append data to thiswriter
.timeScale
- for all times in the OEM exceptKeyword.CREATION_DATE
. See Section 5.2.4.5 and Annex A.metadata
- for the satellite. Can be overridden innewSegment(Frame, Map)
for a specific segment. SeeStreamingOemWriter
.
-
-
Method Detail
-
writeHeader
public void writeHeader() throws IOException
Writes the standard OEM header for the file.- Throws:
IOException
- if the stream cannot write to stream
-
newSegment
public StreamingOemWriter.Segment newSegment(Frame frame, Map<Keyword,String> segmentMetadata)
Create a writer for a new OEM ephemeris segment.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.
- Parameters:
frame
- the reference frame to use for the segment. If this value isnull
thenStreamingOemWriter.Segment.handleStep(SpacecraftState, boolean)
will throw aNullPointerException
and the metadata itemKeyword.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. SeeStreamingOemWriter(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.- Returns:
- a new OEM segment, ready for writing.
-
-