1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-10-01 00:10:50 +00:00

Fix building in MacOS, code refactoring, position test integration

Bugs from previous commits have been fixed. Working in macOS and Linux. This commit includes a pull from next
This commit is contained in:
Carles Fernandez 2017-04-23 02:03:43 +02:00
commit 57a17ac5d5
48 changed files with 8223 additions and 6454 deletions

View File

@ -271,6 +271,14 @@ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
# Append -O2 optimization flag for Debug builds
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2")
# allow 'large' files in 32 bit builds
if(UNIX)
add_definitions( -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64
-D_LARGE_FILES
)
endif(UNIX)
################################################################################
@ -331,7 +339,6 @@ if(OS_IS_LINUX)
endif(OS_IS_LINUX)
################################################################################
# Googletest - https://github.com/google/googletest
################################################################################
@ -520,11 +527,11 @@ if(NOT VOLK_GNSSSDR_FOUND)
-DCMAKE_CXX_FLAGS=${CXX_FLAGS}
-DCMAKE_C_FLAGS=${C_FLAGS}
-DCMAKE_INCLUDE_PATH=${Boost_INCLUDE_DIR}
-DENABLE_ORC=OFF
${STRIP_VOLK_GNSSSDR_PROFILE}
${USE_THIS_PYTHON} )
if(EXISTS $ENV{OECORE_TARGET_SYSROOT})
set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS}
-DENABLE_ORC=OFF
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/Toolchains/oe-sdk_cross.cmake
-DCROSSCOMPILE_MULTILIB=TRUE )
endif(EXISTS $ENV{OECORE_TARGET_SYSROOT})
@ -882,28 +889,19 @@ endif(OS_IS_LINUX)
find_package(Armadillo)
if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO)
message(STATUS " Armadillo has not been found.")
message(STATUS " Armadillo will be downloaded and built automatically ")
message(STATUS " Armadillo will be downloaded and built automatically")
message(STATUS " when doing 'make'. ")
if(CMAKE_VERSION VERSION_LESS 3.1)
# ExternalProject in CMake > 3.1 cannot open .xz files
set(armadillo_RELEASE 6.700.7)
set(armadillo_MD5 "8116185e1d7391eed3bf6c500f81b4d8")
set(ARMA_FILE_EXTENSION "gz")
else(CMAKE_VERSION VERSION_LESS 3.1)
set(armadillo_RELEASE 7.800.1)
set(armadillo_MD5 "e094351771c40a6e06e1a9c1ffdfc2b8")
set(ARMA_FILE_EXTENSION "xz")
endif(CMAKE_VERSION VERSION_LESS 3.1)
set(armadillo_BRANCH 7.800.x)
set(armadillo_RELEASE ${armadillo_BRANCH})
ExternalProject_Add(
armadillo-${armadillo_RELEASE}
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/armadillo-${armadillo_RELEASE}
URL http://sourceforge.net/projects/arma/files/armadillo-${armadillo_RELEASE}.tar.${ARMA_FILE_EXTENSION}
DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/download/armadillo-${armadillo_RELEASE}
URL_MD5 ${armadillo_MD5}
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DBUILD_SHARED_LIBS=OFF
BUILD_IN_SOURCE 1
GIT_REPOSITORY https://github.com/conradsnicta/armadillo-code.git
GIT_TAG ${armadillo_BRANCH}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE}
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/armadillo-${armadillo_RELEASE}
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_FLAGS=-std=c++11
BUILD_COMMAND make
UPDATE_COMMAND ""
INSTALL_COMMAND ""
@ -911,7 +909,7 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO)
# Set up variables
ExternalProject_Get_Property(armadillo-${armadillo_RELEASE} binary_dir)
set(ARMADILLO_INCLUDE_DIRS ${binary_dir}/include )
set(ARMADILLO_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE}/include )
find_library(LAPACK NAMES lapack HINTS /usr/lib /usr/local/lib /usr/lib64)
if(OS_IS_MACOSX)
find_library(BLAS blas)
@ -925,10 +923,6 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO)
endif(NOT GFORTRAN)
set(ARMADILLO_LIBRARIES ${BLAS} ${LAPACK} ${GFORTRAN} ${binary_dir}/${CMAKE_FIND_LIBRARY_PREFIXES}armadillo.a)
set(LOCAL_ARMADILLO true CACHE STRING "Armadillo downloaded and built automatically" FORCE)
# Save a copy at the thirdparty folder
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/armadillo-${armadillo_RELEASE}
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/armadillo
)
set(ARMADILLO_VERSION_STRING ${armadillo_RELEASE})
else(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO)
set(armadillo_RELEASE ${ARMADILLO_VERSION_STRING})
@ -1180,8 +1174,17 @@ if($ENV{RTLSDR_DRIVER})
endif($ENV{RTLSDR_DRIVER})
if(ENABLE_OSMOSDR)
message(STATUS "The driver for OsmoSDR and other front-ends (HackRF, bladeRF, Realtek's RTL2832U-based dongles, etc.) will be compiled." )
message(STATUS "You can disable it with 'cmake -DENABLE_OSMOSDR=OFF ../'" )
find_package(GrOsmoSDR)
if(GROSMOSDR_FOUND)
message(STATUS "The driver for OsmoSDR and other front-ends (HackRF, bladeRF, Realtek's RTL2832U-based dongles, etc.) will be compiled." )
message(STATUS "You can disable it with 'cmake -DENABLE_OSMOSDR=OFF ../'" )
else(GROSMOSDR_FOUND)
if(ENABLE_PACKAGING)
message(WARNING "gr-osmosdr has not been found. Source blocks depending on it will NOT be built.")
else(ENABLE_PACKAGING)
message(FATAL_ERROR "gr-osmosdr required to build gnss-sdr with the optional OSMOSDR driver")
endif(ENABLE_PACKAGING)
endif(GROSMOSDR_FOUND)
else(ENABLE_OSMOSDR)
message(STATUS "The (optional) driver for OsmoSDR and related front-ends is not enabled." )
message(STATUS "Enable it with 'cmake -DENABLE_OSMOSDR=ON ../' to add support for OsmoSDR and other front-ends (HackRF, bladeRF, Realtek's RTL2832U-based USB dongles, etc.)" )
@ -1314,4 +1317,3 @@ add_custom_target(uninstall
# Add subdirectories (in order of deps)
########################################################################
add_subdirectory(src)

74
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at carles.fernandez@cttc.es. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

176
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,176 @@
# Contributing to GNSS-SDR
:+1::tada: Thanks for taking the time to contribute! :tada::+1:
Third-party contributions are essential for keeping GNSS-SDR
continuously improving. We simply cannot access the huge number of
platforms and myriad configurations for running GNSS-SDR. We want to
keep it as easy as possible to contribute changes that get things
working in your environment. There are a few guidelines that we need
contributors to follow so that we can have a chance of keeping on top of
things.
The following is a set of guidelines for contributing to GNSS-SDR, which
is hosted in the [GNSS-SDR Organization](https://github.com/gnss-sdr) on
GitHub. These are just guidelines, not rules. Use your best judgment,
and feel free to propose changes to this document in a [pull
request](#how-to-submit-a-pull-request).
## Code of Conduct
This project adheres to the Contributor Covenant [code of
conduct](CODE_OF_CONDUCT.md). By participating, you are expected to
uphold this code. Please report unacceptable behavior.
## Reporting an issue
Have you found a bug in the code which is not in the [list of known
bugs](https://github.com/gnss-sdr/gnss-sdr/issues)? Do you have a
suggestion for improvement? Then by all means please [submit a new
issue](https://github.com/gnss-sdr/gnss-sdr/issues/new), and do not
hesitate to comment on existing [open
issues](https://github.com/gnss-sdr/gnss-sdr/issues).
When filling a new issue, please remember to:
* **Use a clear and descriptive title** for the issue to identify the
problem.
* **Describe the exact steps which reproduce the problem** in as many
details as possible. For example, start by describing your computing
platform (Operating System and version, how did you installed GNSS-SDR
and its dependencies, what file or front-end are you using as a signal
source, etc.). You can also include the configuration file you are
using, or a dump of the terminal output you are getting. The more
information you provide, the more chances to get useful answers.
* **Please be patient**. This organization is run on a volunteer basis,
so it can take some time to the Developer Team to reach your issue.
They will do their best to fix it as soon as possible.
* If you opened an issue that is now solved, it is a good practice to
**close it**.
The list of [open issues](https://github.com/gnss-sdr/gnss-sdr/issues)
can be a good starting point and a source of ideas if you are looking to
contribute to the source code.
## Contributing to the source code
### Preliminaries
1. If you still have not done so, [create your personal account on
GitHub](https://github.com/join).
2. [Fork GNSS-SDR from
GitHub](https://github.com/gnss-sdr/gnss-sdr/fork). This will copy the
whole gnss-sdr repository to your personal account.
3. Then, go to your favourite working folder in your computer and
clone your forked repository by typing (replacing ```YOUR_USERNAME``` by
the actual username of your GitHub account):
$ git clone https://github.com/YOUR_USERNAME/gnss-sdr
4. Your forked repository https://github.com/YOUR_USERNAME/gnss-sdr
will receive the default name of `origin`. You can also add the original
gnss-sdr repository, which is usually called `upstream`:
$ cd gnss-sdr
$ git remote add upstream https://github.com/gnss-sdr/gnss-sdr.git
To verify the new upstream repository you have specified for your fork,
type `git remote -v`. You should see the URL for your fork as `origin`,
and the URL for the original repository as `upstream`:
```
$ git remote -v
origin https://github.com/YOUR_USERNAME/gnss-sdr.git (fetch)
origin https://github.com/YOUR_USERNAME/gnss-sdr.git (push)
upstream https://github.com/gnss-sdr/gnss-sdr.git (fetch)
upstream https://github.com/gnss-sdr/gnss-sdr.git (push)
```
### Start working on your contribution
Checkout the `next` branch of the git repository in order to get
synchronized with the latest development code:
```
$ git checkout next
$ git pull upstream next
```
When start working in a new improvement, please **always** branch off
from `next`. Open a new branch and start working on it:
```
$ git checkout -b my_feature
```
Now you can do changes, add files, do commits (please take a look at
[how to write good commit
messages](https://chris.beams.io/posts/git-commit/)!) and push them to
your repository:
```
$ git push origin my_feature
```
If there have been new pushes to the `next` branch of the `upstream`
repository since the last time you pulled from it, you might want to put
your commits on top of them (this is mandatory for pull requests):
```
$ git pull --rebase upstream next
```
### How to submit a pull request
When the contribution is ready, you can [submit a pull
request](https://github.com/gnss-sdr/gnss-sdr/compare/). Head to your
GitHub repository, switch to your `my_feature` branch, and click the
_**Pull Request**_ button, which will do all the work for you. Code
comparison must be always to the `next` branch.
Once a pull request is sent, the Developer Team can review the set of
changes, discuss potential modifications, and even push follow-up
commits if necessary.
Some things that will increase the chance that your pull request is
accepted:
* Avoid platform-dependent code. If your code require external
dependencies, they must be available as packages in [Debian OldStable](https://wiki.debian.org/DebianOldStable).
* Write tests.
* Follow our [coding style guide](http://gnss-sdr.org/coding-style/).
* Write a descriptive and detailed summary. Please consider that
reviewing pull requests is hard, so include as much information as
possible to make your pull request's intent clear.
For more details about Git usage, please check out [our
tutorial](http://gnss-sdr.org/docs/tutorials/using-git/).
## Contributing to the website
The content of http://gnss-sdr.org lives in a GitHub repository at
https://github.com/gnss-sdr/geniuss-place
You can fork that repository, reproduce the entire website on your
computer using [Jekyll](https://jekyllrb.com/), do changes and submit
pull requests, just as explained above. For more details, please check
out [how to contribute](http://gnss-sdr.org/contribute/).
Last but not the least, you can leave your comments on the website.
------
![GeNiuSS
contributes](http://gnss-sdr.org/assets/images/geniuss-contribute.png)
Thanks for your contribution to GNSS-SDR!

View File

@ -129,9 +129,9 @@ or manually as explained below, and then please follow instructions on how to [d
$ sudo apt-get install libopenblas-dev liblapack-dev # For Debian/Ubuntu/LinuxMint
$ sudo yum install lapack-devel blas-devel # For Fedora/CentOS/RHEL
$ sudo zypper install lapack-devel blas-devel # For OpenSUSE
$ wget http://sourceforge.net/projects/arma/files/armadillo-7.800.1.tar.xz
$ tar xvfz armadillo-7.800.1.tar.xz
$ cd armadillo-7.800.1
$ wget http://sourceforge.net/projects/arma/files/armadillo-7.800.2.tar.xz
$ tar xvfz armadillo-7.800.2.tar.xz
$ cd armadillo-7.800.2
$ cmake .
$ make
$ sudo make install

View File

@ -17,7 +17,7 @@ SignalSource.implementation=File_Signal_Source
;#filename: path to file with the captured GNSS signal samples to be processed
;#SignalSource.filename=/home/javier/Descargas/rtlsdr_tcxo_l1/rtlsdr_tcxo_l1.bin ; <- PUT YOUR FILE HERE
SignalSource.filename=/home/javier/git/gnss-sdr/build/signal_out.bin ; <- PUT YOUR FILE HERE
SignalSource.filename=/Users/carlesfernandez/git/cttc/build/signal_out.bin ; <- PUT YOUR FILE HERE
;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version.
SignalSource.item_type=byte

258
docs/changelog Normal file
View File

@ -0,0 +1,258 @@
## [0.0.9](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.9)
DOI: https://doi.org/10.5281/zenodo.291371
This release has several improvements, addition of new features and bug fixes in many dimensions:
### Improvements in Accuracy:
- Major rewriting in the generation of pseudoranges.
- Fixed bug in Galileo E5a/I codes.
- Fixed bug in Galileo E1 correlator spacing.
- Fixed bug that was causing errors in receivers above the troposphere.
- Fixed 16-bit complex resampler.
- Improved time tracking algorithm.
- Added Bancroft's algorithm implementation for PVT initialization.
### Improvements in Availability:
- Improved numerical stability of the PVT solution. The infamous bug that was causing apparently random error peaks has finally been fixed.
### Improvements in Efficiency:
- VOLK_GNSSSDR: Added NEON,AVX and unaligned protokernels for volk_gnsssdr_32f_index_max_32 kernel.
- VOLK_GNSSSDR: Added volk_gnsssdr-config-info to the list of generated executables.
### Improvements in Flexibility:
- Added maximum number of dwells in the Tong algorithm.
### Improvements in Interoperability:
- Added six new Galileo satellites: FM7, FM10, FM11, FM12, FM13, FM14.
- The Hybrid_Observables and Hybrid_PVT implementations can now handle more types of GNSS signals.
- The RINEX printer can now print L2C and E5a observables and navigation files, including multiband configurations.
- Added RTCM 3.2 output to more receiver configurations.
### Improvements in Maintainability:
- The VOLK_GNSSSDR library can now be built with Python 3. Switched dependencies for VOLK_GNSSDR: from (old, python2.7-only) python-cheetah templates to Python3 friendly python-mako and python-six. So, Python-cheetah dependency has been dropped, and python-mako and python-six have been added.
- If suitable versions of gflags, glog, armadillo or googletest are not found in the system, they will be downloaded and built at compile time (versions 2.2.0, 0.3.4, 7.600.2 and 1.8.0, respectively).
- Fixed more than 30 defects detected by Coverity Scan.
- Added CMake Python finder and module checker.
- Deleted files related to CPack.
- Fixes, updates and improvements in the documentation.
- Improvements in CMake scripts: General code cleaning and addition of comments. Improved user information in case of failure. Improved detection of dependencies in more processor architectures (e.g. aarch64).
### Improvements in Marketability:
- Reduced time from a commit to deployment (see virtualization mechanisms in Portability).
### Improvements in Portability:
- Now GNSS-SDR can be run in virtual environments through snap packages (see https://github.com/carlesfernandez/snapcraft-sandbox) and docker images (see https://github.com/carlesfernandez/docker-gnsssdr).
- Now GNSS-SDR is adapted to cross-compiling environments for embedded devices (see https://github.com/carlesfernandez/oe-gnss-sdr-manifest).
- BLAS and LAPACK libraries are not longer mandatory on ARM devices.
### Improvements in Scalability:
- Fixed bug in acquisition with rata rates higher than 16 Msps in 4ms code periods.
### Improvements in Testability:
- Major QA source code refactoring: they has been split into src/tests/unit-tests and src/tests/system-tests folders. They are optionally built with the ENABLE_UNIT_TESTING=ON (unit testing QA code), ENABLE_UNIT_TESTING_EXTRA=ON (unit tests that require extra files downloaded at configure time), ENABLE_SYSTEM_TESTING=ON (system tests, such as measurement of Time-To-First-Fix) and ENABLE_SYSTEM_TESTING_EXTRA=ON (extra system test requiring external tools, automatically downloaded and built at building time) configuration flags. The EXTRA options also download and build a custom software-defined signal generator and version 2.9 of GPSTk, if not already found on the system. Download and local link of version 2.9 can be forced by ENABLE_OWN_GPSTK=ON building configuration flag. Only ENABLE_UNIT_TESTING is set to ON by default.
- Unit tests added: CPU_multicorrelator_test and GPU_multicorrelator_test measure computer performance in multicorrelator setups.
- Unit tests added: GpsL1CADllPllTracking and GpsL1CATelemetryDecoderTest.
- System test added: ttff_gps_l1 performs a set of cold / assisted runs of the software receiver and computes statistics about the obtained Time To First Fix.
- System test added: obs_gps_l1_system_test uses an external software-defined signal generator to produce raw digital GNSS signal from a RINEX navigation file and a position (static or dynamic), processes it with GNSS-SDR, and then compares the RINEX observation file produced by the software receiver to that produced by the signal generator.
- Software Development Kit provided for embedded devices (see http://gnss-sdr.org/docs/tutorials/cross-compiling/).
### Improvements in Usability:
- Now the block factory automatically detects Channel input data type, so it is no longer required to specify Channel.input_type in the configuration. An error raises if Acquisition and Tracking Blocks are not configured with the same input data type.
- Block names changed from L2_M to L2C.
- Documentation available at http://gnss-sdr.org/docs/
- Improved tools for compilation, execution and testing in embedded devices.
See the definitions of concepts and metrics at http://gnss-sdr.org/design-forces/
## [0.0.8](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.8)
DOI: https://doi.org/10.5281/zenodo.57022
This is a maintenance and bug fix release with no relevant new features with respect to v0.0.7. The main changes are:
- Fixed a bug that broke building when using latest VOLK release
- Updated PYBOMBS instructions
- Added Tests for FFT length
- Added Tests for CUDA-based tracking
- Added Tests for SIMD-based tracking
- Improved CUDA-based correlation.
- Updated documentation
- Fixed building in mips and powerpc architectures.
- gr-gn3s and gr-dbfcttc moved to its own repository.
- Improved package reproducibility
- VOLK_GNSSSDR: Fixed a bug in AVX2 puppet
- VOLK_GNSSSDR: can now be built using the C98 standard
- VOLK_GNSSSDR: Fixed a bug that broke building when linking to Boost in some configurations.
- VOLK_GNSSSDR: Added an option to trigger profiling at building time.
- VOLK_GNSSSDR: Fix the CMake-based check for posix_memalign.
## [0.0.7](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.7)
DOI: https://doi.org/10.5281/zenodo.51521
This release has several improvements, addition of new features and bug fixes:
- Improvements in receiver design: Internal block communication has been redesigned to accommodate the addition of new signals, and now upstream and downstream communication within blocks is implemented through the GNU Radio blocks asynchronous message passing system, leading to a more scalable, more robust and cleaner design.
- Improvements in receiver design: Correlators have been rewritten to take full advantage of VOLK and VOLK_GNSSSDR, and they are of general use for any tracking block. Their API now admit an arbitrary number of correlators, spaced in an arbitrary manner, in 16ic and 32fc versions.
- Improvements in receiver design: Block adapters are now all managed by smart pointers, ensuring better memory management.
- Improvements in processing speed: The VOLK_GNSSSDR library has been rewritten, following current VOLK standards and adding a number of new kernels. This approach addresses both efficiency and portability. Now the library provides the key kernels for GNSS signal processing in 16ic and 32fc versions, including SSE2, SSE3, SSE4.1, AVX, AV2 and NEON implementations. Please execute volk_gnsssdr_profile and volk_profile to use the fastest implementation for your host machine.
- New source block: Two_Bit_Packed_File_Signal_Source. This block takes 2 bit samples that have been packed into bytes or shorts as input and generates a byte for each sample.
- Fixes in SUPL assistance (supl.nokia.com removed).
- Improvements in acquisition: Added a non CFAR PCPS acquisition algorithm based on the estimation of the post correlation noise floor. If enabled as an option in the acquisition configuration, it allows setting more stable thresholds in the presence of non-gaussian front-end noise (which is the usual behavior of front-ends.)
- Fixes in acquisition: Fixed mismatch between the config files and the acquisition code in the specification of the IF. Fixed a bug in the length of the FFT of local codes.
- Improvements in tracking sensitivity: Added configuration option to customize the extension of the GPS L1 CA correlation length after bit synchronization (options are: [1,2,4,5,10,20] ms). Only available in the GPS_L1_CA_DLL_PLL_C_Aid_Tracking implementation.
- New tracking block introduced: GPS_L1_CA_DLL_PLL_C_Aid_Tracking is a GPS L1 C/A carrier PLL and code DLL with optional carrier-aid feedback. It is available in both 32 bits gr_complex input samples and in 16 bits short int complex samples. The gr_complex version has also the capability to extend the coherent correlation period from 1ms to 20ms using telemetry symbol synchronization.
- Increased resolution in CN0 estimator internal variables.
- Fixed a bug in computation of GPS L1 C/A carrier phase observable.
- Fixed a bug in the internal state machine that was blocking the receiver after a few hours of usage. Now the receiver can work continually (tested for more than one week, no known limit).
- New tracking block introduced: GPS_L1_CA_DLL_PLL_Tracking_GPU is a GPS L1 C/A carrier PLL and code DLL that uses the CUDA-compatible GPU to compute carrier wipe off and correlation operations, alleviating the CPU load.
- Obsolete/buggy blocks removed: GPS_L1_CA_DLL_FLL_PLL_Tracking, GPS_L1_CA_DLL_PLL_Optim_Tracking.
- Added a RTCM printer and TCP server in PVT blocks (still experimental). The receiver is now able to stream data in real time, serving RTCM 3.2 messages to multiple clients. For instance, it can act as a Ntrip Source feeding a Ntrip Server, or to be used as data input in RTKLIB, obtaining Precise Point Positioning fixes in real-time. The TCP port, Station ID, and rate of MT1019/MT1045 and MSM can be configured. GPS_L1_CA_PVT serves MT1019 (GPS Ephemeris) and MSM7 (MT1077, full GPS pseudoranges, phase ranges, phase range rates and CNR - high resolution) messages, while GALILEO_E1_PVT serves MT1045 (Galileo ephemeris) and MSM7 (MT1097, full Galileo pseudoranges, phase ranges, phase range rates and CNR - high resolution).
- Added a GeoJSON printer. Basic (least-squares) position fixes can be now also stored in this format, in addition to KML.
- Obsolete block removed: output filter.
- QA code migrated to the new asynchronous message passing system.
- Improvements in documentation: update of README.md file, addition of documentation for the VOLK_GNSSSDR library, updated links to new ICDs.
- Improvements in documentation: Satellite identification updated to current constellation status.
- Updated and cleaner console output. Now Galileo satellites have the E identifier in their PRN number.
- Several improvements in CMake scripts allow to build GNSS-SDR in Linux Debian (Jessie, Stretch and Sid), Ubuntu (from 12.04 to 16.04), including amd64, i386, armhf and arm64 architectures, and possibly in other GNU/Linux distributions, as well as in Mac OS X 10.9 to 10.11. It also works well with CMake 3.5 (some problems solved with VOLK_GNSSSDR as a sub-project).
- The software can link either against OpenSSL or against GnuTLS with openssl extensions, whatever it is available. This allows buildings in distributions such as Fedora or ArchLinux, while being compatible with binary distribution through Debian packages.
- Fixed a number of defects detected by Coverity Scan.
- Some fixes required by Debian licensing and packaging system.
- Added a CGRAN (http://www.cgran.org/) manifest
- Lots of code cleaning and fixes of typos and small bugs.
## [0.0.6](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.6)
This release has several improvements and bug fixes:
- Added initial support to multi-band, multi-source configurations (multiple signal sources and signal conditioners).
- Updated configuration files to new notation. Old and new configuration notations still compatible.
- Added skeleton for mixed (multi-frequency and multi-system) observables block.
- Faster local carrier update (25% of improvement).
- Added initial support to GPS L2C real time tracking and decoding of CNAV message with NSL STEREO v2, Fraunhofers Flexiband, and USRPx front-ends (the latter requiring external clock).
- Added initial support to select the frontend clock reference source in UHD signal source (i.e. internal or external clock reference).
- Added 2 bits complex file source for GNSS-SDR GSoC 2015 signal sampler designed by Ajith Peter.
- Added a new rtl_tcp signal source, remote access to RTL2832U-based dongles via TCP.
- Always build front-end-cal, a calibration tool for some DVB-T receivers based on the Realtek's RTL2832U chipset.
- Fixed bug in UTC time computation for GPS signals.
- Updated satellite identification for GPS and Galileo.
- Defined cbyte as a new input data type (std::complex<unsigned char>)
- Adding a new data_type_adapter, from interleaved short to std::complex<short>
- Adding a filter for complex short streams.
- Adding a fir_filter for std::complex<signed char> (aka cbyte). It converts the data type to floats, filters, and converts back to cbyte.
- Added a resampler for cbytes and cshorts.
- First working version of a GPS tracking block implementation using CUDA with multi-GPU device support.
- Updating RINEX obs header when leap second is available.
- Updating RINEX nav file when IONO and UTC data are available.
- Include Signal Strength Indicator in RINEX observable files.
- Tests fixed.
- Fixed more than 200 code defects detected by Coverity Scan.
- Updated documentation.
- Updated documentation and CMake scripts for the GN3S v2 driver (Linux-only)
- Armadillo version automatically downloaded and built if it is not present in the system is now 5.400.3.
- Updated old links from googlecode to new links at GitHub for Google Test, gflags, glog and gperftools.
- gfortran is no longer a required package, but it is used if available.
- Added an option to remove logging.
- Enabled cross-compilation for ARM devices.
- Lots of code cleaning.
## [0.0.5](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.5)
This release has several improvements and bug fixes:
- Now GNSS-SDR can be installed on the system with the usual cmake ../ && make && sudo make install.
- Added volk_gnsssdr library, a volk-like library implementing some specific kernels and ensuring portable executables. It comes with a volk_gnsssdr_profile executable, in the fashion of volk_profile. Volk and volk_gnsssdr are compatible and can be mixed together. This is expected to enable faster execution of the software receiver in upcoming versions.
- The former rtlsdr_signal_source has been replaced by a more general osmosdr_signal_source compatible with all those front-ends accessible by the OsmoSDR driver (bladeRF, hackRF, etc.) in addition to RTL-based dongles.
- Added manpages when binaries gnss-sdr, volk_gnsssdr_profile and front-end-cal are installed.
- Now GNSS-SDR can be build on i386, amd64, armhf, armel and arm64 architectures.
- Now GNSS-SDR builds on Ubuntu 14.04 and 14.10, Debian jessie/sid and Mac OS X 10.9 and 10.10.
- Improved detection of dependencies, specially when installed as .deb packages.
- Added a check' target with some minimal tests.
- Added support for interleaved I/Q byte-size sample files.
- Minor bug fixes, updated documentation and code cleaning.
## [0.0.4](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.4)
This release has several improvements and bug fixes:
- Added hybrid processing GPS L1 C/A and Galileo E1B, providing position fixes make use of observables for both constellations.
- Added implementations of the QuickSync algorithm for GPS L1 C/A and Galileo E1 acquisition.
- Added processing blocks for Galileo E5a: Acquisition, Tracking, Telemetry_Decoder (experimental)
- New configuration files allow to configure GPS and Galileo channels in the same receiver.
- Added tropospheric corrections to GPS and Galileo PVT solution.
- Improved precision obtained by changing some variables from float to double.
- New building options: ENABLE_GN3S, ENABLE_RTLSDR and ENABLE_ARRAY and ENABLE_OPENCL.
- Improved documentation on how to enable optional drivers.
- Fixed bug in memory alignment that caused problems with high data rates.
- Added ENABLE_GENERIC_ARCH, an option to build the binary without detecting the SIMD instruction set present in the compiling machine, so it can be executed in other machines without those specific sets.
- Added ENABLE_GPERFTOOLS, which links the executable to tcmalloc and profiler if Gperftools is available on the system.
- Added carrier phase, Doppler shift and signal strength observables to the RINEX files. Static PPP solutions are available for GPS with RTKLIB via RINEX files.
- The executable now produces RINEX files version 3.02 of Galileo Observables, Navigation data, and mixed (GPS/Galileo) observables and nav data. RINEX 3.02 is the default version of RINEX files.
- Armadillo version updated to 4.400.2
- Armadillo now uses OpenBLAS instead of BLAS if the former is available on the system.
- Some raw pointers have been changed to smart pointers.
- Minor bug fixes and code cleaning.
## [0.0.3](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.3)
This release has several improvements and bug fixes, completing the transition from Subversion to Git. The main changes are:
- Created some missing directories lost in the SVN to Git transition.
- New C++11-ized block factory, flow graph and tests, resulting in better memory management and fewer segmentation faults. Several raw pointers converted to smart pointers.
- Reorganization of assistance data input and output.
- Fixed memory leak when talking to SUPL servers.
- Improved retrieval of assistance data.
- Fixing an error in a constant value related to Galileo.
- Inform users if the temporal folder is not /tmp.
- Fixes and additions to the documentation.
- README in markdown language so it looks better in Git repositories.
- Fixed a bug that prevented the update of all shared map structures (ephemeris, iono parameters, etc…).
- The configuration script now throws error if GCC is older than 4.7 or Boost is older than 1.45
- Improved detection / downloading & building if missing of Gflags and Glog.
- Improved detection / downloading & building if missing of Armadillo and related dependencies.
- Fixes many warnings that appeared when using CMake 3.0.
- Improved detection of GTEST_DIR variable.
- Include header files in libraries so IDEs such as Xcode can display them.
Enjoy it!

View File

@ -217,8 +217,8 @@ bool rtklib_solver::get_PVT(std::map<int,Gnss_Synchro> gnss_observables_map, dou
nav_data.n=valid_obs;
for (int i=0; i< MAXSAT;i++)
{
nav_data.lam[i][0]=CLIGHT/FREQ1; /* L1/E1 */
nav_data.lam[i][1]=CLIGHT/FREQ2; /* L2 */
nav_data.lam[i][0]=SPEED_OF_LIGHT/FREQ1; /* L1/E1 */
nav_data.lam[i][1]=SPEED_OF_LIGHT/FREQ2; /* L2 */
}
result=pntpos(obs_data, valid_obs, &nav_data, &rtklib_opt, &old_pvt_sol, NULL, NULL,rtklib_msg);

View File

@ -1,4 +1,4 @@
# Copyright (C) 2012-2015 (see AUTHORS file for a list of contributors)
# Copyright (C) 2012-2017 (see AUTHORS file for a list of contributors)
#
# This file is part of GNSS-SDR.
#
@ -38,14 +38,13 @@ include_directories(
${GFlags_INCLUDE_DIRS}
${GLOG_INCLUDE_DIRS}
)
file(GLOB RTKLIB_LIB_HEADERS "*.h")
list(SORT RTKLIB_LIB_HEADERS)
add_library(rtklib_lib ${RTKLIB_LIB_SOURCES} ${RTKLIB_LIB_HEADERS})
source_group(Headers FILES ${RTKLIB_LIB_HEADERS})
add_dependencies(rtklib_lib armadillo-${armadillo_RELEASE} glog-${glog_RELEASE})
#set_property(SOURCE rtklib_rtkcmn.cc APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-missing-field-initializers ")
target_link_libraries(
rtklib_lib
${Boost_LIBRARIES}
@ -56,5 +55,3 @@ target_link_libraries(
${LAPACK}
)
#MESSAGE( STATUS "*****************BLAS: " ${BLAS} )

View File

@ -48,356 +48,243 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef RTKLIB_H_
#define RTKLIB_H_
#ifndef GNSS_SDR_RTKLIB_H_
#define GNSS_SDR_RTKLIB_H_
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <cstring>
#include <math.h>
#include <cmath>
#include <time.h>
#include <ctype.h>
#include "MATH_CONSTANTS.h"
#include "gnss_frequencies.h"
#include "gnss_obs_codes.h"
#define thread_t pthread_t
#define lock_t pthread_mutex_t
#define initlock(f) pthread_mutex_init(f,NULL)
#define lock(f) pthread_mutex_lock(f)
#define unlock(f) pthread_mutex_unlock(f)
#define FILEPATHSEP '/'
#define PI 3.1415926535897932 /* pi */
#define D2R (PI/180.0) /* deg to rad */
#define R2D (180.0/PI) /* rad to deg */
#define CLIGHT 299792458.0 /* speed of light (m/s) */
#define SC2RAD 3.1415926535898 /* semi-circle to radian (IS-GPS) */
#define AU 149597870691.0 /* 1 AU (m) */
#define AS2R (D2R/3600.0) /* arc sec to radian */
const int FILEPATHSEP = '/';
#define OMGE 7.2921151467E-5 /* earth angular velocity (IS-GPS) (rad/s) */
const double RE_WGS84 = 6378137.0; //!< earth semimajor axis (WGS84) (m)
const double FE_WGS84 = (1.0 / 298.257223563); //!< earth flattening (WGS84)
#define RE_WGS84 6378137.0 /* earth semimajor axis (WGS84) (m) */
#define FE_WGS84 (1.0/298.257223563) /* earth flattening (WGS84) */
const double HION = 350000.0; //!< ionosphere height (m)
#define HION 350000.0 /* ionosphere height (m) */
const unsigned int POLYCRC32 = 0xEDB88320u; //!< CRC32 polynomial
const unsigned int POLYCRC24Q = 0x1864CFBu; //!< CRC24Q polynomial
#define P2_5 0.03125 /* 2^-5 */
#define P2_6 0.015625 /* 2^-6 */
#define P2_11 4.882812500000000E-04 /* 2^-11 */
#define P2_15 3.051757812500000E-05 /* 2^-15 */
#define P2_17 7.629394531250000E-06 /* 2^-17 */
#define P2_19 1.907348632812500E-06 /* 2^-19 */
#define P2_20 9.536743164062500E-07 /* 2^-20 */
#define P2_21 4.768371582031250E-07 /* 2^-21 */
#define P2_23 1.192092895507810E-07 /* 2^-23 */
#define P2_24 5.960464477539063E-08 /* 2^-24 */
#define P2_27 7.450580596923828E-09 /* 2^-27 */
#define P2_29 1.862645149230957E-09 /* 2^-29 */
#define P2_30 9.313225746154785E-10 /* 2^-30 */
#define P2_31 4.656612873077393E-10 /* 2^-31 */
#define P2_32 2.328306436538696E-10 /* 2^-32 */
#define P2_33 1.164153218269348E-10 /* 2^-33 */
#define P2_35 2.910383045673370E-11 /* 2^-35 */
#define P2_38 3.637978807091710E-12 /* 2^-38 */
#define P2_39 1.818989403545856E-12 /* 2^-39 */
#define P2_40 9.094947017729280E-13 /* 2^-40 */
#define P2_43 1.136868377216160E-13 /* 2^-43 */
#define P2_48 3.552713678800501E-15 /* 2^-48 */
#define P2_50 8.881784197001252E-16 /* 2^-50 */
#define P2_55 2.775557561562891E-17 /* 2^-55 */
const unsigned int PMODE_SINGLE = 0; //!< positioning mode: single
const unsigned int PMODE_DGPS = 1; //!< positioning mode: DGPS/DGNSS
const unsigned int PMODE_KINEMA = 2; //!< positioning mode: kinematic
const unsigned int PMODE_STATIC = 3; //!< positioning mode: static
const unsigned int PMODE_MOVEB = 4; //!< positioning mode: moving-base
const unsigned int PMODE_FIXED = 5; //!< positioning mode: fixed
const unsigned int PMODE_PPP_KINEMA = 6; //!< positioning mode: PPP-kinemaric
const unsigned int PMODE_PPP_STATIC = 7; //!< positioning mode: PPP-static
const unsigned int PMODE_PPP_FIXED = 8; //!< positioning mode: PPP-fixed
#define POLYCRC32 0xEDB88320u /* CRC32 polynomial */
#define POLYCRC24Q 0x1864CFBu /* CRC24Q polynomial */
const unsigned int SOLF_LLH = 0; //!< solution format: lat/lon/height
const unsigned int SOLF_XYZ = 1; //!< solution format: x/y/z-ecef
const unsigned int SOLF_ENU = 2; //!< solution format: e/n/u-baseline
const unsigned int SOLF_NMEA = 3; //!< solution format: NMEA-183
const unsigned int SOLF_STAT = 4; //!< solution format: solution status
const unsigned int SOLF_GSIF = 5; //!< solution format: GSI F1/F2
#define PMODE_SINGLE 0 /* positioning mode: single */
#define PMODE_DGPS 1 /* positioning mode: DGPS/DGNSS */
#define PMODE_KINEMA 2 /* positioning mode: kinematic */
#define PMODE_STATIC 3 /* positioning mode: static */
#define PMODE_MOVEB 4 /* positioning mode: moving-base */
#define PMODE_FIXED 5 /* positioning mode: fixed */
#define PMODE_PPP_KINEMA 6 /* positioning mode: PPP-kinemaric */
#define PMODE_PPP_STATIC 7 /* positioning mode: PPP-static */
#define PMODE_PPP_FIXED 8 /* positioning mode: PPP-fixed */
const unsigned int SOLQ_NONE = 0; //!< solution status: no solution
const unsigned int SOLQ_FIX = 1; //!< solution status: fix
const unsigned int SOLQ_FLOAT = 2; //!< solution status: float
const unsigned int SOLQ_SBAS = 3; //!< solution status: SBAS
const unsigned int SOLQ_DGPS = 4; //!< solution status: DGPS/DGNSS
const unsigned int SOLQ_SINGLE = 5; //!< solution status: single
const unsigned int SOLQ_PPP = 6; //!< solution status: PPP
const unsigned int SOLQ_DR = 7; //!< solution status: dead reckoning
const unsigned int MAXSOLQ = 7; //!< max number of solution status
#define SOLF_LLH 0 /* solution format: lat/lon/height */
#define SOLF_XYZ 1 /* solution format: x/y/z-ecef */
#define SOLF_ENU 2 /* solution format: e/n/u-baseline */
#define SOLF_NMEA 3 /* solution format: NMEA-183 */
#define SOLF_STAT 4 /* solution format: solution status */
#define SOLF_GSIF 5 /* solution format: GSI F1/F2 */
const unsigned int TIMES_GPST = 0; //!< time system: gps time
const unsigned int TIMES_UTC = 1; //!< time system: utc
const unsigned int TIMES_JST = 2; //!< time system: jst
#define SOLQ_NONE 0 /* solution status: no solution */
#define SOLQ_FIX 1 /* solution status: fix */
#define SOLQ_FLOAT 2 /* solution status: float */
#define SOLQ_SBAS 3 /* solution status: SBAS */
#define SOLQ_DGPS 4 /* solution status: DGPS/DGNSS */
#define SOLQ_SINGLE 5 /* solution status: single */
#define SOLQ_PPP 6 /* solution status: PPP */
#define SOLQ_DR 7 /* solution status: dead reconing */
#define MAXSOLQ 7 /* max number of solution status */
const int MAXFREQ = 7; //!< max NFREQ
#define TIMES_GPST 0 /* time system: gps time */
#define TIMES_UTC 1 /* time system: utc */
#define TIMES_JST 2 /* time system: jst */
const int MAXLEAPS = 64; //!< max number of leap seconds table
const double DTTOL = 0.005; //!< tolerance of time difference (s)
#define MAXFREQ 7 /* max NFREQ */
const int NFREQ = 3;
const int NEXOBS = 0; //!< number of extended obs codes
const int MAXANT = 64; //!< max length of station name/antenna type
#define FREQ1 1.57542E9 /* L1/E1 frequency (Hz) */
#define FREQ2 1.22760E9 /* L2 frequency (Hz) */
#define FREQ5 1.17645E9 /* L5/E5a frequency (Hz) */
#define FREQ6 1.27875E9 /* E6/LEX frequency (Hz) */
#define FREQ7 1.20714E9 /* E5b frequency (Hz) */
#define FREQ8 1.191795E9 /* E5a+b frequency (Hz) */
#define FREQ9 2.492028E9 /* S frequency (Hz) */
#define FREQ1_GLO 1.60200E9 /* GLONASS G1 base frequency (Hz) */
#define DFRQ1_GLO 0.56250E6 /* GLONASS G1 bias frequency (Hz/n) */
#define FREQ2_GLO 1.24600E9 /* GLONASS G2 base frequency (Hz) */
#define DFRQ2_GLO 0.43750E6 /* GLONASS G2 bias frequency (Hz/n) */
#define FREQ3_GLO 1.202025E9 /* GLONASS G3 frequency (Hz) */
#define FREQ1_CMP 1.561098E9 /* BeiDou B1 frequency (Hz) */
#define FREQ2_CMP 1.20714E9 /* BeiDou B2 frequency (Hz) */
#define FREQ3_CMP 1.26852E9 /* BeiDou B3 frequency (Hz) */
const int MINPRNGPS = 1; //!< min satellite PRN number of GPS
const int MAXPRNGPS = 32; //!< max satellite PRN number of GPS
const int NSATGPS = (MAXPRNGPS - MINPRNGPS + 1); //!< number of GPS satellites
const int NSYSGPS = 1;
#define MAXLEAPS 64 /* max number of leap seconds table */
#define DTTOL 0.005 /* tolerance of time difference (s) */
#define NFREQ 3
#define NEXOBS 0 /* number of extended obs codes */
#define MAXANT 64 /* max length of station name/antenna type */
#define MINPRNGPS 1 /* min satellite PRN number of GPS */
#define MAXPRNGPS 32 /* max satellite PRN number of GPS */
#define NSATGPS (MAXPRNGPS-MINPRNGPS+1) /* number of GPS satellites */
#define NSYSGPS 1
#define SYS_NONE 0x00 /* navigation system: none */
#define SYS_GPS 0x01 /* navigation system: GPS */
#define SYS_SBS 0x02 /* navigation system: SBAS */
#define SYS_GLO 0x04 /* navigation system: GLONASS */
#define SYS_GAL 0x08 /* navigation system: Galileo */
#define SYS_QZS 0x10 /* navigation system: QZSS */
#define SYS_CMP 0x20 /* navigation system: BeiDou */
#define SYS_IRN 0x40 /* navigation system: IRNS */
#define SYS_LEO 0x80 /* navigation system: LEO */
#define SYS_ALL 0xFF /* navigation system: all */
#define CODE_NONE 0 /* obs code: none or unknown */
#define CODE_L1C 1 /* obs code: L1C/A,G1C/A,E1C (GPS,GLO,GAL,QZS,SBS) */
#define CODE_L1P 2 /* obs code: L1P,G1P (GPS,GLO) */
#define CODE_L1W 3 /* obs code: L1 Z-track (GPS) */
#define CODE_L1Y 4 /* obs code: L1Y (GPS) */
#define CODE_L1M 5 /* obs code: L1M (GPS) */
#define CODE_L1N 6 /* obs code: L1codeless (GPS) */
#define CODE_L1S 7 /* obs code: L1C(D) (GPS,QZS) */
#define CODE_L1L 8 /* obs code: L1C(P) (GPS,QZS) */
#define CODE_L1E 9 /* (not used) */
#define CODE_L1A 10 /* obs code: E1A (GAL) */
#define CODE_L1B 11 /* obs code: E1B (GAL) */
#define CODE_L1X 12 /* obs code: E1B+C,L1C(D+P) (GAL,QZS) */
#define CODE_L1Z 13 /* obs code: E1A+B+C,L1SAIF (GAL,QZS) */
#define CODE_L2C 14 /* obs code: L2C/A,G1C/A (GPS,GLO) */
#define CODE_L2D 15 /* obs code: L2 L1C/A-(P2-P1) (GPS) */
#define CODE_L2S 16 /* obs code: L2C(M) (GPS,QZS) */
#define CODE_L2L 17 /* obs code: L2C(L) (GPS,QZS) */
#define CODE_L2X 18 /* obs code: L2C(M+L),B1I+Q (GPS,QZS,CMP) */
#define CODE_L2P 19 /* obs code: L2P,G2P (GPS,GLO) */
#define CODE_L2W 20 /* obs code: L2 Z-track (GPS) */
#define CODE_L2Y 21 /* obs code: L2Y (GPS) */
#define CODE_L2M 22 /* obs code: L2M (GPS) */
#define CODE_L2N 23 /* obs code: L2codeless (GPS) */
#define CODE_L5I 24 /* obs code: L5/E5aI (GPS,GAL,QZS,SBS) */
#define CODE_L5Q 25 /* obs code: L5/E5aQ (GPS,GAL,QZS,SBS) */
#define CODE_L5X 26 /* obs code: L5/E5aI+Q/L5B+C (GPS,GAL,QZS,IRN,SBS) */
#define CODE_L7I 27 /* obs code: E5bI,B2I (GAL,CMP) */
#define CODE_L7Q 28 /* obs code: E5bQ,B2Q (GAL,CMP) */
#define CODE_L7X 29 /* obs code: E5bI+Q,B2I+Q (GAL,CMP) */
#define CODE_L6A 30 /* obs code: E6A (GAL) */
#define CODE_L6B 31 /* obs code: E6B (GAL) */
#define CODE_L6C 32 /* obs code: E6C (GAL) */
#define CODE_L6X 33 /* obs code: E6B+C,LEXS+L,B3I+Q (GAL,QZS,CMP) */
#define CODE_L6Z 34 /* obs code: E6A+B+C (GAL) */
#define CODE_L6S 35 /* obs code: LEXS (QZS) */
#define CODE_L6L 36 /* obs code: LEXL (QZS) */
#define CODE_L8I 37 /* obs code: E5(a+b)I (GAL) */
#define CODE_L8Q 38 /* obs code: E5(a+b)Q (GAL) */
#define CODE_L8X 39 /* obs code: E5(a+b)I+Q (GAL) */
#define CODE_L2I 40 /* obs code: B1I (BDS) */
#define CODE_L2Q 41 /* obs code: B1Q (BDS) */
#define CODE_L6I 42 /* obs code: B3I (BDS) */
#define CODE_L6Q 43 /* obs code: B3Q (BDS) */
#define CODE_L3I 44 /* obs code: G3I (GLO) */
#define CODE_L3Q 45 /* obs code: G3Q (GLO) */
#define CODE_L3X 46 /* obs code: G3I+Q (GLO) */
#define CODE_L1I 47 /* obs code: B1I (BDS) */
#define CODE_L1Q 48 /* obs code: B1Q (BDS) */
#define CODE_L5A 49 /* obs code: L5A SPS (IRN) */
#define CODE_L5B 50 /* obs code: L5B RS(D) (IRN) */
#define CODE_L5C 51 /* obs code: L5C RS(P) (IRN) */
#define CODE_L9A 52 /* obs code: SA SPS (IRN) */
#define CODE_L9B 53 /* obs code: SB RS(D) (IRN) */
#define CODE_L9C 54 /* obs code: SC RS(P) (IRN) */
#define CODE_L9X 55 /* obs code: SB+C (IRN) */
#define MAXCODE 55 /* max number of obs code */
const int SYS_NONE = 0x00; //!< navigation system: none
const int SYS_GPS = 0x01; //!< navigation system: GPS
const int SYS_SBS = 0x02; //!< navigation system: SBAS
const int SYS_GLO = 0x04; //!< navigation system: GLONASS
const int SYS_GAL = 0x08; //!< navigation system: Galileo
const int SYS_QZS = 0x10; //!< navigation system: QZSS
const int SYS_BDS = 0x20; //!< navigation system: BeiDou
const int SYS_IRN = 0x40; //!< navigation system: IRNS
const int SYS_LEO = 0x80; //!< navigation system: LEO
const int SYS_ALL = 0xFF; //!< navigation system: all
#ifdef ENAGLO
#define MINPRNGLO 1 /* min satellite slot number of GLONASS */
#define MAXPRNGLO 27 /* max satellite slot number of GLONASS */
#define NSATGLO (MAXPRNGLO-MINPRNGLO+1) /* number of GLONASS satellites */
#define NSYSGLO 1
const int MINPRNGLO = 1; //!< min satellite slot number of GLONASS
const int MAXPRNGLO = 27; //!< max satellite slot number of GLONASS
const int NSATGLO = (MAXPRNGLO - MINPRNGLO + 1); //!< number of GLONASS satellites
const int NSYSGLO = 1;
#else
#define MINPRNGLO 0
#define MAXPRNGLO 0
#define NSATGLO 0
#define NSYSGLO 0
const int MINPRNGLO = 0;
const int MAXPRNGLO = 0;
const int NSATGLO = 0;
const int NSYSGLO = 0;
#endif
#ifdef ENAGAL
#define MINPRNGAL 1 /* min satellite PRN number of Galileo */
#define MAXPRNGAL 30 /* max satellite PRN number of Galileo */
#define NSATGAL (MAXPRNGAL-MINPRNGAL+1) /* number of Galileo satellites */
#define NSYSGAL 1
const int MINPRNGAL = 1; //!< min satellite PRN number of Galileo
const int MAXPRNGAL = 30; //!< max satellite PRN number of Galileo
const int NSATGAL = (MAXPRNGAL - MINPRNGAL + 1); //!< number of Galileo satellites
const int NSYSGAL = 1;
#else
#define MINPRNGAL 0
#define MAXPRNGAL 0
#define NSATGAL 0
#define NSYSGAL 0
const int MINPRNGAL = 0;
const int MAXPRNGAL = 0;
const int NSATGAL = 0;
const int NSYSGAL = 0;
#endif
#ifdef ENAQZS
#define MINPRNQZS 193 /* min satellite PRN number of QZSS */
#define MAXPRNQZS 199 /* max satellite PRN number of QZSS */
#define MINPRNQZS_S 183 /* min satellite PRN number of QZSS SAIF */
#define MAXPRNQZS_S 189 /* max satellite PRN number of QZSS SAIF */
#define NSATQZS (MAXPRNQZS-MINPRNQZS+1) /* number of QZSS satellites */
#define NSYSQZS 1
const int MINPRNQZS = 193; //!< min satellite PRN number of QZSS
const int MAXPRNQZS = 199; //!< max satellite PRN number of QZSS
const int MINPRNQZS_S = 183; //!< min satellite PRN number of QZSS SAIF
const int MAXPRNQZS_S = 189; //!< max satellite PRN number of QZSS SAIF
const int NSATQZS = (MAXPRNQZS - MINPRNQZS + 1); //!< number of QZSS satellites
const int NSYSQZS = 1;
#else
#define MINPRNQZS 0
#define MAXPRNQZS 0
#define MINPRNQZS_S 0
#define MAXPRNQZS_S 0
#define NSATQZS 0
#define NSYSQZS 0
const int MINPRNQZS = 0;
const int MAXPRNQZS = 0;
const int MINPRNQZS_S = 0;
const int MAXPRNQZS_S = 0;
const int NSATQZS = 0;
const int NSYSQZS = 0;
#endif
#ifdef ENACMP
#define MINPRNCMP 1 /* min satellite sat number of BeiDou */
#define MAXPRNCMP 35 /* max satellite sat number of BeiDou */
#define NSATCMP (MAXPRNCMP-MINPRNCMP+1) /* number of BeiDou satellites */
#define NSYSCMP 1
#ifdef ENABDS
const int MINPRNBDS = 1; //!< min satellite sat number of BeiDou
const int MAXPRNBDS = 35; //!< max satellite sat number of BeiDou
const int NSATBDS = (MAXPRNBDS - MINPRNCM + 1); //!< number of BeiDou satellites
const int NSYSBDS = 1;
#else
#define MINPRNCMP 0
#define MAXPRNCMP 0
#define NSATCMP 0
#define NSYSCMP 0
const int MINPRNBDS = 0;
const int MAXPRNBDS = 0;
const int NSATBDS = 0;
const int NSYSBDS = 0;
#endif
#ifdef ENAIRN
#define MINPRNIRN 1 /* min satellite sat number of IRNSS */
#define MAXPRNIRN 7 /* max satellite sat number of IRNSS */
#define NSATIRN (MAXPRNIRN-MINPRNIRN+1) /* number of IRNSS satellites */
#define NSYSIRN 1
const int MINPRNIRN = 1; //!< min satellite sat number of IRNSS
const int MAXPRNIRN = 7; //!< max satellite sat number of IRNSS
const int NSATIRN = (MAXPRNIRN - MINPRNIRN + 1); //!< number of IRNSS satellites
const int NSYSIRN = 1;
#else
#define MINPRNIRN 0
#define MAXPRNIRN 0
#define NSATIRN 0
#define NSYSIRN 0
const int MINPRNIRN = 0;
const int MAXPRNIRN = 0;
const int NSATIRN = 0;
const int NSYSIRN = 0;
#endif
#ifdef ENALEO
#define MINPRNLEO 1 /* min satellite sat number of LEO */
#define MAXPRNLEO 10 /* max satellite sat number of LEO */
#define NSATLEO (MAXPRNLEO-MINPRNLEO+1) /* number of LEO satellites */
#define NSYSLEO 1
const int MINPRNLEO = 1; //!< min satellite sat number of LEO
const int NSATLEO = 10; //!< max satellite sat number of LEO
const int NSATLEO = (MAXPRNLEO - MINPRNLEO + 1); //!< number of LEO satellites
const int NSYSLEO = 1;
#else
#define MINPRNLEO 0
#define MAXPRNLEO 0
#define NSATLEO 0
#define NSYSLEO 0
const int MINPRNLEO = 0;
const int MAXPRNLEO = 0;
const int NSATLEO = 0;
const int NSYSLEO = 0;
#endif
#define NSYS (NSYSGPS+NSYSGLO+NSYSGAL+NSYSQZS+NSYSCMP+NSYSIRN+NSYSLEO) /* number of systems */
const int NSYS = (NSYSGPS + NSYSGLO + NSYSGAL + NSYSQZS + NSYSBDS + NSYSIRN + NSYSLEO); //!< number of systems
#define MINPRNSBS 120 /* min satellite PRN number of SBAS */
#define MAXPRNSBS 142 /* max satellite PRN number of SBAS */
#define NSATSBS (MAXPRNSBS-MINPRNSBS+1) /* number of SBAS satellites */
const int MINPRNSBS = 120; //!< min satellite PRN number of SBAS
const int MAXPRNSBS = 142; //!< max satellite PRN number of SBAS
const int NSATSBS = (MAXPRNSBS - MINPRNSBS + 1); //!< number of SBAS satellites
#define MAXSAT (NSATGPS+NSATGLO+NSATGAL+NSATQZS+NSATCMP+NSATIRN+NSATSBS+NSATLEO)
const int MAXSAT = (NSATGPS + NSATGLO + NSATGAL + NSATQZS + NSATBDS + NSATIRN + NSATSBS + NSATLEO);
#define MAXNIGP 201 /* max number of IGP in SBAS band */
#define MAXCODE 55 /* max number of obs code */
#define MAXSTA 255
const int MAXSTA = 255;
#ifndef MAXOBS
#define MAXOBS 64 /* max number of obs in an epoch */
const int MAXOBS = 64; //!< max number of obs in an epoch
#endif
#define MAXRCV 64 /* max receiver number (1 to MAXRCV) */
#define MAXOBSTYPE 64 /* max number of obs type in RINEX */
#define DTTOL 0.005 /* tolerance of time difference (s) */
#define MAXDTOE 7200.0 /* max time difference to GPS Toe (s) */
#define MAXDTOE_QZS 7200.0 /* max time difference to QZSS Toe (s) */
#define MAXDTOE_GAL 10800.0 /* max time difference to Galileo Toe (s) */
#define MAXDTOE_CMP 21600.0 /* max time difference to BeiDou Toe (s) */
#define MAXDTOE_GLO 1800.0 /* max time difference to GLONASS Toe (s) */
#define MAXDTOE_SBS 360.0 /* max time difference to SBAS Toe (s) */
#define MAXDTOE_S 86400.0 /* max time difference to ephem toe (s) for other */
#define MAXGDOP 300.0 /* max GDOP */
const int MAXRCV = 64; //!< max receiver number (1 to MAXRCV)
const int MAXOBSTYPE = 64; //!< max number of obs type in RINEX
const double MAXDTOE = 7200.0; //!< max time difference to GPS Toe (s)
const double MAXDTOE_QZS = 7200.0; //!< max time difference to QZSS Toe (s)
const double MAXDTOE_GAL = 10800.0; //!< max time difference to Galileo Toe (s)
const double MAXDTOE_BDS = 21600.0; //!< max time difference to BeiDou Toe (s)
const double MAXDTOE_GLO = 1800.0; //!< max time difference to GLONASS Toe (s)
const double MAXDTOE_SBS = 360.0; //!< max time difference to SBAS Toe (s)
const double MAXDTOE_S = 86400.0; //!< max time difference to ephem toe (s) for other
const double MAXGDOP = 300.0; //!< max GDOP
#define MAXSBSAGEF 30.0 /* max age of SBAS fast correction (s) */
#define MAXSBSAGEL 1800.0 /* max age of SBAS long term corr (s) */
#define MAXSBSURA 8 /* max URA of SBAS satellite */
#define MAXBAND 10 /* max SBAS band of IGP */
#define MAXNIGP 201 /* max number of IGP in SBAS band */
#define MAXNGEO 4 /* max number of GEO satellites */
const int MAXSBSURA = 8; //!< max URA of SBAS satellite
const int MAXBAND = 10; //!< max SBAS band of IGP
const int MAXNIGP = 201; //!< max number of IGP in SBAS band
const int MAXNGEO = 4; //!< max number of GEO satellites
#define MAXSOLMSG 8191 /* max length of solution message */
#define MAXERRMSG 4096 /* max length of error/warning message */
const int MAXSOLMSG = 8191; //!< max length of solution message
const int MAXERRMSG = 4096; //!< max length of error/warning message
#define IONOOPT_OFF 0 /* ionosphere option: correction off */
#define IONOOPT_BRDC 1 /* ionosphere option: broadcast model */
#define IONOOPT_SBAS 2 /* ionosphere option: SBAS model */
#define IONOOPT_IFLC 3 /* ionosphere option: L1/L2 or L1/L5 iono-free LC */
#define IONOOPT_EST 4 /* ionosphere option: estimation */
#define IONOOPT_TEC 5 /* ionosphere option: IONEX TEC model */
#define IONOOPT_QZS 6 /* ionosphere option: QZSS broadcast model */
#define IONOOPT_LEX 7 /* ionosphere option: QZSS LEX ionospehre */
#define IONOOPT_STEC 8 /* ionosphere option: SLANT TEC model */
const unsigned int IONOOPT_OFF = 0; //!< ionosphere option: correction off
const unsigned int IONOOPT_BRDC = 1; //!< ionosphere option: broadcast model
const unsigned int IONOOPT_SBAS = 2; //!< ionosphere option: SBAS model
const unsigned int IONOOPT_IFLC = 3; //!< ionosphere option: L1/L2 or L1/L5 iono-free LC
const unsigned int IONOOPT_EST = 4; //!< ionosphere option: estimation
const unsigned int IONOOPT_TEC = 5; //!< ionosphere option: IONEX TEC model
const unsigned int IONOOPT_QZS = 6; //!< ionosphere option: QZSS broadcast model
const unsigned int IONOOPT_LEX = 7; //!< ionosphere option: QZSS LEX ionospehre
const unsigned int IONOOPT_STEC = 8; //!< ionosphere option: SLANT TEC model
#define TROPOPT_OFF 0 /* troposphere option: correction off */
#define TROPOPT_SAAS 1 /* troposphere option: Saastamoinen model */
#define TROPOPT_SBAS 2 /* troposphere option: SBAS model */
#define TROPOPT_EST 3 /* troposphere option: ZTD estimation */
#define TROPOPT_ESTG 4 /* troposphere option: ZTD+grad estimation */
#define TROPOPT_ZTD 5 /* troposphere option: ZTD correction */
const unsigned int TROPOPT_OFF = 0; //!< troposphere option: correction off
const unsigned int TROPOPT_SAAS = 1; //!< troposphere option: Saastamoinen model
const unsigned int TROPOPT_SBAS = 2; //!< troposphere option: SBAS model
const unsigned int TROPOPT_EST = 3; //!< troposphere option: ZTD estimation
const unsigned int TROPOPT_ESTG = 4; //!< troposphere option: ZTD+grad estimation
const unsigned int TROPOPT_ZTD = 5; //!< troposphere option: ZTD correction
#define EPHOPT_BRDC 0 /* ephemeris option: broadcast ephemeris */
#define EPHOPT_PREC 1 /* ephemeris option: precise ephemeris */
#define EPHOPT_SBAS 2 /* ephemeris option: broadcast + SBAS */
#define EPHOPT_SSRAPC 3 /* ephemeris option: broadcast + SSR_APC */
#define EPHOPT_SSRCOM 4 /* ephemeris option: broadcast + SSR_COM */
#define EPHOPT_LEX 5 /* ephemeris option: QZSS LEX ephemeris */
const unsigned int EPHOPT_BRDC = 0; //!< ephemeris option: broadcast ephemeris
const unsigned int EPHOPT_PREC = 1; //!< ephemeris option: precise ephemeris
const unsigned int EPHOPT_SBAS = 2; //!< ephemeris option: broadcast + SBAS
const unsigned int EPHOPT_SSRAPC = 3; //!< ephemeris option: broadcast + SSR_APC
const unsigned int EPHOPT_SSRCOM = 4; //!< ephemeris option: broadcast + SSR_COM
const unsigned int EPHOPT_LEX = 5; //!< ephemeris option: QZSS LEX ephemeris
#define EFACT_GPS 1.0 /* error factor: GPS */
#define EFACT_GLO 1.5 /* error factor: GLONASS */
#define EFACT_GAL 1.0 /* error factor: Galileo */
#define EFACT_QZS 1.0 /* error factor: QZSS */
#define EFACT_CMP 1.0 /* error factor: BeiDou */
#define EFACT_IRN 1.5 /* error factor: IRNSS */
#define EFACT_SBS 3.0 /* error factor: SBAS */
const double EFACT_GPS = 1.0; //!< error factor: GPS
const double EFACT_GLO = 1.5; //!< error factor: GLONASS
const double EFACT_GAL = 1.0; //!< error factor: Galileo
const double EFACT_QZS = 1.0; //!< error factor: QZSS
const double EFACT_BDS = 1.0; //!< error factor: BeiDou
const double EFACT_IRN = 1.5; //!< error factor: IRNSS
const double EFACT_SBS = 3.0; //!< error factor: SBAS
const int MAXEXFILE = 1024; //!< max number of expanded files
const double MAXSBSAGEF = 30.0; //!< max age of SBAS fast correction (s)
const double MAXSBSAGEL = 1800.0; //!< max age of SBAS long term corr (s)
#define MAXEXFILE 1024 /* max number of expanded files */
#define MAXSBSAGEF 30.0 /* max age of SBAS fast correction (s) */
#define MAXSBSAGEL 1800.0 /* max age of SBAS long term corr (s) */
#define MAXSBSURA 8 /* max URA of SBAS satellite */
#define MAXBAND 10 /* max SBAS band of IGP */
#define MAXNIGP 201 /* max number of IGP in SBAS band */
typedef void fatalfunc_t(const char *); //!< fatal callback function type
typedef void fatalfunc_t(const char *); /* fatal callback function type */
typedef struct { /* time struct */
time_t time; /* time (s) expressed by standard time_t */
double sec; /* fraction of second under 1 s */
} gtime_t;
typedef struct { /* observation data record */
gtime_t time; /* receiver sampling time (GPST) */
unsigned char sat,rcv; /* satellite/receiver number */
@ -409,11 +296,13 @@ typedef struct { /* observation data record */
float D[NFREQ+NEXOBS]; /* observation data doppler frequency (Hz) */
} obsd_t;
typedef struct { /* observation data */
int n,nmax; /* number of obervation data/allocated */
obsd_t *data; /* observation data records */
} obs_t;
typedef struct { /* earth rotation parameter data type */
double mjd; /* mjd (days) */
double xp,yp; /* pole offset (rad) */
@ -422,11 +311,13 @@ typedef struct { /* earth rotation parameter data type */
double lod; /* length of day (s/day) */
} erpd_t;
typedef struct { /* earth rotation parameter type */
int n,nmax; /* number and max number of data */
erpd_t *data; /* earth rotation parameter data */
} erp_t;
typedef struct { /* antenna parameter type */
int sat; /* satellite number (0:receiver) */
char type[MAXANT]; /* antenna type */
@ -437,11 +328,13 @@ typedef struct { /* antenna parameter type */
/* el=90,85,...,0 or nadir=0,1,2,3,... (deg) */
} pcv_t;
typedef struct { /* antenna parameters type */
int n,nmax; /* number of data/allocated */
pcv_t *pcv; /* antenna parameters data */
} pcvs_t;
typedef struct { /* almanac type */
int sat; /* satellite number */
int svh; /* sv health (0:ok) */
@ -454,14 +347,15 @@ typedef struct { /* almanac type */
double f0,f1; /* SV clock parameters (af0,af1) */
} alm_t;
typedef struct { /* GPS/QZS/GAL broadcast ephemeris type */
int sat; /* satellite number */
int iode,iodc; /* IODE,IODC */
int sva; /* SV accuracy (URA index) */
int svh; /* SV health (0:ok) */
int week; /* GPS/QZS: gps week, GAL: galileo week */
int code; /* GPS/QZS: code on L2, GAL/CMP: data sources */
int flag; /* GPS/QZS: L2 P data flag, CMP: nav type */
int code; /* GPS/QZS: code on L2, GAL/BDS: data sources */
int flag; /* GPS/QZS: L2 P data flag, BDS: nav type */
gtime_t toe,toc,ttr; /* Toe,Toc,T_trans */
/* SV orbit parameters */
double A,e,i0,OMG0,omg,M0,deln,OMGd,idot;
@ -472,10 +366,11 @@ typedef struct { /* GPS/QZS/GAL broadcast ephemeris type */
double tgd[4]; /* group delay parameters */
/* GPS/QZS:tgd[0]=TGD */
/* GAL :tgd[0]=BGD E5a/E1,tgd[1]=BGD E5b/E1 */
/* CMP :tgd[0]=BGD1,tgd[1]=BGD2 */
/* BDS :tgd[0]=BGD1,tgd[1]=BGD2 */
double Adot,ndot; /* Adot,ndot for CNAV */
} eph_t;
typedef struct { /* GLONASS broadcast ephemeris type */
int sat; /* satellite number */
int iode; /* IODE (0-6 bit of tb field) */
@ -490,6 +385,7 @@ typedef struct { /* GLONASS broadcast ephemeris type */
double dtaun; /* delay between L1 and L2 (s) */
} geph_t;
typedef struct { /* precise ephemeris type */
gtime_t time; /* time (GPST) */
int index; /* ephemeris index for multiple files */
@ -501,6 +397,7 @@ typedef struct { /* precise ephemeris type */
float vco[MAXSAT][3]; /* satellite velocity covariance (m^2) */
} peph_t;
typedef struct { /* precise clock type */
gtime_t time; /* time (GPST) */
int index; /* clock index for multiple files */
@ -508,6 +405,7 @@ typedef struct { /* precise clock type */
float std[MAXSAT][1]; /* satellite clock std (s) */
} pclk_t;
typedef struct { /* SBAS ephemeris type */
int sat; /* satellite number */
gtime_t t0; /* reference epoch time (GPST) */
@ -520,6 +418,7 @@ typedef struct { /* SBAS ephemeris type */
double af0,af1; /* satellite clock-offset/drift (s,s/s) */
} seph_t;
typedef struct { /* norad two line element data type */
char name [32]; /* common name */
char alias[32]; /* alias name */
@ -541,11 +440,13 @@ typedef struct { /* norad two line element data type */
int rev; /* revolution number at epoch */
} tled_t;
typedef struct { /* norad two line element type */
int n,nmax; /* number/max number of two line element data */
tled_t *data; /* norad two line element data */
} tle_t;
typedef struct { /* TEC grid type */
gtime_t time; /* epoch time (GPST) */
int ndata[3]; /* TEC grid data size {nlat,nlon,nhgt} */
@ -557,23 +458,27 @@ typedef struct { /* TEC grid type */
float *rms; /* RMS values (tecu) */
} tec_t;
typedef struct { /* satellite fcb data type */
gtime_t ts,te; /* start/end time (GPST) */
double bias[MAXSAT][3]; /* fcb value (cyc) */
double std [MAXSAT][3]; /* fcb std-dev (cyc) */
} fcbd_t;
typedef struct { /* SBAS message type */
int week,tow; /* receiption time */
int prn; /* SBAS satellite PRN number */
unsigned char msg[29]; /* SBAS message (226bit) padded by 0 */
} sbsmsg_t;
typedef struct { /* SBAS messages type */
int n,nmax; /* number of SBAS messages/allocated */
sbsmsg_t *msgs; /* SBAS messages */
} sbs_t;
typedef struct { /* SBAS fast correction type */
gtime_t t0; /* time of applicability (TOF) */
double prc; /* pseudorange correction (PRC) (m) */
@ -584,6 +489,7 @@ typedef struct { /* SBAS fast correction type */
short ai; /* degradation factor indicator */
} sbsfcorr_t;
typedef struct { /* SBAS long term satellite error correction type */
gtime_t t0; /* correction time */
int iode; /* IODE (issue of date ephemeris) */
@ -592,12 +498,14 @@ typedef struct { /* SBAS long term satellite error correction type */
double daf0,daf1; /* delta clock-offset/drift (s,s/s) */
} sbslcorr_t;
typedef struct { /* SBAS satellite correction type */
int sat; /* satellite number */
sbsfcorr_t fcorr; /* fast correction */
sbslcorr_t lcorr; /* long term correction */
} sbssatp_t;
typedef struct { /* SBAS satellite corrections type */
int iodp; /* IODP (issue of date mask) */
int nsat; /* number of satellites */
@ -605,6 +513,7 @@ typedef struct { /* SBAS satellite corrections type */
sbssatp_t sat[MAXSAT]; /* satellite correction */
} sbssat_t;
typedef struct { /* SBAS ionospheric correction type */
gtime_t t0; /* correction time */
short lat,lon; /* latitude/longitude (deg) */
@ -612,6 +521,7 @@ typedef struct { /* SBAS ionospheric correction type */
float delay; /* vertical delay estimate (m) */
} sbsigp_t;
typedef struct { /* IGP band type */
short x; /* longitude/latitude (deg) */
const short *y; /* latitudes/longitudes (deg) */
@ -619,12 +529,14 @@ typedef struct { /* IGP band type */
unsigned char bite; /* IGP mask end bit */
} sbsigpband_t;
typedef struct { /* SBAS ionospheric corrections type */
int iodi; /* IODI (issue of date ionos corr) */
int nigp; /* number of igps */
sbsigp_t igp[MAXNIGP]; /* ionospheric correction */
} sbsion_t;
typedef struct { /* DGPS/GNSS correction type */
gtime_t t0; /* correction time */
double prc; /* pseudorange correction (PRC) (m) */
@ -633,6 +545,7 @@ typedef struct { /* DGPS/GNSS correction type */
double udre; /* UDRE */
} dgps_t;
typedef struct { /* SSR correction type */
gtime_t t0[6]; /* epoch time (GPST) {eph,clk,hrclk,ura,bias,pbias} */
double udi[6]; /* SSR update interval (s) */
@ -652,6 +565,7 @@ typedef struct { /* SSR correction type */
unsigned char update; /* update flag (0:no update,1:update) */
} ssr_t;
typedef struct { /* QZSS LEX message type */
int prn; /* satellite PRN number */
int type; /* message type */
@ -662,11 +576,13 @@ typedef struct { /* QZSS LEX message type */
unsigned char msg[212]; /* LEX message data part 1695 bits */
} lexmsg_t;
typedef struct { /* QZSS LEX messages type */
int n,nmax; /* number of LEX messages and allocated */
lexmsg_t *msgs; /* LEX messages */
} lex_t;
typedef struct { /* QZSS LEX ephemeris type */
gtime_t toe; /* epoch time (GPST) */
gtime_t tof; /* message frame time (GPST) */
@ -682,6 +598,7 @@ typedef struct { /* QZSS LEX ephemeris type */
double isc[8]; /* ISC */
} lexeph_t;
typedef struct { /* QZSS LEX ionosphere correction type */
gtime_t t0; /* epoch time (GPST) */
double tspan; /* valid time span (s) */
@ -689,6 +606,7 @@ typedef struct { /* QZSS LEX ionosphere correction type */
double coef[3][2]; /* coefficients lat x lon (3 x 2) */
} lexion_t;
typedef struct { /* stec data type */
gtime_t time; /* time (GPST) */
unsigned char sat; /* satellite number */
@ -698,12 +616,14 @@ typedef struct { /* stec data type */
unsigned char flag; /* fix flag */
} stec_t;
typedef struct { /* trop data type */
gtime_t time; /* time (GPST) */
double trp[3]; /* zenith tropos delay/gradient (m) */
float std[3]; /* std-dev (m) */
} trop_t;
typedef struct { /* ppp corrections type */
int nsta; /* number of stations */
char stas[MAXSTA][8]; /* station names */
@ -714,6 +634,7 @@ typedef struct { /* ppp corrections type */
trop_t *trop[MAXSTA]; /* trop data */
} pppcorr_t;
typedef struct { /* navigation data type */
int n,nmax; /* number of broadcast ephemeris */
int ng,ngmax; /* number of glonass ephemeris */
@ -761,6 +682,7 @@ typedef struct { /* navigation data type */
pppcorr_t pppcorr; /* ppp corrections */
} nav_t;
typedef struct { /* station parameter type */
char name [MAXANT]; /* marker name */
char marker [MAXANT]; /* marker number */
@ -777,6 +699,7 @@ typedef struct { /* station parameter type */
double hgt; /* antenna height (m) */
} sta_t;
typedef struct { /* solution type */
gtime_t time; /* time (GPST) */
double rr[6]; /* position/velocity (m|m/s) */
@ -793,6 +716,7 @@ typedef struct { /* solution type */
float thres; /* AR ratio threshold for valiation */
} sol_t;
typedef struct { /* solution buffer type */
int n,nmax; /* number of solution/max number of buffer */
int cyclic; /* cyclic buffer flag */
@ -804,6 +728,7 @@ typedef struct { /* solution buffer type */
int nb; /* number of byte in message buffer */
} solbuf_t;
typedef struct { /* solution status type */
gtime_t time; /* time (GPST) */
unsigned char sat; /* satellite number */
@ -819,11 +744,13 @@ typedef struct { /* solution status type */
unsigned short rejc; /* reject counter */
} solstat_t;
typedef struct { /* solution status buffer type */
int n,nmax; /* number of solution/max number of buffer */
solstat_t *data; /* solution status data */
} solstatbuf_t;
typedef struct { /* RTCM control struct type */
int staid; /* station id */
int stah; /* station health */
@ -855,6 +782,7 @@ typedef struct { /* RTCM control struct type */
char opt[256]; /* RTCM dependent options */
} rtcm_t;
typedef struct { /* download url type */
char type[32]; /* data type */
char path[1024]; /* url path */
@ -862,6 +790,7 @@ typedef struct { /* download url type */
double tint; /* time interval (s) */
} url_t;
typedef struct { /* option type */
const char *name; /* option name */
int format; /* option format (0:int,1:double,2:string,3:enum) */
@ -869,6 +798,7 @@ typedef struct { /* option type */
const char *comment; /* option comment/enum labels/unit */
} opt_t;
typedef struct { /* extended receiver error model */
int ena[4]; /* model enabled */
double cerr[4][NFREQ*2]; /* code errors (m) */
@ -877,11 +807,13 @@ typedef struct { /* extended receiver error model */
double gloicb [NFREQ]; /* glonass interchannel bias (m/fn) */
} exterr_t;
typedef struct { /* SNR mask type */
int ena[2]; /* enable flag {rover,base} */
double mask[NFREQ][9]; /* mask (dBHz) at 5,10,...85 deg */
} snrmask_t;
typedef struct { /* processing options type */
int mode; /* positioning mode (PMODE_???) */
int soltype; /* solution type (0:forward,1:backward,2:combined) */
@ -944,6 +876,7 @@ typedef struct { /* processing options type */
char pppopt[256]; /* ppp option */
} prcopt_t;
typedef struct { /* solution options type */
int posf; /* solution format (SOLF_???) */
int times; /* time system (TIMES_???) */
@ -966,7 +899,6 @@ typedef struct { /* solution options type */
} solopt_t;
typedef struct { /* satellite status type */
unsigned char sys; /* navigation system */
unsigned char vs; /* valid satellite flag single */
@ -990,6 +922,7 @@ typedef struct { /* satellite status type */
double ph[2][NFREQ]; /* previous carrier-phase observable (cycle) */
} ssat_t;
typedef struct { /* ambiguity control type */
gtime_t epoch[4]; /* last epoch */
int n[4]; /* number of epochs */
@ -999,6 +932,7 @@ typedef struct { /* ambiguity control type */
char flags[MAXSAT]; /* fix flags */
} ambc_t;
typedef struct { /* RTK control/result type */
sol_t sol; /* RTK solution */
double rb[6]; /* base position/velocity (ecef) (m|m/s) */
@ -1014,6 +948,7 @@ typedef struct { /* RTK control/result type */
prcopt_t opt; /* processing options */
} rtk_t;
typedef struct half_cyc_tag { /* half-cycle correction list type */
unsigned char sat; /* satellite number */
unsigned char freq; /* frequency number (0:L1,1:L2,2:L5) */
@ -1024,21 +959,23 @@ typedef struct half_cyc_tag { /* half-cycle correction list type */
} half_cyc_t;
const double chisqr[100]={ /* chi-sqr(n) (alpha=0.001) */
10.8,13.8,16.3,18.5,20.5,22.5,24.3,26.1,27.9,29.6,
31.3,32.9,34.5,36.1,37.7,39.3,40.8,42.3,43.8,45.3,
46.8,48.3,49.7,51.2,52.6,54.1,55.5,56.9,58.3,59.7,
61.1,62.5,63.9,65.2,66.6,68.0,69.3,70.7,72.1,73.4,
74.7,76.0,77.3,78.6,80.0,81.3,82.6,84.0,85.4,86.7,
88.0,89.3,90.6,91.9,93.3,94.7,96.0,97.4,98.7,100 ,
101 ,102 ,103 ,104 ,105 ,107 ,108 ,109 ,110 ,112 ,
113 ,114 ,115 ,116 ,118 ,119 ,120 ,122 ,123 ,125 ,
126 ,127 ,128 ,129 ,131 ,132 ,133 ,134 ,135 ,137 ,
138 ,139 ,140 ,142 ,143 ,144 ,145 ,147 ,148 ,149
const double chisqr[100] = { /* chi-sqr(n) (alpha=0.001) */
10.8, 13.8, 16.3, 18.5, 20.5, 22.5, 24.3, 26.1, 27.9, 29.6,
31.3, 32.9, 34.5, 36.1, 37.7, 39.3, 40.8, 42.3, 43.8, 45.3,
46.8, 48.3, 49.7, 51.2, 52.6, 54.1, 55.5, 56.9, 58.3, 59.7,
61.1, 62.5, 63.9, 65.2, 66.6, 68.0, 69.3, 70.7, 72.1, 73.4,
74.7, 76.0, 77.3, 78.6, 80.0, 81.3, 82.6, 84.0, 85.4, 86.7,
88.0, 89.3, 90.6, 91.9, 93.3, 94.7, 96.0, 97.4, 98.7, 100 ,
101 , 102 , 103 , 104 , 105 , 107 , 108 , 109 , 110 , 112 ,
113 , 114 , 115 , 116 , 118 , 119 , 120 , 122 , 123 , 125 ,
126 , 127 , 128 , 129 , 131 , 132 , 133 , 134 , 135 , 137 ,
138 , 139 , 140 , 142 , 143 , 144 , 145 , 147 , 148 , 149
};
const double lam_carr[MAXFREQ]={ /* carrier wave length (m) */
CLIGHT/FREQ1,CLIGHT/FREQ2,CLIGHT/FREQ5,CLIGHT/FREQ6,CLIGHT/FREQ7,
CLIGHT/FREQ8,CLIGHT/FREQ9
const double lam_carr[MAXFREQ] = { /* carrier wave length (m) */
SPEED_OF_LIGHT / FREQ1, SPEED_OF_LIGHT / FREQ2, SPEED_OF_LIGHT / FREQ5, SPEED_OF_LIGHT / FREQ6, SPEED_OF_LIGHT / FREQ7,
SPEED_OF_LIGHT / FREQ8, SPEED_OF_LIGHT / FREQ9
};
#endif

View File

@ -46,165 +46,171 @@
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "rtklib_conversions.h"
obsd_t obs_to_rtklib(Gnss_Synchro gnss_synchro, int week)
{
obsd_t rtklib_obs;
rtklib_obs.D[0]=gnss_synchro.Carrier_Doppler_hz;
rtklib_obs.P[0]=gnss_synchro.Pseudorange_m;
rtklib_obs.L[0]=gnss_synchro.Carrier_phase_rads;//todo: check units
//rtklib_obs.SNR=gnss_synchro.CN0_dB_hz;
rtklib_obs.sat=gnss_synchro.PRN;
rtklib_obs.time=gpst2time(adjgpsweek(week),gnss_synchro.RX_time);
obsd_t rtklib_obs = {};
rtklib_obs.D[0] = gnss_synchro.Carrier_Doppler_hz;
rtklib_obs.P[0] = gnss_synchro.Pseudorange_m;
rtklib_obs.L[0] = gnss_synchro.Carrier_phase_rads;//todo: check units
//rtklib_obs.SNR = gnss_synchro.CN0_dB_hz;
rtklib_obs.sat = gnss_synchro.PRN;
rtklib_obs.time = gpst2time(adjgpsweek(week), gnss_synchro.RX_time);
//printf("OBS RX TIME [%i]: %s,%f\n\r",rtklib_obs.sat,time_str(rtklib_obs.time,3),rtklib_obs.time.sec);
return rtklib_obs;
}
eph_t eph_to_rtklib(Galileo_Ephemeris gal_eph)
{
eph_t rtklib_sat;
eph_t rtklib_sat = {};
rtklib_sat.sat = gal_eph.i_satellite_PRN;
rtklib_sat.A=gal_eph.A_1*gal_eph.A_1;
rtklib_sat.M0=gal_eph.M0_1;
rtklib_sat.deln=gal_eph.delta_n_3;
rtklib_sat.OMG0=gal_eph.OMEGA_0_2;
rtklib_sat.OMGd=gal_eph.OMEGA_dot_3;
rtklib_sat.omg=gal_eph.omega_2;
rtklib_sat.i0=gal_eph.i_0_2;
rtklib_sat.idot=gal_eph.iDot_2;
rtklib_sat.e=gal_eph.e_1;
rtklib_sat.Adot=0; //only in CNAV;
rtklib_sat.ndot=0; //only in CNAV;
rtklib_sat.A = gal_eph.A_1 * gal_eph.A_1;
rtklib_sat.M0 = gal_eph.M0_1;
rtklib_sat.deln = gal_eph.delta_n_3;
rtklib_sat.OMG0 = gal_eph.OMEGA_0_2;
rtklib_sat.OMGd = gal_eph.OMEGA_dot_3;
rtklib_sat.omg = gal_eph.omega_2;
rtklib_sat.i0 = gal_eph.i_0_2;
rtklib_sat.idot = gal_eph.iDot_2;
rtklib_sat.e = gal_eph.e_1;
rtklib_sat.Adot = 0; //only in CNAV;
rtklib_sat.ndot = 0; //only in CNAV;
rtklib_sat.week=adjgpsweek(gal_eph.WN_5); /* week of tow */
rtklib_sat.cic=gal_eph.C_ic_4;
rtklib_sat.cis=gal_eph.C_is_4;
rtklib_sat.cuc=gal_eph.C_uc_3;
rtklib_sat.cus=gal_eph.C_us_3;
rtklib_sat.crc=gal_eph.C_rc_3;
rtklib_sat.crs=gal_eph.C_rs_3;
rtklib_sat.f0=gal_eph.af0_4;
rtklib_sat.f1=gal_eph.af1_4;
rtklib_sat.f2=gal_eph.af2_4;
rtklib_sat.tgd[0]=0;
rtklib_sat.tgd[1]=0;
rtklib_sat.tgd[2]=0;
rtklib_sat.tgd[3]=0;
rtklib_sat.toes=gal_eph.t0e_1;
rtklib_sat.toc=gpst2time(rtklib_sat.week,gal_eph.t0c_4);
rtklib_sat.ttr=gpst2time(rtklib_sat.week,gal_eph.TOW_5);
rtklib_sat.week = adjgpsweek(gal_eph.WN_5); /* week of tow */
rtklib_sat.cic = gal_eph.C_ic_4;
rtklib_sat.cis = gal_eph.C_is_4;
rtklib_sat.cuc = gal_eph.C_uc_3;
rtklib_sat.cus = gal_eph.C_us_3;
rtklib_sat.crc = gal_eph.C_rc_3;
rtklib_sat.crs = gal_eph.C_rs_3;
rtklib_sat.f0 = gal_eph.af0_4;
rtklib_sat.f1 = gal_eph.af1_4;
rtklib_sat.f2 = gal_eph.af2_4;
rtklib_sat.tgd[0] = 0;
rtklib_sat.tgd[1] = 0;
rtklib_sat.tgd[2] = 0;
rtklib_sat.tgd[3] = 0;
rtklib_sat.toes = gal_eph.t0e_1;
rtklib_sat.toc = gpst2time(rtklib_sat.week, gal_eph.t0c_4);
rtklib_sat.ttr = gpst2time(rtklib_sat.week, gal_eph.TOW_5);
/* adjustment for week handover */
double tow, toc;
tow=time2gpst(rtklib_sat.ttr,&rtklib_sat.week);
toc=time2gpst(rtklib_sat.toc,NULL);
if (rtklib_sat.toes<tow-302400.0) {rtklib_sat.week++; tow-=604800.0;}
else if (rtklib_sat.toes>tow+302400.0) {rtklib_sat.week--; tow+=604800.0;}
rtklib_sat.toe=gpst2time(rtklib_sat.week,rtklib_sat.toes);
rtklib_sat.toc=gpst2time(rtklib_sat.week,toc);
rtklib_sat.ttr=gpst2time(rtklib_sat.week,tow);
tow = time2gpst(rtklib_sat.ttr, &rtklib_sat.week);
toc = time2gpst(rtklib_sat.toc, NULL);
if (rtklib_sat.toes < tow - 302400.0) {rtklib_sat.week++; tow -= 604800.0;}
else if (rtklib_sat.toes > tow + 302400.0) {rtklib_sat.week--; tow += 604800.0;}
rtklib_sat.toe = gpst2time(rtklib_sat.week, rtklib_sat.toes);
rtklib_sat.toc = gpst2time(rtklib_sat.week, toc);
rtklib_sat.ttr = gpst2time(rtklib_sat.week, tow);
return rtklib_sat;
}
eph_t eph_to_rtklib(Gps_Ephemeris gps_eph)
{
eph_t rtklib_sat;
eph_t rtklib_sat = {};
rtklib_sat.sat = gps_eph.i_satellite_PRN;
rtklib_sat.A=gps_eph.d_sqrt_A*gps_eph.d_sqrt_A;
rtklib_sat.M0=gps_eph.d_M_0;
rtklib_sat.deln=gps_eph.d_Delta_n;
rtklib_sat.OMG0=gps_eph.d_OMEGA0;
rtklib_sat.OMGd=gps_eph.d_OMEGA_DOT;
rtklib_sat.omg=gps_eph.d_OMEGA;
rtklib_sat.i0=gps_eph.d_i_0;
rtklib_sat.idot=gps_eph.d_IDOT;
rtklib_sat.e=gps_eph.d_e_eccentricity;
rtklib_sat.Adot=0; //only in CNAV;
rtklib_sat.ndot=0; //only in CNAV;
rtklib_sat.A = gps_eph.d_sqrt_A * gps_eph.d_sqrt_A;
rtklib_sat.M0 = gps_eph.d_M_0;
rtklib_sat.deln = gps_eph.d_Delta_n;
rtklib_sat.OMG0 = gps_eph.d_OMEGA0;
rtklib_sat.OMGd = gps_eph.d_OMEGA_DOT;
rtklib_sat.omg = gps_eph.d_OMEGA;
rtklib_sat.i0 = gps_eph.d_i_0;
rtklib_sat.idot = gps_eph.d_IDOT;
rtklib_sat.e = gps_eph.d_e_eccentricity;
rtklib_sat.Adot = 0; //only in CNAV;
rtklib_sat.ndot = 0; //only in CNAV;
rtklib_sat.week=adjgpsweek(gps_eph.i_GPS_week); /* week of tow */
rtklib_sat.cic=gps_eph.d_Cic;
rtklib_sat.cis=gps_eph.d_Cis;
rtklib_sat.cuc=gps_eph.d_Cuc;
rtklib_sat.cus=gps_eph.d_Cus;
rtklib_sat.crc=gps_eph.d_Crc;
rtklib_sat.crs=gps_eph.d_Crs;
rtklib_sat.f0=gps_eph.d_A_f0;
rtklib_sat.f1=gps_eph.d_A_f1;
rtklib_sat.f2=gps_eph.d_A_f2;
rtklib_sat.tgd[0]=gps_eph.d_TGD;
rtklib_sat.tgd[1]=0;
rtklib_sat.tgd[2]=0;
rtklib_sat.tgd[3]=0;
rtklib_sat.toes=gps_eph.d_Toe;
rtklib_sat.toc=gpst2time(rtklib_sat.week,gps_eph.d_Toc);
rtklib_sat.ttr=gpst2time(rtklib_sat.week,gps_eph.d_TOW);
rtklib_sat.week = adjgpsweek(gps_eph.i_GPS_week); /* week of tow */
rtklib_sat.cic = gps_eph.d_Cic;
rtklib_sat.cis = gps_eph.d_Cis;
rtklib_sat.cuc = gps_eph.d_Cuc;
rtklib_sat.cus = gps_eph.d_Cus;
rtklib_sat.crc = gps_eph.d_Crc;
rtklib_sat.crs = gps_eph.d_Crs;
rtklib_sat.f0 = gps_eph.d_A_f0;
rtklib_sat.f1 = gps_eph.d_A_f1;
rtklib_sat.f2 = gps_eph.d_A_f2;
rtklib_sat.tgd[0] = gps_eph.d_TGD;
rtklib_sat.tgd[1] = 0;
rtklib_sat.tgd[2] = 0;
rtklib_sat.tgd[3] = 0;
rtklib_sat.toes = gps_eph.d_Toe;
rtklib_sat.toc = gpst2time(rtklib_sat.week, gps_eph.d_Toc);
rtklib_sat.ttr = gpst2time(rtklib_sat.week, gps_eph.d_TOW);
/* adjustment for week handover */
double tow, toc;
tow=time2gpst(rtklib_sat.ttr,&rtklib_sat.week);
toc=time2gpst(rtklib_sat.toc,NULL);
if (rtklib_sat.toes<tow-302400.0) {rtklib_sat.week++; tow-=604800.0;}
else if (rtklib_sat.toes>tow+302400.0) {rtklib_sat.week--; tow+=604800.0;}
rtklib_sat.toe=gpst2time(rtklib_sat.week,rtklib_sat.toes);
rtklib_sat.toc=gpst2time(rtklib_sat.week,toc);
rtklib_sat.ttr=gpst2time(rtklib_sat.week,tow);
tow = time2gpst(rtklib_sat.ttr, &rtklib_sat.week);
toc = time2gpst(rtklib_sat.toc, NULL);
if (rtklib_sat.toes < tow - 302400.0) {rtklib_sat.week++; tow -= 604800.0;}
else if (rtklib_sat.toes > tow + 302400.0) {rtklib_sat.week--; tow += 604800.0;}
rtklib_sat.toe = gpst2time(rtklib_sat.week, rtklib_sat.toes);
rtklib_sat.toc = gpst2time(rtklib_sat.week, toc);
rtklib_sat.ttr = gpst2time(rtklib_sat.week, tow);
//printf("EPHEMERIS TIME [%i]: %s,%f\n\r",rtklib_sat.sat,time_str(rtklib_sat.toe,3),rtklib_sat.toe.sec);
return rtklib_sat;
}
eph_t eph_to_rtklib(Gps_CNAV_Ephemeris gps_cnav_eph)
{
eph_t rtklib_sat;
eph_t rtklib_sat = {};
rtklib_sat.sat = gps_cnav_eph.i_satellite_PRN;
const double A_REF = 26559710.0; // See IS-GPS-200H, pp. 170
rtklib_sat.A=A_REF + gps_cnav_eph.d_DELTA_A;
rtklib_sat.M0=gps_cnav_eph.d_M_0;
rtklib_sat.deln=gps_cnav_eph.d_Delta_n;
rtklib_sat.OMG0=gps_cnav_eph.d_OMEGA0;
rtklib_sat.A = A_REF + gps_cnav_eph.d_DELTA_A;
rtklib_sat.M0 = gps_cnav_eph.d_M_0;
rtklib_sat.deln = gps_cnav_eph.d_Delta_n;
rtklib_sat.OMG0 = gps_cnav_eph.d_OMEGA0;
// Compute the angle between the ascending node and the Greenwich meridian
const double OMEGA_DOT_REF = -2.6e-9; // semicircles / s, see IS-GPS-200H pp. 164
double d_OMEGA_DOT = OMEGA_DOT_REF*GPS_L2_PI + gps_cnav_eph.d_DELTA_OMEGA_DOT;
rtklib_sat.OMGd=d_OMEGA_DOT;
rtklib_sat.omg=gps_cnav_eph.d_OMEGA;
rtklib_sat.i0=gps_cnav_eph.d_i_0;
rtklib_sat.idot=gps_cnav_eph.d_IDOT;
rtklib_sat.e=gps_cnav_eph.d_e_eccentricity;
rtklib_sat.Adot=gps_cnav_eph.d_A_DOT; //only in CNAV;
rtklib_sat.ndot=gps_cnav_eph.d_DELTA_DOT_N; //only in CNAV;
double d_OMEGA_DOT = OMEGA_DOT_REF * GPS_L2_PI + gps_cnav_eph.d_DELTA_OMEGA_DOT;
rtklib_sat.OMGd = d_OMEGA_DOT;
rtklib_sat.omg = gps_cnav_eph.d_OMEGA;
rtklib_sat.i0 = gps_cnav_eph.d_i_0;
rtklib_sat.idot = gps_cnav_eph.d_IDOT;
rtklib_sat.e = gps_cnav_eph.d_e_eccentricity;
rtklib_sat.Adot = gps_cnav_eph.d_A_DOT; //only in CNAV;
rtklib_sat.ndot = gps_cnav_eph.d_DELTA_DOT_N; //only in CNAV;
rtklib_sat.week=adjgpsweek(gps_cnav_eph.i_GPS_week); /* week of tow */
rtklib_sat.cic=gps_cnav_eph.d_Cic;
rtklib_sat.cis=gps_cnav_eph.d_Cis;
rtklib_sat.cuc=gps_cnav_eph.d_Cuc;
rtklib_sat.cus=gps_cnav_eph.d_Cus;
rtklib_sat.crc=gps_cnav_eph.d_Crc;
rtklib_sat.crs=gps_cnav_eph.d_Crs;
rtklib_sat.f0=gps_cnav_eph.d_A_f0;
rtklib_sat.f1=gps_cnav_eph.d_A_f1;
rtklib_sat.f2=gps_cnav_eph.d_A_f2;
rtklib_sat.tgd[0]=gps_cnav_eph.d_TGD;
rtklib_sat.tgd[1]=0;
rtklib_sat.tgd[2]=0;
rtklib_sat.tgd[3]=0;
rtklib_sat.toes=gps_cnav_eph.d_Toe1;
rtklib_sat.toc=gpst2time(rtklib_sat.week,gps_cnav_eph.d_Toc);
rtklib_sat.ttr=gpst2time(rtklib_sat.week,gps_cnav_eph.d_TOW);
rtklib_sat.week = adjgpsweek(gps_cnav_eph.i_GPS_week); /* week of tow */
rtklib_sat.cic = gps_cnav_eph.d_Cic;
rtklib_sat.cis = gps_cnav_eph.d_Cis;
rtklib_sat.cuc = gps_cnav_eph.d_Cuc;
rtklib_sat.cus = gps_cnav_eph.d_Cus;
rtklib_sat.crc = gps_cnav_eph.d_Crc;
rtklib_sat.crs = gps_cnav_eph.d_Crs;
rtklib_sat.f0 = gps_cnav_eph.d_A_f0;
rtklib_sat.f1 = gps_cnav_eph.d_A_f1;
rtklib_sat.f2 = gps_cnav_eph.d_A_f2;
rtklib_sat.tgd[0] = gps_cnav_eph.d_TGD;
rtklib_sat.tgd[1] = 0;
rtklib_sat.tgd[2] = 0;
rtklib_sat.tgd[3] = 0;
rtklib_sat.toes = gps_cnav_eph.d_Toe1;
rtklib_sat.toc = gpst2time(rtklib_sat.week,gps_cnav_eph.d_Toc);
rtklib_sat.ttr = gpst2time(rtklib_sat.week,gps_cnav_eph.d_TOW);
/* adjustment for week handover */
double tow, toc;
tow=time2gpst(rtklib_sat.ttr,&rtklib_sat.week);
toc=time2gpst(rtklib_sat.toc,NULL);
if (rtklib_sat.toes<tow-302400.0) {rtklib_sat.week++; tow-=604800.0;}
else if (rtklib_sat.toes>tow+302400.0) {rtklib_sat.week--; tow+=604800.0;}
rtklib_sat.toe=gpst2time(rtklib_sat.week,rtklib_sat.toes);
rtklib_sat.toc=gpst2time(rtklib_sat.week,toc);
rtklib_sat.ttr=gpst2time(rtklib_sat.week,tow);
tow = time2gpst(rtklib_sat.ttr, &rtklib_sat.week);
toc = time2gpst(rtklib_sat.toc, NULL);
if (rtklib_sat.toes < tow - 302400.0) {rtklib_sat.week++; tow -= 604800.0;}
else if (rtklib_sat.toes > tow + 302400.0) {rtklib_sat.week--; tow += 604800.0;}
rtklib_sat.toe = gpst2time(rtklib_sat.week, rtklib_sat.toes);
rtklib_sat.toc = gpst2time(rtklib_sat.week, toc);
rtklib_sat.ttr = gpst2time(rtklib_sat.week, tow);
return rtklib_sat;
}

View File

@ -47,8 +47,10 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
#ifndef SRC_ALGORITHMS_PVT_LIBS_RTKLIB_CONVERSIONS_H_
#define SRC_ALGORITHMS_PVT_LIBS_RTKLIB_CONVERSIONS_H_
#ifndef GNSS_SDR_RTKLIB_CONVERSIONS_H_
#define GNSS_SDR_RTKLIB_CONVERSIONS_H_
#include "rtklib_rtkcmn.h"
#include "gnss_synchro.h"
@ -62,4 +64,4 @@ eph_t eph_to_rtklib(Gps_CNAV_Ephemeris gps_cnav_eph);
obsd_t obs_to_rtklib(Gnss_Synchro gnss_synchro, int week);
#endif /* SRC_ALGORITHMS_PVT_LIBS_RTKLIB_CONVERSIONS_H_ */
#endif /* GNSS_SDR_RTKLIB_CONVERSIONS_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -47,38 +47,12 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* history : 2010/07/28 1.1 moved from rtkcmn.c
* added api:
* eph2clk(),geph2clk(),seph2clk(),satantoff()
* satposs()
* changed api:
* eph2pos(),geph2pos(),satpos()
* deleted api:
* satposv(),satposiode()
* 2010/08/26 1.2 add ephemeris option EPHOPT_LEX
* 2010/09/09 1.3 fix problem when precise clock outage
* 2011/01/12 1.4 add api alm2pos()
* change api satpos(),satposs()
* enable valid unhealthy satellites and output status
* fix bug on exception by glonass ephem computation
* 2013/01/10 1.5 support beidou (compass)
* use newton's method to solve kepler eq.
* update ssr correction algorithm
* 2013/03/20 1.6 fix problem on ssr clock relativitic correction
* 2013/09/01 1.7 support negative pseudorange
* fix bug on variance in case of ura ssr = 63
* 2013/11/11 1.8 change constant MAXAGESSR 70.0 -> 90.0
* 2014/10/24 1.9 fix bug on return of var_uraeph() if ura<0||15<ura
* 2014/12/07 1.10 modify MAXDTOE for qzss,gal and bds
* test max number of iteration for Kepler
* 2015/08/26 1.11 update RTOL_ELPLER 1E-14 -> 1E-13
* set MAX_ITER_KEPLER for alm2pos()
*-----------------------------------------------------------------------------*/
*
*-----------------------------------------------------------------------------*/
#ifndef RTKLIB_EPHEMERIS_H_
#define RTKLIB_EPHEMERIS_H_
#ifndef GNSS_SDR_RTKLIB_EPHEMERIS_H_
#define GNSS_SDR_RTKLIB_EPHEMERIS_H_
#include "rtklib.h"
#include "rtklib_rtkcmn.h"
@ -122,4 +96,4 @@ void satposs(gtime_t teph, const obsd_t *obs, int n, const nav_t *nav,
#endif /* RTKLIB_EPHEMERIS_H_ */
#endif /* GNSS_SDR_RTKLIB_EPHEMERIS_H_ */

View File

@ -55,462 +55,536 @@
* Maps based on GPS Carrier Phase Data Routinely producted by CODE
* Analysis Center, Proceeding of the IGS Analysis Center Workshop, 1996
*
* version : $Revision:$ $Date:$
* history : 2011/03/29 1.0 new
* 2013/03/05 1.1 change api readtec()
* fix problem in case of lat>85deg or lat<-85deg
* 2014/02/22 1.2 fix problem on compiled as C++
*-----------------------------------------------------------------------------*/
#include "rtklib_ionex.h"
/* get index -----------------------------------------------------------------*/
int getindex(double value, const double *range)
{
if (range[2]==0.0) return 0;
if (range[1]>0.0&&(value<range[0]||range[1]<value)) return -1;
if (range[1]<0.0&&(value<range[1]||range[0]<value)) return -1;
return (int)floor((value-range[0])/range[2]+0.5);
if (range[2] == 0.0) return 0;
if (range[1] > 0.0 && (value < range[0] || range[1]<value)) return -1;
if (range[1] < 0.0 && (value < range[1] || range[0]<value)) return -1;
return (int)floor((value - range[0]) / range[2] + 0.5);
}
/* get number of items -------------------------------------------------------*/
int nitem(const double *range)
{
return getindex(range[1],range)+1;
return getindex(range[1], range) + 1;
}
/* data index (i:lat,j:lon,k:hgt) --------------------------------------------*/
int dataindex(int i, int j, int k, const int *ndata)
{
if (i<0||ndata[0]<=i||j<0||ndata[1]<=j||k<0||ndata[2]<=k) return -1;
return i+ndata[0]*(j+ndata[1]*k);
if (i < 0 || ndata[0] <= i || j < 0 || ndata[1] <= j || k < 0 || ndata[2] <= k) return -1;
return i + ndata[0] * (j + ndata[1] * k);
}
/* add tec data to navigation data -------------------------------------------*/
tec_t *addtec(const double *lats, const double *lons, const double *hgts,
double rb, nav_t *nav)
double rb, nav_t *nav)
{
tec_t *p,*nav_tec;
gtime_t time0={};
int i,n,ndata[3];
tec_t *p, *nav_tec;
gtime_t time0 = {};
int i, n, ndata[3];
trace(3,"addtec :\n");
trace(3, "addtec :\n");
ndata[0]=nitem(lats);
ndata[1]=nitem(lons);
ndata[2]=nitem(hgts);
if (ndata[0]<=1||ndata[1]<=1||ndata[2]<=0) return NULL;
ndata[0] = nitem(lats);
ndata[1] = nitem(lons);
ndata[2] = nitem(hgts);
if (ndata[0] <= 1 || ndata[1] <= 1 || ndata[2] <= 0) return NULL;
if (nav->nt>=nav->ntmax) {
nav->ntmax+=256;
if (!(nav_tec=(tec_t *)realloc(nav->tec,sizeof(tec_t)*nav->ntmax))) {
trace(1,"readionex malloc error ntmax=%d\n",nav->ntmax);
free(nav->tec); nav->tec=NULL; nav->nt=nav->ntmax=0;
if (nav->nt >= nav->ntmax)
{
nav->ntmax+=256;
if (!(nav_tec = (tec_t *)realloc(nav->tec, sizeof(tec_t)*nav->ntmax)))
{
trace(1, "readionex malloc error ntmax=%d\n", nav->ntmax);
free(nav->tec); nav->tec = NULL; nav->nt = nav->ntmax = 0;
return NULL;
}
nav->tec = nav_tec;
}
p = nav->tec+nav->nt;
p->time = time0;
p->rb = rb;
for (i = 0; i < 3; i++)
{
p->ndata[i] = ndata[i];
p->lats[i] = lats[i];
p->lons[i] = lons[i];
p->hgts[i] = hgts[i];
}
n = ndata[0] * ndata[1] * ndata[2];
if (!(p->data = (double *)malloc(sizeof(double) * n)) ||
!(p->rms = (float *)malloc(sizeof(float ) * n)))
{
return NULL;
}
nav->tec=nav_tec;
}
p=nav->tec+nav->nt;
p->time=time0;
p->rb=rb;
for (i=0;i<3;i++) {
p->ndata[i]=ndata[i];
p->lats[i]=lats[i];
p->lons[i]=lons[i];
p->hgts[i]=hgts[i];
}
n=ndata[0]*ndata[1]*ndata[2];
if (!(p->data=(double *)malloc(sizeof(double)*n))||
!(p->rms =(float *)malloc(sizeof(float )*n))) {
return NULL;
}
for (i=0;i<n;i++) {
p->data[i]=0.0;
p->rms [i]=0.0f;
}
for (i = 0; i < n; i++)
{
p->data[i] = 0.0;
p->rms [i] = 0.0f;
}
nav->nt++;
return p;
}
/* read ionex dcb aux data ----------------------------------------------------*/
void readionexdcb(FILE *fp, double *dcb, double *rms)
{
int i,sat;
char buff[1024],id[32],*label;
int i, sat;
char buff[1024], id[32], *label;
trace(3,"readionexdcb:\n");
trace(3, "readionexdcb:\n");
for (i=0;i<MAXSAT;i++) dcb[i]=rms[i]=0.0;
for (i = 0; i < MAXSAT; i++) dcb[i] = rms[i] = 0.0;
while (fgets(buff,sizeof(buff),fp)) {
if (strlen(buff)<60) continue;
label=buff+60;
while (fgets(buff, sizeof(buff), fp))
{
if (strlen(buff) < 60) continue;
label = buff + 60;
if (strstr(label,"PRN / BIAS / RMS")==label) {
if (strstr(label, "PRN / BIAS / RMS") == label)
{
strncpy(id, buff+3, 3); id[3] = '\0';
strncpy(id,buff+3,3); id[3]='\0';
if (!(sat=satid2no(id))) {
trace(2,"ionex invalid satellite: %s\n",id);
continue;
}
dcb[sat-1]=str2num(buff, 6,10);
rms[sat-1]=str2num(buff,16,10);
if (!(sat = satid2no(id)))
{
trace(2, "ionex invalid satellite: %s\n", id);
continue;
}
dcb[sat-1] = str2num(buff, 6, 10);
rms[sat-1] = str2num(buff, 16, 10);
}
else if (strstr(label, "END OF AUX DATA") == label) break;
}
else if (strstr(label,"END OF AUX DATA")==label) break;
}
}
/* read ionex header ---------------------------------------------------------*/
double readionexh(FILE *fp, double *lats, double *lons, double *hgts,
double *rb, double *nexp, double *dcb, double *rms)
double *rb, double *nexp, double *dcb, double *rms)
{
double ver=0.0;
char buff[1024],*label;
double ver = 0.0;
char buff[1024], *label;
trace(3,"readionexh:\n");
trace(3, "readionexh:\n");
while (fgets(buff,sizeof(buff),fp)) {
while (fgets(buff, sizeof(buff), fp))
{
if (strlen(buff)<60) continue;
label=buff+60;
if (strlen(buff) < 60) continue;
label = buff + 60;
if (strstr(label,"IONEX VERSION / TYPE")==label) {
if (buff[20]=='I') ver=str2num(buff,0,8);
if (strstr(label, "IONEX VERSION / TYPE") == label)
{
if (buff[20] == 'I') ver = str2num(buff, 0, 8);
}
else if (strstr(label, "BASE RADIUS") == label)
{
*rb = str2num(buff, 0, 8);
}
else if (strstr(label, "HGT1 / HGT2 / DHGT") == label)
{
hgts[0] = str2num(buff, 2, 6);
hgts[1] = str2num(buff, 8, 6);
hgts[2] = str2num(buff, 14, 6);
}
else if (strstr(label, "LAT1 / LAT2 / DLAT") == label)
{
lats[0] = str2num(buff, 2, 6);
lats[1] = str2num(buff, 8, 6);
lats[2] = str2num(buff, 14, 6);
}
else if (strstr(label,"LON1 / LON2 / DLON") == label)
{
lons[0] = str2num(buff, 2, 6);
lons[1] = str2num(buff, 8, 6);
lons[2] = str2num(buff, 14, 6);
}
else if (strstr(label, "EXPONENT") == label)
{
*nexp = str2num(buff, 0, 6);
}
else if (strstr(label, "START OF AUX DATA") == label &&
strstr(buff, "DIFFERENTIAL CODE BIASES"))
{
readionexdcb(fp, dcb, rms);
}
else if (strstr(label, "END OF HEADER") == label)
{
return ver;
}
}
else if (strstr(label,"BASE RADIUS")==label) {
*rb=str2num(buff,0,8);
}
else if (strstr(label,"HGT1 / HGT2 / DHGT")==label) {
hgts[0]=str2num(buff, 2,6);
hgts[1]=str2num(buff, 8,6);
hgts[2]=str2num(buff,14,6);
}
else if (strstr(label,"LAT1 / LAT2 / DLAT")==label) {
lats[0]=str2num(buff, 2,6);
lats[1]=str2num(buff, 8,6);
lats[2]=str2num(buff,14,6);
}
else if (strstr(label,"LON1 / LON2 / DLON")==label) {
lons[0]=str2num(buff, 2,6);
lons[1]=str2num(buff, 8,6);
lons[2]=str2num(buff,14,6);
}
else if (strstr(label,"EXPONENT")==label) {
*nexp=str2num(buff,0,6);
}
else if (strstr(label,"START OF AUX DATA")==label&&
strstr(buff,"DIFFERENTIAL CODE BIASES")) {
readionexdcb(fp,dcb,rms);
}
else if (strstr(label,"END OF HEADER")==label) {
return ver;
}
}
return 0.0;
}
/* read ionex body -----------------------------------------------------------*/
int readionexb(FILE *fp, const double *lats, const double *lons,
const double *hgts, double rb, double nexp, nav_t *nav)
const double *hgts, double rb, double nexp, nav_t *nav)
{
tec_t *p=NULL;
gtime_t time={};
double lat,lon[3],hgt,x;
int i,j,k,n,m,index,type=0;
char buff[1024],*label=buff+60;
tec_t *p = NULL;
gtime_t time = {};
double lat, lon[3], hgt, x;
int i, j, k, n, m, index, type = 0;
char buff[1024], *label = buff + 60;
trace(3,"readionexb:\n");
trace(3, "readionexb:\n");
while (fgets(buff,sizeof(buff),fp)) {
while (fgets(buff, sizeof(buff), fp))
{
if (strlen(buff) < 60) continue;
if (strlen(buff)<60) continue;
if (strstr(label,"START OF TEC MAP")==label) {
if ((p=addtec(lats,lons,hgts,rb,nav))) type=1;
}
else if (strstr(label,"END OF TEC MAP")==label) {
type=0;
p=NULL;
}
else if (strstr(label,"START OF RMS MAP")==label) {
type=2;
p=NULL;
}
else if (strstr(label,"END OF RMS MAP")==label) {
type=0;
p=NULL;
}
else if (strstr(label,"EPOCH OF CURRENT MAP")==label) {
if (str2time(buff,0,36,&time)) {
trace(2,"ionex epoch invalid: %-36.36s\n",buff);
continue;
}
if (type==2) {
for (i=nav->nt-1;i>=0;i--) {
if (fabs(timediff(time,nav->tec[i].time))>=1.0) continue;
p=nav->tec+i;
break;
if (strstr(label, "START OF TEC MAP") == label)
{
if ((p = addtec(lats, lons, hgts, rb, nav))) type = 1;
}
else if (strstr(label, "END OF TEC MAP") == label)
{
type = 0;
p = NULL;
}
else if (strstr(label, "START OF RMS MAP") == label)
{
type = 2;
p = NULL;
}
else if (strstr(label, "END OF RMS MAP") == label)
{
type = 0;
p = NULL;
}
else if (strstr(label, "EPOCH OF CURRENT MAP") == label)
{
if (str2time(buff, 0, 36, &time))
{
trace(2, "ionex epoch invalid: %-36.36s\n", buff);
continue;
}
if (type == 2)
{
for (i = nav->nt-1; i >= 0; i--)
{
if (fabs(timediff(time, nav->tec[i].time)) >= 1.0) continue;
p = nav->tec + i;
break;
}
}
else if (p) p->time = time;
}
else if (strstr(label, "LAT/LON1/LON2/DLON/H") == label && p)
{
lat = str2num(buff, 2, 6);
lon[0] = str2num(buff, 8, 6);
lon[1] = str2num(buff, 14, 6);
lon[2] = str2num(buff, 20, 6);
hgt = str2num(buff, 26, 6);
i = getindex(lat, p->lats);
k = getindex(hgt, p->hgts);
n = nitem(lon);
for (m = 0; m < n; m++)
{
if (m % 16 == 0 && !fgets(buff, sizeof(buff), fp)) break;
j = getindex(lon[0] + lon[2] * m, p->lons);
if ((index = dataindex(i, j, k, p->ndata)) < 0) continue;
if ((x = str2num(buff, m % 16 * 5, 5)) == 9999.0) continue;
if (type == 1) p->data[index] = x * std::pow(10.0, nexp);
else p->rms[index] = (float)(x * std::pow(10.0, nexp));
}
}
}
else if (p) p->time=time;
}
else if (strstr(label,"LAT/LON1/LON2/DLON/H")==label&&p) {
lat =str2num(buff, 2,6);
lon[0]=str2num(buff, 8,6);
lon[1]=str2num(buff,14,6);
lon[2]=str2num(buff,20,6);
hgt =str2num(buff,26,6);
i=getindex(lat,p->lats);
k=getindex(hgt,p->hgts);
n=nitem(lon);
for (m=0;m<n;m++) {
if (m%16==0&&!fgets(buff,sizeof(buff),fp)) break;
j=getindex(lon[0]+lon[2]*m,p->lons);
if ((index=dataindex(i,j,k,p->ndata))<0) continue;
if ((x=str2num(buff,m%16*5,5))==9999.0) continue;
if (type==1) p->data[index]=x*pow(10.0,nexp);
else p->rms[index]=(float)(x*pow(10.0,nexp));
}
}
}
return 1;
}
/* combine tec grid data -----------------------------------------------------*/
void combtec(nav_t *nav)
{
tec_t tmp;
int i,j,n=0;
int i, j, n = 0;
trace(3,"combtec : nav->nt=%d\n",nav->nt);
trace(3, "combtec : nav->nt=%d\n", nav->nt);
for (i=0;i<nav->nt-1;i++) {
for (j=i+1;j<nav->nt;j++) {
if (timediff(nav->tec[j].time,nav->tec[i].time)<0.0) {
tmp=nav->tec[i];
nav->tec[i]=nav->tec[j];
nav->tec[j]=tmp;
}
for (i = 0; i < nav->nt - 1; i++)
{
for (j = i + 1; j < nav->nt; j++)
{
if (timediff(nav->tec[j].time, nav->tec[i].time) < 0.0)
{
tmp = nav->tec[i];
nav->tec[i] = nav->tec[j];
nav->tec[j] = tmp;
}
}
}
}
for (i=0;i<nav->nt;i++) {
if (i>0&&timediff(nav->tec[i].time,nav->tec[n-1].time)==0.0) {
free(nav->tec[n-1].data);
free(nav->tec[n-1].rms );
nav->tec[n-1]=nav->tec[i];
continue;
for (i = 0; i < nav->nt; i++)
{
if (i > 0 && timediff(nav->tec[i].time, nav->tec[n - 1].time) == 0.0)
{
free(nav->tec[n - 1].data);
free(nav->tec[n - 1].rms );
nav->tec[n - 1] = nav->tec[i];
continue;
}
nav->tec[n++] = nav->tec[i];
}
nav->tec[n++]=nav->tec[i];
}
nav->nt=n;
nav->nt = n;
trace(4,"combtec : nav->nt=%d\n",nav->nt);
trace(4, "combtec : nav->nt=%d\n", nav->nt);
}
/* read ionex tec grid file ----------------------------------------------------
* read ionex ionospheric tec grid file
* args : char *file I ionex tec grid file
* (wind-card * is expanded)
* nav_t *nav IO navigation data
* nav->nt, nav->ntmax and nav->tec are modified
* int opt I read option (1: no clear of tec data,0:clear)
* return : none
* notes : see ref [1]
*-----------------------------------------------------------------------------*/
* read ionex ionospheric tec grid file
* args : char *file I ionex tec grid file
* (wind-card * is expanded)
* nav_t *nav IO navigation data
* nav->nt, nav->ntmax and nav->tec are modified
* int opt I read option (1: no clear of tec data,0:clear)
* return : none
* notes : see ref [1]
*-----------------------------------------------------------------------------*/
void readtec(const char *file, nav_t *nav, int opt)
{
FILE *fp;
double lats[3]={0},lons[3]={0},hgts[3]={0},rb=0.0,nexp=-1.0;
double dcb[MAXSAT]={0},rms[MAXSAT]={0};
int i,n;
double lats[3] = {0}, lons[3] = {0}, hgts[3] = {0}, rb = 0.0, nexp = -1.0;
double dcb[MAXSAT] = {0}, rms[MAXSAT] = {0};
int i, n;
char *efiles[MAXEXFILE];
trace(3,"readtec : file=%s\n",file);
trace(3, "readtec : file=%s\n", file);
/* clear of tec grid data option */
if (!opt) {
free(nav->tec); nav->tec=NULL; nav->nt=nav->ntmax=0;
}
for (i=0;i<MAXEXFILE;i++) {
if (!(efiles[i]=(char *)malloc(1024))) {
for (i--;i>=0;i--) free(efiles[i]);
return;
if (!opt)
{
free(nav->tec);
nav->tec = NULL;
nav->nt = nav->ntmax = 0;
}
for (i = 0; i < MAXEXFILE; i++)
{
if (!(efiles[i] = (char *)malloc(1024)))
{
for (i--; i >= 0; i--) free(efiles[i]);
return;
}
}
}
/* expand wild card in file path */
n=expath(file,efiles,MAXEXFILE);
n = expath(file, efiles, MAXEXFILE);
for (i=0;i<n;i++) {
if (!(fp=fopen(efiles[i],"r"))) {
trace(2,"ionex file open error %s\n",efiles[i]);
continue;
}
/* read ionex header */
if (readionexh(fp,lats,lons,hgts,&rb,&nexp,dcb,rms)<=0.0) {
trace(2,"ionex file format error %s\n",efiles[i]);
continue;
}
/* read ionex body */
readionexb(fp,lats,lons,hgts,rb,nexp,nav);
for (i = 0; i < n; i++)
{
if (!(fp = fopen(efiles[i], "r")))
{
trace(2, "ionex file open error %s\n", efiles[i]);
continue;
}
/* read ionex header */
if (readionexh(fp, lats, lons, hgts, &rb, &nexp, dcb, rms) <= 0.0)
{
trace(2, "ionex file format error %s\n", efiles[i]);
continue;
}
/* read ionex body */
readionexb(fp, lats, lons, hgts, rb, nexp, nav);
fclose(fp);
}
for (i=0;i<MAXEXFILE;i++) free(efiles[i]);
fclose(fp);
}
for (i = 0; i < MAXEXFILE; i++) free(efiles[i]);
/* combine tec grid data */
if (nav->nt>0) combtec(nav);
if (nav->nt > 0) combtec(nav);
/* P1-P2 dcb */
for (i=0;i<MAXSAT;i++) {
nav->cbias[i][0]=CLIGHT*dcb[i]*1E-9; /* ns->m */
}
for (i = 0; i < MAXSAT; i++)
{
nav->cbias[i][0] = SPEED_OF_LIGHT * dcb[i] * 1e-9; /* ns->m */
}
}
/* interpolate tec grid data -------------------------------------------------*/
int interptec(const tec_t *tec, int k, const double *posp, double *value,
double *rms)
double *rms)
{
double dlat,dlon,a,b,d[4]={0},r[4]={0};
int i,j,n,index;
double dlat, dlon, a, b, d[4] = {0}, r[4] = {0};
int i, j, n, index;
trace(3,"interptec: k=%d posp=%.2f %.2f\n",k,posp[0]*R2D,posp[1]*R2D);
*value=*rms=0.0;
trace(3, "interptec: k=%d posp=%.2f %.2f\n", k, posp[0] * R2D, posp[1] * R2D);
*value = *rms = 0.0;
if (tec->lats[2]==0.0||tec->lons[2]==0.0) return 0;
if (tec->lats[2] == 0.0 || tec->lons[2] == 0.0) return 0;
dlat=posp[0]*R2D-tec->lats[0];
dlon=posp[1]*R2D-tec->lons[0];
if (tec->lons[2]>0.0) dlon-=floor( dlon/360)*360.0; /* 0<=dlon<360 */
else dlon+=floor(-dlon/360)*360.0; /* -360<dlon<=0 */
dlat = posp[0] * R2D - tec->lats[0];
dlon = posp[1] * R2D - tec->lons[0];
if (tec->lons[2] > 0.0) dlon -= floor( dlon / 360) * 360.0; /* 0 <= dlon<360 */
else dlon += floor(-dlon / 360) * 360.0; /* -360<dlon <= 0 */
a=dlat/tec->lats[2];
b=dlon/tec->lons[2];
i=(int)floor(a); a-=i;
j=(int)floor(b); b-=j;
a = dlat / tec->lats[2];
b = dlon / tec->lons[2];
i = (int)floor(a);
a -= i;
j = (int)floor(b);
b -= j;
/* get gridded tec data */
for (n=0;n<4;n++) {
if ((index=dataindex(i+(n%2),j+(n<2?0:1),k,tec->ndata))<0) continue;
d[n]=tec->data[index];
r[n]=tec->rms [index];
}
if (d[0]>0.0&&d[1]>0.0&&d[2]>0.0&&d[3]>0.0) {
/* bilinear interpolation (inside of grid) */
*value=(1.0-a)*(1.0-b)*d[0]+a*(1.0-b)*d[1]+(1.0-a)*b*d[2]+a*b*d[3];
*rms =(1.0-a)*(1.0-b)*r[0]+a*(1.0-b)*r[1]+(1.0-a)*b*r[2]+a*b*r[3];
}
for (n = 0; n < 4; n++)
{
if ((index = dataindex(i + (n % 2), j + (n < 2 ? 0 : 1), k, tec->ndata)) < 0) continue;
d[n] = tec->data[index];
r[n] = tec->rms[index];
}
if (d[0] > 0.0 && d[1] > 0.0 && d[2] > 0.0 && d[3] > 0.0)
{
/* bilinear interpolation (inside of grid) */
*value = (1.0 - a) * (1.0 - b) * d[0] + a*(1.0 -b) * d[1] + (1.0 - a) * b * d[2] + a * b * d[3];
*rms = (1.0 - a) * (1.0 - b) * r[0] + a*(1.0 - b) * r[1] + (1.0 - a) * b * r[2] + a * b * r[3];
}
/* nearest-neighbour extrapolation (outside of grid) */
else if (a<=0.5&&b<=0.5&&d[0]>0.0) {*value=d[0]; *rms=r[0];}
else if (a> 0.5&&b<=0.5&&d[1]>0.0) {*value=d[1]; *rms=r[1];}
else if (a<=0.5&&b> 0.5&&d[2]>0.0) {*value=d[2]; *rms=r[2];}
else if (a> 0.5&&b> 0.5&&d[3]>0.0) {*value=d[3]; *rms=r[3];}
else {
i=0;
for (n=0;n<4;n++) if (d[n]>0.0) {i++; *value+=d[n]; *rms+=r[n];}
if(i==0) return 0;
*value/=i; *rms/=i;
}
else if (a <= 0.5 && b <= 0.5 && d[0] > 0.0) {*value = d[0]; *rms = r[0];}
else if (a > 0.5 && b <= 0.5 && d[1] > 0.0) {*value = d[1]; *rms = r[1];}
else if (a <= 0.5 && b > 0.5 && d[2] > 0.0) {*value = d[2]; *rms = r[2];}
else if (a > 0.5 && b > 0.5 && d[3] > 0.0) {*value = d[3]; *rms = r[3];}
else
{
i = 0;
for (n = 0; n < 4; n++) if (d[n] > 0.0) {i++; *value += d[n]; *rms += r[n];}
if(i == 0) return 0;
*value /= i;
*rms /= i;
}
return 1;
}
/* ionosphere delay by tec grid data -----------------------------------------*/
int iondelay(gtime_t time, const tec_t *tec, const double *pos,
const double *azel, int opt, double *delay, double *var)
const double *azel, int opt, double *delay, double *var)
{
const double fact=40.30E16/FREQ1/FREQ1; /* tecu->L1 iono (m) */
double fs,posp[3]={0},vtec,rms,hion,rp;
const double fact = 40.30E16 / FREQ1 / FREQ1; /* tecu->L1 iono (m) */
double fs, posp[3] = {0}, vtec, rms, hion, rp;
int i;
trace(3,"iondelay: time=%s pos=%.1f %.1f azel=%.1f %.1f\n",time_str(time,0),
pos[0]*R2D,pos[1]*R2D,azel[0]*R2D,azel[1]*R2D);
trace(3, "iondelay: time=%s pos=%.1f %.1f azel=%.1f %.1f\n", time_str(time, 0),
pos[0]*R2D, pos[1]*R2D, azel[0]*R2D, azel[1]*R2D);
*delay=*var=0.0;
*delay = *var = 0.0;
for (i=0;i<tec->ndata[2];i++) { /* for a layer */
for (i = 0;i < tec->ndata[2]; i++)
{ /* for a layer */
hion = tec->hgts[0] + tec->hgts[2] * i;
hion=tec->hgts[0]+tec->hgts[2]*i;
/* ionospheric pierce point position */
fs = ionppp(pos, azel, tec->rb, hion, posp);
/* ionospheric pierce point position */
fs=ionppp(pos,azel,tec->rb,hion,posp);
if (opt&2)
{
/* modified single layer mapping function (M-SLM) ref [2] */
rp = tec->rb / (tec->rb + hion) * sin(0.9782 * (PI / 2.0 - azel[1]));
fs = 1.0 / sqrt(1.0 - rp * rp);
}
if (opt&1)
{
/* earth rotation correction (sun-fixed coordinate) */
posp[1] += 2.0 * PI * timediff(time, tec->time) / 86400.0;
}
/* interpolate tec grid data */
if (!interptec(tec, i, posp, &vtec, &rms)) return 0;
if (opt&2) {
/* modified single layer mapping function (M-SLM) ref [2] */
rp=tec->rb/(tec->rb+hion)*sin(0.9782*(PI/2.0-azel[1]));
fs=1.0/sqrt(1.0-rp*rp);
*delay += fact * fs * vtec;
*var += fact * fact * fs * fs * rms * rms;
}
if (opt&1) {
/* earth rotation correction (sun-fixed coordinate) */
posp[1]+=2.0*PI*timediff(time,tec->time)/86400.0;
}
/* interpolate tec grid data */
if (!interptec(tec,i,posp,&vtec,&rms)) return 0;
*delay+=fact*fs*vtec;
*var+=fact*fact*fs*fs*rms*rms;
}
trace(4,"iondelay: delay=%7.2f std=%6.2f\n",*delay,sqrt(*var));
trace(4, "iondelay: delay=%7.2f std=%6.2f\n", *delay, sqrt(*var));
return 1;
}
/* ionosphere model by tec grid data -------------------------------------------
* compute ionospheric delay by tec grid data
* args : gtime_t time I time (gpst)
* nav_t *nav I navigation data
* double *pos I receiver position {lat,lon,h} (rad,m)
* double *azel I azimuth/elevation angle {az,el} (rad)
* int opt I model option
* bit0: 0:earth-fixed,1:sun-fixed
* bit1: 0:single-layer,1:modified single-layer
* double *delay O ionospheric delay (L1) (m)
* double *var O ionospheric dealy (L1) variance (m^2)
* return : status (1:ok,0:error)
* notes : before calling the function, read tec grid data by calling readtec()
* return ok with delay=0 and var=VAR_NOTEC if el<MIN_EL or h<MIN_HGT
*-----------------------------------------------------------------------------*/
* compute ionospheric delay by tec grid data
* args : gtime_t time I time (gpst)
* nav_t *nav I navigation data
* double *pos I receiver position {lat,lon,h} (rad,m)
* double *azel I azimuth/elevation angle {az,el} (rad)
* int opt I model option
* bit0: 0:earth-fixed,1:sun-fixed
* bit1: 0:single-layer,1:modified single-layer
* double *delay O ionospheric delay (L1) (m)
* double *var O ionospheric dealy (L1) variance (m^2)
* return : status (1:ok,0:error)
* notes : before calling the function, read tec grid data by calling readtec()
* return ok with delay=0 and var=VAR_NOTEC if el<MIN_EL or h<MIN_HGT
*-----------------------------------------------------------------------------*/
int iontec(gtime_t time, const nav_t *nav, const double *pos,
const double *azel, int opt, double *delay, double *var)
const double *azel, int opt, double *delay, double *var)
{
double dels[2],vars[2],a,tt;
int i,stat[2];
double dels[2], vars[2], a, tt;
int i, stat[2];
trace(3,"iontec : time=%s pos=%.1f %.1f azel=%.1f %.1f\n",time_str(time,0),
pos[0]*R2D,pos[1]*R2D,azel[0]*R2D,azel[1]*R2D);
trace(3, "iontec : time=%s pos=%.1f %.1f azel=%.1f %.1f\n", time_str(time, 0),
pos[0] * R2D, pos[1] * R2D, azel[0] * R2D, azel[1] * R2D);
if (azel[1]<MIN_EL||pos[2]<MIN_HGT) {
*delay=0.0;
*var=VAR_NOTEC;
return 1;
}
for (i=0;i<nav->nt;i++) {
if (timediff(nav->tec[i].time,time)>0.0) break;
}
if (i==0||i>=nav->nt) {
trace(2,"%s: tec grid out of period\n",time_str(time,0));
return 0;
}
if ((tt=timediff(nav->tec[i].time,nav->tec[i-1].time))==0.0) {
trace(2,"tec grid time interval error\n");
return 0;
}
if (azel[1] < MIN_EL || pos[2] < MIN_HGT)
{
*delay = 0.0;
*var = VAR_NOTEC;
return 1;
}
for (i = 0; i < nav->nt; i++)
{
if (timediff(nav->tec[i].time, time) > 0.0) break;
}
if (i == 0 || i >= nav->nt)
{
trace(2, "%s: tec grid out of period\n", time_str(time, 0));
return 0;
}
if ((tt = timediff(nav->tec[i].time, nav->tec[i-1].time)) == 0.0)
{
trace(2, "tec grid time interval error\n");
return 0;
}
/* ionospheric delay by tec grid data */
stat[0]=iondelay(time,nav->tec+i-1,pos,azel,opt,dels ,vars );
stat[1]=iondelay(time,nav->tec+i ,pos,azel,opt,dels+1,vars+1);
stat[0] = iondelay(time, nav->tec+i-1, pos, azel, opt, dels , vars );
stat[1] = iondelay(time, nav->tec+i , pos, azel, opt, dels+1, vars+1);
if (!stat[0]&&!stat[1]) {
trace(2,"%s: tec grid out of area pos=%6.2f %7.2f azel=%6.1f %5.1f\n",
time_str(time,0),pos[0]*R2D,pos[1]*R2D,azel[0]*R2D,azel[1]*R2D);
return 0;
}
if (stat[0]&&stat[1]) { /* linear interpolation by time */
a=timediff(time,nav->tec[i-1].time)/tt;
*delay=dels[0]*(1.0-a)+dels[1]*a;
*var =vars[0]*(1.0-a)+vars[1]*a;
}
else if (stat[0]) { /* nearest-neighbour extrapolation by time */
*delay=dels[0];
*var =vars[0];
}
else {
*delay=dels[1];
*var =vars[1];
}
trace(3,"iontec : delay=%5.2f std=%5.2f\n",*delay,sqrt(*var));
if (!stat[0] && !stat[1])
{
trace(2, "%s: tec grid out of area pos=%6.2f %7.2f azel=%6.1f %5.1f\n",
time_str(time, 0), pos[0] * R2D, pos[1] * R2D, azel[0] * R2D, azel[1] * R2D);
return 0;
}
if (stat[0] && stat[1])
{ /* linear interpolation by time */
a = timediff(time, nav->tec[i-1].time) / tt;
*delay = dels[0] * (1.0 - a) + dels[1] * a;
*var = vars[0] * (1.0 - a) + vars[1] * a;
}
else if (stat[0])
{ /* nearest-neighbour extrapolation by time */
*delay = dels[0];
*var = vars[0];
}
else
{
*delay = dels[1];
*var = vars[1];
}
trace(3, "iontec : delay=%5.2f std=%5.2f\n", *delay, sqrt(*var));
return 1;
}

View File

@ -1,5 +1,5 @@
/*!
* \file rtklib_ionex.cc
* \file rtklib_ionex.h
* \brief ionex functions
* \authors <ul>
* <li> 2007-2013, T. Takasu
@ -47,29 +47,24 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* references:
* [1] S.Schear, W.Gurtner and J.Feltens, IONEX: The IONosphere Map EXchange
* Format Version 1, February 25, 1998
* [2] S.Schaer, R.Markus, B.Gerhard and A.S.Timon, Daily Global Ionosphere
* Maps based on GPS Carrier Phase Data Routinely producted by CODE
* Analysis Center, Proceeding of the IGS Analysis Center Workshop, 1996
*
* version : $Revision:$ $Date:$
* history : 2011/03/29 1.0 new
* 2013/03/05 1.1 change api readtec()
* fix problem in case of lat>85deg or lat<-85deg
* 2014/02/22 1.2 fix problem on compiled as C++
*-----------------------------------------------------------------------------*/
#ifndef RTKLIB_IONEX_H_
#define RTKLIB_IONEX_H_
*
* References:
* [1] S.Schear, W.Gurtner and J.Feltens, IONEX: The IONosphere Map EXchange
* Format Version 1, February 25, 1998
* [2] S.Schaer, R.Markus, B.Gerhard and A.S.Timon, Daily Global Ionosphere
* Maps based on GPS Carrier Phase Data Routinely producted by CODE
* Analysis Center, Proceeding of the IGS Analysis Center Workshop, 1996
*
*-----------------------------------------------------------------------------*/
#ifndef GNSS_SDR_RTKLIB_IONEX_H_
#define GNSS_SDR_RTKLIB_IONEX_H_
#include "rtklib_rtkcmn.h"
#define SQR(x) ((x)*(x))
#define VAR_NOTEC SQR(30.0) /* variance of no tec */
#define MIN_EL 0.0 /* min elevation angle (rad) */
#define MIN_HGT -1000.0 /* min user height (m) */
const double VAR_NOTEC = 30.0 * 30.0; /* variance of no tec */
const double MIN_EL = 0.0; /* min elevation angle (rad) */
const double MIN_HGT = -1000.0; /* min user height (m) */
int getindex(double value, const double *range);
@ -92,4 +87,4 @@ int iondelay(gtime_t time, const tec_t *tec, const double *pos,
int iontec(gtime_t time, const nav_t *nav, const double *pos,
const double *azel, int opt, double *delay, double *var);
#endif /* SRC_ALGORITHMS_PVT_LIBS_RTKLIB_IONEX_H_ */
#endif /* GNSS_SDR_RTKLIB_IONEX_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -48,22 +48,10 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* history : 2010/07/28 1.0 moved from rtkcmn.c
* changed api:
* pntpos()
* deleted api:
* pntvel()
* 2011/01/12 1.1 add option to include unhealthy satellite
* reject duplicated observation data
* changed api: ionocorr()
* 2011/11/08 1.2 enable snr mask for single-mode (rtklib_2.4.1_p3)
* 2012/12/25 1.3 add variable snr mask
* 2014/05/26 1.4 support galileo and beidou
* 2015/03/19 1.5 fix bug on ionosphere correction for GLO and BDS
*-----------------------------------------------------------------------------*/
*-----------------------------------------------------------------------------*/
#ifndef RTKLIB_PNTPOS_H_
#define RTKLIB_PNTPOS_H_
#ifndef GNSS_SDR_RTKLIB_PNTPOS_H_
#define GNSS_SDR_RTKLIB_PNTPOS_H_
#include "rtklib.h"
#include "rtklib_rtkcmn.h"
@ -71,18 +59,15 @@
#include "rtklib_ionex.h"
/* constants -----------------------------------------------------------------*/
const int NX = 4 + 3; //!< # of estimated parameters
#define SQR(x) ((x)*(x))
#define NX (4+3) /* # of estimated parameters */
#define MAXITR 10 /* max number of iteration for point pos */
#define ERR_ION 5.0 /* ionospheric delay std (m) */
#define ERR_TROP 3.0 /* tropspheric delay std (m) */
#define ERR_SAAS 0.3 /* saastamoinen model error std (m) */
#define ERR_BRDCI 0.5 /* broadcast iono model error factor */
#define ERR_CBIAS 0.3 /* code bias error std (m) */
#define REL_HUMI 0.7 /* relative humidity for saastamoinen model */
const int MAXITR = 10; //!< max number of iteration for point pos
const double ERR_ION = 5.0; //!< ionospheric delay std (m)
const double ERR_TROP = 3.0; //!< tropspheric delay std (m)
const double ERR_SAAS = 0.3; //!< saastamoinen model error std (m)
const double ERR_BRDCI = 0.5; //!< broadcast iono model error factor
const double ERR_CBIAS = 0.3; //!< code bias error std (m)
const double REL_HUMI = 0.7; //!< relative humidity for saastamoinen model
/* pseudorange measurement error variance ------------------------------------*/
double varerr(const prcopt_t *opt, double el, int sys);
@ -177,4 +162,4 @@ int pntpos(const obsd_t *obs, int n, const nav_t *nav,
const prcopt_t *opt, sol_t *sol, double *azel, ssat_t *ssat,
char *msg);
#endif /* RTKLIB_PNTPOS_H_ */
#endif /* GNSS_SDR_RTKLIB_PNTPOS_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -48,57 +48,29 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* references :
* [1] S.Hilla, The Extended Standard Product 3 Orbit Format (SP3-c),
* 12 February, 2007
* [2] J.Ray, W.Gurtner, RINEX Extensions to Handle Clock Information,
* 27 August, 1998
* [3] D.D.McCarthy, IERS Technical Note 21, IERS Conventions 1996, July 1996
* [4] D.A.Vallado, Fundamentals of Astrodynamics and Applications 2nd ed,
* Space Technology Library, 2004
*
* version : $Revision: 1.1 $ $Date: 2008/07/17 21:48:06 $
* history : 2009/01/18 1.0 new
* 2009/01/31 1.1 fix bug on numerical error to read sp3a ephemeris
* 2009/05/15 1.2 support glonass,galileo,qzs
* 2009/12/11 1.3 support wild-card expansion of file path
* 2010/07/21 1.4 added api:
* eci2ecef(),sunmoonpos(),peph2pos(),satantoff(),
* readdcb()
* changed api:
* readsp3()
* deleted api:
* eph2posp()
* 2010/09/09 1.5 fix problem when precise clock outage
* 2011/01/23 1.6 support qzss satellite code
* 2011/09/12 1.7 fix problem on precise clock outage
* move sunmmonpos() to rtkcmn.c
* 2011/12/01 1.8 modify api readsp3()
* precede later ephemeris if ephemeris is NULL
* move eci2ecef() to rtkcmn.c
* 2013/05/08 1.9 fix bug on computing std-dev of precise clocks
* 2013/11/20 1.10 modify option for api readsp3()
* 2014/04/03 1.11 accept extenstion including sp3,eph,SP3,EPH
* 2014/05/23 1.12 add function to read sp3 velocity records
* change api: satantoff()
* 2014/08/31 1.13 add member cov and vco in peph_t sturct
* 2014/10/13 1.14 fix bug on clock error variance in peph2pos()
* 2015/05/10 1.15 add api readfcb()
* modify api readdcb()
*-----------------------------------------------------------------------------*/
#ifndef RTKLIB_PRECEPH_H_
#define RTKLIB_PRECEPH_H_
*
* References :
* [1] S.Hilla, The Extended Standard Product 3 Orbit Format (SP3-c),
* 12 February, 2007
* [2] J.Ray, W.Gurtner, RINEX Extensions to Handle Clock Information,
* 27 August, 1998
* [3] D.D.McCarthy, IERS Technical Note 21, IERS Conventions 1996, July 1996
* [4] D.A.Vallado, Fundamentals of Astrodynamics and Applications 2nd ed,
* Space Technology Library, 2004
*
*-----------------------------------------------------------------------------*/
#ifndef GNSS_SDR_RTKLIB_PRECEPH_H_
#define GNSS_SDR_RTKLIB_PRECEPH_H_
#include "rtklib.h"
#include "rtklib_rtkcmn.h"
#define SQR(x) ((x)*(x))
#define NMAX 10 /* order of polynomial interpolation */
#define MAXDTE 900.0 /* max time difference to ephem time (s) */
#define EXTERR_CLK 1E-3 /* extrapolation error for clock (m/s) */
#define EXTERR_EPH 5E-7 /* extrapolation error for ephem (m/s^2) */
const int NMAX = 10; /* order of polynomial interpolation */
const double MAXDTE = 900.0; /* max time difference to ephem time (s) */
const double EXTERR_CLK = 1e-3; /* extrapolation error for clock (m/s) */
const double EXTERR_EPH = 5e-7; /* extrapolation error for ephem (m/s^2) */
int code2sys(char code);
int readsp3h(FILE *fp, gtime_t *time, char *type, int *sats,
@ -133,4 +105,4 @@ void satantoff(gtime_t time, const double *rs, int sat, const nav_t *nav,
int peph2pos(gtime_t time, int sat, const nav_t *nav, int opt,
double *rs, double *dts, double *var);
#endif //RTKLIB_PRECEPH_H_
#endif // GNSS_SDR_RTKLIB_PRECEPH_H_

File diff suppressed because it is too large Load Diff

View File

@ -48,132 +48,44 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* options : -DLAPACK use LAPACK/BLAS
* -DMKL use Intel MKL
* -DTRACE enable debug trace
* -DWIN32 use WIN32 API
* -DNOCALLOC no use calloc for zero matrix
* -DIERS_MODEL use GMF instead of NMF
* -DDLL built for shared library
* -DCPUTIME_IN_GPST cputime operated in gpst
*
* references :
* [1] IS-GPS-200D, Navstar GPS Space Segment/Navigation User Interfaces,
* 7 March, 2006
* [2] RTCA/DO-229C, Minimum operational performanc standards for global
* positioning system/wide area augmentation system airborne equipment,
* RTCA inc, November 28, 2001
* [3] M.Rothacher, R.Schmid, ANTEX: The Antenna Exchange Format Version 1.4,
* 15 September, 2010
* [4] A.Gelb ed., Applied Optimal Estimation, The M.I.T Press, 1974
* [5] A.E.Niell, Global mapping functions for the atmosphere delay at radio
* wavelengths, Jounal of geophysical research, 1996
* [6] W.Gurtner and L.Estey, RINEX The Receiver Independent Exchange Format
* Version 3.00, November 28, 2007
* [7] J.Kouba, A Guide to using International GNSS Service (IGS) products,
* May 2009
* [8] China Satellite Navigation Office, BeiDou navigation satellite system
* signal in space interface control document, open service signal B1I
* (version 1.0), Dec 2012
* [9] J.Boehm, A.Niell, P.Tregoning and H.Shuh, Global Mapping Function
* (GMF): A new empirical mapping function base on numerical weather
* model data, Geophysical Research Letters, 33, L07304, 2006
* [10] GLONASS/GPS/Galileo/Compass/SBAS NV08C receiver series BINR interface
* protocol specification ver.1.3, August, 2012
*
* version : $Revision: 1.1 $ $Date: 2008/07/17 21:48:06 $
* history : 2007/01/12 1.0 new
* 2007/03/06 1.1 input initial rover pos of pntpos()
* update only effective states of filter()
* fix bug of atan2() domain error
* 2007/04/11 1.2 add function antmodel()
* add gdop mask for pntpos()
* change constant MAXDTOE value
* 2007/05/25 1.3 add function execcmd(),expandpath()
* 2008/06/21 1.4 add funciton sortobs(),uniqeph(),screent()
* replace geodist() by sagnac correction way
* 2008/10/29 1.5 fix bug of ionosphereic mapping function
* fix bug of seasonal variation term of tropmapf
* 2008/12/27 1.6 add function tickget(), sleepms(), tracenav(),
* xyz2enu(), satposv(), pntvel(), covecef()
* 2009/03/12 1.7 fix bug on error-stop when localtime() returns NULL
* 2009/03/13 1.8 fix bug on time adjustment for summer time
* 2009/04/10 1.9 add function adjgpsweek(),getbits(),getbitu()
* add function geph2pos()
* 2009/06/08 1.10 add function seph2pos()
* 2009/11/28 1.11 change function pntpos()
* add function tracegnav(),tracepeph()
* 2009/12/22 1.12 change default parameter of ionos std
* valid under second for timeget()
* 2010/07/28 1.13 fix bug in tropmapf()
* added api:
* obs2code(),code2obs(),cross3(),normv3(),
* gst2time(),time2gst(),time_str(),timeset(),
* deg2dms(),dms2deg(),searchpcv(),antmodel_s(),
* tracehnav(),tracepclk(),reppath(),reppaths(),
* createdir()
* changed api:
* readpcv(),
* deleted api:
* uniqeph()
* 2010/08/20 1.14 omit to include mkl header files
* fix bug on chi-sqr(n) table
* 2010/12/11 1.15 added api:
* freeobs(),freenav(),ionppp()
* 2011/05/28 1.16 fix bug on half-hour offset by time2epoch()
* added api:
* uniqnav()
* 2012/06/09 1.17 add a leap second after 2012-6-30
* 2012/07/15 1.18 add api setbits(),setbitu(),utc2gmst()
* fix bug on interpolation of antenna pcv
* fix bug on str2num() for string with over 256 char
* add api readblq(),satexclude(),setcodepri(),
* getcodepri()
* change api obs2code(),code2obs(),antmodel()
* 2012/12/25 1.19 fix bug on satwavelen(),code2obs(),obs2code()
* add api testsnr()
* 2013/01/04 1.20 add api gpst2bdt(),bdt2gpst(),bdt2time(),time2bdt()
* readblq(),readerp(),geterp(),crc16()
* change api eci2ecef(),sunmoonpos()
* 2013/03/26 1.21 tickget() uses clock_gettime() for linux
* 2013/05/08 1.22 fix bug on nutation coefficients for ast_args()
* 2013/06/02 1.23 add #ifdef for undefined CLOCK_MONOTONIC_RAW
* 2013/09/01 1.24 fix bug on interpolation of satellite antenna pcv
* 2013/09/06 1.25 fix bug on extrapolation of erp
* 2014/04/27 1.26 add SYS_LEO for satellite system
* add BDS L1 code for RINEX 3.02 and RTCM 3.2
* support BDS L1 in satwavelen()
* 2014/05/29 1.27 fix bug on obs2code() to search obs code table
* 2014/08/26 1.28 fix problem on output of uncompress() for tar file
* add function to swap trace file with keywords
* 2014/10/21 1.29 strtok() -> strtok_r() in expath() for thread-safe
* add bdsmodear in procopt_default
* 2015/03/19 1.30 fix bug on interpolation of erp values in geterp()
* add leap second insertion before 2015/07/01 00:00
* add api read_leaps()
* 2015/05/31 1.31 delte api windupcorr()
* 2015/08/08 1.32 add compile option CPUTIME_IN_GPST
* add api add_fatal()
* support usno leapsec.dat for api read_leaps()
* 2016/01/23 1.33 enable septentrio
* 2016/02/05 1.34 support GLONASS for savenav(), loadnav()
* 2016/06/11 1.35 delete trace() in reppath() to avoid deadlock
* 2016/07/01 1.36 support IRNSS
* add leap second before 2017/1/1 00:00:00
* 2016/07/29 1.37 rename api compress() -> rtk_uncompress()
* rename api crc16() -> rtk_crc16()
* rename api crc24q() -> rtk_crc24q()
* rename api crc32() -> rtk_crc32()
* 2016/08/20 1.38 fix type incompatibility in win64 environment
* change constant _POSIX_C_SOURCE 199309 -> 199506
* 2016/08/21 1.39 fix bug on week overflow in time2gpst()/gpst2time()
* 2016/09/05 1.40 fix bug on invalid nav data read in readnav()
* 2016/09/17 1.41 suppress warnings
* 2016/09/19 1.42 modify api deg2dms() to consider numerical error
*-----------------------------------------------------------------------------*/
#ifndef RTKLIB_RTKCMN_H_
#define RTKLIB_RTKCMN_H_
*
* options : -DLAPACK use LAPACK/BLAS
* -DMKL use Intel MKL
* -DTRACE enable debug trace
* -DWIN32 use WIN32 API
* -DNOCALLOC no use calloc for zero matrix
* -DIERS_MODEL use GMF instead of NMF
* -DDLL built for shared library
* -DCPUTIME_IN_GPST cputime operated in gpst
*
* references :
* [1] IS-GPS-200D, Navstar GPS Space Segment/Navigation User Interfaces,
* 7 March, 2006
* [2] RTCA/DO-229C, Minimum operational performanc standards for global
* positioning system/wide area augmentation system airborne equipment,
* RTCA inc, November 28, 2001
* [3] M.Rothacher, R.Schmid, ANTEX: The Antenna Exchange Format Version 1.4,
* 15 September, 2010
* [4] A.Gelb ed., Applied Optimal Estimation, The M.I.T Press, 1974
* [5] A.E.Niell, Global mapping functions for the atmosphere delay at radio
* wavelengths, Jounal of geophysical research, 1996
* [6] W.Gurtner and L.Estey, RINEX The Receiver Independent Exchange Format
* Version 3.00, November 28, 2007
* [7] J.Kouba, A Guide to using International GNSS Service (IGS) products,
* May 2009
* [8] China Satellite Navigation Office, BeiDou navigation satellite system
* signal in space interface control document, open service signal B1I
* (version 1.0), Dec 2012
* [9] J.Boehm, A.Niell, P.Tregoning and H.Shuh, Global Mapping Function
* (GMF): A new empirical mapping function base on numerical weather
* model data, Geophysical Research Letters, 33, L07304, 2006
* [10] GLONASS/GPS/Galileo/Compass/SBAS NV08C receiver series BINR interface
* protocol specification ver.1.3, August, 2012
*
*-----------------------------------------------------------------------------*/
#ifndef GNSS_SDR_RTKLIB_RTKCMN_H_
#define GNSS_SDR_RTKLIB_RTKCMN_H_
#include "rtklib.h"
@ -307,19 +219,19 @@ int savenav(const char *file, const nav_t *nav);
void freeobs(obs_t *obs);
void freenav(nav_t *nav, int opt);
void traceopen(const char *file);
void traceclose(void);
void tracelevel(int level);
//void traceopen(const char *file);
//void traceclose(void);
//void tracelevel(int level);
void trace (int level, const char *format, ...);
void tracet (int level, const char *format, ...);
void tracemat(int level, const double *A, int n, int m, int p, int q);
void traceobs(int level, const obsd_t *obs, int n);
void tracenav(int level, const nav_t *nav);
void tracegnav(int level, const nav_t *nav);
void tracehnav(int level, const nav_t *nav);
void tracepeph(int level, const nav_t *nav);
void tracepclk(int level, const nav_t *nav);
void traceb (int level, const unsigned char *p, int n);
//void tracet (int level, const char *format, ...);
//void tracemat(int level, const double *A, int n, int m, int p, int q);
//void traceobs(int level, const obsd_t *obs, int n);
//void tracenav(int level, const nav_t *nav);
//void tracegnav(int level, const nav_t *nav);
//void tracehnav(int level, const nav_t *nav);
//void tracepeph(int level, const nav_t *nav);
//void tracepclk(int level, const nav_t *nav);
//void traceb (int level, const unsigned char *p, int n);
int execcmd(const char *cmd);
void createdir(const char *path);
@ -360,4 +272,4 @@ void csmooth(obs_t *obs, int ns);
int rtk_uncompress(const char *file, char *uncfile);
int expath(const char *path, char *paths[], int nmax);
#endif /* RTKLIB_RTKCMN_H_ */
#endif /* GNSS_SDR_RTKLIB_RTKCMN_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -48,43 +48,21 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* option : -DRRCENA enable rrc correction
*
* references :
* [1] RTCA/DO-229C, Minimum operational performanc standards for global
* positioning system/wide area augmentation system airborne equipment,
* RTCA inc, November 28, 2001
* [2] IS-QZSS v.1.1, Quasi-Zenith Satellite System Navigation Service
* Interface Specification for QZSS, Japan Aerospace Exploration Agency,
* July 31, 2009
*
* version : $Revision: 1.1 $ $Date: 2008/07/17 21:48:06 $
* history : 2007/10/14 1.0 new
* 2009/01/24 1.1 modify sbspntpos() api
* improve fast/ion correction update
* 2009/04/08 1.2 move function crc24q() to rcvlog.c
* support glonass, galileo and qzss
* 2009/06/08 1.3 modify sbsupdatestat()
* delete sbssatpos()
* 2009/12/12 1.4 support glonass
* 2010/01/22 1.5 support ems (egnos message service) format
* 2010/06/10 1.6 added api:
* sbssatcorr(),sbstropcorr(),sbsioncorr(),
* sbsupdatecorr()
* changed api:
* sbsreadmsgt(),sbsreadmsg()
* deleted api:
* sbspntpos(),sbsupdatestat()
* 2010/08/16 1.7 not reject udre==14 or give==15 correction message
* (2.4.0_p4)
* 2011/01/15 1.8 use api ionppp()
* add prn mask of qzss for qzss L1SAIF
* 2016/07/29 1.9 crc24q() -> rtk_crc24q()
*-----------------------------------------------------------------------------*/
*
* option : -DRRCENA enable rrc correction
*
* References :
* [1] RTCA/DO-229C, Minimum operational performanc standards for global
* positioning system/wide area augmentation system airborne equipment,
* RTCA inc, November 28, 2001
* [2] IS-QZSS v.1.1, Quasi-Zenith Satellite System Navigation Service
* Interface Specification for QZSS, Japan Aerospace Exploration Agency,
* July 31, 2009
*
*-----------------------------------------------------------------------------*/
#ifndef RTKLIB_SBAS_H_
#define RTKLIB_SBAS_H_
#ifndef GNSS_SDR_RTKLIB_SBAS_H_
#define GNSS_SDR_RTKLIB_SBAS_H_
#include "rtklib.h"
#include "rtklib_rtkcmn.h"
@ -94,51 +72,51 @@
/* sbas igp definition -------------------------------------------------------*/
static const short
x1[]={-75,-65,-55,-50,-45,-40,-35,-30,-25,-20,-15,-10,- 5, 0, 5, 10, 15, 20,
x1[] = {-75, -65, -55, -50, -45, -40, -35, -30, -25, -20, -15, -10, - 5, 0, 5, 10, 15, 20,
25, 30, 35, 40, 45, 50, 55, 65, 75, 85},
x2[]={-55,-50,-45,-40,-35,-30,-25,-20,-15,-10, -5, 0, 5, 10, 15, 20, 25, 30,
x2[] = {-55, -50, -45, -40, -35, -30, -25, -20, -15, -10, -5, 0, 5, 10, 15, 20, 25, 30,
35, 40, 45, 50, 55},
x3[]={-75,-65,-55,-50,-45,-40,-35,-30,-25,-20,-15,-10,- 5, 0, 5, 10, 15, 20,
x3[] = {-75, -65, -55, -50, -45, -40, -35, -30, -25, -20, -15, -10, - 5, 0, 5, 10, 15, 20,
25, 30, 35, 40, 45, 50, 55, 65, 75},
x4[]={-85,-75,-65,-55,-50,-45,-40,-35,-30,-25,-20,-15,-10,- 5, 0, 5, 10, 15,
x4[] = {-85, -75, -65, -55, -50, -45, -40, -35, -30, -25, -20, -15, -10, - 5, 0, 5, 10, 15,
20, 25, 30, 35, 40, 45, 50, 55, 65, 75},
x5[]={-180,-175,-170,-165,-160,-155,-150,-145,-140,-135,-130,-125,-120,-115,
-110,-105,-100,- 95,- 90,- 85,- 80,- 75,- 70,- 65,- 60,- 55,- 50,- 45,
- 40,- 35,- 30,- 25,- 20,- 15,- 10,- 5, 0, 5, 10, 15, 20, 25,
x5[] = {-180, -175, -170, -165, -160, -155, -150, -145, -140, -135, -130, -125, -120, -115,
-110, -105, -100, - 95, - 90, - 85, - 80, - 75, - 70, - 65, - 60, - 55, - 50, - 45,
- 40, - 35, - 30, - 25, - 20, - 15, - 10, - 5, 0, 5, 10, 15, 20, 25,
30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95,
100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165,
170, 175},
x6[]={-180,-170,-160,-150,-140,-130,-120,-110,-100,- 90,- 80,- 70,- 60,- 50,
- 40,- 30,- 20,- 10, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90,
x6[] = {-180, -170, -160, -150, -140, -130, -120, -110, -100, - 90, - 80, - 70, - 60, - 50,
- 40, - 30, - 20, - 10, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90,
100, 110, 120, 130, 140, 150, 160, 170},
x7[]={-180,-150,-120,- 90,- 60,- 30, 0, 30, 60, 90, 120, 150},
x8[]={-170,-140,-110,- 80,- 50,- 20, 10, 40, 70, 100, 130, 160};
x7[] = {-180, -150, -120, - 90, - 60, - 30, 0, 30, 60, 90, 120, 150},
x8[] = {-170, -140, -110, - 80, - 50, - 20, 10, 40, 70, 100, 130, 160};
const sbsigpband_t igpband1[9][8]={ /* band 0-8 */
{{-180,x1, 1, 28},{-175,x2, 29, 51},{-170,x3, 52, 78},{-165,x2, 79,101},
{-160,x3,102,128},{-155,x2,129,151},{-150,x3,152,178},{-145,x2,179,201}},
{{-140,x4, 1, 28},{-135,x2, 29, 51},{-130,x3, 52, 78},{-125,x2, 79,101},
{-120,x3,102,128},{-115,x2,129,151},{-110,x3,152,178},{-105,x2,179,201}},
{{-100,x3, 1, 27},{- 95,x2, 28, 50},{- 90,x1, 51, 78},{- 85,x2, 79,101},
{- 80,x3,102,128},{- 75,x2,129,151},{- 70,x3,152,178},{- 65,x2,179,201}},
{{- 60,x3, 1, 27},{- 55,x2, 28, 50},{- 50,x4, 51, 78},{- 45,x2, 79,101},
{- 40,x3,102,128},{- 35,x2,129,151},{- 30,x3,152,178},{- 25,x2,179,201}},
{{- 20,x3, 1, 27},{- 15,x2, 28, 50},{- 10,x3, 51, 77},{- 5,x2, 78,100},
{ 0,x1,101,128},{ 5,x2,129,151},{ 10,x3,152,178},{ 15,x2,179,201}},
{{ 20,x3, 1, 27},{ 25,x2, 28, 50},{ 30,x3, 51, 77},{ 35,x2, 78,100},
{ 40,x4,101,128},{ 45,x2,129,151},{ 50,x3,152,178},{ 55,x2,179,201}},
{{ 60,x3, 1, 27},{ 65,x2, 28, 50},{ 70,x3, 51, 77},{ 75,x2, 78,100},
{ 80,x3,101,127},{ 85,x2,128,150},{ 90,x1,151,178},{ 95,x2,179,201}},
{{ 100,x3, 1, 27},{ 105,x2, 28, 50},{ 110,x3, 51, 77},{ 115,x2, 78,100},
{ 120,x3,101,127},{ 125,x2,128,150},{ 130,x4,151,178},{ 135,x2,179,201}},
{{ 140,x3, 1, 27},{ 145,x2, 28, 50},{ 150,x3, 51, 77},{ 155,x2, 78,100},
{ 160,x3,101,127},{ 165,x2,128,150},{ 170,x3,151,177},{ 175,x2,178,200}}
const sbsigpband_t igpband1[9][8] = { /* band 0-8 */
{{-180, x1, 1, 28}, {-175, x2, 29, 51}, {-170, x3, 52, 78}, {-165, x2, 79, 101},
{-160, x3, 102, 128}, {-155, x2, 129, 151}, {-150, x3, 152, 178}, {-145, x2, 179, 201}},
{{-140, x4, 1, 28}, {-135, x2, 29, 51}, {-130, x3, 52, 78}, {-125, x2, 79, 101},
{-120, x3, 102, 128}, {-115, x2, 129, 151}, {-110, x3, 152, 178}, {-105, x2, 179, 201}},
{{-100, x3, 1, 27}, {- 95,x2, 28, 50},{- 90, x1, 51, 78}, {- 85, x2, 79, 101},
{- 80, x3, 102, 128}, {- 75, x2, 129, 151}, {- 70, x3, 152, 178}, {- 65, x2,179, 201}},
{{- 60, x3, 1, 27}, {- 55, x2, 28, 50}, {- 50,x4, 51, 78}, {- 45, x2, 79, 101},
{- 40, x3, 102, 128}, {- 35, x2, 129, 151}, {- 30, x3, 152, 178}, {- 25, x2, 179, 201}},
{{- 20, x3, 1, 27}, {- 15, x2, 28, 50}, {- 10, x3, 51, 77}, {- 5, x2, 78, 100},
{ 0, x1, 101, 128}, { 5, x2, 129, 151}, { 10, x3, 152, 178}, { 15, x2, 179, 201}},
{{ 20, x3, 1, 27}, { 25, x2, 28, 50}, { 30, x3, 51, 77}, { 35, x2, 78, 100},
{ 40, x4, 101, 128}, { 45, x2, 129, 151},{ 50, x3, 152, 178}, { 55, x2, 179, 201}},
{{ 60, x3, 1, 27}, { 65, x2, 28, 50}, { 70, x3, 51, 77}, { 75, x2, 78, 100},
{ 80, x3, 101, 127}, { 85, x2, 128, 150}, { 90,x1, 151, 178}, { 95, x2, 179, 201}},
{{ 100, x3, 1, 27}, { 105, x2, 28, 50}, { 110, x3, 51, 77}, { 115, x2, 78 ,100},
{ 120, x3, 101, 127}, { 125, x2, 128, 150}, { 130, x4, 151, 178}, { 135, x2, 179, 201}},
{{ 140, x3, 1, 27}, { 145, x2, 28, 50}, { 150, x3, 51, 77}, { 155, x2, 78, 100},
{ 160, x3, 101, 127}, { 165, x2,128, 150}, { 170, x3,151,177}, { 175, x2, 178, 200}}
};
const sbsigpband_t igpband2[2][5]={ /* band 9-10 */
{{ 60,x5, 1, 72},{ 65,x6, 73,108},{ 70,x6,109,144},{ 75,x6,145,180},
{ 85,x7,181,192}},
{{- 60,x5, 1, 72},{- 65,x6, 73,108},{- 70,x6,109,144},{- 75,x6,145,180},
{- 85,x8,181,192}}
const sbsigpband_t igpband2[2][5] = { /* band 9-10 */
{{ 60, x5, 1, 72}, { 65, x6, 73, 108}, { 70, x6, 109, 144}, { 75, x6, 145, 180},
{ 85, x7, 181, 192}},
{{- 60, x5, 1, 72}, {- 65, x6, 73, 108}, {- 70, x6, 109, 144}, {- 75 ,x6, 145, 180},
{- 85, x8, 181, 192}}
};
@ -146,6 +124,7 @@ char *getfield(char *p, int pos);
double varfcorr(int udre);
double varicorr(int give);
double degfcorr(int ai);
int decode_sbstype1(const sbsmsg_t *msg, sbssat_t *sbssat);
int decode_sbstype2(const sbsmsg_t *msg, sbssat_t *sbssat);
int decode_sbstype6(const sbsmsg_t *msg, sbssat_t *sbssat);
@ -158,6 +137,7 @@ int decode_longcorrh(const sbsmsg_t *msg, int p, sbssat_t *sbssat);
int decode_sbstype24(const sbsmsg_t *msg, sbssat_t *sbssat);
int decode_sbstype25(const sbsmsg_t *msg, sbssat_t *sbssat);
int decode_sbstype26(const sbsmsg_t *msg, sbsion_t *sbsion);
int sbsupdatecorr(const sbsmsg_t *msg, nav_t *nav);
void readmsgs(const char *file, int sel, gtime_t ts, gtime_t te,sbs_t *sbs);
int cmpmsgs(const void *p1, const void *p2);
@ -184,4 +164,4 @@ int sbsdecodemsg(gtime_t time, int prn, const unsigned int *words,
sbsmsg_t *sbsmsg);
#endif /* RTKLIB_SBAS_H_ */
#endif /* GNSS_SDR_RTKLIB_SBAS_H_ */

View File

@ -76,6 +76,14 @@ if(MSVC)
add_compile_options(/wo4838)
endif(MSVC)
# allow 'large' files in 32 bit builds
if(UNIX)
add_definitions( -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64
-D_LARGE_FILES
)
endif(UNIX)
########################################################################
# Dependencies setup
########################################################################

View File

@ -1,26 +1,56 @@
# Welcome to VOLK_GNSSSDR, the Vector-Optimized Library of Kernels for GNSS-SDR
VOLK_GNSSSDR is a sub-project of GNSS-SDR. This library provides a set of extra kernels that can be used stand-alone or in combination with VOLK's. Please see http://libvolk.org for documentation, source code, and contact information about the original VOLK library.
VOLK_GNSSSDR is a sub-project of GNSS-SDR. This library provides a set
of extra kernels that can be used stand-alone or in combination with
VOLK's. Please see http://libvolk.org for documentation, source code,
and contact information about the original VOLK library.
The boilerplate of this code was initially generated with ```volk_modtool```, an application provided by VOLK that creates the skeleton than can then be filled with custom kernels. Some modifications were added to accomodate the specificities of Global Navigation Satellite Systems (GNSS) signal processing. Those changes are clearly indicated in the source code, and do not break compatibility.
The boilerplate of this code was initially generated with
```volk_modtool```, an application provided by VOLK that creates the
skeleton than can then be filled with custom kernels. Some modifications
were added to accomodate the specificities of Global Navigation
Satellite Systems (GNSS) signal processing. Those changes are clearly
indicated in the source code, and do not break compatibility.
This library contains kernels of hand-written SIMD code for different mathematical operations, mainly with 8-bit and 16-bit real and complex data types, offering a platform/architecture agnostic version that will run in all machines, plus other versions for different SIMD instruction sets. Then, the application ```volk_gnsssdr_profile``` runs some iterations of all versions that your machine can execute and annotates which is the fastest, which will then be selected at runtime when executing GNSS-SDR. In this way, we can address at the same time portability (by creating executables that will run in nearly all processor architectures) and efficiency (by providing custom implementations specially designed to take advantage of the specific processor that is running the code).
This library contains kernels of hand-written SIMD code for different
mathematical operations, mainly with 8-bit and 16-bit real and complex
data types, offering a platform/architecture agnostic version that will
run in all machines, plus other versions for different SIMD instruction
sets. Then, the application ```volk_gnsssdr_profile``` runs some
iterations of all versions that your machine can execute and annotates
which is the fastest, which will then be selected at runtime when
executing GNSS-SDR. In this way, we can address at the same time
[portability](http://gnss-sdr.org/design-forces/portability/) (by
creating executables that will run in nearly all processor
architectures) and
[efficiency](http://gnss-sdr.org/design-forces/efficiency/) (by
providing custom implementations specially designed to take advantage of
the specific processor that is running the code).
These kernels have some specific features (e.g. saturation arithmetics) that are aimed to GNSS signal processing, but could make them not suitable for its general use in other applications. Check out the documentation generated by Doxygen and the *generic* (that is, plain C) implementation to see what each kernel is actually doing.
These kernels have some specific features (e.g. saturation arithmetics)
that are aimed to GNSS signal processing, but could make them not
suitable for its general use in other applications. Check out the
documentation generated by Doxygen and the *generic* (that is, plain C)
implementation to see what each kernel is actually doing.
## How to use VOLK_GNSSSDR:
This library is automatically built and installed along with GNSS-SDR if it is not found by CMake on your system at configure time.
This library is automatically built and installed along with GNSS-SDR if
it is not found by CMake on your system at configure time.
However, you can install and use VOLK_GNSSSDR kernels as you use VOLK's, independently from GNSS-SDR.
However, you can install and use VOLK_GNSSSDR kernels as you use VOLK's,
independently from GNSS-SDR.
First, make sure that the required dependencies are installed in you machine:
First, make sure that the required dependencies are installed in your
machine:
~~~~~~
$ sudo apt-get install git cmake python-mako python-six libboost-dev libbbost-filesystem
$ sudo apt-get install cmake python-mako python-six libboost-dev \
libboost-filesystem-dev libboost-system-dev libboost-program-options-dev
~~~~~~
In order to build and install the library, go to the base folder of the source code and do:
In order to build and install the library, go to the base folder of the
source code and do:
~~~~~~
$ mkdir build
@ -32,15 +62,20 @@ $ sudo make install
That's it!
Before its first use, please execute ```volk_gnsssdr_profile``` to let your system know which is the fastest available implementation. This only has to be done once:
Before its first use, please execute ```volk_gnsssdr_profile``` to let
your system know which is the fastest available implementation. This
only has to be done once:
~~~~~~
$ volk_gnsssdr_profile
~~~~~~
From now on, GNSS-SDR (and any other program of your own that makes use of VOLK_GNSSSDR) will benefit from the acceleration provided by SIMD instructions available in your processor.
From now on, GNSS-SDR (and any other program of your own that makes use
of VOLK_GNSSSDR) will benefit from the acceleration provided by SIMD
instructions available in your processor.
The execution of ```volk_gnsssdr_profile``` can be set automatically after building, leaving your system ready to use:
The execution of ```volk_gnsssdr_profile``` can be set automatically
after building, leaving your system ready to use:
~~~~~~
$ cmake -DENABLE_PROFILING=ON ../
@ -49,22 +84,35 @@ $ sudo make install
~~~~~~
This figure shows the role of some VOLK_GNSSSDR kernels in the context of a GNSS baseband processor:
This figure shows the role of some VOLK_GNSSSDR kernels in the context
of a GNSS baseband processor:
![Example of VOLK_GNSSSDR usage.](./docs/images/VOLK_GNSSSDR_Usage_Example.png)
![Example of VOLK_GNSSSDR
usage.](./docs/images/VOLK_GNSSSDR_Usage_Example.png)
If you use VOLK_GNSSSDR in your research and/or software, please cite the following paper:
If you use VOLK_GNSSSDR in your research and/or software, please cite
the following paper:
* C. Fern&aacute;ndez-Prades, J. Arribas, P. Closas, [*Accelerating GNSS Software Receivers*](https://zenodo.org/record/266493), in Proc. of the ION GNSS+ 2016 Conference, pp. 44-61, Portland, Oregon, Sept. 12-16, 2016.
* C. Fernández-Prades, J. Arribas, P. Closas, [*Accelerating
GNSS Software Receivers*](https://zenodo.org/record/266493), in Proc. of
the ION GNSS+ 2016 Conference, pp. 44-61, Portland, Oregon, Sept. 12-16, 2016.
Citations are useful for the continued development and maintenance of the library.
Citations are useful for the continued development and maintenance of
the library.
___
VOLK_GNSSSDR was originally created by Andres Cecilia Luque in the framework of the [Summer Of Code In Space (SOCIS 2014)](http://sophia.estec.esa.int/socis2014/?q=about "SOCIS 2014 webpage") program organized by the European Space Agency, and then evolved and maintained by Carles Fern&aacute;ndez-Prades and Javier Arribas. This software is released under the GNU General Public License version 3, see the file COPYING.
VOLK_GNSSSDR was originally created by Andres Cecilia Luque in the
framework of the [Summer Of Code In Space (SOCIS
2014)](http://sophia.estec.esa.int/socis2014/?q=about "SOCIS 2014
webpage") program organized by the European Space Agency, and then
evolved and maintained by Carles Fernández-Prades and Javier
Arribas. This software is released under the GNU General Public License
version 3, see the file COPYING.
This project is managed by [Centre Tecnologic de Telecomunicacions de Catalunya](http://www.cttc.es "CTTC webpage").
This project is managed by [Centre Tecnologic de Telecomunicacions de
Catalunya](http://www.cttc.es "CTTC webpage").

View File

@ -101,8 +101,8 @@ static inline void volk_gnsssdr_16ic_x2_dot_prod_16ic_a_sse2(lv_16sc_t* out, con
realcacc = _mm_setzero_si128();
imagcacc = _mm_setzero_si128();
mask_imag = _mm_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
mask_real = _mm_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
mask_imag = _mm_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
mask_real = _mm_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
for(number = 0; number < sse_iters; number++)
{
@ -179,8 +179,8 @@ static inline void volk_gnsssdr_16ic_x2_dot_prod_16ic_u_sse2(lv_16sc_t* out, con
realcacc = _mm_setzero_si128();
imagcacc = _mm_setzero_si128();
mask_imag = _mm_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
mask_real = _mm_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
mask_imag = _mm_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
mask_real = _mm_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
for(number = 0; number < sse_iters; number++)
{
@ -258,8 +258,8 @@ static inline void volk_gnsssdr_16ic_x2_dot_prod_16ic_u_axv2(lv_16sc_t* out, con
realcacc = _mm256_setzero_si256();
imagcacc = _mm256_setzero_si256();
mask_imag = _mm256_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
mask_real = _mm256_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
mask_imag = _mm256_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
mask_real = _mm256_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
for(number = 0; number < avx_iters; number++)
{
@ -335,8 +335,8 @@ static inline void volk_gnsssdr_16ic_x2_dot_prod_16ic_a_axv2(lv_16sc_t* out, con
realcacc = _mm256_setzero_si256();
imagcacc = _mm256_setzero_si256();
mask_imag = _mm256_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
mask_real = _mm256_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
mask_imag = _mm256_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
mask_real = _mm256_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
for(number = 0; number < avx_iters; number++)
{

View File

@ -138,8 +138,8 @@ static inline void volk_gnsssdr_16ic_x2_dot_prod_16ic_xn_a_sse2(lv_16sc_t* resul
__m128i a, b, c, c_sr, mask_imag, mask_real, real, imag;
mask_imag = _mm_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
mask_real = _mm_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
mask_imag = _mm_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
mask_real = _mm_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
for(index = 0; index < sse_iters; index++)
{
@ -232,8 +232,8 @@ static inline void volk_gnsssdr_16ic_x2_dot_prod_16ic_xn_u_sse2(lv_16sc_t* resul
__m128i a, b, c, c_sr, mask_imag, mask_real, real, imag;
mask_imag = _mm_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
mask_real = _mm_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
mask_imag = _mm_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
mask_real = _mm_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
for(index = 0; index < sse_iters; index++)
{
@ -326,8 +326,8 @@ static inline void volk_gnsssdr_16ic_x2_dot_prod_16ic_xn_a_avx2(lv_16sc_t* resul
__m256i a, b, c, c_sr, mask_imag, mask_real, real, imag;
mask_imag = _mm256_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
mask_real = _mm256_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
mask_imag = _mm256_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
mask_real = _mm256_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
for(index = 0; index < sse_iters; index++)
{
@ -420,8 +420,8 @@ static inline void volk_gnsssdr_16ic_x2_dot_prod_16ic_xn_u_avx2(lv_16sc_t* resul
__m256i a, b, c, c_sr, mask_imag, mask_real, real, imag;
mask_imag = _mm256_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
mask_real = _mm256_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
mask_imag = _mm256_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
mask_real = _mm256_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
for(index = 0; index < sse_iters; index++)
{

View File

@ -85,8 +85,8 @@ static inline void volk_gnsssdr_16ic_x2_multiply_16ic_a_sse2(lv_16sc_t* out, con
unsigned int number;
__m128i a, b, c, c_sr, mask_imag, mask_real, real, imag, imag1, imag2, b_sl, a_sl, result;
mask_imag = _mm_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
mask_real = _mm_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
mask_imag = _mm_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
mask_real = _mm_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
const lv_16sc_t* _in_a = in_a;
const lv_16sc_t* _in_b = in_b;
@ -139,8 +139,8 @@ static inline void volk_gnsssdr_16ic_x2_multiply_16ic_u_sse2(lv_16sc_t* out, con
unsigned int number;
__m128i a, b, c, c_sr, mask_imag, mask_real, real, imag, imag1,imag2, b_sl, a_sl, result;
mask_imag = _mm_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
mask_real = _mm_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
mask_imag = _mm_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
mask_real = _mm_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
const lv_16sc_t* _in_a = in_a;
const lv_16sc_t* _in_b = in_b;
@ -198,8 +198,8 @@ static inline void volk_gnsssdr_16ic_x2_multiply_16ic_u_avx2(lv_16sc_t* out, con
__m256i a, b, c, c_sr, real, imag, imag1, imag2, b_sl, a_sl, result;
const __m256i mask_imag = _mm256_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
const __m256i mask_real = _mm256_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
const __m256i mask_imag = _mm256_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
const __m256i mask_real = _mm256_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
for(;number < avx2_points; number++)
{
@ -252,8 +252,8 @@ static inline void volk_gnsssdr_16ic_x2_multiply_16ic_a_avx2(lv_16sc_t* out, con
__m256i a, b, c, c_sr, real, imag, imag1, imag2, b_sl, a_sl, result;
const __m256i mask_imag = _mm256_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
const __m256i mask_real = _mm256_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
const __m256i mask_imag = _mm256_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
const __m256i mask_real = _mm256_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
for(;number < avx2_points; number++)
{

View File

@ -205,8 +205,8 @@ static inline void volk_gnsssdr_16ic_x2_rotator_dot_prod_16ic_xn_a_sse3(lv_16sc_
__m128i a, b, c, c_sr, mask_imag, mask_real, real, imag, imag1, imag2, b_sl, a_sl;
mask_imag = _mm_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
mask_real = _mm_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
mask_imag = _mm_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
mask_real = _mm_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
// phase rotation registers
__m128 pa, pb, two_phase_acc_reg, two_phase_inc_reg;
@ -383,8 +383,8 @@ static inline void volk_gnsssdr_16ic_x2_rotator_dot_prod_16ic_xn_a_sse3_reload(l
__m128i a, b, c, c_sr, mask_imag, mask_real, real, imag, imag1, imag2, b_sl, a_sl;
mask_imag = _mm_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
mask_real = _mm_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
mask_imag = _mm_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
mask_real = _mm_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
// phase rotation registers
__m128 pa, pb, two_phase_acc_reg, two_phase_inc_reg;
@ -629,8 +629,8 @@ static inline void volk_gnsssdr_16ic_x2_rotator_dot_prod_16ic_xn_u_sse3(lv_16sc_
__m128i a, b, c, c_sr, mask_imag, mask_real, real, imag, imag1, imag2, b_sl, a_sl;
mask_imag = _mm_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
mask_real = _mm_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
mask_imag = _mm_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
mask_real = _mm_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
// phase rotation registers
__m128 pa, pb, two_phase_acc_reg, two_phase_inc_reg;
@ -794,8 +794,8 @@ static inline void volk_gnsssdr_16ic_x2_rotator_dot_prod_16ic_xn_a_avx2(lv_16sc_
imagcacc[n_vec] = _mm256_setzero_si256();
}
const __m256i mask_imag = _mm256_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
const __m256i mask_real = _mm256_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
const __m256i mask_imag = _mm256_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
const __m256i mask_real = _mm256_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
__m128 a, b, two_phase_acc_reg, two_phase_inc_reg;
__m128i c1, c2, result1, result2;
@ -1002,8 +1002,8 @@ static inline void volk_gnsssdr_16ic_x2_rotator_dot_prod_16ic_xn_a_avx2_reload(l
imagcacc[n_vec] = _mm256_setzero_si256();
}
const __m256i mask_imag = _mm256_set_epi8(255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0);
const __m256i mask_real = _mm256_set_epi8(0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255);
const __m256i mask_imag = _mm256_set_epi8(0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0);
const __m256i mask_real = _mm256_set_epi8(0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF, 0, 0, 0xFF, 0xFF);
__m128 a, b, two_phase_acc_reg, two_phase_inc_reg;
__m128i c1, c2, result1, result2;

View File

@ -71,7 +71,7 @@ static inline void volk_gnsssdr_8ic_conjugate_8ic_u_avx(lv_8sc_t* cVector, const
__m256 tmp;
__m128i tmp128lo, tmp128hi;
__m256 conjugator1 = _mm256_castsi256_ps(_mm256_setr_epi8(0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255));
__m256 conjugator1 = _mm256_castsi256_ps(_mm256_setr_epi8(0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF));
__m128i conjugator2 = _mm_setr_epi8(0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1);
for (i = 0; i < sse_iters; ++i)
@ -140,7 +140,7 @@ static inline void volk_gnsssdr_8ic_conjugate_8ic_u_sse3(lv_8sc_t* cVector, cons
const lv_8sc_t* a = aVector;
__m128i tmp;
__m128i conjugator1 = _mm_setr_epi8(0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255);
__m128i conjugator1 = _mm_setr_epi8(0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF);
__m128i conjugator2 = _mm_setr_epi8(0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1);
for (i = 0; i < sse_iters; ++i)
@ -190,7 +190,7 @@ static inline void volk_gnsssdr_8ic_conjugate_8ic_a_avx(lv_8sc_t* cVector, const
__m256 tmp;
__m128i tmp128lo, tmp128hi;
__m256 conjugator1 = _mm256_castsi256_ps(_mm256_setr_epi8(0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255));
__m256 conjugator1 = _mm256_castsi256_ps(_mm256_setr_epi8(0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF));
__m128i conjugator2 = _mm_setr_epi8(0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1);
for (i = 0; i < sse_iters; ++i)
@ -257,7 +257,7 @@ static inline void volk_gnsssdr_8ic_conjugate_8ic_a_sse3(lv_8sc_t* cVector, cons
const lv_8sc_t* a = aVector;
__m128i tmp;
__m128i conjugator1 = _mm_setr_epi8(0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255);
__m128i conjugator1 = _mm_setr_epi8(0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF);
__m128i conjugator2 = _mm_setr_epi8(0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1);
for (i = 0; i < sse_iters; ++i)

View File

@ -73,7 +73,7 @@ static inline void volk_gnsssdr_8ic_s8ic_multiply_8ic_u_sse3(lv_8sc_t* cVector,
lv_8sc_t* c = cVector;
const lv_8sc_t* a = aVector;
mult1 = _mm_set_epi8(0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255);
mult1 = _mm_set_epi8(0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF);
y = _mm_set1_epi16(*(short*)&scalar);
imagy = _mm_srli_si128(y, 1);
@ -166,7 +166,7 @@ static inline void volk_gnsssdr_8ic_s8ic_multiply_8ic_a_sse3(lv_8sc_t* cVector,
lv_8sc_t* c = cVector;
const lv_8sc_t* a = aVector;
mult1 = _mm_set_epi8(0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255);
mult1 = _mm_set_epi8(0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF);
y = _mm_set1_epi16(*(short*)&scalar);
imagy = _mm_srli_si128(y, 1);

View File

@ -127,7 +127,7 @@ static inline void volk_gnsssdr_8ic_x2_dot_prod_8ic_u_sse2(lv_8sc_t* result, con
{
__m128i x, y, mult1, realx, imagx, realy, imagy, realx_mult_realy, imagx_mult_imagy, realx_mult_imagy, imagx_mult_realy, realc, imagc, totalc, realcacc, imagcacc;
mult1 = _mm_set_epi8(0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255);
mult1 = _mm_set_epi8(0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF);
realcacc = _mm_setzero_si128();
imagcacc = _mm_setzero_si128();
@ -204,7 +204,7 @@ static inline void volk_gnsssdr_8ic_x2_dot_prod_8ic_u_sse4_1(lv_8sc_t* result, c
{
__m128i x, y, mult1, realx, imagx, realy, imagy, realx_mult_realy, imagx_mult_imagy, realx_mult_imagy, imagx_mult_realy, realc, imagc, totalc, realcacc, imagcacc;
mult1 = _mm_set_epi8(0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255);
mult1 = _mm_set_epi8(0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF);
realcacc = _mm_setzero_si128();
imagcacc = _mm_setzero_si128();
@ -279,7 +279,7 @@ static inline void volk_gnsssdr_8ic_x2_dot_prod_8ic_a_sse2(lv_8sc_t* result, con
{
__m128i x, y, mult1, realx, imagx, realy, imagy, realx_mult_realy, imagx_mult_imagy, realx_mult_imagy, imagx_mult_realy, realc, imagc, totalc, realcacc, imagcacc;
mult1 = _mm_set_epi8(0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255);
mult1 = _mm_set_epi8(0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF);
realcacc = _mm_setzero_si128();
imagcacc = _mm_setzero_si128();
@ -355,7 +355,7 @@ static inline void volk_gnsssdr_8ic_x2_dot_prod_8ic_a_sse4_1(lv_8sc_t* result, c
{
__m128i x, y, mult1, realx, imagx, realy, imagy, realx_mult_realy, imagx_mult_imagy, realx_mult_imagy, imagx_mult_realy, realc, imagc, totalc, realcacc, imagcacc;
mult1 = _mm_set_epi8(0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255);
mult1 = _mm_set_epi8(0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF);
realcacc = _mm_setzero_si128();
imagcacc = _mm_setzero_si128();

View File

@ -73,7 +73,7 @@ static inline void volk_gnsssdr_8ic_x2_multiply_8ic_u_sse2(lv_8sc_t* cVector, co
const lv_8sc_t* a = aVector;
const lv_8sc_t* b = bVector;
mult1 = _mm_set_epi8(0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255);
mult1 = _mm_set_epi8(0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF);
for(number = 0; number < sse_iters; number++)
{
@ -131,7 +131,7 @@ static inline void volk_gnsssdr_8ic_x2_multiply_8ic_u_sse4_1(lv_8sc_t* cVector,
const lv_8sc_t* b = bVector;
_mm_setzero_si128();
mult1 = _mm_set_epi8(0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255);
mult1 = _mm_set_epi8(0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF);
for(number = 0; number < sse_iters; number++)
{
@ -202,7 +202,7 @@ static inline void volk_gnsssdr_8ic_x2_multiply_8ic_a_sse2(lv_8sc_t* cVector, co
const lv_8sc_t* a = aVector;
const lv_8sc_t* b = bVector;
mult1 = _mm_set_epi8(0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255);
mult1 = _mm_set_epi8(0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF);
for(number = 0; number < sse_iters; number++)
{
@ -260,7 +260,7 @@ static inline void volk_gnsssdr_8ic_x2_multiply_8ic_a_sse4_1(lv_8sc_t* cVector,
const lv_8sc_t* b = bVector;
_mm_setzero_si128();
mult1 = _mm_set_epi8(0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255);
mult1 = _mm_set_epi8(0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF);
for(number = 0; number < sse_iters; number++)
{

View File

@ -78,7 +78,7 @@ static inline void volk_gnsssdr_8u_x2_multiply_8u_u_sse3(unsigned char* cChar, c
x = _mm_lddqu_si128((__m128i*)a);
y = _mm_lddqu_si128((__m128i*)b);
mult1 = _mm_set_epi8(0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255);
mult1 = _mm_set_epi8(0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF);
x1 = _mm_srli_si128(x, 1);
x1 = _mm_and_si128(x1, mult1);
x2 = _mm_and_si128(x, mult1);
@ -144,7 +144,7 @@ static inline void volk_gnsssdr_8u_x2_multiply_8u_a_sse3(unsigned char* cChar, c
x = _mm_load_si128((__m128i*)a);
y = _mm_load_si128((__m128i*)b);
mult1 = _mm_set_epi8(0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255);
mult1 = _mm_set_epi8(0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF);
x1 = _mm_srli_si128(x, 1);
x1 = _mm_and_si128(x1, mult1);
x2 = _mm_and_si128(x, mult1);

View File

@ -16,6 +16,9 @@
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
file(GLOB SIGNAL_SOURCE_ADAPTER_HEADERS "*.h")
list(SORT SIGNAL_SOURCE_ADAPTER_HEADERS)
# Optional drivers
if(ENABLE_GN3S)
@ -72,26 +75,29 @@ if(ENABLE_OSMOSDR)
################################################################################
# OsmoSDR - http://sdr.osmocom.org/trac/
################################################################################
find_package(GrOsmoSDR REQUIRED)
if(NOT GROSMOSDR_FOUND)
message(FATAL_ERROR "gr-osmosdr required to build gnss-sdr with the optional OSMOSDR driver")
if(ENABLE_PACKAGING)
list(REMOVE_ITEM SIGNAL_SOURCE_ADAPTER_HEADERS ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/adapters/osmosdr_signal_source.h)
endif(ENABLE_PACKAGING)
else(NOT GROSMOSDR_FOUND)
# set OSMO include dirs
set(OSMO_DRIVER_INCLUDE_DIRS
${OPT_DRIVER_INCLUDE_DIRS}
${GROSMOSDR_INCLUDE_DIR}/osmosdr
)
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} osmosdr_signal_source.cc)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${GROSMOSDR_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${OSMO_DRIVER_INCLUDE_DIRS})
endif(NOT GROSMOSDR_FOUND)
# set OSMO include dirs
set(OSMO_DRIVER_INCLUDE_DIRS
${OPT_DRIVER_INCLUDE_DIRS}
${GROSMOSDR_INCLUDE_DIR}/osmosdr
)
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} osmosdr_signal_source.cc)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${GROSMOSDR_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${OSMO_DRIVER_INCLUDE_DIRS})
endif(ENABLE_OSMOSDR)
if(ENABLE_UHD)
if(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd)
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} uhd_signal_source.cc)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${UHD_LIBRARIES} ${GNURADIO_UHD_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${UHD_INCLUDE_DIRS})
endif(ENABLE_UHD)
else(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd)
list(REMOVE_ITEM SIGNAL_SOURCE_ADAPTER_HEADERS ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/adapters/uhd_signal_source.h)
endif(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd)
set(SIGNAL_SOURCE_ADAPTER_SOURCES file_signal_source.cc
@ -129,8 +135,6 @@ endif(ARCH_64BITS)
add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}")
file(GLOB SIGNAL_SOURCE_ADAPTER_HEADERS "*.h")
list(SORT SIGNAL_SOURCE_ADAPTER_HEADERS)
add_library(signal_source_adapters ${SIGNAL_SOURCE_ADAPTER_SOURCES} ${SIGNAL_SOURCE_ADAPTER_HEADERS})
source_group(Headers FILES ${SIGNAL_SOURCE_ADAPTER_HEADERS})
target_link_libraries(signal_source_adapters signal_source_gr_blocks
@ -140,4 +144,3 @@ target_link_libraries(signal_source_adapters signal_source_gr_blocks
${OPT_LIBRARIES}
gnss_sp_libs
)

View File

@ -102,12 +102,14 @@ if(ENABLE_FLEXIBAND)
endif(ENABLE_FLEXIBAND)
if(ENABLE_OSMOSDR)
add_definitions(-DOSMOSDR_DRIVER=1)
if(GROSMOSDR_FOUND)
add_definitions(-DOSMOSDR_DRIVER=1)
endif(GROSMOSDR_FOUND)
endif(ENABLE_OSMOSDR)
if(ENABLE_UHD)
if(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd)
add_definitions(-DUHD_DRIVER=1)
endif(ENABLE_UHD)
endif(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd)
#Enable OpenCL if found in the system
if(OPENCL_FOUND)

View File

@ -35,19 +35,20 @@
#include <vector>
#include <utility> // std::pair
#include "MATH_CONSTANTS.h"
#include "gnss_frequencies.h"
// Physical constants
const double GPS_C_m_s = 299792458.0; //!< The speed of light, [m/s]
const double GPS_C_m_s = SPEED_OF_LIGHT; //!< The speed of light, [m/s]
const double GPS_C_m_ms = 299792.4580; //!< The speed of light, [m/ms]
const double GPS_PI = 3.1415926535898; //!< Pi as defined in IS-GPS-200E
const double GPS_TWO_PI = 6.283185307179586;//!< 2Pi as defined in IS-GPS-200E
const double OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Earth rotation rate, [rad/s]
const double OMEGA_EARTH_DOT = DEFAULT_OMEGA_EARTH_DOT; //!< Earth rotation rate, [rad/s]
const double GM = 3.986005e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2]
const double F = -4.442807633e-10; //!< Constant, [s/(m)^(1/2)]
// carrier and code frequencies
const double GPS_L1_FREQ_HZ = 1.57542e9; //!< L1 [Hz]
const double GPS_L1_FREQ_HZ = FREQ1; //!< L1 [Hz]
const double GPS_L1_CA_CODE_RATE_HZ = 1.023e6; //!< GPS L1 C/A code rate [chips/s]
const double GPS_L1_CA_CODE_LENGTH_CHIPS = 1023.0; //!< GPS L1 C/A code length [chips]
const double GPS_L1_CA_CODE_PERIOD = 0.001; //!< GPS L1 C/A code period [seconds]

View File

@ -36,6 +36,7 @@
#include <vector>
#include <utility> // std::pair
#include "MATH_CONSTANTS.h"
#include "gnss_frequencies.h"
// Physical constants
const double GPS_L2_C_m_s = 299792458.0; //!< The speed of light, [m/s]
@ -48,7 +49,7 @@ const double GPS_L2_F = -4.442807633e-10; //!< Constant, [s/(m)^(1
// carrier and code frequencies
const double GPS_L2_FREQ_HZ = 1.2276e9; //!< L2 [Hz]
const double GPS_L2_FREQ_HZ = FREQ2; //!< L2 [Hz]
const double GPS_L2_M_CODE_RATE_HZ = 0.5115e6; //!< GPS L2 M code rate [chips/s]
const int GPS_L2_M_CODE_LENGTH_CHIPS = 10230; //!< GPS L2 M code length [chips]

View File

@ -37,6 +37,7 @@
#include <vector>
#include <utility> // std::pair
#include "MATH_CONSTANTS.h"
#include "gnss_frequencies.h"
// Physical constants
const double GALILEO_PI = 3.1415926535898; //!< Pi as defined in GALILEO ICD
@ -48,7 +49,7 @@ const double GALILEO_C_m_ms = 299792.4580; //!< The speed of light, [m/ms]
const double GALILEO_F = -4.442807309e-10; //!< Constant, [s/(m)^(1/2)]
// carrier and code frequencies
const double Galileo_E1_FREQ_HZ = 1.57542e9; //!< Galileo E1 carrier frequency [Hz]
const double Galileo_E1_FREQ_HZ = FREQ1; //!< Galileo E1 carrier frequency [Hz]
const double Galileo_E1_CODE_CHIP_RATE_HZ = 1.023e6; //!< Galileo E1 code rate [chips/s]
const double Galileo_E1_CODE_PERIOD = 0.004; //!< Galileo E1 code period [s]
const double Galileo_E1_SUB_CARRIER_A_RATE_HZ = 1.023e6; //!< Galileo E1 sub-carrier 'a' rate [Hz]

View File

@ -35,11 +35,11 @@
#include <vector>
#include <utility> // std::pair
#include "MATH_CONSTANTS.h"
#include "gnss_frequencies.h"
// Physical constants already defined in E1
// Carrier and code frequencies
const double Galileo_E5a_FREQ_HZ = 1.176450e9; //!< Galileo E5a carrier frequency [Hz]
const double Galileo_E5a_FREQ_HZ = FREQ5; //!< Galileo E5a carrier frequency [Hz]
const double Galileo_E5a_CODE_CHIP_RATE_HZ = 1.023e7; //!< Galileo E5a code rate [chips/s]
const double Galileo_E5a_I_TIERED_CODE_PERIOD = 0.020; //!< Galileo E5a-I tiered code period [s]
const double Galileo_E5a_Q_TIERED_CODE_PERIOD = 0.100; //!< Galileo E5a-Q tiered code period [s]

View File

@ -40,6 +40,9 @@
PI_TWO_PX ==> Pi*2^X
ONE_PI_TWO_PX = (1/Pi)*2^X
*/
const double PI = 3.1415926535897932; //!< pi
const double TWO_P4 = (16); //!< 2^4
const double TWO_P11 = (2048); //!< 2^11
const double TWO_P12 = (4096); //!< 2^12
@ -53,6 +56,7 @@ const double TWO_P57 = (1.441151880758559e+017); //!< 2^57
const double TWO_N2 = (0.25); //!< 2^-2
const double TWO_N5 = (0.03125); //!< 2^-5
const double TWO_N6 = (0.015625); //!< 2^-6
const double TWO_N8 = (0.00390625); //!< 2^-8
const double TWO_N9 = (0.001953125); //!< 2^-9
const double TWO_N10 = (0.0009765625); //!< 2^-10
@ -60,9 +64,11 @@ const double TWO_N11 = (4.882812500000000e-004); //!< 2^-11
const double TWO_N14 = (0.00006103515625); //!< 2^-14
const double TWO_N15 = (0.00003051757813); //!< 2^-15
const double TWO_N16 = (0.0000152587890625); //!< 2^-16
const double TWO_N17 = (7.629394531250000e-006); //!< 2^-17
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_N23 = (1.192092895507810e-007); //!< 2^-23
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
@ -73,8 +79,9 @@ const double TWO_N32 = (2.328306436538696e-010); //!< 2^-32
const double TWO_N33 = (1.164153218269348e-010); //!< 2^-33
const double TWO_N34 = (5.82076609134674e-011); //!< 2^-34
const double TWO_N35 = (2.91038304567337e-011); //!< 2^-35
const double TWO_N38 = (3.637978807091713e-012); //!< 2^-38
const double TWO_N39 = (1.818989403545856e-012); //!< 2^-39
const double TWO_N40 = (9.094947017729280e-013); //!< 2^-40
const double TWO_N43 = (1.136868377216160e-013); //!< 2^-43
const double TWO_N44 = (5.684341886080802e-14); //!< 2^-44
const double TWO_N46 = (1.4210854715202e-014); //!< 2^-46
@ -95,4 +102,13 @@ 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
const double D2R = (PI/180.0); //!< deg to rad
const double R2D = (180.0/PI); //!< rad to deg
const double SC2RAD = 3.1415926535898; //!< semi-circle to radian (IS-GPS)
const double AS2R = (D2R / 3600.0); //!< arc sec to radian
const double DEFAULT_OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Default Earth rotation rate, [rad/s]
const double SPEED_OF_LIGHT = 299792458.0; //!< [m/s]
const double AU = 149597870691.0; //!< 1 Astronomical Unit AU (m) distance from Earth to the Sun.
#endif /* GNSS_SDR_MATH_CONSTANTS_H_ */

View File

@ -0,0 +1,53 @@
/*!
* \file gnss_frequencies.h
* \brief GNSS Frequencies
* \author Carles Fernandez, 2017. cfernandez(at)cttc.es
*
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_GNSS_FREQUENCIES_H_
#define GNSS_SDR_GNSS_FREQUENCIES_H_
const double FREQ1 = 1.57542e9; //!< L1/E1 frequency (Hz)
const double FREQ2 = 1.22760e9; //!< L2 frequency (Hz)
const double FREQ5 = 1.17645e9; //!< L5/E5a frequency (Hz)
const double FREQ6 = 1.27875e9; //!< E6/LEX frequency (Hz)
const double FREQ7 = 1.20714e9; //!< E5b frequency (Hz)
const double FREQ8 = 1.191795e9; //!< E5a+b frequency (Hz)
const double FREQ9 = 2.492028e9; //!< S frequency (Hz)
const double FREQ1_GLO = 1.60200e9; //!< GLONASS G1 base frequency (Hz)
const double DFRQ1_GLO = 0.56250e6; //!< GLONASS G1 bias frequency (Hz/n)
const double FREQ2_GLO = 1.24600e9; //!< GLONASS G2 base frequency (Hz)
const double DFRQ2_GLO = 0.43750e6; //!< GLONASS G2 bias frequency (Hz/n)
const double FREQ3_GLO = 1.202025e9; //!< GLONASS G3 frequency (Hz)
const double FREQ1_BDS = 1.561098e9; //!< BeiDou B1 frequency (Hz)
const double FREQ2_BDS = 1.20714e9; //!< BeiDou B2 frequency (Hz)
const double FREQ3_BDS = 1.26852e9; //!< BeiDou B3 frequency (Hz)
#endif

View File

@ -0,0 +1,97 @@
/*!
* \file gnss_obs_codes.h
* \brief GNSS Observable codes
* \author Carles Fernandez, 2017. cfernandez(at)cttc.es
*
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_GNSS_OBS_CODES_H_
#define GNSS_SDR_GNSS_OBS_CODES_H_
const unsigned int CODE_NONE = 0; //!< obs code: none or unknown
const unsigned int CODE_L1C = 1; //!< obs code: L1C/A,G1C/A,E1C (GPS,GLO,GAL,QZS,SBS)
const unsigned int CODE_L1P = 2; //!< obs code: L1P,G1P (GPS,GLO)
const unsigned int CODE_L1W = 3; //!< obs code: L1 Z-track (GPS)
const unsigned int CODE_L1Y = 4; //!< obs code: L1Y (GPS)
const unsigned int CODE_L1M = 5; //!< obs code: L1M (GPS)
const unsigned int CODE_L1N = 6; //!< obs code: L1codeless (GPS)
const unsigned int CODE_L1S = 7; //!< obs code: L1C(D) (GPS,QZS)
const unsigned int CODE_L1L = 8; //!< obs code: L1C(P) (GPS,QZS)
const unsigned int CODE_L1E = 9; //!< (not used)
const unsigned int CODE_L1A = 10; //!< obs code: E1A (GAL)
const unsigned int CODE_L1B = 11; //!< obs code: E1B (GAL)
const unsigned int CODE_L1X = 12; //!< obs code: E1B+C,L1C(D+P) (GAL,QZS)
const unsigned int CODE_L1Z = 13; //!< obs code: E1A+B+C,L1SAIF (GAL,QZS)
const unsigned int CODE_L2C = 14; //!< obs code: L2C/A,G1C/A (GPS,GLO)
const unsigned int CODE_L2D = 15; //!< obs code: L2 L1C/A-(P2-P1) (GPS)
const unsigned int CODE_L2S = 16; //!< obs code: L2C(M) (GPS,QZS)
const unsigned int CODE_L2L = 17; //!< obs code: L2C(L) (GPS,QZS)
const unsigned int CODE_L2X = 18; //!< obs code: L2C(M+L),B1I+Q (GPS,QZS,BDS)
const unsigned int CODE_L2P = 19; //!< obs code: L2P,G2P (GPS,GLO)
const unsigned int CODE_L2W = 20; //!< obs code: L2 Z-track (GPS)
const unsigned int CODE_L2Y = 21; //!< obs code: L2Y (GPS)
const unsigned int CODE_L2M = 22; //!< obs code: L2M (GPS)
const unsigned int CODE_L2N = 23; //!< obs code: L2codeless (GPS)
const unsigned int CODE_L5I = 24; //!< obs code: L5/E5aI (GPS,GAL,QZS,SBS)
const unsigned int CODE_L5Q = 25; //!< obs code: L5/E5aQ (GPS,GAL,QZS,SBS)
const unsigned int CODE_L5X = 26; //!< obs code: L5/E5aI+Q/L5B+C (GPS,GAL,QZS,IRN,SBS)
const unsigned int CODE_L7I = 27; //!< obs code: E5bI,B2I (GAL,BDS)
const unsigned int CODE_L7Q = 28; //!< obs code: E5bQ,B2Q (GAL,BDS)
const unsigned int CODE_L7X = 29; //!< obs code: E5bI+Q,B2I+Q (GAL,BDS)
const unsigned int CODE_L6A = 30; //!< obs code: E6A (GAL)
const unsigned int CODE_L6B = 31; //!< obs code: E6B (GAL)
const unsigned int CODE_L6C = 32; //!< obs code: E6C (GAL)
const unsigned int CODE_L6X = 33; //!< obs code: E6B+C,LEXS+L,B3I+Q (GAL,QZS,BDS)
const unsigned int CODE_L6Z = 34; //!< obs code: E6A+B+C (GAL)
const unsigned int CODE_L6S = 35; //!< obs code: LEXS (QZS)
const unsigned int CODE_L6L = 36; //!< obs code: LEXL (QZS)
const unsigned int CODE_L8I = 37; //!< obs code: E5(a+b)I (GAL)
const unsigned int CODE_L8Q = 38; //!< obs code: E5(a+b)Q (GAL)
const unsigned int CODE_L8X = 39; //!< obs code: E5(a+b)I+Q (GAL)
const unsigned int CODE_L2I = 40; //!< obs code: B1I (BDS)
const unsigned int CODE_L2Q = 41; //!< obs code: B1Q (BDS)
const unsigned int CODE_L6I = 42; //!< obs code: B3I (BDS)
const unsigned int CODE_L6Q = 43; //!< obs code: B3Q (BDS)
const unsigned int CODE_L3I = 44; //!< obs code: G3I (GLO)
const unsigned int CODE_L3Q = 45; //!< obs code: G3Q (GLO)
const unsigned int CODE_L3X = 46; //!< obs code: G3I+Q (GLO)
const unsigned int CODE_L1I = 47; //!< obs code: B1I (BDS)
const unsigned int CODE_L1Q = 48; //!< obs code: B1Q (BDS)
const unsigned int CODE_L5A = 49; //!< obs code: L5A SPS (IRN)
const unsigned int CODE_L5B = 50; //!< obs code: L5B RS(D) (IRN)
const unsigned int CODE_L5C = 51; //!< obs code: L5C RS(P) (IRN)
const unsigned int CODE_L9A = 52; //!< obs code: SA SPS (IRN)
const unsigned int CODE_L9B = 53; //!< obs code: SB RS(D) (IRN)
const unsigned int CODE_L9C = 54; //!< obs code: SC RS(P) (IRN)
const unsigned int CODE_L9X = 55; //!< obs code: SB+C (IRN)
const unsigned int MAXCODE = 55; //!< max number of obs code
#endif

View File

@ -28,10 +28,10 @@ if(ENABLE_GPERFTOOLS)
endif(GPERFTOOLS_FOUND)
endif(ENABLE_GPERFTOOLS)
if(ENABLE_UHD)
if(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd)
set(GNSS_SDR_OPTIONAL_LIBS ${GNSS_SDR_OPTIONAL_LIBS} ${UHD_LIBRARIES} ${GNURADIO_UHD_LIBRARIES})
set(GNSS_SDR_OPTIONAL_HEADERS ${GNSS_SDR_OPTIONAL_HEADERS} ${UHD_INCLUDE_DIRS})
endif(ENABLE_UHD)
endif(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd)
if(OPENSSL_FOUND)
add_definitions( -DUSE_OPENSSL_FALLBACK=1 )
@ -127,10 +127,16 @@ find_program(GZIP
)
if(NOT GZIP_NOTFOUND)
execute_process(COMMAND gzip -9 -c ${CMAKE_SOURCE_DIR}/docs/manpage/gnss-sdr-manpage
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_FILE "${CMAKE_BINARY_DIR}/gnss-sdr.1.gz")
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_FILE "${CMAKE_BINARY_DIR}/gnss-sdr.1.gz")
install(FILES ${CMAKE_BINARY_DIR}/gnss-sdr.1.gz DESTINATION share/man/man1)
if(NOT VOLK_GNSSSDR_FOUND)
install(FILES ${CMAKE_BINARY_DIR}/gnss-sdr.1.gz DESTINATION share/man/man1)
execute_process(COMMAND gzip -9 -c ${CMAKE_SOURCE_DIR}/docs/changelog
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_FILE "${CMAKE_BINARY_DIR}/changelog.gz")
install(FILES ${CMAKE_BINARY_DIR}/changelog.gz DESTINATION share/doc/gnss-sdr)
if(NOT VOLK_GNSSSDR_FOUND)
execute_process(COMMAND gzip -9 -c ${CMAKE_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr_profile-manpage
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_FILE "${CMAKE_BINARY_DIR}/volk_gnsssdr_profile.1.gz")
execute_process(COMMAND gzip -9 -c ${CMAKE_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr-config-info-manpage
@ -138,5 +144,5 @@ if(NOT GZIP_NOTFOUND)
install(FILES ${CMAKE_BINARY_DIR}/volk_gnsssdr_profile.1.gz DESTINATION share/man/man1)
install(FILES ${CMAKE_BINARY_DIR}/volk_gnsssdr-config-info.1.gz DESTINATION share/man/man1)
endif(NOT VOLK_GNSSSDR_FOUND)
endif(NOT VOLK_GNSSSDR_FOUND)
endif(NOT GZIP_NOTFOUND)

View File

@ -392,6 +392,7 @@ if(ENABLE_SYSTEM_TESTING)
gnss_rx
gnss_system_parameters
)
if(ENABLE_INSTALL_TESTS)
if(EXISTS ${CMAKE_SOURCE_DIR}/install/ttff)
file(REMOVE ${CMAKE_SOURCE_DIR}/install/ttff)
@ -404,6 +405,39 @@ if(ENABLE_SYSTEM_TESTING)
endif(ENABLE_INSTALL_TESTS)
if(ENABLE_SYSTEM_TESTING_EXTRA)
add_executable(position_test
${CMAKE_CURRENT_SOURCE_DIR}/system-tests/position_test.cc )
if(NOT ${GTEST_DIR_LOCAL})
add_dependencies(position_test gtest-${gtest_RELEASE})
else(NOT ${GTEST_DIR_LOCAL})
add_dependencies(position_test gtest)
endif(NOT ${GTEST_DIR_LOCAL})
target_link_libraries(position_test
${Boost_LIBRARIES}
${GFlags_LIBS}
${GLOG_LIBRARIES}
${GTEST_LIBRARIES}
${GNURADIO_RUNTIME_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${GNURADIO_FILTER_LIBRARIES}
${GNURADIO_ANALOG_LIBRARIES}
${VOLK_GNSSSDR_LIBRARIES}
gnss_sp_libs
gnss_rx
gnss_system_parameters
)
if(ENABLE_INSTALL_TESTS)
if(EXISTS ${CMAKE_SOURCE_DIR}/install/position_test)
file(REMOVE ${CMAKE_SOURCE_DIR}/install/position_test)
endif(EXISTS ${CMAKE_SOURCE_DIR}/install/position_test)
install(TARGETS position_test RUNTIME DESTINATION bin COMPONENT "position_test")
else(ENABLE_INSTALL_TESTS)
add_custom_command(TARGET position_test POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:position_test>
${CMAKE_SOURCE_DIR}/install/$<TARGET_FILE_NAME:position_test> )
endif(ENABLE_INSTALL_TESTS)
if(GPSTK_FOUND OR OWN_GPSTK)
add_executable(obs_gps_l1_system_test ${CMAKE_CURRENT_SOURCE_DIR}/system-tests/obs_gps_l1_system_test.cc)
if(NOT ${GTEST_DIR_LOCAL})
@ -418,6 +452,7 @@ if(ENABLE_SYSTEM_TESTING)
gnss_sp_libs
gnss_rx
${gpstk_libs})
if(ENABLE_INSTALL_TESTS)
if(EXISTS ${CMAKE_SOURCE_DIR}/install/obs_gps_l1_system_test)
file(REMOVE ${CMAKE_SOURCE_DIR}/install/obs_gps_l1_system_test)
@ -430,6 +465,7 @@ if(ENABLE_SYSTEM_TESTING)
endif(ENABLE_INSTALL_TESTS)
endif(GPSTK_FOUND OR OWN_GPSTK)
endif(ENABLE_SYSTEM_TESTING_EXTRA)
endif(ENABLE_SYSTEM_TESTING)
@ -439,115 +475,98 @@ endif(ENABLE_SYSTEM_TESTING)
set(CMAKE_CTEST_COMMAND ctest -V)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
add_executable(control_thread_test
${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/control-plane/control_message_factory_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/control-plane/control_thread_test.cc
)
if(NOT ${ENABLE_PACKAGING})
add_executable(control_thread_test ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/control-plane/control_message_factory_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/control-plane/control_thread_test.cc
)
target_link_libraries(control_thread_test ${Boost_LIBRARIES}
${GFlags_LIBS}
${GLOG_LIBRARIES}
${GTEST_LIBRARIES}
gnss_sp_libs
gnss_system_parameters
gnss_rx
${VOLK_GNSSSDR_LIBRARIES}
)
add_test(control_thread_test control_thread_test)
if(NOT ${GTEST_DIR_LOCAL})
add_dependencies(control_thread_test gtest-${gtest_RELEASE})
else(NOT ${GTEST_DIR_LOCAL})
add_dependencies(control_thread_test gtest)
endif(NOT ${GTEST_DIR_LOCAL})
set_property(TEST control_thread_test PROPERTY TIMEOUT 30)
set_property(TARGET control_thread_test PROPERTY EXCLUDE_FROM_ALL TRUE)
endif(NOT ${ENABLE_PACKAGING})
target_link_libraries(control_thread_test ${Boost_LIBRARIES}
#########################################################
add_executable(flowgraph_test ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/control-plane/gnss_flowgraph_test.cc )
set_property(TARGET flowgraph_test PROPERTY EXCLUDE_FROM_ALL TRUE)
target_link_libraries(flowgraph_test ${Boost_LIBRARIES}
${GFlags_LIBS}
${GLOG_LIBRARIES}
${GTEST_LIBRARIES}
gnss_sp_libs
gnss_system_parameters
gnss_rx
${VOLK_GNSSSDR_LIBRARIES}
)
add_test(control_thread_test control_thread_test)
if(NOT ${GTEST_DIR_LOCAL})
add_dependencies(control_thread_test gtest-${gtest_RELEASE})
else(NOT ${GTEST_DIR_LOCAL})
add_dependencies(control_thread_test gtest)
endif(NOT ${GTEST_DIR_LOCAL})
set_property(TEST control_thread_test PROPERTY TIMEOUT 30)
add_executable(flowgraph_test
${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/control-plane/gnss_flowgraph_test.cc
)
if(NOT ${ENABLE_PACKAGING})
gnss_system_parameters
${VOLK_GNSSSDR_LIBRARIES} )
add_test(flowgraph_test flowgraph_test)
if(NOT ${GTEST_DIR_LOCAL})
add_dependencies(flowgraph_test gtest-${gtest_RELEASE})
else(NOT ${GTEST_DIR_LOCAL})
add_dependencies(flowgraph_test gtest)
endif(NOT ${GTEST_DIR_LOCAL})
set_property(TEST flowgraph_test PROPERTY TIMEOUT 30)
set_property(TARGET flowgraph_test PROPERTY EXCLUDE_FROM_ALL TRUE)
endif(NOT ${ENABLE_PACKAGING})
target_link_libraries(flowgraph_test ${Boost_LIBRARIES}
${GFlags_LIBS}
${GLOG_LIBRARIES}
${GTEST_LIBRARIES}
gnss_sp_libs
gnss_rx
gnss_system_parameters
${VOLK_GNSSSDR_LIBRARIES}
)
#########################################################
add_test(flowgraph_test flowgraph_test)
if(NOT ${GTEST_DIR_LOCAL})
add_dependencies(flowgraph_test gtest-${gtest_RELEASE})
else(NOT ${GTEST_DIR_LOCAL})
add_dependencies(flowgraph_test gtest)
endif(NOT ${GTEST_DIR_LOCAL})
set_property(TEST flowgraph_test PROPERTY TIMEOUT 30)
add_executable(gnss_block_test
${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/adapter/pass_through_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/control-plane/gnss_block_factory_test.cc
)
if(NOT ${ENABLE_PACKAGING})
add_executable(gnss_block_test ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/adapter/pass_through_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/control-plane/gnss_block_factory_test.cc
)
set_property(TARGET gnss_block_test PROPERTY EXCLUDE_FROM_ALL TRUE)
target_link_libraries(gnss_block_test ${Boost_LIBRARIES}
${GFlags_LIBS}
${GLOG_LIBRARIES}
${GTEST_LIBRARIES}
${GNURADIO_RUNTIME_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${GNURADIO_FILTER_LIBRARIES}
${GNURADIO_ANALOG_LIBRARIES}
gnss_sp_libs
gnss_rx
gnss_system_parameters
${VOLK_GNSSSDR_LIBRARIES}
)
add_test(gnss_block_test gnss_block_test)
if(NOT ${GTEST_DIR_LOCAL})
add_dependencies(gnss_block_test gtest-${gtest_RELEASE})
else(NOT ${GTEST_DIR_LOCAL})
add_dependencies(gnss_block_test gtest)
endif(NOT ${GTEST_DIR_LOCAL})
endif(NOT ${ENABLE_PACKAGING})
target_link_libraries(gnss_block_test ${Boost_LIBRARIES}
${GFlags_LIBS}
${GLOG_LIBRARIES}
${GTEST_LIBRARIES}
${GNURADIO_RUNTIME_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${GNURADIO_FILTER_LIBRARIES}
${GNURADIO_ANALOG_LIBRARIES}
gnss_sp_libs
gnss_rx
gnss_system_parameters
# signal_generator_blocks
${VOLK_GNSSSDR_LIBRARIES}
)
add_test(gnss_block_test gnss_block_test)
if(NOT ${GTEST_DIR_LOCAL})
add_dependencies(gnss_block_test gtest-${gtest_RELEASE})
else(NOT ${GTEST_DIR_LOCAL})
add_dependencies(gnss_block_test gtest)
endif(NOT ${GTEST_DIR_LOCAL})
add_executable(gnuradio_block_test
${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/sources/unpack_2bit_samples_test.cc
)
if(NOT ${ENABLE_PACKAGING})
set_property(TARGET gnuradio_block_test PROPERTY EXCLUDE_FROM_ALL TRUE)
endif(NOT ${ENABLE_PACKAGING})
add_executable(gnuradio_block_test ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/sources/unpack_2bit_samples_test.cc
)
target_link_libraries(gnuradio_block_test ${Boost_LIBRARIES}
${GFlags_LIBS}
${GLOG_LIBRARIES}
${GTEST_LIBRARIES}
${GNURADIO_RUNTIME_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${GNURADIO_FILTER_LIBRARIES}
${GNURADIO_ANALOG_LIBRARIES}
gnss_sp_libs
gnss_rx
gnss_system_parameters
# signal_generator_blocks
${VOLK_GNSSSDR_LIBRARIES}
)
${GFlags_LIBS}
${GLOG_LIBRARIES}
${GTEST_LIBRARIES}
${GNURADIO_RUNTIME_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${GNURADIO_FILTER_LIBRARIES}
${GNURADIO_ANALOG_LIBRARIES}
gnss_sp_libs
gnss_rx
gnss_system_parameters
${VOLK_GNSSSDR_LIBRARIES}
)
add_test(gnuradio_block_test gnuradio_block_test)
if(NOT ${GTEST_DIR_LOCAL})
add_dependencies(gnuradio_block_test gtest-${gtest_RELEASE})
@ -576,16 +595,10 @@ endif(NOT ${GTEST_DIR_LOCAL})
# )
# add_test(acq_test acq_test)
add_executable(trk_test
${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc
)
if(NOT ${ENABLE_PACKAGING})
set_property(TARGET trk_test PROPERTY EXCLUDE_FROM_ALL TRUE)
endif(NOT ${ENABLE_PACKAGING})
add_executable(trk_test ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc
)
target_link_libraries(trk_test ${Boost_LIBRARIES}
${GFlags_LIBS}
${GLOG_LIBRARIES}
@ -599,7 +612,7 @@ target_link_libraries(trk_test ${Boost_LIBRARIES}
gnss_system_parameters
signal_generator_blocks
${VOLK_GNSSSDR_LIBRARIES}
)
)
add_test(trk_test trk_test)
if(NOT ${GTEST_DIR_LOCAL})
add_dependencies(trk_test gtest-${gtest_RELEASE})
@ -607,5 +620,10 @@ else(NOT ${GTEST_DIR_LOCAL})
add_dependencies(trk_test gtest)
endif(NOT ${GTEST_DIR_LOCAL})
add_dependencies(check control_thread_test flowgraph_test gnss_block_test
gnuradio_block_test trk_test)
if(${ENABLE_PACKAGING})
add_dependencies(check gnuradio_block_test trk_test)
else(${ENABLE_PACKAGING})
add_dependencies(check control_thread_test flowgraph_test gnss_block_test
gnuradio_block_test trk_test)
endif(${ENABLE_PACKAGING})

View File

@ -48,10 +48,10 @@
#include "gps_ref_location.h"
#include "gps_ref_time.h"
#include "galileo_navigation_message.h"
#include "sbas_ionospheric_correction.h"
#include "sbas_telemetry_data.h"
#include "sbas_ephemeris.h"
#include "sbas_satellite_correction.h"
//#include "sbas_ionospheric_correction.h"
//#include "sbas_telemetry_data.h"
//#include "sbas_ephemeris.h"
//#include "sbas_satellite_correction.h"
concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;

View File

@ -33,10 +33,12 @@
#include <exception>
#include <iostream>
#include <cstring>
#include <chrono>
#include <numeric>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <thread>
#include <unistd.h>
#include <gflags/gflags.h>
#include <glog/logging.h>
@ -57,6 +59,7 @@
concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
class Obs_Gps_L1_System_Test: public ::testing::Test
{
public:
@ -71,7 +74,7 @@ public:
std::string filename_rinex_obs = FLAGS_filename_rinex_obs;
std::string filename_raw_data = FLAGS_filename_raw_data;
std::string generated_rinex_obs;
int configure_generator();
int generate_signal();
int configure_receiver();
@ -82,7 +85,6 @@ public:
double compute_stdev(const std::vector<double> & vec);
std::shared_ptr<InMemoryConfiguration> config;
std::string generated_rinex_obs;
};
@ -341,6 +343,7 @@ int Obs_Gps_L1_System_Test::run_receiver()
std::cout << "STD exception: " << ex.what();
}
// Get the name of the RINEX obs file generated by the receiver
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
FILE *fp;
std::string argum2 = std::string("/bin/ls *O | grep GSDR | tail -1");
char buffer[1035];
@ -350,15 +353,12 @@ int Obs_Gps_L1_System_Test::run_receiver()
std::cout << "Failed to run command: " << argum2 << std::endl;
return -1;
}
char * without_trailing = (char*)"0";
while (fgets(buffer, sizeof(buffer), fp) != NULL)
{
std::string aux = std::string(buffer);
without_trailing = strtok(&aux[0], "\n");
Obs_Gps_L1_System_Test::generated_rinex_obs = aux.erase(aux.length() - 1, 1);
}
generated_rinex_obs = std::string(without_trailing);
pclose(fp);
return 0;
}
@ -436,7 +436,7 @@ void Obs_Gps_L1_System_Test::check_results()
try
{
std::string arg2_gen = std::string("./") + generated_rinex_obs;
std::string arg2_gen = std::string("./") + Obs_Gps_L1_System_Test::generated_rinex_obs;
gpstk::Rinex3ObsStream r_meas(arg2_gen);
r_meas.exceptions(std::ios::failbit);
gpstk::Rinex3ObsData r_meas_data;
@ -685,9 +685,9 @@ TEST_F(Obs_Gps_L1_System_Test, Observables_system_test)
// Run the receiver
EXPECT_EQ( run_receiver(), 0) << "Problem executing the software-defined signal generator";
std::cout << "Validating RINEX obs file obtained by GNSS-SDR: " << generated_rinex_obs << " ..." << std::endl;
is_gen_rinex_obs_valid = check_valid_rinex_obs( "./" + generated_rinex_obs);
EXPECT_EQ(true, is_gen_rinex_obs_valid) << "The RINEX observation file " << generated_rinex_obs << ", generated by GNSS-SDR, is not well formed.";
std::cout << "Validating RINEX obs file obtained by GNSS-SDR: " << Obs_Gps_L1_System_Test::generated_rinex_obs << " ..." << std::endl;
is_gen_rinex_obs_valid = check_valid_rinex_obs( "./" + Obs_Gps_L1_System_Test::generated_rinex_obs);
EXPECT_EQ(true, is_gen_rinex_obs_valid) << "The RINEX observation file " << Obs_Gps_L1_System_Test::generated_rinex_obs << ", generated by GNSS-SDR, is not well formed.";
std::cout << "The file is valid." << std::endl;
// Check results

View File

@ -0,0 +1,557 @@
/*!
* \file position_test.cc
* \brief This class implements a test for the validation of computed position.
* \author Carles Fernandez-Prades, 2016. cfernandez(at)cttc.es
*
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include <cmath>
#include <numeric>
#include <thread>
#include <gflags/gflags.h>
#include <glog/logging.h>
#include <gtest/gtest.h>
#include "concurrent_map.h"
#include "concurrent_queue.h"
#include "control_thread.h"
#include "in_memory_configuration.h"
#include "signal_generator_flags.h"
// For GPS NAVIGATION (L1)
concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
class Position_Gps_L1_System_Test: public ::testing::Test
{
public:
std::string generator_binary;
std::string p1;
std::string p2;
std::string p3;
std::string p4;
std::string p5;
const double baseband_sampling_freq = 2.6e6;
std::string filename_rinex_obs = FLAGS_filename_rinex_obs;
std::string filename_raw_data = FLAGS_filename_raw_data;
int configure_generator();
int generate_signal();
int configure_receiver();
int run_receiver();
void check_results();
double compute_stdev_precision(const std::vector<double> & vec);
double compute_stdev_accuracy(const std::vector<double> & vec, double ref);
void geodetic2Enu(const double latitude, const double longitude, const double altitude,
double* east, double* north, double* up);
std::shared_ptr<InMemoryConfiguration> config;
std::string generated_kml_file;
private:
void geodetic2Ecef(const double latitude, const double longitude, const double altitude,
double* x, double* y, double* z);
};
void Position_Gps_L1_System_Test::geodetic2Ecef(const double latitude, const double longitude, const double altitude,
double* x, double* y, double* z)
{
const double a = 6378137.0; // WGS84
const double b = 6356752.314245; // WGS84
double aux_x, aux_y, aux_z;
// Convert to ECEF (See https://en.wikipedia.org/wiki/Geographic_coordinate_conversion#From_geodetic_to_ECEF_coordinates )
double N = std::pow(a, 2.0) / sqrt( std::pow(a, 2.0) * std::pow(cos(latitude), 2.0) + std::pow(b, 2.0) * std::pow(sin(latitude), 2.0));
aux_x = (N + altitude) * cos(latitude) * cos(longitude);
aux_y = (N + altitude) * cos(latitude) * sin(longitude);
aux_z = ((std::pow(b, 2.0) / std::pow(a, 2.0)) * N + altitude) * sin(latitude);
*x = aux_x;
*y = aux_y;
*z = aux_z;
}
void Position_Gps_L1_System_Test::geodetic2Enu(const double latitude, const double longitude, const double altitude,
double* east, double* north, double* up)
{
// Reference : https://github.com/ethz-asl/geodetic_utils/blob/master/include/geodetic_utils/geodetic_conv.hpp
double x, y, z;
const double d2r = 3.1415926535898 / 180.0;
geodetic2Ecef(latitude * d2r, longitude * d2r, altitude, &x, &y, &z);
double aux_north, aux_east, aux_down;
std::istringstream iss2(FLAGS_static_position);
std::string str_aux;
std::getline(iss2, str_aux, ',');
double ref_long = std::stod(str_aux);
std::getline(iss2, str_aux, ',');
double ref_lat = std::stod(str_aux);
std::getline(iss2, str_aux, '\n');
double ref_h = std::stod(str_aux);
double ref_x, ref_y, ref_z;
geodetic2Ecef(ref_lat * d2r, ref_long * d2r, ref_h, &ref_x, &ref_y, &ref_z);
double aux_x = x - ref_x;
double aux_y = y - ref_y;
double aux_z = z - ref_z;
// ECEF to NED matrix
double phiP = atan2(ref_z, sqrt(std::pow(ref_x, 2.0) + std::pow(ref_y, 2.0)));
const double sLat = sin(phiP);
const double sLon = sin(ref_long * d2r);
const double cLat = cos(phiP);
const double cLon = cos(ref_long * d2r);
aux_north = -aux_x * sLat * cLon - aux_y * sLon + aux_z * cLat * cLon;
aux_east = -aux_x * sLat * sLon + aux_y * cLon + aux_z * cLat * sLon;
aux_down = aux_x * cLat + aux_z * sLat;
*east = aux_east;
*north = aux_north;
*up = -aux_down;
}
double Position_Gps_L1_System_Test::compute_stdev_precision(const std::vector<double> & vec)
{
double sum__ = std::accumulate(vec.begin(), vec.end(), 0.0);
double mean__ = sum__ / vec.size();
double accum__ = 0.0;
std::for_each (std::begin(vec), std::end(vec), [&](const double d) {
accum__ += (d - mean__) * (d - mean__);
});
double stdev__ = std::sqrt(accum__ / (vec.size() - 1));
return stdev__;
}
double Position_Gps_L1_System_Test::compute_stdev_accuracy(const std::vector<double> & vec, double ref)
{
double mean__ = ref;
double accum__ = 0.0;
std::for_each (std::begin(vec), std::end(vec), [&](const double d) {
accum__ += (d - mean__) * (d - mean__);
});
double stdev__ = std::sqrt(accum__ / (vec.size() - 1));
return stdev__;
}
int Position_Gps_L1_System_Test::configure_generator()
{
// Configure signal generator
generator_binary = FLAGS_generator_binary;
p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file;
if(FLAGS_dynamic_position.empty())
{
p2 = std::string("-static_position=") + FLAGS_static_position + std::string(",") + std::to_string(std::min(FLAGS_duration * 10, 3000));
if(FLAGS_duration > 300) std::cout << "WARNING: Duration has been set to its maximum value of 300 s" << std::endl;
}
else
{
p2 = std::string("-obs_pos_file=") + std::string(FLAGS_dynamic_position);
}
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps]
return 0;
}
int Position_Gps_L1_System_Test::generate_signal()
{
pid_t wait_result;
int child_status;
char *const parmList[] = { &generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], NULL };
int pid;
if ((pid = fork()) == -1)
perror("fork error");
else if (pid == 0)
{
execv(&generator_binary[0], parmList);
std::cout << "Return not expected. Must be an execv error." << std::endl;
std::terminate();
}
wait_result = waitpid(pid, &child_status, 0);
if (wait_result == -1) perror("waitpid error");
return 0;
}
int Position_Gps_L1_System_Test::configure_receiver()
{
config = std::make_shared<InMemoryConfiguration>();
const int sampling_rate_internal = baseband_sampling_freq;
const int number_of_taps = 11;
const int number_of_bands = 2;
const float band1_begin = 0.0;
const float band1_end = 0.48;
const float band2_begin = 0.52;
const float band2_end = 1.0;
const float ampl1_begin = 1.0;
const float ampl1_end = 1.0;
const float ampl2_begin = 0.0;
const float ampl2_end = 0.0;
const float band1_error = 1.0;
const float band2_error = 1.0;
const int grid_density = 16;
const int decimation_factor = 1;
const float zero = 0.0;
const int number_of_channels = 8;
const int in_acquisition = 1;
const float threshold = 0.01;
const float doppler_max = 8000.0;
const float doppler_step = 500.0;
const int max_dwells = 1;
const int tong_init_val = 2;
const int tong_max_val = 10;
const int tong_max_dwells = 30;
const int coherent_integration_time_ms = 1;
const float pll_bw_hz = 30.0;
const float dll_bw_hz = 4.0;
const float early_late_space_chips = 0.5;
const float pll_bw_narrow_hz = 20.0;
const float dll_bw_narrow_hz = 2.0;
const int extend_correlation_ms = 1;
const int display_rate_ms = 500;
const int output_rate_ms = 1000;
const int averaging_depth = 1;
config->set_property("GNSS-SDR.internal_fs_hz", std::to_string(sampling_rate_internal));
// Set the assistance system parameters
config->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "false");
config->set_property("GNSS-SDR.SUPL_gps_enabled", "false");
config->set_property("GNSS-SDR.SUPL_gps_ephemeris_server", "supl.google.com");
config->set_property("GNSS-SDR.SUPL_gps_ephemeris_port", std::to_string(7275));
config->set_property("GNSS-SDR.SUPL_gps_acquisition_server", "supl.google.com");
config->set_property("GNSS-SDR.SUPL_gps_acquisition_port", std::to_string(7275));
config->set_property("GNSS-SDR.SUPL_MCC", std::to_string(244));
config->set_property("GNSS-SDR.SUPL_MNS", std::to_string(5));
config->set_property("GNSS-SDR.SUPL_LAC", "0x59e2");
config->set_property("GNSS-SDR.SUPL_CI", "0x31b0");
// Set the Signal Source
config->set_property("SignalSource.implementation", "File_Signal_Source");
config->set_property("SignalSource.filename", "./" + filename_raw_data);
config->set_property("SignalSource.sampling_frequency", std::to_string(sampling_rate_internal));
config->set_property("SignalSource.item_type", "ibyte");
config->set_property("SignalSource.samples", std::to_string(zero));
// Set the Signal Conditioner
config->set_property("SignalConditioner.implementation", "Signal_Conditioner");
config->set_property("DataTypeAdapter.implementation", "Ibyte_To_Complex");
config->set_property("InputFilter.implementation", "Fir_Filter");
config->set_property("InputFilter.dump", "false");
config->set_property("InputFilter.input_item_type", "gr_complex");
config->set_property("InputFilter.output_item_type", "gr_complex");
config->set_property("InputFilter.taps_item_type", "float");
config->set_property("InputFilter.number_of_taps", std::to_string(number_of_taps));
config->set_property("InputFilter.number_of_bands", std::to_string(number_of_bands));
config->set_property("InputFilter.band1_begin", std::to_string(band1_begin));
config->set_property("InputFilter.band1_end", std::to_string(band1_end));
config->set_property("InputFilter.band2_begin", std::to_string(band2_begin));
config->set_property("InputFilter.band2_end", std::to_string(band2_end));
config->set_property("InputFilter.ampl1_begin", std::to_string(ampl1_begin));
config->set_property("InputFilter.ampl1_end", std::to_string(ampl1_end));
config->set_property("InputFilter.ampl2_begin", std::to_string(ampl2_begin));
config->set_property("InputFilter.ampl2_end", std::to_string(ampl2_end));
config->set_property("InputFilter.band1_error", std::to_string(band1_error));
config->set_property("InputFilter.band2_error", std::to_string(band2_error));
config->set_property("InputFilter.filter_type", "bandpass");
config->set_property("InputFilter.grid_density", std::to_string(grid_density));
config->set_property("InputFilter.sampling_frequency", std::to_string(sampling_rate_internal));
config->set_property("InputFilter.IF", std::to_string(zero));
config->set_property("Resampler.implementation", "Pass_Through");
config->set_property("Resampler.dump", "false");
config->set_property("Resampler.item_type", "gr_complex");
config->set_property("Resampler.sample_freq_in", std::to_string(sampling_rate_internal));
config->set_property("Resampler.sample_freq_out", std::to_string(sampling_rate_internal));
// Set the number of Channels
config->set_property("Channels_1C.count", std::to_string(number_of_channels));
config->set_property("Channels.in_acquisition", std::to_string(in_acquisition));
config->set_property("Channel.signal", "1C");
// Set Acquisition
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition");
config->set_property("Acquisition_1C.item_type", "gr_complex");
config->set_property("Acquisition_1C.if", std::to_string(zero));
config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms));
config->set_property("Acquisition_1C.threshold", std::to_string(threshold));
config->set_property("Acquisition_1C.doppler_max", std::to_string(doppler_max));
config->set_property("Acquisition_1C.doppler_step", std::to_string(doppler_step));
config->set_property("Acquisition_1C.bit_transition_flag", "false");
config->set_property("Acquisition_1C.max_dwells", std::to_string(max_dwells));
config->set_property("Acquisition_1C.tong_init_val", std::to_string(tong_init_val));
config->set_property("Acquisition_1C.tong_max_val", std::to_string(tong_max_val));
config->set_property("Acquisition_1C.tong_max_dwells", std::to_string(tong_max_dwells));
// Set Tracking
config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_Tracking");
//config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_C_Aid_Tracking");
config->set_property("Tracking_1C.item_type", "gr_complex");
config->set_property("Tracking_1C.if", std::to_string(zero));
config->set_property("Tracking_1C.dump", "false");
config->set_property("Tracking_1C.dump_filename", "./tracking_ch_");
config->set_property("Tracking_1C.pll_bw_hz", std::to_string(pll_bw_hz));
config->set_property("Tracking_1C.dll_bw_hz", std::to_string(dll_bw_hz));
config->set_property("Tracking_1C.early_late_space_chips", std::to_string(early_late_space_chips));
config->set_property("Tracking_1C.pll_bw_narrow_hz", std::to_string(pll_bw_narrow_hz));
config->set_property("Tracking_1C.dll_bw_narrow_hz", std::to_string(dll_bw_narrow_hz));
config->set_property("Tracking_1C.extend_correlation_ms", std::to_string(extend_correlation_ms));
// Set Telemetry
config->set_property("TelemetryDecoder_1C.implementation", "GPS_L1_CA_Telemetry_Decoder");
config->set_property("TelemetryDecoder_1C.dump", "false");
config->set_property("TelemetryDecoder_1C.decimation_factor", std::to_string(decimation_factor));
// Set Observables
config->set_property("Observables.implementation", "Hybrid_Observables");
config->set_property("Observables.dump", "false");
config->set_property("Observables.dump_filename", "./observables.dat");
config->set_property("Observables.averaging_depth", std::to_string(100));
// Set PVT
config->set_property("PVT.implementation", "RTKLIB_PVT");
//config->set_property("PVT.implementation", "Hybrid_PVT");
config->set_property("PVT.averaging_depth", std::to_string(averaging_depth));
config->set_property("PVT.flag_averaging", "false");
config->set_property("PVT.output_rate_ms", std::to_string(output_rate_ms));
config->set_property("PVT.display_rate_ms", std::to_string(display_rate_ms));
config->set_property("PVT.dump_filename", "./PVT");
config->set_property("PVT.nmea_dump_filename", "./gnss_sdr_pvt.nmea");
config->set_property("PVT.flag_nmea_tty_port", "false");
config->set_property("PVT.nmea_dump_devname", "/dev/pts/4");
config->set_property("PVT.flag_rtcm_server", "false");
config->set_property("PVT.flag_rtcm_tty_port", "false");
config->set_property("PVT.rtcm_dump_devname", "/dev/pts/1");
config->set_property("PVT.dump", "false");
config->set_property("PVT.rinex_version", std::to_string(2));
return 0;
}
int Position_Gps_L1_System_Test::run_receiver()
{
std::shared_ptr<ControlThread> control_thread;
control_thread = std::make_shared<ControlThread>(config);
// start receiver
try
{
control_thread->run();
}
catch( boost::exception & e )
{
std::cout << "Boost exception: " << boost::diagnostic_information(e);
}
catch(std::exception const& ex)
{
std::cout << "STD exception: " << ex.what();
}
// Get the name of the KML file generated by the receiver
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
FILE *fp;
std::string argum2 = std::string("/bin/ls *kml | tail -1");
char buffer[1035];
fp = popen(&argum2[0], "r");
if (fp == NULL)
{
std::cout << "Failed to run command: " << argum2 << std::endl;
return -1;
}
while (fgets(buffer, sizeof(buffer), fp) != NULL)
{
std::string aux = std::string(buffer);
EXPECT_EQ(aux.empty(), false);
Position_Gps_L1_System_Test::generated_kml_file = aux.erase(aux.length() - 1, 1);
}
pclose(fp);
EXPECT_EQ(Position_Gps_L1_System_Test::generated_kml_file.empty(), false);
return 0;
}
void Position_Gps_L1_System_Test::check_results()
{
std::fstream myfile(Position_Gps_L1_System_Test::generated_kml_file, std::ios_base::in);
std::string line;
std::vector<double> pos_e;
std::vector<double> pos_n;
std::vector<double> pos_u;
// Skip header
std::getline(myfile, line);
bool is_header = true;
while(is_header)
{
std::getline(myfile, line);
std::size_t found = line.find("<coordinates>");
if (found != std::string::npos) is_header = false;
}
bool is_data = true;
//read data
while(is_data)
{
std::getline(myfile, line);
std::size_t found = line.find("</coordinates>");
if (found != std::string::npos) is_data = false;
else
{
std::string str2;
std::istringstream iss(line);
double value;
double lat, longitude, h;
for (int i = 0; i < 3; i++)
{
std::getline(iss, str2, ',');
value = std::stod(str2);
if(i == 0) lat = value;
if(i == 1) longitude = value;
if(i == 2) h = value;
}
double north, east, up;
geodetic2Enu(lat, longitude, h, &east, &north, &up);
//std::cout << "E = " << east << ", N = " << north << " U = " << up << std::endl;
pos_e.push_back(east);
pos_n.push_back(north);
pos_u.push_back(up);
}
}
myfile.close();
double sigma_E_2_precision = std::pow(compute_stdev_precision(pos_e), 2.0);
double sigma_N_2_precision = std::pow(compute_stdev_precision(pos_n), 2.0);
double sigma_U_2_precision = std::pow(compute_stdev_precision(pos_u), 2.0);
double sigma_E_2_accuracy = std::pow(compute_stdev_accuracy(pos_e, 0.0), 2.0);
double sigma_N_2_accuracy = std::pow(compute_stdev_accuracy(pos_n, 0.0), 2.0);
double sigma_U_2_accuracy = std::pow(compute_stdev_accuracy(pos_u, 0.0), 2.0);
std::cout << "---- ACCURACY ----" << std::endl;
std::cout << "2DRMS = " << 2 * sqrt(sigma_E_2_accuracy + sigma_N_2_accuracy) << " [m]" << std::endl;
std::cout << "DRMS = " << sqrt(sigma_E_2_accuracy + sigma_N_2_accuracy) << " [m]" << std::endl;
std::cout << "CEP = " << 0.62 * compute_stdev_accuracy(pos_n, 0.0) + 0.56 * compute_stdev_accuracy(pos_e, 0.0) << " [m]" << std::endl;
std::cout << "99% SAS = " << 1.122 * (sigma_E_2_accuracy + sigma_N_2_accuracy + sigma_U_2_accuracy) << " [m]" << std::endl;
std::cout << "90% SAS = " << 0.833 * (sigma_E_2_accuracy + sigma_N_2_accuracy + sigma_U_2_accuracy) << " [m]" << std::endl;
std::cout << "MRSE = " << sqrt(sigma_E_2_accuracy + sigma_N_2_accuracy + sigma_U_2_accuracy) << " [m]" << std::endl;
std::cout << "SEP = " << 0.51 * (sigma_E_2_accuracy + sigma_N_2_accuracy + sigma_U_2_accuracy) << " [m]" << std::endl;
std::cout << std::endl;
std::cout << "---- PRECISION ----" << std::endl;
std::cout << "2DRMS = " << 2 * sqrt(sigma_E_2_precision + sigma_N_2_precision) << " [m]" << std::endl;
std::cout << "DRMS = " << sqrt(sigma_E_2_precision + sigma_N_2_precision) << " [m]" << std::endl;
std::cout << "CEP = " << 0.62 * compute_stdev_precision(pos_n) + 0.56 * compute_stdev_precision(pos_e) << " [m]" << std::endl;
std::cout << "99% SAS = " << 1.122 * (sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision) << " [m]" << std::endl;
std::cout << "90% SAS = " << 0.833 * (sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision) << " [m]" << std::endl;
std::cout << "MRSE = " << sqrt(sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision) << " [m]" << std::endl;
std::cout << "SEP = " << 0.51 * (sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision) << " [m]" << std::endl;
// Sanity Check
double precision_SEP = 0.51 * (sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision);
ASSERT_LT(precision_SEP, 20.0);
}
TEST_F(Position_Gps_L1_System_Test, Position_system_test)
{
// Configure the signal generator
configure_generator();
// Generate signal raw signal samples and observations RINEX file
if(!FLAGS_disable_generator)
{
generate_signal();
}
// Configure receiver
configure_receiver();
// Run the receiver
EXPECT_EQ( run_receiver(), 0) << "Problem executing the software-defined signal generator";
// Check results
check_results();
}
int main(int argc, char **argv)
{
std::cout << "Running Position precision test..." << std::endl;
int res = 0;
try
{
testing::InitGoogleTest(&argc, argv);
}
catch(...) {} // catch the "testing::internal::<unnamed>::ClassUniqueToAlwaysTrue" from gtest
google::ParseCommandLineFlags(&argc, &argv, true);
google::InitGoogleLogging(argv[0]);
// Run the Tests
try
{
res = RUN_ALL_TESTS();
}
catch(...)
{
LOG(WARNING) << "Unexpected catch";
}
google::ShutDownCommandLineFlags();
return res;
}