config['depart'] = { 'lon': LON_UT_DEP, 'lat': LAT_UT_DEP, 'h': H_UT_DEP, } config['arrivee'] = { 'lon': LON_UT_AR, 'lat': LAT_UT_AR, 'h': H_UT_AR, } with open('trajet.cfg', 'w') as configfile: config.write(configfile) ## Trajet coord_lon_ut = LON_UT_DEP, LON_UT_AR, LON_UT, LON_INI coord_lat_ut = LAT_UT_DEP, LAT_UT_AR, LAT_UT, LAT_INI contour = affichage.trajet_ut(coord_lon_ut, coord_lat_ut) ## zoom affichage.zoom_depart(P0, PSOL, LON_UT, LAT_UT) ## calcul du cercle de visibilité DLAT_VIS, DLON = calc_cercle_visi() ## début de la simulation simulation_gps.main(DLAT_VIS, DLON, contour) plt.ioff() input("\aAppuyez sur Entrée pour quitter") #plt.show()
def main(DLAT_VIS, DLON, contour): P0 = POSINIT ######################################################## # Simulation de l'évolution de la constellation # Simulation de la triangulation ######################################################## ## initialisation des plots point_trajet, = plt.plot([], [], marker='*', color='k', markerfacecolor='g', markersize=12) cercleg, = plt.plot([], [], 'r-') cercled, = plt.plot([], [], 'r-') sat_plt = [] for k in range(NBSAT): sat_plt.append(plt.plot([], [], marker='d')[0]) # Boucle sur le temps for it in range(NBIT+1): ################################################ # Propagation des satellites ################################################ t = DEBUT + PAS * it coordsat, lons, lats = propagation(t) ################################################ # Position utilisateur ################################################ lon_ut, lat_ut, h_ut, Pexacte = calculs.calc_pos_ut(it) ################################################ # Determination des satellites visibles ################################################ nbvisi, indvisi = calculs.sat_visi(coordsat, Pexacte) ################################################ # Calcul de position ################################################ if nbvisi >= 4: # Acquisition des signaux TGps, TRecep, X, Y, Z = calculs.reception(coordsat, Pexacte, indvisi, nbvisi, t) # Triangulation PSOL = posFUN(P0, TGps, TRecep, X, Y, Z, c, Pexacte) #print('PSOL = \t\t\tPexacte = ') #print(np.array_str(np.concatenate((PSOL, Pexacte), 1))) time.sleep(0.25) ################################################ # Affichages ################################################ #try: fig1 = plt.figure(1) affichage.evo_constellation(P0, indvisi, lon_ut, lat_ut, DLAT_VIS, DLON, lons, lats, point_trajet, contour, cercleg, cercled, sat_plt, fig1) time.sleep(0.25) affichage.zoom_depart(P0, PSOL, lon_ut, lat_ut) #except Exception as e: # print("Fin prématurée : %s - %s !" % (type(e).__name__, e)) # break # Mémorisation position précédente P0 = PSOL print("Fin de la simulation\a")