[Spice_discussion] Solving for constraints on L_s

Nat Bachman nathaniel.bachman at jpl.nasa.gov
Fri Mar 30 21:09:00 PDT 2012


Hi Michael,

About your question

 >
Dear all,

does SPICE have an inverse to lspcn_c that would calculate the epoch-time for a 
given solar longitude, maybe constrained to a given calendar year to avoid the 
ambiguity?

Best regards and have a nice weekend!

Michael
 >

Yes, SPICE does have code that solves this problem, but one cannot
just push a button to get the result. Since a fair amount of set-up work
is involved, I've written an example program which can be extended or
re-written for your application. The program and associated kernels,
as well as program output, are attached.

The basic solution approach is as follows:

    1) Recognize that L_s is longitude of one object relative
       to another in some reference frame.

    2) Create a frame kernel that specifies the needed reference
       frame, as well as any required, supporting frames.

    3) Use the SPICE Geometry Finder (GF) subsystem to search for
       times when L_s satisfies the constraint of interest.

If you're not already familiar with the SPICE GF subsystem, you
can find the tutorial online here:

ftp://naif.jpl.nasa.gov/pub/naif/toolkit_docs/Tutorials/pdf/individual_docs/30_geometry_finder.pdf

The dynamic frames tutorial may also be helpful:

ftp://naif.jpl.nasa.gov/pub/naif/toolkit_docs/Tutorials/pdf/individual_docs/24_dynamic_frames.pdf

Both tutorials are rather large; just skimming them on
the first pass may be useful to get a sense of what
capabilities are provided.

Both of these subsystems are discussed in Required Reading files as well:

    frames.req
    gf.req

These documents are contained in the documentation provided with the SPICE
Toolkit and are available on the NAIF website as well.

The example program uses the earth as the central body. The program and
kernels can easily be modified to work for a different central body.

The example program uses the constraint

    L_s == 90 degrees

Constraints involving inequalities or local and global
extrema are also supported by the GF subsystem; see the
tutorial.

The program searches over a time interval long enough to contain
multiple solutions.

The custom frame kernel

    lspcn.tf

specifies two dynamic reference frames that are needed
for this application. The meta-kernel

    lspcn.tm

loads the frame kernel and other kernels required by
the program. All kernels other than the attached ones
are available from the NAIF server.

As you can see, the GF subsystem is rather complex, but
it does provide a rather robust capability. In particular,
the use of SPICE windows enables set operations on
solution sets: unions, intersections, complements, etc.,
as well as enabling applications to use the result of
one search as an input to another.

SPICE windows are implemented rather differently in the
different language versions of SPICE. The quickest
way to start using them for GF search applications is probably
to start with the example programs in the headers of the GF
search routines themselves.

Finally, what if you want to perform a search using a custom
geometric quantity that GF doesn't know about? The Fortran
and C versions of the SPICE Toolkit contain the routine

    GFUDS {GF, user-defined scalar}

that performs searches using user-defined scalar quantities.
The user must write certain callback routines in order to use this
routine.

Another GF user-defined search routine that deals with binary
state quantities---such as occultation or visibility within
an instrument FOV---is being developed and will be provided in
the next version of the SPICE Toolkit.

Please let us know if you have further questions about SPICE.

Best regards,

   -Nat

Nathaniel.Bachman at jpl.nasa.gov






























-------------- next part --------------
A non-text attachment was scrubbed...
Name: ls_ex1.for
Type: text/x-fortran
Size: 5294 bytes
Desc: not available
Url : http://naif.jpl.nasa.gov/pipermail/spice_discussion/attachments/20120330/2646c521/ls_ex1.bin
-------------- next part --------------
  
  
 Number of result intervals found:            2
  
 Result window
  
     1   2012 JUN 20 23:02:07.083569 TDB    2012 JUN 20 23:02:07.083569 TDB    
         LS (deg) =    90.000000000000256     
  
     2   2013 JUN 21 05:09:00.484632 TDB    2013 JUN 21 05:09:00.484632 TDB    
         LS (deg) =    90.000000000000426     
  
  
-------------- next part --------------
KPL/FK

   File:                         lspcn.tf
   Author:                       Nat Bachman (JPL/NAIF)
   Date:                         30-MAR-2012


   Example meta-kernel created by Nat Bachman for
   Michael Aye.

   This kernel can be used together with the SPICE GF
   (geometry finder) subsystem to determine times when
   solar longitude L_s with respect to the earth 
   satisfies given constraints.

   The kernels shown here, other than the frame
   kernel, are available from the NAIF server.

      Kernels loaded by this meta-kernel:

         naif0010.tls           Leapseconds

         pck00010.tpc           Generic PCK
                                (provides earth orientation)
         de421.bsp              JPL planetary ephemeris    

         lspcn.tf               Frame kernel specifying the
                                reference frame in which   
                                L_s is measured           
\begindata

   KERNELS_TO_LOAD = (  'naif0010.tls'
                        'pck00010.tpc'
                        'de421.bsp'
                        'lspcn.tf'    )


\begintext


 [End of kernel]
