def _calc_ECI(self):
        ''' calc position in ECI reference from time:LMST and pos:LLA'''

        self._df_clear("time")  # clear dirty flags
        self._df_clear("pos")

        a = wgs72_complete["radiusearthkm"]
        e2 = wgs72_complete["e^2"]

        phi = self._geo_lat
        lambd = self.sidereal_get_LMST()
        h = self._geo_alti / 1000  # m to km

        sin_phi = math_helper.sin_deg(phi)
        cos_phi = math_helper.cos_deg(phi)
        sin_lambd = math_helper.sin_deg(lambd)
        cos_lambd = math_helper.cos_deg(lambd)

        # [Günter Seeber, "Satellite Geodesy", 2nd edition] page 24

        # N is the radius of curvature in the prime vertical:
        # N = a / sqrt( 1 - (e^2)*(sin(lat)^2) )
        # EQUATION (2.36)
        N = a / math.sqrt(1 - e2 * (sin_phi**2))

        # EQUATION (2.35)
        self._eci_x = (N + h) * cos_phi * cos_lambd
        self._eci_y = (N + h) * cos_phi * sin_lambd
        self._eci_z = ((1 - e2) * N + h) * sin_phi
Пример #2
0
    def _calc_topoc_equator_spherical(self):
        ''' computes [Position Angles] and [Angular Velocities] 
            ([Right Ascencion] and [Declination]) 
            in [TOPOcentric Equatorial Coordinate System] of the Sat
            relavtive to the telescope.
            (Center = [surface position],
            References: [Earth axis] / [Equatorial plane] and
                the direction to the [Vernal equinox].) '''

        # Berechnung is aehnlich zu GEOzentrisch spherical,
        #   JEDOCH ist (x,y,z) der vektor vom telescop zum satelliten
        #   und fuer (x',y',z') muss x',y' vom teleskop berechnet werden

        # -------------
        # get cartesian corrdinates
        xp, yp, zp = self._topocentr_equator["cartesian"]["vel"]
        x, y, z = self._topocentr_equator["cartesian"]["pos"]
        r = math_helper.vector_abs((x, y, z))

        # -------------
        # calc spherical coordinates

        # -------------
        # ANGULAR POSITION

        Ra = math_helper.atan2_deg(y, x)
        De = math_helper.asin_deg(z / r)

        self._topocentr_equator["spherical"]["pos"]["Ra"] = Ra
        self._topocentr_equator["spherical"]["pos"]["De"] = De
        self._topocentr_equator["spherical"]["pos"]["R"] = r

        # -------------
        # ANGULAR VELOCITY

        # x,y,z = f(t)
        # r = f(t) = sqrt(x^2+y^2+z^2)

        # Ra = atan(y/x)
        # d( atan(y(t)/x(t)) )/dt = (x*y' - y*x')/(x^2+y^2)   in rad/s
        Ra_dot = math.degrees((x * yp - y * xp) / (x**2 + y**2))

        # De = asin(z/r)
        # d( asin(z(t)/r(t)) )/dt =
        #       z' - z/(r^2) * (x*x'+y*y'+z*z')
        #   = ------------------------------    in rad/s
        #           sqrt(r^2 - z^2)
        De_dot = math.degrees((zp - z / (r**2) * (x * xp + y * yp + z * zp)) /
                              math.sqrt(r**2 - z**2))

        self._topocentr_equator["spherical"]["vel"]["Ra"] = Ra_dot
        self._topocentr_equator["spherical"]["vel"]["De"] = De_dot
    def __calc_equatorialCoordinates(self): 
        ''' calculates position in equatorial coords from ecliptic '''
        
        import math
        Jcty = self._TSMgr.time_get_julianCenturiesJ2000()
        
        Lam_deg = self._moonCoordinates["ecl_Lon"] # Lambda
        Bet_deg = self._moonCoordinates["ecl_Lat"] # Beta
        Eps_deg = MH.eps_deg(Jcty)                 # Epsilon
        
        sinLam = MH.sin_deg(Lam_deg)
        cosLam = MH.cos_deg(Lam_deg)        
        sinBet = MH.sin_deg(Bet_deg)
        cosBet = MH.cos_deg(Bet_deg)
        sinEps = MH.sin_deg(Eps_deg)
        cosEps = MH.cos_deg(Eps_deg)
        
        # [o. Montenbruck] "Grundlagen der Ephemeridenrechnung" S.14
