1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-09 03:20:01 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next

This commit is contained in:
Carles Fernandez 2019-05-13 16:03:10 +02:00
commit d00cc6aada
10 changed files with 522 additions and 340 deletions

View File

@ -154,13 +154,11 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
* 10 | GPS L1 C/A + Galileo E5a
* 11 | GPS L1 C/A + Galileo E5b
* 12 | Galileo E1B + GPS L2C
* 13 | Galileo E1B + GPS L5
* 13 | Galileo E5a + GPS L5
* 14 | Galileo E1B + Galileo E5a
* 15 | Galileo E1B + Galileo E5b
* 16 | GPS L2C + GPS L5
* 17 | GPS L2C + Galileo E5a
* 18 | GPS L2C + Galileo E5b
* 19 | GPS L5 + Galileo E5a
* 20 | GPS L5 + Galileo E5b
* 21 | GPS L1 C/A + Galileo E1B + GPS L2C
* 22 | GPS L1 C/A + Galileo E1B + GPS L5
@ -170,6 +168,10 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
* 26 | GPS L1 C/A + GLONASS L1 C/A
* 27 | Galileo E1B + GLONASS L1 C/A
* 28 | GPS L2C + GLONASS L1 C/A
* 29 | GPS L1 C/A + GLONASS L2 C/A
* 30 | Galileo E1B + GLONASS L2 C/A
* 31 | GPS L2C + GLONASS L2 C/A
* 32 | GPS L1 C/A + Galileo E1B + GPS L5 + Galileo E5a
*
*
* Skipped previous values to avoid overlapping
@ -203,7 +205,7 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
}
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 2;
pvt_output_parameters.type_of_receiver = 2; // GPS L2C
}
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count != 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
@ -223,7 +225,7 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
}
if ((gps_1C_count != 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 7;
pvt_output_parameters.type_of_receiver = 7; // GPS L1 C/A + GPS L2C
}
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count != 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
@ -235,7 +237,7 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
}
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 10;
pvt_output_parameters.type_of_receiver = 10; // GPS L1 C/A + Galileo E5a
}
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count != 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
@ -243,7 +245,7 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
}
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 12;
pvt_output_parameters.type_of_receiver = 12; // Galileo E1B + GPS L2C
}
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count != 0) && (gal_1B_count == 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
@ -251,16 +253,19 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
}
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 14;
pvt_output_parameters.type_of_receiver = 14; // Galileo E1B + Galileo E5a
}
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count != 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 15;
}
//if( (gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0)) pvt_output_parameters.type_of_receiver = 16;
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count != 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 16; // GPS L2C + GPS L5
}
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 17;
pvt_output_parameters.type_of_receiver = 17; // GPS L2C + Galileo E5a
}
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count != 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
@ -270,44 +275,47 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
//if( (gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0)) pvt_output_parameters.type_of_receiver = 20;
if ((gps_1C_count != 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 21;
pvt_output_parameters.type_of_receiver = 21; // GPS L1 C/A + Galileo E1B + GPS L2C
}
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count != 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count = 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 22; // GPS L1 C/A + Galileo E1B + GPS L5
}
//if( (gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count = 0)) pvt_output_parameters.type_of_receiver = 22;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 23;
pvt_output_parameters.type_of_receiver = 23; // GLONASS L1 C/A
}
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 24;
pvt_output_parameters.type_of_receiver = 24; // GLONASS L2 C/A
}
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count != 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 25;
pvt_output_parameters.type_of_receiver = 25; // GLONASS L1 C/A + GLONASS L2 C/A
}
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 26;
pvt_output_parameters.type_of_receiver = 26; // GPS L1 C/A + GLONASS L1 C/A
}
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 27;
pvt_output_parameters.type_of_receiver = 27; // Galileo E1B + GLONASS L1 C/A
}
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 28;
pvt_output_parameters.type_of_receiver = 28; // GPS L2C + GLONASS L1 C/A
}
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 29;
pvt_output_parameters.type_of_receiver = 29; // GPS L1 C/A + GLONASS L2 C/A
}
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 30;
pvt_output_parameters.type_of_receiver = 30; // Galileo E1B + GLONASS L2 C/A
}
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 31;
pvt_output_parameters.type_of_receiver = 31; // GPS L2C + GLONASS L2 C/A
}
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count != 0) && (gal_1B_count != 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
@ -317,48 +325,48 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
// BeiDou B1I Receiver
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count != 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 50;
pvt_output_parameters.type_of_receiver = 50; // Beidou B1I
}
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count != 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 51;
pvt_output_parameters.type_of_receiver = 51; // Beidou B1I + GPS L1 C/A
}
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count != 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 52;
pvt_output_parameters.type_of_receiver = 52; // Beidou B1I + Galileo E1B
}
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0) && (bds_B1_count != 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 53;
pvt_output_parameters.type_of_receiver = 53; // Beidou B1I + GLONASS L1 C/A
}
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count != 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 54;
pvt_output_parameters.type_of_receiver = 54; // Beidou B1I + GPS L1 C/A + Galileo E1B
}
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0) && (bds_B1_count != 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 55;
pvt_output_parameters.type_of_receiver = 55; // Beidou B1I + GPS L1 C/A + GLONASS L1 C/A + Galileo E1B
}
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count != 0) && (bds_B3_count != 0))
{
pvt_output_parameters.type_of_receiver = 56;
pvt_output_parameters.type_of_receiver = 56; // Beidou B1I + Beidou B3I
}
// BeiDou B3I Receiver
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count != 0))
{
pvt_output_parameters.type_of_receiver = 60;
pvt_output_parameters.type_of_receiver = 60; // Beidou B3I
}
if ((gps_1C_count != 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count != 0))
{
pvt_output_parameters.type_of_receiver = 61;
pvt_output_parameters.type_of_receiver = 61; // Beidou B3I + GPS L2C
}
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0) && (bds_B1_count == 0) && (bds_B3_count != 0))
{
pvt_output_parameters.type_of_receiver = 62;
pvt_output_parameters.type_of_receiver = 62; // Beidou B3I + GLONASS L2 C/A
}
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count != 0) && (bds_B1_count == 0) && (bds_B3_count != 0))
{
pvt_output_parameters.type_of_receiver = 63;
pvt_output_parameters.type_of_receiver = 63; // Beidou B3I + GPS L2C + GLONASS L2 C/A
}
// RTKLIB PVT solver options

View File

