spkw15 |
Table of contents
ProcedureSPKW15 ( SPK, write a type 15 segment ) SUBROUTINE SPKW15 ( HANDLE, BODY, CENTER, FRAME, FIRST, LAST, . SEGID, EPOCH, TP, PA, P, ECC, . J2FLG, PV, GM, J2, RADIUS ) AbstractWrite an SPK segment of type 15 given a type 15 data record. Required_ReadingSPK KeywordsEPHEMERIS DeclarationsIMPLICIT NONE INTEGER HANDLE INTEGER BODY INTEGER CENTER CHARACTER*(*) FRAME DOUBLE PRECISION FIRST DOUBLE PRECISION LAST CHARACTER*(*) SEGID DOUBLE PRECISION EPOCH DOUBLE PRECISION TP ( 3 ) DOUBLE PRECISION PA ( 3 ) DOUBLE PRECISION P DOUBLE PRECISION ECC DOUBLE PRECISION J2FLG DOUBLE PRECISION PV ( 3 ) DOUBLE PRECISION GM DOUBLE PRECISION J2 DOUBLE PRECISION RADIUS Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- HANDLE I Handle of an SPK file open for writing. BODY I Body code for ephemeris object. CENTER I Body code for the center of motion of the body. FRAME I The reference frame of the states. FIRST I First valid time for which states can be computed. LAST I Last valid time for which states can be computed. SEGID I Segment identifier. EPOCH I Epoch of the periapse. TP I Trajectory pole vector. PA I Periapsis vector. P I Semi-latus rectum. ECC I Eccentricity. J2FLG I J2 processing flag. PV I Central body pole vector. GM I Central body GM. J2 I Central body J2. RADIUS I Equatorial radius of central body. Detailed_InputHANDLE is the file handle of an SPK file that has been opened for writing. BODY is the NAIF ID for the body whose states are to be recorded in an SPK file. CENTER is the NAIF ID for the center of motion associated with BODY. FRAME is the reference frame that states are referenced to, for example 'J2000'. FIRST are the bounds on the ephemeris times, expressed as LAST seconds past J2000. SEGID is the segment identifier. An SPK segment identifier may contain up to 40 characters. EPOCH is the epoch of the orbit elements at periapse in ephemeris seconds past J2000. TP is a vector parallel to the angular momentum vector of the orbit at epoch expressed relative to FRAME. A unit vector parallel to TP will be stored in the output segment. PA is a vector parallel to the position vector of the trajectory at periapsis of EPOCH expressed relative to FRAME. A unit vector parallel to PA will be stored in the output segment. P is the semi-latus rectum--- p in the equation: r = p/(1 + ECC*COS(Nu)) ECC is the eccentricity. J2FLG is the J2 processing flag describing what J2 corrections are to be applied when the orbit is propagated. All J2 corrections are applied if the value of J2FLG is not 1, 2 or 3. If the value of the flag is 3 no corrections are done. If the value of the flag is 1 no corrections are computed for the precession of the line of apsides. However, regression of the line of nodes is performed. If the value of the flag is 2 no corrections are done for the regression of the line of nodes. However, precession of the line of apsides is performed. Note that J2 effects are computed only if the orbit is elliptic and does not intersect the central body. PV is a vector parallel to the north pole vector of the central body expressed relative to FRAME. A unit vector parallel to PV will be stored in the output segment. GM is the central body GM. J2 is the central body J2 (dimensionless). RADIUS is the equatorial radius of the central body. Units are radians, km, seconds. Detailed_OutputNone. A type 15 segment is written to the file attached to HANDLE. ParametersNone. Exceptions1) If the eccentricity is less than zero, the error SPICE(BADECCENTRICITY) is signaled. 2) If the semi-latus rectum is 0, the error SPICE(BADLATUSRECTUM) is signaled. 3) If the pole vector, trajectory pole vector or periapsis vector have zero length, the error SPICE(BADVECTOR) is signaled. 4) If the trajectory pole vector and the periapsis vector are not orthogonal, the error SPICE(BADINITSTATE) is signaled. The test for orthogonality is very crude. The routine simply checks that the dot product of the unit vectors parallel to the trajectory pole and periapse vectors is less than 0.00001. This check is intended to catch blunders, not to enforce orthogonality to double precision capacity. 5) If the mass of the central body is non-positive, the error SPICE(NONPOSITIVEMASS) is signaled. 6) If the radius of the central body is negative, the error SPICE(BADRADIUS) is signaled. 7) If the segment identifier has more than 40 non-blank characters, the error SPICE(SEGIDTOOLONG) is signaled. 8) If the segment identifier contains non-printing characters, the error SPICE(NONPRINTABLECHARS) is signaled. 9) If there are inconsistencies in the BODY, CENTER, FRAME or FIRST and LAST times, an error is signaled by a routine in the call tree of this routine. FilesA new type 15 SPK segment is written to the SPK file attached to HANDLE. ParticularsThis routine writes an SPK type 15 data segment to the open SPK file according to the format described in the type 15 section of the SPK Required Reading. The SPK file must have been opened with write access. This routine is provided to provide direct support for the MASL precessing orbit formulation. ExamplesSuppose that at time EPOCH you have the J2000 periapsis state of some object relative to some central body and would like to create a type 15 SPK segment to model the motion of the object using simple regression and precession of the line of nodes and apsides. The following code fragment illustrates how you can prepare such a segment. We shall assume that you have in hand the J2000 direction of the central body's pole vector, its GM, J2 and equatorial radius. In addition we assume that you have opened an SPK file for write access and that it is attached to HANDLE. (If your state is at an epoch other than periapse the fragment below will NOT produce a "correct" type 15 segment for modeling the motion of your object.) C C First we get the osculating elements. C CALL OSCELT ( STATE, EPOCH, GM, ELTS ) C C From these collect the eccentricity and semi-latus rectum. C ECC = ELTS ( 2 ) P = ELTS ( 1 ) * ( 1.0D0 + ECC ) C C Next get the trajectory pole vector and the C periapsis vector. C CALL UCRSS ( STATE(1), STATE(4), TP ) CALL VHAT ( STATE(1), PA ) C C Enable both J2 corrections. C J2FLG = 0.0D0 C C Now add the segment. C CALL SPKW15 ( HANDLE, BODY, CENTER, FRAME, FIRST, LAST, . SEGID, EPOCH, TP, PA, P, ECC, . J2FLG, PV, GM, J2, RADIUS ) RestrictionsNone. Literature_ReferencesNone. Author_and_InstitutionN.J. Bachman (JPL) J. Diaz del Rio (ODC Space) W.L. Taber (JPL) VersionSPICELIB Version 2.1.0, 03-JUN-2021 (JDR) Added IMPLICIT NONE statement. Edited the header to comply with NAIF standard. SPICELIB Version 2.0.0, 29-MAY-2012 (NJB) Input vectors that nominally have unit length are mapped to local copies that actually do have unit length. The applicable inputs are TP, PA, and PV. The Detailed Input header section was updated to reflect the change. Some typos in error messages were corrected. SPICELIB Version 1.0.0, 28-NOV-1994 (WLT) |
Fri Dec 31 18:36:56 2021