MAKECK4 User's Guide =========================================================================== By Yuri Zaiko, April 9, 1998 Introduction -------------------------------------------------------- MAKECK4 is a CK Type 4 creation utility program which uses approximation of spacecraft or space platform pointing data using Chebyshev polynomial coefficients. MAKECK4 gets as input discrete measurements of function in time to approximate it using Chebyshev polynomials. MAKECK4 output data is prepared to be used for creation of SPICE CK Type 4 files. The first MAKECK4 version doesn't write data directly to CK Type 4 file. It creates intermediate text file which can be considered visually to decide if approximation is satisfactory or it is necessary to change parameters of approximation (smooth input data alter accuracies of approximation...). If input data is well approximated and compression factor is fine then output file can be loaded to CK type 4 binary file. Usage -------------------------------------------------------- MAKECK4 requires a properly formatted command text kernel file to describe input and output data and parameters of its operation. The program can take the name of this file from the command line: prompt> makeck4 [setup file name] If the name wasn't specified on the command line, the program prompt for it: prompt> makeck4 Input name of SETUP FILE> ... The program will create two output file -- a Type 4 CK file and an ancillary text file containing complete ``dump'' of the Chebyshev polynomial coefficients Setup File Format -------------------------------------------------------- MAKECK4 input parameters are to be determined in a setup file. This file should be in a format of the SPICE text kernel file and contain the following parameter definitions: INPUT_DATA_TYPE Input pointing data type ('TYPE 3 CK', 'QUATERNIONS', 'EULER ANGLES'). INPUT_FILE Pointing data file name Three integer parameters below have to be declared only for non-CK3 source data type. ANG_VELOCITY_DATA The angular rates flag. 'PRESENT' -- source text file contains angular velocities as well; 'NOT PRESENT' -- source text file does not contain angular velocities) INSTRUMENT_ID The integer NAIF code of the instrument whose pointing is being described in source text file REF_FRAME The NAIF ID code of a reference frame for source text file data. At the moment program can handle orientation given relative to an inertial (SPICE Frame Type 1) or body-fixed (SPICE Frame Type 2) frames. Next parameter is to be declared only for Euler angles source file. EULER_ROTATIONS_ORDER 3 codes of rotation sequence APPROXIMATION_TYPE Type of formula for accuracy of approximation calculation ('MEAN SQUARE ROOT' or 'MAXIMUM DEVIATION MODULE') See APPENDIX 1 for explanation of the approximation criteria. ATT_APPROXIMATION_ACCURACY accuracy for angles or quaternion components approximation. AV_APPROXIMATION_ACCURACY accuracy for angular velocities approximation SCLK_FILE Name of Spacecraft clock file This file is a SPICE spacecraft clock (SCLK) kernel containing information required for Spacecraft on-board clock to ET conversion. LEAPSECONDS_FILE Name of the LEAPSECONDS KERNEL FILE OUTPUT_FILE Output file name TIME_INTERVALS_FILE Name of the ancillary file which contains limits of intervals of continuous measurements. SEGMENT_ID Text string which is to be shipped to Segment Identifier in output CK4 file data segment. Setup File Example To transform (and compress) MGS pointing data from CK type 3 to CK Type 4 the following command file can be used: \begindata INPUT_FILE = 'quattim1.res' TIME_INTERVALS_FILE = 'mgssc272.int' LEAPSECONDS_FILE = 'NAIF0006.TLS' SCLK_FILE = 'MGS_SCLK.TSC' OUTPUT_FILE = 'makeck4.cft' INPUT_DATA_TYPE = 'QUATERNIONS' ANG_VELOCITY_DATA = 'PRESENT' EULER_ROTATIONS_ORDER = ('Y','Z','X') APPROXIMATION_TYPE = 'MEAN SQUARE ROOT' ATT_APPROXIMATION_ACCURACY = 1.D-3 AV_APPROXIMATION_ACCURACY = 1.D-5 INSTRUMENT_ID = -94000 REF_FRAME = 1 SEGMENT_ID = 'CHEBY POLYNOMIALS FOR MGS ATTITUDE' \begintext Input Orientation Data File Format(s) -------------------------------------------------------- Inputs are arrays of pointing data of one of these types: 1. Type 3 CK 2. Euler angles 3. Quaternions Each input type can be provided by arrays of angular velocities. CK Type 3 data format is explained in CK Required Reading. Note that since the program produces a single-segment output CK file, if an input Type 3 CK file contains multiple segment, all these segments should contain orientation of the same object relative to the same reference frame which can be only an inertial (SPICE Frame Type 1) or body-fixed (SPICE Frame Type 2) frame. Euler angles arrays have to be written in flat text file with a line format as follows: t(i) euler1(i) euler2(i) euler3(i) ( av1(i) av2(i) av3(i) ) Quaternions arrays have to be written in flat text file with a line format as follows: t(i) q0(i) q1(i) q2(i) q3(i) ( av1(i) av2(i) av3(i) ) Value on the line of the input file should be delimited by spaces. Time tags (t(i)) can be express as encoded SCLK time (D.P. SCLK times). Input Orientation File Example(1) This is an example of an input orientation file contaning quaternions: ... Input Orientation File Example(2) This is an example of an input orientation file containing euler angles: ... Input Approximation Intervals File Format -------------------------------------------------------- In order to approximate a function it is necessary to find intervals covered by continuous measurements. That is because we can get a set of measurements in time which cover more then one continuous interval. If from other data sources it is known that points in file belong to different intervals of continuous measurements then the limits of those intervals have to be used to build better approximation of measured function. These limits describe intervals of function contingency; the limits of approximation intervals are to be placed into ancillary file which is to be red and used by approximation algorithm during file of measurements processing. Ancillary file describing intervals of approximation have to be a flat text file with a line format as follows: Time_of_int(1)_start Time_of_int(1)_end Time_of_int(2)_start Time_of_int(2)_end Time limits in ancillary text file have to be UTC times (it is the most frequent form of time presentation used in that kind of ancillary files). UTC times in the should not have embedded spaces because two columns in the file should be delimited by space. If there is no ancillary file which describes intervals of continuous measurements the whole file or data segment (respectively a type of source data) is considered by MAKECK4 as continuous interval of measurements of function to be approximated. (The only alternative to that problem is to develop algorithm for automatic calculation of intervals of continuous function behavior. The algorithm can be based only on analysis of measurements. For instance it is possible to declare [dark] gap between two adjacent measurements if gap's length exceeds predetermined constant DT or it is bigger then predetermined constant K multiplied by average time difference for measurements in segment. These [dark] intervals won't be covered by approximation coefficients. But it is too difficult for CK Type 4 "creator" to determine DT or K. This version of MAKECK4 considers the whole segment or text file as interval of continuous measurements if ancillary file for interval limits is not defined.) Input Approximation Intervals File Example This is an example of an input approximation intervals file: ... Output CK File -------------------------------------------------------- The program's primary output is a single-segment Type 4 CK file containing a Chebyshev polynomials which were constructed fort he input data. See CK Required Reading for description of the CK Type 4 Segment format. Output Polynomial Coefficients ``Dump'' File Format -------------------------------------------------------- Additionally to a Type 4 CK file, the program creates a text file with data packets which contain approximation coefficients sets, other parameters of approximation and start times for intervals of approximation that were placed into reference directory of CK-file Type 4 segment. The format of this file is: ---------------------- ³ Standard header ³ L---------------------- ------------------------------- ³ Data packet for approximation ³ ³ subinterval 1 ³ L------------------------------- ------------------------------- ³ Data packet for approximation ³ ³ subinterval 2 ³ L------------------------------- ------------------------------- ³ Data packet for approximation ³ ³ subinterval 3 ³ L------------------------------- ................................ ------------------------------- ³ Data packet for approximation ³ ³ subinterval N ³ L------------------------------- ------------------------------- ³ Start time for subinterval 1 ³ L------------------------------- ------------------------------- ³ Start time for subinterval 2 ³ L------------------------------- ------------------------------- ³ Start time for subinterval 3 ³ L------------------------------- ................................ ------------------------------- ³ Start time for subinterval N ³ L------------------------------- Standard header includes: NUMINT data packets number ICD (4) angular rates flag ICD (1) The integer NAIF code of the instrument whose pointing is being described in output text file ICD (2) The NAIF ID code of the inertial reference frame for the output text file data. BEGTIM Start time for the first subinterval covered by approximation coefficients ENDTIM End time for the last subinterval covered by approximation coefficients Data packet structure MIDINTERV mid of subinterval of approximation RADINTERV radii of subinterval of approximation (Start_time = MIDINTERV - RADINTERV, End_time = MIDINTERV + RADINTERV) I1:I7 numbers of Cheby polynomials coefficients for quaternion components (Q0,Q1, Q2,Q3) and angular velocities components AV1,AV2,AV3. RECCOEF double precision array of Cheby polynomials coefficients. Length of array is equal to I1+I2+I3+I4+I5+I6+I7. Output text array of coefficients consist of text strings - one coefficient per string Limits of approximation subintervals are placed after polynomials coefficients - two double precision numbers per string. Output Polynomial Coefficients ``Dump'' File Example This is an example of an output polynomial coefficients ``dump'' file: ... APPENDIX 1: Approximation Types -------------------------------------------------------- There are two reasonable criteria: mean square root deviation and maximum module of deviation for all nodes. For mean square root criterion -- \ error = ( / (Fi - Gi)**2 )/N, -- i=1,2,...,N where Fi - given function value in the i-node, Gi - approach to the Fi, N - number of nodes in the subinterval. In case of maximum module of deviation criteria: error = MAX [Fi - Gi]. i=1,2,...,N