WMM module updated to 2025 data (#3456)

This commit is contained in:
OpenUAS
2025-05-20 18:26:22 +02:00
committed by GitHub
parent 4ee8e5e1b9
commit b6d1ca99ab
5 changed files with 37 additions and 37 deletions
+2 -2
View File
@@ -11,7 +11,7 @@
Method uses is based on the the ngdc noaa DODWMM model and data (http://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml). Method uses is based on the the ngdc noaa DODWMM model and data (http://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml).
The WMM is based on earth magnetic field measuring at an high number of sites on the whole globe and on its mathematical representation through a series of characteristic values listed in a file (WMM.COF) which has a five-year validity. The WMM is based on earth magnetic field measuring at an high number of sites on the whole globe and on its mathematical representation through a series of characteristic values listed in a file (WMM.COF) which has a five-year validity.
The autopilot used data derived from this file to make the complex calculation of declination. The autopilot used data derived from this file to make the complex calculation of declination.
Every 5 years (2015, 2020) an updated geomagnetic model is released and datatables in the code must be updated accordingly for more accurate flight. Every 5 years (2015, 2020, 2025) an updated geomagnetic model is released and datatables in the code must be updated accordingly for more accurate flight.
</description> </description>
</doc> </doc>
<settings> <settings>
@@ -29,7 +29,7 @@
<event fun="geo_mag_event()"/> <event fun="geo_mag_event()"/>
<makefile target="ap|nps"> <makefile target="ap|nps">
<file name="geo_mag.c"/> <file name="geo_mag.c"/>
<file name="pprz_geodetic_wmm2020.c" dir="math"/> <file name="pprz_geodetic_wmm2025.c" dir="math"/>
</makefile> </makefile>
<makefile target="nps"> <makefile target="nps">
<define name="NPS_CALC_GEO_MAG"/> <define name="NPS_CALC_GEO_MAG"/>
+1 -1
View File
@@ -62,7 +62,7 @@ VPATH += $(PAPARAZZI_HOME)/var/share
<file name="nps_ivy.c" dir="$(NPS_DIR)"/> <file name="nps_ivy.c" dir="$(NPS_DIR)"/>
<file name="nps_flightgear.c" dir="$(NPS_DIR)"/> <file name="nps_flightgear.c" dir="$(NPS_DIR)"/>
<file name="nps_random.c" dir="$(NPS_DIR)"/> <file name="nps_random.c" dir="$(NPS_DIR)"/>
<file name="pprz_geodetic_wmm2020.c" dir="math"/> <file name="pprz_geodetic_wmm2025.c" dir="math"/>
<file name="nps_main_common.c" dir="$(NPS_DIR)"/> <file name="nps_main_common.c" dir="$(NPS_DIR)"/>
</makefile> </makefile>
</module> </module>
@@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2012 Sergey Krukowski <softsr@yahoo.de> * Copyright (C) 2012 Sergey Krukowski <softsr@yahoo.de>
* Copyright (C) 2020 OpenUAS info@openuas.org> * Copyright (C) 2025 OpenUAS info@openuas.org>
* *
* This file is part of paparazzi. * This file is part of paparazzi.
* *
@@ -20,45 +20,45 @@
*/ */
/** /**
* @file pprz_geodetic_wmm2020.c * @file pprz_geodetic_wmm2025.c
* @brief WMM2020 Geomagnetic field model. * @brief WMM2025 Geomagnetic field model.
* *
* Based on the WMM2020 model (http://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml) * Based on the WMM2025 model (http://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml)
*/ */
#include "std.h" #include "std.h"
#include "math/pprz_geodetic_wmm2020.h" #include "math/pprz_geodetic_wmm2025.h"
const double gh1[MAXCOEFF] = { const double gh1[MAXCOEFF] = {
//WMM 2020 data //WMM 2025 data
0.0, -29404.5, -1450.7, 4652.9, 0.0, -29351.8, -1410.8, 4545.4,
-2500.0, 2982.0, -2991.6, 1676.8, -734.8, -2556.6, 2951.1, -3133.6, 1649.3, -815.1,
1363.9, -2381.0, -82.2, 1236.2, 241.8, 525.7, -542.9, 1361.0, -2404.1, -56.6, 1243.8, 237.5, 453.6, -549.5,
903.1, 809.4, 282.0, 86.2, -158.4, -309.4, 199.8, 47.9, -350.1, 895.0, 799.5, 278.6, 55.7, -133.9, -281.1, 212.0, 12.1, -375.6,
-234.4, 363.1, 47.7, 187.8, 208.4, -140.7, -121.3, -151.2, 32.2, 13.7, 99.1, -233.2, 368.9, 45.4, 187.2, 220.2, -138.7, -122.9, -142.0, 43.0, 20.9, 106.1,
65.9, 65.6, -19.1, 73.0, 25.0, -121.5, 52.7, -36.2, -64.4, 13.5, 9.0, -64.7, 68.1, 64.4, 63.8, -18.4, 76.9, 16.8, -115.7, 48.8, -40.9, -59.8, 14.9, 10.9, -60.7, 72.7,
80.6, -76.8, -51.4, -8.3, -16.8, 56.5, 2.3, 15.8, 23.5, 6.4, -2.2, -7.2, -27.2, 9.8, -1.9, 79.5, -77.0, -48.9, -8.8, -14.4, 59.3, -1.0, 15.8, 23.4, 2.5, -7.4, -11.1, -25.1, 14.2, -2.3,
23.6, 9.8, 8.4, -17.5, -15.3, -0.4, 12.8, -21.1, -11.8, 15.3, 14.9, 13.7, 3.6, -16.5, -6.9, -0.3, 2.8, 23.2, 10.8, 7.1, -17.5 , -12.6, 2.0, 11.4, -21.7, -9.7, 16.9, 12.7, 15.0, 0.7, -16.8, -5.2, 0.9, 3.9,
5.0, 8.2, -23.3, 2.9, 11.1, -1.4, 9.8, -1.1, -5.1, -13.3, -6.2, 1.1, 7.8, 8.9, 0.4, -9.3, -1.5, -11.9, 9.7, 4.6, 7.8, -24.8, 3.0, 12.2, -0.2, 8.3, -2.5, -3.3, -13.1, -5.2, 2.4, 7.2, 8.6, -0.6, -8.7, 0.8, -12.9, 10.0,
-1.9, -6.2, 3.4, -0.1, -0.2, 1.7, 3.5, -0.9, 4.8, 0.6, -8.6, -0.9, -0.1, 1.9, -4.2, 1.4, -3.4, -2.4, -0.1, -3.9, -8.8, -1.3, -6.4, 3.3, 0.2, 0.0, 2.0, 2.4, -1.0, 5.3, -0.6, -9.1, -0.9, 0.4, 1.5, -4.2, 0.9, -3.8, -2.7, 0.9, -3.9, -9.1,
3.0, -1.4, 0.0, -2.5, 2.6, 2.4, -0.5, -0.9, -0.4, 0.3, 0.6, -0.7, -0.2, -0.1, -1.7, 1.4, -1.6, -0.6, -3.0, 0.2, -2.0, 3.1, -2.6, 2.9, -1.5, 0.0, -2.5, 2.9, 2.4, -0.6, -0.6, 0.2, -0.1, 0.5, -0.6, -0.3, -0.1, -1.2, 1.1, -1.7, -1.0, -2.9, -0.2, -1.8, 2.6, -2.3,
-2.0, -0.1, -1.2, 0.5, 0.5, 1.3, 1.3, -1.2, -1.8, 0.7, 0.1, 0.3, 0.7, 0.5, -0.1, -0.2, 0.6, -0.5, 0.2, 0.1, -0.9, -1.1, 0.0, -0.3, 0.5 -2.0, -0.2, -1.3, 0.3, 0.7, 1.2, 1.0, -1.3 , -1.4, 0.6, 0.0, 0.6, 0.6, 0.5, -0.1, -0.1, 0.8, -0.4, 0.1, -0.2, -1.0, -1.3, 0.1, -0.7, 0.2
}; };
const double gh2[MAXCOEFF] = { const double gh2[MAXCOEFF] = {
//WMM 2020 data //WMM 2025 data
0.0, 6.7, 7.7, -25.1, 0.0, 12.0, 9.7, -21.5,
-11.5, -7.1, -30.2, -2.2, -23.9, -11.6, -5.2, -27.7, -8.0, -12.1,
2.8, -6.2, 5.7, 3.4, -1.0, -12.2, 1.1, -1.3, -4.2, 4.0, 0.4, -0.3, -15.6, -4.1,
-1.1, -1.6, 0.2, -6.0, 6.9, 5.4, 3.7, -5.5, -5.6, -1.6, -2.4, -1.1, -6.0, 4.1, 5.6, 1.6, -7.0, -4.4,
-0.3, 0.6, 0.1, -0.7, 2.5, 0.1, -0.9, 1.2, 3.0, 1.0, 0.5, 0.6, 1.4, -0.5, 0.0, 2.2, 0.6, 0.4, 2.2, 1.7, 0.9, 1.9,
-0.6, -0.4, 0.1, 0.5, -1.8, 1.4, -1.4, -1.4, 0.9, 0.0, 0.1, 0.8, 1.0, -0.2, -0.4, 0.3, 0.9, -1.6, 1.2, -0.4, -0.9, 0.9, 0.3, 0.7, 0.9, 0.9,
-0.1, -0.3, 0.5, -0.1, 0.6, 0.7, -0.7, 0.2, -0.2, -0.5, -1.2, -0.8, 0.2, 1.0, 0.3, 0.0, -0.1, 0.6, -0.1, 0.5, 0.5, -0.8, -0.1, 0.0, -0.8, -1.0, -0.8, 0.6, 0.8, -0.2,
-0.1, 0.1, -0.3, -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-0.1, -0.1
}; };
int16_t extrapsh(double date, double dte1, int16_t nmax1, int16_t nmax2, double *gh) int16_t extrapsh(double date, double dte1, int16_t nmax1, int16_t nmax2, double *gh)
+3 -3
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2012 Sergey Krukowski <softsr@yahoo.de> * Copyright (C) 2012 Sergey Krukowski <softsr@yahoo.de>
* Copyright (C) 2020 OpenUAS <info@openuas.org> * Copyright (C) 2025 OpenUAS <info@openuas.org>
* *
* This file is part of paparazzi. * This file is part of paparazzi.
* *
@@ -27,7 +27,7 @@
*/ */
#include "modules/geo_mag/geo_mag.h" #include "modules/geo_mag/geo_mag.h"
#include "math/pprz_geodetic_wmm2020.h" #include "math/pprz_geodetic_wmm2025.h"
#include "math/pprz_algebra_double.h" #include "math/pprz_algebra_double.h"
#include "modules/gps/gps.h" #include "modules/gps/gps.h"
#include "modules/core/abi.h" #include "modules/core/abi.h"
@@ -62,7 +62,7 @@ void geo_mag_event(void)
double gha[MAXCOEFF]; // Geomag global variables double gha[MAXCOEFF]; // Geomag global variables
int32_t nmax; int32_t nmax;
/* Current date in decimal year, for example 2015.68 */ /* Current date in decimal year, for example 2025.68 */
double sdate = GPS_EPOCH_BEGIN + double sdate = GPS_EPOCH_BEGIN +
(double)gps.week / WEEKS_IN_YEAR + (double)gps.week / WEEKS_IN_YEAR +
(double)gps.tow / 1000 / SECS_IN_YEAR; (double)gps.tow / 1000 / SECS_IN_YEAR;