Skip to content

Commit

Permalink
add stub executable for testing channel estimation
Browse files Browse the repository at this point in the history
  • Loading branch information
marenz2569 committed Jan 6, 2025
1 parent 5006e47 commit 38bf753
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
3 changes: 3 additions & 0 deletions include/iq_stream_decoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ class IQStreamDecoder {
static void abs_convolve_same_length(const QueueT& queueA, std::size_t offsetA, const std::complex<float>* itb,
std::size_t len, float* res);

static auto solve_channel(const std::vector<std::complex<float>>& pilots,
const QueueT& signal_queue, const std::size_t signal_offset);

std::vector<std::complex<float>> channel_estimation(std::vector<std::complex<float>> const& stream,
std::vector<std::complex<float>> const& pilots);

Expand Down
7 changes: 6 additions & 1 deletion src/experiments/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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)
15 changes: 15 additions & 0 deletions src/experiments/channel_estimation.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (C) 2025 Transit Live Mapping Solutions
* All rights reserved.
*
* Authors:
* Marenz Schmidl
*/

#include <iostream>

auto main(int argc, char** argv) -> int {
auto decoder = IQStreamDecoder(nullptr, nullptr, nullptr, /*is_uplink=*/true);

return EXIT_SUCCESS;
}
6 changes: 3 additions & 3 deletions src/iq_stream_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,16 @@ std::vector<std::complex<float>> IQStreamDecoder::channel_estimation(std::vector
return stream;
}

static auto solve_channel(const std::vector<std::complex<float>>& pilots,
const FixedQueue<std::complex<float>, 300>& signal_queue, const std::size_t signal_offset)
auto IQStreamDecoder::solve_channel(const std::vector<std::complex<float>>& 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());
for (auto i = 0; i < arma_signal.size(); i++) {
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;
}

Expand Down

0 comments on commit 38bf753

Please sign in to comment.