From 14564326079d5fc46c1e165d5e72b2cd8c3e3afc Mon Sep 17 00:00:00 2001 From: ismagom Date: Wed, 21 Jan 2015 18:18:31 +0000 Subject: [PATCH] Changed eNodeB console prompt --- lte/examples/pdsch_enodeb.c | 8 +- lte/examples/pdsch_ue.c | 18 +++- .../liblte/phy/ch_estimation/refsignal_ul.h | 83 +++++++++++++++++++ lte/phy/lib/ch_estimation/src/refsignal_ul.c | 46 +++++++++- matlab/tests/pdcch_bler.m | 4 +- 5 files changed, 148 insertions(+), 11 deletions(-) create mode 100644 lte/phy/include/liblte/phy/ch_estimation/refsignal_ul.h diff --git a/lte/examples/pdsch_enodeb.c b/lte/examples/pdsch_enodeb.c index 49548fb15..70936ea68 100644 --- a/lte/examples/pdsch_enodeb.c +++ b/lte/examples/pdsch_enodeb.c @@ -107,7 +107,7 @@ void usage(char *prog) { printf("\t-n number of frames [Default %d]\n", nof_frames); printf("\t-c cell id [Default %d]\n", cell.id); printf("\t-p nof_prb [Default %d]\n", cell.nof_prb); - printf("\t-u listen UDP port for input data (-1 is random) [Default %d]\n", net_port); + printf("\t-u listen TCP port for input data (-1 is random) [Default %d]\n", net_port); printf("\t-v [set verbose to debug, default none]\n"); } @@ -328,7 +328,8 @@ int update_radl() { ra_mcs_from_idx_dl(mcs_idx, prb_alloc.slot[0].nof_prb, &ra_dl.mcs); ra_pdsch_fprint(stdout, &ra_dl, cell.nof_prb); - + printf("Type new MCS index and press Enter: "); fflush(stdout); + pdsch_harq_reset(&harq_process); if (pdsch_harq_setup(&harq_process, ra_dl.mcs, &prb_alloc)) { fprintf(stderr, "Error configuring HARQ process\n"); @@ -374,7 +375,6 @@ int update_control() { prbset_num--; break; } - printf("num: %d, orig: %d\n", prbset_num, prbset_orig); } else { last_mcs_idx = mcs_idx; mcs_idx = atoi(input); @@ -604,8 +604,6 @@ int main(int argc, char **argv) { nf++; } sfn = (sfn + 1) % 1024; - printf("SFN: %4d\tType new MCS index and press Enter\r", sfn); - fflush(stdout); } base_free(); diff --git a/lte/examples/pdsch_ue.c b/lte/examples/pdsch_ue.c index 6aa3ad7ee..a31f333ed 100644 --- a/lte/examples/pdsch_ue.c +++ b/lte/examples/pdsch_ue.c @@ -125,8 +125,8 @@ void usage(prog_args_t *args, char *prog) { printf("\t-n nof_subframes [Default %d]\n", args->nof_subframes); printf("\t-s remote UDP port to send input signal (-1 does nothing with it) [Default %d]\n", args->net_port_signal); printf("\t-S remote UDP address to send input signal [Default %s]\n", args->net_address_signal); - printf("\t-u remote UDP port to send data (-1 does nothing with it) [Default %d]\n", args->net_port); - printf("\t-U remote UDP address to send data [Default %s]\n", args->net_address); + printf("\t-u remote TCP port to send data (-1 does nothing with it) [Default %d]\n", args->net_port); + printf("\t-U remote TCP address to send data [Default %s]\n", args->net_address); printf("\t-v [set verbose to debug, default none]\n"); } @@ -421,6 +421,20 @@ int main(int argc, char **argv) { if (isnan(rsrp)) { rsrp = 0; } + + /* Adjust channel estimator based on SNR */ + if (10*log10(snr) < 5.0) { + float f_low_snr[5]={0.05, 0.15, 0.6, 0.15, 0.05}; + chest_dl_set_filter_freq(&ue_dl.chest, f_low_snr, 5); + } else if (10*log10(snr) < 10.0) { + float f_mid_snr[3]={0.1, 0.8, 0.1}; + chest_dl_set_filter_freq(&ue_dl.chest, f_mid_snr, 3); + } else { + float f_high_snr[3]={0.05, 0.9, 0.05}; + chest_dl_set_filter_freq(&ue_dl.chest, f_high_snr, 3); + } + + } if (ue_sync_get_sfidx(&ue_sync) != 5 && ue_sync_get_sfidx(&ue_sync) != 0) { pdcch_tx++; diff --git a/lte/phy/include/liblte/phy/ch_estimation/refsignal_ul.h b/lte/phy/include/liblte/phy/ch_estimation/refsignal_ul.h new file mode 100644 index 000000000..b55b20bfa --- /dev/null +++ b/lte/phy/include/liblte/phy/ch_estimation/refsignal_ul.h @@ -0,0 +1,83 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2014 The libLTE Developers. See the + * COPYRIGHT file at the top-level directory of this distribution. + * + * \section LICENSE + * + * This file is part of the libLTE library. + * + * libLTE is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * libLTE 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 Lesser General Public License for more details. + * + * A copy of the GNU Lesser General Public License can be found in + * the LICENSE file in the top-level directory of this distribution + * and at http://www.gnu.org/licenses/. + * + */ + +#ifndef REFSIGNAL_UL_ +#define REFSIGNAL_DL_ + +/* Object to manage Downlink reference signals for channel estimation. + * + */ + +#include "liblte/config.h" +#include "liblte/phy/common/phy_common.h" + +typedef _Complex float cf_t; + +// Number of references in a subframe: there are 2 symbols for port_id=0,1 x 2 slots x 2 refs per prb +#define REFSIGNAL_NUM_SF(nof_prb, port_id) (((port_id)<2?8:4)*(nof_prb)) +#define REFSIGNAL_MAX_NUM_SF(nof_prb) REFSIGNAL_NUM_SF(nof_prb, 0) + +#define REFSIGNAL_PILOT_IDX(i,l,cell) (2*cell.nof_prb*(l)+(i)) + + +/** Cell-Specific Reference Signal */ +typedef struct LIBLTE_API { + lte_cell_t cell; + cf_t *pilots[2][NSUBFRAMES_X_FRAME]; // Saves the reference signal per subframe for ports 0,1 and ports 2,3 +} refsignal_cs_t; + + +LIBLTE_API int refsignal_cs_generate(refsignal_cs_t *q, + lte_cell_t cell); + +LIBLTE_API void refsignal_cs_free(refsignal_cs_t *q); + +LIBLTE_API int refsignal_cs_put_sf(lte_cell_t cell, + uint32_t port_id, + cf_t *pilots, + cf_t *sf_symbols); + +LIBLTE_API int refsignal_cs_get_sf(lte_cell_t cell, + uint32_t port_id, + cf_t *sf_symbols, + cf_t *pilots); + +LIBLTE_API uint32_t refsignal_fidx(lte_cell_t cell, + uint32_t l, + uint32_t port_id, + uint32_t m); + +LIBLTE_API uint32_t refsignal_nsymbol(uint32_t l, + lte_cp_t cp, + uint32_t port_id); + +LIBLTE_API uint32_t refsignal_cs_v(uint32_t port_id, + uint32_t ref_symbol_idx); + +LIBLTE_API uint32_t refsignal_cs_nof_symbols(uint32_t port_id); + +#endif diff --git a/lte/phy/lib/ch_estimation/src/refsignal_ul.c b/lte/phy/lib/ch_estimation/src/refsignal_ul.c index dfc5f6166..153844964 100644 --- a/lte/phy/lib/ch_estimation/src/refsignal_ul.c +++ b/lte/phy/lib/ch_estimation/src/refsignal_ul.c @@ -1,5 +1,45 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2014 The libLTE Developers. See the + * COPYRIGHT file at the top-level directory of this distribution. + * + * \section LICENSE + * + * This file is part of the libLTE library. + * + * libLTE is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * libLTE 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 Lesser General Public License for more details. + * + * A copy of the GNU Lesser General Public License can be found in + * the LICENSE file in the top-level directory of this distribution + * and at http://www.gnu.org/licenses/. + * + */ + +#ifdef compile + +#include +#include +#include +#include +#include + +#include "liblte/phy/common/phy_common.h" +#include "liblte/phy/ch_estimation/refsignal_ul.h" +#include "liblte/phy/utils/vector.h" +#include "liblte/phy/utils/debug.h" +#include "liblte/phy/common/sequence.h" + -#ifdef nocompile // n_drms_2 table 5.5.2.1.1-1 from 36.211 uint32_t n_drms_2[8] = { 0, 6, 3, 4, 2, 8, 10, 9 }; @@ -180,4 +220,6 @@ free_and_exit: return ret; } -#endif \ No newline at end of file +#endif + + diff --git a/matlab/tests/pdcch_bler.m b/matlab/tests/pdcch_bler.m index c337a7b63..bc26faca3 100644 --- a/matlab/tests/pdcch_bler.m +++ b/matlab/tests/pdcch_bler.m @@ -5,14 +5,14 @@ clear Npackets = 1000; -SNR_values = linspace(-0.5,3,6); +SNR_values = linspace(-5,0,8); txCFI = 3; enbConfig.NDLRB = 15; % No of Downlink RBs in total BW enbConfig.CyclicPrefix = 'Normal'; % CP length enbConfig.CFI = txCFI; ; % 4 PDCCH symbols as NDLRB <= 10 enbConfig.Ng = 'Sixth'; % HICH groups -enbConfig.CellRefP = 1; % 1-antenna ports +enbConfig.CellRefP = 2; % 1-antenna ports enbConfig.NCellID = 0; % Physical layer cell identity enbConfig.NSubframe = 5; % Subframe number 0 enbConfig.DuplexMode = 'FDD'; % Frame structure