Practical Astronomy Algorithms in .NET/C#
Loading...
Searching...
No Matches
PABinary.cs
Go to the documentation of this file.
1using System;
2using PALib.Data;
3using PALib.Helpers;
4
5namespace PALib;
6
10public class PABinary
11{
19 public (double positionAngleDeg, double separationArcsec) BinaryStarOrbit(double greenwichDateDay, int greenwichDateMonth, int greenwichDateYear, string binaryName)
20 {
21 BinaryData binaryInfo = BinaryInfo.GetBinaryInfo(binaryName);
22
23 double yYears = greenwichDateYear + (PAMacros.CivilDateToJulianDate(greenwichDateDay, greenwichDateMonth, greenwichDateYear) - PAMacros.CivilDateToJulianDate(0, 1, greenwichDateYear)) / 365.242191 - binaryInfo.EpochPeri;
24 double mDeg = 360 * yYears / binaryInfo.Period;
25 double mRad = (mDeg - 360 * (mDeg / 360).Floor()).ToRadians();
26 double eccentricity = binaryInfo.Ecc;
27 double trueAnomalyRad = PAMacros.TrueAnomaly(mRad, eccentricity);
28 double rArcsec = (1 - eccentricity * PAMacros.EccentricAnomaly(mRad, eccentricity).Cosine()) * binaryInfo.Axis;
29 double taPeriRad = trueAnomalyRad + binaryInfo.LongPeri.ToRadians();
30
31 double y = taPeriRad.Sine() * binaryInfo.Incl.ToRadians().Cosine();
32 double x = taPeriRad.Cosine();
33 double aDeg = PAMacros.Degrees(y.AngleTangent2(x));
34 double thetaDeg1 = aDeg + binaryInfo.PANode;
35 double thetaDeg2 = thetaDeg1 - 360 * (thetaDeg1 / 360).Floor();
36 double rhoArcsec = rArcsec * taPeriRad.Cosine() / (thetaDeg2 - binaryInfo.PANode).ToRadians().Cosine();
37
38 double positionAngleDeg = Math.Round(thetaDeg2, 1);
39 double separationArcsec = Math.Round(rhoArcsec, 2);
40
41 return (positionAngleDeg, separationArcsec);
42 }
43}
Holds information about binary star systems.
Definition BinaryData.cs:10
double Ecc
Eccentricity of the orbit.
Definition BinaryData.cs:34
double Incl
Orbital inclination.
Definition BinaryData.cs:44
double Period
Period of the orbit.
Definition BinaryData.cs:19
double EpochPeri
Epoch of the perihelion.
Definition BinaryData.cs:24
double LongPeri
Longitude of the perihelion.
Definition BinaryData.cs:29
double PANode
Position angle of the ascending node.
Definition BinaryData.cs:49
double Axis
Semi-major axis of the orbit.
Definition BinaryData.cs:39
Binary star system data manager.
Definition BinaryData.cs:56
static BinaryData GetBinaryInfo(string name)
Retrieve information about a specific binary star system.
Binary star calculations.
Definition PABinary.cs:11
double positionAngleDeg
Calculate orbital data for binary star.
Definition PABinary.cs:19
double double separationArcsec BinaryStarOrbit(double greenwichDateDay, int greenwichDateMonth, int greenwichDateYear, string binaryName)
Definition PABinary.cs:19
Miscellaneous macro functions supporting the other classes.
Definition PAMacros.cs:13
static double CivilDateToJulianDate(double day, double month, double year)
Convert a Greenwich Date/Civil Date (day,month,year) to Julian Date.
Definition PAMacros.cs:87
static double Degrees(double w)
Convert W to Degrees.
Definition PAMacros.cs:463
static double EccentricAnomaly(double am, double ec)
Solve Kepler's equation, and return value of the eccentric anomaly in radians.
Definition PAMacros.cs:850
static double TrueAnomaly(double am, double ec)
Solve Kepler's equation, and return value of the true anomaly in radians.
Definition PAMacros.cs:822