1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-06-27 07:32:57 +00:00

Merge with next and adding full suport for custom AD936x sample sizes and dual frequency modes with external mixer board

This commit is contained in:
Javier Arribas 2022-08-29 11:49:55 +02:00
commit baa2a33838
42 changed files with 400 additions and 445 deletions

View File

@ -16,7 +16,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: install dependencies - name: install dependencies
run: sudo apt-get update && sudo apt-get install ninja-build libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev libboost-serialization-dev liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev python3-mako run: sudo apt-get update && sudo apt-get install ninja-build libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev libboost-serialization-dev liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev python3-mako liborc-0.4-dev
- name: configure - name: configure
run: cd build && cmake -GNinja .. run: cd build && cmake -GNinja ..
- name: build - name: build

View File

@ -630,45 +630,6 @@ endif()
################################################################################
# Log4cpp - http://log4cpp.sourceforge.net/
################################################################################
if(GNURADIO_USES_LOG4CPP)
find_package(LOG4CPP)
set_package_properties(LOG4CPP PROPERTIES
PURPOSE "Required by GNU Radio."
TYPE REQUIRED
)
endif()
################################################################################
# spdlog - https://github.com/gabime/spdlog
################################################################################
if(GNURADIO_USES_SPDLOG)
find_package(SPDLOG REQUIRED)
set_package_properties(SPDLOG PROPERTIES
PURPOSE "Required by GNU Radio."
TYPE REQUIRED
)
endif()
################################################################################
# fmt - https://github.com/fmtlib/fmt
################################################################################
if(GNURADIO_USES_SPDLOG)
find_package(FMT REQUIRED)
set_package_properties(FMT PROPERTIES
PURPOSE "Required by GNU Radio."
TYPE REQUIRED
)
endif()
################################################################################ ################################################################################
# Detect availability of std::filesystem and set C++ standard accordingly # Detect availability of std::filesystem and set C++ standard accordingly
################################################################################ ################################################################################

View File

@ -1,76 +0,0 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2021 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
# Locate header
find_path(FMT_INCLUDE_DIR fmt/core.h
HINTS ${FMT_ROOT_DIR}/include
PATHS
/usr/include
/usr/local/include
/opt/local/include
)
# Locate library
find_library(FMT_LIBRARY NAMES fmt
HINTS ${FMT_ROOT_DIR}/lib ${FMT_ROOT_DIR}/lib64
PATHS
/usr/lib
/usr/lib64
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabi
/usr/lib/aarch64-linux-gnu
/usr/lib/mipsel-linux-gnu
/usr/lib/mips-linux-gnu
/usr/lib/mips64el-linux-gnuabi64
/usr/lib/powerpc-linux-gnu
/usr/lib/powerpc64-linux-gnu
/usr/lib/powerpc64le-linux-gnu
/usr/lib/powerpc-linux-gnuspe
/usr/lib/hppa-linux-gnu
/usr/lib/s390x-linux-gnu
/usr/lib/i386-gnu
/usr/lib/hppa-linux-gnu
/usr/lib/x86_64-kfreebsd-gnu
/usr/lib/i386-kfreebsd-gnu
/usr/lib/m68k-linux-gnu
/usr/lib/sh4-linux-gnu
/usr/lib/sparc64-linux-gnu
/usr/lib/x86_64-linux-gnux32
/usr/lib/alpha-linux-gnu
/usr/lib/riscv64-linux-gnu
/usr/local/lib
/usr/local/lib64
/opt/local/lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FMT DEFAULT_MSG FMT_INCLUDE_DIR FMT_LIBRARY)
set_package_properties(FMT PROPERTIES
URL "https://github.com/fmtlib/fmt"
DESCRIPTION "An open-source formatting library"
)
# Add imported target.
if(FMT_FOUND)
set(FMT_INCLUDE_DIRS "${FMT_INCLUDE_DIR}")
if(NOT TARGET fmt::fmt)
add_library(fmt::fmt UNKNOWN IMPORTED)
set_target_properties(fmt::fmt PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${FMT_INCLUDE_DIRS}"
)
set_property(TARGET fmt::fmt APPEND PROPERTY
IMPORTED_LOCATION "${FMT_LIBRARY}"
)
endif()
endif()

View File

@ -20,7 +20,7 @@ include(FindPackageHandleStandardArgs)
# if GR_REQUIRED_COMPONENTS is not defined, it will be set to the following list # if GR_REQUIRED_COMPONENTS is not defined, it will be set to the following list
if(NOT GR_REQUIRED_COMPONENTS) if(NOT GR_REQUIRED_COMPONENTS)
set(GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS FFT FILTER ANALOG) set(GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS FFT FILTER ANALOG)
endif() endif()
# Allows us to use all .cmake files in this directory # Allows us to use all .cmake files in this directory
@ -411,10 +411,28 @@ if(GNURADIO_RUNTIME_INCLUDE_DIRS)
endif() endif()
endforeach() endforeach()
if(${_uses_log4cpp}) if(${_uses_log4cpp})
set(GNURADIO_USES_LOG4CPP TRUE) find_package(LOG4CPP)
set_package_properties(LOG4CPP PROPERTIES
PURPOSE "Required by GNU Radio."
TYPE REQUIRED
)
if(CMAKE_VERSION VERSION_GREATER 3.13)
target_link_libraries(Gnuradio::filter INTERFACE Log4cpp::log4cpp)
else()
set(LOG4CPP_WITH_OLD_CMAKE TRUE)
endif()
endif() endif()
if(${_uses_spdlog}) if(${_uses_spdlog})
find_package(spdlog REQUIRED CONFIG)
set_package_properties(spdlog PROPERTIES
URL "https://github.com/gabime/spdlog"
DESCRIPTION "Very fast, header-only/compiled, C++ logging library (found: v${spdlog_VERSION})"
PURPOSE "Required by GNU Radio."
TYPE REQUIRED
)
set(GNURADIO_USES_SPDLOG TRUE) set(GNURADIO_USES_SPDLOG TRUE)
target_link_libraries(Gnuradio::runtime INTERFACE spdlog::spdlog)
target_link_libraries(Gnuradio::blocks INTERFACE spdlog::spdlog)
endif() endif()
endif() endif()
endif() endif()

View File

@ -1,84 +0,0 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2021 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
# Locate header
find_path(SPDLOG_INCLUDE_DIR spdlog/spdlog.h
HINTS ${SPDLOG_ROOT_DIR}/include
PATHS
/usr/include
/usr/local/include
/opt/local/include
)
# Locate library
find_library(SPDLOG_LIBRARY NAMES spdlog spdlogd
HINTS ${SPDLOG_ROOT_DIR}/lib ${SPDLOG_ROOT_DIR}/lib64
PATHS
/usr/lib
/usr/lib64
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabi
/usr/lib/aarch64-linux-gnu
/usr/lib/mipsel-linux-gnu
/usr/lib/mips-linux-gnu
/usr/lib/mips64el-linux-gnuabi64
/usr/lib/powerpc-linux-gnu
/usr/lib/powerpc64-linux-gnu
/usr/lib/powerpc64le-linux-gnu
/usr/lib/powerpc-linux-gnuspe
/usr/lib/hppa-linux-gnu
/usr/lib/s390x-linux-gnu
/usr/lib/i386-gnu
/usr/lib/hppa-linux-gnu
/usr/lib/x86_64-kfreebsd-gnu
/usr/lib/i386-kfreebsd-gnu
/usr/lib/m68k-linux-gnu
/usr/lib/sh4-linux-gnu
/usr/lib/sparc64-linux-gnu
/usr/lib/x86_64-linux-gnux32
/usr/lib/alpha-linux-gnu
/usr/lib/riscv64-linux-gnu
/usr/local/lib
/usr/local/lib64
/opt/local/lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SPDLOG DEFAULT_MSG SPDLOG_INCLUDE_DIR SPDLOG_LIBRARY)
set_package_properties(SPDLOG PROPERTIES
URL "https://github.com/gabime/spdlog"
DESCRIPTION "Very fast, header-only/compiled, C++ logging library"
)
# Add imported target.
if(SPDLOG_FOUND)
set(SPDLOG_INCLUDE_DIRS "${SPDLOG_INCLUDE_DIR}")
if(NOT TARGET spdlog::spdlog)
add_library(spdlog::spdlog UNKNOWN IMPORTED)
set_target_properties(spdlog::spdlog PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SPDLOG_INCLUDE_DIRS}"
)
set_property(TARGET spdlog::spdlog APPEND PROPERTY
IMPORTED_LOCATION "${SPDLOG_LIBRARY}"
)
endif()
if(CMAKE_VERSION VERSION_GREATER 3.11.0)
target_compile_definitions(spdlog::spdlog INTERFACE -DSPDLOG_FMT_EXTERNAL=1)
else()
set_property(TARGET spdlog::spdlog APPEND PROPERTY
INTERFACE_COMPILE_DEFINITIONS SPDLOG_FMT_EXTERNAL=1
)
endif()
endif()

View File

