Jump to content

Banner.jpg.b83b14cd4142fe10848741bb2a14c66b.jpg

Rise and Set Times of Stars using RA and Dec


Recommended Posts

I have been searching (8hrs in total) thousands of websites via google, looked at loads of pages etc but I can not find the info I want. I can find plenty of info on the Rise and Setting of stars but it was all ready generated content via back end code etc. I did find plenty of references to the Rise/Set Moon, Sun and Planets but this is not what I need.

Does any one here know what the equations would be to work out the rise/set times of the Crab Nebula (M1) from just using RA/Dec, Ground position and UTC (or local time) or could point me to a suitable source/url that would show how to calculate.

I am wanting to work out the equation so I can create a "What's up Tonight" viewing list in software.

Example:

Object: M1

RA: 5:35:9

Dec +22:1:24

Ground Position:

Lat 52:09:29N

Long 2:18:45W

UTC(For example) 21:00UTC

Thanks

Link to comment
Share on other sites

I was quite susprised that after searching to Sunrise/Sunset and how to calculate I did find some complex equations then I came across some PHP code and after all that I find that PHP has the routines built-in to it's libraries so it just a quick call giving Lat/Long and Hour offset, of course this only helps as I am doing all the coding for my website however if I want to implement it into another language then I still will need the equations.

As for downloading software, I don't mind as long as I can get the equations out and put into PHP for my website viewing list. So it has to be Open Source with code.

At least with the PHP Sunrise/sunset I can also generate when the best time is for using a telescope buy using Astronomical Twilight and that code is now on my site.

Link to comment
Share on other sites

Could you not just read the php code? Its not compiled into a DLL so take a look around for it. Its open source so should be there somewhere, or one of the geek boards might have it for you.

Edit: Another option is search for a web service to do it, there might be one somewhere

Link to comment
Share on other sites

Do a search for 'positional astronomy' or 'spherical trigonometry' - that should give you the background and equations you need. There are several textbooks on this area, but they are all at least undergraduate physics degree level

Alternatively you might want to look at the 'skycalc' set of programmes written by John Thorstensen. I believe he makes the code available for non-profit use;

Department of Physics and Astronomy - Dartmouth College

His website & tools may already do what you want...

Link to comment
Share on other sites

Do a search for 'positional astronomy' or 'spherical trigonometry' - that should give you the background and equations you need. There are several textbooks on this area, but they are all at least undergraduate physics degree level

Alternatively you might want to look at the 'skycalc' set of programmes written by John Thorstensen. I believe he makes the code available for non-profit use;

Department of Physics and Astronomy - Dartmouth College

His website & tools may already do what you want...

Thanks.

For moonrise/set I have found an old QB file that works for the moon (if you have QB) but it is slow going transferring the code into php as functions are different and of course all the silly goto and gosub routines. but I am getting there and it's fun doing the work the hard way.

Link to comment
Share on other sites

I now written a VB6 App which when running which will output Sunrise/set, Twlilight Times, Moonrise/set, Moon Transit times. I have found some equations for the planets so will be integrating them into my app.

Now sure yet if I would just run then app daily and auto ftp up into the MySQL DB like I currently do with BOINC Stats and and also all my Football Prediction Databases and CSV files or report the VB6 code into PHP and run everthing from there. I just have to understand how to get the RA/Dec of the planets accurate for every run of the Server App

Still not found out about fixed celestrial objects (Stars etc) but I have brought a secondhand copy of "Practical Astronomy With Your Calculator" as it might have the equations in there.

Link to comment
Share on other sites

Have not got the book yet, Amazon Market trader is taking their time..

Anyway, this Celestial Mechanics stuff is difficult.

First off I thought I would get to grips with the correct timing equations in relationship with UTC. So that is Sidereal Time (Local and Greenwich) and Julian Dates (Full, Modified and Greenwich)

Now Julian dates (full, modified and Greenwich UTC0) were easy to work out in the end.

Julian Dates (JD) start at noon on January 1st 4713 BC.

Modified Julian Dates (MJD) is derived from Midnight November 17th 1858 and Greenwich JDUTC0 is the full JD but at the Greenwich Meridan at UTC 0 (Midnight). This always end in .5

