def itrs_pos_sun(self): """Determine unit vector pointing from given position to Sun in ITRS The determination of the vector pointing from given position to Sun is based on Eq. 5.77 in :cite:`subirana2013`. Returns: numpy.ndarray: unit vectors pointing from given position to Sun in ITRS and in unit of meters """ # Get Sun position vector in ITRS eph = apriori.get( "ephemerides", time=self._time.tdb) # TODO: is self._time.tdb correct # TODO: # Actually the JPL ephemeris are given in the BCRS with Solar System barycenter as origin and not Earth mass # center. So in principle the sun position vector has to be transformed from the BCRS to the GCRS. What are # the consequences, if we do not consider these corrections? earth_sun = eph.itrs( "earth", "sun") # vector pointing from Earth to Sun mass center # Determination of vector between given position and Sun pos_sun = earth_sun - self.itrs_pos pos_sun_unit = mathp.unit_vector(pos_sun) # +DEBUG: Use same model as gLAB for determination of sun-earth vector # glab_sun_earth = gnss.findsun(self._time.tdb) # glab_pos_sun = glab_sun_earth - self.itrs_pos # pos_sun_unit = mathp.unit_vector(glab_pos_sun) # -DEBUG return pos_sun_unit
def _itrs2yaw(self): """Transformation matrix from ITRS to yaw-steering reference system The yaw-steering reference system given with x-axis lying in the Earth-Satellite-Sun plane, y-axis as the normal vector of the Earth-Satellite-Sun plane and the z-axis pointing to the Earth's center. Returns: numpy.ndarray: transformation matrix with shape (num_obs, 3, 3). """ z_unit = -mathp.unit_vector(self.itrs_pos) # unit vector of z-axis sat_sun_unit = self.itrs_pos_sun # unit vector pointing from satellite position to Sun y_unit = mathp.unit_vector(np.cross( z_unit, sat_sun_unit)) # unit vector of y-axis x_unit = mathp.unit_vector(np.cross(y_unit, z_unit)) # unit vector of x-axis itrs2yaw = np.stack((x_unit, y_unit, z_unit), axis=1) return itrs2yaw
def _itrs2acr(self): """Transformation matrix from ITRS to local orbital reference system given with along-track, cross-track and radial. Returns: numpy.ndarray: transformation matrix with shape (num_obs, 3, 3). """ r_unit = mathp.unit_vector( self.itrs_pos ) # unit vector of satellite position and in radial direction v_unit = mathp.unit_vector( self.itrs_vel) # unit vector of satellite velocity c_unit = mathp.unit_vector(np.cross( r_unit, v_unit)) # unit vector cross-track direction a_unit = mathp.unit_vector(np.cross( c_unit, r_unit)) # unit vector along-track direction itrs2acr = np.stack((a_unit, c_unit, r_unit), axis=1) return itrs2acr
def check_satellite_eclipse(dset): """Check if a satellite is an eclipse TODO: Check if a better algorithm exists (e.g. based on beta angle). Args: dset(Dataset): Model data """ cos_gamma = np.einsum( "ij,ij->i", mathp.unit_vector(dset.sat_posvel.itrs_pos), dset.sat_posvel.itrs_pos_sun ) # TODO: dot product -> better solution dot() function in mathp h = np.linalg.norm(dset.sat_posvel.itrs_pos, axis=1) * np.sqrt(1.0 - cos_gamma**2) satellites_in_eclipse = list() for satellite in dset.unique("satellite"): idx = dset.filter(satellite=satellite) satellite_eclipse = np.logical_and(cos_gamma[idx] < 0, h[idx] < constant.a) if np.any(satellite_eclipse == True): satellites_in_eclipse.append(satellite) return satellites_in_eclipse
def get_line_of_sight(dset): """Get the Line of Sight vector from receiver to satellite in the ITRS. """ # TODO: Other solution dset.site_pos.convert_gcrs_to_itrs(dset.site_pos.direction) return mathp.unit_vector(dset.sat_posvel.itrs_pos - dset.site_pos.itrs)