Page 1 of 3

Astrometry: Looking for Pascal/Delphi functions

Posted: 06 Jun 2019, 17:04
by Asterix
Dear all,
Until now I used for the astrometry calculations the Pascal/Delphi programs described by Mountenbruck and Pfleger in ... 3540577017 The claimed accuracy of their functions and procedures of about 1 arcsec was sufficient for my purposes. I would now like improving this accuracy. This likely means replacing/improving the following calculations:
-> Precession matrix for equatorial coordinates from equinox T1 to T2 (PROCEDURE PMATEQU)
-> Nutation equation: Transformation from mean to apparent equatorial coordinates (PROCEDURE NUTEQU)
-> Aberration, velocity vector of earth in equatorial coordinates (PROCEDURE ABERRAT)
-> Functions for calculating positions of Sun, Moon and Planets.
1) Has someone here improved their Pascal/Delphi functions or knows someone else who has done this?
2) An other solution could exist by using in the Pascal code these SOFA functions added as DLLs. Do you know someone who uses such DLLs in his Pascal code who would be prepared to show how it was done?
3) In this context it would also be of interest to use the JPL ephemeries. Again, do you know someone who uses them with a Pascal-code?

Thanks and regards

Re: Astrometry: Looking for Pascal/Delphi functions

Posted: 06 Jun 2019, 17:23
by han.k
Hello Marcel,

I'm not aware of anybody using the code except me in HNSKY.

There are two improvement available:

1) Precession. Patrick Chevalley has coded in Pascal the improved ESO model for this. See HNSKY unit hns_Uprs.pas or source code Carte Du Ciel.
2) I also copied from Patrick his routine for JPL ephemeries. See hns_uDE.pas. This was original written by Denis Boucher

Still the code in "Astronomy with the personal computer is good". They where build using an old JPL ephemerides as reference. The latest JPL ephemeris are more accurate and can cover a large time span.

If you see any other improvement, please inform me & Patrick.


Re: Astrometry: Looking for Pascal/Delphi functions

Posted: 06 Jun 2019, 18:34
by Asterix
Hello Han,
Thank you for this fast reply! I downloaded your source codes and found the indicated pas-files. I will see how I can use them; I will give it a try. The weak part seems to remain their NUTEQU.PAS where they neglected all contributions smaller than 0.1 arcsec.
Again, many thanks, Han.

Re: Astrometry: Looking for Pascal/Delphi functions

Posted: 08 Jun 2019, 09:25
by PatrickChevalley
You can get precise nutation from the JPL ephemeris. Just be sure to use a file that include the nutation, DE430 and DE431 are OK.

Here the code use in CdC to get the nutation parameters for a date: ... .pas#L3705


Re: Astrometry: Looking for Pascal/Delphi functions

Posted: 08 Jun 2019, 14:54
by Asterix
Thank you, Patrick, for your code and the information on the JPL ephemeris. I have so far not used them myself, only in connection with an other program. In order to avoid applying nutation twice my following question: Is with DE430 or DE431 nutation always added or only optional? It looks like there are several parts which I will be able to use from the scripts received from you and from Han. In case of additional questions I might therefore have to come back to you.

In the mean time I came across the package of Pascal/Delphi codes for this book:
Scanning through their files I found that they are very complete and also well documented. May be they are also of interest to you.


Re: Astrometry: Looking for Pascal/Delphi functions

Posted: 08 Jun 2019, 23:46
by PatrickChevalley
The nutation is not automatically applied to the planet coordinates, the result from the jpl function is always J2000.

When you call the jpl computation for "planet" 14 you get the values to make the nutation matrix at the given date instead of a planet coordinates.
Then you rotate with this matrix any coordinates you need to apply the nutation.

I know my code is not easy to reuse because of unit dependency but if you are interested I can give you more detail on the part you need.


Re: Astrometry: Looking for Pascal/Delphi functions

