/// <summary> /// Calculates the dome azimuth for a given telescope position. /// NOTE: Code adapted from Time_Coord.pas in the RemoteCommander Delphi project /// </summary> /// <param name="ra">Angle, target RA</param> /// <param name="dec">Angle, target DEC</param> /// <returns>Angle, dome azimuth</returns> public Angle CalculateDomeAzimuth(Angle ra, Angle dec) { const double X0 = 0.0; // meters const double Y0 = 0.0; // meters const double Z0 = 0.0; // meters const double R = 5.0; // meters - dome radius const double L = 1.2; // meters - optical axis offset from ra axis const double SiteNorthLat = 0.534024354440983; //+30:35:50.43; double Lx, Ly, Lz, Px, Py, Pz, PL, QA, QB, QC, A1, Rx1, Ry1, DomeAz; double rar = 0, decr = 0, targetHA, targetAlt, targetAz = 0, zd = 0; wisesite.prepareRefractionData(true); novas31.Equ2Hor(astroutils.JulianDateUT1(0), 0, WiseSite.astrometricAccuracy, 0, 0, wisesite.onSurface, ra.Hours, dec.Degrees, WiseSite.refractionOption, ref zd, ref targetAz, ref rar, ref decr); targetHA = (wisesite.LocalSiderealTime - ra).Radians; targetAz = Angle.FromDegrees(targetAz).Radians; targetAlt = Angle.FromDegrees(90.0 - zd).Radians; Lx = X0 - Math.Sin(SiteNorthLat) * Math.Sin(-targetHA) * L; Ly = Y0 + Math.Cos(-targetHA) * L; Lz = Z0 + Math.Cos(SiteNorthLat) * Math.Sin(-targetHA) * L; Px = Math.Cos(-targetAz) * Math.Cos(targetAlt); Py = Math.Sin(-targetAz) * Math.Cos(targetAlt); Pz = Math.Sin(targetAlt); PL = Px * Lx + Py * Ly + Pz * Lz; QA = 1; QB = 2 * PL; QC = L * L - R * R; A1 = (-QB + Math.Sqrt(QB * QB - 4 * QA * QC)) / (2 * QA); Rx1 = A1 * Px - Lx; Ry1 = A1 * Py - Ly; DomeAz = -Math.Atan2(Ry1, Rx1); if (DomeAz < 0) { DomeAz += 2 * Math.PI; } return(Angle.FromRadians(DomeAz)); }
public Angle Distance(double telescopeRA, double telescopeDec) { SkyPos moonPos = new SkyPos(); short ret; ret = novas31.Place(astroutils.JulianDateUT1(0), moon, observer, 0.0, CoordSys.Astrometric, Accuracy.Full, ref moonPos); if (ret != 0) { #region debug debugger.WriteLine(Debugger.DebugLevel.DebugLogic, "Moon.Distance: Cannot calculate Moon position (ret: {0})", ret); #endregion return(Angle.FromDegrees(0)); } double rad = SphereDist(telescopeRA, telescopeDec, moonPos.RA, moonPos.Dec); return(Angle.FromRadians(rad, Angle.Type.Az)); }