From baa2e9256221367a84a5b5b239231b9df8e4d702 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Sat, 13 Nov 2021 15:44:49 +0100 Subject: [PATCH] add support for 5 MHz (15 kHz SCS) and 10 MHz (30 kHz SCS) to nr_dlsim and nr_ulsim --- openair1/PHY/INIT/nr_init.c | 7 +++++- openair1/SIMULATION/NR_PHY/dlsim.c | 13 +++++++--- openair1/SIMULATION/NR_PHY/ulsim.c | 40 ++++++++++++++++++++++-------- openair2/GNB_APP/gnb_config.c | 32 +++++++++++++++--------- openair2/RRC/NR/nr_rrc_config.c | 2 +- 5 files changed, 67 insertions(+), 27 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index bf360d347a..3507d9ab77 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -478,7 +478,12 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, //gNB_config->subframe_config.dl_cyclic_prefix_type.value = (fp->Ncp == NORMAL) ? NFAPI_CP_NORMAL : NFAPI_CP_EXTENDED; gNB->mac_enabled = 1; - if (mu==1) { + if (mu==0) { + fp->dl_CarrierFreq = 2600000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); + fp->ul_CarrierFreq = 2600000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); + fp->nr_band = 38; + // fp->threequarter_fs= 0; + } else if (mu==1) { fp->dl_CarrierFreq = 3600000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); fp->ul_CarrierFreq = 3600000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); fp->nr_band = 78; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 680858f821..0c27ca5974 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -96,7 +96,6 @@ uint16_t sl_ahead=0; uint64_t downlink_frequency[MAX_NUM_CCs][4]; THREAD_STRUCT thread_struct; nfapi_ue_release_request_body_t release_rntis; -uint32_t N_RB_DL = 106; //Fixme: Uniq dirty DU instance, by global var, datamodel need better management instance_t DUuniqInstance=0; instance_t CUuniqInstance=0; @@ -832,10 +831,14 @@ int main(int argc, char **argv) double fs,bw; - if (mu == 1 && N_RB_DL == 217) { + if (mu == 0 && N_RB_DL == 25) { + fs = 7.68e6; + bw = 5e6; + } + else if (mu == 1 && N_RB_DL == 217) { fs = 122.88e6; bw = 80e6; - } + } else if (mu == 1 && N_RB_DL == 245) { fs = 122.88e6; bw = 90e6; @@ -856,6 +859,10 @@ int main(int argc, char **argv) fs = 61.44e6; bw = 60e6; } + else if (mu == 1 && N_RB_DL == 24) { + fs = 15.36e6; + bw = 10e6; + } else if (mu == 3 && N_RB_DL == 66) { fs = 122.88e6; bw = 100e6; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 1443ebc24f..16e406794a 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -91,7 +91,6 @@ double cpuf; uint64_t downlink_frequency[MAX_NUM_CCs][4]; THREAD_STRUCT thread_struct; nfapi_ue_release_request_body_t release_rntis; -uint32_t N_RB_DL = 106; //Fixme: Uniq dirty DU instance, by global var, datamodel need better management instance_t DUuniqInstance=0; @@ -644,16 +643,37 @@ int main(int argc, char **argv) double sampling_frequency; double bandwidth; - if (N_RB_UL >= 217) sampling_frequency = 122.88; - else if (N_RB_UL >= 106) sampling_frequency = 61.44; - else if (N_RB_UL >= 32) sampling_frequency = 32.72; - else { printf("Need at least 106 PRBs\b"); exit(-1); } - if (N_RB_UL == 273) bandwidth = 100; - else if (N_RB_UL == 217) bandwidth = 80; - else if (N_RB_UL == 106) bandwidth = 40; - else if (N_RB_UL == 32) bandwidth = 50; - else { printf("Add N_RB_UL %d\n",N_RB_UL); exit(-1); } + if (mu == 0 && N_RB_UL == 25 ) { + sampling_frequency = 7.68; + bandwidth = 5; + } + else if (mu == 1 && N_RB_UL == 273) { + sampling_frequency = 122.88; + bandwidth = 100; + } + else if (mu == 1 && N_RB_UL == 217) { + sampling_frequency = 122.88; + bandwidth = 80; + } + else if (mu == 1 && N_RB_UL == 106) { + sampling_frequency = 61.44; + bandwidth = 40; + } + else if (mu == 1 && N_RB_UL == 24) { + sampling_frequency = 15.36; + bandwidth = 10; + } + else if (mu == 3 && N_RB_UL == 32) { + sampling_frequency = 61.44; + bandwidth = 50; + } + else { + printf("Add N_RB_UL %d\n",N_RB_UL); + exit(-1); + } + LOG_I( PHY,"++++++++++++++++++++++++++++++++++++++++++++++%i+++++++++++++++++++++++++++++++++++++++++",loglvl); + if (openair0_cfg[0].threequarter_fs == 1) sampling_frequency*=.75; UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 2795c07ce7..f532f9e74a 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -213,15 +213,20 @@ void fill_scc_sim(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_R // *scc->n_TimingAdvanceOffset=NR_ServingCellConfigCommon__n_TimingAdvanceOffset_n0; *scc->ssb_periodicityServingCell=NR_ServingCellConfigCommon__ssb_periodicityServingCell_ms20; scc->dmrs_TypeA_Position=NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos2; - *scc->ssbSubcarrierSpacing=NR_SubcarrierSpacing_kHz30; - *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB=641032; - *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]=78; - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA=640000; + *scc->ssbSubcarrierSpacing=mu_dl; + if (mu_dl == 0) { + *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB=520432; + *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]=38; + scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA=520000; + } else { + *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB=641032; + *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]=78; + scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA=640000; + } scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier=0; - scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing=NR_SubcarrierSpacing_kHz30; - + scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing=mu_dl; scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth=N_RB_DL; - scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth=13036; + scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth=275*(N_RB_DL-1); scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing=mu_dl;//NR_SubcarrierSpacing_kHz30; *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero=12; *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero=0; @@ -235,13 +240,13 @@ void fill_scc_sim(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_R timedomainresourceallocation1->startSymbolAndLength=57; ASN_SEQUENCE_ADD(&scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list, timedomainresourceallocation1); - *scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]=78; + *scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]=mu_ul?78:38; *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA=-1; scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier=0; - scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing=NR_SubcarrierSpacing_kHz30; + scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing=mu_ul; scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth=N_RB_UL; *scc->uplinkConfigCommon->frequencyInfoUL->p_Max=20; - scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth=13036; + scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth=275*(N_RB_UL-1); scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing=mu_ul;//NR_SubcarrierSpacing_kHz30; scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex=98; scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM=NR_RACH_ConfigGeneric__msg1_FDM_one; @@ -277,8 +282,11 @@ void fill_scc_sim(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_R *scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->p0_nominal=-90; scc->ssb_PositionsInBurst->present=NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap; *ssb_bitmap=0xff; - scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing=NR_SubcarrierSpacing_kHz30; - scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity=NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5; + scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing=mu_dl; + if (mu_dl == 0) + scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity=NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms10; + else + scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity=NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5; scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots=7; scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols=6; scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots=2; diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index f8f05f2fe5..1e590a26b8 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -172,7 +172,7 @@ void set_dl_mcs_table(int scs, NR_UE_NR_Capability_t *cap, } AssertFatal(bw_rb>0,"Could not find scs-SpecificCarrierList element for scs %d",scs); int bw = get_supported_band_index(scs, band, bw_rb); - AssertFatal(bw>0,"Supported band corresponding to %d RBs not found\n", bw_rb); + AssertFatal(bw>=0,"Supported band corresponding to %d RBs not found\n", bw_rb); bool supported = false; if (band>256) {