00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include <stdio.h>
00037 #include "Basic.h"
00038 #include "ionosphere.h"
00039 #include "constants.h"
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 static double test_IONOSPHERE_getCorrectionL1_gpstk_3rdParty(
00055 double gpstow,
00056 double alpha[4],
00057 double beta[4],
00058 const double latitude,
00059 const double longitude,
00060 const double svel,
00061 const double svaz
00062 );
00063
00064
00065 int init_suite_IONOSPHERE(void)
00066 {
00067 return 0;
00068 }
00069
00070 int clean_suite_IONOSPHERE(void)
00071 {
00072 return 0;
00073 }
00074
00075
00076 void test_IONOSPHERE_GetL1KlobucharCorrection(void)
00077 {
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 double alpha[4];
00093 double beta[4];
00094
00095 double latitude;
00096 double longitude;
00097 double azimuth;
00098 double elevation;
00099 double gpstow;
00100 double az;
00101 double el;
00102 BOOL result;
00103 double ionospheric_delay;
00104 double ionospheric_delay_test;
00105
00106 alpha[0] = 1.0836e-08;
00107 alpha[1] = -6.6222e-09;
00108 alpha[2] = -3.4546e-07;
00109 alpha[3] = -5.5205e-07;
00110
00111 beta[0] = 1.0706e+05;
00112 beta[1] = -1.1893e+05;
00113 beta[2] = -9.7785e+05;
00114 beta[3] = -1.3581e+06;
00115
00116
00117 latitude = 51*DEG2RAD;
00118 longitude = -114*DEG2RAD;
00119
00120 for( az = 0; az < 360; az+= 15 )
00121 {
00122 azimuth = az*DEG2RAD;
00123 for( el = 0; el <= 90; el += 15 )
00124 {
00125 elevation = el*DEG2RAD;
00126 for( gpstow = 345600; gpstow < 5*86400.0; gpstow += 3600.0 )
00127 {
00128 result = IONOSPHERE_GetL1KlobucharCorrection(
00129 alpha[0],
00130 alpha[1],
00131 alpha[2],
00132 alpha[3],
00133 beta[0],
00134 beta[1],
00135 beta[2],
00136 beta[3],
00137 latitude,
00138 longitude,
00139 elevation,
00140 azimuth,
00141 gpstow,
00142 &ionospheric_delay
00143 );
00144 CU_ASSERT_FATAL( result );
00145
00146 ionospheric_delay_test = test_IONOSPHERE_getCorrectionL1_gpstk_3rdParty(
00147 gpstow,
00148 alpha,
00149 beta,
00150 latitude,
00151 longitude,
00152 elevation,
00153 azimuth
00154 );
00155 CU_ASSERT_DOUBLE_EQUAL( ionospheric_delay, ionospheric_delay_test, 1e-04 );
00156
00157 }
00158 }
00159 }
00160 }
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178 double test_IONOSPHERE_getCorrectionL1_gpstk_3rdParty(
00179 double gpstow,
00180 double alpha[4],
00181 double beta[4],
00182 const double latitude,
00183 const double longitude,
00184 const double svel,
00185 const double svaz
00186 )
00187 {
00188
00189
00190
00191
00192 double azRad;
00193 double svE;
00194 double phi_u;
00195 double lambda_u;
00196 double psi;
00197 double phi_i;
00198 double lambda_i;
00199 double phi_m;
00200 double iAMP;
00201 double iPER;
00202 double t;
00203 double x;
00204 double iF;
00205 double t_iono;
00206 double correction;
00207
00208 azRad = svaz;
00209 svE = svel / PI;
00210
00211 phi_u = latitude / PI;
00212 lambda_u = longitude / PI;
00213
00214 psi = (0.0137 / (svE + 0.11)) - 0.022;
00215
00216 phi_i = phi_u + psi * cos(azRad);
00217 if (phi_i > 0.416)
00218 phi_i = 0.416;
00219 if (phi_i < -0.416)
00220 phi_i = -0.416;
00221
00222 lambda_i = lambda_u + psi * sin(azRad) / cos(phi_i*PI);
00223
00224 phi_m = phi_i + 0.064 * cos((lambda_i - 1.617)*PI);
00225
00226 iAMP = 0.0;
00227 iPER = 0.0;
00228
00229 iPER = beta[0] + beta[1]*phi_m + beta[2]*phi_m*phi_m + beta[3]*phi_m*phi_m*phi_m;
00230
00231
00232 iAMP = alpha[0] + alpha[1]*phi_m + alpha[2]*phi_m*phi_m + alpha[3]*phi_m*phi_m*phi_m;
00233
00234 iAMP = alpha[0]+phi_m*(alpha[1]+phi_m*(alpha[2]+phi_m*alpha[3]));
00235 iPER = beta[0]+phi_m*( beta[1]+phi_m*( beta[2]+phi_m* beta[3]));
00236
00237 if (iAMP < 0.0)
00238 iAMP = 0.0;
00239 if (iPER < 72000.0)
00240 iPER = 72000.0;
00241
00242 t = 43200.0 * lambda_i + gpstow;
00243 if (t >= 86400.0)
00244 t -= 86400.0;
00245 if (t < 0)
00246 t += 86400.0;
00247
00248 x = TWOPI * (t - 50400.0) / iPER;
00249
00250 iF = 1.0 + 16.0 * (0.53 - svE)*(0.53 - svE)*(0.53 - svE);
00251
00252 t_iono = 0.0;
00253 if (fabs(x) < 1.57)
00254 t_iono = iF * (5.0e-9 + iAMP * (1 + x*x * (-0.5 + x*x/24.0)));
00255 else
00256 t_iono = iF * 5.0e-9;
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266 correction = t_iono * LIGHTSPEED;
00267
00268 return correction;
00269 }
00270