@ -62,6 +62,7 @@ All notable changes to GNSS-SDR will be documented in this file.
- The configuration options at building time `-DENABLE_OWN_GLOG`, - The configuration options at building time `-DENABLE_OWN_GLOG`,
`-DENABLE_OWN_ARMADILLO`, and `-DENABLE_OWN_GNSSTK` can now be switched `ON` `-DENABLE_OWN_ARMADILLO`, and `-DENABLE_OWN_GNSSTK` can now be switched `ON`
and `OFF` without the need to start from an empty buiding folder. and `OFF` without the need to start from an empty buiding folder.
- Improved CMake handling of the spdlog library used by GNU Radio >= 3.10.
### Improvements in Usability: ### Improvements in Usability:

View File

@ -39,14 +39,6 @@ if(USE_OLD_BOOST_MATH_COMMON_FACTOR)
) )
endif() endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(pvt_adapters
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(ENABLE_CLANG_TIDY) if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE) if(CLANG_TIDY_EXE)
set_target_properties(pvt_adapters set_target_properties(pvt_adapters

View File

@ -1873,8 +1873,8 @@ int32_t Rtcm::read_MT1020(const std::string& message, Glonass_Gnav_Ephemeris& gl
{ {
} // Avoid compiler warning } // Avoid compiler warning
glonass_gnav_eph.d_P_1 = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 2))); uint32_t P_1_tmp = Rtcm::bin_to_uint(message_bin.substr(index, 2));
glonass_gnav_eph.d_P_1 = (glonass_gnav_eph.d_P_1 + 1) * 15; glonass_gnav_eph.d_P_1 = (P_1_tmp == 0) ? 0. : (P_1_tmp + 1) * 15;
index += 2; index += 2;
glonass_gnav_eph.d_t_k += static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 5))) * 3600; glonass_gnav_eph.d_t_k += static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 5))) * 3600;
@ -5102,8 +5102,9 @@ int32_t Rtcm::set_DF105(uint32_t glonass_gnav_alm_health_ind)
int32_t Rtcm::set_DF106(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF106(const Glonass_Gnav_Ephemeris& glonass_gnav_eph)
{ {
// Convert the value from (15, 30, 45, 60) to (00, 01, 10, 11) // Convert the value from (0, 30, 45, 60) to (00, 01, 10, 11)
const auto P_1 = static_cast<uint32_t>(std::round(glonass_gnav_eph.d_P_1 / 15.0 - 1.0)); uint32_t P_1_tmp = std::round(glonass_gnav_eph.d_P_1 / 15.);
uint32_t P_1 = (P_1_tmp == 0) ? 0 : P_1_tmp - 1;
DF106 = std::bitset<2>(P_1); DF106 = std::bitset<2>(P_1);
return 0; return 0;
} }

View File

@ -40,6 +40,8 @@ Channel::Channel(const ConfigurationInterface* configuration,
role_(role), role_(role),
channel_(channel) channel_(channel)
{ {
glonass_extend_correlation_ms_ = configuration->property("Tracking_1G.extend_correlation_ms", 0) + configuration->property("Tracking_2G.extend_correlation_ms", 0);
channel_fsm_ = std::make_shared<ChannelFsm>(); channel_fsm_ = std::make_shared<ChannelFsm>();
flag_enable_fpga_ = configuration->property("GNSS-SDR.enable_FPGA", false); flag_enable_fpga_ = configuration->property("GNSS-SDR.enable_FPGA", false);
@ -128,7 +130,7 @@ void Channel::connect(gr::top_block_sptr top_block)
// Message ports // Message ports
top_block->msg_connect(nav_->get_left_block(), pmt::mp("telemetry_to_trk"), trk_->get_right_block(), pmt::mp("telemetry_to_trk")); top_block->msg_connect(nav_->get_left_block(), pmt::mp("telemetry_to_trk"), trk_->get_right_block(), pmt::mp("telemetry_to_trk"));
if ((trk_->get_right_block()->name() == "glonass_l1_ca_dll_pll_c_aid_tracking_cc") || (trk_->get_right_block()->name() == "glonass_l2_ca_dll_pll_c_aid_tracking_cc")) if (glonass_dll_pll_c_aid_tracking_check())
{ {
top_block->msg_connect(nav_->get_left_block(), pmt::mp("preamble_timestamp_samples"), trk_->get_right_block(), pmt::mp("preamble_timestamp_samples")); top_block->msg_connect(nav_->get_left_block(), pmt::mp("preamble_timestamp_samples"), trk_->get_right_block(), pmt::mp("preamble_timestamp_samples"));
} }
@ -162,7 +164,7 @@ void Channel::disconnect(gr::top_block_sptr top_block)
nav_->disconnect(top_block); nav_->disconnect(top_block);
top_block->msg_disconnect(nav_->get_left_block(), pmt::mp("telemetry_to_trk"), trk_->get_right_block(), pmt::mp("telemetry_to_trk")); top_block->msg_disconnect(nav_->get_left_block(), pmt::mp("telemetry_to_trk"), trk_->get_right_block(), pmt::mp("telemetry_to_trk"));
if ((trk_->get_right_block()->name() == "glonass_l1_ca_dll_pll_c_aid_tracking_cc") || (trk_->get_right_block()->name() == "glonass_l2_ca_dll_pll_c_aid_tracking_cc")) if (glonass_dll_pll_c_aid_tracking_check())
{ {
top_block->msg_disconnect(nav_->get_left_block(), pmt::mp("preamble_timestamp_samples"), trk_->get_right_block(), pmt::mp("preamble_timestamp_samples")); top_block->msg_disconnect(nav_->get_left_block(), pmt::mp("preamble_timestamp_samples"), trk_->get_right_block(), pmt::mp("preamble_timestamp_samples"));
} }
@ -270,3 +272,28 @@ void Channel::start_acquisition()
} }
DLOG(INFO) << "Channel start_acquisition()"; DLOG(INFO) << "Channel start_acquisition()";
} }
bool Channel::glonass_dll_pll_c_aid_tracking_check()
{
if (glonass_extend_correlation_ms_)
{
const pmt::pmt_t nav_ports_out = nav_->get_left_block()->message_ports_out();
const pmt::pmt_t trk_ports_in = trk_->get_right_block()->message_ports_in();
const pmt::pmt_t symbol = pmt::mp("preamble_timestamp_samples");
for (unsigned k = 0; k < pmt::length(nav_ports_out); k++)
{
if (pmt::vector_ref(nav_ports_out, k) == symbol)
{
for (unsigned j = 0; j < pmt::length(trk_ports_in); j++)
{
if (pmt::vector_ref(trk_ports_in, j) == symbol)
{
return true;
}
}
return false;
}
}
}
return false;
}

View File

@ -96,6 +96,7 @@ public:
inline std::shared_ptr<TelemetryDecoderInterface> telemetry() const { return nav_; } inline std::shared_ptr<TelemetryDecoderInterface> telemetry() const { return nav_; }
private: private:
bool glonass_dll_pll_c_aid_tracking_check();
std::shared_ptr<ChannelFsm> channel_fsm_; std::shared_ptr<ChannelFsm> channel_fsm_;
std::shared_ptr<AcquisitionInterface> acq_; std::shared_ptr<AcquisitionInterface> acq_;
std::shared_ptr<TrackingInterface> trk_; std::shared_ptr<TrackingInterface> trk_;
@ -106,6 +107,7 @@ private:
std::string role_; std::string role_;
std::mutex mx_; std::mutex mx_;
uint32_t channel_; uint32_t channel_;
int glonass_extend_correlation_ms_;
bool connected_; bool connected_;
bool repeat_; bool repeat_;
bool flag_enable_fpga_; bool flag_enable_fpga_;

View File

@ -54,14 +54,6 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(channel_libs
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(USE_GENERIC_LAMBDAS) if(USE_GENERIC_LAMBDAS)
set(has_generic_lambdas HAS_GENERIC_LAMBDA=1) set(has_generic_lambdas HAS_GENERIC_LAMBDA=1)
set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0) set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0)

View File

