fix compilation issue regarding definition of size_t in header and declaration of static member null_value in sliding average class

master
Francisco 4 years ago committed by Andre Puschmann
parent d42dc50c44
commit 69748e9313

@ -71,12 +71,12 @@ struct sliding_window {
next_idx -= window.size();
}
}
size_t size() const { return window.size(); }
std::size_t size() const { return window.size(); }
const T& oldest() const { return window[(next_idx + size() - 1) % size()]; }
T& operator[](size_t i) { return window[i]; }
const T& operator[](size_t i) const { return window[i]; }
T& operator[](std::size_t i) { return window[i]; }
const T& operator[](std::size_t i) const { return window[i]; }
std::vector<T> window;
size_t next_idx = 0;
std::size_t next_idx = 0;
};
} // namespace detail
@ -92,7 +92,7 @@ struct sliding_sum : private detail::sliding_window<T> {
T value() const
{
T ret = 0;
for (size_t i = 0; i < size(); ++i) {
for (std::size_t i = 0; i < size(); ++i) {
ret += (*this)[i];
}
return ret;
@ -111,23 +111,23 @@ private:
template <typename T>
struct null_sliding_average {
static constexpr T null_value = std::numeric_limits<T>::max();
null_sliding_average(uint32_t N) : window(N, null_value) {}
null_sliding_average(uint32_t N) : window(N, null_value()) {}
void push(T sample) { window.push(sample); }
void push_hole() { window.push(null_value); }
void push_hole() { window.push(null_value()); }
T value() const
{
T ret = 0;
uint32_t count = 0;
for (size_t i = 0; i < window.size(); ++i) {
if (window[i] != null_value) {
for (std::size_t i = 0; i < window.size(); ++i) {
if (window[i] != null_value()) {
ret += window[i];
count++;
}
}
return (count == 0) ? null_value : ret / count;
return (count == 0) ? null_value() : ret / count;
}
static constexpr T null_value() { return std::numeric_limits<T>::max(); }
private:
detail::sliding_window<T> window;

@ -69,7 +69,7 @@ public:
}
// Enqueue pending SNR measurement
if (pending_snr == snr_avg.null_value) {
if (pending_snr == snr_avg.null_value()) {
acc_pusch_tpc_values += win_pusch_tpc_values.oldest();
acc_pucch_tpc_values += win_pusch_tpc_values.oldest();
} else {
@ -77,7 +77,7 @@ public:
acc_pusch_tpc_values = 0;
}
snr_avg.push(pending_snr);
pending_snr = snr_avg.null_value;
pending_snr = snr_avg.null_value();
// Enqueue PUSCH/PUCCH TPC sent in last TTI (zero for both Delta_PUSCH/Delta_PUCCH=0 and TPC not sent)
win_pusch_tpc_values.push(pending_pusch_tpc);
@ -101,7 +101,7 @@ public:
pending_pusch_tpc = (max_prbs_cached == nof_prb) ? 1 : (last_phr < 0 ? -1 : 0);
pusch_phr_flag = true;
}
} else if (snr_avg.value() != snr_avg.null_value) {
} else if (snr_avg.value() != snr_avg.null_value()) {
// target SINR is finite and there is power headroom
float diff = target_snr_dB - snr_avg.value();
diff -= win_pusch_tpc_values.value() + acc_pusch_tpc_values;
@ -134,7 +134,7 @@ public:
pending_pucch_tpc = (max_prbs_cached == nof_prb) ? 1 : (last_phr < 0 ? -1 : 0);
pucch_phr_flag = true;
}
} else if (snr_avg.value() != snr_avg.null_value) {
} else if (snr_avg.value() != snr_avg.null_value()) {
// target SINR is finite and there is power headroom
float diff = target_snr_dB - snr_avg.value();
diff -= win_pucch_tpc_values.value() + acc_pucch_tpc_values;
@ -162,7 +162,7 @@ private:
srslte::sliding_sum<int> win_pusch_tpc_values, win_pucch_tpc_values;
uint32_t max_prbs_cached = 100;
int pending_pusch_tpc = 0, pending_pucch_tpc = 0;
float pending_snr = srslte::null_sliding_average<float>::null_value;
float pending_snr = srslte::null_sliding_average<float>::null_value();
int acc_pusch_tpc_values = 0, acc_pucch_tpc_values = 0;
int last_phr = undefined_phr;
bool pusch_phr_flag = false, pucch_phr_flag = false;

@ -75,7 +75,7 @@ struct test_scell_activation_params {
int test_scell_activation(test_scell_activation_params params)
{
std::array<uint32_t, 6> prb_list = {6, 15, 25, 50, 75, 100};
std::array<uint32_t, 6> prb_list{6, 15, 25, 50, 75, 100};
/* Simulation Configuration Arguments */
uint32_t nof_prb = prb_list[std::uniform_int_distribution<uint32_t>{0, 5}(get_rand_gen())];

Loading…
Cancel
Save