|
mhuss utils 1.1.5ws | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mhuss.AstroLib.RiseSet
public class RiseSet
Calculates rise & set times of the sun or moon, and also calculates twilight times (civil/nautical/astronomical).
Based on code by Bill Gray (www.projectpluto.com)
[Bill Gray's Comments:]
This class computes the times at which the sun or moon will rise
and set during a given day starting on the given Julian day. It
does this by computing the altitude of the object during each of
the 24 hours of that day (and 1 hour of the next). What we really
want to know is the object's altitude relative to the "rise/set
altitude." This is the altitude at which the top of the object
becomes visible, after correcting for refraction and (in the case
of the Moon) topocentric parallax.
For the sun, this altitude is -.8333 degrees (its apparent radius is about .25 degrees, and refraction 'lifts it up' by .58333 degrees.) For the moon, this altitude is +.125 degrees.
If we find that the object was below this altitude at one hour, and above it on the next hour, then it must have risen in that interval; Conversely, if we find that the object was above this altitude at one hour, and below it on the next hour, then it must have set in that interval.
We then do an iterative search to find the instant during that hour that it rose or set. This starts with a guessed rise/set time in the middle of the particular hour in question. At each step, we look at the altitude of that object at that time, and use it to adjust the rise/set time based on the assumption that the motion was linear during the hour (this isn't a perfect assumption, but we still usually converge in a few iterations.)
As a side benefit, this function will also calculate twilight times by using the sun and just changing the event altitude. The modified altitudes are -6 degrees (civil twilight), -12 degrees (nautical twilight) and -18 degrees (astronomical twilight).
TimePair.a stores the rise (or twilight start) times.
TimePair.b stores the set (or twilight end) times.
Field Summary | |
---|---|
static double |
A_TWI_ALT
Astronomical twilight altitude (when sun is 18 degrees below horizon). |
static int |
ASTRONOMICAL_TWI
Calulation type (pseudo-enum) |
static double |
C_TWI_ALT
Civil twilight altitude (when sun is 6 degrees below horizon). |
static int |
CIVIL_TWI
Calulation type (pseudo-enum) |
static int |
CULMINATING
State enum |
static int |
MOON
Calulation type (pseudo-enum) |
static double |
MOON_ALT
Lunar altitude adjustment |
static double |
N_TWI_ALT
Nautical twilight altitude (when sun is 12 degrees below horizon). |
static int |
NAUTICAL_TWI
Calulation type (pseudo-enum) |
static double |
PLANET_ALT
Stellar altitude adjustment |
static int |
RISING
State enum |
static int |
SETTING
State enum |
static int |
SUN
Calulation type (pseudo-enum) |
static double |
SUN_ALT
Solar altitude adjustment |
static double |
SUN_TOPO_ALT
Solar an lunar topocentric altitude adjustment |
static int |
UNKNOWN
State enum |
Constructor Summary | |
---|---|
RiseSet()
|
Method Summary | |
---|---|
static TimePair |
getTimes(int rsType,
double jd,
ObsInfo oi)
Calculate the rise/set (or start/end) times. |
static TimePair |
getTimes(int rsType,
double jd,
ObsInfo oi,
PlanetData pd)
Calculate the rise/set (or start/end) times. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SUN
public static final int MOON
public static final int CIVIL_TWI
public static final int NAUTICAL_TWI
public static final int ASTRONOMICAL_TWI
public static final double SUN_ALT
public static final double SUN_TOPO_ALT
public static final double MOON_ALT
public static final double PLANET_ALT
public static final double C_TWI_ALT
public static final double N_TWI_ALT
public static final double A_TWI_ALT
public static final int UNKNOWN
public static final int RISING
public static final int SETTING
public static final int CULMINATING
Constructor Detail |
---|
public RiseSet()
Method Detail |
---|
public static TimePair getTimes(int rsType, double jd, ObsInfo oi, PlanetData pd)
rsType
- Rise/Set type (SUN, MOON, CIVIL_TWI, NAUTICAL_TWI, or ASTRONOMICAL_TWI).jd
- The Julian day for which to calculate the desired information (set to 0h local timeoi
- The observer's locationpd
- A PlanetData instance to use for our calculations.
public static TimePair getTimes(int rsType, double jd, ObsInfo oi)
rsType
- Rise/Set type (SUN, MOON, CIVIL_TWI, NAUTICAL_TWI, or ASTRONOMICAL_TWI).jd
- The Julian day for which to calculate the desired informationoi
- The observer's location
|
mhuss utils 1.1.5ws | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |