/// <summary> /// /// </summary> /// <param name="ra"></param> /// <param name="dec"></param> /// <param name="lat"></param> /// <param name="lon"></param> /// <param name="jd"></param> /// <returns></returns> public static structAltAz GetAltAz(double ra, double dec, double lat, double lon, double jd) { ASCOM.Astrometry.OnSurface OS = new ASCOM.Astrometry.OnSurface(); OS.Latitude = lat; OS.Longitude = lon; OS.Height = Properties.Settings.Default.site_altitude; OS.Temperature = Properties.Settings.Default.site_temperature; OS.Temperature = Properties.Settings.Default.site_pressure; ASCOM.Utilities.Util UT = new ASCOM.Utilities.Util(); double JDate = UT.DateLocalToJulian(DateTime.Now); double Zd = 0.0; double Az = 0.0; double RaR = 0.0; double DecR = 0.0; ASCOM.Astrometry.NOVAS.NOVAS31 N = new ASCOM.Astrometry.NOVAS.NOVAS31(); N.Equ2Hor(JDate, 0, ASCOM.Astrometry.Accuracy.Reduced, 0, 0, OS, ra, dec, ASCOM.Astrometry.RefractionOption.LocationRefraction, ref Zd, ref Az, ref RaR, ref DecR); //N.Equ2Hor(jd, 0, ASCOM.Astrometry.Accuracy.Reduced, 0, 0, OS, ra, dec, ASCOM.Astrometry.RefractionOption.LocationRefraction, ref Zd, ref Az, ref RaR, ref DecR); structAltAz ret_value = default(structAltAz); ret_value.Alt = 90.0 - Zd; ret_value.Az = Az; return(ret_value); }
/// <summary> /// Returns a struct with alt & az coordinates of an object given it's Ra & Dec from a specific lat & lon on a specific date (jd) /// </summary> /// <param name="Lat"></param> /// <param name="Lon"></param> /// <param name="Ra"></param> /// <param name="Dec"></param> /// <param name="Prof"></param> /// <param name="jd"></param> /// <returns></returns> public static structAltAz GetAltAz(double Lat, double Lon, double Ra, double Dec, clsSharedData Prof, double jd) { //Lat = Current Observing Latitude //Lon = Current Observing Longitude //Ra = Right Ascention of Object //Dec = Declination of object //jd = Julian Date //GSTime = GMT Sidereal Time structAltAz ret_value = default(structAltAz); double ASCOMAlt = 0; double ASCOMAz = 0; ASCOM.Astrometry.NOVASCOM.Site Site = default(ASCOM.Astrometry.NOVASCOM.Site); ASCOM.Utilities.Util utl = default(ASCOM.Utilities.Util); ASCOM.Astrometry.NOVASCOM.Star Obj = default(ASCOM.Astrometry.NOVASCOM.Star); ASCOM.Astrometry.NOVASCOM.PositionVector PosVector = default(ASCOM.Astrometry.NOVASCOM.PositionVector); //ASCOM.Astrometry.SiteInfo Site = default(ASCOM.Astrometry.SiteInfo); //ASCOM.Astrometry.PosVector PVector = default(ASCOM.Astrometry.PosVector); ASCOM.Astrometry.NOVAS.NOVAS31 N = new ASCOM.Astrometry.NOVAS.NOVAS31(); ASCOM.Astrometry.SOFA.SOFA S = new ASCOM.Astrometry.SOFA.SOFA(); ASCOM.Astrometry.OnSurface onSurface = default(ASCOM.Astrometry.OnSurface); onSurface = new ASCOM.Astrometry.OnSurface(); onSurface.Latitude = Lat; onSurface.Longitude = Lon; onSurface.Height = Properties.Settings.Default.site_altitude; onSurface.Pressure = Properties.Settings.Default.site_pressure; onSurface.Pressure = Properties.Settings.Default.site_temperature; Site = new ASCOM.Astrometry.NOVASCOM.Site(); utl = new ASCOM.Utilities.Util(); Obj = new ASCOM.Astrometry.NOVASCOM.Star(); PosVector = new ASCOM.Astrometry.NOVASCOM.PositionVector(); //Site = new ASCOM.Astrometry.SiteInfo(); //PVector = new ASCOM.Astrometry.PosVector(); //double jd = JDNow(); double GSTime = GMSTime(); Site.Latitude = Lat; Site.Longitude = Lon; Site.Height = Properties.Settings.Default.site_altitude; Site.Pressure = Properties.Settings.Default.site_pressure; Site.Temperature = Properties.Settings.Default.site_temperature; PosVector.SetFromSite(Site, GSTime); Obj.Set(Ra, Dec, 0.0, 0.0, 0.0, 0.0); PosVector = Obj.GetTopocentricPosition(jd, Site, false); ASCOMAlt = PosVector.Elevation; ASCOMAz = PosVector.Azimuth; ret_value.Alt = ASCOMAlt; ret_value.Az = ASCOMAz; return(ret_value); }