📄 ppf_orbit_c.c
字号:
/* This version number is the SCCS version number valid only for internal configuration and control. *//* The oficial version number can be found in the History box below. */static char PPF_ORBIT_C_C []="@(#)ppf_orbit_c.c 1.13 01/07/05"; /****************************************************************************** * * Module : ppf_orbit_c.c * * Functions : main program (PPF_ORBIT example) to call: * * - po_genstate * - po_ppforb * - po_interpol * - po_genops * * Purpose : Example program to show the way to call the above functions. * * +-------------------------------------------------------------+ * History : |Version | Date | Name | Change | * |-------------------------------------------------------------| * | 4.1 |21/01/97| GMV, S.A. | First release | * | 4.2 |30/04/97| GMV, S.A. | Second release | * | 4.3 |18/05/98| GMV, S.A. | Third release | * | 4.4 |13/10/98| GMV, S.A. | Fourth release | * | 4.5 |25/05/99| GMV, S.A. | Fifth release | * | 4.6 |14/04/00| GMV, S.A. | Sixth release | * | 4.7 |27/06/01| GMV, S.A. | Seventh release | * | 4.8 |31/07/01| GMV, S.A. | Eigth release | * | 4.9 |22/10/01| DEIMOS | Ninth release | * | 5.0 |18/01/02| DEIMOS | Tenth release | * | 5.1 |25/11/02| DEIMOS | Eleventh release | * | 5.2 |26/05/03| DEIMOS | Twelfth release | * | 5.3 |13/12/04| DEIMOS | Thirteenth release | * | 5.3.1|15/02/05| DEIMOS | Forteenth release | * | 5.4 |17/05/05| DEIMOS | Fifteenth release | * +-------------------------------------------------------------+ * ******************************************************************************/#include <string.h>#include <stdio.h>#include <ppf_orbit.h> /* PPF_ORBIT header file *//* Main program *//* ------------ */long main (int argc, char *argv[]){ long k; long irep_t, icyc_t; long iorb0_t, iorb_t, ierr_genstate_t[4]; double mjdr_t[2], rlong_t, ascmlst_t, mjdp_t[2], pos_t[3], vel_t[3]; long mode_t, ierr_ppforb_t[4]; double xm_t[6], x_t[6], acc_t[3], res_ppforb_t[54]; double dt_t; double time_t[2]; long status; /* Main status flag */ long n; /* Number of error messages */ long func_id; /* CFI function ID */ char msg[PO_MAX_COD][PO_MAX_STR]; /* Error messages vector */ long code[PO_MAX_COD]; /* Error codes vector *//* po_interpol variables *//* --------------------- */ long mode, choice; long ndc, ndl, ner, ierr[10], dummy_n=0; double mdjr0, mdjr1, mdjp[2], x[6], pos[3], vel[3], acc[3], res[54], dummy=0; long selected=PO_NONE, dummy_c=PO_NONE;#ifdef PL_WINDOWS char file1[] = "..\\data\\DOR_VOR_2PTCTD19930412_220000_00000000A018_00062_09080_0000.N1"; /* DORIS_PRECISE */ char file2[] = "..\\data\\DOR_POR_2PTCTD19930412_220500_00000000A018_00062_09080_0000.N1"; /* DORIS_PRELIMINARY */ char file3[] = "..\\data\\AUX_FRO_AXTFOS19930412_215500_00000000A018_00062_09080_0000.N1"; /* ESOC_RESTITUTED */#else char file1[] = "../data/DOR_VOR_2PTCTD19930412_220000_00000000A018_00062_09080_0000.N1"; /* DORIS_PRECISE */ char file2[] = "../data/DOR_POR_2PTCTD19930412_220500_00000000A018_00062_09080_0000.N1"; /* DORIS_PRELIMINARY */ char file3[] = "../data/AUX_FRO_AXTFOS19930412_215500_00000000A018_00062_09080_0000.N1"; /* ESOC_RESTITUTED */#endif char *doris_precise[10], *doris_prelim[10], *esoc_rest[10], *dummy_file[10];/* po_genops variables *//* ------------------- */ double mjd0, mjd1, mjdp[2], res_g[32]; char doris_nav[200]; char esoc_pred[200];/* Set error handling mode to SILENT *//* ---------------------------------- */ po_silent(); /* Set error handling mode to SILENT */ /* Dummy Test of Logging feature *//* ----------------------------- */ n = 0; strcpy(msg[n++],"This is the first user's log message"); strcpy(msg[n++],"This is the second user's log message"); po_print_msg(&n,msg);/* Calling po_genstate *//* ------------------- */ mjdr_t[0] = -2456.0; /* UTC time in MJD2000 (1993-04-11 00:00:00) [days] */ mjdr_t[1] = 0.0; /* Delta UT1 [s] */ irep_t = 35; /* Repeat cycle of the reference orbit [days] */ icyc_t = 501; /* Cycle length of the reference orbit [orbits] */ rlong_t = 312.71; /* Geocentric longitude of the ANX [deg] */ ascmlst_t = 22.0; /* Mean local solar time at ANX [hours] */ iorb0_t = 1; /* Absolute orbit number of the reference orbit */ iorb_t = 1; /* Absolute orbit number of the requested orbit */ n = 0; sprintf(msg[n++], "\n\nPO_GENSTATE\n"); po_print_msg(&n, msg); status = po_genstate(mjdr_t, &irep_t, &icyc_t, &rlong_t, &ascmlst_t, &iorb0_t, &iorb_t, mjdp_t, pos_t, vel_t, ierr_genstate_t); if (status != PO_OK) { func_id = PO_GENSTATE_ID; po_vector_msg(&func_id, ierr_genstate_t, &n, msg); po_print_msg(&n, msg); if (status <= PO_ERR) return(PO_ERR); } n = 0; sprintf(msg[n++], "- mjdp_t[0]: %lf", mjdp_t[0] ); /* PL_Time */ sprintf(msg[n++], "- mjdp_t[1]: %lf", mjdp_t[1] ); sprintf(msg[n++], "- pos_t[0]: %lf", pos_t[0] ); /* Position vector */ sprintf(msg[n++], "- pos_t[1]: %lf", pos_t[1] ); sprintf(msg[n++], "- pos_t[2]: %lf", pos_t[2] ); sprintf(msg[n++], "- vel_t[0]: %lf", vel_t[0] ); /* Velocity vector */ sprintf(msg[n++], "- vel_t[1]: %lf", vel_t[1] ); sprintf(msg[n++], "- vel_t[2]: %lf", vel_t[2] ); po_print_msg(&n, msg);/* Calling po_ppforb (initialization mode) *//* --------------------------------------- */ mode_t = PO_INIT_GENSTATE+PO_PPFORB_RES_BAS+PO_PPFORB_RES_AUX+PO_PPFORB_RES_BAS_D; /* Initialization using the output of po_genstate */ n = 0; sprintf(msg[n++], "\n\nPO_PPFORB initialization\n"); po_print_msg(&n, msg); status = po_ppforb(&mode_t, mjdr_t, xm_t, mjdp_t, x_t, pos_t, vel_t, acc_t, res_ppforb_t, ierr_ppforb_t); if (status != PO_OK) { func_id = PO_PPFORB_ID; po_vector_msg(&func_id, ierr_ppforb_t, &n, msg); po_print_msg(&n, msg); if (status <= PO_ERR) return(PO_ERR); /* example of handling of error codes - in this case to detect a trivial warning */ po_vector_code(&func_id, ierr_ppforb_t, &n, code); for (k=0; k<n; k++) { if (code[k] == PO_CFI_PPFORB_RESU_NEGATIVE_TANG_SUN_ALT_WARN) { n = 0; sprintf(msg[n++], "\n*** Ignore warning on negative sun tangent altitude"); sprintf(msg[n++], "*** It only means that the satellite is in eclipse\n"); po_print_msg(&n, msg); } } } n = 0; sprintf(msg[n++], "- mjdr_t[0]: %lf", mjdr_t[0] ); sprintf(msg[n++], "- mjdr_t[1]: %lf", mjdr_t[1] ); sprintf(msg[n++], "- xm_t[0]: %lf", xm_t[0] ); sprintf(msg[n++], "- xm_t[1]: %lf", xm_t[1] ); sprintf(msg[n++], "- xm_t[2]: %lf", xm_t[2] ); sprintf(msg[n++], "- xm_t[3]: %lf", xm_t[3] ); sprintf(msg[n++], "- xm_t[4]: %lf", xm_t[4] ); sprintf(msg[n++], "- xm_t[5]: %lf", xm_t[5] ); sprintf(msg[n++], "- x_t[0]: %lf", x_t[0] ); sprintf(msg[n++], "- x_t[1]: %lf", x_t[1] ); sprintf(msg[n++], "- x_t[2]: %lf", x_t[2] ); sprintf(msg[n++], "- x_t[3]: %lf", x_t[3] ); sprintf(msg[n++], "- x_t[4]: %lf", x_t[4] ); sprintf(msg[n++], "- x_t[5]: %lf", x_t[5] ); sprintf(msg[n++], "- acc_t[0]: %lf", acc_t[0] ); sprintf(msg[n++], "- acc_t[1]: %lf", acc_t[1] ); sprintf(msg[n++], "- acc_t[2]: %lf", acc_t[2] ); po_print_msg(&n, msg); for (k=0; k<54; k++) { sprintf(msg[k], "- res_ppforb_t[%d]: %lf", k, res_ppforb_t[k] ); } po_print_msg(&k, msg); /* CAREFUL here, po_print_msg handles only MAX_COD messages */ /* look up ppf_lib.h for MAX_COD *//* Calling po_ppforb (propagation mode) *//* ------------------------------------ */ mode_t = PO_PROPAG_ANX+PO_PPFORB_RES_BAS+PO_PPFORB_RES_BAS_D+PO_PPFORB_RES_BAS_2D; /* Propagate using time relative to ANX */ for (dt_t= 0.0; dt_t<=5.0; dt_t++) /* Propagating every mn for 5 mn */ { time_t[0]= dt_t * 60.0; /* Propagation time relative to ANX [s] */ time_t[1]= dummy; /* DUMMY = delta UT1 of the state vector used at initialization */ n = 0; sprintf(msg[n++], "\n\nPO_PPFORB propagation # %i\n", (long) dt_t); po_print_msg(&n, msg); status = po_ppforb(&mode_t, mjdr_t, xm_t, time_t, x_t, pos_t, vel_t, acc_t, res_ppforb_t, ierr_ppforb_t); if (status != PO_OK) { func_id = PO_PPFORB_ID; po_vector_msg(&func_id, ierr_ppforb_t, &n, msg); po_print_msg(&n, msg); if (status <= PO_ERR) return(PO_ERR); /* example of handling of error codes - in this case to detect a trivial warning */ po_vector_code(&func_id, ierr_ppforb_t, &n, code); for (k=0; k<n; k++) { if (code[k] == PO_CFI_PPFORB_RESU_NEGATIVE_TANG_SUN_ALT_WARN) { n = 0; sprintf(msg[n++], "\n*** Ignore warning on negative sun tangent altitude"); sprintf(msg[n++], "*** It only means that the satellite is in eclipse\n"); po_print_msg(&n, msg);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -