10.01.2015 Views

Programming interface to the Swiss Ephemeris - programmiastral.com

Programming interface to the Swiss Ephemeris - programmiastral.com

Programming interface to the Swiss Ephemeris - programmiastral.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Swiss</strong> <strong>Ephemeris</strong> 24<br />

If you first <strong>com</strong>pute tjd on <strong>the</strong> basis of <strong>the</strong> registered Local Apparent Time, you convert it <strong>to</strong> Local Mean<br />

Time with:<br />

tjd_mean = tjd_app + e;<br />

8. Time functions<br />

/* delta t from Julian day number */<br />

double swe_deltat(double tjd);<br />

/* get tidal acceleration used in swe_deltat() */<br />

double swe_get_tid_acc(void);<br />

/* set tidal acceleration <strong>to</strong> be used in swe_deltat() */<br />

void swe_set_tid_acc(double t_acc);<br />

The Julian day number, you <strong>com</strong>pute from a birth date, will be Universal Time (UT, former GMT) and can<br />

be used <strong>to</strong> <strong>com</strong>pute <strong>the</strong> star time and <strong>the</strong> houses. However, for <strong>the</strong> planets and <strong>the</strong> o<strong>the</strong>r fac<strong>to</strong>rs, you have <strong>to</strong><br />

convert UT <strong>to</strong> <strong>Ephemeris</strong> time (ET):<br />

8.1 swe_deltat()<br />

tjde = tjd + swe_deltat(tjd); where tjd = Julian day in UT, tjde = in ET<br />

For precision fanatics: The value of delta t depends on <strong>the</strong> tidal acceleration in <strong>the</strong> motion of <strong>the</strong> moon. Its<br />

default value corresponds <strong>to</strong> <strong>the</strong> state-of-<strong>the</strong>-art JPL ephemeris (e.g. DE406, s. swephexp.h). If you use<br />

ano<strong>the</strong>r JPL ephemeris, e.g. DE200, you may wish <strong>the</strong> tidal constant of DE200. This makes a difference of 0.5<br />

time seconds in 1900 and 4 seconds in 1800 (= 0.2” in <strong>the</strong> position of <strong>the</strong> sun). However, this effect is limited <strong>to</strong><br />

<strong>the</strong> period 1620 - ~1997. To change <strong>the</strong> tidal acceleration, use <strong>the</strong> function<br />

8.2 swe_set_tid_acc(), swe_get_tid_acc()<br />

swe_set_tid_acc(acceleration); // Do this before calling deltat() !<br />

The values that acceleration can have are listed in swephexp.h. (e.g. SE_TIDAL_200, etc.)<br />

To find out <strong>the</strong> built-in value of <strong>the</strong> tidal acceleration, you can call<br />

acceleration = swe_get_tidacc();<br />

9. The function swe_set_<strong>to</strong>po() for <strong>to</strong>pocentric planet positions<br />

void swe_set_<strong>to</strong>po(double geolon, double geolat, double altitude);<br />

/* eastern longitude is positive, western longitude is negative,<br />

nor<strong>the</strong>rn latitude is positive, sou<strong>the</strong>rn latitude is negative */<br />

This function must be called before <strong>to</strong>pocentric planet positions for a certain birth place can be <strong>com</strong>puted. It tells<br />

<strong>Swiss</strong> <strong>Ephemeris</strong>, what geographic position is <strong>to</strong> be used. Geographic longitude geolon and latitude geolat must<br />

be in degrees, <strong>the</strong> altitude above sea must be in meters. Neglecting <strong>the</strong> altitude can result in an error of<br />

about 2 arc seconds with <strong>the</strong> moon and at an altitude 3000 m. After calling swe_set_<strong>to</strong>po(), add<br />

SEFLG_TOPOCTR <strong>to</strong> iflag and call swe_calc() as with an ordinary <strong>com</strong>putation. E.g.:<br />

swe_set_<strong>to</strong>po(geo_lon, geo_lat, altitude_above_sea);<br />

iflag | = SEFLG_TOPOCTR;<br />

for (i = 0; i < NPLANETS; i++) {<br />

iflgret = swe_calc( tjd, ipl, iflag, xp, serr );<br />

printf(”%f\n”, xp[0]);<br />

}<br />

The parameters set by swe_set_<strong>to</strong>po() survive swe_close().

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!