public static void CalcMoonTimes(GPLocationProvider e, GPGregorianTime vc, out GPGregorianTime rise, out GPGregorianTime set) { double UT; rise = null; set = null; // inicializacia prvej hodnoty ELEVATION vc.setDayHours(0.0); vc.normalizeValues(); UT = vc.getJulianGreenwichTime(); GPJulianTime start = new GPJulianTime(); GPJulianTime time; start.setLocalJulianDay(vc.getJulianGreenwichTime()); TRiseSet rs; set = null; rise = null; time = GPAstroEngine.GetNextMoonEvent(start, e, out rs); while (time.getLocalJulianDay() < UT + 1) { GPGregorianTime gt = new GPGregorianTime(e, time); if (rs == TRiseSet.RISE && rise == null) { rise = gt; } else if (rs == TRiseSet.SET && set == null) { set = gt; } time = GPAstroEngine.GetNextMoonEvent(time, e, out rs); } }
public static void TestSunCoordinates() { GPObserver obs = new GPObserver(); obs.setLatitudeNorthPositive(defLatitude).setLongitudeEastPositive(defLongitude); GPJulianTime dp = new GPJulianTime(); dp.setLocalJulianDay(2456710.500000); for (int k = 0; k < 26; k++) { //dp = MA.GPMeeusEngine.GetNextMoonEvent(dp, obs, out kind); GPCelestialBodyCoordinates crd = GPAstroEngine.sun_coordinate(dp.getGreenwichJulianEphemerisDay()); //srt = MA.GPMeeusEngine.GetSiderealTime(dp.GetJulianDay(), out deltaphi, out epsilon); //crd = MA.GPMeeusEngine.moon_coordinate(2448724.5); crd.makeTopocentric(obs); GPAstroEngine.calcHorizontal(crd, obs); //Log("time {0} deltaphi {1} epsilon {2} sidereal {3}", dp, deltaphi, epsilon, srt/15); //Log("time {0} altitude {1} azimuth {2}", dp, crd.elevation, crd.azimuth); //Log("time {0} ra {1} dec {2}", dp, crd.right_ascession, crd.declination); //Log("RA={0} DEC={1}", crd.right_ascession, crd.elevation); //Log("AZ={0} EL={1} RA", crd.azimuth, crd.elevation); Log("{0}", crd.elevation); // Log("next event = {0}, {1}, {2}\n", dp, kind, crd.elevation); dp.AddHours(1); } }
/// <summary> /// JULIAN(greenwich) = JULIAN(local) - TIMEZONEHOURS /// JULIAN(local) = JULIAN(greenwich) + TIMEZONEHOURS /// </summary> /// <param name="jdate">Julian Time</param> public void setJulianGreenwichTime(GPJulianTime jdate) { double jd = jdate.getGreenwichJulianDay() + getLocation().getTimeZoneOffsetHours() / 24.0; setJulianLocalTime(jd); // greenwich julian day p_julian = jdate.getGreenwichJulianDay(); }
public static void TestSiderealTime() { GPObserver obs = new GPObserver(); obs.setLatitudeNorthPositive(defLatitude).setLongitudeEastPositive(defLongitude); GPJulianTime dp = new GPJulianTime(); dp.setLocalJulianDay(2456710.500000); for (int k = 0; k < 26; k++) { GPCelestialBodyCoordinates crd = GPAstroEngine.sun_coordinate(dp.getGreenwichJulianEphemerisDay()); Log("{0}", crd.apparent_sidereal_time / 15); dp.AddHours(1); } }
public static void TestMoonEvents() { TRiseSet kind; GPJulianTime dp = new GPJulianTime(); dp.setLocalJulianDay(defJulian); GPLocation obs = new GPLocation(); obs.setLatitudeNorthPositive(defLatitude).setLongitudeEastPositive(defLongitude).SetAltitude(0.2); GPLocationProvider prov = new GPLocationProvider(obs); for (int k = 0; k < 26; k++) { dp = GPAstroEngine.GetNextMoonEvent(dp, prov, out kind); Log("next event = {0}, {1}\n", dp, kind); dp.AddHours(1); } }
public void CalculateEvents(GPLocationProvider loc, GPGregorianTime vcStart, GPGregorianTime vcEnd) { GPCoreEventResults inEvents = this; GPLocationProvider earth = loc; GPGregorianTime vc = new GPGregorianTime(loc); GPSun sun = new GPSun(); //int ndst = 0; int nData; inEvents.clear(); inEvents.m_location = loc; inEvents.m_vcStart = vcStart; inEvents.m_vcEnd = vcEnd; GPGregorianTime vcAdd = new GPGregorianTime(loc); GPGregorianTime vcTemp = null; GPGregorianTime vcNext = new GPGregorianTime(loc); vc.Copy(vcStart); if (GPDisplays.CoreEvents.Sunrise()) { vcAdd.Copy(vc); while (vcAdd.IsBeforeThis(vcEnd)) { sun.SunCalc(vcAdd, earth); vcTemp = new GPGregorianTime(sun.arunodaya); inEvents.AddEvent(vcTemp, GPConstants.CCTYPE_S_ARUN, 0); //GPJulianTime tr, tt, ts; //GPAstroEngine.CalculateTimeSun(vcTemp, vcTemp.getLocation(), out tr, out tt, out ts); vcTemp = new GPGregorianTime(sun.rise); //vcTemp = new GPGregorianTime(vcTemp.getLocation(), tr); inEvents.AddEvent(vcTemp, GPConstants.CCTYPE_S_RISE, 0); vcTemp = new GPGregorianTime(sun.noon); //vcTemp = new GPGregorianTime(vcTemp.getLocation(), tt); inEvents.AddEvent(vcTemp, GPConstants.CCTYPE_S_NOON, 0); vcTemp = new GPGregorianTime(sun.set); //vcTemp = new GPGregorianTime(vcTemp.getLocation(), ts); inEvents.AddEvent(vcTemp, GPConstants.CCTYPE_S_SET, 0); vcAdd.NextDay(); } } if (GPDisplays.CoreEvents.Tithi()) { GPTithi te = new GPTithi(); te.setStartDate(vc); vcAdd = te.getNext(); while (vcAdd.IsBeforeThis(vcEnd)) { nData = te.getCurrentPosition(); //ndst = loc.getTimeZone().GetDaylightChangeType(vcNext); inEvents.AddEvent(vcAdd, GPConstants.CCTYPE_TITHI, nData); vcAdd = te.getNext(); } } if (GPDisplays.CoreEvents.Naksatra()) { GPNaksatra te = new GPNaksatra(); te.setStartDate(vc); vcAdd = te.getNext(); while (vcAdd.IsBeforeThis(vcEnd)) { nData = te.getCurrentNaksatra(); //ndst = loc.getTimeZone().GetDaylightChangeType(vcNext); inEvents.AddEvent(vcAdd, GPConstants.CCTYPE_NAKS, nData); vcAdd = te.getNext(); } } if (GPDisplays.CoreEvents.Sankranti()) { GPSankranti te = new GPSankranti(); te.setStartDate(vc); vcAdd = te.getNext(); while (vcAdd.IsBeforeThis(vcEnd)) { nData = te.getCurrentPosition(); //ndst = loc.getTimeZone().GetDaylightChangeType(vcNext); inEvents.AddEvent(vcAdd, GPConstants.CCTYPE_SANK, nData); vcAdd = te.getNext(); } } if (GPDisplays.CoreEvents.Conjunction()) { double[] times = null; GPConjunction te = new GPConjunction(); te.setStartDate(vc); vcAdd = te.getNext(); while (vcAdd.IsBeforeThis(vcEnd)) { nData = te.getCurrentPosition(); //ndst = loc.getTimeZone().GetDaylightChangeType(vcNext); inEvents.AddEvent(vcAdd, GPConstants.CCTYPE_CONJ, nData); if (GPDisplays.CoreEvents.SunEclipse()) { GPAstroEngine.CalculateTimesSunEclipse(vcAdd.getJulianGreenwichTime(), vcAdd.getLocation(), out times); if (times != null && times[2] > 0) { for (int i = 0; i < 5; i++) { if (times[i] > 0) { GPGregorianTime gt = new GPGregorianTime(vcAdd.getLocation()); gt.setJulianGreenwichTime(new GPJulianTime(times[i], 0.0)); inEvents.AddEvent(gt, GPConstants.SUNECLIPSE_CONSTS[i], 0); } } } } vcAdd = te.getNext(); } } // moon eclipses if (GPDisplays.CoreEvents.MoonEclipse()) { double[] times = null; GPConjunction te = new GPConjunction(); te.setOpositeConjunction(true); te.setStartDate(vc); vcAdd = te.getNext(); while (vcAdd.IsBeforeThis(vcEnd)) { GPAstroEngine.CalculateTimesMoonEclipse(vcAdd.getJulianGreenwichTime(), vcAdd.getLocation(), out times); if (times != null && times[4] > 0) { for (int i = 0; i < 9; i++) { if (times[i] > 0 && GPConstants.MOONECLIPSE_CONSTS[i] > 0) { GPGregorianTime gt = new GPGregorianTime(vcAdd.getLocation()); gt.setJulianGreenwichTime(new GPJulianTime(times[i], 0.0)); inEvents.AddEvent(gt, GPConstants.MOONECLIPSE_CONSTS[i], 0); } } } vcAdd = te.getNext(); } } // rise and set of the moon if (GPDisplays.CoreEvents.Moonrise()) { GPJulianTime julian = vc.getJulian(); GPJulianTime julianEnd = vcEnd.getJulian(); GPJulianTime nextJulian; TRiseSet kind; while (julian.getGreenwichJulianDay() < julianEnd.getGreenwichJulianDay()) { nextJulian = GPAstroEngine.GetNextMoonEvent(julian, vc.getLocationProvider(), out kind); if (kind == TRiseSet.RISE) { inEvents.AddEvent(new GPGregorianTime(loc, nextJulian), GPConstants.CoreEventMoonRise, 0); } else if (kind == TRiseSet.SET) { inEvents.AddEvent(new GPGregorianTime(loc, nextJulian), GPConstants.CoreEventMoonSet, 0); } julian.setGreenwichJulianDay(nextJulian.getGreenwichJulianDay() + 10.0 / 1440.0); } } // travellings { GPJulianTime julian = vc.getJulian(); GPJulianTime julianEnd = vcEnd.getJulian(); double start, end; start = julian.getGreenwichJulianDay(); end = julianEnd.getGreenwichJulianDay(); for (int i = 0; i < loc.getChangeCount(); i++) { GPLocationChange chn = loc.getChangeAtIndex(i); if ((chn.julianStart >= start && chn.julianStart <= end) || (chn.julianStart >= start && chn.julianEnd <= end)) { GPGregorianTime startTime = new GPGregorianTime(chn.LocationA); startTime.setJulianGreenwichTime(new GPJulianTime(chn.julianStart, 0)); GPGregorianTime endTime = new GPGregorianTime(chn.LocationB); endTime.setJulianGreenwichTime(new GPJulianTime(chn.julianEnd, 0)); inEvents.AddEvent(startTime, GPConstants.CCTYPE_TRAVELLING_START, 0); inEvents.AddEvent(endTime, GPConstants.CCTYPE_TRAVELLING_END, 0); } } } // eventual sorting inEvents.Sort(GPDisplays.CoreEvents.Sort()); }
public GPGregorianTime(GPLocationProvider loc, GPJulianTime julianTime) { p_locationProvider = loc; setJulianGreenwichTime(julianTime); }
public GPGregorianTime(GPLocation loc, GPJulianTime julianTime) { setLocation(loc); setJulianGreenwichTime(julianTime); }