/// <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); }
// private readonly Timer TelescopeUpdateTimer = new Timer { AutoReset = true }; // public TimeSpan TelescopeUpdateTickInterval { get; set; } = TimeSpan.FromMilliseconds(1000); public TelescopeController(ITransactionProcessorFactory factory) { this.factory = factory; utilities = new ASCOM.Utilities.Util(); //Initialise util object astroUtilities = new ASCOM.Astrometry.AstroUtils.AstroUtils(); // Initialise astro-utilities object // TelescopeUpdateTimer.Interval = TelescopeUpdateTickInterval.TotalMilliseconds; // TelescopeUpdateTimer.Elapsed += TelescopeUpdateTimerElapsed; }
private RTMLRequestTargetCoordinates getCoordenadas(chase500DataSet.observationsRow rowObs) { RTMLRequestTargetCoordinates targetCoordinates; StringBuilder strRA; StringBuilder strDEC; targetCoordinates = new RTMLRequestTargetCoordinates(); strRA = new StringBuilder(); strDEC = new StringBuilder(); strRA.Append(rowObs.rahh); strRA.Append(":"); strRA.Append(rowObs.ramm); strRA.Append(":"); strRA.Append(rowObs.rass); if (rowObs.decp) { strDEC.Append("+"); } else { strDEC.Append("-"); } strDEC.Append(rowObs.decdd); strDEC.Append(":"); strDEC.Append(rowObs.decmm); strDEC.Append(":"); strDEC.Append(rowObs.decss); ASCOM.Utilities.Util util; util = new ASCOM.Utilities.Util(); targetCoordinates.RightAscension = util.HMSToDegrees(strRA.ToString()); targetCoordinates.Declination = util.DMSToDegrees(strDEC.ToString()); return(targetCoordinates); }
/// <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); }
private void SetupDialogForm_FormClosed(object sender, FormClosedEventArgs e) { m_Util?.Dispose(); m_Util = null; }
public static Version GetPlatformVersion() { using (var util = new ASCOM.Utilities.Util()) { return(new Version(util.MajorVersion, util.MinorVersion)); } }
public static string GetVersion() { using (var util = new ASCOM.Utilities.Util()) { return($"Version {util.PlatformVersion}"); } }
private void RefreshTelescope() { if (!panelTelescope.Visible) { return; } DateTime now = DateTime.Now; DateTime utc = now.ToUniversalTime(); ASCOM.Utilities.Util u = new ASCOM.Utilities.Util(); labelLTValue.Text = now.TimeOfDay.ToString(@"hh\hmm\mss\.f\s"); labelUTValue.Text = utc.TimeOfDay.ToString(@"hh\hmm\mss\.f\s"); if (wisetele.Connected) { groupBoxTelescope.Text = string.Format(" {0} v{1} ", wisetele.Name, wisetele.DriverVersion); labelSiderealValue.Text = wisesite.LocalSiderealTime.ToString(); labelRightAscensionValue.Text = Angle.FromHours(wisetele.RightAscension).ToNiceString(); labelDeclinationValue.Text = Angle.FromDegrees(wisetele.Declination).ToNiceString(); labelHourAngleValue.Text = Angle.FromHours(wisetele.HourAngle, Angle.Type.HA).ToNiceString(); labelAltitudeValue.Text = Angle.FromDegrees(wisetele.Altitude).ToNiceString(); labelAzimuthValue.Text = Angle.FromDegrees(wisetele.Azimuth).ToNiceString(); labelHAEncValue.Text = wisetele.HAEncoder.Value.ToString(); labelDecEncValue.Text = wisetele.DecEncoder.Value.ToString(); axisValue.Text = wisetele.HAEncoder.AxisValue.ToString(); wormValue.Text = wisetele.HAEncoder.WormValue.ToString(); checkBoxPrimaryIsActive.Checked = wisetele.AxisIsMoving(TelescopeAxes.axisPrimary); checkBoxSecondaryIsActive.Checked = wisetele.AxisIsMoving(TelescopeAxes.axisSecondary); checkBoxSlewingIsActive.Checked = wisetele.Slewing; checkBoxTrackingIsActive.Checked = wisetele.Tracking; checkBoxTrack.Checked = wisetele.Tracking; } else { groupBoxTelescope.Text = " Telescope (not connected) "; labelSiderealValue.Text = string.Empty; labelRightAscensionValue.Text = string.Empty; labelDeclinationValue.Text = string.Empty; labelHourAngleValue.Text = string.Empty; labelAltitudeValue.Text = string.Empty; labelAzimuthValue.Text = string.Empty; labelHAEncValue.Text = string.Empty; labelDecEncValue.Text = string.Empty; axisValue.Text = string.Empty; wormValue.Text = string.Empty; checkBoxPrimaryIsActive.Checked = false; checkBoxSecondaryIsActive.Checked = false; checkBoxSlewingIsActive.Checked = false; checkBoxTrackingIsActive.Checked = false; checkBoxTrack.Checked = false; } }