Table of contents
CSPICE_SCTIKS converts a spacecraft clock format string to
number of "ticks."
Given:
sc the NAIF ID number for the spacecraft whose clock string is
being converted.
help, sc
LONG = Scalar
clkstr a character string representing a spacecraft clock time, WITHOUT
PARTITION NUMBER.
help, clkstr
STRING = Scalar
Using Galileo as an example, the full format is
wwwwwwww:xx:y:z
where z is a mod-8 counter (values 0-7) which
increments approximately once every 8 1/3 ms., y is a
mod-10 counter (values 0-9) which increments once
every time z turns over, i.e., approximately once every
66 2/3 ms., xx is a mod-91 (values 0-90) counter
which increments once every time y turns over, i.e.,
once every 2/3 seconds. wwwwwwww is the Real-Time Image
Count (RIM), which increments once every time xx turns
over, i.e., once every 60 2/3 seconds. The roll-over
expression for the RIM is 16777215, which corresponds
to approximately 32 years.
wwwwwwww, xx, y, and z are referred to interchangeably
as the fields or components of the spacecraft clock.
SCLK components may be separated by any of the
following characters: ' ' '.' ':' ',' '-'
Any number of spaces may separate the components and
the delimiters. The presence of the RIM component
is required. Successive components may be omitted, and
in such cases are assumed to represent zero values.
Values for the individual components may exceed the
maximum expected values. For instance, '0:0:0:9' is
an acceptable Galileo clock string, and will convert
to the same number of ticks as '0:0:1:1'.
Consecutive delimiters containing no intervening digits
are treated as if they delimit zero components.
Trailing zeros should always be included to match the
length of the counter. For example, a Galileo clock
count of '25684.90' should not be represented as
'25684.9'.
Some spacecraft clock components have offset, or
starting, values different from zero. For example,
with an offset value of 1, a mod 20 counter would
cycle from 1 to 20 instead of from 0 to 19.
See the SCLK required reading for a detailed
description of the Voyager and Mars Observer clock
formats.
the call:
cspice_sctiks, sc, clkstr, ticks
returns:
ticks the number of ticks represented by the spacecraft clock string.
help, ticks
DOUBLE = Scalar
A tick is defined to be the smallest time increment expressible
by the spacecraft clock.
An analogy may be drawn between a spacecraft clock
and a standard wall clock, measuring hours, minutes
and seconds. The number of ticks represented by the
wall clock string
hh:mm:ss
would be the number of seconds represented by that
time.
For example:
00:00:10 would convert to 10
00:01:00 would convert to 60
00:10:00 would convert to 600
01:00:00 would convert to 3600
01:01:00 would convert to 3660
See the -Examples section below for examples for
actual spacecraft clocks.
None.
Any numerical results shown for these examples may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
1) Convert a CASSINI spacecraft clock format string to its
corresponding encoded spacecraft clock ("ticks") value.
Note that the provided character string representing the
spacecraft clock MUST NOT HAVE PARTITION NUMBER.
Use the SCLK kernel below to load the CASSINI spacecraft clock
time correlation data required for conversions between different
spacecraft clock representations.
cas00071.tsc
Example code begins here.
PRO sctiks_ex1
;;
;; Load the leapseconds kernel for time conversion.
;;
cspice_furnsh, 'cas00071.tsc'
;;
;; Assign values for the spacecraft ID (CASSINI).
;;
SC = -82
CLKSTR = '1465644281.165'
;;
;; Convert the clock string to ticks for
;; spacecraft 'SC'.
;;
cspice_sctiks, SC, CLKSTR, ticks
print, ' SCLK String Number of Ticks'
print, '-------------- --------------------'
print, FORMAT='(2A,F20.6)', CLKSTR, ' ', ticks
;;
;; It's always good form to unload kernels after use,
;; particularly in IDL due to data persistence.
;;
cspice_kclear
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
SCLK String Number of Ticks
-------------- --------------------
1465644281.165 375204936101.000000
2) Below are some examples illustrating various clock string inputs
and the resulting outputs for the Galileo spacecraft. See the
SCLK required reading for a detailed description of the Galileo
clock format.
CLKSTR TICKS
---------------- --------------------
"0:0:0:1" 1
"0:0:1" 8
"0:1" 80
"1" 7280
"1 0 0 0" 7280
"1,0,0,0" 7280
"1:90" 14480
"1:9" 8000
"1:09" 8000
"0-0-10" 80 |-- Third component is supposed
"0-1-0" 80 | to be a mod-10 count.
"0/1/0" Error: "/" is not an accepted delimiter.
"1: 00 : 0 : 1" 7281
"1:::1" 7281
"1.1.1.1.1" Error: Too many components
"1.1.1.1." Error: The last delimiter signals that
a fifth component will follow.
The following examples are for the Voyager 2 spacecraft. Note
that the last component of the Voyager clock has an offset
value of 1.
CLKSTR TICKS
---------------- --------------------
"0.0.001" 0
"0:0:002" 1
"0:01" 800
"1" 48000
"1.0" 48000
"1.0.0" Error: The 3rd component is never 0.
"0.0:100" 99
"0-60-1" 48000
"1-1-1" 48800
"1-1-2" 48801
Each spacecraft is assigned a clock type code in the kernel file.
cspice_sctiks calls the function SCTYPE to determine this value. If the
clock type is supported by SPICE, then the SPICELIB routine TIKSnn
is called to handle the actual conversion from clock format to
number of ticks. The nn in TIKSnn refers to the spacecraft clock
type code. Different spacecraft have distinct clock formats but
can still be of the same clock type.
The TIKSnn routines are routines to the routines SCLKnn, which
also contain the ticks-to-clock format conversion routines FMTnn.
FMTnn is called by the routine cspice_scfmt, which performs the
inverse operation to cspice_sctiks.
Note the important difference between cspice_scencd and cspice_sctiks.
cspice_scencd converts a clock string to the number of ticks it
represents since the beginning of the mission, and so uses partition
information. cspice_sctiks just converts to absolute ticks.
1) If the spacecraft clock type is not supported, the error
SPICE(NOTSUPPORTED) is signaled by a routine in the call tree
of this routine.
2) If any of the extracted clock components cannot be parsed as
integers, or the string has too many components, or the value
of one of the components is less than the offset value, then,
an error is signaled by a routine in the call tree of this
routine.
3) Invalid spacecraft ID's are not diagnosed.
4) If any of the input arguments, `sc' or `clkstr', is undefined,
an error is signaled by the IDL error handling system.
5) If any of the input arguments, `sc' or `clkstr', is not of the
expected type, or it does not have the expected dimensions and
size, an error is signaled by the Icy interface.
6) If the output argument `ticks' is not a named variable, an
error is signaled by the Icy interface.
None.
None.
ICY.REQ
SCLK.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.1, 01-NOV-2021 (JDR)
Edited the header to comply with NAIF standard. Extended -I/O
section's argument descriptions. Added example's problem statement
and meta-kernel using CASSINI PDS archived data. Added cspice_kclear
to code example.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections, and
completed -Particulars section.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added arguments' type and size information in the -I/O section.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
convert spacecraft_clock string to ticks
|