📄 ppf_pointing_c.c
字号:
} } /* Calling pp_stavis */ /* ----------------- */ n = 0; sprintf(msg[n++], "\n\nPP_STAVIS # %i\n", n_iter); pp_print_msg(&n, msg); status = pp_stavis(mjdp_t, pos_t, vel_t, acc_t, aocs_g, att, datt, sta, res_sta, ierr_s); if (status != PP_OK) { func_id = PP_STAVIS_ID; pp_vector_msg(&func_id, ierr_s, &n, msg); pp_print_msg(&n, msg); if (status <= PP_ERR) return(PP_ERR); } for (k=0; k<31; k++) { sprintf(msg[k], "- res_sta[%d]: %lf ", k, res_sta[k] ); } pp_print_msg(&k, msg); /* CAREFUL here, pp_print_msg handles only MAX_COD messages */ /* look up ppf_lib.h f r MAX_COD */ /* Calling pp_genstate_drs */ /* ----------------------- */ mjddrs[0] = mjdp_t[0]; mjddrs[1] = mjdp_t[1]; n = 0; sprintf(msg[n++], "\n\nPP_GENSTATE_DRS # %i seconds\n", n_iter); pp_print_msg(&n, msg); status = pp_genstate_drs(mjddrs, &longdrs, posdrs, veldrs, ierr_g); if (status != PP_OK) { func_id = PP_GENSTATE_DRS_ID; pp_vector_msg(&func_id, ierr_g, &n, msg); pp_print_msg(&n, msg); if (status <= PP_ERR) return(PP_ERR); } n = 0; sprintf(msg[n++], "- posdrs: %lf %lf %lf", posdrs[0], posdrs[1], posdrs[2] ); sprintf(msg[n++], "- veldrs: %lf %lf %lf", veldrs[0], veldrs[1], veldrs[2] ); pp_print_msg(&n, msg); /* Calling pp_drsvis */ /* ----------------- */ n = 0; sprintf(msg[n++], "\n\nPP_DRSVIS # %i seconds\n", n_iter); pp_print_msg(&n, msg); status = pp_drsvis(mjdp_t, pos_t, vel_t, acc_t, aocs_g, att, datt, mjddrs, posdrs, veldrs, res_drs, ierr_d); if (status != PP_OK) { func_id = PP_DRSVIS_ID; pp_vector_msg(&func_id, ierr_d, &n, msg); pp_print_msg(&n, msg); if (status <= PP_ERR) return(PP_ERR); } for (k=0; k<33; k++) { sprintf(msg[k], "- res_drs[%d]: %lf ", k, res_drs[k] ); } pp_print_msg(&k, msg); /* CAREFUL here, pp_print_msg handles only MAX_COD messages */ /* look up ppf_lib.h for MAX_COD */ /* Calling pp_target */ /* ----------------- */ n = 0; sprintf(msg[n++], "\n\nPP_TARGET # %i seconds\n", n_iter); pp_print_msg(&n, msg); status = pp_target(mjdp_t, pos_t, vel_t, acc_t, aocs_g, att, datt, &idir, dir, &iray, &freq, &ieres, res_tar, ierr_tar); if (status != PP_OK) { func_id = PP_TARGET_ID; pp_vector_msg(&func_id, ierr_tar, &n, msg); pp_print_msg(&n, msg); if (status <= PP_ERR) return(PP_ERR); /* example of handling of error codes - in this case to detect a trivial warning */ pp_vector_code(&func_id, ierr_tar, &n, codes); for (k=0; k<n; k++) { if ( (codes[k] == PP_CFI_TARGET_TS_NO_SUN_VISIBILITY_WARN) || (codes[k] == PP_CFI_TARGET_SM_NO_SUN_VISIBILITY_WARN) ) { n = 0; sprintf(msg[n++], "*** Ignore warning on no sun/moon visibility, it only means that the satellite is in eclipse"); pp_print_msg(&n, msg); } } } for (k=0; k<50; k++) { sprintf(msg[k], "- res_tar[%d]: %lf ", k, res_tar[k] ); } pp_print_msg(&k, msg); /* CAREFUL here, pp_print_msg handles only MAX_COD messages */ /* look up ppf_lib.h for MAX_COD */ for (k=0; k<25; k++) { sprintf(msg[k], "- res_tar[%d]: %lf ", k+50, res_tar[k+50] ); } pp_print_msg(&k, msg); /* CAREFUL here, pp_print_msg handles only MAX_COD messages */ /* look up ppf_lib.h for MAX_COD */ } /* Calling pp_target in PP_LUT_REF mode */ /* ------------------------------------ */ printf("\n\n PP_TARGET # PP_LUT_REF mode \n\n"); /* Set enviroment variable for defining atmosphere model */ /* ----------------------------------------------------- */ strcpy(atm_var,"PP_USER_REF_CONV_FILE_NAME=");#ifndef PL_WINDOWS strcat(atm_var,"../data/pp_converter_coefs.out");#else strcat(atm_var,"..\\data\\pp_converter_coefs.out");#endif #ifndef PL_WINDOWS if ((put=putenv(atm_var))!=0){#else if ((put=_putenv(atm_var))!=0){#endif printf("ERROR in setting enviroment variable"); return(PP_ERR); } /* Initialize pp_target */ /* -------------------- */ status = pp_target(mjdp_t, pos_t, vel_t, acc_t, aocs_g, att, datt, &idir_ini, dir_lut, &iray_lut, &freq_lut, &ieres_lut, res_tar, ierr_tar); if (status != PP_OK) { func_id = PP_TARGET_ID; pp_vector_msg(&func_id, ierr_tar, &n, msg); pp_print_msg(&n, msg); if (status <= PP_ERR) return(PP_ERR); } /* Main call to pp_target */ /* ---------------------- */ status = pp_target(mjdp_t, pos_t, vel_t, acc_t, aocs_g, att, datt, &idir_lut, dir_lut, &iray_lut, &freq_lut, &ieres_lut, res_tar, ierr_tar); if (status != PP_OK) { func_id = PP_TARGET_ID; pp_vector_msg(&func_id, ierr_tar, &n, msg); pp_print_msg(&n, msg); if (status <= PP_ERR) return(PP_ERR); } for (k=0; k<50; k++) { sprintf(msg[k], "- res_tar[%d]: %lf ", k, res_tar[k] ); } pp_print_msg(&k, msg); /* CAREFUL here, pp_print_msg handles only MAX_COD messages */ /* look up ppf_lib.h for MAX_COD */ for (k=0; k<25; k++) { sprintf(msg[k], "- res_tar[%d]: %lf ", k+50, res_tar[k+50] ); } pp_print_msg(&k, msg); /* CAREFUL here, pp_print_msg handles only MAX_COD messages */ /* look up ppf_lib.h for MAX_COD */ /* Main call to pp_init_attitude_file */ /* ---------------------------------- */ start = 1757.0; stop = 1758.0; perfo_params[0] = 100; perfo_params[1] = 100; perfo_params[2] = 100; perfo_params[3] = 1; perfo_params[4] = 0; perfo_params[5] = 0; mode_out = PP_ATT_ESTIMATOR; mode_perfo = PP_ESTIMATOR_PERFO; mode_statistic = PP_STATISTIC; status = pp_init_attitude_file(filename, &mode_out, &start, &stop, &mode_perfo, perfo_params, &mode_statistic, bias_good, rms_good, bias_flag, rms_flag, flag_stats, ierr); if (status != PP_OK) { func_id = PP_INIT_ATTITUDE_FILE_ID; pp_vector_msg(&func_id, ierr, &n, msg); pp_print_msg(&n, msg); if (status <= PP_ERR) return(PP_ERR); } printf ("OUTPUTS from pp_init_attitude_file:\n"); printf ("----------------------------------\n"); printf ("bias_good = %f, %f, %f\n", bias_good[0], bias_good[1], bias_good[2]); printf ("rms_good = %f, %f, %f\n", rms_good[0], rms_good[1], rms_good[2]); printf ("bias_flag = %f, %f, %f\n", bias_flag[0], bias_flag[1], bias_flag[2]); printf ("rms_flag = %f, %f, %f\n", rms_flag[0], rms_flag[1], rms_flag[2]); printf ("Percentage of flagged data= %f\n", flag_stats[0]); printf ("Percentage of data gap = %f\n", flag_stats[1]); /* Attitude calculation */ /* -------------------- */ utc_time = 1757.5; status = pp_get_attitude_aocs(&utc_time, aocs, att, datt, &perfo_flag, mode, ierr); if (status != PP_OK) { func_id = PP_GET_ATTITUDE_AOCS_ID; pp_vector_msg(&func_id, ierr, &n, msg); pp_print_msg(&n, msg); if (status <= PP_ERR) return(PP_ERR); } printf ("OUTPUTS from pp_get_attitude_aocs:\n"); printf ("---------------------------------\n"); printf ("AOCS = %f, %f, %f\n", aocs[0], aocs[1], aocs[2]); printf ("Pitch= %f, Roll= %f, Yaw = %f (deg)\n", att[0], att[1], att[2]); printf ("Attitude rates: Pitch= %f, Roll= %f, Yaw = %f (deg/sec)\n", datt[0], datt[1], datt[2]); printf ("Perfo flag = %d\n", perfo_flag); printf ("Mode = %s\n", mode); /* Free memory stored in the attitude initialization */ /* ------------------------------------------------- */ pp_free_attitude(); return (PP_OK);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -