-
Notifications
You must be signed in to change notification settings - Fork 1
/
ObjectDataRecords.cs
128 lines (100 loc) · 5.44 KB
/
ObjectDataRecords.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using CsvHelper;
using CsvHelper.Configuration.Attributes;
namespace ControlProgram
{
public struct ObjectDataCalculations
{
public double Distance { get; set; }
public double Ra { get; set; }
public double Dec { get; set; }
public double Az { get; set; }
public double El { get; set; }
public double HourAngle { get; set; }
public double LST { get; set; }
public double CartX { get; set; }
public double CartY { get; set; }
public double CartZ { get; set; }
}
public class ObjectDataRecords
{
// CSV: JDTDB,Calendar Date (TDB),EC,QR,IN,OM,W,Tp,N,MA,TA,A,AD,PR,,name
private float jDTDB; // EPOCH DATE
private DateTime date; // CALENDAR DATE
private decimal e; // Eccentricity, e
private decimal q; // Periapsis distance, q (au)
private decimal i; // Inclination w.r.t X-Y plane, i (degrees)
private decimal omega; // Longitude of Ascending Node, OMEGA, (degrees)
private decimal w; // Argument of Perifocus, w (degrees)
private decimal tp; // Time of periapsis (Julian Day Number)
private decimal n; // Mean motion, n (degrees/day)
private decimal m; // Mean anomaly, M (degrees)
private decimal nu; // True anomaly, nu (degrees)
private decimal a; // Semi-major axis, a (au)
private decimal aD; // Apoapsis distance (au)
private decimal pR; // Sidereal orbit period (day)
private string name; // Human readable name
[Name("JDTDB")]
public float JDTDB { get => jDTDB; set => jDTDB = value; }
[Name("Calendar Date (TDB)")]
public DateTime Date { get => date; set => date = value; }
[Name("EC")]
public string EString { get => e.ToString(); set => Decimal.TryParse(value, System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture, out e); }
[Name("QR")]
public string QString { get => q.ToString(); set => Decimal.TryParse(value, System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture, out q); }
[Name("IN")]
public string IString { get => i.ToString(); set => Decimal.TryParse(value, System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture, out i); }
[Name("OM")]
public string OmegaString { get => omega.ToString(); set => Decimal.TryParse(value, System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture, out omega); }
[Name("W")]
public string WString { get => w.ToString(); set => Decimal.TryParse(value, System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture, out w); }
[Name("Tp")]
public string TpString { get => tp.ToString(); set => Decimal.TryParse(value, System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture, out tp); }
[Name("N")]
public string NString { get => n.ToString(); set => Decimal.TryParse(value, System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture, out n); }
[Name("MA")]
public string MString { get => m.ToString(); set => Decimal.TryParse(value, System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture, out m); }
[Name("TA")]
public string NuString { get => nu.ToString(); set => Decimal.TryParse(value, System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture, out nu); }
[Name("A")]
public string AString { get => a.ToString(); set => Decimal.TryParse(value, System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture, out a); }
[Name("AD")]
public string ADString { get => aD.ToString(); set => Decimal.TryParse(value, System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture, out aD); }
[Name("PR")]
public string PRString { get => pR.ToString(); set => Decimal.TryParse(value, System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture, out pR); }
[Name("name")]
public string Name { get => name; set => name = value; }
public decimal E { get => e; set { } }
public decimal Q { get => q; set { } }
public decimal I { get => i; set { } }
public decimal Omega { get => omega; set { } }
public decimal W { get => w; set { } }
public decimal Tp { get => tp; set { } }
public decimal N { get => n; set { } }
public decimal M { get => m; set { } }
public decimal Nu { get => nu; set { } }
public decimal A { get => a; set { } }
public decimal AD { get => aD; set { } }
public decimal PR { get => pR; set { } }
public ObjectDataCalculations Calculations;
private PropertyInfo[] _PropertyInfos = null;
public override string ToString()
{
if (_PropertyInfos == null)
_PropertyInfos = this.GetType().GetProperties();
var sb = new StringBuilder();
foreach (var info in _PropertyInfos)
{
var value = info.GetValue(this, null) ?? "(null)";
sb.AppendLine(info.Name + ": " + value.ToString());
}
return sb.ToString();
}
}
}