(Comp.sys.hp48) Item: 574 by fin@unet.umn.edu Author: [Craig A. Finseth] Subj: Analemma program for 48SX, 48S Date: Fri Feb 07 1992 Craig A. Finseth fin@unet.umn.edu 1343 Lafond Craig.Finseth@nic.mr.net St Paul MN 55104-2437 +1 612 644 4027 USA 14 January 1992 What it does: Many globes show a large "figure 8" somewhere over the Pacific Ocean. (Oddly, this figure does not show on photographs taken from space...) This figure is called an "analemma," and it shows the position of the Sun (in degrees of declination and minutes of right ascention (that is, minutes as in "hours and minutes" not "degrees and minutes")) relative to "where it is supposed to be." For example, on May 14, the Sun is about 3 minutes and 41 seconds ahead of nominal and about 20 degrees north of the ecliptic. I said "many globes" because some manufacturers are removing this useful piece of information from their globes. This program makes up for this loss (as well as providing an excuse to write a program). This program uses the graphics capabilities of the 48S/48SX to draw an analemma for the year 2000. The equations used are from: Meeus, Jean (1991) Astronomical Algorithms. Richmond, Virginia: Willmann-Bell. ISBN 0-943396-35-2. In many cases, the definitions for the functions in this program give equation numbers from this text. Note: the shape on an analemma varies over time. Also, an analemma is *not* symmetric about the origin along either axis. ------------------------------------------------------------ Basic Operation: Execute "GO". Wait and watch. When complete, you can enter the graphics environment and use the cursor and COORD to identify the position in decimal minutes of right ascention and degrees of declination. The program operates in four phases: 1) Clear the screen and draw the grid (declination lines of -20, -10, 0, 10, and 20 degrees and a right ascention line of 0 degrees). 2) Draw the analemma curve. Points are calculated every five days and a line is drawn connecting the points. 3) Draw the tick marks. These are drawn the first of every month and 21 Mar, 20 Jun, 21 Sep, and 20 Dec. February is assumed to have 28 days. 4) Draw the labels. The program objects all communicate via global variables. Each program uses those globals that it needs and stores its result in its own global variable. Because of these dependencies, the programs must be executed in the following order: FIGJD FIGT FIG FIGî FIGL0 anytime after FIGT FIGà FIGE FIGë anytime after FIGT While FIGL0 may be computed anytime after FIGT, FIGà and FIGE (indirectly) must be computed after FIGL0. As it turned out, this structure made it very easy to test the modules. A test Julian Day could be stored in JD, then the other program calculated and their results examined. The programs can, of course, be used separately. ------------------------------------------------------------ Accuracy: The program calculates the analemma for the year 2000. While the analemma does vary over time, the variation is not much and the displayed shape wouldn't change for a couple of centuries on each side of the target year. Most of the programs assume this range of time. Higher-order terms are not included in the programs, but could be added with minimal effort. The horizontal axis is "magnified" by a factor of four. If you wish to change this magnification, you will need to edit: PPAR to set new limits FRAME to set horizontal endpoints LBL to position the labels If you don't care about the lines and labels, you can drop the invocations from GO and simply edit PPAR. Then replot. Internal computations are all performed in decimal degrees. Where a computation may result in a number of degrees significantly in excess of 360, the value is taken mod 360 before being stored. ------------------------------------------------------------ Object Summary: GO runs the program BASE computes the basic analemma E global variable: result variable for the equation of time FIGE computes E FIGJD computes the Julian Day FIGL0 computes L0 FIGT computes T FIGà computes à FIG computes î and p FIGë computes ë FIGî computes î FRAME displays the frame JD global variable: current Julian Day L0 global variable: longitude of the Sun LBL displays the month labels PLACE computes the coordinates for a day PPAR global variable: plotting parameters T global variable: current Julian Century TICK places month tick marks à global variable: apparent Solar right ascention î global variable: nutation in obliquity p global variable: nutation in longitude (p should be psi) ë global variable: Solar declination î global variable: obliquity of the ecliptic ------------------------------------------------------------ Detailed Interfaces: GO Stack Input: none Stack Output: none Global Input: none Global Output: none Calls: BASE, FRAME, LBL, TICK Saves the flags, sets degrees mode, clears and displays the PICT, draws the figure, restores the flags. BASE Stack Input: none Stack Output: none Global Input: none Global Output: none Calls: PLACE Plots the basic analemma. FIGE Stack Input: none Stack Output: none Global Input: L0, à, p, î Global Output: E Calls: none Computes the equation of time (equation 27.1). FIGJD Stack Input: day number within year (21 Mar = 0) Stack Output: none Global Input: none Global Output: JD Calls: none Computes the Julian Day FIGL0 Stack Input: none Stack Output: none Global Input: T Global Output: L0 Calls: none Computes the Sun's mean longitude (equation 27.2). FIGT Stack Input: none Stack Output: none Global Input: JD Global Output: T Calls: none Computes the Julian Century (equation 21.1). The origin is 1 Jan 2000. FIGà Stack Input: none Stack Output: none Global Input: L0, T, î Global Output: à Calls: none Computes the *apparent* Solar right ascention (equations 24.3, both unnumbered between 24.4 and 24.5 ("OD" refers to the circle with dot varaible), first two unnumbered between 24.5 and 24.6, 24.6, and 24.8). FIG Stack Input: none Stack Output: none Global Input: T Global Output: î, p Calls: none Computes the nutation in longitude (p, p should be psi) and nutation in obliquity (î) (the accuracy of 0.5 minutes equations on page 132). FIGë Stack Input: none Stack Output: none Global Input: T, î Global Output: ë Calls: none Computes the Solar declination. Uses simple first order approximation. FIGî Stack Input: none Stack Output: none Global Input: T Global Output: î Calls: none Computes the mean obliquity of the ecliptic (equation 21.1). FRAME Stack Input: none Stack Output: none Global Input: none Global Output: none Calls: none Plots the lines of declination (-20, -10, 0, 10, and 20 degrees) and right ascention (0). LBL Stack Input: none Stack Output: none Global Input: none Global Output: none Calls: none Plots the month name labels. PLACE Stack Input: day number within year (21 Mar = 0) Stack Output: complex coordinate of analemma point for that day Global Input: E, ë Global Output: none Calls: FIGE, FIGJD, FIGL0, FIGT, FIGà, FIG FIGë, FIGî computes the coordinates for a day TICK Stack Input: none Stack Output: none Global Input: none Global Output: none Calls: PLACE Plots the tick marks for the first of every month and 21 Mar, 20 Jun, 21 Sep, and 20 Dec. Checksum: #c6deh Size: 2859.5