-------------- next part --------------
KPL/FK

   File:                         lspcn.tf
   Author:                       Nat Bachman (JPL/NAIF)
   Date:                         30-MAR-2012


   Example dynamic frame kernel created by Nat Bachman for
   Michael Aye.

   This kernel can be used together with the SPICE GF
   (geometry finder) subsystem to determine times when
   solar longitude L_s with respect to the earth 
   satisfies given constraints.

   This kernel can be edited to define new reference frames
   for computing L_s with respect to bodies other than the
   earth. 


   Frame Specifications
   ====================
   
   GSE: Geocentric Solar Ecliptic

   This is a reference frame based on the instantaneous orbital
   angular velocity vector of the earth. Note that it's also
   possible to define this frame using the mean ecliptic of
   date as the X-Y plane.

      The +X axis points from the earth to the sun.

      The +Z axis is aligned with the cross product
      of the +X axis and velocity of the sun with respect 
      to the earth.

      The +Y axis is the cross product +Z x +X, completing
      the right-handed frame.

\begindata

      FRAME_GSE                    =  1400000
      FRAME_1400000_NAME           = 'GSE'
      FRAME_1400000_CLASS          =  5
      FRAME_1400000_CLASS_ID       =  1400000
      FRAME_1400000_CENTER         =  399
      FRAME_1400000_RELATIVE       = 'J2000'
      FRAME_1400000_DEF_STYLE      = 'PARAMETERIZED'
      FRAME_1400000_FAMILY         = 'TWO-VECTOR'
      FRAME_1400000_PRI_AXIS       = 'X'
      FRAME_1400000_PRI_VECTOR_DEF = 'OBSERVER_TARGET_POSITION'
      FRAME_1400000_PRI_OBSERVER   = 'EARTH'
      FRAME_1400000_PRI_TARGET     = 'SUN'
      FRAME_1400000_PRI_ABCORR     = 'NONE'
      FRAME_1400000_SEC_AXIS       = 'Y'
      FRAME_1400000_SEC_VECTOR_DEF = 'OBSERVER_TARGET_VELOCITY'
      FRAME_1400000_SEC_OBSERVER   = 'EARTH'
      FRAME_1400000_SEC_TARGET     = 'SUN'
      FRAME_1400000_SEC_ABCORR     = 'NONE'
      FRAME_1400000_SEC_FRAME      = 'J2000'
 
\begintext

      The EARTH_LSPCN reference frame is the one in which solar
      planetocentric longitude L_s is actually measured.
      This frame is defined as specified in the header of
      the SPICELIB routine EARTH_LSPCN:
 
	 This is the longitude of the body-sun vector in a 
         right-handed frame whose basis vectors are defined
          as follows:

	    - The positive Z direction is given by the instantaneous
	      angular velocity vector of the orbit of the body about
	      the sun.

	    - The positive X direction is that of the cross product
              of the instantaneous north spin axis of the body 
              with the positive Z direction.

	    - The positive Y direction is Z x X.

         We can re-cast the specification of the X and Y axes
         in a form usable by the dynamic frames subsystem:

            - The positive Z direction is as above.
           
	    - The positive Y direction is aligned with the
              component orthogonal to +Z of the north spin 
              axis.

            - The positive X direction is Y x Z.
            

      For simplicity, the earth rotational elements determining
      the north pole are taken from the IAU rotation model.
      Changing the reference frame for the pole from IAU_EARTH
      to ITRF93 will yield a more accurate instantaneous pole
      direction, if desired. The application using this kernel
      will need to load a binary earth PCK file in order to use 
      the ITRF93 frame.
 
\begindata

      FRAME_EARTH_LSPCN            =  1400001
      FRAME_1400001_NAME           = 'EARTH_LSPCN'
      FRAME_1400001_CLASS          =  5
      FRAME_1400001_CLASS_ID       =  1400001
      FRAME_1400001_CENTER         =  399
      FRAME_1400001_RELATIVE       = 'J2000'
      FRAME_1400001_DEF_STYLE      = 'PARAMETERIZED'
      FRAME_1400001_FAMILY         = 'TWO-VECTOR'
      FRAME_1400001_PRI_AXIS       = 'Z'
      FRAME_1400001_PRI_VECTOR_DEF = 'CONSTANT'
      FRAME_1400001_PRI_FRAME      = 'GSE'
      FRAME_1400001_PRI_SPEC       = 'RECTANGULAR'
      FRAME_1400001_PRI_VECTOR     = ( 0, 0, 1 )
      FRAME_1400001_PRI_ABCORR     = 'NONE'
      FRAME_1400001_SEC_AXIS       = 'Y'
      FRAME_1400001_SEC_VECTOR_DEF = 'CONSTANT'
      FRAME_1400001_SEC_FRAME      = 'IAU_EARTH'
      FRAME_1400001_SEC_SPEC       = 'RECTANGULAR'
      FRAME_1400001_SEC_VECTOR     = ( 0, 0, 1 )
      FRAME_1400001_SEC_ABCORR     = 'NONE'


\begintext


 [End of kernel]



More information about the Spice_discussion mailing list