Click or drag to resize

StkEphemerisFile Class

Reads from and writes to STK ephemeris (.e) files. STK ephemeris files can express position, velocity, acceleration, and covariance information, and are useful for getting this type of data into and out of STK.

To read an STK ephemeris file, call the ReadFrom(String) method to read the data into memory, and then call the CreatePoint method to create a time-varying Point representing the ephemeris data in the file. Similarly, call CreateCovarianceInterpolator to obtain the Covariance3By3SizeAndOrientationInterpolator representing the covariance data in the file.

You can also build an StkEphemerisFile instance by calling the various Configure... methods such as ConfigureFromPointInterpolator(PointInterpolator). Once you've built an appropriate StkEphemerisFile instance, you can save it to a file or another stream by calling WriteTo(TextWriter).

Inheritance Hierarchy
SystemObject
  AGI.Foundation.StkStkEphemerisFile

Namespace:  AGI.Foundation.Stk
Assembly:  AGI.Foundation.Models (in AGI.Foundation.Models.dll) Version: 19.5.402.0 (19.5.402.0)
Syntax
public class StkEphemerisFile

The StkEphemerisFile type exposes the following members.

Constructors
  NameDescription
Public methodStkEphemerisFile
Initializes a new instance.
Top
Properties
  NameDescription
Public propertyCovarianceData
Gets or sets the covariance data.
Public propertyData
Gets or sets the ephemeris data.
Public propertyProperties
Gets a dictionary of key and value pairs in the STK ephemeris file. After an StkEphemerisFile is read, this dictionary contains all of the key and value pairs in the file. When writing an StkEphemerisFile, these properties are written back to the file, but only if another property does not offer an authoritative value. For example, if the CoordinateSystem property is set, any "CoordinateSystem" property in this collection will be overwritten.
Public propertyPropertiesWithUnsupportedValues
Gets a dictionary of property names and values for the properties with values specified in the file that are not supported by the StkEphemerisFile reader. Any information contained in these properties may not be captured by the reader.
Public propertySegmentBoundaryTimes
Gets or sets the list of segment boundary times in the STK ephemeris file. Segment boundary times are times that should not be interpolated over.
Public propertyUnsupportedProperties
Gets a dictionary of property names and values for the properties that are contained in the file but that are not supported by the StkEphemerisFile reader. Any information contained in these properties may not be captured by the reader.
Public propertyVersion
Gets or sets the ephemeris file version.
Top
Methods
  NameDescription
