Refactorisation des dosiers
This commit is contained in:
39
Astro lolo/equa2azim.js
Normal file
39
Astro lolo/equa2azim.js
Normal file
@@ -0,0 +1,39 @@
|
||||
// script en JS pour calculer les coordonnées longitude/azimut depuis une coordonnée équatoriale
|
||||
// le but du jeu c'est de convertir ce script JS en Lua pour le NodeMCU avec asservissement d'un
|
||||
// télescope à monture azimutale
|
||||
// zf180807.2217
|
||||
// source https://astronomy.stackexchange.com/questions/15013/calculating-azimuth-from-equatorial-coordinates
|
||||
|
||||
// a=arctan2(sin(θ−α),sinφ∗cos(θ−α)−cosφ∗tanδ)
|
||||
// Where
|
||||
// φ = geographic latitude of the observer (here: 0°)
|
||||
// θ = sidereal time (here: 0°)
|
||||
// δ = declination
|
||||
// α = right ascension
|
||||
|
||||
obliq = deg2rad(23.44); // obliquity of ecliptic
|
||||
lat2 = deg2rad(0); // observer's latitude
|
||||
lmst = deg2rad(0); // siderial time
|
||||
|
||||
function equatorial(lat, lon) {
|
||||
// returns equatorial from ecliptic coordinates
|
||||
dec = Math.asin( Math.cos(obliq) * Math.sin(lat) + Math.sin(obliq) *
|
||||
Math.cos(lat) * Math.sin(lon));
|
||||
ra = Math.atan2(Math.cos(obliq) * Math.sin(lon) - Math.sin(obliq) * Math.tan(lat),
|
||||
Math.cos(lon));
|
||||
ra += 2 * Math.PI * (ra < 0);
|
||||
return [dec, ra];
|
||||
}
|
||||
|
||||
function horizontal(lat, lon) {
|
||||
// returns horizontal from ecliptic coordinates
|
||||
coords = equatorial(lat, lon);
|
||||
dec = coords[0]; // δ
|
||||
ra = coords[1]; // α
|
||||
alt = Math.asin(Math.sin(lat2) * Math.sin(dec) + Math.cos(lat2) *
|
||||
Math.cos(dec) * Math.cos(lmst - ra));
|
||||
azm = Math.atan2(Math.sin(lmst - ra), Math.sin(lat2) * Math.cos(lmst - ra) -
|
||||
Math.cos(lat2) * Math.tan(dec));
|
||||
azm += 2 * Math.PI * (azm < 0);
|
||||
return [alt, azm];
|
||||
}
|
||||
48
Astro lolo/equa2azim.lua
Normal file
48
Astro lolo/equa2azim.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
-- script en LUA pour calculer les coordonnées longitude/azimut depuis une coordonnée équatoriale
|
||||
-- le but du jeu c'était de convertir script JS en LUA pour le NodeMCU avec asservissement d'un
|
||||
-- télescope à monture azimutale.
|
||||
-- le problème avec le LUA embarqué sur NodeMCU c'est qu'il n'y a pas de fonctions trigo :-(
|
||||
-- zf180807.2300
|
||||
-- source https:--astronomy.stackexchange.com/questions/15013/calculating-azimuth-from-equatorial-coordinates
|
||||
|
||||
|
||||
-- ce n'est pas terminé !
|
||||
|
||||
|
||||
-- a=arctan2(sin(θ−α),sinφ∗cos(θ−α)−cosφ∗tanδ)
|
||||
-- Where
|
||||
-- φ = geographic latitude of the observer (here: 0°)
|
||||
-- θ = sidereal time (here: 0°)
|
||||
-- δ = declination
|
||||
-- α = right ascension
|
||||
|
||||
obliq = math.rad(23.44) -- obliquity of ecliptic
|
||||
lat2 = math.rad(0) -- observer's latitude
|
||||
lmst = math.rad(0) -- siderial time
|
||||
|
||||
bool_to_number={ [true]=1, [false]=0 }
|
||||
|
||||
function equatorial(lat, lon)
|
||||
-- returns equatorial from ecliptic coordinates
|
||||
dec = math.asin( math.cos(obliq) * math.sin(lat) + math.sin(obliq) * math.cos(lat) * math.sin(lon))
|
||||
ra = math.atan2(math.cos(obliq) * math.sin(lon) - math.sin(obliq) * math.tan(lat) , math.cos(lon))
|
||||
ra = ra + 2 * math.pi * bool_to_number[ra < 0]
|
||||
return dec, ra
|
||||
end
|
||||
|
||||
function horizontal(lat, lon)
|
||||
-- returns horizontal from ecliptic coordinates
|
||||
coords = equatorial(lat, lon)
|
||||
dec = coords[0] -- δ
|
||||
ra = coords[1] -- α
|
||||
alt = math.asin(math.sin(lat2) * math.sin(dec) + math.cos(lat2) * math.cos(dec) * math.cos(lmst - ra))
|
||||
azm = math.atan2(math.sin(lmst - ra), math.sin(lat2) * math.cos(lmst - ra) - math.cos(lat2) * math.tan(dec))
|
||||
azm = azm + 2 * math.pi * bool_to_number[azm < 0]
|
||||
return alt, azm
|
||||
end
|
||||
|
||||
|
||||
|
||||
print "toto"
|
||||
|
||||
horizontal(13,6)
|
||||
86
Astro lolo/equa2azim2.lua
Normal file
86
Astro lolo/equa2azim2.lua
Normal file
@@ -0,0 +1,86 @@
|
||||
-- script en LUA pour calculer les coordonnées horizontale (hauteur/azimut) depuis une coordonnée équatoriale
|
||||
-- le but du jeu c'était de convertir script JS en LUA pour le NodeMCU avec asservissement d'un
|
||||
-- télescope à monture azimutale.
|
||||
-- le problème avec le LUA embarqué sur NodeMCU c'est qu'il n'y a pas de fonctions trigo :-(
|
||||
-- zf180813.1900
|
||||
-- source: https://astronomy.stackexchange.com/questions/15013/calculating-azimuth-from-equatorial-coordinates
|
||||
-- source: https://www.webastro.net/forums/topic/145571-convertir-coordonn%C3%A9es-alto-azimutales-en-%C3%A9quatoriale-et-vice-versa/
|
||||
|
||||
|
||||
-- ce n'est pas terminé !
|
||||
|
||||
|
||||
--[[ ancien code en js https:astronomy.stackexchange.com/questions/15013/calculating-azimuth-from-equatorial-coordinates
|
||||
a=arctan2(sin(θ−α),sinφ∗cos(θ−α)−cosφ∗tanδ)
|
||||
Where
|
||||
φ = geographic latitude of the observer (here: 0°)
|
||||
θ = sidereal time (here: 0°)
|
||||
δ = declination
|
||||
α = right ascension
|
||||
|
||||
obliq = math.rad(23.44) -- obliquity of ecliptic
|
||||
lat2 = math.rad(0) -- observer's latitude
|
||||
lmst = math.rad(0) -- siderial time
|
||||
|
||||
function equatorial(lat, lon)
|
||||
-- returns equatorial from ecliptic coordinates
|
||||
dec = math.asin( math.cos(obliq) * math.sin(lat) + math.sin(obliq) * math.cos(lat) * math.sin(lon))
|
||||
ra = math.atan2(math.cos(obliq) * math.sin(lon) - math.sin(obliq) * math.tan(lat) , math.cos(lon))
|
||||
ra = ra + 2 * math.pi * bool_to_number[ra < 0]
|
||||
return dec, ra
|
||||
end
|
||||
]]
|
||||
|
||||
|
||||
|
||||
lat = math.rad(46.52) -- latitude de l'observateur
|
||||
long = math.rad(6.55) -- longitude de l'observateur
|
||||
timsid = math.rad((17+54/60+49/3600)*15) -- 10h39mn22s temps sidérale de l'observateur
|
||||
|
||||
ra = math.rad(18+12/60+56/3600) -- 18h12mn56, -22o38'34 ascension droite de la coordonnée équatoriale de l'objet céleste
|
||||
dec = math.rad(-(22+38/60+34/3600)) -- -22o38'34 déclinaison de la coordonnée équatoriale de l'objet céleste
|
||||
|
||||
haut = math.rad(20+45/60) -- +20o45 hauteur de la coordonnée horizontale du télescope
|
||||
azmt = math.rad(175+35/60) -- +175o35 azimut de la coordonnée horizontale du télescope
|
||||
|
||||
bool_to_number={ [true]=1, [false]=0 }
|
||||
|
||||
|
||||
--[[ code en VBA https://www.webastro.net/forums/topic/145571-convertir-coordonn%C3%A9es-alto-azimutales-en-%C3%A9quatoriale-et-vice-versa/
|
||||
Function Arsin(ByVal X As Single) As Single
|
||||
If (Abs(X) >= 1) Then Arsin = 0 Else Arsin = Atn(X / Sqr(-X * X + 1))
|
||||
End Function
|
||||
|
||||
Function Arcos(ByVal X As Single) As Single
|
||||
If (Abs(X) >= 1) Then Arcos = 0 Else Arcos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
|
||||
End Function
|
||||
|
||||
Function Hauteur(Dec As Single, Latitude As Single, H As Single) As Single
|
||||
Dim Sin_hauteur, PI As Single
|
||||
PI = 3.14159
|
||||
Sin_hauteur = Sin(Dec * PI / 180) * Sin(Latitude * PI / 180) - Cos(Dec * PI / 180) * Cos(Latitude * PI / 180) * Cos(H * PI / 180)
|
||||
Hauteur = Arsin(Sin_hauteur) * 180 / PI
|
||||
End Function
|
||||
|
||||
Function Azimuth(Dec As Single, Lat As Single, H As Single, Haut As Single) As Single
|
||||
Dim Cosazimuth, Sinazimuth, test, Az As Single
|
||||
PI = 3.14159
|
||||
Cosazimuth = (Sin(Dec * PI / 180) - Sin(Lat * PI / 180) * Sin(Haut * PI / 180)) / (Cos(Lat * PI / 180) * Cos(Haut * PI / 180))
|
||||
Sinazimuth = (Cos(Dec * PI / 180) * Sin(H * PI / 180)) / Cos(Haut * PI / 180)
|
||||
If (Sinazimuth > 0) Then Az = Arcos(Cosazimuth) * 180 / PI Else Az = -Arcos(Cosazimuth) * 180 / PI
|
||||
If (Az < 0) Then Azimuth = 360 + Az Else Azimuth = Az
|
||||
End Function
|
||||
]]
|
||||
|
||||
function horizontal() -- returns horizontal from equatorial coordinates
|
||||
haut = math.asin(math.sin(lat) * math.sin(dec) + math.cos(lat) * math.cos(dec) * math.cos(timsid - ra))
|
||||
azmt = math.atan2(math.sin(timsid - ra), math.sin(lat) * math.cos(timsid - ra) - math.cos(lat) * math.tan(dec))
|
||||
azmt = azmt + 2 * math.pi * bool_to_number[azmt < 0]
|
||||
end
|
||||
|
||||
|
||||
|
||||
print "toto"
|
||||
print(math.deg(haut),math.deg(azmt))
|
||||
horizontal()
|
||||
print(math.deg(haut),math.deg(azmt))
|
||||
101
Astro lolo/equa2azim3.lua
Normal file
101
Astro lolo/equa2azim3.lua
Normal file
@@ -0,0 +1,101 @@
|
||||
-- script en LUA pour calculer les coordonnées horizontale (hauteur/azimut) depuis une coordonnée équatoriale
|
||||
-- le but du jeu c'était de convertir script JS en LUA pour le NodeMCU avec asservissement d'un
|
||||
-- télescope à monture azimutale.
|
||||
-- le problème avec le LUA embarqué sur NodeMCU c'est qu'il n'y a pas de fonctions trigo :-(
|
||||
-- zf180814.0753
|
||||
-- source: https://astronomy.stackexchange.com/questions/15013/calculating-azimuth-from-equatorial-coordinates
|
||||
-- source: https://www.webastro.net/forums/topic/145571-convertir-coordonn%C3%A9es-alto-azimutales-en-%C3%A9quatoriale-et-vice-versa/
|
||||
|
||||
|
||||
-- ce n'est pas terminé !
|
||||
|
||||
|
||||
--[[ ancien code en js https:astronomy.stackexchange.com/questions/15013/calculating-azimuth-from-equatorial-coordinates
|
||||
a=arctan2(sin(θ−α),sinφ∗cos(θ−α)−cosφ∗tanδ)
|
||||
Where
|
||||
φ = geographic latitude of the observer (here: 0°)
|
||||
θ = sidereal time (here: 0°)
|
||||
δ = declination
|
||||
α = right ascension
|
||||
|
||||
obliq = math.rad(23.44) -- obliquity of ecliptic
|
||||
lat2 = math.rad(0) -- observer's latitude
|
||||
lmst = math.rad(0) -- siderial time
|
||||
|
||||
function equatorial(lat, lon)
|
||||
-- returns equatorial from ecliptic coordinates
|
||||
dec = math.asin( math.cos(obliq) * math.sin(lat) + math.sin(obliq) * math.cos(lat) * math.sin(lon))
|
||||
ra = math.atan2(math.cos(obliq) * math.sin(lon) - math.sin(obliq) * math.tan(lat) , math.cos(lon))
|
||||
ra = ra + 2 * math.pi * bool_to_number[ra < 0]
|
||||
return dec, ra
|
||||
end
|
||||
]]
|
||||
|
||||
|
||||
lat = math.rad(46.52) -- latitude de l'observateur
|
||||
long = math.rad(6.55) -- longitude de l'observateur
|
||||
|
||||
timsid = math.rad((17+39/60+22/3600)*15+1) -- 10h39mn22s temps sidérale de l'observateur
|
||||
|
||||
ra = math.rad(18+12/60+56/3600) -- 18h12mn56, -22o38'34 ascension droite de la coordonnée équatoriale de l'objet céleste
|
||||
dec = math.rad(-(22+38/60+34/3600)) -- -22o38'34 déclinaison de la coordonnée équatoriale de l'objet céleste
|
||||
|
||||
haut = math.rad(20+45/60) -- +20o45 hauteur de la coordonnée horizontale du télescope
|
||||
azmt = math.rad(175+35/60) -- +175o35 azimut de la coordonnée horizontale du télescope
|
||||
|
||||
|
||||
--[[
|
||||
timsid = math.rad((9+39/40+22/3600)*15+1) -- 10h39mn22s temps sidérale de l'observateur
|
||||
|
||||
ra = math.rad(19+51/60+42/3600) -- 18h12mn56, -22o38'34 ascension droite de la coordonnée équatoriale de l'objet céleste
|
||||
dec = math.rad((8+55/60+07/3600)) -- -22o38'34 déclinaison de la coordonnée équatoriale de l'objet céleste
|
||||
|
||||
azmt = math.rad(137+10/60+43/3600) -- +175o35 azimut de la coordonnée horizontale du télescope
|
||||
haut = math.rad(44+55/60+60/3600) -- +20o45 hauteur de la coordonnée horizontale du télescope
|
||||
]]
|
||||
|
||||
|
||||
|
||||
|
||||
bool_to_number={ [true]=1, [false]=0 }
|
||||
|
||||
|
||||
--[[ code en VBA https://www.webastro.net/forums/topic/145571-convertir-coordonn%C3%A9es-alto-azimutales-en-%C3%A9quatoriale-et-vice-versa/
|
||||
Function Arsin(ByVal X As Single) As Single
|
||||
If (Abs(X) >= 1) Then Arsin = 0 Else Arsin = Atn(X / Sqr(-X * X + 1))
|
||||
End Function
|
||||
|
||||
Function Arcos(ByVal X As Single) As Single
|
||||
If (Abs(X) >= 1) Then Arcos = 0 Else Arcos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
|
||||
End Function
|
||||
|
||||
Function Hauteur(Dec As Single, Latitude As Single, H As Single) As Single
|
||||
Dim Sin_hauteur, PI As Single
|
||||
PI = 3.14159
|
||||
Sin_hauteur = Sin(Dec) * Sin(Latitude) - Cos(Dec) * Cos(Latitude) * Cos(H)
|
||||
Hauteur = Arsin(Sin_hauteur) * 180 / PI
|
||||
End Function
|
||||
|
||||
Function Azimuth(Dec As Single, Lat As Single, H As Single, Haut As Single) As Single
|
||||
Dim Cosazimuth, Sinazimuth, test, Az As Single
|
||||
PI = 3.14159
|
||||
Cosazimuth = (Sin(Dec) - Sin(Lat) * Sin(Haut)) / (Cos(Lat) * Cos(Haut))
|
||||
Sinazimuth = (Cos(Dec) * Sin(H)) / Cos(Haut)
|
||||
If (Sinazimuth > 0) Then Az = Arcos(Cosazimuth) * 180 / PI Else Az = -Arcos(Cosazimuth) * 180 / PI
|
||||
If (Az < 0) Then Azimuth = 360 + Az Else Azimuth = Az
|
||||
End Function
|
||||
]]
|
||||
|
||||
function horizontal() -- returns horizontal from equatorial coordinates
|
||||
haut = math.asin(math.sin(dec) * math.sin(lat) - math.cos(dec) * math.cos(lat) * math.cos(timsid))
|
||||
-- azmt = math.atan2(math.sin(dec) - math.sin(lat) * math.sin(ra) / math.cos(lat) * math.cos(ra) , math.cos(dec) * math.sin(timsid) / math.cos(ra))
|
||||
azmt = math.atan2(math.cos(dec) * math.sin(timsid) / math.cos(ra) , math.sin(dec) - math.sin(lat) * math.sin(ra) / math.cos(lat) * math.cos(ra))
|
||||
azmt = azmt + 2 * math.pi * bool_to_number[azmt < 0]
|
||||
end
|
||||
|
||||
|
||||
|
||||
print "toto"
|
||||
print(math.deg(haut),math.deg(azmt))
|
||||
horizontal()
|
||||
print(math.deg(haut),math.deg(azmt))
|
||||
191
Astro lolo/equa2azim4.lua
Normal file
191
Astro lolo/equa2azim4.lua
Normal file
@@ -0,0 +1,191 @@
|
||||
-- script en LUA pour calculer les coordonnées horizontales (hauteur/azimut) depuis une coordonnée équatoriale
|
||||
-- pour en faire un asservissement d'un télescope à monture azimutale.
|
||||
-- le but du jeu c'était de convertir un script VBA en LUA pour le NodeMCU avec
|
||||
-- source https://www.webastro.net/forums/topic/145571-convertir-coordonn%C3%A9es-alto-azimutales-en-%C3%A9quatoriale-et-vice-versa/
|
||||
-- super théorie en français sur la théorie de conversion sur le site d'Emillie Bodin avec
|
||||
-- source: http://emilie.bodin.free.fr/logiciel/logicielframe.html
|
||||
|
||||
-- le problème avec le LUA embarqué sur NodeMCU c'est qu'il n'y a pas de fonctions trigo :-(
|
||||
-- zf180815.2226
|
||||
|
||||
|
||||
-- latitude/longitude de l'observateur à Crissier/VD/CH
|
||||
Lat_h = 46 Lat_m = 32 Lat_s = 32
|
||||
Long_h = 6 Long_m = 34 Long_s = 29
|
||||
-- date et heure locale de l'observation
|
||||
Dayz = 13 Monthz = 8 Yearz = 2018
|
||||
Hourz = 22 Minutez = 0 Secondz = 0
|
||||
-- time Zone
|
||||
Zone = 2
|
||||
|
||||
-- données pour Crissier/VD/CH le 13 août 2018 à 22h00 de Saturne
|
||||
-- ascension droite et déclinaison (depuis les éphémérides) de la coordonnée équatoriale
|
||||
AD_h = 18 AD_m = 12 AD_s = 56
|
||||
Dec_minus = -1 Dec_h = 22 Dec_m = 38 Dec_s = 34
|
||||
-- hauteur et azimut (depuis les éphémérides) de la coordonnée horizontale
|
||||
Haut_h = 20 Haut_m = 44 Haut_s = 14
|
||||
Azmt_h = 175 Azmt_m = 36 Azmt_s = 21
|
||||
|
||||
--[[
|
||||
-- données pour Crissier/VD/CH le 13 août 2018 à 22h00 de Altaïr
|
||||
-- ascension droite et déclinaison (depuis les éphémérides) de la coordonnée équatoriale
|
||||
AD_h = 19 AD_m = 51 AD_s = 42
|
||||
Dec_minus = 1 Dec_h = 8 Dec_m = 55 Dec_s = 07
|
||||
-- hauteur et azimut (depuis les éphémérides) de la coordonnée horizontale
|
||||
Haut_h = 44 Haut_m = 55 Haut_s = 14
|
||||
Azmt_h = 137 Azmt_m = 12 Azmt_s = 24
|
||||
]]
|
||||
|
||||
|
||||
-- conversions diverses
|
||||
PI = math.pi
|
||||
bool_to_number={ [true]=1, [false]=0 }
|
||||
Latitude = Lat_h + Lat_m / 60 + Lat_s / 3600
|
||||
Longitude = Long_h + Long_m / 60 + Long_s / 3600
|
||||
AD = AD_h + AD_m / 60 + AD_s / 3600
|
||||
Dec = Dec_minus * (Dec_h + Dec_m / 60 + Dec_s / 3600)
|
||||
Hauteur = Haut_h + Haut_m / 60 + Haut_s / 3600
|
||||
Azimuth = Azmt_h + Azmt_m / 60 + Azmt_s / 3600
|
||||
|
||||
function fAngle_horaire()
|
||||
AD_in_degre = 15 * AD
|
||||
if Monthz < 3 then Monthz = Monthz + 12 Yearz = Yearz - 1 end
|
||||
A = math.floor(Yearz / 100) B = 2 - A + math.floor(A / 4)
|
||||
C = math.floor(365.25 * Yearz) D = math.floor(30.6001 * (Monthz + 1))
|
||||
JJ = B + C + D + Dayz + 1720994.5 T = (JJ - 2451545) / 36525
|
||||
H1 = 24110.54841 + (8640184.812866 * T) + (0.093104 * (T * T)) - (0.0000062 * (T * T * T))
|
||||
HSH = H1 / 3600 HS = ((HSH / 24) - math.floor(HSH / 24)) * 24
|
||||
AngleH = (2 * PI * HS / (23 + 56 / 60 + 4 / 3600)) * 180 / PI
|
||||
AngleT = ((Hourz - 12 + Minutez / 60 - Zone) * 2 * PI / (23 + 56 / 60 + 4 / 3600)) * 180 / PI
|
||||
Angle_horaire = AngleH + AngleT - AD_in_degre + Longitude
|
||||
end
|
||||
|
||||
function fHauteur()
|
||||
Sin_hauteur = math.sin(Dec * PI / 180) * math.sin(Latitude * PI / 180) - math.cos(Dec * PI / 180) * math.cos(Latitude * PI / 180) * math.cos(Angle_horaire * PI / 180)
|
||||
Hauteur = math.asin(Sin_hauteur) * 180 / PI
|
||||
end
|
||||
|
||||
function fAzimuth()
|
||||
Cosazimuth = (math.sin(Dec * PI / 180) - math.sin(Latitude * PI / 180) * math.sin(Hauteur * PI / 180)) / (math.cos(Latitude * PI / 180) * math.cos(Hauteur * PI / 180))
|
||||
Sinazimuth = (math.cos(Dec * PI / 180) * math.sin(Angle_horaire * PI / 180)) / math.cos(Hauteur * PI / 180)
|
||||
if (Sinazimuth > 0) then Az = math.acos(Cosazimuth) * 180 / PI else Az = -math.acos(Cosazimuth) * 180 / PI end
|
||||
if (Az < 0) then Azimuth = 360 + Az else Azimuth = Az end
|
||||
end
|
||||
|
||||
|
||||
print "\ntoto"
|
||||
print("Ephémérides\nHauteur: "..Hauteur..", Azimuth: "..Azimuth)
|
||||
fAngle_horaire()
|
||||
--print("Heure sidérale: "..HS..", Angle horaire: "..Angle_horaire)
|
||||
fHauteur()
|
||||
fAzimuth()
|
||||
print("Calculée\nHauteur: "..Hauteur..", Azimuth: "..Azimuth)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--[[code en VBA https://www.webastro.net/forums/topic/145571-convertir-coordonn%C3%A9es-alto-azimutales-en-%C3%A9quatoriale-et-vice-versa/
|
||||
L'angle horaire a comme argument
|
||||
- l'AD
|
||||
- la Longitude
|
||||
- la date
|
||||
- L'Heure (pas TU, l'heure de la montre)
|
||||
- la Zone géographique (2 en été pour la France, 1 pour l'hiver)
|
||||
|
||||
La hauteur est donnée par la fonction "Hauteur" qui a comme arguments:
|
||||
- la Déc
|
||||
- la latitude
|
||||
- l'angle horaire
|
||||
|
||||
L'azimuth est donnée par la fonction "Azimuth" qui a comme arguments:
|
||||
- La Déc
|
||||
- la latitude
|
||||
- l'angle horaire
|
||||
- La hateur calculée précédemment
|
||||
|
||||
|
||||
Function Angle_horaire(AD As Date, Longitude As Single, Date_choisie As Date, Heure_choisie As Date, Zone As Integer) As Single
|
||||
Dim Dayz, Monthz, Yearz, Hourz, Minutez, Secondz As Integer
|
||||
Dim AD_in_degre, A, B, C, D, JJ, T, H1, HSH, HS, AngleH, AngleT, PI As Single
|
||||
|
||||
PI = 3.14159
|
||||
Dayz = Day(Date_choisie)
|
||||
Monthz = Month(Date_choisie)
|
||||
Yearz = Year(Date_choisie)
|
||||
Hourz = Hour(Heure_choisie)
|
||||
Minutez = Minute(Heure_choisie)
|
||||
Secondz = Second(Heure_choisie)
|
||||
|
||||
AD_in_degre = 15 * (Hour(AD) + Minute(AD) / 60 + Second(AD) / 3600)
|
||||
If (Monthz < 3) Then
|
||||
Monthz = Monthz + 12
|
||||
Yearz = Yearz - 1
|
||||
End If
|
||||
A = Int(Yearz / 100)
|
||||
B = 2 - A + Int(A / 4)
|
||||
C = Int(365.25 * Yearz)
|
||||
D = Int(30.6001 * (Monthz + 1))
|
||||
JJ = B + C + D + Dayz + 1720994.5
|
||||
T = (JJ - 2451545) / 36525
|
||||
H1 = 24110.54841 + (8640184.812866 * T) + (0.093104 * (T * T)) - (0.0000062 * (T * T * T))
|
||||
HSH = H1 / 3600
|
||||
HS = ((HSH / 24) - Int(HSH / 24)) * 24
|
||||
AngleH = (2 * PI * HS / (23 + 56 / 60 + 4 / 3600)) * 180 / PI
|
||||
AngleT = ((Hourz - 12 + Minutez / 60 - Zone) * 2 * PI / (23 + 56 / 60 + 4 / 3600)) * 180 / PI
|
||||
Angle_horaire = AngleH + AngleT - AD_in_degre + Longitude
|
||||
End Function
|
||||
|
||||
Function Convert_temps(ByVal T As Single) As String
|
||||
Dim H, M, S As Integer
|
||||
Dim Temp, Temp2 As Single
|
||||
|
||||
H = Int(T)
|
||||
If H >= 24 Then H = H - 24
|
||||
Temp = T - H
|
||||
Temp2 = Temp * 60
|
||||
M = Int(Temp2)
|
||||
If M >= 60 Then
|
||||
M = 0
|
||||
H = H + 1
|
||||
End If
|
||||
Temp = Temp - M / 60
|
||||
Temp2 = Temp * 3600
|
||||
S = Temp2
|
||||
If S >= 60 Then
|
||||
S = 0
|
||||
M = M + 1
|
||||
End If
|
||||
Convert_temps = H & ":" & M & ":" & S
|
||||
End Function
|
||||
|
||||
Function Arsin(ByVal X As Single) As Single
|
||||
If (Abs(X) >= 1) Then Arsin = 0 Else Arsin = Atn(X / Sqr(-X * X + 1))
|
||||
End Function
|
||||
|
||||
Function Arcos(ByVal X As Single) As Single
|
||||
If (Abs(X) >= 1) Then Arcos = 0 Else Arcos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
|
||||
End Function
|
||||
|
||||
Function Hauteur(Dec As Single, Latitude As Single, H As Single) As Single
|
||||
Dim Sin_hauteur, PI As Single
|
||||
|
||||
PI = 3.14159
|
||||
Sin_hauteur = Sin(Dec * PI / 180) * Sin(Latitude * PI / 180) - Cos(Dec * PI / 180) * Cos(Latitude * PI / 180) * Cos(H * PI / 180)
|
||||
Hauteur = Arsin(Sin_hauteur) * 180 / PI
|
||||
End Function
|
||||
|
||||
Function Azimuth(Dec As Single, Lat As Single, H As Single, Haut As Single) As Single
|
||||
Dim Cosazimuth, Sinazimuth, test, Az As Single
|
||||
|
||||
PI = 3.14159
|
||||
Cosazimuth = (Sin(Dec * PI / 180) - Sin(Lat * PI / 180) * Sin(Haut * PI / 180)) / (Cos(Lat * PI / 180) * Cos(Haut * PI / 180))
|
||||
Sinazimuth = (Cos(Dec * PI / 180) * Sin(H * PI / 180)) / Cos(Haut * PI / 180)
|
||||
If (Sinazimuth > 0) Then Az = Arcos(Cosazimuth) * 180 / PI Else Az = -Arcos(Cosazimuth) * 180 / PI
|
||||
If (Az < 0) Then Azimuth = 360 + Az Else Azimuth = Az
|
||||
End Function
|
||||
]]
|
||||
Reference in New Issue
Block a user