Exemplo n.º 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = RightAscension.GetHashCode();
         hashCode = (hashCode * 397) ^ Declination.GetHashCode();
         return((hashCode * 397) ^ Distance.GetHashCode());
     }
 }
Exemplo n.º 2
0
        public async Task PointSkyObject(StellarObjectDesignation stellarObjectDesignation)
        {
            var observer = new Observer
            {
                Latitude  = 45.42546991419586,
                Longitude = 23.9497447013855,
                Altitude  = 595
            };

            double            epoch             = GetJulianDate(DateTime.Now);
            PlanetCoordinates planetCoordinates = await GetPlanetCoordinates(stellarObjectDesignation, epoch, observer);

            var rightAscension = new RightAscension();

            rightAscension.ConvertFromArcSec(planetCoordinates.RightAscensionInArcSec);

            var declination = new Declination();

            declination.ConvertFromArcSec(planetCoordinates.DeclinationInArcSec);

            CelestialCoordinates celestialCoordinates = EquatorialCoordinatesConverter.ToCelestialCoordinates(
                rightAscension.Longitude,
                declination.Latitude,
                observer.Latitude,
                observer.Longitude);

            double roundedAltitude = Math.Round(celestialCoordinates.Altitude);
            double roundedAzimuth  = Math.Round(celestialCoordinates.Azimuth);

            double servoMotorValue = roundedAltitude;

            if (servoMotorValue > 0)
            {
                servoMotorValue += 90;
            }
            else
            {
                servoMotorValue = 90 - Math.Abs(servoMotorValue);
            }

            using var serialPort = new SerialPort
                  {
                      PortName  = SerialPort.GetPortNames().First(),
                      BaudRate  = 9600,
                      Parity    = Parity.None,
                      StopBits  = StopBits.One,
                      DataBits  = 8,
                      Handshake = Handshake.None,
                      RtsEnable = true
                  };

            serialPort.Open();

            var command = $"<S{roundedAzimuth};A{servoMotorValue};B{servoMotorValue};C{servoMotorValue}>";

            serialPort.WriteLine(command);
        }
Exemplo n.º 3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = RightAscension.GetHashCode();
         hashCode = (hashCode * 397) ^ Declination.GetHashCode();
         hashCode = (hashCode * 397) ^ HourAngle.GetHashCode();
         hashCode = (hashCode * 397) ^ (RaArgs != null ? RaArgs.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DecArgs != null ? DecArgs.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemplo n.º 4
0
 protected bool Equals(EquatorialCs other)
 {
     return(RightAscension.Equals(other.RightAscension) && Declination.Equals(other.Declination) && HourAngle.Equals(other.HourAngle) && Equals(RaArgs, other.RaArgs) && Equals(DecArgs, other.DecArgs));
 }