#        cos(del)*cos(alp) = cos(bet)*cos(lam)
#        cos(del)*sin(alp) = cos(eps)*cos(bet)*sin(lam) - sin(eps)*sin(bet)
#        sin(del)          = sin(eps)*cos(bet)*sin(lam) + cos(eps)*sin(bet)
        
        Del_rad = math.asin( sinEps*cosBet*sinLam + cosEps*sinBet )
        Del_deg = math.degrees(Del_rad)
        cosDel = math.cos(Del_rad)
        
        cosAlp = (cosBet*cosLam) / cosDel
        sinAlp = (cosEps*cosBet*sinLam - sinEps*sinBet) / cosDel
        
        Alp_deg = MH.atan2_deg(sinAlp,cosAlp)%360
        
        self._moonCoordinates["equa_Lon"] = Alp_deg # Alpha / RA
        self._moonCoordinates["equa_Lat"] = Del_deg # Delta / DE
Пример #4
0
    def _propagate(self):
        ''' Calculates [Position] and [Velocity] in [Cartesian Coordinate 
            System] for the [GEOcentric AND TOPOcentric Equatorial System] 
            for the statet utc time.
            (Center = [Earth Center], [Surface position],
            References: [Earth axis] / [Equatorial plane] and
                the direction to the [Vernal equinox].) '''

        # get utc time of TSMgr object
        t = self._TSMgr.time_get_utcDateTime()

        # -------------
        # calc pos and vel for GEOcentr cartesian coordins of SAT

        pos_sat, vel_sat = self._sat.propagate(t.year, t.month, t.day, t.hour,
                                               t.minute,
                                               t.second + t.microsecond * 1e-6)

        self._geocentr_equator["cartesian"]["pos"] = pos_sat
        self._geocentr_equator["cartesian"]["vel"] = vel_sat

        # -------------
        # calc pos and vel for GEOcentr cartesian coordins of TELE

        #get geocentr pos of tele
        pos_tele = self._TSMgr.pos_get_ECI()

        #calc geocentr vel of tele
        # Formel fuer kartesiches koordinatensystem:
        #   drehender pfeil in xy ebene mit w = winkelgeschw.
        w = wgs72_complete["omega_RadPerSec"]  # winkelgeschw in xy ebene
        vel_tele = [0, 0, 0]
        vel_tele[0] = w * pos_tele[1]  # x' =   w*y
        vel_tele[1] = -w * pos_tele[0]  # y' = - w*x
        vel_tele[2] = 0  # z' = 0    # (erdrotation in z) = 0

        # -------------
        # calc pos and vel for TOPOcentr cartesian coordins of SAT(fromTELE)

        #topocentr pos of sat = [geocentr pos of sat] - [geocentr pos of tele]
        pos_topo = math_helper.vector_sub(pos_sat, pos_tele)
        vel_topo = math_helper.vector_sub(vel_sat, vel_tele)

        self._topocentr_equator["cartesian"]["pos"] = tuple(pos_topo)
        self._topocentr_equator["cartesian"]["vel"] = tuple(vel_topo)
    def __init__(self, TSMgrObj: TSMgr.TimeSpaceMgr, planet: str):
        ''' Create a planet by its name,
            with reference to a TimeSpaceMgr object
            (preferably one for all planets). '''
        print("PLANET: " + str(planet))

        # default values
        self._successPlanet = False
        self._planetName = None
        self._TSMgr = None

        if (planet.lower() in Planetlist.Planetlist
                and planet.lower() != "earth"):
            #wenn planet sich in der liste bekannter planeten befindet

            self._planetName = planet.lower()
            self._TSMgr = TSMgrObj  # reference to the global TSMgr

            Jcty = self._TSMgr.time_get_julianCenturiesJ2000()
            self._keplerPlanet = Planetlist.getCurrentKeplerElem(
                self._planetName, Jcty)  #get kepler elements
            self._keplerEarth = Planetlist.getCurrentKeplerElem(
                "earth", Jcty)  #get kepler elements

            # astronomical almanach 2018
            # schiefe der eklitptic epsilon = epsJ2000 + epsDot * T
            # T = julian centuries since J2000
            # epsJ2000 = 84381.406 arcsec
            # epsDot =  -46.836769 arcsec per julian century
            #            self._eps = (84381.406 -
            #                         46.836769*self._TSMgr.time_get_julianCenturiesJ2000()
            #                         )/3600
            self._eps = MH.eps_deg(Jcty)

            # astronomic unit in km
            self._AU = 149597870.7

            self._successPlanet = True
    def calcPos(self, utcDateTime=None):
        # es müssen position von erde und planet immer gleichzeitig
        # berechnet werden, da wir den relativen richtungsvektor
        # zwischen beiden benötigen (und alles im heliozentr koord sys
        # berechnet wird)
        import src.EPH.EPH_ADD_math_helper as math_helper
        from src.EPH.EPH_ADD_wgs72_complete import wgs72_complete

        #update time in TSMgr
        #self._TSMgr.time_set_utcDateTime(utcDateTime)

        # -------------------------------------------------------------------
        #get kepler elements
        Jcty = self._TSMgr.time_get_julianCenturiesJ2000()
        self._keplerPlanet = Planetlist.getCurrentKeplerElem(
            self._planetName, Jcty)  #get kepler elements
        self._keplerEarth = Planetlist.getCurrentKeplerElem(
            "earth", Jcty)  #get kepler elements

        # -------------------------------------------------------------------
        # get eccentric anomaly with KEPLER EQUATION (newton verfahren)
        # PLANET
        self._keplerPlanet["E"] = Planetlist.keplerEquation(
            self._keplerPlanet["M"], self._keplerPlanet["e"])
        # EARTH
        self._keplerEarth["E"] = Planetlist.keplerEquation(
            self._keplerEarth["M"], self._keplerEarth["e"])

        # -------------------------------------------------------------------
        # heliocentric coordinates in the planet's orbital plane
        # x-axis aligned from focus towards perihelion
        # PLANET
        xyzHelioOrbitP = self.__calc_helio_orbit_from_kepler(
            self._keplerPlanet)

        # EARTH
        xyzHelioOrbitE = self.__calc_helio_orbit_from_kepler(self._keplerEarth)

        # -------------------------------------------------------------------
        # heliocentric coordinates in the ecliptic plane (earths orbit)
        # x-axis aligned towards the equinox
        # PLANET
        xyzHelioEclP = self.__calc_helio_ecliptical_from_helio_orbit(
            xyzHelioOrbitP, self._keplerPlanet)

        # EARTH
        xyzHelioEclE = self.__calc_helio_ecliptical_from_helio_orbit(
            xyzHelioOrbitE, self._keplerEarth)

        # -------------------------------------------------------------------
        # relativer vektor von erde zu planet (Erde2Planet) im heliocentr.
        # ekliptikalen kartes. koordin system (entspricht geozentr.
        # ekliptikalen kartes. koord system)
        # Sonne2Planet = Sonne2Erde + Erde2Planet
        # Erde2Planet = Sonne2Planet - Sonne2Erde
        xyzHelioEcl_E2P = math_helper.vector_sub(xyzHelioEclP, xyzHelioEclE)

        # (entspricht geozentr. ekliptikalen kartes. koord system)
        planetGeoEclCartesian = tuple(xyzHelioEcl_E2P)

        # -------------------------------------------------------------------
        # an dieser stelle ist der relative vektor vom zentrum der erde zum
        # gesuchten planeten im heliocentr, ecliptical cartes. coord sys
        # bekannt - es folgen umrechungen in koordin systeme für die
        # beobachtung von der erde aus.
        # -------------------------------------------------------------------

        # drehe koordinate von ekliptical zu equatorial
        planetGeoEquCartesian = self.__rotate_from_ecliptical_to_equatorial(
            planetGeoEclCartesian, self._eps)

        #get geocentr equatorial pos of tele in KM!!!
        pos_tele_GeoEquCartesian = self._TSMgr.pos_get_ECI()

        planetTopoEquCartesian = [0, 0, 0]
        # um parallax effekte zu vermeiden, wird die position des teleskops
        # abgezogen.
        # Im falle von Mars würde die maximale parallaxe bei seinem letzten
        # Closest approach in 2018 Jul 27 (näheste annäherung an die erde)
        # ca 22.78 arcsec betragen (dist_min = 0.386 AU,
        # parallax_max = asin(earthradius in km / dist in km ),
        # parallax_max = asin(6378/57744778) )
        for k in range(3):
            planetTopoEquCartesian[k] = (
                planetGeoEquCartesian[k] -
                pos_tele_GeoEquCartesian[k] / self._AU)