@ -981,7 +981,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
}
else
{
if (d_pvt_solver->gps_ephemeris_map[gps_eph->i_satellite_PRN].d_Toc != gps_eph->d_Toc)
if (d_pvt_solver->gps_ephemeris_map[gps_eph->i_satellite_PRN].d_Toe != gps_eph->d_Toe)
{
new_annotation = true;
}
@ -1068,7 +1068,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
}
else
{
if (d_pvt_solver->gps_cnav_ephemeris_map[gps_cnav_ephemeris->i_satellite_PRN].d_Toc != gps_cnav_ephemeris->d_Toc)
if (d_pvt_solver->gps_cnav_ephemeris_map[gps_cnav_ephemeris->i_satellite_PRN].d_Toe1 != gps_cnav_ephemeris->d_Toe1)
{
new_annotation = true;
}
@ -1810,30 +1810,39 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
* 7 | GPS L1 C/A + GPS L2C
* 8 | GPS L1 C/A + GPS L5
* 9 | GPS L1 C/A + Galileo E1B
* 10 | GPS L1 C/A + Galileo E5a
* 11 | GPS L1 C/A + Galileo E5b
* 12 | Galileo E1B + GPS L2C
* 13 | Galileo E1B + GPS L5
* 14 | Galileo E1B + Galileo E5a
* 15 | Galileo E1B + Galileo E5b
* 16 | GPS L2C + GPS L5
* 17 | GPS L2C + Galileo E5a
* 18 | GPS L2C + Galileo E5b
* 19 | GPS L5 + Galileo E5a
* 20 | GPS L5 + Galileo E5b
* 21 | GPS L1 C/A + Galileo E1B + GPS L2C
* 22 | GPS L1 C/A + Galileo E1B + GPS L5
* 23 | GLONASS L1 C/A
* 24 | GLONASS L2 C/A
* 25 | GLONASS L1 C/A + GLONASS L2 C/A
* 26 | GPS L1 C/A + GLONASS L1 C/A
* 27 | Galileo E1B + GLONASS L1 C/A
* 28 | GPS L2C + GLONASS L1 C/A
* 29 | GPS L1 C/A + GLONASS L2 C/A
* 30 | Galileo E1B + GLONASS L2 C/A
* 31 | GPS L2C + GLONASS L2 C/A
* 32 | GPS L1 C/A + Galileo E1B + GPS L5 + Galileo E5a
*/
* 10 | GPS L1 C/A + Galileo E5a
* 11 | GPS L1 C/A + Galileo E5b
* 12 | Galileo E1B + GPS L2C
* 13 | Galileo E5a + GPS L5
* 14 | Galileo E1B + Galileo E5a
* 15 | Galileo E1B + Galileo E5b
* 16 | GPS L2C + GPS L5
* 17 | GPS L2C + Galileo E5a
* 18 | GPS L2C + Galileo E5b
* 21 | GPS L1 C/A + Galileo E1B + GPS L2C
* 22 | GPS L1 C/A + Galileo E1B + GPS L5
* 23 | GLONASS L1 C/A
* 24 | GLONASS L2 C/A
* 25 | GLONASS L1 C/A + GLONASS L2 C/A
* 26 | GPS L1 C/A + GLONASS L1 C/A
* 27 | Galileo E1B + GLONASS L1 C/A
* 28 | GPS L2C + GLONASS L1 C/A
* 29 | GPS L1 C/A + GLONASS L2 C/A
* 30 | Galileo E1B + GLONASS L2 C/A
* 31 | GPS L2C + GLONASS L2 C/A
* 32 | GPS L1 C/A + Galileo E1B + GPS L5 + Galileo E5a
* 50 | Beidou B1I
* 51 | Beidou B1I + GPS L1 C/A
* 52 | Beidou B1I + Galileo E1B
* 53 | Beidou B1I + GLONASS L1 C/A
* 54 | Beidou B1I + GPS L1 C/A + Galileo E1B
* 55 | Beidou B1I + GPS L1 C/A + GLONASS L1 C/A + Galileo E1B
* 56 | Beidou B1I + Beidou B3I
* 60 | Beidou B3I
* 61 | Beidou B3I + GPS L2C
* 62 | Beidou B3I + GLONASS L2 C/A
* 63 | Beidou B3I + GPS L2C + GLONASS L2 C/A
*/
// ####################### RINEX FILES #################
if (b_rinex_output_enabled)
@ -1856,7 +1865,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
if (gps_ephemeris_iter != d_pvt_solver->gps_ephemeris_map.cend())
{
rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, d_rx_time);
rp->rinex_nav_header(rp->navFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model);
rp->rinex_nav_header(rp->navFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second);
rp->log_rinex_nav(rp->navFile, d_pvt_solver->gps_ephemeris_map);
b_rinex_header_written = true; // do not write header anymore
}
@ -1913,7 +1922,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
{
std::string signal("1C 2S");
rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, d_rx_time, signal);
rp->rinex_nav_header(rp->navFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model);
rp->rinex_nav_header(rp->navFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second);
rp->log_rinex_nav(rp->navFile, d_pvt_solver->gps_cnav_ephemeris_map);
b_rinex_header_written = true; // do not write header anymore
}
@ -1923,7 +1932,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
{
std::string signal("1C L5");
rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, d_rx_time, signal);
rp->rinex_nav_header(rp->navFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model);
rp->rinex_nav_header(rp->navFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second);
rp->log_rinex_nav(rp->navFile, d_pvt_solver->gps_ephemeris_map);
b_rinex_header_written = true; // do not write header anymore
}
@ -1933,7 +1942,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
{
std::string gal_signal("1B");
rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gal_signal);
rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
b_rinex_header_written = true; // do not write header anymore
}
break;
@ -1942,7 +1951,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
{
std::string gal_signal("5X");
rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gal_signal);
rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
b_rinex_header_written = true; // do not write header anymore
}
break;
@ -1951,7 +1960,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
{
std::string gal_signal("7X");
rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gal_signal);
rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
rp->log_rinex_nav(rp->navMixFile, d_pvt_solver->gps_ephemeris_map, d_pvt_solver->galileo_ephemeris_map);
b_rinex_header_written = true; // do not write header anymore
}
@ -2021,12 +2030,12 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal);
if (d_rinex_version == 3)
{
rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, d_pvt_solver->glonass_gnav_utc_model, d_pvt_solver->glonass_gnav_almanac);
rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_pvt_solver->glonass_gnav_utc_model, d_pvt_solver->glonass_gnav_almanac);
rp->log_rinex_nav(rp->navMixFile, d_pvt_solver->gps_ephemeris_map, d_pvt_solver->glonass_gnav_ephemeris_map);
}
if (d_rinex_version == 2)
{
rp->rinex_nav_header(rp->navFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model);
rp->rinex_nav_header(rp->navFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second);
rp->rinex_nav_header(rp->navGloFile, d_pvt_solver->glonass_gnav_utc_model, glonass_gnav_ephemeris_iter->second);
rp->log_rinex_nav(rp->navFile, d_pvt_solver->gps_ephemeris_map);
rp->log_rinex_nav(rp->navGloFile, d_pvt_solver->glonass_gnav_ephemeris_map);
@ -2062,12 +2071,12 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal);
if (d_rinex_version == 3)
{
rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, d_pvt_solver->glonass_gnav_utc_model, d_pvt_solver->glonass_gnav_almanac);
rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_pvt_solver->glonass_gnav_utc_model, d_pvt_solver->glonass_gnav_almanac);
rp->log_rinex_nav(rp->navMixFile, d_pvt_solver->gps_ephemeris_map, d_pvt_solver->glonass_gnav_ephemeris_map);
}
if (d_rinex_version == 2)
{
rp->rinex_nav_header(rp->navFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model);
rp->rinex_nav_header(rp->navFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second);
rp->rinex_nav_header(rp->navGloFile, d_pvt_solver->glonass_gnav_utc_model, glonass_gnav_ephemeris_iter->second);
rp->log_rinex_nav(rp->navFile, d_pvt_solver->gps_ephemeris_map);
rp->log_rinex_nav(rp->navGloFile, d_pvt_solver->glonass_gnav_ephemeris_map);
@ -2104,7 +2113,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
std::string gal_signal("1B 5X");
std::string gps_signal("1C L5");
rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gps_signal, gal_signal);
rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
rp->log_rinex_nav(rp->navMixFile, d_pvt_solver->gps_ephemeris_map, d_pvt_solver->galileo_ephemeris_map);
b_rinex_header_written = true; // do not write header anymore
}
@ -2115,7 +2124,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
{
std::string gal_signal("1B 5X");
rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gal_signal);
rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
rp->log_rinex_nav(rp->navMixFile, d_pvt_solver->gps_ephemeris_map, d_pvt_solver->galileo_ephemeris_map);
b_rinex_header_written = true; // do not write header anymore
}
@ -2160,12 +2169,12 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
if (gps_ephemeris_iter != d_pvt_solver->gps_ephemeris_map.cend())
{
rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, d_rx_time, gnss_observables_map);
}
if (!b_rinex_header_updated and (d_pvt_solver->gps_utc_model.d_A0 != 0))
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navFile, d_pvt_solver->gps_utc_model, d_pvt_solver->gps_iono);
b_rinex_header_updated = true;
if (!b_rinex_header_updated and (d_pvt_solver->gps_utc_model.d_A0 != 0))
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navFile, d_pvt_solver->gps_utc_model, d_pvt_solver->gps_iono, gps_ephemeris_iter->second);
b_rinex_header_updated = true;
}
}
break;
case 2: // GPS L2C only
@ -2232,44 +2241,44 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
if ((gps_ephemeris_iter != d_pvt_solver->gps_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != d_pvt_solver->gps_cnav_ephemeris_map.cend()))
{
rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, d_rx_time, gnss_observables_map);
}
if (!b_rinex_header_updated and (d_pvt_solver->gps_utc_model.d_A0 != 0))
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navFile, d_pvt_solver->gps_utc_model, d_pvt_solver->gps_iono);
b_rinex_header_updated = true;
if (!b_rinex_header_updated and (d_pvt_solver->gps_utc_model.d_A0 != 0))
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navFile, d_pvt_solver->gps_utc_model, d_pvt_solver->gps_iono, gps_ephemeris_iter->second);
b_rinex_header_updated = true;
}
}
break;
case 8: // L1+L5
if ((gps_ephemeris_iter != d_pvt_solver->gps_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != d_pvt_solver->gps_cnav_ephemeris_map.cend()))
{
rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, d_rx_time, gnss_observables_map);
}
if (!b_rinex_header_updated and ((d_pvt_solver->gps_cnav_utc_model.d_A0 != 0) or (d_pvt_solver->gps_utc_model.d_A0 != 0)))
{
if (d_pvt_solver->gps_cnav_utc_model.d_A0 != 0)
if (!b_rinex_header_updated and ((d_pvt_solver->gps_cnav_utc_model.d_A0 != 0) or (d_pvt_solver->gps_utc_model.d_A0 != 0)))
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_cnav_utc_model);
rp->update_nav_header(rp->navFile, d_pvt_solver->gps_cnav_utc_model, d_pvt_solver->gps_cnav_iono);
if (d_pvt_solver->gps_cnav_utc_model.d_A0 != 0)
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_cnav_utc_model);
rp->update_nav_header(rp->navFile, d_pvt_solver->gps_cnav_utc_model, d_pvt_solver->gps_cnav_iono);
}
else
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navFile, d_pvt_solver->gps_utc_model, d_pvt_solver->gps_iono, gps_ephemeris_iter->second);
}
b_rinex_header_updated = true;
}
else
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navFile, d_pvt_solver->gps_utc_model, d_pvt_solver->gps_iono);
}
b_rinex_header_updated = true;
}
break;
case 9: // GPS L1 C/A + Galileo E1B
if ((galileo_ephemeris_iter != d_pvt_solver->galileo_ephemeris_map.cend()) and (gps_ephemeris_iter != d_pvt_solver->gps_ephemeris_map.cend()))
{
rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map);
}
if (!b_rinex_header_updated and (d_pvt_solver->gps_utc_model.d_A0 != 0))
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
b_rinex_header_updated = true;
if (!b_rinex_header_updated and (d_pvt_solver->gps_utc_model.d_A0 != 0))
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
b_rinex_header_updated = true;
}
}
break;
case 13: // L5+E5a
@ -2348,12 +2357,12 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
if ((glonass_gnav_ephemeris_iter != d_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_ephemeris_iter != d_pvt_solver->gps_ephemeris_map.cend()))
{
rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map);
}
if (!b_rinex_header_updated and (d_pvt_solver->gps_utc_model.d_A0 != 0))
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, d_pvt_solver->glonass_gnav_utc_model, d_pvt_solver->glonass_gnav_almanac);
b_rinex_header_updated = true; // do not write header anymore
if (!b_rinex_header_updated and (d_pvt_solver->gps_utc_model.d_A0 != 0))
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_pvt_solver->glonass_gnav_utc_model, d_pvt_solver->glonass_gnav_almanac);
b_rinex_header_updated = true; // do not write header anymore
}
}
break;
case 27: // Galileo E1B + GLONASS L1 C/A
@ -2384,12 +2393,12 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
if ((glonass_gnav_ephemeris_iter != d_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_ephemeris_iter != d_pvt_solver->gps_ephemeris_map.cend()))
{
rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map);
}
if (!b_rinex_header_updated and (d_pvt_solver->gps_utc_model.d_A0 != 0))
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, d_pvt_solver->glonass_gnav_utc_model, d_pvt_solver->glonass_gnav_almanac);
b_rinex_header_updated = true; // do not write header anymore
if (!b_rinex_header_updated and (d_pvt_solver->gps_utc_model.d_A0 != 0))
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_pvt_solver->glonass_gnav_utc_model, d_pvt_solver->glonass_gnav_almanac);
b_rinex_header_updated = true; // do not write header anymore
}
}
break;
case 30: // Galileo E1B + GLONASS L2 C/A
@ -2420,32 +2429,32 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
if ((gps_ephemeris_iter != d_pvt_solver->gps_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != d_pvt_solver->gps_cnav_ephemeris_map.cend()) and (galileo_ephemeris_iter != d_pvt_solver->galileo_ephemeris_map.cend()))
{
rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map);
}
if (!b_rinex_header_updated and ((d_pvt_solver->gps_cnav_utc_model.d_A0 != 0) or (d_pvt_solver->gps_utc_model.d_A0 != 0)) and (d_pvt_solver->galileo_utc_model.A0_6 != 0))
{
if (d_pvt_solver->gps_cnav_utc_model.d_A0 != 0)
if (!b_rinex_header_updated and ((d_pvt_solver->gps_cnav_utc_model.d_A0 != 0) or (d_pvt_solver->gps_utc_model.d_A0 != 0)) and (d_pvt_solver->galileo_utc_model.A0_6 != 0))
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_cnav_utc_model);
rp->update_nav_header(rp->navMixFile, d_pvt_solver->gps_cnav_utc_model, d_pvt_solver->gps_cnav_iono, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
if (d_pvt_solver->gps_cnav_utc_model.d_A0 != 0)
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_cnav_utc_model);
rp->update_nav_header(rp->navMixFile, d_pvt_solver->gps_cnav_utc_model, d_pvt_solver->gps_cnav_iono, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
}
else
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
}
b_rinex_header_updated = true; // do not write header anymore
}
else
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
}
b_rinex_header_updated = true; // do not write header anymore
}
break;
case 33: // L1+E1+E5a
if ((gps_ephemeris_iter != d_pvt_solver->gps_ephemeris_map.cend()) and (galileo_ephemeris_iter != d_pvt_solver->galileo_ephemeris_map.cend()))
{
rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map);
}
if (!b_rinex_header_updated and (d_pvt_solver->gps_utc_model.d_A0 != 0) and (d_pvt_solver->galileo_utc_model.A0_6 != 0))
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
b_rinex_header_updated = true; // do not write header anymore
if (!b_rinex_header_updated and (d_pvt_solver->gps_utc_model.d_A0 != 0) and (d_pvt_solver->galileo_utc_model.A0_6 != 0))
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
b_rinex_header_updated = true; // do not write header anymore
}
}
break;
case 50: // BDS B1I only

View File

@ -599,7 +599,7 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Glonass_Gnav_Utc_M
}
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac)
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Gps_Ephemeris& eph, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac)
{
if (glonass_gnav_almanac.i_satellite_freq_channel)
{
@ -696,7 +696,28 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A0, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A1, 15, 2), 16);
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.d_t_OT), 7);
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T + 1024), 5); // valid until 2019
if (eph.i_GPS_week < 512)
{
if (gps_utc_model.i_WN_T == 0)
{
line += Rinex_Printer::rightJustify(std::to_string(eph.i_GPS_week + 2048), 5); // valid from 2019 to 2029
}
else
{
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T + (eph.i_GPS_week / 256) * 256 + 2048), 5); // valid from 2019 to 2029
}
}
else
{
if (gps_utc_model.i_WN_T == 0)
{
line += Rinex_Printer::rightJustify(std::to_string(eph.i_GPS_week + 1024), 5); // valid from 2009 to 2019
}
else
{
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T + (eph.i_GPS_week / 256) * 256 + 1024), 5); // valid from 2009 to 2019
}
}
line += std::string(10, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line);
@ -820,7 +841,7 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono& gps
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A0, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A1, 15, 2), 16);
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.d_t_OT), 7);
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T + 1024), 5); // valid until 2019
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T), 5);
line += std::string(10, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line);
@ -1146,7 +1167,7 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono& ion
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A0, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A1, 15, 2), 16);
line += Rinex_Printer::rightJustify(std::to_string(utc_model.d_t_OT), 7);
line += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T + 1024), 5); // valid until 2019
line += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T), 5);
/* if ( SBAS )
{
line += string(1, ' ');
@ -1288,7 +1309,7 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono& ion
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A0, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A1, 15, 2), 16);
line += Rinex_Printer::rightJustify(std::to_string(utc_model.d_t_OT), 7);
line += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T + 1024), 5); // valid until 2019
line += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T), 5);
line += std::string(10, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line);
@ -1315,7 +1336,7 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono& ion
}
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& iono, const Gps_Utc_Model& utc_model)
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& iono, const Gps_Utc_Model& utc_model, const Gps_Ephemeris& eph)
{
std::string line;
@ -1436,7 +1457,28 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& iono, co
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A0, 18, 2), 19);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A1, 18, 2), 19);
line += Rinex_Printer::rightJustify(std::to_string(utc_model.d_t_OT), 9);
line += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T + 1024), 9); // valid until 2019
if (eph.i_GPS_week < 512)
{
if (utc_model.i_WN_T == 0)
{
line += Rinex_Printer::rightJustify(std::to_string(eph.i_GPS_week + 2048), 9); // valid from 2019 to 2029
}
else
{
line += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T + (eph.i_GPS_week / 256) * 256 + 1024), 9); // valid from 2019 to 2029
}
}
else
{
if (utc_model.i_WN_T == 0)
{
line += Rinex_Printer::rightJustify(std::to_string(eph.i_GPS_week + 1024), 9); // valid from 2019 to 2029
}
else
{
line += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T + (eph.i_GPS_week / 256) * 256 + 1024), 9); // valid from 2009 to 2019
}
}
line += std::string(1, ' ');
line += Rinex_Printer::leftJustify("DELTA-UTC: A0,A1,T,W", 20);
}
@ -1447,7 +1489,28 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& iono, co
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A0, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A1, 15, 2), 16);
line += Rinex_Printer::rightJustify(std::to_string(utc_model.d_t_OT), 7);
line += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T + 1024), 5); // valid until 2019
if (eph.i_GPS_week < 512)
{
if (utc_model.i_WN_T == 0)
{
line += Rinex_Printer::rightJustify(std::to_string(eph.i_GPS_week + 2048), 5); // valid from 2019 to 2029
}
else
{
line += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T + (eph.i_GPS_week / 256) * 256 + 2048), 5); // valid from 2019 to 2029
}
}
else
{
if (utc_model.i_WN_T == 0)
{
line += Rinex_Printer::rightJustify(std::to_string(eph.i_GPS_week + 1024), 5); // valid from 2009 to 2019
}
else
{
line += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T + (eph.i_GPS_week / 256) * 256 + 1024), 5); // valid from 2009 to 2019
}
}
/* if ( SBAS )
{
line += string(1, ' ');
@ -1492,7 +1555,7 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& iono, co
}
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model)
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Gps_Ephemeris& eph, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model)
{
std::string line;
@ -1596,7 +1659,28 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A0, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A1, 15, 2), 16);
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.d_t_OT), 7);
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T + 1024), 5); // valid until 2019
if (eph.i_GPS_week < 512)
{
if (gps_utc_model.i_WN_T == 0)
{
line += Rinex_Printer::rightJustify(std::to_string(eph.i_GPS_week + 2048), 5); // valid from 2019 to 2029
}
else
{
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T + (eph.i_GPS_week / 256) * 256 + 2048), 5); // valid from 2019 to 2029
}
}
else
{
if (gps_utc_model.i_WN_T == 0)
{
line += Rinex_Printer::rightJustify(std::to_string(eph.i_GPS_week + 1024), 5); // valid from 2009 to 2019
}
else
{
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T + (eph.i_GPS_week / 256) * 256 + 1024), 5); // valid from 2009 to 2019
}
}
line += std::string(10, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line);
@ -2027,7 +2111,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Galileo_Iono& gal
}
void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Utc_Model& utc_model, const Gps_Iono& iono)
void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Utc_Model& utc_model, const Gps_Iono& iono, const Gps_Ephemeris& eph)
{
std::vector<std::string> data;
std::string line_aux;
@ -2077,7 +2161,14 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Utc_Model& ut
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A0, 18, 2), 19);
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A1, 18, 2), 19);
line_aux += Rinex_Printer::rightJustify(std::to_string(utc_model.d_t_OT), 9);
line_aux += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T + 1024), 9); // valid until 2019
if (eph.i_GPS_week < 512)
{
line_aux += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T + (eph.i_GPS_week / 256) * 256 + 2048), 9); // valid from 2019 to 2029
}
else
{
line_aux += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T + (eph.i_GPS_week / 256) * 256 + 1024), 9); // valid from 2009 to 2019
}
line_aux += std::string(1, ' ');
line_aux += Rinex_Printer::leftJustify("DELTA-UTC: A0,A1,T,W", 20);
data.push_back(line_aux);
@ -2132,7 +2223,14 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Utc_Model& ut
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A0, 16, 2), 18);
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A1, 15, 2), 16);
line_aux += Rinex_Printer::rightJustify(std::to_string(utc_model.d_t_OT), 7);
line_aux += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T + 1024), 5); // valid until 2019
if (eph.i_GPS_week < 512)
{
line_aux += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T + (eph.i_GPS_week / 256) * 256 + 2048), 5); // valid from 2019 to 2029
}
else
{
line_aux += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T + (eph.i_GPS_week / 256) * 256 + 1024), 5); // valid from 2009 to 2019
}
line_aux += std::string(10, ' ');
line_aux += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
data.push_back(line_aux);
@ -2228,7 +2326,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_CNAV_Utc_Mode
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A0, 16, 2), 18);
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A1, 15, 2), 16);
line_aux += Rinex_Printer::rightJustify(std::to_string(utc_model.d_t_OT), 7);
line_aux += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T + 1024), 5); // valid until 2019
line_aux += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T), 5);
line_aux += std::string(10, ' ');
line_aux += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
data.push_back(line_aux);
@ -2358,7 +2456,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_CNAV_Utc_Mode
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A0, 16, 2), 18);
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A1, 15, 2), 16);
line_aux += Rinex_Printer::rightJustify(std::to_string(utc_model.d_t_OT), 7);
line_aux += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T + 1024), 5); // valid until 2019
line_aux += Rinex_Printer::rightJustify(std::to_string(utc_model.i_WN_T), 5);
line_aux += std::string(10, ' ');
line_aux += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
data.push_back(line_aux);
@ -2402,7 +2500,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_CNAV_Utc_Mode
}
void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model)
void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Gps_Ephemeris& eph, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model)
{
std::vector<std::string> data;
std::string line_aux;
@ -2465,7 +2563,14 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Iono& gps_ion
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A0, 16, 2), 18);
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A1, 15, 2), 16);
line_aux += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.d_t_OT), 7);
line_aux += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T + 1024), 5); // valid until 2019
if (eph.i_GPS_week < 512)
{
line_aux += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T + (eph.i_GPS_week / 256) * 256 + 2048), 5); // valid from 2019 to 2029
}
else
{
line_aux += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T + (eph.i_GPS_week / 256) * 256 + 1024), 5); // valid from 2009 to 2019
}
line_aux += std::string(10, ' ');
line_aux += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
data.push_back(line_aux);
@ -2532,7 +2637,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Iono& gps_ion
}
void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac)
void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Gps_Ephemeris& eph, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac)
{
if (glonass_gnav_almanac.i_satellite_freq_channel)
{
@ -2573,7 +2678,14 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Iono& gps_ion
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A0, 16, 2), 18);
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A1, 15, 2), 16);
line_aux += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.d_t_OT), 7);
line_aux += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T + 1024), 5); // valid until 2019
if (eph.i_GPS_week < 512)
{
line_aux += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T + (eph.i_GPS_week / 256) * 256 + 2048), 5); // valid from 2019 to 2029
}
else
{
line_aux += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T + (eph.i_GPS_week / 256) * 256 + 1024), 5); // valid from 2009 to 2019
}
line_aux += std::string(10, ' ');
line_aux += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
data.push_back(line_aux);
@ -2681,7 +2793,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_CNAV_Iono& gp
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A0, 16, 2), 18);
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A1, 15, 2), 16);
line_aux += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.d_t_OT), 7);
line_aux += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T + 1024), 5); // valid until 2019
line_aux += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T), 5);
line_aux += std::string(10, ' ');
line_aux += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
data.push_back(line_aux);
@ -2872,7 +2984,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Beidou_Dnav_Utc_M
if (line_str.find("BDSA", 0) != std::string::npos)
{
line_aux += std::string("GPSA");
line_aux += std::string("BDSA");
line_aux += std::string(1, ' ');
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(iono.d_alpha0, 10, 2), 12);
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(iono.d_alpha1, 10, 2), 12);
@ -2884,7 +2996,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Beidou_Dnav_Utc_M
}
else if (line_str.find("BDSB", 0) != std::string::npos)
{
line_aux += std::string("GPSB");
line_aux += std::string("BDSB");
line_aux += std::string(1, ' ');
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(iono.d_beta0, 10, 2), 12);
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(iono.d_beta1, 10, 2), 12);
@ -2896,7 +3008,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Beidou_Dnav_Utc_M
}
else if (line_str.find("BDUT", 0) != std::string::npos)
{
line_aux += std::string("GPUT");
line_aux += std::string("BDUT");
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A0_UTC, 16, 2), 18);
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A1_UTC, 15, 2), 16);
line_aux += std::string(22, ' ');
@ -2942,6 +3054,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Beidou_Dnav_Utc_M
std::cout << "The RINEX Navigation file header has been updated with UTC and IONO info." << std::endl;
}
void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int32_t, Gps_Ephemeris>& eph_map)
{
std::string line;
@ -3180,7 +3293,20 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int32_t, Gps
line += std::string(1, ' ');
line += Rinex_Printer::doub2for(static_cast<double>(gps_ephemeris_iter->second.i_code_on_L2), 18, 2);
line += std::string(1, ' ');
auto GPS_week_continuous_number = static_cast<double>(gps_ephemeris_iter->second.i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm)
double GPS_week_continuous_number;
if (gps_ephemeris_iter->second.i_GPS_week < 512)
{
GPS_week_continuous_number = static_cast<double>(gps_ephemeris_iter->second.i_GPS_week + 2048); // valid until 2029
}
else
{
GPS_week_continuous_number = static_cast<double>(gps_ephemeris_iter->second.i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm)
}
// This week goes with Toe. This is different from the GPS week in the original satellite message!
if (gps_ephemeris_iter->second.d_Toe < 7200.0)
{
GPS_week_continuous_number += 1.0;
}
line += Rinex_Printer::doub2for(GPS_week_continuous_number, 18, 2);
line += std::string(1, ' ');
line += Rinex_Printer::doub2for(static_cast<double>(gps_ephemeris_iter->second.i_code_on_L2), 18, 2);
@ -3191,7 +3317,6 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int32_t, Gps
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- BROADCAST ORBIT - 6
line.clear();
if (version == 2)
@ -3226,9 +3351,14 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int32_t, Gps
{
line += std::string(5, ' ');
}
line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_TOW, 18, 2);
double tx_time_of_message = gps_ephemeris_iter->second.d_TOW;
if (gps_ephemeris_iter->second.d_Toe < 7200.0)
{
tx_time_of_message -= 604800.0; // see RINEX 3.03 section 6.13
}
line += Rinex_Printer::doub2for(tx_time_of_message, 18, 2);
line += std::string(1, ' ');
double curve_fit_interval = 4;
int curve_fit_interval = 4;
if (gps_ephemeris_iter->second.satelliteBlock.at(gps_ephemeris_iter->second.i_satellite_PRN) == "IIA")
{
@ -3278,7 +3408,14 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int32_t, Gps
curve_fit_interval = 26;
}
}
line += Rinex_Printer::doub2for(curve_fit_interval, 18, 2);
if (curve_fit_interval == 4)
{
line += Rinex_Printer::doub2for(0.0, 18, 2);
}
else
{
line += Rinex_Printer::doub2for(1.0, 18, 2);
}
line += std::string(1, ' ');
line += std::string(18, ' '); // spare
line += std::string(1, ' ');
@ -3417,7 +3554,13 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int32_t, Gps
double my_zero = 0.0;
line += Rinex_Printer::doub2for(my_zero, 18, 2);
line += std::string(1, ' ');
auto GPS_week_continuous_number = static_cast<double>(gps_ephemeris_iter->second.i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm)
auto GPS_week_continuous_number = static_cast<double>(gps_ephemeris_iter->second.i_GPS_week);
// This week goes with Toe. This is different from the GPS week in the original satellite message!
if (gps_ephemeris_iter->second.d_Toe1 < 7200.0)
{
GPS_week_continuous_number += 1.0;
}
line += Rinex_Printer::doub2for(GPS_week_continuous_number, 18, 2);
line += Rinex_Printer::doub2for(GPS_week_continuous_number, 18, 2);
line += std::string(1, ' ');
line += Rinex_Printer::doub2for(my_zero, 18, 2);
@ -3443,7 +3586,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int32_t, Gps
line += std::string(5, ' ');
line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_TOW, 18, 2);
line += std::string(1, ' ');
double curve_fit_interval = 3; /// ?? Not defined in CNAV
double curve_fit_interval = 0.0; /// ?? Not defined in CNAV
line += Rinex_Printer::doub2for(curve_fit_interval, 18, 2);
line += std::string(1, ' ');
line += std::string(18, ' '); // spare
@ -11113,19 +11256,22 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_Ephemeris& ep
// The RINEX v2.11 v3.00 format uses GPS time for the observations epoch, not UTC time, thus, no leap seconds needed here.
// (see Section 3 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex211.txt)
// (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex300.pdf)
// --??? No time correction here, since it will be done in the RINEX processor
const double gps_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<int64_t>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000));
// No time correction here, since it will be done in the PVT processor
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<int64_t>((obs_time + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000));
// Handle TOW rollover
if (obs_time < 18.0)
{
t += boost::posix_time::seconds(604800);
}
// Handle week rollover (valid from 2009 to 2029)
if (eph.i_GPS_week < 512)
{
boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t);
return p_time;
}
else
{
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time;
}
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time;
}
@ -11135,18 +11281,9 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_CNAV_Ephemeri
// (see Section 3 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex211.txt)
// (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex300.pdf)
// --??? No time correction here, since it will be done in the RINEX processor
const double gps_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<int64_t>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000));
if (eph.i_GPS_week < 512)
{
boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t);
return p_time;
}
else
{
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time;
}
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<int64_t>((obs_time + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000));
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time;
}

View File

@ -107,7 +107,7 @@ public:
/*!
* \brief Generates the GPS L1 C/A Navigation Data header
*/
void rinex_nav_header(std::fstream& out, const Gps_Iono& iono, const Gps_Utc_Model& utc_model);
void rinex_nav_header(std::fstream& out, const Gps_Iono& iono, const Gps_Utc_Model& utc_model, const Gps_Ephemeris& eph);
/*!
* \brief Generates the GPS L2C(M) Navigation Data header
@ -122,7 +122,7 @@ public:
/*!
* \brief Generates the Mixed (GPS/Galileo) Navigation Data header
*/
void rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model);
void rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Gps_Ephemeris& eph, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model);
/*!
* \brief Generates the Mixed (GPS CNAV/Galileo) Navigation Data header
@ -142,7 +142,7 @@ public:
/*!
* \brief Generates the Mixed (GPS L1 C/A/GLONASS L1, L2) Navigation Data header
*/
void rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac);
void rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Gps_Ephemeris& eph, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac);
/*!
* \brief Generates the Mixed (GPS L2C C/A/GLONASS L1, L2) Navigation Data header
@ -382,11 +382,11 @@ public:
*/
//void log_rinex_sbs(std::fstream & out, const Sbas_Raw_Msg & sbs_message);
void update_nav_header(std::fstream& out, const Gps_Utc_Model& utc_model, const Gps_Iono& gps_iono);
void update_nav_header(std::fstream& out, const Gps_Utc_Model& utc_model, const Gps_Iono& gps_iono, const Gps_Ephemeris& eph);
void update_nav_header(std::fstream& out, const Gps_CNAV_Utc_Model& utc_model, const Gps_CNAV_Iono& iono);
void update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model);
void update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Gps_Ephemeris& eph, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model);
void update_nav_header(std::fstream& out, const Gps_CNAV_Utc_Model& utc_model, const Gps_CNAV_Iono& iono, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model);
@ -394,7 +394,7 @@ public:
void update_nav_header(std::fstream& out, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac);
void update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac);
void update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc, const Gps_Ephemeris& eph, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac);
void update_nav_header(std::fstream& out, const Gps_CNAV_Iono& gps_iono, const Gps_CNAV_Utc_Model& gps_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac);

