;+ ; Project : STEREO - SSC ; ; Name : STEREO_HPC_DEMO ; ; Purpose : Demonstration of reading STEREO SPICE CK kernel ; ; Category : STEREO, Orbit ; ; Explanation : This procedure demonstrates the process of deriving the ; attitude of the two STEREO spacecraft in helioprojective ; cartesian coordinates. The sample attitude data is taken from ; Mission Simulation #1, and thus is relatively limited in time. ; Rather than ask the user for a sample input time, this ; demonstration program plots the derived roll, hpln, and hplt ; for the total 5 hour duration of the test. ; ; Syntax : STEREO_HPC_DEMO [, UTC, ROLL, HPLN, HPLT ] ; ; Examples : stereo_hpc_demo ; ; Inputs : None required. ; ; Opt. Inputs : None. ; ; Outputs : The roll, hpln, and hplt values are plotted. ; ; Opt. Outputs: UTC = The date/time values. ; ROLL = The roll values, defined as a counter-clockwise ; rotation about the spacecraft -X axis, in degrees. ; HPLN = The longitude values, in degrees. ; HPLT = The latitude values, in degrees. ; ; Keywords : None. ; ; Calls : ANYTIM2UTC, CONCAT_DIR, CSPICE_FURNSH, CSPICE_SPKEZR, ; CSPICE_UNLOAD ; ; Common : None. ; ; Restrictions: This procedure works in conjunction with the Icy/CSPICE ; package, which is implemented as an IDL Dynamically Loadable ; Module (DLM). The Icy source code can be downloaded from ; ; ftp://naif.jpl.nasa.gov/pub/naif/toolkit/IDL ; ; Because this uses dynamic frames, it requires Icy/CSPICE ; version N0058 or higher. ; ; Side effects: None. ; ; Prev. Hist. : Based on STEREO_STATE_DEMO ; ; History : Version 1, W. Thompson, 30 June 2005 ; ; Contact : WTHOMPSON ;- ; pro stereo_hpc_demo, utc, roll, hpln, hplt ; on_error, 2 ; ; The sample attitude history file is for the ahead spacecraft, which has the ; ID number of -234. In the pointing file, this appears as instrument code ; number -234000. ; sc = -234 inst = sc*1000L ; ; Define the path to the demo files. ; datapath = concat_dir('$SSW', 'stereo', /DIR) datapath = concat_dir(datapath, 'ssc', /DIR) datapath = concat_dir(datapath, 'data', /DIR) datapath = concat_dir(datapath, 'spice_demo', /DIR) ; ; Define the files which need to be loaded. The STEREO Ahead attitude history ; file is taken from Mission Simulation #1. To support reading this file, ; several other files must also be loaded. The file 'naif0007.tls' contains ; leap second information used to support the conversion from UTC to the ; ephemeris time (ET) used by SPICE. The file 'ahead_science_03.sclk' is the ; spacecraft clock file, and is used to convert between the onboard clock time ; used by the attitude history file, and UTC or ET. The planetary orbit ; ephemeris file, 'de405.bsp', is the same file used in generating the STEREO ; ephemeris, and is required to put the STEREO attitude data into the various ; standard coordinate systems. Solar and planetary physical data are stored ; in 'pck00007.tpc', and are used to support the "IAU_EARTH" and "IAU_SUN" ; reference frames. Except for the spacecraft clock file, these supporting ; files were downloaded from ; ; ftp://naif.jpl.nasa.gov/pub/naif/generic_kernels ; ; Finally, the heliospheric.tf file is a dynamics frame definition file for ; many of the standard coordinate systems. Although developed for the STEREO ; project, it is applicable to all heliospheric missions. ; tm_file = concat_dir(datapath, 'naif0007.tls') ;Leapseconds de_file = concat_dir(datapath, 'de405.bsp') ;Planetary orbits pl_file = concat_dir(datapath, 'pck00007.tpc') ;Planetary phys. data fr_file = concat_dir(datapath, 'heliospheric.tf') ;Heliospheric frames rt_file = concat_dir(datapath, 'stereo_rtn.tf') ;STEREO frames sc_file = concat_dir(datapath, 'ahead_science_03.sclk') ;Spacecraft clock bc_file = concat_dir(datapath, 'ahead_2006_070_00.ah.bc') sp_file = concat_dir(datapath, 'ahead_2006_042_p2primary_01.epm.bsp') ; ; Load the files ; cspice_furnsh, tm_file cspice_furnsh, de_file cspice_furnsh, pl_file cspice_furnsh, fr_file cspice_furnsh, rt_file cspice_furnsh, sc_file cspice_furnsh, bc_file cspice_furnsh, sp_file ; ; Step through the time range in units of one minute. ; tai0 = anytim2tai('2006-Mar-11T10:03') tai1 = anytim2tai('2006-Mar-11T15:31') n_minutes = 1 + (tai1 - tai0) / 60.d0 hpln = dblarr(n_minutes) hplt = dblarr(n_minutes) roll = dblarr(n_minutes) utc = strarr(n_minutes) for i=0,n_minutes-1 do begin tai = tai0 + 60.d0*i ; ; Convert the date/time to ephemeris time, and then to spacecraft clock double ; precision time. ; utc[i] = tai2utc(tai,/ccsds) cspice_str2et, utc[i], et cspice_sce2c, sc, et, sclkdp ; ; Get the CK matrix. ; tol = 1000 cspice_ckgp, inst, sclkdp,tol, 'STAHGRTN', cmat, clkout, found if not found then message, /continue, 'Date not found' if clkout ne sclkdp then print,clkout-sclkdp ; ; The Y and Z components of the spacecraft X axis give the pointing. ; lat = asin(cmat[0,1]) hpln[i] = asin(cmat[0,2]/cos(lat)) * 180.d0 / !dpi hplt[i] = lat * 180.d0 / !dpi ; ; The roll angle can be derived from the projection of the spacecraft Y axis ; onto the Y-Z plane. ; roll[i] = atan(cmat[1,2], cmat[1,1]) * 180. / !dpi endfor ; ; Plot the roll, hpln, and hplt values. ; erase setview, 1, 1, 1, 3 utplot, utc, roll, /yno, ytitle='Roll' oplot,!x.crange,[0,0],line=1 setview, 1, 1, 2, 3 utplot, utc, hpln, /yno, ytitle='Longitude' oplot,!x.crange,[0,0],line=1 setview, 1, 1, 3, 3 utplot, utc, hplt, /yno, ytitle='Latitude' oplot,!x.crange,[0,0],line=1 setview ; ; Unload the files ; cspice_unload, sp_file cspice_unload, bc_file cspice_unload, sc_file cspice_unload, fr_file cspice_unload, pl_file cspice_unload, de_file cspice_unload, tm_file ; end