mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-13 11:40:33 +00:00
Towards a Galileo INAV Navigation decoder: First version of the Galileo_E1_Telemetry_Decoder block. In this version only the preamble detection and page part synchro is functional.
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@389 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
27b20b0a6d
commit
b0a323095d
@ -17,10 +17,10 @@ ControlThread.wait_for_flowgraph=false
|
||||
SignalSource.implementation=File_Signal_Source
|
||||
|
||||
;#filename: path to file with the captured GNSS signal samples to be processed
|
||||
SignalSource.filename=/media/DATALOGGER_/signals/CTTC captures/cp_cttc_1_galileo_4Msps.dat
|
||||
SignalSource.filename=/media/DATALOGGER_/signals/CTTC captures/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat
|
||||
|
||||
;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version.
|
||||
SignalSource.item_type=gr_complex
|
||||
SignalSource.item_type=short
|
||||
|
||||
;#sampling_frequency: Original Signal sampling frequency in [Hz]
|
||||
SignalSource.sampling_frequency=4000000
|
||||
@ -57,13 +57,12 @@ SignalSource.enable_throttle_control=false
|
||||
;#implementation: Use [Pass_Through] or [Signal_Conditioner]
|
||||
;#[Pass_Through] disables this block and the [DataTypeAdapter], [InputFilter] and [Resampler] blocks
|
||||
;#[Signal_Conditioner] enables this block. Then you have to configure [DataTypeAdapter], [InputFilter] and [Resampler] blocks
|
||||
;SignalConditioner.implementation=Signal_Conditioner
|
||||
SignalConditioner.implementation=Pass_Through
|
||||
SignalConditioner.implementation=Signal_Conditioner
|
||||
|
||||
;######### DATA_TYPE_ADAPTER CONFIG ############
|
||||
;## Changes the type of input data. Please disable it in this version.
|
||||
;#implementation: [Pass_Through] disables this block
|
||||
DataTypeAdapter.implementation=Pass_Through
|
||||
DataTypeAdapter.implementation=Ishort_To_Complex
|
||||
|
||||
;######### INPUT_FILTER CONFIG ############
|
||||
;## Filter the input data. Can be combined with frequency translation for IF signals
|
||||
@ -145,8 +144,8 @@ InputFilter.IF=0
|
||||
;#implementation: Use [Pass_Through] or [Direct_Resampler]
|
||||
;#[Pass_Through] disables this block
|
||||
;#[Direct_Resampler] enables a resampler that implements a nearest neigbourhood interpolation
|
||||
Resampler.implementation=Direct_Resampler
|
||||
;Resampler.implementation=Pass_Through
|
||||
;Resampler.implementation=Direct_Resampler
|
||||
Resampler.implementation=Pass_Through
|
||||
|
||||
;#dump: Dump the resamplered data to a file.
|
||||
Resampler.dump=false
|
||||
@ -160,12 +159,12 @@ Resampler.item_type=gr_complex
|
||||
Resampler.sample_freq_in=4000000
|
||||
|
||||
;#sample_freq_out: the desired sample frequency of the output signal
|
||||
Resampler.sample_freq_out=2000000
|
||||
Resampler.sample_freq_out=4000000
|
||||
|
||||
|
||||
;######### CHANNELS GLOBAL CONFIG ############
|
||||
;#count: Number of available satellite channels.
|
||||
Channels.count=2
|
||||
Channels.count=1
|
||||
;#in_acquisition: Number of channels simultaneously acquiring
|
||||
Channels.in_acquisition=1
|
||||
;#system: GPS, GLONASS, GALILEO, SBAS or COMPASS
|
||||
@ -233,18 +232,33 @@ Channel.signal=1B
|
||||
|
||||
|
||||
|
||||
;Galileo FM3 -> PRN 19
|
||||
;Galileo FM4 -> PRN 20
|
||||
;######### CHANNEL 0 CONFIG ############
|
||||
|
||||
;Channel0.system=Galileo
|
||||
;Channel0.signal=1B
|
||||
;#satellite: Satellite PRN ID for this channel. Disable this option to random search
|
||||
Channel0.satellite=12
|
||||
Channel0.satellite=20
|
||||
|
||||
;######### CHANNEL 1 CONFIG ############
|
||||
|
||||
;Channel1.system=Galileo
|
||||
;Channel1.signal=1B
|
||||
Channel1.satellite=11
|
||||
Channel1.satellite=12
|
||||
|
||||
;######### CHANNEL 0 CONFIG ############
|
||||
|
||||
;Channel2.system=Galileo
|
||||
;Channel2.signal=1B
|
||||
;#satellite: Satellite PRN ID for this channel. Disable this option to random search
|
||||
Channel2.satellite=11
|
||||
|
||||
;######### CHANNEL 1 CONFIG ############
|
||||
|
||||
;Channel3.system=Galileo
|
||||
;Channel3.signal=1B
|
||||
Channel3.satellite=19
|
||||
|
||||
;######### ACQUISITION GLOBAL CONFIG ############
|
||||
|
||||
@ -261,9 +275,9 @@ Acquisition.sampled_ms=4
|
||||
;#implementation: Acquisition algorithm selection for this channel: [GPS_L1_CA_PCPS_Acquisition] or [Galileo_E1_PCPS_Ambiguous_Acquisition]
|
||||
Acquisition.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition
|
||||
;#threshold: Acquisition threshold
|
||||
Acquisition.threshold=0.008
|
||||
;Acquisition.threshold=0
|
||||
;#pfa: Acquisition false alarm probability. This option overrides the threshold option. Only use with implementations: [GPS_L1_CA_PCPS_Acquisition] or [Galileo_E1_PCPS_Ambiguous_Acquisition]
|
||||
Acquisition.pfa=0.0001
|
||||
Acquisition.pfa=0.00005
|
||||
;#doppler_max: Maximum expected Doppler shift [Hz]
|
||||
Acquisition.doppler_max=10000
|
||||
;#doppler_max: Doppler step in the grid search [Hz]
|
||||
@ -328,8 +342,8 @@ Tracking.early_late_space_chips=0.15;
|
||||
Tracking.very_early_late_space_chips=0.6;
|
||||
|
||||
;######### TELEMETRY DECODER CONFIG ############
|
||||
;#implementation: Use [GPS_L1_CA_Telemetry_Decoder] for GPS L1 C/A.
|
||||
TelemetryDecoder.implementation=GPS_L1_CA_Telemetry_Decoder
|
||||
;#implementation: Use [GPS_L1_CA_Telemetry_Decoder] for GPS L1 C/A or [Galileo_E1B_Telemetry_Decoder] for Galileo E1B
|
||||
TelemetryDecoder.implementation=Galileo_E1B_Telemetry_Decoder
|
||||
TelemetryDecoder.dump=false
|
||||
|
||||
;######### OBSERVABLES CONFIG ############
|
||||
|
@ -16,7 +16,10 @@
|
||||
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
set(TELEMETRY_DECODER_ADAPTER_SOURCES gps_l1_ca_telemetry_decoder.cc )
|
||||
set(TELEMETRY_DECODER_ADAPTER_SOURCES
|
||||
gps_l1_ca_telemetry_decoder.cc
|
||||
galileo_e1b_telemetry_decoder.cc
|
||||
)
|
||||
|
||||
include_directories(
|
||||
$(CMAKE_CURRENT_SOURCE_DIR)
|
||||
|
@ -0,0 +1,119 @@
|
||||
/*!
|
||||
* \file galileo_l1_ca_telemetry_decoder.cc
|
||||
* \brief Implementation of an adapter of a Galileo INAV data decoder block
|
||||
* to a TelemetryDecoderInterface
|
||||
* \author Javier Arribas 2013. jarribas(at)cttc.es
|
||||
* \author Mara Branzanti 2013. mara.branzanti(at)gmail.com
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (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/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include "galileo_e1b_telemetry_decoder.h"
|
||||
#include "configuration_interface.h"
|
||||
#include "galileo_e1b_telemetry_decoder_cc.h"
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
#include "galileo_ephemeris.h"
|
||||
#include "galileo_almanac.h"
|
||||
#include "galileo_iono.h"
|
||||
#include "galileo_utc_model.h"
|
||||
|
||||
extern concurrent_queue<Galileo_Ephemeris> global_galileo_ephemeris_queue;
|
||||
extern concurrent_queue<Galileo_Iono> global_galileo_iono_queue;
|
||||
extern concurrent_queue<Galileo_Utc_Model> global_galileo_utc_model_queue;
|
||||
extern concurrent_queue<Galileo_Almanac> global_galileo_almanac_queue;
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
GalileoE1BTelemetryDecoder::GalileoE1BTelemetryDecoder(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue) :
|
||||
role_(role),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams),
|
||||
queue_(queue)
|
||||
{
|
||||
std::string default_item_type = "gr_complex";
|
||||
std::string default_dump_filename = "./navigation.dat";
|
||||
DLOG(INFO) << "role " << role;
|
||||
DLOG(INFO) << "vector length " << vector_length_;
|
||||
vector_length_ = configuration->property(role + ".vector_length", 2048);
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
|
||||
int fs_in;
|
||||
fs_in = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
|
||||
// make telemetry decoder object
|
||||
telemetry_decoder_ = galileo_e1b_make_telemetry_decoder_cc(satellite_, 0, (long)fs_in, vector_length_, queue_, dump_); // TODO fix me
|
||||
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
|
||||
// set the navigation msg queue;
|
||||
telemetry_decoder_->set_ephemeris_queue(&global_galileo_ephemeris_queue);
|
||||
telemetry_decoder_->set_iono_queue(&global_galileo_iono_queue);
|
||||
telemetry_decoder_->set_almanac_queue(&global_galileo_almanac_queue);
|
||||
telemetry_decoder_->set_utc_model_queue(&global_galileo_utc_model_queue);
|
||||
}
|
||||
|
||||
|
||||
GalileoE1BTelemetryDecoder::~GalileoE1BTelemetryDecoder()
|
||||
{}
|
||||
|
||||
|
||||
void GalileoE1BTelemetryDecoder::set_satellite(Gnss_Satellite satellite)
|
||||
{
|
||||
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||
telemetry_decoder_->set_satellite(satellite_);
|
||||
DLOG(INFO) << "GALILEO TELEMETRY DECODER: satellite set to " << satellite_;
|
||||
}
|
||||
|
||||
|
||||
void GalileoE1BTelemetryDecoder::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
// Nothing to connect internally
|
||||
DLOG(INFO) << "nothing to connect internally";
|
||||
}
|
||||
|
||||
|
||||
void GalileoE1BTelemetryDecoder::disconnect(gr::top_block_sptr top_block)
|
||||
{
|
||||
// Nothing to disconnect
|
||||
}
|
||||
|
||||
|
||||
gr::basic_block_sptr GalileoE1BTelemetryDecoder::get_left_block()
|
||||
{
|
||||
return telemetry_decoder_;
|
||||
}
|
||||
|
||||
|
||||
gr::basic_block_sptr GalileoE1BTelemetryDecoder::get_right_block()
|
||||
{
|
||||
return telemetry_decoder_;
|
||||
}
|
||||
|
@ -0,0 +1,95 @@
|
||||
/*!
|
||||
* \file galileo_l1_ca_telemetry_decoder.h
|
||||
* \brief Interface of an adapter of a GALILEO E1B NAV data decoder block
|
||||
* to a TelemetryDecoderInterface
|
||||
* \author Javier Arribas 2013. jarribas(at)cttc.es * \author Javier Arribas 2013. jarribas(at)cttc.es
|
||||
* \author Mara Branzanti 2013. mara.branzanti(at)gmail.com
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (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_GALILEO_E1B_TELEMETRY_DECODER_H_
|
||||
#define GNSS_SDR_GALILEO_E1B_TELEMETRY_DECODER_H_
|
||||
|
||||
#include "telemetry_decoder_interface.h"
|
||||
#include "galileo_e1b_telemetry_decoder_cc.h"
|
||||
#include <gnuradio/msg_queue.h>
|
||||
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
/*!
|
||||
* \brief This class implements a NAV data decoder for Galileo INAV frames in E1B radio link
|
||||
*/
|
||||
class GalileoE1BTelemetryDecoder : public TelemetryDecoderInterface
|
||||
{
|
||||
public:
|
||||
GalileoE1BTelemetryDecoder(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue);
|
||||
|
||||
virtual ~GalileoE1BTelemetryDecoder();
|
||||
std::string role()
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
std::string implementation()
|
||||
{
|
||||
return "Galileo_E1B_Telemetry_Decoder";
|
||||
}
|
||||
void connect(gr::top_block_sptr top_block);
|
||||
void disconnect(gr::top_block_sptr top_block);
|
||||
gr::basic_block_sptr get_left_block();
|
||||
gr::basic_block_sptr get_right_block();
|
||||
void set_satellite(Gnss_Satellite satellite);
|
||||
void set_channel(int channel){telemetry_decoder_->set_channel(channel);}
|
||||
void reset()
|
||||
{
|
||||
return;
|
||||
}
|
||||
size_t item_size()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
galileo_e1b_telemetry_decoder_cc_sptr telemetry_decoder_;
|
||||
Gnss_Satellite satellite_;
|
||||
int channel_;
|
||||
unsigned int vector_length_;
|
||||
std::string item_type_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
boost::shared_ptr<gr::msg_queue> queue_;
|
||||
};
|
||||
|
||||
#endif
|
@ -18,7 +18,7 @@
|
||||
|
||||
set(TELEMETRY_DECODER_GR_BLOCKS_SOURCES
|
||||
gps_l1_ca_telemetry_decoder_cc.cc
|
||||
# direct_resampler_conditioner_ss.cc
|
||||
galileo_e1b_telemetry_decoder_cc.cc
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
@ -0,0 +1,333 @@
|
||||
/*!
|
||||
* \file galileo_e1b_telemetry_decoder_cc.cc
|
||||
* \brief Implementation of a NAV message demodulator block
|
||||
* \author Mara Branzanti 2013. mara.branzanti(at)gmail.com
|
||||
* \author Javier Arribas 2013. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (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/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "gnss_synchro.h"
|
||||
#include "galileo_e1b_telemetry_decoder_cc.h"
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <bitset>
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "control_message_factory.h"
|
||||
|
||||
#include "gnss_synchro.h"
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
|
||||
galileo_e1b_telemetry_decoder_cc_sptr
|
||||
galileo_e1b_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned
|
||||
int vector_length, boost::shared_ptr<gr::msg_queue> queue, bool dump)
|
||||
{
|
||||
return galileo_e1b_telemetry_decoder_cc_sptr(new galileo_e1b_telemetry_decoder_cc(satellite, if_freq,
|
||||
fs_in, vector_length, queue, dump));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void galileo_e1b_telemetry_decoder_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required)
|
||||
{
|
||||
for (unsigned i = 0; i < 3; i++)
|
||||
{
|
||||
ninput_items_required[i] = GALILEO_INAV_PAGE_SYMBOLS; //set the required sample history
|
||||
}
|
||||
}
|
||||
|
||||
galileo_e1b_telemetry_decoder_cc::galileo_e1b_telemetry_decoder_cc(
|
||||
Gnss_Satellite satellite,
|
||||
long if_freq,
|
||||
long fs_in,
|
||||
unsigned
|
||||
int vector_length,
|
||||
boost::shared_ptr<gr::msg_queue> queue,
|
||||
bool dump) :
|
||||
gr::block("galileo_e1b_telemetry_decoder_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// initialize internal vars
|
||||
d_queue = queue;
|
||||
d_dump = dump;
|
||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||
DLOG(INFO) << "GALILEO E1B TELEMETRY PROCESSING: satellite " << d_satellite;
|
||||
d_vector_length = vector_length;
|
||||
d_samples_per_symbol = ( Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS ) / Galileo_E1_B_SYMBOL_RATE_BPS;
|
||||
d_fs_in = fs_in;
|
||||
|
||||
// set the preamble
|
||||
unsigned short int preambles_bits[GALILEO_INAV_PREAMBLE_LENGTH_BITS]=GALILEO_INAV_PREAMBLE;
|
||||
|
||||
d_symbols_per_preamble=GALILEO_INAV_PREAMBLE_LENGTH_BITS * d_samples_per_symbol;
|
||||
|
||||
memcpy((unsigned short int*)this->d_preambles_bits, (unsigned short int*)preambles_bits, GALILEO_INAV_PREAMBLE_LENGTH_BITS*sizeof(unsigned short int));
|
||||
|
||||
// preamble bits to sampled symbols
|
||||
d_preambles_symbols = (signed int*)malloc(sizeof(signed int) * d_symbols_per_preamble);
|
||||
int n = 0;
|
||||
for (int i=0; i<GALILEO_INAV_PREAMBLE_LENGTH_BITS; i++)
|
||||
{
|
||||
for (unsigned int j=0; j<d_samples_per_symbol; j++)
|
||||
{
|
||||
if (d_preambles_bits[i] == 1)
|
||||
{
|
||||
d_preambles_symbols[n] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
d_preambles_symbols[n] = -1;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
}
|
||||
d_sample_counter = 0;
|
||||
d_stat = 0;
|
||||
d_preamble_index = 0;
|
||||
|
||||
d_preamble_time_seconds = 0;
|
||||
d_flag_frame_sync = false;
|
||||
|
||||
d_flag_parity = false;
|
||||
d_TOW_at_Preamble = 0;
|
||||
d_TOW_at_current_symbol = 0;
|
||||
flag_TOW_set = false;
|
||||
|
||||
// set up de-interleaver table
|
||||
// std::vector<int> positions;
|
||||
// for (int rows=0;rows<GALILEO_INAV_INTERLEAVER_ROWS;rows++)
|
||||
// {
|
||||
// for (int cols=0;cols<GALILEO_INAV_INTERLEAVER_COLS;cols++)
|
||||
// {
|
||||
// positions.push_back(rows*GALILEO_INAV_INTERLEAVER_ROWS+cols);
|
||||
// }
|
||||
// }
|
||||
// d_interleaver= new gr::trellis::interleaver();
|
||||
|
||||
// set up trellis decoder
|
||||
|
||||
}
|
||||
|
||||
|
||||
galileo_e1b_telemetry_decoder_cc::~galileo_e1b_telemetry_decoder_cc()
|
||||
{
|
||||
delete d_preambles_symbols;
|
||||
d_dump_file.close();
|
||||
}
|
||||
|
||||
|
||||
int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
{
|
||||
int corr_value = 0;
|
||||
int preamble_diff = 0;
|
||||
|
||||
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
|
||||
d_sample_counter++; //count for the processed samples
|
||||
|
||||
// ########### Output the tracking data to navigation and PVT ##########
|
||||
const Gnss_Synchro **in = (const Gnss_Synchro **) &input_items[0]; //Get the input samples pointer
|
||||
|
||||
// TODO Optimize me!
|
||||
//******* preamble correlation ********
|
||||
for (int i=0; i<d_symbols_per_preamble; i++)
|
||||
{
|
||||
if (in[0][i].Prompt_I < 0) // symbols clipping
|
||||
{
|
||||
corr_value -= d_preambles_symbols[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
corr_value += d_preambles_symbols[i];
|
||||
}
|
||||
}
|
||||
d_flag_preamble = false;
|
||||
|
||||
//******* frame sync ******************
|
||||
if (abs(corr_value) >= d_symbols_per_preamble)
|
||||
{
|
||||
//std::cout << "Positive preamble correlation for Galileo SAT " << this->d_satellite << std::endl;
|
||||
//TODO: Rewrite with state machine
|
||||
if (d_stat == 0)
|
||||
{
|
||||
//d_GPS_FSM.Event_gps_word_preamble();
|
||||
d_preamble_index = d_sample_counter;//record the preamble sample stamp
|
||||
std::cout << "Preamble detection for Galileo SAT " << this->d_satellite << std::endl;
|
||||
d_stat = 1; // enter into frame pre-detection status
|
||||
}
|
||||
else if (d_stat == 1) //check preamble separation
|
||||
{
|
||||
preamble_diff = abs(d_sample_counter - d_preamble_index);
|
||||
//std::cout << "preamble_diff="<< preamble_diff <<" for Galileo SAT " << this->d_satellite << std::endl;
|
||||
if (abs(preamble_diff - GALILEO_INAV_PREAMBLE_PERIOD_SYMBOLS) < 1)
|
||||
{
|
||||
// NEW Galileo page part is received
|
||||
// 1. De-interleave
|
||||
|
||||
// 2. Viterbi decoder
|
||||
|
||||
// 3. Call the Galileo page decoder
|
||||
|
||||
//d_GPS_FSM.Event_gps_word_preamble();
|
||||
d_flag_preamble = true;
|
||||
d_preamble_index = d_sample_counter; //record the preamble sample stamp (t_P)
|
||||
d_preamble_time_seconds = in[0][0].Tracking_timestamp_secs;// - d_preamble_duration_seconds; //record the PRN start sample index associated to the preamble
|
||||
|
||||
if (!d_flag_frame_sync)
|
||||
{
|
||||
d_flag_frame_sync = true;
|
||||
std::cout <<" Frame sync SAT " << this->d_satellite << " with preamble start at " << d_preamble_time_seconds << " [s]" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (d_stat == 1)
|
||||
{
|
||||
preamble_diff = d_sample_counter - d_preamble_index;
|
||||
if (preamble_diff > GALILEO_INAV_PREAMBLE_PERIOD_SYMBOLS)
|
||||
{
|
||||
std::cout << "Lost of frame sync SAT " << this->d_satellite << " preamble_diff= " << preamble_diff << std::endl;
|
||||
d_stat = 0; //lost of frame sync
|
||||
d_flag_frame_sync = false;
|
||||
//flag_TOW_set=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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][0];
|
||||
//2. Add the telemetry decoder information
|
||||
//if (this->d_flag_preamble==true and d_GPS_FSM.d_nav.d_TOW>0) //update TOW at the preamble instant (todo: check for valid d_TOW)
|
||||
if (this->d_flag_preamble==true) //update TOW at the preamble instant (todo: check for valid d_TOW)
|
||||
{
|
||||
//d_TOW_at_Preamble = d_GPS_FSM.d_nav.d_TOW + GPS_SUBFRAME_SECONDS; //we decoded the current TOW when the last word of the subframe arrive, so, we have a lag of ONE SUBFRAME
|
||||
//d_TOW_at_current_symbol = d_TOW_at_Preamble + GALILEO_INAV_PREAMBLE_LENGTH_BITS/Galileo_E1_B_SYMBOL_RATE_BPS;
|
||||
Prn_timestamp_at_preamble_ms = in[0][0].Tracking_timestamp_secs * 1000.0;
|
||||
///if (flag_TOW_set==false)
|
||||
//{
|
||||
// flag_TOW_set = true;
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
//d_TOW_at_current_symbol = d_TOW_at_current_symbol + Galileo_E1_CODE_PERIOD;
|
||||
}
|
||||
|
||||
|
||||
current_synchro_data.d_TOW = d_TOW_at_Preamble;
|
||||
current_synchro_data.d_TOW_at_current_symbol = d_TOW_at_current_symbol;
|
||||
current_synchro_data.Flag_valid_word = (d_flag_frame_sync == true and d_flag_parity == true and flag_TOW_set==true);
|
||||
current_synchro_data.Flag_preamble = d_flag_preamble;
|
||||
current_synchro_data.Prn_timestamp_ms = in[0][0].Tracking_timestamp_secs * 1000.0;
|
||||
current_synchro_data.Prn_timestamp_at_preamble_ms = Prn_timestamp_at_preamble_ms;
|
||||
|
||||
if(d_dump == true)
|
||||
{
|
||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||
try
|
||||
{
|
||||
double tmp_double;
|
||||
tmp_double = d_TOW_at_current_symbol;
|
||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
||||
tmp_double = current_synchro_data.Prn_timestamp_ms;
|
||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
||||
tmp_double = d_TOW_at_Preamble;
|
||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
||||
}
|
||||
catch (std::ifstream::failure e)
|
||||
{
|
||||
std::cout << "Exception writing observables dump file " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
//3. Make the output (copy the object contents to the GNURadio reserved memory)
|
||||
*out[0] = current_synchro_data;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void galileo_e1b_telemetry_decoder_cc::set_satellite(Gnss_Satellite satellite)
|
||||
{
|
||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
|
||||
//d_GPS_FSM.i_satellite_PRN = d_satellite.get_PRN();
|
||||
DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
|
||||
}
|
||||
|
||||
|
||||
void galileo_e1b_telemetry_decoder_cc::set_channel(int channel)
|
||||
{
|
||||
d_channel = channel;
|
||||
//d_GPS_FSM.i_channel_ID = channel;
|
||||
DLOG(INFO) << "Navigation channel set to " << channel;
|
||||
// ############# ENABLE DATA FILE LOG #################
|
||||
if (d_dump == true)
|
||||
{
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
d_dump_filename = "telemetry";
|
||||
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
|
||||
d_dump_filename.append(".dat");
|
||||
d_dump_file.exceptions ( std::ifstream::failbit | std::ifstream::badbit );
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||
std::cout << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
}
|
||||
catch (std::ifstream::failure e)
|
||||
{
|
||||
std::cout << "channel " << d_channel << " Exception opening trk dump file " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void galileo_e1b_telemetry_decoder_cc::set_ephemeris_queue(concurrent_queue<Galileo_Ephemeris> *ephemeris_queue)
|
||||
{
|
||||
//d_Galileo_INAV_FSM.d_ephemeris_queue = ephemeris_queue;
|
||||
}
|
||||
void galileo_e1b_telemetry_decoder_cc::set_iono_queue(concurrent_queue<Galileo_Iono> *iono_queue)
|
||||
{
|
||||
//d_Galileo_INAV_FSM.d_iono_queue = iono_queue;
|
||||
}
|
||||
void galileo_e1b_telemetry_decoder_cc::set_almanac_queue(concurrent_queue<Galileo_Almanac> *almanac_queue)
|
||||
{
|
||||
//d_Galileo_INAV_FSM.d_almanac_queue = almanac_queue;
|
||||
}
|
||||
void galileo_e1b_telemetry_decoder_cc::set_utc_model_queue(concurrent_queue<Galileo_Utc_Model> *utc_model_queue)
|
||||
{
|
||||
//d_Galileo_INAV_FSM.d_utc_model_queue = utc_model_queue;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,132 @@
|
||||
/*!
|
||||
* \file galileo_e1b_telemetry_decoder_cc.h
|
||||
* \brief Interface of a Galileo NAV message demodulator block
|
||||
* \author Javier Arribas 2013. jarribas(at)cttc.es
|
||||
* \author Mara Branzanti 2013. mara.branzanti(at)gmail.com
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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_galileo_e1b_TELEMETRY_DECODER_CC_H
|
||||
#define GNSS_SDR_galileo_e1b_TELEMETRY_DECODER_CC_H
|
||||
|
||||
|
||||
#include "Galileo_E1.h"
|
||||
#include "concurrent_queue.h"
|
||||
#include <fstream>
|
||||
#include <bitset>
|
||||
#include <gnuradio/block.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
|
||||
#include "gnuradio/trellis/interleaver.h"
|
||||
#include "gnuradio/trellis/permutation.h"
|
||||
#include "gnuradio/fec/viterbi.h"
|
||||
|
||||
//#include <gnuradio/gr_sync_block.h>
|
||||
#include "gnss_satellite.h"
|
||||
//#include "galileo_inav_fsm.h"
|
||||
#include "galileo_navigation_message.h"
|
||||
#include "galileo_ephemeris.h"
|
||||
#include "galileo_almanac.h"
|
||||
#include "galileo_iono.h"
|
||||
#include "galileo_utc_model.h"
|
||||
|
||||
class galileo_e1b_telemetry_decoder_cc;
|
||||
|
||||
typedef boost::shared_ptr<galileo_e1b_telemetry_decoder_cc> galileo_e1b_telemetry_decoder_cc_sptr;
|
||||
|
||||
galileo_e1b_telemetry_decoder_cc_sptr
|
||||
galileo_e1b_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned
|
||||
int vector_length, boost::shared_ptr<gr::msg_queue> queue, bool dump);
|
||||
|
||||
/*!
|
||||
* \brief This class implements a block that decodes the INAV data defined in Galileo ICD
|
||||
*
|
||||
*/
|
||||
class galileo_e1b_telemetry_decoder_cc : public gr::block
|
||||
{
|
||||
public:
|
||||
~galileo_e1b_telemetry_decoder_cc();
|
||||
void set_satellite(Gnss_Satellite satellite); //!< Set satellite PRN
|
||||
void set_channel(int channel); //!< Set receiver's channel
|
||||
/*!
|
||||
* \brief Set the satellite data queue
|
||||
*/
|
||||
void set_ephemeris_queue(concurrent_queue<Galileo_Ephemeris> *ephemeris_queue);
|
||||
void set_iono_queue(concurrent_queue<Galileo_Iono> *iono_queue);
|
||||
void set_almanac_queue(concurrent_queue<Galileo_Almanac> *almanac_queue);
|
||||
void set_utc_model_queue(concurrent_queue<Galileo_Utc_Model> *utc_model_queue);
|
||||
|
||||
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
||||
|
||||
private:
|
||||
friend galileo_e1b_telemetry_decoder_cc_sptr
|
||||
galileo_e1b_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in,unsigned
|
||||
int vector_length, boost::shared_ptr<gr::msg_queue> queue, bool dump);
|
||||
galileo_e1b_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned
|
||||
int vector_length, boost::shared_ptr<gr::msg_queue> queue, bool dump);
|
||||
|
||||
unsigned short int d_preambles_bits[GALILEO_INAV_PREAMBLE_LENGTH_BITS];
|
||||
|
||||
signed int *d_preambles_symbols;
|
||||
unsigned int d_samples_per_symbol;
|
||||
int d_symbols_per_preamble;
|
||||
|
||||
long unsigned int d_sample_counter;
|
||||
long unsigned int d_preamble_index;
|
||||
unsigned int d_stat;
|
||||
bool d_flag_frame_sync;
|
||||
|
||||
bool d_flag_parity;
|
||||
bool d_flag_preamble;
|
||||
|
||||
long d_fs_in;
|
||||
|
||||
//gr::trellis::interleaver d_interleaver;
|
||||
|
||||
// navigation message vars
|
||||
Galileo_Navigation_Message d_nav;
|
||||
|
||||
//GalileoINAVFsm d_Galileo_INAV_FSM;
|
||||
|
||||
boost::shared_ptr<gr::msg_queue> d_queue;
|
||||
unsigned int d_vector_length;
|
||||
bool d_dump;
|
||||
Gnss_Satellite d_satellite;
|
||||
int d_channel;
|
||||
|
||||
double d_preamble_time_seconds;
|
||||
|
||||
double d_TOW_at_Preamble;
|
||||
double d_TOW_at_current_symbol;
|
||||
double Prn_timestamp_at_preamble_ms;
|
||||
bool flag_TOW_set;
|
||||
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
};
|
||||
|
||||
#endif
|
298
src/algorithms/telemetry_decoder/libs/galileo_inav_fsm.cc
Normal file
298
src/algorithms/telemetry_decoder/libs/galileo_inav_fsm.cc
Normal file
@ -0,0 +1,298 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_subframe_fsm.cc
|
||||
* \brief Implementation of a GPS NAV message word-to-subframe decoder state machine
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (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/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "gps_l1_ca_subframe_fsm.h"
|
||||
|
||||
|
||||
//************ GPS WORD TO SUBFRAME DECODER STATE MACHINE **********
|
||||
|
||||
struct Ev_gps_word_valid : sc::event<Ev_gps_word_valid> {};
|
||||
struct Ev_gps_word_invalid : sc::event<Ev_gps_word_invalid>{};
|
||||
struct Ev_gps_word_preamble : sc::event<Ev_gps_word_preamble>{};
|
||||
|
||||
|
||||
struct gps_subframe_fsm_S0: public sc::state<gps_subframe_fsm_S0, GpsL1CaSubframeFsm>
|
||||
{
|
||||
public:
|
||||
// sc::transition(event,next_status)
|
||||
typedef sc::transition< Ev_gps_word_preamble, gps_subframe_fsm_S1 > reactions;
|
||||
gps_subframe_fsm_S0(my_context ctx): my_base( ctx )
|
||||
{
|
||||
//std::cout<<"Enter S0 "<<std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
struct gps_subframe_fsm_S1: public sc::state<gps_subframe_fsm_S1, GpsL1CaSubframeFsm>
|
||||
{
|
||||
public:
|
||||
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S2 > > reactions;
|
||||
|
||||
gps_subframe_fsm_S1(my_context ctx): my_base( ctx )
|
||||
{
|
||||
//std::cout<<"Enter S1 "<<std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
struct gps_subframe_fsm_S2: public sc::state<gps_subframe_fsm_S2, GpsL1CaSubframeFsm>
|
||||
{
|
||||
public:
|
||||
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S3 > > reactions;
|
||||
|
||||
gps_subframe_fsm_S2(my_context ctx): my_base( ctx )
|
||||
{
|
||||
//std::cout<<"Enter S2 "<<std::endl;
|
||||
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
struct gps_subframe_fsm_S3: public sc::state<gps_subframe_fsm_S3, GpsL1CaSubframeFsm>
|
||||
{
|
||||
public:
|
||||
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S4 > > reactions;
|
||||
|
||||
gps_subframe_fsm_S3(my_context ctx): my_base( ctx )
|
||||
{
|
||||
//std::cout<<"Enter S3 "<<std::endl;
|
||||
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(1);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
struct gps_subframe_fsm_S4: public sc::state<gps_subframe_fsm_S4, GpsL1CaSubframeFsm>
|
||||
{
|
||||
public:
|
||||
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S5 > > reactions;
|
||||
|
||||
gps_subframe_fsm_S4(my_context ctx): my_base( ctx )
|
||||
{
|
||||
//std::cout<<"Enter S4 "<<std::endl;
|
||||
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
struct gps_subframe_fsm_S5: public sc::state<gps_subframe_fsm_S5, GpsL1CaSubframeFsm>
|
||||
{
|
||||
public:
|
||||
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S6 > > reactions;
|
||||
|
||||
gps_subframe_fsm_S5(my_context ctx): my_base( ctx )
|
||||
{
|
||||
//std::cout<<"Enter S5 "<<std::endl;
|
||||
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(3);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct gps_subframe_fsm_S6: public sc::state<gps_subframe_fsm_S6, GpsL1CaSubframeFsm>
|
||||
{
|
||||
public:
|
||||
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S7 > > reactions;
|
||||
|
||||
gps_subframe_fsm_S6(my_context ctx): my_base( ctx )
|
||||
{
|
||||
//std::cout<<"Enter S6 "<<std::endl;
|
||||
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(4);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct gps_subframe_fsm_S7: public sc::state<gps_subframe_fsm_S7, GpsL1CaSubframeFsm>
|
||||
{
|
||||
public:
|
||||
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S8 > > reactions;
|
||||
|
||||
gps_subframe_fsm_S7(my_context ctx): my_base( ctx )
|
||||
{
|
||||
//std::cout<<"Enter S7 "<<std::endl;
|
||||
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(5);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct gps_subframe_fsm_S8: public sc::state<gps_subframe_fsm_S8, GpsL1CaSubframeFsm>
|
||||
{
|
||||
public:
|
||||
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S9 > > reactions;
|
||||
|
||||
gps_subframe_fsm_S8(my_context ctx): my_base( ctx )
|
||||
{
|
||||
//std::cout<<"Enter S8 "<<std::endl;
|
||||
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(6);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
struct gps_subframe_fsm_S9: public sc::state<gps_subframe_fsm_S9, GpsL1CaSubframeFsm>
|
||||
{
|
||||
public:
|
||||
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S10 > > reactions;
|
||||
|
||||
gps_subframe_fsm_S9(my_context ctx): my_base( ctx )
|
||||
{
|
||||
//std::cout<<"Enter S9 "<<std::endl;
|
||||
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(7);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct gps_subframe_fsm_S10: public sc::state<gps_subframe_fsm_S10, GpsL1CaSubframeFsm>
|
||||
{
|
||||
public:
|
||||
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S11 > > reactions;
|
||||
|
||||
gps_subframe_fsm_S10(my_context ctx): my_base( ctx )
|
||||
{
|
||||
//std::cout<<"Enter S10 "<<std::endl;
|
||||
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(8);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct gps_subframe_fsm_S11: public sc::state<gps_subframe_fsm_S11, GpsL1CaSubframeFsm>
|
||||
{
|
||||
public:
|
||||
typedef sc::transition< Ev_gps_word_preamble, gps_subframe_fsm_S1 > reactions;
|
||||
|
||||
gps_subframe_fsm_S11(my_context ctx): my_base( ctx )
|
||||
{
|
||||
//std::cout<<"Completed GPS Subframe!"<<std::endl;
|
||||
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(9);
|
||||
context< GpsL1CaSubframeFsm >().gps_subframe_to_nav_msg(); //decode the subframe
|
||||
// DECODE SUBFRAME
|
||||
//std::cout<<"Enter S11"<<std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
GpsL1CaSubframeFsm::GpsL1CaSubframeFsm()
|
||||
{
|
||||
d_nav.reset();
|
||||
initiate(); //start the FSM
|
||||
}
|
||||
|
||||
void GpsL1CaSubframeFsm::gps_word_to_subframe(int position)
|
||||
{
|
||||
// insert the word in the correct position of the subframe
|
||||
std::memcpy(&d_subframe[position*GPS_WORD_LENGTH], &d_GPS_frame_4bytes, sizeof(char)*GPS_WORD_LENGTH);
|
||||
}
|
||||
|
||||
void GpsL1CaSubframeFsm::gps_subframe_to_nav_msg()
|
||||
{
|
||||
int subframe_ID;
|
||||
// NEW GPS SUBFRAME HAS ARRIVED!
|
||||
subframe_ID = d_nav.subframe_decoder(this->d_subframe); //decode the subframe
|
||||
std::cout << "NAVIGATION FSM: received subframe " << subframe_ID << " for satellite " << Gnss_Satellite(std::string("GPS"), i_satellite_PRN) << std::endl;
|
||||
d_nav.i_satellite_PRN = i_satellite_PRN;
|
||||
d_nav.i_channel_ID = i_channel_ID;
|
||||
d_nav.d_subframe_timestamp_ms = this->d_preamble_time_ms;
|
||||
|
||||
switch (subframe_ID)
|
||||
{
|
||||
case 3: //we have a new set of ephemeris data for the current SV
|
||||
if (d_nav.satellite_validation()==true)
|
||||
{
|
||||
// get ephemeris object for this SV (mandatory)
|
||||
Gps_Ephemeris ephemeris=d_nav.get_ephemeris();
|
||||
d_ephemeris_queue->push(ephemeris);
|
||||
}
|
||||
break;
|
||||
case 4: // Possible IONOSPHERE and UTC model update (page 18)
|
||||
if (d_nav.flag_iono_valid==true)
|
||||
{
|
||||
Gps_Iono iono=d_nav.get_iono(); //notice that the read operation will clear the valid flag
|
||||
d_iono_queue->push(iono);
|
||||
}
|
||||
if (d_nav.flag_utc_model_valid==true)
|
||||
{
|
||||
Gps_Utc_Model utc_model=d_nav.get_utc_model(); //notice that the read operation will clear the valid flag
|
||||
d_utc_model_queue->push(utc_model);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
// get almanac (if available)
|
||||
//TODO: implement almanac reader in navigation_message
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GpsL1CaSubframeFsm::Event_gps_word_valid()
|
||||
{
|
||||
this->process_event(Ev_gps_word_valid());
|
||||
}
|
||||
|
||||
void GpsL1CaSubframeFsm::Event_gps_word_invalid()
|
||||
{
|
||||
this->process_event(Ev_gps_word_invalid());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GpsL1CaSubframeFsm::Event_gps_word_preamble()
|
||||
{
|
||||
this->process_event(Ev_gps_word_preamble());
|
||||
}
|
||||
|
112
src/algorithms/telemetry_decoder/libs/galileo_inav_fsm.h
Normal file
112
src/algorithms/telemetry_decoder/libs/galileo_inav_fsm.h
Normal file
@ -0,0 +1,112 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_subframe_fsm.h
|
||||
* \brief Interface of a Galileo NAV message word-to-subframe decoder state machine
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (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_GALILEO_INAV_FSM_H_
|
||||
#define GNSS_SDR_GALILEO_INAV_FSM_H_
|
||||
|
||||
#include <boost/statechart/state_machine.hpp>
|
||||
#include <boost/statechart/simple_state.hpp>
|
||||
#include <boost/statechart/state.hpp>
|
||||
#include <boost/statechart/transition.hpp>
|
||||
#include <boost/statechart/custom_reaction.hpp>
|
||||
#include <boost/mpl/list.hpp>
|
||||
#include <queue>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include "concurrent_queue.h"
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
||||
#include "galileo_navigation_message.h"
|
||||
#include "galileo_ephemeris.h"
|
||||
#include "galileo_almanac.h"
|
||||
#include "galileo_iono.h"
|
||||
#include "galileo_utc_model.h"
|
||||
|
||||
namespace sc = boost::statechart;
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
struct gps_subframe_fsm_S0;
|
||||
struct gps_subframe_fsm_S1;
|
||||
struct gps_subframe_fsm_S2;
|
||||
struct gps_subframe_fsm_S3;
|
||||
struct gps_subframe_fsm_S4;
|
||||
struct gps_subframe_fsm_S5;
|
||||
struct gps_subframe_fsm_S6;
|
||||
struct gps_subframe_fsm_S7;
|
||||
struct gps_subframe_fsm_S8;
|
||||
struct gps_subframe_fsm_S9;
|
||||
struct gps_subframe_fsm_S10;
|
||||
struct gps_subframe_fsm_S11;
|
||||
|
||||
class GalileoINAVFsm : public sc::state_machine< GalileoINAVFsm, gps_subframe_fsm_S0 >
|
||||
{
|
||||
public:
|
||||
// channel and satellite info
|
||||
int i_channel_ID;
|
||||
unsigned int i_satellite_PRN;
|
||||
|
||||
// ephemeris queue
|
||||
concurrent_queue<Galileo_Ephemeris> *d_ephemeris_queue;
|
||||
// ionospheric parameters queue
|
||||
concurrent_queue<Galileo_Iono> *d_iono_queue;
|
||||
// UTC model parameters queue
|
||||
concurrent_queue<Galileo_Utc_Model> *d_utc_model_queue;
|
||||
// Almanac queue
|
||||
concurrent_queue<Galileo_Almanac> *d_almanac_queue;
|
||||
|
||||
// navigation message class
|
||||
Gps_Navigation_Message d_nav;
|
||||
|
||||
// GPS SV and System parameters
|
||||
Galileo_Ephemeris ephemeris;
|
||||
Galileo_Almanac almanac;
|
||||
Galileo_Utc_Model utc_model;
|
||||
Galileo_Iono iono;
|
||||
|
||||
|
||||
char d_subframe[GPS_SUBFRAME_LENGTH];
|
||||
char d_GPS_frame_4bytes[GPS_WORD_LENGTH];
|
||||
|
||||
double d_preamble_time_ms;
|
||||
|
||||
void gps_word_to_subframe(int position);
|
||||
void gps_subframe_to_nav_msg();
|
||||
|
||||
//FSM EVENTS
|
||||
void Event_gps_word_valid();
|
||||
void Event_gps_word_invalid();
|
||||
void Event_gps_word_preamble();
|
||||
|
||||
GalileoINAVFsm();
|
||||
};
|
||||
|
||||
#endif
|
@ -31,6 +31,10 @@
|
||||
#ifndef GNSS_SDR_CONCURRENT_QUEUE_H
|
||||
#define GNSS_SDR_CONCURRENT_QUEUE_H
|
||||
|
||||
#include <queue>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
|
||||
template<typename Data>
|
||||
|
||||
/*!
|
||||
|
@ -63,6 +63,7 @@
|
||||
#include "galileo_e1_dll_pll_veml_tracking.h"
|
||||
#include "galileo_e1_tcp_connector_tracking.h"
|
||||
#include "gps_l1_ca_telemetry_decoder.h"
|
||||
#include "galileo_e1b_telemetry_decoder.h"
|
||||
#include "gps_l1_ca_observables.h"
|
||||
#include "gps_l1_ca_pvt.h"
|
||||
|
||||
@ -374,6 +375,11 @@ GNSSBlockInterface* GNSSBlockFactory::GetBlock(
|
||||
block = new GpsL1CaTelemetryDecoder(configuration, role, in_streams,
|
||||
out_streams, queue);
|
||||
}
|
||||
else if (implementation.compare("Galileo_E1B_Telemetry_Decoder") == 0)
|
||||
{
|
||||
block = new GalileoE1BTelemetryDecoder(configuration, role, in_streams,
|
||||
out_streams, queue);
|
||||
}
|
||||
// OBSERVABLES -----------------------------------------------------------------
|
||||
else if (implementation.compare("GPS_L1_CA_Observables") == 0)
|
||||
{
|
||||
|
@ -27,6 +27,11 @@ set(SYSTEM_PARAMETERS_SOURCES
|
||||
gps_acq_assist.cc
|
||||
gps_ref_time.cc
|
||||
gps_ref_location.cc
|
||||
galileo_utc_model.cc
|
||||
galileo_ephemeris.cc
|
||||
galileo_almanac.cc
|
||||
galileo_iono.cc
|
||||
galileo_navigation_message.cc
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <vector>
|
||||
#include <utility> // std::pair
|
||||
#include <gnss_satellite.h>
|
||||
#include "MATH_CONSTANTS.h"
|
||||
|
||||
// Physical constants
|
||||
const double GPS_C_m_s = 299792458.0; //!< The speed of light, [m/s]
|
||||
@ -63,12 +64,9 @@ const double GPS_L1_CA_CODE_PERIOD = 0.001; //!< GPS L1 C/A code perio
|
||||
*/
|
||||
const double MAX_TOA_DELAY_MS = 20;
|
||||
|
||||
|
||||
|
||||
//#define NAVIGATION_SOLUTION_RATE_MS 1000 // this cannot go here
|
||||
const double GPS_STARTOFFSET_ms = 68.802; //[ms] Initial sign. travel time (this cannot go here)
|
||||
|
||||
|
||||
// NAVIGATION MESSAGE DEMODULATION AND DECODING
|
||||
|
||||
#define GPS_PREAMBLE {1, 0, 0, 0, 1, 0, 1, 1}
|
||||
@ -81,50 +79,6 @@ const int GPS_SUBFRAME_BITS = 300; //!< Number of bits per subf
|
||||
const int GPS_SUBFRAME_SECONDS = 6; //!< Subframe duration [seconds]
|
||||
const int GPS_WORD_BITS = 30; //!< Number of bits per word in the NAV message [bits]
|
||||
|
||||
/* Constants for scaling the ephemeris found in the data message
|
||||
the format is the following: TWO_N5 -> 2^-5, TWO_P4 -> 2^4, PI_TWO_N43 -> Pi*2^-43, etc etc
|
||||
Additionally some of the PI*2^N terms are used in the tracking stuff
|
||||
TWO_PX ==> 2^X
|
||||
TWO_NX ==> 2^-X
|
||||
PI_TWO_NX ==> Pi*2^-X
|
||||
PI_TWO_PX ==> Pi*2^X
|
||||
ONE_PI_TWO_PX = (1/Pi)*2^X
|
||||
*/
|
||||
const double TWO_P4 = (16); //!< 2^4
|
||||
const double TWO_P11 = (2048); //!< 2^11
|
||||
const double TWO_P12 = (4096); //!< 2^12
|
||||
const double TWO_P14 = (16384); //!< 2^14
|
||||
const double TWO_P16 = (65536); //!< 2^16
|
||||
const double TWO_P19 = (524288); //!< 2^19
|
||||
const double TWO_P31 = (2147483648.0); //!< 2^31
|
||||
const double TWO_P32 = (4294967296.0); //!< 2^32 this is too big for an int so add the x.0
|
||||
const double TWO_P56 = (7.205759403792794e+016); //!< 2^56
|
||||
const double TWO_P57 = (1.441151880758559e+017); //!< 2^57
|
||||
|
||||
const double TWO_N5 = (0.03125); //!< 2^-5
|
||||
const double TWO_N11 = (4.882812500000000e-004); //!< 2^-11
|
||||
const double TWO_N19 = (1.907348632812500e-006); //!< 2^-19
|
||||
const double TWO_N20 = (9.536743164062500e-007); //!< 2^-20
|
||||
const double TWO_N21 = (4.768371582031250e-007); //!< 2^-21
|
||||
const double TWO_N24 = (5.960464477539063e-008); //!< 2^-24
|
||||
const double TWO_N25 = (2.980232238769531e-008); //!< 2^-25
|
||||
const double TWO_N27 = (7.450580596923828e-009); //!< 2^-27
|
||||
const double TWO_N29 = (1.862645149230957e-009); //!< 2^-29
|
||||
const double TWO_N30 = (9.313225746154785e-010); //!< 2^-30
|
||||
const double TWO_N31 = (4.656612873077393e-010); //!< 2^-31
|
||||
const double TWO_N32 = (2.328306436538696e-010); //!< 2^-32
|
||||
const double TWO_N33 = (1.164153218269348e-010); //!< 2^-33
|
||||
const double TWO_N38 = (3.637978807091713e-012); //!< 2^-38
|
||||
const double TWO_N43 = (1.136868377216160e-013); //!< 2^-43
|
||||
const double TWO_N50 = (8.881784197001252e-016); //!< 2^-50
|
||||
const double TWO_N55 = (2.775557561562891e-017); //!< 2^-55
|
||||
|
||||
const double PI_TWO_N19 = (5.992112452678286e-006); //!< Pi*2^-19
|
||||
const double PI_TWO_N43 = (3.571577341960839e-013); //!< Pi*2^-43
|
||||
const double PI_TWO_N31 = (1.462918079267160e-009); //!< Pi*2^-31
|
||||
const double PI_TWO_N38 = (1.142904749427469e-011); //!< Pi*2^-38
|
||||
const double PI_TWO_N23 = (3.745070282923929e-007); //!< Pi*2^-23
|
||||
|
||||
|
||||
|
||||
// GPS NAVIGATION MESSAGE STRUCTURE
|
||||
|
@ -2,6 +2,8 @@
|
||||
* \file Galileo_E1.h
|
||||
* \brief Defines system parameters for Galileo E1 signal and NAV data
|
||||
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
* \author Mara Branzanti 2013. mara.branzanti(at)gmail.com
|
||||
* \author Javier Arribas 2013. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
@ -34,6 +36,9 @@
|
||||
#include <complex>
|
||||
#include <gnss_satellite.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility> // std::pair
|
||||
#include "MATH_CONSTANTS.h"
|
||||
|
||||
// carrier and code frequencies
|
||||
const double Galileo_E1_FREQ_HZ = 1.57542e9; //!< E1 [Hz]
|
||||
@ -43,8 +48,37 @@ const double Galileo_E1_SUB_CARRIER_A_RATE_HZ = 1.023e6; //!< Galileo E1 sub-car
|
||||
const double Galileo_E1_SUB_CARRIER_B_RATE_HZ = 6.138e6; //!< Galileo E1 sub-carrier 'b' rate [Hz]
|
||||
const double Galileo_E1_B_CODE_LENGTH_CHIPS = 4092.0; //!< Galileo E1-B code length [chips]
|
||||
const double Galileo_E1_B_SYMBOL_RATE_BPS = 250.0; //!< Galileo E1-B symbol rate [bits/second]
|
||||
|
||||
const int Galileo_E1_NUMBER_OF_CODES = 50;
|
||||
|
||||
// Galileo INAV Telemetry structure
|
||||
|
||||
#define GALILEO_INAV_PREAMBLE {0, 1, 0, 1, 1, 0, 0, 0, 0, 0}
|
||||
|
||||
const int GALILEO_INAV_PREAMBLE_LENGTH_BITS = 10;
|
||||
const int GALILEO_INAV_PREAMBLE_PERIOD_SYMBOLS = 250;
|
||||
const int GALILEO_INAV_PAGE_PART_SYMBOLS = 250; //!< Each Galileo INAV pages are composed of two parts (even and odd) each of 250 symbols, including preamble. See Galileo ICD 4.3.2
|
||||
const int GALILEO_INAV_PAGE_SYMBOLS = 500; //!< The complete Galileo INAV page length
|
||||
|
||||
const int GALILEO_INAV_INTERLEAVER_ROWS = 8;
|
||||
const int GALILEO_INAV_INTERLEAVER_COLS = 30;
|
||||
|
||||
const int GALILEO_PAGE_TYPE_BITS = 6;
|
||||
const int GALILEO_DATA_JK_BITS =128;
|
||||
|
||||
const std::vector<std::pair<int,int>> type({{1,6}});
|
||||
|
||||
/*Page 1*/
|
||||
const std::vector<std::pair<int,int>> PAGE_TYPE_bit({{1,6}});
|
||||
const std::vector<std::pair<int,int>> IOD_nav_page1({{7,10}});
|
||||
const std::vector<std::pair<int,int>> T0E_bit({{17,14}});
|
||||
const double t0e_LSB = 60;
|
||||
const std::vector<std::pair<int,int>> M0_bit({{31,32}});
|
||||
const double M0_LSB = TWO_N31;
|
||||
const std::vector<std::pair<int,int>> e_bit({{63,32}});
|
||||
const double e_LSB = TWO_N33;
|
||||
const std::vector<std::pair<int,int>> A_bit({{95,32}});
|
||||
const double A_LSB = TWO_N19;
|
||||
|
||||
// Galileo E1 primary codes
|
||||
|
||||
|
78
src/core/system_parameters/MATH_CONSTANTS.h
Normal file
78
src/core/system_parameters/MATH_CONSTANTS.h
Normal file
@ -0,0 +1,78 @@
|
||||
/*!
|
||||
* \file MATH_CONSTANTS.h
|
||||
* \brief Defines useful mathematical constants and their scaled versions
|
||||
* \author Javier Arribas, 2013. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2013 (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_MATH_CONSTANTS_H_
|
||||
#define GNSS_SDR_MATH_CONSTANTS_H_
|
||||
|
||||
/* Constants for scaling the ephemeris found in the data message
|
||||
the format is the following: TWO_N5 -> 2^-5, TWO_P4 -> 2^4, PI_TWO_N43 -> Pi*2^-43, etc etc
|
||||
Additionally some of the PI*2^N terms are used in the tracking stuff
|
||||
TWO_PX ==> 2^X
|
||||
TWO_NX ==> 2^-X
|
||||
PI_TWO_NX ==> Pi*2^-X
|
||||
PI_TWO_PX ==> Pi*2^X
|
||||
ONE_PI_TWO_PX = (1/Pi)*2^X
|
||||
*/
|
||||
const double TWO_P4 = (16); //!< 2^4
|
||||
const double TWO_P11 = (2048); //!< 2^11
|
||||
const double TWO_P12 = (4096); //!< 2^12
|
||||
const double TWO_P14 = (16384); //!< 2^14
|
||||
const double TWO_P16 = (65536); //!< 2^16
|
||||
const double TWO_P19 = (524288); //!< 2^19
|
||||
const double TWO_P31 = (2147483648.0); //!< 2^31
|
||||
const double TWO_P32 = (4294967296.0); //!< 2^32 this is too big for an int so add the x.0
|
||||
const double TWO_P56 = (7.205759403792794e+016); //!< 2^56
|
||||
const double TWO_P57 = (1.441151880758559e+017); //!< 2^57
|
||||
|
||||
const double TWO_N5 = (0.03125); //!< 2^-5
|
||||
const double TWO_N11 = (4.882812500000000e-004); //!< 2^-11
|
||||
const double TWO_N19 = (1.907348632812500e-006); //!< 2^-19
|
||||
const double TWO_N20 = (9.536743164062500e-007); //!< 2^-20
|
||||
const double TWO_N21 = (4.768371582031250e-007); //!< 2^-21
|
||||
const double TWO_N24 = (5.960464477539063e-008); //!< 2^-24
|
||||
const double TWO_N25 = (2.980232238769531e-008); //!< 2^-25
|
||||
const double TWO_N27 = (7.450580596923828e-009); //!< 2^-27
|
||||
const double TWO_N29 = (1.862645149230957e-009); //!< 2^-29
|
||||
const double TWO_N30 = (9.313225746154785e-010); //!< 2^-30
|
||||
const double TWO_N31 = (4.656612873077393e-010); //!< 2^-31
|
||||
const double TWO_N32 = (2.328306436538696e-010); //!< 2^-32
|
||||
const double TWO_N33 = (1.164153218269348e-010); //!< 2^-33
|
||||
const double TWO_N38 = (3.637978807091713e-012); //!< 2^-38
|
||||
const double TWO_N43 = (1.136868377216160e-013); //!< 2^-43
|
||||
const double TWO_N50 = (8.881784197001252e-016); //!< 2^-50
|
||||
const double TWO_N55 = (2.775557561562891e-017); //!< 2^-55
|
||||
|
||||
const double PI_TWO_N19 = (5.992112452678286e-006); //!< Pi*2^-19
|
||||
const double PI_TWO_N43 = (3.571577341960839e-013); //!< Pi*2^-43
|
||||
const double PI_TWO_N31 = (1.462918079267160e-009); //!< Pi*2^-31
|
||||
const double PI_TWO_N38 = (1.142904749427469e-011); //!< Pi*2^-38
|
||||
const double PI_TWO_N23 = (3.745070282923929e-007); //!< Pi*2^-23
|
||||
|
||||
#endif /* GNSS_SDR_MATH_CONSTANTS_H_ */
|
36
src/core/system_parameters/galileo_almanac.cc
Normal file
36
src/core/system_parameters/galileo_almanac.cc
Normal file
@ -0,0 +1,36 @@
|
||||
/*!
|
||||
* \file gps_almanac.cc
|
||||
* \brief Interface of a GPS ALMANAC storage
|
||||
*
|
||||
* See http://www.gps.gov/technical/icwg/IS-GPS-200E.pdf Appendix II
|
||||
* \author Javier Arribas, 2013. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2013 (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/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "galileo_almanac.h"
|
||||
|
||||
Galileo_Almanac::Galileo_Almanac() {}
|
||||
|
69
src/core/system_parameters/galileo_almanac.h
Normal file
69
src/core/system_parameters/galileo_almanac.h
Normal file
@ -0,0 +1,69 @@
|
||||
/*!
|
||||
* \file gps_almanac.h
|
||||
* \brief Interface of a GPS ALMANAC storage
|
||||
* \author Javier Arribas, 2013. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2013 (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/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* ToDo: rewrite the class Galileo Almanac (actually it is just a Gps Almanac copy!). Update also the in-line documentation!
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_GALILEO_ALMANAC_H_
|
||||
#define GNSS_SDR_GALILEO_ALMANAC_H_
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class is a storage for the GPS SV ALMANAC data as described in IS-GPS-200E
|
||||
*
|
||||
* See http://www.gps.gov/technical/icwg/IS-GPS-200E.pdf Appendix II
|
||||
*/
|
||||
/*
|
||||
* ToDo: Rewrite the class to include all the parameters described in Galileo ICD (this is just a copy of GPS code!)
|
||||
*/
|
||||
class Galileo_Almanac
|
||||
{
|
||||
public:
|
||||
unsigned int i_satellite_PRN; //!< SV PRN NUMBER
|
||||
double d_Delta_i;
|
||||
double d_Toa; //!< Almanac data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s]
|
||||
double d_M_0; //!< Mean Anomaly at Reference Time [semi-circles]
|
||||
double d_e_eccentricity; //!< Eccentricity [dimensionless]
|
||||
double d_sqrt_A; //!< Square Root of the Semi-Major Axis [sqrt(m)]
|
||||
double d_OMEGA0; //!< Longitude of Ascending Node of Orbit Plane at Weekly Epoch [semi-circles]
|
||||
double d_OMEGA; //!< Argument of Perigee [semi-cicles]
|
||||
double d_OMEGA_DOT; //!< Rate of Right Ascension [semi-circles/s]
|
||||
int i_SV_health; // SV Health
|
||||
double d_A_f0; //!< Coefficient 0 of code phase offset model [s]
|
||||
double d_A_f1; //!< Coefficient 1 of code phase offset model [s/s]
|
||||
|
||||
/*!
|
||||
* Default constructor
|
||||
*/
|
||||
Galileo_Almanac();
|
||||
};
|
||||
|
||||
#endif
|
95
src/core/system_parameters/galileo_ephemeris.cc
Normal file
95
src/core/system_parameters/galileo_ephemeris.cc
Normal file
@ -0,0 +1,95 @@
|
||||
/*!
|
||||
* \file gps_ephemeris.cc
|
||||
* \brief Interface of a GPS EPHEMERIS storage and orbital model functions
|
||||
*
|
||||
* See http://www.gps.gov/technical/icwg/IS-GPS-200E.pdf Appendix II
|
||||
* \author Javier Arribas, 2013. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2013 (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/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "galileo_ephemeris.h"
|
||||
|
||||
Galileo_Ephemeris::Galileo_Ephemeris()
|
||||
{
|
||||
i_satellite_PRN = 0;
|
||||
d_TOW = 0;
|
||||
d_Crs = 0;
|
||||
d_Delta_n = 0;
|
||||
d_M_0 = 0;
|
||||
d_Cuc = 0;
|
||||
d_e_eccentricity = 0;
|
||||
d_Cus = 0;
|
||||
d_sqrt_A = 0;
|
||||
d_Toe = 0;
|
||||
d_Toc = 0;
|
||||
d_Cic = 0;
|
||||
d_OMEGA0 = 0;
|
||||
d_Cis = 0;
|
||||
d_i_0 = 0;
|
||||
d_Crc = 0;
|
||||
d_OMEGA = 0;
|
||||
d_OMEGA_DOT = 0;
|
||||
d_IDOT = 0;
|
||||
i_code_on_L2 = 0;
|
||||
i_GPS_week = 0;
|
||||
b_L2_P_data_flag = false;
|
||||
i_SV_accuracy = 0;
|
||||
i_SV_health = 0;
|
||||
d_TGD = 0; //!< Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s]
|
||||
d_IODC = 0; //!< Issue of Data, Clock
|
||||
i_AODO = 0; //!< Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s]
|
||||
|
||||
b_fit_interval_flag = false;//!< indicates the curve-fit interval used by the CS (Block II/IIA/IIR/IIR-M/IIF) and SS (Block IIIA) in determining the ephemeris parameters, as follows: 0 = 4 hours, 1 = greater than 4 hours.
|
||||
d_spare1 = 0;
|
||||
d_spare2 = 0;
|
||||
|
||||
d_A_f0 = 0; //!< Coefficient 0 of code phase offset model [s]
|
||||
d_A_f1 = 0; //!< Coefficient 1 of code phase offset model [s/s]
|
||||
d_A_f2 = 0; //!< Coefficient 2 of code phase offset model [s/s^2]
|
||||
|
||||
b_integrity_status_flag = false;
|
||||
b_alert_flag = false; //!< If true, indicates that the SV URA may be worse than indicated in d_SV_accuracy, use that SV at our own risk.
|
||||
b_antispoofing_flag = false; //!< If true, the AntiSpoofing mode is ON in that SV
|
||||
|
||||
}
|
||||
|
||||
void Galileo_Ephemeris::satellitePosition(double transmitTime)
|
||||
{
|
||||
/*
|
||||
* ToDo: Compute satellite position at transmit Time
|
||||
*/
|
||||
|
||||
// --- Compute satellite coordinates in Earth-fixed coordinates
|
||||
d_satpos_X = 0;
|
||||
d_satpos_Y = 0;
|
||||
d_satpos_Z = 0;
|
||||
|
||||
// Satellite's velocity.
|
||||
|
||||
d_satvel_X =0;
|
||||
d_satvel_Y = 0;
|
||||
d_satvel_Z = 0;
|
||||
}
|
176
src/core/system_parameters/galileo_ephemeris.h
Normal file
176
src/core/system_parameters/galileo_ephemeris.h
Normal file
@ -0,0 +1,176 @@
|
||||
/*!
|
||||
* \file gps_navigation_message.h
|
||||
* \brief Interface of a GPS EPHEMERIS storage
|
||||
* \author Javier Arribas, 2013. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2013 (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_GALILEO_EPHEMERIS_H_
|
||||
#define GNSS_SDR_GALILEO_EPHEMERIS_H_
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include "boost/assign.hpp"
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class is a storage and orbital model functions for the Galileo SV ephemeris data as described in Galileo ICD
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* ToDo: Rewrite the class to include all the parameters described in Galileo ICD (this is just a copy of GPS ephemeris!)
|
||||
*/
|
||||
class Galileo_Ephemeris
|
||||
{
|
||||
private:
|
||||
|
||||
public:
|
||||
|
||||
unsigned int i_satellite_PRN; // SV PRN NUMBER
|
||||
double d_TOW; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s]
|
||||
double d_Crs; //!< Amplitude of the Sine Harmonic Correction Term to the Orbit Radius [m]
|
||||
double d_Delta_n; //!< Mean Motion Difference From Computed Value [semi-circles/s]
|
||||
double d_M_0; //!< Mean Anomaly at Reference Time [semi-circles]
|
||||
double d_Cuc; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
|
||||
double d_e_eccentricity; //!< Eccentricity [dimensionless]
|
||||
double d_Cus; //!< Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude [rad]
|
||||
double d_sqrt_A; //!< Square Root of the Semi-Major Axis [sqrt(m)]
|
||||
double d_Toe; //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s]
|
||||
double d_Toc; //!< clock data reference time (Ref. 20.3.3.3.3.1 IS-GPS-200E) [s]
|
||||
double d_Cic; //!< Amplitude of the Cosine Harmonic Correction Term to the Angle of Inclination [rad]
|
||||
double d_OMEGA0; //!< Longitude of Ascending Node of Orbit Plane at Weekly Epoch [semi-circles]
|
||||
double d_Cis; //!< Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination [rad]
|
||||
double d_i_0; //!< Inclination Angle at Reference Time [semi-circles]
|
||||
double d_Crc; //!< Amplitude of the Cosine Harmonic Correction Term to the Orbit Radius [m]
|
||||
double d_OMEGA; //!< Argument of Perigee [semi-cicles]
|
||||
double d_OMEGA_DOT; //!< Rate of Right Ascension [semi-circles/s]
|
||||
double d_IDOT; //!< Rate of Inclination Angle [semi-circles/s]
|
||||
int i_code_on_L2; //!< If 1, P code ON in L2; if 2, C/A code ON in L2;
|
||||
int i_GPS_week; //!< GPS week number, aka WN [week]
|
||||
bool b_L2_P_data_flag; //!< When true, indicates that the NAV data stream was commanded OFF on the P-code of the L2 channel
|
||||
int i_SV_accuracy; //!< User Range Accuracy (URA) index of the SV (reference paragraph 6.2.1) for the standard positioning service user (Ref 20.3.3.3.1.3 IS-GPS-200E)
|
||||
int i_SV_health;
|
||||
double d_TGD; //!< Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s]
|
||||
double d_IODC; //!< Issue of Data, Clock
|
||||
int i_AODO; //!< Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s]
|
||||
|
||||
bool b_fit_interval_flag;//!< indicates the curve-fit interval used by the CS (Block II/IIA/IIR/IIR-M/IIF) and SS (Block IIIA) in determining the ephemeris parameters, as follows: 0 = 4 hours, 1 = greater than 4 hours.
|
||||
double d_spare1;
|
||||
double d_spare2;
|
||||
|
||||
double d_A_f0; //!< Coefficient 0 of code phase offset model [s]
|
||||
double d_A_f1; //!< Coefficient 1 of code phase offset model [s/s]
|
||||
double d_A_f2; //!< Coefficient 2 of code phase offset model [s/s^2]
|
||||
|
||||
|
||||
// Flags
|
||||
|
||||
bool b_integrity_status_flag;
|
||||
bool b_alert_flag; //!< If true, indicates that the SV URA may be worse than indicated in d_SV_accuracy, use that SV at our own risk.
|
||||
bool b_antispoofing_flag; //!< If true, the AntiSpoofing mode is ON in that SV
|
||||
|
||||
// clock terms derived from ephemeris data
|
||||
double d_satClkDrift; // GPS clock error
|
||||
double d_dtr; // relativistic clock correction term
|
||||
|
||||
// satellite positions
|
||||
double d_satpos_X; //!< Earth-fixed coordinate x of the satellite [m]. Intersection of the IERS Reference Meridian (IRM) and the plane passing through the origin and normal to the Z-axis.
|
||||
double d_satpos_Y; //!< Earth-fixed coordinate y of the satellite [m]. Completes a right-handed, Earth-Centered, Earth-Fixed orthogonal coordinate system.
|
||||
double d_satpos_Z; //!< Earth-fixed coordinate z of the satellite [m]. The direction of the IERS (International Earth Rotation and Reference Systems Service) Reference Pole (IRP).
|
||||
|
||||
// Satellite velocity
|
||||
double d_satvel_X; //!< Earth-fixed velocity coordinate x of the satellite [m]
|
||||
double d_satvel_Y; //!< Earth-fixed velocity coordinate y of the satellite [m]
|
||||
double d_satvel_Z; //!< Earth-fixed velocity coordinate z of the satellite [m]
|
||||
|
||||
|
||||
std::map<int,std::string> satelliteBlock; //!< Map that stores to which block the PRN belongs http://www.navcen.uscg.gov/?Do=constellationStatus
|
||||
|
||||
|
||||
template<class Archive>
|
||||
/*
|
||||
* \brief Serialize is a boost standard method to be called by the boost XML serialization. Here is used to save the ephemeris data on disk file.
|
||||
*/
|
||||
void serialize(Archive& archive, const unsigned int version)
|
||||
{
|
||||
using boost::serialization::make_nvp;
|
||||
|
||||
archive & make_nvp("i_satellite_PRN",i_satellite_PRN); // SV PRN NUMBER
|
||||
archive & make_nvp("d_TOW",d_TOW); //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s]
|
||||
archive & make_nvp("d_Crs",d_Crs); //!< Amplitude of the Sine Harmonic Correction Term to the Orbit Radius [m]
|
||||
archive & make_nvp("d_Delta_n",d_Delta_n); //!< Mean Motion Difference From Computed Value [semi-circles/s]
|
||||
archive & make_nvp("d_M_0",d_M_0); //!< Mean Anomaly at Reference Time [semi-circles]
|
||||
archive & make_nvp("d_Cuc",d_Cuc); //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
|
||||
archive & make_nvp("d_e_eccentricity",d_e_eccentricity); //!< Eccentricity [dimensionless]
|
||||
archive & make_nvp("d_Cus",d_Cus); //!< Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude [rad]
|
||||
archive & make_nvp("d_sqrt_A",d_sqrt_A); //!< Square Root of the Semi-Major Axis [sqrt(m)]
|
||||
archive & make_nvp("d_Toe",d_Toe); //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s]
|
||||
archive & make_nvp("d_Toc",d_Toe); //!< clock data reference time (Ref. 20.3.3.3.3.1 IS-GPS-200E) [s]
|
||||
archive & make_nvp("d_Cic",d_Cic); //!< Amplitude of the Cosine Harmonic Correction Term to the Angle of Inclination [rad]
|
||||
archive & make_nvp("d_OMEGA0",d_OMEGA0); //!< Longitude of Ascending Node of Orbit Plane at Weekly Epoch [semi-circles]
|
||||
archive & make_nvp("d_Cis",d_Cis); //!< Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination [rad]
|
||||
archive & make_nvp("d_i_0",d_i_0); //!< Inclination Angle at Reference Time [semi-circles]
|
||||
archive & make_nvp("d_Crc",d_Crc); //!< Amplitude of the Cosine Harmonic Correction Term to the Orbit Radius [m]
|
||||
archive & make_nvp("d_OMEGA",d_OMEGA); //!< Argument of Perigee [semi-cicles]
|
||||
archive & make_nvp("d_OMEGA_DOT",d_OMEGA_DOT); //!< Rate of Right Ascension [semi-circles/s]
|
||||
archive & make_nvp("d_IDOT",d_IDOT); //!< Rate of Inclination Angle [semi-circles/s]
|
||||
archive & make_nvp("i_code_on_L2",i_code_on_L2); //!< If 1, P code ON in L2; if 2, C/A code ON in L2;
|
||||
archive & make_nvp("i_GPS_week",i_GPS_week); //!< GPS week number, aka WN [week]
|
||||
archive & make_nvp("b_L2_P_data_flag",b_L2_P_data_flag); //!< When true, indicates that the NAV data stream was commanded OFF on the P-code of the L2 channel
|
||||
archive & make_nvp("i_SV_accuracy",i_SV_accuracy); //!< User Range Accuracy (URA) index of the SV (reference paragraph 6.2.1) for the standard positioning service user (Ref 20.3.3.3.1.3 IS-GPS-200E)
|
||||
archive & make_nvp("i_SV_health",i_SV_health);
|
||||
archive & make_nvp("d_TGD",d_TGD); //!< Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s]
|
||||
archive & make_nvp("d_IODC",d_IODC); //!< Issue of Data, Clock
|
||||
archive & make_nvp("i_AODO",i_AODO); //!< Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s]
|
||||
|
||||
archive & make_nvp("b_fit_interval_flag",b_fit_interval_flag);//!< indicates the curve-fit interval used by the CS (Block II/IIA/IIR/IIR-M/IIF) and SS (Block IIIA) in determining the ephemeris parameters, as follows: 0 = 4 hours, 1 = greater than 4 hours.
|
||||
archive & make_nvp("d_spare1",d_spare1);
|
||||
archive & make_nvp("d_spare2",d_spare2);
|
||||
|
||||
archive & make_nvp("d_A_f0",d_A_f0); //!< Coefficient 0 of code phase offset model [s]
|
||||
archive & make_nvp("d_A_f1",d_A_f1); //!< Coefficient 1 of code phase offset model [s/s]
|
||||
archive & make_nvp("d_A_f2",d_A_f2); //!< Coefficient 2 of code phase offset model [s/s^2]
|
||||
|
||||
archive & make_nvp("b_integrity_status_flag",b_integrity_status_flag);
|
||||
archive & make_nvp("b_alert_flag",b_alert_flag); //!< If true, indicates that the SV URA may be worse than indicated in d_SV_accuracy, use that SV at our own risk.
|
||||
archive & make_nvp("b_antispoofing_flag",b_antispoofing_flag); //!< If true, the AntiSpoofing mode is ON in that SV
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Compute the ECEF SV coordinates and ECEF velocity
|
||||
* [Insert here the reference in Galileo ICD]
|
||||
*/
|
||||
void satellitePosition(double transmitTime);
|
||||
|
||||
/*!
|
||||
* Default constructor
|
||||
*/
|
||||
Galileo_Ephemeris();
|
||||
};
|
||||
|
||||
#endif
|
40
src/core/system_parameters/galileo_iono.cc
Normal file
40
src/core/system_parameters/galileo_iono.cc
Normal file
@ -0,0 +1,40 @@
|
||||
/*!
|
||||
* \file gps_iono.cc
|
||||
* \brief Interface of a GPS IONOSPHERIC MODEL storage
|
||||
*
|
||||
* See http://www.gps.gov/technical/icwg/IS-GPS-200E.pdf Appendix II
|
||||
* \author Javier Arribas, 2013. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2013 (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/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "galileo_iono.h"
|
||||
|
||||
Galileo_Iono::Galileo_Iono()
|
||||
{
|
||||
valid = false;
|
||||
|
||||
}
|
||||
|
67
src/core/system_parameters/galileo_iono.h
Normal file
67
src/core/system_parameters/galileo_iono.h
Normal file
@ -0,0 +1,67 @@
|
||||
/*!
|
||||
* \file gps_iono.h
|
||||
* \brief Interface of a GPS IONOSPHERIC MODEL storage
|
||||
* \author Javier Arribas, 2013. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2013 (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_GALILEO_IONO_H_
|
||||
#define GNSS_SDR_GALILEO_IONO_H_
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class is a storage for the GALILEO IONOSPHERIC data as described in Galileo ICD
|
||||
*
|
||||
* See [Update ref]
|
||||
*/
|
||||
|
||||
/*
|
||||
* ToDo: Rewrite the class to include all the parameters described in Galileo ICD (this is just a copy of GPS code!)
|
||||
*/
|
||||
class Galileo_Iono
|
||||
{
|
||||
private:
|
||||
|
||||
public:
|
||||
// valid flag
|
||||
bool valid;
|
||||
// Ionospheric parameters
|
||||
double d_alpha0; //!< Coefficient 0 of a cubic equation representing the amplitude of the vertical delay [s]
|
||||
double d_alpha1; //!< Coefficient 1 of a cubic equation representing the amplitude of the vertical delay [s/semi-circle]
|
||||
double d_alpha2; //!< Coefficient 2 of a cubic equation representing the amplitude of the vertical delay [s(semi-circle)^2]
|
||||
double d_alpha3; //!< Coefficient 3 of a cubic equation representing the amplitude of the vertical delay [s(semi-circle)^3]
|
||||
double d_beta0; //!< Coefficient 0 of a cubic equation representing the period of the model [s]
|
||||
double d_beta1; //!< Coefficient 1 of a cubic equation representing the period of the model [s/semi-circle]
|
||||
double d_beta2; //!< Coefficient 2 of a cubic equation representing the period of the model [s(semi-circle)^2]
|
||||
double d_beta3; //!< Coefficient 3 of a cubic equation representing the period of the model [s(semi-circle)^3]
|
||||
/*!
|
||||
* Default constructor
|
||||
*/
|
||||
Galileo_Iono();
|
||||
};
|
||||
|
||||
#endif
|
703
src/core/system_parameters/galileo_navigation_message.cc
Normal file
703
src/core/system_parameters/galileo_navigation_message.cc
Normal file
@ -0,0 +1,703 @@
|
||||
/*!
|
||||
* \file Galileo_Navigation_Message.cc
|
||||
* \brief Implementation of a Galileo NAV Data message decoder as described in Galileo ICD
|
||||
* \author Mara Branzanti 2013. mara.branzanti(at)gmail.com
|
||||
* \author Javier Arribas, 2013. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2013 (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/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "galileo_navigation_message.h"
|
||||
#include "boost/date_time/posix_time/posix_time.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
void Galileo_Navigation_Message::reset()
|
||||
{
|
||||
|
||||
/*Word type 1: Ephemeris (1/4)*/
|
||||
IOD_nav_1 = 0;
|
||||
t0e = 0;
|
||||
M0 = 0;
|
||||
e = 0;
|
||||
A = 0;
|
||||
|
||||
/*d_TOW_SF1 = 0;
|
||||
d_TOW_SF2 = 0;
|
||||
d_TOW_SF3 = 0;
|
||||
d_TOW_SF4 = 0;
|
||||
d_TOW_SF5 = 0;
|
||||
|
||||
d_IODE_SF2 = 0;
|
||||
d_IODE_SF3 = 0;
|
||||
d_Crs = 0;
|
||||
d_Delta_n = 0;
|
||||
d_M_0 = 0;
|
||||
d_Cuc = 0;
|
||||
d_e_eccentricity = 0;
|
||||
d_Cus = 0;
|
||||
d_sqrt_A = 0;
|
||||
d_Toe = 0;
|
||||
d_Toc = 0;
|
||||
d_Cic = 0;
|
||||
d_OMEGA0 = 0;
|
||||
d_Cis = 0;
|
||||
d_i_0 = 0;
|
||||
d_Crc = 0;
|
||||
d_OMEGA = 0;
|
||||
d_OMEGA_DOT = 0;
|
||||
d_IDOT = 0;
|
||||
i_code_on_L2 = 0;
|
||||
i_GPS_week = 0;
|
||||
b_L2_P_data_flag = false;
|
||||
i_SV_accuracy = 0;
|
||||
i_SV_health = 0;
|
||||
d_TGD = 0;
|
||||
d_IODC = -1;
|
||||
i_AODO = 0;
|
||||
|
||||
b_fit_interval_flag = false;
|
||||
d_spare1 = 0;
|
||||
d_spare2 = 0;
|
||||
|
||||
d_A_f0 = 0;
|
||||
d_A_f1 = 0;
|
||||
d_A_f2 = 0;
|
||||
|
||||
//clock terms
|
||||
//d_master_clock=0;
|
||||
d_dtr = 0;
|
||||
d_satClkCorr = 0;
|
||||
|
||||
// satellite positions
|
||||
d_satpos_X = 0;
|
||||
d_satpos_Y = 0;
|
||||
d_satpos_Z = 0;
|
||||
|
||||
// info
|
||||
i_channel_ID = 0;
|
||||
i_satellite_PRN = 0;
|
||||
|
||||
// time synchro
|
||||
d_subframe_timestamp_ms = 0;
|
||||
|
||||
// flags
|
||||
b_alert_flag = false;
|
||||
b_integrity_status_flag = false;
|
||||
b_antispoofing_flag = false;
|
||||
|
||||
// Ionosphere and UTC
|
||||
flag_iono_valid = false;
|
||||
flag_utc_model_valid = true;
|
||||
d_alpha0 = 0;
|
||||
d_alpha1 = 0;
|
||||
d_alpha2 = 0;
|
||||
d_alpha3 = 0;
|
||||
d_beta0 = 0;
|
||||
d_beta1 = 0;
|
||||
d_beta2 = 0;
|
||||
d_beta3 = 0;
|
||||
d_A1 = 0;
|
||||
d_A0 = 0;
|
||||
d_t_OT = 0;
|
||||
i_WN_T = 0;
|
||||
d_DeltaT_LS = 0;
|
||||
i_WN_LSF = 0;
|
||||
i_DN = 0;
|
||||
d_DeltaT_LSF= 0;
|
||||
|
||||
//Almanac
|
||||
d_Toa = 0;
|
||||
i_WN_A = 0;
|
||||
for (int i=1; i < 32; i++ )
|
||||
{
|
||||
almanacHealth[i] = 0;
|
||||
}
|
||||
|
||||
// Satellite velocity
|
||||
d_satvel_X = 0;
|
||||
d_satvel_Y = 0;
|
||||
d_satvel_Z = 0;
|
||||
|
||||
//Plane A (info from http://www.navcen.uscg.gov/?Do=constellationStatus)
|
||||
satelliteBlock[9] = "IIA";
|
||||
satelliteBlock[31] = "IIR-M";
|
||||
satelliteBlock[8] = "IIA";
|
||||
satelliteBlock[7] = "IIR-M";
|
||||
satelliteBlock[27] = "IIA";
|
||||
//Plane B
|
||||
satelliteBlock[16] = "IIR";
|
||||
satelliteBlock[25] = "IIF";
|
||||
satelliteBlock[28] = "IIR";
|
||||
satelliteBlock[12] = "IIR-M";
|
||||
satelliteBlock[30] = "IIA";
|
||||
//Plane C
|
||||
satelliteBlock[29] = "IIR-M";
|
||||
satelliteBlock[3] = "IIA";
|
||||
satelliteBlock[19] = "IIR";
|
||||
satelliteBlock[17] = "IIR-M";
|
||||
satelliteBlock[6] = "IIA";
|
||||
//Plane D
|
||||
satelliteBlock[2] = "IIR";
|
||||
satelliteBlock[1] = "IIF";
|
||||
satelliteBlock[21] = "IIR";
|
||||
satelliteBlock[4] = "IIA";
|
||||
satelliteBlock[11] = "IIR";
|
||||
satelliteBlock[24] = "IIA"; // Decommissioned from active service on 04 Nov 2011
|
||||
//Plane E
|
||||
satelliteBlock[20] = "IIR";
|
||||
satelliteBlock[22] = "IIR";
|
||||
satelliteBlock[5] = "IIR-M";
|
||||
satelliteBlock[18] = "IIR";
|
||||
satelliteBlock[32] = "IIA";
|
||||
satelliteBlock[10] = "IIA";
|
||||
//Plane F
|
||||
satelliteBlock[14] = "IIR";
|
||||
satelliteBlock[15] = "IIR-M";
|
||||
satelliteBlock[13] = "IIR";
|
||||
satelliteBlock[23] = "IIR";
|
||||
satelliteBlock[26] = "IIA";*/
|
||||
}
|
||||
|
||||
|
||||
Galileo_Navigation_Message::Galileo_Navigation_Message()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
unsigned long int Galileo_Navigation_Message::read_navigation_unsigned(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int,int> > parameter)
|
||||
{
|
||||
unsigned long int value = 0;
|
||||
int num_of_slices = parameter.size();
|
||||
for (int i=0; i<num_of_slices; i++)
|
||||
{
|
||||
for (int j=0; j<parameter[i].second; j++)
|
||||
{
|
||||
value <<= 1; //shift left
|
||||
if (bits[GALILEO_DATA_JK_BITS - parameter[i].first - j] == 1)
|
||||
{
|
||||
value += 1; // insert the bit
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned long int Galileo_Navigation_Message::read_page_type_unsigned(std::bitset<GALILEO_PAGE_TYPE_BITS> bits, const std::vector<std::pair<int,int> > parameter)
|
||||
{
|
||||
unsigned long int value = 0;
|
||||
int num_of_slices = parameter.size();
|
||||
for (int i=0; i<num_of_slices; i++)
|
||||
{
|
||||
for (int j=0; j<parameter[i].second; j++)
|
||||
{
|
||||
value <<= 1; //shift left
|
||||
if (bits[GALILEO_PAGE_TYPE_BITS - parameter[i].first - j] == 1)
|
||||
{
|
||||
value += 1; // insert the bit
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*signed long int Galileo_Navigation_Message::read_navigation_signed(std::bitset<GALILEO_SUBFRAME_BITS> bits, const std::vector<std::pair<int,int> > parameter)
|
||||
{
|
||||
signed long int value = 0;
|
||||
int num_of_slices = parameter.size();
|
||||
// Discriminate between 64 bits and 32 bits compiler
|
||||
int long_int_size_bytes = sizeof(signed long int);
|
||||
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[GALILEO_SUBFRAME_BITS - parameter[0].first] == 1)
|
||||
{
|
||||
value ^= 0xFFFFFFFFFFFFFFFF; //64 bits variable
|
||||
}
|
||||
else
|
||||
{
|
||||
value &= 0;
|
||||
}
|
||||
|
||||
for (int i=0; i<num_of_slices; i++)
|
||||
{
|
||||
for (int j=0; j<parameter[i].second; j++)
|
||||
{
|
||||
value <<= 1; //shift left
|
||||
value &= 0xFFFFFFFFFFFFFFFE; //reset the corresponding bit (for the 64 bits variable)
|
||||
if (bits[GALILEO_SUBFRAME_BITS - parameter[i].first - j] == 1)
|
||||
{
|
||||
value += 1; // insert the bit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // we assume we are in a 32 bits system
|
||||
{
|
||||
// read the MSB and perform the sign extension
|
||||
if (bits[GALILEO_SUBFRAME_BITS - parameter[0].first] == 1)
|
||||
{
|
||||
value ^= 0xFFFFFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
value &= 0;
|
||||
}
|
||||
|
||||
for (int i=0; i<num_of_slices; i++)
|
||||
{
|
||||
for (int j=0; j<parameter[i].second; j++)
|
||||
{
|
||||
value <<= 1; //shift left
|
||||
value &= 0xFFFFFFFE; //reset the corresponding bit
|
||||
if (bits[GALILEO_SUBFRAME_BITS - parameter[i].first - j] == 1)
|
||||
{
|
||||
value += 1; // insert the bit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}*/
|
||||
|
||||
/*bool Galileo_Navigation_Message::read_navigation_bool(std::bitset<GALILEO_SUBFRAME_BITS> bits, const std::vector<std::pair<int,int> > parameter)
|
||||
{
|
||||
bool value;
|
||||
|
||||
if (bits[GALILEO_SUBFRAME_BITS - parameter[0].first] == 1)
|
||||
{
|
||||
value = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = false;
|
||||
}
|
||||
return value;
|
||||
}*/
|
||||
|
||||
|
||||
/*void Galileo_Navigation_Message::print_galileo_word_bytes(unsigned int GPS_word)
|
||||
{
|
||||
std::cout << " Word =";
|
||||
std::cout << std::bitset<32>(GPS_word);
|
||||
std::cout << std::endl;
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
void Galileo_Navigation_Message::split_page(char *page){
|
||||
cout << "--------------------------------------------------------------------------" << endl;
|
||||
cout << "Entered in Galileo_Navigation_Message::split_page(char *page)" << endl << endl;;
|
||||
|
||||
char Even_bit[2]={'\0'}, Odd_bit[2]={'\0'}, Page_type_Odd[2]={'\0'}, Page_type_even[2]={'\0'}, tail_Even[7]={'\0'}; //HO DATO A TUTTI UNO SPAZIO IN PIÙ PER L'ULTIMO CARATTERE
|
||||
char page_Odd[121]={'\0'}, page_INAV[235]={'\0'};
|
||||
char Data_j[16]={'\0'}, Data_k[112]={'\0'}, page_number_bits[6]={'\0'};
|
||||
char Data_jk_ephemeris[128]={'\0'};
|
||||
char Reserved_1[40]={'\0'};
|
||||
char SAR[22]={'\0'};
|
||||
char Spare[2]={'\0'};
|
||||
char CRC_data[24]={'\0'};
|
||||
char Reserved_2[8]={'\0'};
|
||||
char Tail_odd[6]={'\0'};
|
||||
char correct_tail[7]="000000";
|
||||
int flag_even_word_arrived=1; /*******************REMEMBER TO CHANGE flag_even_word_arrived=0 *****+**********/
|
||||
int Page_type=0;
|
||||
|
||||
/* Test to decode page 1 even joined to its corresponding
|
||||
The Even pages given here are without their tails bits*/
|
||||
char page_Even[115]="000000010001011111010111101101100111110110101110101111100011001000000000001101110101110010000100101010100000010011";
|
||||
//test to detect page 3------> char page_Even[115]="000000110001011111111111111100001001100110001000110001011111110011111100110001011000111110000011011111000011110000";
|
||||
//test to detect page 10-----> char page_Even[115]="000010101111101010101010101010101010101010101010101010101010101010101010101010101010111100000000000000000000000000";
|
||||
//test to detect page 5------> char page_Even[115]="000001010010000010000000100010000010111010100000011111110001111111000111111001011000110010110011111111110110000000";
|
||||
//test to detect page 2------> char page_Even[115]="000000100001011111110010111010111100000010111100000010011100000000100001011110100111000111100111000000100000000010";
|
||||
|
||||
|
||||
cout << "Start decoding Galileo I/NAV " << endl;
|
||||
|
||||
if(page[0]=='1') // if page is odd
|
||||
{
|
||||
strcpy(page_Odd, page);
|
||||
//cout << "Page Odd " << endl << page_Odd<< endl;
|
||||
|
||||
if (flag_even_word_arrived==1) //to test the function and satisfy this condition the flag is INITIALIZED AT 1
|
||||
{
|
||||
|
||||
strncpy(page_INAV, page_Even, 114); //Join pages: Even+Odd=INAV page
|
||||
strncat(page_INAV, page_Odd,120);
|
||||
|
||||
//cout << "Page INAV Even+Odd " << endl << page_INAV << endl;
|
||||
|
||||
strncpy(Even_bit, &page_INAV[0], 1);
|
||||
//cout << "Even bit = " << Even_bit << endl;
|
||||
strncpy(Page_type_even, &page_INAV[1], 1);
|
||||
//cout << "Page type even = " << Page_type_even << endl;
|
||||
|
||||
if(atoi(Page_type_even)==1) cout << "Alert frame "<< endl;
|
||||
else cout << "Nominal Page" << endl;
|
||||
|
||||
strncpy(Data_k, &page_INAV[2], 112);
|
||||
//cout << "Data_k " << endl << Data_k << endl;
|
||||
|
||||
strncpy(Odd_bit, &page_INAV[114], 1);
|
||||
//cout << "Odd bit: " << Odd_bit << endl;
|
||||
strncpy(Page_type_Odd, &page_INAV[115], 1);
|
||||
//cout << "Page_type_Odd: " << Page_type_Odd << endl;
|
||||
strncpy(Data_j, &page_INAV[116], 16);
|
||||
//cout << "Data_j: " << endl << Data_j << endl;
|
||||
|
||||
strncpy(Reserved_1, &page_INAV[132], 40);
|
||||
strncpy(SAR, &page_INAV[172], 22);
|
||||
strncpy(Spare, &page_INAV[194], 2);
|
||||
strncpy(CRC_data, &page_INAV[196], 24);
|
||||
strncpy(Reserved_2, &page_INAV[220], 8);
|
||||
strncpy(Tail_odd, &page_INAV[228], 6);
|
||||
//cout << "tail odd: " << endl << Tail_odd << endl;
|
||||
if(strcmp (Tail_odd,correct_tail) != 0)
|
||||
cout << "Tail odd is not correct!" << endl;
|
||||
else cout<<"Tail odd is correct!"<<endl;
|
||||
|
||||
/************* CRC cycle control ***********/
|
||||
|
||||
strncpy(page_number_bits, &Data_k[0], 6);
|
||||
//cout << "Page number bits from Data k" << endl << page_number_bits << endl;
|
||||
|
||||
stringstream ss_page_number;
|
||||
string s_page_number;
|
||||
ss_page_number << page_number_bits; // from char to stringstream
|
||||
ss_page_number >> s_page_number; // from stringstream to string
|
||||
|
||||
std::bitset<GALILEO_PAGE_TYPE_BITS> page_type_bits (s_page_number); // from string to bitset
|
||||
|
||||
Page_type = (int)read_page_type_unsigned(page_type_bits, type);
|
||||
|
||||
cout << "Page number (first 6 bits of Data k converted to decimal) = " << Page_type << endl;
|
||||
|
||||
strncpy(Data_jk_ephemeris, Data_k, 112); // Join data_j + data_k = Data_jk_ephemeris;
|
||||
strncat(Data_jk_ephemeris, Data_j, 16); // Data_jk_ephemeris is the input for the function page decoder*/
|
||||
|
||||
//cout<<"Data j k ephemeris" << endl << Data_jk_ephemeris << endl;
|
||||
|
||||
page_jk_decoder(Data_jk_ephemeris); // Corresponding to ephemeris_decode.m in matlab code
|
||||
|
||||
flag_even_word_arrived=0;
|
||||
|
||||
}
|
||||
|
||||
} /*if(page[0]=='1') */
|
||||
|
||||
else{
|
||||
cout << "Page Even" << endl;
|
||||
strncpy(page_Even, &page[0], 114);
|
||||
//cout << page_Even << endl;
|
||||
strncpy(tail_Even, &page[114], 6);
|
||||
|
||||
if(strcmp (tail_Even,correct_tail) != 0)
|
||||
cout << "Tail even is not correct!" << endl;
|
||||
else cout<<"Tail even is correct!"<<endl;
|
||||
|
||||
flag_even_word_arrived=1;
|
||||
|
||||
}
|
||||
cout << "flag EVEN word arrived = " << flag_even_word_arrived << endl;
|
||||
cout << "--------------------------------------------------------------------------" << endl;
|
||||
}
|
||||
|
||||
|
||||
int Galileo_Navigation_Message::page_jk_decoder(char *data_jk)
|
||||
{
|
||||
cout << "--------------------------------------------------------------------------" << endl;
|
||||
cout<< "Entered in function Galileo_Navigation_Message::page_jk_decoder(char *data_jk)" << endl << endl;
|
||||
|
||||
int page_number = 0;
|
||||
|
||||
stringstream ss;
|
||||
string str;
|
||||
ss << data_jk;
|
||||
ss >> str;
|
||||
|
||||
std::bitset<GALILEO_DATA_JK_BITS> data_jk_bits (str);
|
||||
|
||||
//cout << "Data_jk_bits (bitset) "<< endl << data_jk_bits << endl;
|
||||
|
||||
page_number = (int)read_navigation_unsigned(data_jk_bits, PAGE_TYPE_bit);
|
||||
cout << "Page number (for the test it must return page 1) = " << page_number << endl;
|
||||
|
||||
switch (page_number)
|
||||
{
|
||||
case 1: /*Word type 1: Ephemeris (1/4)*/
|
||||
|
||||
IOD_nav_1=(int)read_navigation_unsigned(data_jk_bits, IOD_nav_page1);
|
||||
cout<<"IOD_nav_1= "<< IOD_nav_1 <<endl;
|
||||
|
||||
t0e=(double)read_navigation_unsigned(data_jk_bits, T0E_bit);
|
||||
t0e = t0e * t0e_LSB;
|
||||
cout << "t0e= " << t0e <<endl;
|
||||
|
||||
M0 = (double)read_navigation_unsigned(data_jk_bits, M0_bit);
|
||||
M0 = M0 * M0_LSB;
|
||||
cout << "M0= " << M0<<endl;
|
||||
|
||||
e = (double)read_navigation_unsigned(data_jk_bits, e_bit);
|
||||
e = e * e_LSB;
|
||||
cout << "e= " << e <<endl;
|
||||
|
||||
A = (double)read_navigation_unsigned(data_jk_bits, A_bit);
|
||||
A = A * A_LSB;
|
||||
cout << "A= " << A <<endl;
|
||||
}
|
||||
|
||||
|
||||
/*unsigned int gps_word;
|
||||
|
||||
// UNPACK BYTES TO BITS AND REMOVE THE CRC REDUNDANCE
|
||||
std::bitset<GALILEO_SUBFRAME_BITS> subframe_bits;
|
||||
std::bitset<GPS_WORD_BITS+2> word_bits;
|
||||
for (int i=0; i<10; i++)
|
||||
{
|
||||
memcpy(&gps_word, &subframe[i*4], sizeof(char)*4);
|
||||
word_bits = std::bitset<(GPS_WORD_BITS+2)>(gps_word);
|
||||
for (int j=0; j<GPS_WORD_BITS; j++)
|
||||
{
|
||||
subframe_bits[GPS_WORD_BITS*(9-i) + j] = word_bits[j];
|
||||
}
|
||||
}
|
||||
|
||||
subframe_ID = (int)read_navigation_unsigned(subframe_bits, SUBFRAME_ID);
|
||||
|
||||
// Decode all 5 sub-frames
|
||||
switch (subframe_ID)
|
||||
{
|
||||
//--- Decode the sub-frame id ------------------------------------------
|
||||
// ICD (IS-GPS-200E Appendix II). http://www.losangeles.af.mil/shared/media/document/AFD-100813-045.pdf
|
||||
case 1:
|
||||
//--- It is subframe 1 -------------------------------------
|
||||
// Compute the time of week (TOW) of the first sub-frames in the array ====
|
||||
// Also correct the TOW. The transmitted TOW is actual TOW of the next
|
||||
// subframe and we need the TOW of the first subframe in this data block
|
||||
// (the variable subframe at this point contains bits of the last subframe).
|
||||
//TOW = bin2dec(subframe(31:47)) * 6 - 30;
|
||||
d_TOW_SF1 = (double)read_navigation_unsigned(subframe_bits, TOW);
|
||||
//we are in the first subframe (the transmitted TOW is the start time of the next subframe) !
|
||||
d_TOW_SF1 = d_TOW_SF1*6;
|
||||
d_TOW = d_TOW_SF1 - 6; // Set transmission time
|
||||
b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG);
|
||||
b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG);
|
||||
b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG);
|
||||
i_GPS_week = (int)read_navigation_unsigned(subframe_bits, GPS_WEEK);
|
||||
i_SV_accuracy = (int)read_navigation_unsigned(subframe_bits, SV_ACCURACY); // (20.3.3.3.1.3)
|
||||
i_SV_health = (int)read_navigation_unsigned(subframe_bits, SV_HEALTH);
|
||||
b_L2_P_data_flag = read_navigation_bool(subframe_bits, L2_P_DATA_FLAG); //
|
||||
i_code_on_L2 = (int)read_navigation_unsigned(subframe_bits, CA_OR_P_ON_L2);
|
||||
d_TGD = (double)read_navigation_signed(subframe_bits, T_GD);
|
||||
d_TGD = d_TGD*T_GD_LSB;
|
||||
d_IODC = (double)read_navigation_unsigned(subframe_bits, IODC);
|
||||
d_Toc = (double)read_navigation_unsigned(subframe_bits, T_OC);
|
||||
d_Toc = d_Toc*T_OC_LSB;
|
||||
d_A_f0 = (double)read_navigation_signed(subframe_bits, A_F0);
|
||||
d_A_f0 = d_A_f0*A_F0_LSB;
|
||||
d_A_f1 = (double)read_navigation_signed(subframe_bits, A_F1);
|
||||
d_A_f1 = d_A_f1*A_F1_LSB;
|
||||
d_A_f2 = (double)read_navigation_signed(subframe_bits, A_F2);
|
||||
d_A_f2 = d_A_f2*A_F2_LSB;
|
||||
|
||||
break;
|
||||
|
||||
case 2: //--- It is subframe 2 -------------------
|
||||
d_TOW_SF2 = (double)read_navigation_unsigned(subframe_bits, TOW);
|
||||
d_TOW_SF2 = d_TOW_SF2*6;
|
||||
d_TOW = d_TOW_SF2 - 6; // Set transmission time
|
||||
b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG);
|
||||
b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG);
|
||||
b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG);
|
||||
d_IODE_SF2 = (double)read_navigation_unsigned(subframe_bits, IODE_SF2);
|
||||
d_Crs = (double)read_navigation_signed(subframe_bits, C_RS);
|
||||
d_Crs = d_Crs * C_RS_LSB;
|
||||
d_Delta_n = (double)read_navigation_signed(subframe_bits, DELTA_N);
|
||||
d_Delta_n = d_Delta_n * DELTA_N_LSB;
|
||||
d_M_0 = (double)read_navigation_signed(subframe_bits, M_0);
|
||||
d_M_0 = d_M_0 * M_0_LSB;
|
||||
d_Cuc = (double)read_navigation_signed(subframe_bits, C_UC);
|
||||
d_Cuc = d_Cuc * C_UC_LSB;
|
||||
d_e_eccentricity = (double)read_navigation_unsigned(subframe_bits, E);
|
||||
d_e_eccentricity = d_e_eccentricity * E_LSB;
|
||||
d_Cus = (double)read_navigation_signed(subframe_bits, C_US);
|
||||
d_Cus = d_Cus * C_US_LSB;
|
||||
d_sqrt_A = (double)read_navigation_unsigned(subframe_bits, SQRT_A);
|
||||
d_sqrt_A = d_sqrt_A * SQRT_A_LSB;
|
||||
d_Toe = (double)read_navigation_unsigned(subframe_bits, T_OE);
|
||||
d_Toe = d_Toe * T_OE_LSB;
|
||||
b_fit_interval_flag = read_navigation_bool(subframe_bits, FIT_INTERVAL_FLAG);
|
||||
i_AODO = (int)read_navigation_unsigned(subframe_bits, AODO);
|
||||
i_AODO = i_AODO * AODO_LSB;
|
||||
|
||||
break;
|
||||
|
||||
case 3: // --- It is subframe 3 -------------------------------------
|
||||
d_TOW_SF3 = (double)read_navigation_unsigned(subframe_bits, TOW);
|
||||
d_TOW_SF3 = d_TOW_SF3*6;
|
||||
d_TOW = d_TOW_SF3 - 6; // Set transmission time
|
||||
b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG);
|
||||
b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG);
|
||||
b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG);
|
||||
d_Cic = (double)read_navigation_signed(subframe_bits, C_IC);
|
||||
d_Cic = d_Cic * C_IC_LSB;
|
||||
d_OMEGA0 = (double)read_navigation_signed(subframe_bits, OMEGA_0);
|
||||
d_OMEGA0 = d_OMEGA0 * OMEGA_0_LSB;
|
||||
d_Cis = (double)read_navigation_signed(subframe_bits, C_IS);
|
||||
d_Cis = d_Cis * C_IS_LSB;
|
||||
d_i_0 = (double)read_navigation_signed(subframe_bits, I_0);
|
||||
d_i_0 = d_i_0 * I_0_LSB;
|
||||
d_Crc = (double)read_navigation_signed(subframe_bits, C_RC);
|
||||
d_Crc = d_Crc * C_RC_LSB;
|
||||
d_OMEGA = (double)read_navigation_signed(subframe_bits, OMEGA);
|
||||
d_OMEGA = d_OMEGA * OMEGA_LSB;
|
||||
d_OMEGA_DOT = (double)read_navigation_signed(subframe_bits, OMEGA_DOT);
|
||||
d_OMEGA_DOT = d_OMEGA_DOT * OMEGA_DOT_LSB;
|
||||
d_IODE_SF3 = (double)read_navigation_unsigned(subframe_bits, IODE_SF3);
|
||||
d_IDOT = (double)read_navigation_signed(subframe_bits, I_DOT);
|
||||
d_IDOT = d_IDOT*I_DOT_LSB;
|
||||
|
||||
break;
|
||||
|
||||
case 4: // --- It is subframe 4 ---------- Almanac, ionospheric model, UTC parameters, SV health (PRN: 25-32)
|
||||
d_TOW_SF4 = (double)read_navigation_unsigned(subframe_bits, TOW);
|
||||
d_TOW_SF4 = d_TOW_SF4*6;
|
||||
d_TOW = d_TOW_SF4 - 6; // Set transmission time
|
||||
b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG);
|
||||
b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG);
|
||||
b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG);
|
||||
SV_data_ID = (int)read_navigation_unsigned(subframe_bits, SV_DATA_ID);
|
||||
SV_page = (int)read_navigation_unsigned(subframe_bits, SV_PAGE);
|
||||
|
||||
if (SV_page == 13)
|
||||
{
|
||||
//! \TODO read Estimated Range Deviation (ERD) values
|
||||
}
|
||||
|
||||
if (SV_page == 18)
|
||||
{
|
||||
// Page 18 - Ionospheric and UTC data
|
||||
d_alpha0 = (double)read_navigation_signed(subframe_bits, ALPHA_0);
|
||||
d_alpha0 = d_alpha0 * ALPHA_0_LSB;
|
||||
d_alpha1 = (double)read_navigation_signed(subframe_bits, ALPHA_1);
|
||||
d_alpha1 = d_alpha1 * ALPHA_1_LSB;
|
||||
d_alpha2 = (double)read_navigation_signed(subframe_bits, ALPHA_2);
|
||||
d_alpha2 = d_alpha2 * ALPHA_2_LSB;
|
||||
d_alpha3 = (double)read_navigation_signed(subframe_bits, ALPHA_3);
|
||||
d_alpha3 = d_alpha3 * ALPHA_3_LSB;
|
||||
d_beta0 = (double)read_navigation_signed(subframe_bits, BETA_0);
|
||||
d_beta0 = d_beta0 * BETA_0_LSB;
|
||||
d_beta1 = (double)read_navigation_signed(subframe_bits, BETA_1);
|
||||
d_beta1 = d_beta1 * BETA_1_LSB;
|
||||
d_beta2 = (double)read_navigation_signed(subframe_bits, BETA_2);
|
||||
d_beta2 = d_beta2 * BETA_2_LSB;
|
||||
d_beta3 = (double)read_navigation_signed(subframe_bits, BETA_3);
|
||||
d_beta3 = d_beta3 * BETA_3_LSB;
|
||||
d_A1 = (double)read_navigation_signed(subframe_bits, A_1);
|
||||
d_A1 = d_A1 * A_1_LSB;
|
||||
d_A0 = (double)read_navigation_signed(subframe_bits, A_0);
|
||||
d_A0 = d_A0 * A_0_LSB;
|
||||
d_t_OT = (double)read_navigation_unsigned(subframe_bits, T_OT);
|
||||
d_t_OT = d_t_OT * T_OT_LSB;
|
||||
i_WN_T = (int)read_navigation_unsigned(subframe_bits, WN_T);
|
||||
d_DeltaT_LS = (double)read_navigation_signed(subframe_bits, DELTAT_LS);
|
||||
i_WN_LSF = (int)read_navigation_unsigned(subframe_bits, WN_LSF);
|
||||
i_DN = (int)read_navigation_unsigned(subframe_bits, DN); // Right-justified ?
|
||||
d_DeltaT_LSF = (double)read_navigation_signed(subframe_bits, DELTAT_LSF);
|
||||
flag_iono_valid = true;
|
||||
flag_utc_model_valid = true;
|
||||
}
|
||||
|
||||
if (SV_page == 25)
|
||||
{
|
||||
// Page 25 Anti-Spoofing, SV config and almanac health (PRN: 25-32)
|
||||
//! \TODO Read Anti-Spoofing, SV config
|
||||
almanacHealth[25] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV25);
|
||||
almanacHealth[26] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV26);
|
||||
almanacHealth[27] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV27);
|
||||
almanacHealth[28] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV28);
|
||||
almanacHealth[29] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV29);
|
||||
almanacHealth[30] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV30);
|
||||
almanacHealth[31] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV31);
|
||||
almanacHealth[32] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV32);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5://--- It is subframe 5 -----------------almanac health (PRN: 1-24) and Almanac reference week number and time.
|
||||
d_TOW_SF5 = (double)read_navigation_unsigned(subframe_bits, TOW);
|
||||
d_TOW_SF5 = d_TOW_SF5*6;
|
||||
d_TOW = d_TOW_SF5 - 6; // Set transmission time
|
||||
b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG);
|
||||
b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG);
|
||||
b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG);
|
||||
SV_data_ID = (int)read_navigation_unsigned(subframe_bits, SV_DATA_ID);
|
||||
SV_page = (int)read_navigation_unsigned(subframe_bits, SV_PAGE);
|
||||
if (SV_page < 25)
|
||||
{
|
||||
//! \TODO read almanac
|
||||
}
|
||||
if (SV_page == 25)
|
||||
{
|
||||
d_Toa = (double)read_navigation_unsigned(subframe_bits, T_OA);
|
||||
d_Toa = d_Toa * T_OA_LSB;
|
||||
i_WN_A = (int)read_navigation_unsigned(subframe_bits, WN_A);
|
||||
almanacHealth[1] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV1);
|
||||
almanacHealth[2] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV2);
|
||||
almanacHealth[3] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV3);
|
||||
almanacHealth[4] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV4);
|
||||
almanacHealth[5] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV5);
|
||||
almanacHealth[6] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV6);
|
||||
almanacHealth[7] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV7);
|
||||
almanacHealth[8] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV8);
|
||||
almanacHealth[9] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV9);
|
||||
almanacHealth[10] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV10);
|
||||
almanacHealth[11] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV11);
|
||||
almanacHealth[12] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV12);
|
||||
almanacHealth[13] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV13);
|
||||
almanacHealth[14] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV14);
|
||||
almanacHealth[15] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV15);
|
||||
almanacHealth[16] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV16);
|
||||
almanacHealth[17] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV17);
|
||||
almanacHealth[18] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV18);
|
||||
almanacHealth[19] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV19);
|
||||
almanacHealth[20] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV20);
|
||||
almanacHealth[21] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV21);
|
||||
almanacHealth[22] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV22);
|
||||
almanacHealth[23] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV23);
|
||||
almanacHealth[24] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV24);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
} // switch subframeID ...
|
||||
*/cout<<"--------------------------------------------------------------------------"<<endl;
|
||||
return page_number;
|
||||
}
|
104
src/core/system_parameters/galileo_navigation_message.h
Normal file
104
src/core/system_parameters/galileo_navigation_message.h
Normal file
@ -0,0 +1,104 @@
|
||||
/*!
|
||||
* \file galileo_navigation_message.h
|
||||
* \brief Implementation of a Galileo NAV Data message decoder as described in Galileo ICD
|
||||
* \author Mara Branzanti 2013. mara.branzanti(at)gmail.com
|
||||
* \author Javier Arribas, 2013. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2013 (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_GALILEO_NAVIGATION_MESSAGE_H_
|
||||
#define GNSS_SDR_GALILEO_NAVIGATION_MESSAGE_H_
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <bitset>
|
||||
#include "boost/assign.hpp"
|
||||
#include <cmath>
|
||||
#include <utility>
|
||||
|
||||
#include "Galileo_E1.h"
|
||||
|
||||
|
||||
|
||||
class Galileo_Navigation_Message {
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//bool read_navigation_bool(std::bitset<GALILEO_SUBFRAME_BITS> bits, const std::vector<std::pair<int,int> > parameter);
|
||||
//void print_galileo_word_bytes(unsigned int GPS_word);
|
||||
unsigned long int read_navigation_unsigned(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector< std::pair<int,int> > parameter);
|
||||
unsigned long int read_page_type_unsigned(std::bitset<GALILEO_PAGE_TYPE_BITS> bits, const std::vector< std::pair<int,int> > parameter);
|
||||
//signed long int read_navigation_signed(std::bitset<GALILEO_SUBFRAME_BITS> bits, const std::vector<std::pair<int,int> > parameter);
|
||||
|
||||
int x,y;
|
||||
|
||||
public:
|
||||
|
||||
/*Word type 1: Ephemeris (1/4)*/
|
||||
int IOD_nav_1; // IOD_nav page 1
|
||||
double t0e; // Ephemeris reference time [s]
|
||||
double M0; // Mean anomaly at reference time [semi-circles]
|
||||
double e; // Eccentricity
|
||||
double A; // Square root of the semi-major axis [metres^1/2]
|
||||
|
||||
/*Word type 2: Ephemeris (2/4)*/
|
||||
|
||||
/*Word type 3: Ephemeris (3/4) and SISA*/
|
||||
|
||||
/*Word type 4: Ephemeris (4/4) and Clock correction parameters*/
|
||||
|
||||
/*Word type 5: Ionospheric correction, BGD, signal health and data validity status and GST*/
|
||||
|
||||
/*Word type 6: GST-UTC conversion parameters*/
|
||||
|
||||
/*Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number*/
|
||||
|
||||
/*Word type 8: Almanac for SVID1 (2/2) and SVID2 (1/2)*/
|
||||
|
||||
/*Word type 9: Almanac for SVID2 (2/2) and SVID3 (1/2)*/
|
||||
|
||||
/*Word type 10: Almanac for SVID3 (2/2) and GST-GPS conversion parameters*/
|
||||
|
||||
/*Word type 0: I/NAV Spare Word*/
|
||||
|
||||
|
||||
void split_page(char *page); /* Takes in input a page (Odd or Even) of 120 bit, split it according ICD 4.3.2.3 and join Data_k with Data_j*/
|
||||
|
||||
int page_jk_decoder(char *data_jk); /* Takes in input Data_jk (128 bit) and split it in ephemeris parameters according ICD 4.3.5*/
|
||||
|
||||
void reset();
|
||||
|
||||
|
||||
/* Default constructor */
|
||||
|
||||
Galileo_Navigation_Message();
|
||||
};
|
||||
|
||||
#endif /* GALILEO_NAVIGATION_MESSAGE_H_ */
|
46
src/core/system_parameters/galileo_utc_model.cc
Normal file
46
src/core/system_parameters/galileo_utc_model.cc
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* \file gps_utc_model.h
|
||||
* \brief Interface of a GPS UTC MODEL storage
|
||||
* \author Javier Arribas, 2013. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2013 (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/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "galileo_utc_model.h"
|
||||
|
||||
Galileo_Utc_Model::Galileo_Utc_Model()
|
||||
{
|
||||
valid = false;
|
||||
d_A1 = 0;
|
||||
d_A0 = 0;
|
||||
d_t_OT = 0;
|
||||
i_WN_T = 0;
|
||||
d_DeltaT_LS = 0;
|
||||
i_WN_LSF = 0;
|
||||
i_DN = 0;
|
||||
d_DeltaT_LSF = 0;
|
||||
|
||||
}
|
||||
|
67
src/core/system_parameters/galileo_utc_model.h
Normal file
67
src/core/system_parameters/galileo_utc_model.h
Normal file
@ -0,0 +1,67 @@
|
||||
/*!
|
||||
* \file gps_utc_model.h
|
||||
* \brief Interface of a GPS UTC MODEL storage
|
||||
* \author Javier Arribas, 2013. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2013 (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_GALILEO_UTC_MODEL_H_
|
||||
#define GNSS_SDR_GALILEO_UTC_MODEL_H_
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class is a storage for the GALILEO UTC MODEL data as described in Galileo ICD
|
||||
*
|
||||
* See [Update ref]
|
||||
*/
|
||||
|
||||
/*
|
||||
* ToDo: Rewrite the class to include all the parameters described in Galileo ICD (this is just a copy of GPS code!)
|
||||
*/
|
||||
|
||||
class Galileo_Utc_Model
|
||||
{
|
||||
public:
|
||||
bool valid;
|
||||
// UTC parameters
|
||||
double d_A1; //!< 1st order term of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s/s]
|
||||
double d_A0; //!< Constant of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s]
|
||||
double d_t_OT; //!< Reference time for UTC data (reference 20.3.4.5 and 20.3.3.5.2.4 IS-GPS-200E) [s]
|
||||
int i_WN_T; //!< UTC reference week number [weeks]
|
||||
double d_DeltaT_LS; //!< delta time due to leap seconds [s]. Number of leap seconds since 6-Jan-1980 as transmitted by the GPS almanac.
|
||||
int i_WN_LSF; //!< Week number at the end of which the leap second becomes effective [weeks]
|
||||
int i_DN; //!< Day number (DN) at the end of which the leap second becomes effective [days]
|
||||
double d_DeltaT_LSF; //!< Scheduled future or recent past (relative to NAV message upload) value of the delta time due to leap seconds [s]
|
||||
|
||||
/*!
|
||||
* Default constructor
|
||||
*/
|
||||
Galileo_Utc_Model();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -45,11 +45,17 @@
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include "concurrent_queue.h"
|
||||
#include "concurrent_map.h"
|
||||
#include "gps_navigation_message.h"
|
||||
|
||||
#include "gps_ephemeris.h"
|
||||
#include "gps_almanac.h"
|
||||
#include "gps_iono.h"
|
||||
#include "gps_utc_model.h"
|
||||
|
||||
#include "galileo_ephemeris.h"
|
||||
#include "galileo_almanac.h"
|
||||
#include "galileo_iono.h"
|
||||
#include "galileo_utc_model.h"
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <ctime>
|
||||
#include <memory>
|
||||
@ -67,6 +73,7 @@ DECLARE_string(log_dir);
|
||||
* to the Observables modules
|
||||
*/
|
||||
|
||||
// For GPS NAVIGATION
|
||||
concurrent_queue<Gps_Ephemeris> global_gps_ephemeris_queue;
|
||||
concurrent_queue<Gps_Iono> global_gps_iono_queue;
|
||||
concurrent_queue<Gps_Utc_Model> global_gps_utc_model_queue;
|
||||
@ -79,6 +86,17 @@ concurrent_map<Gps_Utc_Model> global_gps_utc_model_map;
|
||||
concurrent_map<Gps_Almanac> global_gps_almanac_map;
|
||||
concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
|
||||
|
||||
// For GALILEO NAVIGATION
|
||||
concurrent_queue<Galileo_Ephemeris> global_galileo_ephemeris_queue;
|
||||
concurrent_queue<Galileo_Iono> global_galileo_iono_queue;
|
||||
concurrent_queue<Galileo_Utc_Model> global_galileo_utc_model_queue;
|
||||
concurrent_queue<Galileo_Almanac> global_galileo_almanac_queue;
|
||||
|
||||
concurrent_map<Galileo_Ephemeris> global_galileo_ephemeris_map;
|
||||
concurrent_map<Galileo_Iono> global_galileo_iono_map;
|
||||
concurrent_map<Galileo_Utc_Model> global_galileo_utc_model_map;
|
||||
concurrent_map<Galileo_Almanac> global_galileo_almanac_map;
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -44,8 +44,18 @@
|
||||
#include "concurrent_queue.h"
|
||||
#include "concurrent_map.h"
|
||||
#include "gps_navigation_message.h"
|
||||
#include "control_thread.h"
|
||||
|
||||
#include "gps_ephemeris.h"
|
||||
#include "gps_almanac.h"
|
||||
#include "gps_iono.h"
|
||||
#include "gps_utc_model.h"
|
||||
|
||||
#include "galileo_ephemeris.h"
|
||||
#include "galileo_almanac.h"
|
||||
#include "galileo_iono.h"
|
||||
#include "galileo_utc_model.h"
|
||||
|
||||
#include "control_thread.h"
|
||||
|
||||
//#include "arithmetic/complex_arithmetic_libc.cc"
|
||||
//#include "arithmetic/correlations_libc.cc"
|
||||
@ -81,6 +91,16 @@ concurrent_map<Gps_Utc_Model> global_gps_utc_model_map;
|
||||
concurrent_map<Gps_Almanac> global_gps_almanac_map;
|
||||
concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
|
||||
|
||||
// For GALILEO NAVIGATION
|
||||
concurrent_queue<Galileo_Ephemeris> global_galileo_ephemeris_queue;
|
||||
concurrent_queue<Galileo_Iono> global_galileo_iono_queue;
|
||||
concurrent_queue<Galileo_Utc_Model> global_galileo_utc_model_queue;
|
||||
concurrent_queue<Galileo_Almanac> global_galileo_almanac_queue;
|
||||
|
||||
concurrent_map<Galileo_Ephemeris> global_galileo_ephemeris_map;
|
||||
concurrent_map<Galileo_Iono> global_galileo_iono_map;
|
||||
concurrent_map<Galileo_Utc_Model> global_galileo_utc_model_map;
|
||||
concurrent_map<Galileo_Almanac> global_galileo_almanac_map;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
@ -63,6 +63,12 @@
|
||||
#include "gps_almanac.h"
|
||||
#include "gps_iono.h"
|
||||
#include "gps_utc_model.h"
|
||||
|
||||
#include "galileo_ephemeris.h"
|
||||
#include "galileo_almanac.h"
|
||||
#include "galileo_iono.h"
|
||||
#include "galileo_utc_model.h"
|
||||
|
||||
#include "gnss_sdr_supl_client.h"
|
||||
#include <sys/time.h>
|
||||
#include <ctime>
|
||||
@ -89,6 +95,16 @@ concurrent_map<Gps_Utc_Model> global_gps_utc_model_map;
|
||||
concurrent_map<Gps_Almanac> global_gps_almanac_map;
|
||||
concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
|
||||
|
||||
// For GALILEO NAVIGATION
|
||||
concurrent_queue<Galileo_Ephemeris> global_galileo_ephemeris_queue;
|
||||
concurrent_queue<Galileo_Iono> global_galileo_iono_queue;
|
||||
concurrent_queue<Galileo_Utc_Model> global_galileo_utc_model_queue;
|
||||
concurrent_queue<Galileo_Almanac> global_galileo_almanac_queue;
|
||||
|
||||
concurrent_map<Galileo_Ephemeris> global_galileo_ephemeris_map;
|
||||
concurrent_map<Galileo_Iono> global_galileo_iono_map;
|
||||
concurrent_map<Galileo_Utc_Model> global_galileo_utc_model_map;
|
||||
concurrent_map<Galileo_Almanac> global_galileo_almanac_map;
|
||||
|
||||
bool stop;
|
||||
concurrent_queue<int> channel_internal_queue;
|
||||
|
Loading…
Reference in New Issue
Block a user