View File

@ -3401,7 +3401,7 @@ std::map<std::string, int> Rtcm::galileo_signal_map = [] {
boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double obs_time) const
{
const double gps_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000)); // NOLINT(google-runtime-int)
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week)) * 1000)); // NOLINT(google-runtime-int)
if (eph.i_GPS_week < 512)
{
@ -3417,14 +3417,7 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double
boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_CNAV_Ephemeris& eph, double obs_time) const
{
const double gps_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000)); // NOLINT(google-runtime-int)
if (eph.i_GPS_week < 512)
{
boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t);
return p_time;
}
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week)) * 1000)); // NOLINT(google-runtime-int)
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time;
}
@ -4226,9 +4219,18 @@ int32_t Rtcm::set_DF050(const Gnss_Synchro& gnss_synchro)
int32_t Rtcm::set_DF051(const Gps_Ephemeris& gps_eph, double obs_time)
{
const double gps_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<int64_t>((gps_t + 604800 * static_cast<double>(gps_eph.i_GPS_week % 1024)) * 1000));
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
std::string now_ptime = to_iso_string(p_time);
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<int64_t>((gps_t + 604800 * static_cast<double>(gps_eph.i_GPS_week)) * 1000));
std::string now_ptime;
if (gps_eph.i_GPS_week < 512)
{
boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t);
now_ptime = to_iso_string(p_time);
}
else
{
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
now_ptime = to_iso_string(p_time);
}
std::string today_ptime = now_ptime.substr(0, 8);
boost::gregorian::date d(boost::gregorian::from_undelimited_string(today_ptime));
uint32_t mjd = d.modjulian_day();
@ -4240,9 +4242,18 @@ int32_t Rtcm::set_DF051(const Gps_Ephemeris& gps_eph, double obs_time)
int32_t Rtcm::set_DF052(const Gps_Ephemeris& gps_eph, double obs_time)
{
const double gps_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<int64_t>((gps_t + 604800 * static_cast<double>(gps_eph.i_GPS_week % 1024)) * 1000));
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
std::string now_ptime = to_iso_string(p_time);
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<int64_t>((gps_t + 604800 * static_cast<double>(gps_eph.i_GPS_week)) * 1000));
std::string now_ptime;
if (gps_eph.i_GPS_week < 512)
{
boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t);
now_ptime = to_iso_string(p_time);
}
else
{
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
now_ptime = to_iso_string(p_time);
}
std::string hours = now_ptime.substr(9, 2);
std::string minutes = now_ptime.substr(11, 2);
std::string seconds = now_ptime.substr(13, 8);

