# OAI-rf-simulator based on Semcom gNB/UE Installation & Execution
###### tags: `Construction`
## OAI rf simulator gNB/UE pre-requisites
#### Basic requirement
| OS/Kernel | Version |
|:-------------------------- |:----------------------------------------|
| Host operating system | Linux Ubuntu 18.04 or 20.04 or 22.04 |
| Kernel | 4.15.0.142.lowlatency |
## Build OAI gNB/UE
#### Clone and build the dependency for the first time
```shell=
# Clone OAI project in Develop Branch
$ git clone https://github.com/eric693/mwnl_oai_semcom.git
$ cd openairinterface5g/
# Build ONLY FOR the FIRST time
$ source oaienv
$ cd cmake_targets
$ export BUILD_UHD_FROM_SOURCE=Ture
$ export UHD_VERSION=4.3.0.0-rc1 #(optional UHD_VERSION=4.4.0.0)
$ ./build_oai -I
```
#### Build OAI gNB and nrUE for USRP
```shell=
$ sudo ./build_oai --phy_simulators --gNB --nrUE
```
#### RUN OAI gNB with RF Simulator
```shell=
# sudo RFSIMULATOR=server ./nr-softmodem --rfsim --sa -O [where the config file is]
$ sudo ./nr-softmodem --rfsim --sa --rfsimulator.options chanmod -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6
# print gNB log in file
$ sudo ./nr-softmodem --rfsim --sa --rfsimulator.options chanmod -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 2>&1 | ts &>../../../../oai-semcom/LOG/5-OAI_gNBsim.log
```
#### RUN OAI nrUE with RF Simulator
```shell=
$ sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --sa --uicc0.imsi 001010000000001 --rfsim 2>&1
# print nrUE log in file
$ sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --sa --uicc0.imsi 001010000000001 --rfsim 2>&1 | ts &>../../../../oai-semcom/LOG/5-OAI_UEsim.log
```
#### Discuss
https://hackmd.io/@RGAAplgqT32ASLrIimn62g/HksCdtDGC#git
https://hackmd.io/@RGAAplgqT32ASLrIimn62g/BJt5pcTJR
https://hackmd.io/xdpF6cy1Tiu64kXuhOb_mw?view