source: BAORadio/libindi/v1.0.1/BAOControl/astro.cpp@ 680

Last change on this file since 680 was 502, checked in by frichard, 15 years ago

-BAOControl : petite interface permettant de contrôler les antennes via le pilote indi_BAO
-Le pilote indi_BAO utilise désormais indilib v 0.7

File size: 3.9 KB
Line 
1#include "astro.h"
2
3////////////////////
4// Routines Astro //
5////////////////////
6
7Astro::Astro()
8{
9 Longitude=0.0;
10 Latitude=0.0;
11 Lst=0.0;
12 JJ=0.0;
13 CorP=0.0;
14 CorEP=0.0;
15 Annee=0.0;
16 Mois=0.0;
17 Jour=0.0;
18 Heu=0.0;
19 Min=0.0;
20 Sec=0.0;
21 ep=0.0;
22 hs=0.0;
23 UTCP=0.0;
24 tsl=0.0;
25}
26
27Astro::~Astro()
28{
29}
30
31
32//0<=Angle<=2*PI
33double Astro::VerifAngle(double Angle)
34{
35 Angle=fmod(Angle, Pi2);
36 if (Angle<0.0) Angle+=Pi2;
37
38 return(Angle);
39}
40
41
42//////////////////////////////////////////////////////////////////////
43//Nutation
44
45void Astro::Nutation()
46{
47 double T,L,LP,M,MP,O,L2,LP2,O2;
48
49 T=(JJ-2415020.0)/36525.0;
50
51 L=(279.6967+(36000.7689+0.000303*T)*T)*Pidiv180;
52 LP=(270.4342+(481267.8831-0.001133*T)*T)*Pidiv180;
53 M=(358.4758+(35999.0498-0.000150*T)*T)*Pidiv180;
54 MP=(296.1046+(477198.8491+0.009192*T)*T)*Pidiv180;
55 O=(259.1833+(-1934.1420+0.002078*T)*T)*Pidiv180;
56
57 L2=2.0*L;
58 LP2=2.0*LP;
59 O2=2.0*O;
60
61 CorP=-(17.2327+0.01737*T)*sin(O)
62 -(1.2729+0.00013*T)*sin(L2)
63 +0.2088*sin(O2)
64 -0.2037*sin(LP2)
65 +(0.1261-0.00031*T)*sin(M)
66 +0.0675*sin(MP)
67 -(0.0497-0.00012*T)*sin(L2+M)
68 -0.0342*sin(LP2-O)
69 -0.0261*sin(LP2+MP)
70 +0.0214*sin(L2-M)
71 -0.0149*sin(L2-LP2+MP)
72 +0.0124*sin(L2-O)
73 +0.0114*sin(LP2-MP);
74
75 CorEP=(9.2100+0.00091*T)*cos(O)
76 +(0.5522-0.00029*T)*cos(L2)
77 -0.0904*cos(O2)
78 +0.0884*cos(LP2)
79 +0.0216*cos(L2+M)
80 +0.0183*cos(LP2-O)
81 +0.0113*cos(LP2+MP)
82 -0.0093*cos(L2-M)
83 -0.0066*cos(L2-O);
84
85 CorP=CorP/3600.0*Pidiv180;
86 CorEP=CorEP/3600.0*Pidiv180;
87}
88
89
90//////////////////////////////////////////////////////////////////////
91// calcul Jour julien
92
93void Astro::CalculJJ(double Heure)
94{
95
96 long y, a, b, c, e, m;
97
98 long year = (long)Annee;
99 int month = (int)Mois;
100 double day = Jour + Heure;
101
102
103 y = year + 4800;
104
105 m = month;
106 if ( m <= 2 )
107 {
108 m += 12;
109 y -= 1;
110 }
111 e = (306 * (m+1))/10;
112
113 a = y/100;
114 if ( year <= 1582L )
115 {
116 if ( year == 1582L )
117 {
118 if ( month < 10 )
119 goto julius;
120 if ( month > 10)
121 goto gregor;
122 if ( day >= 15 )
123 goto gregor;
124 }
125julius:
126
127 b = -38;
128 }
129 else
130 {
131
132gregor:
133 b = (a/4) - a;
134 }
135
136 c = (36525L * y)/100;
137
138 JJ = b + c + e + day - 32167.5;
139}
140
141
142///////////////////////////////////////////////////////////////////////
143//Obliquité
144
145void Astro::Obliquite(double JJ)
146{
147 double T;
148
149 T = (JJ-2415020.0) / 36525.0;
150
151 ep = (23.452294+ (((0.000000503 * T ) - 0.00000164 ) * T - 0.0130125 ) * T ) * Pidiv180;
152}
153
154///////////////////////////////////////////////////////////////////////
155//Temps sidéral local
156
157double Astro::TSL(double JJ, double HeureSiderale, double Longitude)
158{
159 double rd,T;
160
161 T = (JJ - 2415020.0 ) / 36525.0;
162 rd = 0.276919398 + ( 100.0021359 + 0.000001075 * T ) * T;
163 rd += HeureSiderale;
164 rd *= Pi2;
165 rd += CorP * cos(ep);
166 rd -= Longitude;
167
168 return VerifAngle(rd);
169}
170
171
172void Astro::CalculTSL()
173{
174 hs=(Heu+Min/60.0+Sec/3600.0)/24.0;
175
176 hs-=UTCP/24.0;
177
178 CalculJJ(hs);
179
180 Obliquite(JJ);
181
182 Nutation();
183
184 tsl=TSL(JJ, hs, Longitude);
185}
186
187
188///////////////////////////////////////////////////////////////////////
189//Azimut et hauteur à partir de AR et Dec
190
191void Astro::Azimut(double ts, double Latitude, double Ar, double De, double *azi, double *hau)
192{
193 double ah, ht, a1, az, zc, ac;
194
195 ah=ts-Ar;
196
197 zc=sin(Latitude)*sin(De)+cos(Latitude)*cos(De)*cos(ah);
198 ht=atan(zc/sqrt((-zc*zc)+1.0));
199
200 a1=cos(De)*sin(ah)/cos(ht);
201 ac=(-cos(Latitude)*sin(De)+sin(Latitude)*cos(De)*cos(ah))/cos(ht);
202 az=atan(a1/sqrt((-a1*a1)+1.0));
203 if (ac<0.0) az=Pi-az;
204
205 az=VerifAngle(Pi+az);
206
207 *azi=az;
208 *hau=ht;
209}
210
Note: See TracBrowser for help on using the repository browser.