View File

@ -991,9 +991,6 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
this->set_course_over_ground(new_cog);
}
//observable fix:
//double offset_s = this->get_time_offset_s();
//this->set_time_offset_s(offset_s + (rx_position_and_time(3) / GPS_C_m_s)); // accumulate the rx time error for the next iteration [meters]->[seconds]
this->set_time_offset_s(rx_position_and_time(3));
DLOG(INFO) << "RTKLIB Position at RX TOW = " << gnss_observables_map.begin()->second.RX_time
@ -1002,10 +999,11 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
boost::posix_time::ptime p_time;
// gtime_t rtklib_utc_time = gpst2utc(pvt_sol.time); //Corrected RX Time (Non integer multiply of 1 ms of granularity)
// Uncorrected RX Time (integer multiply of 1 ms and the same observables time reported in RTCM and RINEX)
gtime_t rtklib_time = gpst2time(adjgpsweek(nav_data.eph[0].week), gnss_observables_map.begin()->second.RX_time);
gtime_t rtklib_time = timeadd(pvt_sol.time, rx_position_and_time(3)); //uncorrected rx time
gtime_t rtklib_utc_time = gpst2utc(rtklib_time);
p_time = boost::posix_time::from_time_t(rtklib_utc_time.time);
p_time += boost::posix_time::microseconds(static_cast<long>(round(rtklib_utc_time.sec * 1e6))); // NOLINT(google-runtime-int)
this->set_position_UTC_time(p_time);
cart2geo(static_cast<double>(rx_position_and_time(0)), static_cast<double>(rx_position_and_time(1)), static_cast<double>(rx_position_and_time(2)), 4);
@ -1014,6 +1012,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
<< " [deg], Height= " << this->get_height() << " [m]"
<< " RX time offset= " << this->get_time_offset_s() << " [s]";
// PVT MONITOR
// TOW

