📄 ppf_orbit_valid.c
字号:
#include <stdio.h>#include <math.h>#include <string.h>#include <ppf_orbit.h>/* This version number is the SCCS version number valid only for internal control and configuration. *//* The oficial version number can be found in the History box below. */static char PPF_ORBIT_VALID_C [] = "@(#)ppf_orbit_valid.c 1.11 00/04/13";extern char test_name[]; /* For the example of genops *//***************************************************************************************** * * Copyright : DEIMOS Space S.L. * Project : REMASE * * Test level : VALIDATION * * Module : ppf_orbit_valid.c * Purpose : It runs the validation cases of PPF_ORBIT * * History +------------------------------------------------------------------------+ * | Version | Date | Name | Change | * |---------|----------|--------------|------------------------------------| * | 4.1 | 15/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/07/01 | GMV, S.A. | Seventh release | * | 4.8 | 31/07/01 | GMV, S.A. | Eigth release | * | 4.9 | 22/10/01 | DEIMOS Space | Ninth release | * | 5.0 | 18/01/02 | DEIMOS Space | Tenth release | * | 5.1 | 25/11/02 | DEIMOS Space | Eleventh release | * | 5.2 | 26/05/03 | DEIMOS Space | Twelfth release | * | 5.3 | 13/12/04 | DEIMOS Space | Thirteenth release | * | 5.3.1 | 15/02/05 | DEIMOS Space | Forteenth release | * | 5.4 | 17/05/05 | DEIMOS Space | Fifteenth release | * +------------------------------------------------------------------------+ * ****************************************************************************************//* Macro definition *//* ---------------- */#define MAX_CONDITION 1000 /* Maximum number of checks pertest case */#define START_VALIDATION int main(int argc, char *argv[]){ \ double di,th,ta,tb,sinta,costa,sintb,costb;\ double di_l,di_r,th_l,th_r; \ int i,j; \ int checks; \ PL_Boolean condition[MAX_CONDITION]; \ PL_Boolean result;#define START_CHECK(msg) printf(" *** %s\n",msg); \ checks = 0;#define END_CHECK result = PL_TRUE; \ for (i = 0 ; i < checks ; i++) \ { \ if (condition[i] == PL_FALSE) \ { \ result = PL_FALSE; \ break; \ } \ } \ if (result == PL_TRUE) \ { \ printf(" *** RESULT = PASS ***\n\n"); \ } \ else \ { \ printf(" *** RESULT = FAIL ***\n\n"); \ }#define CHECK_STATUS(msg,stat) if (stat < PO_OK ) { \ condition[checks] = PL_FALSE; \ printf(" ...\t%s (PL_FALSE)\n",msg); \ }else{ \ condition[checks] = PL_TRUE; \ printf(" ...\t%s (PL_TRUE)\n",msg); \ } \ checks++;#define CHECK_PAR(msg,p,p0,dp) if((di=fabs(p-p0)) <= (th=dp)){ \ condition[checks] = PL_TRUE; \ printf(" ...\t%s (PL_TRUE)\n",msg); \ }else{ \ condition[checks] = PL_FALSE; \ printf(" ...\t%s (PL_FALSE)\n",msg); \ } \ printf("\t\t Threshold : %g\n",th); \ printf("\t\t Difference : %g\n",di); \ checks++;#define CHECK_VEC(msg,v,v0,im,iM,dp) for(i=im;i<=iM;++i){ \ CHECK_PAR(msg,v[i],v0[i],dp); \ }#define END_VALIDATION return(0); \ }/***************************************************************************************** * * ----------------------- * Auxiliary Test Modules: * ----------------------- * * - TEST_INTERPOL_AUX * - TEST_MLST_AUX * * Used by Tests number : AT-71_01, _02, _03, .... , _11 * * -------------- * Procedure * -------------- * * Test Description : the following input condition is introduced: * o To check using DORIS Precise or DORIS Preliminary or FOS Restituted * o To check the INTERPOLATION mode (loop of 100 cases) * o To check with ppf_orb (test _05) * o To check with genstate + ppf_orb (test _06) * o To check MLST * * Pass/Fail criteria : the following conditions need to be true: * o check status after calling * o check selected * o generate a data file with the interpolated points * ****************************************************************************************/ #define TEST_INTERPOL_AUX \ \ status = interpol(&mode , &choice, \ &ndc , &doris_precise_file[0], \ &ndl , &doris_prelim_file[0], \ &ner , &esoc_rest_file[0], \ &mjdr0 , &mjdr1, mjdp, x, pos, vel, acc, \ &selected, res , ierr); \ \ CHECK_STATUS("Initialization", status); \ CHECK_PAR( selected_text, selected, selected_value, 0 ) \ \ \ \ /* Interpolation mode: */ \ /*---------------------*/ \ mode = PO_INTERPOLATE; \ \ for(i_loop=0 ; i_loop<num ; i_loop=i_loop+1) \ { \ mjdr_n = mjdr0 + (double)(i_loop)*(mjdr1-mjdr0)/(num-1); \ \ status = interpol(&mode , &choice, \ &dummy_n, &dummy_file[0], \ &dummy_n, &dummy_file[0], \ &dummy_n, &dummy_file[0], \ &mjdr_n , &dummy, mjdp, x, pos, vel, acc, \ &selected, res , ierr); \ \ CHECK_STATUS("Interpolation", status); \ } \ \#define TEST_MLST_AUX \ \ cf_mode = PO_INIT; \ status_cf = ppforb(&cf_mode, mjdp_anx, x_anx, mjdp, x_cf, pos, vel, acc_cf, res_cf, ierr_cf); \ \ cf_mode = PO_PROPAG; \ status_cf = ppforb(&cf_mode, mjdp_anx, x_anx, mjdp_anx, x_cf, pos_cf, vel_cf, acc_cf, res_cf, ierr_cf); \ CHECK_PAR( "Checking |z| < 10 m: ", pos_cf[2], 0, 10. ) \ CHECK_PAR( "Checking MLST: ", res_cf[17], check_mlst, 0.005 )typedef enum{PL_FALSE = 0, /* False variable */PL_TRUE = 1 /* True variable */} PL_Boolean;/* Nominal acceptance values *//* ------------------------- */double mjdr[] = { -730.0 , 0.3};long irep = 35;long icyc = 501;double rlong = -47.2941;double ascmlst = 22.0;long iorb0 = 0;long iorb = 43;double mjdp[] = { -2456.0 , 0.3 };double pos[] = { 4859964.138 , -5265612.059 , 0.002 };double vel[] = { -1203.303801, -1098.845511 , 7377.224410 };/* Validation for PPF_ORBIT *//* ------------------------ */START_VALIDATION/* Local variables definition *//* -------------------------- */ double pos_ref[3],vel_ref[3];double mj_anx[2],xm[6],x[6],accel[3],resorb_cf[54];long status_cf,ierr_cf[4];double my_aux;double u1[4],u2[4];long pr_mode;long ii;double rad2deg=180.0/3.14159265358979323846; /* Local variables definition for "genops" *//* --------------------------------------- */ long status; long mjdt_m[4], mjdt_new[4]; double mjdp_m[2], mjdp_new[2], mjdp_tra[2]; char utce_m[28], dut1e_m[9], utce_new[28], dut1e_new[9], utce_tra[28], dut1e_tra[9]; double mjdr_new, sec; long year, month, day, hour, min; double ut1[2], rsun[4], rdsun[4], rmoon[4], rdmoon[4]; double mjd_m, ulun[4], usun[4]; long mjdt_pr[4], mjdt_prnew[4]; double mjdp_pr[2], mjdp_prnew[2]; char utce_pr[28], dut1e_pr[9], utce_prnew[28], dut1e_prnew[9]; long mode_t, choice_t, mode_ppforb_t; char doris_file_t[200], fos_file_t[200]; double mjd0_t, mjd1_t; double mjdp_t[2], pos_t[3], vel_t[3]; long select_t; double res_t[32]; long ierr_t[10]; double lon_gen_t, lat_gen_t, h_gen_t, lond_gen_t, latd_gen_t, hd_gen_t; /* Variables to call "ppforb" */ long ierr_ppforb_t[4]; double mjdr_t[2], xm_t[6], x_t[6], acc_t[6], res_ppforb_t[54]; /* Variables to call "PO_Ppf_Init" */ /*double acc[3];*/ long local_status; /* variables for TEST_01 */ int k; char start_check_str[200]; long start_sec, end_sec; /* Interpol variables definition: */ /*--------------------------------*/ long ndc, ndl, ner, ierr[10], dummy_n=0, selected, dummy_s, mode, choice; double mjdr0, mjdr1, mjdp[2], pos[3], vel[3], acc[3], res[54], dummy=0; char *doris_precise_file[10], *doris_prelim_file[10], *esoc_rest_file[10], *dummy_file[10]; char esoc_file_path[200], doris_file_path[200]; int test_number; long func_id; char msg[PO_MAX_COD][PO_MAX_STR]; long n; /* Endurance test variables */ char out_file[200]; FILE *pfout; long i_loop; double mjdr_n; double mjdp_ppforb_t[2], pos_ppforb_t[3], vel_ppforb_t[3]; double mjdp_anx[2];/* Local variables definition *//* -------------------------- */ long cf_mode, ierr_g[4]; double x_anx[6], mjdp_cf[2], x_cf[6], pos_cf[3], vel_cf[3], acc_cf[3], res_cf[54]; long irep_g=35, icyc_g=501, iorb0_g=1000, iorb_g=1000; double mjdr_ref[2], rlong_g=0.1335, ascmlst_g=22.0; double mjdp_g[2], pos_g[3], vel_g[3];#ifdef PL_WINDOWS char file1[] = "..\\example\\data\\DOR_VOR_2PTCTD19930412_220000_00000000A018_00062_09080_0000.N1", /* DORIS_PRECISE */ file2[] = "..\\example\\data\\DOR_POR_2PTCTD19930412_220500_00000000A018_00062_09080_0000.N1", /* DORIS_PRELIMINARY */ file3[] = "..\\example\\data\\AUX_FRO_AXTFOS19930412_215500_00000000A018_00062_09080_0000.N1", /* ESOC_RESTITUTED */ file4[] = "..\\example\\data\\DOR_VOR_2PTCTD19970410_114500_00000000A018_00062_01000_0000.N1", /* DORIS_PRECISE Leap Day */ file5[] = "..\\example\\data\\DOR_VOR_2PTCTD19930412_220000_00000000A018_00062_09080_0000.N5", /* DORIS_PRECISE Orbits 1-4 */ file6[] = "..\\example\\data\\DOR_VOR_2PTCTD19930412_220000_00000000A018_00062_09080_0000.N6", /* DORIS_PRECISE Orbits 5-8 */ file7[] = "..\\example\\data\\DOR_VOR_2PTCTD19930412_220000_00000000A018_00062_09080_0000.N7", /* DORIS_PRECISE Orbits 8-12 */ file8[] = "..\\example\\data\\DOR_VOR_2PTCTD19930412_220000_00000000A018_00062_09080_0000.N8", /* DORIS_PRECISE Orbit 13-14 */ file9[] = "..\\example\\data\\DOR_VOR_2PTCTD19930412_220000_00000000A018_00062_09080_0000.N9"; /* DORIS_PRECISE Every other minute */#else char file1[] = "../example/data/DOR_VOR_2PTCTD19930412_220000_00000000A018_00062_09080_0000.N1", /* DORIS_PRECISE */ file2[] = "../example/data/DOR_POR_2PTCTD19930412_220500_00000000A018_00062_09080_0000.N1", /* DORIS_PRELIMINARY */ file3[] = "../example/data/AUX_FRO_AXTFOS19930412_215500_00000000A018_00062_09080_0000.N1", /* ESOC_RESTITUTED */ file4[] = "../example/data/DOR_VOR_2PTCTD19970410_114500_00000000A018_00062_01000_0000.N1", /* DORIS_PRECISE Leap Day */ file5[] = "../example/data/DOR_VOR_2PTCTD19930412_220000_00000000A018_00062_09080_0000.N5", /* DORIS_PRECISE Orbits 1-4 */ file6[] = "../example/data/DOR_VOR_2PTCTD19930412_220000_00000000A018_00062_09080_0000.N6", /* DORIS_PRECISE Orbits 5-8 */ file7[] = "../example/data/DOR_VOR_2PTCTD19930412_220000_00000000A018_00062_09080_0000.N7", /* DORIS_PRECISE Orbits 8-12 */ file8[] = "../example/data/DOR_VOR_2PTCTD19930412_220000_00000000A018_00062_09080_0000.N8", /* DORIS_PRECISE Orbit 13-14 */ file9[] = "../example/data/DOR_VOR_2PTCTD19930412_220000_00000000A018_00062_09080_0000.N9"; /* DORIS_PRECISE Every other minute */#endif char selected_text[100]; long selected_value, num, ppf_orb_flag; double check_mlst; FILE *pfin, *pfres; double t1, dt1, x1, y1, z1, vx1, vy1, vz1, x11, x21, x31, x41, x51, x61, r1, v1; double t2, dt2, x2, y2, z2, vx2, vy2, vz2, x12, x22, x32, x42, x52, x62, r2, v2; char pute1[301], pute2[301];/***************************************************************************************** * * --------- * Test case * --------- * * Test number : VT-11 * ****************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -