From 650f24d0ffbeb868d76c20b226524602fa4ada9c Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 14 Feb 2023 13:54:06 +0100 Subject: [PATCH] convert Igrf13 model vector from nT to uT --- mission/controller/acs/Igrf13Model.cpp | 9 +++------ mission/controller/acs/Igrf13Model.h | 1 - 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/mission/controller/acs/Igrf13Model.cpp b/mission/controller/acs/Igrf13Model.cpp index 63992010..3f844434 100644 --- a/mission/controller/acs/Igrf13Model.cpp +++ b/mission/controller/acs/Igrf13Model.cpp @@ -20,6 +20,7 @@ Igrf13Model::~Igrf13Model() {} void Igrf13Model::magFieldComp(const double longitude, const double gcLatitude, const double altitude, timeval timeOfMagMeasurement, double* magFieldModelInertial) { + double magFieldModel[3] = {0, 0, 0}; double phi = longitude, theta = gcLatitude; // geocentric /* Here is the co-latitude needed*/ theta -= 90 * PI / 180; @@ -100,12 +101,8 @@ void Igrf13Model::magFieldComp(const double longitude, const double gcLatitude, magFieldModelInertial[2] = magFieldModel[0] * sin(gcLatitude) - magFieldModel[1] * cos(gcLatitude); - double normVecMagFieldInert[3] = {0, 0, 0}; - VectorOperations::normalize(magFieldModelInertial, normVecMagFieldInert, 3); - - magFieldModel[0] = 0; - magFieldModel[1] = 0; - magFieldModel[2] = 0; + // convert nT to uT + VectorOperations::mulScalar(magFieldModelInertial, 1e-3, magFieldModelInertial, 3); } void Igrf13Model::updateCoeffGH(timeval timeOfMagMeasurement) { diff --git a/mission/controller/acs/Igrf13Model.h b/mission/controller/acs/Igrf13Model.h index ea2c1044..187adde7 100644 --- a/mission/controller/acs/Igrf13Model.h +++ b/mission/controller/acs/Igrf13Model.h @@ -47,7 +47,6 @@ class Igrf13Model /*:public HasParametersIF*/ { // Coefficient wary over year, could be updated sometimes. void updateCoeffGH(timeval timeOfMagMeasurement); // Secular variation (SV) - double magFieldModel[3]; void schmidtNormalization(); private: