1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-13 19:50:34 +00:00

Merge branch 'dmiralles2009-glonass_dec' into glonass

This commit is contained in:
Carles Fernandez 2017-11-03 16:31:23 +01:00
commit 9bc6601ebd
18 changed files with 180 additions and 234 deletions

View File

@ -49,7 +49,7 @@ option(ENABLE_FLEXIBAND "Enable the use of the signal source adater for the Tele
option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal source (experimental)" OFF)
option(ENABLE_GN3S "Enable the use of the GN3S dongle as signal source (experimental)" OFF)
option(ENABLE_PLUTOSDR "Enable the use of ADALM-PLUTO Evaluation Boards (Analog Devices Inc.), requires gr-iio" OFF)
option(ENABLE_FMCOMMS2 "Enable the use of FMCOMMS4-EBZ + ZedBoard hardware" OFF)
option(ENABLE_FMCOMMS2 "Enable the use of FMCOMMS4-EBZ + ZedBoard hardware, requires gr-iio" OFF)
# Performance analysis tools
option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF)

View File

@ -373,51 +373,38 @@ $ sudo make install
Install the [libiio](https://github.com/analogdevicesinc/libiio.git) (>=v0.11), [libad9361](https://github.com/analogdevicesinc/libad9361-iio.git) (>=v0.1-1) libraries and [gr-iio](https://github.com/analogdevicesinc/gr-iio.git) (>=v0.2) gnuradio block. For example in Ubuntu 16.04 follow these instructions (based on https://github.com/blurbdust/blurbdust.github.io):
~~~~~~
$ sudo apt-get install libxml2-dev bison flex
$ git clone https://github.com/analogdevicesinc/libiio.git
$ cd libiio
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install
$ sudo ldconfig
$ make && sudo make install && sudo ldconfig
$ cd ../..
$ git clone https://github.com/analogdevicesinc/libad9361-iio.git
$ cd libad9361-iio
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install
$ sudo ldconfig
$ make && sudo make install && sudo ldconfig
$ cd ../..
$ git clone https://github.com/analogdevicesinc/gr-iio.git
$ cd gr-iio
$ mv include/gnuradio/iio include/iio
$ rm -r include/gnuradio
$ sed -i 's/gnuradio\/iio/iio/g' CMakeLists.txt
$ sed -i 's/gnuradio\/iio/iio/g' swig/*
$ sed -i 's/gnuradio\/iio/iio/g' include/iio/*
$ sed -i 's/gnuradio\/iio/iio/g' lib/*
$ sed -i 's/gnuradio\/iio/iio/g' python/iio/*
$ sed -i 's/from\ gnuradio\ import\ iio/import\ iio/g' grc/iio_pluto_sink.xml
$ sed -i 's/from\ gnuradio\ import\ iio/import\ iio/g' grc/iio_pluto_source.xml
$ sed -i 's/from\ gnuradio\ import\ iio/import\ iio/g' grc/iio_fmcomms2_sink.xml
$ sed -i 's/from\ gnuradio\ import\ iio/import\ iio/g' grc/iio_fmcomms2_source.xml
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install
$ sudo ldconfig
$ cmake -DCMAKE_INSTALL_PREFIX=/usr ..
$ make && sudo make install && sudo ldconfig
$ cd ../..
~~~~~~
Then configure the gnss-sdr to build the `Fmcomms2_Signal_Source` and `Plutosdr_Signal_Source`:
Then configure the gnss-sdr to build the `Fmcomms2_Signal_Source` implementation:
~~~~~~
$ cmake -DENABLE_FMCOMMS2=ON ../
$ make
$ sudo make install
~~~~~~
or configure only `Plutosdr_Signal_Source`:
or configure it to build `Plutosdr_Signal_Source`:
~~~~~~
$ cmake -DENABLE_PLUTOSDR=ON ../
$ make

View File

@ -0,0 +1,29 @@
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_IIO gnuradio-iio)
FIND_PATH(
IIO_INCLUDE_DIRS
NAMES gnuradio/iio/api.h
HINTS $ENV{IIO_DIR}/include
${PC_IIO_INCLUDEDIR}
PATHS ${CMAKE_INSTALL_PREFIX}/include
/usr/local/include
/usr/include
)
FIND_LIBRARY(
IIO_LIBRARIES
NAMES gnuradio-iio
HINTS $ENV{IIO_DIR}/lib
${PC_IIO_LIBDIR}
PATHS ${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib64
/usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(IIO DEFAULT_MSG IIO_LIBRARIES IIO_INCLUDE_DIRS)
MARK_AS_ADVANCED(IIO_LIBRARIES IIO_INCLUDE_DIRS)

View File

@ -67,7 +67,7 @@ Observables.dump_filename=/archive/glo_observables.dat
;######### PVT CONFIG ############
PVT.implementation=RTKLIB_PVT
PVT.positioning_mode=PPP_Static
PVT.positioning_mode=Single
PVT.output_rate_ms=100
PVT.display_rate_ms=500
PVT.trop_model=Saastamoinen

View File

@ -182,11 +182,18 @@ Rinex_Printer::Rinex_Printer(int conf_version)
}
if(conf_version != 0)
{
if(conf_version == 2)
version = 2;
stringVersion = "2.11";
}
{
if(conf_version == 2)
{
version = 2;
stringVersion = "2.11";
}
if(conf_version == 3)
{
version = 3;
stringVersion = "3.02";
}
}
numberTypesObservations = 4; // Number of available types of observable in the system
fake_cnav_iode = 1;

View File

@ -91,7 +91,7 @@ geph_t eph_to_rtklib(const Glonass_Gnav_Ephemeris & glonass_gnav_eph, const Glon
rtklib_sat.age = static_cast<int>(glonass_gnav_eph.d_Delta_tau_n); /* delay between L1 and L2 (s) */
// Time expressed in GPS Time but using RTKLib format
glonass_gnav_eph.glot_to_gpst(glonass_gnav_eph.d_tod, gnav_clock_model.d_tau_c, gnav_clock_model.d_tau_gps, &week, &sec);
glonass_gnav_eph.glot_to_gpst(glonass_gnav_eph.d_t_b, gnav_clock_model.d_tau_c, gnav_clock_model.d_tau_gps, &week, &sec);
adj_week = adjgpsweek(static_cast<int>(week));
rtklib_sat.toe = gpst2time(adj_week, sec);

View File

@ -371,7 +371,7 @@ void decodefile(rtksvr_t *svr, int index)
nav_t nav = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
{0, 0, (erpd_t *){0}}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0},
{0.0}, {0.0}, {0.0}, {0.0}, 0, {{0.0},{0.0}}, {{0.0},{0.0}}, {{0.0},{0.0},{0.0}},
{0.0}, {0.0}, {0.0}, {0.0}, 0, {{0.0},{0.0}}, {{0.0},{0.0}}, {{0.0}, {0.0}, {0.0}},
{0.0}, {0.0}, {*glo_fcn}, {*pcvt0}, sbssat0, {*sbsion0}, {*dgps0}, {*ssr0}, {*lexeph0},
{{0,0.0}, 0.0, {0.0}, {{0.0},{0.0}} }, pppcorr0} ;