View File

@ -76,7 +76,7 @@ public:
monitor_.set_cov_zz(monitor.cov_zz);
monitor_.set_cov_xy(monitor.cov_xy);
monitor_.set_cov_yz(monitor.cov_yz);
monitor_.set_cov_yz(monitor.cov_yz);
monitor_.set_cov_zx(monitor.cov_zx);
monitor_.set_latitude(monitor.latitude);
monitor_.set_longitude(monitor.longitude);
monitor_.set_height(monitor.height);

View File

@ -119,6 +119,13 @@ obsd_t insert_obs_to_rtklib(obsd_t& rtklib_obs, const Gnss_Synchro& gnss_synchro
// }
//
rtklib_obs.time = gpst2time(adjgpsweek(week), gnss_synchro.RX_time);
//account for the TOW crossover transitory in the first 18 seconds where the week is not yet updated!
if (gnss_synchro.RX_time < 18.0)
{
//p_time += boost::posix_time::seconds(604800);
rtklib_obs.time = timeadd(rtklib_obs.time, 604800);
}
rtklib_obs.rcv = 1;
return rtklib_obs;
}

View File

@ -2044,6 +2044,17 @@ double time2doy(gtime_t t)
*-----------------------------------------------------------------------------*/
int adjgpsweek(int week)
{
// int w;
// if (week < 512)
// {
// //assume receiver date > 7 april 2019
// w = week + 2048; //add weeks from 6-january-1980 to week rollover in 7 april 2019
// }
// else
// {
// //assume receiver date < 7 april 2019
// w = week + 1024; //add weeks from 6-january-1980 to week rollover in 22 august 2019
// }
int w;
(void)time2gpst(utc2gpst(timeget()), &w);
if (w < 1560)
@ -2051,6 +2062,7 @@ int adjgpsweek(int week)
w = 1560; /* use 2009/12/1 if time is earlier than 2009/12/1 */
}
return week + (w - week + 512) / 1024 * 1024;
// return w;
}

View File

@ -198,6 +198,8 @@ void labsat23_source::decode_samples_one_channel(int16_t input_short, gr_complex
//out[i] += gr_complex(0.5, 0.5);
}
break;
default:
break;
}
}
@ -225,7 +227,6 @@ int labsat23_source::general_work(int noutput_items,
{
preamble_ok = false;
}
//std::cout << "H[" << i << "]:" << (int)memblock[byte_counter] << std::endl;
byte_counter++;
}
@ -266,17 +267,14 @@ int labsat23_source::general_work(int noutput_items,
header_bytes += memblock[byte_counter] | (memblock[byte_counter + 1] << 8) | (memblock[byte_counter + 2] << 16) | (memblock[byte_counter + 3] << 24);
byte_counter += 4;
//std::cout << "header_bytes=" << header_bytes << std::endl;
// read first section
// section ID (little-endian)
uint8_t section_id = static_cast<int>(memblock[byte_counter]) + static_cast<int>(memblock[byte_counter + 1]) * 256;
//std::cout << "Section ID: " << (int)section_id << std::endl;
byte_counter += 2;
//uint8_t section_lenght_bytes = 0;
//section_lenght_bytes += memblock[byte_counter] | (memblock[byte_counter + 1] << 8) | (memblock[byte_counter + 2] << 16) | (memblock[byte_counter + 3] << 24);
//std::cout << "section_lenght_bytes=" << (int)section_lenght_bytes << std::endl;
byte_counter += 4;
if (section_id == 2)
@ -285,10 +283,10 @@ int labsat23_source::general_work(int noutput_items,
switch (d_ref_clock)
{
case 0:
std::cout << "Labsat reference clock: internal OXCO" << std::endl;
std::cout << "Labsat reference clock: internal OCXO" << std::endl;
break;
case 1:
std::cout << "Labsat reference clock: internal TXCO" << std::endl;
std::cout << "Labsat reference clock: internal TCXO" << std::endl;
break;
case 2:
std::cout << "Labsat reference clock: external 10 MHz" << std::endl;
@ -319,19 +317,19 @@ int labsat23_source::general_work(int noutput_items,
switch (d_channel_selector)
{
case 0:
std::cout << "Available channels: Channel A + B, 1 bit quantisation" << std::endl;
std::cout << "Available channels: Channel A + B, 1 bit quantisation (I & Q)" << std::endl;
break;
case 1:
std::cout << "Available channels: Channel A, 1 bit quantisation" << std::endl;
std::cout << "Available channels: Channel A, 1 bit quantisation (I & Q)" << std::endl;
break;
case 2:
std::cout << "Available channels: Channel B, 1 bit quantisation" << std::endl;
std::cout << "Available channels: Channel B, 1 bit quantisation (I & Q)" << std::endl;
break;
case 3:
std::cout << "Available channels: Channel A, 2 bit quantisation" << std::endl;
std::cout << "Available channels: Channel A, 2 bit quantisation (I & Q)" << std::endl;
break;
case 4:
std::cout << "Available channels: Channel B, 2 bit quantisation" << std::endl;
std::cout << "Available channels: Channel B, 2 bit quantisation (I & Q)" << std::endl;
break;
default:
std::cout << "Unknown channel selection ID " << static_cast<int>(d_channel_selector) << std::endl;
@ -355,6 +353,8 @@ int labsat23_source::general_work(int noutput_items,
auto quantization = static_cast<uint8_t>(memblock[byte_counter]);
switch (quantization)
{
case 0:
break;
case 1:
std::cout << "1 bit per sample" << std::endl;
break;
@ -393,6 +393,9 @@ int labsat23_source::general_work(int noutput_items,
case 2:
std::cout << "Labsat Channel B is BDS" << std::endl;
break;
case 255:
// No channel B
break;
default:
std::cout << "Unknown channel B constellation ID " << static_cast<int>(channel_b_constellation) << std::endl;
}
@ -415,133 +418,129 @@ int labsat23_source::general_work(int noutput_items,
switch (d_bits_per_sample)
{
case 2:
{
switch (d_channel_selector)
{
case 0:
// dual channel 2 bits per complex sample
//todo: implement dual channel reader
break;
default:
// single channel 2 bits per complex sample (1 bit I + 1 bit Q, 8 samples per int16)
int n_int16_to_read = noutput_items / 8;
if (n_int16_to_read > 0)
{
int16_t memblock[n_int16_to_read];
binary_input_file->read(reinterpret_cast<char *>(memblock), n_int16_to_read * 2);
n_int16_to_read = binary_input_file->gcount() / 2; //from bytes to int16
if (n_int16_to_read > 0)
{
int output_pointer = 0;
for (int i = 0; i < n_int16_to_read; i++)
{
decode_samples_one_channel(memblock[i], &out[output_pointer], d_bits_per_sample);
output_pointer += 8;
}
return output_pointer;
}
switch (d_channel_selector)
{
case 0:
// dual channel 2 bits per complex sample
//todo: implement dual channel reader
break;
default:
// single channel 2 bits per complex sample (1 bit I + 1 bit Q, 8 samples per int16)
int n_int16_to_read = noutput_items / 8;
if (n_int16_to_read > 0)
{
int16_t memblock[n_int16_to_read];
binary_input_file->read(reinterpret_cast<char *>(memblock), n_int16_to_read * 2);
n_int16_to_read = binary_input_file->gcount() / 2; //from bytes to int16
if (n_int16_to_read > 0)
{
int output_pointer = 0;
for (int i = 0; i < n_int16_to_read; i++)
{
decode_samples_one_channel(memblock[i], &out[output_pointer], d_bits_per_sample);
output_pointer += 8;
}
return output_pointer;
}
// trigger the read of the next file in the sequence
if (d_labsat_version == 3)
{
std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl;
}
d_current_file_number++;
binary_input_file->close();
binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary);
if (binary_input_file->is_open())
{
std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl;
}
else
{
if (d_labsat_version == 3)
{
std::cout << "Last file reached, LabSat source stop" << std::endl;
}
else
{
std::cout << "End of file reached, LabSat source stop" << std::endl;
}
auto *cmf = new ControlMessageFactory();
d_queue->handle(cmf->GetQueueMessage(200, 0));
delete cmf;
return -1;
}
}
else
{
return 0;
}
};
break;
}
// trigger the read of the next file in the sequence
d_current_file_number++;
if (d_labsat_version == 3)
{
std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl;
}
binary_input_file->close();
binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary);
if (binary_input_file->is_open())
{
std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl;
return 0;
}
else
{
if (d_labsat_version == 3)
{
std::cout << "Last file reached, LabSat source stop" << std::endl;
}
else
{
std::cout << "End of file reached, LabSat source stop" << std::endl;
}
auto *cmf = new ControlMessageFactory();
d_queue->handle(cmf->GetQueueMessage(200, 0));
delete cmf;
return -1;
}
}
else
{
return 0;
}
}
break;
case 4:
{
switch (d_channel_selector)
{
case 0:
// dual channel
//todo: implement dual channel reader
break;
default:
// single channel 4 bits per complex sample (2 bit I + 2 bit Q, 4 samples per int16)
int n_int16_to_read = noutput_items / 4;
if (n_int16_to_read > 0)
{
int16_t memblock[n_int16_to_read];
binary_input_file->read(reinterpret_cast<char *>(memblock), n_int16_to_read * 2);
n_int16_to_read = binary_input_file->gcount() / 2; //from bytes to int16
if (n_int16_to_read > 0)
{
int output_pointer = 0;
for (int i = 0; i < n_int16_to_read; i++)
{
decode_samples_one_channel(memblock[i], &out[output_pointer], d_bits_per_sample);
output_pointer += 4;
}
return output_pointer;
}
switch (d_channel_selector)
{
case 0:
// dual channel
//todo: implement dual channel reader
break;
default:
// single channel 4 bits per complex sample (2 bit I + 2 bit Q, 4 samples per int16)
int n_int16_to_read = noutput_items / 4;
if (n_int16_to_read > 0)
{
int16_t memblock[n_int16_to_read];
binary_input_file->read(reinterpret_cast<char *>(memblock), n_int16_to_read * 2);
n_int16_to_read = binary_input_file->gcount() / 2; // from bytes to int16
if (n_int16_to_read > 0)
{
int output_pointer = 0;
for (int i = 0; i < n_int16_to_read; i++)
{
decode_samples_one_channel(memblock[i], &out[output_pointer], d_bits_per_sample);
output_pointer += 4;
}
return output_pointer;
}
// trigger the read of the next file in the sequence
if (d_labsat_version == 3)
{
std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl;
}
d_current_file_number++;
binary_input_file->close();
binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary);
if (binary_input_file->is_open())
{
std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl;
}
else
{
if (d_labsat_version == 3)
{
std::cout << "Last file reached, LabSat source stop" << std::endl;
}
else
{
std::cout << "End of file reached, LabSat source stop" << std::endl;
}
auto *cmf = new ControlMessageFactory();
d_queue->handle(cmf->GetQueueMessage(200, 0));
delete cmf;
return -1;
}
}
else
{
return 0;
}
}
break;
}
// trigger the read of the next file in the sequence
d_current_file_number++;
if (d_labsat_version == 3)
{
std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl;
}
binary_input_file->close();
binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary);
if (binary_input_file->is_open())
{
std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl;
return 0;
}
else
{
if (d_labsat_version == 3)
{
std::cout << "Last file reached, LabSat source stop" << std::endl;
}
else
{
std::cout << "End of file reached, LabSat source stop" << std::endl;
}
auto *cmf = new ControlMessageFactory();
d_queue->handle(cmf->GetQueueMessage(200, 0));
delete cmf;
return -1;
}
}
else
{
return 0;
}
}
break;
default:
{
return -1;
}
return -1;
}
std::cout << "Warning!!" << std::endl;