30 public (
double sunRAHour,
double sunRAMin,
double sunRASec,
double sunDecDeg,
double sunDecMin,
double sunDecSec)
ApproximatePositionOfSun(
double lctHours,
double lctMinutes,
double lctSeconds,
double localDay,
int localMonth,
int localYear,
bool isDaylightSaving,
int zoneCorrection)
32 int daylightSaving = (isDaylightSaving ==
true) ? 1 : 0;
38 double utDays = utHours / 24;
41 double nDeg = 360 * dDays / 365.242191;
43 double mDeg2 = mDeg1 - 360 * (mDeg1 / 360).Floor();
44 double eCDeg = 360 *
PAMacros.
SunEcc(0, 1, 2010) * mDeg2.ToRadians().Sine() / Math.PI;
46 double lSDeg2 = lSDeg1 - 360 * (lSDeg1 / 360).Floor();
47 double raDeg =
PAMacros.
EcRA(lSDeg2, 0, 0, 0, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear);
49 double decDeg =
PAMacros.
EcDec(lSDeg2, 0, 0, 0, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear);
64 public (
double sunRAHour,
double sunRAMin,
double sunRASec,
double sunDecDeg,
double sunDecMin,
double sunDecSec)
PrecisePositionOfSun(
double lctHours,
double lctMinutes,
double lctSeconds,
double localDay,
int localMonth,
int localYear,
bool isDaylightSaving,
int zoneCorrection)
66 int daylightSaving = (isDaylightSaving ==
true) ? 1 : 0;
71 double sunEclipticLongitudeDeg =
PAMacros.
SunLong(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear);
72 double raDeg =
PAMacros.
EcRA(sunEclipticLongitudeDeg, 0, 0, 0, 0, 0, gDay, gMonth, gYear);
74 double decDeg =
PAMacros.
EcDec(sunEclipticLongitudeDeg, 0, 0, 0, 0, 0, gDay, gMonth, gYear);
95 public (
double sunDistKm,
double sunAngSizeDeg,
double sunAngSizeMin,
double sunAngSizeSec)
SunDistanceAndAngularSize(
double lctHours,
double lctMinutes,
double lctSeconds,
double localDay,
int localMonth,
int localYear,
bool isDaylightSaving,
int zoneCorrection)
97 int daylightSaving = isDaylightSaving ? 1 : 0;
102 double trueAnomalyDeg =
PAMacros.
SunTrueAnomaly(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear);
103 double trueAnomalyRad = trueAnomalyDeg.ToRadians();
105 double f = (1 + eccentricity * trueAnomalyRad.Cosine()) / (1 - eccentricity * eccentricity);
106 double rKm = 149598500 / f;
107 double thetaDeg = f * 0.533128;
129 public (
double localSunriseHour,
double localSunriseMinute,
double localSunsetHour,
double localSunsetMinute,
double azimuthOfSunriseDeg,
double azimuthOfSunsetDeg,
string status)
SunriseAndSunset(
double localDay,
int localMonth,
int localYear,
bool isDaylightSaving,
int zoneCorrection,
double geographicalLongDeg,
double geographicalLatDeg)
131 int daylightSaving = isDaylightSaving ? 1 : 0;
133 double localSunriseHours =
PAMacros.
SunriseLCT(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg);
134 double localSunsetHours =
PAMacros.
SunsetLCT(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg);
136 string sunRiseSetStatus =
PAMacros.
ESunRS(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg);
138 double adjustedSunriseHours = localSunriseHours + 0.008333;
139 double adjustedSunsetHours = localSunsetHours + 0.008333;
141 double azimuthOfSunriseDeg1 =
PAMacros.
SunriseAZ(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg);
142 double azimuthOfSunsetDeg1 =
PAMacros.
SunsetAZ(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg);
150 double azimuthOfSunriseDeg = sunRiseSetStatus.Equals(
"OK") ? Math.Round(azimuthOfSunriseDeg1, 2) : 0;
151 double azimuthOfSunsetDeg = sunRiseSetStatus.Equals(
"OK") ? Math.Round(azimuthOfSunsetDeg1, 2) : 0;
153 string status = sunRiseSetStatus;
176 public (
double amTwilightBeginsHour,
double amTwilightBeginsMin,
double pmTwilightEndsHour,
double pmTwilightEndsMin,
string status)
MorningAndEveningTwilight(
double localDay,
int localMonth,
int localYear,
bool isDaylightSaving,
int zoneCorrection,
double geographicalLongDeg,
double geographicalLatDeg,
PATwilightType twilightType)
178 int daylightSaving = isDaylightSaving ? 1 : 0;
180 double startOfAMTwilightHours =
PAMacros.
TwilightAMLCT(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg, twilightType);
182 double endOfPMTwilightHours =
PAMacros.
TwilightPMLCT(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg, twilightType);
184 string twilightStatus =
PAMacros.
ETwilight(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg, twilightType);
186 double adjustedAMStartTime = startOfAMTwilightHours + 0.008333;
187 double adjustedPMStartTime = endOfPMTwilightHours + 0.008333;
195 string status = twilightStatus;
212 double sunLongitudeDeg =
PAMacros.
SunLong(12, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear);
215 double equationOfTimeHours = equivalentUTHours - 12;
230 public double SolarElongation(
double raHour,
double raMin,
double raSec,
double decDeg,
double decMin,
double decSec,
double gwdateDay,
int gwdateMonth,
int gwdateYear)
232 double sunLongitudeDeg =
PAMacros.
SunLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear);
235 double solarElongationDeg =
PAMacros.
Angle(sunRAHours, 0, 0,
sunDecDeg, 0, 0, raHour, raMin, raSec, decDeg, decMin, decSec,
PAAngleMeasure.Hours);
237 return Math.Round(solarElongationDeg, 2);
Miscellaneous macro functions supporting the other classes.
static double GreenwichSiderealTimeToUniversalTime(double greenwichSiderealHours, double greenwichSiderealMinutes, double greenwichSiderealSeconds, double greenwichDay, int greenwichMonth, int greenwichYear)
Convert Greenwich Sidereal Time to Universal Time.
static string ETwilight(double ld, int lm, int ly, int ds, int zc, double gl, double gp, PATwilightType tt)
static double LocalCivilTimeGreenwichDay(double lctHours, double lctMinutes, double lctSeconds, int daylightSaving, int zoneCorrection, double localDay, int localMonth, int localYear)
Determine Greenwich Day for Local Time.
static double CivilDateToJulianDate(double day, double month, double year)
Convert a Greenwich Date/Civil Date (day,month,year) to Julian Date.
static double SunEcc(double gd, int gm, int gy)
Eccentricity of the Sun-Earth orbit.
static string ESunRS(double ld, int lm, int ly, int ds, int zc, double gl, double gp)
static double SunsetLCT(double ld, int lm, int ly, int ds, int zc, double gl, double gp)
static double SunriseLCT(double ld, int lm, int ly, int ds, int zc, double gl, double gp)
Calculate local civil time of sunrise.
static double SunELong(double gd, int gm, int gy)
Mean ecliptic longitude of the Sun at the epoch.
static double TwilightPMLCT(double ld, int lm, int ly, int ds, int zc, double gl, double gp, PATwilightType tt)
Calculate evening twilight end, in local time.
static double EcDec(double eld, double elm, double els, double bd, double bm, double bs, double gd, int gm, int gy)
Ecliptic - Declination (degrees)
static double TwilightAMLCT(double ld, int lm, int ly, int ds, int zc, double gl, double gp, PATwilightType tt)
Calculate morning twilight start, in local time.
static double DecimalDegreesToDegreeHours(double decimalDegrees)
Convert Decimal Degrees to Degree-Hours.
static double SunTrueAnomaly(double lch, double lcm, double lcs, int ds, int zc, double ld, int lm, int ly)
Calculate Sun's true anomaly, i.e., how much its orbit deviates from a true circle to an ellipse.
static double EcRA(double eld, double elm, double els, double bd, double bm, double bs, double gd, int gm, int gy)
Ecliptic - Right Ascension (degrees)
static int DecimalHoursMinute(double decimalHours)
Return the minutes part of a Decimal Hours.
static double DecimalHoursSecond(double decimalHours)
Return the seconds part of a Decimal Hours.
static double DecimalDegreesSeconds(double decimalDegrees)
Return Seconds part of Decimal Degrees.
static int DecimalHoursHour(double decimalHours)
Return the hour part of a Decimal Hours.
static double SunLong(double lch, double lcm, double lcs, int ds, int zc, double ld, int lm, int ly)
Calculate Sun's ecliptic longitude.
static double LocalCivilTimeToUniversalTime(double lctHours, double lctMinutes, double lctSeconds, int daylightSaving, int zoneCorrection, double localDay, int localMonth, int localYear)
Convert Local Civil Time to Universal Time.
static double SunPeri(double gd, int gm, int gy)
Longitude of the Sun at perigee.
static double SunriseAZ(double ld, int lm, int ly, int ds, int zc, double gl, double gp)
static double DecimalDegreesMinutes(double decimalDegrees)
Return Minutes part of Decimal Degrees.
static int LocalCivilTimeGreenwichMonth(double lctHours, double lctMinutes, double lctSeconds, int daylightSaving, int zoneCorrection, double localDay, int localMonth, int localYear)
Determine Greenwich Month for Local Time.
static double SunsetAZ(double ld, int lm, int ly, int ds, int zc, double gl, double gp)
Calculate azimuth of sunset.
static double DecimalDegreesDegrees(double decimalDegrees)
Return Degrees part of Decimal Degrees.
static double Angle(double xx1, double xm1, double xs1, double dd1, double dm1, double ds1, double xx2, double xm2, double xs2, double dd2, double dm2, double ds2, PAAngleMeasure s)
Calculate the angle between two celestial objects.
static int LocalCivilTimeGreenwichYear(double lctHours, double lctMinutes, double lctSeconds, int daylightSaving, int zoneCorrection, double localDay, int localMonth, int localYear)
Determine Greenwich Year for Local Time.
double double double double double sunDecMin
double double double double double azimuthOfSunriseDeg
double double double double double double sunDecSec PrecisePositionOfSun(double lctHours, double lctMinutes, double lctSeconds, double localDay, int localMonth, int localYear, bool isDaylightSaving, int zoneCorrection)
double double amTwilightBeginsMin
double double double double double double azimuthOfSunsetDeg
double equationOfTimeMin
Calculate the equation of time. (The difference between the real Sun time and the mean Sun time....
double double double double sunAngSizeSec SunDistanceAndAngularSize(double lctHours, double lctMinutes, double lctSeconds, double localDay, int localMonth, int localYear, bool isDaylightSaving, int zoneCorrection)
double amTwilightBeginsHour
Calculate times of morning and evening twilight.
double localSunriseHour
Calculate local sunrise and sunset.
double double sunAngSizeDeg
double double double double localSunsetMinute
double double double double double double sunDecSec ApproximatePositionOfSun(double lctHours, double lctMinutes, double lctSeconds, double localDay, int localMonth, int localYear, bool isDaylightSaving, int zoneCorrection)
double double double pmTwilightEndsHour
double double double double sunDecDeg
double double double double string status MorningAndEveningTwilight(double localDay, int localMonth, int localYear, bool isDaylightSaving, int zoneCorrection, double geographicalLongDeg, double geographicalLatDeg, PATwilightType twilightType)
double double double sunRASec
double sunRAHour
Calculate approximate position of the sun for a local date and time.
double sunDistKm
Calculate distance to the Sun (in km), and angular size.
double double equationOfTimeSec EquationOfTime(double gwdateDay, int gwdateMonth, int gwdateYear)
double double localSunriseMinute
double double double double double double string status SunriseAndSunset(double localDay, int localMonth, int localYear, bool isDaylightSaving, int zoneCorrection, double geographicalLongDeg, double geographicalLatDeg)
double double double sunAngSizeMin
double double double localSunsetHour
double SolarElongation(double raHour, double raMin, double raSec, double decDeg, double decMin, double decSec, double gwdateDay, int gwdateMonth, int gwdateYear)
Calculate solar elongation for a celestial body.
double double double double pmTwilightEndsMin
PAAngleMeasure
Angle measurement units.
PATwilightType
Twilight type.