Public methodConfigureFromPoint
Configures this instance with values computed by sampling a Point over an interval with a fixed step. The Data property is replaced with a new instance of StkEphemerisFileEphemerisTimePos, StkEphemerisFileEphemerisTimePosVel, or StkEphemerisFileEphemerisTimePosVelAcc (depending on the value of the order property) and any existing information stored in that instance is lost. The Properties are not modified, but values pulled from Point will take precedence over values in the Properties collection when writing this instance using WriteTo(TextWriter). The Interpolator property is not configured, so you may want to call ConfigureInterpolation(InterpolationAlgorithm, Int32) after calling this method.
Public methodConfigureFromPointInterpolator
Configures the instance to represent the ephemeris and interpolation stored in a PointInterpolator. The Data property is replaced with a new instance of StkEphemerisFileEphemerisTimePos, StkEphemerisFileEphemerisTimePosVel, or StkEphemerisFileEphemerisTimePosVelAcc (depending on the number of derivatives available from the PointInterpolator) and any existing information stored in that instance is lost. The Properties are not modified, but values pulled from PointInterpolator will take precedence over values in the Properties collection when writing this instance using WriteTo(TextWriter).
Public methodConfigureInterpolation
Configures the Interpolator to use the specified interpolation algorithm and polynomial degree. The Data property must be set before calling this method.
Public methodCreateCovarianceInterpolator
Creates a Covariance3By3SizeAndOrientationInterpolator for interpolating over the covariance data held by this instance.
Public methodCreatePoint
Creates a Point whose time-varying position is computed by interpolating over the ephemeris data held by this instance.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodStatic memberReadFrom(TextReader)
Reads an STK ephemeris (.e) file from a TextReader. The TextReader can be a StreamReader for reading from a file, a StringReader for reading from a string, or any number of other types. See the Remarks section of the documentation of ReadFrom(TextReader, StkEphemerisFileOptions) for detailed information.
Public methodStatic memberReadFrom(String)
Reads an STK ephemeris (.e) file from a file. See the Remarks section of the documentation of ReadFrom(TextReader, StkEphemerisFileOptions) for detailed information.
Public methodStatic memberReadFrom(TextReader, StkEphemerisFileOptions)
Reads an STK ephemeris (.e) file from a TextReader. The TextReader can be a StreamReader for reading from a file, a StringReader for reading from a string, or any number of other types. See the Remarks section for more information.
Public methodStatic memberReadFrom(String, StkEphemerisFileOptions)
Reads an STK ephemeris (.e) file from a file. See the Remarks section of the documentation of ReadFrom(TextReader, StkEphemerisFileOptions) for detailed information.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodWriteTo(TextWriter)
Writes this instance to a TextWriter in the STK ephemeris file (.e) format. The TextWriter can be a StreamWriter for writing to a file, a StringWriter for writing to a string, or any number of other types.
Public methodWriteTo(TextWriter, Boolean)
Writes this instance to a TextWriter in the STK ephemeris file (.e) format. The TextWriter can be a StreamWriter for writing to a file, a StringWriter for writing to a string, or any number of other types.
Top
Examples
An example of writing an STK ephemeris (.e) file from a motion evaluator:
C#
// Use any valid TLE to create a propagator, and use that propagator to create a MotionEvaluator.
TwoLineElementSet inputTwoLineElementSet =
    new TwoLineElementSet(@"1 20813U 90084A   07157.52757149 -.00000978  00000-0  10000-3 0  8139
                            2 20813  62.3585 177.5907 7234421 261.2958  18.3008  2.01001663122427");
Sgp4Propagator propagator = new Sgp4Propagator(inputTwoLineElementSet);
MotionEvaluator<Cartesian> motionEvaluator = propagator.GetEvaluator();

// Define start time, stop time, and time step that will be used to sample the motion evaluator for ephemeris data.
JulianDate startDate = new JulianDate(new GregorianDate(2007, 6, 1));
JulianDate stopDate = new JulianDate(new GregorianDate(2007, 6, 2));
Duration timeStep = Duration.FromSeconds(60);

// Using the MotionEvaluator created above, output ephemeris data in a format that can be processed by
// the StkEphemerisFile object. Passing null for the ITrackCalculationProgress indicates that the Evaluate step
// should not track progress.
DateMotionCollection<Cartesian> rawEphemerisData = motionEvaluator.Evaluate(startDate, stopDate, timeStep, 0, null);

// The data obtained from the MotionEvaluator is in meters.  Convert to desired units, kilometers in this case.
DateMotionCollection<Cartesian> rawEphemerisDataKm = new DateMotionCollection<Cartesian>();
double toKilometers = 1.0 / 1000.0;
for (int i = 0; i < rawEphemerisData.Count; i++)
{
    rawEphemerisDataKm.Add(rawEphemerisData.Dates[i], rawEphemerisData.Motions[i].Value * toKilometers);
}

// Once the raw data has been obtained from the MotionEvaluator and converted as necessary, place it into an StkEphemerisFile
// and specify the appropriate coordinate system.
StkEphemerisFile.EphemerisTimePos ephemerisData = new StkEphemerisFile.EphemerisTimePos
{
    CoordinateSystem = propagator.ReferenceFrame,
    EphemerisData = rawEphemerisDataKm
};
StkEphemerisFile ephemerisFile = new StkEphemerisFile
{
    Data = ephemerisData
};

// Use the "Properties" element of the STKEphemerisFile to specify any additional supported properties
// such as the distance unit of the data.
ephemerisFile.Properties.Add("DistanceUnit", "Kilometers");

// Finally, write the StkEphemerisFile out.
using (StreamWriter ephemerisWriter = new StreamWriter(path, false, Encoding.ASCII))
{
    ephemerisFile.WriteTo(ephemerisWriter);
}
See Also