1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 20:20:35 +00:00

Add work on IGM messages generation

This commit is contained in:
Carles Fernandez 2021-10-18 14:21:46 +02:00
parent 9858e5fcea
commit 9d8f36ecae
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 152 additions and 1 deletions

View File

@ -31,7 +31,7 @@
#include <algorithm> // for std::reverse
#include <cmath> // for std::fmod, std::lround
#include <cstdlib> // for strtol
#include <iostream> // for cout
#include <iostream> // for std::cout
#include <sstream> // for std::stringstream
@ -3250,6 +3250,152 @@ std::string Rtcm::get_MSM_7_content_signal_data(const Gps_Ephemeris& ephNAV,
}
std::string Rtcm::get_IGM01_header(const Galileo_HAS_data& has_data, uint8_t nsys)
{
std::string header;
uint32_t tow = 0;
uint16_t ssr_provider_id = 0; // ?
uint8_t igm_version = 0;
uint8_t subtype_msg_number = 0;
if (has_data.gnss_id_mask[nsys] == 0) // GPS
{
subtype_msg_number = 21;
}
else if (has_data.gnss_id_mask[nsys] == 2) // Galileo
{
subtype_msg_number = 61;
}
uint8_t ssr_solution_id = 0; // ?
bool ssr_multiple_msg_indicator = false;
bool regional_indicator = false;
uint8_t validity_index = has_data.validity_interval_index_orbit_corrections;
uint16_t validity_seconds = has_data.get_validity_interval_s(validity_index);
uint8_t ssr_update_interval = 0;
if (validity_seconds > 0)
{
if (validity_seconds < 2)
{
ssr_update_interval = 0;
}
else if (validity_seconds < 5)
{
ssr_update_interval = 1;
}
else if (validity_seconds < 10)
{
ssr_update_interval = 2;
}
else if (validity_seconds < 15)
{
ssr_update_interval = 3;
}
else if (validity_seconds < 30)
{
ssr_update_interval = 4;
}
else if (validity_seconds < 60)
{
ssr_update_interval = 5;
}
else if (validity_seconds < 120)
{
ssr_update_interval = 6;
}
else if (validity_seconds < 240)
{
ssr_update_interval = 7;
}
else if (validity_seconds < 300)
{
ssr_update_interval = 8;
}
else if (validity_seconds < 600)
{
ssr_update_interval = 9;
}
else if (validity_seconds < 900)
{
ssr_update_interval = 10;
}
else if (validity_seconds < 1800)
{
ssr_update_interval = 11;
}
else if (validity_seconds < 3600)
{
ssr_update_interval = 12;
}
else if (validity_seconds < 7200)
{
ssr_update_interval = 13;
}
else if (validity_seconds < 10800)
{
ssr_update_interval = 14;
}
else
{
ssr_update_interval = 15;
}
}
auto iod_ssr = has_data.header.iod_id % 15; // ?? HAS IOD is 0-31
uint8_t Nsat = has_data.get_num_satellites()[nsys];
Rtcm::set_DF002(4076); // Always “4076” for IGS Proprietary Messages
Rtcm::set_IDF001(igm_version);
Rtcm::set_IDF002(subtype_msg_number);
Rtcm::set_IDF003(tow);
Rtcm::set_IDF004(ssr_update_interval);
Rtcm::set_IDF005(ssr_multiple_msg_indicator);
Rtcm::set_IDF007(iod_ssr);
Rtcm::set_IDF008(ssr_provider_id);
Rtcm::set_IDF009(ssr_solution_id);
Rtcm::set_IDF006(regional_indicator);
Rtcm::set_IDF010(Nsat);
header += DF002.to_string() + IDF001.to_string() + IDF002.to_string() +
IDF003.to_string() + IDF004.to_string() + IDF005.to_string() +
IDF007.to_string() + IDF008.to_string() + IDF009.to_string() +
IDF006.to_string() + IDF010.to_string();
return header;
}
std::string Rtcm::get_IGM01_content_sat(const Galileo_HAS_data& has_data, uint8_t nsys_index)
{
std::string content;
std::vector<int> prn = has_data.get_PRNs_in_mask(nsys_index);
std::vector<uint16_t> gnss_iod = has_data.get_gnss_iod(nsys_index);
std::vector<float> delta_orbit_radial_m = has_data.get_delta_radial_m(nsys_index);
std::vector<float> delta_orbit_along_track_m = has_data.get_delta_along_track_m(nsys_index);
std::vector<float> delta_orbit_cross_track_m = has_data.get_delta_cross_track_m(nsys_index);
const uint8_t num_sats_in_this_system = has_data.get_num_satellites()[nsys_index];
for (uint8_t sat = 0; sat < num_sats_in_this_system; sat++)
{
Rtcm::set_IDF011(static_cast<uint8_t>(prn[sat]));
Rtcm::set_IDF012(static_cast<uint8_t>(gnss_iod[sat] % 255)); // 8 LSBs
Rtcm::set_IDF013(delta_orbit_radial_m[sat]);
Rtcm::set_IDF014(delta_orbit_along_track_m[sat]);
Rtcm::set_IDF016(0.0); // dot_orbit_delta_track_m_s
Rtcm::set_IDF015(delta_orbit_cross_track_m[sat]);
Rtcm::set_IDF017(0.0); // dot_orbit_delta_along_track_m_s
Rtcm::set_IDF018(0.0); // dot_orbit_delta_cross_track_m_s
content += IDF011.to_string() + IDF012.to_string() + IDF013.to_string() +
IDF014.to_string() + IDF016.to_string() + IDF015.to_string() +
IDF017.to_string() + IDF018.to_string();
}
return content;
}
// *****************************************************************************************************
// Some utilities
// *****************************************************************************************************

View File

@ -21,6 +21,7 @@
#include "concurrent_queue.h"
#include "galileo_ephemeris.h"
#include "galileo_has_data.h"
#include "glonass_gnav_ephemeris.h"
#include "glonass_gnav_utc_model.h"
#include "gnss_synchro.h"
@ -476,6 +477,10 @@ private:
std::string get_MSM_6_content_signal_data(const Gps_Ephemeris& ephNAV, const Gps_CNAV_Ephemeris& ephCNAV, const Galileo_Ephemeris& ephFNAV, const Glonass_Gnav_Ephemeris& ephGNAV, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
std::string get_MSM_7_content_signal_data(const Gps_Ephemeris& ephNAV, const Gps_CNAV_Ephemeris& ephCNAV, const Galileo_Ephemeris& ephFNAV, const Glonass_Gnav_Ephemeris& ephGNAV, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
std::string get_IGM01_header(const Galileo_HAS_data& has_data, uint8_t nsys);
std::string get_IGM01_content_sat(const Galileo_HAS_data& has_data, uint8_t nsys_index);
//
// Utilities
//