#        # wandle in spherical koordinaten um
#        planetGeoEquSpherical = self.__calc_spherical_from_cartesian(
#                planetGeoEquCartesian)

# wandle in spherical koordinaten um
        planetTopoEquSpherical = self.__calc_spherical_from_cartesian(
            planetTopoEquCartesian)

        return {
            "Ra": planetTopoEquSpherical[0],
            "De": planetTopoEquSpherical[1],
            "R": planetTopoEquSpherical[2]
        }
    def calcMoonCoords_1stSolution(self):
        # self.__meanArgs_checkDF()
        self.calcMoonMeanArgumentsFromDate()
        
        L0 = self._moonMeanArguments['L0']
        l  = self._moonMeanArguments['l']
        l_ = self._moonMeanArguments['l_']
        F  = self._moonMeanArguments['F']
        D  = self._moonMeanArguments['D']
#        print('L0   ',L0)
#        print('l    ',l)
#        print('l_   ',l_)
#        print('F    ',F)
#        print('D    ',D)
        
        term = [None]*13
        
        term[0] = (
                22640 * MH.sin_deg(l) + 
                769   * MH.sin_deg(2*l) + 
                36    * MH.sin_deg(3*l) )       #grosse ungleicheit
        
        term[1] = -4586  * MH.sin_deg(l-2*D)    #evektion
        term[2] = 2370   * MH.sin_deg(2*D)      #variation
        term[3] = -668   * MH.sin_deg(l_)       #jaehrliche ungleichheit
        term[4] = -412   * MH.sin_deg(2*F)      #differenz in bahnlaenge und ekliptikaler laenge
        term[5] = -212   * MH.sin_deg(2*l-2*D)
        term[6] = -206   * MH.sin_deg(l+l_-2*D)
        term[7] = 192    * MH.sin_deg(l+2*D)
        term[8] = -165   * MH.sin_deg(l_-2*D)
        term[9] = 148    * MH.sin_deg(l-l_)
        term[10] = -125  * MH.sin_deg(D)        #paralaktiche gleichung
        term[11] = -110  * MH.sin_deg(l+l_)
        term[12] = -55   * MH.sin_deg(2*F-2*D)
            
        ecl_Laenge = L0 + sum(term)/3600
        self._moonCoordinates["ecl_Lon"] = ecl_Laenge %360


        # Reset des "term" Arrays
        term = [None]*8
        
        term[0] = 18520* MH.sin_deg( F + ecl_Laenge - L0 + 
            0.114*MH.sin_deg(2*F) +0.15*MH.sin_deg(l_) )    
        
        term[1] = -526 * MH.sin_deg(    F - 2*D       )
        term[2] =   44 * MH.sin_deg(    l +   F - 2*D )
        term[3] =  -31 * MH.sin_deg(   -l +   F - 2*D )
        term[4] =  -25 * MH.sin_deg( -2*l +   F       )
        term[5] =  -23 * MH.sin_deg(   l_ +   F - 2*D )
        term[6] =   21 * MH.sin_deg(   -l +   F       )
        term[7] =   11 * MH.sin_deg(  -l_ +   F - 2*D )
            
        self._moonCoordinates["ecl_Lat"] = sum(term)/3600
        
        # ergebnis ist im ekliptischen koordsys
        # wird benötigt im äquatorialen koordsys
        self.__calc_equatorialCoordinates()