CCIR_T.cpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 
26 //==============================================================================
27 //
28 // This software was developed by Applied Research Laboratories at the
29 // University of Texas at Austin, under contract to an agency or agencies
30 // within the U.S. Department of Defense. The U.S. Government retains all
31 // rights to use, duplicate, distribute, disclose, or release this software.
32 //
33 // Pursuant to DoD Directive 523024
34 //
35 // DISTRIBUTION STATEMENT A: This software has been approved for public
36 // release, distribution is unlimited.
37 //
38 //==============================================================================
39 
40 #include "CCIR.hpp"
41 #include "TestUtil.hpp"
42 #include "CivilTime.hpp"
43 #include "DebugTrace.hpp"
44 
45 class CCIR_T
46 {
47 public:
48  CCIR_T();
49 
51  unsigned testValidateCache();
52 
56  unsigned testF2LayerCoeff();
57 
60  unsigned testF2LayerCoeffInterp();
61 
64  unsigned testF2LayerFourier();
65 
71  void testF2LayerCoeffAZr(gnsstk::TestUtil& testFramework,
72  const gnsstk::CivilTime& when,
73  double Azr, unsigned solarActIdx);
74 
76  class TestData
77  {
78  public:
79  TestData(double iazr, const std::vector<double>& coeffF2,
80  const std::vector<double>& coeffFm3)
81  : tAzr(iazr), tF2(coeffF2), tFm3(coeffFm3)
82  {}
83  double tAzr;
84  std::vector<double> tF2;
85  std::vector<double> tFm3;
86  };
87 
90  {
91  public:
92  TestDataFourier(double iazr, double hour, int month,
93  const std::vector<double>& coeffCF2,
94  const std::vector<double>& coeffCm3)
95  : tAzr(iazr), tCF2(coeffCF2), tCm3(coeffCm3)
96  {
97  int hr = trunc(hour);
98  double soh = (hour-hr)*3600;
99  int min = trunc(soh/60.0);
100  double sec = fmod(soh,60.0);
102  GNSSTK_ASSERT(fabs(ct.getUTHour()-hour) < 1e-7);
103  }
104  double tAzr;
106  std::vector<double> tCF2;
107  std::vector<double> tCm3;
108  };
109 
113  static TestData testData[];
117  static const double interpCoeffEps;
118 };
119 
120 
121 // value pulled from NeQuickG_JRC_iono_F2_layer_fourier_coefficients_test.c
122 const double CCIR_T::interpCoeffEps = 1e-5;
123 
124 // data pulled from NeQuickG_JRC_iono_F2_layer_fourier_coefficients_test.c
126 {
127  {
128  186.328060,
129  {
130  12.605340, 0.313256, 0.249495, 0.049053, 0.029104, 0.007502, -0.088684,
131  0.018222, -0.001853, 0.046916, 0.010309, 0.011487, -0.011607, 1.169928,
132  0.112289, -0.150386, -0.333868, 0.604549, 0.670627, -0.565507,
133  0.281560, -0.094419, -0.069452, 0.031858, 0.046254, 0.045217,
134  48.033505, -5.233178, -3.254403, 4.474504, 2.049914, -0.155251,
135  0.129335, 0.234437, 0.094904, -1.970059, -0.749943, 0.394905, 0.035730,
136  -33.384710, 3.235633, 10.083203, 4.355962, -8.718357, -7.505598,
137  7.846329, -2.907102, 1.893942, -0.889924, -0.812209, -0.289308,
138  0.027877, -232.876672, 34.143300, 3.098905, -49.103239, -17.359770,
139  2.064551, 3.573960, 2.567447, -0.274293, 9.659007, 5.943820, -4.429119,
140  1.213721, 215.714239, -43.861678, -21.895338, -9.012181, 57.491373,
141  22.591265, -39.741690, 16.885715, -13.466449, 8.860139, 7.624284,
142  2.393455, -1.665282, 418.308887, -76.120002, 15.002122, 158.305733,
143  49.535624, -4.148387, -14.452858, -14.271928, -0.077570, -16.268280,
144  -16.856444, 13.790904, -4.336880, -512.396227, 121.372980, -39.916676,
145  -6.157677, -145.930864, -27.028738, 85.604631, -44.157515, 35.440471,
146  -23.537707, -22.235131, -7.450479, 4.319500, -361.528414, 70.027646,
147  -25.313509, -195.287031, -58.597947, 2.302665, 18.648192, 20.950511,
148  0.341560, 10.592821, 19.528544, -16.675782, 4.710296, 513.824929,
149  -131.762305, 114.833015, 25.195737, 155.836873, 12.221157, -82.395676,
150  48.848563, -38.104631, 24.958091, 25.420673, 8.674223, -3.799770,
151  122.115232, -23.344245, 10.254202, 81.816004, 24.323755, -0.056900,
152  -7.803140, -9.521312, -0.044382, -2.056354, -7.867321, 6.918368,
153  -1.565617, -184.986330, 51.275826, -63.012360, -14.008187, -59.320434,
154  -0.970336, 29.374678, -18.937461, 14.300356, -9.301002, -10.049047,
155  -3.369804, 1.071633, -0.045080, 1.463798, 1.400662, 0.097343,
156  -0.016736, -0.014765, -0.002148, 0.015800, -0.011023, 0.013787,
157  0.029012, -0.007102, -0.014518, 0.436505, -1.508201, 1.166348,
158  -0.131102, -0.011230, -0.023335, -0.001966, -0.057908, -0.005647,
159  -0.025366, 0.017572, 0.002181, -0.035899, 1.554252, -1.075776,
160  -0.789063, -0.594607, 0.319782, -0.291296, 0.284122, -0.192956,
161  0.002946, -0.114094, 0.344783, -0.124144, 0.051071, 1.855770,
162  -1.139613, 0.532812, -0.173064, -0.052377, 1.094478, 0.544593,
163  0.337293, -0.461860, -0.196080, 0.022977, -0.045425, -0.671778,
164  -1.968465, 14.522424, -25.997919, -1.194876, -0.387456, -2.994397,
165  0.029345, 0.564826, 1.660505, -1.351524, -0.527586, 0.186069, 0.062935,
166  -11.835563, 27.618008, 25.481320, 6.775228, 1.698771, 1.559801,
167  -1.900554, 2.240655, -0.783190, -1.149844, -0.204631, 0.390659,
168  1.622043, -17.403655, 12.987714, 4.412895, -4.984779, -12.556048,
169  3.609189, -7.054924, 3.897800, 5.543111, -1.773318, -4.057586,
170  4.199129, -0.946793, -32.927709, 27.954948, -21.268468, 12.495880,
171  -2.042190, -4.871082, -4.102766, -9.817850, 11.511584, -0.523183,
172  -2.707436, 0.307591, 11.078793, 22.158435, 62.046546, 147.999461,
173  -12.060964, 20.119652, 28.446452, -3.505217, -1.059723, -11.558060,
174  8.072343, 1.949282, 2.143111, -2.159692, 96.541401, -187.242190,
175  -13.091500, -52.208576, -7.885607, -11.490833, 20.957980, -16.102596,
176  5.436303, 10.621450, 3.901198, -4.562195, -13.612887, 48.808955,
177  -90.991886, -32.387570, 73.855967, 73.826064, -24.493968, 39.706659,
178  -20.616878, -40.576198, 16.695069, 12.193076, -25.751294, 12.374516,
179  237.029518, -119.498973, 123.728080, -77.027466, 4.858599, 7.609107,
180  6.970890, 64.420970, -68.897238, 6.634095, 20.252329, -2.657578,
181  -54.528912, -88.522241, -464.750840, -234.627663, 78.807865,
182  -80.213575, -86.361789, 22.886626, -3.373235, 23.292733, -17.649945,
183  -5.732901, -9.734850, 7.778405, -292.668794, 395.857964, -303.958173,
184  154.059584, 5.342703, 26.919782, -69.210193, 39.989035, -12.651589,
185  -31.052031, -15.532030, 12.890232, 40.724752, -20.395999, 235.606784,
186  94.500119, -238.540161, -163.269300, 75.390470, -91.505977, 38.403044,
187  107.310254, -48.038737, -7.519126, 54.907698, -49.662874, -684.433624,
188  224.912696, -263.724829, 169.772776, 15.997527, -7.424005, 7.177101,
189  -154.977230, 164.445113, -5.829790, -54.717991, 10.806883, 115.870440,
190  133.375841, 782.519958, 166.274593, -133.409228, 103.859156,
191  107.445607, -42.444629, 9.380890, -14.072954, 16.167417, 10.017364,
192  12.182878, -9.882188, 382.339775, -392.021838, 660.500025, -200.744825,
193  12.940374, -23.967628, 90.328150, -42.402037, 14.679182, 38.083262,
194  21.406621, -12.752926, -50.425665, -57.614769, -251.378380,
195  -151.798704, 291.068092, 159.085047, -102.635903, 94.627585,
196  -26.977914, -119.712376, 56.337847, -10.079401, -46.229550, 73.995106,
197  839.338599, -173.226401, 215.648889, -146.987954, -48.045354,
198  12.826667, -31.528798, 156.099058, -173.588504, -12.062153, 62.759427,
199  -15.373148, -111.019926, -66.847508, -400.030211, -52.434073,
200  70.643090, -42.142479, -47.543178, 23.876324, -5.754827, 0.211416,
201  -5.117637, -6.111011, -4.510637, 4.349204, -177.191566, 155.414498,
202  -375.407702, 94.949884, -10.775809, 6.727726, -41.683171, 16.639216,
203  -6.969563, -16.785451, -9.724054, 3.801352, 22.168354, 48.242564,
204  90.620046, 87.325395, -123.816045, -58.131081, 50.128683, -36.277517,
205  5.098232, 47.392135, -22.992987, 9.356549, 12.630013, -36.661218,
206  -363.282598, 42.633189, -53.050249, 39.692389, 27.371883, -10.584300,
207  22.807966, -56.583317, 67.434613, 12.793143, -25.901444, 7.021491,
208  39.329433, 0.038098, -0.543312, 0.262068, -0.687094, 1.198206,
209  -0.057017, 0.092313, 0.043021, -0.024797, -0.032974, 0.031728,
210  -0.012591, -0.011246, 0.120357, -0.375800, -0.159186, -1.230970,
211  -0.878177, -0.064158, -0.032577, 0.006907, -0.018462, -0.045782,
212  0.013923, -0.000234, -0.007239, 0.874662, 0.795188, 0.078150, 0.647681,
213  -0.910413, 0.607686, 0.392656, 0.318523, 0.175609, -0.190211,
214  -0.174326, -0.159084, -0.125848, 0.684847, 0.781381, 0.173504,
215  0.743819, -0.308093, -0.019020, 0.201468, -0.032197, 0.421767,
216  -0.184326, 0.085897, 0.056416, 0.027466, -0.084307, 7.170500,
217  -3.661860, -14.563892, 10.893159, -0.186497, -2.318544, -0.902224,
218  1.504792, 0.147942, -0.734568, 0.585001, -0.868378, -4.121224,
219  2.466947, 2.325009, -11.400883, -10.773119, -0.627572, 0.455827,
220  1.057112, 1.796294, 0.987904, 0.212603, 0.359253, -0.105532, -7.992438,
221  -7.655343, -4.869693, -6.722327, 9.544512, -5.250600, -4.050820,
222  -5.120951, -0.758755, 1.829706, 1.384338, 2.390245, 1.296190,
223  -10.218486, -0.629071, -8.504401, -8.641282, -2.207658, 1.818525,
224  -1.423120, -0.898007, -1.263703, 2.076739, -2.244396, -0.292382,
225  -0.353299, 10.248974, -27.376506, 6.124142, 61.384787, -41.764771,
226  6.326810, 11.721932, 5.141960, -9.065378, 2.119422, 4.865250,
227  -5.308071, 5.989284, 32.326696, -13.531891, -19.457694, 44.769873,
228  42.491105, 6.557419, -3.201100, -8.098944, -12.725586, -5.451011,
229  -1.217291, -5.300221, -0.130005, 21.014798, 17.510967, 15.041109,
230  26.899854, -18.934167, 14.036661, 8.954179, 15.325031, 1.048105,
231  -4.266107, -2.382286, -6.221658, -3.671553, 27.778641, -9.561991,
232  31.240633, 11.989257, 20.109609, -3.582962, 5.319328, 6.014944,
233  -0.156488, -6.828748, 5.770803, -0.508356, 0.585577, -31.540378,
234  39.380786, -4.559957, -86.294496, 40.488945, -18.769312, -18.318774,
235  -11.135692, 16.764698, -7.576188, -9.399571, 12.263502, -13.097443,
236  -82.664532, 39.293663, 40.663177, -52.462998, -52.547568, -21.780121,
237  8.544329, 14.784174, 28.032260, 8.528502, 0.715122, 14.568276,
238  -0.115154, -21.239112, -8.226969, -15.442636, -26.612158, 6.677141,
239  -9.530594, -5.713634, -12.083189, -0.744603, 3.161936, 1.107489,
240  4.274360, 2.906592, -23.982064, 18.410091, -24.831194, 1.868333,
241  -23.761154, 1.421808, -4.591061, -6.513712, 1.590576, 6.079756,
242  -3.733402, 1.369797, 0.036043, 22.165010, -18.074133, 7.855068,
243  42.246652, -3.603180, 12.789308, 8.578457, 7.461044, -8.994677,
244  5.561167, 5.618378, -8.122258, 8.741300, 64.192477, -38.786800,
245  -22.642449, 15.698649, 22.567014, 19.725521, -6.242227, -7.074890,
246  -18.533355, -4.179728, 0.706036, -11.385839, 0.759281, 0.019447,
247  -0.321519, 0.119784, -0.074797, 0.077260, -0.769781, -1.337296,
248  0.040636, -0.068956, -0.068883, 0.026387, 0.014205, -0.001321,
249  0.068272, -0.184453, -0.026805, 0.001980, 0.023125, 1.282862,
250  -0.762171, 0.045567, 0.054089, -0.013119, -0.065518, -0.050090,
251  -0.033346, 0.591252, 0.495495, -0.078775, 0.653448, -0.190878,
252  0.286104, 0.011563, 0.041493, 0.292102, 0.071813, -0.022038, 0.077655,
253  0.134747, 0.642081, 0.298203, 0.174374, 0.035621, -0.027082, -0.021615,
254  0.253489, -0.125320, 0.176998, 0.024160, -0.156271, -0.106737,
255  0.078026, 1.765835, 1.372020, 0.062259, 1.437948, -0.768550, 4.026957,
256  2.516653, -1.195206, 0.194463, 0.609759, 0.477914, 0.039275, 0.085043,
257  -2.207613, 2.529836, -0.687636, 0.351815, 0.384883, -2.611568,
258  3.505054, 0.163649, -1.327412, 0.090694, 0.614554, 0.601481, 0.095022,
259  -0.871535, 0.119544, -0.108937, -0.551275, 0.973566, 0.737487,
260  0.344844, -0.004828, -0.838485, 0.007011, 0.094322, -0.054031,
261  -0.157722, -1.761764, -0.965691, -1.114498, -0.734733, 0.424344,
262  -0.315157, 0.747600, 0.077065, -0.250993, 0.150990, 0.335479, 0.320943,
263  0.003406, -3.168587, -1.260433, -2.190761, -3.170990, 1.870636,
264  -8.245646, -2.993538, 1.889443, 0.106361, -1.104209, -0.858865,
265  -0.141571, -0.317136, 4.019955, -2.289908, 1.225496, -0.670238,
266  -1.628387, 3.373839, -7.201759, -0.466417, 2.089699, -0.028354,
267  -0.812401, -0.886807, -0.142708, -0.074023, -0.018372, 0.055160,
268  -0.069238, 0.089849, -0.079363, -0.043138, 0.354535, -0.361675,
269  -0.004009, 0.025287, 0.004072, -0.006672, -0.046330, 0.185377,
270  -0.085176, 0.030711, -0.012072, 0.032997, -0.046105, 0.335955,
271  0.334184, -0.039451, 0.005832, -0.008278, 0.018905, -0.312693,
272  0.127976, -0.177347, 0.114024, 0.297272, -0.158177, 0.309353,
273  -0.078180, 0.461209, -0.027827, -0.082803, 0.015608, -0.014203,
274  0.086680, -0.094092, 0.193506, 0.010364, 0.030688, -0.248585,
275  -0.152054, -0.442186, -0.069645, 0.003033, -0.084052, -0.048800,
276  -0.021403, 0.072451, 0.051953, -0.026251, 0.059080, 0.053744, 0.047860,
277  -0.017435, 0.037730, -0.041852, 0.317511, 0.230828, -0.003490,
278  -0.020955, 0.030571, 0.126116, -0.099623, -0.062962, -0.006488,
279  0.025849, 0.113608, -0.020264, 0.059315, -0.187916, 0.244214,
280  -0.020019, -0.024625, 0.054342, -0.018074, 0.105125, 0.075732,
281  0.015922, 0.064729, -0.019431, -0.045231, -0.031091, 0.002592,
282  0.026699, -0.124771, 0.150817, 0.097936, 0.088664, -0.017489,
283  -0.049393, -0.016298, 0.065342, 0.020930, -0.004494, -0.012553,
284  0.019495, -0.021316, -0.210982, -0.127474, -0.129283, -0.063425,
285  -0.054209, 0.051204, -0.006596, 0.044107, -0.077901, -0.030469,
286  0.025592, 0.018597, -0.000246, -0.036534, -0.019517, 0.028308,
287  0.103966, 0.083250, -0.221282, -0.103371, 0.011245, -0.082415,
288  -0.028077, -0.003575, -0.036848, 0.036348, 0.010804, 0.030885,
289  -0.041841, 0.104022, 0.105598, -0.042406, -0.031386, -0.123089,
290  -0.061930, 0.081084, 0.061734, 0.049359, -0.037290, 0.006585,
291  -0.017415, -0.058447, 0.082053, -0.067225, -0.093859, 0.062868,
292  0.029391, -0.013171, 0.054954, -0.044198, 0.012521, -0.027162,
293  -0.027362, -0.024754
294  },
295  {
296  2.348018, -0.001699, 0.007715, 0.008054, 0.005956, 0.004442, 0.000192,
297  -0.001132, 0.000421, -0.000732, 0.104042, 0.073937, 0.006236, 0.017641,
298  0.002967, -0.017425, -0.001263, -0.011133, 1.628826, 0.000839,
299  -0.043487, 0.008183, -0.027630, -0.075356, -0.029852, 0.048012,
300  -0.008284, -0.363106, -0.590419, -0.212766, -0.041687, -0.092664,
301  -0.047221, 0.033426, 0.003241, 0.026134, -2.710255, 0.125712, 0.002491,
302  -0.040918, 0.027339, 0.226196, 0.099359, -0.126889, -0.011937,
303  0.351285, 0.449536, 0.186016, 0.047315, 0.073236, 0.046255, -0.022189,
304  0.005093, -0.015973, 1.193932, -0.066091, 0.073483, 0.020656,
305  -0.007722, -0.160789, -0.065105, 0.084813, 0.028908, 0.022510,
306  -0.475089, -0.204080, 0.000794, -0.006344, -0.006337, 0.005135,
307  -0.000647, 0.005509, -0.013830, 0.224803, -0.464797, -0.022138,
308  0.001138, 0.010352, -0.015882, -0.002307, 0.004197, 0.047607, 0.234728,
309  -0.007625, -0.033090, 0.018158, -0.018386, 0.012600, -0.007045,
310  0.033261, 0.020139, 0.078512, 0.219390, 0.039412, -0.013902, 0.022683,
311  -0.021540, -0.000198, 0.024949, -0.487616, 1.574244, 0.432463,
312  0.218492, 0.075169, 0.075773, 0.018466, 0.029614, -0.096548, -0.455430,
313  -0.415314, 1.733171, 0.184123, -0.018706, -0.107045, 0.120685,
314  -0.073586, -0.057949, -0.293838, -1.884681, -0.076974, 0.175803,
315  -0.233234, 0.085856, -0.433716, 0.049404, -0.332902, 0.475885,
316  0.209720, -1.490486, -0.201115, 0.106034, -0.125392, 0.215934,
317  0.128539, -0.088779, 1.327118, -1.829720, -0.109311, -0.762860,
318  -0.061753, -0.152755, -0.023608, 0.121147, 0.345016, 1.979343,
319  -0.843470, -2.838183, -0.447563, 0.072140, 0.152487, -0.191963,
320  0.148621, 0.120824, 0.644868, 3.963176, 1.131517, -0.365259, 0.210715,
321  -0.198506, 1.393376, -0.096845, 0.899000, -2.166833, -1.190547,
322  3.161021, 0.464725, -0.110211, 0.305447, -0.550121, -0.373833,
323  0.128468, -0.934276, 1.199678, 0.501081, 0.580176, -0.081116, 0.068154,
324  0.046532, -0.205327, -0.287616, -1.773041, 0.818055, 1.956153,
325  0.357749, -0.113235, -0.074916, 0.045023, -0.056935, -0.102033,
326  -0.463514, -2.643355, -1.685999, 0.371182, 0.034485, 0.115887,
327  -1.149404, 0.027926, -0.657321, 2.075349, 1.568890, -2.196361,
328  -0.307358, 0.094175, -0.181613, 0.385548, 0.250442, -0.044992,
329  -0.015733, -0.014472, 0.018836, 0.095844, -0.082169, -0.004467,
330  0.002126, -0.001382, -0.004955, -0.021777, -0.023440, 0.006277,
331  0.051548, 0.103019, 0.005133, -0.004611, -0.004134, -0.001079,
332  0.106588, 0.069897, 0.019879, -0.035639, 0.147082, 0.023604, 0.005004,
333  -0.023715, 0.000441, 0.088662, 0.075925, -0.061172, -0.133245,
334  0.008753, 0.004629, 0.022664, -0.013934, 0.050403, -0.005578, 0.124173,
335  -0.136488, -0.637906, 0.563826, -0.011007, -0.010520, -0.084654,
336  0.087195, -0.087516, 0.209648, 0.000548, -0.509944, -0.689913,
337  -0.089406, 0.037529, -0.031821, 0.015336, -0.296560, -0.399040,
338  0.135352, 0.293610, -0.554710, 0.004851, -0.013995, 0.163193, 0.017272,
339  -0.234823, -0.406313, 0.163453, 0.532010, 0.280655, 0.081339,
340  -0.009131, 0.152424, -0.334780, -0.020425, -0.377480, 0.190504,
341  0.300364, -1.050087, 0.020014, 0.056851, 0.159984, -0.122557, 0.179915,
342  -0.608465, -0.072259, 1.053742, 0.318071, 0.063549, -0.037475,
343  0.069399, -0.030931, 0.060784, 0.654025, -0.227380, -0.210893,
344  0.326508, 0.031074, -0.028936, -0.226340, 0.010711, 0.232391, 0.833718,
345  -0.064806, -0.337450, -0.279959, -0.066289, 0.009593, -0.184023,
346  0.401939, -0.026376, -0.001023, 0.020319, -0.003194, -0.016130,
347  0.032305, -0.067228, -0.008159, -0.008117, -0.006698, -0.014285,
348  -0.001860, 0.013103, -0.008092, 0.059979, 0.038945, 0.000080,
349  -0.012524, 0.014632, 0.065843, 0.002780, 0.005617, 0.015095, 0.052315,
350  -0.009234, -0.008999, 0.003270, 0.029486, 0.022521, 0.018000,
351  -0.012775, -0.005724, 0.005642, 0.031011, 0.000398, 0.014850, 0.084642,
352  -0.069241, -0.042539, -0.019294, 0.011683, -0.139180, -0.059414,
353  0.010924, 0.041329, 0.000852, 0.014060, -0.037598, 0.016026, 0.010226,
354  0.064456, -0.136401, -0.013533, 0.012086, -0.017698, -0.019324,
355  0.009433, -0.008142, 0.001055, 0.000024, -0.000156, 0.023261, 0.014897,
356  -0.002064, 0.003572, -0.010381, 0.010619, 0.002215, -0.000543,
357  0.003015, -0.013645, 0.021360, 0.017216, 0.015516, -0.013986,
358  -0.015010, -0.005596, -0.009339, 0.018945, 0.035999, 0.065646,
359  0.042485, -0.056088, 0.031171, -0.008497, -0.014708, -0.011700,
360  -0.020747, -0.054002, 0.021964, 0.002399, -0.005294, 0.009420,
361  0.006315, -0.005378, 0.004159, -0.001329, 0.001494, -0.003252,
362  0.006756, 0.008762, -0.013714, 0.003111, 0.002457, 0.002003, 0.008298,
363  0.005674, 0.015190, 0.009952, 0.005180, 0.003884, 0.007024, -0.008818,
364  0.001617, 0.002230, 0.006900, 0.008047, -0.001120, 0.000586, -0.005133,
365  0.002056, 0.005241, 0.000906, -0.000496, -0.001411, 0.007141,
366  }
367  }
368 };
369 
371 {
372  {
373  186.328060,
374  0.0, 4,
375  {
376  12.449863, 2.409311, 54.089065, -57.298571, -261.913700, 312.086626,
377  479.737242, -642.019944, -427.937731, 569.899389, 150.245248,
378  -185.248045, -1.514883, -0.798225, 2.088210, -0.430627, 25.863680,
379  -32.674075, -18.663771, 15.699147, -117.883190, 68.711532, 74.921172,
380  -32.489332, 79.809261, 129.447469, -121.492935, -76.854825, 79.432526,
381  -412.701131, 123.003527, 259.805297, -69.760607, 254.046342,
382  -59.562025, -173.002943, 0.814153, -0.605680, -0.282469, 0.365118,
383  18.160237, -16.197021, 9.625684, -1.871229, -57.303215, 85.838296,
384  -22.155819, 5.986576, 44.894123, -157.217622, 7.648798, -12.960942,
385  -3.743449, 97.164057, 1.217554, 0.966633, 0.916473, 0.598431,
386  -1.780034, -6.487091, -1.224404, -1.553588, 4.534438, 11.127223,
387  -0.389831, 0.420136, 0.382382, 0.068920, -0.123753, -0.199426,
388  0.077597, -0.040515, 0.002551, -0.084937, -0.035286, 0.043026
389  },
390  {
391  2.346487, -0.050736, 1.666251, -0.250297, -2.796702, 0.244721,
392  1.206740, 0.220620, 0.472184, 0.094050, -0.166664, -0.959924,
393  -2.385940, -0.349284, 1.767692, 1.743299, 5.202454, -0.770309,
394  -4.759476, -1.850621, -3.989485, 1.749054, 3.935344, -0.123819,
395  0.078496, 0.229228, 0.186326, 0.792451, -0.800171, -0.955354,
396  -0.443270, -1.440425, 0.576789, 0.654319, 0.409584, -0.003714,
397  -0.064398, 0.039451, -0.010398, 0.239607, 0.197164, -0.011023,
398  0.028878, 0.072306, 0.039317, -0.014321, 0.029819, 0.003067, 0.016890
399  }
400  },
401  {
402  186.738676,
403  10.333333, 4,
404  {
405  12.605497682, 0.551506466, 47.022139774, -21.448664030, -232.123104595,
406  200.764231706, 409.461413670, -572.203653389, -336.313529859,
407  644.782789433, 105.878095472, -252.733077045, 0.509462478, 2.344543172,
408  2.421526994, 2.506997850, -27.765498792, -9.170952722, -30.901991624,
409  -71.508784378, 120.170741210, 233.831852730, 92.168812032,
410  437.185394230, -111.905811833, -940.197494839, -51.277376062,
411  -1076.988061263, -16.697104428, 1403.390170514, -119.352261133,
412  1125.602157218, 37.957453385, -698.152854904, 114.285189037,
413  -416.092485976, 1.870004682, 0.601398662, -0.857661447, -0.182721559,
414  12.722215301, -2.923758620, 6.737100302, -13.432192542, -60.190568618,
415  24.488754670, -21.005718949, 64.898529127, 78.017091881, -66.946598203,
416  4.858141122, -71.035296381, -24.847382525, 60.239086024, 0.777315260,
417  -1.254128297, -0.880149499, 0.866973682, -3.326071610, -1.238013274,
418  -0.343299653, -1.549424458, 6.079231148, 1.600065539, -0.133203709,
419  -0.650440630, -0.118109335, 1.051542442, -0.437364250, -0.009617647,
420  0.006056462, 0.233159653, -0.212611477, 0.136207528, 0.027188046,
421  -0.079557094
422  },
423  {
424  2.348583830, 0.024899411, 1.586116060, -0.288055376, -2.782106795,
425  0.288450491, 1.320131302, 0.041358209, -0.525517556, 0.000734276,
426  0.115188751, -0.964525882, 1.356872410, -0.037834939, -0.677714455,
427  2.512392935, -0.215168429, 0.903984898, 0.686483448, -1.286067035,
428  -0.531922098, -1.461489809, -0.248006049, -0.111618606, 0.018803376,
429  0.219727474, 0.115543926, 0.747203747, -0.102341198, -0.762687644,
430  -0.316864698, -0.735845853, -0.367649659, 0.136061313, 0.079677826,
431  -0.054628257, -0.063472605, -0.050276834, 0.042014050, 0.199003049,
432  -0.130970256, -0.019506269, -0.008617415, -0.027111264, 0.146933574,
433  -0.000391404, -0.018168929, -0.008920463, -0.005064096,
434  }
435  }
436 };
437 
438 
439 CCIR_T ::
441  : testTime(2525, 4, 1, 0, 0, 0, gnsstk::TimeSystem::UTC)
442 {
443 }
444 
445 
446 unsigned CCIR_T ::
448 {
449  TUDEF("CCIR", "validateCache");
450  gnsstk::CCIR uut;
451  gnsstk::CivilTime t1(2525, 4, 1, 0, 0, 0, gnsstk::TimeSystem::UTC);
452  gnsstk::CivilTime t2(2525, 5, 1, 0, 0, 0, gnsstk::TimeSystem::UTC);
453  gnsstk::CivilTime t3(2525, 5, 1, 0, 0, 1.0e-16, gnsstk::TimeSystem::UTC);
454  gnsstk::CivilTime t4(2525, 5, 2, 0, 0, 1.0e-16, gnsstk::TimeSystem::UTC);
455  gnsstk::CivilTime t5(2526, 5, 2, 0, 0, 1.0e-16, gnsstk::TimeSystem::UTC);
456  double ess1 = 123.456;
457  double ess2 = ess1 + 1.1e-10;
458  // check initial state
459  TUASSERTE(bool, false, uut.cacheGood);
460  TUASSERTE(bool, false, uut.cacheFourierGood);
461  // check that the first call to validateCache will invalidate the cache
462  uut.cacheGood = uut.cacheFourierGood = true;
463  uut.validateCache(t1, ess1);
464  TUASSERTE(bool, false, uut.cacheGood);
465  TUASSERTE(bool, false, uut.cacheFourierGood);
466  // check that a change in month will invalidate the cache
467  uut.cacheGood = uut.cacheFourierGood = true;
468  uut.validateCache(t2, ess1);
469  TUASSERTE(bool, false, uut.cacheGood);
470  TUASSERTE(bool, false, uut.cacheFourierGood);
471  // check that a change in UT hour will invalidate the cache
472  uut.cacheGood = uut.cacheFourierGood = true;
473  uut.validateCache(t3, ess1);
474  TUASSERTE(bool, false, uut.cacheGood);
475  TUASSERTE(bool, false, uut.cacheFourierGood);
476  // check that a change in effective sun spots will invalidate the cache
477  uut.cacheGood = uut.cacheFourierGood = true;
478  uut.validateCache(t3, ess2);
479  TUASSERTE(bool, false, uut.cacheGood);
480  TUASSERTE(bool, false, uut.cacheFourierGood);
481  // check that a change in day will NOT invalidate the cache
482  uut.cacheGood = uut.cacheFourierGood = true;
483  uut.validateCache(t4, ess2);
484  TUASSERTE(bool, true, uut.cacheGood);
485  TUASSERTE(bool, true, uut.cacheFourierGood);
486  // check that a change in year will NOT invalidate the cache
487  uut.cacheGood = uut.cacheFourierGood = true;
488  uut.validateCache(t5, ess2);
489  TUASSERTE(bool, true, uut.cacheGood);
490  TUASSERTE(bool, true, uut.cacheFourierGood);
491  // check that no change will NOT invalidate the cache
492  uut.cacheGood = uut.cacheFourierGood = true;
493  uut.validateCache(t5, ess2);
494  TUASSERTE(bool, true, uut.cacheGood);
495  TUASSERTE(bool, true, uut.cacheFourierGood);
496  TURETURN();
497 }
498 
499 
500 unsigned CCIR_T ::
502 {
503  TUDEF("CCIR", "");
504  // 0.0 = minimum solar flux units
505  // 0 = low solar activity array index
506  testF2LayerCoeffAZr(testFramework, testTime, 0.0, 0);
507  // 100.0 = solar flux units
508  // 1 = high solar activity array index
509  testF2LayerCoeffAZr(testFramework, testTime, 100.0, 1);
510  TURETURN();
511 }
512 
513 
514 void CCIR_T ::
516  const gnsstk::CivilTime& when,
517  double Azr, unsigned solarActIdx)
518 {
519  TUCSM("interpolate");
520  gnsstk::CCIR uut;
521  TUCATCH(uut.interpolate(when, Azr));
522 
523  unsigned vecidx = 0;
524  for (unsigned degree = 0; degree < gnsstk::CCIR::F2MaxDegree; degree++)
525  {
526  for (unsigned order = 0; order < gnsstk::CCIR::F2MaxOrder; order++)
527  {
528  TUASSERTFE(uut.ccirF2(when.month, solarActIdx, degree, order),
529  uut.cacheF2[vecidx]);
530  vecidx++;
531  }
532  }
533 
534  vecidx = 0;
535  for (unsigned degree = 0; degree < gnsstk::CCIR::FM3MaxDegree; degree++)
536  {
537  for (unsigned order = 0; order < gnsstk::CCIR::FM3MaxOrder; order++)
538  {
539  TUASSERTFE(uut.ccirFm3(when.month, solarActIdx, degree, order),
540  uut.cacheFM3[vecidx]);
541  vecidx++;
542  }
543  }
544 }
545 
546 
547 unsigned CCIR_T ::
549 {
550  TUDEF("CCIR", "interpolate");
551  gnsstk::CCIR uut;
552  unsigned numTests = sizeof(testData)/sizeof(testData[0]);
553  for (unsigned testNum = 0; testNum < numTests; testNum++)
554  {
555  DEBUGTRACE("testNum = " << testNum);
556  TUCATCH(uut.interpolate(testTime, testData[testNum].tAzr));
557  unsigned vecidx = 0;
558  TUASSERTE(unsigned long, testData[testNum].tF2.size(),
559  uut.cacheF2.size());
560  for (unsigned degree = 0; degree < gnsstk::CCIR::F2MaxDegree; degree++)
561  {
562  for (unsigned order = 0; order < gnsstk::CCIR::F2MaxOrder; order++)
563  {
564  TUASSERTFEPS(testData[testNum].tF2[vecidx], uut.cacheF2[vecidx],
566  vecidx++;
567  }
568  }
569  vecidx = 0;
570  TUASSERTE(unsigned long, testData[testNum].tFm3.size(),
571  uut.cacheFM3.size());
572  for (unsigned degree = 0; degree < gnsstk::CCIR::FM3MaxDegree; degree++)
573  {
574  for (unsigned order = 0; order < gnsstk::CCIR::FM3MaxOrder; order++)
575  {
576  TUASSERTFEPS(testData[testNum].tFm3[vecidx], uut.cacheFM3[vecidx],
578  vecidx++;
579  }
580  }
581  }
582  TURETURN();
583 }
584 
585 
586 unsigned CCIR_T ::
588 {
589  TUDEF("CCIR", "fourier");
590  gnsstk::CCIR uut;
592  unsigned numTests = sizeof(testDataFourier)/sizeof(testDataFourier[0]);
593  for (unsigned testNum = 0; testNum < numTests; testNum++)
594  {
595  TUCATCH(uut.fourier(testDataFourier[testNum].ct,
596  testDataFourier[testNum].tAzr));
597  unsigned vecidx = 0;
598  TUASSERTE(unsigned long, testDataFourier[testNum].tCF2.size(),
599  uut.cacheCF2.size());
600  TUASSERTE(unsigned long, gnsstk::CCIR::F2MaxDegree, uut.cacheCF2.size());
601  for (unsigned degree = 0; degree < gnsstk::CCIR::F2MaxDegree; degree++)
602  {
603  TUASSERTFEPS(testDataFourier[testNum].tCF2[vecidx],
604  uut.cacheCF2[vecidx], interpCoeffEps);
605  vecidx++;
606  }
607  vecidx = 0;
608  TUASSERTE(unsigned long, testDataFourier[testNum].tCm3.size(),
609  uut.cacheCM3.size());
610  TUASSERTE(unsigned long, gnsstk::CCIR::FM3MaxDegree, uut.cacheCM3.size());
611  for (unsigned degree = 0; degree < gnsstk::CCIR::FM3MaxDegree; degree++)
612  {
613  TUASSERTFEPS(testDataFourier[testNum].tCm3[vecidx],
614  uut.cacheCM3[vecidx], interpCoeffEps);
615  vecidx++;
616  }
617  }
618  TURETURN();
619 }
620 
621 
622 int main(int argc, char *argv[])
623 {
624  CCIR_T testClass;
625  unsigned errorTotal = 0;
626 
627  errorTotal += testClass.testValidateCache();
628  errorTotal += testClass.testF2LayerCoeff();
629  errorTotal += testClass.testF2LayerCoeffInterp();
630  errorTotal += testClass.testF2LayerFourier();
631 
632  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
633  << std::endl;
634 
635  return errorTotal;
636 }
CCIR_T::TestData::tF2
std::vector< double > tF2
Definition: CCIR_T.cpp:84
gnsstk::CCIR::ccirF2
double ccirF2(unsigned month, int cond, int deg, int ord)
Definition: CCIR.cpp:236
TUCSM
#define TUCSM(METHOD)
Definition: TestUtil.hpp:59
CCIR_T::interpCoeffEps
static const double interpCoeffEps
Epsilon for interpolated coefficients.
Definition: CCIR_T.cpp:117
CCIR_T
Definition: CCIR_T.cpp:45
gnsstk::CCIR::cacheCF2
std::vector< double > cacheCF2
Cached interpolated CF2 coefficients.
Definition: CCIR.hpp:217
TUCATCH
#define TUCATCH(STATEMENT)
Definition: TestUtil.hpp:193
CCIR_T::TestData
Hold input/truth data for testF2LayerCoeffInterp.
Definition: CCIR_T.cpp:76
CCIR.hpp
CCIR_T::TestData::tFm3
std::vector< double > tFm3
Definition: CCIR_T.cpp:85
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
DEBUGTRACE
#define DEBUGTRACE(EXPR)
Definition: DebugTrace.hpp:119
CCIR_T::testF2LayerCoeffAZr
void testF2LayerCoeffAZr(gnsstk::TestUtil &testFramework, const gnsstk::CivilTime &when, double Azr, unsigned solarActIdx)
Definition: CCIR_T.cpp:515
example6.hour
hour
Definition: example6.py:67
CCIR_T::TestData::TestData
TestData(double iazr, const std::vector< double > &coeffF2, const std::vector< double > &coeffFm3)
Definition: CCIR_T.cpp:79
CCIR_T::testData
static TestData testData[]
Input/truth data for testF2LayerCoeffInterp.
Definition: CCIR_T.cpp:113
gnsstk::CCIR::cacheCM3
std::vector< double > cacheCM3
Cached interpolated Cm3 coefficients.
Definition: CCIR.hpp:219
CCIR_T::testF2LayerCoeff
unsigned testF2LayerCoeff()
Definition: CCIR_T.cpp:501
CCIR_T::testValidateCache
unsigned testValidateCache()
Test the validateCache method.
Definition: CCIR_T.cpp:447
gnsstk::CCIR::cacheFourierGood
bool cacheFourierGood
Cache state information for Fourier data.
Definition: CCIR.hpp:223
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::CCIR::cacheFM3
std::vector< double > cacheFM3
Cached interpolated FM3 coefficients (Am3).
Definition: CCIR.hpp:215
gnsstk::CCIR::cacheGood
bool cacheGood
Cache state information for interpolated (non-Fourier) data.
Definition: CCIR.hpp:221
gnsstk::CCIR::ccirFm3
double ccirFm3(unsigned month, int cond, int deg, int ord)
Definition: CCIR.cpp:260
CCIR_T::testTime
gnsstk::CivilTime testTime
Reference time for various interpolation tests.
Definition: CCIR_T.cpp:111
gnsstk::CCIR::FM3MaxOrder
@ FM3MaxOrder
FM3 coefficients maximum order.
Definition: CCIR.hpp:74
TestUtil.hpp
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
gnsstk::CCIR::cacheF2
std::vector< double > cacheF2
Cached interpolated F2 coefficients (AF2).
Definition: CCIR.hpp:213
CCIR_T::CCIR_T
CCIR_T()
Definition: CCIR_T.cpp:440
gnsstk::CCIR::FM3MaxDegree
@ FM3MaxDegree
FM3 coefficients maximum degree.
Definition: CCIR.hpp:73
gnsstk::min
T min(const SparseMatrix< T > &SM)
Maximum element - return 0 if empty.
Definition: SparseMatrix.hpp:858
gnsstk::CCIR::interpolate
void interpolate(const CommonTime &when, double effSunSpots)
Definition: CCIR.cpp:68
gnsstk::TimeSystem
TimeSystem
Definition of various time systems.
Definition: TimeSystem.hpp:51
TUASSERTFEPS
#define TUASSERTFEPS(EXP, GOT, EPS)
Definition: TestUtil.hpp:126
CCIR_T::TestData::tAzr
double tAzr
Definition: CCIR_T.cpp:83
CivilTime.hpp
CCIR_T::testDataFourier
static TestDataFourier testDataFourier[]
Input/truth data for testF2LayerFourier.
Definition: CCIR_T.cpp:115
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
CCIR_T::testF2LayerCoeffInterp
unsigned testF2LayerCoeffInterp()
Definition: CCIR_T.cpp:548
CCIR_T::TestDataFourier::TestDataFourier
TestDataFourier(double iazr, double hour, int month, const std::vector< double > &coeffCF2, const std::vector< double > &coeffCm3)
Definition: CCIR_T.cpp:92
gnsstk::TimeSystem::UTC
@ UTC
Coordinated Universal Time (e.g., from NTP)
CCIR_T::TestDataFourier
Hold input/truth data for testF2LayerFourier.
Definition: CCIR_T.cpp:89
gnsstk::CivilTime
Definition: CivilTime.hpp:55
GNSSTK_ASSERT
#define GNSSTK_ASSERT(CONDITION)
Provide an "ASSERT" type macro.
Definition: Exception.hpp:373
gnsstk::CCIR::F2MaxDegree
@ F2MaxDegree
F2 coefficients maximum degree.
Definition: CCIR.hpp:71
gnsstk::CCIR
Definition: CCIR.hpp:59
DebugTrace.hpp
DEBUGTRACE_ENABLE
#define DEBUGTRACE_ENABLE()
Definition: DebugTrace.hpp:107
gnsstk::CivilTime::month
int month
Definition: CivilTime.hpp:199
CCIR_T::TestDataFourier::ct
gnsstk::CivilTime ct
Definition: CCIR_T.cpp:105
CCIR_T::TestDataFourier::tAzr
double tAzr
Definition: CCIR_T.cpp:104
TUASSERTFE
#define TUASSERTFE(EXP, GOT)
Definition: TestUtil.hpp:103
example6.month
month
Definition: example6.py:65
gnsstk::CCIR::F2MaxOrder
@ F2MaxOrder
F2 coefficients maximum order.
Definition: CCIR.hpp:72
CCIR_T::TestDataFourier::tCF2
std::vector< double > tCF2
Definition: CCIR_T.cpp:106
gnsstk::TestUtil
Definition: TestUtil.hpp:265
CCIR_T::TestDataFourier::tCm3
std::vector< double > tCm3
Definition: CCIR_T.cpp:107
gnsstk::CCIR::validateCache
void validateCache(const CommonTime &when, double effSunSpots)
Definition: CCIR.cpp:192
main
int main(int argc, char *argv[])
Definition: CCIR_T.cpp:622
CCIR_T::testF2LayerFourier
unsigned testF2LayerFourier()
Definition: CCIR_T.cpp:587
gnsstk::CivilTime::getUTHour
double getUTHour() const
Get the "universal time"-esque fractional hour of day.
Definition: CivilTime.hpp:195
gnsstk::CCIR::fourier
void fourier(const CommonTime &when, double effSunSpots)
Definition: CCIR.cpp:81


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:38