View File

@ -179,12 +179,11 @@ int hybrid_observables_cc::general_work (int noutput_items __attribute__((unused
{
channel_history_ok = false;
}
}
if (channel_history_ok == true)
{
std::map<int,Gnss_Synchro>::iterator gnss_synchro_map_iter;
std::deque<Gnss_Synchro>::iterator gnss_synchro_deque_iter;
std::map<int,Gnss_Synchro>::const_iterator gnss_synchro_map_iter;
std::deque<Gnss_Synchro>::const_iterator gnss_synchro_deque_iter;
// 1. If the RX time is not set, set the Rx time
if (T_rx_s == 0)
@ -196,8 +195,8 @@ int hybrid_observables_cc::general_work (int noutput_items __attribute__((unused
gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(d_gnss_synchro_history_queue[i].front().Channel_ID,
d_gnss_synchro_history_queue[i].front()));
}
gnss_synchro_map_iter = min_element(gnss_synchro_map.begin(),
gnss_synchro_map.end(),
gnss_synchro_map_iter = min_element(gnss_synchro_map.cbegin(),
gnss_synchro_map.cend(),
Hybrid_pairCompare_gnss_synchro_sample_counter);
T_rx_s = static_cast<double>(gnss_synchro_map_iter->second.Tracking_sample_counter) / static_cast<double>(gnss_synchro_map_iter->second.fs);
T_rx_s = floor(T_rx_s * 1000.0) / 1000.0; // truncate to ms
@ -210,11 +209,11 @@ int hybrid_observables_cc::general_work (int noutput_items __attribute__((unused
// shift channels history to match the reference TOW
for (unsigned int i = 0; i < d_nchannels; i++)
{
gnss_synchro_deque_iter = std::lower_bound(d_gnss_synchro_history_queue[i].begin(),
d_gnss_synchro_history_queue[i].end(),
gnss_synchro_deque_iter = std::lower_bound(d_gnss_synchro_history_queue[i].cbegin(),
d_gnss_synchro_history_queue[i].cend(),
T_rx_s,
Hybrid_valueCompare_gnss_synchro_receiver_time);
if (gnss_synchro_deque_iter != d_gnss_synchro_history_queue[i].end())
if (gnss_synchro_deque_iter != d_gnss_synchro_history_queue[i].cend())
{
if (gnss_synchro_deque_iter->Flag_valid_word == true)
{
@ -226,10 +225,10 @@ int hybrid_observables_cc::general_work (int noutput_items __attribute__((unused
{
// record the word structure in a map for pseudorange computation
// save the previous observable
int distance = std::distance(d_gnss_synchro_history_queue[i].begin(), gnss_synchro_deque_iter);
int distance = std::distance(d_gnss_synchro_history_queue[i].cbegin(), gnss_synchro_deque_iter);
if (distance > 0)
{
if (d_gnss_synchro_history_queue[i].at(distance-1).Flag_valid_word)
if (d_gnss_synchro_history_queue[i].at(distance - 1).Flag_valid_word)
{
double T_rx_channel_prev = static_cast<double>(d_gnss_synchro_history_queue[i].at(distance - 1).Tracking_sample_counter) / static_cast<double>(gnss_synchro_deque_iter->fs);
double delta_T_rx_s_prev = T_rx_channel_prev - T_rx_s;
@ -268,8 +267,8 @@ int hybrid_observables_cc::general_work (int noutput_items __attribute__((unused
* common RX time algorithm
*/
// what is the most recent symbol TOW in the current set? -> this will be the reference symbol
gnss_synchro_map_iter = max_element(realigned_gnss_synchro_map.begin(),
realigned_gnss_synchro_map.end(),
gnss_synchro_map_iter = max_element(realigned_gnss_synchro_map.cbegin(),
realigned_gnss_synchro_map.cend(),
Hybrid_pairCompare_gnss_synchro_d_TOW);
double ref_fs_hz = static_cast<double>(gnss_synchro_map_iter->second.fs);
@ -292,7 +291,7 @@ int hybrid_observables_cc::general_work (int noutput_items __attribute__((unused
double channel_T_rx_s;
double channel_fs_hz;
double channel_TOW_s;
for(gnss_synchro_map_iter = realigned_gnss_synchro_map.begin(); gnss_synchro_map_iter != realigned_gnss_synchro_map.end(); gnss_synchro_map_iter++)
for(gnss_synchro_map_iter = realigned_gnss_synchro_map.cbegin(); gnss_synchro_map_iter != realigned_gnss_synchro_map.cend(); gnss_synchro_map_iter++)
{
channel_fs_hz = static_cast<double>(gnss_synchro_map_iter->second.fs);
channel_TOW_s = gnss_synchro_map_iter->second.TOW_at_current_symbol_s;

View File

@ -21,36 +21,41 @@ list(SORT SIGNAL_SOURCE_ADAPTER_HEADERS)
# Optional drivers
if(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2)
find_package(iio REQUIRED)
if(NOT IIO_FOUND)
message(STATUS "gnuradio-iio not found, its installation is required.")
message(STATUS "Please build and install the following projects:")
message(STATUS " * libiio from https://github.com/analogdevicesinc/libiio")
message(STATUS " * libad9361-iio from https://github.com/analogdevicesinc/libad9361-iio")
message(STATUS " * gnuradio-iio from https://github.com/analogdevicesinc/gr-iio")
message(FATAL_ERROR "gnuradio-iio required for building gnss-sdr with this option enabled")
endif(NOT IIO_FOUND)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${IIO_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS})
endif(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2)
if(ENABLE_PLUTOSDR)
##############################################
# ADALM-PLUTO (Analog Devices Inc.)
##############################################
find_package(iio REQUIRED)
if(NOT IIO_FOUND)
message("gnuradio-iio not found, installation is required")
message(FATAL_ERROR "gnuradio-iio required for building gnss-sdr with this option enabled")
else(NOT IIO_FOUND)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${IIO_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS})
if(IIO_FOUND)
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} plutosdr_signal_source.cc)
endif(NOT IIO_FOUND)
endif(IIO_FOUND)
endif(ENABLE_PLUTOSDR)
if(ENABLE_FMCOMMS2)
###############################################
# FMCOMMS2 based SDR Hardware
###############################################
find_package(iio REQUIRED)
if(NOT IIO_FOUND)
message("gnuradio-iio not found, installation is required")
message(FATAL_ERROR "gnuradio-iio required for building gnss-sdr with this option enabled")
else(NOT IIO_FOUND)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${IIO_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS})
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} fmcomms2_signal_source.cc plutosdr_signal_source.cc)
endif(NOT IIO_FOUND)
if(IIO_FOUND)
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} fmcomms2_signal_source.cc)
endif(IIO_FOUND)
endif(ENABLE_FMCOMMS2)
if(ENABLE_GN3S)
##############################################
# GN3S (USB dongle)
@ -134,7 +139,7 @@ set(SIGNAL_SOURCE_ADAPTER_SOURCES file_signal_source.cc
gen_signal_source.cc
nsr_file_signal_source.cc
spir_file_signal_source.cc
rtl_tcp_signal_source.cc
rtl_tcp_signal_source.cc
${OPT_DRIVER_SOURCES}
)

View File

@ -78,7 +78,7 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
std::cout << "LO frequency : " << freq_ << "Hz" << std::endl;
std::cout << "sample rate: " << sample_rate_ << "Hz" << std::endl;
if(item_type_.compare("gr_complex")==0)
if(item_type_.compare("gr_complex") == 0)
{
fmcomms2_source_f32c_ = gr::iio::fmcomms2_source_f32c::make(
uri_.c_str(), freq_, sample_rate_,
@ -92,7 +92,7 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
}
else
{
LOG(FATAL) << "Exception: item type " << item_type_ << " not suported!";
LOG(FATAL) << "Exception: item type " << item_type_ << " not supported!";
}
if (samples_ != 0)

View File

@ -1,6 +1,6 @@
/*!
* \file fmcomms2_signal_source.h
* \brief Interface to use SDR hardware based in FMCOMMS2 driver from analog
* \brief Interface to use SDR hardware based in FMCOMMS2 driver from analog
* devices, for example FMCOMMS4 and ADALM-PLUTO (PlutoSdr)
* \author Rodrigo Muñoz, 2017. rmunozl(at)inacap.cl
*
@ -37,7 +37,7 @@
#include <boost/shared_ptr.hpp>
#include <gnuradio/msg_queue.h>
#include <gnuradio/blocks/file_sink.h>
#include <iio/fmcomms2_source.h>
#include <gnuradio/iio/fmcomms2_source.h>
#include "gnss_block_interface.h"
class ConfigurationInterface;

View File

@ -51,7 +51,7 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration
std::string default_dump_file = "./data/signal_source.dat";
uri_ = configuration->property(role + ".device_address", std::string("192.168.2.1"));
freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ);
sample_rate_ configuration->property(role + ".sampling_frequency", 3000000);
sample_rate_ = configuration->property(role + ".sampling_frequency", 3000000);
bandwidth_ = configuration->property(role + ".bandwidth", 2000000);
buffer_size_ = configuration->property(role + ".buffer_size", 0xA0000);
decimation_ = configuration->property(role + ".decimation", 1);

View File

@ -36,7 +36,7 @@
#include <boost/shared_ptr.hpp>
#include <gnuradio/msg_queue.h>
#include <gnuradio/blocks/file_sink.h>
#include <iio/pluto_source.h>
#include <gnuradio/iio/pluto_source.h>
#include "gnss_block_interface.h"
class ConfigurationInterface;

View File

@ -355,7 +355,7 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attrib
if (this->d_flag_preamble == true and d_nav.flag_TOW_new == true)
//update TOW at the preamble instant
{
d_TOW_at_current_symbol = floor((d_nav.gnav_ephemeris.d_TOW - GLONASS_GNAV_PREAMBLE_DURATION_S)*1000)/1000;
d_TOW_at_current_symbol = floor((d_nav.gnav_ephemeris.d_TOW-GLONASS_GNAV_PREAMBLE_DURATION_S)*1000)/1000;
d_nav.flag_TOW_new = false;
}

View File

@ -41,6 +41,58 @@ if(ENABLE_FPGA)
endif(ENABLE_FPGA)
if(Boost_VERSION LESS 105000)
add_definitions(-DOLD_BOOST=1)
endif(Boost_VERSION LESS 105000)
if(OPENSSL_FOUND)
add_definitions( -DUSE_OPENSSL_FALLBACK=1 )
endif(OPENSSL_FOUND)
if(ENABLE_GN3S)
add_definitions(-DGN3S_DRIVER=1)
endif(ENABLE_GN3S)
if(ENABLE_ARRAY)
add_definitions(-DRAW_ARRAY_DRIVER=1)
endif(ENABLE_ARRAY)
if(ENABLE_FLEXIBAND)
add_definitions(-DFLEXIBAND_DRIVER=1)
endif(ENABLE_FLEXIBAND)
if(ENABLE_OSMOSDR)
if(GROSMOSDR_FOUND)
add_definitions(-DOSMOSDR_DRIVER=1)
endif(GROSMOSDR_FOUND)
endif(ENABLE_OSMOSDR)
if(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd)
add_definitions(-DUHD_DRIVER=1)
endif(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd)
#Enable OpenCL if found in the system
if(OPENCL_FOUND)
message(STATUS "Adding processing blocks implemented using OpenCL" )
add_definitions(-DOPENCL_BLOCKS=1)
else(OPENCL_FOUND)
add_definitions(-DOPENCL_BLOCKS=0)
endif(OPENCL_FOUND)
#enable SDR Hardware based on fmcomms2
if(ENABLE_PLUTOSDR)
add_definitions(-DPLUTOSDR_DRIVER=1)
set(OPT_RECEIVER_INCLUDE_DIRS ${OPT_RECEIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS})
endif(ENABLE_PLUTOSDR)
if(ENABLE_FMCOMMS2)
add_definitions(-DFMCOMMS2_DRIVER=1)
set(OPT_RECEIVER_INCLUDE_DIRS ${OPT_RECEIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS})
endif(ENABLE_FMCOMMS2)
add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}")
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src/core/system_parameters
@ -86,56 +138,6 @@ include_directories(
${VOLK_GNSSSDR_INCLUDE_DIRS}
)
if(Boost_VERSION LESS 105000)
add_definitions(-DOLD_BOOST=1)
endif(Boost_VERSION LESS 105000)
if(OPENSSL_FOUND)
add_definitions( -DUSE_OPENSSL_FALLBACK=1 )
endif(OPENSSL_FOUND)
if(ENABLE_GN3S)
add_definitions(-DGN3S_DRIVER=1)
endif(ENABLE_GN3S)
if(ENABLE_ARRAY)
add_definitions(-DRAW_ARRAY_DRIVER=1)
endif(ENABLE_ARRAY)
if(ENABLE_FLEXIBAND)
add_definitions(-DFLEXIBAND_DRIVER=1)
endif(ENABLE_FLEXIBAND)
if(ENABLE_OSMOSDR)
if(GROSMOSDR_FOUND)
add_definitions(-DOSMOSDR_DRIVER=1)
endif(GROSMOSDR_FOUND)
endif(ENABLE_OSMOSDR)
if(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd)
add_definitions(-DUHD_DRIVER=1)
endif(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd)
#Enable OpenCL if found in the system
if(OPENCL_FOUND)
message(STATUS "Adding processing blocks implemented using OpenCL" )
add_definitions(-DOPENCL_BLOCKS=1)
else(OPENCL_FOUND)
add_definitions(-DOPENCL_BLOCKS=0)
endif(OPENCL_FOUND)
#enable SDR Hardware based on fmcomms2
if(ENABLE_PLUTOSDR)
add_definitions(-DPLUTOSDR_DRIVER=1)
endif(ENABLE_PLUTOSDR)
if(ENABLE_FMCOMMS2)
add_definitions(-DFMCOMMS2_DRIVER=1)
add_definitions(-DPLUTOSDR_DRIVER=1)
endif(ENABLE_FMCOMMS2)
add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}")
file(GLOB GNSS_RECEIVER_HEADERS "*.h")
list(SORT GNSS_RECEIVER_HEADERS)
file(GLOB GNSS_RECEIVER_INTERFACE_HEADERS "../interfaces/*.h")

View File

@ -140,6 +140,7 @@ void Glonass_Gnav_Ephemeris::glot_to_gpst(double tod_offset, double glot2utc_cor
sec_of_day = static_cast<double>((glonass_time.time_of_day()).total_seconds());
total_sec = days*86400 + sec_of_day;
// GLONASST already includes leap second addition or deletion
for (i = 0; GLONASS_LEAP_SECONDS[i][0]>0; i++)
{
if (d_yr >= GLONASS_LEAP_SECONDS[i][0])

View File

@ -315,78 +315,6 @@ unsigned int Glonass_Gnav_Navigation_Message::get_frame_number(unsigned int sate
return frame_ID;
}
double Glonass_Gnav_Navigation_Message::get_WN()
{
double WN = 0.0;
double days = 0.0;
double total_sec = 0.0;
int i = 0;
boost::gregorian::date gps_epoch { 1980, 1, 6 };
// Map to UTC
boost::gregorian::date glo_date(gnav_ephemeris.d_yr, 1, 1);
boost::gregorian::days d2(gnav_ephemeris.d_N_T-1);
glo_date = glo_date + d2;
boost::posix_time::time_duration t(-6, 0, 0);
boost::posix_time::ptime glo_time(glo_date, t);
boost::gregorian::date utc_date = glo_time.date();
days = static_cast<double>((utc_date - gps_epoch).days());
total_sec = days*86400;
for (i = 0; GLONASS_LEAP_SECONDS[i][0]>0; i++)
{
if (GLONASS_LEAP_SECONDS[i][0] == gnav_ephemeris.d_yr)
{
// We add the leap second when going from utc to gpst
total_sec += GLONASS_LEAP_SECONDS[i][6];
}
}
WN = floor(total_sec/604800);
return WN;
}
double Glonass_Gnav_Navigation_Message::get_TOW()
{
double TOD = 0.0;
double TOW = 0.0;
double dayofweek = 0.0;
double utcsu2utc = 3*3600;
double glot2utcsu = 3*3600;
int i = 0;
// tk is relative to UTC(SU) + 3.00 hrs, so we need to convert to utc and add corrections
// tk plus 10 sec is the true tod since get_TOW is called when in str5
TOD = (gnav_ephemeris.d_t_k + 10) - glot2utcsu - utcsu2utc;// + gnav_utc_model.d_tau_c + gnav_utc_model.d_tau_gps;
boost::gregorian::date glo_date(gnav_ephemeris.d_yr, 1, 1);
boost::gregorian::days d2(gnav_ephemeris.d_N_T);
glo_date = glo_date + d2;
dayofweek = static_cast<double>(glo_date.day_of_week());
TOW = TOD + dayofweek*86400;
for (i = 0; GLONASS_LEAP_SECONDS[i][0]>0; i++)
{
if (gnav_ephemeris.d_yr >= GLONASS_LEAP_SECONDS[i][0])
{
// We add the leap second when going from utc to gpst
TOW += fabs(GLONASS_LEAP_SECONDS[i][6]);
}
}
// Compute the arithmetic modules to wrap around range
TOW = TOW - 604800*floor(TOW/604800);
return TOW;
}
int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
{
@ -426,7 +354,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
{
gnav_ephemeris.d_B_n = static_cast<double>(read_navigation_unsigned(string_bits, B_N));
gnav_ephemeris.d_P_2 = static_cast<bool>(read_navigation_bool(string_bits, P2));
gnav_ephemeris.d_t_b = static_cast<double>(read_navigation_unsigned(string_bits, T_B)) * gnav_ephemeris.d_P_1 * 60;
gnav_ephemeris.d_t_b = static_cast<double>(read_navigation_unsigned(string_bits, T_B)) * 15 * 60;
gnav_ephemeris.d_VYn = static_cast<double>(read_navigation_signed(string_bits, Y_N_DOT)) * TWO_N20;
gnav_ephemeris.d_AYn = static_cast<double>(read_navigation_signed(string_bits, Y_N_DOT_DOT)) * TWO_N30;
gnav_ephemeris.d_Yn = static_cast<double>(read_navigation_signed(string_bits, Y_N)) * TWO_N11;
@ -759,15 +687,6 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
}
double Glonass_Gnav_Navigation_Message::utc_time(const double glonass_time_corrected) const
{
double t_utc;
t_utc = glonass_time_corrected + 3*3600 + gnav_utc_model.d_tau_c;
return t_utc;
}
Glonass_Gnav_Ephemeris Glonass_Gnav_Navigation_Message::get_ephemeris()
{
return gnav_ephemeris;
@ -814,9 +733,9 @@ bool Glonass_Gnav_Navigation_Message::have_new_ephemeris() //Check if we have a
bool Glonass_Gnav_Navigation_Message::have_new_utc_model() // Check if we have a new utc data set stored in the galileo navigation class
{
if (flag_utc_model_valid == true)
if (flag_utc_model_str_5 == true)
{
flag_utc_model_valid = false; // clear the flag
flag_utc_model_str_5 = false; // clear the flag
return true;
}
else

View File

@ -65,7 +65,6 @@ public:
unsigned int d_string_ID;
bool flag_update_slot_number;
// satellite identification info
int i_channel_ID;
unsigned int i_satellite_PRN;
@ -102,17 +101,25 @@ public:
bool flag_TOW_set; //!< Flag indicating when the TOW has been set
bool flag_TOW_new; //!< Flag indicating when a new TOW has been computed
// Clock terms
double d_satClkCorr; // Satellite clock error
double d_dtr; // Relativistic clock correction term
double d_satClkDrift; // Satellite clock drift
double d_satClkCorr; //!< Satellite clock error
double d_dtr; //!< Relativistic clock correction term
double d_satClkDrift; //!< Satellite clock drift
// Data update parameters
double d_previous_tb;
double d_previous_Na[GLONASS_L1_CA_NBR_SATS];
double d_previous_tb; //!< Previous iode for the Glonass_Gnav_Ephemeris object. Used to determine when new data arrives
double d_previous_Na[GLONASS_L1_CA_NBR_SATS]; //!< Previous time for almanac of the Glonass_Gnav_Almanac object
/*!
* \brief Compute CRC for GLONASS GNAV strings
* \param bits Bits of the string message where to compute CRC
*/
bool CRC_test(std::bitset<GLONASS_GNAV_STRING_BITS> bits);
/*!
* \brief Computes the frame number being decoded given the satellite slot number
* \param satellite_slot_number [in] Satellite slot number identifier
* \returns Frame number being decoded, 0 if operation was not successful.
*/
unsigned int get_frame_number(unsigned int satellite_slot_number);
/*!
@ -130,45 +137,35 @@ public:
*/
Glonass_Gnav_Utc_Model get_utc_model();
/*
* \brief Returns a Galileo_Almanac object filled with the latest navigation data received
/*!
* \brief Returns a Glonass_Gnav_Almanac object filled with the latest navigation data received
* \param satellite_slot_number Slot number identifier for the satellite
* \returns Returns the Glonass_Gnav_Almanac object for the input slot number
*/
Glonass_Gnav_Almanac get_almanac(unsigned int satellite_slot_number);
/*
* \brief Returns true if new Ephemeris has arrived. The flag is set to false when the function is executed
/*!
* \brief Returns true if a new Glonass_Gnav_Ephemeris object has arrived.
*/
bool have_new_ephemeris();
/*
* \brief Returns true if new UTC model has arrived. The flag is set to false when the function is executed
/*!
* \brief Returns true if new Glonass_Gnav_Utc_Model object has arrived
*/
bool have_new_utc_model();
/*
* \brief Returns true if new UTC model has arrived. The flag is set to false when the function is executed
/*!
* \brief Returns true if new Glonass_Gnav_Almanac object has arrived.
*/
bool have_new_almanac();
/*!
* \brief Decodes the GLONASS GNAV string
* \param frame_string [in] is the string message within the parsed frame
* \returns Returns the ID of the decoded string
*/
int string_decoder(std::string frame_string);
/*!
* \brief Gets the time of week in GPS Time
* \details This converts from GLONASS Time to GPS Time of Week based on the
* start of frame
*/
double get_TOW();
double get_WN();
/*!
* \brief Computes the Coordinated Universal Time (UTC) and returns it in [s]
*/
double utc_time(const double glonasstime_corrected) const;
/*!
* Default constructor
*/