Posted: 11 Jun 2019, 18:29
by Guest
Hello Han,
I intend to get your unit hns_uDE working. I have a question regarding the DE-versions: Can the program be used for any of them, like e.g. DE430 or DE431, or is its use limited to DE405, as mentioned in the script?

Re: Astrometry: Looking for Pascal/Delphi functions

Posted: 12 Jun 2019, 12:44
by han.k
No the format is universal. In the HNSKY settings menu, tab settings you can select lnxp2000p2050.430 or lnxm13000p17000.431. The .405 is an older run but compatible.

The lnxp2000p2050.430 is an unofficial version valid from only 2000 to 2050 and extracted by somebody from the original .430 version covering a larger time span.

What I remember these files contain planet ephemerides at specific time interval calculated by a long running (weeks) JPL computer simulation. The routine uses these ephemerides for a final calculation. So the CPU intensive part is done at JPL.

More info:

Just noted the ae has changed by the nihil 7 meters. Change in hns_uDE.pas
- if in_au then de_eph.auinkm := 149597870.691 else de_eph.auinkm := 1;
+ if in_au then de_eph.auinkm := 149597870.700 else de_eph.auinkm := 1; {ae has been fixed to the value 149597870.700 km as adopted by the International Astronomical Union in 2012}

What kind of program are you intend to create?


Re: Astrometry: Looking for Pascal/Delphi functions

Posted: 14 Jun 2019, 14:36
by Asterix
Hello Han,

Thank you for the additional information. I am not yet ready to install the JPL DE data files. In the mean time I tried to improve my program to extend the functions and numerical formats to better than the about 1 arcsec differences which I achieved with my previous version. Before moving to JPL data, I would like to verify my new results on star observations. My problem is that it appears to be difficult verifying my results obtained as part of a reanalysis of some 1000 documented observations (perforemd outside the Pulkovo observatory). I could not find an on-line calculator which would be suitable for the specific purpose. The observations are given for an object, a location, date, and sideral time; for those I calculate first the correponding UT1 observation time and then the objects true (air-free) altitude. I adjusted my program to run these cases in a batch run realising that the present accuracy would better have to improved somewhat. Below is an example of such an observation. Could you calculate it with your program and what values do you get?

Sorry for deviating from the original subject of the thread, but you asked: "What kind of program are you intend to create?".

Thanks and regards,

Observation (Input):
Reference No: 50
Star HIP: 69673
Loc. Lat. N: 59.77288889
Loc. Lon. E: 30.32402778
Date Yr: 1867
Date Mt: 8
Date Dy: 15
LASTobs Hr: 21
LASTobs Min: 21
LASTobs Sec: 27.9

Results (Output):
UT1 Hr: 21.74781329
ALTtrue Deg: 8.496896579

Re: Astrometry: Looking for Pascal/Delphi functions

Posted: 15 Jun 2019, 13:03
by Asterix
Hello Han and Patrick,
It looks like the version of converting the data from a star catalogue which I use has been simplified. Does one of you have a Pascal version for a correct conversion of RA, Dec, Distance(Px?), proper motion, and radial velocity from catalogue values to the time of interest?
Thanks and regards,

... after searching in your hns-files I found in hns_Usno:

DEC {(epoch T)} := (DECU -90/360000 + pmDE * (epoch2 - 2000.0)/10.0)*((pi/180)/(3600*1000))-pi/2; {DEC first}
RA {(epoch T)} := (RAU + pmRA / cos(dec)*(epoch2 - 2000.0)/10.0)*((pi/180)/(3600*1000));

I try interpreting the content, please correct me:

DECU -90/360000 ... is the Dec value in degrees from the catalogue corrected with a constant value of -900 mas ??? Is this constant value specific to the USNO catalogue?

RAU is the RA value in degrees from the catalogue

pmDE and pmRA ... proper motion in mas/10yr ???

DEC first ... because DEC calculated from DECU is required for calculating RA.

DEC and RA are in radians.

Is distance and radial velocity not used?