diff --git a/charts/physims/charts/nr-pbchsim.scs/Chart.yaml b/charts/physims/charts/nr-pbchsim.scs/Chart.yaml new file mode 100644 index 0000000000..c590bfff38 --- /dev/null +++ b/charts/physims/charts/nr-pbchsim.scs/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-nr-pbchsim-scs +description: A Helm subchart for nr-pbchsim network function ("Other SCS" tests) + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: v1 + +keywords: + - Physical Simulator + - nr-pbchsim + - RAN + - 5G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims/charts/nr-pbchsim.scs/templates/_helpers.tpl b/charts/physims/charts/nr-pbchsim.scs/templates/_helpers.tpl new file mode 100644 index 0000000000..4734fc898e --- /dev/null +++ b/charts/physims/charts/nr-pbchsim.scs/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-nr-pbchsim-scs.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "oai-nr-pbchsim-scs.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "oai-nr-pbchsim-scs.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-nr-pbchsim-scs.labels" -}} +helm.sh/chart: {{ include "oai-nr-pbchsim-scs.chart" . }} +{{ include "oai-nr-pbchsim-scs.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-nr-pbchsim-scs.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-nr-pbchsim-scs.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-nr-pbchsim-scs.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-nr-pbchsim-scs.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims/charts/nr-pbchsim.scs/templates/job.yaml b/charts/physims/charts/nr-pbchsim.scs/templates/job.yaml new file mode 100644 index 0000000000..a8087a108a --- /dev/null +++ b/charts/physims/charts/nr-pbchsim.scs/templates/job.yaml @@ -0,0 +1,42 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ .Chart.Name }} +spec: + template: + metadata: + labels: + app: physim + spec: + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: physim + image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.version }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + env: + - name: OPENAIR_DIR + value: /opt/oai-physim + command: ["/bin/sh", "-c"] + args: + - > + cmake_targets/autotests/run_exec_autotests.bash -g "nr_pbchsim.otherSCS" -d bin/ && + echo "FINISHED" && sleep infinity + dnsPolicy: ClusterFirst + restartPolicy: Never + schedulerName: default-scheduler + serviceAccountName: {{ .Values.global.serviceAccountName }} + terminationGracePeriodSeconds: 30 + {{- if .Values.global.nodeSelector}} + nodeSelector: + {{- toYaml .Values.global.nodeSelector | nindent 12 }} + {{- end }} + {{- if .Values.global.nodeName.nrpbchsim273rb}} + nodeName: {{ .Values.global.nodeName.nrpbchsim273rb }} + {{- end }} diff --git a/charts/physims/charts/nr-pbchsim.scs/values.yaml b/charts/physims/charts/nr-pbchsim.scs/values.yaml new file mode 100644 index 0000000000..f7753924f1 --- /dev/null +++ b/charts/physims/charts/nr-pbchsim.scs/values.yaml @@ -0,0 +1,48 @@ +# Default values for oai-nr-pbchsim-scs +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + +imagePullSecrets: [] + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "oai-nr-pbchsim-scs" + +podSecurityContext: + runAsUser: 0 + runAsGroup: 0 + +securityContext: + privileged: false + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/physims/values.yaml b/charts/physims/values.yaml index 9a00a56134..a4e0ffecd4 100644 --- a/charts/physims/values.yaml +++ b/charts/physims/values.yaml @@ -27,6 +27,7 @@ global: nrpbschsim106rb: dedale nrpbchsim217rb: dedale nrpbchsim273rb: dedale + nrpbchsimscs: dedale nrpsbchsim: dedale nrprachsim: dedale nrpucchsim: dedale diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 0fa88aff32..5e803b27e7 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -163,7 +163,7 @@ class PhySim: mySSH.command('oc get pods -o wide -l app=physim | tee -a cmake_targets/log/physim_pods_summary.txt', '\$', 30, resync=True) running_count = mySSH.getBefore().count('Running') completed_count = mySSH.getBefore().count('Completed') - if (running_count + completed_count) == 22: + if (running_count + completed_count) == 23: logging.debug('\u001B[1m Running the physim test Scenarios\u001B[0m') isRunning = True podNames = re.findall('oai-[\S\d\w]+', mySSH.getBefore()) diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 90ec5c7f24..2c6dc73bfa 100755 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -149,6 +149,18 @@ 3 + + nr_pbchsim Test cases. (Test1: PBCH-only, 15Khz, 5Mhz), + (Test2: PBCH-only, 120Khz, 50Mhz) + nr_pbchsim + -s-10 -S-8 -n10 -m0 -R25 + -s-10 -S-8 -n10 -m3 -R32 + test1 test2 + PBCH test OK + segmentation fault|assertion|exiting|fatal + 3 + + nr_dlsim Test cases. (Test1: 106 PRB), (Test2: 217 PRB), diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 9f3f1760bd..c0b1cbf5bb 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -125,55 +125,6 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue, return 0; } -void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB, - int N_RB_DL, - int N_RB_UL, - int mu, - int Nid_cell, - uint64_t position_in_burst) -{ - NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; - nfapi_nr_config_request_scf_t *gNB_config = &gNB->gNB_config; - //overwrite for new NR parameters - - uint64_t rev_burst=0; - for (int i=0; i<64; i++) - rev_burst |= (((position_in_burst>>(63-i))&0x01)<cell_config.phy_cell_id.value = Nid_cell; - gNB_config->ssb_config.scs_common.value = mu; - gNB_config->ssb_table.ssb_subcarrier_offset.value = 0; - gNB_config->ssb_table.ssb_offset_point_a.value = (N_RB_DL-20)>>1; - gNB_config->ssb_table.ssb_mask_list[1].ssb_mask.value = (rev_burst)&(0xFFFFFFFF); - gNB_config->ssb_table.ssb_mask_list[0].ssb_mask.value = (rev_burst>>32)&(0xFFFFFFFF); - gNB_config->cell_config.frame_duplex_type.value = TDD; - gNB_config->ssb_table.ssb_period.value = 1; //10ms - gNB_config->carrier_config.dl_grid_size[mu].value = N_RB_DL; - gNB_config->carrier_config.ul_grid_size[mu].value = N_RB_UL; - gNB_config->carrier_config.num_tx_ant.value = fp->nb_antennas_tx; - gNB_config->carrier_config.num_rx_ant.value = fp->nb_antennas_rx; - - gNB_config->tdd_table.tdd_period.value = 0; - //gNB_config->subframe_config.dl_cyclic_prefix_type.value = (fp->Ncp == NORMAL) ? NFAPI_CP_NORMAL : NFAPI_CP_EXTENDED; - - 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); - if (mu>2) fp->nr_band = 257; - else fp->nr_band = 78; - fp->threequarter_fs= 0; - frequency_range_t frequency_range = fp->nr_band > 256 ? FR2 : FR1; - int bw_index = get_supported_band_index(mu, frequency_range, N_RB_DL); - gNB_config->carrier_config.dl_bandwidth.value = get_supported_bw_mhz(frequency_range, bw_index); - - fp->ofdm_offset_divisor = UINT_MAX; - nr_init_frame_parms(gNB_config, fp); - init_timeshift_rotation(fp); - - init_symbol_rotation(fp); - - gNB->configured = 1; - LOG_I(PHY,"gNB configured\n"); -} configmodule_interface_t *uniqCfg = NULL; int main(int argc, char **argv) { @@ -499,9 +450,14 @@ int main(int argc, char **argv) frame_parms->ssb_type = nr_ssb_type_C; frame_parms->freq_range = mu<2 ? FR1 : FR2; - nr_phy_config_request_sim_pbchsim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions); + nr_phy_config_request_sim(gNB, N_RB_DL, N_RB_DL, mu, Nid_cell, SSB_positions); gNB->gNB_config.tdd_table.tdd_period.value = 6; - set_tdd_config_nr(&gNB->gNB_config, mu, 7, 6, 2, 4); + if (mu == 0) + set_tdd_config_nr(&gNB->gNB_config, mu, 3, 6, 1, 4); + else if (mu == 1) + set_tdd_config_nr(&gNB->gNB_config, mu, 7, 6, 2, 4); + else if (mu == 3) + set_tdd_config_nr(&gNB->gNB_config, mu, 27, 6, 12, 4); phy_init_nr_gNB(gNB); frame_parms->ssb_start_subcarrier = 12 * gNB->gNB_config.ssb_table.ssb_offset_point_a.value + ssb_subcarrier_offset; initFloatingCoresTpool(ssb_scan_threads, &nrUE_params.Tpool, false, "UE-tpool"); @@ -511,40 +467,10 @@ int main(int argc, char **argv) double fs=0, eps; double scs = 30000; - double bw = 100e6; - - switch (mu) { - case 1: - scs = 30000; - frame_parms->Lmax = 8; - if (N_RB_DL == 217) { - fs = 122.88e6; - bw = 80e6; - } - else if (N_RB_DL == 245) { - fs = 122.88e6; - bw = 90e6; - } - else if (N_RB_DL == 273) { - fs = 122.88e6; - bw = 100e6; - } - else if (N_RB_DL == 106) { - fs = 61.44e6; - bw = 40e6; - } - else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL); - break; - case 3: - frame_parms->Lmax = 64; - scs = 120000; - if (N_RB_DL == 66) { - fs = 122.88e6; - bw = 100e6; - } - else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL); - break; - } + double txbw, rxbw; + uint32_t samples; + + get_samplerate_and_bw(mu, N_RB_DL, frame_parms->threequarter_fs, &fs, &samples, &txbw, &rxbw); // cfo with respect to sub-carrier spacing eps = cfo/scs; @@ -560,19 +486,7 @@ int main(int argc, char **argv) printf("FFO = %lf; IFO = %d\n",eps-IFO,IFO); } - gNB2UE = new_channel_desc_scm(n_tx, - n_rx, - channel_model, - fs, - 0, - bw, - 300e-9, - 0.0, - CORR_LEVEL_LOW, - 0, - 0, - 0, - 0); + gNB2UE = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, 0, txbw, 300e-9, 0.0, CORR_LEVEL_LOW, 0, 0, 0, 0); if (gNB2UE==NULL) { printf("Problem generating channel model. Exiting.\n");