mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 12:10:34 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into pps_lime
This commit is contained in:
commit
e7a8bf36c9
@ -599,6 +599,10 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
// 1. Copy the current tracking output
|
||||
current_symbol = in[0][0];
|
||||
d_band = current_symbol.Signal[0];
|
||||
if (d_band == '1')
|
||||
{
|
||||
d_inav_nav.enable_reed_solomon();
|
||||
}
|
||||
|
||||
// add new symbol to the symbol queue
|
||||
switch (d_frame_type)
|
||||
|
@ -268,6 +268,8 @@ const std::vector<std::pair<int32_t, int32_t>> CED_af1red_BIT({{123, 6}});
|
||||
const std::vector<std::pair<int32_t, int32_t>> RS_IODNAV_LSBS({{15, 2}});
|
||||
constexpr size_t INAV_RS_SUBVECTOR_LENGTH = 15;
|
||||
constexpr size_t INAV_RS_PARITY_VECTOR_LENGTH = 60;
|
||||
constexpr size_t INAV_RS_INFO_VECTOR_LENGTH = 58;
|
||||
constexpr size_t INAV_RS_BUFFER_LENGTH = 118;
|
||||
constexpr int32_t BITS_IN_OCTET = 8;
|
||||
constexpr int32_t FIRST_RS_BIT = 7;
|
||||
constexpr int32_t FIRST_RS_BIT_AFTER_IODNAV = 17;
|
||||
|
@ -45,7 +45,7 @@ void Beidou_Dnav_Navigation_Message::print_beidou_word_bytes(uint32_t BEIDOU_wor
|
||||
|
||||
|
||||
bool Beidou_Dnav_Navigation_Message::read_navigation_bool(
|
||||
std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits,
|
||||
const std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS>& bits,
|
||||
const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
bool value;
|
||||
@ -63,7 +63,7 @@ bool Beidou_Dnav_Navigation_Message::read_navigation_bool(
|
||||
|
||||
|
||||
uint64_t Beidou_Dnav_Navigation_Message::read_navigation_unsigned(
|
||||
std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits,
|
||||
const std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS>& bits,
|
||||
const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
uint64_t value = 0ULL;
|
||||
@ -84,7 +84,7 @@ uint64_t Beidou_Dnav_Navigation_Message::read_navigation_unsigned(
|
||||
|
||||
|
||||
int64_t Beidou_Dnav_Navigation_Message::read_navigation_signed(
|
||||
std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits,
|
||||
const std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS>& bits,
|
||||
const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
int64_t value = 0;
|
||||
|
@ -138,9 +138,9 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
uint64_t read_navigation_unsigned(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
int64_t read_navigation_signed(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
bool read_navigation_bool(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
uint64_t read_navigation_unsigned(const std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
int64_t read_navigation_signed(const std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
bool read_navigation_bool(const std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
void print_beidou_word_bytes(uint32_t BEIDOU_word) const;
|
||||
|
||||
// broadcast orbit 1
|
||||
|
@ -26,7 +26,7 @@
|
||||
using CRC_Galileo_CNAV_type = boost::crc_optimal<24, 0x1864CFBU, 0x0, 0x0, false, false>;
|
||||
|
||||
|
||||
bool Galileo_Cnav_Message::CRC_test(std::bitset<GALILEO_CNAV_BITS_FOR_CRC> bits, uint32_t checksum) const
|
||||
bool Galileo_Cnav_Message::CRC_test(const std::bitset<GALILEO_CNAV_BITS_FOR_CRC>& bits, uint32_t checksum) const
|
||||
{
|
||||
CRC_Galileo_CNAV_type CRC_Galileo;
|
||||
|
||||
@ -568,7 +568,7 @@ void Galileo_Cnav_Message::read_MT1_body(const std::string& message_string)
|
||||
}
|
||||
|
||||
|
||||
uint8_t Galileo_Cnav_Message::read_has_page_header_parameter(std::bitset<GALILEO_CNAV_PAGE_HEADER_BITS> bits, const std::pair<int32_t, int32_t>& parameter) const
|
||||
uint8_t Galileo_Cnav_Message::read_has_page_header_parameter(const std::bitset<GALILEO_CNAV_PAGE_HEADER_BITS>& bits, const std::pair<int32_t, int32_t>& parameter) const
|
||||
{
|
||||
uint8_t value = 0U;
|
||||
for (int j = 0; j < parameter.second; j++)
|
||||
@ -583,7 +583,7 @@ uint8_t Galileo_Cnav_Message::read_has_page_header_parameter(std::bitset<GALILEO
|
||||
}
|
||||
|
||||
|
||||
uint8_t Galileo_Cnav_Message::read_has_message_header_parameter_uint8(std::bitset<GALILEO_CNAV_MT1_HEADER_BITS> bits, const std::pair<int32_t, int32_t>& parameter) const
|
||||
uint8_t Galileo_Cnav_Message::read_has_message_header_parameter_uint8(const std::bitset<GALILEO_CNAV_MT1_HEADER_BITS>& bits, const std::pair<int32_t, int32_t>& parameter) const
|
||||
{
|
||||
uint8_t value = 0U;
|
||||
for (int j = 0; j < parameter.second; j++)
|
||||
@ -598,7 +598,7 @@ uint8_t Galileo_Cnav_Message::read_has_message_header_parameter_uint8(std::bitse
|
||||
}
|
||||
|
||||
|
||||
uint16_t Galileo_Cnav_Message::read_has_message_header_parameter_uint16(std::bitset<GALILEO_CNAV_MT1_HEADER_BITS> bits, const std::pair<int32_t, int32_t>& parameter) const
|
||||
uint16_t Galileo_Cnav_Message::read_has_message_header_parameter_uint16(const std::bitset<GALILEO_CNAV_MT1_HEADER_BITS>& bits, const std::pair<int32_t, int32_t>& parameter) const
|
||||
{
|
||||
uint16_t value = 0U;
|
||||
for (int j = 0; j < parameter.second; j++)
|
||||
@ -613,7 +613,7 @@ uint16_t Galileo_Cnav_Message::read_has_message_header_parameter_uint16(std::bit
|
||||
}
|
||||
|
||||
|
||||
bool Galileo_Cnav_Message::read_has_message_header_parameter_bool(std::bitset<GALILEO_CNAV_MT1_HEADER_BITS> bits, const std::pair<int32_t, int32_t>& parameter) const
|
||||
bool Galileo_Cnav_Message::read_has_message_header_parameter_bool(const std::bitset<GALILEO_CNAV_MT1_HEADER_BITS>& bits, const std::pair<int32_t, int32_t>& parameter) const
|
||||
{
|
||||
bool value = false;
|
||||
if (static_cast<int>(bits[GALILEO_CNAV_MT1_HEADER_BITS - parameter.first]) == 1)
|
||||
|
@ -67,17 +67,17 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
bool CRC_test(std::bitset<GALILEO_CNAV_BITS_FOR_CRC> bits, uint32_t checksum) const;
|
||||
bool CRC_test(const std::bitset<GALILEO_CNAV_BITS_FOR_CRC>& bits, uint32_t checksum) const;
|
||||
void read_HAS_page_header(const std::string& page_string);
|
||||
void process_HAS_page(const std::string& page_string);
|
||||
void read_MT1_header(const std::string& message_string);
|
||||
void read_MT1_body(const std::string& message_string);
|
||||
int decode_message_type1();
|
||||
|
||||
uint8_t read_has_page_header_parameter(std::bitset<GALILEO_CNAV_PAGE_HEADER_BITS> bits, const std::pair<int32_t, int32_t>& parameter) const;
|
||||
uint8_t read_has_message_header_parameter_uint8(std::bitset<GALILEO_CNAV_MT1_HEADER_BITS> bits, const std::pair<int32_t, int32_t>& parameter) const;
|
||||
uint16_t read_has_message_header_parameter_uint16(std::bitset<GALILEO_CNAV_MT1_HEADER_BITS> bits, const std::pair<int32_t, int32_t>& parameter) const;
|
||||
bool read_has_message_header_parameter_bool(std::bitset<GALILEO_CNAV_MT1_HEADER_BITS> bits, const std::pair<int32_t, int32_t>& parameter) const;
|
||||
uint8_t read_has_page_header_parameter(const std::bitset<GALILEO_CNAV_PAGE_HEADER_BITS>& bits, const std::pair<int32_t, int32_t>& parameter) const;
|
||||
uint8_t read_has_message_header_parameter_uint8(const std::bitset<GALILEO_CNAV_MT1_HEADER_BITS>& bits, const std::pair<int32_t, int32_t>& parameter) const;
|
||||
uint16_t read_has_message_header_parameter_uint16(const std::bitset<GALILEO_CNAV_MT1_HEADER_BITS>& bits, const std::pair<int32_t, int32_t>& parameter) const;
|
||||
bool read_has_message_header_parameter_bool(const std::bitset<GALILEO_CNAV_MT1_HEADER_BITS>& bits, const std::pair<int32_t, int32_t>& parameter) const;
|
||||
|
||||
uint8_t read_has_message_body_uint8(const std::string& bits) const;
|
||||
uint16_t read_has_message_body_uint16(const std::string& bits) const;
|
||||
|
@ -50,7 +50,7 @@ void Galileo_Fnav_Message::split_page(const std::string& page_string)
|
||||
}
|
||||
|
||||
|
||||
bool Galileo_Fnav_Message::_CRC_test(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, uint32_t checksum) const
|
||||
bool Galileo_Fnav_Message::_CRC_test(const std::bitset<GALILEO_FNAV_DATA_FRAME_BITS>& bits, uint32_t checksum) const
|
||||
{
|
||||
CRC_Galileo_FNAV_type CRC_Galileo;
|
||||
|
||||
@ -279,7 +279,7 @@ void Galileo_Fnav_Message::decode_page(const std::string& data)
|
||||
}
|
||||
|
||||
|
||||
uint64_t Galileo_Fnav_Message::read_navigation_unsigned(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
uint64_t Galileo_Fnav_Message::read_navigation_unsigned(const std::bitset<GALILEO_FNAV_DATA_FRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
uint64_t value = 0ULL;
|
||||
const int num_of_slices = parameter.size();
|
||||
@ -298,7 +298,7 @@ uint64_t Galileo_Fnav_Message::read_navigation_unsigned(std::bitset<GALILEO_FNAV
|
||||
}
|
||||
|
||||
|
||||
int64_t Galileo_Fnav_Message::read_navigation_signed(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
int64_t Galileo_Fnav_Message::read_navigation_signed(const std::bitset<GALILEO_FNAV_DATA_FRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
int64_t value = 0LL;
|
||||
const int num_of_slices = parameter.size();
|
||||
|
@ -138,10 +138,10 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
bool _CRC_test(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, uint32_t checksum) const;
|
||||
bool _CRC_test(const std::bitset<GALILEO_FNAV_DATA_FRAME_BITS>& bits, uint32_t checksum) const;
|
||||
void decode_page(const std::string& data);
|
||||
uint64_t read_navigation_unsigned(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
int64_t read_navigation_signed(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
uint64_t read_navigation_unsigned(const std::bitset<GALILEO_FNAV_DATA_FRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
int64_t read_navigation_signed(const std::bitset<GALILEO_FNAV_DATA_FRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
|
||||
std::string omega0_1{};
|
||||
// std::string omega0_2{};
|
||||
|
@ -29,7 +29,13 @@
|
||||
using CRC_Galileo_INAV_type = boost::crc_optimal<24, 0x1864CFBU, 0x0, 0x0, false, false>;
|
||||
|
||||
|
||||
bool Galileo_Inav_Message::CRC_test(std::bitset<GALILEO_DATA_FRAME_BITS> bits, uint32_t checksum) const
|
||||
Galileo_Inav_Message::Galileo_Inav_Message()
|
||||
{
|
||||
rs_buffer = std::vector<uint8_t>(INAV_RS_BUFFER_LENGTH, 0);
|
||||
}
|
||||
|
||||
|
||||
bool Galileo_Inav_Message::CRC_test(const std::bitset<GALILEO_DATA_FRAME_BITS>& bits, uint32_t checksum) const
|
||||
{
|
||||
CRC_Galileo_INAV_type CRC_Galileo;
|
||||
|
||||
@ -56,7 +62,7 @@ bool Galileo_Inav_Message::CRC_test(std::bitset<GALILEO_DATA_FRAME_BITS> bits, u
|
||||
}
|
||||
|
||||
|
||||
uint64_t Galileo_Inav_Message::read_navigation_unsigned(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
uint64_t Galileo_Inav_Message::read_navigation_unsigned(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
uint64_t value = 0ULL;
|
||||
const int32_t num_of_slices = parameter.size();
|
||||
@ -75,7 +81,26 @@ uint64_t Galileo_Inav_Message::read_navigation_unsigned(std::bitset<GALILEO_DATA
|
||||
}
|
||||
|
||||
|
||||
uint64_t Galileo_Inav_Message::read_page_type_unsigned(std::bitset<GALILEO_PAGE_TYPE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
uint8_t Galileo_Inav_Message::read_octet_unsigned(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
uint8_t value = 0;
|
||||
const int32_t num_of_slices = parameter.size();
|
||||
for (int32_t i = 0; i < num_of_slices; i++)
|
||||
{
|
||||
for (int32_t j = 0; j < parameter[i].second; j++)
|
||||
{
|
||||
value <<= 1; // shift left
|
||||
if (static_cast<int>(bits[GALILEO_DATA_JK_BITS - parameter[i].first - j]) == 1)
|
||||
{
|
||||
value += 1; // insert the bit
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
uint64_t Galileo_Inav_Message::read_page_type_unsigned(const std::bitset<GALILEO_PAGE_TYPE_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
uint64_t value = 0ULL;
|
||||
const int32_t num_of_slices = parameter.size();
|
||||
@ -94,7 +119,7 @@ uint64_t Galileo_Inav_Message::read_page_type_unsigned(std::bitset<GALILEO_PAGE_
|
||||
}
|
||||
|
||||
|
||||
int64_t Galileo_Inav_Message::read_navigation_signed(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
int64_t Galileo_Inav_Message::read_navigation_signed(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
int64_t value = 0LL;
|
||||
const int32_t num_of_slices = parameter.size();
|
||||
@ -125,7 +150,7 @@ int64_t Galileo_Inav_Message::read_navigation_signed(std::bitset<GALILEO_DATA_JK
|
||||
}
|
||||
|
||||
|
||||
bool Galileo_Inav_Message::read_navigation_bool(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
bool Galileo_Inav_Message::read_navigation_bool(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
bool value;
|
||||
if (static_cast<int>(static_cast<int>(bits[GALILEO_DATA_JK_BITS - parameter[0].first])) == 1)
|
||||
@ -461,10 +486,115 @@ Galileo_Ephemeris Galileo_Inav_Message::get_reduced_ced() const
|
||||
ced.af1red = ced_af1red;
|
||||
|
||||
Galileo_Ephemeris eph = ced.compute_eph();
|
||||
eph.BGD_E1E5a = BGD_E1E5a_5;
|
||||
eph.BGD_E1E5b = BGD_E1E5b_5;
|
||||
return eph;
|
||||
}
|
||||
|
||||
|
||||
void Galileo_Inav_Message::read_page_1(const std::bitset<GALILEO_DATA_JK_BITS>& data_bits)
|
||||
{
|
||||
IOD_nav_1 = static_cast<int32_t>(read_navigation_unsigned(data_bits, IOD_NAV_1_BIT));
|
||||
DLOG(INFO) << "IOD_nav_1= " << IOD_nav_1;
|
||||
t0e_1 = static_cast<int32_t>(read_navigation_unsigned(data_bits, T0_E_1_BIT));
|
||||
t0e_1 = t0e_1 * T0E_1_LSB;
|
||||
DLOG(INFO) << "t0e_1= " << t0e_1;
|
||||
M0_1 = static_cast<double>(read_navigation_signed(data_bits, M0_1_BIT));
|
||||
M0_1 = M0_1 * M0_1_LSB;
|
||||
DLOG(INFO) << "M0_1= " << M0_1;
|
||||
e_1 = static_cast<double>(read_navigation_unsigned(data_bits, E_1_BIT));
|
||||
e_1 = e_1 * E_1_LSB;
|
||||
DLOG(INFO) << "e_1= " << e_1;
|
||||
A_1 = static_cast<double>(read_navigation_unsigned(data_bits, A_1_BIT));
|
||||
A_1 = A_1 * A_1_LSB_GAL;
|
||||
DLOG(INFO) << "A_1= " << A_1;
|
||||
flag_ephemeris_1 = true;
|
||||
DLOG(INFO) << "flag_tow_set" << flag_TOW_set;
|
||||
}
|
||||
|
||||
|
||||
void Galileo_Inav_Message::read_page_2(const std::bitset<GALILEO_DATA_JK_BITS>& data_bits)
|
||||
{
|
||||
IOD_nav_2 = static_cast<int32_t>(read_navigation_unsigned(data_bits, IOD_NAV_2_BIT));
|
||||
DLOG(INFO) << "IOD_nav_2= " << IOD_nav_2;
|
||||
OMEGA_0_2 = static_cast<double>(read_navigation_signed(data_bits, OMEGA_0_2_BIT));
|
||||
OMEGA_0_2 = OMEGA_0_2 * OMEGA_0_2_LSB;
|
||||
DLOG(INFO) << "OMEGA_0_2= " << OMEGA_0_2;
|
||||
i_0_2 = static_cast<double>(read_navigation_signed(data_bits, I_0_2_BIT));
|
||||
i_0_2 = i_0_2 * I_0_2_LSB;
|
||||
DLOG(INFO) << "i_0_2= " << i_0_2;
|
||||
omega_2 = static_cast<double>(read_navigation_signed(data_bits, OMEGA_2_BIT));
|
||||
omega_2 = omega_2 * OMEGA_2_LSB;
|
||||
DLOG(INFO) << "omega_2= " << omega_2;
|
||||
iDot_2 = static_cast<double>(read_navigation_signed(data_bits, I_DOT_2_BIT));
|
||||
iDot_2 = iDot_2 * I_DOT_2_LSB;
|
||||
DLOG(INFO) << "iDot_2= " << iDot_2;
|
||||
flag_ephemeris_2 = true;
|
||||
DLOG(INFO) << "flag_tow_set" << flag_TOW_set;
|
||||
}
|
||||
|
||||
|
||||
void Galileo_Inav_Message::read_page_3(const std::bitset<GALILEO_DATA_JK_BITS>& data_bits)
|
||||
{
|
||||
IOD_nav_3 = static_cast<int32_t>(read_navigation_unsigned(data_bits, IOD_NAV_3_BIT));
|
||||
DLOG(INFO) << "IOD_nav_3= " << IOD_nav_3;
|
||||
OMEGA_dot_3 = static_cast<double>(read_navigation_signed(data_bits, OMEGA_DOT_3_BIT));
|
||||
OMEGA_dot_3 = OMEGA_dot_3 * OMEGA_DOT_3_LSB;
|
||||
DLOG(INFO) << "OMEGA_dot_3= " << OMEGA_dot_3;
|
||||
delta_n_3 = static_cast<double>(read_navigation_signed(data_bits, DELTA_N_3_BIT));
|
||||
delta_n_3 = delta_n_3 * DELTA_N_3_LSB;
|
||||
DLOG(INFO) << "delta_n_3= " << delta_n_3;
|
||||
C_uc_3 = static_cast<double>(read_navigation_signed(data_bits, C_UC_3_BIT));
|
||||
C_uc_3 = C_uc_3 * C_UC_3_LSB;
|
||||
DLOG(INFO) << "C_uc_3= " << C_uc_3;
|
||||
C_us_3 = static_cast<double>(read_navigation_signed(data_bits, C_US_3_BIT));
|
||||
C_us_3 = C_us_3 * C_US_3_LSB;
|
||||
DLOG(INFO) << "C_us_3= " << C_us_3;
|
||||
C_rc_3 = static_cast<double>(read_navigation_signed(data_bits, C_RC_3_BIT));
|
||||
C_rc_3 = C_rc_3 * C_RC_3_LSB;
|
||||
DLOG(INFO) << "C_rc_3= " << C_rc_3;
|
||||
C_rs_3 = static_cast<double>(read_navigation_signed(data_bits, C_RS_3_BIT));
|
||||
C_rs_3 = C_rs_3 * C_RS_3_LSB;
|
||||
DLOG(INFO) << "C_rs_3= " << C_rs_3;
|
||||
SISA_3 = static_cast<int32_t>(read_navigation_unsigned(data_bits, SISA_3_BIT));
|
||||
DLOG(INFO) << "SISA_3= " << SISA_3;
|
||||
flag_ephemeris_3 = true;
|
||||
DLOG(INFO) << "flag_tow_set" << flag_TOW_set;
|
||||
}
|
||||
|
||||
|
||||
void Galileo_Inav_Message::read_page_4(const std::bitset<GALILEO_DATA_JK_BITS>& data_bits)
|
||||
{
|
||||
IOD_nav_4 = static_cast<int32_t>(read_navigation_unsigned(data_bits, IOD_NAV_4_BIT));
|
||||
DLOG(INFO) << "IOD_nav_4= " << IOD_nav_4;
|
||||
SV_ID_PRN_4 = static_cast<int32_t>(read_navigation_unsigned(data_bits, SV_ID_PRN_4_BIT));
|
||||
DLOG(INFO) << "SV_ID_PRN_4= " << SV_ID_PRN_4;
|
||||
C_ic_4 = static_cast<double>(read_navigation_signed(data_bits, C_IC_4_BIT));
|
||||
C_ic_4 = C_ic_4 * C_IC_4_LSB;
|
||||
DLOG(INFO) << "C_ic_4= " << C_ic_4;
|
||||
C_is_4 = static_cast<double>(read_navigation_signed(data_bits, C_IS_4_BIT));
|
||||
C_is_4 = C_is_4 * C_IS_4_LSB;
|
||||
DLOG(INFO) << "C_is_4= " << C_is_4;
|
||||
// Clock correction parameters
|
||||
t0c_4 = static_cast<int32_t>(read_navigation_unsigned(data_bits, T0C_4_BIT));
|
||||
t0c_4 = t0c_4 * T0C_4_LSB;
|
||||
DLOG(INFO) << "t0c_4= " << t0c_4;
|
||||
af0_4 = static_cast<double>(read_navigation_signed(data_bits, AF0_4_BIT));
|
||||
af0_4 = af0_4 * AF0_4_LSB;
|
||||
DLOG(INFO) << "af0_4 = " << af0_4;
|
||||
af1_4 = static_cast<double>(read_navigation_signed(data_bits, AF1_4_BIT));
|
||||
af1_4 = af1_4 * AF1_4_LSB;
|
||||
DLOG(INFO) << "af1_4 = " << af1_4;
|
||||
af2_4 = static_cast<double>(read_navigation_signed(data_bits, AF2_4_BIT));
|
||||
af2_4 = af2_4 * AF2_4_LSB;
|
||||
DLOG(INFO) << "af2_4 = " << af2_4;
|
||||
spare_4 = static_cast<double>(read_navigation_unsigned(data_bits, SPARE_4_BIT));
|
||||
DLOG(INFO) << "spare_4 = " << spare_4;
|
||||
flag_ephemeris_4 = true;
|
||||
DLOG(INFO) << "flag_tow_set" << flag_TOW_set;
|
||||
}
|
||||
|
||||
|
||||
int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk)
|
||||
{
|
||||
const std::string data_jk_string = data_jk;
|
||||
@ -476,99 +606,123 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk)
|
||||
switch (page_number)
|
||||
{
|
||||
case 1: // Word type 1: Ephemeris (1/4)
|
||||
IOD_nav_1 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, IOD_NAV_1_BIT));
|
||||
DLOG(INFO) << "IOD_nav_1= " << IOD_nav_1;
|
||||
t0e_1 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, T0_E_1_BIT));
|
||||
t0e_1 = t0e_1 * T0E_1_LSB;
|
||||
DLOG(INFO) << "t0e_1= " << t0e_1;
|
||||
M0_1 = static_cast<double>(read_navigation_signed(data_jk_bits, M0_1_BIT));
|
||||
M0_1 = M0_1 * M0_1_LSB;
|
||||
DLOG(INFO) << "M0_1= " << M0_1;
|
||||
e_1 = static_cast<double>(read_navigation_unsigned(data_jk_bits, E_1_BIT));
|
||||
e_1 = e_1 * E_1_LSB;
|
||||
DLOG(INFO) << "e_1= " << e_1;
|
||||
A_1 = static_cast<double>(read_navigation_unsigned(data_jk_bits, A_1_BIT));
|
||||
A_1 = A_1 * A_1_LSB_GAL;
|
||||
DLOG(INFO) << "A_1= " << A_1;
|
||||
flag_ephemeris_1 = true;
|
||||
DLOG(INFO) << "flag_tow_set" << flag_TOW_set;
|
||||
{
|
||||
read_page_1(data_jk_bits);
|
||||
if (enable_rs)
|
||||
{
|
||||
if (current_IODnav == 0)
|
||||
{
|
||||
current_IODnav = IOD_nav_1;
|
||||
}
|
||||
if (current_IODnav != IOD_nav_1)
|
||||
{
|
||||
// IODnav changed, reset buffer
|
||||
current_IODnav = IOD_nav_1;
|
||||
rs_buffer = std::vector<uint8_t>(INAV_RS_BUFFER_LENGTH, 0);
|
||||
}
|
||||
|
||||
// Store RS information vector C_{RS,0}
|
||||
std::vector<std::pair<int32_t, int32_t>> info_octet_bits({{1, 6}, {15, 2}});
|
||||
rs_buffer[0] = read_octet_unsigned(data_jk_bits, info_octet_bits);
|
||||
info_octet_bits = std::vector<std::pair<int32_t, int32_t>>({{7, BITS_IN_OCTET}});
|
||||
rs_buffer[1] = read_octet_unsigned(data_jk_bits, info_octet_bits);
|
||||
int32_t start_bit = FIRST_RS_BIT_AFTER_IODNAV;
|
||||
for (size_t i = 2; i < 16; i++)
|
||||
{
|
||||
info_octet_bits = std::vector<std::pair<int32_t, int32_t>>({{start_bit, BITS_IN_OCTET}});
|
||||
rs_buffer[i] = read_octet_unsigned(data_jk_bits, info_octet_bits);
|
||||
start_bit += BITS_IN_OCTET;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: // Word type 2: Ephemeris (2/4)
|
||||
IOD_nav_2 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, IOD_NAV_2_BIT));
|
||||
DLOG(INFO) << "IOD_nav_2= " << IOD_nav_2;
|
||||
OMEGA_0_2 = static_cast<double>(read_navigation_signed(data_jk_bits, OMEGA_0_2_BIT));
|
||||
OMEGA_0_2 = OMEGA_0_2 * OMEGA_0_2_LSB;
|
||||
DLOG(INFO) << "OMEGA_0_2= " << OMEGA_0_2;
|
||||
i_0_2 = static_cast<double>(read_navigation_signed(data_jk_bits, I_0_2_BIT));
|
||||
i_0_2 = i_0_2 * I_0_2_LSB;
|
||||
DLOG(INFO) << "i_0_2= " << i_0_2;
|
||||
omega_2 = static_cast<double>(read_navigation_signed(data_jk_bits, OMEGA_2_BIT));
|
||||
omega_2 = omega_2 * OMEGA_2_LSB;
|
||||
DLOG(INFO) << "omega_2= " << omega_2;
|
||||
iDot_2 = static_cast<double>(read_navigation_signed(data_jk_bits, I_DOT_2_BIT));
|
||||
iDot_2 = iDot_2 * I_DOT_2_LSB;
|
||||
DLOG(INFO) << "iDot_2= " << iDot_2;
|
||||
flag_ephemeris_2 = true;
|
||||
DLOG(INFO) << "flag_tow_set" << flag_TOW_set;
|
||||
break;
|
||||
{
|
||||
read_page_2(data_jk_bits);
|
||||
if (enable_rs)
|
||||
{
|
||||
if (current_IODnav == 0)
|
||||
{
|
||||
current_IODnav = IOD_nav_2;
|
||||
}
|
||||
if (current_IODnav != IOD_nav_2)
|
||||
{
|
||||
// IODnav changed, reset buffer
|
||||
current_IODnav = IOD_nav_2;
|
||||
rs_buffer = std::vector<uint8_t>(INAV_RS_BUFFER_LENGTH, 0);
|
||||
}
|
||||
|
||||
case 3: // Word type 3: Ephemeris (3/4) and SISA
|
||||
IOD_nav_3 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, IOD_NAV_3_BIT));
|
||||
DLOG(INFO) << "IOD_nav_3= " << IOD_nav_3;
|
||||
OMEGA_dot_3 = static_cast<double>(read_navigation_signed(data_jk_bits, OMEGA_DOT_3_BIT));
|
||||
OMEGA_dot_3 = OMEGA_dot_3 * OMEGA_DOT_3_LSB;
|
||||
DLOG(INFO) << "OMEGA_dot_3= " << OMEGA_dot_3;
|
||||
delta_n_3 = static_cast<double>(read_navigation_signed(data_jk_bits, DELTA_N_3_BIT));
|
||||
delta_n_3 = delta_n_3 * DELTA_N_3_LSB;
|
||||
DLOG(INFO) << "delta_n_3= " << delta_n_3;
|
||||
C_uc_3 = static_cast<double>(read_navigation_signed(data_jk_bits, C_UC_3_BIT));
|
||||
C_uc_3 = C_uc_3 * C_UC_3_LSB;
|
||||
DLOG(INFO) << "C_uc_3= " << C_uc_3;
|
||||
C_us_3 = static_cast<double>(read_navigation_signed(data_jk_bits, C_US_3_BIT));
|
||||
C_us_3 = C_us_3 * C_US_3_LSB;
|
||||
DLOG(INFO) << "C_us_3= " << C_us_3;
|
||||
C_rc_3 = static_cast<double>(read_navigation_signed(data_jk_bits, C_RC_3_BIT));
|
||||
C_rc_3 = C_rc_3 * C_RC_3_LSB;
|
||||
DLOG(INFO) << "C_rc_3= " << C_rc_3;
|
||||
C_rs_3 = static_cast<double>(read_navigation_signed(data_jk_bits, C_RS_3_BIT));
|
||||
C_rs_3 = C_rs_3 * C_RS_3_LSB;
|
||||
DLOG(INFO) << "C_rs_3= " << C_rs_3;
|
||||
SISA_3 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, SISA_3_BIT));
|
||||
DLOG(INFO) << "SISA_3= " << SISA_3;
|
||||
flag_ephemeris_3 = true;
|
||||
DLOG(INFO) << "flag_tow_set" << flag_TOW_set;
|
||||
// Store RS information vector C_{RS,1}
|
||||
rs_buffer[0] = 4 + current_IODnav % 4; // we always know c_{0,0}
|
||||
int32_t start_bit = FIRST_RS_BIT_AFTER_IODNAV;
|
||||
for (size_t i = 16; i < 30; i++)
|
||||
{
|
||||
std::vector<std::pair<int32_t, int32_t>> info_octet_bits({{start_bit, BITS_IN_OCTET}});
|
||||
rs_buffer[i] = read_octet_unsigned(data_jk_bits, info_octet_bits);
|
||||
start_bit += BITS_IN_OCTET;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: // Word type 3: Ephemeris (3/4) and SISA
|
||||
{
|
||||
read_page_3(data_jk_bits);
|
||||
if (enable_rs)
|
||||
{
|
||||
if (current_IODnav == 0)
|
||||
{
|
||||
current_IODnav = IOD_nav_3;
|
||||
}
|
||||
if (current_IODnav != IOD_nav_3)
|
||||
{
|
||||
// IODnav changed, reset buffer
|
||||
current_IODnav = IOD_nav_3;
|
||||
rs_buffer = std::vector<uint8_t>(INAV_RS_BUFFER_LENGTH, 0);
|
||||
}
|
||||
|
||||
// Store RS information vector C_{RS,2}
|
||||
rs_buffer[0] = 4 + current_IODnav % 4; // we always know c_{0,0}
|
||||
int32_t start_bit = FIRST_RS_BIT_AFTER_IODNAV;
|
||||
for (size_t i = 30; i < 44; i++)
|
||||
{
|
||||
std::vector<std::pair<int32_t, int32_t>> info_octet_bits({{start_bit, BITS_IN_OCTET}});
|
||||
rs_buffer[i] = read_octet_unsigned(data_jk_bits, info_octet_bits);
|
||||
start_bit += BITS_IN_OCTET;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 4: // Word type 4: Ephemeris (4/4) and Clock correction parameters
|
||||
IOD_nav_4 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, IOD_NAV_4_BIT));
|
||||
DLOG(INFO) << "IOD_nav_4= " << IOD_nav_4;
|
||||
SV_ID_PRN_4 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, SV_ID_PRN_4_BIT));
|
||||
DLOG(INFO) << "SV_ID_PRN_4= " << SV_ID_PRN_4;
|
||||
C_ic_4 = static_cast<double>(read_navigation_signed(data_jk_bits, C_IC_4_BIT));
|
||||
C_ic_4 = C_ic_4 * C_IC_4_LSB;
|
||||
DLOG(INFO) << "C_ic_4= " << C_ic_4;
|
||||
C_is_4 = static_cast<double>(read_navigation_signed(data_jk_bits, C_IS_4_BIT));
|
||||
C_is_4 = C_is_4 * C_IS_4_LSB;
|
||||
DLOG(INFO) << "C_is_4= " << C_is_4;
|
||||
// Clock correction parameters
|
||||
t0c_4 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, T0C_4_BIT));
|
||||
t0c_4 = t0c_4 * T0C_4_LSB;
|
||||
DLOG(INFO) << "t0c_4= " << t0c_4;
|
||||
af0_4 = static_cast<double>(read_navigation_signed(data_jk_bits, AF0_4_BIT));
|
||||
af0_4 = af0_4 * AF0_4_LSB;
|
||||
DLOG(INFO) << "af0_4 = " << af0_4;
|
||||
af1_4 = static_cast<double>(read_navigation_signed(data_jk_bits, AF1_4_BIT));
|
||||
af1_4 = af1_4 * AF1_4_LSB;
|
||||
DLOG(INFO) << "af1_4 = " << af1_4;
|
||||
af2_4 = static_cast<double>(read_navigation_signed(data_jk_bits, AF2_4_BIT));
|
||||
af2_4 = af2_4 * AF2_4_LSB;
|
||||
DLOG(INFO) << "af2_4 = " << af2_4;
|
||||
spare_4 = static_cast<double>(read_navigation_unsigned(data_jk_bits, SPARE_4_BIT));
|
||||
DLOG(INFO) << "spare_4 = " << spare_4;
|
||||
flag_ephemeris_4 = true;
|
||||
DLOG(INFO) << "flag_tow_set" << flag_TOW_set;
|
||||
{
|
||||
read_page_4(data_jk_bits);
|
||||
if (enable_rs)
|
||||
{
|
||||
if (current_IODnav == 0)
|
||||
{
|
||||
current_IODnav = IOD_nav_4;
|
||||
}
|
||||
if (current_IODnav != IOD_nav_4)
|
||||
{
|
||||
// IODnav changed, reset buffer
|
||||
current_IODnav = IOD_nav_4;
|
||||
rs_buffer = std::vector<uint8_t>(INAV_RS_BUFFER_LENGTH, 0);
|
||||
}
|
||||
|
||||
// Store RS information vector C_{RS,3}
|
||||
rs_buffer[0] = 4 + current_IODnav % 4; // we always know c_{0,0}
|
||||
int32_t start_bit = FIRST_RS_BIT_AFTER_IODNAV;
|
||||
for (size_t i = 44; i < INAV_RS_INFO_VECTOR_LENGTH; i++)
|
||||
{
|
||||
std::vector<std::pair<int32_t, int32_t>> info_octet_bits({{start_bit, BITS_IN_OCTET}});
|
||||
rs_buffer[i] = read_octet_unsigned(data_jk_bits, info_octet_bits);
|
||||
start_bit += BITS_IN_OCTET;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 5: // Word type 5: Ionospheric correction, BGD, signal health and data validity status and GST
|
||||
// Ionospheric correction
|
||||
@ -830,65 +984,81 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk)
|
||||
|
||||
case 17: // Word type 17: FEC2 Reed-Solomon for CED
|
||||
{
|
||||
std::vector<std::pair<int32_t, int32_t>> gamma_octet_bits({{FIRST_RS_BIT, BITS_IN_OCTET}});
|
||||
gamma_rs0[0] = static_cast<uint8_t>(read_navigation_unsigned(data_jk_bits, gamma_octet_bits));
|
||||
IODnav_LSB17 = static_cast<uint8_t>(read_navigation_unsigned(data_jk_bits, RS_IODNAV_LSBS));
|
||||
if (enable_rs)
|
||||
{
|
||||
IODnav_LSB17 = read_octet_unsigned(data_jk_bits, RS_IODNAV_LSBS);
|
||||
DLOG(INFO) << "IODnav 2 LSBs in Word type 17: " << static_cast<float>(IODnav_LSB17);
|
||||
// Store RS parity vector gamma_{RS,0}
|
||||
std::vector<std::pair<int32_t, int32_t>> gamma_octet_bits({{FIRST_RS_BIT, BITS_IN_OCTET}});
|
||||
rs_buffer[INAV_RS_INFO_VECTOR_LENGTH] = read_octet_unsigned(data_jk_bits, gamma_octet_bits);
|
||||
int32_t start_bit = FIRST_RS_BIT_AFTER_IODNAV;
|
||||
for (size_t i = 1; i < INAV_RS_SUBVECTOR_LENGTH; i++)
|
||||
{
|
||||
gamma_octet_bits[0] = std::pair<int32_t, int32_t>({start_bit, BITS_IN_OCTET});
|
||||
gamma_rs0[i] = static_cast<uint8_t>(read_navigation_unsigned(data_jk_bits, gamma_octet_bits));
|
||||
rs_buffer[INAV_RS_INFO_VECTOR_LENGTH + i] = read_octet_unsigned(data_jk_bits, gamma_octet_bits);
|
||||
start_bit += BITS_IN_OCTET;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 18: // Word type 18: FEC2 Reed-Solomon for CED
|
||||
{
|
||||
std::vector<std::pair<int32_t, int32_t>> gamma_octet_bits({{FIRST_RS_BIT, BITS_IN_OCTET}});
|
||||
gamma_rs1[0] = static_cast<uint8_t>(read_navigation_unsigned(data_jk_bits, gamma_octet_bits));
|
||||
IODnav_LSB18 = static_cast<uint8_t>(read_navigation_unsigned(data_jk_bits, RS_IODNAV_LSBS));
|
||||
if (enable_rs)
|
||||
{
|
||||
IODnav_LSB18 = read_octet_unsigned(data_jk_bits, RS_IODNAV_LSBS);
|
||||
DLOG(INFO) << "IODnav 2 LSBs in Word type 18: " << static_cast<float>(IODnav_LSB18);
|
||||
// Store RS parity vector gamma_{RS,1}
|
||||
std::vector<std::pair<int32_t, int32_t>> gamma_octet_bits({{FIRST_RS_BIT, BITS_IN_OCTET}});
|
||||
rs_buffer[INAV_RS_INFO_VECTOR_LENGTH + INAV_RS_SUBVECTOR_LENGTH] = read_octet_unsigned(data_jk_bits, gamma_octet_bits);
|
||||
int32_t start_bit = FIRST_RS_BIT_AFTER_IODNAV;
|
||||
for (size_t i = 1; i < INAV_RS_SUBVECTOR_LENGTH; i++)
|
||||
for (size_t i = INAV_RS_SUBVECTOR_LENGTH + 1; i < 2 * INAV_RS_SUBVECTOR_LENGTH; i++)
|
||||
{
|
||||
gamma_octet_bits[0] = std::pair<int32_t, int32_t>({start_bit, BITS_IN_OCTET});
|
||||
gamma_rs1[i] = static_cast<uint8_t>(read_navigation_unsigned(data_jk_bits, gamma_octet_bits));
|
||||
rs_buffer[INAV_RS_INFO_VECTOR_LENGTH + i] = read_octet_unsigned(data_jk_bits, gamma_octet_bits);
|
||||
start_bit += BITS_IN_OCTET;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 19: // Word type 19: FEC2 Reed-Solomon for CED
|
||||
{
|
||||
std::vector<std::pair<int32_t, int32_t>> gamma_octet_bits({{FIRST_RS_BIT, BITS_IN_OCTET}});
|
||||
gamma_rs2[0] = static_cast<uint8_t>(read_navigation_unsigned(data_jk_bits, gamma_octet_bits));
|
||||
IODnav_LSB19 = static_cast<uint8_t>(read_navigation_unsigned(data_jk_bits, RS_IODNAV_LSBS));
|
||||
if (enable_rs)
|
||||
{
|
||||
IODnav_LSB19 = read_octet_unsigned(data_jk_bits, RS_IODNAV_LSBS);
|
||||
DLOG(INFO) << "IODnav 2 LSBs in Word type 19: " << static_cast<float>(IODnav_LSB19);
|
||||
// Store RS parity vector gamma_{RS,2}
|
||||
std::vector<std::pair<int32_t, int32_t>> gamma_octet_bits({{FIRST_RS_BIT, BITS_IN_OCTET}});
|
||||
rs_buffer[INAV_RS_INFO_VECTOR_LENGTH + 2 * INAV_RS_SUBVECTOR_LENGTH] = read_octet_unsigned(data_jk_bits, gamma_octet_bits);
|
||||
int32_t start_bit = FIRST_RS_BIT_AFTER_IODNAV;
|
||||
for (size_t i = 1; i < INAV_RS_SUBVECTOR_LENGTH; i++)
|
||||
for (size_t i = 2 * INAV_RS_SUBVECTOR_LENGTH + 1; i < 3 * INAV_RS_SUBVECTOR_LENGTH; i++)
|
||||
{
|
||||
gamma_octet_bits[0] = std::pair<int32_t, int32_t>({start_bit, BITS_IN_OCTET});
|
||||
gamma_rs2[i] = static_cast<uint8_t>(read_navigation_unsigned(data_jk_bits, gamma_octet_bits));
|
||||
rs_buffer[INAV_RS_INFO_VECTOR_LENGTH + i] = read_octet_unsigned(data_jk_bits, gamma_octet_bits);
|
||||
start_bit += BITS_IN_OCTET;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 20: // Word type 20: FEC2 Reed-Solomon for CED
|
||||
{
|
||||
std::vector<std::pair<int32_t, int32_t>> gamma_octet_bits({{FIRST_RS_BIT, BITS_IN_OCTET}});
|
||||
gamma_rs3[0] = static_cast<uint8_t>(read_navigation_unsigned(data_jk_bits, gamma_octet_bits));
|
||||
IODnav_LSB20 = static_cast<uint8_t>(read_navigation_unsigned(data_jk_bits, RS_IODNAV_LSBS));
|
||||
if (enable_rs)
|
||||
{
|
||||
IODnav_LSB20 = read_octet_unsigned(data_jk_bits, RS_IODNAV_LSBS);
|
||||
DLOG(INFO) << "IODnav 2 LSBs in Word type 20: " << static_cast<float>(IODnav_LSB20);
|
||||
// Store RS parity vector gamma_{RS,4}
|
||||
std::vector<std::pair<int32_t, int32_t>> gamma_octet_bits({{FIRST_RS_BIT, BITS_IN_OCTET}});
|
||||
rs_buffer[INAV_RS_INFO_VECTOR_LENGTH + 3 * INAV_RS_SUBVECTOR_LENGTH] = read_octet_unsigned(data_jk_bits, gamma_octet_bits);
|
||||
int32_t start_bit = FIRST_RS_BIT_AFTER_IODNAV;
|
||||
for (size_t i = 1; i < INAV_RS_SUBVECTOR_LENGTH; i++)
|
||||
for (size_t i = 3 * INAV_RS_SUBVECTOR_LENGTH + 1; i < 4 * INAV_RS_SUBVECTOR_LENGTH; i++)
|
||||
{
|
||||
gamma_octet_bits[0] = std::pair<int32_t, int32_t>({start_bit, BITS_IN_OCTET});
|
||||
gamma_rs3[i] = static_cast<uint8_t>(read_navigation_unsigned(data_jk_bits, gamma_octet_bits));
|
||||
rs_buffer[INAV_RS_INFO_VECTOR_LENGTH + i] = read_octet_unsigned(data_jk_bits, gamma_octet_bits);
|
||||
start_bit += BITS_IN_OCTET;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
class Galileo_Inav_Message
|
||||
{
|
||||
public:
|
||||
Galileo_Inav_Message() = default;
|
||||
Galileo_Inav_Message();
|
||||
|
||||
/*
|
||||
* \brief Takes in input a page (Odd or Even) of 120 bit, split it according ICD 4.3.2.3 and join Data_k with Data_j
|
||||
@ -191,12 +191,25 @@ public:
|
||||
SV_ID_PRN_4 = prn;
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Enable Reed-Solomon in Galileo E1B
|
||||
*/
|
||||
inline void enable_reed_solomon()
|
||||
{
|
||||
enable_rs = true;
|
||||
}
|
||||
|
||||
private:
|
||||
bool CRC_test(std::bitset<GALILEO_DATA_FRAME_BITS> bits, uint32_t checksum) const;
|
||||
bool read_navigation_bool(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
uint64_t read_navigation_unsigned(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
uint64_t read_page_type_unsigned(std::bitset<GALILEO_PAGE_TYPE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
int64_t read_navigation_signed(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
bool CRC_test(const std::bitset<GALILEO_DATA_FRAME_BITS>& bits, uint32_t checksum) const;
|
||||
bool read_navigation_bool(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
uint64_t read_navigation_unsigned(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
uint64_t read_page_type_unsigned(const std::bitset<GALILEO_PAGE_TYPE_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
int64_t read_navigation_signed(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
uint8_t read_octet_unsigned(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
void read_page_1(const std::bitset<GALILEO_DATA_JK_BITS>& data_bits);
|
||||
void read_page_2(const std::bitset<GALILEO_DATA_JK_BITS>& data_bits);
|
||||
void read_page_3(const std::bitset<GALILEO_DATA_JK_BITS>& data_bits);
|
||||
void read_page_4(const std::bitset<GALILEO_DATA_JK_BITS>& data_bits);
|
||||
|
||||
std::string page_Even{};
|
||||
|
||||
@ -349,19 +362,17 @@ private:
|
||||
double ced_af0red{};
|
||||
double ced_af1red{};
|
||||
|
||||
// Word types 17, 18, 19, 20: Reed-Solomon parity vector
|
||||
std::vector<uint8_t> gamma_rs0{INAV_RS_SUBVECTOR_LENGTH, 0};
|
||||
std::vector<uint8_t> gamma_rs1{INAV_RS_SUBVECTOR_LENGTH, 0};
|
||||
std::vector<uint8_t> gamma_rs2{INAV_RS_SUBVECTOR_LENGTH, 0};
|
||||
std::vector<uint8_t> gamma_rs3{INAV_RS_SUBVECTOR_LENGTH, 0};
|
||||
std::vector<uint8_t> rs_parity_vector{INAV_RS_PARITY_VECTOR_LENGTH, 0};
|
||||
double Galileo_satClkDrift{};
|
||||
|
||||
int32_t current_IODnav{};
|
||||
|
||||
std::vector<uint8_t> rs_buffer; // Reed-Solomon buffer
|
||||
|
||||
uint8_t IODnav_LSB17{};
|
||||
uint8_t IODnav_LSB18{};
|
||||
uint8_t IODnav_LSB19{};
|
||||
uint8_t IODnav_LSB20{};
|
||||
|
||||
double Galileo_satClkDrift{};
|
||||
|
||||
bool flag_CRC_test{};
|
||||
bool flag_all_ephemeris{}; // Flag indicating that all words containing ephemeris have been received
|
||||
bool flag_ephemeris_1{}; // Flag indicating that ephemeris 1/4 (word 1) have been received
|
||||
@ -387,6 +398,7 @@ private:
|
||||
bool flag_GGTO_4{};
|
||||
|
||||
bool flag_CED{};
|
||||
bool enable_rs{};
|
||||
};
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ Glonass_Gnav_Navigation_Message::Glonass_Gnav_Navigation_Message()
|
||||
}
|
||||
|
||||
|
||||
bool Glonass_Gnav_Navigation_Message::CRC_test(std::bitset<GLONASS_GNAV_STRING_BITS> bits) const
|
||||
bool Glonass_Gnav_Navigation_Message::CRC_test(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits) const
|
||||
{
|
||||
uint32_t sum_bits = 0;
|
||||
int32_t sum_hamming = 0;
|
||||
@ -133,7 +133,7 @@ bool Glonass_Gnav_Navigation_Message::CRC_test(std::bitset<GLONASS_GNAV_STRING_B
|
||||
}
|
||||
|
||||
|
||||
bool Glonass_Gnav_Navigation_Message::read_navigation_bool(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
bool Glonass_Gnav_Navigation_Message::read_navigation_bool(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
bool value;
|
||||
|
||||
@ -149,7 +149,7 @@ bool Glonass_Gnav_Navigation_Message::read_navigation_bool(std::bitset<GLONASS_G
|
||||
}
|
||||
|
||||
|
||||
uint64_t Glonass_Gnav_Navigation_Message::read_navigation_unsigned(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
uint64_t Glonass_Gnav_Navigation_Message::read_navigation_unsigned(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
uint64_t value = 0ULL;
|
||||
const int32_t num_of_slices = parameter.size();
|
||||
@ -168,7 +168,7 @@ uint64_t Glonass_Gnav_Navigation_Message::read_navigation_unsigned(std::bitset<G
|
||||
}
|
||||
|
||||
|
||||
int64_t Glonass_Gnav_Navigation_Message::read_navigation_signed(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
int64_t Glonass_Gnav_Navigation_Message::read_navigation_signed(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
int64_t value = 0LL;
|
||||
int64_t sign = 0LL;
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
* \brief Compute CRC for GLONASS GNAV strings
|
||||
* \param bits Bits of the string message where to compute CRC
|
||||
*/
|
||||
bool CRC_test(std::bitset<GLONASS_GNAV_STRING_BITS> bits) const;
|
||||
bool CRC_test(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits) const;
|
||||
|
||||
/*!
|
||||
* \brief Computes the frame number being decoded given the satellite slot number
|
||||
@ -170,9 +170,9 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
uint64_t read_navigation_unsigned(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
int64_t read_navigation_signed(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
bool read_navigation_bool(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
uint64_t read_navigation_unsigned(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
int64_t read_navigation_signed(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
bool read_navigation_bool(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
|
||||
Glonass_Gnav_Ephemeris gnav_ephemeris{}; // Ephemeris information decoded
|
||||
Glonass_Gnav_Utc_Model gnav_utc_model{}; // UTC model information
|
||||
|
@ -34,7 +34,7 @@ Gps_CNAV_Navigation_Message::Gps_CNAV_Navigation_Message()
|
||||
}
|
||||
|
||||
|
||||
bool Gps_CNAV_Navigation_Message::read_navigation_bool(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
bool Gps_CNAV_Navigation_Message::read_navigation_bool(const std::bitset<GPS_CNAV_DATA_PAGE_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
bool value;
|
||||
|
||||
@ -50,7 +50,7 @@ bool Gps_CNAV_Navigation_Message::read_navigation_bool(std::bitset<GPS_CNAV_DATA
|
||||
}
|
||||
|
||||
|
||||
uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(const std::bitset<GPS_CNAV_DATA_PAGE_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
uint64_t value = 0ULL;
|
||||
const int32_t num_of_slices = parameter.size();
|
||||
@ -69,7 +69,7 @@ uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_C
|
||||
}
|
||||
|
||||
|
||||
int64_t Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
int64_t Gps_CNAV_Navigation_Message::read_navigation_signed(const std::bitset<GPS_CNAV_DATA_PAGE_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
int64_t value = 0LL;
|
||||
const int32_t num_of_slices = parameter.size();
|
||||
@ -100,7 +100,7 @@ int64_t Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset<GPS_CNAV
|
||||
}
|
||||
|
||||
|
||||
void Gps_CNAV_Navigation_Message::decode_page(std::bitset<GPS_CNAV_DATA_PAGE_BITS> data_bits)
|
||||
void Gps_CNAV_Navigation_Message::decode_page(const std::bitset<GPS_CNAV_DATA_PAGE_BITS>& data_bits)
|
||||
{
|
||||
int32_t page_type;
|
||||
bool alert_flag;
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
*/
|
||||
Gps_CNAV_Navigation_Message();
|
||||
|
||||
void decode_page(std::bitset<GPS_CNAV_DATA_PAGE_BITS> data_bits);
|
||||
void decode_page(const std::bitset<GPS_CNAV_DATA_PAGE_BITS>& data_bits);
|
||||
|
||||
/*!
|
||||
* \brief Obtain a GPS SV Ephemeris class filled with current SV data
|
||||
@ -82,9 +82,9 @@ public:
|
||||
bool have_new_ephemeris();
|
||||
|
||||
private:
|
||||
uint64_t read_navigation_unsigned(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
int64_t read_navigation_signed(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
bool read_navigation_bool(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
uint64_t read_navigation_unsigned(const std::bitset<GPS_CNAV_DATA_PAGE_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
int64_t read_navigation_signed(const std::bitset<GPS_CNAV_DATA_PAGE_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
bool read_navigation_bool(const std::bitset<GPS_CNAV_DATA_PAGE_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
|
||||
Gps_CNAV_Ephemeris ephemeris_record{};
|
||||
Gps_CNAV_Iono iono_record{};
|
||||
|
@ -46,7 +46,7 @@ void Gps_Navigation_Message::print_gps_word_bytes(uint32_t GPS_word) const
|
||||
}
|
||||
|
||||
|
||||
bool Gps_Navigation_Message::read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
bool Gps_Navigation_Message::read_navigation_bool(const std::bitset<GPS_SUBFRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
bool value;
|
||||
|
||||
@ -62,7 +62,7 @@ bool Gps_Navigation_Message::read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS>
|
||||
}
|
||||
|
||||
|
||||
uint64_t Gps_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
uint64_t Gps_Navigation_Message::read_navigation_unsigned(const std::bitset<GPS_SUBFRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
uint64_t value = 0ULL;
|
||||
const int32_t num_of_slices = parameter.size();
|
||||
@ -81,7 +81,7 @@ uint64_t Gps_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_SUBFRA
|
||||
}
|
||||
|
||||
|
||||
int64_t Gps_Navigation_Message::read_navigation_signed(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
int64_t Gps_Navigation_Message::read_navigation_signed(const std::bitset<GPS_SUBFRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
|
||||
{
|
||||
int64_t value = 0LL;
|
||||
const int32_t num_of_slices = parameter.size();
|
||||
|
@ -135,9 +135,9 @@ public:
|
||||
bool satellite_validation();
|
||||
|
||||
private:
|
||||
uint64_t read_navigation_unsigned(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
int64_t read_navigation_signed(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
bool read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
uint64_t read_navigation_unsigned(const std::bitset<GPS_SUBFRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
int64_t read_navigation_signed(const std::bitset<GPS_SUBFRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
bool read_navigation_bool(const std::bitset<GPS_SUBFRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const;
|
||||
void print_gps_word_bytes(uint32_t GPS_word) const;
|
||||
|
||||
std::map<int32_t, int32_t> almanacHealth; //!< Map that stores the health information stored in the almanac
|
||||
|
@ -283,26 +283,213 @@ TEST(ReedSolomonE1BTest, Decode31Errors)
|
||||
}
|
||||
|
||||
|
||||
TEST(ReedSolomonE1BTest, Decode33ErrorsWithErasure)
|
||||
TEST(ReedSolomonE1BTest, DecodeErasureCorrectionCase1)
|
||||
{
|
||||
// ICD 2.0 Annex F
|
||||
const std::vector<uint8_t> information_vector = {147, 109, 66, 23, 234, 140, 74, 234, 49, 89, 241, 253, 169, 161, 89, 93, 75, 142, 83, 102, 98, 218, 14, 197, 155, 151, 43, 181, 9, 163, 142, 111, 8, 118, 21, 47, 135, 139, 108, 215, 51, 147, 185, 52, 17, 151, 97, 102, 238, 71, 83, 114, 47, 80, 67, 199, 215, 162};
|
||||
|
||||
std::vector<uint8_t> code_vector = {147, 109, 66, 23, 234, 140, 74, 234, 49, 89, 241, 253, 169, 161, 89, 93, 75, 142, 83, 102, 98, 218, 14, 197, 155, 151, 43, 181, 9, 163, 142, 111, 8, 118, 21, 47, 135, 139, 108, 215, 51, 147, 185, 52, 17, 151, 97, 102, 238, 71, 83, 114, 47, 80, 67, 199, 215, 162, 238, 77, 12, 72, 235, 21, 148, 213, 230, 54, 183, 82, 49, 104, 12, 228, 150, 157, 220, 112, 236, 187, 63, 31, 175, 47, 210, 164, 17, 104, 98, 46, 252, 165, 194, 57, 26, 213, 14, 133, 176, 148, 34, 9, 167, 43, 204, 198, 25, 164, 233, 55, 153, 31, 237, 84, 212, 76, 137, 242};
|
||||
|
||||
// Introduce 33 errors
|
||||
for (int i = 0; i < 66; i += 2)
|
||||
std::vector<int> erasure_positions;
|
||||
erasure_positions.reserve(60); // nroots is the maximum number of erasure positions
|
||||
|
||||
// We have received Word 2, Word 4, Word 18, Word 20
|
||||
// So we have: c_1, c_3, g_1, g_3
|
||||
|
||||
// Delete c_0
|
||||
// We always know c_{0,0}, so we start at 1
|
||||
for (int i = 1; i < 16; i++)
|
||||
{
|
||||
code_vector[i] = 0;
|
||||
erasure_positions.push_back(i);
|
||||
}
|
||||
|
||||
std::vector<int> erasure_positions{2, 4, 16, 18, 22, 54};
|
||||
// Delete c_2
|
||||
for (int i = 30; i < 44; i++)
|
||||
{
|
||||
code_vector[i] = 0;
|
||||
erasure_positions.push_back(i);
|
||||
}
|
||||
|
||||
// Delete g_0
|
||||
for (int i = 58; i < 73; i++)
|
||||
{
|
||||
code_vector[i] = 0;
|
||||
erasure_positions.push_back(i + 137); // erasure position refers to the unshortened code, so we add 137
|
||||
}
|
||||
|
||||
// Delete g_2
|
||||
for (int i = 88; i < 103; i++)
|
||||
{
|
||||
code_vector[i] = 0;
|
||||
erasure_positions.push_back(i + 137);
|
||||
}
|
||||
|
||||
auto rs = std::make_unique<ReedSolomon>("E1B");
|
||||
|
||||
int result = rs->decode(code_vector, erasure_positions);
|
||||
|
||||
EXPECT_TRUE(result == 33);
|
||||
EXPECT_TRUE(result == 59);
|
||||
|
||||
std::vector<uint8_t> decoded(code_vector.begin(), code_vector.begin() + 58);
|
||||
|
||||
EXPECT_TRUE(information_vector == decoded);
|
||||
}
|
||||
|
||||
|
||||
TEST(ReedSolomonE1BTest, DecodeErasureCorrectionCase2)
|
||||
{
|
||||
// ICD 2.0 Annex F
|
||||
const std::vector<uint8_t> information_vector = {147, 109, 66, 23, 234, 140, 74, 234, 49, 89, 241, 253, 169, 161, 89, 93, 75, 142, 83, 102, 98, 218, 14, 197, 155, 151, 43, 181, 9, 163, 142, 111, 8, 118, 21, 47, 135, 139, 108, 215, 51, 147, 185, 52, 17, 151, 97, 102, 238, 71, 83, 114, 47, 80, 67, 199, 215, 162};
|
||||
|
||||
std::vector<uint8_t> code_vector = {147, 109, 66, 23, 234, 140, 74, 234, 49, 89, 241, 253, 169, 161, 89, 93, 75, 142, 83, 102, 98, 218, 14, 197, 155, 151, 43, 181, 9, 163, 142, 111, 8, 118, 21, 47, 135, 139, 108, 215, 51, 147, 185, 52, 17, 151, 97, 102, 238, 71, 83, 114, 47, 80, 67, 199, 215, 162, 238, 77, 12, 72, 235, 21, 148, 213, 230, 54, 183, 82, 49, 104, 12, 228, 150, 157, 220, 112, 236, 187, 63, 31, 175, 47, 210, 164, 17, 104, 98, 46, 252, 165, 194, 57, 26, 213, 14, 133, 176, 148, 34, 9, 167, 43, 204, 198, 25, 164, 233, 55, 153, 31, 237, 84, 212, 76, 137, 242};
|
||||
|
||||
std::vector<int> erasure_positions;
|
||||
erasure_positions.reserve(60); // nroots is the maximum number of erasure positions
|
||||
|
||||
// We have received Word 2, Word 4, Word 17, Word 19
|
||||
// So we have: c_1, c_3, g_0, g_2
|
||||
|
||||
// Delete c_0
|
||||
// We always know c_{0,0}, so we start at 1
|
||||
for (int i = 1; i < 16; i++)
|
||||
{
|
||||
code_vector[i] = 0;
|
||||
erasure_positions.push_back(i);
|
||||
}
|
||||
|
||||
// Delete c_2
|
||||
for (int i = 30; i < 44; i++)
|
||||
{
|
||||
code_vector[i] = 0;
|
||||
erasure_positions.push_back(i);
|
||||
}
|
||||
|
||||
// Delete g_1
|
||||
for (int i = 73; i < 88; i++)
|
||||
{
|
||||
code_vector[i] = 0;
|
||||
erasure_positions.push_back(i + 137); // erasure position refers to the unshortened code, so we add 137
|
||||
}
|
||||
|
||||
// Delete g_3
|
||||
for (int i = 103; i < 118; i++)
|
||||
{
|
||||
code_vector[i] = 0;
|
||||
erasure_positions.push_back(i + 137);
|
||||
}
|
||||
|
||||
auto rs = std::make_unique<ReedSolomon>("E1B");
|
||||
|
||||
int result = rs->decode(code_vector, erasure_positions);
|
||||
|
||||
EXPECT_TRUE(result == 59);
|
||||
|
||||
std::vector<uint8_t> decoded(code_vector.begin(), code_vector.begin() + 58);
|
||||
|
||||
EXPECT_TRUE(information_vector == decoded);
|
||||
}
|
||||
|
||||
|
||||
TEST(ReedSolomonE1BTest, DecodeErasureCorrectionCase3)
|
||||
{
|
||||
// ICD 2.0 Annex F
|
||||
const std::vector<uint8_t> information_vector = {147, 109, 66, 23, 234, 140, 74, 234, 49, 89, 241, 253, 169, 161, 89, 93, 75, 142, 83, 102, 98, 218, 14, 197, 155, 151, 43, 181, 9, 163, 142, 111, 8, 118, 21, 47, 135, 139, 108, 215, 51, 147, 185, 52, 17, 151, 97, 102, 238, 71, 83, 114, 47, 80, 67, 199, 215, 162};
|
||||
|
||||
std::vector<uint8_t> code_vector = {147, 109, 66, 23, 234, 140, 74, 234, 49, 89, 241, 253, 169, 161, 89, 93, 75, 142, 83, 102, 98, 218, 14, 197, 155, 151, 43, 181, 9, 163, 142, 111, 8, 118, 21, 47, 135, 139, 108, 215, 51, 147, 185, 52, 17, 151, 97, 102, 238, 71, 83, 114, 47, 80, 67, 199, 215, 162, 238, 77, 12, 72, 235, 21, 148, 213, 230, 54, 183, 82, 49, 104, 12, 228, 150, 157, 220, 112, 236, 187, 63, 31, 175, 47, 210, 164, 17, 104, 98, 46, 252, 165, 194, 57, 26, 213, 14, 133, 176, 148, 34, 9, 167, 43, 204, 198, 25, 164, 233, 55, 153, 31, 237, 84, 212, 76, 137, 242};
|
||||
|
||||
std::vector<int> erasure_positions;
|
||||
erasure_positions.reserve(60); // nroots is the maximum number of erasure positions
|
||||
|
||||
// We have received Word 1, Word 3, Word 17, Word 19
|
||||
// So we have: c_0, c_2, g_0, g_2
|
||||
|
||||
// Delete c_1
|
||||
for (int i = 16; i < 30; i++)
|
||||
{
|
||||
code_vector[i] = 0;
|
||||
erasure_positions.push_back(i);
|
||||
}
|
||||
|
||||
// Delete c_3
|
||||
for (int i = 44; i < 58; i++)
|
||||
{
|
||||
code_vector[i] = 0;
|
||||
erasure_positions.push_back(i);
|
||||
}
|
||||
|
||||
// Delete g_1
|
||||
for (int i = 73; i < 88; i++)
|
||||
{
|
||||
code_vector[i] = 0;
|
||||
erasure_positions.push_back(i + 137); // erasure position refers to the unshortened code, so we add 137
|
||||
}
|
||||
|
||||
// Delete g_3
|
||||
for (int i = 103; i < 118; i++)
|
||||
{
|
||||
code_vector[i] = 0;
|
||||
erasure_positions.push_back(i + 137);
|
||||
}
|
||||
|
||||
auto rs = std::make_unique<ReedSolomon>("E1B");
|
||||
|
||||
int result = rs->decode(code_vector, erasure_positions);
|
||||
|
||||
EXPECT_TRUE(result == 58);
|
||||
|
||||
std::vector<uint8_t> decoded(code_vector.begin(), code_vector.begin() + 58);
|
||||
|
||||
EXPECT_TRUE(information_vector == decoded);
|
||||
}
|
||||
|
||||
|
||||
TEST(ReedSolomonE1BTest, DecodeErasureCorrectionCase4)
|
||||
{
|
||||
// ICD 2.0 Annex F
|
||||
const std::vector<uint8_t> information_vector = {147, 109, 66, 23, 234, 140, 74, 234, 49, 89, 241, 253, 169, 161, 89, 93, 75, 142, 83, 102, 98, 218, 14, 197, 155, 151, 43, 181, 9, 163, 142, 111, 8, 118, 21, 47, 135, 139, 108, 215, 51, 147, 185, 52, 17, 151, 97, 102, 238, 71, 83, 114, 47, 80, 67, 199, 215, 162};
|
||||
|
||||
std::vector<uint8_t> code_vector = {147, 109, 66, 23, 234, 140, 74, 234, 49, 89, 241, 253, 169, 161, 89, 93, 75, 142, 83, 102, 98, 218, 14, 197, 155, 151, 43, 181, 9, 163, 142, 111, 8, 118, 21, 47, 135, 139, 108, 215, 51, 147, 185, 52, 17, 151, 97, 102, 238, 71, 83, 114, 47, 80, 67, 199, 215, 162, 238, 77, 12, 72, 235, 21, 148, 213, 230, 54, 183, 82, 49, 104, 12, 228, 150, 157, 220, 112, 236, 187, 63, 31, 175, 47, 210, 164, 17, 104, 98, 46, 252, 165, 194, 57, 26, 213, 14, 133, 176, 148, 34, 9, 167, 43, 204, 198, 25, 164, 233, 55, 153, 31, 237, 84, 212, 76, 137, 242};
|
||||
|
||||
std::vector<int> erasure_positions;
|
||||
erasure_positions.reserve(60); // nroots is the maximum number of erasure positions
|
||||
|
||||
// We have received Word 1, Word 3, Word 18, Word 20
|
||||
// So we have: c_0, c_2, g_1, g_3
|
||||
|
||||
// Delete c_1
|
||||
for (int i = 16; i < 30; i++)
|
||||
{
|
||||
code_vector[i] = 0;
|
||||
erasure_positions.push_back(i);
|
||||
}
|
||||
|
||||
// Delete c_3
|
||||
for (int i = 44; i < 58; i++)
|
||||
{
|
||||
code_vector[i] = 0;
|
||||
erasure_positions.push_back(i);
|
||||
}
|
||||
|
||||
// Delete g_0
|
||||
for (int i = 58; i < 73; i++)
|
||||
{
|
||||
code_vector[i] = 0;
|
||||
erasure_positions.push_back(i + 137); // erasure position refers to the unshortened code, so we add 137
|
||||
}
|
||||
|
||||
// Delete g_2
|
||||
for (int i = 88; i < 103; i++)
|
||||
{
|
||||
code_vector[i] = 0;
|
||||
erasure_positions.push_back(i + 137);
|
||||
}
|
||||
|
||||
auto rs = std::make_unique<ReedSolomon>("E1B");
|
||||
|
||||
int result = rs->decode(code_vector, erasure_positions);
|
||||
|
||||
EXPECT_TRUE(result == 58);
|
||||
|
||||
std::vector<uint8_t> decoded(code_vector.begin(), code_vector.begin() + 58);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user