nr: refactor DL/UL frequency deriviation

* add separate DL/UL freq point a in NR carrier struct
* use freqInfoDL/freqInfoUL to get freq point a
* simplify carrier tuning logic
master
Andre Puschmann 3 years ago
parent 11af5662a7
commit 07019a5bd6

@ -69,20 +69,10 @@ public:
* For unparied spectrum (TDD) the function returns the same ARFCN.
*
* @param dl_arfcn The DL ARFCN
* @return uint32_t
* @return uint32_t the UL ARFCN
*/
uint32_t get_ul_arfcn_from_dl_arfcn(uint32_t dl_arfcn) const;
/**
* @brief Compute the DL and UL center frequency for a NR carrier
*
* Results are stored inside the carrier struct.
*
* @param carrier Reference to a carrier struct including PRB, abs. frequency point A and carrier offset.
* @return int SRSRAN_SUCESS The center frequency
*/
int get_center_freq_from_abs_freq_point_a(srsran_carrier_nr_t& carrier);
/**
* @brief Selects the SSB pattern case according to the band number and subcarrier spacing
* @remark Described by TS 38.101-1 Table 5.4.3.3-1: Applicable SS raster entries per operating band
@ -99,6 +89,22 @@ public:
*/
srsran_duplex_mode_t get_duplex_mode(uint16_t band) const;
/**
* @brief Compute the DL center frequency for a NR carrier
*
* @param carrier Const Reference to a carrier struct including PRB, abs. frequency point A and carrier offset.
* @return double Frequency in Hz
*/
double get_dl_center_freq(const srsran_carrier_nr_t& carrier);
/**
* @brief Compute the UL center frequency for a NR carrier
*
* @param carrier Const Reference to a carrier struct including PRB, abs. frequency point A and carrier offset.
* @return double Frequency in Hz
*/
double get_ul_center_freq(const srsran_carrier_nr_t& carrier);
class sync_raster_t
{
protected:
@ -130,6 +136,9 @@ public:
sync_raster_t get_sync_raster(uint16_t band, srsran_subcarrier_spacing_t scs) const;
private:
// internal helper
double get_center_freq_from_abs_freq_point_a(uint32_t nof_prb, uint32_t freq_point_a_arfcn);
// Elements of TS 38.101-1 Table 5.2-1: NR operating bands in FR1
struct nr_operating_band {
uint16_t band;

@ -363,7 +363,8 @@ typedef enum SRSRAN_API {
typedef struct SRSRAN_API {
uint32_t pci;
uint32_t absolute_frequency_ssb;
uint32_t absolute_frequency_point_a;
uint32_t dl_absolute_frequency_point_a;
uint32_t ul_absolute_frequency_point_a;
uint32_t offset_to_carrier; ///< Offset between point A and the lowest subcarrier of the lowest RB
srsran_subcarrier_spacing_t scs;
uint32_t nof_prb; ///< @brief See TS 38.101-1 Table 5.3.2-1 for more details

@ -1349,11 +1349,13 @@ bool make_phy_carrier_cfg(const freq_info_dl_s& asn1_freq_info_dl, srsran_carrie
}
// As the carrier structure requires parameters from different objects, set fields separately
out_carrier_nr->absolute_frequency_ssb = absolute_frequency_ssb;
out_carrier_nr->absolute_frequency_point_a = asn1_freq_info_dl.absolute_freq_point_a;
out_carrier_nr->offset_to_carrier = asn1_freq_info_dl.scs_specific_carrier_list[0].offset_to_carrier;
out_carrier_nr->nof_prb = asn1_freq_info_dl.scs_specific_carrier_list[0].carrier_bw;
out_carrier_nr->scs = scs;
out_carrier_nr->absolute_frequency_ssb = absolute_frequency_ssb;
out_carrier_nr->dl_absolute_frequency_point_a = asn1_freq_info_dl.absolute_freq_point_a;
out_carrier_nr->ul_absolute_frequency_point_a =
out_carrier_nr->dl_absolute_frequency_point_a; // needs to be updated for FDD
out_carrier_nr->offset_to_carrier = asn1_freq_info_dl.scs_specific_carrier_list[0].offset_to_carrier;
out_carrier_nr->nof_prb = asn1_freq_info_dl.scs_specific_carrier_list[0].carrier_bw;
out_carrier_nr->scs = scs;
return true;
}

@ -109,28 +109,24 @@ uint32_t srsran_band_helper::get_ul_arfcn_from_dl_arfcn(uint32_t dl_arfcn) const
return 0;
}
int srsran_band_helper::get_center_freq_from_abs_freq_point_a(srsran_carrier_nr_t& carrier)
double srsran_band_helper::get_dl_center_freq(const srsran_carrier_nr_t& carrier)
{
return get_center_freq_from_abs_freq_point_a(carrier.nof_prb, carrier.dl_absolute_frequency_point_a);
}
double srsran_band_helper::get_ul_center_freq(const srsran_carrier_nr_t& carrier)
{
return get_center_freq_from_abs_freq_point_a(carrier.nof_prb, carrier.ul_absolute_frequency_point_a);
}
double srsran_band_helper::get_center_freq_from_abs_freq_point_a(uint32_t nof_prb, uint32_t freq_point_a_arfcn)
{
// for FR1 unit of resources blocks for freq calc is always 180kHz regardless for actual SCS of carrier
// TODO: add offset_to_carrier
double abs_freq_point_a_freq = nr_arfcn_to_freq(carrier.absolute_frequency_point_a);
carrier.dl_center_freq =
abs_freq_point_a_freq +
(carrier.nof_prb / 2 * SRSRAN_SUBC_SPACING_NR(srsran_subcarrier_spacing_t::srsran_subcarrier_spacing_15kHz) *
SRSRAN_NRE);
// UL depends on duplex
if (get_duplex_mode(get_band_from_dl_arfcn(carrier.absolute_frequency_point_a)) == SRSRAN_DUPLEX_MODE_TDD) {
// TDD case
carrier.ul_center_freq = carrier.dl_center_freq;
} else {
// FDD case
uint32_t dl_arfcn = freq_to_nr_arfcn(carrier.dl_center_freq);
uint32_t ul_arfcn = get_ul_arfcn_from_dl_arfcn(dl_arfcn);
carrier.ul_center_freq = nr_arfcn_to_freq(ul_arfcn);
}
return SRSRAN_SUCCESS;
double abs_freq_point_a_freq = nr_arfcn_to_freq(freq_point_a_arfcn);
return abs_freq_point_a_freq +
(nof_prb / 2 * SRSRAN_SUBC_SPACING_NR(srsran_subcarrier_spacing_t::srsran_subcarrier_spacing_15kHz) *
SRSRAN_NRE);
}
srsran_ssb_patern_t srsran_band_helper::get_ssb_pattern(uint16_t band, srsran_subcarrier_spacing_t scs) const

@ -66,24 +66,24 @@ phy_cfg_nr_default_t::reference_cfg_t::reference_cfg_t(const std::string& args)
void phy_cfg_nr_default_t::make_carrier_custom_10MHz(srsran_carrier_nr_t& carrier)
{
carrier.nof_prb = 52;
carrier.max_mimo_layers = 1;
carrier.pci = 500;
carrier.absolute_frequency_point_a = 633928;
carrier.absolute_frequency_ssb = 634176;
carrier.offset_to_carrier = 0;
carrier.scs = srsran_subcarrier_spacing_15kHz;
carrier.nof_prb = 52;
carrier.max_mimo_layers = 1;
carrier.pci = 500;
carrier.dl_absolute_frequency_point_a = 633928;
carrier.absolute_frequency_ssb = 634176;
carrier.offset_to_carrier = 0;
carrier.scs = srsran_subcarrier_spacing_15kHz;
}
void phy_cfg_nr_default_t::make_carrier_custom_20MHz(srsran_carrier_nr_t& carrier)
{
carrier.nof_prb = 106;
carrier.max_mimo_layers = 1;
carrier.pci = 500;
carrier.absolute_frequency_point_a = 633928;
carrier.absolute_frequency_ssb = 634176;
carrier.offset_to_carrier = 0;
carrier.scs = srsran_subcarrier_spacing_15kHz;
carrier.nof_prb = 106;
carrier.max_mimo_layers = 1;
carrier.pci = 500;
carrier.dl_absolute_frequency_point_a = 633928;
carrier.absolute_frequency_ssb = 634176;
carrier.offset_to_carrier = 0;
carrier.scs = srsran_subcarrier_spacing_15kHz;
}
void phy_cfg_nr_default_t::make_tdd_custom_6_4(srsran_tdd_config_nr_t& tdd)

@ -42,11 +42,11 @@ int bands_test_nr()
// check actual freqs for FDD carrier (example values are for 52 PRB)
srsran_carrier_nr_t carrier = {};
carrier.absolute_frequency_point_a = 175364;
carrier.dl_absolute_frequency_point_a = 175364;
carrier.ul_absolute_frequency_point_a = 166364;
carrier.nof_prb = 52;
TESTASSERT(bands.get_center_freq_from_abs_freq_point_a(carrier) == SRSRAN_SUCCESS);
TESTASSERT(carrier.dl_center_freq == 881.5e6);
TESTASSERT(carrier.ul_center_freq == 836.5e6);
TESTASSERT(bands.get_dl_center_freq(carrier) == 881.5e6);
TESTASSERT(bands.get_ul_center_freq(carrier) == 836.5e6);
// b3
TESTASSERT(bands.nr_arfcn_to_freq(342000) == 1710.0e6);

@ -20,7 +20,8 @@
static srsran_carrier_nr_t carrier = {
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // dl_absolute_frequency_point_a
0, // ul_absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
50, // nof_prb

@ -23,7 +23,8 @@
static srsran_carrier_nr_t carrier = {
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // dl_absolute_frequency_point_a
0, // ul_absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
50, // nof_prb

@ -18,7 +18,8 @@
static srsran_carrier_nr_t carrier = {
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // dl_absolute_frequency_point_a
0, // ul_absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
50, // nof_prb

@ -23,7 +23,8 @@
static srsran_carrier_nr_t carrier = {
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // dl_absolute_frequency_point_a
0, // ul_absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
SRSRAN_MAX_PRB_NR, // nof_prb

@ -25,7 +25,8 @@
static srsran_carrier_nr_t carrier = {
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // dl_absolute_frequency_point_a
0, // ul_absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
6, // nof_prb

@ -22,7 +22,8 @@
static srsran_carrier_nr_t carrier = {
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // dl_absolute_frequency_point_a
0, // ul_absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
SRSRAN_MAX_PRB_NR, // nof_prb

@ -21,7 +21,8 @@
static srsran_carrier_nr_t carrier = {
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // dl_absolute_frequency_point_a
0, // ul_absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
SRSRAN_MAX_PRB_NR, // nof_prb

@ -19,7 +19,8 @@
static srsran_carrier_nr_t carrier = {
501, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // dl_absolute_frequency_point_a
0, // ul_absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
52, // nof_prb

@ -22,7 +22,8 @@
static srsran_carrier_nr_t carrier = {
501, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // dl_absolute_frequency_point_a
0, // ul_absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
52, // nof_prb

@ -85,7 +85,7 @@ bool cc_worker::update_cfg()
}
double abs_freq_point_a_freq =
srsran::srsran_band_helper().nr_arfcn_to_freq(phy.cfg.carrier.absolute_frequency_point_a);
srsran::srsran_band_helper().nr_arfcn_to_freq(phy.cfg.carrier.dl_absolute_frequency_point_a);
double abs_freq_ssb_freq = srsran::srsran_band_helper().nr_arfcn_to_freq(phy.cfg.carrier.absolute_frequency_ssb);
double carrier_center_freq =

@ -136,7 +136,7 @@ bool worker_pool::set_config(const srsran::phy_cfg_nr_t& cfg)
phy_state.cfg = cfg;
logger.info(
"Setting new PHY configuration ARFCN=%d, PCI=%d", cfg.carrier.absolute_frequency_point_a, cfg.carrier.pci);
"Setting new PHY configuration ARFCN=%d, PCI=%d", cfg.carrier.dl_absolute_frequency_point_a, cfg.carrier.pci);
// Set carrier information
info_metrics_t info = {};

@ -649,20 +649,16 @@ void phy::set_earfcn(std::vector<uint32_t> earfcns)
bool phy::set_config(const srsran::phy_cfg_nr_t& cfg)
{
// Derive actual RF frequencies for NR carrier
double abs_freq_point_a_freq = srsran::srsran_band_helper().nr_arfcn_to_freq(cfg.carrier.absolute_frequency_point_a);
// for FR1 unit of resources blocks for freq calc is always 180kHz regardless for actual SCS of carrier
// TODO: add offset_to_carrier
double carrier_center_freq =
abs_freq_point_a_freq +
(cfg.carrier.nof_prb / 2 * SRSRAN_SUBC_SPACING_NR(srsran_subcarrier_spacing_t::srsran_subcarrier_spacing_15kHz) *
SRSRAN_NRE);
srsran::srsran_band_helper band_helper;
double dl_freq_hz = band_helper.get_dl_center_freq(cfg.carrier);
double ul_freq_hz = band_helper.get_ul_center_freq(cfg.carrier);
// tune radio
for (uint32_t i = 0; i < common.args->nof_nr_carriers; i++) {
logger_phy.info("Tuning channel %d to %.2f GHz", i + common.args->nof_lte_carriers, carrier_center_freq / 1e6);
radio->set_rx_freq(i + common.args->nof_lte_carriers, carrier_center_freq);
radio->set_tx_freq(i + common.args->nof_lte_carriers, carrier_center_freq);
logger_phy.info("Tuning Rx channel %d to %.2f GHz", i + common.args->nof_lte_carriers, dl_freq_hz / 1e6);
radio->set_rx_freq(i + common.args->nof_lte_carriers, dl_freq_hz);
logger_phy.info("Tuning Tx channel %d to %.2f GHz", i + common.args->nof_lte_carriers, ul_freq_hz / 1e6);
radio->set_tx_freq(i + common.args->nof_lte_carriers, ul_freq_hz);
}
return nr_workers.set_config(cfg);

@ -773,16 +773,16 @@ bool rrc_nr::apply_csi_meas_cfg(const asn1::rrc_nr::csi_meas_cfg_s& csi_meas_cfg
bool rrc_nr::apply_dl_common_cfg(const asn1::rrc_nr::dl_cfg_common_s& dl_cfg_common)
{
if (dl_cfg_common.init_dl_bwp_present) {
if (dl_cfg_common.freq_info_dl_present) {
if (make_phy_carrier_cfg(dl_cfg_common.freq_info_dl, &phy_cfg.carrier) == false) {
logger.warning("Warning while making carrier phy config");
return false;
}
} else {
logger.warning("Option freq_info_dl not present");
if (dl_cfg_common.freq_info_dl_present) {
if (make_phy_carrier_cfg(dl_cfg_common.freq_info_dl, &phy_cfg.carrier) == false) {
logger.warning("Warning while making carrier phy config");
return false;
}
} else {
logger.warning("Option freq_info_dl not present, S-UL not supported.");
return false;
}
if (dl_cfg_common.init_dl_bwp_present) {
if (dl_cfg_common.init_dl_bwp.pdsch_cfg_common_present) {
if (dl_cfg_common.init_dl_bwp.pdsch_cfg_common.type() ==
asn1::rrc_nr::setup_release_c<asn1::rrc_nr::pdsch_cfg_common_s>::types_opts::setup) {
@ -790,13 +790,12 @@ bool rrc_nr::apply_dl_common_cfg(const asn1::rrc_nr::dl_cfg_common_s& dl_cfg_com
// Load CORESET Zero
if (pdcch_cfg_common.ctrl_res_set_zero_present) {
srsran::srsran_band_helper band_helper;
// Get band number
uint16_t band = band_helper.get_band_from_dl_arfcn(phy_cfg.carrier.absolute_frequency_point_a);
srsran::srsran_band_helper band_helper;
uint16_t band = band_helper.get_band_from_dl_arfcn(phy_cfg.carrier.dl_absolute_frequency_point_a);
// Get pointA and SSB absolute frequencies
double pointA_abs_freq_Hz = band_helper.nr_arfcn_to_freq(phy_cfg.carrier.absolute_frequency_point_a);
double pointA_abs_freq_Hz = band_helper.nr_arfcn_to_freq(phy_cfg.carrier.dl_absolute_frequency_point_a);
double ssb_abs_freq_Hz = band_helper.nr_arfcn_to_freq(phy_cfg.carrier.absolute_frequency_ssb);
// Calculate integer SSB to pointA frequency offset in Hz
@ -914,6 +913,10 @@ bool rrc_nr::apply_dl_common_cfg(const asn1::rrc_nr::dl_cfg_common_s& dl_cfg_com
bool rrc_nr::apply_ul_common_cfg(const asn1::rrc_nr::ul_cfg_common_s& ul_cfg_common)
{
if (ul_cfg_common.freq_info_ul_present && ul_cfg_common.freq_info_ul.absolute_freq_point_a_present) {
// Update UL frequency point if provided
phy_cfg.carrier.ul_absolute_frequency_point_a = ul_cfg_common.freq_info_ul.absolute_freq_point_a;
}
if (ul_cfg_common.init_ul_bwp_present) {
if (ul_cfg_common.init_ul_bwp.rach_cfg_common_present) {
if (ul_cfg_common.init_ul_bwp.rach_cfg_common.type() == setup_release_c<rach_cfg_common_s>::types_opts::setup) {

Loading…
Cancel
Save