mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-11-04 09:13:05 +00:00 
			
		
		
		
	Correct Carrier Phase observable for inverted PLL lock in L2,L5 E1, and E5
This commit is contained in:
		@@ -757,6 +757,12 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
 | 
			
		||||
            // todo: Galileo to GPS time conversion should be moved to observable block.
 | 
			
		||||
            // current_symbol.TOW_at_current_symbol_ms -= delta_t;  // Galileo to GPS TOW
 | 
			
		||||
 | 
			
		||||
            if (flag_PLL_180_deg_phase_locked == true)
 | 
			
		||||
                {
 | 
			
		||||
                    // correct the accumulated phase for the Costas loop phase shift, if required
 | 
			
		||||
                    current_symbol.Carrier_phase_rads += GALILEO_PI;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            if (d_dump == true)
 | 
			
		||||
                {
 | 
			
		||||
                    // MULTIPLEXED FILE RECORDING - Record results to file
 | 
			
		||||
 
 | 
			
		||||
@@ -74,6 +74,7 @@ gps_l2c_telemetry_decoder_gs::gps_l2c_telemetry_decoder_gs(
 | 
			
		||||
    cnav_msg_decoder_init(&d_cnav_decoder);
 | 
			
		||||
 | 
			
		||||
    d_sample_counter = 0;
 | 
			
		||||
    flag_PLL_180_deg_phase_locked = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -175,6 +176,14 @@ int gps_l2c_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
 | 
			
		||||
    // check if new CNAV frame is available
 | 
			
		||||
    if (flag_new_cnav_frame == true)
 | 
			
		||||
        {
 | 
			
		||||
            if (d_cnav_decoder.part1.invert == true or d_cnav_decoder.part1.invert == true)
 | 
			
		||||
                {
 | 
			
		||||
                    flag_PLL_180_deg_phase_locked = true;
 | 
			
		||||
                }
 | 
			
		||||
            else
 | 
			
		||||
                {
 | 
			
		||||
                    flag_PLL_180_deg_phase_locked = false;
 | 
			
		||||
                }
 | 
			
		||||
            std::bitset<GPS_L2_CNAV_DATA_PAGE_BITS> raw_bits;
 | 
			
		||||
            // Expand packet bits to bitsets. Notice the reverse order of the bits sequence, required by the CNAV message decoder
 | 
			
		||||
            for (uint32_t i = 0; i < GPS_L2_CNAV_DATA_PAGE_BITS; i++)
 | 
			
		||||
@@ -225,6 +234,14 @@ int gps_l2c_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
 | 
			
		||||
                    d_flag_valid_word = false;
 | 
			
		||||
                }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    if (flag_PLL_180_deg_phase_locked == true)
 | 
			
		||||
        {
 | 
			
		||||
            // correct the accumulated phase for the Costas loop phase shift, if required
 | 
			
		||||
            current_synchro_data.Carrier_phase_rads += GPS_L2_PI;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    current_synchro_data.TOW_at_current_symbol_ms = round(d_TOW_at_current_symbol * 1000.0);
 | 
			
		||||
    current_synchro_data.Flag_valid_word = d_flag_valid_word;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -83,6 +83,7 @@ private:
 | 
			
		||||
    uint64_t d_last_valid_preamble;
 | 
			
		||||
    uint32_t d_max_symbols_without_valid_frame;
 | 
			
		||||
 | 
			
		||||
    bool flag_PLL_180_deg_phase_locked;
 | 
			
		||||
    double d_TOW_at_current_symbol;
 | 
			
		||||
    double d_TOW_at_Preamble;
 | 
			
		||||
    bool d_flag_valid_word;
 | 
			
		||||
 
 | 
			
		||||
@@ -69,6 +69,7 @@ gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs(
 | 
			
		||||
    cnav_msg_decoder_init(&d_cnav_decoder);
 | 
			
		||||
 | 
			
		||||
    d_sample_counter = 0;
 | 
			
		||||
    flag_PLL_180_deg_phase_locked = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -167,6 +168,14 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u
 | 
			
		||||
    // check if new CNAV frame is available
 | 
			
		||||
    if (cnav_msg_decoder_add_symbol(&d_cnav_decoder, symbol_clip, &msg, &delay) == true)
 | 
			
		||||
        {
 | 
			
		||||
            if (d_cnav_decoder.part1.invert == true or d_cnav_decoder.part1.invert == true)
 | 
			
		||||
                {
 | 
			
		||||
                    flag_PLL_180_deg_phase_locked = true;
 | 
			
		||||
                }
 | 
			
		||||
            else
 | 
			
		||||
                {
 | 
			
		||||
                    flag_PLL_180_deg_phase_locked = false;
 | 
			
		||||
                }
 | 
			
		||||
            std::bitset<GPS_L5_CNAV_DATA_PAGE_BITS> raw_bits;
 | 
			
		||||
            // Expand packet bits to bitsets. Notice the reverse order of the bits sequence, required by the CNAV message decoder
 | 
			
		||||
            for (uint32_t i = 0; i < GPS_L5_CNAV_DATA_PAGE_BITS; i++)
 | 
			
		||||
@@ -238,6 +247,11 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u
 | 
			
		||||
 | 
			
		||||
    if (d_flag_valid_word == true)
 | 
			
		||||
        {
 | 
			
		||||
            if (flag_PLL_180_deg_phase_locked == true)
 | 
			
		||||
                {
 | 
			
		||||
                    // correct the accumulated phase for the Costas loop phase shift, if required
 | 
			
		||||
                    current_synchro_data.Carrier_phase_rads += GPS_L5_PI;
 | 
			
		||||
                }
 | 
			
		||||
            current_synchro_data.TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
 | 
			
		||||
            current_synchro_data.Flag_valid_word = d_flag_valid_word;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -75,6 +75,7 @@ private:
 | 
			
		||||
 | 
			
		||||
    cnav_msg_decoder_t d_cnav_decoder{};
 | 
			
		||||
 | 
			
		||||
    bool flag_PLL_180_deg_phase_locked;
 | 
			
		||||
    uint32_t d_TOW_at_current_symbol_ms;
 | 
			
		||||
    uint32_t d_TOW_at_Preamble_ms;
 | 
			
		||||
    bool d_flag_valid_word;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user