Fixes a bug in GLONASS GNAV CRC computation (Fixes: #349)

This commit is contained in:
Carles Fernandez 2020-04-10 13:44:45 +02:00
parent a49df87704
commit ec3c868625
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
4 changed files with 47 additions and 2 deletions

View File

@ -19,6 +19,10 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades <carles.fernandez@cttc
- The software can now be cross-compiled on Petalinux environments.
### Improvements in Reliability:
- Fixed a bug in GLONASS GNAV CRC computation.
### Improvements in Reproducibility:
- Improved reproducibility of the volk_gnsssdr library: Drop compile-time CPU

View File

@ -194,8 +194,8 @@ bool Glonass_Gnav_Navigation_Message::CRC_test(std::bitset<GLONASS_GNAV_STRING_B
{
return true;
}
// (a-ii) Only one of the checksums (C1,...,C7) is equal to zero but C_Sigma = 1
if (C_Sigma == 1 && C1 + C2 + C3 + C4 + C5 + C6 + C7 == 6)
// (a-ii) Only one of the checksums (C1,...,C7) is equal to 1 and C_Sigma = 1
if (C_Sigma == 1 && C1 + C2 + C3 + C4 + C5 + C6 + C7 == 1)
{
return true;
}

View File

@ -118,6 +118,7 @@ DECLARE_string(log_dir);
#include "unit-tests/signal-processing-blocks/pvt/rtcm_test.cc"
#include "unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc"
#include "unit-tests/signal-processing-blocks/telemetry_decoder/galileo_fnav_inav_decoder_test.cc"
#include "unit-tests/system-parameters/glonass_gnav_crc_test.cc"
#include "unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc"
#include "unit-tests/system-parameters/glonass_gnav_nav_message_test.cc"

View File

@ -0,0 +1,40 @@
/*!
* \file glonass_gnav_crc_test.cc
* \brief Test fot GLONASS GNAV CRC
* \author Carles Fernandez-Prades, 2020. cfernandez(at)cttc.es
*
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2020 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -------------------------------------------------------------------------
*/
#include "glonass_gnav_navigation_message.h"
#include <bitset>
#include <string>
TEST(GlonassCrcTest, GnssSdrCRCTest)
{
// test data
std::string string1Real_14_18_00("0000100000111001001001000011101010101100010101001000001001011101010101110011110110101");
std::string string1Real_14_18_30("0000100000111001001011000011101010101100010101001000001001011101010101110011100001010");
std::string string1Wrong_14_18_00("0000100000111001001001000011101010101100010101001000001001011101010101110011100001010");
auto gnav_msg = Glonass_Gnav_Navigation_Message();
std::bitset<GLONASS_GNAV_STRING_BITS> bits;
bits = std::bitset<GLONASS_GNAV_STRING_BITS>(string1Real_14_18_00);
ASSERT_TRUE(gnav_msg.CRC_test(bits));
bits = std::bitset<GLONASS_GNAV_STRING_BITS>(string1Real_14_18_30);
ASSERT_TRUE(gnav_msg.CRC_test(bits));
bits = std::bitset<GLONASS_GNAV_STRING_BITS>(string1Wrong_14_18_00);
ASSERT_FALSE(gnav_msg.CRC_test(bits));
}