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 themetadataargument tonewSegment(Frame, Map).Keyword Usage Obligatory Default Reference Keyword.CCSDS_OEM_VERSHeader Yes CCSDS_OEM_VERSTable 5-2 Keyword.COMMENTHeader No Table 5-2 Keyword.CREATION_DATEHeader Yes NowTable 5.2, 6.5.9 Keyword.ORIGINATORHeader Yes DEFAULT_ORIGINATORTable 5-2 Keyword.OBJECT_NAMESegment Yes Table 5-3 Keyword.OBJECT_IDSegment Yes Table 5-3 Keyword.CENTER_NAMESegment Yes Guessed from the segment'sframeTable 5-3 Keyword.REF_FRAMESegment Yes Guessed from the segment'sframeTable 5-3, Annex A Keyword.REF_FRAME_EPOCHSegment No Table 5-3, 6.5.9 Keyword.TIME_SYSTEMSegment Yes Guessed from timeScaleset in theconstructor.Table 5-3, Annex A Keyword.START_TIMESegment Yes Date of initial state in Segment.init(...)Table 5-3, 6.5.9 Keyword.USEABLE_START_TIMESegment No Table 5-3, 6.5.9 Keyword.STOP_TIMESegment Yes Target date in Segment.init(...)Table 5-3, 6.5.9 Keyword.USEABLE_STOP_TIMESegment No Table 5-3, 6.5.9 Keyword.INTERPOLATIONSegment No Table 5-3 Keyword.INTERPOLATION_DEGREESegment No Table 5-3 The
Keyword.TIME_SYSTEMmust 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_SYSTEMto avoid any bugs associated with incorrect guesses.Standardized values for
Keyword.TIME_SYSTEMare GMST, GPS, ME, MRT, SCLK, TAI, TCB, TDB, TCG, TT, UT1, and UTC. Standardized values forKeyword.REF_FRAMEare 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_TIMEandKeyword.STOP_TIMEneed 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 classStreamingOemWriter.SegmentA writer for a segment of an OEM.
-
Field Summary
Fields Modifier and Type Field Description static StringCCSDS_OEM_VERSVersion number implemented.static StringDEFAULT_ORIGINATORDefault 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.SegmentnewSegment(Frame frame, Map<Keyword,String> segmentMetadata)Create a writer for a new OEM ephemeris segment.voidwriteHeader()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 IOExceptionWrites 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 isnullthenStreamingOemWriter.Segment.handleStep(SpacecraftState, boolean)will throw aNullPointerExceptionand the metadata itemKeyword.REF_FRAMEmust 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.
-
-