public static int calculateNaksatraAtMidnight(GPGregorianTime date, GPLocationProvider earth) { double d; double jdate; GPMoon moon = new GPMoon(); GPSun sun = new GPSun(); jdate = date.getJulianGreenwichNoon() + 0.5; moon.MoonCalc(jdate); d = GPMath.putIn360(moon.longitude_deg - GPAyanamsa.GetAyanamsa(jdate)); return(Convert.ToInt32(Math.Floor((d * 3.0) / 40.0))); }
// return values are in sun.arunodaya, sun.rise, sun.set, sun.noon, sun.length // if values are less than zero, that means, no sunrise, no sunset in that day // // brahma 1 = calculation at brahma muhurta begining // brahma 0 = calculation at sunrise public void SunCalc(GPGregorianTime vct, GPLocationProvider earth) { if (sunPosMethod == SUNPOSMETHOD_CALCULATOR) { GPSun s_rise = new GPSun(); GPSun s_set = new GPSun(); // first calculation // for 12:00 universal time s_rise.calculateRise(vct, earth); // first calculation // for 12:00 universal time s_set.calculateSet(vct, earth); // calculate times longitude_arun_deg = s_rise.eclipticalLongitude - (24.0 / 365.25); eclipticalLongitude = s_rise.eclipticalLongitude; rightAscession = s_rise.rightAscession; longitude_set_deg = s_set.eclipticalLongitude; sunrise_deg = s_rise.sunrise_deg; sunset_deg = s_set.sunset_deg; } else { calculateRiseSet(vct, earth, 180); double gmt = vct.getJulianGreenwichNoon(); longitude_arun_deg = GPAstroEngine.sunLongitudeMethodM(julianDayRise - 96 / 1440.0); eclipticalLongitude = GPAstroEngine.sunLongitudeMethodM(julianDayRise); longitude_set_deg = GPAstroEngine.sunLongitudeMethodM(julianDaySet); } updateSunriseTimes(vct, earth); updateNoonTimes(vct, earth); updateSetTimes(vct, earth); List <GPLocationChange> chr = earth.getChangesForJulianDay(arunodaya.getJulianGreenwichNoon()); processTravellingChanges(chr); // finally calculate length of the daylight DayLength = (set.getJulianGreenwichTime() - rise.getJulianGreenwichTime()) * 24.0; }
// VCTIME vct [in] - valid must be each member of this structure // // from vct uses members: year, month, day // DayHours is in degrees (360deg = 24hours) public void calculateRiseSet(GPGregorianTime vct, GPLocationProvider ed, double DayHours) { double DG = GPMath.pi / 180; double RAD = 180 / GPMath.pi; julianDay = vct.getJulianGreenwichNoon() - 0.5 + DayHours / 360; if (sunPosMethod == SUNPOSMETHOD_CALCULATOR) { calculateCoordinatesMethodC(vct, DayHours); calculateRiseSetMethodA(vct, ed, DayHours, this, DG, RAD); } else if (sunPosMethod == SUNPOSMETHOD_CALCULATOREX) { calculateCoordinatesMethodM(julianDay); calculateRiseSetMethodM(julianDay, ed); } //calculateRiseSetMethodA(vct, ed, DayHours, sun, DG, RAD); }