add a new class called gnss_satellite.

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@129 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Carles Fernandez 2012-01-16 22:01:29 +00:00
parent 60da2f4336
commit 115b36c722
5 changed files with 501 additions and 7 deletions

View File

@ -342,7 +342,7 @@ const bits_slice HEALTH_SV22[]={{247,6}};
const bits_slice HEALTH_SV23[]={{253,6}};
const bits_slice HEALTH_SV24[]={{259,6}};
/*
inline void ca_code_generator_complex(std::complex<float>* _dest, signed int _prn, unsigned int _chip_shift)
{
@ -355,14 +355,14 @@ inline void ca_code_generator_complex(std::complex<float>* _dest, signed int _pr
unsigned int delay;
signed int prn = _prn-1; //Move the PRN code to fit an array indices
/* G2 Delays as defined in IS-GPS-200E */
// G2 Delays as defined in IS-GPS-200E
signed int delays[32] = {5, 6, 7, 8, 17, 18, 139, 140, 141, 251,
252, 254, 255, 256, 257, 258, 469, 470, 471, 472,
473, 474, 509, 512, 513, 514, 515, 516, 859, 860,
861, 862};
// PRN sequences 33 through 37 are reserved for other uses (e.g. ground transmitters)
/* A simple error check */
// A simple error check
if((prn < 0) || (prn > 32))
return;
@ -372,7 +372,7 @@ inline void ca_code_generator_complex(std::complex<float>* _dest, signed int _pr
G2_register[lcv] = 1;
}
/* Generate G1 & G2 Register */
// Generate G1 & G2 Register
for(lcv = 0; lcv < 1023; lcv++)
{
G1[lcv] = G1_register[0];
@ -391,11 +391,11 @@ inline void ca_code_generator_complex(std::complex<float>* _dest, signed int _pr
G2_register[9] = feedback2;
}
/* Set the delay */
// Set the delay
delay = 1023 - delays[prn];
delay += _chip_shift;
delay %= 1023;
/* Generate PRN from G1 and G2 Registers */
// Generate PRN from G1 and G2 Registers
for(lcv = 0; lcv < 1023; lcv++)
{
_dest[lcv] = std::complex<float>(G1[(lcv + _chip_shift)%1023]^G2[delay], 0);
@ -409,7 +409,7 @@ inline void ca_code_generator_complex(std::complex<float>* _dest, signed int _pr
}
}
*/
#endif /* GNSS_SDR_GPS_L1_CA_H_ */

View File

@ -0,0 +1,428 @@
/*!
* \file gnss_satellite.cc
* \brief Implementation of the Gnss_Satellite class
* \author Carles Fernandez-Prades, 2012. cfernandez(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_satellite.h"
#include <glog/log_severity.h>
#include <glog/logging.h>
Gnss_Satellite::Gnss_Satellite()
{
Gnss_Satellite::reset();
}
Gnss_Satellite::Gnss_Satellite(std::string system_, unsigned int PRN_)
{
Gnss_Satellite::reset();
Gnss_Satellite::set_system(system_);
Gnss_Satellite::set_PRN(PRN_);
Gnss_Satellite::set_block(system_, PRN_);
}
Gnss_Satellite::~Gnss_Satellite()
{}
void Gnss_Satellite::reset()
{
system_set = {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"};
PRN = 0;
system = std::string("");
block = std::string("");
}
void Gnss_Satellite::set_system(std::string system_)
{
// Set the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"}
std::set<std::string>::iterator it = system_set.find(system_);
if(it != system_set.end())
{
system = system_;
}
else
{
LOG_AT_LEVEL(ERROR) << "System " << system_ << " is not defined {GPS, GLONASS, SBAS, Galileo, Compass}";
system = std::string("");
}
}
void Gnss_Satellite::set_PRN(unsigned int PRN_)
{
// Set satellite's PRN
if (system.compare("") == 0)
{
LOG_AT_LEVEL(ERROR) << "Trying to define PRN while system is not defined";
PRN = 0;
}
if (system.compare("GPS") == 0)
{
if (PRN_ < 1 or PRN > 32)
{
LOG_AT_LEVEL(ERROR) << "This PRN is not defined";
PRN = 0;
}
else
{
PRN = PRN_;
}
}
else if (system.compare("Glonass") == 0)
{
if (PRN_ < 1 or PRN > 24)
{
LOG_AT_LEVEL(ERROR) << "This PRN is not defined";
PRN = 0;
}
else
{
PRN = PRN_;
}
}
else if (system.compare("SBAS") == 0)
{
if (PRN_ == 122){ PRN = PRN_; } // WAAS Inmarsat 3F4 (AOR-W)
else if (PRN_ == 134){ PRN = PRN_; } // WAAS Inmarsat 3F3 (POR)
else if (PRN_ == 120){ PRN = PRN_; } // EGNOS AOR-E Broadcast satellite http://www.egnos-pro.esa.int/index.html
else if (PRN_ == 124){ PRN = PRN_; } // EGNOS ESA ARTEMIS used for EGNOS Operations
else if (PRN_ == 126){ PRN = PRN_; } // EGNOS IOR-W currently used by Industry to perform various tests on the system.
else
{
LOG_AT_LEVEL(ERROR) << "This PRN is not defined";
PRN = 0;
}
}
else if (system.compare("Galileo") == 0)
{
if (PRN_ == 11)
{
PRN = 11;
}
else
{
LOG_AT_LEVEL(ERROR) << "This PRN is not defined";
PRN = 0;
}
}
else
{
LOG_AT_LEVEL(ERROR) << "System " << system << " is not defined";
PRN = 0;
}
}
unsigned int Gnss_Satellite::get_PRN()
{
// Get satellite's PRN
unsigned int PRN_;
PRN_ = PRN;
return PRN_;
}
std::string Gnss_Satellite::get_system()
{
// Get the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"}
std::string system_;
system_ = system;
return system_;
}
std::string Gnss_Satellite::get_block()
{
// Get the satellite block
std::string block_;
block_ = block;
return block_;
}
void Gnss_Satellite::set_block(std::string system_, unsigned int PRN_ )
{
if (system_.compare("GPS") == 0)
{
switch ( PRN_ )
{
// info from http://www.navcen.uscg.gov/?Do=constellationStatus
case 1 :
block = std::string("IIF"); //Plane D
break;
case 2 :
block = std::string("IIR"); //Plane D
break;
case 3 :
block = std::string("IIA"); //Plane D
break;
case 4 :
block = std::string("IIA"); //Plane D
break;
case 5 :
block = std::string("IIR-M"); //Plane F
break;
case 6 :
block = std::string("IIA"); //Plane C
break;
case 7 :
block = std::string("IIR-M"); //Plane A
break;
case 8 :
block = std::string("IIA"); //Plane A
break;
case 9 :
block = std::string("IIA"); //Plane A
break;
case 10 :
block = std::string("IIA"); //Plane E
break;
case 11 :
block = std::string("IIR"); //Plane D
break;
case 12 :
block = std::string("IIR-M"); //Plane B
break;
case 13 :
block = std::string("IIR"); //Plane F
break;
case 14 :
block = std::string("IIR"); //Plane F
break;
case 15 :
block = std::string("IIR-M"); //Plane F
break;
case 16 :
block = std::string("IIR"); //Plane B
break;
case 17 :
block = std::string("IIR-M"); //Plane C
break;
case 18 :
block = std::string("IIR"); //Plane E
break;
case 19 :
block = std::string("IIR"); //Plane D
break;
case 20 :
block = std::string("IIR"); //Plane E
break;
case 21 :
block = std::string("IIR"); //Plane D
break;
case 22 :
block = std::string("IIR"); //Plane E
break;
case 23 :
block = std::string("IIR"); //Plane F
break;
case 24 :
block = std::string("IIA"); //Plane D Decommissioned from active service on 04 Nov 2011
break;
case 25 :
block = std::string("IIF"); //Plane B
break;
case 26 :
block = std::string("IIA"); //Plane F
break;
case 27 :
block = std::string("IIA"); //Plane A
break;
case 28 :
block = std::string("IIR"); //Plane B
break;
case 29 :
block = std::string("IIR-M"); //Plane D
break;
case 30 :
block = std::string("IIA"); //Plane B
break;
case 31 :
block = std::string("IIR-M"); //Plane A
break;
case 32 :
block = std::string("IIA"); //Plane E
break;
default :
block = std::string("Unknown");
}
}
if (system_.compare("Glonass") == 0)
{
switch ( PRN_ )
{
// info from http://www.sdcm.ru/smglo/grupglo?version=eng&site=extern
case 1 :
block = std::string("1"); //Plane 1
break;
case 2 :
block = std::string("-4"); //Plane 1
break;
case 3 :
block = std::string("5"); //Plane 1
break;
case 4 :
block = std::string("6"); //Plane 1
break;
case 5 :
block = std::string("1"); //Plane 1
break;
case 6 :
block = std::string("-4"); //Plane 1
break;
case 7 :
block = std::string("5"); //Plane 1
break;
case 8 :
block = std::string("6"); //Plane 1
break;
case 9 :
block = std::string("-2"); //Plane 2
break;
case 10 :
block = std::string("-7"); //Plane 2
break;
case 11 :
block = std::string("0"); //Plane 2
break;
case 12 :
block = std::string("-1"); //Plane 2
break;
case 13 :
block = std::string("-2"); //Plane 2
break;
case 14 :
block = std::string("-7"); //Plane 2
break;
case 15 :
block = std::string("0"); //Plane 2
break;
case 16 :
block = std::string("-1"); //Plane 2
break;
case 17 :
block = std::string("4"); //Plane 3
break;
case 18 :
block = std::string("-3"); //Plane 3
break;
case 19 :
block = std::string("3"); //Plane 3
break;
case 20 :
block = std::string("2"); //Plane 3
break;
case 21 :
block = std::string("4"); //Plane 3
break;
case 22 :
block = std::string("-3"); //Plane 3
break;
case 23 :
block = std::string("3"); //Plane 3
break;
case 24 :
block = std::string("2"); //Plane 3
break;
default :
block = std::string("Unknown");
}
}
if (system_.compare("SBAS") == 0)
{
switch ( PRN_ )
{
case 122 :
block = std::string("WAAS"); // WAAS Inmarsat 3F4 (AOR-W)
break;
case 134 :
block = std::string("WAAS"); // WAAS Inmarsat 3F3 (POR)
break;
case 120 :
block = std::string("EGNOS"); // EGNOS AOR-E Broadcast satellite http://www.egnos-pro.esa.int/index.html
case 124 :
block = std::string("EGNOS"); // EGNOS ESA ARTEMIS used for EGNOS Operations
break;
case 126 :
block = std::string("EGNOS"); // EGNOS IOR-W currently used by Industry to perform various tests on the system.
break;
default:
block = std::string("Unknown");
}
}
if (system_.compare("Galileo") == 0)
{
switch ( PRN_ )
{
case 11 :
block = std::string("IOV"); // Launched from French Guiana at 10:30 GMT on October 21, 2011
break;
default:
block = std::string("Unknown");
}
}
}

View File

@ -0,0 +1,64 @@
/*!
* \file gnss_satellite.h
* \brief Interface of the Gnss_Satellite class
* \author Carles Fernandez-Prades, 2012. cfernandez(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_GNSS_SATELLITE_H_
#define GNSS_SDR_GNSS_SATELLITE_H_
#include <string>
#include <set>
/*
* \brief This class represents a GNSS satellite.
*
* It contains information about the space vehicles currently operational
* of GPS, Glonass, SBAS and Galileo constellations.
*/
class Gnss_Satellite
{
public:
Gnss_Satellite(); //!< Default Constructor.
Gnss_Satellite(std::string system_, unsigned int PRN_); //!< Concrete GNSS satellite Constructor.
~Gnss_Satellite(); //!< Default Destructor.
unsigned int get_PRN(); //!< Gets satellite's PRN
std::string get_system(); //!< Gets the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"}
std::string get_block(); //!< Gets the satellite block. If GPS, returns {"IIA", "IIR", "IIR-M", "IIF"}
private:
unsigned int PRN;
std::string system;
std::string block;
void set_system(std::string system); // Sets the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"}. Returns 1 if success.
void set_PRN(unsigned int PRN); // Sets satellite's PRN
void set_block(std::string system_, unsigned int PRN_ );
std::set<std::string> system_set; // = {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"};
void reset();
};
#endif

View File

@ -1,3 +1,4 @@
project : build-dir ../../../build ;
obj gps_navigation_message : gps_navigation_message.cc ;
obj gnss_satellite : gnss_satellite.cc ;

View File

@ -51,6 +51,7 @@ exe gnss-sdr : main.cc
../core/receiver//gnss_block_factory
../core/receiver//gnss_flowgraph
../core/system_parameters//gps_navigation_message
../core/system_parameters//gnss_satellite
../..//gflags
../..//glog
../..//gnuradio-core ;