mirror of https://github.com/gnss-sdr/gnss-sdr
moving things to trunk
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@72 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
0d9423d5ed
commit
228fa3b797
|
@ -0,0 +1,674 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program 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.
|
||||||
|
|
||||||
|
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
@ -0,0 +1,65 @@
|
||||||
|
How to set up the compilation environment for Ubuntu 9.10 and 10.04
|
||||||
|
|
||||||
|
- Download GNU Radio 3.3.0 from ftp://ftp.gnu.org/gnu/gnuradio
|
||||||
|
- Compile and install following the instructions at http://gnuradio.org/redmine/wiki/1/UbuntuInstall
|
||||||
|
- Install bjam with the command 'sudo apt-get install bjam'
|
||||||
|
- Install Boost.Build with the command 'sudo apt-get install boost-build'
|
||||||
|
- Add the system variable GNURADIO_330_ROOT with the location of the sources of gnuradio-3.3.0
|
||||||
|
- Download gtest-1.4.0.tar.gz from http://code.google.com/p/googletest.
|
||||||
|
- Unpack gtest-1.4.0.tar.gz into some folder.
|
||||||
|
- From the folder containing gtest build the libraries and install them:
|
||||||
|
- GTEST$ ./configure
|
||||||
|
- GTEST$ make
|
||||||
|
- GTEST$ make check
|
||||||
|
- GTEST$ sudo make install
|
||||||
|
- Add the following line to your .bashrc:
|
||||||
|
- export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
|
||||||
|
- Download glog-0.3.0.tar.gz from http://code.google.com/p/google-glog.
|
||||||
|
- Unpack glog-0.3.0.tar.gz into some folder.
|
||||||
|
- From the folder containing glog, build and install the libraries:
|
||||||
|
- GLOG$ ./configure
|
||||||
|
- GLOG$ make
|
||||||
|
- GLOG$ sudo make install
|
||||||
|
NOTE: THE LOG FILES ARE STORED BY DEFAULT /TMP/
|
||||||
|
- Download gflags-1.3.tar.gz from http://code.google.com/p/google-gflags.
|
||||||
|
- Unpack gflags-1.3.tar.gz into some folder.
|
||||||
|
- From the folder containing gflags, build the libraries and install them:
|
||||||
|
- GFLAGS$ ./configure
|
||||||
|
- GFLAGS$ make
|
||||||
|
- GFLAGS$ sudo make install
|
||||||
|
|
||||||
|
(11/12/2010) GSL AND CBLAS ARITHMETIC
|
||||||
|
|
||||||
|
In order to compile the arithmetic tests, the GNU Scientific Library (GSL) library package is needed.
|
||||||
|
Install the ubuntu package with:
|
||||||
|
|
||||||
|
sudo apt-get install libgsl0ldbl
|
||||||
|
|
||||||
|
|
||||||
|
To build the project type call bjam from the project root folder.
|
||||||
|
|
||||||
|
PROFILING
|
||||||
|
|
||||||
|
In order to do profiling, you'll have to install google-perftools library.
|
||||||
|
- Download google-perftools-1.5.tar.gz from http://code.google.com/p/google-perftools.
|
||||||
|
- Unpack google-perftools-1.5.tar.gz into some folder.
|
||||||
|
- From the folder containing google-perftools, build and install the libraries:
|
||||||
|
- PERFTOOLS$ ./configure
|
||||||
|
- PERFTOOLS$ make
|
||||||
|
- PERFTOOLS$ sudo make install
|
||||||
|
|
||||||
|
Once google-perftools is installed, you can use the script "profiler" which is placed
|
||||||
|
in the root folder of MERCURIO sources. The script must be run as root since it makes use
|
||||||
|
of "nice". The result of the profiling are two files, mercurio.cpu.prof and mercurio.head.prof.0001.heap,
|
||||||
|
that contain the results for CPU and HEAP profiling. You can use google-perftools' script pprof
|
||||||
|
to analyze the recorded data.
|
||||||
|
|
||||||
|
(Sample of .bashrc configuration)
|
||||||
|
|
||||||
|
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
|
||||||
|
export GNURADIO_330_ROOT=/home/gnss/sdr/gnuradio-3.3.0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
; Sample for a configuration file for MERCURIO
|
||||||
|
|
||||||
|
[mercurio]
|
||||||
|
|
||||||
|
;######### CONTROL_THREAD CONFIG ############
|
||||||
|
ControlThread.wait_for_flowgraph=false
|
||||||
|
|
||||||
|
;######### SIGNAL_SOURCE CONFIG ############
|
||||||
|
SignalSource.implementation=File_Signal_Source
|
||||||
|
;SignalSource.filename=/media/My Passport/spirent scenario 2/data/sc2_d8.dat
|
||||||
|
;SignalSource.filename=/home/luis/Project/signals/GPS_cap1.dat
|
||||||
|
SignalSource.filename=/media/My Passport/KINGSTON (G)/Project Luis/GPSL1_Fs_8MHz_ID_1_CN0_60.dat
|
||||||
|
SignalSource.item_type=gr_complex
|
||||||
|
SignalSource.sampling_frequency=8000000
|
||||||
|
SignalSource.samples=0
|
||||||
|
SignalSource.repeat=false
|
||||||
|
SignalSource.dump=false
|
||||||
|
SignalSource.enable_throttle_control=true
|
||||||
|
|
||||||
|
;######### SIGNAL_CONDITIONER CONFIG ############
|
||||||
|
SignalConditioner.implementation=Pass_Through
|
||||||
|
SignalConditioner.item_type=gr_complex
|
||||||
|
SignalConditioner.sample_freq_in=8000000
|
||||||
|
SignalConditioner.sample_freq_out=8000000
|
||||||
|
SignalConditioner.dump=false
|
||||||
|
|
||||||
|
;######### CHANNELS CONFIGURATION CONFIG ############
|
||||||
|
Channels.count=1
|
||||||
|
|
||||||
|
;######### ACQUISITION CONFIG ############
|
||||||
|
|
||||||
|
Acquisition.dump=false
|
||||||
|
Acquisition.dump_filename=./acq_dump.dat
|
||||||
|
Acquisition.item_type=gr_complex
|
||||||
|
Acquisition.fs_in=8000000
|
||||||
|
Acquisition.if=0
|
||||||
|
Acquisition.sampled_ms=1
|
||||||
|
|
||||||
|
;######### ACQUISITION 0 CONFIG ############
|
||||||
|
Acquisition0.implementation=GPS_L1_CA_PCPS_Acquisition
|
||||||
|
Acquisition0.threshold=0.006
|
||||||
|
Acquisition0.doppler_max=10000
|
||||||
|
Acquisition0.doppler_step=250
|
||||||
|
Acquisition0.satellite=1
|
||||||
|
Acquisition0.repeat_satellite=true
|
||||||
|
|
||||||
|
;######### ACQUISITION 1 CONFIG ############
|
||||||
|
Acquisition1.implementation=GPS_L1_CA_GPS_SDR_Acquisition
|
||||||
|
Acquisition1.threshold=30
|
||||||
|
Acquisition1.doppler_max=10000
|
||||||
|
Acquisition1.doppler_step=250
|
||||||
|
Acquisition1.satellite=16
|
||||||
|
Acquisition1.repeat_satellite=true
|
||||||
|
|
||||||
|
;######### ACQUISITION 2 CONFIG ############
|
||||||
|
Acquisition2.implementation=GPS_L1_CA_TONG_PCPS_Acquisition
|
||||||
|
Acquisition2.threshold=
|
||||||
|
Acquisition2.doppler_max=10000
|
||||||
|
Acquisition2.doppler_step=250
|
||||||
|
Acquisition2.satellite=21
|
||||||
|
Acquisition2.repeat_satellite=true
|
||||||
|
|
||||||
|
|
||||||
|
;######### ACQUISITION 3 CONFIG ############
|
||||||
|
Acquisition3.implementation=GPS_L1_CA_PCPS_Acquisition
|
||||||
|
Acquisition3.threshold=105000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;######### TRACKING CONFIG ############
|
||||||
|
Tracking.implementation=GPS_L1_CA_DLL_PLL_Tracking
|
||||||
|
Tracking.item_type=gr_complex
|
||||||
|
Tracking.vector_length=8000
|
||||||
|
Tracking.fs_in=8000000
|
||||||
|
Tracking.if=0
|
||||||
|
Tracking.dump=true
|
||||||
|
Tracking.dump_filename=./trk_dump.dat
|
||||||
|
|
||||||
|
;######### TELEMETRY DECODER CONFIG ############
|
||||||
|
TelemetryDecoder.implementation=GPS_L1_CA_Telemetry_Decoder
|
||||||
|
TelemetryDecoder.item_type=gr_complex
|
||||||
|
|
||||||
|
;######### OBSERVABLES CONFIG ############
|
||||||
|
Observables.implementation=GPS_L1_CA_Observables
|
||||||
|
Observables.fs_in=8000000;
|
||||||
|
|
||||||
|
;######### PVT CONFIG ############
|
||||||
|
PVT.implementation=Pass_Through
|
||||||
|
PVT.item_type=gr_complex
|
||||||
|
|
||||||
|
;######### OUTPUT_FILTER CONFIG ############
|
||||||
|
OutputFilter.implementation=Null_Sink_Output_Filter
|
||||||
|
OutputFilter.filename=data/mercurio.dat
|
||||||
|
OutputFilter.item_type=gr_complex
|
|
@ -0,0 +1,155 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<profiles version="1">
|
||||||
|
<profile kind="CodeFormatterProfile" name="GNSS-SDR" version="1">
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.lineSplit" value="78"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer" value="18"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.tabulation.size" value="4"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.alignment_for_enumerator_list" value="50"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.alignment_for_declarator_list" value="16"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_empty_lines" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_method_declaration" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation" value="18"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration" value="18"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_block" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_type_declaration" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.continuation_indentation" value="2"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.alignment_for_expression_list" value="0"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.alignment_for_conditional_expression" value="16"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.alignment_for_compact_if" value="0"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration" value="82"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="18"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.tabulation.char" value="space"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_block_in_case" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.compact_else_if" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_switch" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indentation.size" value="4"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments" value="do not insert"/>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
|
@ -0,0 +1,50 @@
|
||||||
|
import testing ;
|
||||||
|
|
||||||
|
lib gtest ;
|
||||||
|
lib glog ;
|
||||||
|
lib gflags ;
|
||||||
|
lib gnuradio-core ;
|
||||||
|
lib gnuradio-usrp ;
|
||||||
|
lib profiler ;
|
||||||
|
lib gsl ;
|
||||||
|
lib gslcblas ;
|
||||||
|
|
||||||
|
project : requirements
|
||||||
|
<define>OMNITHREAD_POSIX
|
||||||
|
<cxxflags>"-std=c++0x"
|
||||||
|
# <include>src/utils
|
||||||
|
# <include>src/utils/INIReader
|
||||||
|
<include>src/algorithms/acquisition/adapters
|
||||||
|
<include>src/algorithms/acquisition/gnuradio_blocks
|
||||||
|
<include>src/algorithms/channel/adapters
|
||||||
|
<include>src/algorithms/channel/gnuradio_blocks
|
||||||
|
<include>src/algorithms/channel/libs
|
||||||
|
<include>src/algorithms/conditioner/adapters
|
||||||
|
<include>src/algorithms/conditioner/gnuradio_blocks
|
||||||
|
<include>src/algorithms/libs
|
||||||
|
<include>src/algorithms/observables/adapters
|
||||||
|
<include>src/algorithms/observables/gnuradio_blocks
|
||||||
|
<include>src/algorithms/observables/libs
|
||||||
|
<include>src/algorithms/output_filter/adapters
|
||||||
|
<include>src/algorithms/output_filter/gnuradio_blocks
|
||||||
|
<include>src/algorithms/PVT/adapters
|
||||||
|
<include>src/algorithms/PVT/gnuradio_blocks
|
||||||
|
<include>src/algorithms/signal_source/adapters
|
||||||
|
<include>src/algorithms/signal_source/gnuradio_blocks
|
||||||
|
<include>src/algorithms/telemetry_decoder/adapters
|
||||||
|
<include>src/algorithms/telemetry_decoder/gnuradio_blocks
|
||||||
|
<include>src/algorithms/telemetry_decoder/libs
|
||||||
|
<include>src/algorithms/tracking/adapters
|
||||||
|
<include>src/algorithms/tracking/gnuradio_blocks
|
||||||
|
<include>src/core/interfaces
|
||||||
|
<include>src/core/libs
|
||||||
|
<include>src/core/receiver
|
||||||
|
<include>src/core/system_parameters
|
||||||
|
<include>$GNURADIO_330_ROOT/gr-usrp/src
|
||||||
|
<include>$GNURADIO_330_ROOT/gnuradio-core/src/lib/runtime
|
||||||
|
<include>$GNURADIO_330_ROOT/gnuradio-core/src/lib/filter
|
||||||
|
<include>$GNURADIO_330_ROOT/gnuradio-core/src/lib/io
|
||||||
|
<include>$GNURADIO_330_ROOT/gnuradio-core/src/lib/general
|
||||||
|
<include>$GNURADIO_330_ROOT/gnuradio-core/src/lib/gengen ;
|
||||||
|
|
||||||
|
build-project src ;
|
|
@ -0,0 +1,307 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_gps_sdr_acquisition.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gps_l1_ca_gps_sdr_acquisition.h"
|
||||||
|
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
#include <gnuradio/gr_stream_to_vector.h>
|
||||||
|
#include <gnuradio/gr_vector_to_stream.h>
|
||||||
|
#include <gnuradio/gr_complex_to_interleaved_short.h>
|
||||||
|
#include <gnuradio/gr_interleaved_short_to_complex.h>
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
GpsL1CaGpsSdrAcquisition::GpsL1CaGpsSdrAcquisition(
|
||||||
|
ConfigurationInterface* configuration, std::string role,
|
||||||
|
unsigned int in_streams, unsigned int out_streams,
|
||||||
|
gr_msg_queue_sptr queue) :
|
||||||
|
role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(
|
||||||
|
queue)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string default_item_type = "gr_complex";
|
||||||
|
std::string default_dump_filename = "./data/acquisition_";
|
||||||
|
|
||||||
|
DLOG(INFO) << "role " << role;
|
||||||
|
|
||||||
|
item_type_ = configuration->property(role + ".item_type",
|
||||||
|
default_item_type);
|
||||||
|
//vector_length_ = configuration->property(role + ".vector_length", 2048);
|
||||||
|
|
||||||
|
satellite_ = 0;
|
||||||
|
fs_in_ = configuration->property(role + ".fs_in", 2048000);
|
||||||
|
if_ = configuration->property(role + ".ifreq", 0);
|
||||||
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
|
doppler_max_ = 0;
|
||||||
|
acquisition_ms_ = configuration->property(role + ".sampled_ms", 1);
|
||||||
|
dump_filename_ = configuration->property(role + ".dump_filename",
|
||||||
|
default_dump_filename);
|
||||||
|
|
||||||
|
//vector_length_=ceil((float)fs_in_*((float)acquisition_ms_/1000));
|
||||||
|
|
||||||
|
//--- Find number of samples per spreading code ----------------------------
|
||||||
|
const int32 _codeFreqBasis = 1023000; //Hz
|
||||||
|
const int32 _codeLength = 1023;
|
||||||
|
vector_length_ = round(fs_in_ / (_codeFreqBasis / _codeLength));
|
||||||
|
|
||||||
|
printf("vector_length_ %i\n\r", vector_length_);
|
||||||
|
|
||||||
|
if (item_type_.compare("short") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(short);
|
||||||
|
acquisition_ss_ = gps_l1_ca_gps_sdr_make_acquisition_ss(
|
||||||
|
acquisition_ms_, if_, fs_in_, vector_length_, queue_, dump_,
|
||||||
|
dump_filename_);
|
||||||
|
stream_to_vector_ = gr_make_stream_to_vector(item_size_, 2
|
||||||
|
* vector_length_);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
acquisition_cc_ = gps_l1_ca_gps_sdr_make_acquisition_cc(
|
||||||
|
acquisition_ms_, if_, fs_in_, vector_length_, queue_, dump_,
|
||||||
|
dump_filename_);
|
||||||
|
stream_to_vector_ = gr_make_stream_to_vector(item_size_,
|
||||||
|
vector_length_);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(WARNING) << item_type_ << " unknown item type.";
|
||||||
|
}
|
||||||
|
|
||||||
|
DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id()
|
||||||
|
<< ")";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
GpsL1CaGpsSdrAcquisition::~GpsL1CaGpsSdrAcquisition()
|
||||||
|
{}
|
||||||
|
|
||||||
|
//! Set satellite
|
||||||
|
void GpsL1CaGpsSdrAcquisition::set_satellite(unsigned int satellite)
|
||||||
|
{
|
||||||
|
satellite_ = satellite;
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_satellite(satellite_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
acquisition_ss_->set_satellite(satellite_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//! Set channel
|
||||||
|
void GpsL1CaGpsSdrAcquisition::set_channel(unsigned int channel)
|
||||||
|
{
|
||||||
|
channel_ = channel;
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_channel(channel_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
acquisition_ss_->set_channel(channel_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Set acquisition threshold
|
||||||
|
void GpsL1CaGpsSdrAcquisition::set_threshold(float threshold)
|
||||||
|
{
|
||||||
|
threshold_ = threshold;
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_threshold(threshold_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
acquisition_ss_->set_threshold(threshold_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Set maximum Doppler shift
|
||||||
|
void GpsL1CaGpsSdrAcquisition::set_doppler_max(unsigned int doppler_max)
|
||||||
|
{
|
||||||
|
doppler_max_ = doppler_max;
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_doppler_max(doppler_max_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
acquisition_ss_->set_doppler_max(doppler_max_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Set Channel Queue
|
||||||
|
void GpsL1CaGpsSdrAcquisition::set_channel_queue(
|
||||||
|
concurrent_queue<int> *channel_internal_queue)
|
||||||
|
{
|
||||||
|
channel_internal_queue_ = channel_internal_queue;
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_channel_queue(channel_internal_queue_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
acquisition_ss_->set_channel_queue(channel_internal_queue_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signed int GpsL1CaGpsSdrAcquisition::prn_code_phase()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
return acquisition_cc_->prn_code_phase();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return acquisition_ss_->prn_code_phase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float GpsL1CaGpsSdrAcquisition::doppler_freq_shift()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
return acquisition_cc_->doppler_freq_phase();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return acquisition_ss_->doppler_freq_phase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signed int GpsL1CaGpsSdrAcquisition::mag()
|
||||||
|
{
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
return acquisition_cc_->mag();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return acquisition_ss_->mag();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaGpsSdrAcquisition::reset()
|
||||||
|
{
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_active(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
acquisition_ss_->set_active(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long int GpsL1CaGpsSdrAcquisition::get_sample_stamp()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
return acquisition_cc_->get_sample_stamp();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return acquisition_ss_->get_sample_stamp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaGpsSdrAcquisition::connect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
//top_block->connect(stream_to_vector_, 0, vector_to_stream_,0);
|
||||||
|
|
||||||
|
top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0);
|
||||||
|
//top_block->connect(acquisition_cc_, 0, vector_to_stream_, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
top_block->connect(stream_to_vector_, 0, acquisition_ss_, 0);
|
||||||
|
//top_block->connect(acquisition_ss_, 0, vector_to_stream_, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaGpsSdrAcquisition::disconnect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
top_block->disconnect(stream_to_vector_, 0, acquisition_cc_, 0);
|
||||||
|
//top_block->disconnect(acquisition_cc_, 0, vector_to_stream_, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
top_block->disconnect(stream_to_vector_, 0, acquisition_ss_, 0);
|
||||||
|
//top_block->disconnect(acquisition_ss_, 0, vector_to_stream_, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr GpsL1CaGpsSdrAcquisition::get_left_block()
|
||||||
|
{
|
||||||
|
return stream_to_vector_;
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr GpsL1CaGpsSdrAcquisition::get_right_block()
|
||||||
|
{
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
return acquisition_cc_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return acquisition_ss_;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,123 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_gps_sdr_acquisition.h
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_ACQUISITION_H_
|
||||||
|
#define GNSS_SDR_ACQUISITION_H_
|
||||||
|
|
||||||
|
#include "acquisition_interface.h"
|
||||||
|
|
||||||
|
#include "gps_l1_ca_gps_sdr_acquisition_cc.h"
|
||||||
|
#include "gps_l1_ca_gps_sdr_acquisition_ss.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Adapts the GPS-SDR acquisition implementation to
|
||||||
|
* an Acquisition Interface
|
||||||
|
*
|
||||||
|
* Derived from AcquisitionInterface, this class wraps the implementation
|
||||||
|
* of the acquisition algorithm proposed by Gregory Heckler at https://github.com/gps-sdr/gps-sdr
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class GpsL1CaGpsSdrAcquisition: public AcquisitionInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
GpsL1CaGpsSdrAcquisition(ConfigurationInterface* configuration,
|
||||||
|
std::string role, unsigned int in_streams,
|
||||||
|
unsigned int out_streams, gr_msg_queue_sptr queue);
|
||||||
|
|
||||||
|
virtual ~GpsL1CaGpsSdrAcquisition();
|
||||||
|
|
||||||
|
std::string role()
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
std::string implementation()
|
||||||
|
{
|
||||||
|
return "Acquisition";
|
||||||
|
}
|
||||||
|
size_t item_size()
|
||||||
|
{
|
||||||
|
return item_size_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void connect(gr_top_block_sptr top_block);
|
||||||
|
void disconnect(gr_top_block_sptr top_block);
|
||||||
|
gr_basic_block_sptr get_left_block();
|
||||||
|
gr_basic_block_sptr get_right_block();
|
||||||
|
|
||||||
|
void set_satellite(unsigned int satellite);
|
||||||
|
void set_channel(unsigned int channel);
|
||||||
|
void set_threshold(float threshold);
|
||||||
|
void set_doppler_max(unsigned int doppler_max);
|
||||||
|
void set_channel_queue(concurrent_queue<int> *channel_internal_queue);
|
||||||
|
signed int prn_code_phase();
|
||||||
|
float doppler_freq_shift();
|
||||||
|
signed int mag();
|
||||||
|
void reset();
|
||||||
|
unsigned long int get_sample_stamp();
|
||||||
|
|
||||||
|
//Not used in this implementation
|
||||||
|
void set_doppler_step(unsigned int doppler_step)
|
||||||
|
{};
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
gps_l1_ca_gps_sdr_acquisition_cc_sptr acquisition_cc_;
|
||||||
|
gps_l1_ca_gps_sdr_acquisition_ss_sptr acquisition_ss_;
|
||||||
|
gr_block_sptr stream_to_vector_;
|
||||||
|
gr_block_sptr complex_to_short_;
|
||||||
|
gr_block_sptr short_to_complex_;
|
||||||
|
size_t item_size_;
|
||||||
|
std::string item_type_;
|
||||||
|
unsigned int vector_length_;
|
||||||
|
unsigned int satellite_;
|
||||||
|
unsigned int channel_;
|
||||||
|
float threshold_;
|
||||||
|
unsigned int doppler_max_;
|
||||||
|
unsigned int acquisition_ms_;
|
||||||
|
long fs_in_;
|
||||||
|
long if_;
|
||||||
|
bool dump_;
|
||||||
|
std::string dump_filename_;
|
||||||
|
|
||||||
|
std::string role_;
|
||||||
|
unsigned int in_streams_;
|
||||||
|
unsigned int out_streams_;
|
||||||
|
gr_msg_queue_sptr queue_;
|
||||||
|
concurrent_queue<int> *channel_internal_queue_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,254 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_pcps_acquisition.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gps_l1_ca_pcps_acquisition.h"
|
||||||
|
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
#include <gnuradio/gr_stream_to_vector.h>
|
||||||
|
#include <gnuradio/gr_vector_to_stream.h>
|
||||||
|
#include <gnuradio/gr_complex_to_interleaved_short.h>
|
||||||
|
#include <gnuradio/gr_interleaved_short_to_complex.h>
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
||||||
|
ConfigurationInterface* configuration, std::string role,
|
||||||
|
unsigned int in_streams, unsigned int out_streams,
|
||||||
|
gr_msg_queue_sptr queue) :
|
||||||
|
role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(
|
||||||
|
queue)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string default_item_type = "gr_complex";
|
||||||
|
std::string default_dump_filename = "./data/acquisition.dat";
|
||||||
|
|
||||||
|
DLOG(INFO) << "role " << role;
|
||||||
|
|
||||||
|
item_type_ = configuration->property(role + ".item_type",
|
||||||
|
default_item_type);
|
||||||
|
|
||||||
|
satellite_ = 0;
|
||||||
|
fs_in_ = configuration->property(role + ".fs_in", 2048000);
|
||||||
|
if_ = configuration->property(role + ".ifreq", 0);
|
||||||
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
|
shift_resolution_ = configuration->property(role + ".doppler_max", 15);
|
||||||
|
sampled_ms_ = configuration->property(role + ".sampled_ms", 1);
|
||||||
|
dump_filename_ = configuration->property(role + ".dump_filename",
|
||||||
|
default_dump_filename);
|
||||||
|
|
||||||
|
//--- Find number of samples per spreading code ----------------------------
|
||||||
|
const signed int _codeFreqBasis = 1023000; //Hz
|
||||||
|
const signed int _codeLength = 1023;
|
||||||
|
std::cout << fs_in_ << " " << role << std::endl;
|
||||||
|
vector_length_ = round(fs_in_ / (_codeFreqBasis / _codeLength));
|
||||||
|
|
||||||
|
printf("vector_length_ %i\n\r", vector_length_);
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
acquisition_cc_ = gps_l1_ca_pcps_make_acquisition_cc(sampled_ms_,
|
||||||
|
shift_resolution_, if_, fs_in_, vector_length_, queue_,
|
||||||
|
dump_, dump_filename_);
|
||||||
|
stream_to_vector_ = gr_make_stream_to_vector(item_size_,
|
||||||
|
vector_length_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(WARNING) << item_type_
|
||||||
|
<< " unknown acquisition item type";
|
||||||
|
}
|
||||||
|
|
||||||
|
DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id()
|
||||||
|
<< ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
GpsL1CaPcpsAcquisition::~GpsL1CaPcpsAcquisition()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaPcpsAcquisition::set_satellite(unsigned int satellite)
|
||||||
|
{
|
||||||
|
satellite_ = satellite;
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_satellite(satellite_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaPcpsAcquisition::set_channel(unsigned int channel)
|
||||||
|
{
|
||||||
|
channel_ = channel;
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_channel(channel_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaPcpsAcquisition::set_threshold(float threshold)
|
||||||
|
{
|
||||||
|
threshold_ = threshold;
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_threshold(threshold_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaPcpsAcquisition::set_doppler_max(unsigned int doppler_max)
|
||||||
|
{
|
||||||
|
doppler_max_ = doppler_max;
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_doppler_max(doppler_max_);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaPcpsAcquisition::set_doppler_step(unsigned int doppler_step)
|
||||||
|
{
|
||||||
|
doppler_step_ = doppler_step;
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_doppler_step(doppler_step_);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaPcpsAcquisition::set_channel_queue(
|
||||||
|
concurrent_queue<int> *channel_internal_queue)
|
||||||
|
{
|
||||||
|
channel_internal_queue_ = channel_internal_queue;
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_channel_queue(channel_internal_queue_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signed int GpsL1CaPcpsAcquisition::prn_code_phase()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
return acquisition_cc_->prn_code_phase();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long int GpsL1CaPcpsAcquisition::get_sample_stamp()
|
||||||
|
{
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
return acquisition_cc_->get_sample_stamp();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
float GpsL1CaPcpsAcquisition::doppler_freq_shift()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
return acquisition_cc_->doppler_freq();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signed int GpsL1CaPcpsAcquisition::mag()
|
||||||
|
{
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
return acquisition_cc_->mag();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaPcpsAcquisition::reset()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_active(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaPcpsAcquisition::connect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaPcpsAcquisition::disconnect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
top_block->disconnect(stream_to_vector_, 0, acquisition_cc_, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr GpsL1CaPcpsAcquisition::get_left_block()
|
||||||
|
{
|
||||||
|
return stream_to_vector_;
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr GpsL1CaPcpsAcquisition::get_right_block()
|
||||||
|
{
|
||||||
|
return acquisition_cc_;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,117 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_pcps_acquisition.h
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GPS_L1_CA_PCPS_ACQUISITION_H_
|
||||||
|
#define GPS_L1_CA_PCPS_ACQUISITION_H_
|
||||||
|
|
||||||
|
#include "acquisition_interface.h"
|
||||||
|
|
||||||
|
#include "gps_l1_ca_pcps_acquisition_cc.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
|
||||||
|
class GpsL1CaPcpsAcquisition: public AcquisitionInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
GpsL1CaPcpsAcquisition(ConfigurationInterface* configuration,
|
||||||
|
std::string role, unsigned int in_streams,
|
||||||
|
unsigned int out_streams, gr_msg_queue_sptr queue);
|
||||||
|
|
||||||
|
virtual ~GpsL1CaPcpsAcquisition();
|
||||||
|
|
||||||
|
std::string role()
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
std::string implementation()
|
||||||
|
{
|
||||||
|
return "Acquisition";
|
||||||
|
}
|
||||||
|
size_t item_size()
|
||||||
|
{
|
||||||
|
return item_size_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void connect(gr_top_block_sptr top_block);
|
||||||
|
void disconnect(gr_top_block_sptr top_block);
|
||||||
|
gr_basic_block_sptr get_left_block();
|
||||||
|
gr_basic_block_sptr get_right_block();
|
||||||
|
|
||||||
|
void set_satellite(unsigned int satellite);
|
||||||
|
void set_channel(unsigned int channel);
|
||||||
|
void set_threshold(float threshold);
|
||||||
|
void set_doppler_max(unsigned int doppler_max);
|
||||||
|
void set_doppler_step(unsigned int doppler_step);
|
||||||
|
void set_channel_queue(concurrent_queue<int> *channel_internal_queue);
|
||||||
|
signed int prn_code_phase();
|
||||||
|
float doppler_freq_shift();
|
||||||
|
|
||||||
|
unsigned long int get_sample_stamp();
|
||||||
|
|
||||||
|
signed int mag();
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
gps_l1_ca_pcps_acquisition_cc_sptr acquisition_cc_;
|
||||||
|
gr_block_sptr stream_to_vector_;
|
||||||
|
gr_block_sptr complex_to_short_;
|
||||||
|
gr_block_sptr short_to_complex_;
|
||||||
|
size_t item_size_;
|
||||||
|
std::string item_type_;
|
||||||
|
unsigned int vector_length_;
|
||||||
|
unsigned int satellite_;
|
||||||
|
unsigned int channel_;
|
||||||
|
float threshold_;
|
||||||
|
unsigned int doppler_max_;
|
||||||
|
unsigned int doppler_step_;
|
||||||
|
unsigned int shift_resolution_;
|
||||||
|
unsigned int sampled_ms_;
|
||||||
|
long fs_in_;
|
||||||
|
long if_;
|
||||||
|
bool dump_;
|
||||||
|
std::string dump_filename_;
|
||||||
|
|
||||||
|
std::string role_;
|
||||||
|
unsigned int in_streams_;
|
||||||
|
unsigned int out_streams_;
|
||||||
|
gr_msg_queue_sptr queue_;
|
||||||
|
concurrent_queue<int> *channel_internal_queue_;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* GPS_L1_CA_PCPS_ACQUISITION_H_ */
|
|
@ -0,0 +1,245 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_tong_pcps_acquisition.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gps_l1_ca_tong_pcps_acquisition.h"
|
||||||
|
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
#include <gnuradio/gr_stream_to_vector.h>
|
||||||
|
#include <gnuradio/gr_vector_to_stream.h>
|
||||||
|
#include <gnuradio/gr_complex_to_interleaved_short.h>
|
||||||
|
#include <gnuradio/gr_interleaved_short_to_complex.h>
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
GpsL1CaTongPcpsAcquisition::GpsL1CaTongPcpsAcquisition(
|
||||||
|
ConfigurationInterface* configuration, std::string role,
|
||||||
|
unsigned int in_streams, unsigned int out_streams,
|
||||||
|
gr_msg_queue_sptr queue) :
|
||||||
|
role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(
|
||||||
|
queue)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string default_item_type = "gr_complex";
|
||||||
|
std::string default_dump_filename = "./data/acquisition.dat";
|
||||||
|
|
||||||
|
DLOG(INFO) << "role " << role;
|
||||||
|
|
||||||
|
item_type_ = configuration->property(role + ".item_type",
|
||||||
|
default_item_type);
|
||||||
|
|
||||||
|
std::cout << "item type " << item_type_ << std::endl;
|
||||||
|
|
||||||
|
satellite_ = 0;
|
||||||
|
fs_in_ = configuration->property(role + ".fs_in", 2048000);
|
||||||
|
if_ = configuration->property(role + ".ifreq", 0);
|
||||||
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
|
doppler_max_ = configuration->property(role + ".doppler_max", 10);
|
||||||
|
sampled_ms_ = configuration->property(role + ".sampled_ms", 1);
|
||||||
|
dump_filename_ = configuration->property(role + ".dump_filename",
|
||||||
|
default_dump_filename);
|
||||||
|
|
||||||
|
//--- Find number of samples per spreading code ----------------------------
|
||||||
|
const signed int _codeFreqBasis = 1023000; //Hz
|
||||||
|
const signed int _codeLength = 1023;
|
||||||
|
vector_length_ = round(fs_in_ / (_codeFreqBasis / _codeLength));
|
||||||
|
|
||||||
|
printf("vector_length_ %i\n\r", vector_length_);
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
acquisition_cc_ = gps_l1_ca_tong_pcps_make_acquisition_cc(
|
||||||
|
sampled_ms_, doppler_max_, if_, fs_in_, vector_length_,
|
||||||
|
queue_, dump_, dump_filename_);
|
||||||
|
stream_to_vector_ = gr_make_stream_to_vector(item_size_,
|
||||||
|
vector_length_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(WARNING) << item_type_
|
||||||
|
<< " unknown acquisition item type";
|
||||||
|
}
|
||||||
|
|
||||||
|
DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id()
|
||||||
|
<< ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
GpsL1CaTongPcpsAcquisition::~GpsL1CaTongPcpsAcquisition()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaTongPcpsAcquisition::set_satellite(unsigned int satellite)
|
||||||
|
{
|
||||||
|
satellite_ = satellite;
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_satellite(satellite_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaTongPcpsAcquisition::set_channel(unsigned int channel)
|
||||||
|
{
|
||||||
|
channel_ = channel;
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_channel(channel_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaTongPcpsAcquisition::set_doppler_max(unsigned int doppler_max)
|
||||||
|
{
|
||||||
|
doppler_max_ = doppler_max;
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_doppler_max(doppler_max_);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaTongPcpsAcquisition::set_doppler_step(unsigned int doppler_step)
|
||||||
|
{
|
||||||
|
doppler_step_ = doppler_step;
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_doppler_step(doppler_step_);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaTongPcpsAcquisition::set_channel_queue(
|
||||||
|
concurrent_queue<int> *channel_internal_queue)
|
||||||
|
{
|
||||||
|
channel_internal_queue_ = channel_internal_queue;
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_channel_queue(channel_internal_queue_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signed int GpsL1CaTongPcpsAcquisition::prn_code_phase()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
return acquisition_cc_->prn_code_phase();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long int GpsL1CaTongPcpsAcquisition::get_sample_stamp()
|
||||||
|
{
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
return acquisition_cc_->get_sample_stamp();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
float GpsL1CaTongPcpsAcquisition::doppler_freq_shift()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
return acquisition_cc_->doppler_freq();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signed int GpsL1CaTongPcpsAcquisition::mag()
|
||||||
|
{
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
return acquisition_cc_->mag();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaTongPcpsAcquisition::reset()
|
||||||
|
{
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
acquisition_cc_->set_active(true);
|
||||||
|
acquisition_cc_->set_dwells(0);
|
||||||
|
acquisition_cc_->set_doppler(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaTongPcpsAcquisition::connect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaTongPcpsAcquisition::disconnect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
top_block->disconnect(stream_to_vector_, 0, acquisition_cc_, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr GpsL1CaTongPcpsAcquisition::get_left_block()
|
||||||
|
{
|
||||||
|
return stream_to_vector_;
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr GpsL1CaTongPcpsAcquisition::get_right_block()
|
||||||
|
{
|
||||||
|
return acquisition_cc_;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_tong_pcps_acquisition.h
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GPS_L1_CA_TONG_PCPS_ACQUISITION_H_
|
||||||
|
#define GPS_L1_CA_TONG_PCPS_ACQUISITION_H_
|
||||||
|
|
||||||
|
#include "acquisition_interface.h"
|
||||||
|
|
||||||
|
#include "gps_l1_ca_tong_pcps_acquisition_cc.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
|
||||||
|
class GpsL1CaTongPcpsAcquisition: public AcquisitionInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
GpsL1CaTongPcpsAcquisition(ConfigurationInterface* configuration,
|
||||||
|
std::string role, unsigned int in_streams,
|
||||||
|
unsigned int out_streams, gr_msg_queue_sptr queue);
|
||||||
|
|
||||||
|
virtual ~GpsL1CaTongPcpsAcquisition();
|
||||||
|
|
||||||
|
std::string role()
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
std::string implementation()
|
||||||
|
{
|
||||||
|
return "Acquisition";
|
||||||
|
}
|
||||||
|
size_t item_size()
|
||||||
|
{
|
||||||
|
return item_size_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void connect(gr_top_block_sptr top_block);
|
||||||
|
void disconnect(gr_top_block_sptr top_block);
|
||||||
|
gr_basic_block_sptr get_left_block();
|
||||||
|
gr_basic_block_sptr get_right_block();
|
||||||
|
|
||||||
|
void set_satellite(unsigned int satellite);
|
||||||
|
void set_channel(unsigned int channel);
|
||||||
|
void set_threshold(float threshold)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
;
|
||||||
|
void set_doppler_max(unsigned int doppler_max);
|
||||||
|
void set_doppler_step(unsigned int doppler_step);
|
||||||
|
void set_channel_queue(concurrent_queue<int> *channel_internal_queue);
|
||||||
|
signed int prn_code_phase();
|
||||||
|
float doppler_freq_shift();
|
||||||
|
|
||||||
|
unsigned long int get_sample_stamp();
|
||||||
|
|
||||||
|
signed int mag();
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
gps_l1_ca_tong_pcps_acquisition_cc_sptr acquisition_cc_;
|
||||||
|
gr_block_sptr stream_to_vector_;
|
||||||
|
gr_block_sptr complex_to_short_;
|
||||||
|
gr_block_sptr short_to_complex_;
|
||||||
|
size_t item_size_;
|
||||||
|
std::string item_type_;
|
||||||
|
unsigned int vector_length_;
|
||||||
|
unsigned int satellite_;
|
||||||
|
unsigned int channel_;
|
||||||
|
float threshold_;
|
||||||
|
unsigned int doppler_max_;
|
||||||
|
unsigned int doppler_step_;
|
||||||
|
unsigned int shift_resolution_;
|
||||||
|
unsigned int sampled_ms_;
|
||||||
|
long fs_in_;
|
||||||
|
long if_;
|
||||||
|
bool dump_;
|
||||||
|
std::string dump_filename_;
|
||||||
|
|
||||||
|
std::string role_;
|
||||||
|
unsigned int in_streams_;
|
||||||
|
unsigned int out_streams_;
|
||||||
|
gr_msg_queue_sptr queue_;
|
||||||
|
concurrent_queue<int> *channel_internal_queue_;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* GPS_L1_CA_TONG_PCPS_ACQUISITION_H_ */
|
|
@ -0,0 +1,5 @@
|
||||||
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
|
obj gps_l1_ca_gps_sdr_acquisition : gps_l1_ca_gps_sdr_acquisition.cc ;
|
||||||
|
obj gps_l1_ca_pcps_acquisition : gps_l1_ca_pcps_acquisition.cc ;
|
||||||
|
obj gps_l1_ca_tong_pcps_acquisition : gps_l1_ca_tong_pcps_acquisition.cc ;
|
|
@ -0,0 +1,330 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_gps_sdr_acquisition_cc.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gps_l1_ca_gps_sdr_acquisition_cc.h"
|
||||||
|
#include "control_message_factory.h"
|
||||||
|
#include "gps_sdr_x86.h"
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
#include <sstream>
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
gps_l1_ca_gps_sdr_acquisition_cc_sptr gps_l1_ca_gps_sdr_make_acquisition_cc(
|
||||||
|
unsigned int sampled_ms, long freq, long fs_in, int samples_per_ms,
|
||||||
|
gr_msg_queue_sptr queue, bool dump, std::string dump_filename)
|
||||||
|
{
|
||||||
|
|
||||||
|
return gps_l1_ca_gps_sdr_acquisition_cc_sptr(
|
||||||
|
new gps_l1_ca_gps_sdr_acquisition_cc(sampled_ms, freq, fs_in,
|
||||||
|
samples_per_ms, queue, dump, dump_filename));
|
||||||
|
}
|
||||||
|
|
||||||
|
gps_l1_ca_gps_sdr_acquisition_cc::gps_l1_ca_gps_sdr_acquisition_cc(
|
||||||
|
unsigned int sampled_ms, long freq, long fs_in, int samples_per_ms,
|
||||||
|
gr_msg_queue_sptr queue, bool dump, std::string dump_filename) :
|
||||||
|
gr_block("gps_l1_ca_gps_sdr_acquisition_cc", gr_make_io_signature(1, 1,
|
||||||
|
sizeof(gr_complex) * samples_per_ms), gr_make_io_signature(0, 0,
|
||||||
|
sizeof(gr_complex) * samples_per_ms))
|
||||||
|
{
|
||||||
|
|
||||||
|
// SAMPLE COUNTER
|
||||||
|
d_sample_counter = 0;
|
||||||
|
|
||||||
|
d_active = false;
|
||||||
|
d_dump = dump;
|
||||||
|
d_queue = queue;
|
||||||
|
d_dump_filename = dump_filename;
|
||||||
|
|
||||||
|
d_freq = freq;
|
||||||
|
d_fs_in = fs_in;
|
||||||
|
|
||||||
|
d_samples_per_ms = samples_per_ms;
|
||||||
|
d_sampled_ms = sampled_ms;
|
||||||
|
|
||||||
|
d_doppler_max = 0;
|
||||||
|
|
||||||
|
d_satellite = 0;
|
||||||
|
|
||||||
|
d_fft_size = d_sampled_ms * d_samples_per_ms;
|
||||||
|
|
||||||
|
d_doppler_freq_phase = 0.0;
|
||||||
|
d_prn_code_phase = 0;
|
||||||
|
d_mag = 0;
|
||||||
|
d_mean = 0.0;
|
||||||
|
|
||||||
|
d_count = 0;
|
||||||
|
|
||||||
|
d_sine_if = new gr_complex[d_fft_size];
|
||||||
|
d_sine_250 = new gr_complex[d_fft_size];
|
||||||
|
d_sine_500 = new gr_complex[d_fft_size];
|
||||||
|
d_sine_750 = new gr_complex[d_fft_size];
|
||||||
|
|
||||||
|
d_fft_codes = (gr_complex*)malloc(sizeof(gr_complex) * d_samples_per_ms);
|
||||||
|
|
||||||
|
// Direct FFT
|
||||||
|
d_fft_if = new gri_fft_complex(d_fft_size, true);
|
||||||
|
d_fft_250 = new gri_fft_complex(d_fft_size, true);
|
||||||
|
d_fft_500 = new gri_fft_complex(d_fft_size, true);
|
||||||
|
d_fft_750 = new gri_fft_complex(d_fft_size, true);
|
||||||
|
|
||||||
|
// Inverse FFT
|
||||||
|
d_ifft = new gri_fft_complex(d_fft_size, false);
|
||||||
|
|
||||||
|
d_best_magnitudes = new float[d_fft_size];
|
||||||
|
|
||||||
|
sine_gen_complex(d_sine_if, -d_freq, d_fs_in, d_fft_size);
|
||||||
|
sine_gen_complex(d_sine_250, -d_freq - 250, d_fs_in, d_fft_size);
|
||||||
|
sine_gen_complex(d_sine_500, -d_freq - 500, d_fs_in, d_fft_size);
|
||||||
|
sine_gen_complex(d_sine_750, -d_freq - 750, d_fs_in, d_fft_size);
|
||||||
|
|
||||||
|
DLOG(INFO) << "fs in " << d_fs_in;
|
||||||
|
DLOG(INFO) << "Doppler max " << d_doppler_max;
|
||||||
|
DLOG(INFO) << "IF " << d_freq;
|
||||||
|
DLOG(INFO) << "Satellite " << d_satellite;
|
||||||
|
DLOG(INFO) << "Sampled_ms " << d_sampled_ms;
|
||||||
|
DLOG(INFO) << "FFT_size " << d_fft_size;
|
||||||
|
DLOG(INFO) << "dump filename " << d_dump_filename;
|
||||||
|
DLOG(INFO) << "dump " << d_dump;
|
||||||
|
}
|
||||||
|
|
||||||
|
gps_l1_ca_gps_sdr_acquisition_cc::~gps_l1_ca_gps_sdr_acquisition_cc()
|
||||||
|
{
|
||||||
|
delete d_sine_if;
|
||||||
|
delete d_sine_250;
|
||||||
|
delete d_sine_500;
|
||||||
|
delete d_sine_750;
|
||||||
|
delete d_fft_codes;
|
||||||
|
delete d_fft_if;
|
||||||
|
delete d_fft_250;
|
||||||
|
delete d_fft_500;
|
||||||
|
delete d_fft_750;
|
||||||
|
|
||||||
|
if (d_dump)
|
||||||
|
{
|
||||||
|
d_dump_file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gps_l1_ca_gps_sdr_acquisition_cc::set_satellite(unsigned int satellite)
|
||||||
|
{
|
||||||
|
d_satellite = satellite;
|
||||||
|
d_prn_code_phase = 0;
|
||||||
|
d_doppler_freq_phase = 0;
|
||||||
|
d_mag = 0;
|
||||||
|
// Now the GPS codes are generated on the fly using a custom version of the GPS code generator
|
||||||
|
code_gen_complex_sampled(d_fft_if->get_inbuf(), satellite, d_fs_in, 0);
|
||||||
|
d_fft_if->execute(); // We need the FFT of GPS C/A code
|
||||||
|
memcpy(d_fft_codes, d_fft_if->get_outbuf(), sizeof(gr_complex)
|
||||||
|
* d_samples_per_ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
signed int gps_l1_ca_gps_sdr_acquisition_cc::prn_code_phase()
|
||||||
|
{
|
||||||
|
return d_prn_code_phase;
|
||||||
|
}
|
||||||
|
|
||||||
|
int gps_l1_ca_gps_sdr_acquisition_cc::general_work(int noutput_items,
|
||||||
|
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items)
|
||||||
|
{
|
||||||
|
if (!d_active)
|
||||||
|
{
|
||||||
|
d_sample_counter += d_fft_size * noutput_items; // sample counter
|
||||||
|
consume_each(noutput_items);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
d_sample_counter += d_fft_size; // sample counter
|
||||||
|
bool positive_acquisition = false;
|
||||||
|
int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
|
||||||
|
|
||||||
|
LOG_AT_LEVEL(INFO) << "Channel: " << d_channel
|
||||||
|
<< " , doing acquisition of satellite: " << d_satellite
|
||||||
|
<< " ,at sample stamp: " << d_sample_counter;
|
||||||
|
|
||||||
|
const gr_complex *in = (const gr_complex *)input_items[0];
|
||||||
|
|
||||||
|
//Perform the carrier wipe-off
|
||||||
|
for (unsigned int j = 0; j < d_fft_size; j++)
|
||||||
|
{
|
||||||
|
d_fft_if->get_inbuf()[j] = in[j] * d_sine_if[j];
|
||||||
|
d_fft_250->get_inbuf()[j] = in[j] * d_sine_250[j];
|
||||||
|
d_fft_500->get_inbuf()[j] = in[j] * d_sine_500[j];
|
||||||
|
d_fft_750->get_inbuf()[j] = in[j] * d_sine_750[j];
|
||||||
|
}
|
||||||
|
// Perform the FFT of the resulting signal
|
||||||
|
d_fft_if->execute();
|
||||||
|
d_fft_250->execute();
|
||||||
|
d_fft_500->execute();
|
||||||
|
d_fft_750->execute();
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
//---Calculate cross-correlation magnitudes using:
|
||||||
|
//----> the circular convolution property of FFT:
|
||||||
|
//----> the frequency-shift property of the FFT: y(t)=exp(jw0t)x(t) -> Y(w)=X(w-w0)
|
||||||
|
for (int j = (int)-(d_doppler_max / 1000); j < (int)d_doppler_max / 1000; j++)
|
||||||
|
{ // doppler search steps
|
||||||
|
calculate_magnitudes(d_fft_if->get_outbuf(), j, 0);
|
||||||
|
calculate_magnitudes(d_fft_250->get_outbuf(), j, 1);
|
||||||
|
calculate_magnitudes(d_fft_500->get_outbuf(), j, 2);
|
||||||
|
calculate_magnitudes(d_fft_750->get_outbuf(), j, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d_dump)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "./data/acquisition_" << d_channel << "_" << d_satellite << "_"
|
||||||
|
<< d_count << ".dat";
|
||||||
|
d_dump_file.open(ss.str().c_str(), std::ios::out | std::ios::binary);
|
||||||
|
std::streamsize n = sizeof(float) * (d_fft_size);
|
||||||
|
d_dump_file.write((char*)d_best_magnitudes, n);
|
||||||
|
d_dump_file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d_test_statistics > d_threshold)
|
||||||
|
{ //TODO: Include in configuration parameters and check value!!
|
||||||
|
|
||||||
|
positive_acquisition = true;
|
||||||
|
d_acq_sample_stamp = d_sample_counter;
|
||||||
|
|
||||||
|
LOG_AT_LEVEL(INFO) << "POSITIVE ACQUISITION of channel " << d_channel;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Satellite " << d_satellite;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Code Phase " << d_prn_code_phase;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Doppler " << d_doppler_freq_phase;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Magnitude " << d_mag;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Mean " << d_mean;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Test statistics value " << d_test_statistics;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Test statistics threshold " << d_threshold;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Acq sample stamp " << d_acq_sample_stamp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(INFO) << "NEGATIVE ACQUISITION of channel " << d_channel;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Satellite " << d_satellite;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Test statistics value " << d_test_statistics;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Test statistics threshold " << d_threshold;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Acq sample stamp " << d_acq_sample_stamp;
|
||||||
|
}
|
||||||
|
d_active = false;
|
||||||
|
|
||||||
|
LOG_AT_LEVEL(INFO) << "d_count " << d_count;
|
||||||
|
|
||||||
|
if (positive_acquisition)
|
||||||
|
{
|
||||||
|
acquisition_message = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
acquisition_message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
d_channel_internal_queue->push(acquisition_message);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gps_l1_ca_gps_sdr_acquisition_cc::calculate_magnitudes(
|
||||||
|
gr_complex* fft_signal, int doppler_shift, int doppler_offset)
|
||||||
|
{
|
||||||
|
|
||||||
|
unsigned int indext = 0;
|
||||||
|
float magt = 0.0;
|
||||||
|
std::complex<float> tmp_cpx;
|
||||||
|
|
||||||
|
// FFT frequency-shift property
|
||||||
|
if (doppler_shift != 0)
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < d_fft_size; i++)
|
||||||
|
{
|
||||||
|
//complex conjugate (optimize me!)
|
||||||
|
tmp_cpx = std::complex<float>(d_fft_codes[i].real(),
|
||||||
|
-d_fft_codes[i].imag());
|
||||||
|
d_ifft->get_inbuf()[i] = fft_signal[(doppler_shift + i
|
||||||
|
+ d_fft_size) % d_fft_size] * tmp_cpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < d_fft_size; i++)
|
||||||
|
{
|
||||||
|
//complex conjugate (optimize me!)
|
||||||
|
tmp_cpx = std::complex<float>(d_fft_codes[i].real(),
|
||||||
|
-d_fft_codes[i].imag());
|
||||||
|
d_ifft->get_inbuf()[i] = fft_signal[i] * tmp_cpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
d_ifft->execute(); // inverse FFT of the result = convolution in time
|
||||||
|
|
||||||
|
x86_gr_complex_mag(d_ifft->get_outbuf(), d_fft_size); // d_ifft->get_outbuf()=|abs(·)|^2
|
||||||
|
x86_float_max((float*)d_ifft->get_outbuf(), &indext, &magt, d_fft_size); // find max of |abs(·)|^2 -> index and magt
|
||||||
|
|
||||||
|
if (magt > d_mag)
|
||||||
|
{ // if the magnitude is > threshold
|
||||||
|
|
||||||
|
// save the synchronization parameters
|
||||||
|
d_mag = magt;
|
||||||
|
d_prn_code_phase = indext;
|
||||||
|
d_doppler_freq_phase = -((doppler_shift * 1000.0) + (doppler_offset
|
||||||
|
* 250.0));
|
||||||
|
// save the circular correlation of this Doppler shift
|
||||||
|
memcpy(d_best_magnitudes, d_ifft->get_outbuf(), sizeof(float)
|
||||||
|
* d_fft_size);
|
||||||
|
|
||||||
|
// Remove the maximum and its neighbours to calculate the mean
|
||||||
|
((float*)d_ifft->get_outbuf())[indext] = 0.0;
|
||||||
|
if (indext != 0)
|
||||||
|
{
|
||||||
|
((float*)d_ifft->get_outbuf())[indext - 1] = 0.0;
|
||||||
|
}
|
||||||
|
if (indext != d_fft_size - 1)
|
||||||
|
{
|
||||||
|
((float*)d_ifft->get_outbuf())[indext + 1] = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < d_fft_size; i++)
|
||||||
|
{
|
||||||
|
d_mean += ((float*)d_ifft->get_outbuf())[i];
|
||||||
|
}
|
||||||
|
d_mean = d_mean / d_fft_size;
|
||||||
|
d_test_statistics = d_mag / d_mean;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,166 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_gps_sdr_acquisition_cc.h
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INCLUDED_GPS_L1_CA_GPS_SDR_ACQUISITION_CC_H
|
||||||
|
#define INCLUDED_GPS_L1_CA_GPS_SDR_ACQUISITION_CC_H
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include <gnuradio/gr_block.h>
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
#include <gnuradio/gr_complex.h>
|
||||||
|
#include <gnuradio/gri_fft.h>
|
||||||
|
|
||||||
|
#include <queue>
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
|
#include <boost/thread/thread.hpp>
|
||||||
|
#include "concurrent_queue.h"
|
||||||
|
|
||||||
|
class gps_l1_ca_gps_sdr_acquisition_cc;
|
||||||
|
typedef boost::shared_ptr<gps_l1_ca_gps_sdr_acquisition_cc>
|
||||||
|
gps_l1_ca_gps_sdr_acquisition_cc_sptr;
|
||||||
|
gps_l1_ca_gps_sdr_acquisition_cc_sptr
|
||||||
|
gps_l1_ca_gps_sdr_make_acquisition_cc(unsigned int sampled_ms, long freq,
|
||||||
|
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||||
|
std::string dump_filename);
|
||||||
|
|
||||||
|
class gps_l1_ca_gps_sdr_acquisition_cc: public gr_block
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend gps_l1_ca_gps_sdr_acquisition_cc_sptr
|
||||||
|
gps_l1_ca_gps_sdr_make_acquisition_cc(unsigned int sampled_ms, long freq,
|
||||||
|
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue,
|
||||||
|
bool dump, std::string dump_filename);
|
||||||
|
|
||||||
|
gps_l1_ca_gps_sdr_acquisition_cc(unsigned int sampled_ms, long freq,
|
||||||
|
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue,
|
||||||
|
bool dump, std::string dump_filename);
|
||||||
|
|
||||||
|
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
|
||||||
|
int doppler_offset);
|
||||||
|
|
||||||
|
long d_fs_in;
|
||||||
|
long d_freq;
|
||||||
|
int d_samples_per_ms;
|
||||||
|
unsigned int d_satellite;
|
||||||
|
float d_threshold;
|
||||||
|
std::string d_satellite_str;
|
||||||
|
unsigned int d_doppler_max;
|
||||||
|
unsigned int d_sampled_ms;
|
||||||
|
unsigned int d_fft_size;
|
||||||
|
unsigned long int d_sample_counter;
|
||||||
|
unsigned long int d_acq_sample_stamp;
|
||||||
|
|
||||||
|
gr_complex* d_baseband_signal;
|
||||||
|
gr_complex* d_sine_if;
|
||||||
|
gr_complex* d_sine_250;
|
||||||
|
gr_complex* d_sine_500;
|
||||||
|
gr_complex* d_sine_750;
|
||||||
|
gr_complex* d_fft_codes;
|
||||||
|
|
||||||
|
gri_fft_complex* d_fft_if;
|
||||||
|
gri_fft_complex* d_fft_250;
|
||||||
|
gri_fft_complex* d_fft_500;
|
||||||
|
gri_fft_complex* d_fft_750;
|
||||||
|
gri_fft_complex* d_ifft;
|
||||||
|
|
||||||
|
float* d_best_magnitudes;
|
||||||
|
|
||||||
|
unsigned int d_prn_code_phase;
|
||||||
|
float d_doppler_freq_phase;
|
||||||
|
float d_mag;
|
||||||
|
float d_mean;
|
||||||
|
float d_test_statistics;
|
||||||
|
|
||||||
|
gr_msg_queue_sptr d_queue;
|
||||||
|
concurrent_queue<int> *d_channel_internal_queue;
|
||||||
|
|
||||||
|
std::ofstream d_dump_file;
|
||||||
|
|
||||||
|
unsigned int d_count;
|
||||||
|
|
||||||
|
bool d_active;
|
||||||
|
bool d_dump;
|
||||||
|
unsigned int d_channel;
|
||||||
|
std::string d_dump_filename;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
~gps_l1_ca_gps_sdr_acquisition_cc();
|
||||||
|
|
||||||
|
signed int prn_code_phase();
|
||||||
|
float doppler_freq_phase()
|
||||||
|
{
|
||||||
|
return d_doppler_freq_phase;
|
||||||
|
}
|
||||||
|
unsigned int mag()
|
||||||
|
{
|
||||||
|
return d_mag;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long int get_sample_stamp()
|
||||||
|
{
|
||||||
|
return d_acq_sample_stamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_satellite(unsigned int satellite);
|
||||||
|
void set_active(bool active)
|
||||||
|
{
|
||||||
|
d_active = active;
|
||||||
|
}
|
||||||
|
void set_channel(unsigned int channel)
|
||||||
|
{
|
||||||
|
d_channel = channel;
|
||||||
|
}
|
||||||
|
void set_threshold(float threshold)
|
||||||
|
{
|
||||||
|
d_threshold = threshold;
|
||||||
|
}
|
||||||
|
void set_doppler_max(unsigned int doppler_max)
|
||||||
|
{
|
||||||
|
d_doppler_max = doppler_max;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_channel_queue(concurrent_queue<int> *channel_internal_queue)
|
||||||
|
{
|
||||||
|
d_channel_internal_queue = channel_internal_queue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||||
|
gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* INCLUDED_GPS_L1_CA_GPS_SDR_ACQUISITION_CC_H */
|
|
@ -0,0 +1,276 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_gps_sdr_acquisition_ss.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gps_l1_ca_gps_sdr_acquisition_ss.h"
|
||||||
|
|
||||||
|
#include "gps_sdr_simd.h"
|
||||||
|
#include "gps_sdr_fft.h"
|
||||||
|
#include "gps_sdr_prn_codes_short.h"
|
||||||
|
#include "control_message_factory.h"
|
||||||
|
#include "gps_sdr_x86.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
gps_l1_ca_gps_sdr_acquisition_ss_sptr gps_l1_ca_gps_sdr_make_acquisition_ss(
|
||||||
|
unsigned int sampled_ms, long freq, long fs_in, int samples_per_ms,
|
||||||
|
gr_msg_queue_sptr queue, bool dump, std::string dump_filename)
|
||||||
|
{
|
||||||
|
|
||||||
|
return gps_l1_ca_gps_sdr_acquisition_ss_sptr(
|
||||||
|
new gps_l1_ca_gps_sdr_acquisition_ss(sampled_ms, freq, fs_in,
|
||||||
|
samples_per_ms, queue, dump, dump_filename));
|
||||||
|
}
|
||||||
|
|
||||||
|
gps_l1_ca_gps_sdr_acquisition_ss::gps_l1_ca_gps_sdr_acquisition_ss(
|
||||||
|
unsigned int sampled_ms, long freq, long fs_in, int samples_per_ms,
|
||||||
|
gr_msg_queue_sptr queue, bool dump, std::string dump_filename) :
|
||||||
|
gr_block("gps_l1_ca_gps_sdr_acquisition_ss", gr_make_io_signature(1, 1,
|
||||||
|
sizeof(short) * 2 * samples_per_ms), gr_make_io_signature(0, 0,
|
||||||
|
sizeof(short) * 2 * samples_per_ms))
|
||||||
|
{
|
||||||
|
|
||||||
|
// SAMPLE COUNTER
|
||||||
|
d_sample_counter = 0;
|
||||||
|
|
||||||
|
d_active = false;
|
||||||
|
d_dump = dump;
|
||||||
|
d_queue = queue;
|
||||||
|
d_dump_filename = dump_filename;
|
||||||
|
|
||||||
|
d_fs_in = fs_in;
|
||||||
|
d_samples_per_ms = samples_per_ms;
|
||||||
|
d_doppler_resolution = 4;
|
||||||
|
d_freq = freq;
|
||||||
|
d_satellite = 0;
|
||||||
|
d_doppler_max = 0;
|
||||||
|
d_sampled_ms = sampled_ms;
|
||||||
|
d_fft_size = d_sampled_ms * d_samples_per_ms;
|
||||||
|
|
||||||
|
d_doppler_freq_shift = 0.0;
|
||||||
|
d_prn_code_phase = 0;
|
||||||
|
d_mag = 0;
|
||||||
|
|
||||||
|
d_sine_if = new CPX[d_fft_size];
|
||||||
|
d_sine_250 = new CPX[d_fft_size];
|
||||||
|
d_sine_500 = new CPX[d_fft_size];
|
||||||
|
d_sine_750 = new CPX[d_fft_size];
|
||||||
|
|
||||||
|
d_baseband_signal = new CPX[d_doppler_resolution * d_fft_size];
|
||||||
|
d_baseband_signal_shift = new CPX[d_doppler_resolution * (d_fft_size
|
||||||
|
+ 201)];
|
||||||
|
|
||||||
|
signed int R1[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
d_pFFT = new FFT(d_fft_size, R1);
|
||||||
|
|
||||||
|
signed int R2[16] = { 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1 };
|
||||||
|
d_piFFT = new FFT(d_fft_size, R2);
|
||||||
|
|
||||||
|
for (int i = 0; i < 32; i++)
|
||||||
|
{
|
||||||
|
d_fft_codes[i] = (CPX *)&PRN_Codes_Short[sizeof(short) * i
|
||||||
|
* d_samples_per_ms];
|
||||||
|
}
|
||||||
|
|
||||||
|
sine_gen(d_sine_if, -d_freq, d_fs_in, d_fft_size);
|
||||||
|
sine_gen(d_sine_250, -d_freq - 250, d_fs_in, d_fft_size);
|
||||||
|
sine_gen(d_sine_500, -d_freq - 500, d_fs_in, d_fft_size);
|
||||||
|
sine_gen(d_sine_750, -d_freq - 750, d_fs_in, d_fft_size);
|
||||||
|
|
||||||
|
DLOG(INFO) << "fs in " << d_fs_in;
|
||||||
|
DLOG(INFO) << "samples per ms " << d_samples_per_ms;
|
||||||
|
DLOG(INFO) << "doppler resolution " << d_doppler_resolution;
|
||||||
|
DLOG(INFO) << "freq " << d_freq;
|
||||||
|
DLOG(INFO) << "satellite " << d_satellite;
|
||||||
|
DLOG(INFO) << "sampled_ms " << d_sampled_ms;
|
||||||
|
DLOG(INFO) << "fft_size " << d_fft_size;
|
||||||
|
DLOG(INFO) << "dump filename " << d_dump_filename;
|
||||||
|
DLOG(INFO) << "dump " << d_dump;
|
||||||
|
}
|
||||||
|
|
||||||
|
gps_l1_ca_gps_sdr_acquisition_ss::~gps_l1_ca_gps_sdr_acquisition_ss()
|
||||||
|
{
|
||||||
|
delete d_baseband_signal;
|
||||||
|
delete d_baseband_signal_shift;
|
||||||
|
delete d_sine_if;
|
||||||
|
delete d_sine_250;
|
||||||
|
delete d_sine_500;
|
||||||
|
delete d_sine_750;
|
||||||
|
delete d_pFFT;
|
||||||
|
delete d_piFFT;
|
||||||
|
|
||||||
|
if (d_dump)
|
||||||
|
{
|
||||||
|
d_dump_file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gps_l1_ca_gps_sdr_acquisition_ss::set_satellite(unsigned int satellite)
|
||||||
|
{
|
||||||
|
d_satellite = satellite;
|
||||||
|
d_prn_code_phase = 0;
|
||||||
|
d_doppler_freq_shift = 0;
|
||||||
|
d_mag = 0;
|
||||||
|
DLOG(INFO) << "satellite set to " << d_satellite;
|
||||||
|
}
|
||||||
|
|
||||||
|
signed int gps_l1_ca_gps_sdr_acquisition_ss::prn_code_phase()
|
||||||
|
{
|
||||||
|
return d_prn_code_phase;
|
||||||
|
}
|
||||||
|
|
||||||
|
int gps_l1_ca_gps_sdr_acquisition_ss::general_work(int noutput_items,
|
||||||
|
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!d_active)
|
||||||
|
{
|
||||||
|
d_sample_counter += d_fft_size * noutput_items; // sample counter
|
||||||
|
consume_each(noutput_items);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_sample_counter += d_fft_size; // sample counter
|
||||||
|
|
||||||
|
const CPX *in = (const CPX *)input_items[0];
|
||||||
|
|
||||||
|
CPX* buffer = new CPX[d_fft_size];
|
||||||
|
|
||||||
|
signed int index = 0;
|
||||||
|
unsigned int indext = 0;
|
||||||
|
unsigned int magt = 0;
|
||||||
|
|
||||||
|
DLOG(INFO) << "copied " << (d_fft_size * sizeof(CPX))
|
||||||
|
<< " bytes into buffer (" << d_fft_size << " samples)";
|
||||||
|
memcpy(d_baseband_signal, in, d_fft_size * sizeof(CPX));
|
||||||
|
|
||||||
|
sse_cmulsc(d_baseband_signal, d_sine_250,
|
||||||
|
&d_baseband_signal[d_fft_size], d_fft_size, 14);
|
||||||
|
sse_cmulsc(d_baseband_signal, d_sine_500, &d_baseband_signal[2
|
||||||
|
* d_fft_size], d_fft_size, 14);
|
||||||
|
sse_cmulsc(d_baseband_signal, d_sine_750, &d_baseband_signal[3
|
||||||
|
* d_fft_size], d_fft_size, 14);
|
||||||
|
|
||||||
|
sse_cmuls(d_baseband_signal, d_sine_if, d_fft_size, 14);
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < d_doppler_resolution; i++)
|
||||||
|
{
|
||||||
|
d_pFFT->doFFT(&d_baseband_signal[i * d_fft_size], true);
|
||||||
|
memcpy(&d_baseband_signal_shift[i * (d_fft_size + 201)],
|
||||||
|
&d_baseband_signal[(i + 1) * d_fft_size - 100], 100
|
||||||
|
* sizeof(CPX));
|
||||||
|
memcpy(&d_baseband_signal_shift[(i * (d_fft_size + 201)) + 100],
|
||||||
|
&d_baseband_signal[i * d_fft_size], d_fft_size
|
||||||
|
* sizeof(CPX));
|
||||||
|
memcpy(&d_baseband_signal_shift[(i * (d_fft_size + 201)) + 100
|
||||||
|
+ d_fft_size], &d_baseband_signal[i * d_fft_size], 100
|
||||||
|
* sizeof(CPX));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Here begins the actual acquisition process.
|
||||||
|
|
||||||
|
for (int i = -d_doppler_max / 1000; i < (int)d_doppler_max / 1000; i++)
|
||||||
|
{
|
||||||
|
for (unsigned int j = 0; j < d_doppler_resolution; j++)
|
||||||
|
{
|
||||||
|
sse_cmulsc(&d_baseband_signal_shift[(j * (d_fft_size + 201))
|
||||||
|
+ 100 + i], d_fft_codes[d_satellite], buffer,
|
||||||
|
d_fft_size, 10);
|
||||||
|
d_piFFT->doiFFT(buffer, true);
|
||||||
|
x86_cmag(buffer, d_fft_size);
|
||||||
|
x86_max((unsigned int *)buffer, &indext, &magt, d_fft_size);
|
||||||
|
|
||||||
|
if (magt > d_mag)
|
||||||
|
{
|
||||||
|
d_mag = magt;
|
||||||
|
index = indext;
|
||||||
|
d_prn_code_phase = ceil((index * d_samples_per_ms)
|
||||||
|
/ d_fft_size);
|
||||||
|
d_doppler_freq_shift = (i * 1000.0) + (j * 250.0);
|
||||||
|
|
||||||
|
if (d_dump)
|
||||||
|
{
|
||||||
|
d_dump_file.open(d_dump_filename.c_str(),
|
||||||
|
std::ios::out | std::ios::binary);
|
||||||
|
std::streamsize n = sizeof(unsigned int) * d_fft_size;
|
||||||
|
d_dump_file.write((char*)buffer, n);
|
||||||
|
d_dump_file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DLOG(INFO) << "satellite " << d_satellite;
|
||||||
|
//result->code_phase = 2048 - index;
|
||||||
|
DLOG(INFO) << "code phase " << d_prn_code_phase;
|
||||||
|
//result->doppler = (lcv*1000) + (float)lcv2*250;
|
||||||
|
DLOG(INFO) << "doppler " << d_doppler_freq_shift;
|
||||||
|
//result->magnitude = mag;
|
||||||
|
DLOG(INFO) << "magnitude " << d_mag;
|
||||||
|
|
||||||
|
d_active = false;
|
||||||
|
|
||||||
|
delete buffer;
|
||||||
|
|
||||||
|
DLOG(INFO) << "Acquisition done";
|
||||||
|
|
||||||
|
int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
|
||||||
|
|
||||||
|
if (d_mag > d_threshold)
|
||||||
|
{
|
||||||
|
d_acq_sample_stamp = d_sample_counter;
|
||||||
|
acquisition_message = 1; //ACQ_SUCCES
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
acquisition_message = 2; //ACQ_FAIL
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
d_channel_internal_queue->push(acquisition_message);
|
||||||
|
|
||||||
|
consume_each(1);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,155 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_gps_sdr_acquisition_ss.h
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INCLUDED_GPS_L1_CA_GPS_SDR_ACQUISITION_SS_H
|
||||||
|
#define INCLUDED_GPS_L1_CA_GPS_SDR_ACQUISITION_SS_H
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include <gnuradio/gr_block.h>
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
#include "gps_sdr_signal_processing.h"
|
||||||
|
|
||||||
|
#include <queue>
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
|
#include <boost/thread/thread.hpp>
|
||||||
|
#include "concurrent_queue.h"
|
||||||
|
|
||||||
|
|
||||||
|
class FFT;
|
||||||
|
|
||||||
|
class gps_l1_ca_gps_sdr_acquisition_ss;
|
||||||
|
typedef boost::shared_ptr<gps_l1_ca_gps_sdr_acquisition_ss>
|
||||||
|
gps_l1_ca_gps_sdr_acquisition_ss_sptr;
|
||||||
|
gps_l1_ca_gps_sdr_acquisition_ss_sptr
|
||||||
|
gps_l1_ca_gps_sdr_make_acquisition_ss(unsigned int sampled_ms, long freq,
|
||||||
|
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||||
|
std::string dump_filename);
|
||||||
|
|
||||||
|
class gps_l1_ca_gps_sdr_acquisition_ss: public gr_block
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend gps_l1_ca_gps_sdr_acquisition_ss_sptr
|
||||||
|
gps_l1_ca_gps_sdr_make_acquisition_ss(unsigned int sampled_ms, long freq,
|
||||||
|
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue,
|
||||||
|
bool dump, std::string dump_filename);
|
||||||
|
|
||||||
|
gps_l1_ca_gps_sdr_acquisition_ss(unsigned int sampled_ms, long freq,
|
||||||
|
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue,
|
||||||
|
bool dump, std::string dump_filename);
|
||||||
|
|
||||||
|
long d_fs_in;
|
||||||
|
long d_freq;
|
||||||
|
int d_samples_per_ms;
|
||||||
|
unsigned int d_satellite;
|
||||||
|
float d_threshold;
|
||||||
|
unsigned int d_doppler_max;
|
||||||
|
unsigned int d_doppler_resolution;
|
||||||
|
unsigned int d_sampled_ms;
|
||||||
|
unsigned int d_fft_size;
|
||||||
|
unsigned long int d_sample_counter;
|
||||||
|
unsigned long int d_acq_sample_stamp;
|
||||||
|
|
||||||
|
CPX* d_baseband_signal;
|
||||||
|
CPX* d_baseband_signal_shift;
|
||||||
|
CPX* d_sine_if;
|
||||||
|
CPX* d_sine_250;
|
||||||
|
CPX* d_sine_500;
|
||||||
|
CPX* d_sine_750;
|
||||||
|
FFT* d_pFFT;
|
||||||
|
FFT* d_piFFT;
|
||||||
|
CPX* d_fft_codes[32];
|
||||||
|
|
||||||
|
signed int d_prn_code_phase;
|
||||||
|
float d_doppler_freq_shift;
|
||||||
|
unsigned int d_mag;
|
||||||
|
|
||||||
|
gr_msg_queue_sptr d_queue;
|
||||||
|
concurrent_queue<int> *d_channel_internal_queue;
|
||||||
|
std::ofstream d_dump_file;
|
||||||
|
|
||||||
|
bool d_active;
|
||||||
|
bool d_dump;
|
||||||
|
unsigned int d_channel;
|
||||||
|
std::string d_dump_filename;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
~gps_l1_ca_gps_sdr_acquisition_ss();
|
||||||
|
|
||||||
|
signed int prn_code_phase();
|
||||||
|
float doppler_freq_phase()
|
||||||
|
{
|
||||||
|
return d_doppler_freq_shift;
|
||||||
|
}
|
||||||
|
unsigned int mag()
|
||||||
|
{
|
||||||
|
return d_mag;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long int get_sample_stamp()
|
||||||
|
{
|
||||||
|
return d_acq_sample_stamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_satellite(unsigned int satellite);
|
||||||
|
void set_active(bool active)
|
||||||
|
{
|
||||||
|
d_active = active;
|
||||||
|
}
|
||||||
|
void set_channel(unsigned int channel)
|
||||||
|
{
|
||||||
|
d_channel = channel;
|
||||||
|
}
|
||||||
|
void set_threshold(float threshold)
|
||||||
|
{
|
||||||
|
d_threshold = threshold;
|
||||||
|
}
|
||||||
|
void set_doppler_max(unsigned int doppler_max)
|
||||||
|
{
|
||||||
|
d_doppler_max = doppler_max;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_channel_queue(concurrent_queue<int> *channel_internal_queue)
|
||||||
|
{
|
||||||
|
d_channel_internal_queue = channel_internal_queue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||||
|
gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* INCLUDED_GPS_L1_CA_GPS_SDR_ACQUISITION_SS_H */
|
|
@ -0,0 +1,319 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_pcps_acquisition_cc.h
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gps_l1_ca_pcps_acquisition_cc.h"
|
||||||
|
#include "gps_sdr_signal_processing.h"
|
||||||
|
#include "control_message_factory.h"
|
||||||
|
#include "gps_sdr_x86.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
gps_l1_ca_pcps_acquisition_cc_sptr gps_l1_ca_pcps_make_acquisition_cc(
|
||||||
|
unsigned int sampled_ms, unsigned int doppler_max, long freq,
|
||||||
|
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||||
|
std::string dump_filename)
|
||||||
|
{
|
||||||
|
|
||||||
|
return gps_l1_ca_pcps_acquisition_cc_sptr(
|
||||||
|
new gps_l1_ca_pcps_acquisition_cc(sampled_ms, doppler_max, freq,
|
||||||
|
fs_in, samples_per_ms, queue, dump, dump_filename));
|
||||||
|
}
|
||||||
|
|
||||||
|
gps_l1_ca_pcps_acquisition_cc::gps_l1_ca_pcps_acquisition_cc(
|
||||||
|
unsigned int sampled_ms, unsigned int doppler_max, long freq,
|
||||||
|
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||||
|
std::string dump_filename) :
|
||||||
|
gr_block("gps_l1_ca_pcps_acquisition_cc", gr_make_io_signature(1, 1,
|
||||||
|
sizeof(gr_complex) * samples_per_ms), gr_make_io_signature(0, 0,
|
||||||
|
sizeof(gr_complex) * samples_per_ms))
|
||||||
|
{
|
||||||
|
|
||||||
|
// SAMPLE COUNTER
|
||||||
|
d_sample_counter = 0;
|
||||||
|
|
||||||
|
d_active = false;
|
||||||
|
d_dump = dump;
|
||||||
|
d_queue = queue;
|
||||||
|
d_dump_filename = dump_filename;
|
||||||
|
|
||||||
|
d_freq = freq;
|
||||||
|
d_fs_in = fs_in;
|
||||||
|
|
||||||
|
d_samples_per_ms = samples_per_ms;
|
||||||
|
d_sampled_ms = sampled_ms;
|
||||||
|
|
||||||
|
d_doppler_max = doppler_max;
|
||||||
|
|
||||||
|
d_satellite = 0;
|
||||||
|
|
||||||
|
d_fft_size = d_sampled_ms * d_samples_per_ms;
|
||||||
|
|
||||||
|
d_doppler_freq = 0.0;
|
||||||
|
d_code_phase = 0;
|
||||||
|
d_mag = 0;
|
||||||
|
d_input_power = 0.0;
|
||||||
|
|
||||||
|
d_sine_if = new gr_complex[d_fft_size];
|
||||||
|
|
||||||
|
d_fft_codes = (gr_complex*)malloc(sizeof(gr_complex) * d_samples_per_ms);
|
||||||
|
|
||||||
|
// Direct FFT
|
||||||
|
d_fft_if = new gri_fft_complex(d_fft_size, true);
|
||||||
|
|
||||||
|
// Inverse FFT
|
||||||
|
d_ifft = new gri_fft_complex(d_fft_size, false);
|
||||||
|
|
||||||
|
DLOG(INFO) << "fs in " << d_fs_in;
|
||||||
|
DLOG(INFO) << "samples per ms " << d_samples_per_ms;
|
||||||
|
DLOG(INFO) << "doppler max " << d_doppler_max;
|
||||||
|
DLOG(INFO) << "freq " << d_freq;
|
||||||
|
DLOG(INFO) << "satellite " << d_satellite;
|
||||||
|
DLOG(INFO) << "sampled_ms " << d_sampled_ms;
|
||||||
|
DLOG(INFO) << "fft_size " << d_fft_size;
|
||||||
|
DLOG(INFO) << "dump filename " << d_dump_filename;
|
||||||
|
DLOG(INFO) << "dump " << d_dump;
|
||||||
|
}
|
||||||
|
|
||||||
|
gps_l1_ca_pcps_acquisition_cc::~gps_l1_ca_pcps_acquisition_cc()
|
||||||
|
{
|
||||||
|
delete d_sine_if;
|
||||||
|
delete d_fft_codes;
|
||||||
|
|
||||||
|
if (d_dump)
|
||||||
|
{
|
||||||
|
d_dump_file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gps_l1_ca_pcps_acquisition_cc::set_satellite(unsigned int satellite)
|
||||||
|
{
|
||||||
|
d_satellite = satellite;
|
||||||
|
d_code_phase = 0;
|
||||||
|
d_doppler_freq = 0;
|
||||||
|
d_mag = 0;
|
||||||
|
d_input_power = 0.0;
|
||||||
|
|
||||||
|
// Now the GPS codes are generated on the fly using a custom version of the GPS code generator
|
||||||
|
code_gen_complex_sampled(d_fft_if->get_inbuf(), satellite, d_fs_in, 0);
|
||||||
|
d_fft_if->execute(); // We need the FFT of GPS C/A code
|
||||||
|
//Conjugate the local code
|
||||||
|
//TODO Optimize it !
|
||||||
|
for (unsigned int i = 0; i < d_fft_size; i++)
|
||||||
|
{
|
||||||
|
d_fft_codes[i] = std::complex<float>(
|
||||||
|
d_fft_if->get_outbuf()[i].real(),
|
||||||
|
-d_fft_if->get_outbuf()[i].imag());
|
||||||
|
d_fft_codes[i] = d_fft_codes[i] / (float)d_fft_size; //to correct the scale factor introduced by FFTW
|
||||||
|
}
|
||||||
|
//memcpy(d_fft_codes,d_fft_if->get_outbuf(),sizeof(gr_complex)*d_samples_per_ms);
|
||||||
|
|
||||||
|
// std::stringstream filename;
|
||||||
|
// std::streamsize n = 2*sizeof(float)*(d_fft_size); // complex file write
|
||||||
|
// filename.str("");
|
||||||
|
// filename << "./data/code.dat";
|
||||||
|
// std::cout<<filename.str().c_str();
|
||||||
|
// std::cout<<".\n";
|
||||||
|
// d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// d_dump_file.write((char*)d_ifft->get_inbuf(), n); //write directly |abs(·)|^2 in this Doppler bin
|
||||||
|
// //d_dump_file.write((char*)d_sine_if, n); //to be read with read_complex_binary() -> test OK
|
||||||
|
// d_dump_file.close();
|
||||||
|
}
|
||||||
|
signed int gps_l1_ca_pcps_acquisition_cc::prn_code_phase()
|
||||||
|
{
|
||||||
|
return d_code_phase;
|
||||||
|
}
|
||||||
|
|
||||||
|
int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items,
|
||||||
|
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items)
|
||||||
|
{
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* By J.Arribas
|
||||||
|
* Acquisition A strategy (Kay Borre book + CFAR threshold):
|
||||||
|
* 1º- Compute the input signal power estimation
|
||||||
|
* 2º- Doppler serial search loop
|
||||||
|
* 3º- Perform the FFT-based circular convolution (parallel time search)
|
||||||
|
* 4º- record the maximum peak and the associated synchronization parameters
|
||||||
|
* 5º- Compute the test statistics and compare to the threshold
|
||||||
|
* 6º- Declare positive or negative acquisition using a message queue
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!d_active)
|
||||||
|
{
|
||||||
|
d_sample_counter += d_fft_size * noutput_items; // sample counter
|
||||||
|
consume_each(noutput_items);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_sample_counter += d_fft_size; // sample counter
|
||||||
|
// initialize acquisition algorithm
|
||||||
|
|
||||||
|
int doppler;
|
||||||
|
unsigned int indext = 0;
|
||||||
|
float magt = 0.0;
|
||||||
|
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
|
||||||
|
bool positive_acquisition = false;
|
||||||
|
int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
|
||||||
|
|
||||||
|
//aux vars
|
||||||
|
unsigned int i;
|
||||||
|
std::stringstream filename;
|
||||||
|
std::streamsize n = 2 * sizeof(float) * (d_fft_size); // complex file write
|
||||||
|
|
||||||
|
LOG_AT_LEVEL(INFO) << "Channel: " << d_channel
|
||||||
|
<< " , doing acquisition of satellite: " << d_satellite
|
||||||
|
<< " ,sample stamp: " << d_sample_counter << ", threshold: "
|
||||||
|
<< d_threshold << ", doppler_max: " << d_doppler_max
|
||||||
|
<< ", doppler_step: " << d_doppler_step;
|
||||||
|
|
||||||
|
// 1º Compute the input signal power estimation
|
||||||
|
for (i = 0; i < d_fft_size; i++)
|
||||||
|
{
|
||||||
|
d_input_power += std::abs(in[i]) * std::abs(in[i]);
|
||||||
|
}
|
||||||
|
d_input_power = d_input_power / ((float)d_fft_size
|
||||||
|
* (float)d_fft_size);
|
||||||
|
|
||||||
|
// 2º- Doppler frequency search loop
|
||||||
|
for (doppler = (int)(-d_doppler_max); doppler < (int)d_doppler_max; doppler
|
||||||
|
+= d_doppler_step)
|
||||||
|
{ // doppler search steps
|
||||||
|
//Perform the carrier wipe-off
|
||||||
|
sine_gen_complex(d_sine_if, d_freq + doppler, d_fs_in, d_fft_size);
|
||||||
|
for (i = 0; i < d_fft_size; i++)
|
||||||
|
{
|
||||||
|
d_fft_if->get_inbuf()[i] = in[i] * d_sine_if[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
//3º- Perform the FFT-based circular convolution (parallel time search)
|
||||||
|
d_fft_if->execute(); //TODO Optimize me
|
||||||
|
for (i = 0; i < d_fft_size; i++)
|
||||||
|
{
|
||||||
|
d_ifft->get_inbuf()[i] = (d_fft_if->get_outbuf()[i]
|
||||||
|
* d_fft_codes[i]) / (float)d_fft_size;
|
||||||
|
}
|
||||||
|
d_ifft->execute();
|
||||||
|
|
||||||
|
x86_gr_complex_mag(d_ifft->get_outbuf(), d_fft_size); // d_ifft->get_outbuf()=|abs(·)|^2 and the array is converted from CPX->Float
|
||||||
|
x86_float_max((float*)d_ifft->get_outbuf(), &indext, &magt,
|
||||||
|
d_fft_size); // find max of |abs(·)|^2 -> index and magt
|
||||||
|
|
||||||
|
magt = magt / (float)d_fft_size;
|
||||||
|
// Record results to files
|
||||||
|
if (d_dump)
|
||||||
|
{
|
||||||
|
filename.str("");
|
||||||
|
filename << "./data/fft_" << doppler << "_.dat";
|
||||||
|
std::cout << filename.str().c_str();
|
||||||
|
std::cout << ".\n";
|
||||||
|
d_dump_file.open(filename.str().c_str(), std::ios::out
|
||||||
|
| std::ios::binary);
|
||||||
|
d_dump_file.write((char*)d_ifft->get_outbuf(), n); //write directly |abs(·)|^2 in this Doppler bin
|
||||||
|
d_dump_file.close();
|
||||||
|
}
|
||||||
|
// 4º- record the maximum peak and the associated synchronization parameters
|
||||||
|
if (d_mag < magt)
|
||||||
|
{
|
||||||
|
d_mag = magt;
|
||||||
|
d_code_phase = indext;
|
||||||
|
d_doppler_freq = doppler;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5º- Compute the test statistics and compare to the threshold
|
||||||
|
d_test_statistics = d_mag / d_input_power;
|
||||||
|
// 6º- Declare positive or negative acquisition using a message queue
|
||||||
|
|
||||||
|
if (d_test_statistics > d_threshold)
|
||||||
|
{ //0.004
|
||||||
|
positive_acquisition = true;
|
||||||
|
d_acq_sample_stamp = d_sample_counter;
|
||||||
|
LOG_AT_LEVEL(INFO) << "positive acquisition";
|
||||||
|
LOG_AT_LEVEL(INFO) << "satellite " << d_satellite;
|
||||||
|
LOG_AT_LEVEL(INFO) << "sample_stamp" << d_sample_counter;
|
||||||
|
LOG_AT_LEVEL(INFO) << "test statistics value "
|
||||||
|
<< d_test_statistics;
|
||||||
|
LOG_AT_LEVEL(INFO) << "test statistics threshold " << d_threshold;
|
||||||
|
LOG_AT_LEVEL(INFO) << "code phase " << d_code_phase;
|
||||||
|
LOG_AT_LEVEL(INFO) << "doppler " << d_doppler_freq;
|
||||||
|
LOG_AT_LEVEL(INFO) << "magnitude " << d_mag;
|
||||||
|
LOG_AT_LEVEL(INFO) << "input signal power " << d_input_power;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(INFO) << "negative acquisition";
|
||||||
|
LOG_AT_LEVEL(INFO) << "satellite " << d_satellite;
|
||||||
|
LOG_AT_LEVEL(INFO) << "sample_stamp " << d_sample_counter;
|
||||||
|
LOG_AT_LEVEL(INFO) << "test statistics value "
|
||||||
|
<< d_test_statistics;
|
||||||
|
LOG_AT_LEVEL(INFO) << "test statistics threshold " << d_threshold;
|
||||||
|
LOG_AT_LEVEL(INFO) << "magnitude " << d_mag;
|
||||||
|
LOG_AT_LEVEL(INFO) << "input signal power " << d_input_power;
|
||||||
|
|
||||||
|
//restart acquisition variables
|
||||||
|
d_input_power = 0.0;
|
||||||
|
d_mag = 0.0;
|
||||||
|
|
||||||
|
}
|
||||||
|
d_active = false;
|
||||||
|
|
||||||
|
if (positive_acquisition)
|
||||||
|
{
|
||||||
|
acquisition_message = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
acquisition_message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
d_channel_internal_queue->push(acquisition_message);
|
||||||
|
|
||||||
|
consume_each(1);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,163 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_pcps_acquisition_cc.h
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GPS_L1_CA_PCPS_ACQUISITION_A_CC_H
|
||||||
|
#define GPS_L1_CA_PCPS_ACQUISITION_A_CC_H
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include <gnuradio/gr_block.h>
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
#include <gnuradio/gr_complex.h>
|
||||||
|
#include <gnuradio/gri_fft.h>
|
||||||
|
|
||||||
|
#include <queue>
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
|
#include <boost/thread/thread.hpp>
|
||||||
|
#include "concurrent_queue.h"
|
||||||
|
|
||||||
|
class gps_l1_ca_pcps_acquisition_cc;
|
||||||
|
typedef boost::shared_ptr<gps_l1_ca_pcps_acquisition_cc>
|
||||||
|
gps_l1_ca_pcps_acquisition_cc_sptr;
|
||||||
|
gps_l1_ca_pcps_acquisition_cc_sptr
|
||||||
|
gps_l1_ca_pcps_make_acquisition_cc(unsigned int sampled_ms,
|
||||||
|
unsigned int doppler_max, long freq, long fs_in, int samples_per_ms,
|
||||||
|
gr_msg_queue_sptr queue, bool dump, std::string dump_filename);
|
||||||
|
|
||||||
|
class gps_l1_ca_pcps_acquisition_cc: public gr_block
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend gps_l1_ca_pcps_acquisition_cc_sptr
|
||||||
|
gps_l1_ca_pcps_make_acquisition_cc(unsigned int sampled_ms,
|
||||||
|
unsigned int doppler_max, long freq, long fs_in,
|
||||||
|
int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||||
|
std::string dump_filename);
|
||||||
|
|
||||||
|
gps_l1_ca_pcps_acquisition_cc(unsigned int sampled_ms,
|
||||||
|
unsigned int doppler_max, long freq, long fs_in,
|
||||||
|
int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||||
|
std::string dump_filename);
|
||||||
|
|
||||||
|
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
|
||||||
|
int doppler_offset);
|
||||||
|
|
||||||
|
long d_fs_in;
|
||||||
|
long d_freq;
|
||||||
|
int d_samples_per_ms;
|
||||||
|
unsigned int d_doppler_resolution;
|
||||||
|
unsigned int d_satellite;
|
||||||
|
float d_threshold;
|
||||||
|
std::string d_satellite_str;
|
||||||
|
unsigned int d_doppler_max;
|
||||||
|
unsigned int d_doppler_step;
|
||||||
|
unsigned int d_sampled_ms;
|
||||||
|
unsigned int d_fft_size;
|
||||||
|
unsigned long int d_sample_counter;
|
||||||
|
unsigned long int d_acq_sample_stamp;
|
||||||
|
gr_complex* d_sine_if;
|
||||||
|
|
||||||
|
gr_complex* d_fft_codes;
|
||||||
|
|
||||||
|
gri_fft_complex* d_fft_if;
|
||||||
|
|
||||||
|
gri_fft_complex* d_ifft;
|
||||||
|
|
||||||
|
unsigned int d_code_phase;
|
||||||
|
float d_doppler_freq;
|
||||||
|
float d_mag;
|
||||||
|
float d_input_power;
|
||||||
|
float d_test_statistics;
|
||||||
|
|
||||||
|
gr_msg_queue_sptr d_queue;
|
||||||
|
concurrent_queue<int> *d_channel_internal_queue;
|
||||||
|
std::ofstream d_dump_file;
|
||||||
|
|
||||||
|
bool d_active;
|
||||||
|
bool d_dump;
|
||||||
|
unsigned int d_channel;
|
||||||
|
std::string d_dump_filename;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
~gps_l1_ca_pcps_acquisition_cc();
|
||||||
|
|
||||||
|
signed int prn_code_phase();
|
||||||
|
float doppler_freq()
|
||||||
|
{
|
||||||
|
return d_doppler_freq;
|
||||||
|
}
|
||||||
|
unsigned int mag()
|
||||||
|
{
|
||||||
|
return d_mag;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long int get_sample_stamp()
|
||||||
|
{
|
||||||
|
return d_acq_sample_stamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_satellite(unsigned int satellite);
|
||||||
|
void set_active(bool active)
|
||||||
|
{
|
||||||
|
d_active = active;
|
||||||
|
}
|
||||||
|
void set_channel(unsigned int channel)
|
||||||
|
{
|
||||||
|
d_channel = channel;
|
||||||
|
}
|
||||||
|
void set_threshold(float threshold)
|
||||||
|
{
|
||||||
|
d_threshold = threshold;
|
||||||
|
}
|
||||||
|
void set_doppler_max(unsigned int doppler_max)
|
||||||
|
{
|
||||||
|
d_doppler_max = doppler_max;
|
||||||
|
}
|
||||||
|
void set_doppler_step(unsigned int doppler_step)
|
||||||
|
{
|
||||||
|
d_doppler_step = doppler_step;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_channel_queue(concurrent_queue<int> *channel_internal_queue)
|
||||||
|
{
|
||||||
|
d_channel_internal_queue = channel_internal_queue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||||
|
gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* GPS_L1_CA_PCPS_ACQUISITION_CC_H*/
|
|
@ -0,0 +1,354 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_tong_pcps_acquisition_cc.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gps_l1_ca_tong_pcps_acquisition_cc.h"
|
||||||
|
#include "gps_sdr_signal_processing.h"
|
||||||
|
#include "control_message_factory.h"
|
||||||
|
#include "gps_sdr_x86.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
gps_l1_ca_tong_pcps_acquisition_cc_sptr gps_l1_ca_tong_pcps_make_acquisition_cc(
|
||||||
|
unsigned int sampled_ms, unsigned int doppler_max, long freq,
|
||||||
|
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||||
|
std::string dump_filename)
|
||||||
|
{
|
||||||
|
|
||||||
|
return gps_l1_ca_tong_pcps_acquisition_cc_sptr(
|
||||||
|
new gps_l1_ca_tong_pcps_acquisition_cc(sampled_ms, doppler_max,
|
||||||
|
freq, fs_in, samples_per_ms, queue, dump, dump_filename));
|
||||||
|
}
|
||||||
|
|
||||||
|
gps_l1_ca_tong_pcps_acquisition_cc::gps_l1_ca_tong_pcps_acquisition_cc(
|
||||||
|
unsigned int sampled_ms, unsigned int doppler_max, long freq,
|
||||||
|
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||||
|
std::string dump_filename) :
|
||||||
|
gr_block("gps_l1_ca_tong_pcps_acquisition_cc", gr_make_io_signature(1, 1,
|
||||||
|
sizeof(gr_complex) * samples_per_ms), gr_make_io_signature(0, 0,
|
||||||
|
sizeof(gr_complex) * samples_per_ms))
|
||||||
|
{
|
||||||
|
|
||||||
|
// SAMPLE COUNTER
|
||||||
|
d_sample_counter = 0;
|
||||||
|
|
||||||
|
d_active = false;
|
||||||
|
d_dump = dump;
|
||||||
|
d_queue = queue;
|
||||||
|
d_dump_filename = dump_filename;
|
||||||
|
|
||||||
|
d_freq = freq;
|
||||||
|
d_fs_in = fs_in;
|
||||||
|
|
||||||
|
d_samples_per_ms = samples_per_ms;
|
||||||
|
d_sampled_ms = sampled_ms;
|
||||||
|
|
||||||
|
d_doppler_max = doppler_max;
|
||||||
|
|
||||||
|
d_satellite = 0;
|
||||||
|
|
||||||
|
d_samples = d_sampled_ms * d_samples_per_ms;
|
||||||
|
|
||||||
|
d_doppler_freq = 0.0;
|
||||||
|
d_code_phase = 0;
|
||||||
|
d_mag = 0.0;
|
||||||
|
d_noise_power = 0.0;
|
||||||
|
d_fbins = 0;
|
||||||
|
d_doppler = 0;
|
||||||
|
d_pfa = 0.2;
|
||||||
|
d_A = 8;
|
||||||
|
d_B = 1;
|
||||||
|
d_max_dwells = 15;
|
||||||
|
d_K = d_B;
|
||||||
|
|
||||||
|
d_if_sin = new gr_complex[d_samples];
|
||||||
|
|
||||||
|
d_fft_codes = (gr_complex*)malloc(sizeof(gr_complex) * d_samples_per_ms);
|
||||||
|
|
||||||
|
// Direct FFT
|
||||||
|
d_fft_if = new gri_fft_complex(d_samples, true);
|
||||||
|
|
||||||
|
// Inverse FFT
|
||||||
|
d_ifft = new gri_fft_complex(d_samples, false);
|
||||||
|
|
||||||
|
d_ca_codes = new gr_complex[d_samples];
|
||||||
|
|
||||||
|
d_aux_ca_code = new gr_complex[d_samples];
|
||||||
|
|
||||||
|
//generates a unused PRN code to calculate the noise envelope
|
||||||
|
code_gen_complex_sampled(d_aux_ca_code, 33, d_fs_in, 0);
|
||||||
|
|
||||||
|
DLOG(INFO) << "fs in " << d_fs_in;
|
||||||
|
DLOG(INFO) << "samples per ms " << d_samples_per_ms;
|
||||||
|
DLOG(INFO) << "doppler max " << d_doppler_max;
|
||||||
|
DLOG(INFO) << "freq " << d_freq;
|
||||||
|
DLOG(INFO) << "satellite " << d_satellite;
|
||||||
|
DLOG(INFO) << "sampled_ms " << d_sampled_ms;
|
||||||
|
DLOG(INFO) << "Samples_for_processing " << d_samples;
|
||||||
|
DLOG(INFO) << "dump filename " << d_dump_filename;
|
||||||
|
DLOG(INFO) << "dump " << d_dump;
|
||||||
|
}
|
||||||
|
|
||||||
|
gps_l1_ca_tong_pcps_acquisition_cc::~gps_l1_ca_tong_pcps_acquisition_cc()
|
||||||
|
{
|
||||||
|
delete d_if_sin;
|
||||||
|
delete d_ca_codes;
|
||||||
|
|
||||||
|
if (d_dump)
|
||||||
|
{
|
||||||
|
d_dump_file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gps_l1_ca_tong_pcps_acquisition_cc::set_satellite(unsigned int satellite)
|
||||||
|
{
|
||||||
|
d_satellite = satellite;
|
||||||
|
d_code_phase = 0;
|
||||||
|
d_doppler_freq = 0;
|
||||||
|
d_mag = 0.0;
|
||||||
|
d_noise_power = 0.0;
|
||||||
|
|
||||||
|
// The GPS codes are generated on the fly using a custom version of the GPS code generator
|
||||||
|
code_gen_complex_sampled(d_fft_if->get_inbuf(), satellite, d_fs_in, 0);
|
||||||
|
|
||||||
|
d_fft_if->execute(); // We need the FFT of GPS C/A code
|
||||||
|
//Conjugate the local code
|
||||||
|
//TODO Optimize it !
|
||||||
|
for (unsigned int i = 0; i < d_samples; i++)
|
||||||
|
{
|
||||||
|
d_fft_codes[i] = std::complex<float>(
|
||||||
|
d_fft_if->get_outbuf()[i].real(),
|
||||||
|
-d_fft_if->get_outbuf()[i].imag());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
signed int gps_l1_ca_tong_pcps_acquisition_cc::prn_code_phase()
|
||||||
|
{
|
||||||
|
return d_code_phase;
|
||||||
|
}
|
||||||
|
|
||||||
|
int gps_l1_ca_tong_pcps_acquisition_cc::general_work(int noutput_items,
|
||||||
|
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!d_active)
|
||||||
|
{
|
||||||
|
// sample counter
|
||||||
|
d_sample_counter += d_samples * noutput_items;
|
||||||
|
consume_each(noutput_items);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_sample_counter += d_samples;
|
||||||
|
|
||||||
|
// initialize acquisition algorithm
|
||||||
|
|
||||||
|
bool positive_acquisition = false;
|
||||||
|
int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
|
||||||
|
|
||||||
|
//float noise_envelope = 0.0;
|
||||||
|
float vt = 20000;
|
||||||
|
//float peak = 0.0;
|
||||||
|
float magt = 0.0;
|
||||||
|
unsigned int max_freq_step = 2 * (unsigned int)(d_doppler_max
|
||||||
|
/ d_doppler_step);
|
||||||
|
unsigned int indext = 0;
|
||||||
|
|
||||||
|
// Get the input samples pointer
|
||||||
|
const gr_complex *in = (const gr_complex *)input_items[0];
|
||||||
|
|
||||||
|
// aux vars
|
||||||
|
std::stringstream filename;
|
||||||
|
//unsigned int consume_items = 1;
|
||||||
|
|
||||||
|
// complex file write
|
||||||
|
// std::streamsize n = 2 * sizeof(float) * (d_samples);
|
||||||
|
|
||||||
|
// 1 - Compute the input noise envelope estimation and the threshold vt
|
||||||
|
|
||||||
|
// sine_gen_complex( d_if_sin, d_freq + doppler, d_fs_in, d_samples );
|
||||||
|
//
|
||||||
|
// noise_envelope = calculate_envelope( in, d_aux_ca_code, d_if_sin );
|
||||||
|
// vt = noise_envelope * sqrt( -2 * log( d_pfa ) );
|
||||||
|
|
||||||
|
|
||||||
|
// 1º Compute the input signal power estimation
|
||||||
|
for (unsigned int i = 0; i < d_samples; i++)
|
||||||
|
{
|
||||||
|
d_noise_power += std::abs(in[i]);
|
||||||
|
}
|
||||||
|
d_noise_power = sqrt(d_noise_power / (float)d_samples);
|
||||||
|
|
||||||
|
//Perform the carrier wipe-off
|
||||||
|
sine_gen_complex(d_if_sin, d_freq + d_doppler, d_fs_in, d_samples);
|
||||||
|
for (unsigned int i = 0; i < d_samples; i++)
|
||||||
|
{
|
||||||
|
d_fft_if->get_inbuf()[i] = in[i] * d_if_sin[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
//3º- Perform the FFT-based circular convolution (parallel time search)
|
||||||
|
d_fft_if->execute(); //TODO Optimize me
|
||||||
|
for (unsigned int i = 0; i < d_samples; i++)
|
||||||
|
{
|
||||||
|
d_ifft->get_inbuf()[i] = d_fft_if->get_outbuf()[i]
|
||||||
|
* d_fft_codes[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
d_ifft->execute();
|
||||||
|
x86_gr_complex_mag(d_ifft->get_outbuf(), d_samples); // d_ifft->get_outbuf()=|abs(·)|^2 and the array is converted from CPX->Float
|
||||||
|
x86_float_max((float*)d_ifft->get_outbuf(), &d_indext, &magt,
|
||||||
|
d_samples); // find max of |abs(·)|^2 -> index and magt
|
||||||
|
magt = sqrt(magt) / (float)d_samples;
|
||||||
|
d_test_statistics = magt / d_noise_power;
|
||||||
|
|
||||||
|
LOG_AT_LEVEL(INFO) << "Channel: " << d_channel
|
||||||
|
<< ", doing Tong PCSS acquisition of satellite: "
|
||||||
|
<< d_satellite << ", sample stamp: " << d_sample_counter
|
||||||
|
<< ", bin_freq " << d_doppler << ", doppler_max: "
|
||||||
|
<< d_doppler_max << ", K " << d_K << ", sigma: "
|
||||||
|
<< d_noise_power << ", mag: " << d_test_statistics
|
||||||
|
<< ", vt: " << vt;
|
||||||
|
|
||||||
|
if ((d_test_statistics > vt) && (indext = d_indext))
|
||||||
|
{
|
||||||
|
d_K++;
|
||||||
|
if (d_K == d_A)
|
||||||
|
{
|
||||||
|
d_code_phase = d_indext;
|
||||||
|
positive_acquisition = true;
|
||||||
|
d_doppler_freq = d_doppler;
|
||||||
|
d_acq_sample_stamp = d_sample_counter;
|
||||||
|
LOG_AT_LEVEL(INFO) << "positive acquisition";
|
||||||
|
LOG_AT_LEVEL(INFO) << "satellite " << d_satellite;
|
||||||
|
LOG_AT_LEVEL(INFO) << "sample_stamp " << d_sample_counter;
|
||||||
|
LOG_AT_LEVEL(INFO) << "test statistics value "
|
||||||
|
<< d_test_statistics;
|
||||||
|
LOG_AT_LEVEL(INFO) << "test statistics threshold " << vt;
|
||||||
|
LOG_AT_LEVEL(INFO) << "code phase " << d_code_phase;
|
||||||
|
LOG_AT_LEVEL(INFO) << "doppler " << d_doppler_freq;
|
||||||
|
LOG_AT_LEVEL(INFO) << "magnitude " << magt;
|
||||||
|
LOG_AT_LEVEL(INFO) << "input signal power " << d_noise_power;
|
||||||
|
d_dwells = 0;
|
||||||
|
d_active = false;
|
||||||
|
}
|
||||||
|
else d_dwells++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_K--;
|
||||||
|
if ((d_K == 0) || (d_dwells > d_max_dwells))
|
||||||
|
{
|
||||||
|
d_K = d_B;
|
||||||
|
d_dwells = 0;
|
||||||
|
d_fbins++;
|
||||||
|
if (d_fbins > max_freq_step)
|
||||||
|
{
|
||||||
|
d_fbins = 0;
|
||||||
|
LOG_AT_LEVEL(INFO) << "negative acquisition";
|
||||||
|
LOG_AT_LEVEL(INFO) << "satellite " << d_satellite;
|
||||||
|
LOG_AT_LEVEL(INFO) << "sample_stamp" << d_sample_counter;
|
||||||
|
LOG_AT_LEVEL(INFO) << "test statistics value "
|
||||||
|
<< d_test_statistics;
|
||||||
|
LOG_AT_LEVEL(INFO) << "test statistics threshold " << vt;
|
||||||
|
LOG_AT_LEVEL(INFO) << "input signal power "
|
||||||
|
<< d_noise_power;
|
||||||
|
d_active = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_doppler = d_doppler + pow(-1, d_fbins + 1) * d_fbins
|
||||||
|
* d_doppler_step;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else d_dwells++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Record results to files
|
||||||
|
// if( d_dump )
|
||||||
|
// {
|
||||||
|
// filename.str( "" );
|
||||||
|
// filename << "./data/fft_" << doppler << "_.dat";
|
||||||
|
// std::cout << filename.str().c_str();
|
||||||
|
// std::cout << ".\n";
|
||||||
|
// d_dump_file.open( filename.str().c_str(), std::ios::out
|
||||||
|
// | std::ios::binary );
|
||||||
|
// d_dump_file.write( (char*) d_ifft->get_outbuf(), n ); //write directly |abs(·)|^2 in this Doppler bin
|
||||||
|
// d_dump_file.close();
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
if (d_active == false)
|
||||||
|
{
|
||||||
|
if (positive_acquisition)
|
||||||
|
{
|
||||||
|
acquisition_message = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
acquisition_message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
d_channel_internal_queue->push(acquisition_message);
|
||||||
|
}
|
||||||
|
|
||||||
|
consume_each(1);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
float gps_l1_ca_tong_pcps_acquisition_cc::calculate_envelope(
|
||||||
|
const gr_complex* _input_signal, std::complex<float>* _local_code,
|
||||||
|
std::complex<float>* _local_if_sin)
|
||||||
|
{
|
||||||
|
float mag = 0.0;
|
||||||
|
std::complex<float> tmp_cpx = 0.0;
|
||||||
|
//std::cout << "tmp_cpx " << tmp_cpx << std::endl;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < d_samples; i++)
|
||||||
|
{
|
||||||
|
tmp_cpx = tmp_cpx + _input_signal[i] * _local_code[i]
|
||||||
|
* _local_if_sin[i];
|
||||||
|
}
|
||||||
|
//std::cout << "tmp_cpx " << tmp_cpx << std::endl;
|
||||||
|
|
||||||
|
mag = abs(tmp_cpx);
|
||||||
|
return mag;
|
||||||
|
}
|
|
@ -0,0 +1,186 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_tong_pcps_acquisition_cc.h
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GPS_L1_CA_TONG_PCPS_ACQUISITION_CC_H
|
||||||
|
#define GPS_L1_CA_TONG_PCPS_ACQUISITION_CC_H
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include <gnuradio/gr_block.h>
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
#include <gnuradio/gr_complex.h>
|
||||||
|
#include <gnuradio/gri_fft.h>
|
||||||
|
|
||||||
|
#include <queue>
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
|
#include <boost/thread/thread.hpp>
|
||||||
|
#include "concurrent_queue.h"
|
||||||
|
|
||||||
|
class gps_l1_ca_tong_pcps_acquisition_cc;
|
||||||
|
typedef boost::shared_ptr<gps_l1_ca_tong_pcps_acquisition_cc>
|
||||||
|
gps_l1_ca_tong_pcps_acquisition_cc_sptr;
|
||||||
|
gps_l1_ca_tong_pcps_acquisition_cc_sptr
|
||||||
|
gps_l1_ca_tong_pcps_make_acquisition_cc(unsigned int sampled_ms,
|
||||||
|
unsigned int doppler_max, long freq, long fs_in, int samples_per_ms,
|
||||||
|
gr_msg_queue_sptr queue, bool dump, std::string dump_filename);
|
||||||
|
|
||||||
|
class gps_l1_ca_tong_pcps_acquisition_cc: public gr_block
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend gps_l1_ca_tong_pcps_acquisition_cc_sptr
|
||||||
|
gps_l1_ca_tong_pcps_make_acquisition_cc(unsigned int sampled_ms,
|
||||||
|
unsigned int doppler_max, long freq, long fs_in,
|
||||||
|
int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||||
|
std::string dump_filename);
|
||||||
|
|
||||||
|
gps_l1_ca_tong_pcps_acquisition_cc(unsigned int sampled_ms,
|
||||||
|
unsigned int doppler_max, long freq, long fs_in,
|
||||||
|
int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||||
|
std::string dump_filename);
|
||||||
|
|
||||||
|
long d_fs_in;
|
||||||
|
long d_freq;
|
||||||
|
long d_doppler;
|
||||||
|
int d_samples_per_ms;
|
||||||
|
unsigned int d_doppler_resolution;
|
||||||
|
unsigned int d_satellite;
|
||||||
|
std::string d_satellite_str;
|
||||||
|
unsigned int d_doppler_max;
|
||||||
|
unsigned int d_doppler_step;
|
||||||
|
unsigned int d_sampled_ms;
|
||||||
|
unsigned int d_samples;
|
||||||
|
unsigned long int d_sample_counter;
|
||||||
|
unsigned long int d_acq_sample_stamp;
|
||||||
|
unsigned int d_fbins;
|
||||||
|
unsigned int d_indext;
|
||||||
|
unsigned d_dwells;
|
||||||
|
float d_pfa;
|
||||||
|
unsigned int d_A;
|
||||||
|
unsigned int d_B;
|
||||||
|
unsigned int d_max_dwells;
|
||||||
|
unsigned int d_K;
|
||||||
|
|
||||||
|
gr_complex* d_if_sin;
|
||||||
|
|
||||||
|
gr_complex* d_fft_codes;
|
||||||
|
|
||||||
|
gri_fft_complex* d_fft_if;
|
||||||
|
|
||||||
|
gri_fft_complex* d_ifft;
|
||||||
|
|
||||||
|
gr_complex* d_ca_codes;
|
||||||
|
|
||||||
|
gr_complex* d_aux_ca_code;
|
||||||
|
|
||||||
|
unsigned int d_code_phase;
|
||||||
|
float d_doppler_freq;
|
||||||
|
float d_mag;
|
||||||
|
float d_noise_power;
|
||||||
|
float d_test_statistics;
|
||||||
|
|
||||||
|
gr_msg_queue_sptr d_queue;
|
||||||
|
concurrent_queue<int> *d_channel_internal_queue;
|
||||||
|
std::ofstream d_dump_file;
|
||||||
|
|
||||||
|
bool d_active;
|
||||||
|
bool d_dump;
|
||||||
|
unsigned int d_channel;
|
||||||
|
std::string d_dump_filename;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
~gps_l1_ca_tong_pcps_acquisition_cc();
|
||||||
|
|
||||||
|
signed int prn_code_phase();
|
||||||
|
|
||||||
|
float doppler_freq()
|
||||||
|
{
|
||||||
|
return d_doppler_freq;
|
||||||
|
}
|
||||||
|
unsigned int mag()
|
||||||
|
{
|
||||||
|
return d_mag;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long int get_sample_stamp()
|
||||||
|
{
|
||||||
|
return d_acq_sample_stamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_satellite(unsigned int satellite);
|
||||||
|
|
||||||
|
void set_active(bool active)
|
||||||
|
{
|
||||||
|
d_active = active;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_channel(unsigned int channel)
|
||||||
|
{
|
||||||
|
d_channel = channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_doppler_max(unsigned int doppler_max)
|
||||||
|
{
|
||||||
|
d_doppler_max = doppler_max;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_doppler_step(unsigned int doppler_step)
|
||||||
|
{
|
||||||
|
d_doppler_step = doppler_step;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_doppler(unsigned int doppler)
|
||||||
|
{
|
||||||
|
d_doppler = doppler;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_dwells(unsigned int dwells)
|
||||||
|
{
|
||||||
|
d_dwells = dwells;
|
||||||
|
}
|
||||||
|
|
||||||
|
float calculate_envelope(const gr_complex* _input_signal, std::complex<
|
||||||
|
float>* _local_code, std::complex<float>* _local_if_sin);
|
||||||
|
|
||||||
|
void set_channel_queue(concurrent_queue<int> *channel_internal_queue)
|
||||||
|
{
|
||||||
|
d_channel_internal_queue = channel_internal_queue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||||
|
gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* GPS_L1_CA_TONG_PCPS_ACQUISITION_CC_H*/
|
|
@ -0,0 +1,6 @@
|
||||||
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
|
obj gps_l1_ca_gps_sdr_acquisition_cc : gps_l1_ca_gps_sdr_acquisition_cc.cc ;
|
||||||
|
obj gps_l1_ca_gps_sdr_acquisition_ss : gps_l1_ca_gps_sdr_acquisition_ss.cc ;
|
||||||
|
obj gps_l1_ca_pcps_acquisition_cc : gps_l1_ca_pcps_acquisition_cc.cc ;
|
||||||
|
obj gps_l1_ca_tong_pcps_acquisition_cc : gps_l1_ca_tong_pcps_acquisition_cc.cc ;
|
|
@ -0,0 +1,2 @@
|
||||||
|
build-project adapters ;
|
||||||
|
build-project gnuradio_blocks ;
|
|
@ -0,0 +1,266 @@
|
||||||
|
/*!
|
||||||
|
* \file channel.cc
|
||||||
|
* \brief Implementation of a GPS_L1_CA_Channel with a Finite State Machine
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "channel.h"
|
||||||
|
|
||||||
|
#include "acquisition_interface.h"
|
||||||
|
#include "tracking_interface.h"
|
||||||
|
#include "telemetry_decoder_interface.h"
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
#include "gnss_flowgraph.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
#include <gnuradio/gr_message.h>
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
Channel::Channel(ConfigurationInterface *configuration, unsigned int channel,
|
||||||
|
GNSSBlockInterface *pass_through, AcquisitionInterface *acq,
|
||||||
|
TrackingInterface *trk, TelemetryDecoderInterface *nav,
|
||||||
|
std::string role, std::string implementation, gr_msg_queue_sptr queue) :
|
||||||
|
pass_through_(pass_through), acq_(acq), trk_(trk), nav_(nav),
|
||||||
|
role_(role), implementation_(implementation), channel_(channel),
|
||||||
|
queue_(queue)
|
||||||
|
|
||||||
|
{
|
||||||
|
stop_ = false;
|
||||||
|
acq_->set_channel(channel_);
|
||||||
|
trk_->set_channel(channel_);
|
||||||
|
nav_->set_channel(channel_);
|
||||||
|
|
||||||
|
acq_->set_threshold(configuration->property("Acquisition"
|
||||||
|
+ boost::lexical_cast<std::string>(channel_) + ".threshold", 0.0));
|
||||||
|
acq_->set_doppler_max(configuration->property("Acquisition"
|
||||||
|
+ boost::lexical_cast<std::string>(channel_) + ".doppler_max",
|
||||||
|
10000));
|
||||||
|
acq_->set_doppler_step(configuration->property("Acquisition"
|
||||||
|
+ boost::lexical_cast<std::string>(channel_) + ".doppler_step",
|
||||||
|
250));
|
||||||
|
|
||||||
|
repeat_ = configuration->property("Acquisition" + boost::lexical_cast<
|
||||||
|
std::string>(channel_) + ".repeat_satellite", false);
|
||||||
|
std::cout << "Channel " << channel_ << " satellite repeat = " << repeat_
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
acq_->set_channel_queue(&channel_internal_queue_);
|
||||||
|
trk_->set_channel_queue(&channel_internal_queue_);
|
||||||
|
|
||||||
|
channel_fsm_.set_acquisition(acq_);
|
||||||
|
channel_fsm_.set_tracking(trk_);
|
||||||
|
channel_fsm_.set_channel(channel_);
|
||||||
|
channel_fsm_.set_queue(queue_);
|
||||||
|
|
||||||
|
connected_ = false;
|
||||||
|
message_ = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
Channel::~Channel()
|
||||||
|
{
|
||||||
|
|
||||||
|
delete acq_;
|
||||||
|
delete trk_;
|
||||||
|
delete nav_;
|
||||||
|
delete pass_through_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Channel::connect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (connected_)
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(WARNING) << "channel already connected internally";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pass_through_->connect(top_block);
|
||||||
|
acq_->connect(top_block);
|
||||||
|
trk_->connect(top_block);
|
||||||
|
nav_->connect(top_block);
|
||||||
|
|
||||||
|
top_block->connect(pass_through_->get_right_block(), 0,
|
||||||
|
acq_->get_left_block(), 0);
|
||||||
|
DLOG(INFO) << "pass_through_ -> acquisition";
|
||||||
|
|
||||||
|
top_block->connect(pass_through_->get_right_block(), 0,
|
||||||
|
trk_->get_left_block(), 0);
|
||||||
|
DLOG(INFO) << "pass_through_ -> tracking";
|
||||||
|
top_block->connect(trk_->get_right_block(), 0, nav_->get_left_block(), 0); // channel 1
|
||||||
|
top_block->connect(trk_->get_right_block(), 1, nav_->get_left_block(), 1); // channel 2
|
||||||
|
top_block->connect(trk_->get_right_block(), 2, nav_->get_left_block(), 2); // channel 3
|
||||||
|
DLOG(INFO) << "tracking -> telemetry_decoder";
|
||||||
|
|
||||||
|
connected_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Channel::disconnect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!connected_)
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(WARNING) << "Channel already disconnected internally";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
top_block->disconnect(acq_->get_right_block(), 0, trk_->get_left_block(),
|
||||||
|
0);
|
||||||
|
top_block->disconnect(trk_->get_right_block(), 0, nav_->get_left_block(),
|
||||||
|
0);
|
||||||
|
|
||||||
|
acq_->disconnect(top_block);
|
||||||
|
trk_->disconnect(top_block);
|
||||||
|
nav_->disconnect(top_block);
|
||||||
|
|
||||||
|
connected_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr Channel::get_left_block()
|
||||||
|
{
|
||||||
|
return pass_through_->get_left_block();
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr Channel::get_right_block()
|
||||||
|
{
|
||||||
|
|
||||||
|
return nav_->get_right_block();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Channel::set_satellite(unsigned int satellite)
|
||||||
|
{
|
||||||
|
satellite_ = satellite;
|
||||||
|
acq_->set_satellite(satellite);
|
||||||
|
trk_->set_satellite(satellite);
|
||||||
|
nav_->set_satellite(satellite);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Channel::start_acquisition()
|
||||||
|
{
|
||||||
|
channel_fsm_.Event_gps_start_acquisition();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Channel::start()
|
||||||
|
{
|
||||||
|
ch_thread_ = boost::thread(&Channel::run, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Channel::run()
|
||||||
|
{
|
||||||
|
start_acquisition();
|
||||||
|
while (!stop_)
|
||||||
|
{
|
||||||
|
channel_internal_queue_.wait_and_pop(message_);
|
||||||
|
process_channel_messages();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \brief Set stop_ to true and blocks the calling thread until
|
||||||
|
* the thread of the constructor has completed
|
||||||
|
*/
|
||||||
|
void Channel::stop()
|
||||||
|
{
|
||||||
|
stop_ = true;
|
||||||
|
channel_internal_queue_.push(0); //message to stop channel
|
||||||
|
|
||||||
|
/* When the boost::thread object that represents a thread of execution
|
||||||
|
* is destroyed the thread becomes detached. Once a thread is detached,
|
||||||
|
* it will continue executing until the invocation of the function or
|
||||||
|
* callable object supplied on construction has completed,
|
||||||
|
* or the program is terminated. In order to wait for a thread of
|
||||||
|
* execution to finish, the join() or timed_join() member functions of
|
||||||
|
* the boost::thread object must be used. join() will block the calling
|
||||||
|
* thread until the thread represented by the boost::thread object
|
||||||
|
* has completed.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
ch_thread_.join();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Channel::process_channel_messages()
|
||||||
|
{
|
||||||
|
switch (message_)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
|
||||||
|
LOG_AT_LEVEL(INFO) << "Stop channel " << channel_;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
|
||||||
|
LOG_AT_LEVEL(INFO) << "Channel " << channel_
|
||||||
|
<< " ACQ SUCCESS satellite " << satellite_;
|
||||||
|
channel_fsm_.Event_gps_valid_acquisition();
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
|
||||||
|
LOG_AT_LEVEL(INFO) << "Channel " << channel_
|
||||||
|
<< " ACQ FAILED satellite " << satellite_;
|
||||||
|
if (repeat_ == true)
|
||||||
|
{
|
||||||
|
channel_fsm_.Event_gps_failed_acquisition_repeat();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
channel_fsm_.Event_gps_failed_acquisition_no_repeat();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
LOG_AT_LEVEL(INFO) << "Channel " << channel_
|
||||||
|
<< " TRACKING FAILED satellite " << satellite_
|
||||||
|
<< ", reacquisition.";
|
||||||
|
channel_fsm_.Event_gps_failed_tracking();
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
|
||||||
|
LOG_AT_LEVEL(WARNING) << "Default case, invalid message.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,121 @@
|
||||||
|
/*!
|
||||||
|
* \file channel.h
|
||||||
|
* \brief This class represents a GNSS channel.
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* It holds blocks for acquisition, tracking,
|
||||||
|
* navigation data extraction and pseudorange calculation.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CHANNEL_H_
|
||||||
|
#define CHANNEL_H_
|
||||||
|
|
||||||
|
#include <gnuradio/gr_null_sink.h>
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
|
||||||
|
#include "channel_interface.h"
|
||||||
|
#include "gps_l1_ca_channel_fsm.h"
|
||||||
|
#include "control_message_factory.h"
|
||||||
|
#include "concurrent_queue.h"
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
class AcquisitionInterface;
|
||||||
|
class TrackingInterface;
|
||||||
|
class TelemetryDecoderInterface;
|
||||||
|
//class GpsL1CaChannelFsm;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief This class represents a GNSS channel.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Channel: public ChannelInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
Channel(ConfigurationInterface *configuration, unsigned int channel,
|
||||||
|
GNSSBlockInterface *pass_through, AcquisitionInterface *acq,
|
||||||
|
TrackingInterface *trk, TelemetryDecoderInterface *nav,
|
||||||
|
std::string role, std::string implementation,
|
||||||
|
gr_msg_queue_sptr queue);
|
||||||
|
|
||||||
|
//! Virtual destructor
|
||||||
|
virtual ~Channel();
|
||||||
|
|
||||||
|
void connect(gr_top_block_sptr top_block);
|
||||||
|
void disconnect(gr_top_block_sptr top_block);
|
||||||
|
gr_basic_block_sptr get_left_block();
|
||||||
|
gr_basic_block_sptr get_right_block();
|
||||||
|
|
||||||
|
std::string role(){ return role_;}
|
||||||
|
|
||||||
|
std::string implementation(){ return "Channel";}
|
||||||
|
|
||||||
|
size_t item_size(){ return 0;}
|
||||||
|
|
||||||
|
unsigned int satellite(){ return satellite_;}
|
||||||
|
|
||||||
|
AcquisitionInterface* acquisition(){ return acq_;}
|
||||||
|
|
||||||
|
TrackingInterface* tracking(){ return trk_;}
|
||||||
|
|
||||||
|
TelemetryDecoderInterface* telemetry(){ return nav_;}
|
||||||
|
|
||||||
|
void start_acquisition();
|
||||||
|
void set_satellite(unsigned int satellite);
|
||||||
|
void start();
|
||||||
|
void stop();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
GNSSBlockInterface *pass_through_;
|
||||||
|
AcquisitionInterface *acq_;
|
||||||
|
TrackingInterface *trk_;
|
||||||
|
TelemetryDecoderInterface *nav_;
|
||||||
|
|
||||||
|
std::string role_;
|
||||||
|
std::string implementation_;
|
||||||
|
|
||||||
|
unsigned int channel_;
|
||||||
|
unsigned int satellite_;
|
||||||
|
bool connected_;
|
||||||
|
bool stop_;
|
||||||
|
int message_;
|
||||||
|
bool repeat_;
|
||||||
|
|
||||||
|
GpsL1CaChannelFsm channel_fsm_;
|
||||||
|
gr_msg_queue_sptr queue_;
|
||||||
|
concurrent_queue<int> channel_internal_queue_;
|
||||||
|
boost::thread ch_thread_;
|
||||||
|
|
||||||
|
void run();
|
||||||
|
void process_channel_messages();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*CHANNEL_H_*/
|
|
@ -0,0 +1,3 @@
|
||||||
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
|
obj channel : channel.cc ;
|
|
@ -0,0 +1,3 @@
|
||||||
|
build-project adapters ;
|
||||||
|
# build-project gnuradio_blocks ;
|
||||||
|
build-project libs ;
|
|
@ -0,0 +1,209 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_channel_fsm.cc
|
||||||
|
* \briefState Machine for channel using boost::statechart
|
||||||
|
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gps_l1_ca_channel_fsm.h"
|
||||||
|
#include "control_message_factory.h"
|
||||||
|
#include "channel.h"
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
struct Ev_gps_channel_start_acquisition: sc::event<
|
||||||
|
Ev_gps_channel_start_acquisition>
|
||||||
|
{};
|
||||||
|
|
||||||
|
struct Ev_gps_channel_valid_acquisition: sc::event<
|
||||||
|
Ev_gps_channel_valid_acquisition>
|
||||||
|
{};
|
||||||
|
|
||||||
|
struct Ev_gps_channel_failed_acquisition_repeat: sc::event<
|
||||||
|
Ev_gps_channel_failed_acquisition_repeat>
|
||||||
|
{};
|
||||||
|
|
||||||
|
struct Ev_gps_channel_failed_acquisition_no_repeat: sc::event<
|
||||||
|
Ev_gps_channel_failed_acquisition_no_repeat>
|
||||||
|
{};
|
||||||
|
|
||||||
|
struct Ev_gps_channel_failed_tracking: sc::event<
|
||||||
|
Ev_gps_channel_failed_tracking>
|
||||||
|
{};
|
||||||
|
|
||||||
|
struct gps_channel_idle_fsm_S0: public sc::state<gps_channel_idle_fsm_S0,
|
||||||
|
GpsL1CaChannelFsm>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// sc::transition(event, next state)
|
||||||
|
typedef sc::transition<Ev_gps_channel_start_acquisition,
|
||||||
|
gps_channel_acquiring_fsm_S1> reactions;
|
||||||
|
gps_channel_idle_fsm_S0(my_context ctx) :
|
||||||
|
my_base(ctx)
|
||||||
|
{
|
||||||
|
//std::cout << "Enter Channel_Idle_S0 " << std::endl;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct gps_channel_acquiring_fsm_S1: public sc::state<
|
||||||
|
gps_channel_acquiring_fsm_S1, GpsL1CaChannelFsm>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef mpl::list<sc::transition<
|
||||||
|
Ev_gps_channel_failed_acquisition_no_repeat,
|
||||||
|
gps_channel_waiting_fsm_S3>, sc::transition<
|
||||||
|
Ev_gps_channel_failed_acquisition_repeat,
|
||||||
|
gps_channel_acquiring_fsm_S1>, sc::transition<
|
||||||
|
Ev_gps_channel_valid_acquisition, gps_channel_tracking_fsm_S2> >
|
||||||
|
reactions;
|
||||||
|
|
||||||
|
gps_channel_acquiring_fsm_S1(my_context ctx) :
|
||||||
|
my_base(ctx)
|
||||||
|
{
|
||||||
|
//std::cout << "Enter Channel_Acq_S1 " << std::endl;
|
||||||
|
context<GpsL1CaChannelFsm> ().start_acquisition();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct gps_channel_tracking_fsm_S2: public sc::state<
|
||||||
|
gps_channel_tracking_fsm_S2, GpsL1CaChannelFsm>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef sc::transition<Ev_gps_channel_failed_tracking,
|
||||||
|
gps_channel_acquiring_fsm_S1> reactions;
|
||||||
|
|
||||||
|
gps_channel_tracking_fsm_S2(my_context ctx) :
|
||||||
|
my_base(ctx)
|
||||||
|
{
|
||||||
|
//std::cout << "Enter Channel_tracking_S2 " << std::endl;
|
||||||
|
context<GpsL1CaChannelFsm> ().start_tracking();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct gps_channel_waiting_fsm_S3: public sc::state<
|
||||||
|
gps_channel_waiting_fsm_S3, GpsL1CaChannelFsm>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef sc::transition<Ev_gps_channel_start_acquisition,
|
||||||
|
gps_channel_acquiring_fsm_S1> reactions;
|
||||||
|
|
||||||
|
gps_channel_waiting_fsm_S3(my_context ctx) :
|
||||||
|
my_base(ctx)
|
||||||
|
{
|
||||||
|
//std::cout << "Enter Channel_waiting_S3 " << std::endl;
|
||||||
|
context<GpsL1CaChannelFsm> ().request_satellite();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
GpsL1CaChannelFsm::GpsL1CaChannelFsm()
|
||||||
|
{
|
||||||
|
initiate(); //start the FSM
|
||||||
|
}
|
||||||
|
|
||||||
|
GpsL1CaChannelFsm::GpsL1CaChannelFsm(AcquisitionInterface *acquisition) :
|
||||||
|
acq_(acquisition)
|
||||||
|
{
|
||||||
|
initiate(); //start the FSM
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaChannelFsm::Event_gps_start_acquisition()
|
||||||
|
{
|
||||||
|
this->process_event(Ev_gps_channel_start_acquisition());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaChannelFsm::Event_gps_valid_acquisition()
|
||||||
|
{
|
||||||
|
this->process_event(Ev_gps_channel_valid_acquisition());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaChannelFsm::Event_gps_failed_acquisition_repeat()
|
||||||
|
{
|
||||||
|
this->process_event(Ev_gps_channel_failed_acquisition_repeat());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaChannelFsm::Event_gps_failed_acquisition_no_repeat()
|
||||||
|
{
|
||||||
|
this->process_event(Ev_gps_channel_failed_acquisition_no_repeat());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaChannelFsm::Event_gps_failed_tracking()
|
||||||
|
{
|
||||||
|
this->process_event(Ev_gps_channel_failed_tracking());
|
||||||
|
}
|
||||||
|
void GpsL1CaChannelFsm::set_acquisition(AcquisitionInterface *acquisition)
|
||||||
|
{
|
||||||
|
acq_ = acquisition;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaChannelFsm::set_tracking(TrackingInterface *tracking)
|
||||||
|
{
|
||||||
|
trk_ = tracking;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaChannelFsm::set_queue(gr_msg_queue_sptr queue)
|
||||||
|
{
|
||||||
|
queue_ = queue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaChannelFsm::set_channel(unsigned int channel)
|
||||||
|
{
|
||||||
|
channel_ = channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaChannelFsm::start_acquisition()
|
||||||
|
{
|
||||||
|
acq_->reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaChannelFsm::start_tracking()
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(INFO) << "Channel " << channel_
|
||||||
|
<< " passing prn code phase " << acq_->prn_code_phase();
|
||||||
|
LOG_AT_LEVEL(INFO) << "Channel " << channel_
|
||||||
|
<< " passing doppler freq shift " << acq_->doppler_freq_shift();
|
||||||
|
LOG_AT_LEVEL(INFO) << "Channel " << channel_
|
||||||
|
<< " passing acquisition sample stamp "
|
||||||
|
<< acq_->get_sample_stamp();
|
||||||
|
trk_->set_prn_code_phase(acq_->prn_code_phase());
|
||||||
|
trk_->set_doppler_freq_shift(acq_->doppler_freq_shift());
|
||||||
|
trk_->set_acq_sample_stamp(acq_->get_sample_stamp());
|
||||||
|
trk_->start_tracking();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaChannelFsm::request_satellite()
|
||||||
|
{
|
||||||
|
ControlMessageFactory* cmf = new ControlMessageFactory();
|
||||||
|
if (queue_ != gr_msg_queue_sptr())
|
||||||
|
{
|
||||||
|
queue_->handle(cmf->GetQueueMessage(channel_, 0));
|
||||||
|
}
|
||||||
|
delete cmf;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_channel_fsm.h
|
||||||
|
* \brief State Machine for channel using boost::statechart
|
||||||
|
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_GPS_L1_CA_CHANNEL_FSM_H
|
||||||
|
#define GNSS_SDR_GPS_L1_CA_CHANNEL_FSM_H
|
||||||
|
|
||||||
|
#include <boost/statechart/state_machine.hpp>
|
||||||
|
#include <boost/statechart/simple_state.hpp>
|
||||||
|
#include <boost/statechart/state.hpp>
|
||||||
|
#include <boost/statechart/transition.hpp>
|
||||||
|
#include <boost/statechart/custom_reaction.hpp>
|
||||||
|
#include <boost/mpl/list.hpp>
|
||||||
|
#include <queue>
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
|
#include <boost/thread/thread.hpp>
|
||||||
|
|
||||||
|
#include "acquisition_interface.h"
|
||||||
|
#include "tracking_interface.h"
|
||||||
|
#include "telemetry_decoder_interface.h"
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
namespace sc = boost::statechart;
|
||||||
|
namespace mpl = boost::mpl;
|
||||||
|
|
||||||
|
struct gps_channel_idle_fsm_S0;
|
||||||
|
struct gps_channel_acquiring_fsm_S1;
|
||||||
|
struct gps_channel_tracking_fsm_S2;
|
||||||
|
struct gps_channel_waiting_fsm_S3;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief This class implements a State Machine for channel using boost::statechart
|
||||||
|
*/
|
||||||
|
class GpsL1CaChannelFsm: public sc::state_machine<GpsL1CaChannelFsm,
|
||||||
|
gps_channel_idle_fsm_S0>
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
GpsL1CaChannelFsm();
|
||||||
|
GpsL1CaChannelFsm(AcquisitionInterface *acquisition);
|
||||||
|
|
||||||
|
void set_acquisition(AcquisitionInterface *acquisition);
|
||||||
|
void set_tracking(TrackingInterface *tracking);
|
||||||
|
void set_queue(gr_msg_queue_sptr queue);
|
||||||
|
void set_channel(unsigned int channel);
|
||||||
|
void start_acquisition();
|
||||||
|
void start_tracking();
|
||||||
|
void request_satellite();
|
||||||
|
|
||||||
|
//FSM EVENTS
|
||||||
|
void Event_gps_start_acquisition();
|
||||||
|
void Event_gps_valid_acquisition();
|
||||||
|
void Event_gps_failed_acquisition_repeat();
|
||||||
|
void Event_gps_failed_acquisition_no_repeat();
|
||||||
|
void Event_gps_failed_tracking();
|
||||||
|
|
||||||
|
private:
|
||||||
|
AcquisitionInterface *acq_;
|
||||||
|
TrackingInterface *trk_;
|
||||||
|
TelemetryDecoderInterface *nav_;
|
||||||
|
gr_msg_queue_sptr queue_;
|
||||||
|
unsigned int channel_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*GNSS_SDR_GPS_L1_CA_CHANNEL_FSM_H*/
|
|
@ -0,0 +1,3 @@
|
||||||
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
|
obj gps_l1_ca_channel_fsm : gps_l1_ca_channel_fsm.cc ;
|
|
@ -0,0 +1,136 @@
|
||||||
|
/*!
|
||||||
|
* \file direct_resampler_conditioner.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "direct_resampler_conditioner.h"
|
||||||
|
|
||||||
|
#include <gnuradio/usrp_source_c.h>
|
||||||
|
#include <gnuradio/gr_file_sink.h>
|
||||||
|
|
||||||
|
#include "direct_resampler_conditioner_cc.h"
|
||||||
|
#include "direct_resampler_conditioner_ss.h"
|
||||||
|
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
DirectResamplerConditioner::DirectResamplerConditioner(
|
||||||
|
ConfigurationInterface* configuration, std::string role,
|
||||||
|
unsigned int in_stream, unsigned int out_stream) :
|
||||||
|
role_(role), in_stream_(in_stream), out_stream_(out_stream)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string default_item_type = "short";
|
||||||
|
std::string default_dump_file = "./data/signal_conditioner.dat";
|
||||||
|
|
||||||
|
sample_freq_in_ = configuration->property(role_ + ".sample_freq_in",
|
||||||
|
(double)4000000.0);
|
||||||
|
sample_freq_out_ = configuration->property(role_ + ".sample_freq_out",
|
||||||
|
(double)2048000.0);
|
||||||
|
item_type_ = configuration->property(role + ".item_type",
|
||||||
|
default_item_type);
|
||||||
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
|
dump_filename_ = configuration->property(role + ".dump_filename",
|
||||||
|
default_dump_file);
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
resampler_ = direct_resampler_make_conditioner_cc(sample_freq_in_,
|
||||||
|
sample_freq_out_);
|
||||||
|
}
|
||||||
|
else if (item_type_.compare("short") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(short);
|
||||||
|
resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_,
|
||||||
|
sample_freq_out_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(WARNING) << item_type_
|
||||||
|
<< " unrecognized item type. Using short";
|
||||||
|
item_size_ = sizeof(short);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "Dumping output into file " << dump_filename_;
|
||||||
|
file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
DLOG(INFO) << "sample_freq_in " << sample_freq_in_;
|
||||||
|
DLOG(INFO) << "sample_freq_out" << sample_freq_out_;
|
||||||
|
DLOG(INFO) << "Item size " << item_size_;
|
||||||
|
DLOG(INFO) << "resampler(" << resampler_->unique_id() << ")";
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DirectResamplerConditioner::~DirectResamplerConditioner()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void DirectResamplerConditioner::connect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->connect(resampler_, 0, file_sink_, 0);
|
||||||
|
DLOG(INFO) << "connected resampler to file sink";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "nothing to connect internally";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DirectResamplerConditioner::disconnect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->disconnect(resampler_, 0, file_sink_, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr DirectResamplerConditioner::get_left_block()
|
||||||
|
{
|
||||||
|
return resampler_;
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr DirectResamplerConditioner::get_right_block()
|
||||||
|
{
|
||||||
|
return resampler_;
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
/*!
|
||||||
|
* \file direct_resampler_conditioner.h
|
||||||
|
* \brief This class represents a direct resampler.
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DIRECT_RESAMPLER_CONDITIONER_H_
|
||||||
|
#define DIRECT_RESAMPLER_CONDITIONER_H_
|
||||||
|
|
||||||
|
#include <gnuradio/gr_hier_block2.h>
|
||||||
|
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
|
||||||
|
class DirectResamplerConditioner: public GNSSBlockInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
DirectResamplerConditioner(ConfigurationInterface* configuration,
|
||||||
|
std::string role, unsigned int in_stream,
|
||||||
|
unsigned int out_stream);
|
||||||
|
virtual ~DirectResamplerConditioner();
|
||||||
|
|
||||||
|
std::string role()
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
std::string implementation()
|
||||||
|
{
|
||||||
|
return "DirectResamplerConditioner";
|
||||||
|
}
|
||||||
|
size_t item_size()
|
||||||
|
{
|
||||||
|
return item_size_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void connect(gr_top_block_sptr top_block);
|
||||||
|
void disconnect(gr_top_block_sptr top_block);
|
||||||
|
gr_basic_block_sptr get_left_block();
|
||||||
|
gr_basic_block_sptr get_right_block();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
std::string role_;
|
||||||
|
unsigned int in_stream_;
|
||||||
|
unsigned int out_stream_;
|
||||||
|
|
||||||
|
std::string item_type_;
|
||||||
|
size_t item_size_;
|
||||||
|
long samples_;
|
||||||
|
bool dump_;
|
||||||
|
std::string dump_filename_;
|
||||||
|
double sample_freq_in_;
|
||||||
|
double sample_freq_out_;
|
||||||
|
|
||||||
|
gr_block_sptr resampler_;
|
||||||
|
gr_block_sptr file_sink_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*DIRECT_RESAMPLER_CONDITIONER_H_*/
|
|
@ -0,0 +1,3 @@
|
||||||
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
|
obj direct_resampler_conditioner : direct_resampler_conditioner.cc ;
|
|
@ -0,0 +1,146 @@
|
||||||
|
/*!
|
||||||
|
* \file direct_resampler_conditioner_cc.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "direct_resampler_conditioner_cc.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
direct_resampler_conditioner_cc_sptr direct_resampler_make_conditioner_cc(
|
||||||
|
double sample_freq_in, double sample_freq_out)
|
||||||
|
{
|
||||||
|
|
||||||
|
return direct_resampler_conditioner_cc_sptr(
|
||||||
|
new direct_resampler_conditioner_cc(sample_freq_in,
|
||||||
|
sample_freq_out));
|
||||||
|
}
|
||||||
|
|
||||||
|
direct_resampler_conditioner_cc::direct_resampler_conditioner_cc(
|
||||||
|
double sample_freq_in, double sample_freq_out) :
|
||||||
|
gr_block("direct_resampler_conditioner_cc", gr_make_io_signature(1, 1,
|
||||||
|
sizeof(gr_complex)), gr_make_io_signature(1, 1,
|
||||||
|
sizeof(gr_complex))), d_sample_freq_in(sample_freq_in),
|
||||||
|
d_sample_freq_out(sample_freq_out), d_phase(0), d_lphase(0),
|
||||||
|
d_history(1)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296
|
||||||
|
if (d_sample_freq_in >= d_sample_freq_out)
|
||||||
|
{
|
||||||
|
d_phase_step = (unsigned int)floor((double)4294967296.0
|
||||||
|
* sample_freq_out / sample_freq_in);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_phase_step = (unsigned int)floor((double)4294967296.0
|
||||||
|
* sample_freq_in / sample_freq_out);
|
||||||
|
}
|
||||||
|
|
||||||
|
set_relative_rate(1.0 * sample_freq_out / sample_freq_in);
|
||||||
|
set_output_multiple(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
direct_resampler_conditioner_cc::~direct_resampler_conditioner_cc()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void direct_resampler_conditioner_cc::forecast(int noutput_items,
|
||||||
|
gr_vector_int &ninput_items_required)
|
||||||
|
{
|
||||||
|
|
||||||
|
int nreqd = std::max((unsigned)1, (int)((double)(noutput_items + 1)
|
||||||
|
* sample_freq_in() / sample_freq_out()) + history() - 1);
|
||||||
|
unsigned ninputs = ninput_items_required.size();
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < ninputs; i++)
|
||||||
|
{
|
||||||
|
ninput_items_required[i] = nreqd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int direct_resampler_conditioner_cc::general_work(int noutput_items,
|
||||||
|
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items)
|
||||||
|
{
|
||||||
|
|
||||||
|
const gr_complex *in = (const gr_complex *)input_items[0];
|
||||||
|
gr_complex *out = (gr_complex *)output_items[0];
|
||||||
|
|
||||||
|
int lcv = 0;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
if (d_sample_freq_in >= d_sample_freq_out)
|
||||||
|
{
|
||||||
|
while ((lcv < noutput_items))
|
||||||
|
{
|
||||||
|
if (d_phase <= d_lphase)
|
||||||
|
{
|
||||||
|
out[lcv] = *in;
|
||||||
|
lcv++;
|
||||||
|
}
|
||||||
|
|
||||||
|
d_lphase = d_phase;
|
||||||
|
d_phase += d_phase_step;
|
||||||
|
in++;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while ((lcv < noutput_items))
|
||||||
|
{
|
||||||
|
d_lphase = d_phase;
|
||||||
|
d_phase += d_phase_step;
|
||||||
|
if (d_phase <= d_lphase)
|
||||||
|
{
|
||||||
|
in++;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
out[lcv] = *in;
|
||||||
|
lcv++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
consume_each(std::min(count, ninput_items[0]));
|
||||||
|
return lcv;
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
/*!
|
||||||
|
* \file direct_resampler_conditioner_cc.h
|
||||||
|
*
|
||||||
|
* \brief Direct resampler with
|
||||||
|
* gr_complex input and gr_complex output
|
||||||
|
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* This block takes in a signal stream and performs direct
|
||||||
|
* resampling.
|
||||||
|
*
|
||||||
|
* The theory behind this block can be found in Chapter 7.5 of
|
||||||
|
* the following book.
|
||||||
|
*
|
||||||
|
* \param sample_freq_in (double) Specifies the sampling frequency of the input signal
|
||||||
|
* \param sample_freq_out (double) Specifies the sampling frequency of the output signal
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INCLUDED_DIRECT_RESAMPLER_CONDITIONER_CC_H
|
||||||
|
#define INCLUDED_DIRECT_RESAMPLER_CONDITIONER_CC_H
|
||||||
|
|
||||||
|
#include <gnuradio/gr_block.h>
|
||||||
|
|
||||||
|
class direct_resampler_conditioner_cc;
|
||||||
|
typedef boost::shared_ptr<direct_resampler_conditioner_cc>
|
||||||
|
direct_resampler_conditioner_cc_sptr;
|
||||||
|
direct_resampler_conditioner_cc_sptr
|
||||||
|
direct_resampler_make_conditioner_cc(double sample_freq_in,
|
||||||
|
double sample_freq_out);
|
||||||
|
|
||||||
|
class direct_resampler_conditioner_cc: public gr_block
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend direct_resampler_conditioner_cc_sptr
|
||||||
|
direct_resampler_make_conditioner_cc(double sample_freq_in,
|
||||||
|
double sample_freq_out);
|
||||||
|
|
||||||
|
double d_sample_freq_in;
|
||||||
|
double d_sample_freq_out;
|
||||||
|
unsigned int d_phase;
|
||||||
|
unsigned int d_lphase;
|
||||||
|
unsigned int d_phase_step;
|
||||||
|
unsigned int d_history;
|
||||||
|
|
||||||
|
direct_resampler_conditioner_cc(double sample_freq_in,
|
||||||
|
double sample_freq_out);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
~direct_resampler_conditioner_cc();
|
||||||
|
|
||||||
|
unsigned int sample_freq_in() const
|
||||||
|
{
|
||||||
|
return d_sample_freq_in;
|
||||||
|
}
|
||||||
|
unsigned int sample_freq_out() const
|
||||||
|
{
|
||||||
|
return d_sample_freq_out;
|
||||||
|
}
|
||||||
|
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
|
||||||
|
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||||
|
gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* INCLUDED_DIRECT_RESAMPLER_CONDITIONER_CC_H */
|
|
@ -0,0 +1,147 @@
|
||||||
|
/*!
|
||||||
|
* \file direct_resampler_conditioner_ss.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "direct_resampler_conditioner_ss.h"
|
||||||
|
|
||||||
|
#include "gps_sdr_signal_processing.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
direct_resampler_conditioner_ss_sptr direct_resampler_make_conditioner_ss(
|
||||||
|
double sample_freq_in, double sample_freq_out)
|
||||||
|
{
|
||||||
|
|
||||||
|
return direct_resampler_conditioner_ss_sptr(
|
||||||
|
new direct_resampler_conditioner_ss(sample_freq_in,
|
||||||
|
sample_freq_out));
|
||||||
|
}
|
||||||
|
|
||||||
|
direct_resampler_conditioner_ss::direct_resampler_conditioner_ss(
|
||||||
|
double sample_freq_in, double sample_freq_out) :
|
||||||
|
gr_block("direct_resampler_make_conditioner_ss", gr_make_io_signature(1,
|
||||||
|
1, sizeof(short)), gr_make_io_signature(1, 1, sizeof(short))),
|
||||||
|
d_sample_freq_in(sample_freq_in), d_sample_freq_out(
|
||||||
|
sample_freq_out), d_phase(0), d_lphase(0), d_history(1)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296
|
||||||
|
if (d_sample_freq_in >= d_sample_freq_out)
|
||||||
|
{
|
||||||
|
d_phase_step = (unsigned int)floor((double)4294967296.0
|
||||||
|
* sample_freq_out / sample_freq_in);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_phase_step = (unsigned int)floor((double)4294967296.0
|
||||||
|
* sample_freq_in / sample_freq_out);
|
||||||
|
}
|
||||||
|
|
||||||
|
set_relative_rate(1.0 * sample_freq_out / sample_freq_in);
|
||||||
|
set_output_multiple(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
direct_resampler_conditioner_ss::~direct_resampler_conditioner_ss()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void direct_resampler_conditioner_ss::forecast(int noutput_items,
|
||||||
|
gr_vector_int &ninput_items_required)
|
||||||
|
{
|
||||||
|
|
||||||
|
int nreqd = std::max((unsigned)1, (int)((double)(noutput_items + 1)
|
||||||
|
* sample_freq_in() / sample_freq_out()) + history() - 1);
|
||||||
|
unsigned ninputs = ninput_items_required.size();
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < ninputs; i++)
|
||||||
|
{
|
||||||
|
ninput_items_required[i] = nreqd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int direct_resampler_conditioner_ss::general_work(int noutput_items,
|
||||||
|
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items)
|
||||||
|
{
|
||||||
|
|
||||||
|
const CPX *in = (const CPX *)input_items[0];
|
||||||
|
CPX *out = (CPX *)output_items[0];
|
||||||
|
|
||||||
|
int lcv = 0;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
if (d_sample_freq_in >= d_sample_freq_out)
|
||||||
|
{
|
||||||
|
while ((lcv < noutput_items))
|
||||||
|
{
|
||||||
|
if (d_phase <= d_lphase)
|
||||||
|
{
|
||||||
|
out[lcv] = *in;
|
||||||
|
lcv++;
|
||||||
|
}
|
||||||
|
|
||||||
|
d_lphase = d_phase;
|
||||||
|
d_phase += d_phase_step;
|
||||||
|
in++;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while ((lcv < noutput_items))
|
||||||
|
{
|
||||||
|
d_lphase = d_phase;
|
||||||
|
d_phase += d_phase_step;
|
||||||
|
if (d_phase <= d_lphase)
|
||||||
|
{
|
||||||
|
in++;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
out[lcv] = *in;
|
||||||
|
lcv++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
consume_each(std::min(count, ninput_items[0]));
|
||||||
|
return lcv;
|
||||||
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
/*!
|
||||||
|
* \file direct_resampler_conditioner_ss.h
|
||||||
|
* \brief Direct resampler with
|
||||||
|
* short input and short output
|
||||||
|
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INCLUDED_DIRECT_RESAMPLER_CONDITIONER_SS_H
|
||||||
|
#define INCLUDED_DIRECT_RESAMPLER_CONDITIONER_SS_H
|
||||||
|
|
||||||
|
#include <gnuradio/gr_block.h>
|
||||||
|
|
||||||
|
class direct_resampler_conditioner_ss;
|
||||||
|
typedef boost::shared_ptr<direct_resampler_conditioner_ss>
|
||||||
|
direct_resampler_conditioner_ss_sptr;
|
||||||
|
direct_resampler_conditioner_ss_sptr
|
||||||
|
direct_resampler_make_conditioner_ss(double sample_freq_in,
|
||||||
|
double sample_freq_out);
|
||||||
|
|
||||||
|
class direct_resampler_conditioner_ss: public gr_block
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend direct_resampler_conditioner_ss_sptr
|
||||||
|
direct_resampler_make_conditioner_ss(double sample_freq_in,
|
||||||
|
double sample_freq_out);
|
||||||
|
|
||||||
|
double d_sample_freq_in;
|
||||||
|
double d_sample_freq_out;
|
||||||
|
unsigned int d_phase;
|
||||||
|
unsigned int d_lphase;
|
||||||
|
unsigned int d_phase_step;
|
||||||
|
unsigned int d_history;
|
||||||
|
|
||||||
|
direct_resampler_conditioner_ss(double sample_freq_in,
|
||||||
|
double sample_freq_out);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
~direct_resampler_conditioner_ss();
|
||||||
|
|
||||||
|
unsigned int sample_freq_in() const
|
||||||
|
{
|
||||||
|
return d_sample_freq_in;
|
||||||
|
}
|
||||||
|
unsigned int sample_freq_out() const
|
||||||
|
{
|
||||||
|
return d_sample_freq_out;
|
||||||
|
}
|
||||||
|
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
|
||||||
|
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||||
|
gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* INCLUDED_DIRECT_RESAMPLER_CONDITIONER_SS_H */
|
|
@ -0,0 +1,4 @@
|
||||||
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
|
obj direct_resampler_conditioner_cc : direct_resampler_conditioner_cc.cc ;
|
||||||
|
obj direct_resampler_conditioner_ss : direct_resampler_conditioner_ss.cc ;
|
|
@ -0,0 +1,2 @@
|
||||||
|
build-project adapters ;
|
||||||
|
build-project gnuradio_blocks ;
|
|
@ -0,0 +1,9 @@
|
||||||
|
build-project acquisition ;
|
||||||
|
build-project channel ;
|
||||||
|
build-project conditioner ;
|
||||||
|
build-project libs ;
|
||||||
|
build-project signal_source ;
|
||||||
|
build-project tracking ;
|
||||||
|
build-project telemetry_decoder ;
|
||||||
|
build-project observables ;
|
||||||
|
build-project output_filter ;
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*!
|
||||||
|
* \file gnss_sdr_valve.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gnss_sdr_valve.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
|
||||||
|
#include "control_message_factory.h"
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
gnss_sdr_valve::gnss_sdr_valve (size_t sizeof_stream_item,
|
||||||
|
int nitems,
|
||||||
|
gr_msg_queue_sptr queue) : gr_sync_block ("valve",
|
||||||
|
gr_make_io_signature (1, 1, sizeof_stream_item),
|
||||||
|
gr_make_io_signature (1, 1, sizeof_stream_item)),
|
||||||
|
d_nitems (nitems), d_ncopied_items (0), d_queue(queue)
|
||||||
|
{}
|
||||||
|
|
||||||
|
gr_block_sptr gnss_sdr_make_valve (size_t sizeof_stream_item,
|
||||||
|
int nitems,
|
||||||
|
gr_msg_queue_sptr queue)
|
||||||
|
{
|
||||||
|
return gr_block_sptr (new gnss_sdr_valve (sizeof_stream_item, nitems, queue));
|
||||||
|
}
|
||||||
|
|
||||||
|
int gnss_sdr_valve::work (int noutput_items,
|
||||||
|
gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items)
|
||||||
|
{
|
||||||
|
if (d_ncopied_items >= d_nitems)
|
||||||
|
{
|
||||||
|
|
||||||
|
ControlMessageFactory* cmf = new ControlMessageFactory();
|
||||||
|
d_queue->handle(cmf->GetQueueMessage(200,0));
|
||||||
|
delete cmf;
|
||||||
|
|
||||||
|
return -1; // Done!
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned n = std::min (d_nitems - d_ncopied_items, noutput_items);
|
||||||
|
|
||||||
|
if (n == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
memcpy (output_items[0], input_items[0], n * input_signature()->sizeof_stream_item (0));
|
||||||
|
d_ncopied_items += n;
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
/*!
|
||||||
|
* \file gnss_sdr_valve.h
|
||||||
|
* \brief This class implements a GNU Radio block that sends a STOP message to the
|
||||||
|
* control queue right after a specific number of samples have passed through it.
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_VALVE_H_
|
||||||
|
#define GNSS_SDR_VALVE_H_
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
#include <gr_sync_block.h>
|
||||||
|
#include <gr_msg_queue.h>
|
||||||
|
|
||||||
|
gr_block_sptr gnss_sdr_make_valve (size_t sizeof_stream_item,
|
||||||
|
int nitems,
|
||||||
|
gr_msg_queue_sptr queue);
|
||||||
|
|
||||||
|
class gnss_sdr_valve : public gr_sync_block
|
||||||
|
{
|
||||||
|
|
||||||
|
friend gr_block_sptr gnss_sdr_make_valve(size_t sizeof_stream_item,
|
||||||
|
int nitems,
|
||||||
|
gr_msg_queue_sptr queue);
|
||||||
|
gnss_sdr_valve (size_t sizeof_stream_item,
|
||||||
|
int nitems,
|
||||||
|
gr_msg_queue_sptr queue);
|
||||||
|
|
||||||
|
int d_nitems;
|
||||||
|
int d_ncopied_items;
|
||||||
|
gr_msg_queue_sptr d_queue;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
int work (int noutput_items,
|
||||||
|
gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*GNSS_SDR_VALVE_H_*/
|
|
@ -0,0 +1,169 @@
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
/*! \file defines.h
|
||||||
|
//
|
||||||
|
// FILENAME: defines.h
|
||||||
|
//
|
||||||
|
// DESCRIPTION: Important, non board-specific defines, many associated with IS-GPS-200D.
|
||||||
|
//
|
||||||
|
// DEVELOPERS: Gregory W. Heckler (2003-2009)
|
||||||
|
//
|
||||||
|
// LICENSE TERMS: Copyright (c) Gregory W. Heckler 2009
|
||||||
|
//
|
||||||
|
// This file is part of the GPS Software Defined Radio (GPS-SDR)
|
||||||
|
//
|
||||||
|
// The GPS-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 2 of
|
||||||
|
// the License, or (at your option) any later version. The GPS-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.
|
||||||
|
//
|
||||||
|
// Note: Comments within this file follow a syntax that is compatible with
|
||||||
|
// DOXYGEN and are utilized for automated document extraction
|
||||||
|
//
|
||||||
|
// Reference:
|
||||||
|
*/
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef DEFINES_H_
|
||||||
|
#define DEFINES_H_
|
||||||
|
|
||||||
|
/* For unnamed pipes */
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
#define READ (0) //!< Read handle
|
||||||
|
#define WRITE (1) //!< Write handle
|
||||||
|
#define TRUE (1) //!< True?
|
||||||
|
#define FALSE (0) //!< False!
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* First make some type prototypes */
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
typedef unsigned char uint8; //!< Unsigned byte
|
||||||
|
typedef unsigned short uint16; //!< Unsigned word
|
||||||
|
//typedef unsigned long uint32; //!< Unsigned double word
|
||||||
|
typedef unsigned long long uint64; //!< Unsigned quadruple word
|
||||||
|
typedef signed char int8; //!< Signed byte
|
||||||
|
typedef signed short int16; //!< Signed word
|
||||||
|
//typedef signed long int32; //!< Signed double word
|
||||||
|
typedef signed long long int64; //!< Signed quadruple word
|
||||||
|
typedef signed int int32;
|
||||||
|
typedef unsigned int uint32;
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Constants for scaling the ephemeris found in the data message
|
||||||
|
the format is the following: TWO_N5 -> 2^-5, TWO_P4 -> 2^4, PI_TWO_N43 -> Pi*2^-43, etc etc
|
||||||
|
Additionally some of the PI*2^N terms are used in the tracking stuff
|
||||||
|
TWO_PX ==> 2^X
|
||||||
|
TWO_NX ==> 2^-X
|
||||||
|
PI_TWO_NX ==> Pi*2^-X
|
||||||
|
PI_TWO_PX ==> Pi*2^X
|
||||||
|
ONE_PI_TWO_PX = (1/Pi)*2^X
|
||||||
|
*/
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
#define TWO_P4 (16) //!< 2^4
|
||||||
|
#define TWO_P11 (2048) //!< 2^11
|
||||||
|
#define TWO_P12 (4096) //!< 2^12
|
||||||
|
#define TWO_P14 (16384) //!< 2^14
|
||||||
|
#define TWO_P16 (65536) //!< 2^16
|
||||||
|
#define TWO_P19 (524288) //!< 2^19
|
||||||
|
#define TWO_P31 (2147483648.0) //!< 2^31
|
||||||
|
#define TWO_P32 (4294967296.0) //!< 2^32 this is too big for an int so add the x.0
|
||||||
|
#define TWO_P57 (1.441151880758559e+017) //!< 2^57
|
||||||
|
|
||||||
|
#define TWO_N5 (0.03125) //!< 2^-5
|
||||||
|
#define TWO_N11 (4.882812500000000e-004) //!< 2^-11
|
||||||
|
#define TWO_N19 (1.907348632812500e-006) //!< 2^-19
|
||||||
|
#define TWO_N20 (9.536743164062500e-007) //!< 2^-20
|
||||||
|
#define TWO_N21 (4.768371582031250e-007) //!< 2^-21
|
||||||
|
#define TWO_N24 (5.960464477539063e-008) //!< 2^-24
|
||||||
|
#define TWO_N25 (2.980232238769531e-008) //!< 2^-25
|
||||||
|
#define TWO_N27 (7.450580596923828e-009) //!< 2^-27
|
||||||
|
#define TWO_N29 (1.862645149230957e-009) //!< 2^-29
|
||||||
|
#define TWO_N30 (9.313225746154785e-010) //!< 2^-30
|
||||||
|
#define TWO_N31 (4.656612873077393e-010) //!< 2^-31
|
||||||
|
#define TWO_N32 (2.328306436538696e-010) //!< 2^-32
|
||||||
|
#define TWO_N33 (1.164153218269348e-010) //!< 2^-33
|
||||||
|
#define TWO_N38 (3.637978807091713e-012) //!< 2^-38
|
||||||
|
#define TWO_N43 (1.136868377216160e-013) //!< 2^-43
|
||||||
|
#define TWO_N50 (8.881784197001252e-016) //!< 2^-50
|
||||||
|
#define TWO_N55 (2.775557561562891e-017) //!< 2^-55
|
||||||
|
#define TWO_P56 (7.205759403792794e+016) //!< 2^56
|
||||||
|
#define TWO_P57 (1.441151880758559e+017) //!< 2^57
|
||||||
|
|
||||||
|
#define PI_TWO_N19 (5.992112452678286e-006) //!< Pi*2^-19
|
||||||
|
#define PI_TWO_N43 (3.571577341960839e-013) //!< Pi*2^-43
|
||||||
|
#define PI_TWO_N31 (1.462918079267160e-009) //!< Pi*2^-31
|
||||||
|
#define PI_TWO_N38 (1.142904749427469e-011) //!< Pi*2^-38
|
||||||
|
#define PI_TWO_N23 (3.745070282923929e-007) //!< Pi*2^-23
|
||||||
|
|
||||||
|
/* from ICD-GPS-2000 !!! Do not extend the number of significant digits !!! */
|
||||||
|
#ifndef PI
|
||||||
|
#define PI (3.141592653589793) //!< Pi
|
||||||
|
#endif
|
||||||
|
#ifndef TWO_PI
|
||||||
|
#define TWO_PI (6.283185307179586) //!< 2*Pi
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define THREE_PI_OVER_2 (4.7123889803) //!< 3*Pi/2
|
||||||
|
#define PI_OVER_2 (1.5707963267) //!< Pi/2
|
||||||
|
#define RAD_2_DEG (57.29577951308232) //!< 180/Pi
|
||||||
|
#define DEG_2_RAD (0.01745329251994) //!< Pi/180
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Channel Defines */
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
#define FRAME_SIZE_PLUS_2 (12) //!< Number of 30 bit words in subframe plus 2
|
||||||
|
#define PREAMBLE (unsigned long)(0x008B) //!< GPS data message preamble.
|
||||||
|
#define INVERSEPREAMBLE (unsigned long)(0x0074) //!< Inverted preamble.
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/* PVT Stuff */
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
#define GRAVITY_CONSTANT (3.986005e14) //!< Earth's WGS-84 gravitational constant (m^3/s^2) as specified in IS-GPS-200D
|
||||||
|
#define WGS84OE (7.2921151467e-5) //!< Earth's WGS-84 rotation rate (rads/s) as specified in IS-GPS-200D
|
||||||
|
#define WGS84_MAJOR_AXIS (6378137.0) //!< Earth's WGS-84 ellipsoid's major axis
|
||||||
|
#define WGS84_MINOR_AXIS (6356752.314245) //!< Earth's WGS-84 ellipsoid's minor axis
|
||||||
|
#define SECONDS_IN_1024_WEEKS (619315200.0) //!< Number of seconds in 1024 weeks
|
||||||
|
#define SECONDS_IN_WEEK (604800.0) //!< Number of seconds in a week
|
||||||
|
#define HALF_OF_SECONDS_IN_WEEK (302400.0) //!< Number of seconds in one half of a week
|
||||||
|
#define SECONDS_IN_DAY (86400.0) //!< Number of seconds in a day
|
||||||
|
#define SECONDS_IN_HOUR (3600.0) //!< Number of seconds in an hour
|
||||||
|
#define SECONDS_IN_MINUTE (60.0) //!< Number of seconds in a minute
|
||||||
|
#define SECONDS_IN_HALF_HOUR (1800.0) //!< Number of seconds in a half hour
|
||||||
|
#define FOUR_HOURS (14400.0) //!< Number of seconds in 4 hrs
|
||||||
|
#define SECONDS_PER_MZCOUNT (0.6) //!< Seconds per RTCM-104 modified Z-count.
|
||||||
|
#define L1 (1.57542e9)
|
||||||
|
#define L2 (1.2276e9)
|
||||||
|
#define L1_WAVELENGTH (1.902936727983649e-001) //!< Meters
|
||||||
|
#define L1_OVER_C (5.255035468570728) //!< L1 over Speed O Light
|
||||||
|
#define C_OVER_L1 (0.190293672798365) //!< Speed O Light over L1
|
||||||
|
#ifndef SPEED_OF_LIGHT
|
||||||
|
#define SPEED_OF_LIGHT (2.99792458e8) //!< Speed of light (m/s) as specified in IS-GPS-200D
|
||||||
|
#endif
|
||||||
|
#define INVERSE_L1 (6.347513678891978e-10) //!< 1/L1
|
||||||
|
#define INVERSE_SPEED_OF_LIGHT (3.33564095198152049576e-9) //!< Inverse speed of light
|
||||||
|
#define CODE_RATE (1.023e6) //!< L1 C/A code chipping rate
|
||||||
|
#define INVERSE_CODE_RATE (9.775171065493646e-07) //!< 1/L1 C/A code chipping rate
|
||||||
|
#define CODE_CHIPS (1023)
|
||||||
|
#define SAMPS_MS (2048) //!< All incoming signals are resampled to this sampling frequency
|
||||||
|
#define SAMPLE_FREQUENCY (2048000) //!< All incoming signals are resampled to this sampling frequency
|
||||||
|
#define INVERSE_SAMPLE_FREQUENCY (4.882812500000000e-7)
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Global Serial Port */
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
#define CHECK_STATUS(x) if((x) != NU_SUCCESS) {ERC_System_Error((x));}
|
||||||
|
#define READ (0)
|
||||||
|
#define WRITE (1)
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
#define NON_EXISTENT_SV (666)
|
||||||
|
#define NON_EXISTENT_IODE (9999)
|
||||||
|
#define STALE_SPS_VALUE (99999)
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif //DEFINES_H_
|
|
@ -0,0 +1,816 @@
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
/*! \file fft.cpp
|
||||||
|
//
|
||||||
|
// FILENAME: fft.cpp
|
||||||
|
//
|
||||||
|
// DESCRIPTION: Implements member functions of the FFT class.
|
||||||
|
//
|
||||||
|
// DEVELOPERS: Gregory W. Heckler (2003-2009)
|
||||||
|
//
|
||||||
|
// LICENSE TERMS: Copyright (c) Gregory W. Heckler 2009
|
||||||
|
//
|
||||||
|
// This file is part of the GPS Software Defined Radio (GPS-SDR)
|
||||||
|
//
|
||||||
|
// The GPS-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 2 of
|
||||||
|
// the License, or (at your option) any later version. The GPS-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.
|
||||||
|
//
|
||||||
|
// Note: Comments within this file follow a syntax that is compatible with
|
||||||
|
// DOXYGEN and are utilized for automated document extraction
|
||||||
|
//
|
||||||
|
// Reference:
|
||||||
|
*/
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "gps_sdr_fft.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
//#define NO_SIMD
|
||||||
|
|
||||||
|
#ifdef NO_SIMD
|
||||||
|
void rank(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize);
|
||||||
|
void rankdf(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize);
|
||||||
|
void rank_noscale(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize);
|
||||||
|
void rankdf_noscale(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize);
|
||||||
|
void bfly(CPX *_A, CPX *_B, MIX *_W);
|
||||||
|
void bflydf(CPX *_A, CPX *_B, MIX *_W);
|
||||||
|
void bfly_noscale(CPX *_A, CPX *_B, MIX *_W);
|
||||||
|
void bflydf_noscale(CPX *_A, CPX *_B, MIX *_W);
|
||||||
|
#else
|
||||||
|
void rank(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize) __attribute__ ((noinline));
|
||||||
|
void rankdf(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize) __attribute__ ((noinline));
|
||||||
|
void rank_noscale(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize) __attribute__ ((noinline));
|
||||||
|
void rankdf_noscale(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize) __attribute__ ((noinline));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FFT::FFT()
|
||||||
|
{
|
||||||
|
|
||||||
|
N = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FFT::FFT(int32 _N)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < MAX_RANKS; lcv++)
|
||||||
|
R[lcv] = 1;
|
||||||
|
|
||||||
|
N = _N;
|
||||||
|
M = 0;
|
||||||
|
|
||||||
|
/* Get the number of ranks */
|
||||||
|
while(_N > 1)
|
||||||
|
{
|
||||||
|
M++;
|
||||||
|
_N >>= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
W = (MIX *)malloc(N/2*sizeof(MIX)); // Forward twiddle lookup
|
||||||
|
iW = (MIX *)malloc(N/2*sizeof(MIX)); // Inverse twiddle lookup
|
||||||
|
BR = (int32 *)malloc(N*sizeof(int32)); // Bit reverse lookup
|
||||||
|
BRX = (int32 *)malloc(N*sizeof(CPX)); // Shuffle temp array
|
||||||
|
|
||||||
|
initW();
|
||||||
|
initBR();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FFT::FFT(int32 _N, int32 _R[MAX_RANKS])
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < MAX_RANKS; lcv++)
|
||||||
|
R[lcv] = _R[lcv];
|
||||||
|
|
||||||
|
N = _N;
|
||||||
|
M = 0;
|
||||||
|
|
||||||
|
/* Get the number of ranks */
|
||||||
|
while(_N > 1)
|
||||||
|
{
|
||||||
|
M++;
|
||||||
|
_N >>= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
W = (MIX *)malloc(N/2*sizeof(MIX)); // Forward twiddle lookup
|
||||||
|
iW = (MIX *)malloc(N/2*sizeof(MIX)); // Inverse twiddle lookup
|
||||||
|
BR = (int32 *)malloc(N*sizeof(int32)); // Bit reverse lookup
|
||||||
|
BRX = (int32 *)malloc(N*sizeof(CPX)); // Shuffle temp array
|
||||||
|
|
||||||
|
initW();
|
||||||
|
initBR();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FFT::~FFT()
|
||||||
|
{
|
||||||
|
free(BRX);
|
||||||
|
free(BR);
|
||||||
|
free(W);
|
||||||
|
free(iW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FFT::initW()
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv;
|
||||||
|
double s, c, phase;
|
||||||
|
const double pi = 3.14159265358979323846264338327;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < N/2; lcv++)
|
||||||
|
{
|
||||||
|
//Forward twiddles
|
||||||
|
phase = (-2*pi*lcv)/N;
|
||||||
|
c = floor(16384*cos(phase));
|
||||||
|
s = floor(16384*sin(phase));
|
||||||
|
W[lcv].i = (short)(c);
|
||||||
|
W[lcv].q = (short)(s);
|
||||||
|
W[lcv].nq = (short)(-s);
|
||||||
|
W[lcv].ni = (short)(c);
|
||||||
|
|
||||||
|
// fprintf(stdout,"W:%d,%d\n",W[lcv].i,W[lcv].q);
|
||||||
|
|
||||||
|
//Inverse twiddles
|
||||||
|
iW[lcv].i = (short)(c);
|
||||||
|
iW[lcv].q = (short)(-s);
|
||||||
|
iW[lcv].nq = (short)(s);
|
||||||
|
iW[lcv].ni = (short)(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void FFT::initBR()
|
||||||
|
{
|
||||||
|
int lcv, lcv2, index;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < N; lcv++)
|
||||||
|
{
|
||||||
|
index = 0;
|
||||||
|
for(lcv2 = 0; lcv2 < M; lcv2++)
|
||||||
|
{
|
||||||
|
index += ((lcv >> lcv2) & 0x1);
|
||||||
|
index <<= 1;
|
||||||
|
}
|
||||||
|
index >>= 1;
|
||||||
|
|
||||||
|
BR[lcv] = index;
|
||||||
|
|
||||||
|
// fprintf(stdout,"BR:%d\n",BR[lcv]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FFT::doFFT(CPX *_x, bool _shuf)
|
||||||
|
{
|
||||||
|
int32 lcv, nblocks, bsize;
|
||||||
|
CPX *a, *b;
|
||||||
|
MIX *w;
|
||||||
|
|
||||||
|
if(_shuf) {
|
||||||
|
doShuffle(_x); //bit reverse the array
|
||||||
|
}
|
||||||
|
|
||||||
|
bsize = 1;
|
||||||
|
nblocks = N >> 1;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < M; lcv++) //Loop over M ranks
|
||||||
|
{
|
||||||
|
a = _x;
|
||||||
|
b = _x + bsize;
|
||||||
|
w = W;
|
||||||
|
|
||||||
|
if(R[lcv])
|
||||||
|
rank(a, b, w, nblocks, bsize);
|
||||||
|
else
|
||||||
|
rank_noscale(a, b, w, nblocks, bsize);
|
||||||
|
|
||||||
|
bsize <<= 1;
|
||||||
|
nblocks >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FFT::doiFFT(CPX *_x, bool _shuf)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv, nblocks, bsize;
|
||||||
|
CPX *a, *b;
|
||||||
|
MIX *w;
|
||||||
|
|
||||||
|
if(_shuf)
|
||||||
|
doShuffle(_x); //bit reverse the array
|
||||||
|
|
||||||
|
bsize = 1;
|
||||||
|
nblocks = N >> 1;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < M; lcv++) //Loop over M ranks
|
||||||
|
{
|
||||||
|
a = _x;
|
||||||
|
b = _x + bsize;
|
||||||
|
w = iW;
|
||||||
|
|
||||||
|
if(R[lcv])
|
||||||
|
rank(a, b, w, nblocks, bsize);
|
||||||
|
else
|
||||||
|
rank_noscale(a, b, w, nblocks, bsize);
|
||||||
|
|
||||||
|
|
||||||
|
bsize <<= 1;
|
||||||
|
nblocks >>= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FFT::doFFTdf(CPX *_x, bool _shuf)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv;
|
||||||
|
int32 bsize;
|
||||||
|
int32 nblocks;
|
||||||
|
CPX *a, *b;
|
||||||
|
MIX *w;
|
||||||
|
|
||||||
|
bsize = N >> 1;
|
||||||
|
nblocks = 1;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < M; lcv++) //Loop over M ranks
|
||||||
|
{
|
||||||
|
a = _x;
|
||||||
|
b = _x + bsize;
|
||||||
|
w = W;
|
||||||
|
|
||||||
|
if(R[lcv])
|
||||||
|
rankdf(a, b, w, nblocks, bsize);
|
||||||
|
else
|
||||||
|
rankdf_noscale(a, b, w, nblocks, bsize);
|
||||||
|
|
||||||
|
bsize >>= 1;
|
||||||
|
nblocks <<= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_shuf)
|
||||||
|
doShuffle(_x); //bit reverse the array
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FFT::doiFFTdf(CPX *_x, bool _shuf)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv;
|
||||||
|
int32 bsize, nblocks;
|
||||||
|
CPX *a, *b;
|
||||||
|
MIX *w;
|
||||||
|
|
||||||
|
bsize = N >> 1;
|
||||||
|
nblocks = 1;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < M; lcv++) //Loop over M ranks
|
||||||
|
{
|
||||||
|
a = _x;
|
||||||
|
b = _x + bsize;
|
||||||
|
w = iW;
|
||||||
|
|
||||||
|
if(R[lcv])
|
||||||
|
rankdf(a, b, w, nblocks, bsize);
|
||||||
|
else
|
||||||
|
rankdf_noscale(a, b, w, nblocks, bsize);
|
||||||
|
|
||||||
|
bsize >>= 1;
|
||||||
|
nblocks <<= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_shuf)
|
||||||
|
doShuffle(_x); //bit reverse the array
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FFT::doShuffle(CPX *_x)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv;
|
||||||
|
int32 *p = (int32 *)_x;
|
||||||
|
|
||||||
|
memcpy(BRX, p, N*sizeof(CPX));
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < N; lcv++)
|
||||||
|
p[lcv] = BRX[BR[lcv]];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef NO_SIMD /* Include the cPP FFT Functions */
|
||||||
|
|
||||||
|
void rank(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv, lcv2;
|
||||||
|
|
||||||
|
MIX *wbase = _W;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _nblocks; lcv++)
|
||||||
|
{
|
||||||
|
for(lcv2 = 0; lcv2 < _bsize; lcv2++)
|
||||||
|
{
|
||||||
|
bfly(_A, _B, _W);
|
||||||
|
_A++; _B++; _W+=_nblocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
_A += _bsize;
|
||||||
|
_B += _bsize;
|
||||||
|
_W = wbase;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void rank_noscale(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv, lcv2;
|
||||||
|
|
||||||
|
MIX *wbase = _W;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _nblocks; lcv++)
|
||||||
|
{
|
||||||
|
for(lcv2 = 0; lcv2 < _bsize; lcv2++)
|
||||||
|
{
|
||||||
|
bfly_noscale(_A, _B, _W);
|
||||||
|
_A++; _B++; _W+=_nblocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
_A += _bsize;
|
||||||
|
_B += _bsize;
|
||||||
|
_W = wbase;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void rankdf(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv, lcv2;
|
||||||
|
|
||||||
|
MIX *wbase = _W;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _nblocks; lcv++)
|
||||||
|
{
|
||||||
|
for(lcv2 = 0; lcv2 < _bsize; lcv2++)
|
||||||
|
{
|
||||||
|
bflydf(_A, _B, _W);
|
||||||
|
_A++; _B++; _W+=_nblocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
_A += _bsize;
|
||||||
|
_B += _bsize;
|
||||||
|
_W = wbase;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void rankdf_noscale(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv, lcv2;
|
||||||
|
|
||||||
|
MIX *wbase = _W;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _nblocks; lcv++)
|
||||||
|
{
|
||||||
|
for(lcv2 = 0; lcv2 < _bsize; lcv2++)
|
||||||
|
{
|
||||||
|
bflydf_noscale(_A, _B, _W);
|
||||||
|
_A++; _B++; _W+=_nblocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
_A += _bsize;
|
||||||
|
_B += _bsize;
|
||||||
|
_W = wbase;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void bfly(CPX *_A, CPX *_B, MIX *_W)
|
||||||
|
{
|
||||||
|
int32 bi, bq;
|
||||||
|
|
||||||
|
_A->i >>= 1;
|
||||||
|
_A->q >>= 1;
|
||||||
|
_B->i >>= 1;
|
||||||
|
_B->q >>= 1;
|
||||||
|
|
||||||
|
bi = _B->i*_W->i - _B->q*_W->q;
|
||||||
|
bq = _B->i*_W->q + _B->q*_W->i;
|
||||||
|
|
||||||
|
bi = (bi + 8192) >> 14;
|
||||||
|
bq = (bq + 8192) >> 14;
|
||||||
|
|
||||||
|
_B->i = _A->i - (int16)bi;
|
||||||
|
_B->q = _A->q - (int16)bq;
|
||||||
|
|
||||||
|
_A->i += (int16)bi;
|
||||||
|
_A->q += (int16)bq;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bfly_noscale(CPX *_A, CPX *_B, MIX *_W)
|
||||||
|
{
|
||||||
|
int32 bi, bq;
|
||||||
|
|
||||||
|
bi = _B->i*_W->i - _B->q*_W->q;
|
||||||
|
bq = _B->i*_W->q + _B->q*_W->i;
|
||||||
|
|
||||||
|
bi = (bi + 8192) >> 14;
|
||||||
|
bq = (bq + 8192) >> 14;
|
||||||
|
|
||||||
|
_B->i = _A->i - (int16)bi;
|
||||||
|
_B->q = _A->q - (int16)bq;
|
||||||
|
|
||||||
|
_A->i += (int16)bi;
|
||||||
|
_A->q += (int16)bq;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bflydf(CPX *_A, CPX *_B, MIX *_W)
|
||||||
|
{
|
||||||
|
int32 bi, bq;
|
||||||
|
|
||||||
|
_A->i >>= 1;
|
||||||
|
_A->q >>= 1;
|
||||||
|
_B->i >>= 1;
|
||||||
|
_B->q >>= 1;
|
||||||
|
|
||||||
|
bi = _B->i;
|
||||||
|
bq = _B->q;
|
||||||
|
|
||||||
|
_B->i = _A->i - bi;
|
||||||
|
_B->q = _A->q - bq;
|
||||||
|
_A->i = _A->i + bi;
|
||||||
|
_A->q = _A->q + bq;
|
||||||
|
|
||||||
|
bi = _A->i*_W->i - _A->q*_W->q;
|
||||||
|
bq = _A->i*_W->q + _A->q*_W->i;
|
||||||
|
|
||||||
|
bi = (bi + 8192) >> 14;
|
||||||
|
bq = (bq + 8192) >> 14;
|
||||||
|
|
||||||
|
_A->i += (int16)bi;
|
||||||
|
_A->q += (int16)bq;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bflydf_noscale(CPX *_A, CPX *_B, MIX *_W)
|
||||||
|
{
|
||||||
|
int32 bi, bq;
|
||||||
|
|
||||||
|
bi = _B->i;
|
||||||
|
bq = _B->q;
|
||||||
|
|
||||||
|
_B->i = _A->i - bi;
|
||||||
|
_B->q = _A->q - bq;
|
||||||
|
_A->i = _A->i + bi;
|
||||||
|
_A->q = _A->q + bq;
|
||||||
|
|
||||||
|
bi = _A->i*_W->i - _A->q*_W->q;
|
||||||
|
bq = _A->i*_W->q + _A->q*_W->i;
|
||||||
|
|
||||||
|
bi = (bi + 8192) >> 14;
|
||||||
|
bq = (bq + 8192) >> 14;
|
||||||
|
|
||||||
|
_A->i += (int16)bi;
|
||||||
|
_A->q += (int16)bq;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* Include the SIMD FFT Functions */
|
||||||
|
|
||||||
|
void rank(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
|
||||||
|
{
|
||||||
|
|
||||||
|
__asm
|
||||||
|
(
|
||||||
|
".intel_syntax noprefix \n" //Use intel syntax
|
||||||
|
"push ebx\n\t"
|
||||||
|
"mov ebx, [ebp+8] \n" //A
|
||||||
|
"mov edi, [ebp+12] \n" //B
|
||||||
|
"mov edx, [ebp+20] \n" //nblocks
|
||||||
|
"mov eax, 0x00002000 \n"
|
||||||
|
"movd mm4, eax \n"
|
||||||
|
"punpckldq mm4, mm4 \n" //Low 32 bits to high 32 bits
|
||||||
|
"B%=: \n"
|
||||||
|
"mov esi, [ebp+16] \n" //W
|
||||||
|
"mov ecx, 0x0 \n"
|
||||||
|
"mov eax, [ebp+20] \n" //nblocks
|
||||||
|
"sal eax, 3 \n" //make into bytes
|
||||||
|
"S%=: \n"
|
||||||
|
"movd mm0, [ebx+ecx*4]\n" //Copy A to mm0
|
||||||
|
"movd mm1, [edi+ecx*4]\n" //Copy B to mm1
|
||||||
|
"movq mm2, [esi] \n" //Copy W to mm2
|
||||||
|
"psraw mm0, 1 \n" //Divide A by 2
|
||||||
|
"psraw mm1, 1 \n" //Divide B by 2
|
||||||
|
"movq mm3, mm0 \n" //Copy A to mm3
|
||||||
|
"punpckldq mm1, mm1 \n" //Low 32 bits to high 32 bits
|
||||||
|
"pmaddwd mm1, mm2 \n" //Multiply and add
|
||||||
|
"padddw mm1, mm4 \n"
|
||||||
|
"psrad mm1, 0xe \n" //Right shift by 14 bits
|
||||||
|
"packssdw mm1, mm1 \n" //Pack back into 16 bit interleaved
|
||||||
|
"paddw mm0, mm1 \n" //A+Bw
|
||||||
|
"psubw mm3, mm1 \n" //A-Bw
|
||||||
|
"movd [ebx+ecx*4], mm0\n" //Copy back to A
|
||||||
|
"movd [edi+ecx*4], mm3\n" //Copy back to B
|
||||||
|
"add esi, eax \n"
|
||||||
|
"add ecx, 0x1 \n"
|
||||||
|
"cmp ecx, [ebp+24] \n"
|
||||||
|
"jne S%= \n"
|
||||||
|
"sal ecx, 3 \n"
|
||||||
|
"add ebx, ecx \n"
|
||||||
|
"add edi, ecx \n"
|
||||||
|
"sub edx, 0x1 \n"
|
||||||
|
"jnz B%= \n"
|
||||||
|
"pop ebx\n\t"
|
||||||
|
"EMMS \n" //Done with MMX
|
||||||
|
".att_syntax \n" //Back to ATT syntax
|
||||||
|
:
|
||||||
|
: "m" (_A), "m" (_B), "m" (_W), "m" (_nblocks), "m" (_bsize)
|
||||||
|
: "%eax", "%ecx", "%edx", "%edi", "%esi"
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void rank_noscale(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
|
||||||
|
{
|
||||||
|
|
||||||
|
__asm
|
||||||
|
(
|
||||||
|
".intel_syntax noprefix \n" //Use intel syntax
|
||||||
|
"push ebx\n\t"
|
||||||
|
"mov ebx, [ebp+8] \n" //A
|
||||||
|
"mov edi, [ebp+12] \n" //B
|
||||||
|
"mov edx, [ebp+20] \n" //nblocks
|
||||||
|
"mov eax, 0x00002000 \n"
|
||||||
|
"movd mm4, eax \n"
|
||||||
|
"punpckldq mm4, mm4 \n" //Low 32 bits to high 32 bits
|
||||||
|
"B%=: \n"
|
||||||
|
"mov esi, [ebp+16] \n" //W
|
||||||
|
"mov ecx, 0x0 \n"
|
||||||
|
"mov eax, [ebp+20] \n" //nblocks
|
||||||
|
"sal eax, 3 \n" //make into bytes
|
||||||
|
"S%=: \n"
|
||||||
|
"movd mm0, [ebx+ecx*4]\n" //Copy A to mm0
|
||||||
|
"movd mm1, [edi+ecx*4]\n" //Copy B to mm1
|
||||||
|
"movq mm2, [esi] \n" //Copy W to mm2
|
||||||
|
"movq mm3, mm0 \n" //Copy A to mm3
|
||||||
|
"punpckldq mm1, mm1 \n" //Low 32 bits to high 32 bits
|
||||||
|
"pmaddwd mm1, mm2 \n" //Multiply and add
|
||||||
|
"padddw mm1, mm4 \n"
|
||||||
|
"psrad mm1, 0xe \n" //Right shift by 14 bits
|
||||||
|
"packssdw mm1, mm1 \n" //Pack back into 16 bit interleaved
|
||||||
|
"paddw mm0, mm1 \n" //A+Bw
|
||||||
|
"psubw mm3, mm1 \n" //A-Bw
|
||||||
|
"movd [ebx+ecx*4], mm0\n" //Copy back to A
|
||||||
|
"movd [edi+ecx*4], mm3\n" //Copy back to B
|
||||||
|
"add esi, eax \n"
|
||||||
|
"add ecx, 0x1 \n"
|
||||||
|
"cmp ecx, [ebp+24] \n"
|
||||||
|
"jne S%= \n"
|
||||||
|
"sal ecx, 3 \n"
|
||||||
|
"add ebx, ecx \n"
|
||||||
|
"add edi, ecx \n"
|
||||||
|
"sub edx, 0x1 \n"
|
||||||
|
"jnz B%= \n"
|
||||||
|
"pop ebx\n\t"
|
||||||
|
"EMMS \n" //Done with MMX
|
||||||
|
".att_syntax \n" //Back to ATT syntax
|
||||||
|
:
|
||||||
|
: "m" (_A), "m" (_B), "m" (_W), "m" (_nblocks), "m" (_bsize)
|
||||||
|
: "%eax", "%ecx", "%edx", "%edi", "%esi"
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//static void bflydf(void *_A, void *_B, void *_W)
|
||||||
|
//{
|
||||||
|
//
|
||||||
|
// __asm
|
||||||
|
// {
|
||||||
|
// mov ebx, _A;
|
||||||
|
// mov edi, _B;
|
||||||
|
// mov esi, _W;
|
||||||
|
//
|
||||||
|
// movd mm0, [ebx]; /*move 32 bits from A to bottom 32 bits of mm0*/
|
||||||
|
// movd mm1, [edi]; /*move 32 bits from B to bottom 32 bits of mm1*/
|
||||||
|
// movq mm2, [esi]; /*move 64 bits from W to mm2*/
|
||||||
|
// psraw mm0, 0x1;
|
||||||
|
// psraw mm1, 0x1;
|
||||||
|
// movq mm3, mm0; /*copy A to mm3*/
|
||||||
|
// paddw mm0, mm1; /*A+B*/
|
||||||
|
// psubw mm3, mm1; /*A-B*/
|
||||||
|
// punpckldq mm3, mm3; /*copy bottom 32 bits of B data into high 32 bits*/
|
||||||
|
// pmaddwd mm3, mm2; /*complex multiply, real now 0..31 of mm1, imag 32..63 of mm1*/
|
||||||
|
// psrad mm3, 0xf; /*right shift 0..31 by 16, 32..63 by 16*/
|
||||||
|
// packssdw mm3, mm3; /*pack bits 0..31 to 0..16, bits 32..63 to 16..31*/
|
||||||
|
// movd [ebx], mm0;
|
||||||
|
// movd [edi], mm3;
|
||||||
|
//
|
||||||
|
// EMMS;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
void rankdf(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
|
||||||
|
{
|
||||||
|
|
||||||
|
__asm
|
||||||
|
(
|
||||||
|
".intel_syntax noprefix \n" //Use intel syntax
|
||||||
|
"push ebx\n\t"
|
||||||
|
"mov ebx, [ebp+8] \n" //A
|
||||||
|
"mov edi, [ebp+12] \n" //B
|
||||||
|
"mov edx, [ebp+20] \n" //nblocks
|
||||||
|
"mov eax, 0x00002000 \n"
|
||||||
|
"movd mm4, eax \n"
|
||||||
|
"punpckldq mm4, mm4 \n" //Low 32 bits to high 32 bits
|
||||||
|
"B%=: \n"
|
||||||
|
"mov esi, [ebp+16] \n" //W
|
||||||
|
"mov ecx, [ebp+24] \n" //bsize
|
||||||
|
"mov eax, [ebp+20] \n" //nblocks
|
||||||
|
"sal eax, 3 \n" //make into bytes
|
||||||
|
"L%=: \n"
|
||||||
|
"movd mm0, [ebx] \n" //Copy A to mm0
|
||||||
|
"movd mm1, [edi] \n" //Copy B to mm1
|
||||||
|
"movq mm2, [esi] \n" //Copy W to mm2
|
||||||
|
"psraw mm0, 1 \n" //Divide A by 2
|
||||||
|
"psraw mm1, 1 \n" //Divide B by 2
|
||||||
|
"movq mm3, mm0 \n" //Copy A to mm3
|
||||||
|
"paddw mm0, mm1 \n" //A+B
|
||||||
|
"psubw mm3, mm1 \n" //A-B
|
||||||
|
"punpckldq mm3, mm3 \n" //Copy bottom 32 bits of B data into high 32 bits*/
|
||||||
|
"pmaddwd mm3, mm2 \n" //Complex multiply, real now 0..31 of mm1, imag 32..63 of mm1*/
|
||||||
|
"padddw mm3, mm4 \n"
|
||||||
|
"psrad mm3, 0xe \n" //Right shift 0..31 by 14, 32..63 by 14*/
|
||||||
|
"packssdw mm3, mm3 \n" //Pack bits 0..31 to 0..16, bits 32..63 to 16..31*/
|
||||||
|
"movd [ebx], mm0 \n" //Copy back to A
|
||||||
|
"movd [edi], mm3 \n" //Copy back to B
|
||||||
|
"add ebx, 0x4 \n"
|
||||||
|
"add edi, 0x4 \n"
|
||||||
|
"add esi, eax \n"
|
||||||
|
"loop L%= \n"
|
||||||
|
"mov ecx, [ebp+24] \n" //bsize
|
||||||
|
"sal ecx, 2 \n"
|
||||||
|
"add ebx, ecx \n"
|
||||||
|
"add edi, ecx \n"
|
||||||
|
"sub edx, 0x1 \n"
|
||||||
|
"jnz B%= \n"
|
||||||
|
"pop ebx\n\t"
|
||||||
|
"EMMS \n" //Done with MMX
|
||||||
|
".att_syntax \n" //Back to ATT syntax
|
||||||
|
:
|
||||||
|
: "m" (_A), "m" (_B), "m" (_W), "m" (_nblocks), "m" (_bsize)
|
||||||
|
: "%eax", "%ecx", "%edx", "%edi", "%esi"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void rankdf_noscale(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
|
||||||
|
{
|
||||||
|
|
||||||
|
__asm
|
||||||
|
(
|
||||||
|
".intel_syntax noprefix \n" //Use intel syntax
|
||||||
|
"push ebx\n\t"
|
||||||
|
"mov ebx, [ebp+8] \n" //A
|
||||||
|
"mov edi, [ebp+12] \n" //B
|
||||||
|
"mov edx, [ebp+20] \n" //nblocks
|
||||||
|
"mov eax, 0x00002000 \n"
|
||||||
|
"movd mm4, eax \n"
|
||||||
|
"punpckldq mm4, mm4 \n" //Low 32 bits to high 32 bits
|
||||||
|
"B%=: \n"
|
||||||
|
"mov esi, [ebp+16] \n" //W
|
||||||
|
"mov ecx, [ebp+24] \n" //bsize
|
||||||
|
"mov eax, [ebp+20] \n" //nblocks
|
||||||
|
"sal eax, 3 \n" //make into bytes
|
||||||
|
"L%=: \n"
|
||||||
|
"movd mm0, [ebx] \n" //Copy A to mm0
|
||||||
|
"movd mm1, [edi] \n" //Copy B to mm1
|
||||||
|
"movq mm2, [esi] \n" //Copy W to mm2
|
||||||
|
"movq mm3, mm0 \n" //Copy A to mm3
|
||||||
|
"paddw mm0, mm1 \n" //A+B
|
||||||
|
"psubw mm3, mm1 \n" //A-B
|
||||||
|
"punpckldq mm3, mm3 \n" //Copy bottom 32 bits of B data into high 32 bits*/
|
||||||
|
"pmaddwd mm3, mm2 \n" //Complex multiply, real now 0..31 of mm1, imag 32..63 of mm1*/
|
||||||
|
"padddw mm3, mm4 \n"
|
||||||
|
"psrad mm3, 0xe \n" //Right shift 0..31 by 14, 32..63 by 14*/
|
||||||
|
"packssdw mm3, mm3 \n" //Pack bits 0..31 to 0..16, bits 32..63 to 16..31*/
|
||||||
|
"movd [ebx], mm0 \n" //Copy back to A
|
||||||
|
"movd [edi], mm3 \n" //Copy back to B
|
||||||
|
"add ebx, 0x4 \n"
|
||||||
|
"add edi, 0x4 \n"
|
||||||
|
"add esi, eax \n"
|
||||||
|
"loop L%= \n"
|
||||||
|
"mov ecx, [ebp+24] \n" //bsize
|
||||||
|
"sal ecx, 2 \n"
|
||||||
|
"add ebx, ecx \n"
|
||||||
|
"add edi, ecx \n"
|
||||||
|
"sub edx, 0x1 \n"
|
||||||
|
"jnz B%= \n"
|
||||||
|
"pop ebx\n\t"
|
||||||
|
"EMMS \n" //Done with MMX
|
||||||
|
".att_syntax \n" //Back to ATT syntax
|
||||||
|
:
|
||||||
|
: "m" (_A), "m" (_B), "m" (_W), "m" (_nblocks), "m" (_bsize)
|
||||||
|
: "%eax", "%ecx", "%edx", "%edi", "%esi"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//void bfly(CPX *_A, CPX *_B, MIX *_W)
|
||||||
|
//{
|
||||||
|
// __asm
|
||||||
|
// (
|
||||||
|
// ".intel_syntax noprefix \n" //Use intel syntax
|
||||||
|
// "mov ebx, [ebp+8] \n" //A
|
||||||
|
// "mov edi, [ebp+12] \n" //B
|
||||||
|
// "mov esi, [ebp+16] \n" //W
|
||||||
|
// "movd mm0, [ebx] \n" //Copy A to mm0
|
||||||
|
// "movd mm1, [edi] \n" //Copy B to mm1
|
||||||
|
// "movq mm2, [esi] \n" //Copy W to mm2
|
||||||
|
// "psraw mm0, 1 \n" //Divide A by 2
|
||||||
|
// "psraw mm1, 1 \n" //Divide B by 2
|
||||||
|
// "movq mm3, mm0 \n" //Copy A to mm3
|
||||||
|
// "punpckldq mm1, mm1 \n" //Low 32 bits to high 32 bits
|
||||||
|
// "pmaddwd mm1, mm2 \n" //Multiply and add
|
||||||
|
// "psrad mm1, 0xe \n" //Right shift by 14 bits
|
||||||
|
// "packssdw mm1, mm1 \n" //Pack back into 16 bit interleaved
|
||||||
|
// "paddw mm0, mm1 \n" //A+Bw
|
||||||
|
// "psubw mm3, mm1 \n" //A-Bw
|
||||||
|
// "movd [ebx], mm0 \n" //Copy back to A
|
||||||
|
// "movd [edi], mm3 \n" //Copy back to B
|
||||||
|
// "EMMS \n" //Done with MMX
|
||||||
|
// ".att_syntax \n" //Back to ATT syntax
|
||||||
|
// :
|
||||||
|
// :
|
||||||
|
// : "%eax", "%ebx", "%ecx", "%edx", "%edi", "%esi"
|
||||||
|
// );
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//void block(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
|
||||||
|
//{
|
||||||
|
//
|
||||||
|
// __asm
|
||||||
|
// (
|
||||||
|
// ".intel_syntax noprefix \n" //Use intel syntax
|
||||||
|
// "mov ebx, [ebp+8] \n" //A
|
||||||
|
// "mov edi, [ebp+12] \n" //B
|
||||||
|
// "mov esi, [ebp+16] \n" //W
|
||||||
|
// "mov eax, [ebp+20] \n" //nblocks
|
||||||
|
// "sal eax, 3 \n" //make into bytes
|
||||||
|
// "mov ecx, [ebp+24] \n" //bsize
|
||||||
|
// "Lbsize: \n"
|
||||||
|
// "movd mm0, [ebx] \n" //Copy A to mm0
|
||||||
|
// "movd mm1, [edi] \n" //Copy B to mm1
|
||||||
|
// "movq mm2, [esi] \n" //Copy W to mm2
|
||||||
|
// "psraw mm0, 1 \n" //Divide A by 2
|
||||||
|
// "psraw mm1, 1 \n" //Divide B by 2
|
||||||
|
// "movq mm3, mm0 \n" //Copy A to mm3
|
||||||
|
// "punpckldq mm1, mm1 \n" //Low 32 bits to high 32 bits
|
||||||
|
// "pmaddwd mm1, mm2 \n" //Multiply and addint64
|
||||||
|
// "psrad mm1, 0xe \n" //Right shift by 14 bits
|
||||||
|
// "packssdw mm1, mm1 \n" //Pack back into 16 bit interleaved
|
||||||
|
// "paddw mm0, mm1 \n" //A+Bw
|
||||||
|
// "psubw mm3, mm1 \n" //A-Bw
|
||||||
|
// "movd [ebx], mm0 \n" //Copy back to A
|
||||||
|
// "movd [edi], mm3 \n" //Copy back to B
|
||||||
|
// "add ebx, 0x4 \n"
|
||||||
|
// "add edi, 0x4 \n"
|
||||||
|
// "add esi, eax \n"
|
||||||
|
// "loop Lbsize \n"
|
||||||
|
// "EMMS \n" //Done with MMX
|
||||||
|
// ".att_syntax \n" //Back to ATT syntax
|
||||||
|
// :
|
||||||
|
// :
|
||||||
|
// : "%eax", "%ebx", "%ecx", "%edx", "%edi", "%esi"
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
/*! \file fft.h
|
||||||
|
//
|
||||||
|
// FILENAME: fft.h
|
||||||
|
//
|
||||||
|
// DESCRIPTION: Defines the FFT class.
|
||||||
|
//
|
||||||
|
// DEVELOPERS: Gregory W. Heckler (2003-2009)
|
||||||
|
//
|
||||||
|
// LICENSE TERMS: Copyright (c) Gregory W. Heckler 2009
|
||||||
|
//
|
||||||
|
// This file is part of the GPS Software Defined Radio (GPS-SDR)
|
||||||
|
//
|
||||||
|
// The GPS-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 2 of
|
||||||
|
// the License, or (at your option) any later version. The GPS-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.
|
||||||
|
//
|
||||||
|
// Note: Comments within this file follow a syntax that is compatible with
|
||||||
|
// DOXYGEN and are utilized for automated document extraction
|
||||||
|
//
|
||||||
|
// Reference:
|
||||||
|
*/
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef FFT_H_
|
||||||
|
#define FFT_H_
|
||||||
|
|
||||||
|
#include "gps_sdr_defines.h"
|
||||||
|
#include "gps_sdr_signal_processing.h"
|
||||||
|
|
||||||
|
#define MAX_RANKS (16)
|
||||||
|
|
||||||
|
/*! @ingroup CLASSES
|
||||||
|
@brief /xyzzy */
|
||||||
|
class FFT
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
MIX *W; //!< Twiddle lookup array for FFT
|
||||||
|
MIX *iW; //!< Twiddle lookup array for iFFT
|
||||||
|
int32 *BRX; //!< Re-order temp array
|
||||||
|
int32 *BR; //!< Re-order index array
|
||||||
|
|
||||||
|
int32 N; //!< Length (should be 2^N!!!)
|
||||||
|
int32 M; //!< Log2(N) (number of ranks)
|
||||||
|
int32 R[16]; //!< Programmable rank scaling
|
||||||
|
|
||||||
|
void initW(); //!< Initialize twiddles
|
||||||
|
void initBR(); //!< Initialize re-order array
|
||||||
|
void doShuffle(CPX *_x); //!< Do bit-reverse shuffling
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
FFT(); //!< Initialize FFT
|
||||||
|
FFT(int32 _N); //!< Initialize FFT for 2^N
|
||||||
|
FFT(int32 _N, int32 _R[MAX_RANKS]); //!< Initialize FFT for 2^N, with ranks
|
||||||
|
~FFT(); //!< Destructor
|
||||||
|
void doFFT(CPX *_x, bool _shuf); //!< Forward FFT, decimate in time
|
||||||
|
void doiFFT(CPX *_x, bool _shuf); //!< Inverse FFT, decimate in time
|
||||||
|
void doFFTdf(CPX *_x, bool _shuf); //!< Forward FFT, decimate in frequency
|
||||||
|
void doiFFTdf(CPX *_x, bool _shuf); //!< Inverse FFT, decimate in frequency
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*FFT_H_*/
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,387 @@
|
||||||
|
#include "gps_sdr_signal_processing.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* The SV ID is _prn=ID -1
|
||||||
|
*/
|
||||||
|
void code_gen_conplex(std::complex<float>* _dest, int32 _prn, unsigned int _chip_shift) {
|
||||||
|
|
||||||
|
uint32 G1[1023];
|
||||||
|
uint32 G2[1023];
|
||||||
|
uint32 G1_register[10], G2_register[10];
|
||||||
|
uint32 feedback1, feedback2;
|
||||||
|
uint32 lcv, lcv2;
|
||||||
|
uint32 delay;
|
||||||
|
int32 prn = _prn-1; //Move the PRN code to fit an array indices
|
||||||
|
|
||||||
|
/* G2 Delays as defined in GPS-ISD-200D */
|
||||||
|
int32 delays[51] = {5, 6, 7, 8, 17, 18, 139, 140, 141, 251, 252, 254 ,255, 256, 257, 258, 469, 470, 471, 472,
|
||||||
|
473, 474, 509, 512, 513, 514, 515, 516, 859, 860, 861, 862, 145, 175, 52, 21, 237, 235, 886, 657, 634, 762,
|
||||||
|
355, 1012, 176, 603, 130, 359, 595, 68, 386};
|
||||||
|
|
||||||
|
/* A simple error check */
|
||||||
|
if((prn < 0) || (prn > 51))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < 10; lcv++)
|
||||||
|
{
|
||||||
|
G1_register[lcv] = 1;
|
||||||
|
G2_register[lcv] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Generate G1 & G2 Register */
|
||||||
|
for(lcv = 0; lcv < 1023; lcv++)
|
||||||
|
{
|
||||||
|
G1[lcv] = G1_register[0];
|
||||||
|
G2[lcv] = G2_register[0];
|
||||||
|
|
||||||
|
feedback1 = G1_register[7]^G1_register[0];
|
||||||
|
feedback2 = (G2_register[8] + G2_register[7] + G2_register[4] + G2_register[2] + G2_register[1] + G2_register[0]) & 0x1;
|
||||||
|
|
||||||
|
for(lcv2 = 0; lcv2 < 9; lcv2++)
|
||||||
|
{
|
||||||
|
G1_register[lcv2] = G1_register[lcv2+1];
|
||||||
|
G2_register[lcv2] = G2_register[lcv2+1];
|
||||||
|
}
|
||||||
|
|
||||||
|
G1_register[9] = feedback1;
|
||||||
|
G2_register[9] = feedback2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the delay */
|
||||||
|
delay = 1023 - delays[prn];
|
||||||
|
delay+=_chip_shift;
|
||||||
|
delay %= 1023;
|
||||||
|
/* Generate PRN from G1 and G2 Registers */
|
||||||
|
for(lcv = 0; lcv < 1023; lcv++)
|
||||||
|
{
|
||||||
|
_dest[lcv] = std::complex<float>(G1[(lcv+_chip_shift)%1023]^G2[delay], 0);
|
||||||
|
if(_dest[lcv].real()==0.0) //javi
|
||||||
|
{
|
||||||
|
_dest[lcv].real(-1.0);
|
||||||
|
}
|
||||||
|
delay++;
|
||||||
|
delay %= 1023;
|
||||||
|
//std::cout<<_dest[lcv].real(); //OK
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
/*!
|
||||||
|
* code_gen, generate the given prn code
|
||||||
|
* */
|
||||||
|
int32 code_gen(CPX *_dest, int32 _prn)
|
||||||
|
{
|
||||||
|
|
||||||
|
uint32 G1[1023];
|
||||||
|
uint32 G2[1023];
|
||||||
|
uint32 G1_register[10], G2_register[10];
|
||||||
|
uint32 feedback1, feedback2;
|
||||||
|
uint32 lcv, lcv2;
|
||||||
|
uint32 delay;
|
||||||
|
int32 prn = _prn-1; //Move the PRN code to fit an array indices
|
||||||
|
|
||||||
|
/* G2 Delays as defined in GPS-ISD-200D */
|
||||||
|
int32 delays[51] = {5, 6, 7, 8, 17, 18, 139, 140, 141, 251, 252, 254 ,255, 256, 257, 258, 469, 470, 471, 472,
|
||||||
|
473, 474, 509, 512, 513, 514, 515, 516, 859, 860, 861, 862, 145, 175, 52, 21, 237, 235, 886, 657, 634, 762,
|
||||||
|
355, 1012, 176, 603, 130, 359, 595, 68, 386};
|
||||||
|
|
||||||
|
/* A simple error check */
|
||||||
|
if((prn < 0) || (prn > 51))
|
||||||
|
return(0);
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < 10; lcv++)
|
||||||
|
{
|
||||||
|
G1_register[lcv] = 1;
|
||||||
|
G2_register[lcv] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Generate G1 & G2 Register */
|
||||||
|
for(lcv = 0; lcv < 1023; lcv++)
|
||||||
|
{
|
||||||
|
G1[lcv] = G1_register[0];
|
||||||
|
G2[lcv] = G2_register[0];
|
||||||
|
|
||||||
|
feedback1 = G1_register[7]^G1_register[0];
|
||||||
|
feedback2 = (G2_register[8] + G2_register[7] + G2_register[4] + G2_register[2] + G2_register[1] + G2_register[0]) & 0x1;
|
||||||
|
|
||||||
|
for(lcv2 = 0; lcv2 < 9; lcv2++)
|
||||||
|
{
|
||||||
|
G1_register[lcv2] = G1_register[lcv2+1];
|
||||||
|
G2_register[lcv2] = G2_register[lcv2+1];
|
||||||
|
}
|
||||||
|
|
||||||
|
G1_register[9] = feedback1;
|
||||||
|
G2_register[9] = feedback2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the delay */
|
||||||
|
delay = 1023 - delays[prn];
|
||||||
|
|
||||||
|
/* Generate PRN from G1 and G2 Registers */
|
||||||
|
for(lcv = 0; lcv < 1023; lcv++)
|
||||||
|
{
|
||||||
|
_dest[lcv].i = G1[lcv]^G2[delay];
|
||||||
|
_dest[lcv].q = 0;
|
||||||
|
|
||||||
|
delay++;
|
||||||
|
delay %= 1023;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(1);
|
||||||
|
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* code_gen_complex_sampled, generate GPS L1 C/A code complex for the desired SV ID and sampled to specific sampling frequency
|
||||||
|
*/
|
||||||
|
void code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, int32 _fs, unsigned int _chip_shift)
|
||||||
|
{
|
||||||
|
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
|
||||||
|
std::complex<float> _code[1023];
|
||||||
|
int32 _samplesPerCode,_codeValueIndex;
|
||||||
|
float _ts;
|
||||||
|
float _tc;
|
||||||
|
const int32 _codeFreqBasis=1023000; //Hz
|
||||||
|
const int32 _codeLength=1023;
|
||||||
|
|
||||||
|
//--- Find number of samples per spreading code ----------------------------
|
||||||
|
_samplesPerCode = round(_fs / (_codeFreqBasis / _codeLength));
|
||||||
|
|
||||||
|
//--- Find time constants --------------------------------------------------
|
||||||
|
_ts = 1/(float)_fs; // Sampling period in sec
|
||||||
|
_tc = 1/(float)_codeFreqBasis; // C/A chip period in sec
|
||||||
|
code_gen_conplex(_code,_prn,_chip_shift); //generate C/A code 1 sample per chip
|
||||||
|
//std::cout<<"ts="<<_ts<<std::endl;
|
||||||
|
//std::cout<<"tc="<<_tc<<std::endl;
|
||||||
|
//std::cout<<"sv="<<_prn<<std::endl;
|
||||||
|
for (int32 i=0;i<_samplesPerCode;i++)
|
||||||
|
{
|
||||||
|
//=== Digitizing =======================================================
|
||||||
|
|
||||||
|
//--- Make index array to read C/A code values -------------------------
|
||||||
|
// The length of the index array depends on the sampling frequency -
|
||||||
|
// number of samples per millisecond (because one C/A code period is one
|
||||||
|
// millisecond).
|
||||||
|
|
||||||
|
|
||||||
|
_codeValueIndex = ceil((_ts * ((float)i+1)) / _tc)-1;
|
||||||
|
|
||||||
|
//--- Make the digitized version of the C/A code -----------------------
|
||||||
|
// The "upsampled" code is made by selecting values form the CA code
|
||||||
|
// chip array (caCode) for the time instances of each sample.
|
||||||
|
if (i==_samplesPerCode-1){
|
||||||
|
//--- Correct the last index (due to number rounding issues) -----------
|
||||||
|
_dest[i] = _code[_codeLength-1];
|
||||||
|
|
||||||
|
}else{
|
||||||
|
_dest[i] = _code[_codeValueIndex]; //repeat the chip -> upsample
|
||||||
|
}
|
||||||
|
//std::cout<<_codeValueIndex;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
/*!
|
||||||
|
* sine_gen, generate a full scale sinusoid of frequency f with sampling frequency fs for _samps samps and put it into _dest
|
||||||
|
* */
|
||||||
|
void sine_gen(CPX *_dest, double _f, double _fs, signed int _samps) {
|
||||||
|
|
||||||
|
signed int lcv;
|
||||||
|
signed short c, s;
|
||||||
|
float phase, phase_step;
|
||||||
|
|
||||||
|
phase = 0;
|
||||||
|
phase_step = (float)TWO_PI*_f/_fs;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _samps; lcv++) {
|
||||||
|
c = (signed short)floor(16383.0*cos(phase));
|
||||||
|
s = (signed short)floor(16383.0*sin(phase));
|
||||||
|
_dest[lcv].i = c;
|
||||||
|
_dest[lcv].q = s;
|
||||||
|
|
||||||
|
phase += phase_step;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void sine_gen_complex(std::complex<float>* _dest, double _f, double _fs, unsigned int _samps) {
|
||||||
|
|
||||||
|
double phase, phase_step;
|
||||||
|
|
||||||
|
phase_step = ((double)TWO_PI*_f)/_fs;
|
||||||
|
|
||||||
|
for(unsigned int i = 0; i < _samps; i++) {
|
||||||
|
|
||||||
|
//_dest[i] = std::complex<float>(16383.0*cos(phase), 16383.0*sin(phase));
|
||||||
|
_dest[i] = std::complex<float>(cos(phase),sin(phase));
|
||||||
|
|
||||||
|
phase += phase_step;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
void sine_gen(CPX *_dest, double _f, double _fs, int32 _samps, double _p)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv;
|
||||||
|
int16 c, s;
|
||||||
|
double phase, phase_step;
|
||||||
|
|
||||||
|
phase = _p;
|
||||||
|
phase_step = (double)TWO_PI*_f/_fs;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _samps; lcv++)
|
||||||
|
{
|
||||||
|
c = (int16)floor(16383.0*cos(phase));
|
||||||
|
s = (int16)floor(16383.0*sin(phase));
|
||||||
|
_dest[lcv].i = c;
|
||||||
|
_dest[lcv].q = s;
|
||||||
|
|
||||||
|
phase += phase_step;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
/*!
|
||||||
|
* wipeoff_gen, generate a full scale sinusoid of frequency f with sampling frequency fs for _samps samps and put it into _dest
|
||||||
|
* */
|
||||||
|
void wipeoff_gen(MIX *_dest, double _f, double _fs, int32 _samps)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv;
|
||||||
|
int16 c, s;
|
||||||
|
double phase, phase_step;
|
||||||
|
|
||||||
|
phase = 0;
|
||||||
|
phase_step = (double)TWO_PI*_f/_fs;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _samps; lcv++)
|
||||||
|
{
|
||||||
|
c = (int16)floor(16383.0*cos(phase));
|
||||||
|
s = (int16)floor(16383.0*sin(phase));
|
||||||
|
_dest[lcv].i = _dest[lcv].ni = c;
|
||||||
|
_dest[lcv].q = s;
|
||||||
|
_dest[lcv].nq = -s;
|
||||||
|
|
||||||
|
phase += phase_step;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
void downsample(CPX *_dest, CPX *_source, double _fdest, double _fsource, int32 _samps)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv, k;
|
||||||
|
uint32 phase_step;
|
||||||
|
uint32 lphase, phase;
|
||||||
|
|
||||||
|
phase_step = (uint32)floor((double)4294967296.0*_fdest/_fsource);
|
||||||
|
|
||||||
|
k = lphase = phase = 0;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _samps; lcv++)
|
||||||
|
{
|
||||||
|
if(phase <= lphase)
|
||||||
|
{
|
||||||
|
_dest[k] = _source[lcv];
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
|
||||||
|
lphase = phase;
|
||||||
|
phase += phase_step;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
/*!
|
||||||
|
* Gather statistics and run AGC
|
||||||
|
* */
|
||||||
|
int32 run_agc(CPX *_buff, int32 _samps, int32 _bits, int32 _scale)
|
||||||
|
{
|
||||||
|
int32 lcv, num;
|
||||||
|
int16 max, *p;
|
||||||
|
int16 val;
|
||||||
|
|
||||||
|
p = (int16 *)&_buff[0];
|
||||||
|
|
||||||
|
val = (1 << _scale - 1);
|
||||||
|
max = 1 << _bits;
|
||||||
|
num = 0;
|
||||||
|
|
||||||
|
if(_scale)
|
||||||
|
{
|
||||||
|
for(lcv = 0; lcv < 2*_samps; lcv++)
|
||||||
|
{
|
||||||
|
p[lcv] += val;
|
||||||
|
p[lcv] >>= _scale;
|
||||||
|
if(abs(p[lcv]) > max)
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(lcv = 0; lcv < 2*_samps; lcv++)
|
||||||
|
{
|
||||||
|
if(abs(p[lcv]) > max)
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(num);
|
||||||
|
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
/*!
|
||||||
|
* Get a rough first guess of scale value to quickly initialize agc
|
||||||
|
* */
|
||||||
|
void init_agc(CPX *_buff, int32 _samps, int32 bits, int32 *scale)
|
||||||
|
{
|
||||||
|
int32 lcv;
|
||||||
|
int16 *p;
|
||||||
|
int32 max;
|
||||||
|
|
||||||
|
p = (int16 *)&_buff[0];
|
||||||
|
|
||||||
|
max = 0;
|
||||||
|
for(lcv = 0; lcv < 2*_samps; lcv++)
|
||||||
|
{
|
||||||
|
if(p[lcv] > max)
|
||||||
|
max = p[lcv];
|
||||||
|
}
|
||||||
|
|
||||||
|
scale[0] = (1 << 14) / max;
|
||||||
|
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
|
@ -0,0 +1,56 @@
|
||||||
|
#ifndef GPS_SDR_SIGNAL_PROCESSING_H_
|
||||||
|
#define GPS_SDR_SIGNAL_PROCESSING_H_
|
||||||
|
|
||||||
|
#include "gps_sdr_defines.h"
|
||||||
|
|
||||||
|
#include <complex>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Signal processing functions from gps-sdr.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
/*! @ingroup STRUCTS
|
||||||
|
* @brief Define the CPX structure, used in the Fine_Acquisition FFT */
|
||||||
|
typedef struct CPX
|
||||||
|
{
|
||||||
|
int16 i; //!< Real value
|
||||||
|
int16 q; //!< Imaginary value
|
||||||
|
} CPX;
|
||||||
|
|
||||||
|
/*! \ingroup STRUCTS
|
||||||
|
* @brief Format of complex accumulations */
|
||||||
|
typedef struct CPX_ACCUM {
|
||||||
|
|
||||||
|
int32 i; //!< Inphase (real)
|
||||||
|
int32 q; //!< Quadrature (imaginary)
|
||||||
|
|
||||||
|
} CPX_ACCUM;
|
||||||
|
|
||||||
|
|
||||||
|
/*! \ingroup STRUCTS
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef struct MIX {
|
||||||
|
|
||||||
|
int16 i; //!< Inphase (real)
|
||||||
|
int16 nq; //!< Quadrature (imaginary)
|
||||||
|
int16 q; //!< Quadrature (imaginary)
|
||||||
|
int16 ni; //!< Inphase (real)
|
||||||
|
|
||||||
|
} MIX;
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void code_gen_conplex(std::complex<float>* _dest, int32 _prn, unsigned int _chip_shift);
|
||||||
|
void code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, int32 _fs, unsigned int _chip_shift);
|
||||||
|
int32 code_gen(CPX *_dest, int32 _prn);
|
||||||
|
void sine_gen(CPX *_dest, double _f, double _fs, int32 _samps);
|
||||||
|
void sine_gen_complex(std::complex<float>* _dest, double _f, double _fs, unsigned int _samps);
|
||||||
|
void sine_gen(CPX *_dest, double _f, double _fs, int32 _samps, double _p);
|
||||||
|
void wipeoff_gen(MIX *_dest, double _f, double _fs, int32 _samps);
|
||||||
|
void downsample(CPX *_dest, CPX *_source, double _fdest, double _fsource, int32 _samps);
|
||||||
|
void init_agc(CPX *_buff, int32 _samps, int32 bits, int32 *scale);
|
||||||
|
int32 run_agc(CPX *_buff, int32 _samps, int32 bits, int32 scale);
|
||||||
|
|
||||||
|
#endif /* GPS_SDR_SIGNAL_PROCESSING_H_ */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,68 @@
|
||||||
|
/*! \file SIMD.h
|
||||||
|
Contains prototpyes for all the SIMD functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
/************************************************************************************************
|
||||||
|
Copyright 2008 Gregory W Heckler
|
||||||
|
|
||||||
|
This file is part of the GPS Software Defined Radio (GPS-SDR)
|
||||||
|
|
||||||
|
The GPS-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 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GPS-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 GPS-SDR; if not,
|
||||||
|
write to the:
|
||||||
|
|
||||||
|
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
************************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef SIMD_H_
|
||||||
|
#define SIMD_H_
|
||||||
|
|
||||||
|
|
||||||
|
//#ifdef GLOBALS_HERE
|
||||||
|
// #define EXTERN
|
||||||
|
//#else
|
||||||
|
// #define EXTERN extern
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
#include "gps_sdr_defines.h"
|
||||||
|
#include "gps_sdr_signal_processing.h"
|
||||||
|
|
||||||
|
/* Found in CPUID.cpp */
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
bool CPU_MMX(); //!< Does the CPU support MMX?
|
||||||
|
bool CPU_SSE(); //!< Does the CPU support SSE?
|
||||||
|
bool CPU_SSE2(); //!< Does the CPU support SSE2?
|
||||||
|
bool CPU_SSE3(); //!< Does the CPU support SSE3?
|
||||||
|
bool CPU_SSSE3(); //!< Does the CPU support SSSE3? No thats not a typo!
|
||||||
|
bool CPU_SSE41(); //!< Does the CPU support SSE4.1?
|
||||||
|
bool CPU_SSE42(); //!< Does the CPU support SSE4.2?
|
||||||
|
void Init_SIMD(); //!< Initialize the global function pointers
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Found in SSE.cpp */
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
void sse_add(int16 *A, int16 *B, int32 cnt) __attribute__ ((noinline)); //!< Pointwise vector addition
|
||||||
|
void sse_sub(int16 *A, int16 *B, int32 cnt) __attribute__ ((noinline)); //!< Pointwise vector difference
|
||||||
|
void sse_mul(int16 *A, int16 *B, int32 cnt) __attribute__ ((noinline)); //!< Pointwise vector multiply
|
||||||
|
int32 sse_dot(int16 *A, int16 *B, int32 cnt) __attribute__ ((noinline)); //!< Compute vector dot product
|
||||||
|
|
||||||
|
void sse_conj(CPX *A, int32 cnt) __attribute__ ((noinline)); //!< Pointwise vector conjugate
|
||||||
|
void sse_cacc(CPX *A, MIX *B, int32 cnt, int32 *iaccum, int32 *baccum) __attribute__ ((noinline)); //!< Compute dot product of cpx and a mix vector
|
||||||
|
void sse_cmul(CPX *A, CPX *B, int32 cnt) __attribute__ ((noinline)); //!< Pointwise vector multiply
|
||||||
|
void sse_cmuls(CPX *A, CPX *B, int32 cnt, int32 shift) __attribute__ ((noinline)); //!< Pointwise vector multiply with shift
|
||||||
|
void sse_cmulsc(CPX *A, CPX *B, CPX *C, int32 cnt, int32 shift) __attribute__ ((noinline)); //!< Pointwise vector multiply with shift, dump results into C
|
||||||
|
void sse_prn_accum(CPX *A, CPX *E, CPX *P, CPX *L, int32 cnt, CPX *accum) __attribute__ ((noinline)); //!< This is a long story
|
||||||
|
void sse_prn_accum_new(CPX *A, MIX *E, MIX *P, MIX *L, int32 cnt, CPX_ACCUM *accum) __attribute__ ((noinline)); //!< This is a long story
|
||||||
|
void sse_max(int32 *_A, int32 *_index, int32 *_magt, int32 _cnt) __attribute__ ((noinline));
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
#endif /*SIMD_H_*/
|
|
@ -0,0 +1,493 @@
|
||||||
|
/*! \file x86.cpp
|
||||||
|
Emulate SIMD functionality with plain x86 crap, for older processors
|
||||||
|
*/
|
||||||
|
/************************************************************************************************
|
||||||
|
Copyright 2008 Gregory W Heckler
|
||||||
|
|
||||||
|
This file is part of the GPS Software Defined Radio (GPS-SDR)
|
||||||
|
|
||||||
|
The GPS-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 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GPS-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 GPS-SDR; if not,
|
||||||
|
write to the:
|
||||||
|
|
||||||
|
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
************************************************************************************************/
|
||||||
|
|
||||||
|
#include "gps_sdr_x86.h"
|
||||||
|
#include "gr_complex.h"
|
||||||
|
#include <complex>
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
void x86_add(int16 *_A, int16 *_B, int32 _cnt)
|
||||||
|
{
|
||||||
|
|
||||||
|
int16 *a = _A;
|
||||||
|
int16 *b = _B;
|
||||||
|
int32 lcv;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _cnt; lcv++)
|
||||||
|
a[lcv] += b[lcv];
|
||||||
|
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
void x86_sub(int16 *_A, int16 *_B, int32 _cnt)
|
||||||
|
{
|
||||||
|
|
||||||
|
int16 *a = _A;
|
||||||
|
int16 *b = _B;
|
||||||
|
int32 lcv;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _cnt; lcv++)
|
||||||
|
a[lcv] -= b[lcv];
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
void x86_mul(int16 *_A, int16 *_B, int32 _cnt)
|
||||||
|
{
|
||||||
|
|
||||||
|
int16 *a = _A;
|
||||||
|
int16 *b = _B;
|
||||||
|
int32 lcv;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _cnt; lcv++)
|
||||||
|
a[lcv] *= b[lcv];
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
void x86_muls(int16 *_A, int16 *_B, int32 _cnt, int32 _shift)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _cnt; lcv++)
|
||||||
|
{
|
||||||
|
_A[lcv] *= *_B;
|
||||||
|
_A[lcv] >>= _shift;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
int32 x86_dot(int16 *_A, int16 *_B, int32 _cnt)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 accum = 0;
|
||||||
|
int16 *a = _A;
|
||||||
|
int16 *b = _B;
|
||||||
|
int32 lcv;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _cnt; lcv++)
|
||||||
|
accum += (int32)a[lcv]*(int32)b[lcv];
|
||||||
|
|
||||||
|
return(accum);
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
void x86_conj(CPX *_A, int32 _cnt)
|
||||||
|
{
|
||||||
|
int32 lcv;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _cnt; lcv++)
|
||||||
|
_A[lcv].q = -_A[lcv].q;
|
||||||
|
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
void x86_cmul(CPX *_A, CPX *_B, int32 _cnt)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv;
|
||||||
|
int32 ai, aq;
|
||||||
|
int32 bi, bq;
|
||||||
|
int32 ti, tq;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _cnt; lcv++)
|
||||||
|
{
|
||||||
|
|
||||||
|
ai = _A[lcv].i;
|
||||||
|
aq = _A[lcv].q;
|
||||||
|
bi = _B[lcv].i;
|
||||||
|
bq = _B[lcv].q;
|
||||||
|
|
||||||
|
ti = ai*bi-aq*bq;
|
||||||
|
tq = ai*bq+aq*bi;
|
||||||
|
|
||||||
|
_A[lcv].i = (int16)(ti);
|
||||||
|
_A[lcv].q = (int16)(tq);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
void x86_cmuls(CPX *_A, CPX *_B, int32 _cnt, int32 _shift)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv;
|
||||||
|
int32 ai, aq;
|
||||||
|
int32 bi, bq;
|
||||||
|
int32 ti, tq;
|
||||||
|
int32 shift;
|
||||||
|
int32 round;
|
||||||
|
|
||||||
|
shift = _shift;
|
||||||
|
round = 1 << (shift-1);
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _cnt; lcv++)
|
||||||
|
{
|
||||||
|
|
||||||
|
ai = _A[lcv].i;
|
||||||
|
aq = _A[lcv].q;
|
||||||
|
bi = _B[lcv].i;
|
||||||
|
bq = _B[lcv].q;
|
||||||
|
|
||||||
|
ti = ai*bi-aq*bq;
|
||||||
|
tq = ai*bq+aq*bi;
|
||||||
|
|
||||||
|
ti += round;
|
||||||
|
tq += round;
|
||||||
|
|
||||||
|
ti >>= shift;
|
||||||
|
tq >>= shift;
|
||||||
|
|
||||||
|
_A[lcv].i = (int16)ti;
|
||||||
|
_A[lcv].q = (int16)tq;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void x86_cmulsc_complex(std::complex<float> *_A, std::complex<float> *_B, std::complex<float> *_C, int32 _cnt) {
|
||||||
|
|
||||||
|
for(int i = 0; i < _cnt; i++) {
|
||||||
|
|
||||||
|
_C[i] = _A[i] * _B[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
void x86_cmulsc(CPX *_A, CPX *_B, CPX *_C, int32 _cnt, int32 _shift)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv;
|
||||||
|
int32 ai, aq;
|
||||||
|
int32 bi, bq;
|
||||||
|
int32 ti, tq;
|
||||||
|
int32 shift;
|
||||||
|
int32 round;
|
||||||
|
|
||||||
|
shift = _shift;
|
||||||
|
round = 1 << (shift-1);
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _cnt; lcv++)
|
||||||
|
{
|
||||||
|
|
||||||
|
ai = _A[lcv].i;
|
||||||
|
aq = _A[lcv].q;
|
||||||
|
bi = _B[lcv].i;
|
||||||
|
bq = _B[lcv].q;
|
||||||
|
|
||||||
|
ti = ai*bi-aq*bq;
|
||||||
|
tq = ai*bq+aq*bi;
|
||||||
|
|
||||||
|
ti += round;
|
||||||
|
tq += round;
|
||||||
|
|
||||||
|
ti >>= shift;
|
||||||
|
tq >>= shift;
|
||||||
|
|
||||||
|
_C[lcv].i = (int16)ti;
|
||||||
|
_C[lcv].q = (int16)tq;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
void x86_cacc(CPX *_A, MIX *_B, int32 _cnt, int32 *_iaccum, int32 *_qaccum)
|
||||||
|
{
|
||||||
|
int32 lcv;
|
||||||
|
int32 ai, aq;
|
||||||
|
int32 ti, tq;
|
||||||
|
int32 iaccum;
|
||||||
|
int32 qaccum;
|
||||||
|
|
||||||
|
iaccum = qaccum = 0;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _cnt; lcv++)
|
||||||
|
{
|
||||||
|
|
||||||
|
ai = _A[lcv].i;
|
||||||
|
aq = _A[lcv].q;
|
||||||
|
|
||||||
|
ti = ai*_B[lcv].i+aq*_B[lcv].nq;
|
||||||
|
tq = ai*_B[lcv].q+aq*_B[lcv].ni;
|
||||||
|
|
||||||
|
iaccum += ti;
|
||||||
|
qaccum += tq;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
*_iaccum = iaccum;
|
||||||
|
*_qaccum = qaccum;
|
||||||
|
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
// _A=|abs(·)|^2 overwrite the input array
|
||||||
|
void x86_gr_complex_mag(gr_complex* _A, int32 _cnt) {
|
||||||
|
float* p = (float*)_A;
|
||||||
|
|
||||||
|
for(int i=0;i<_cnt;i++) {
|
||||||
|
*p = _A[i].real()*_A[i].real() + _A[i].imag()*_A[i].imag();
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
void x86_cmag(CPX *_A, int32 _cnt)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32 lcv, *p;
|
||||||
|
|
||||||
|
p = (int32 *)_A;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _cnt; lcv++)
|
||||||
|
{
|
||||||
|
*p = _A[lcv].i*_A[lcv].i + _A[lcv].q*_A[lcv].q;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
// Find the maximum float in _A[·]
|
||||||
|
void x86_float_max(float* _A, unsigned int* _index, float* _magt, unsigned int _cnt) {
|
||||||
|
|
||||||
|
unsigned int index;
|
||||||
|
float mag;
|
||||||
|
|
||||||
|
mag = index = 0;
|
||||||
|
|
||||||
|
for(int i=0; i<_cnt; i++) {
|
||||||
|
if(_A[i] > mag) {
|
||||||
|
index = i;
|
||||||
|
mag = _A[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*_index = index;
|
||||||
|
*_magt = mag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
void x86_max(unsigned int *_A, unsigned int *_index, unsigned int *_magt, unsigned int _cnt)
|
||||||
|
{
|
||||||
|
|
||||||
|
unsigned int lcv, mag, index;
|
||||||
|
|
||||||
|
mag = index = 0;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < _cnt; lcv++)
|
||||||
|
{
|
||||||
|
if(_A[lcv] > mag)
|
||||||
|
{
|
||||||
|
index = lcv;
|
||||||
|
mag = _A[lcv];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*_index = index;
|
||||||
|
*_magt = mag;
|
||||||
|
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
void x86_prn_accum(CPX *A, CPX *E, CPX *P, CPX *L, int32 cnt, CPX *accum) //!< This is a long story
|
||||||
|
{
|
||||||
|
|
||||||
|
CPX Ea, Pa, La;
|
||||||
|
int32 lcv;
|
||||||
|
|
||||||
|
Ea.i = 0;
|
||||||
|
Ea.q = 0;
|
||||||
|
Pa.i = 0;
|
||||||
|
Pa.q = 0;
|
||||||
|
La.i = 0;
|
||||||
|
La.q = 0;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < cnt; lcv++)
|
||||||
|
{
|
||||||
|
if(E[lcv].i < 0)
|
||||||
|
{
|
||||||
|
Ea.i -= A[lcv].i;
|
||||||
|
Ea.q -= A[lcv].q;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Ea.i += A[lcv].i;
|
||||||
|
Ea.q += A[lcv].q;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(P[lcv].i < 0)
|
||||||
|
{
|
||||||
|
Pa.i -= A[lcv].i;
|
||||||
|
Pa.q -= A[lcv].q;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Pa.i += A[lcv].i;
|
||||||
|
Pa.q += A[lcv].q;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(L[lcv].i < 0)
|
||||||
|
{
|
||||||
|
La.i -= A[lcv].i;
|
||||||
|
La.q -= A[lcv].q;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
La.i += A[lcv].i;
|
||||||
|
La.q += A[lcv].q;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
accum[0].i = Ea.i;
|
||||||
|
accum[0].q = Ea.q;
|
||||||
|
accum[1].i = Pa.i;
|
||||||
|
accum[1].q = Pa.q;
|
||||||
|
accum[2].i = La.i;
|
||||||
|
accum[2].q = La.q;
|
||||||
|
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
void x86_prn_accum_new(CPX *A, MIX *E, MIX *P, MIX *L, int32 cnt, CPX_ACCUM *accum)
|
||||||
|
{
|
||||||
|
|
||||||
|
CPX_ACCUM Ea, Pa, La;
|
||||||
|
int32 lcv;
|
||||||
|
|
||||||
|
Ea.i = 0; Ea.q = 0;
|
||||||
|
Pa.i = 0; Pa.q = 0;
|
||||||
|
La.i = 0; La.q = 0;
|
||||||
|
|
||||||
|
for(lcv = 0; lcv < cnt; lcv++)
|
||||||
|
{
|
||||||
|
Ea.i += A[lcv].i*E[lcv].i;
|
||||||
|
Ea.q += A[lcv].q*E[lcv].ni;
|
||||||
|
Pa.i += A[lcv].i*P[lcv].i;
|
||||||
|
Pa.q += A[lcv].q*P[lcv].ni;
|
||||||
|
La.i += A[lcv].i*L[lcv].i;
|
||||||
|
La.q += A[lcv].q*L[lcv].ni;
|
||||||
|
}
|
||||||
|
|
||||||
|
accum[0].i = Ea.i;
|
||||||
|
accum[0].q = Ea.q;
|
||||||
|
accum[1].i = Pa.i;
|
||||||
|
accum[1].q = Pa.q;
|
||||||
|
accum[2].i = La.i;
|
||||||
|
accum[2].q = La.q;
|
||||||
|
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
//int32 x86_acc(int16 *_A, int32 _cnt)
|
||||||
|
//{
|
||||||
|
//
|
||||||
|
// int32 accum = 0;
|
||||||
|
// int16 *a = _A;
|
||||||
|
// int32 lcv;
|
||||||
|
//
|
||||||
|
// for(lcv = 0; lcv < _cnt; lcv++)
|
||||||
|
// accum += a[lcv];
|
||||||
|
//
|
||||||
|
// return(accum);
|
||||||
|
//}
|
||||||
|
//void x86_crot(CPX *_A, CPX *_B, int32 _cnt)
|
||||||
|
//{
|
||||||
|
//
|
||||||
|
// int32 lcv;
|
||||||
|
// int32 ai, aq;
|
||||||
|
// int32 bi, bq;
|
||||||
|
// int32 ti, tq;
|
||||||
|
//
|
||||||
|
// bi = _B->i;
|
||||||
|
// bq = _B->q;
|
||||||
|
//
|
||||||
|
// for(lcv = 0; lcv < _cnt; lcv++)
|
||||||
|
// {
|
||||||
|
//
|
||||||
|
// ai = _A[lcv].i;
|
||||||
|
// aq = _A[lcv].q;
|
||||||
|
//
|
||||||
|
// ti = ai*bi-aq*bq;
|
||||||
|
// tq = ai*bq+aq*bi;
|
||||||
|
//
|
||||||
|
// _A[lcv].i = (int16)ti;
|
||||||
|
// _A[lcv].q = (int16)tq;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//void x86_crot(CPX *_A, CPX *_B, int32 _shift, int32 _cnt)
|
||||||
|
//{
|
||||||
|
//
|
||||||
|
// int32 lcv;
|
||||||
|
// int32 ai, aq;
|
||||||
|
// int32 bi, bq;
|
||||||
|
// int32 ti, tq;
|
||||||
|
// int32 shift;
|
||||||
|
// int32 round;
|
||||||
|
//
|
||||||
|
// shift = _shift;
|
||||||
|
// round = 1 << (shift-1);
|
||||||
|
//
|
||||||
|
// bi = _B->i;
|
||||||
|
// bq = _B->q;
|
||||||
|
//
|
||||||
|
// for(lcv = 0; lcv < _cnt; lcv++)
|
||||||
|
// {
|
||||||
|
//
|
||||||
|
// ai = _A[lcv].i;
|
||||||
|
// aq = _A[lcv].q;
|
||||||
|
//
|
||||||
|
// ti = ai*bi-aq*bq;
|
||||||
|
// tq = ai*bq+aq*bi;
|
||||||
|
//
|
||||||
|
// ti += round;
|
||||||
|
// tq += round;
|
||||||
|
//
|
||||||
|
// ti >>= shift;
|
||||||
|
// tq >>= shift;
|
||||||
|
//
|
||||||
|
// _A[lcv].i = (int16)ti;
|
||||||
|
// _A[lcv].q = (int16)tq;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
|
@ -0,0 +1,21 @@
|
||||||
|
#include "gps_sdr_defines.h"
|
||||||
|
#include "gps_sdr_signal_processing.h"
|
||||||
|
#include "gr_complex.h"
|
||||||
|
|
||||||
|
void x86_add(int16 *A, int16 *B, int32 cnt); //!< Pointwise vector addition
|
||||||
|
void x86_sub(int16 *A, int16 *B, int32 cnt); //!< Pointwise vector difference
|
||||||
|
void x86_mul(int16 *A, int16 *B, int32 cnt); //!< Pointwise vector multiply
|
||||||
|
void x86_muls(int16 *A, int16 *B, int32 cnt, int32 shift); //!< Pointwise vector multiply
|
||||||
|
int32 x86_dot(int16 *A, int16 *B, int32 cnt); //!< Compute vector dot product
|
||||||
|
|
||||||
|
void x86_conj(CPX *A, int32 cnt); //!< Pointwise vector conjugate
|
||||||
|
void x86_cacc(CPX *A, MIX *B, int32 cnt, int32 *iaccum, int32 *baccum); //!< Compute dot product of cpx and a mix vector
|
||||||
|
void x86_cmul(CPX *A, CPX *B, int32 cnt); //!< Pointwise vector multiply
|
||||||
|
void x86_cmuls(CPX *A, CPX *B, int32 cnt, int32 shift); //!< Pointwise complex multiply with shift
|
||||||
|
void x86_cmulsc(CPX *A, CPX *B, CPX *C, int32 cnt, int32 shift); //!< Pointwise vector multiply with shift, dump results into C
|
||||||
|
void x86_cmag(CPX *A, int32 cnt); //!< Convert from complex to a power
|
||||||
|
void x86_prn_accum(CPX *A, CPX *E, CPX *P, CPX *L, int32 cnt, CPX *accum); //!< This is a long story
|
||||||
|
void x86_prn_accum_new(CPX *A, MIX *E, MIX *P, MIX *L, int32 cnt, CPX_ACCUM *accum); //!< This is a long story
|
||||||
|
void x86_max(unsigned int *_A, unsigned int *_index, unsigned int *_magt, unsigned int _cnt);
|
||||||
|
void x86_float_max(float* _A, unsigned int* _index, float* _magt, unsigned int _cnt);
|
||||||
|
void x86_gr_complex_mag(gr_complex* _A, int32 _cnt);
|
|
@ -0,0 +1,10 @@
|
||||||
|
project : build-dir ../../../build ;
|
||||||
|
|
||||||
|
obj gps_sdr_signal_processing : gps_sdr_signal_processing.cc ;
|
||||||
|
obj gnss_sdr_valve : gnss_sdr_valve.cc ;
|
||||||
|
obj pass_through : pass_through.cc ;
|
||||||
|
obj gps_sdr_fft : gps_sdr_fft.cc ;
|
||||||
|
obj gps_sdr_simd : gps_sdr_simd.cc ;
|
||||||
|
obj gps_sdr_x86 : gps_sdr_x86.cc ;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,104 @@
|
||||||
|
/*!
|
||||||
|
* \file pass_through.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "pass_through.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
PassThrough::PassThrough(ConfigurationInterface* configuration, std::string role,
|
||||||
|
unsigned int in_streams,
|
||||||
|
unsigned int out_streams) :
|
||||||
|
role_(role),
|
||||||
|
in_streams_(in_streams),
|
||||||
|
out_streams_(out_streams)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string default_item_type = "short";
|
||||||
|
|
||||||
|
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||||
|
vector_size_ = configuration->property(role + ".vector_size", 1);
|
||||||
|
|
||||||
|
if(item_type_.compare("float") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(float);
|
||||||
|
}
|
||||||
|
else if(item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
}
|
||||||
|
else if(item_type_.compare("short") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(short);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(WARNING) << item_type_ << " unrecognized item type. Using float";
|
||||||
|
item_size_ = sizeof(float);
|
||||||
|
}
|
||||||
|
|
||||||
|
kludge_copy_ = gr_make_kludge_copy(item_size_);
|
||||||
|
DLOG(INFO) << "kludge_copy(" << kludge_copy_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
PassThrough::~PassThrough()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void PassThrough::connect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "nothing to connect internally";
|
||||||
|
}
|
||||||
|
|
||||||
|
void PassThrough::disconnect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
// Nothing to disconnect
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr PassThrough::get_left_block()
|
||||||
|
{
|
||||||
|
return kludge_copy_;
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr PassThrough::get_right_block()
|
||||||
|
{
|
||||||
|
return kludge_copy_;
|
||||||
|
}
|
|
@ -0,0 +1,97 @@
|
||||||
|
/*!
|
||||||
|
* \file pass_through.h
|
||||||
|
* \brief This class represent a block that just puts its input in its
|
||||||
|
* output.
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef PASS_THROUGH_H_
|
||||||
|
#define PASS_THROUGH_H_
|
||||||
|
|
||||||
|
#include <gr_hier_block2.h>
|
||||||
|
#include <gr_kludge_copy.h>
|
||||||
|
#include <gr_file_sink.h>
|
||||||
|
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
|
||||||
|
class PassThrough : public GNSSBlockInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
PassThrough(ConfigurationInterface* configuration,
|
||||||
|
std::string role,
|
||||||
|
unsigned int in_stream,
|
||||||
|
unsigned int out_stream);
|
||||||
|
|
||||||
|
virtual ~PassThrough();
|
||||||
|
|
||||||
|
std::string role()
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
std::string implementation()
|
||||||
|
{
|
||||||
|
return "PassThrough";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string item_type()
|
||||||
|
{
|
||||||
|
return item_type_;
|
||||||
|
}
|
||||||
|
size_t vector_size()
|
||||||
|
{
|
||||||
|
return vector_size_;
|
||||||
|
}
|
||||||
|
size_t item_size()
|
||||||
|
{
|
||||||
|
return item_size_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void connect(gr_top_block_sptr top_block);
|
||||||
|
void disconnect(gr_top_block_sptr top_block);
|
||||||
|
gr_basic_block_sptr get_left_block();
|
||||||
|
gr_basic_block_sptr get_right_block();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
std::string item_type_;
|
||||||
|
size_t vector_size_;
|
||||||
|
std::string role_;
|
||||||
|
unsigned int in_streams_;
|
||||||
|
unsigned int out_streams_;
|
||||||
|
|
||||||
|
gr_kludge_copy_sptr kludge_copy_;
|
||||||
|
size_t item_size_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*PASS_THROUGH_H_*/
|
|
@ -0,0 +1,115 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_observables.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "gps_l1_ca_observables.h"
|
||||||
|
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
|
||||||
|
#include "gps_l1_ca_observables_cc.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
#include <gnuradio/gr_stream_to_vector.h>
|
||||||
|
#include <gnuradio/gr_vector_to_stream.h>
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
/* The extern keyword declares a variable or function and specifies
|
||||||
|
* that it has external linkage (its name is visible from files other
|
||||||
|
* than the one in which it's defined). When modifying a variable,
|
||||||
|
* extern specifies that the variable has static duration (it is allocated
|
||||||
|
* when the program begins and deallocated when the program ends).
|
||||||
|
* The variable is defined in main.cc
|
||||||
|
*/
|
||||||
|
extern concurrent_queue<gps_navigation_message> global_gps_nav_msg_queue;
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
GpsL1CaObservables::GpsL1CaObservables(ConfigurationInterface* configuration,
|
||||||
|
std::string role,
|
||||||
|
unsigned int in_streams,
|
||||||
|
unsigned int out_streams,
|
||||||
|
gr_msg_queue_sptr queue) :
|
||||||
|
role_(role),
|
||||||
|
in_streams_(in_streams),
|
||||||
|
out_streams_(out_streams),
|
||||||
|
queue_(queue)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string default_dump_filename = "./observables.dat";
|
||||||
|
|
||||||
|
DLOG(INFO) << "role " << role;
|
||||||
|
|
||||||
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
|
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
|
||||||
|
fs_in_ = configuration->property(role + ".fs_in", 0);
|
||||||
|
|
||||||
|
observables_ = gps_l1_ca_make_observables_cc(in_streams_, queue_, dump_);
|
||||||
|
observables_->set_fs_in(fs_in_);
|
||||||
|
|
||||||
|
DLOG(INFO) << "pseudorange(" << observables_->unique_id() << ")";
|
||||||
|
// set the navigation msg queue;
|
||||||
|
|
||||||
|
observables_->set_navigation_queue(&global_gps_nav_msg_queue);
|
||||||
|
|
||||||
|
DLOG(INFO) << "global navigation message queue assigned to observables ("<< observables_->unique_id() << ")";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GpsL1CaObservables::~GpsL1CaObservables()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void GpsL1CaObservables::connect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
// Nothing to connect internally
|
||||||
|
DLOG(INFO) << "nothing to connect internally";
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaObservables::disconnect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
// Nothing to disconnect
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gr_basic_block_sptr GpsL1CaObservables::get_left_block()
|
||||||
|
{
|
||||||
|
return observables_;
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr GpsL1CaObservables::get_right_block()
|
||||||
|
{
|
||||||
|
return observables_;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_observables.h
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GPS_L1_CA_OBSERVABLES_H_
|
||||||
|
#define GPS_L1_CA_OBSERVABLES_H_
|
||||||
|
|
||||||
|
#include "observables_interface.h"
|
||||||
|
|
||||||
|
#include "gps_l1_ca_observables_cc.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
|
||||||
|
class GpsL1CaObservables : public ObservablesInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
GpsL1CaObservables(ConfigurationInterface* configuration,
|
||||||
|
std::string role,
|
||||||
|
unsigned int in_streams,
|
||||||
|
unsigned int out_streams,
|
||||||
|
gr_msg_queue_sptr queue);
|
||||||
|
|
||||||
|
virtual ~GpsL1CaObservables();
|
||||||
|
|
||||||
|
std::string role()
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
std::string implementation()
|
||||||
|
{
|
||||||
|
return "observables";
|
||||||
|
}
|
||||||
|
|
||||||
|
void connect(gr_top_block_sptr top_block);
|
||||||
|
void disconnect(gr_top_block_sptr top_block);
|
||||||
|
gr_basic_block_sptr get_left_block();
|
||||||
|
gr_basic_block_sptr get_right_block();
|
||||||
|
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
// all blocks must have an intem_size() function implementation
|
||||||
|
size_t item_size()
|
||||||
|
{
|
||||||
|
return sizeof(gr_complex);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
gps_l1_ca_observables_cc_sptr observables_;
|
||||||
|
bool dump_;
|
||||||
|
unsigned int fs_in_;
|
||||||
|
std::string dump_filename_;
|
||||||
|
std::string role_;
|
||||||
|
unsigned int in_streams_;
|
||||||
|
unsigned int out_streams_;
|
||||||
|
gr_msg_queue_sptr queue_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,3 @@
|
||||||
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
|
obj gps_l1_ca_observables : gps_l1_ca_observables.cc ;
|
|
@ -0,0 +1,164 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright notice
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
#include <algorithm>
|
||||||
|
# include <bitset>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include "math.h"
|
||||||
|
|
||||||
|
#include "gps_l1_ca_observables_cc.h"
|
||||||
|
|
||||||
|
#include "control_message_factory.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
gps_l1_ca_observables_cc_sptr
|
||||||
|
gps_l1_ca_make_observables_cc(unsigned int nchannels, gr_msg_queue_sptr queue, bool dump) {
|
||||||
|
|
||||||
|
return gps_l1_ca_observables_cc_sptr(new gps_l1_ca_observables_cc(nchannels, queue, dump));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gps_l1_ca_observables_cc::gps_l1_ca_observables_cc(unsigned int nchannels, gr_msg_queue_sptr queue, bool dump) :
|
||||||
|
gr_block ("gps_l1_ca_observables_cc", gr_make_io_signature (nchannels, nchannels, sizeof(gnss_synchro)),
|
||||||
|
gr_make_io_signature(1, 1, sizeof(gr_complex))) {
|
||||||
|
//TODO: change output channels to have Pseudorange GNURadio signature: nchannels input (float), nchannels output (float)
|
||||||
|
// initialize internal vars
|
||||||
|
d_queue = queue;
|
||||||
|
d_dump = dump;
|
||||||
|
d_nchannels = nchannels;
|
||||||
|
d_rinex_printer.set_headers("GNSS-SDR"); //TODO: read filename from config
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
gps_l1_ca_observables_cc::~gps_l1_ca_observables_cc() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pairCompare( pair<int,gnss_synchro> a, pair<int,gnss_synchro> b)
|
||||||
|
{
|
||||||
|
return a.second.last_preamble_index < b.second.last_preamble_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||||
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) {
|
||||||
|
|
||||||
|
gnss_synchro **in = (gnss_synchro **) &input_items[0]; //Get the input samples pointer
|
||||||
|
|
||||||
|
// CONSTANTS TODO: place in a file
|
||||||
|
const float code_length_s=0.001; //1 ms
|
||||||
|
const float C_m_ms= GPS_C_m_s/1000; // The speed of light, [m/ms]
|
||||||
|
|
||||||
|
const float nav_sol_period_ms=1000;
|
||||||
|
//--- Find number of samples per spreading code ----------------------------
|
||||||
|
const signed int codeFreqBasis=1023000; //Hz
|
||||||
|
const signed int codeLength=1023;
|
||||||
|
const unsigned int samples_per_code = round(d_fs_in/ (codeFreqBasis / codeLength));
|
||||||
|
|
||||||
|
map<int,gnss_synchro> gps_words;
|
||||||
|
map<int,gnss_synchro>::iterator gps_words_iter;
|
||||||
|
|
||||||
|
map<int,float> pseudoranges;
|
||||||
|
map<int,float>::iterator pseudoranges_iter;
|
||||||
|
|
||||||
|
|
||||||
|
unsigned long int min_preamble_index;
|
||||||
|
|
||||||
|
float prn_delay_ms;
|
||||||
|
float traveltime_ms;
|
||||||
|
float pseudorange_m;
|
||||||
|
|
||||||
|
for (unsigned int i=0; i<d_nchannels ; i++)
|
||||||
|
{
|
||||||
|
if (in[i][0].valid_word) //if this channel have valid word
|
||||||
|
{
|
||||||
|
gps_words.insert(pair<int,gnss_synchro>(in[i][0].satellite_PRN,in[i][0])); //record the word structure in a map for pseudoranges
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(gps_words.size()>0)
|
||||||
|
{
|
||||||
|
// find the minimum index (nearest satellite, will be the reference)
|
||||||
|
gps_words_iter=min_element(gps_words.begin(),gps_words.end(),pairCompare);
|
||||||
|
min_preamble_index=gps_words_iter->second.last_preamble_index;
|
||||||
|
|
||||||
|
//compute the pseudoranges
|
||||||
|
for(gps_words_iter = gps_words.begin(); gps_words_iter != gps_words.end(); gps_words_iter++)
|
||||||
|
{
|
||||||
|
prn_delay_ms=gps_words_iter->second.prn_delay/(float)samples_per_code;
|
||||||
|
traveltime_ms=(float)(1000*(gps_words_iter->second.last_preamble_index-min_preamble_index))/(float)samples_per_code+GPS_STARTOFFSET_ms+prn_delay_ms;
|
||||||
|
//cout<<"traveltime ms"<<gps_words_iter->first<<" ="<<traveltime_ms<<endl;
|
||||||
|
pseudorange_m=traveltime_ms*C_m_ms;
|
||||||
|
pseudoranges.insert(pair<int,float>(gps_words_iter->first,pseudorange_m)); //record the preamble index in a map
|
||||||
|
}
|
||||||
|
|
||||||
|
// write the pseudoranges to RINEX OBS file
|
||||||
|
// 1- need a valid clock
|
||||||
|
if (d_last_nav_msg.d_satellite_PRN>0)
|
||||||
|
{
|
||||||
|
std::cout<<"d_inter_frame_sec_counter="<<d_inter_frame_sec_counter<<std::endl;
|
||||||
|
d_rinex_printer.LogRinex2Obs(d_last_nav_msg,d_inter_frame_sec_counter,pseudoranges);
|
||||||
|
}
|
||||||
|
d_inter_frame_sec_counter+=((float)NAVIGATION_OUTPUT_RATE_MS)/1000.0; //TODO: synchronize the gps time of the ephemeris with the obs
|
||||||
|
}
|
||||||
|
|
||||||
|
//debug
|
||||||
|
cout << setprecision(16);
|
||||||
|
for(pseudoranges_iter = pseudoranges.begin();
|
||||||
|
pseudoranges_iter != pseudoranges.end();
|
||||||
|
pseudoranges_iter++)
|
||||||
|
{
|
||||||
|
cout<<"Pseudoranges =("<<pseudoranges_iter->first<<","<<pseudoranges_iter->second<<")"<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gps_navigation_message nav_msg;
|
||||||
|
if (d_nav_queue->try_pop(nav_msg)==true)
|
||||||
|
{
|
||||||
|
|
||||||
|
cout<<"New ephemeris record has arrived!"<<endl;
|
||||||
|
cout<<"d_channel_ID="<<nav_msg.d_channel_ID<<endl;
|
||||||
|
cout<<"d_satellite_PRN="<<nav_msg.d_satellite_PRN<<endl;
|
||||||
|
cout<<"d_satpos_X="<<nav_msg.d_satpos_X<<endl;
|
||||||
|
cout<<"d_satpos_Y="<<nav_msg.d_satpos_Y<<endl;
|
||||||
|
cout<<"d_satpos_Z="<<nav_msg.d_satpos_Z<<endl;
|
||||||
|
cout<<"d_master_clock="<<nav_msg.d_master_clock<<endl;
|
||||||
|
cout<<"d_satClkCorr="<<nav_msg.d_satClkCorr<<endl;
|
||||||
|
cout<<"d_dtr="<<nav_msg.d_dtr<<endl;
|
||||||
|
|
||||||
|
// write ephemeris to RINES NAV file
|
||||||
|
// TODO: check operation ok
|
||||||
|
d_last_nav_msg=nav_msg;
|
||||||
|
d_inter_frame_sec_counter=0; //reset the interframe seconds counter
|
||||||
|
d_rinex_printer.LogRinex2Nav(nav_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
consume_each(1); //one by one
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright notice
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GPS_L1_CA_OBSERVABLES_CC_H
|
||||||
|
#define GPS_L1_CA_OBSERVABLES_CC_H
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include <gnuradio/gr_block.h>
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
|
||||||
|
#include <queue>
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
|
#include <boost/thread/thread.hpp>
|
||||||
|
|
||||||
|
#include "concurrent_queue.h"
|
||||||
|
|
||||||
|
#include "gps_navigation_message.h"
|
||||||
|
|
||||||
|
#include "rinex_2_1_printer.h"
|
||||||
|
|
||||||
|
#include "GPS_L1_CA.h"
|
||||||
|
|
||||||
|
class gps_l1_ca_observables_cc;
|
||||||
|
typedef boost::shared_ptr<gps_l1_ca_observables_cc> gps_l1_ca_observables_cc_sptr;
|
||||||
|
gps_l1_ca_observables_cc_sptr
|
||||||
|
gps_l1_ca_make_observables_cc(unsigned int n_channels, gr_msg_queue_sptr queue, bool dump);
|
||||||
|
|
||||||
|
|
||||||
|
class gps_l1_ca_observables_cc : public gr_block {
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend gps_l1_ca_observables_cc_sptr
|
||||||
|
gps_l1_ca_make_observables_cc(unsigned int nchannels, gr_msg_queue_sptr queue, bool dump);
|
||||||
|
|
||||||
|
gps_l1_ca_observables_cc(unsigned int nchannels, gr_msg_queue_sptr queue, bool dump);
|
||||||
|
|
||||||
|
// class private vars
|
||||||
|
gr_msg_queue_sptr d_queue;
|
||||||
|
bool d_dump;
|
||||||
|
|
||||||
|
unsigned int d_nchannels;
|
||||||
|
unsigned long int d_fs_in;
|
||||||
|
|
||||||
|
std::string d_dump_filename;
|
||||||
|
std::ofstream d_dump_file;
|
||||||
|
|
||||||
|
concurrent_queue<gps_navigation_message> *d_nav_queue; // Navigation ephemeris queue
|
||||||
|
|
||||||
|
rinex_printer d_rinex_printer; // RINEX printer class
|
||||||
|
|
||||||
|
double d_inter_frame_sec_counter; // counter for seconds between GPS frames
|
||||||
|
|
||||||
|
gps_navigation_message d_last_nav_msg; //last navigation message
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
~gps_l1_ca_observables_cc ();
|
||||||
|
|
||||||
|
void set_navigation_queue(concurrent_queue<gps_navigation_message> *nav_queue){d_nav_queue=nav_queue;}
|
||||||
|
|
||||||
|
void set_fs_in(unsigned long int fs_in) {d_fs_in=fs_in;};
|
||||||
|
|
||||||
|
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||||
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,3 @@
|
||||||
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
|
obj gps_l1_ca_observables_cc : gps_l1_ca_observables_cc.cc ;
|
|
@ -0,0 +1,3 @@
|
||||||
|
build-project adapters ;
|
||||||
|
build-project gnuradio_blocks ;
|
||||||
|
build-project libs ;
|
|
@ -0,0 +1,3 @@
|
||||||
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
|
obj rinex_2_1_printer : rinex_2_1_printer.cc ;
|
|
@ -0,0 +1,314 @@
|
||||||
|
#include "rinex_2_1_printer.h"
|
||||||
|
|
||||||
|
|
||||||
|
void rinex_printer::set_headers(std::string file_name)
|
||||||
|
{
|
||||||
|
|
||||||
|
correccio_primera_obs=1;
|
||||||
|
|
||||||
|
fp_rin = fopen((file_name+".09o").c_str(),"wt");
|
||||||
|
fp_rin_end = ftell(fp_rin);
|
||||||
|
|
||||||
|
fp_rin2 = fopen((file_name+".09n").c_str(),"wt");
|
||||||
|
fp_rin_end2 = ftell(fp_rin2);
|
||||||
|
|
||||||
|
// write RINEX headers
|
||||||
|
Rinex2ObsHeader();
|
||||||
|
Rinex2NavHeader();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
rinex_printer::rinex_printer ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
rinex_printer::~rinex_printer ()
|
||||||
|
{
|
||||||
|
fclose(fp_rin);
|
||||||
|
fclose(fp_rin2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rinex_printer::Rinex2NavHeader()
|
||||||
|
{
|
||||||
|
|
||||||
|
if(fp_rin2 != NULL)
|
||||||
|
{
|
||||||
|
//calculate UTC_TIME
|
||||||
|
time_t tiempo;
|
||||||
|
char cad[80];
|
||||||
|
struct tm *tmPtr;
|
||||||
|
tiempo = time(NULL);
|
||||||
|
tmPtr = gmtime(&tiempo);
|
||||||
|
strftime( cad, 20, "%d-%b-%y %H:%M", tmPtr );
|
||||||
|
|
||||||
|
fseek(fp_rin2, fp_rin_end2, SEEK_SET);
|
||||||
|
//fprintf(fp_rin2,"----|---1|0---|---2|0---|---3|0---|---4|0---|---5|0---|---6|0---|---7|0---|---8|\n\n");
|
||||||
|
fprintf(fp_rin2," 2.10 NAVIGATION DATA RINEX VERSION / TYPE\n");
|
||||||
|
fprintf(fp_rin2,"GNSS-SDR-mercurio CTTC %s PGM / RUN BY / DATE\n",cad);
|
||||||
|
//fprintf(fp_rin2,"CTTC MARKER NAME\n");
|
||||||
|
//fprintf(fp_rin2,"0000 MARKERNUMBER\n");
|
||||||
|
fp_rin_end2 = ftell(fp_rin2);
|
||||||
|
correccio_primera_obs=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rinex_printer::LogRinex2Nav(gps_navigation_message nav_msg){
|
||||||
|
|
||||||
|
|
||||||
|
if(fp_rin2 != NULL)
|
||||||
|
{
|
||||||
|
//double decimalday,daydecimalhour,decimalhour,decimalmin,decimalsec;
|
||||||
|
//double day,hour,minutes,seconds,enterseconds,a;
|
||||||
|
double gpstime;
|
||||||
|
struct tm *tmPtr;
|
||||||
|
time_t temps;
|
||||||
|
//1-Calcul data i hora gps
|
||||||
|
//Calculo el any,mes i dia a partir de l'hora UTC
|
||||||
|
//calculate UTC_TIME
|
||||||
|
char cad1[80];
|
||||||
|
char cad2[80];
|
||||||
|
//calculate date of gps time:
|
||||||
|
double setmanes=nav_msg.d_GPS_week+1024;
|
||||||
|
//Days & weeks between 00h 1 Jan 1970 and 00h 6 Jan 1980
|
||||||
|
//520 weeks and 12 days.
|
||||||
|
gpstime=nav_msg.d_master_clock;
|
||||||
|
temps=(520+setmanes)*7*24*3600+gpstime+17*24*3600;
|
||||||
|
|
||||||
|
tmPtr = gmtime(&temps);
|
||||||
|
strftime( cad1, 20, "%y %m %d", tmPtr );
|
||||||
|
//std::cout<<"gps_time="<<cad1<<std::endl;
|
||||||
|
|
||||||
|
sprintf(cad2,"%2.0f %2.0f %3.1f",(double)tmPtr->tm_hour,(double)tmPtr->tm_min,(double)tmPtr->tm_sec);
|
||||||
|
|
||||||
|
if(correccio_primera_obs==1){
|
||||||
|
//Escriure CORRECCIO DE TEMPS GPS a0 i a1;
|
||||||
|
fseek(fp_rin2, fp_rin_end2, SEEK_SET);
|
||||||
|
char correction[256],correction2[256];
|
||||||
|
double A0,A1;
|
||||||
|
/* 8.3819D-09 -7.4506D-09 -5.9605D-08 5.9605D-08 ION ALPHA
|
||||||
|
8.8 064D+04 -3.2768D+04 -1.9661D+05 1.9661D+05 ION BETA
|
||||||
|
5. 587935447693D-09 8.881784197001D-15 233472 1518 DELTA-UTC: A0,A1,T,W*/
|
||||||
|
A0=587.935447693E-09;
|
||||||
|
A1=8.881784197001E-15;
|
||||||
|
sprintf(correction,"%19.12E",A0);
|
||||||
|
sprintf(correction2,"%19.12E",A1);
|
||||||
|
double alpha0,alpha1,alpha2,alpha3,beta0,beta1,beta2,beta3;
|
||||||
|
alpha0=8.3819E-09;
|
||||||
|
alpha1=-7.4506E-09;
|
||||||
|
alpha2=-5.9605E-08;
|
||||||
|
alpha3=5.9605E-08;
|
||||||
|
beta0=064E+04;
|
||||||
|
beta1=-3.2768E+04;
|
||||||
|
beta2=-1.9661E+05;
|
||||||
|
beta3= 1.9661E+05;
|
||||||
|
//Format(&correction[0],1);
|
||||||
|
//Format(&correction2[0],1);
|
||||||
|
//fp_rin_correction_time = ftell(fp_rin2);
|
||||||
|
// fprintf(fp_rin2," %12.4E%12.4E%12.4E%12.4E ION ALPHA\n",alpha0,alpha1,alpha2,alpha3);
|
||||||
|
// fprintf(fp_rin2," %12.4E%12.4E%12.4E%12.4E ION BETA\n",beta0,beta1,beta2,beta3);
|
||||||
|
fprintf(fp_rin2," %s%s%9.0f%9d DELTA-UTC: A0,A1,T,W\n",correction,correction2,gpstime,(int)nav_msg.d_GPS_week+1024);
|
||||||
|
fprintf(fp_rin2," 15 LEAP SECONDS\n");
|
||||||
|
|
||||||
|
fprintf(fp_rin2," END OF HEADER\n");
|
||||||
|
fp_rin_end2 = ftell(fp_rin2);
|
||||||
|
correccio_primera_obs=0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//preparacio lines de efemerides per imprimir!!!
|
||||||
|
char linia0[256],linia1[256],linia2[256],linia3[256],linia4[256],linia5[256],linia6[256],linia7[256];
|
||||||
|
char idef[256];
|
||||||
|
sprintf(idef,"%2.0d",nav_msg.d_satellite_PRN);
|
||||||
|
|
||||||
|
sprintf(linia0,"%19.12E%19.12E%19.12E",nav_msg.d_A_f0,nav_msg.d_A_f1,nav_msg.d_A_f2);
|
||||||
|
|
||||||
|
sprintf(linia1,"%19.12E%19.12E%19.12E%19.12E",nav_msg.d_IODE_SF2,nav_msg.d_Crs,nav_msg.d_Delta_n,nav_msg.d_M_0);
|
||||||
|
sprintf(linia2,"%19.12E%19.12E%19.12E%19.12E",nav_msg.d_Cuc,nav_msg.d_e_eccentricity,nav_msg.d_Cus,nav_msg.d_sqrt_A);
|
||||||
|
sprintf(linia3,"%19.12E%19.12E%19.12E%19.12E",nav_msg.d_Toe,nav_msg.d_Cic,nav_msg.d_OMEGA0,nav_msg.d_Cis);
|
||||||
|
sprintf(linia4,"%19.12E%19.12E%19.12E%19.12E",nav_msg.d_i_0,nav_msg.d_Crc,nav_msg.d_OMEGA,nav_msg.d_OMEGA_DOT);
|
||||||
|
|
||||||
|
sprintf(linia5,"%19.12E%19.12E%19.12E%19.12E",nav_msg.d_IDOT,0.0,nav_msg.d_GPS_week+1024.0,0.0);//CodeL2, L2pData
|
||||||
|
sprintf(linia6,"%19.12E%19.12E%19.12E%19.12E",nav_msg.d_SV_accuracy,nav_msg.d_SV_health,nav_msg.d_TGD,nav_msg.d_IODC);
|
||||||
|
sprintf(linia7,"%19.12E%19.12E",nav_msg.d_TOW,0.0); //fit interval is set to 0
|
||||||
|
|
||||||
|
fseek(fp_rin2, fp_rin_end2, SEEK_SET);
|
||||||
|
|
||||||
|
fprintf(fp_rin2,"%s %s %s%s\n",idef,cad1,cad2,linia0);
|
||||||
|
|
||||||
|
fprintf(fp_rin2," %s\n",linia1);
|
||||||
|
|
||||||
|
fprintf(fp_rin2," %s\n",linia2);
|
||||||
|
|
||||||
|
fprintf(fp_rin2," %s\n",linia3);
|
||||||
|
|
||||||
|
fprintf(fp_rin2," %s\n",linia4);
|
||||||
|
|
||||||
|
fprintf(fp_rin2," %s\n",linia5);
|
||||||
|
|
||||||
|
fprintf(fp_rin2," %s\n",linia6);
|
||||||
|
|
||||||
|
fprintf(fp_rin2," %s\n",linia7);
|
||||||
|
fp_rin_end2 = ftell(fp_rin2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void rinex_printer::Rinex2ObsHeader()
|
||||||
|
{
|
||||||
|
//Clock_S *pClock = &tNav.master_clock; /* Clock solution */
|
||||||
|
if(fp_rin != NULL)
|
||||||
|
{
|
||||||
|
//calculate UTC_TIME
|
||||||
|
time_t tiempo;
|
||||||
|
char cad[80];
|
||||||
|
struct tm *tmPtr;
|
||||||
|
tiempo = time(NULL);
|
||||||
|
tmPtr = gmtime(&tiempo);
|
||||||
|
strftime( cad, 24, "%d/%m/%Y %H:%M:%S", tmPtr );
|
||||||
|
|
||||||
|
fseek(fp_rin, fp_rin_end, SEEK_SET);
|
||||||
|
//fprintf(fp_rin,"----|---1|0---|---2|0---|---3|0---|---4|0---|---5|0---|---6|0---|---7|0---|---8|\n\n");
|
||||||
|
fprintf(fp_rin," 2.10 Observation G (GPS) RINEX VERSION / TYPE\n");
|
||||||
|
fprintf(fp_rin,"GNSS-SDR-mercurio CTTC %s PGM / RUN BY / DATE\n",cad);
|
||||||
|
fprintf(fp_rin,"CTTC MARKER NAME\n");
|
||||||
|
//fprintf(fp_rin,"0000 MARKERNUMBER\n");
|
||||||
|
|
||||||
|
fprintf(fp_rin,"JAVIER ARRIBAS CTTC OBSERVER / AGENCY\n");
|
||||||
|
fprintf(fp_rin,"GNSS-SDR-mercurio SDR 1.0 REC # / TYPE / VERS\n");
|
||||||
|
fprintf(fp_rin,"0000000000 CTTC00000.00 ANT # / TYPE\n");
|
||||||
|
fprintf(fp_rin," 4797642.2790 166436.1500 4185504.6370 APPROX POSITION XYZ\n");
|
||||||
|
fprintf(fp_rin," 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N\n");
|
||||||
|
fprintf(fp_rin," 1 0 WAVELENGTH FACT L1/2\n");
|
||||||
|
fprintf(fp_rin," 2 C1 L1 # / TYPES OF OBSERV\n");
|
||||||
|
|
||||||
|
fprintf(fp_rin," 0.1000 INTERVAL\n");
|
||||||
|
//INTRODUIR HORA PRIMERA OBSERVACIO
|
||||||
|
//ho escriure un cop hagi adquirit dades
|
||||||
|
//fprintf(fp_rin," 2001 3 24 13 10 36.0000000 TIME OF FIRST OBS\n");
|
||||||
|
//fprintf(fp_rin," END OF HEADER\n");
|
||||||
|
fp_rin_end = ftell(fp_rin);
|
||||||
|
temps_primera_obs=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void rinex_printer::LogRinex2Obs(gps_navigation_message nav_msg,double interframe_seconds, std::map<int,float> pseudoranges)
|
||||||
|
{
|
||||||
|
int ss;
|
||||||
|
char sat_vis[36];
|
||||||
|
for(int i=0;i<36;i++) sat_vis[i]=' ';
|
||||||
|
char packet[80];
|
||||||
|
int index=0;
|
||||||
|
char cad[2];
|
||||||
|
double setmanes;
|
||||||
|
std::map<int,float>::iterator pseudoranges_iter;
|
||||||
|
|
||||||
|
//necessito
|
||||||
|
//1-Data i hora<--- de struct Clock_S
|
||||||
|
//2-#sat visibles, identificador dat visibles-----> de Com fa a LogNav() // (Chan_Packet_S *) &tChan[lcv]->sv
|
||||||
|
//3-pseudodistancia de cada satèl·lit ----> Com fa a LogPseudo(), tb es pot treure la carrier_phase. Serveix per algo??
|
||||||
|
//4- El punt 1 i 2 s'han d'escriure a la mateixa línia. El punt 3 una línia per a cada satèl·lit.
|
||||||
|
if(fp_rin != NULL)
|
||||||
|
{
|
||||||
|
setmanes=nav_msg.d_GPS_week + 1024;
|
||||||
|
//1-Calcul data i hora gps
|
||||||
|
//Calculo el any,mes i dia a partir de l'hora UTC
|
||||||
|
//calculate UTC_TIME
|
||||||
|
time_t temps;
|
||||||
|
char cad1[80];
|
||||||
|
char cad2[80];
|
||||||
|
char cad3[80];
|
||||||
|
char cad4[80];
|
||||||
|
struct tm *tmPtr;
|
||||||
|
//Calculo hora, minut, segons a partir de pClocK.time =hora GPS
|
||||||
|
double decimalday,daydecimalhour,decimalhour,decimalmin,decimalsec;
|
||||||
|
double day,hour,minutes,seconds,enterseconds,a;
|
||||||
|
double gpstime;
|
||||||
|
gpstime=nav_msg.d_master_clock;
|
||||||
|
//calculate date of gps time:
|
||||||
|
//Days & weeks between 00h 1 Jan 1970 and 00h 6 Jan 1980
|
||||||
|
//520 weeks and 12 days.
|
||||||
|
|
||||||
|
temps=(520+setmanes)*7*24*3600+gpstime+17*24*3600;
|
||||||
|
tmPtr = gmtime(&temps);
|
||||||
|
strftime( cad1, 20, " %y %m %d", tmPtr );
|
||||||
|
strftime( cad2, 20, " %Y %m %d", tmPtr );
|
||||||
|
decimalday=((gpstime+interframe_seconds)/(24*3600));//Dies dins de la semana
|
||||||
|
daydecimalhour=modf(decimalday,&day);//day=#dies sencers, daydecimalhour=porcio de dia
|
||||||
|
daydecimalhour=daydecimalhour*24;//porcio de dia en hores
|
||||||
|
decimalhour=modf(daydecimalhour,&hour);//hour=hora del dia; decimalhour=porcio d'hora
|
||||||
|
decimalmin=decimalhour*60;//decimalmin=minuts del dia amb decimal
|
||||||
|
decimalsec=modf(decimalmin,&minutes);//minutes=minuts del dia enters,decimalsec=porcio de minuts
|
||||||
|
seconds=decimalsec*60;//seconds=segons del dia en decimal
|
||||||
|
|
||||||
|
a=modf(seconds,&enterseconds);
|
||||||
|
sprintf(cad4,"%6.0f%6.0f%13.7f",hour,minutes,seconds);
|
||||||
|
sprintf(cad3," %2.0f %2.0f%11.7f",hour,minutes,seconds);
|
||||||
|
|
||||||
|
//TODO: Include receiver clock offset
|
||||||
|
if(temps_primera_obs==1){
|
||||||
|
//Escriure Hora Primera Observació
|
||||||
|
fseek(fp_rin, fp_rin_end, SEEK_SET);
|
||||||
|
fprintf(fp_rin,"%s%s GPS TIME OF FIRST OBS\n",cad2,cad4);
|
||||||
|
fprintf(fp_rin,"00000CTTC MARKER NUMBER\n");
|
||||||
|
//fprintf(fp_rin,"Edited by .... COMMENT\n");
|
||||||
|
fprintf(fp_rin," END OF HEADER\n");
|
||||||
|
fp_rin_end = ftell(fp_rin);
|
||||||
|
temps_primera_obs=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//2-Num sat visibles i identificador
|
||||||
|
signed long int nsvs = 0;
|
||||||
|
|
||||||
|
//3-Escriure pseudodistancia
|
||||||
|
for(pseudoranges_iter = pseudoranges.begin();
|
||||||
|
pseudoranges_iter != pseudoranges.end();
|
||||||
|
pseudoranges_iter++)
|
||||||
|
{
|
||||||
|
//PER FORMAT RINEX2
|
||||||
|
nsvs++;
|
||||||
|
sprintf(cad,"%2.0f",(double)pseudoranges_iter->first); //satellite PRN ID
|
||||||
|
int k=3*index;
|
||||||
|
sat_vis[k]='G';
|
||||||
|
sat_vis[k+1]=cad[0];
|
||||||
|
sat_vis[k+2]=cad[1];
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
//sat_vis tinc vector de identif de sat visibles
|
||||||
|
//Per format RINEX2
|
||||||
|
//sprintf(packet,"%s%s 0%3d%s%12.9f",cad1,cad3,nsvs,sat_vis,offset);
|
||||||
|
sprintf(packet,"%s%s 0%3d%s",cad1,cad3,nsvs,sat_vis);
|
||||||
|
packet[69]=packet[68];
|
||||||
|
packet[68]=' ';
|
||||||
|
fseek(fp_rin, fp_rin_end, SEEK_SET);
|
||||||
|
fprintf(fp_rin,"%s\n",packet);
|
||||||
|
fp_rin_end = ftell(fp_rin);
|
||||||
|
|
||||||
|
//3-Escriure pseudodistancia
|
||||||
|
for(pseudoranges_iter = pseudoranges.begin();
|
||||||
|
pseudoranges_iter != pseudoranges.end();
|
||||||
|
pseudoranges_iter++)
|
||||||
|
{
|
||||||
|
ss=signalstrength(54.00); // TODO: include estimated signal strength
|
||||||
|
fseek(fp_rin, fp_rin_end, SEEK_SET);
|
||||||
|
fprintf(fp_rin,"%14.3f %14.3f %d\n",pseudoranges_iter->second,0.0,ss); //TODO: include the carrier phase
|
||||||
|
fp_rin_end = ftell(fp_rin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int rinex_printer::signalstrength( double snr)
|
||||||
|
{
|
||||||
|
int ss;
|
||||||
|
if(snr<=12.00) ss=1;
|
||||||
|
else if(snr>12.00 && snr<=18.00) ss=2;
|
||||||
|
else if(snr>18.00 && snr<=24.00) ss=3;
|
||||||
|
else if(snr>24.00 && snr<=30.00) ss=4;
|
||||||
|
else if(snr>30.00 && snr<=36.00) ss=5;
|
||||||
|
else if(snr>36.00 && snr<=42.00) ss=6;
|
||||||
|
else if(snr>42.00 && snr<=48.00) ss=7;
|
||||||
|
else if(snr>48.00 && snr<=54) ss=8;
|
||||||
|
else if(snr>=54.00) ss=9;
|
||||||
|
return (ss);
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
/**
|
||||||
|
* Copyright notice
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef RINEX_PRINTER_H_
|
||||||
|
#define RINEX_PRINTER_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <map>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include "gps_navigation_message.h"
|
||||||
|
|
||||||
|
class rinex_printer
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
int temps_primera_obs; //per saber si he escrit el temps de la primera observació.
|
||||||
|
int correccio_primera_obs; //per saber si he escrit l correccio de temps de la primera observació.
|
||||||
|
int primeravegada;//per evitar problemes primera pseudodistancia
|
||||||
|
int PERMIS_RINEX; //PER DEIXAR ESCRIURE PER PRIMERA VEGADA AL RINEX
|
||||||
|
|
||||||
|
FILE *fp_rin; //!< RINEX OBS FILE Output
|
||||||
|
FILE *fp_rin2; //!< RINEX NAV FILE Output
|
||||||
|
unsigned long int fp_rin_end; //!< Hold place of last RINEX OBS FILE pointer, minus the header
|
||||||
|
unsigned long int fp_rin_end2; //!< Hold place of last RINEX NAV FILE pointer, minus the header
|
||||||
|
|
||||||
|
int signalstrength( double snr);
|
||||||
|
void Rinex2ObsHeader();
|
||||||
|
void Rinex2NavHeader();
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void set_headers(std::string file_name);
|
||||||
|
void LogRinex2Nav(gps_navigation_message nav_msg);
|
||||||
|
void LogRinex2Obs(gps_navigation_message nav_msg,double interframe_seconds, std::map<int,float> pseudoranges);
|
||||||
|
rinex_printer();
|
||||||
|
~rinex_printer();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,105 @@
|
||||||
|
/*!
|
||||||
|
* \file file_output_filter.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "file_output_filter.h"
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
#include <gr_io_signature.h>
|
||||||
|
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
FileOutputFilter::FileOutputFilter(ConfigurationInterface* configuration,
|
||||||
|
std::string role,
|
||||||
|
unsigned int in_streams,
|
||||||
|
unsigned int out_streams) :
|
||||||
|
role_(role),
|
||||||
|
in_streams_(in_streams),
|
||||||
|
out_streams_(out_streams)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string default_filename = "./data/signal.dat";
|
||||||
|
std::string default_item_type = "short";
|
||||||
|
|
||||||
|
filename_ = configuration->property(role + ".filename", default_filename);
|
||||||
|
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||||
|
|
||||||
|
if(item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
}
|
||||||
|
else if(item_type_.compare("float") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(float);
|
||||||
|
}
|
||||||
|
else if(item_type_.compare("short") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(short);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(WARNING) << item_type_ << " Unrecognized item type. Using short.";
|
||||||
|
item_size_ = sizeof(short);
|
||||||
|
}
|
||||||
|
|
||||||
|
file_sink_ = gr_make_file_sink(item_size_, filename_.c_str());
|
||||||
|
|
||||||
|
DLOG(INFO) << "file sink(" << file_sink_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
FileOutputFilter::~FileOutputFilter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void FileOutputFilter::connect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "nothing to connect internally";
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileOutputFilter::disconnect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
// Nothing to disconnect internally
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr FileOutputFilter::get_left_block()
|
||||||
|
{
|
||||||
|
return file_sink_;
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr FileOutputFilter::get_right_block()
|
||||||
|
{
|
||||||
|
return file_sink_;
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
/*!
|
||||||
|
* \file file_output_filter.h
|
||||||
|
* \brief This class represents an output filter that sends its output
|
||||||
|
* to a file without any change in the data format.
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_FILE_OUTPUT_FILTER_H_
|
||||||
|
#define GNSS_SDR_FILE_OUTPUT_FILTER_H_
|
||||||
|
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
|
||||||
|
#include <gr_file_sink.h>
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
|
||||||
|
class FileOutputFilter : public GNSSBlockInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
FileOutputFilter(ConfigurationInterface* configuration,
|
||||||
|
std::string role,
|
||||||
|
unsigned int in_streams,
|
||||||
|
unsigned int out_streams);
|
||||||
|
|
||||||
|
virtual ~FileOutputFilter();
|
||||||
|
|
||||||
|
std::string role()
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
std::string implementation()
|
||||||
|
{
|
||||||
|
return "FileOutputFilter";
|
||||||
|
}
|
||||||
|
size_t item_size()
|
||||||
|
{
|
||||||
|
return item_size_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void connect(gr_top_block_sptr top_block);
|
||||||
|
void disconnect(gr_top_block_sptr top_block);
|
||||||
|
gr_basic_block_sptr get_left_block();
|
||||||
|
gr_basic_block_sptr get_right_block();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
gr_file_sink_sptr file_sink_;
|
||||||
|
size_t item_size_;
|
||||||
|
|
||||||
|
std::string filename_;
|
||||||
|
std::string item_type_;
|
||||||
|
std::string role_;
|
||||||
|
unsigned int in_streams_;
|
||||||
|
unsigned int out_streams_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*GNSS_SDR_FILE_OUTPUT_FILTER_H_*/
|
|
@ -0,0 +1,4 @@
|
||||||
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
|
obj file_output_filter : file_output_filter.cc ;
|
||||||
|
obj null_sink_output_filter : null_sink_output_filter.cc ;
|
|
@ -0,0 +1,102 @@
|
||||||
|
/*!
|
||||||
|
* \file null_sink_output_filter.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "null_sink_output_filter.h"
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
#include <gr_io_signature.h>
|
||||||
|
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
NullSinkOutputFilter::NullSinkOutputFilter(ConfigurationInterface* configuration,
|
||||||
|
std::string role,
|
||||||
|
unsigned int in_streams,
|
||||||
|
unsigned int out_streams) :
|
||||||
|
role_(role),
|
||||||
|
in_streams_(in_streams),
|
||||||
|
out_streams_(out_streams)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string default_item_type = "short";
|
||||||
|
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||||
|
|
||||||
|
if(item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
}
|
||||||
|
else if(item_type_.compare("short") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(short);
|
||||||
|
}
|
||||||
|
else if(item_type_.compare("float") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(float);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(WARNING) << item_type_ << " unrecognized item type. Usign float";
|
||||||
|
item_size_ = sizeof(float);
|
||||||
|
}
|
||||||
|
|
||||||
|
sink_ = gr_make_null_sink(item_size_);
|
||||||
|
DLOG(INFO) << "null_sink(" << sink_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
NullSinkOutputFilter::~NullSinkOutputFilter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void NullSinkOutputFilter::connect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "nothing to connect internally";
|
||||||
|
}
|
||||||
|
|
||||||
|
void NullSinkOutputFilter::disconnect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
// Nothing to connect
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr NullSinkOutputFilter::get_left_block()
|
||||||
|
{
|
||||||
|
return sink_;
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr NullSinkOutputFilter::get_right_block()
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(WARNING) << "Right block of a signal sink should not be retrieved";
|
||||||
|
return gr_block_sptr();
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*!
|
||||||
|
* \file null_sink_output_filter.h
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
*
|
||||||
|
* This class represents an implementation of an output filter that
|
||||||
|
* sends its input to a null sink.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NULL_SINK_OUTPUT_FILTER_H_
|
||||||
|
#define NULL_SINK_OUTPUT_FILTER_H_
|
||||||
|
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
|
||||||
|
#include <gr_null_sink.h>
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
|
||||||
|
class NullSinkOutputFilter : public GNSSBlockInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
NullSinkOutputFilter(ConfigurationInterface* configuration,
|
||||||
|
std::string role,
|
||||||
|
unsigned int in_streams,
|
||||||
|
unsigned int out_streams);
|
||||||
|
|
||||||
|
virtual ~NullSinkOutputFilter();
|
||||||
|
|
||||||
|
std::string item_type()
|
||||||
|
{
|
||||||
|
return item_type_;
|
||||||
|
}
|
||||||
|
std::string role()
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
std::string implementation()
|
||||||
|
{
|
||||||
|
return "NullSinkOutputFilter";
|
||||||
|
}
|
||||||
|
size_t item_size()
|
||||||
|
{
|
||||||
|
return item_size_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void connect(gr_top_block_sptr top_block);
|
||||||
|
void disconnect(gr_top_block_sptr top_block);
|
||||||
|
gr_basic_block_sptr get_left_block();
|
||||||
|
gr_basic_block_sptr get_right_block();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
gr_block_sptr sink_;
|
||||||
|
size_t item_size_;
|
||||||
|
|
||||||
|
std::string item_type_;
|
||||||
|
std::string role_;
|
||||||
|
|
||||||
|
unsigned int in_streams_;
|
||||||
|
unsigned int out_streams_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*NULL_SINK_OUTPUT_FILTER_H_*/
|
|
@ -0,0 +1,2 @@
|
||||||
|
build-project adapters ;
|
||||||
|
# build-project gnuradio_blocks ;
|
|
@ -0,0 +1,252 @@
|
||||||
|
/*!
|
||||||
|
* \file file_signal_source.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
* Javier Arribas, 2011 jarribas(at)cttc.es
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "file_signal_source.h"
|
||||||
|
|
||||||
|
#include "gnss_sdr_valve.h"
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
|
||||||
|
std::string role, unsigned int in_streams, unsigned int out_streams,
|
||||||
|
gr_msg_queue_sptr queue) :
|
||||||
|
role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(
|
||||||
|
queue)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string default_filename = "./signal_samples/signal.dat";
|
||||||
|
std::string default_item_type = "short";
|
||||||
|
std::string default_dump_filename = "./data/signal_source.dat";
|
||||||
|
|
||||||
|
samples_ = configuration->property(role + ".samples", 0);
|
||||||
|
sampling_frequency_ = configuration->property(role
|
||||||
|
+ ".sampling_frequency", 0);
|
||||||
|
filename_ = configuration->property(role + ".filename", default_filename);
|
||||||
|
item_type_ = configuration->property(role + ".item_type",
|
||||||
|
default_item_type);
|
||||||
|
repeat_ = configuration->property(role + ".repeat", false);
|
||||||
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
|
dump_filename_ = configuration->property(role + ".dump_filename",
|
||||||
|
default_dump_filename);
|
||||||
|
enable_throttle_control_ = configuration->property(role
|
||||||
|
+ ".enable_throttle_control", false);
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
}
|
||||||
|
else if (item_type_.compare("float") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(float);
|
||||||
|
}
|
||||||
|
else if (item_type_.compare("short") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(short);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(WARNING) << item_type_
|
||||||
|
<< " unrecognized item type. Using short.";
|
||||||
|
item_size_ = sizeof(short);
|
||||||
|
}
|
||||||
|
|
||||||
|
file_source_
|
||||||
|
= gr_make_file_source(item_size_, filename_.c_str(), repeat_);
|
||||||
|
DLOG(INFO) << "file_source(" << file_source_->unique_id() << ")";
|
||||||
|
|
||||||
|
// if samples != 0 then enable a flow valve to stop the process after n samples
|
||||||
|
if (samples_ != 0)
|
||||||
|
{
|
||||||
|
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
|
||||||
|
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str());
|
||||||
|
DLOG(INFO) << "file_sink(" << sink_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enable_throttle_control_)
|
||||||
|
{
|
||||||
|
throttle_ = gr_make_throttle(item_size_, sampling_frequency_);
|
||||||
|
}
|
||||||
|
DLOG(INFO) << "File source filename " << filename_;
|
||||||
|
DLOG(INFO) << "Samples " << samples_;
|
||||||
|
DLOG(INFO) << "Sampling frequency " << sampling_frequency_;
|
||||||
|
DLOG(INFO) << "Item type " << item_type_;
|
||||||
|
DLOG(INFO) << "Item size " << item_size_;
|
||||||
|
DLOG(INFO) << "Repeat " << repeat_;
|
||||||
|
DLOG(INFO) << "Dump " << dump_;
|
||||||
|
DLOG(INFO) << "Dump filename " << dump_filename_;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FileSignalSource::~FileSignalSource()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileSignalSource::connect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
if (samples_ != 0)
|
||||||
|
{
|
||||||
|
if (enable_throttle_control_ == true)
|
||||||
|
{
|
||||||
|
top_block->connect(file_source_, 0, throttle_, 0);
|
||||||
|
DLOG(INFO) << "connected file source to throttle";
|
||||||
|
top_block->connect(throttle_, 0, valve_, 0);
|
||||||
|
DLOG(INFO) << "connected throttle to valve";
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->connect(valve_, 0, sink_, 0);
|
||||||
|
DLOG(INFO) << "connected valve to file sink";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
top_block->connect(file_source_, 0, valve_, 0);
|
||||||
|
DLOG(INFO) << "connected file source to valve";
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->connect(valve_, 0, sink_, 0);
|
||||||
|
DLOG(INFO) << "connected valve to file sink";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (enable_throttle_control_ == true)
|
||||||
|
{
|
||||||
|
top_block->connect(file_source_, 0, throttle_, 0);
|
||||||
|
DLOG(INFO) << "connected file source to throttle";
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->connect(file_source_, 0, sink_, 0);
|
||||||
|
DLOG(INFO) << "connected file source to sink";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->connect(file_source_, 0, sink_, 0);
|
||||||
|
DLOG(INFO) << "connected file source to sink";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileSignalSource::disconnect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
if (samples_ != 0)
|
||||||
|
{
|
||||||
|
if (enable_throttle_control_ == true)
|
||||||
|
{
|
||||||
|
top_block->disconnect(file_source_, 0, throttle_, 0);
|
||||||
|
DLOG(INFO) << "disconnected file source to throttle";
|
||||||
|
top_block->disconnect(throttle_, 0, valve_, 0);
|
||||||
|
DLOG(INFO) << "disconnected throttle to valve";
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->disconnect(valve_, 0, sink_, 0);
|
||||||
|
DLOG(INFO) << "disconnected valve to file sink";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
top_block->disconnect(file_source_, 0, valve_, 0);
|
||||||
|
DLOG(INFO) << "disconnected file source to valve";
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->disconnect(valve_, 0, sink_, 0);
|
||||||
|
DLOG(INFO) << "disconnected valve to file sink";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (enable_throttle_control_ == true)
|
||||||
|
{
|
||||||
|
top_block->disconnect(file_source_, 0, throttle_, 0);
|
||||||
|
DLOG(INFO) << "disconnected file source to throttle";
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->disconnect(file_source_, 0, sink_, 0);
|
||||||
|
DLOG(INFO) << "disconnected file source to sink";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->disconnect(file_source_, 0, sink_, 0);
|
||||||
|
DLOG(INFO) << "disconnected file source to sink";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr FileSignalSource::get_left_block()
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(WARNING)
|
||||||
|
<< "Left block of a signal source should not be retrieved";
|
||||||
|
return gr_block_sptr();
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr FileSignalSource::get_right_block()
|
||||||
|
{
|
||||||
|
if (samples_ != 0)
|
||||||
|
{
|
||||||
|
return valve_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (enable_throttle_control_ == true)
|
||||||
|
{
|
||||||
|
return throttle_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return file_source_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,123 @@
|
||||||
|
/*!
|
||||||
|
* \file file_signal_source.h
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
*
|
||||||
|
* This class represents a file signal source. Internally it uses a GNU Radio's gr_file_source
|
||||||
|
* a a connector to the data.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FILE_SIGNAL_SOURCE_H_
|
||||||
|
#define FILE_SIGNAL_SOURCE_H_
|
||||||
|
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_file_source.h>
|
||||||
|
#include <gnuradio/gr_file_sink.h>
|
||||||
|
#include <gnuradio/gr_throttle.h>
|
||||||
|
#include <gnuradio/gr_hier_block2.h>
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
|
||||||
|
class FileSignalSource: public GNSSBlockInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
FileSignalSource(ConfigurationInterface* configuration, std::string role,
|
||||||
|
unsigned int in_streams, unsigned int out_streams,
|
||||||
|
gr_msg_queue_sptr queue);
|
||||||
|
|
||||||
|
virtual ~FileSignalSource();
|
||||||
|
|
||||||
|
std::string role()
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
std::string implementation()
|
||||||
|
{
|
||||||
|
return "FileSignalSource";
|
||||||
|
}
|
||||||
|
size_t item_size()
|
||||||
|
{
|
||||||
|
return item_size_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void connect(gr_top_block_sptr top_block);
|
||||||
|
void disconnect(gr_top_block_sptr top_block);
|
||||||
|
gr_basic_block_sptr get_left_block();
|
||||||
|
gr_basic_block_sptr get_right_block();
|
||||||
|
|
||||||
|
std::string filename()
|
||||||
|
{
|
||||||
|
return filename_;
|
||||||
|
}
|
||||||
|
std::string item_type()
|
||||||
|
{
|
||||||
|
return item_type_;
|
||||||
|
}
|
||||||
|
bool repeat()
|
||||||
|
{
|
||||||
|
return repeat_;
|
||||||
|
}
|
||||||
|
long sampling_frequency()
|
||||||
|
{
|
||||||
|
return sampling_frequency_;
|
||||||
|
}
|
||||||
|
long samples()
|
||||||
|
{
|
||||||
|
return samples_;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
long samples_;
|
||||||
|
long sampling_frequency_;
|
||||||
|
std::string filename_;
|
||||||
|
std::string item_type_;
|
||||||
|
bool repeat_;
|
||||||
|
bool dump_;
|
||||||
|
std::string dump_filename_;
|
||||||
|
|
||||||
|
std::string role_;
|
||||||
|
|
||||||
|
unsigned int in_streams_;
|
||||||
|
unsigned int out_streams_;
|
||||||
|
|
||||||
|
gr_file_source_sptr file_source_;
|
||||||
|
gr_block_sptr valve_;
|
||||||
|
gr_block_sptr sink_;
|
||||||
|
gr_block_sptr throttle_;
|
||||||
|
|
||||||
|
gr_msg_queue_sptr queue_;
|
||||||
|
size_t item_size_;
|
||||||
|
|
||||||
|
// Throttle control
|
||||||
|
bool enable_throttle_control_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*FILE_SIGNAL_SOURCE_H_*/
|
|
@ -0,0 +1,4 @@
|
||||||
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
|
obj file_signal_source : file_signal_source.cc ;
|
||||||
|
obj usrp1_signal_source : usrp1_signal_source.cc ;
|
|
@ -0,0 +1,219 @@
|
||||||
|
/*!
|
||||||
|
* \file usrp1_signal_source.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "usrp1_signal_source.h"
|
||||||
|
|
||||||
|
#include <gnuradio/usrp_source_s.h>
|
||||||
|
#include <gnuradio/usrp_source_c.h>
|
||||||
|
#include <gnuradio/gr_file_sink.h>
|
||||||
|
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
#include "gnss_sdr_valve.h"
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
Usrp1SignalSource::Usrp1SignalSource(ConfigurationInterface* configuration,
|
||||||
|
std::string role, unsigned int in_stream, unsigned int out_stream,
|
||||||
|
gr_msg_queue_sptr queue) :
|
||||||
|
role_(role), in_stream_(in_stream), out_stream_(out_stream),
|
||||||
|
queue_(queue)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string empty = "";
|
||||||
|
std::string default_dump_file = "./data/signal_source.dat";
|
||||||
|
std::string default_item_type = "short";
|
||||||
|
|
||||||
|
which_board_ = configuration->property(role + ".which_board", 0);
|
||||||
|
decim_rate_ = configuration->property(role + ".decim_rate", 16);
|
||||||
|
nchan_ = configuration->property(role + ".nchan", 1);
|
||||||
|
mux_ = configuration->property(role + ".mux", -1);
|
||||||
|
mode_ = configuration->property(role + ".mode", 0);
|
||||||
|
fusb_block_size_ = configuration->property(role + ".fusb_block_size", 0);
|
||||||
|
fusb_nblocks_ = configuration->property(role + ".fusb_nblocks", 0);
|
||||||
|
fpga_filename_ = configuration->property(role + ".fpga_filename", empty);
|
||||||
|
firmware_filename_ = configuration->property(role + ".firmware_filename",
|
||||||
|
empty);
|
||||||
|
spec_side_ = configuration->property(role + ".spec_side", 0);
|
||||||
|
spec_subdev_ = configuration->property(role + ".spec_subdev", 0);
|
||||||
|
freq_ = configuration->property(role + ".freq", (double)1.57542e9);
|
||||||
|
gain_ = configuration->property(role + ".gain", (float)40.0);
|
||||||
|
item_type_ = configuration->property(role + ".item_type",
|
||||||
|
default_item_type);
|
||||||
|
samples_ = configuration->property(role + ".samples", 0);
|
||||||
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
|
dump_filename_ = configuration->property(role + ".dump_filename",
|
||||||
|
default_dump_file);
|
||||||
|
|
||||||
|
if (item_type_.compare("short") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(short);
|
||||||
|
usrp_source_ = usrp_make_source_s(which_board_, decim_rate_, nchan_,
|
||||||
|
mux_, mode_, fusb_block_size_, fusb_nblocks_, fpga_filename_,
|
||||||
|
firmware_filename_);
|
||||||
|
}
|
||||||
|
else if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
usrp_source_ = usrp_make_source_c(which_board_, decim_rate_, nchan_,
|
||||||
|
mux_, mode_, fusb_block_size_, fusb_nblocks_, fpga_filename_,
|
||||||
|
firmware_filename_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(WARNING) << item_type_
|
||||||
|
<< " unrecognized item type. Using short.";
|
||||||
|
item_size_ = sizeof(short);
|
||||||
|
usrp_source_ = usrp_make_source_s(which_board_, decim_rate_, nchan_,
|
||||||
|
mux_, mode_, fusb_block_size_, fusb_nblocks_, fpga_filename_,
|
||||||
|
firmware_filename_);
|
||||||
|
}
|
||||||
|
|
||||||
|
DLOG(INFO) << "usrp_source(" << usrp_source_->unique_id() << ")";
|
||||||
|
|
||||||
|
if (samples_ != 0)
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "Send STOP signal after " << samples_ << " samples";
|
||||||
|
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
|
||||||
|
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "Dumping output into file " << dump_filename_;
|
||||||
|
file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str());
|
||||||
|
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
DLOG(INFO) << "Item size " << item_size_;
|
||||||
|
|
||||||
|
db_base_sptr subdev = usrp_source_->selected_subdev(usrp_subdev_spec(
|
||||||
|
spec_side_, spec_subdev_));
|
||||||
|
|
||||||
|
DLOG(INFO) << "Subdevice name is " << subdev->side_and_name();
|
||||||
|
DLOG(INFO) << "Subdevice frequency ranges from " << subdev->freq_min()
|
||||||
|
<< " to " << subdev->freq_max();
|
||||||
|
|
||||||
|
mux_ = usrp_source_->determine_rx_mux_value(usrp_subdev_spec(spec_side_,
|
||||||
|
spec_subdev_));
|
||||||
|
|
||||||
|
DLOG(INFO) << "Mux is " << mux_;
|
||||||
|
|
||||||
|
usrp_source_->set_mux(mux_);
|
||||||
|
|
||||||
|
if (gain_ == -1)
|
||||||
|
{
|
||||||
|
gain_ = (subdev->gain_min() + subdev->gain_max()) / 2.0;
|
||||||
|
}
|
||||||
|
DLOG(INFO) << "Gain is " << gain_;
|
||||||
|
subdev->set_gain(gain_);
|
||||||
|
|
||||||
|
usrp_tune_result r;
|
||||||
|
|
||||||
|
bool ok = usrp_source_->tune(0, subdev, freq_, &r); //DDC 0
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(FATAL) << "Could not set frequency " << freq_
|
||||||
|
<< " for USRP";
|
||||||
|
}
|
||||||
|
DLOG(INFO) << "Frequency set to " << freq_;
|
||||||
|
DLOG(INFO) << "Decimation set to " << decim_rate_;
|
||||||
|
}
|
||||||
|
|
||||||
|
Usrp1SignalSource::~Usrp1SignalSource()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Usrp1SignalSource::connect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (samples_ != 0)
|
||||||
|
{
|
||||||
|
top_block->connect(usrp_source_, 0, valve_, 0);
|
||||||
|
DLOG(INFO) << "connected usrp source to valve";
|
||||||
|
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->connect(valve_, 0, file_sink_, 0);
|
||||||
|
DLOG(INFO) << "connected valve to file sink";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->connect(usrp_source_, 0, file_sink_, 0);
|
||||||
|
DLOG(INFO) << "connected usrp source to file sink";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Usrp1SignalSource::disconnect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (samples_ != 0)
|
||||||
|
{
|
||||||
|
top_block->disconnect(usrp_source_, 0, valve_, 0);
|
||||||
|
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->disconnect(valve_, 0, file_sink_, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->disconnect(usrp_source_, 0, file_sink_, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr Usrp1SignalSource::get_left_block()
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(WARNING) << "Trying to get signal source left block.";
|
||||||
|
return gr_basic_block_sptr();
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr Usrp1SignalSource::get_right_block()
|
||||||
|
{
|
||||||
|
if (samples_ != 0)
|
||||||
|
{
|
||||||
|
return valve_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return usrp_source_;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*!
|
||||||
|
* \file usrp1_signal_source.h
|
||||||
|
* \brief This class represents a USRP signal source
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef USRP1_SIGNAL_SOURCE_H_
|
||||||
|
#define USRP1_SIGNAL_SOURCE_H_
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
|
#include <gnuradio/gr_hier_block2.h>
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
class usrp_source_base;
|
||||||
|
typedef boost::shared_ptr<usrp_source_base> usrp_source_base_sptr;
|
||||||
|
|
||||||
|
class Usrp1SignalSource: public GNSSBlockInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
Usrp1SignalSource(ConfigurationInterface* configuration,
|
||||||
|
std::string role, unsigned int in_stream,
|
||||||
|
unsigned int out_stream, gr_msg_queue_sptr queue);
|
||||||
|
|
||||||
|
virtual ~Usrp1SignalSource();
|
||||||
|
|
||||||
|
std::string role()
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
std::string implementation()
|
||||||
|
{
|
||||||
|
return "Usrp1SignalSource";
|
||||||
|
}
|
||||||
|
size_t item_size()
|
||||||
|
{
|
||||||
|
return item_size_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void connect(gr_top_block_sptr top_block);
|
||||||
|
void disconnect(gr_top_block_sptr top_block);
|
||||||
|
gr_basic_block_sptr get_left_block();
|
||||||
|
gr_basic_block_sptr get_right_block();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
std::string role_;
|
||||||
|
unsigned int in_stream_;
|
||||||
|
unsigned int out_stream_;
|
||||||
|
|
||||||
|
int which_board_;
|
||||||
|
unsigned int decim_rate_;
|
||||||
|
int nchan_;
|
||||||
|
int mux_;
|
||||||
|
int mode_;
|
||||||
|
int fusb_block_size_;
|
||||||
|
int fusb_nblocks_;
|
||||||
|
std::string fpga_filename_;
|
||||||
|
std::string firmware_filename_;
|
||||||
|
unsigned int spec_side_;
|
||||||
|
unsigned int spec_subdev_;
|
||||||
|
double freq_;
|
||||||
|
float gain_;
|
||||||
|
std::string item_type_;
|
||||||
|
size_t item_size_;
|
||||||
|
long samples_;
|
||||||
|
bool dump_;
|
||||||
|
std::string dump_filename_;
|
||||||
|
|
||||||
|
usrp_source_base_sptr usrp_source_;
|
||||||
|
gr_block_sptr valve_;
|
||||||
|
gr_block_sptr file_sink_;
|
||||||
|
gr_msg_queue_sptr queue_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*USRP1_SIGNAL_SOURCE_H_*/
|
|
@ -0,0 +1,2 @@
|
||||||
|
build-project adapters ;
|
||||||
|
# build-project gnuradio_blocks ;
|
|
@ -0,0 +1,127 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_navigation.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "gps_l1_ca_telemetry_decoder.h"
|
||||||
|
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
|
||||||
|
#include "gps_l1_ca_telemetry_decoder_cc.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
#include <gnuradio/gr_stream_to_vector.h>
|
||||||
|
#include <gnuradio/gr_vector_to_stream.h>
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
/* The extern keyword declares a variable or function and specifies
|
||||||
|
* that it has external linkage (its name is visible from files other
|
||||||
|
* than the one in which it's defined). When modifying a variable,
|
||||||
|
* extern specifies that the variable has static duration (it is allocated
|
||||||
|
* when the program begins and deallocated when the program ends).
|
||||||
|
* The variable is defined in main.cc
|
||||||
|
*/
|
||||||
|
extern concurrent_queue<gps_navigation_message> global_gps_nav_msg_queue;
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
GpsL1CaTelemetryDecoder::GpsL1CaTelemetryDecoder(ConfigurationInterface* configuration,
|
||||||
|
std::string role,
|
||||||
|
unsigned int in_streams,
|
||||||
|
unsigned int out_streams,
|
||||||
|
gr_msg_queue_sptr queue) :
|
||||||
|
role_(role),
|
||||||
|
in_streams_(in_streams),
|
||||||
|
out_streams_(out_streams),
|
||||||
|
queue_(queue)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string default_item_type = "gr_complex";
|
||||||
|
std::string default_dump_filename = "./navigation.dat";
|
||||||
|
|
||||||
|
DLOG(INFO) << "role " << role;
|
||||||
|
DLOG(INFO) << "vector length " << vector_length_;
|
||||||
|
|
||||||
|
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||||
|
|
||||||
|
vector_length_ = configuration->property(role + ".vector_length", 2048);
|
||||||
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
|
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); //unused!
|
||||||
|
|
||||||
|
|
||||||
|
if(item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
telemetry_decoder_ = gps_l1_ca_make_telemetry_decoder_cc(satellite_, 0, 0, vector_length_, queue_, dump_); // TODO fix me
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(WARNING) << item_type_ << " unknown navigation item type.";
|
||||||
|
}
|
||||||
|
|
||||||
|
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
|
||||||
|
|
||||||
|
// set the navigation msg queue;
|
||||||
|
|
||||||
|
telemetry_decoder_->set_navigation_queue(&global_gps_nav_msg_queue);
|
||||||
|
|
||||||
|
DLOG(INFO) << "global navigation message queue assigned to telemetry_decoder ("<< telemetry_decoder_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
GpsL1CaTelemetryDecoder::~GpsL1CaTelemetryDecoder()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void GpsL1CaTelemetryDecoder::connect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
// Nothing to connect internally
|
||||||
|
DLOG(INFO) << "nothing to connect internally";
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaTelemetryDecoder::disconnect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
// Nothing to disconnect
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gr_basic_block_sptr GpsL1CaTelemetryDecoder::get_left_block()
|
||||||
|
{
|
||||||
|
return telemetry_decoder_;
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr GpsL1CaTelemetryDecoder::get_right_block()
|
||||||
|
{
|
||||||
|
return telemetry_decoder_;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_navigation.h
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GPS_L1_CA_TELEMETRY_DECODER_H_
|
||||||
|
#define GPS_L1_CA_TELEMETRY_DECODER_H_
|
||||||
|
|
||||||
|
#include "telemetry_decoder_interface.h"
|
||||||
|
|
||||||
|
#include "gps_l1_ca_telemetry_decoder_cc.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
|
||||||
|
class GpsL1CaTelemetryDecoder : public TelemetryDecoderInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
GpsL1CaTelemetryDecoder(ConfigurationInterface* configuration,
|
||||||
|
std::string role,
|
||||||
|
unsigned int in_streams,
|
||||||
|
unsigned int out_streams,
|
||||||
|
gr_msg_queue_sptr queue);
|
||||||
|
|
||||||
|
virtual ~GpsL1CaTelemetryDecoder();
|
||||||
|
|
||||||
|
std::string role()
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
std::string implementation()
|
||||||
|
{
|
||||||
|
return "TelemetryDecoder";
|
||||||
|
}
|
||||||
|
|
||||||
|
void connect(gr_top_block_sptr top_block);
|
||||||
|
void disconnect(gr_top_block_sptr top_block);
|
||||||
|
gr_basic_block_sptr get_left_block();
|
||||||
|
gr_basic_block_sptr get_right_block();
|
||||||
|
|
||||||
|
void set_satellite(int satellite){telemetry_decoder_->set_satellite(satellite);};
|
||||||
|
void set_channel(int channel){telemetry_decoder_->set_channel(channel);};
|
||||||
|
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
size_t item_size()
|
||||||
|
{
|
||||||
|
return item_size_;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
|
||||||
|
gps_l1_ca_telemetry_decoder_cc_sptr telemetry_decoder_;
|
||||||
|
|
||||||
|
int satellite_;
|
||||||
|
int channel_;
|
||||||
|
size_t item_size_;
|
||||||
|
unsigned int vector_length_;
|
||||||
|
std::string item_type_;
|
||||||
|
|
||||||
|
bool dump_;
|
||||||
|
std::string dump_filename_;
|
||||||
|
|
||||||
|
std::string role_;
|
||||||
|
unsigned int in_streams_;
|
||||||
|
unsigned int out_streams_;
|
||||||
|
gr_msg_queue_sptr queue_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,3 @@
|
||||||
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
|
obj gps_l1_ca_telemetry_decoder : gps_l1_ca_telemetry_decoder.cc ;
|
|
@ -0,0 +1,239 @@
|
||||||
|
/*!
|
||||||
|
* Navigation message demodulator based on the Kay Borre book MATLAB-based GPS receiver
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright notice
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gps_l1_ca_telemetry_decoder_cc.h"
|
||||||
|
|
||||||
|
#include "control_message_factory.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <bitset>
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
gps_l1_ca_telemetry_decoder_cc_sptr
|
||||||
|
gps_l1_ca_make_telemetry_decoder_cc(unsigned int satellite, long if_freq, long fs_in, unsigned
|
||||||
|
int vector_length, gr_msg_queue_sptr queue, bool dump) {
|
||||||
|
|
||||||
|
return gps_l1_ca_telemetry_decoder_cc_sptr(new gps_l1_ca_telemetry_decoder_cc(satellite, if_freq,
|
||||||
|
fs_in, vector_length, queue, dump));
|
||||||
|
}
|
||||||
|
|
||||||
|
void gps_l1_ca_telemetry_decoder_cc::forecast (int noutput_items,
|
||||||
|
gr_vector_int &ninput_items_required){
|
||||||
|
for (unsigned i = 0; i < 3; i++) {
|
||||||
|
ninput_items_required[i] =d_samples_per_bit*8; //set the required sample history
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(unsigned int satellite, long if_freq, long fs_in, unsigned
|
||||||
|
int vector_length, gr_msg_queue_sptr queue, bool dump) :
|
||||||
|
gr_block ("gps_navigation_cc", gr_make_io_signature (3, 3, sizeof(float)),
|
||||||
|
gr_make_io_signature(1, 1, sizeof(gnss_synchro))) {
|
||||||
|
// initialize internal vars
|
||||||
|
d_queue = queue;
|
||||||
|
d_dump = dump;
|
||||||
|
d_satellite = satellite;
|
||||||
|
d_vector_length = vector_length;
|
||||||
|
d_samples_per_bit=20; // it is exactly 1000*(1/50)=20
|
||||||
|
// set the preamble
|
||||||
|
unsigned short int preambles_bits[8]=GPS_PREAMBLE;
|
||||||
|
|
||||||
|
memcpy((unsigned short int*)this->d_preambles_bits, (unsigned short int*)preambles_bits, 8* sizeof(unsigned short int));
|
||||||
|
|
||||||
|
// preamble bits to sampled symbols
|
||||||
|
d_preambles_symbols=(signed int*)malloc(sizeof(signed int)*8*d_samples_per_bit);
|
||||||
|
int n=0;
|
||||||
|
for (int i=0;i<8;i++)
|
||||||
|
{
|
||||||
|
for (unsigned int j=0;j<d_samples_per_bit;j++)
|
||||||
|
{
|
||||||
|
if (d_preambles_bits[i]==1)
|
||||||
|
{
|
||||||
|
d_preambles_symbols[n]=1;
|
||||||
|
}else{
|
||||||
|
d_preambles_symbols[n]=-1;
|
||||||
|
}
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
d_sample_counter=0;
|
||||||
|
d_stat=0;
|
||||||
|
d_preamble_index=0;
|
||||||
|
d_symbol_accumulator_counter=0;
|
||||||
|
d_frame_bit_index=0;
|
||||||
|
|
||||||
|
d_flag_frame_sync=false;
|
||||||
|
d_GPS_frame_4bytes=0;
|
||||||
|
d_prev_GPS_frame_4bytes=0;
|
||||||
|
d_flag_parity=false;
|
||||||
|
|
||||||
|
//set_history(d_samples_per_bit*8); // At least a history of 8 bits are needed to correlate with the preamble
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
gps_l1_ca_telemetry_decoder_cc::~gps_l1_ca_telemetry_decoder_cc() {
|
||||||
|
delete d_preambles_symbols;
|
||||||
|
d_dump_file.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||||
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) {
|
||||||
|
int corr_value=0;
|
||||||
|
int preamble_diff;
|
||||||
|
gnss_synchro gps_synchro; //structure to save the synchronization information
|
||||||
|
gnss_synchro **out = (gnss_synchro **) &output_items[0];
|
||||||
|
d_sample_counter++; //count for the processed samples
|
||||||
|
|
||||||
|
const float **in = (const float **) &input_items[0]; //Get the input samples pointer
|
||||||
|
//std::cout<<"CH1="<<in[0][0]; // Q
|
||||||
|
//std::cout<<"CH2="<<in[1][0]; // I
|
||||||
|
//std::cout<<"CH3="<<in[2][0]; // Delay
|
||||||
|
//std::cout<<"N_input_streams="<<ninput_items.size();
|
||||||
|
|
||||||
|
// TODO Optimize me!
|
||||||
|
//******* preamble correlation ********
|
||||||
|
for (unsigned int i=0;i<d_samples_per_bit*8;i++){
|
||||||
|
if (in[1][i] <= 0) // symbols clipping
|
||||||
|
{
|
||||||
|
corr_value-=d_preambles_symbols[i];
|
||||||
|
}else{
|
||||||
|
corr_value+=d_preambles_symbols[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//******* frame sync ******************
|
||||||
|
if (abs(corr_value)>=153){
|
||||||
|
//TODO: Rewrite with state machine
|
||||||
|
if (d_stat==0)
|
||||||
|
{
|
||||||
|
d_GPS_FSM.Event_gps_word_preamble();
|
||||||
|
d_preamble_index=d_sample_counter;//record the preamble sample stamp
|
||||||
|
std::cout<<"Pre-detection"<<std::endl;
|
||||||
|
d_symbol_accumulator=0; //sync the symbol to bits integrator
|
||||||
|
d_symbol_accumulator_counter=0;
|
||||||
|
d_frame_bit_index=8;
|
||||||
|
d_stat=1; // enter into frame pre-detection status
|
||||||
|
}else if (d_stat==1) //check 6 seconds of preample separation
|
||||||
|
{
|
||||||
|
preamble_diff=abs(d_sample_counter-d_preamble_index);
|
||||||
|
if (abs(preamble_diff-6000)<1)
|
||||||
|
{
|
||||||
|
d_GPS_FSM.Event_gps_word_preamble();
|
||||||
|
d_preamble_index=d_sample_counter;//record the preamble sample stamp
|
||||||
|
if (!d_flag_frame_sync){
|
||||||
|
d_flag_frame_sync=true;
|
||||||
|
std::cout<<" Frame sync with phase "<<in[2][0]<<std::endl;
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
if (preamble_diff>7000){
|
||||||
|
std::cout<<"lost of frame sync"<<std::endl;
|
||||||
|
d_stat=0; //lost of frame sync
|
||||||
|
d_flag_frame_sync=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//******* SYMBOL TO BIT *******
|
||||||
|
|
||||||
|
d_symbol_accumulator+=in[1][d_samples_per_bit*8-1]; // accumulate the input value in d_symbol_accumulator
|
||||||
|
d_symbol_accumulator_counter++;
|
||||||
|
if (d_symbol_accumulator_counter==20)
|
||||||
|
{
|
||||||
|
if (d_symbol_accumulator>0){ //symbol to bit
|
||||||
|
d_GPS_frame_4bytes+=1; //insert the telemetry bit in LSB
|
||||||
|
}
|
||||||
|
d_symbol_accumulator=0;
|
||||||
|
d_symbol_accumulator_counter=0;
|
||||||
|
|
||||||
|
//******* bits to words ******
|
||||||
|
d_frame_bit_index++;
|
||||||
|
if (d_frame_bit_index==30)
|
||||||
|
{
|
||||||
|
d_frame_bit_index=0;
|
||||||
|
//parity check
|
||||||
|
//Each word in wordbuff is composed of:
|
||||||
|
// Bits 0 to 29 = the GPS data word
|
||||||
|
// Bits 30 to 31 = 2 LSBs of the GPS word ahead.
|
||||||
|
// prepare the extended frame [-2 -1 0 ... 30]
|
||||||
|
if (d_prev_GPS_frame_4bytes & 0x00000001)
|
||||||
|
{
|
||||||
|
d_GPS_frame_4bytes=d_GPS_frame_4bytes|0x40000000;
|
||||||
|
}
|
||||||
|
if (d_prev_GPS_frame_4bytes & 0x00000002)
|
||||||
|
{
|
||||||
|
d_GPS_frame_4bytes=d_GPS_frame_4bytes|0x80000000;
|
||||||
|
}
|
||||||
|
/* Check that the 2 most recently logged words pass parity. Have to first
|
||||||
|
invert the data bits according to bit 30 of the previous word. */
|
||||||
|
if(d_GPS_frame_4bytes & 0x40000000)
|
||||||
|
{
|
||||||
|
d_GPS_frame_4bytes ^= 0x3FFFFFC0; // invert the data bits (using XOR)
|
||||||
|
}
|
||||||
|
if (gps_word_parityCheck(d_GPS_frame_4bytes)) {
|
||||||
|
memcpy(&d_GPS_FSM.d_GPS_frame_4bytes,&d_GPS_frame_4bytes,sizeof(char)*4);
|
||||||
|
d_GPS_FSM.Event_gps_word_valid();
|
||||||
|
d_flag_parity=true;
|
||||||
|
}else{
|
||||||
|
d_GPS_FSM.Event_gps_word_invalid();
|
||||||
|
d_flag_parity=false;
|
||||||
|
}
|
||||||
|
d_prev_GPS_frame_4bytes=d_GPS_frame_4bytes; // save the actual frame
|
||||||
|
d_GPS_frame_4bytes=d_GPS_frame_4bytes & 0;
|
||||||
|
}else{
|
||||||
|
d_GPS_frame_4bytes<<=1; //shift 1 bit left the telemetry word
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// output the frame
|
||||||
|
consume_each(1); //one by one
|
||||||
|
|
||||||
|
if ((d_sample_counter%NAVIGATION_OUTPUT_RATE_MS)==0)
|
||||||
|
{
|
||||||
|
gps_synchro.valid_word=(d_flag_frame_sync==true and d_flag_parity==true);
|
||||||
|
gps_synchro.last_preamble_index=d_preamble_index;
|
||||||
|
gps_synchro.prn_delay=in[2][0];
|
||||||
|
gps_synchro.satellite_PRN=d_satellite+1;
|
||||||
|
gps_synchro.channel_ID=d_channel;
|
||||||
|
*out[0]=gps_synchro;
|
||||||
|
return 1;
|
||||||
|
}else{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void gps_l1_ca_telemetry_decoder_cc::set_satellite(int satellite) {
|
||||||
|
d_satellite = satellite;
|
||||||
|
d_GPS_FSM.d_satellite_PRN=satellite;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Navigation Satellite set to " << d_satellite;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gps_l1_ca_telemetry_decoder_cc::set_channel(int channel) {
|
||||||
|
d_channel = channel;
|
||||||
|
d_GPS_FSM.d_channel_ID=channel;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Navigation channel set to " << channel;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright notice
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GPS_L1_CA_TELEMETRY_DECODER_CC_H
|
||||||
|
#define GPS_L1_CA_TELEMETRY_DECODER_CC_H
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include <gnuradio/gr_block.h>
|
||||||
|
//#include <gnuradio/gr_sync_block.h>
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
|
||||||
|
#include <bitset>
|
||||||
|
|
||||||
|
#include "GPS_L1_CA.h"
|
||||||
|
#include "gps_telemetry.h"
|
||||||
|
#include "gps_l1_ca_subframe_fsm.h"
|
||||||
|
|
||||||
|
#include "concurrent_queue.h"
|
||||||
|
|
||||||
|
class gps_l1_ca_telemetry_decoder_cc;
|
||||||
|
typedef boost::shared_ptr<gps_l1_ca_telemetry_decoder_cc> gps_l1_ca_telemetry_decoder_cc_sptr;
|
||||||
|
gps_l1_ca_telemetry_decoder_cc_sptr
|
||||||
|
gps_l1_ca_make_telemetry_decoder_cc(unsigned int satellite, long if_freq, long fs_in, unsigned
|
||||||
|
int vector_length, gr_msg_queue_sptr queue, bool dump);
|
||||||
|
|
||||||
|
|
||||||
|
class gps_l1_ca_telemetry_decoder_cc : public gr_block {
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend gps_l1_ca_telemetry_decoder_cc_sptr
|
||||||
|
gps_l1_ca_make_telemetry_decoder_cc(unsigned int satellite, long if_freq, long fs_in,unsigned
|
||||||
|
int vector_length, gr_msg_queue_sptr queue, bool dump);
|
||||||
|
|
||||||
|
gps_l1_ca_telemetry_decoder_cc(unsigned int satellite, long if_freq, long fs_in,unsigned
|
||||||
|
int vector_length, gr_msg_queue_sptr queue, bool dump);
|
||||||
|
|
||||||
|
// constants
|
||||||
|
unsigned short int d_preambles_bits[8];
|
||||||
|
|
||||||
|
// class private vars
|
||||||
|
|
||||||
|
signed int *d_preambles_symbols;
|
||||||
|
unsigned int d_samples_per_bit;
|
||||||
|
long unsigned int d_sample_counter;
|
||||||
|
long unsigned int d_preamble_index;
|
||||||
|
unsigned int d_stat;
|
||||||
|
bool d_flag_frame_sync;
|
||||||
|
|
||||||
|
// symbols
|
||||||
|
int d_symbol_accumulator;
|
||||||
|
short int d_symbol_accumulator_counter;
|
||||||
|
|
||||||
|
//bits and frame
|
||||||
|
unsigned short int d_frame_bit_index;
|
||||||
|
unsigned int d_GPS_frame_4bytes;
|
||||||
|
unsigned int d_prev_GPS_frame_4bytes;
|
||||||
|
bool d_flag_parity;
|
||||||
|
int d_word_number;
|
||||||
|
|
||||||
|
// navigation message vars
|
||||||
|
gps_navigation_message d_nav;
|
||||||
|
GpsL1CaSubframeFsm d_GPS_FSM;
|
||||||
|
|
||||||
|
|
||||||
|
gr_msg_queue_sptr d_queue;
|
||||||
|
unsigned int d_vector_length;
|
||||||
|
bool d_dump;
|
||||||
|
int d_satellite;
|
||||||
|
int d_channel;
|
||||||
|
|
||||||
|
std::string d_dump_filename;
|
||||||
|
std::ofstream d_dump_file;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
~gps_l1_ca_telemetry_decoder_cc();
|
||||||
|
|
||||||
|
void set_satellite(int satellite);
|
||||||
|
void set_channel(int channel);
|
||||||
|
|
||||||
|
void set_navigation_queue(concurrent_queue<gps_navigation_message> *nav_queue){d_GPS_FSM.d_nav_queue=nav_queue;}
|
||||||
|
|
||||||
|
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||||
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||||
|
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,3 @@
|
||||||
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
|
obj gps_l1_ca_telemetry_decoder_cc : gps_l1_ca_telemetry_decoder_cc.cc ;
|
|
@ -0,0 +1,3 @@
|
||||||
|
build-project adapters ;
|
||||||
|
build-project gnuradio_blocks ;
|
||||||
|
build-project libs ;
|
|
@ -0,0 +1,184 @@
|
||||||
|
|
||||||
|
#include "gps_l1_ca_subframe_fsm.h"
|
||||||
|
|
||||||
|
//************ GPS WORD TO SUBFRAME DECODER STATE MACHINE **********
|
||||||
|
|
||||||
|
struct Ev_gps_word_valid : sc::event<Ev_gps_word_valid> {};
|
||||||
|
struct Ev_gps_word_invalid : sc::event<Ev_gps_word_invalid>{};
|
||||||
|
struct Ev_gps_word_preamble : sc::event<Ev_gps_word_preamble>{};
|
||||||
|
|
||||||
|
struct gps_subframe_fsm_S0: public sc::state<gps_subframe_fsm_S0, GpsL1CaSubframeFsm > {
|
||||||
|
public:
|
||||||
|
// sc::transition(evento,estado_destino)
|
||||||
|
typedef sc::transition< Ev_gps_word_preamble, gps_subframe_fsm_S1 > reactions;
|
||||||
|
gps_subframe_fsm_S0(my_context ctx): my_base( ctx ){
|
||||||
|
std::cout<<"Enter S0 "<<std::endl;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
struct gps_subframe_fsm_S1: public sc::state<gps_subframe_fsm_S1, GpsL1CaSubframeFsm > {
|
||||||
|
public:
|
||||||
|
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||||
|
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S2 > > reactions;
|
||||||
|
|
||||||
|
gps_subframe_fsm_S1(my_context ctx): my_base( ctx ){
|
||||||
|
std::cout<<"Enter S1 "<<std::endl;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct gps_subframe_fsm_S2: public sc::state<gps_subframe_fsm_S2, GpsL1CaSubframeFsm > {
|
||||||
|
public:
|
||||||
|
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||||
|
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S3 > > reactions;
|
||||||
|
|
||||||
|
gps_subframe_fsm_S2(my_context ctx): my_base( ctx ){
|
||||||
|
std::cout<<"Enter S2 "<<std::endl;
|
||||||
|
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
struct gps_subframe_fsm_S3: public sc::state<gps_subframe_fsm_S3, GpsL1CaSubframeFsm > {
|
||||||
|
public:
|
||||||
|
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||||
|
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S4 > > reactions;
|
||||||
|
|
||||||
|
gps_subframe_fsm_S3(my_context ctx): my_base( ctx ){
|
||||||
|
std::cout<<"Enter S3 "<<std::endl;
|
||||||
|
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
struct gps_subframe_fsm_S4: public sc::state<gps_subframe_fsm_S4, GpsL1CaSubframeFsm > {
|
||||||
|
public:
|
||||||
|
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||||
|
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S5 > > reactions;
|
||||||
|
|
||||||
|
gps_subframe_fsm_S4(my_context ctx): my_base( ctx ){
|
||||||
|
std::cout<<"Enter S4 "<<std::endl;
|
||||||
|
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
struct gps_subframe_fsm_S5: public sc::state<gps_subframe_fsm_S5, GpsL1CaSubframeFsm > {
|
||||||
|
public:
|
||||||
|
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||||
|
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S6 > > reactions;
|
||||||
|
|
||||||
|
gps_subframe_fsm_S5(my_context ctx): my_base( ctx ){
|
||||||
|
std::cout<<"Enter S5 "<<std::endl;
|
||||||
|
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(3);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
struct gps_subframe_fsm_S6: public sc::state<gps_subframe_fsm_S6, GpsL1CaSubframeFsm > {
|
||||||
|
public:
|
||||||
|
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||||
|
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S7 > > reactions;
|
||||||
|
|
||||||
|
gps_subframe_fsm_S6(my_context ctx): my_base( ctx ){
|
||||||
|
std::cout<<"Enter S6 "<<std::endl;
|
||||||
|
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(4);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
struct gps_subframe_fsm_S7: public sc::state<gps_subframe_fsm_S7, GpsL1CaSubframeFsm > {
|
||||||
|
public:
|
||||||
|
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||||
|
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S8 > > reactions;
|
||||||
|
|
||||||
|
gps_subframe_fsm_S7(my_context ctx): my_base( ctx ){
|
||||||
|
std::cout<<"Enter S7 "<<std::endl;
|
||||||
|
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(5);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
struct gps_subframe_fsm_S8: public sc::state<gps_subframe_fsm_S8, GpsL1CaSubframeFsm > {
|
||||||
|
public:
|
||||||
|
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||||
|
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S9 > > reactions;
|
||||||
|
|
||||||
|
gps_subframe_fsm_S8(my_context ctx): my_base( ctx ){
|
||||||
|
std::cout<<"Enter S8 "<<std::endl;
|
||||||
|
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(6);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
struct gps_subframe_fsm_S9: public sc::state<gps_subframe_fsm_S9, GpsL1CaSubframeFsm > {
|
||||||
|
public:
|
||||||
|
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||||
|
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S10 > > reactions;
|
||||||
|
|
||||||
|
gps_subframe_fsm_S9(my_context ctx): my_base( ctx ){
|
||||||
|
std::cout<<"Enter S9 "<<std::endl;
|
||||||
|
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(7);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
struct gps_subframe_fsm_S10: public sc::state<gps_subframe_fsm_S10, GpsL1CaSubframeFsm > {
|
||||||
|
public:
|
||||||
|
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
|
||||||
|
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S11 > > reactions;
|
||||||
|
|
||||||
|
gps_subframe_fsm_S10(my_context ctx): my_base( ctx ){
|
||||||
|
std::cout<<"Enter S10 "<<std::endl;
|
||||||
|
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(8);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
struct gps_subframe_fsm_S11: public sc::state<gps_subframe_fsm_S11, GpsL1CaSubframeFsm > {
|
||||||
|
public:
|
||||||
|
typedef sc::transition< Ev_gps_word_preamble, gps_subframe_fsm_S1 > reactions;
|
||||||
|
|
||||||
|
gps_subframe_fsm_S11(my_context ctx): my_base( ctx ){
|
||||||
|
std::cout<<"Completed GPS Subframe!"<<std::endl;
|
||||||
|
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(9);
|
||||||
|
context< GpsL1CaSubframeFsm >().gps_subframe_to_nav_msg(); //decode the subframe
|
||||||
|
// DECODE SUBFRAME
|
||||||
|
std::cout<<"Enter S11"<<std::endl;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
GpsL1CaSubframeFsm::GpsL1CaSubframeFsm()
|
||||||
|
{
|
||||||
|
d_nav.reset();
|
||||||
|
initiate(); //start the FSM
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaSubframeFsm::gps_word_to_subframe(int position)
|
||||||
|
{
|
||||||
|
// insert the word in the correct position of the subframe
|
||||||
|
std::memcpy(&d_subframe[position*GPS_WORD_LENGTH],&d_GPS_frame_4bytes,sizeof(char)*GPS_WORD_LENGTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaSubframeFsm::gps_subframe_to_nav_msg()
|
||||||
|
{
|
||||||
|
int subframe_ID;
|
||||||
|
// NEW GPS SUBFRAME HAS ARRIVED!
|
||||||
|
|
||||||
|
subframe_ID=d_nav.subframe_decoder(this->d_subframe); //decode the subframe
|
||||||
|
|
||||||
|
d_nav.d_satellite_PRN=d_satellite_PRN+1;
|
||||||
|
d_nav.d_channel_ID=d_channel_ID;
|
||||||
|
|
||||||
|
//TODO: change to subframe 5
|
||||||
|
if (subframe_ID==3) { // if the subframe is the 5th, then
|
||||||
|
if (d_nav.satellite_validation()) // if all the satellite ephemeris parameters are good, then
|
||||||
|
{
|
||||||
|
// compute the GPS master clock
|
||||||
|
d_nav.master_clock();
|
||||||
|
// compute the satellite current ECEF position
|
||||||
|
d_nav.satpos();
|
||||||
|
// compute the clock error including relativistic effects
|
||||||
|
d_nav.relativistic_clock_correction();
|
||||||
|
// Send the procesed satellite ephemeris packet
|
||||||
|
d_nav_queue->push(d_nav);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaSubframeFsm::Event_gps_word_valid()
|
||||||
|
{
|
||||||
|
this->process_event(Ev_gps_word_valid());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaSubframeFsm::Event_gps_word_invalid()
|
||||||
|
{
|
||||||
|
this->process_event(Ev_gps_word_invalid());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaSubframeFsm::Event_gps_word_preamble()
|
||||||
|
{
|
||||||
|
this->process_event(Ev_gps_word_preamble());
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
/**
|
||||||
|
* Copyright notice
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
*/
|
||||||
|
//************ GPS WORD TO SUBFRAME DECODER STATE MACHINE **********
|
||||||
|
#ifndef GPS_L1_CA_SUBFRAME_FSM_H
|
||||||
|
#define GPS_L1_CA_SUBFRAME_FSM_H
|
||||||
|
|
||||||
|
#include <boost/statechart/state_machine.hpp>
|
||||||
|
#include <boost/statechart/simple_state.hpp>
|
||||||
|
#include <boost/statechart/state.hpp>
|
||||||
|
#include <boost/statechart/transition.hpp>
|
||||||
|
#include <boost/statechart/custom_reaction.hpp>
|
||||||
|
#include <boost/mpl/list.hpp>
|
||||||
|
|
||||||
|
#include <queue>
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
|
#include <boost/thread/thread.hpp>
|
||||||
|
#include "concurrent_queue.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "GPS_L1_CA.h"
|
||||||
|
#include "gps_telemetry.h"
|
||||||
|
#include "gps_navigation_message.h"
|
||||||
|
|
||||||
|
namespace sc = boost::statechart;
|
||||||
|
namespace mpl = boost::mpl;
|
||||||
|
|
||||||
|
struct gps_subframe_fsm_S0;
|
||||||
|
struct gps_subframe_fsm_S1;
|
||||||
|
struct gps_subframe_fsm_S2;
|
||||||
|
struct gps_subframe_fsm_S3;
|
||||||
|
struct gps_subframe_fsm_S4;
|
||||||
|
struct gps_subframe_fsm_S5;
|
||||||
|
struct gps_subframe_fsm_S6;
|
||||||
|
struct gps_subframe_fsm_S7;
|
||||||
|
struct gps_subframe_fsm_S8;
|
||||||
|
struct gps_subframe_fsm_S9;
|
||||||
|
struct gps_subframe_fsm_S10;
|
||||||
|
struct gps_subframe_fsm_S11;
|
||||||
|
|
||||||
|
class GpsL1CaSubframeFsm : public sc::state_machine< GpsL1CaSubframeFsm, gps_subframe_fsm_S0 >{
|
||||||
|
private:
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// channel and satellite info
|
||||||
|
int d_channel_ID;
|
||||||
|
int d_satellite_PRN;
|
||||||
|
|
||||||
|
// ephemeris queue
|
||||||
|
concurrent_queue<gps_navigation_message> *d_nav_queue;
|
||||||
|
// navigation message class
|
||||||
|
gps_navigation_message d_nav;
|
||||||
|
|
||||||
|
char d_subframe[GPS_SUBFRAME_LENGTH];
|
||||||
|
char d_GPS_frame_4bytes[GPS_WORD_LENGTH];
|
||||||
|
|
||||||
|
void gps_word_to_subframe(int position);
|
||||||
|
void gps_subframe_to_nav_msg();
|
||||||
|
|
||||||
|
//FSM EVENTS
|
||||||
|
void Event_gps_word_valid();
|
||||||
|
void Event_gps_word_invalid();
|
||||||
|
void Event_gps_word_preamble();
|
||||||
|
|
||||||
|
GpsL1CaSubframeFsm();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,3 @@
|
||||||
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
|
obj gps_l1_ca_subframe_fsm : gps_l1_ca_subframe_fsm.cc ;
|
|
@ -0,0 +1,147 @@
|
||||||
|
/*!
|
||||||
|
* \file gnss_tracking_a.cc
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
* Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gps_l1_ca_dll_pll_tracking.h"
|
||||||
|
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
|
||||||
|
ConfigurationInterface* configuration, std::string role,
|
||||||
|
unsigned int in_streams, unsigned int out_streams,
|
||||||
|
gr_msg_queue_sptr queue) :
|
||||||
|
role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(
|
||||||
|
queue)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string default_item_type = "gr_complex";
|
||||||
|
std::string default_dump_filename = "./tracking.dat";
|
||||||
|
|
||||||
|
DLOG(INFO) << "role " << role;
|
||||||
|
DLOG(INFO) << "vector length " << vector_length_;
|
||||||
|
|
||||||
|
item_type_ = configuration->property(role + ".item_type",
|
||||||
|
default_item_type);
|
||||||
|
vector_length_ = configuration->property(role + ".vector_length", 2048);
|
||||||
|
fs_in_ = configuration->property(role + ".fs_in", 2048000);
|
||||||
|
if_ = configuration->property(role + ".if", 0);
|
||||||
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
|
dump_filename_ = configuration->property(role + ".dump_filename",
|
||||||
|
default_dump_filename); //unused!
|
||||||
|
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
tracking_ = gps_l1_ca_dll_pll_make_tracking_cc(satellite_, if_,
|
||||||
|
fs_in_, vector_length_, queue_, dump_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_AT_LEVEL(WARNING) << item_type_ << " unknown tracking item type.";
|
||||||
|
}
|
||||||
|
|
||||||
|
DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
GpsL1CaDllPllTracking::~GpsL1CaDllPllTracking()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaDllPllTracking::start_tracking()
|
||||||
|
{
|
||||||
|
tracking_->start_tracking();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaDllPllTracking::set_satellite(unsigned int satellite)
|
||||||
|
{
|
||||||
|
satellite_ = satellite;
|
||||||
|
tracking_->set_satellite(satellite);
|
||||||
|
DLOG(INFO) << "satellite set to " << satellite_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaDllPllTracking::set_channel(unsigned int channel)
|
||||||
|
{
|
||||||
|
channel_ = channel;
|
||||||
|
tracking_->set_channel(channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaDllPllTracking::set_channel_queue(
|
||||||
|
concurrent_queue<int> *channel_internal_queue)
|
||||||
|
{
|
||||||
|
channel_internal_queue_ = channel_internal_queue;
|
||||||
|
|
||||||
|
tracking_->set_channel_queue(channel_internal_queue_);
|
||||||
|
|
||||||
|
}
|
||||||
|
void GpsL1CaDllPllTracking::set_prn_code_phase(signed int phase)
|
||||||
|
{
|
||||||
|
return tracking_->set_acq_code_phase((double)phase);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaDllPllTracking::set_doppler_freq_shift(float phase)
|
||||||
|
{
|
||||||
|
return tracking_->set_acq_doppler(phase);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaDllPllTracking::set_acq_sample_stamp(
|
||||||
|
unsigned long int sample_stamp)
|
||||||
|
{
|
||||||
|
return tracking_->set_acq_sample_stamp(sample_stamp);
|
||||||
|
}
|
||||||
|
void GpsL1CaDllPllTracking::connect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
//nothing to connect, now the tracking uses gr_sync_decimator
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsL1CaDllPllTracking::disconnect(gr_top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
//nothing to disconnect, now the tracking uses gr_sync_decimator
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr GpsL1CaDllPllTracking::get_left_block()
|
||||||
|
{
|
||||||
|
return tracking_;
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_basic_block_sptr GpsL1CaDllPllTracking::get_right_block()
|
||||||
|
{
|
||||||
|
return tracking_;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,107 @@
|
||||||
|
/*!
|
||||||
|
* \file gnss_correlator_a.h
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GPS_L1_CA_DLL_PLL_TRACKING_H_
|
||||||
|
#define GPS_L1_CA_DLL_PLL_TRACKING_H_
|
||||||
|
|
||||||
|
#include "tracking_interface.h"
|
||||||
|
|
||||||
|
#include "gps_l1_ca_dll_pll_tracking_cc.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
|
||||||
|
|
||||||
|
class GpsL1CaDllPllTracking : public TrackingInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
GpsL1CaDllPllTracking(ConfigurationInterface* configuration,
|
||||||
|
std::string role,
|
||||||
|
unsigned int in_streams,
|
||||||
|
unsigned int out_streams,
|
||||||
|
gr_msg_queue_sptr queue);
|
||||||
|
|
||||||
|
virtual ~GpsL1CaDllPllTracking();
|
||||||
|
|
||||||
|
std::string role()
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
std::string implementation()
|
||||||
|
{
|
||||||
|
return "tracking";
|
||||||
|
}
|
||||||
|
size_t item_size()
|
||||||
|
{
|
||||||
|
return item_size_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void connect(gr_top_block_sptr top_block);
|
||||||
|
void disconnect(gr_top_block_sptr top_block);
|
||||||
|
gr_basic_block_sptr get_left_block();
|
||||||
|
gr_basic_block_sptr get_right_block();
|
||||||
|
|
||||||
|
void set_satellite(unsigned int satellite);
|
||||||
|
void set_channel(unsigned int channel);
|
||||||
|
void set_prn_code_phase(signed int phase);
|
||||||
|
void set_doppler_freq_shift(float phase);
|
||||||
|
void set_channel_queue(concurrent_queue<int> *channel_internal_queue);
|
||||||
|
|
||||||
|
void start_tracking();
|
||||||
|
|
||||||
|
void set_acq_sample_stamp(unsigned long int sample_stamp);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
gps_l1_ca_dll_pll_tracking_cc_sptr tracking_;
|
||||||
|
size_t item_size_;
|
||||||
|
std::string item_type_;
|
||||||
|
unsigned int vector_length_;
|
||||||
|
unsigned int satellite_;
|
||||||
|
unsigned int channel_;
|
||||||
|
long fs_in_;
|
||||||
|
long if_;
|
||||||
|
bool dump_;
|
||||||
|
std::string dump_filename_;
|
||||||
|
|
||||||
|
std::string role_;
|
||||||
|
unsigned int in_streams_;
|
||||||
|
unsigned int out_streams_;
|
||||||
|
gr_msg_queue_sptr queue_;
|
||||||
|
concurrent_queue<int> *channel_internal_queue_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GPS_L1_CA_DLL_PLL_TRACKING_H_
|
|
@ -0,0 +1,3 @@
|
||||||
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
|
obj gps_l1_ca_dll_pll_tracking : gps_l1_ca_dll_pll_tracking.cc ;
|
|
@ -0,0 +1,424 @@
|
||||||
|
//! Single-delta GPS L1 CA DLL+PLL tracking
|
||||||
|
/*!
|
||||||
|
* Tracking based on the Kay Borre book MATLAB-based GPS receiver
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright notice
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gps_l1_ca_dll_pll_tracking_cc.h"
|
||||||
|
#include "gps_sdr_signal_processing.h"
|
||||||
|
|
||||||
|
//#include "gps_sdr_signaldef.h"
|
||||||
|
#include "gps_sdr_simd.h"
|
||||||
|
#include "gps_sdr_x86.h"
|
||||||
|
|
||||||
|
#include "control_message_factory.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <cmath>
|
||||||
|
#include "math.h"
|
||||||
|
|
||||||
|
#include <gnuradio/gr_io_signature.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <glog/log_severity.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
gps_l1_ca_dll_pll_tracking_cc_sptr
|
||||||
|
gps_l1_ca_dll_pll_make_tracking_cc(unsigned int satellite, long if_freq, long fs_in, unsigned
|
||||||
|
int vector_length, gr_msg_queue_sptr queue, bool dump) {
|
||||||
|
|
||||||
|
return gps_l1_ca_dll_pll_tracking_cc_sptr(new gps_l1_ca_dll_pll_tracking_cc(satellite, if_freq,
|
||||||
|
fs_in, vector_length, queue, dump));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gps_l1_ca_dll_pll_tracking_cc::gps_l1_ca_dll_pll_tracking_cc(unsigned int satellite, long if_freq, long fs_in, unsigned
|
||||||
|
int vector_length, gr_msg_queue_sptr queue, bool dump) :
|
||||||
|
gr_sync_decimator ("gps_l1_ca_dll_pll_tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)),
|
||||||
|
gr_make_io_signature(3, 3, sizeof(float)),vector_length) {
|
||||||
|
// initialize internal vars
|
||||||
|
d_queue = queue;
|
||||||
|
d_dump = dump;
|
||||||
|
d_satellite = satellite;
|
||||||
|
d_if_freq = if_freq;
|
||||||
|
d_fs_in = fs_in;
|
||||||
|
d_vector_length = vector_length;
|
||||||
|
|
||||||
|
// Initialize tracking variables ==========================================
|
||||||
|
//TODO: Include this setting in configuration file
|
||||||
|
|
||||||
|
//--- DLL variables --------------------------------------------------------
|
||||||
|
d_early_late_spc = 0.5; // Define early-late offset (in chips)
|
||||||
|
d_pdi_code = 0.001;// Summation interval for code
|
||||||
|
d_dllnoisebandwidth=2.0; //Hz
|
||||||
|
d_dlldampingratio=0.7;
|
||||||
|
calculate_lopp_coef(&d_tau1_code, &d_tau2_code, d_dllnoisebandwidth, d_dlldampingratio,1.0);// Calculate filter coefficient values
|
||||||
|
|
||||||
|
//--- PLL variables --------------------------------------------------------
|
||||||
|
d_pdi_carr = 0.001;// Summation interval for carrier
|
||||||
|
d_plldampingratio=0.7;
|
||||||
|
d_pllnoisebandwidth=25;
|
||||||
|
|
||||||
|
//Calculate filter coefficient values
|
||||||
|
calculate_lopp_coef(&d_tau1_carr, &d_tau2_carr, d_pllnoisebandwidth, d_plldampingratio,0.25);// Calculate filter coefficient values
|
||||||
|
|
||||||
|
// Initialization of local code replica
|
||||||
|
|
||||||
|
// Get a vector with the C/A code sampled 1x/chip
|
||||||
|
d_code_length=1023;
|
||||||
|
d_ca_code=(gr_complex*)malloc(sizeof(gr_complex)*(d_code_length+2));
|
||||||
|
|
||||||
|
// Get space for the resampled early / prompt / late local replicas
|
||||||
|
d_early_code=(gr_complex*)malloc(sizeof(gr_complex)*d_vector_length);
|
||||||
|
// Get space for the resampled early / prompt / late local replicas
|
||||||
|
d_prompt_code=(gr_complex*)malloc(sizeof(gr_complex)*d_vector_length);
|
||||||
|
// Get space for the resampled early / prompt / late local replicas
|
||||||
|
d_late_code=(gr_complex*)malloc(sizeof(gr_complex)*d_vector_length);
|
||||||
|
|
||||||
|
d_carr_sign=(gr_complex*)malloc(sizeof(gr_complex)*d_vector_length);
|
||||||
|
d_bb_sign=(gr_complex*)malloc(sizeof(gr_complex)*d_vector_length);
|
||||||
|
|
||||||
|
//--- Perform initializations ------------------------------
|
||||||
|
|
||||||
|
// define initial code frequency basis of NCO
|
||||||
|
d_code_freq = 1023000; //Hz
|
||||||
|
// define residual code phase (in chips)
|
||||||
|
d_rem_code_phase = 0.0;
|
||||||
|
// define carrier frequency which is used over whole tracking period
|
||||||
|
// it must be set with set_acq_code_phase() and set_acq_doppler()
|
||||||
|
|
||||||
|
// define residual carrier phase
|
||||||
|
d_rem_carr_phase = 0.0;
|
||||||
|
|
||||||
|
// code tracking loop parameters
|
||||||
|
d_old_code_nco = 0.0;
|
||||||
|
d_old_code_error = 0.0;
|
||||||
|
|
||||||
|
// carrier/Costas loop parameters
|
||||||
|
d_old_carr_nco = 0.0;
|
||||||
|
d_old_carr_error = 0.0;
|
||||||
|
|
||||||
|
d_absolute_code_phase_chips = 0;
|
||||||
|
|
||||||
|
// sample synchronization
|
||||||
|
d_sample_counter=0;
|
||||||
|
d_acq_sample_stamp=0;
|
||||||
|
|
||||||
|
d_dump_filename="./data/trk_epr.dat";
|
||||||
|
d_enable_tracking=false;
|
||||||
|
d_last_seg=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gps_l1_ca_dll_pll_tracking_cc::calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k){
|
||||||
|
// Solve natural frequency
|
||||||
|
float Wn;
|
||||||
|
Wn = lbw*8*zeta / (4*zeta*zeta + 1);
|
||||||
|
|
||||||
|
// solve for t1 & t2
|
||||||
|
*tau1 = k / (Wn * Wn);
|
||||||
|
*tau2 = (2.0 * zeta) / Wn;
|
||||||
|
//std::cout<<"Tau1= "<<*tau1<<std::endl;
|
||||||
|
//std::cout<<"Tau2= "<<*tau2<<std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gps_l1_ca_dll_pll_tracking_cc::update_local_code_refs()
|
||||||
|
{
|
||||||
|
float tcode;
|
||||||
|
float max_tcode;
|
||||||
|
unsigned int i=0;
|
||||||
|
int tmp_index;
|
||||||
|
float block_correction;
|
||||||
|
|
||||||
|
// std::cout<<"d_code_phase_step"<<d_code_phase_step<<std::endl;
|
||||||
|
// std::cout<<"d_rem_code_phase"<<d_rem_code_phase<<std::endl;
|
||||||
|
// std::cout<<"d_blk_size"<<d_blk_size<<std::endl;
|
||||||
|
|
||||||
|
// Define index into early code vector
|
||||||
|
max_tcode=((float)d_blk_size-1.0)*d_code_phase_step+d_rem_code_phase-d_early_late_spc;
|
||||||
|
|
||||||
|
for (tcode=d_rem_code_phase-d_early_late_spc;tcode<max_tcode;tcode+=d_code_phase_step)
|
||||||
|
{
|
||||||
|
tmp_index=ceil(fmod(tcode,d_code_length));
|
||||||
|
d_early_code[i]=d_ca_code[tmp_index];
|
||||||
|
i++;
|
||||||
|
// if (i==d_vector_length){
|
||||||
|
// std::cout<<"Break "<<std::endl;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
// Define index into late code vector
|
||||||
|
i=0;
|
||||||
|
max_tcode=((float)d_blk_size-1.0)*d_code_phase_step+d_rem_code_phase+d_early_late_spc;
|
||||||
|
for (tcode=d_rem_code_phase+d_early_late_spc;tcode<max_tcode;tcode+=d_code_phase_step)
|
||||||
|
{
|
||||||
|
tmp_index=ceil(fmod(tcode,d_code_length));
|
||||||
|
d_late_code[i]=d_ca_code[tmp_index];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
// Define index into prompt code vector
|
||||||
|
i=0;
|
||||||
|
max_tcode=((float)d_blk_size-1.0)*d_code_phase_step+d_rem_code_phase;
|
||||||
|
for (tcode=d_rem_code_phase;tcode<max_tcode;tcode+=d_code_phase_step)
|
||||||
|
{
|
||||||
|
tmp_index=ceil(fmod(tcode,d_code_length));
|
||||||
|
d_prompt_code[i]=d_ca_code[tmp_index];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
block_correction=(float)d_blk_size*(1/(float)d_fs_in)-(float)d_code_length*(1/d_code_freq);
|
||||||
|
d_rem_code_phase = (max_tcode + d_code_phase_step - block_correction) - 1023.0;
|
||||||
|
//std::cout<<"d_rem_code_phase="<<d_rem_code_phase<<std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gps_l1_ca_dll_pll_tracking_cc::update_local_carrier()
|
||||||
|
{
|
||||||
|
float phase, phase_step;
|
||||||
|
|
||||||
|
phase_step = (float)TWO_PI*d_carrier_doppler/d_fs_in;
|
||||||
|
phase=d_rem_carr_phase;
|
||||||
|
for(unsigned int i = 0; i < d_vector_length; i++) {
|
||||||
|
d_carr_sign[i] = std::complex<float>(cos(phase),sin(phase));
|
||||||
|
phase += phase_step;
|
||||||
|
}
|
||||||
|
d_rem_carr_phase=fmod(phase,TWO_PI);
|
||||||
|
}
|
||||||
|
gps_l1_ca_dll_pll_tracking_cc::~gps_l1_ca_dll_pll_tracking_cc() {
|
||||||
|
d_dump_file.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void gps_l1_ca_dll_pll_tracking_cc::start_tracking(){
|
||||||
|
unsigned long int acq_sample_difference;
|
||||||
|
int trk_corrected_code_phase;
|
||||||
|
|
||||||
|
acq_sample_difference=this->d_sample_counter-d_acq_sample_stamp-d_vector_length;
|
||||||
|
|
||||||
|
float velocity_ratio,code_freq_mod,T_prn,T_prn_mod,T_chip_mod;
|
||||||
|
|
||||||
|
const float carrier_freq=1575420000;
|
||||||
|
velocity_ratio=(carrier_freq+d_carrier_doppler)/carrier_freq;
|
||||||
|
|
||||||
|
code_freq_mod=velocity_ratio*d_code_freq;
|
||||||
|
|
||||||
|
T_prn=(1/d_code_freq)*(float)d_code_length;
|
||||||
|
|
||||||
|
T_chip_mod=1/code_freq_mod;
|
||||||
|
T_prn_mod=T_chip_mod*(float)d_code_length;
|
||||||
|
|
||||||
|
trk_corrected_code_phase=round(fmod((d_code_phase+(float)acq_sample_difference+(T_prn-T_prn_mod)*((float)acq_sample_difference/(float)d_vector_length)*(float)d_fs_in),(float)d_vector_length));
|
||||||
|
|
||||||
|
if (trk_corrected_code_phase<0)
|
||||||
|
{
|
||||||
|
trk_corrected_code_phase=d_vector_length+trk_corrected_code_phase;
|
||||||
|
}
|
||||||
|
d_absolute_code_phase_chips=(float)trk_corrected_code_phase;
|
||||||
|
|
||||||
|
/*
|
||||||
|
std::cout<<"Acq sample stamp"<<d_acq_sample_stamp<<std::endl;
|
||||||
|
std::cout<<"Acq - Trk sample difference "<<acq_sample_difference<<std::endl;
|
||||||
|
std::cout<<"Trk local code correction "<<trk_corrected_code_phase<<std::endl;
|
||||||
|
std::cout<<"Rounded"<<round((float)d_code_length*(float)trk_corrected_code_phase/(float)d_vector_length);
|
||||||
|
*/
|
||||||
|
// generate local reference with the acquisition shift corrected
|
||||||
|
code_gen_conplex(&d_ca_code[1],d_satellite,1023-round((float)d_code_length*(float)trk_corrected_code_phase/(float)d_vector_length));
|
||||||
|
// Then make it possible to do early and late versions
|
||||||
|
d_ca_code[0]=d_ca_code[1023];
|
||||||
|
d_ca_code[1024]=d_ca_code[1];
|
||||||
|
|
||||||
|
DLOG(INFO) << "Start tracking for satellite "<<this->d_satellite<<" received ";
|
||||||
|
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||||
|
d_enable_tracking=true;
|
||||||
|
std::cout<<"Tracking start on channel "<<d_channel<<" for satellite ID "<< this->d_satellite << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! Tracking signal processing
|
||||||
|
* Notice that this is a class derived from gr_sync_decimator, so each of the ninput_items has vector_length samples
|
||||||
|
*/
|
||||||
|
int gps_l1_ca_dll_pll_tracking_cc::work (int noutput_items,gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) {
|
||||||
|
|
||||||
|
d_sample_counter+=d_vector_length; //count for the processed samples
|
||||||
|
if (d_enable_tracking==true){
|
||||||
|
float carr_error;
|
||||||
|
float carr_nco;
|
||||||
|
float code_error;
|
||||||
|
float code_nco;
|
||||||
|
float tmp_E,tmp_P,tmp_L;
|
||||||
|
|
||||||
|
const gr_complex* in = (gr_complex*) input_items[0];
|
||||||
|
|
||||||
|
float **out = (float **) &output_items[0];
|
||||||
|
|
||||||
|
// Find the size of a "block" or code period in whole samples
|
||||||
|
|
||||||
|
// Update the phasestep based on code freq (variable) and
|
||||||
|
// sampling frequency (fixed)
|
||||||
|
d_code_phase_step = d_code_freq / d_fs_in;
|
||||||
|
|
||||||
|
// original variable block size (MATLAB)
|
||||||
|
//d_blk_size = ceil(((float)d_code_length-d_rem_code_phase) / d_code_phase_step);
|
||||||
|
|
||||||
|
// fixed block size (Javi)
|
||||||
|
d_blk_size = ceil((float)d_code_length*(1/1023000.0)*(float)d_fs_in);
|
||||||
|
|
||||||
|
this->update_local_code_refs();
|
||||||
|
this->update_local_carrier();
|
||||||
|
|
||||||
|
d_E_I=0.0;
|
||||||
|
d_P_I=0.0;
|
||||||
|
d_L_I=0.0;
|
||||||
|
|
||||||
|
d_E_Q=0.0;
|
||||||
|
d_P_Q=0.0;
|
||||||
|
d_L_Q=0.0;
|
||||||
|
|
||||||
|
for(unsigned int i=0;i<d_vector_length;i++) {
|
||||||
|
//Perform the carrier wipe-off
|
||||||
|
d_bb_sign[i] = in[i] * d_carr_sign[i];
|
||||||
|
// Now get early, late, and prompt values for each
|
||||||
|
d_E_Q += d_early_code[i].real()*d_bb_sign[i].real();
|
||||||
|
|
||||||
|
d_E_I += d_early_code[i].real()*d_bb_sign[i].imag();
|
||||||
|
|
||||||
|
d_P_Q += d_prompt_code[i].real()*d_bb_sign[i].real();
|
||||||
|
d_P_I += d_prompt_code[i].real()*d_bb_sign[i].imag();
|
||||||
|
|
||||||
|
d_L_Q += d_late_code[i].real()*d_bb_sign[i].real();
|
||||||
|
d_L_I += d_late_code[i].real()*d_bb_sign[i].imag();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find PLL error and update carrier NCO -
|
||||||
|
// Implement carrier loop discriminator (phase detector)
|
||||||
|
//carr_error = atan(d_P.imag() / d_P.real()) / TWO_PI;
|
||||||
|
|
||||||
|
carr_error = atan(d_P_Q / d_P_I) / TWO_PI;
|
||||||
|
|
||||||
|
// Implement carrier loop filter and generate NCO command
|
||||||
|
|
||||||
|
carr_nco = d_old_carr_nco+(d_tau2_carr/d_tau1_carr)*(carr_error - d_old_carr_error) + carr_error * (d_pdi_carr/d_tau1_carr);
|
||||||
|
d_old_carr_nco = carr_nco;
|
||||||
|
d_old_carr_error = carr_error;
|
||||||
|
|
||||||
|
// Modify carrier freq based on NCO command
|
||||||
|
d_carrier_doppler = d_carr_freq_basis + carr_nco;
|
||||||
|
|
||||||
|
// Find DLL error and update code NCO -
|
||||||
|
//code_error = (abs(d_E)-abs(d_L))/(abs(d_E)+abs(d_L));
|
||||||
|
|
||||||
|
code_error = (sqrt(d_E_I*d_E_I+d_E_Q*d_E_Q)-sqrt(d_L_I*d_L_I+d_L_Q*d_L_Q))/(sqrt(d_E_I*d_E_I+d_E_Q*d_E_Q)+sqrt(d_L_I*d_L_I+d_L_Q*d_L_Q));
|
||||||
|
|
||||||
|
// Implement code loop filter and generate NCO command
|
||||||
|
code_nco = d_old_code_nco + (d_tau2_code/d_tau1_code)*(code_error - d_old_code_error) + code_error * (d_pdi_code/d_tau1_code);
|
||||||
|
d_old_code_nco = code_nco;
|
||||||
|
d_old_code_error = code_error;
|
||||||
|
|
||||||
|
d_absolute_code_phase_chips+=d_old_code_error; //accumulate the error to get the pseudorange
|
||||||
|
|
||||||
|
// Modify code freq based on NCO command
|
||||||
|
d_code_freq = 1023000 - code_nco;
|
||||||
|
|
||||||
|
// Output the tracking data to navigation and PVT
|
||||||
|
|
||||||
|
// Output channel 1: Prompt correlator output Q
|
||||||
|
*out[0]=d_P_Q;
|
||||||
|
// Output channel 2: Prompt correlator output I
|
||||||
|
*out[1]=d_P_I;
|
||||||
|
// Output channel 3: Prompt correlator output
|
||||||
|
*out[2]=d_absolute_code_phase_chips;
|
||||||
|
|
||||||
|
//Equivalent to the "absolute spreading code starting position" information of the matlab tracking algorithm
|
||||||
|
|
||||||
|
// std::cout<<"tmp_E= "<<tmp_E<<std::endl;
|
||||||
|
// std::cout<<"tmp_P= "<<tmp_P<<std::endl;
|
||||||
|
// std::cout<<"tmp_L= "<<tmp_L<<std::endl;
|
||||||
|
//
|
||||||
|
// std::cout<<"trk pllDiscr carr_error= "<<carr_error<<std::endl;
|
||||||
|
// std::cout<<"trk dllDiscr code error= "<<code_error<<std::endl;
|
||||||
|
// std::cout<<"trk dllDiscrFilt code_nco= "<<code_nco<<std::endl;
|
||||||
|
// std::cout<<"trk pllDiscrFilt carr_nco= "<<carr_nco<<std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
if(d_dump) {
|
||||||
|
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||||
|
tmp_E=sqrt(d_E_I*d_E_I+d_E_Q*d_E_Q);
|
||||||
|
tmp_P=sqrt(d_P_I*d_P_I+d_P_Q*d_P_Q);
|
||||||
|
tmp_L=sqrt(d_L_I*d_L_I+d_L_Q*d_L_Q);
|
||||||
|
|
||||||
|
// EPR
|
||||||
|
d_dump_file.write((char*)&tmp_E, sizeof(float));
|
||||||
|
d_dump_file.write((char*)&tmp_P, sizeof(float));
|
||||||
|
d_dump_file.write((char*)&tmp_L, sizeof(float));
|
||||||
|
// DLL
|
||||||
|
d_dump_file.write((char*)&code_error, sizeof(float));
|
||||||
|
d_dump_file.write((char*)&code_nco, sizeof(float));
|
||||||
|
//PLL
|
||||||
|
d_dump_file.write((char*)&carr_error, sizeof(float));
|
||||||
|
d_dump_file.write((char*)&carr_nco, sizeof(float));
|
||||||
|
//FREQ AND PHASE
|
||||||
|
d_dump_file.write((char*)&d_code_freq, sizeof(float));
|
||||||
|
d_dump_file.write((char*)&d_carrier_doppler, sizeof(float));
|
||||||
|
// PROMPT I and Q (to analyze navigation symbols)
|
||||||
|
d_dump_file.write((char*)&d_P_I, sizeof(float));
|
||||||
|
d_dump_file.write((char*)&d_P_Q, sizeof(float));
|
||||||
|
|
||||||
|
}
|
||||||
|
// debug: Second counter in channel 0
|
||||||
|
if (d_channel==0)
|
||||||
|
{
|
||||||
|
if (floor(d_sample_counter/d_fs_in)!=d_last_seg)
|
||||||
|
{
|
||||||
|
d_last_seg=floor(d_sample_counter/d_fs_in);
|
||||||
|
std::cout<<"t="<<d_last_seg<<std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (d_sample_counter>round((float)this->d_fs_in*39)){ //stop after some seconds debug only!
|
||||||
|
d_enable_tracking=false;
|
||||||
|
std::cout<<"Stop tracking at sample "<<d_sample_counter<<" and acq at sample "<<d_acq_sample_stamp<<std::endl;
|
||||||
|
if(d_queue != gr_msg_queue_sptr()) {
|
||||||
|
ControlMessageFactory* cmf = new ControlMessageFactory();
|
||||||
|
d_queue->handle(cmf->GetQueueMessage(200,0)); //send stop to the control_thread
|
||||||
|
delete cmf;
|
||||||
|
std::cout<<"stop sent from tracking" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//consume_each(1); //not necesary for gr_sync_block derivates
|
||||||
|
return 1; //one group of d_vector_lenght samples at time, and output one set of results ALWAYS even in the case of d_enable_tracking==false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void gps_l1_ca_dll_pll_tracking_cc::set_acq_code_phase(float code_phase) {
|
||||||
|
d_code_phase = code_phase;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Tracking code phase set to " << d_code_phase;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gps_l1_ca_dll_pll_tracking_cc::set_acq_doppler(float doppler) {
|
||||||
|
d_carrier_doppler = doppler;
|
||||||
|
d_carr_freq_basis = doppler;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Tracking carrier doppler set to " << d_carrier_doppler;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gps_l1_ca_dll_pll_tracking_cc::set_satellite(unsigned int satellite) {
|
||||||
|
d_satellite = satellite;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Tracking Satellite set to " << d_satellite;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gps_l1_ca_dll_pll_tracking_cc::set_channel(unsigned int channel) {
|
||||||
|
d_channel = channel;
|
||||||
|
LOG_AT_LEVEL(INFO) << "Tracking Channel set to " << d_channel;
|
||||||
|
}
|
|
@ -0,0 +1,189 @@
|
||||||
|
/*!
|
||||||
|
* \file gps_l1_ca_dll_pll_tracking_cc.h
|
||||||
|
* \brief Brief description of the file here
|
||||||
|
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GPS_L1_CA_DLL_PLL_TRACKING_CC_H
|
||||||
|
#define GPS_L1_CA_DLL_PLL_TRACKING_CC_H
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include <gnuradio/gr_block.h>
|
||||||
|
#include <gnuradio/gr_msg_queue.h>
|
||||||
|
#include <gnuradio/gr_sync_decimator.h>
|
||||||
|
|
||||||
|
#include "gps_sdr_signal_processing.h"
|
||||||
|
|
||||||
|
#include <queue>
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
|
#include <boost/thread/thread.hpp>
|
||||||
|
#include "concurrent_queue.h"
|
||||||
|
|
||||||
|
// #include "gps_sdr_structs.h"
|
||||||
|
// #include "gps_sdr_channel.h"
|
||||||
|
|
||||||
|
class gps_l1_ca_dll_pll_tracking_cc;
|
||||||
|
typedef boost::shared_ptr<gps_l1_ca_dll_pll_tracking_cc>
|
||||||
|
gps_l1_ca_dll_pll_tracking_cc_sptr;
|
||||||
|
|
||||||
|
gps_l1_ca_dll_pll_tracking_cc_sptr
|
||||||
|
gps_l1_ca_dll_pll_make_tracking_cc(unsigned int satellite, long if_freq,
|
||||||
|
long fs_in, unsigned
|
||||||
|
int vector_length,
|
||||||
|
gr_msg_queue_sptr queue, bool dump);
|
||||||
|
|
||||||
|
class gps_l1_ca_dll_pll_tracking_cc: public gr_sync_decimator
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend gps_l1_ca_dll_pll_tracking_cc_sptr
|
||||||
|
gps_l1_ca_dll_pll_make_tracking_cc(unsigned int satellite, long if_freq,
|
||||||
|
long fs_in, unsigned
|
||||||
|
int vector_length,
|
||||||
|
gr_msg_queue_sptr queue, bool dump);
|
||||||
|
|
||||||
|
gps_l1_ca_dll_pll_tracking_cc(unsigned int satellite, long if_freq,
|
||||||
|
long fs_in, unsigned
|
||||||
|
int vector_length, gr_msg_queue_sptr queue,
|
||||||
|
bool dump);
|
||||||
|
|
||||||
|
void calculate_lopp_coef(float* tau1, float* tau2, float lbw, float zeta,
|
||||||
|
float k);
|
||||||
|
void update_local_code_refs();
|
||||||
|
void update_local_carrier();
|
||||||
|
|
||||||
|
// class private vars
|
||||||
|
gr_msg_queue_sptr d_queue;
|
||||||
|
concurrent_queue<int> *d_channel_internal_queue;
|
||||||
|
unsigned int d_vector_length;
|
||||||
|
bool d_dump;
|
||||||
|
unsigned int d_satellite;
|
||||||
|
unsigned int d_channel; //?
|
||||||
|
int d_last_seg;
|
||||||
|
long d_if_freq;
|
||||||
|
long d_fs_in;
|
||||||
|
float d_tau1_code;
|
||||||
|
float d_tau2_code;
|
||||||
|
|
||||||
|
float d_tau1_carr;
|
||||||
|
float d_tau2_carr;
|
||||||
|
|
||||||
|
float d_early_late_spc;
|
||||||
|
float d_pdi_code;
|
||||||
|
float d_pdi_carr;
|
||||||
|
float d_dllnoisebandwidth;
|
||||||
|
float d_dlldampingratio;
|
||||||
|
|
||||||
|
float d_pllnoisebandwidth;
|
||||||
|
float d_plldampingratio;
|
||||||
|
|
||||||
|
unsigned int d_code_length;
|
||||||
|
unsigned int d_blk_size;
|
||||||
|
float d_code_phase_step;
|
||||||
|
|
||||||
|
gr_complex* d_ca_code;
|
||||||
|
|
||||||
|
gr_complex* d_early_code;
|
||||||
|
gr_complex* d_late_code;
|
||||||
|
gr_complex* d_prompt_code;
|
||||||
|
|
||||||
|
gr_complex* d_carr_sign;
|
||||||
|
gr_complex* d_bb_sign;
|
||||||
|
|
||||||
|
float d_code_freq;
|
||||||
|
float d_rem_code_phase;
|
||||||
|
|
||||||
|
float d_rem_carr_phase;
|
||||||
|
|
||||||
|
float d_old_code_nco;
|
||||||
|
float d_old_code_error;
|
||||||
|
|
||||||
|
float d_old_carr_nco;
|
||||||
|
float d_old_carr_error;
|
||||||
|
|
||||||
|
float d_code_phase;
|
||||||
|
float d_carrier_doppler;
|
||||||
|
float d_carr_freq_basis;
|
||||||
|
|
||||||
|
//std::complex<double> d_E;
|
||||||
|
//std::complex<double> d_P;
|
||||||
|
//std::complex<double> d_L;
|
||||||
|
float d_E_I;
|
||||||
|
float d_E_Q;
|
||||||
|
float d_P_I;
|
||||||
|
float d_P_Q;
|
||||||
|
float d_L_I;
|
||||||
|
float d_L_Q;
|
||||||
|
|
||||||
|
float d_absolute_code_phase_chips;
|
||||||
|
|
||||||
|
unsigned long int d_sample_counter;
|
||||||
|
unsigned long int d_acq_sample_stamp;
|
||||||
|
bool d_enable_tracking;
|
||||||
|
|
||||||
|
std::string d_dump_filename;
|
||||||
|
std::ofstream d_dump_file;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
~gps_l1_ca_dll_pll_tracking_cc();
|
||||||
|
|
||||||
|
void set_satellite(unsigned int satellite);
|
||||||
|
void set_channel(unsigned int channel);
|
||||||
|
void set_acq_code_phase(float code_phase);
|
||||||
|
void set_acq_doppler(float doppler);
|
||||||
|
void start_tracking();
|
||||||
|
|
||||||
|
void set_acq_sample_stamp(unsigned long int sample_stamp)
|
||||||
|
{
|
||||||
|
d_acq_sample_stamp = sample_stamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_channel_queue(concurrent_queue<int> *channel_internal_queue)
|
||||||
|
{
|
||||||
|
d_channel_internal_queue = channel_internal_queue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief just like gr_block::general_work, only this arranges to call consume_each for you
|
||||||
|
*
|
||||||
|
* The user must override work to define the signal processing code
|
||||||
|
*/
|
||||||
|
//virtual int work (int noutput_items,
|
||||||
|
// gr_vector_const_void_star &input_items,
|
||||||
|
// gr_vector_void_star &output_items) = 0;
|
||||||
|
|
||||||
|
int work(int noutput_items, gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //GPS_L1_CA_DLL_PLL_TRACKING_CC_H
|
|
@ -0,0 +1,3 @@
|
||||||
|
project : build-dir ../../../../build ;
|
||||||
|
|
||||||
|
obj gps_l1_ca_dll_pll_tracking_cc : gps_l1_ca_dll_pll_tracking_cc.cc ;
|
|
@ -0,0 +1,2 @@
|
||||||
|
build-project adapters ;
|
||||||
|
build-project gnuradio_blocks ;
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*!
|
||||||
|
* \file acquisition_interface.h
|
||||||
|
* \brief Header file of the interface to an acquisition GNSS block.
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* This header file contains the interface to an abstract class
|
||||||
|
* for acquisition algorithms. Since all its methods are virtual,
|
||||||
|
* this class cannot be instantiated directly, and a subclass can only be
|
||||||
|
* instantiated directly if all inherited pure virtual methods have been
|
||||||
|
* implemented by that class or a parent class.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_ACQUISITION_INTERFACE_H_
|
||||||
|
#define GNSS_SDR_ACQUISITION_INTERFACE_H_
|
||||||
|
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
|
||||||
|
template<typename Data>class concurrent_queue;
|
||||||
|
|
||||||
|
/*! \brief This abstract class represents an interface to an acquisition GNSS block.
|
||||||
|
*
|
||||||
|
* Abstract class for acquisition algorithms. Since all its methods are virtual,
|
||||||
|
* this class cannot be instantiated directly, and a subclass can only be
|
||||||
|
* instantiated directly if all inherited pure virtual methods have been
|
||||||
|
* implemented by that class or a parent class.
|
||||||
|
*/
|
||||||
|
class AcquisitionInterface: public GNSSBlockInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//virtual void set_active(bool active) = 0;
|
||||||
|
virtual void set_satellite(unsigned int satellite) = 0;
|
||||||
|
virtual void set_channel(unsigned int channel) = 0;
|
||||||
|
virtual void set_threshold(float threshold) = 0;
|
||||||
|
virtual void set_doppler_max(unsigned int doppler_max) = 0;
|
||||||
|
virtual void set_doppler_step(unsigned int doppler_step) = 0;
|
||||||
|
virtual void set_channel_queue(concurrent_queue<int> *channel_internal_queue) = 0;
|
||||||
|
virtual signed int prn_code_phase() = 0;
|
||||||
|
virtual float doppler_freq_shift() = 0;
|
||||||
|
virtual signed int mag() = 0;
|
||||||
|
virtual void reset() = 0;
|
||||||
|
virtual unsigned long int get_sample_stamp() = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* GNSS_SDR_ACQUISITION_INTERFACE */
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*!
|
||||||
|
* \file channel_interface.h
|
||||||
|
* \brief This class represents an interface to a channel GNSS block.
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||||
|
*
|
||||||
|
* Abstract class for channel blocks. Since all its methods are virtual,
|
||||||
|
* this class cannot be instantiated directly, and a subclass can only be
|
||||||
|
* instantiated directly if all inherited pure virtual methods have been
|
||||||
|
* implemented by that class or a parent class.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_CHANNEL_INTERFACE_H_
|
||||||
|
#define GNSS_SDR_CHANNEL_INTERFACE_H_
|
||||||
|
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief This abstract class represents an interface to a channel GNSS block.
|
||||||
|
*
|
||||||
|
* Abstract class for channel blocks. Since all its methods are virtual,
|
||||||
|
* this class cannot be instantiated directly, and a subclass can only be
|
||||||
|
* instantiated directly if all inherited pure virtual methods have been
|
||||||
|
* implemented by that class or a parent class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class ChannelInterface: public GNSSBlockInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual unsigned int satellite() = 0;
|
||||||
|
virtual void start_acquisition() = 0;
|
||||||
|
virtual void set_satellite(unsigned int) = 0;
|
||||||
|
virtual void start() = 0;
|
||||||
|
virtual void stop() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* GNSS_SDR_CHANNEL_INTERFACE_H_ */
|
|
@ -0,0 +1,76 @@
|
||||||
|
/*!
|
||||||
|
* \file configuration_interface.h
|
||||||
|
* \brief This class represents an interface to configuration parameters.
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
*
|
||||||
|
* The interface defines an accessor method that gets a parameter name as input
|
||||||
|
* and returns the value of this parameter, a string, as output.
|
||||||
|
* Property names are defined here. This is an abstract class for interfaces.
|
||||||
|
* Since all its methods are virtual,
|
||||||
|
* this class cannot be instantiated directly, and a subclass can only be
|
||||||
|
* instantiated directly if all inherited pure virtual methods have been
|
||||||
|
* implemented by that class or a parent class.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_CONFIGURATION_INTERFACE_H_
|
||||||
|
#define GNSS_SDR_CONFIGURATION_INTERFACE_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief This abstract class represents an interface to configuration parameters.
|
||||||
|
*
|
||||||
|
* The interface defines an accessor method that gets a parameter name as input
|
||||||
|
* and returns the value of this parameter, a string, as output.
|
||||||
|
* Property names are defined here. This is an abstract class for interfaces.
|
||||||
|
* Since all its methods are virtual,
|
||||||
|
* this class cannot be instantiated directly, and a subclass can only be
|
||||||
|
* instantiated directly if all inherited pure virtual methods have been
|
||||||
|
* implemented by that class or a parent class.
|
||||||
|
*/
|
||||||
|
class ConfigurationInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual ~ConfigurationInterface()
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual std::string property(std::string property_name,
|
||||||
|
std::string default_value) = 0;
|
||||||
|
virtual bool property(std::string property_name, bool default_value) = 0;
|
||||||
|
virtual long property(std::string property_name, long default_value) = 0;
|
||||||
|
virtual int property(std::string property_name, int default_value) = 0;
|
||||||
|
virtual unsigned int property(std::string property_name,
|
||||||
|
unsigned int default_value) = 0;
|
||||||
|
virtual float property(std::string property_name, float default_value) = 0;
|
||||||
|
virtual double property(std::string property_name, double default_value) = 0;
|
||||||
|
|
||||||
|
virtual void set_property(std::string property_name, std::string value) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*GNSS_SDR_CONFIGURATION_INTERFACE_H_*/
|
|
@ -0,0 +1,69 @@
|
||||||
|
/*!
|
||||||
|
* \file gnss_block_interface.h
|
||||||
|
* \brief This interface represents a GNSS block.
|
||||||
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||||
|
*
|
||||||
|
* Abstract class for GNSS block interfaces. Since all its methods are virtual,
|
||||||
|
* this class cannot be instantiated directly, and a subclass can only be
|
||||||
|
* instantiated directly if all inherited pure virtual methods have been
|
||||||
|
* implemented by that class or a parent class.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_GNSS_BLOCK_INTERFACE_H_
|
||||||
|
#define GNSS_SDR_GNSS_BLOCK_INTERFACE_H_
|
||||||
|
|
||||||
|
#include <gnuradio/gr_hier_block2.h>
|
||||||
|
#include <gnuradio/gr_top_block.h>
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief This abstract class represents an interface to GNSS blocks.
|
||||||
|
*
|
||||||
|
* Abstract class for GNSS block interfaces. Since all its methods are virtual,
|
||||||
|
* this class cannot be instantiated directly, and a subclass can only be
|
||||||
|
* instantiated directly if all inherited pure virtual methods have been
|
||||||
|
* implemented by that class or a parent class.
|
||||||
|
*/
|
||||||
|
class GNSSBlockInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual ~GNSSBlockInterface()
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual std::string role() = 0;
|
||||||
|
virtual std::string implementation() = 0;
|
||||||
|
virtual size_t item_size() = 0;
|
||||||
|
|
||||||
|
virtual void connect(gr_top_block_sptr top_block) = 0;
|
||||||
|
virtual void disconnect(gr_top_block_sptr top_block) = 0;
|
||||||
|
virtual gr_basic_block_sptr get_left_block() = 0;
|
||||||
|
virtual gr_basic_block_sptr get_right_block() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*GNSS_SDR_GNSS_BLOCK_INTERFACE_H_*/
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*!
|
||||||
|
* \file pseudorange_interface.h
|
||||||
|
* \brief This class represents an interface to a navigation gnss block.
|
||||||
|
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
*
|
||||||
|
* Abstract class for pseudorange_intefaces. Since all its methods are virtual,
|
||||||
|
* this class cannot be instantiated directly, and a subclass can only be
|
||||||
|
* instantiated directly if all inherited pure virtual methods have been
|
||||||
|
* implemented by that class or a parent class.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_OBSERVABLES_INTERFACE_H_
|
||||||
|
#define GNSS_SDR_OBSERVABLES_INTERFACE_H_
|
||||||
|
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief This abstract class represents an interface to an observables block.
|
||||||
|
*
|
||||||
|
* Abstract class for pseudorange_intefaces, derived from GNSSBlockInterface.
|
||||||
|
* Since all its methods are virtual,
|
||||||
|
* this class cannot be instantiated directly, and a subclass can only be
|
||||||
|
* instantiated directly if all inherited pure virtual methods have been
|
||||||
|
* implemented by that class or a parent class.
|
||||||
|
*/
|
||||||
|
class ObservablesInterface : public GNSSBlockInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void reset() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* GNSS_SDR_OBSERVABLES_INTERFACE_H_ */
|
|
@ -0,0 +1,60 @@
|
||||||
|
/*!
|
||||||
|
* \file navigation_interface.h
|
||||||
|
* \brief This class represents an interface to a navigation GNSS block.
|
||||||
|
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
|
*
|
||||||
|
* Abstract class for navigation interfaces. Since all its methods are virtual,
|
||||||
|
* this class cannot be instantiated directly, and a subclass can only be
|
||||||
|
* instantiated directly if all inherited pure virtual methods have been
|
||||||
|
* implemented by that class or a parent class.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_TELEMETRY_DECODER_INTERFACE_H_
|
||||||
|
#define GNSS_SDR_TELEMETRY_DECODER_INTERFACE_H_
|
||||||
|
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief This abstract class represents an interface to a navigation GNSS block.
|
||||||
|
*
|
||||||
|
* Abstract class for navigation interfaces. Since all its methods are virtual,
|
||||||
|
* this class cannot be instantiated directly, and a subclass can only be
|
||||||
|
* instantiated directly if all inherited pure virtual methods have been
|
||||||
|
* implemented by that class or a parent class.
|
||||||
|
*/
|
||||||
|
class TelemetryDecoderInterface : public GNSSBlockInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void reset() = 0;
|
||||||
|
virtual void set_satellite(int satellite) = 0;
|
||||||
|
virtual void set_channel(int channel) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* GNSS_SDR_TELEMETRY_DECODER_INTERFACE_H_ */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue