Class 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, 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.

    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.

    
     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);
     }
     
    Author:
    Evan Ward
    See Also:
    CCSDS 502.0-B-2 Orbit Data Messages, CCSDS 500.0-G-3 Navigation Data Definitions and Conventions, OEMWriter