PX4 Firmware
PX4 Autopilot Software http://px4.io
test_autodeclination.cpp
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright (C) 2016-2019 PX4 Development Team. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in
13  * the documentation and/or other materials provided with the
14  * distribution.
15  * 3. Neither the name PX4 nor the names of its contributors may be
16  * used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
26  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  *
32  ****************************************************************************/
33 
34 /**
35  * @file test_autodeclination.cpp
36  * Test for autodeclination values.
37  */
38 
39 #include <unit_test.h>
40 
41 #include <drivers/drv_hrt.h>
42 #include <lib/ecl/geo/geo.h>
44 #include <px4iofirmware/px4io.h>
45 #include <systemlib/err.h>
46 
47 #include <math.h>
48 #include <stdio.h>
49 #include <stdlib.h>
50 #include <string.h>
51 #include <unistd.h>
52 
54 {
55 public:
56  virtual bool run_tests();
57 
58 private:
59  bool autodeclination_check();
60 };
61 
63 {
64  // Test world data using data from Magnetic Model: IGRF12 (calculator version 0.5.0.7)
65  // Decimal Year 2018.05753
66 
67  // ut_compare_float last argument is precision
68  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -180), 2.76391, 0.3);
69  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -170), 7.65238, 0.3);
70  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -160), 12.17294, 0.3);
71  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -150), 16.01107, 0.3);
72  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -140), 18.72801, 0.3);
73  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -130), 19.73724, 0.3);
74  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -120), 18.25112, 0.3);
75  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -110), 13.26654, 0.3);
76  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -100), 4.13317, 0.3);
77  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -90), -7.62673, 0.3);
78  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -80), -17.84456, 0.3);
79  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -70), -23.58845, 0.3);
80  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -60), -25.01681, 0.3);
81  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -50), -23.47267, 0.3);
82  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -40), -20.44728, 0.3);
83  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -30), -15.8376, 0.3);
84  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -20), -11.04886, 0.3);
85  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, -10), -6.13803, 0.3);
86  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 0), -1.38702, 0.3);
87  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 10), 3.0231, 0.3);
88  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 20), 7.04485, 0.3);
89  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 30), 10.68855, 0.3);
90  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 40), 13.86345, 0.3);
91  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 50), 16.27102, 0.3);
92  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 60), 17.41732, 0.3);
93  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 70), 16.69502, 0.3);
94  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 80), 13.51634, 0.3);
95  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 90), 7.64291, 0.3);
96  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 100), -0.46206, 0.3);
97  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 110), -7.83102, 0.3);
98  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 120), -13.14815, 0.3);
99  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 130), -15.19585, 0.3);
100  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 140), -14.314, 0.3);
101  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 150), -11.33504, 0.3);
102  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 160), -7.09405, 0.3);
103  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 170), -2.24693, 0.3);
104  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(60, 180), 2.76391, 0.3);
105  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -180), 3.39297, 0.3);
106  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -170), 7.64688, 0.3);
107  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -160), 11.46075, 0.3);
108  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -150), 14.55849, 0.3);
109  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -140), 16.58104, 0.3);
110  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -130), 17.12886, 0.3);
111  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -120), 15.76953, 0.3);
112  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -110), 11.9804, 0.3);
113  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -100), 5.33907, 0.3);
114  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -90), -3.51221, 0.3);
115  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -80), -12.05701, 0.3);
116  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -70), -17.6109, 0.3);
117  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -60), -19.46549, 0.3);
118  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -50), -18.43554, 0.3);
119  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -40), -15.64288, 0.3);
120  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -30), -11.94753, 0.3);
121  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -20), -7.88526, 0.3);
122  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, -10), -3.85052, 0.3);
123  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 0), -0.21495, 0.3);
124  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 10), 2.80897, 0.3);
125  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 20), 5.29489, 0.3);
126  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 30), 7.40813, 0.3);
127  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 40), 9.12158, 0.3);
128  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 50), 10.20849, 0.3);
129  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 60), 10.40516, 0.3);
130  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 70), 9.47967, 0.3);
131  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 80), 7.22842, 0.3);
132  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 90), 3.55584, 0.3);
133  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 100), -1.29281, 0.3);
134  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 110), -6.43861, 0.3);
135  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 120), -10.49228, 0.3);
136  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 130), -12.34449, 0.3);
137  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 140), -11.76562, 0.3);
138  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 150), -9.22608, 0.3);
139  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 160), -5.4404, 0.3);
140  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 170), -1.07169, 0.3);
141  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(50, 180), 3.39297, 0.3);
142  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -180), 4.73304, 0.3);
143  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -170), 8.06967, 0.3);
144  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -160), 10.84965, 0.3);
145  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -150), 13.03592, 0.3);
146  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -140), 14.4382, 0.3);
147  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -130), 14.73187, 0.3);
148  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -120), 13.57059, 0.3);
149  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -110), 10.56659, 0.3);
150  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -100), 5.33695, 0.3);
151  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -90), -1.83952, 0.3);
152  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -80), -9.22582, 0.3);
153  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -70), -14.50199, 0.3);
154  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -60), -16.59645, 0.3);
155  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -50), -15.90646, 0.3);
156  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -40), -13.42777, 0.3);
157  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -30), -10.05355, 0.3);
158  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -20), -6.33304, 0.3);
159  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, -10), -2.70446, 0.3);
160  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 0), 0.32852, 0.3);
161  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 10), 2.53857, 0.3);
162  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 20), 4.16517, 0.3);
163  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 30), 5.40477, 0.3);
164  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 40), 6.09072, 0.3);
165  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 50), 6.10984, 0.3);
166  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 60), 5.65289, 0.3);
167  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 70), 4.84976, 0.3);
168  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 80), 3.54739, 0.3);
169  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 90), 1.50963, 0.3);
170  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 100), -1.37218, 0.3);
171  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 110), -4.8133, 0.3);
172  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 120), -7.86308, 0.3);
173  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 130), -9.35691, 0.3);
174  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 140), -8.79624, 0.3);
175  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 150), -6.4712, 0.3);
176  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 160), -3.00633, 0.3);
177  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 170), 0.92526, 0.3);
178  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(40, 180), 4.73304, 0.3);
179  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -180), 6.51208, 0.3);
180  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -170), 8.60794, 0.3);
181  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -160), 10.40201, 0.3);
182  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -150), 11.35813, 0.3);
183  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -140), 12.28963, 0.3);
184  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -130), 12.46921, 0.3);
185  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -120), 11.53386, 0.3);
186  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -110), 9.18036, 0.3);
187  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -100), 5.02502, 0.3);
188  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -90), -0.91666, 0.3);
189  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -80), -7.48211, 0.3);
190  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -70), -12.75024, 0.3);
191  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -60), -15.41473, 0.3);
192  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -50), -15.34632, 0.3);
193  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -40), -13.23131, 0.3);
194  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -30), -9.97999, 0.3);
195  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -20), -6.26609, 0.3);
196  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, -10), -2.67489, 0.3);
197  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 0), 0.42859, 0.3);
198  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 10), 1.98719, 0.3);
199  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 20), 3.35693, 0.3);
200  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 30), 4.30231, 0.3);
201  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 40), 4.34228, 0.3);
202  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 50), 3.53408, 0.3);
203  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 60), 2.61371, 0.3);
204  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 70), 1.94408, 0.3);
205  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 80), 1.27365, 0.3);
206  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 90), 0.30968, 0.3);
207  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 100), -1.17718, 0.3);
208  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 110), -3.29027, 0.3);
209  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 120), -5.41121, 0.3);
210  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 130), -6.35606, 0.3);
211  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 140), -5.52501, 0.3);
212  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 150), -3.19361, 0.3);
213  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 160), 0.06272, 0.3);
214  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 170), 3.54892, 0.3);
215  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(30, 180), 6.51208, 0.3);
216  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -180), 8.05455, 0.3);
217  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -170), 8.9018, 0.3);
218  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -160), 9.28221, 0.3);
219  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -150), 9.82187, 0.3);
220  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -140), 10.36589, 0.3);
221  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -130), 10.39581, 0.3);
222  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -120), 9.69265, 0.3);
223  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -110), 8.06385, 0.3);
224  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -100), 4.97456, 0.3);
225  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -90), 0.08873, 0.3);
226  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -80), -5.94379, 0.3);
227  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -70), -11.56551, 0.3);
228  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -60), -15.26153, 0.3);
229  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -50), -16.24801, 0.3);
230  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -40), -14.66383, 0.3);
231  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -30), -11.38606, 0.3);
232  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -20), -7.39534, 0.3);
233  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, -10), -3.57892, 0.3);
234  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 0), -0.73934, 0.3);
235  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 10), 1.12744, 0.3);
236  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 20), 2.64851, 0.3);
237  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 30), 3.6306, 0.3);
238  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 40), 3.29003, 0.3);
239  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 50), 1.9185, 0.3);
240  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 60), 0.68749, 0.3);
241  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 70), 0.05693, 0.3);
242  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 80), -0.26716, 0.3);
243  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 90), -0.47945, 0.3);
244  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 100), -0.85743, 0.3);
245  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 110), -1.87811, 0.3);
246  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 120), -3.17942, 0.3);
247  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 130), -3.50309, 0.3);
248  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 140), -2.25553, 0.3);
249  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 150), 0.44973, 0.3);
250  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 160), 3.15526, 0.3);
251  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 170), 6.0726, 0.3);
252  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(20, 180), 8.05455, 0.3);
253  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -180), 8.96811, 0.3);
254  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -170), 9.00326, 0.3);
255  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -160), 8.80988, 0.3);
256  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -150), 8.96581, 0.3);
257  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -140), 9.20037, 0.3);
258  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -130), 9.0534, 0.3);
259  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -120), 8.5718, 0.3);
260  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -110), 7.65493, 0.3);
261  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -100), 5.53227, 0.3);
262  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -90), 1.47753, 0.3);
263  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -80), -4.32444, 0.3);
264  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -70), -10.57652, 0.3);
265  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -60), -15.55305, 0.3);
266  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -50), -17.91817, 0.3);
267  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -40), -17.19243, 0.3);
268  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -30), -14.02084, 0.3);
269  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -20), -9.68895, 0.3);
270  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, -10), -5.47648, 0.3);
271  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 0), -2.29568, 0.3);
272  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 10), -0.0338, 0.3);
273  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 20), 1.88618, 0.3);
274  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 30), 2.9443, 0.3);
275  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 40), 2.24776, 0.3);
276  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 50), 0.43529, 0.3);
277  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 60), -1.02026, 0.3);
278  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 70), -1.62575, 0.3);
279  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 80), -1.61789, 0.3);
280  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 90), -1.07428, 0.3);
281  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 100), -0.43078, 0.3);
282  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 110), -0.57046, 0.3);
283  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 120), -1.25424, 0.3);
284  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 130), -1.04428, 0.3);
285  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 140), 0.58806, 0.3);
286  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 150), 3.00104, 0.3);
287  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 160), 5.63284, 0.3);
288  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 170), 7.86621, 0.3);
289  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(10, 180), 8.96811, 0.3);
290  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -180), 9.65068, 0.3);
291  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -170), 9.46759, 0.3);
292  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -160), 9.21732, 0.3);
293  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -150), 9.26704, 0.3);
294  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -140), 9.31917, 0.3);
295  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -130), 9.03556, 0.3);
296  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -120), 8.63887, 0.3);
297  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -110), 8.14347, 0.3);
298  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -100), 6.70051, 0.3);
299  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -90), 3.24587, 0.3);
300  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -80), -2.53824, 0.3);
301  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -70), -9.5519, 0.3);
302  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -60), -15.78848, 0.3);
303  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -50), -19.60215, 0.3);
304  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -40), -20.46832, 0.3);
305  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -30), -17.73341, 0.3);
306  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -20), -13.52156, 0.3);
307  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, -10), -8.9561, 0.3);
308  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 0), -5.01498, 0.3);
309  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 10), -1.82178, 0.3);
310  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 20), 0.69154, 0.3);
311  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 30), 1.62948, 0.3);
312  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 40), 0.31861, 0.3);
313  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 50), -2.02581, 0.3);
314  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 60), -3.63856, 0.3);
315  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 70), -4.02958, 0.3);
316  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 80), -3.41245, 0.3);
317  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 90), -1.87563, 0.3);
318  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 100), -0.45464, 0.3);
319  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 110), 0.48183, 0.3);
320  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 120), 0.27308, 0.3);
321  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 130), 0.85887, 0.3);
322  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 140), 2.71814, 0.3);
323  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 150), 5.06264, 0.3);
324  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 160), 7.34057, 0.3);
325  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 170), 9.03413, 0.3);
326  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(0, 180), 9.65068, 0.3);
327  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -180), 10.85622, 0.3);
328  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -170), 10.83952, 0.3);
329  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -160), 10.78586, 0.3);
330  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -150), 10.86624, 0.3);
331  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -140), 10.82903, 0.3);
332  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -130), 10.44786, 0.3);
333  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -120), 9.97844, 0.3);
334  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -110), 9.5716, 0.3);
335  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -100), 8.51933, 0.3);
336  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -90), 5.5268, 0.3);
337  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -80), -0.25975, 0.3);
338  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -70), -8.02128, 0.3);
339  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -60), -15.46443, 0.3);
340  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -50), -20.65426, 0.3);
341  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -40), -22.77406, 0.3);
342  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -30), -21.95047, 0.3);
343  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -20), -18.99256, 0.3);
344  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, -10), -14.69503, 0.3);
345  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 0), -9.76978, 0.3);
346  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 10), -5.16636, 0.3);
347  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 20), -2.08706, 0.3);
348  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 30), -1.81675, 0.3);
349  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 40), -4.23367, 0.3);
350  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 50), -7.17513, 0.3);
351  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 60), -8.6249, 0.3);
352  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 70), -8.28432, 0.3);
353  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 80), -6.54836, 0.3);
354  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 90), -3.6667, 0.3);
355  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 100), -0.68901, 0.3);
356  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 110), 0.85877, 0.3);
357  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 120), 1.26385, 0.3);
358  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 130), 2.23753, 0.3);
359  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 140), 4.26718, 0.3);
360  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 150), 6.62102, 0.3);
361  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 160), 8.78297, 0.3);
362  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 170), 10.29336, 0.3);
363  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-10, 180), 10.85622, 0.3);
364  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -180), 13.11268, 0.3);
365  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -170), 13.37579, 0.3);
366  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -160), 13.53407, 0.3);
367  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -150), 13.64149, 0.3);
368  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -140), 13.52041, 0.3);
369  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -130), 13.0848, 0.3);
370  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -120), 12.59068, 0.3);
371  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -110), 12.22644, 0.3);
372  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -100), 11.40926, 0.3);
373  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -90), 8.75137, 0.3);
374  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -80), 3.04903, 0.3);
375  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -70), -5.25076, 0.3);
376  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -60), -13.82106, 0.3);
377  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -50), -20.32136, 0.3);
378  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -40), -23.88942, 0.3);
379  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -30), -24.94171, 0.3);
380  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -20), -24.16991, 0.3);
381  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, -10), -21.45897, 0.3);
382  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 0), -16.6749, 0.3);
383  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 10), -11.59204, 0.3);
384  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 20), -9.18683, 0.3);
385  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 30), -10.67507, 0.3);
386  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 40), -14.34292, 0.3);
387  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 50), -17.27975, 0.3);
388  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 60), -17.78731, 0.3);
389  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 70), -15.96469, 0.3);
390  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 80), -12.46302, 0.3);
391  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 90), -7.75001, 0.3);
392  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 100), -3.08968, 0.3);
393  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 110), -0.40163, 0.3);
394  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 120), 1.485, 0.3);
395  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 130), 3.24596, 0.3);
396  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 140), 5.70537, 0.3);
397  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 150), 8.34017, 0.3);
398  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 160), 10.69411, 0.3);
399  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 170), 12.34361, 0.3);
400  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-20, 180), 13.11268, 0.3);
401  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -180), 16.76996, 0.3);
402  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -170), 17.25561, 0.3);
403  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -160), 17.48308, 0.3);
404  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -150), 17.5041, 0.3);
405  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -140), 17.28097, 0.3);
406  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -130), 16.92057, 0.3);
407  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -120), 16.6716, 0.3);
408  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -110), 16.5491, 0.3);
409  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -100), 15.87065, 0.3);
410  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -90), 13.296, 0.3);
411  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -80), 7.67066, 0.3);
412  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -70), -0.78849, 0.3);
413  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -60), -10.06988, 0.3);
414  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -50), -17.66004, 0.3);
415  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -40), -22.38439, 0.3);
416  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -30), -24.71024, 0.3);
417  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -20), -25.51542, 0.3);
418  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, -10), -24.76053, 0.3);
419  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 0), -22.32543, 0.3);
420  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 10), -20.28166, 0.3);
421  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 20), -21.40386, 0.3);
422  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 30), -25.30151, 0.3);
423  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 40), -29.46545, 0.3);
424  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 50), -31.84686, 0.3);
425  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 60), -31.4949, 0.3);
426  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 70), -28.43575, 0.3);
427  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 80), -23.14502, 0.3);
428  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 90), -16.2011, 0.3);
429  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 100), -9.03586, 0.3);
430  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 110), -3.45507, 0.3);
431  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 120), 0.46804, 0.3);
432  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 130), 3.93373, 0.3);
433  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 140), 7.48026, 0.3);
434  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 150), 10.84895, 0.3);
435  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 160), 13.6994, 0.3);
436  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 170), 15.69862, 0.3);
437  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-30, 180), 16.76996, 0.3);
438  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -180), 22.27152, 0.3);
439  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -170), 22.79516, 0.3);
440  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -160), 22.88573, 0.3);
441  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -150), 22.72737, 0.3);
442  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -140), 22.47926, 0.3);
443  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -130), 22.36228, 0.3);
444  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -120), 22.48086, 0.3);
445  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -110), 22.51851, 0.3);
446  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -100), 21.626, 0.3);
447  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -90), 18.71198, 0.3);
448  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -80), 13.05342, 0.3);
449  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -70), 4.93397, 0.3);
450  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -60), -4.10539, 0.3);
451  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -50), -11.9663, 0.3);
452  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -40), -17.34478, 0.3);
453  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -30), -20.32802, 0.3);
454  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -20), -21.74287, 0.3);
455  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, -10), -22.31022, 0.3);
456  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 0), -23.00178, 0.3);
457  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 10), -25.48173, 0.3);
458  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 20), -30.36043, 0.3);
459  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 30), -36.2258, 0.3);
460  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 40), -41.34601, 0.3);
461  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 50), -44.67424, 0.3);
462  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 60), -45.61906, 0.3);
463  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 70), -43.82595, 0.3);
464  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 80), -39.06141, 0.3);
465  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 90), -31.25601, 0.3);
466  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 100), -21.32532, 0.3);
467  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 110), -11.44307, 0.3);
468  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 120), -3.04971, 0.3);
469  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 130), 3.96484, 0.3);
470  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 140), 9.91892, 0.3);
471  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 150), 14.80155, 0.3);
472  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 160), 18.51373, 0.3);
473  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 170), 20.96666, 0.3);
474  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-40, 180), 22.27152, 0.3);
475  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -180), 30.84148, 0.3);
476  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -170), 31.06389, 0.3);
477  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -160), 30.81915, 0.3);
478  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -150), 30.43597, 0.3);
479  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -140), 30.44219, 0.3);
480  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -130), 30.03663, 0.3);
481  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -120), 29.94126, 0.3);
482  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -110), 29.32525, 0.3);
483  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -100), 27.46901, 0.3);
484  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -90), 23.78201, 0.3);
485  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -80), 18.09163, 0.3);
486  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -70), 10.83361, 0.3);
487  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -60), 3.05909, 0.3);
488  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -50), -3.92584, 0.3);
489  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -40), -9.21168, 0.3);
490  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -30), -12.73883, 0.3);
491  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -20), -15.21664, 0.3);
492  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, -10), -17.72082, 0.3);
493  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 0), -21.32895, 0.3);
494  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 10), -26.66104, 0.3);
495  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 20), -33.39547, 0.3);
496  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 30), -40.49868, 0.3);
497  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 40), -46.96513, 0.3);
498  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 50), -52.16043, 0.3);
499  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 60), -55.7058, 0.3);
500  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 70), -57.28183, 0.3);
501  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 80), -56.43297, 0.3);
502  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 90), -52.34375, 0.3);
503  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 100), -43.87223, 0.3);
504  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 110), -30.47619, 0.3);
505  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 120), -13.97494, 0.3);
506  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 130), 1.68192, 0.3);
507  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 140), 13.72947, 0.3);
508  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 150), 21.87931, 0.3);
509  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 160), 26.91704, 0.3);
510  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 170), 29.66768, 0.3);
511  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-50, 180), 30.84148, 0.3);
512  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -180), 47.4512, 0.3);
513  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -170), 46.19458, 0.3);
514  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -160), 44.76274, 0.3);
515  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -150), 43.37347, 0.3);
516  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -140), 42.06866, 0.3);
517  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -130), 40.71814, 0.3);
518  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -120), 39.02767, 0.3);
519  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -110), 36.61839, 0.3);
520  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -100), 33.16884, 0.3);
521  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -90), 28.54321, 0.3);
522  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -80), 22.85854, 0.3);
523  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -70), 16.49065, 0.3);
524  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -60), 10.00377, 0.3);
525  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -50), 3.97552, 0.3);
526  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -40), -1.24758, 0.3);
527  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -30), -5.73404, 0.3);
528  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -20), -9.95543, 0.3);
529  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, -10), -14.56373, 0.3);
530  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 0), -20.08398, 0.3);
531  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 10), -26.67759, 0.3);
532  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 20), -34.08849, 0.3);
533  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 30), -41.80175, 0.3);
534  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 40), -49.29185, 0.3);
535  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 50), -56.18184, 0.3);
536  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 60), -62.26058, 0.3);
537  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 70), -67.41773, 0.3);
538  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 80), -71.54529, 0.3);
539  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 90), -74.4018, 0.3);
540  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 100), -75.36581, 0.3);
541  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 110), -72.73199, 0.3);
542  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 120), -60.82632, 0.3);
543  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 130), -21.58385, 0.3);
544  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 140), 25.6129, 0.3);
545  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 150), 42.23883, 0.3);
546  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 160), 47.11516, 0.3);
547  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 170), 48.07206, 0.3);
548  ut_compare_float("declination differs from IGRF12 Magnetic Model", get_mag_declination(-60, 180), 47.4512, 0.3);
549 
550  return true;
551 }
552 
554 {
556 
557  return (_tests_failed == 0);
558 }
559 
#define ut_declare_test_c(test_function, test_class)
Definition: unit_test.h:40
Definition of geo / math functions to perform geodesic calculations.
int test_autodeclination(int argc, char *argv[])
Base class to be used for unit tests.
Definition: unit_test.h:54
High-resolution timer with callouts and timekeeping.
virtual bool run_tests()
Override to run your unit tests.
int _tests_failed
The number of unit tests which failed.
Definition: unit_test.h:206
Simple error/warning functions, heavily inspired by the BSD functions of the same names...
General defines and structures for the PX4IO module firmware.
Calculation / lookup table for Earth&#39;s magnetic field declination, inclination and strength...
#define ut_run_test(test)
Runs a single unit test.
Definition: unit_test.h:96
#define ut_compare_float(message, v1, v2, precision)
Used to compare two float values within a unit test.
Definition: unit_test.h:164
float get_mag_declination(float lat, float lon)