public HourAngle GetRA(AxisPosition axes) { double tempRA_hours = GetHourAngleFromAngle(axes.RAAxis.Value); double tRa = LocalApparentSiderialTime + tempRA_hours; double tHa = AstroConvert.RangeHA(tRa); double dec = GetDec(axes); // System.Diagnostics.Debug.Write($"{axes.RAAxis.Value}/{axes.DecAxis.Value}\t{dec}\t{tHa}\t{tRa}"); if (Hemisphere == HemisphereOption.Northern) { if (axes.DecFlipped) { tRa = tRa - 12.0; // System.Diagnostics.Debug.Write("\t tRa - tRa - 12"); } } else { System.Diagnostics.Debug.Assert(false, "GetRA is not tested for Southern Hemisphere"); if (axes.DecAxis.Value > 180) { tRa = tRa + 12.0; } } return(new HourAngle(AstroConvert.RangeRA(tRa))); }
public EquatorialCoordinate(HourAngle rightAscension, Angle declination) : this() // , Angle longitude, DateTime observedTime) { if (declination > 90.0 || declination < -90.0) { throw new ArgumentOutOfRangeException("Declination"); } _RA.Value = AstroConvert.RangeRA(rightAscension.Value); _Dec = declination.Value; }
public void SlewRA(double slewAngle, double expectedRA) { MountCoordinate currentPosition = new MountCoordinate(new AxisPosition(0.0, 0.0), _Tools, _Now); double targetRA = AstroConvert.RangeRA(currentPosition.Equatorial.RightAscension.Value + expectedRA); double targetDec = currentPosition.Equatorial.Declination.Value; currentPosition.MoveRADec(new AxisPosition(slewAngle, 0.0), _Tools, _Now); EquatorialCoordinate expected = new EquatorialCoordinate(targetRA, targetDec); Assert.AreEqual(expected.RightAscension, currentPosition.Equatorial.RightAscension, 0.000001, "RA test"); Assert.AreEqual(expected.Declination, currentPosition.Equatorial.Declination, 0.000001, "DEc test"); }
private double GetHourAngleFromAngle(Angle raAxisAngle) { double hours = HourAngle.DegreesToHours(AstroConvert.Range360Degrees(360.0 - raAxisAngle.Value)); if (Hemisphere == HemisphereOption.Northern) { return(AstroConvert.RangeRA(hours + 6.0)); } else { return(AstroConvert.RangeRA((24.0 - hours) + 6.0)); } }
private Angle GetAngleFromHourAngle(double hourAngle) { double ha = 0.0; double degrees; if (Hemisphere == HemisphereOption.Northern) { ha = AstroConvert.RangeRA(hourAngle - 6.0); // Renormalise from a perpendicular position degrees = HourAngle.HoursToDegrees(ha); } else { System.Diagnostics.Debug.Assert(false, "GetAngleFromHours not tested for Southern Hemisphere"); ha = AstroConvert.RangeRA((24 - hourAngle) - 6.0); // Renormalise from a perpendicular position degrees = HourAngle.HoursToDegrees(ha); } return(AstroConvert.Range360Degrees(360.0 - degrees)); }
public void CalculateSlewAngles() { MountCoordinate currentPosition = new MountCoordinate(new AxisPosition(0.0, 0.0), _Tools, _Now); double ha = currentPosition.LocalApparentSiderialTime; System.Diagnostics.Debug.WriteLine("\nPoint A (SE)"); System.Diagnostics.Debug.WriteLine("============"); AxisPosition targetAxes = currentPosition.GetAxisPositionForRADec(AstroConvert.RangeRA(ha - 3.0), 10.0, _Tools); Angle[] deltaAngles = currentPosition.ObservedAxes.GetSlewAnglesTo(targetAxes); System.Diagnostics.Debug.WriteLine($"Slewing through: {deltaAngles[0]} / {deltaAngles[1]}"); currentPosition.MoveRADec(targetAxes, _Tools, _Now); currentPosition.DumpDebugInfo(); Assert.AreEqual(PierSide.pierWest, currentPosition.GetPointingSideOfPier(false), "Point A"); System.Diagnostics.Debug.WriteLine("\nPoint B (NW)"); System.Diagnostics.Debug.WriteLine("============"); targetAxes = currentPosition.GetAxisPositionForRADec(AstroConvert.RangeRA(ha + 9.0), 60.0, _Tools); deltaAngles = currentPosition.ObservedAxes.GetSlewAnglesTo(targetAxes); System.Diagnostics.Debug.WriteLine($"Slewing through: {deltaAngles[0]} / {deltaAngles[1]}"); currentPosition.MoveRADec(targetAxes, _Tools, _Now); currentPosition.DumpDebugInfo(); Assert.AreEqual(PierSide.pierEast, currentPosition.GetPointingSideOfPier(false), "Point B"); System.Diagnostics.Debug.WriteLine("\nPoint C (NE)"); System.Diagnostics.Debug.WriteLine("============"); targetAxes = currentPosition.GetAxisPositionForRADec(AstroConvert.RangeRA(ha - 9.0), 60.0, _Tools); deltaAngles = currentPosition.ObservedAxes.GetSlewAnglesTo(targetAxes); System.Diagnostics.Debug.WriteLine($"Slewing through: {deltaAngles[0]} / {deltaAngles[1]}"); currentPosition.MoveRADec(targetAxes, _Tools, _Now); currentPosition.DumpDebugInfo(); Assert.AreEqual(PierSide.pierWest, currentPosition.GetPointingSideOfPier(false), "Point C"); System.Diagnostics.Debug.WriteLine("\nPoint D (SW)"); System.Diagnostics.Debug.WriteLine("============"); targetAxes = currentPosition.GetAxisPositionForRADec(AstroConvert.RangeRA(ha + 3.0), 10.0, _Tools); deltaAngles = currentPosition.ObservedAxes.GetSlewAnglesTo(targetAxes); System.Diagnostics.Debug.WriteLine($"Slewing through: {deltaAngles[0]} / {deltaAngles[1]}"); currentPosition.MoveRADec(targetAxes, _Tools, _Now); currentPosition.DumpDebugInfo(); Assert.AreEqual(PierSide.pierEast, currentPosition.GetPointingSideOfPier(false), "Point D"); }
/// <summary> /// Gets an Axis position in degrees (0 is at 12-o-clock) /// </summary> /// <param name="targetRA">Target RA in hours</param> /// <param name="targetDec">Target Dec in degrees</param> /// <param name="futureOffset">Future offset in seconds (if any).</param> /// <returns></returns> private Angle GetAxisPositionForRA(double targetRA, double targetDec, double futureOffset = 0.0) { double deltaRa = targetRA - LocalApparentSiderialTime + (futureOffset / 3600.0); if (Hemisphere == HemisphereOption.Northern) { if (targetDec > 90.0 && targetDec <= 270.0) { deltaRa = deltaRa - 12.0; } } else { if (targetDec > 90.0 && targetDec <= 270) { deltaRa = deltaRa + 12.0; } } deltaRa = AstroConvert.RangeRA(deltaRa); return(GetAngleFromHourAngle(deltaRa)); }
public void ASCOM_SOP() { MountCoordinate currentPosition = new MountCoordinate(new AxisPosition(0.0, 0.0), _Tools, _Now); double ha = currentPosition.LocalApparentSiderialTime; AxisPosition targetAxisPosition = currentPosition.GetAxisPositionForRADec(AstroConvert.RangeRA(ha - 3.0), 10.0, _Tools); MountCoordinate targetCoordinate = new MountCoordinate(targetAxisPosition, _Tools, _Now); // currentPosition.MoveRADec(targetAxisPosition, _Tools, _Now); Assert.AreEqual(PierSide.pierWest, targetCoordinate.GetPointingSideOfPier(false), "Point A"); targetAxisPosition = currentPosition.GetAxisPositionForRADec(AstroConvert.RangeRA(ha + 9.0), 60.0, _Tools); currentPosition.MoveRADec(targetAxisPosition, _Tools, _Now); Assert.AreEqual(PierSide.pierEast, currentPosition.GetPointingSideOfPier(false), "Point B"); targetAxisPosition = currentPosition.GetAxisPositionForRADec(AstroConvert.RangeRA(ha - 9.0), 60.0, _Tools); currentPosition.MoveRADec(targetAxisPosition, _Tools, _Now); Assert.AreEqual(PierSide.pierWest, currentPosition.GetPointingSideOfPier(false), "Point C"); targetAxisPosition = currentPosition.GetAxisPositionForRADec(AstroConvert.RangeRA(ha + 3.0), 10.0, _Tools); currentPosition.MoveRADec(targetAxisPosition, _Tools, _Now); Assert.AreEqual(PierSide.pierEast, currentPosition.GetPointingSideOfPier(false), "Point D"); }
public void TestRangeRA(double value, double expected) { Assert.AreEqual(expected, AstroConvert.RangeRA(value)); }
/// <summary> /// /// </summary> /// <param name="targetRA"></param> /// <param name="targetDec"></param> /// <param name="tools"></param> /// <param name="futureOffset">Offset in future in seconds (if any)</param> /// <returns></returns> public AxisPosition GetAxisPositionForRADec(double targetRA, double targetDec, AscomTools tools, double futureOffset = 0.0) { bool flipDEC; double adjustedRA = targetRA; double targetHA = AstroConvert.RangeHA(targetRA - LocalApparentSiderialTime + (futureOffset / 3600.0)); if (targetHA < 0) // Target is to the west. { if (ForceMeridianFlip) { if (Hemisphere == HemisphereOption.Northern) { flipDEC = false; } else { flipDEC = true; } adjustedRA = targetRA; } else { if (Hemisphere == HemisphereOption.Northern) { flipDEC = true; } else { flipDEC = false; } adjustedRA = AstroConvert.RangeRA(targetRA - 12); } } else { if (ForceMeridianFlip) { if (Hemisphere == HemisphereOption.Northern) { flipDEC = true; } else { flipDEC = false; } adjustedRA = AstroConvert.RangeRA(targetRA - 12); } else { if (Hemisphere == HemisphereOption.Northern) { flipDEC = false; } else { flipDEC = true; } adjustedRA = targetRA; } } // Compute for Target RA/DEC angles Angle RAAxis = GetAxisPositionForRA(adjustedRA, 0.0, futureOffset); Angle DecAxis = GetAxisPositionForDec(targetDec, flipDEC); // System.Diagnostics.Debug.WriteLine($"RA/Dec:{targetHA}/{targetDec} Axes:{ RAAxis.Value}/{ DecAxis.Value} FlipDec: {flipDEC}"); return(new AxisPosition(RAAxis.Value, DecAxis.Value, flipDEC)); }