📄 ppf_pointing_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_POINTING_C_C [] = "@(#)ppf_pointing_c.c 1.12 00/04/13"; /****************************************************************************** * * Module : ppf_pointing_c.c * * Functions : main program (PPF_POINTING example) to call: * * - pp_target * - pp_stavis * - pp_genstate_drs * - pp_drsvis * * +-------------------------------------------------------------+ * 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 |22/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 <stdio.h>#include <string.h>#ifdef PL_WINDOWS #include <stdlib.h> /*_putenv library*/#endif#include <ppf_orbit.h> /* PPF_ORBIT header file */ /* required because this program calls po_ppforb et al. */#include <ppf_pointing.h> /* PPF_POINTING header file *//* putenv declaration *//* ------------------ */int putenv(const char*);/* Main program *//* ------------ */int main (int argc, char *argv[]){ long k; int put; static char atm_var[100]; long aocsmode_g, ierr_g[4]; double aocs_g[3]; long irep_t, icyc_t; double mjdr_t[2], 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 longdrs; double posdrs[3], veldrs[3]; double att[3], datt[3], sta[4], res_sta[31]; long ierr_d[4], ierr_s[4]; double mjddrs[2], res_drs[33]; long idir, iray, ieres, ierr_tar[15]; long idir_ini, idir_lut, iray_lut, ieres_lut; double dir[8], freq, res_tar[75]; double dir_lut[8], freq_lut; char filename[] ="../data/PDSRA20041123OAFC0002.ENV"; long mode_out, mode_perfo; double perfo_params[6]; long mode_statistic; double bias_good[3], rms_good[3]; double bias_flag[3], rms_flag[3]; double flag_stats[2]; long ierr[1]; double start, stop; double utc_time; double aocs[3]; long perfo_flag; char mode[5]; double dummy = 0.0; long n_iter; long status; /* Main status flag */ long n; /* Number of error messages */ long func_id; /* CFI function ID */ /* CAREFUL: will be changed to long in future release */ char msg[PP_MAX_COD][PP_MAX_STR]; /* Error messages vector */ long codes[PP_MAX_COD]; /* Error codes vector *//* Initialize data *//* --------------- */ longdrs = 16.4; /* DRS geocentric longitude [deg] */ att[0] = 0.0; /* Envisat-1 SRAR mispointing angles [deg] */ att[1] = 0.0; att[2] = 0.0; datt[0] = 0.0; /* Envisat-1 SRAR mispointing rates [deg/s] */ datt[1] = 0.0; datt[2] = 0.0; sta[0] = 311.93; /* Ground station geocentric longitude [deg] */ sta[1] = 3.56; /* Ground station geodetic latitude [deg] */ sta[2] = 362.0; /* Ground station geodetic altitude [m] */ sta[3] = 0.0; /* Ground station minimum elevation link [deg] */ idir = PP_INTER_1ST; /* pp_target: direction mode = first intersection point */ iray = PP_NO_REF; /* pp_target: ray tracing model = no refraction */ ieres = PP_TARG_RES_SAT2TARG_AUX + PP_TARG_RES_SAT2TARG_D + PP_TARG_RES_SAT2MOON; /* pp_target: results = parameters selected with the enumerations */ freq = 550.0e9; /* pp_target: frequency of the signal from the target [Hz] */ idir_lut = PP_TAN; idir_ini = PP_TAR_LUT_INIT; iray_lut = PP_LUT_REF; /* pp_target: ray_tracing_model = predefined lut atmosphere */ ieres_lut = PP_TARG_RES_SAT2TARG; /* pp_target: results = main satellite to target parameters (no derivatives) */ freq_lut = 3.0e14; /* pp_target: frequency of the signal from the target [Hz] */ dir[0] = 10.0; /* pp_target: LOS azimuth in SRAR [deg] */ dir[1] = 75.0; /* pp_target: LOS elevation in SRAR [deg] */ dir[2] = 0.0; /* pp_target: geodetic altitude of the intersection point [m] */ dir[4] = 0.0; /* pp_target: LOS azimuth rate in SRAR [deg/s] */ dir[5] = 0.0; /* pp_target: LOS elevation rate in SRAR [deg/s] */ dir[3] = dummy; /* pp_target: DUMMY input for idir = PP_INTER_1ST */ dir[6] = dummy; /* pp_target: DUMMY input for idir = PP_INTER_1ST */ dir[7] = dummy; /* pp_target: DUMMY input for idir = PP_INTER_1ST */ dir_lut[0] = 180.0; /* pp_target: LOS azimuth in SRAR [deg] */ dir_lut[1] = 15.0; /* pp_target: LOS elevation in SRAR [deg] */ dir_lut[4] = 0.0; /* pp_target: LOS azimuth rate in SRAR [deg/s] */ dir_lut[5] = 0.0; /* pp_target: LOS elevation rate in SRAR [deg/s] */ dir_lut[2] = dummy; /* pp_target: DUMMY input for idir = PP_TAN */ dir_lut[3] = dummy; /* pp_target: DUMMY input for idir = PP_TAN */ dir_lut[6] = dummy; /* pp_target: DUMMY input for idir = PP_TAN */ dir_lut[7] = dummy; /* pp_target: DUMMY input for idir = PP_TAN *//* Set error handling mode to SILENT *//* ---------------------------------- */ pp_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"); pp_print_msg(&n,msg);/* Values of "aocs_g" *//* ------------------ */ /* The values of "aocs_g" are fixed */ aocs_g[0]= PP_AOCS_CX; aocs_g[1]= PP_AOCS_CY; aocs_g[2]= PP_AOCS_CZ;/* Calling po_ppforb (initialization) *//* ---------------------------------- */ mjdp_t[0] = -2456.0 /* UTC time in MJD2000 (1993-04-11 00:00:00) [days] */ + 1.0 / 24.0 /* taken from Predicted Orbit File in ppf_orbit */ + 9.0 / 1440.0 + 8.765999 / 86400.0; mjdp_t[1] = 0.3; /* Delta UT1 [s] */ pos_t[0] = 4859964.138; /* Position vector (x,y,z) [m] */ pos_t[1] = -5265612.059; pos_t[2] = 0.002; vel_t[0] = -1203.303801; /* Velocity vector (x,y,z) [m/s] */ vel_t[1] = -1098.845511; vel_t[2] = 7377.224410; mode_t = PO_INIT; /* Initialization mode = NOMINAL */ 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, codes); for (k=0; k<n; k++) { if (codes[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); } } } /* Calling po_ppforb (propagation mode) *//* ------------------------------------ */ mode_t = PO_PROPAG; /* Propagate using absolute time */ /* propagate for asc node & asc node + 20 minutes */ for (dt_t= mjdr_t[0]; dt_t<=mjdr_t[0]+20.0/1440.0; dt_t+=20.0/1440.0) { n_iter = (long) (0.5+(dt_t - mjdr_t[0]) * 86400); mjdp_t[0]= dt_t; /* Propagation time [MJD2000] */ mjdp_t[1]= dummy; /* DUMMY = delta UT1 of the state vector used at initialization */ n = 0; sprintf(msg[n++], "\n\nPO_PPFORB propagation # %i seconds\n", n_iter); 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, codes); for (k=0; k<n; k++) { if (codes[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 + -