ASPCS
 
Back to Volume
Paper: A software state machine for computing astronomical coordinates
Volume: 61, Astronomical Data Analysis Software and Systems III
Page: 477
Authors: Percival, J. W.
Abstract: We consider the common problem of computing apparent and topocentric places of stars for the purpose of pointing a telescope. Detailed algorithmic descriptions exist (see, for example, Kaplan et al. AJ 1989, 97, 1197). In addition, several software packages such as NOVAS (Kaplan, 1990) and Starlink's SLALIB by Patrick Wallace considerably ease the burden in building specific application programs. A few problems remain, however. Portability can be a problem, in that some real-time platforms have grudging or non-existent support for Fortran, which is the language of implementation for NOVAS and SLALIB. Also, efficiency can be a problem if the subroutines try to do too much, not allowing the programmer to fragment the calculation as needed. SLALIB offers many convenient entry points, which avoids this problem, but the programmer is still left to weave the subroutines together to achieve a desired result. We have designed a portable software state machine, written in C, for use in the WIYN Telescope Control System. The state machine is in the form of a graph, with the nodes representing coordinate states (heliocentric FK4, topocentric apparent, or galactic, for example) and the edges representing the calculations required to move between states. The programmer provides a starting state and coordinate state vector, and a desired ending state. Using the current state and desired end state, the machine marches through the graph, performing the transitions in the proper order. This approach has several advantages. First, not only are the calculations well-defined, as they are in existing subroutine libraries, but their order of execution is embedded in the machine, rather than merely specified in documentation, removing a source of programming error. Second, each transition can be implemented exactly once, in exactly one place, while the state machine dynamically changes the order of events according to the state transition table. Third, transitions can be implemented in both directions, allowing both production and reduction of coordinates. The state transition table is a two-dimensional matrix of entries, indexed by the current and destination state. Each entry specifies two data: the next transition to execute, and the state that will result. In this way, for example, precession can be specified at many points in the table, each one with a different beginning and ending state. We will present the state diagram and transition table, and give examples of computational flows between a number of coordinate states.
Back to Volume