@ -42,14 +42,6 @@ target_link_libraries(conditioner_adapters
Glog::glog Glog::glog
) )
if(GNURADIO_USES_SPDLOG)
target_link_libraries(conditioner_adapters
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
target_include_directories(conditioner_adapters target_include_directories(conditioner_adapters
PUBLIC PUBLIC
${GNSSSDR_SOURCE_DIR}/src/core/interfaces ${GNSSSDR_SOURCE_DIR}/src/core/interfaces

View File

@ -55,14 +55,6 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(data_type_gr_blocks
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
set_property(TARGET data_type_gr_blocks set_property(TARGET data_type_gr_blocks
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>

View File

@ -48,26 +48,18 @@ target_link_libraries(input_filter_gr_blocks
Volk::volk Volk::volk
) )
if(LOG4CPP_FOUND)
target_link_libraries(input_filter_gr_blocks
PRIVATE
Log4cpp::log4cpp
)
endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(input_filter_gr_blocks
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
target_include_directories(input_filter_gr_blocks target_include_directories(input_filter_gr_blocks
PUBLIC PUBLIC
${GNSSSDR_SOURCE_DIR}/src/core/interfaces ${GNSSSDR_SOURCE_DIR}/src/core/interfaces
) )
if(LOG4CPP_WITH_OLD_CMAKE)
target_link_libraries(input_filter_gr_blocks
PRIVATE
Log4cpp::log4cpp
)
endif()
if(GNURADIO_USES_STD_POINTERS) if(GNURADIO_USES_STD_POINTERS)
target_compile_definitions(input_filter_gr_blocks target_compile_definitions(input_filter_gr_blocks
PUBLIC -DGNURADIO_USES_STD_POINTERS=1 PUBLIC -DGNURADIO_USES_STD_POINTERS=1

View File

@ -119,14 +119,6 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(algorithms_libs
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(FILESYSTEM_FOUND) if(FILESYSTEM_FOUND)
target_compile_definitions(algorithms_libs PUBLIC -DHAS_STD_FILESYSTEM=1) target_compile_definitions(algorithms_libs PUBLIC -DHAS_STD_FILESYSTEM=1)
if(find_experimental) if(find_experimental)

View File

@ -37,14 +37,6 @@ target_link_libraries(obs_gr_blocks
Gnuradio::pmt Gnuradio::pmt
) )
if(GNURADIO_USES_SPDLOG)
target_link_libraries(obs_gr_blocks
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
target_include_directories(obs_gr_blocks target_include_directories(obs_gr_blocks
PUBLIC PUBLIC
${GNSSSDR_SOURCE_DIR}/src/core/interfaces ${GNSSSDR_SOURCE_DIR}/src/core/interfaces

View File

@ -50,14 +50,6 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(NOT GNURADIO_USES_LOG4CPP)
target_link_libraries(resampler_gr_blocks
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
target_include_directories(resampler_gr_blocks target_include_directories(resampler_gr_blocks
PUBLIC PUBLIC
${GNSSSDR_SOURCE_DIR}/src/core/interfaces ${GNSSSDR_SOURCE_DIR}/src/core/interfaces

View File

@ -44,14 +44,6 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(signal_generator_adapters
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(ENABLE_CLANG_TIDY) if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE) if(CLANG_TIDY_EXE)
set_target_properties(signal_generator_adapters set_target_properties(signal_generator_adapters

View File

@ -109,16 +109,19 @@ Ad936xCustomSignalSource::Ad936xCustomSignalSource(const ConfigurationInterface*
else if (ssize_ == 8) else if (ssize_ == 8)
{ {
gr_interleaved_char_to_complex_.push_back(gr::blocks::interleaved_char_to_complex::make()); gr_interleaved_char_to_complex_.push_back(gr::blocks::interleaved_char_to_complex::make());
unpack_short_byte.push_back(make_unpack_short_byte_samples());
} }
else if (ssize_ == 4) else if (ssize_ == 4)
{ {
gr_interleaved_short_to_complex_.push_back(gr::blocks::interleaved_short_to_complex::make(false, false)); gr_interleaved_short_to_complex_.push_back(gr::blocks::interleaved_short_to_complex::make(false, false));
unpack_byte_fourbits.push_back(make_unpack_byte_4bit_samples()); unpack_byte_fourbits.push_back(make_unpack_byte_4bit_samples());
unpack_short_byte.push_back(make_unpack_short_byte_samples());
} }
else if (ssize_ == 2) else if (ssize_ == 2)
{ {
gr_interleaved_short_to_complex_.push_back(gr::blocks::interleaved_short_to_complex::make(false, false)); gr_interleaved_short_to_complex_.push_back(gr::blocks::interleaved_short_to_complex::make(false, false));
unpack_byte_twobits.push_back(make_unpack_byte_2bit_cpx_samples()); unpack_byte_twobits.push_back(make_unpack_byte_2bit_cpx_samples());
unpack_short_byte.push_back(make_unpack_short_byte_samples());
} }
} }
} }
@ -165,7 +168,8 @@ void Ad936xCustomSignalSource::connect(gr::top_block_sptr top_block)
} }
else if (ssize_ == 8) else if (ssize_ == 8)
{ {
top_block->connect(ad936x_iio_source, n, gr_interleaved_char_to_complex_.at(n), 0); top_block->connect(ad936x_iio_source, n, unpack_short_byte.at(n), 0);
top_block->connect(unpack_short_byte.at(n), 0, gr_interleaved_char_to_complex_.at(n), 0);
DLOG(INFO) << "connected ad936x_iio_source source to gr_interleaved_char_to_complex_ for channel " << n; DLOG(INFO) << "connected ad936x_iio_source source to gr_interleaved_char_to_complex_ for channel " << n;
if (dump_) if (dump_)
{ {
@ -175,7 +179,8 @@ void Ad936xCustomSignalSource::connect(gr::top_block_sptr top_block)
} }
else if (ssize_ == 4) else if (ssize_ == 4)
{ {
top_block->connect(ad936x_iio_source, n, unpack_byte_fourbits.at(n), 0); top_block->connect(ad936x_iio_source, n, unpack_short_byte.at(n), 0);
top_block->connect(unpack_short_byte.at(n), 0, unpack_byte_fourbits.at(n), 0);
top_block->connect(unpack_byte_fourbits.at(n), 0, gr_interleaved_short_to_complex_.at(n), 0); top_block->connect(unpack_byte_fourbits.at(n), 0, gr_interleaved_short_to_complex_.at(n), 0);
DLOG(INFO) << "connected ad936x_iio_source source to unpack_byte_fourbits for channel " << n; DLOG(INFO) << "connected ad936x_iio_source source to unpack_byte_fourbits for channel " << n;
if (dump_) if (dump_)
@ -186,7 +191,8 @@ void Ad936xCustomSignalSource::connect(gr::top_block_sptr top_block)
} }
else if (ssize_ == 2) else if (ssize_ == 2)
{ {
top_block->connect(ad936x_iio_source, n, unpack_byte_twobits.at(n), 0); top_block->connect(ad936x_iio_source, n, unpack_short_byte.at(n), 0);
top_block->connect(unpack_short_byte.at(n), 0, unpack_byte_twobits.at(n), 0);
top_block->connect(unpack_byte_twobits.at(n), 0, gr_interleaved_short_to_complex_.at(n), 0); top_block->connect(unpack_byte_twobits.at(n), 0, gr_interleaved_short_to_complex_.at(n), 0);
DLOG(INFO) << "connected ad936x_iio_source source to unpack_byte_fourbits for channel " << n; DLOG(INFO) << "connected ad936x_iio_source source to unpack_byte_fourbits for channel " << n;
if (dump_) if (dump_)
@ -216,53 +222,56 @@ void Ad936xCustomSignalSource::disconnect(gr::top_block_sptr top_block)
if (ssize_ == 16) if (ssize_ == 16)
{ {
top_block->disconnect(ad936x_iio_source, n, gr_interleaved_short_to_complex_.at(n), 0); top_block->disconnect(ad936x_iio_source, n, gr_interleaved_short_to_complex_.at(n), 0);
DLOG(INFO) << "connected ad936x_iio_source source to gr_interleaved_short_to_complex for channel " << n; DLOG(INFO) << "disconnect ad936x_iio_source source to gr_interleaved_short_to_complex for channel " << n;
if (dump_) if (dump_)
{ {
top_block->disconnect(gr_interleaved_short_to_complex_.at(n), 0, sink_.at(n), 0); top_block->disconnect(gr_interleaved_short_to_complex_.at(n), 0, sink_.at(n), 0);
DLOG(INFO) << "connected source to file sink"; DLOG(INFO) << "disconnect source to file sink";
} }
} }
else if (ssize_ == 8) else if (ssize_ == 8)
{ {
top_block->disconnect(ad936x_iio_source, n, gr_interleaved_char_to_complex_.at(n), 0); top_block->connect(ad936x_iio_source, n, unpack_short_byte.at(n), 0);
DLOG(INFO) << "connected ad936x_iio_source source to gr_interleaved_char_to_complex_ for channel " << n; top_block->connect(unpack_short_byte.at(n), 0, unpack_byte_fourbits.at(n), 0);
DLOG(INFO) << "disconnect ad936x_iio_source source to gr_interleaved_char_to_complex_ for channel " << n;
if (dump_) if (dump_)
{ {
top_block->disconnect(gr_interleaved_char_to_complex_.at(n), 0, sink_.at(n), 0); top_block->disconnect(gr_interleaved_char_to_complex_.at(n), 0, sink_.at(n), 0);
DLOG(INFO) << "connected source to file sink"; DLOG(INFO) << "disconnect source to file sink";
} }
} }
else if (ssize_ == 4) else if (ssize_ == 4)
{ {
top_block->disconnect(ad936x_iio_source, n, unpack_byte_fourbits.at(n), 0); top_block->disconnect(ad936x_iio_source, n, unpack_short_byte.at(n), 0);
top_block->disconnect(unpack_short_byte.at(n), 0, unpack_byte_fourbits.at(n), 0);
top_block->disconnect(unpack_byte_fourbits.at(n), 0, gr_interleaved_short_to_complex_.at(n), 0); top_block->disconnect(unpack_byte_fourbits.at(n), 0, gr_interleaved_short_to_complex_.at(n), 0);
DLOG(INFO) << "connected ad936x_iio_source source to unpack_byte_fourbits for channel " << n; DLOG(INFO) << "disconnect ad936x_iio_source source to unpack_byte_fourbits for channel " << n;
if (dump_) if (dump_)
{ {
top_block->connect(gr_interleaved_short_to_complex_.at(n), 0, sink_.at(n), 0); top_block->disconnect(gr_interleaved_short_to_complex_.at(n), 0, sink_.at(n), 0);
DLOG(INFO) << "connected source to file sink"; DLOG(INFO) << "disconnect source to file sink";
} }
} }
else if (ssize_ == 2) else if (ssize_ == 2)
{ {
top_block->disconnect(ad936x_iio_source, n, unpack_byte_twobits.at(n), 0); top_block->disconnect(ad936x_iio_source, n, unpack_short_byte.at(n), 0);
top_block->disconnect(unpack_short_byte.at(n), 0, unpack_byte_twobits.at(n), 0);
top_block->disconnect(unpack_byte_twobits.at(n), 0, gr_interleaved_short_to_complex_.at(n), 0); top_block->disconnect(unpack_byte_twobits.at(n), 0, gr_interleaved_short_to_complex_.at(n), 0);
DLOG(INFO) << "connected ad936x_iio_source source to unpack_byte_fourbits for channel " << n; DLOG(INFO) << "disconnect ad936x_iio_source source to unpack_byte_fourbits for channel " << n;
if (dump_) if (dump_)
{ {
top_block->disconnect(gr_interleaved_short_to_complex_.at(n), 0, sink_.at(n), 0); top_block->disconnect(gr_interleaved_short_to_complex_.at(n), 0, sink_.at(n), 0);
DLOG(INFO) << "connected source to file sink"; DLOG(INFO) << "disconnect source to file sink";
} }
} }
else else
{ {
top_block->disconnect(ad936x_iio_source, n, gr_interleaved_short_to_complex_.at(n), 0); top_block->disconnect(ad936x_iio_source, n, gr_interleaved_short_to_complex_.at(n), 0);
DLOG(INFO) << "connected ad936x_iio_source source to gr_interleaved_short_to_complex for channel " << n; DLOG(INFO) << "disconnect ad936x_iio_source source to gr_interleaved_short_to_complex for channel " << n;
if (dump_) if (dump_)
{ {
top_block->disconnect(gr_interleaved_short_to_complex_.at(n), 0, sink_.at(n), 0); top_block->disconnect(gr_interleaved_short_to_complex_.at(n), 0, sink_.at(n), 0);
DLOG(INFO) << "connected source to file sink"; DLOG(INFO) << "disconnect source to file sink";
} }
} }
} }

View File

@ -23,6 +23,7 @@
#include "signal_source_base.h" #include "signal_source_base.h"
#include "unpack_byte_2bit_cpx_samples.h" #include "unpack_byte_2bit_cpx_samples.h"
#include "unpack_byte_4bit_samples.h" #include "unpack_byte_4bit_samples.h"
#include "unpack_short_byte_samples.h"
#include <gnuradio/blocks/file_sink.h> #include <gnuradio/blocks/file_sink.h>
#include <gnuradio/blocks/interleaved_char_to_complex.h> #include <gnuradio/blocks/interleaved_char_to_complex.h>
#include <gnuradio/blocks/interleaved_short_to_complex.h> #include <gnuradio/blocks/interleaved_short_to_complex.h>
@ -74,6 +75,7 @@ private:
std::vector<gr::blocks::interleaved_short_to_complex::sptr> gr_interleaved_short_to_complex_; std::vector<gr::blocks::interleaved_short_to_complex::sptr> gr_interleaved_short_to_complex_;
std::vector<gr::blocks::interleaved_char_to_complex::sptr> gr_interleaved_char_to_complex_; std::vector<gr::blocks::interleaved_char_to_complex::sptr> gr_interleaved_char_to_complex_;
std::vector<unpack_short_byte_samples_sptr> unpack_short_byte;
std::vector<unpack_byte_4bit_samples_sptr> unpack_byte_fourbits; std::vector<unpack_byte_4bit_samples_sptr> unpack_byte_fourbits;
std::vector<unpack_byte_2bit_cpx_samples_sptr> unpack_byte_twobits; std::vector<unpack_byte_2bit_cpx_samples_sptr> unpack_byte_twobits;

View File

@ -30,6 +30,7 @@ set(SIGNAL_SOURCE_GR_BLOCKS_SOURCES
unpack_byte_2bit_cpx_samples.cc unpack_byte_2bit_cpx_samples.cc
unpack_byte_4bit_samples.cc unpack_byte_4bit_samples.cc
unpack_intspir_1bit_samples.cc unpack_intspir_1bit_samples.cc
unpack_short_byte_samples.cc
rtl_tcp_signal_source_c.cc rtl_tcp_signal_source_c.cc
unpack_2bit_samples.cc unpack_2bit_samples.cc
unpack_spir_gss6450_samples.cc unpack_spir_gss6450_samples.cc
@ -44,6 +45,7 @@ set(SIGNAL_SOURCE_GR_BLOCKS_HEADERS
unpack_byte_2bit_cpx_samples.h unpack_byte_2bit_cpx_samples.h
unpack_byte_4bit_samples.h unpack_byte_4bit_samples.h
unpack_intspir_1bit_samples.h unpack_intspir_1bit_samples.h
unpack_short_byte_samples.h
rtl_tcp_signal_source_c.h rtl_tcp_signal_source_c.h
unpack_2bit_samples.h unpack_2bit_samples.h
unpack_spir_gss6450_samples.h unpack_spir_gss6450_samples.h

View File

@ -79,6 +79,21 @@ ad936x_iio_source_sptr ad936x_iio_make_source_sptr(
spattern_)); spattern_));
} }
void ad936x_iio_source::ad9361_channel_demux_and_record(ad936x_iio_samples *samples_in, int nchannels, std::vector<std::fstream> *files_out)
{
int32_t current_byte = 0;
int16_t ch = 0;
// std::cout << "nbytes: " << samples_in->n_bytes << " nsamples: " << samples_in->n_samples << " nch: " << nchannels << "\n";
while (current_byte < samples_in->n_bytes)
{
for (ch = 0; ch < nchannels; ch++)
{
//std::cout << current_byte << " of " << samples_in->n_bytes << " test: " << (int)samples_in->buffer[current_byte] << "\n";
(*files_out).at(ch).write(&samples_in->buffer[current_byte], 4); //two bytes I + two bytes Q per channel
current_byte += 4;
}
}
}
ad936x_iio_source::ad936x_iio_source( ad936x_iio_source::ad936x_iio_source(
std::string pluto_uri_, std::string pluto_uri_,
@ -222,9 +237,22 @@ ad936x_iio_source::ad936x_iio_source(
exit(1); exit(1);
} }
//set_min_noutput_items(IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 2); set_min_noutput_items(IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 2); // multiplexed I,Q, so, two samples per complex sample
set_min_output_buffer(IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 2); set_min_output_buffer(IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * sizeof(int16_t) * 2);
//std::cout << "max_output_buffer " << min_output_buffer(0) << " min_noutput_items: " << min_noutput_items() << "\n"; //std::cout << "max_output_buffer " << min_output_buffer(0) << " min_noutput_items: " << min_noutput_items() << "\n";
// for (int n = 0; n < ad936x_custom->n_channels; n++)
// {
// std::string cap_file_root_name = "./debug_cap_ch";
// samplesfile.push_back(std::fstream(cap_file_root_name + std::to_string(n) + ".dat", std::ios::out | std::ios::binary));
// //samplesfile.back().exceptions(std::ios_base::badbit | std::ios_base::failbit); //this will enable exceptions for debug
//
// if (samplesfile.back().is_open() == false)
// {
// std::cout << "ERROR: Could not open " << cap_file_root_name + "_ch" + std::to_string(n) + ".dat"
// << " for record samples!\n";
// }
// }
} }
ad936x_iio_source::~ad936x_iio_source() ad936x_iio_source::~ad936x_iio_source()
@ -246,6 +274,7 @@ bool ad936x_iio_source::start()
bool ad936x_iio_source::stop() bool ad936x_iio_source::stop()
{ {
std::cout << "stopping ad936x_iio_source...\n";
ad936x_custom->stop_record(); ad936x_custom->stop_record();
return true; return true;
} }
@ -261,16 +290,46 @@ int ad936x_iio_source::general_work(int noutput_items,
current_samples = current_buffer.get(); current_samples = current_buffer.get();
//I and Q samples are interleaved in buffer: IQIQIQ... //I and Q samples are interleaved in buffer: IQIQIQ...
int32_t n_interleaved_iq_samples_per_channel = current_samples->n_bytes / (ad936x_custom->n_channels * 2);
for (size_t n = 0; n < ad936x_custom->n_channels; n++) if (noutput_items < n_interleaved_iq_samples_per_channel)
{ {
if (output_items.size() > n) // check if the output channel is connected std::cout << "ad936x_iio_source output buffer overflow! noutput_items: " << noutput_items << " vs. " << n_interleaved_iq_samples_per_channel << "\n";
{ return 0;
memcpy(reinterpret_cast<void *>(output_items[n]), reinterpret_cast<void *>(current_samples->buffer[n]), current_samples->n_bytes[n]);
produce(n, current_samples->n_samples[n]);
}
} }
else
{
//ad9361_channel_demux_and_record(current_samples, ad936x_custom->n_channels, &samplesfile);
ad936x_custom->push_sample_buffer(current_buffer); uint32_t current_byte = 0;
return this->WORK_CALLED_PRODUCE; uint32_t current_byte_in_gr = 0;
int16_t ch = 0;
//std::cout << "nbytes: " << samples_in->n_bytes << " nsamples: " << samples_in->n_samples << " nch: " << nchannels << "\n";
if (ad936x_custom->n_channels == 1)
{
memcpy(&((char *)output_items[0])[0], &current_samples->buffer[current_byte], current_samples->n_bytes);
}
else
{
while (current_byte < current_samples->n_bytes)
{
for (ch = 0; ch < ad936x_custom->n_channels; ch++)
{
memcpy(&((char *)output_items[ch])[current_byte_in_gr], &current_samples->buffer[current_byte], 4); // two bytes I + two bytes Q per channel: 4 bytes
current_byte += 4;
}
current_byte_in_gr += 4;
}
}
ad936x_custom->push_sample_buffer(current_buffer);
return n_interleaved_iq_samples_per_channel; // always int16_t samples interleaved (I,Q,I,Q)
// for (size_t n = 0; n < ad936x_custom->n_channels; n++)
// {
// produce(n, current_samples->n_samples[n]);
// }
//
//
// return this->WORK_CALLED_PRODUCE;
}
} }

View File

@ -27,6 +27,7 @@
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include <fstream> #include <fstream>
#include <iostream>
#include <memory> #include <memory>
#include <string> #include <string>
#include <thread> #include <thread>
@ -131,12 +132,16 @@ private:
int bshift_, int bshift_,
bool spattern_); bool spattern_);
void ad9361_channel_demux_to_buffer(ad936x_iio_samples *samples_in, int nchannels, gr_vector_void_star &output_items);
void ad9361_channel_demux_and_record(ad936x_iio_samples *samples_in, int nchannels, std::vector<std::fstream> *files_out);
std::thread pps_rx_thread; std::thread pps_rx_thread;
std::unique_ptr<ad936x_iio_custom> ad936x_custom; std::unique_ptr<ad936x_iio_custom> ad936x_custom;
std::shared_ptr<pps_tcp_rx> pps_rx; std::shared_ptr<pps_tcp_rx> pps_rx;
std::shared_ptr<Concurrent_Queue<PpsSamplestamp>> ppsqueue; std::shared_ptr<Concurrent_Queue<PpsSamplestamp>> ppsqueue;
std::vector<std::fstream> samplesfile;
}; };

View File

@ -0,0 +1,55 @@
/*!
* \file unpack_short_byte_samples.cc
*
* \brief Unpacks shorts samples to byte samples (1 short = 2 byte samples).
* Packing Order
* Packing order in Nibble I0 I1
* \author Javier Arribas jarribas (at) cttc.es
* -----------------------------------------------------------------------------
*
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
#include "unpack_short_byte_samples.h"
#include <gnuradio/io_signature.h>
unpack_short_byte_samples_sptr make_unpack_short_byte_samples()
{
return unpack_short_byte_samples_sptr(new unpack_short_byte_samples());
}
unpack_short_byte_samples::unpack_short_byte_samples() : sync_interpolator("unpack_short_byte_samples",
gr::io_signature::make(1, 1, sizeof(int16_t)),
gr::io_signature::make(1, 1, sizeof(int8_t)),
2)
{
}
void unpack_short_byte_samples::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
if (noutput_items != 0)
{
ninput_items_required[0] = static_cast<int32_t>(noutput_items) / 2;
}
}
int unpack_short_byte_samples::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
// const auto *in = reinterpret_cast<const int16_t *>(input_items[0]);
// auto *out = reinterpret_cast<int8_t *>(output_items[0]);
memcpy(reinterpret_cast<int8_t *>(output_items[0]), reinterpret_cast<const int8_t *>(input_items[0]), noutput_items);
return noutput_items;
}

View File

@ -0,0 +1,58 @@
/*!
* \file unpack_short_byte_samples.cc
*
* \brief Unpacks shorts samples to byte samples (1 short = 2 byte samples).
* Packing Order
* Packing order in Nibble I0 I1
* \author Javier Arribas jarribas (at) cttc.es
* -----------------------------------------------------------------------------
*
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_UNPACK_SHORT_BYTE_SAMPLES_H
#define GNSS_SDR_UNPACK_SHORT_BYTE_SAMPLES_H
#include "gnss_block_interface.h"
#include <gnuradio/sync_interpolator.h>
/** \addtogroup Signal_Source
* \{ */
/** \addtogroup Signal_Source_gnuradio_blocks
* \{ */
class unpack_short_byte_samples;
using unpack_short_byte_samples_sptr = gnss_shared_ptr<unpack_short_byte_samples>;
unpack_short_byte_samples_sptr make_unpack_short_byte_samples();
/*!
* \brief This class implements conversion between short packet samples to byte samples
* 1 short = 2 byte samples
*/
class unpack_short_byte_samples : public gr::sync_interpolator
{
public:
unpack_short_byte_samples();
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
~unpack_short_byte_samples() = default;
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend unpack_short_byte_samples_sptr make_unpack_short_byte_samples_sptr();
};
/** \} */
/** \} */
#endif // GNSS_SDR_UNPACK_SHORT_BYTE_SAMPLES_H

View File

@ -92,14 +92,6 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(signal_source_libs
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(ENABLE_FMCOMMS2 OR ENABLE_AD9361 OR ENABLE_PLUTOSDR) if(ENABLE_FMCOMMS2 OR ENABLE_AD9361 OR ENABLE_PLUTOSDR)
target_link_libraries(signal_source_libs target_link_libraries(signal_source_libs
PUBLIC PUBLIC

View File

@ -247,7 +247,8 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_,
double tx_attenuation_db_, double tx_attenuation_db_,
int64_t freq_dds_tx_hz_, int64_t freq_dds_tx_hz_,
double scale_dds_, double scale_dds_,
double phase_dds_deg_) double phase_dds_deg_,
int channel)
{ {
// TX stream config // TX stream config
std::cout << "Start of AD9361 TX Oscillator DDS configuration\n"; std::cout << "Start of AD9361 TX Oscillator DDS configuration\n";
@ -260,52 +261,60 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_,
params_phy.push_back("out_altvoltage1_TX_LO_frequency=" + params_phy.push_back("out_altvoltage1_TX_LO_frequency=" +
std::to_string(freq_rf_tx_hz_)); std::to_string(freq_rf_tx_hz_));
double disabled_tx_attenuation = 89.75;
params_phy.push_back("out_voltage0_hardwaregain=" + if (channel == 1)
std::to_string(-tx_attenuation_db_)); {
params_phy.push_back("out_voltage0_hardwaregain=" +
//disable the other TX std::to_string(-tx_attenuation_db_));
params_phy.push_back("out_voltage1_hardwaregain=" + //disable the other TX
std::to_string(-tx_attenuation_db_)); params_phy.push_back("out_voltage1_hardwaregain=" +
std::to_string(-disabled_tx_attenuation));
}
else
{
params_phy.push_back("out_voltage1_hardwaregain=" +
std::to_string(-tx_attenuation_db_));
//disable the other TX
params_phy.push_back("out_voltage0_hardwaregain=" +
std::to_string(-disabled_tx_attenuation));
}
configure_params(phy, params_phy); configure_params(phy, params_phy);
std::vector<std::string> params_dds; std::vector<std::string> params_dds;
//DDS TX CH1 I (tone #1) //DDS TX CH1 I (tone #1)
params_dds.push_back("out_altvoltage0_TX1_I_F1_frequency=" + // params_dds.push_back("out_altvoltage0_TX1_I_F1_frequency=" +
std::to_string(freq_dds_tx_hz_));
params_dds.push_back("out_altvoltage0_TX1_I_F1_phase=" +
std::to_string(phase_dds_deg_ * 1000.0));
params_dds.push_back("out_altvoltage0_TX1_I_F1_scale=" +
std::to_string(scale_dds_));
params_dds.push_back("out_altvoltage0_TX1_I_F1_raw=1");
//DDS TX CH1 Q (tone #1)
params_dds.push_back("out_altvoltage2_TX1_Q_F1_frequency=" +
std::to_string(freq_dds_tx_hz_));
params_dds.push_back("out_altvoltage2_TX1_Q_F1_phase=" +
std::to_string(phase_dds_deg_ * 1000.0 + 270000.0));
params_dds.push_back("out_altvoltage2_TX1_Q_F1_scale=" +
std::to_string(scale_dds_));
params_dds.push_back("out_altvoltage2_TX1_Q_F1_raw=1");
//DDS TX CH1 I (tone #1)
// params_dds.push_back("out_altvoltage4_TX2_I_F1_frequency=" +
// std::to_string(freq_dds_tx_hz_)); // std::to_string(freq_dds_tx_hz_));
// params_dds.push_back("out_altvoltage4_TX2_I_F1_phase=" + // params_dds.push_back("out_altvoltage0_TX1_I_F1_phase=" +
// std::to_string(phase_dds_deg_ * 1000.0)); // std::to_string(phase_dds_deg_ * 1000.0));
// params_dds.push_back("out_altvoltage4_TX2_I_F1_scale=" + // params_dds.push_back("out_altvoltage0_TX1_I_F1_scale=" +
// std::to_string(scale_dds_)); // std::to_string(scale_dds_));
// params_dds.push_back("out_altvoltage4_TX2_I_F1_raw=1"); // params_dds.push_back("out_altvoltage0_TX1_I_F1_raw=1");
// //DDS TX CH1 Q (tone #1) // //DDS TX CH1 Q (tone #1)
// params_dds.push_back("out_altvoltage6_TX2_Q_F1_frequency=" + // params_dds.push_back("out_altvoltage2_TX1_Q_F1_frequency=" +
// std::to_string(freq_dds_tx_hz_)); // std::to_string(freq_dds_tx_hz_));
// params_dds.push_back("out_altvoltage6_TX2_Q_F1_phase=" + // params_dds.push_back("out_altvoltage2_TX1_Q_F1_phase=" +
// std::to_string(phase_dds_deg_ * 1000.0 + 270000.0)); // std::to_string(phase_dds_deg_ * 1000.0 + 270000.0));
// params_dds.push_back("out_altvoltage6_TX2_Q_F1_scale=" + // params_dds.push_back("out_altvoltage2_TX1_Q_F1_scale=" +
// std::to_string(scale_dds_)); // std::to_string(scale_dds_));
// params_dds.push_back("out_altvoltage6_TX2_Q_F1_raw=1"); // params_dds.push_back("out_altvoltage2_TX1_Q_F1_raw=1");
//DDS TX CH2 I (tone #1)
params_dds.push_back("out_altvoltage4_TX2_I_F1_frequency=" +
std::to_string(freq_dds_tx_hz_));
params_dds.push_back("out_altvoltage4_TX2_I_F1_phase=" +
std::to_string(phase_dds_deg_ * 1000.0));
params_dds.push_back("out_altvoltage4_TX2_I_F1_scale=" +
std::to_string(scale_dds_));
params_dds.push_back("out_altvoltage4_TX2_I_F1_raw=1");
//DDS TX CH2 Q (tone #1)
params_dds.push_back("out_altvoltage6_TX2_Q_F1_frequency=" +
std::to_string(freq_dds_tx_hz_));
params_dds.push_back("out_altvoltage6_TX2_Q_F1_phase=" +
std::to_string(phase_dds_deg_ * 1000.0 + 270000.0));
params_dds.push_back("out_altvoltage6_TX2_Q_F1_scale=" +
std::to_string(scale_dds_));
params_dds.push_back("out_altvoltage6_TX2_Q_F1_raw=1");
configure_params(dds_dev, params_dds); configure_params(dds_dev, params_dds);
@ -511,10 +520,11 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_,
std::cout << "Configuring DDS Local Oscillator generation. LO Freq. is " << delta_freq_hz << " [Hz]\n"; std::cout << "Configuring DDS Local Oscillator generation. LO Freq. is " << delta_freq_hz << " [Hz]\n";
PlutoTxEnable(true); PlutoTxEnable(true);
config_ad9361_dds(delta_freq_hz, config_ad9361_dds(delta_freq_hz,
30, 0,
100000, 0,
0.9, 0.9,
0); 0,
2);
std::cout << "Configuring DDS Local Oscillator generation DONE\n"; std::cout << "Configuring DDS Local Oscillator generation DONE\n";
} }
else else
@ -633,6 +643,7 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_,
// } // }
std::cout << "AD936x Front-end configuration summary: \n"; std::cout << "AD936x Front-end configuration summary: \n";
std::cout << "RF frequency tunned in AD936x: " << freq_ << " [Hz]\n";
std::cout << "Baseband sampling frequency: " << sample_rate_sps << " [SPS]\n"; std::cout << "Baseband sampling frequency: " << sample_rate_sps << " [SPS]\n";
std::cout << "RX chain gain: " << rf_gain_rx0_ << " [dB][only valid in manual mode]\n"; std::cout << "RX chain gain: " << rf_gain_rx0_ << " [dB][only valid in manual mode]\n";
std::cout << "RX chain gain mode: " << gain_mode_rx0_ << "\n"; std::cout << "RX chain gain mode: " << gain_mode_rx0_ << "\n";
@ -812,13 +823,13 @@ void ad936x_iio_custom::stop_record()
{ {
receive_samples = false; receive_samples = false;
if (capture_time_thread.joinable() == true) if (capture_samples_thread.joinable() == true)
{ {
std::cout << "Joining sample cature thread...\n"; std::cout << "Joining sample cature thread...\n";
capture_samples_thread.join(); capture_samples_thread.join();
} }
if (capture_time_thread.joinable() == true) if (overflow_monitor_thread.joinable() == true)
{ {
std::cout << "Joining overflow monitor thread...\n"; std::cout << "Joining overflow monitor thread...\n";
overflow_monitor_thread.join(); overflow_monitor_thread.join();
@ -1153,7 +1164,7 @@ void ad936x_iio_custom::capture(const std::vector<std::string> &channels)
unsigned long items_in_buffer; unsigned long items_in_buffer;
std::cerr << "Enter capture loop...\n"; std::cerr << "Enter capture loop...\n";
int ret; int ret;
int bytes_per_channel = static_cast<int>(channels.size()) * 2; //each channel has two items in channels vector (I,Q). Each component has two bytes. int bytes_to_interleaved_iq_samples = n_channels * sizeof(int16_t);
while (receive_samples == true) while (receive_samples == true)
{ {
free_buffers.wait_and_pop(current_buffer); free_buffers.wait_and_pop(current_buffer);
@ -1173,21 +1184,16 @@ void ad936x_iio_custom::capture(const std::vector<std::string> &channels)
return; return;
} }
} }
memcpy(&current_samples->buffer[0], iio_buffer_start(rxbuf), ret);
// Demultiplex the samples of a given channel items_in_buffer = static_cast<unsigned long>(ret) / bytes_to_interleaved_iq_samples;
int n_ch = 0;
for (auto it = std::begin(channel_list); it != std::end(channel_list); ++it)
{
current_samples->n_bytes[n_ch] = iio_channel_read_raw(*it, rxbuf, &current_samples->buffer[n_ch][0], IIO_MAX_BYTES_PER_CHANNEL);
current_samples->n_samples[n_ch] = current_samples->n_bytes[n_ch] / sizeof(short);
n_ch++;
}
// old, valid only for one channel if (items_in_buffer == 0) return;
//memcpy(&current_samples->buffer[0], iio_buffer_start(rxbuf), ret);
if (current_samples->n_bytes[0] == 0) return;
current_samples->n_channels = n_channels;
current_samples->n_interleaved_iq_samples = items_in_buffer;
current_samples->n_bytes = ret;
current_samples->step_bytes = iio_buffer_step(rxbuf);
used_buffers.push(current_buffer); used_buffers.push(current_buffer);
} }

View File

@ -99,7 +99,8 @@ private:
double tx_attenuation_db_, double tx_attenuation_db_,
int64_t freq_dds_tx_hz_, int64_t freq_dds_tx_hz_,
double scale_dds_, double scale_dds_,
double phase_dds_deg_); double phase_dds_deg_,
int channel);
void get_PPS_timestamp(); void get_PPS_timestamp();
void capture(const std::vector<std::string> &channels); void capture(const std::vector<std::string> &channels);

View File

@ -18,9 +18,8 @@
ad936x_iio_samples::ad936x_iio_samples() ad936x_iio_samples::ad936x_iio_samples()
{ {
for (int n = 0; n < IIO_MAX_CH; n++) n_bytes = 0;
{ n_interleaved_iq_samples = 0;
n_bytes[n] = 0; step_bytes = 0;
n_samples[n] = 0; n_channels = 0;
}
} }

View File

@ -18,12 +18,9 @@
#ifndef SRC_LIBS_ad936x_iio_samples_H_ #ifndef SRC_LIBS_ad936x_iio_samples_H_
#define SRC_LIBS_ad936x_iio_samples_H_ #define SRC_LIBS_ad936x_iio_samples_H_
#define IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES 32768 * 2 #define IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES 32768
#define IIO_INPUTRAMFIFOSIZE 512 #define IIO_INPUTRAMFIFOSIZE 256
#define IIO_MAX_CH 4
#define IIO_MAX_BYTES_PER_CHANNEL IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 2 * 2 //(2-bytes per I + 2-bytes per Q)
#include <memory> #include <memory>
#include <stdint.h> #include <stdint.h>
@ -33,9 +30,11 @@ class ad936x_iio_samples
{ {
public: public:
ad936x_iio_samples(); ad936x_iio_samples();
uint32_t n_bytes[IIO_MAX_CH]; uint32_t n_bytes;
uint32_t n_samples[IIO_MAX_CH]; uint32_t n_interleaved_iq_samples;
int16_t buffer[IIO_MAX_CH][IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 2]; //16 bits I,Q samples buffers uint16_t n_channels;
uint16_t step_bytes;
char buffer[IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 4 * 4]; //max 16 bits samples per buffer (4 channels, 2-bytes per I + 2-bytes per Q)
}; };
#endif #endif

View File

@ -69,14 +69,6 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(telemetry_decoder_gr_blocks
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
target_include_directories(telemetry_decoder_gr_blocks target_include_directories(telemetry_decoder_gr_blocks
PUBLIC PUBLIC
${GNSSSDR_SOURCE_DIR}/src/core/interfaces ${GNSSSDR_SOURCE_DIR}/src/core/interfaces

View File

@ -85,7 +85,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(const p
DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN); DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN);
if (d_enable_extended_integration == false) // avoid re-setting preamble indicator if (d_enable_extended_integration == false) // avoid re-setting preamble indicator
{ {
d_preamble_timestamp_s = pmt::to_double(msg); d_preamble_timestamp_samples = pmt::to_double(msg);
d_enable_extended_integration = true; d_enable_extended_integration = true;
d_preamble_synchronized = false; d_preamble_synchronized = false;
} }
@ -134,10 +134,10 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc
d_pll_to_dll_assist_secs_Ti(0.0), d_pll_to_dll_assist_secs_Ti(0.0),
d_carr_phase_error_secs_Ti(0.0), d_carr_phase_error_secs_Ti(0.0),
d_code_error_chips_Ti(0.0), d_code_error_chips_Ti(0.0),
d_preamble_timestamp_s(0.0), d_preamble_timestamp_samples(0.0),
d_extend_correlation_ms(extend_correlation_ms),
d_code_error_filt_chips_s(0.0), d_code_error_filt_chips_s(0.0),
d_code_error_filt_chips_Ti(0.0), d_code_error_filt_chips_Ti(0.0),
d_extend_correlation_ms(extend_correlation_ms),
d_correlation_length_samples(static_cast<int32_t>(d_vector_length)), d_correlation_length_samples(static_cast<int32_t>(d_vector_length)),
d_sample_counter(0ULL), d_sample_counter(0ULL),
d_acq_sample_stamp(0), d_acq_sample_stamp(0),
@ -154,8 +154,8 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc
d_dump(dump) d_dump(dump)
{ {
// Telemetry bit synchronization message port input // Telemetry bit synchronization message port input
this->message_port_register_in(pmt::mp("preamble_timestamp_s")); this->message_port_register_in(pmt::mp("preamble_timestamp_samples"));
this->set_msg_handler(pmt::mp("preamble_timestamp_s"), this->set_msg_handler(pmt::mp("preamble_timestamp_samples"),
#if HAS_GENERIC_LAMBDA #if HAS_GENERIC_LAMBDA
[this](auto &&PH1) { msg_handler_preamble_index(PH1); }); [this](auto &&PH1) { msg_handler_preamble_index(PH1); });
#else #else
@ -209,7 +209,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
const double acq_trk_diff_seconds = static_cast<double>(acq_trk_diff_samples) / static_cast<double>(d_fs_in); const double acq_trk_diff_seconds = static_cast<double>(acq_trk_diff_samples) / static_cast<double>(d_fs_in);
// Doppler effect // Doppler effect
// Fd=(C/(C+Vr))*F // Fd=(C/(C+Vr))*F
d_glonass_freq_ch = GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_FREQ_HZ * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); d_glonass_freq_ch = GLONASS_L1_CA_FREQ_HZ + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
const double radial_velocity = (d_glonass_freq_ch + d_acq_carrier_doppler_hz) / d_glonass_freq_ch; const double radial_velocity = (d_glonass_freq_ch + d_acq_carrier_doppler_hz) / d_glonass_freq_ch;
// new chip and prn sequence periods based on acq Doppler // new chip and prn sequence periods based on acq Doppler
d_code_freq_chips = radial_velocity * GLONASS_L1_CA_CODE_RATE_CPS; d_code_freq_chips = radial_velocity * GLONASS_L1_CA_CODE_RATE_CPS;
@ -273,8 +273,8 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
// enable tracking // enable tracking
d_pull_in = true; d_pull_in = true;
d_enable_tracking = true; d_enable_tracking = true;
d_enable_extended_integration = true; d_enable_extended_integration = false;
d_preamble_synchronized = true; d_preamble_synchronized = false;
LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz
<< " Code Phase correction [samples]=" << delay_correction_samples << " Code Phase correction [samples]=" << delay_correction_samples
@ -604,7 +604,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
bool enable_dll_pll; bool enable_dll_pll;
if (d_enable_extended_integration == true) if (d_enable_extended_integration == true)
{ {
int64_t symbol_diff = round(1000.0 * ((static_cast<double>(d_sample_counter) + d_rem_code_phase_samples) / static_cast<double>(d_fs_in) - d_preamble_timestamp_s)); int64_t symbol_diff = round(1000.0 * ((static_cast<double>(d_sample_counter) + d_rem_code_phase_samples - d_preamble_timestamp_samples) / static_cast<double>(d_fs_in)));
if (symbol_diff > 0 and symbol_diff % d_extend_correlation_ms == 0) if (symbol_diff > 0 and symbol_diff % d_extend_correlation_ms == 0)
{ {
// compute coherent integration and enable tracking loop // compute coherent integration and enable tracking loop
@ -631,6 +631,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
} }
// UPDATE INTEGRATION TIME // UPDATE INTEGRATION TIME
CURRENT_INTEGRATION_TIME_S = static_cast<double>(d_extend_correlation_ms) * GLONASS_L1_CA_CODE_PERIOD_S; CURRENT_INTEGRATION_TIME_S = static_cast<double>(d_extend_correlation_ms) * GLONASS_L1_CA_CODE_PERIOD_S;
d_code_loop_filter.set_pdi(static_cast<float>(CURRENT_INTEGRATION_TIME_S));
enable_dll_pll = true; enable_dll_pll = true;
} }
else else

View File

@ -170,10 +170,10 @@ private:
double d_pll_to_dll_assist_secs_Ti; double d_pll_to_dll_assist_secs_Ti;
double d_carr_phase_error_secs_Ti; double d_carr_phase_error_secs_Ti;
double d_code_error_chips_Ti; double d_code_error_chips_Ti;
double d_preamble_timestamp_s; double d_preamble_timestamp_samples;
int32_t d_extend_correlation_ms;
double d_code_error_filt_chips_s; double d_code_error_filt_chips_s;
double d_code_error_filt_chips_Ti; double d_code_error_filt_chips_Ti;
int32_t d_extend_correlation_ms;
// Integration period in samples // Integration period in samples
int32_t d_correlation_length_samples; int32_t d_correlation_length_samples;

View File

@ -83,7 +83,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(const p
DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN); DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN);
if (d_enable_extended_integration == false) // avoid re-setting preamble indicator if (d_enable_extended_integration == false) // avoid re-setting preamble indicator
{ {
d_preamble_timestamp_s = pmt::to_double(msg); d_preamble_timestamp_samples = pmt::to_double(msg);
d_enable_extended_integration = true; d_enable_extended_integration = true;
d_preamble_synchronized = false; d_preamble_synchronized = false;
} }
@ -132,10 +132,10 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc
d_pll_to_dll_assist_secs_Ti(0.0), d_pll_to_dll_assist_secs_Ti(0.0),
d_carr_phase_error_secs_Ti(0.0), d_carr_phase_error_secs_Ti(0.0),
d_code_error_chips_Ti(0.0), d_code_error_chips_Ti(0.0),
d_preamble_timestamp_s(0.0), d_preamble_timestamp_samples(0.0),
d_extend_correlation_ms(extend_correlation_ms),
d_code_error_filt_chips_s(0.0), d_code_error_filt_chips_s(0.0),
d_code_error_filt_chips_Ti(0.0), d_code_error_filt_chips_Ti(0.0),
d_extend_correlation_ms(extend_correlation_ms),
d_correlation_length_samples(static_cast<int32_t>(d_vector_length)), d_correlation_length_samples(static_cast<int32_t>(d_vector_length)),
d_sample_counter(0ULL), d_sample_counter(0ULL),
d_acq_sample_stamp(0), d_acq_sample_stamp(0),
@ -152,8 +152,8 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc
d_dump(dump) d_dump(dump)
{ {
// Telemetry bit synchronization message port input // Telemetry bit synchronization message port input
this->message_port_register_in(pmt::mp("preamble_timestamp_s")); this->message_port_register_in(pmt::mp("preamble_timestamp_samples"));
this->set_msg_handler(pmt::mp("preamble_timestamp_s"), this->set_msg_handler(pmt::mp("preamble_timestamp_samples"),
#if HAS_GENERIC_LAMBDA #if HAS_GENERIC_LAMBDA
[this](auto &&PH1) { msg_handler_preamble_index(PH1); }); [this](auto &&PH1) { msg_handler_preamble_index(PH1); });
#else #else
@ -206,7 +206,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::start_tracking()
const double acq_trk_diff_seconds = static_cast<double>(acq_trk_diff_samples) / static_cast<double>(d_fs_in); const double acq_trk_diff_seconds = static_cast<double>(acq_trk_diff_samples) / static_cast<double>(d_fs_in);
// Doppler effect // Doppler effect
// Fd=(C/(C+Vr))*F // Fd=(C/(C+Vr))*F
d_glonass_freq_ch = GLONASS_L2_CA_FREQ_HZ + (GLONASS_L2_CA_FREQ_HZ * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); d_glonass_freq_ch = GLONASS_L2_CA_FREQ_HZ + (DFRQ2_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
const double radial_velocity = (d_glonass_freq_ch + d_acq_carrier_doppler_hz) / d_glonass_freq_ch; const double radial_velocity = (d_glonass_freq_ch + d_acq_carrier_doppler_hz) / d_glonass_freq_ch;
// new chip and prn sequence periods based on acq Doppler // new chip and prn sequence periods based on acq Doppler
d_code_freq_chips = radial_velocity * GLONASS_L2_CA_CODE_RATE_CPS; d_code_freq_chips = radial_velocity * GLONASS_L2_CA_CODE_RATE_CPS;
@ -269,8 +269,8 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::start_tracking()
// enable tracking // enable tracking
d_pull_in = true; d_pull_in = true;
d_enable_tracking = true; d_enable_tracking = true;
d_enable_extended_integration = true; d_enable_extended_integration = false;
d_preamble_synchronized = true; d_preamble_synchronized = false;
d_acc_carrier_phase_initialized = false; d_acc_carrier_phase_initialized = false;
LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz
@ -601,7 +601,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
bool enable_dll_pll; bool enable_dll_pll;
if (d_enable_extended_integration == true) if (d_enable_extended_integration == true)
{ {
const int64_t symbol_diff = round(1000.0 * ((static_cast<double>(d_sample_counter) + d_rem_code_phase_samples) / static_cast<double>(d_fs_in) - d_preamble_timestamp_s)); const int64_t symbol_diff = round(1000.0 * ((static_cast<double>(d_sample_counter) + d_rem_code_phase_samples - d_preamble_timestamp_samples) / static_cast<double>(d_fs_in)));
if (symbol_diff > 0 and symbol_diff % d_extend_correlation_ms == 0) if (symbol_diff > 0 and symbol_diff % d_extend_correlation_ms == 0)
{ {
// compute coherent integration and enable tracking loop // compute coherent integration and enable tracking loop
@ -663,6 +663,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
// perform basic (1ms) correlation // perform basic (1ms) correlation
// UPDATE INTEGRATION TIME // UPDATE INTEGRATION TIME
CURRENT_INTEGRATION_TIME_S = static_cast<double>(d_correlation_length_samples) / static_cast<double>(d_fs_in); CURRENT_INTEGRATION_TIME_S = static_cast<double>(d_correlation_length_samples) / static_cast<double>(d_fs_in);
d_code_loop_filter.set_pdi(static_cast<float>(CURRENT_INTEGRATION_TIME_S));
enable_dll_pll = true; enable_dll_pll = true;
} }
} }

View File

@ -165,10 +165,10 @@ private:
double d_pll_to_dll_assist_secs_Ti; double d_pll_to_dll_assist_secs_Ti;
double d_carr_phase_error_secs_Ti; double d_carr_phase_error_secs_Ti;
double d_code_error_chips_Ti; double d_code_error_chips_Ti;
double d_preamble_timestamp_s; double d_preamble_timestamp_samples;
int32_t d_extend_correlation_ms;
double d_code_error_filt_chips_s; double d_code_error_filt_chips_s;
double d_code_error_filt_chips_Ti; double d_code_error_filt_chips_Ti;
int32_t d_extend_correlation_ms;
// Integration period in samples // Integration period in samples
int32_t d_correlation_length_samples; int32_t d_correlation_length_samples;

View File

@ -65,6 +65,15 @@ target_include_directories(core_libs_supl
${CMAKE_CURRENT_SOURCE_DIR}/types ${CMAKE_CURRENT_SOURCE_DIR}/types
) )
# This is ancient and unmaintained code. As the project migrates to modern
# compilers, non-standards-conforming constructs will be flagged as errors. This
# should be upgraded, but until then, allow non-standards-conforming constructs
if(NOT (CMAKE_VERSION VERSION_LESS "3.1"))
set_target_properties(core_libs_supl
PROPERTIES C_EXTENSIONS ON
)
endif()
set_property(TARGET core_libs_supl set_property(TARGET core_libs_supl
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>

View File

@ -73,14 +73,6 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(core_monitor
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(USE_BOOST_ASIO_IO_CONTEXT) if(USE_BOOST_ASIO_IO_CONTEXT)
target_compile_definitions(core_monitor target_compile_definitions(core_monitor
PUBLIC PUBLIC

View File

@ -235,6 +235,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
{ {
int32_t J = 0; int32_t J = 0;
d_frame_ID = 0U; d_frame_ID = 0U;
uint64_t P_1_tmp = 0;
// Unpack bytes to bits // Unpack bytes to bits
const std::bitset<GLONASS_GNAV_STRING_BITS> string_bits(frame_string); const std::bitset<GLONASS_GNAV_STRING_BITS> string_bits(frame_string);
@ -252,7 +253,8 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
{ {
case 1: case 1:
// --- It is string 1 ----------------------------------------------- // --- It is string 1 -----------------------------------------------
gnav_ephemeris.d_P_1 = (static_cast<double>(read_navigation_unsigned(string_bits, P1)) + 1) * 15; P_1_tmp = read_navigation_unsigned(string_bits, P1);
gnav_ephemeris.d_P_1 = (P_1_tmp == 0) ? 0. : (P_1_tmp + 1) * 15;
gnav_ephemeris.d_t_k = static_cast<double>(read_navigation_unsigned(string_bits, T_K_HR)) * 3600 + gnav_ephemeris.d_t_k = static_cast<double>(read_navigation_unsigned(string_bits, T_K_HR)) * 3600 +
static_cast<double>(read_navigation_unsigned(string_bits, T_K_MIN)) * 60 + static_cast<double>(read_navigation_unsigned(string_bits, T_K_MIN)) * 60 +
static_cast<double>(read_navigation_unsigned(string_bits, T_K_SEC)) * 30; static_cast<double>(read_navigation_unsigned(string_bits, T_K_SEC)) * 30;

View File

@ -53,14 +53,6 @@ target_include_directories(signal_processing_testing_lib
${GNSSSDR_SOURCE_DIR}/src/tests/common-files ${GNSSSDR_SOURCE_DIR}/src/tests/common-files
) )
if(GNURADIO_USES_SPDLOG)
target_link_libraries(signal_processing_testing_lib
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(USE_GENERIC_LAMBDAS) if(USE_GENERIC_LAMBDAS)
set(has_generic_lambdas HAS_GENERIC_LAMBDA=1) set(has_generic_lambdas HAS_GENERIC_LAMBDA=1)
set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0) set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0)

View File

@ -274,13 +274,13 @@ TEST(RtcmTest, MT1020)
Glonass_Gnav_Utc_Model gnav_utc_model_read = Glonass_Gnav_Utc_Model(); Glonass_Gnav_Utc_Model gnav_utc_model_read = Glonass_Gnav_Utc_Model();
// Perform data read and print of special values types // Perform data read and print of special values types
gnav_ephemeris.d_P_1 = 15; gnav_ephemeris.d_P_1 = 0.;
// Bit distribution per fields // Bit distribution per fields
gnav_ephemeris.d_t_k = 7560; gnav_ephemeris.d_t_k = 7560.;
// Glonass signed values // Glonass signed values
gnav_ephemeris.d_VXn = -0.490900039672852; gnav_ephemeris.d_VXn = -0.490900039672852;
// Bit distribution per fields dependent on other factors // Bit distribution per fields dependent on other factors
gnav_ephemeris.d_t_b = 8100; gnav_ephemeris.d_t_b = 8100.;
// Binary flag representation // Binary flag representation
gnav_ephemeris.d_P_3 = true; gnav_ephemeris.d_P_3 = true;

View File

@ -76,10 +76,10 @@ TEST(GlonassGnavNavigationMessageTest, String1Decoder)
Glonass_Gnav_Ephemeris gnav_ephemeris; Glonass_Gnav_Ephemeris gnav_ephemeris;
// Fill out ephemeris values for truth // Fill out ephemeris values for truth
gnav_ephemeris.d_P_1 = 15; gnav_ephemeris.d_P_1 = 0.;
gnav_ephemeris.d_t_k = 7560; gnav_ephemeris.d_t_k = 7560.;
gnav_ephemeris.d_VXn = -0.490900039672852; gnav_ephemeris.d_VXn = -0.490900039672852;
gnav_ephemeris.d_AXn = 0; gnav_ephemeris.d_AXn = 0.;
gnav_ephemeris.d_Xn = -11025.6669921875; gnav_ephemeris.d_Xn = -11025.6669921875;
// Call target test method // Call target test method

View File

@ -60,6 +60,7 @@
#include <cstdlib> #include <cstdlib>
#include <ctime> // for ctime #include <ctime> // for ctime
#include <exception> #include <exception>
#include <iomanip> // for std::setiosflags, std::setprecision
#include <iostream> #include <iostream>
#include <map> #include <map>
#include <memory> #include <memory>