The problem is Sidereal Time, I can not find accurate Sidereal time Equations. The many equations I have come across produce a time but they are seconds to minutes out with each other so it's difficult to get the correct one but I am still working on

Link to comment
Share on other sites

  • 2 weeks later...

All timing references to UTC, Juilian Dates(X) Sidereal(X) are all correct now. Phew!!

Now I have got sun rise, sun set, sun transit, Astro Twilight (I call this scope time) all working and accurate, moon rise and moon set are accurate but having troubke with the moon transit time calculations at the moment and stepping through each equation and calculation is quite tedious but still loving it.

Link to comment
Share on other sites

  • 2 weeks later...

OK, got the moon stuff cleared up quickly but the goal was to calculate rise and setting of a Celestial Object using RA and Dec and after several days of playing with equations I have finaly cracked it.

I have most of the code runnig in VB6 for my desktop usage but will continue coding in VB6 for a while adding a few other things I have thought of then I shall port the code over to PHP to run off my website which is my main goal of having an online view list.

Link to comment
Share on other sites

Here is a brief output of my data that I have done so far.

For testing I have used the following time stamp and this I use to check with online sources and also Stellarium

2nd November 2010 21h01m01s

My data is

Full_Julian_Date,2455503.37570602

Full_Julian_Date_UT0,2455502.5

Modified_Julian_Date_Today,55502

Modified_Julian_Date_Tomorrow,55503

SiderealTime_LocalMean,23:40:21

SiderealTime_GreenwichMean_Degrees,357.277378978597

SiderealTime_GreenwichMean,23:49:07

SiderealTime_GreenwichMeanUT0_Degrees,41.1600750023593

SiderealTime_GreenwichMeanUT0_Degrees_RA,0.114328703703704

SiderealTime_GreenwichMeanUT0_Degrees_RA,0.114328703703704

Sunrise Time,07:07:00

Sun Transit,11:52:17

Sunset Time,16:37:00

Scope Time Starts,18:33:00

Scope_time_end,05:12:00

Moonrise Time,02:05:00

Moon Transit Time,08:28:00

Moonset Time,14:34:00

Moon Phase,0.229867713332414

Moon 2 Earth Distance,364651

Celestial Rise Time,23:38:28

Celestial Transit,04:09:46

Celestial Set Time,08:41:04

Celestial NGC 1952 Rise Time,13:33:22

Celestial NGC 1952 Transit,21:46:25

Celestial NGC 1952 Set Time,05:59:29

Celestial NGC 7089 Rise Time,16:50:53

Celestial NGC 7089 Transit,22:50:21

Celestial NGC 7089 Set Time,04:49:50

I am now tidying up the code and also adding in my Astro Database of Messier and Herschel Objects to produce output for these objects.

The idea will be to produce a view list on a daily basis of Messier/Herschel Objects with their rise/transit/set times for my location and timeframe.

For example I want to view the Messier list, what is currently above the horizon (Now) and also at a preset time. For example there is no point trying to find an object if it is still below the horizon. I want this data at the desktop and via my website.

Link to comment
Share on other sites

Ages ago I was planning to start an observing log app, with an online version in Silverlight and a mobile app for Android. But I can't have any free time lately so it's onhold without any date... (Can't complain really, everyone else is going through hard times and I'm getting more work then ever. :))

Anyway here's all I had so far (in c# but can be easily translated). The "toAltAz" method gives you the Alt AZ coordinates of an object as viewed by the observer. Works for any non solar system object. To get the rising time you can probably rework the equations, equal the alt to zero and solve them in order to get time. You may also want to check this link: Computing rise/set times

public class CelestialObject

{

private static double Normalize(double value, double norm)

{

value = (value/norm - Math.Floor(value/norm)) * norm;

return (value < 0) ? norm + value : value;

}

/// <summary>

/// Gets the Julian day

/// Original can be found here:

/// DotNetBlogger | Convert DateTime to Julian Date in C#

/// </summary>

/// <param name="LocalTime">Localtime</param>

/// <returns>Julian Day</returns>

public static double JulianDay(DateTime LocalTime)

{

double jy;

double ja;

double jm;

int y = LocalTime.Year,

m = LocalTime.Month,

d = LocalTime.Day,

h = LocalTime.Hour,

mn = LocalTime.Minute,

s = LocalTime.Second + (LocalTime.Millisecond >= 500 ? 1 : 0);

if (m > 2)

{

jy = y;

jm = m + 1;

}

else

{

jy = y - 1;

jm = m + 13;

}

double intgr = Math.Floor(Math.Floor(365.25 * jy) + Math.Floor(30.6001 * jm) + d + 1720995);

//check for switch to Gregorian calendar

int gregcal = 15 + 31 * (10 + 12 * 1582);

if (d + 31 * (m + 12 * y) >= gregcal)

{

ja = Math.Floor(0.01 * jy);

intgr += 2 - ja + Math.Floor(0.25 * ja);

}

//correct for half-day offset

double dayfrac = h / 24.0 - 0.5;

if (dayfrac < 0.0)

{

dayfrac += 1.0;

--intgr;

}

//now set the fraction of a day

double frac = dayfrac + (mn + s / 60.0) / 60.0 / 24.0;

//round to nearest second

double jd0 = (intgr + frac) * 100000;

double jd = Math.Floor(jd0);

if (jd0 - jd > 0.5) ++jd;

return jd / 100000;

}

// greenwich sideral time

private static double GSideralTime(DateTime LocalTime)

{

return LocalSideralTime(LocalTime, 0.0);

}

private static double LocalSideralTime(DateTime LocalTime, double Longitude)

{

double JD = JulianDay(LocalTime);

double T = (JD - 2451545.0) / 36525;

return Normalize( 280.46061837 + 360.98564736629 * (JD - 2451545.0) + 0.000387933 * T * T - T * T * T / 38710000.0 + Longitude , 360);

}

private static double DegreesToRadians(double value) { return value * Math.PI / 180; }

private static double RadiansToDegrees(double value) { return value * 180 / Math.PI; }

/// <summary>

/// Gets Alt Az coordinates for an object using the observer localtime and position

/// Warning: Generates division by zero on poles

/// </summary>

/// <param name="Latitude">Latidute in degrees</param>

/// <param name="Longitude">Longitude in degrees</param>

/// <param name="Dec">Declination in degrees</param>

/// <param name="RA">Right Ascention in degrees (multiply hours by 15)</param>

/// <param name="LocalTime">Localtime</param>

/// <returns></returns>

public static double[] toAltAz(double Latitude, double Longitude, double Dec, double RA, DateTime LocalTime)

{

// 0 : Alt ; 1 : Az

double [] results = { 0, 0 };

// get current apparent RA for local time/longitude

double apparentRA = Normalize(LocalSideralTime(LocalTime, Longitude) - RA, 360);

// get values in radians so the Trig function can be used

apparentRA = DegreesToRadians(apparentRA);

Dec = DegreesToRadians(Dec);

Latitude = DegreesToRadians(Latitude);

// Alt

results[0] = Math.Asin(Math.Sin(Dec) * Math.Sin(Latitude) + Math.Cos(Dec) * Math.Cos(Latitude) * Math.Cos(apparentRA));

// if alt != 0 then get AZ else AZ = 0 (object exactly at zenith)

results[1] = (results[0] != 0) ?

Math.Acos((Math.Sin(Dec) - Math.Sin(results[0]) * Math.Sin(Latitude)) / (Math.Cos(results[0]) * Math.Cos(Latitude))) :

0;

// translate back to degrees

results[0] = RadiansToDegrees(results[0]);

results[1] = RadiansToDegrees(results[1]);

// change hemisphere

if (Math.Sin(apparentRA) > 0) results[1] = 360 - results[1];

return results;

}

}

Here are the links I used to get this working:

Basics of Positional Astronomy

Spherical astronomy - Google Books

Link to comment
Share on other sites

Thanks for that.

I will look at the AltAz bit as this is the next equation I shall work on to convert RA/Dec to Alt/Az

Just adding a a few more moon details into the code to try and see if there is a way to give apparent viewable magnitude of items depending of phase of moon. ie Can you see a mag 4 star when the moon is full, new or quater. This will then lead into the viewing list to know what to disregard or keep for nights viewing. If you see what I mean.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.