1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-18 11:09:56 +00:00

Minor changes

This commit is contained in:
Antonio Ramos 2017-12-11 12:17:01 +01:00
parent 8b5f7097b3
commit 26a521907a
21 changed files with 285 additions and 238 deletions

View File

@ -35,7 +35,7 @@ obsd_t insert_obs_to_rtklib(obsd_t & rtklib_obs, const Gnss_Synchro & gnss_synch
{
rtklib_obs.D[band] = gnss_synchro.Carrier_Doppler_hz;
rtklib_obs.P[band] = gnss_synchro.Pseudorange_m;
rtklib_obs.L[band] = gnss_synchro.Carrier_phase_rads / (2.0 * PI);
rtklib_obs.L[band] = gnss_synchro.Carrier_phase_rads / PI_2;
switch(band)
{
case 0:
@ -165,8 +165,6 @@ eph_t eph_to_rtklib(const Gps_Ephemeris & gps_eph)
rtklib_sat.toc = gpst2time(rtklib_sat.week, toc);
rtklib_sat.ttr = gpst2time(rtklib_sat.week, tow);
//printf("EPHEMERIS TIME [%i]: %s,%f\n\r",rtklib_sat.sat,time_str(rtklib_sat.toe,3),rtklib_sat.toe.sec);
return rtklib_sat;
}
@ -183,7 +181,7 @@ eph_t eph_to_rtklib(const Gps_CNAV_Ephemeris & gps_cnav_eph)
rtklib_sat.OMG0 = gps_cnav_eph.d_OMEGA0;
// Compute the angle between the ascending node and the Greenwich meridian
const double OMEGA_DOT_REF = -2.6e-9; // semicircles / s, see IS-GPS-200H pp. 164
double d_OMEGA_DOT = OMEGA_DOT_REF * GPS_L2_PI + gps_cnav_eph.d_DELTA_OMEGA_DOT;
double d_OMEGA_DOT = OMEGA_DOT_REF * PI + gps_cnav_eph.d_DELTA_OMEGA_DOT;
rtklib_sat.OMGd = d_OMEGA_DOT;
rtklib_sat.omg = gps_cnav_eph.d_OMEGA;
rtklib_sat.i0 = gps_cnav_eph.d_i_0;

View File

@ -34,10 +34,6 @@
#include <gnuradio/io_signature.h>
#include <glog/logging.h>
#include "concurrent_queue.h"
#include "gps_cnav_ephemeris.h"
#include "gps_almanac.h"
#include "gps_cnav_iono.h"
#include "gps_cnav_utc_model.h"
#include "configuration_interface.h"

View File

@ -36,6 +36,7 @@
#include <string>
#include "telemetry_decoder_interface.h"
#include "gps_l5_telemetry_decoder_cc.h"
#include "gnss_satellite.h"
class ConfigurationInterface;

View File

@ -37,6 +37,8 @@
#include <boost/lexical_cast.hpp>
#include "gnss_synchro.h"
#include "gps_l5_telemetry_decoder_cc.h"
#include "gps_cnav_ephemeris.h"
#include "gps_cnav_iono.h"
using google::LogMessage;
@ -70,6 +72,19 @@ gps_l5_telemetry_decoder_cc::gps_l5_telemetry_decoder_cc(
//initialize the CNAV frame decoder (libswiftcnav)
cnav_msg_decoder_init(&d_cnav_decoder);
for(int aux = 0; aux < GPS_L5_NH_CODE_LENGTH; aux++)
{
if(GPS_L5_NH_CODE[aux] == 0)
{
bits_NH[aux] = -1.0;
}
else
{
bits_NH[aux] = 1.0;
}
}
sync_NH = false;
new_sym = false;
}
@ -96,26 +111,58 @@ int gps_l5_telemetry_decoder_cc::general_work (int noutput_items __attribute__((
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
// UPDATE GNSS SYNCHRO DATA
Gnss_Synchro current_synchro_data; //structure to save the synchronization information and send the output object to the next block
//1. Copy the current tracking output
current_synchro_data = in[0];
consume_each(1); //one by one
sym_hist.push_back(in[0].Prompt_I);
double symbol_value = 0.0;
if(sym_hist.size() == GPS_L5_NH_CODE_LENGTH)
{
std::deque<double>::iterator it;
int corr_NH = 0;
it = sym_hist.begin();
for(int i = 0; i < GPS_L5_NH_CODE_LENGTH; i++)
{
if((bits_NH[i] * (*it)) > 0.0){corr_NH += 1;}
else{corr_NH -= 1;}
it++;
}
if(abs(corr_NH) == GPS_L5_NH_CODE_LENGTH){sync_NH = true;}
else
{
sym_hist.pop_front();
sync_NH = false;
}
if (sync_NH)
{
new_sym = true;
for(it = sym_hist.begin(); it != sym_hist.end(); it++)
{
symbol_value += (*it);
}
sym_hist.clear();
}
}
bool flag_new_cnav_frame = false;
cnav_msg_t msg;
u32 delay = 0;
//add the symbol to the decoder
u8 symbol_clip = static_cast<u8>(in[0].Prompt_I > 0) * 255;
flag_new_cnav_frame = cnav_msg_decoder_add_symbol(&d_cnav_decoder, symbol_clip, &msg, &delay);
consume_each(1); //one by one
// UPDATE GNSS SYNCHRO DATA
Gnss_Synchro current_synchro_data; //structure to save the synchronization information and send the output object to the next block
//1. Copy the current tracking output
current_synchro_data = in[0];
if(new_sym)
{
u8 symbol_clip = static_cast<u8>(symbol_value > 0.0) * 255;
flag_new_cnav_frame = cnav_msg_decoder_add_symbol(&d_cnav_decoder, symbol_clip, &msg, &delay);
new_sym = false;
}
//2. Add the telemetry decoder information
//check if new CNAV frame is available
if (flag_new_cnav_frame == true)
{
std::cout << "NEW CNAV FRAME" << std::endl;
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 (u32 i = 0; i < GPS_L5_CNAV_DATA_PAGE_BITS ; i++)
@ -169,12 +216,6 @@ int gps_l5_telemetry_decoder_cc::general_work (int noutput_items __attribute__((
current_synchro_data.TOW_at_current_symbol_s = d_TOW_at_current_symbol;
current_synchro_data.Flag_valid_word = d_flag_valid_word;
// 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_PI;
// }
if(d_dump == true)
{
// MULTIPLEXED FILE RECORDING - Record results to file

View File

@ -31,17 +31,15 @@
#ifndef GNSS_SDR_GPS_L5_TELEMETRY_DECODER_CC_H
#define GNSS_SDR_GPS_L5_TELEMETRY_DECODER_CC_H
#include <algorithm> // for copy
#include <algorithm>
#include <deque>
#include <fstream>
#include <string>
#include <utility> // for pair
#include <utility>
#include <vector>
#include <gnuradio/block.h>
#include "gnss_satellite.h"
#include "gps_cnav_navigation_message.h"
#include "gps_cnav_ephemeris.h"
#include "gps_cnav_iono.h"
#include "concurrent_queue.h"
extern "C" {
@ -99,6 +97,10 @@ private:
bool d_flag_valid_word;
Gps_CNAV_Navigation_Message d_CNAV_Message;
double bits_NH[GPS_L5_NH_CODE_LENGTH];
std::deque<double> sym_hist;
bool sync_NH;
bool new_sym;
};

View File

@ -49,11 +49,9 @@
*/
/** Viterbi decoder reversed polynomial A */
#define GPS_L2C_V27_POLY_A (0x4F) /* 0b01001111 - reversed 0171*/
#define GPS_L5_V27_POLY_A (0x4F) /* 0b01001111 - reversed 0171*/
/** Viterbi decoder reversed polynomial B */
#define GPS_L2C_V27_POLY_B (0x6D) /* 0b01101101 - reversed 0133 */
#define GPS_L5_V27_POLY_B (0x6D) /* 0b01101101 - reversed 0133 */
/*
* GPS L2C message constants.
*/

View File

@ -49,16 +49,12 @@
/** Size of the Viterbi decoder history. */
#define GPS_L2_V27_HISTORY_LENGTH_BITS 64
#define GPS_L5_V27_HISTORY_LENGTH_BITS 64
/** Bits to accumulate before decoding starts. */
#define GPS_L2C_V27_INIT_BITS (32)
#define GPS_L5_V27_INIT_BITS (32)
/** Bits to decode at a time. */
#define GPS_L2C_V27_DECODE_BITS (32)
#define GPS_L5_V27_DECODE_BITS (32)
/** Bits in decoder tail. We ignore them. */
#define GPS_L2C_V27_DELAY_BITS (32)
#define GPS_L5_V27_DELAY_BITS (32)
/**
* GPS CNAV message container.
*
@ -73,15 +69,6 @@ typedef struct
u8 raw_msg[GPS_L2C_V27_DECODE_BITS + GPS_L2C_V27_DELAY_BITS]; /**< RAW MSG for GNSS-SDR */
} cnav_msg_t;
typedef struct
{
u8 prn; /**< SV PRN. 0..31 */
u8 msg_id; /**< Message id. 0..31 */
u32 tow; /**< GPS ToW in 6-second units. Multiply to 6 to get seconds. */
bool alert; /**< CNAV message alert flag */
u8 raw_msg[GPS_L5_V27_DECODE_BITS + GPS_L5_V27_DELAY_BITS]; /**< RAW MSG for GNSS-SDR */
} cnav_L5_msg_t;
/**
* GPS CNAV decoder component.
* This component controls symbol decoding string.
@ -109,27 +96,6 @@ typedef struct {
* do not produce output. */
} cnav_v27_part_t;
typedef struct {
v27_t dec; /**< Viterbi block decoder object */
v27_decision_t decisions[GPS_L5_V27_HISTORY_LENGTH_BITS];
/**< Decision graph */
unsigned char symbols[(GPS_L5_V27_INIT_BITS + GPS_L5_V27_DECODE_BITS) * 2];
/**< Symbol buffer */
size_t n_symbols; /**< Count of symbols in the symbol buffer */
unsigned char decoded[GPS_L5_V27_DECODE_BITS + GPS_L5_V27_DELAY_BITS];
/**< Decode buffer */
size_t n_decoded; /**< Number of bits in the decode buffer */
bool preamble_seen; /**< When true, the decode buffer is aligned on
* preamble. */
bool invert; /**< When true, indicates the bits are inverted */
bool message_lock; /**< When true, indicates the message boundary
* is found. */
bool crc_ok; /**< Flag that the last message had good CRC */
size_t n_crc_fail; /**< Counter for CRC failures */
bool init; /**< Initial state flag. When true, initial bits
* do not produce output. */
} cnav_L5_v27_part_t;
/**
* GPS CNAV message lock and decoder object.
*

View File

@ -1,5 +1,5 @@
/*!
* \file gps_l5idll_pll_tracking.cc
* \file gps_l5i_dll_pll_tracking.cc
* \brief Interface of an adapter of a DLL+PLL tracking loop block
* for GPS L5i to a TrackingInterface
* \author Javier Arribas, 2017. jarribas(at)cttc.es

View File

@ -62,7 +62,7 @@ public:
return role_;
}
//! Returns "GPS_L2_M_DLL_PLL_Tracking"
//! Returns "GPS_L5i_DLL_PLL_Tracking"
inline std::string implementation() override
{
return "GPS_L5i_DLL_PLL_Tracking";

View File

@ -642,8 +642,8 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute
// The first Prompt output not equal to 0 is synchronized with the transition of a navigation data bit.
if (d_secondary_lock && d_first_transition)
{
current_synchro_data.Prompt_I = static_cast<double>((d_Prompt_data).real());
current_synchro_data.Prompt_Q = static_cast<double>((d_Prompt_data).imag());
current_synchro_data.Prompt_I = static_cast<double>(d_Prompt_data.real());
current_synchro_data.Prompt_Q = static_cast<double>(d_Prompt_data.imag());
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples;
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_rad;

View File

@ -257,14 +257,14 @@ void gps_l5i_dll_pll_tracking_cc::start_tracking()
sys = sys_.substr(0,1);
// DEBUG OUTPUT
std::cout << "Tracking of GPS L2CM signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl;
LOG(INFO) << "Starting GPS L2CM tracking of satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel;
std::cout << "Tracking of GPS L5i signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl;
LOG(INFO) << "Starting GPS L5i tracking of satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel;
// enable tracking
d_pull_in = true;
d_enable_tracking = true;
LOG(INFO) << "GPS L2CM PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz
LOG(INFO) << "GPS L5i PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz
<< " Code Phase correction [samples]=" << delay_correction_samples
<< " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples;
}

View File

@ -240,6 +240,7 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetObservables(std::shared
Galileo_channels += configuration->property("Channels_5X.count", 0);
unsigned int GPS_channels = configuration->property("Channels_1C.count", 0);
GPS_channels += configuration->property("Channels_2S.count", 0);
GPS_channels += configuration->property("Channels_L5.count", 0);
return GetBlock(configuration, "Observables", implementation, Galileo_channels + GPS_channels, Galileo_channels + GPS_channels);
}
@ -254,6 +255,7 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetPVT(std::shared_ptr<Con
Galileo_channels += configuration->property("Channels_5X.count", 0);
unsigned int GPS_channels = configuration->property("Channels_1C.count", 0);
GPS_channels += configuration->property("Channels_2S.count", 0);
GPS_channels += configuration->property("Channels_L5.count", 0);
return GetBlock(configuration, "PVT", implementation, Galileo_channels + GPS_channels, 0);
}

View File

@ -0,0 +1,183 @@
/*!
* \file GPS_CNAV.h
* \brief Defines parameters for GPS CNAV
* \author Antonio Ramos, 2017. antonio.ramos(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_GPS_CNAV_H_
#define GNSS_SDR_GPS_CNAV_H_
#include <cstdint>
#include <vector>
#include <utility> // std::pair
#include "MATH_CONSTANTS.h"
// CNAV GPS NAVIGATION MESSAGE STRUCTURE
// NAVIGATION MESSAGE FIELDS POSITIONS (from IS-GPS-200E Appendix III)
#define GPS_CNAV_PREAMBLE {1, 0, 0, 0, 1, 0, 1, 1}
#define GPS_CNAV_PREAMBLE_STR "10001011"
#define GPS_CNAV_INV_PREAMBLE_STR "01110100"
const int GPS_CNAV_DATA_PAGE_BITS = 300;
// common to all messages
const std::vector<std::pair<int,int> > CNAV_PRN( { {9,6} } );
const std::vector<std::pair<int,int> > CNAV_MSG_TYPE( { {15,6} } );
const std::vector<std::pair<int,int> > CNAV_TOW( { {21,17} } ); //GPS Time Of Week in seconds
const double CNAV_TOW_LSB = 6.0;
const std::vector<std::pair<int,int> > CNAV_ALERT_FLAG( { {38,1} } );
// MESSAGE TYPE 10 (Ephemeris 1)
const std::vector<std::pair<int,int> > CNAV_WN({{39,13}});
const std::vector<std::pair<int,int> > CNAV_HEALTH({{52,3}});
const std::vector<std::pair<int,int> > CNAV_TOP1({{55,11}});
const double CNAV_TOP1_LSB = 300.0;
const std::vector<std::pair<int,int> > CNAV_URA({{66,5}});
const std::vector<std::pair<int,int> > CNAV_TOE1({{71,11}});
const double CNAV_TOE1_LSB = 300.0;
const std::vector<std::pair<int,int> > CNAV_DELTA_A({{82,26}}); //Relative to AREF = 26,559,710 meters
const double CNAV_DELTA_A_LSB = TWO_N9;
const std::vector<std::pair<int,int> > CNAV_A_DOT({{108,25}});
const double CNAV_A_DOT_LSB = TWO_N21;
const std::vector<std::pair<int,int> > CNAV_DELTA_N0({{133,17}});
const double CNAV_DELTA_N0_LSB = TWO_N44*PI; //semi-circles to radians
const std::vector<std::pair<int,int> > CNAV_DELTA_N0_DOT({{150,23}});
const double CNAV_DELTA_N0_DOT_LSB = TWO_N57*PI;//semi-circles to radians
const std::vector<std::pair<int,int> > CNAV_M0({{173,33}});
const double CNAV_M0_LSB = TWO_N32*PI;//semi-circles to radians
const std::vector<std::pair<int,int> > CNAV_E_ECCENTRICITY({{206,33}});
const double CNAV_E_ECCENTRICITY_LSB = TWO_N34;
const std::vector<std::pair<int,int> > CNAV_OMEGA({{239,33}});
const double CNAV_OMEGA_LSB = TWO_N32*PI;//semi-circles to radians
const std::vector<std::pair<int,int> > CNAV_INTEGRITY_FLAG({{272,1}});
const std::vector<std::pair<int,int> > CNAV_L2_PHASING_FLAG({{273,1}});
// MESSAGE TYPE 11 (Ephemeris 2)
const std::vector<std::pair<int,int> > CNAV_TOE2({{39,11}});
const double CNAV_TOE2_LSB = 300.0;
const std::vector<std::pair<int,int> > CNAV_OMEGA0({{50,33}});
const double CNAV_OMEGA0_LSB = TWO_N32*PI;//semi-circles to radians
const std::vector<std::pair<int,int> > CNAV_I0({{83,33}});
const double CNAV_I0_LSB = TWO_N32*PI;//semi-circles to radians
const std::vector<std::pair<int,int> > CNAV_DELTA_OMEGA_DOT({{116,17}}); //Relative to REF = -2.6 x 10-9 semi-circles/second.
const double CNAV_DELTA_OMEGA_DOT_LSB = TWO_N44*PI;//semi-circles to radians
const std::vector<std::pair<int,int> > CNAV_I0_DOT({{133,15}});
const double CNAV_I0_DOT_LSB = TWO_N44*PI;//semi-circles to radians
const std::vector<std::pair<int,int> > CNAV_CIS({{148,16}});
const double CNAV_CIS_LSB = TWO_N30;
const std::vector<std::pair<int,int> > CNAV_CIC({{164,16}});
const double CNAV_CIC_LSB = TWO_N30;
const std::vector<std::pair<int,int> > CNAV_CRS({{180,24}});
const double CNAV_CRS_LSB = TWO_N8;
const std::vector<std::pair<int,int> > CNAV_CRC({{204,24}});
const double CNAV_CRC_LSB = TWO_N8;
const std::vector<std::pair<int,int> > CNAV_CUS({{228,21}});
const double CNAV_CUS_LSB = TWO_N30;
const std::vector<std::pair<int,int> > CNAV_CUC({{249,21}});
const double CNAV_CUC_LSB = TWO_N30;
// MESSAGE TYPE 30 (CLOCK, IONO, GRUP DELAY)
const std::vector<std::pair<int,int> > CNAV_TOP2({{39,11}});
const double CNAV_TOP2_LSB = 300.0;
const std::vector<std::pair<int,int> > CNAV_URA_NED0({{50,5}});
const std::vector<std::pair<int,int> > CNAV_URA_NED1({{55,3}});
const std::vector<std::pair<int,int> > CNAV_URA_NED2({{58,3}});
const std::vector<std::pair<int,int> > CNAV_TOC({{61,11}});
const double CNAV_TOC_LSB = 300.0;
const std::vector<std::pair<int,int> > CNAV_AF0({{72,26}});
const double CNAV_AF0_LSB = TWO_N60;
const std::vector<std::pair<int,int> > CNAV_AF1({{98,20}});
const double CNAV_AF1_LSB = TWO_N48;
const std::vector<std::pair<int,int> > CNAV_AF2({{118,10}});
const double CNAV_AF2_LSB = TWO_N35;
const std::vector<std::pair<int,int> > CNAV_TGD({{128,13}});
const double CNAV_TGD_LSB = TWO_N35;
const std::vector<std::pair<int,int> > CNAV_ISCL1({{141,13}});
const double CNAV_ISCL1_LSB = TWO_N35;
const std::vector<std::pair<int,int> > CNAV_ISCL2({{154,13}});
const double CNAV_ISCL2_LSB = TWO_N35;
const std::vector<std::pair<int,int> > CNAV_ISCL5I({{167,13}});
const double CNAV_ISCL5I_LSB = TWO_N35;
const std::vector<std::pair<int,int> > CNAV_ISCL5Q({{180,13}});
const double CNAV_ISCL5Q_LSB = TWO_N35;
//Ionospheric parameters
const std::vector<std::pair<int,int> > CNAV_ALPHA0({{193,8}});
const double CNAV_ALPHA0_LSB = TWO_N30;
const std::vector<std::pair<int,int> > CNAV_ALPHA1({{201,8}});
const double CNAV_ALPHA1_LSB = TWO_N27;
const std::vector<std::pair<int,int> > CNAV_ALPHA2({{209,8}});
const double CNAV_ALPHA2_LSB = TWO_N24;
const std::vector<std::pair<int,int> > CNAV_ALPHA3({{217,8}});
const double CNAV_ALPHA3_LSB = TWO_N24;
const std::vector<std::pair<int,int> > CNAV_BETA0({{225,8}});
const double CNAV_BETA0_LSB = TWO_P11;
const std::vector<std::pair<int,int> > CNAV_BETA1({{233,8}});
const double CNAV_BETA1_LSB = TWO_P14;
const std::vector<std::pair<int,int> > CNAV_BETA2({{241,8}});
const double CNAV_BETA2_LSB = TWO_P16;
const std::vector<std::pair<int,int> > CNAV_BETA3({{249,8}});
const double CNAV_BETA3_LSB = TWO_P16;
const std::vector<std::pair<int,int> > CNAV_WNOP({{257,8}});
// MESSAGE TYPE 33 (CLOCK and UTC)
const std::vector<std::pair<int,int> > CNAV_A0({{128,16}});
const double CNAV_A0_LSB = TWO_N35;
const std::vector<std::pair<int,int> > CNAV_A1({{144,13}});
const double CNAV_A1_LSB = TWO_N51;
const std::vector<std::pair<int,int> > CNAV_A2({{157,7}});
const double CNAV_A2_LSB = TWO_N68;
const std::vector<std::pair<int,int> > CNAV_DELTA_TLS({{164,8}});
const double CNAV_DELTA_TLS_LSB = 1;
const std::vector<std::pair<int,int> > CNAV_TOT({{172,16}});
const double CNAV_TOT_LSB = TWO_P4;
const std::vector<std::pair<int,int> > CNAV_WN_OT({{188,13}});
const double CNAV_WN_OT_LSB = 1;
const std::vector<std::pair<int,int> > CNAV_WN_LSF({{201,13}});
const double CNAV_WN_LSF_LSB = 1;
const std::vector<std::pair<int,int> > CNAV_DN({{214,4}});
const double CNAV_DN_LSB = 1;
const std::vector<std::pair<int,int> > CNAV_DELTA_TLSF({{218,8}});
const double CNAV_DELTA_TLSF_LSB = 1;
// TODO: Add more frames (Almanac, etc...)
#endif /* GNSS_SDR_GPS_CNAV_H_ */

View File

@ -37,6 +37,7 @@
#include <utility> // std::pair
#include "MATH_CONSTANTS.h"
#include "gnss_frequencies.h"
#include "GPS_CNAV.h"
// Physical constants
const double GPS_L2_C_m_s = 299792458.0; //!< The speed of light, [m/s]
@ -92,152 +93,10 @@ const int32_t GPS_L2C_M_INIT_REG[115] =
0706202440, 0705056276, 0020373522, 0746013617,
0132720621, 0434015513, 0566721727, 0140633660};
// CNAV GPS NAVIGATION MESSAGE STRUCTURE
// NAVIGATION MESSAGE FIELDS POSITIONS (from IS-GPS-200E Appendix III)
#define GPS_CNAV_PREAMBLE {1, 0, 0, 0, 1, 0, 1, 1}
#define GPS_CNAV_PREAMBLE_STR "10001011"
#define GPS_CNAV_INV_PREAMBLE_STR "01110100"
const int GPS_L2_CNAV_DATA_PAGE_BITS = 300; //!< GPS L2 CNAV page length, including preamble and CRC [bits]
const int GPS_L2_SYMBOLS_PER_BIT = 2;
const int GPS_L2_SAMPLES_PER_SYMBOL = 1;
const int GPS_L2_CNAV_DATA_PAGE_SYMBOLS = 600;
const int GPS_L2_CNAV_DATA_PAGE_DURATION_S = 12;
// common to all messages
const std::vector<std::pair<int,int> > CNAV_PRN( { {9,6} } );
const std::vector<std::pair<int,int> > CNAV_MSG_TYPE( { {15,6} } );
const std::vector<std::pair<int,int> > CNAV_TOW( { {21,17} } ); //GPS Time Of Week in seconds
const double CNAV_TOW_LSB = 6.0;
const std::vector<std::pair<int,int> > CNAV_ALERT_FLAG( { {38,1} } );
// MESSAGE TYPE 10 (Ephemeris 1)
const std::vector<std::pair<int,int> > CNAV_WN({{39,13}});
const std::vector<std::pair<int,int> > CNAV_HEALTH({{52,3}});
const std::vector<std::pair<int,int> > CNAV_TOP1({{55,11}});
const double CNAV_TOP1_LSB = 300.0;
const std::vector<std::pair<int,int> > CNAV_URA({{66,5}});
const std::vector<std::pair<int,int> > CNAV_TOE1({{71,11}});
const double CNAV_TOE1_LSB = 300.0;
const std::vector<std::pair<int,int> > CNAV_DELTA_A({{82,26}}); //Relative to AREF = 26,559,710 meters
const double CNAV_DELTA_A_LSB = TWO_N9;
const std::vector<std::pair<int,int> > CNAV_A_DOT({{108,25}});
const double CNAV_A_DOT_LSB = TWO_N21;
const std::vector<std::pair<int,int> > CNAV_DELTA_N0({{133,17}});
const double CNAV_DELTA_N0_LSB = TWO_N44*GPS_L2_PI; //semi-circles to radians
const std::vector<std::pair<int,int> > CNAV_DELTA_N0_DOT({{150,23}});
const double CNAV_DELTA_N0_DOT_LSB = TWO_N57*GPS_L2_PI;//semi-circles to radians
const std::vector<std::pair<int,int> > CNAV_M0({{173,33}});
const double CNAV_M0_LSB = TWO_N32*GPS_L2_PI;//semi-circles to radians
const std::vector<std::pair<int,int> > CNAV_E_ECCENTRICITY({{206,33}});
const double CNAV_E_ECCENTRICITY_LSB = TWO_N34;
const std::vector<std::pair<int,int> > CNAV_OMEGA({{239,33}});
const double CNAV_OMEGA_LSB = TWO_N32*GPS_L2_PI;//semi-circles to radians
const std::vector<std::pair<int,int> > CNAV_INTEGRITY_FLAG({{272,1}});
const std::vector<std::pair<int,int> > CNAV_L2_PHASING_FLAG({{273,1}});
// MESSAGE TYPE 11 (Ephemeris 2)
const std::vector<std::pair<int,int> > CNAV_TOE2({{39,11}});
const double CNAV_TOE2_LSB = 300.0;
const std::vector<std::pair<int,int> > CNAV_OMEGA0({{50,33}});
const double CNAV_OMEGA0_LSB = TWO_N32*GPS_L2_PI;//semi-circles to radians
const std::vector<std::pair<int,int> > CNAV_I0({{83,33}});
const double CNAV_I0_LSB = TWO_N32*GPS_L2_PI;//semi-circles to radians
const std::vector<std::pair<int,int> > CNAV_DELTA_OMEGA_DOT({{116,17}}); //Relative to REF = -2.6 x 10-9 semi-circles/second.
const double CNAV_DELTA_OMEGA_DOT_LSB = TWO_N44*GPS_L2_PI;//semi-circles to radians
const std::vector<std::pair<int,int> > CNAV_I0_DOT({{133,15}});
const double CNAV_I0_DOT_LSB = TWO_N44*GPS_L2_PI;//semi-circles to radians
const std::vector<std::pair<int,int> > CNAV_CIS({{148,16}});
const double CNAV_CIS_LSB = TWO_N30;
const std::vector<std::pair<int,int> > CNAV_CIC({{164,16}});
const double CNAV_CIC_LSB = TWO_N30;
const std::vector<std::pair<int,int> > CNAV_CRS({{180,24}});
const double CNAV_CRS_LSB = TWO_N8;
const std::vector<std::pair<int,int> > CNAV_CRC({{204,24}});
const double CNAV_CRC_LSB = TWO_N8;
const std::vector<std::pair<int,int> > CNAV_CUS({{228,21}});
const double CNAV_CUS_LSB = TWO_N30;
const std::vector<std::pair<int,int> > CNAV_CUC({{249,21}});
const double CNAV_CUC_LSB = TWO_N30;
// MESSAGE TYPE 30 (CLOCK, IONO, GRUP DELAY)
const std::vector<std::pair<int,int> > CNAV_TOP2({{39,11}});
const double CNAV_TOP2_LSB = 300.0;
const std::vector<std::pair<int,int> > CNAV_URA_NED0({{50,5}});
const std::vector<std::pair<int,int> > CNAV_URA_NED1({{55,3}});
const std::vector<std::pair<int,int> > CNAV_URA_NED2({{58,3}});
const std::vector<std::pair<int,int> > CNAV_TOC({{61,11}});
const double CNAV_TOC_LSB = 300.0;
const std::vector<std::pair<int,int> > CNAV_AF0({{72,26}});
const double CNAV_AF0_LSB = TWO_N60;
const std::vector<std::pair<int,int> > CNAV_AF1({{98,20}});
const double CNAV_AF1_LSB = TWO_N48;
const std::vector<std::pair<int,int> > CNAV_AF2({{118,10}});
const double CNAV_AF2_LSB = TWO_N35;
const std::vector<std::pair<int,int> > CNAV_TGD({{128,13}});
const double CNAV_TGD_LSB = TWO_N35;
const std::vector<std::pair<int,int> > CNAV_ISCL1({{141,13}});
const double CNAV_ISCL1_LSB = TWO_N35;
const std::vector<std::pair<int,int> > CNAV_ISCL2({{154,13}});
const double CNAV_ISCL2_LSB = TWO_N35;
const std::vector<std::pair<int,int> > CNAV_ISCL5I({{167,13}});
const double CNAV_ISCL5I_LSB = TWO_N35;
const std::vector<std::pair<int,int> > CNAV_ISCL5Q({{180,13}});
const double CNAV_ISCL5Q_LSB = TWO_N35;
//Ionospheric parameters
const std::vector<std::pair<int,int> > CNAV_ALPHA0({{193,8}});
const double CNAV_ALPHA0_LSB = TWO_N30;
const std::vector<std::pair<int,int> > CNAV_ALPHA1({{201,8}});
const double CNAV_ALPHA1_LSB = TWO_N27;
const std::vector<std::pair<int,int> > CNAV_ALPHA2({{209,8}});
const double CNAV_ALPHA2_LSB = TWO_N24;
const std::vector<std::pair<int,int> > CNAV_ALPHA3({{217,8}});
const double CNAV_ALPHA3_LSB = TWO_N24;
const std::vector<std::pair<int,int> > CNAV_BETA0({{225,8}});
const double CNAV_BETA0_LSB = TWO_P11;
const std::vector<std::pair<int,int> > CNAV_BETA1({{233,8}});
const double CNAV_BETA1_LSB = TWO_P14;
const std::vector<std::pair<int,int> > CNAV_BETA2({{241,8}});
const double CNAV_BETA2_LSB = TWO_P16;
const std::vector<std::pair<int,int> > CNAV_BETA3({{249,8}});
const double CNAV_BETA3_LSB = TWO_P16;
const std::vector<std::pair<int,int> > CNAV_WNOP({{257,8}});
// MESSAGE TYPE 33 (CLOCK and UTC)
const std::vector<std::pair<int,int> > CNAV_A0({{128,16}});
const double CNAV_A0_LSB = TWO_N35;
const std::vector<std::pair<int,int> > CNAV_A1({{144,13}});
const double CNAV_A1_LSB = TWO_N51;
const std::vector<std::pair<int,int> > CNAV_A2({{157,7}});
const double CNAV_A2_LSB = TWO_N68;
const std::vector<std::pair<int,int> > CNAV_DELTA_TLS({{164,8}});
const double CNAV_DELTA_TLS_LSB = 1;
const std::vector<std::pair<int,int> > CNAV_TOT({{172,16}});
const double CNAV_TOT_LSB = TWO_P4;
const std::vector<std::pair<int,int> > CNAV_WN_OT({{188,13}});
const double CNAV_WN_OT_LSB = 1;
const std::vector<std::pair<int,int> > CNAV_WN_LSF({{201,13}});
const double CNAV_WN_LSF_LSB = 1;
const std::vector<std::pair<int,int> > CNAV_DN({{214,4}});
const double CNAV_DN_LSB = 1;
const std::vector<std::pair<int,int> > CNAV_DELTA_TLSF({{218,8}});
const double CNAV_DELTA_TLSF_LSB = 1;
// TODO: Add more frames (Almanac, etc...)
#endif /* GNSS_SDR_GPS_L2C_H_ */

View File

@ -35,7 +35,7 @@
#include <cstdint>
#include "MATH_CONSTANTS.h"
#include "gnss_frequencies.h"
#include "GPS_L2C.h" // CNAV GPS NAVIGATION MESSAGE STRUCTURE
#include "GPS_CNAV.h"
// Physical constants
const double GPS_L5_C_m_s = 299792458.0; //!< The speed of light, [m/s]
@ -179,6 +179,7 @@ const int GPS_L5_SYMBOLS_PER_BIT = 2;
const int GPS_L5_SAMPLES_PER_SYMBOL = 10;
const int GPS_L5_CNAV_DATA_PAGE_SYMBOLS = 600;
const int GPS_L5_CNAV_DATA_PAGE_DURATION_S = 6;
const int GPS_L5_NH_CODE_LENGTH = 10;
const int GPS_L5_NH_CODE[10] = {0, 0, 0, 0, 1, 1, 0, 1, 0, 1};
#endif /* GNSS_SDR_GPS_L5_H_ */

View File

@ -42,6 +42,7 @@
*/
const double PI = 3.1415926535897932; //!< pi
const double PI_2 = 2.0 * PI; //!< 2 * pi
const double TWO_P4 = (16); //!< 2^4
const double TWO_P11 = (2048); //!< 2^11

View File

@ -32,7 +32,6 @@
#include "gps_cnav_ephemeris.h"
#include <cmath>
#include "GPS_L2C.h"
#include <iostream>
Gps_CNAV_Ephemeris::Gps_CNAV_Ephemeris()
@ -168,7 +167,7 @@ double Gps_CNAV_Ephemeris::sv_clock_relativistic_term(double transmitTime)
{
E_old = E;
E = M + d_e_eccentricity * sin(E);
dE = fmod(E - E_old, 2.0 * GPS_L2_PI);
dE = fmod(E - E_old, 2.0 * PI);
if (fabs(dE) < 1e-12)
{
//Necessary precision is reached, exit from the loop
@ -239,7 +238,7 @@ double Gps_CNAV_Ephemeris::satellitePosition(double transmitTime)
{
E_old = E;
E = M + d_e_eccentricity * sin(E);
dE = fmod(E - E_old, 2 * GPS_L2_PI);
dE = fmod(E - E_old, 2 * PI);
if (fabs(dE) < 1e-12)
{
//Necessary precision is reached, exit from the loop
@ -268,7 +267,7 @@ double Gps_CNAV_Ephemeris::satellitePosition(double transmitTime)
i = d_i_0 + d_IDOT * tk + d_Cic * cos(2*phi) + d_Cis * sin(2*phi);
// Compute the angle between the ascending node and the Greenwich meridian
double d_OMEGA_DOT = OMEGA_DOT_REF*GPS_L2_PI + d_DELTA_OMEGA_DOT;
double d_OMEGA_DOT = OMEGA_DOT_REF*PI + d_DELTA_OMEGA_DOT;
Omega = d_OMEGA0 + (d_OMEGA_DOT - OMEGA_EARTH_DOT)*tk - OMEGA_EARTH_DOT * d_Toe1;
// Reduce to between 0 and 2*pi rad
@ -291,7 +290,7 @@ double Gps_CNAV_Ephemeris::satellitePosition(double transmitTime)
double dtr_s = d_A_f0 + d_A_f1 * tk + d_A_f2 * tk * tk;
/* relativity correction */
dtr_s -= 2.0 * sqrt(GM * a) * d_e_eccentricity * sin(E) / (GPS_L2_C_m_s * GPS_L2_C_m_s);
dtr_s -= 2.0 * sqrt(GM * a) * d_e_eccentricity * sin(E) / (SPEED_OF_LIGHT * SPEED_OF_LIGHT);
return dtr_s;
}

View File

@ -32,7 +32,7 @@
#ifndef GNSS_SDR_GPS_CNAV_EPHEMERIS_H_
#define GNSS_SDR_GPS_CNAV_EPHEMERIS_H_
#include "GPS_L2C.h"
#include "GPS_CNAV.h"
#include "boost/assign.hpp"
#include <boost/serialization/nvp.hpp>

View File

@ -73,11 +73,11 @@ Gps_CNAV_Navigation_Message::Gps_CNAV_Navigation_Message()
bool Gps_CNAV_Navigation_Message::read_navigation_bool(std::bitset<GPS_L2_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int,int>> parameter)
bool Gps_CNAV_Navigation_Message::read_navigation_bool(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int,int>> parameter)
{
bool value;
if (bits[GPS_L2_CNAV_DATA_PAGE_BITS - parameter[0].first] == 1)
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[0].first] == 1)
{
value = true;
}
@ -89,7 +89,7 @@ bool Gps_CNAV_Navigation_Message::read_navigation_bool(std::bitset<GPS_L2_CNAV_D
}
unsigned long int Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_L2_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int,int>> parameter)
unsigned long int Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int,int>> parameter)
{
unsigned long int value = 0;
int num_of_slices = parameter.size();
@ -98,7 +98,7 @@ unsigned long int Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bit
for (int j = 0; j < parameter[i].second; j++)
{
value <<= 1; //shift left
if (bits[GPS_L2_CNAV_DATA_PAGE_BITS - parameter[i].first - j] == 1)
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[i].first - j] == 1)
{
value += 1; // insert the bit
}
@ -108,7 +108,7 @@ unsigned long int Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bit
}
signed long int Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset<GPS_L2_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int,int>> parameter)
signed long int Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int,int>> parameter)
{
signed long int value = 0;
int num_of_slices = parameter.size();
@ -117,7 +117,7 @@ signed long int Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset<
if (long_int_size_bytes == 8) // if a long int takes 8 bytes, we are in a 64 bits system
{
// read the MSB and perform the sign extension
if (bits[GPS_L2_CNAV_DATA_PAGE_BITS - parameter[0].first] == 1)
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[0].first] == 1)
{
value ^= 0xFFFFFFFFFFFFFFFF; //64 bits variable
}
@ -132,7 +132,7 @@ signed long int Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset<
{
value <<= 1; //shift left
value &= 0xFFFFFFFFFFFFFFFE; //reset the corresponding bit (for the 64 bits variable)
if (bits[GPS_L2_CNAV_DATA_PAGE_BITS - parameter[i].first - j] == 1)
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[i].first - j] == 1)
{
value += 1; // insert the bit
}
@ -142,7 +142,7 @@ signed long int Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset<
else // we assume we are in a 32 bits system
{
// read the MSB and perform the sign extension
if (bits[GPS_L2_CNAV_DATA_PAGE_BITS - parameter[0].first] == 1)
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[0].first] == 1)
{
value ^= 0xFFFFFFFF;
}
@ -157,7 +157,7 @@ signed long int Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset<
{
value <<= 1; //shift left
value &= 0xFFFFFFFE; //reset the corresponding bit
if (bits[GPS_L2_CNAV_DATA_PAGE_BITS - parameter[i].first - j] == 1)
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[i].first - j] == 1)
{
value += 1; // insert the bit
}
@ -168,7 +168,7 @@ signed long int Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset<
}
void Gps_CNAV_Navigation_Message::decode_page(std::bitset<GPS_L2_CNAV_DATA_PAGE_BITS> data_bits)
void Gps_CNAV_Navigation_Message::decode_page(std::bitset<GPS_CNAV_DATA_PAGE_BITS> data_bits)
{
int PRN;
int page_type;

View File

@ -38,8 +38,7 @@
#include <string>
#include <vector>
#include <utility>
#include "GPS_L2C.h"
#include "GPS_L5.h"
#include "GPS_CNAV.h"
#include "gps_cnav_ephemeris.h"
#include "gps_cnav_iono.h"
#include "gps_cnav_utc_model.h"
@ -56,9 +55,9 @@
class Gps_CNAV_Navigation_Message
{
private:
unsigned long int read_navigation_unsigned(std::bitset<GPS_L2_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int,int>> parameter);
signed long int read_navigation_signed(std::bitset<GPS_L2_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int,int>> parameter);
bool read_navigation_bool(std::bitset<GPS_L2_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int,int>> parameter);
unsigned long int read_navigation_unsigned(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int,int>> parameter);
signed long int read_navigation_signed(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int,int>> parameter);
bool read_navigation_bool(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int,int>> parameter);
Gps_CNAV_Ephemeris ephemeris_record;
Gps_CNAV_Iono iono_record;
@ -90,7 +89,7 @@ public:
// public functions
void reset();
void decode_page(std::bitset<GPS_L2_CNAV_DATA_PAGE_BITS> data_bits);
void decode_page(std::bitset<GPS_CNAV_DATA_PAGE_BITS> data_bits);
/*!
* \brief Obtain a GPS SV Ephemeris class filled with current SV data
*/

View File

@ -41,6 +41,7 @@
#include <boost/dynamic_bitset.hpp>
#include <glog/logging.h>
#include "Galileo_E1.h"
#include "GPS_L2C.h"
using google::LogMessage;