From 38bf7539f5629f5233281e342d11d1f64047c93c Mon Sep 17 00:00:00 2001 From: Markus Schmidl Date: Mon, 6 Jan 2025 14:18:31 +0100 Subject: [PATCH] add stub executable for testing channel estimation --- include/iq_stream_decoder.hpp | 3 +++ src/experiments/CMakeLists.txt | 7 ++++++- src/experiments/channel_estimation.cpp | 15 +++++++++++++++ src/iq_stream_decoder.cpp | 6 +++--- 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 src/experiments/channel_estimation.cpp diff --git a/include/iq_stream_decoder.hpp b/include/iq_stream_decoder.hpp index 3c03583..1e0d4af 100644 --- a/include/iq_stream_decoder.hpp +++ b/include/iq_stream_decoder.hpp @@ -41,6 +41,9 @@ class IQStreamDecoder { static void abs_convolve_same_length(const QueueT& queueA, std::size_t offsetA, const std::complex* itb, std::size_t len, float* res); + static auto solve_channel(const std::vector>& pilots, + const QueueT& signal_queue, const std::size_t signal_offset); + std::vector> channel_estimation(std::vector> const& stream, std::vector> const& pilots); diff --git a/src/experiments/CMakeLists.txt b/src/experiments/CMakeLists.txt index 91eaf0d..187853f 100644 --- a/src/experiments/CMakeLists.txt +++ b/src/experiments/CMakeLists.txt @@ -8,4 +8,9 @@ target_link_libraries(packet-parser-example tetra-decoder-library) add_executable(slots-parser-example src/experiments/slots_parser_example.cpp) -target_link_libraries(slots-parser-example tetra-decoder-library) \ No newline at end of file +target_link_libraries(slots-parser-example tetra-decoder-library) + +add_executable(channel-estimation + src/experiments/channel_estimation.cpp) + +target_link_libraries(channel-estimation tetra-decoder-library) \ No newline at end of file diff --git a/src/experiments/channel_estimation.cpp b/src/experiments/channel_estimation.cpp new file mode 100644 index 0000000..2ce4aff --- /dev/null +++ b/src/experiments/channel_estimation.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2025 Transit Live Mapping Solutions + * All rights reserved. + * + * Authors: + * Marenz Schmidl + */ + +#include + +auto main(int argc, char** argv) -> int { + auto decoder = IQStreamDecoder(nullptr, nullptr, nullptr, /*is_uplink=*/true); + + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/src/iq_stream_decoder.cpp b/src/iq_stream_decoder.cpp index cb875f1..cf3ee9a 100644 --- a/src/iq_stream_decoder.cpp +++ b/src/iq_stream_decoder.cpp @@ -95,8 +95,8 @@ std::vector> IQStreamDecoder::channel_estimation(std::vector return stream; } -static auto solve_channel(const std::vector>& pilots, - const FixedQueue, 300>& signal_queue, const std::size_t signal_offset) + auto IQStreamDecoder::solve_channel(const std::vector>& pilots, + const QueueT& signal_queue, const std::size_t signal_offset) -> arma::cx_fvec { auto arma_pilots = arma::cx_fvec(pilots); auto arma_signal = arma::cx_fvec(pilots.size()); @@ -104,7 +104,7 @@ static auto solve_channel(const std::vector>& pilots, arma_signal[i] = signal_queue[signal_offset + i]; } auto arma_conj_pilots = arma::conj(arma_pilots); - auto h_vec = arma::solve(arma_conj_pilots * arma_pilots, arma_conj_pilots * arma::conj(arma_signal)); + arma::cx_fvec h_vec = arma::solve(arma_conj_pilots.t() * arma_pilots, arma_conj_pilots.t() * arma::conj(arma_signal).t()); return h_vec; }