Commit 71f0135a authored by Raymond Knopp's avatar Raymond Knopp

removal of dead oaisim-related files

parent 293110e2
all: oaisim nasmesh
oaisim:
(cd $(OPENAIR_TARGETS)/SIMU/USER && make LINK_ENB_PDCP_TO_IP_DRIVER=1 -j2 )
nasmesh:
(cd $(OPENAIR2_DIR) && make nasmesh_netlink.ko)
(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL/ && make)
one_eNB_one_UE: oaisim nasmesh
userclean: clean oaisim nasmesh
clean:
(cd $(OPENAIR_TARGETS)/SIMU/USER && make cleanall)
#!/bin/sh
sudo kill -9 `ps -ef | grep oaisim | awk '{print $2}'`
sudo pkill oaisim
# set params
EMULATION_DEV_INTERFACE="eth0"
EMULATION_MULTICAST_GROUP=1
EMULATION_LOG_LEVEL=7 # 3 = error, 5 info, 7 debug, trace= 9
#OAI_LOCAL_ADDRESS="10.0.1.1"
#OAI_REMOTE_ADDRESS="10.0.1.2"
#EMULATION_DEV_ADDRESS= `hostname -I cut -f1 -d' '`
EMULATION_DEV_ADDRESS=`LC_ALL=C ifconfig $EMULATION_DEV_INTERFACE | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
echo "Setting Emulation Interface to $EMULATION_DEV_INTERFACE ($EMULATION_DEV_ADDRESS)"
#funcs
test_install_package() {
# usage: test_install_package package_name
if [ $# -eq 1 ]; then
dpkg -s "$1" > /dev/null 2>&1 && {
echo "$1 is installed."
} || {
echo "$1 is not installed."
sudo apt-get install --assume-yes $1
}
fi
}
#PGM provide a reliable mutlicast data transport"
test_install_package libpgm-dev
test_install_package libpgm-5.1-0
PGM_FOUND=`dpkg-query -W -f='${Status}' libpgm-dev 2>/dev/null | grep -c "ok installed" `
if [ $PGM_FOUND = 1 ]; then
PGM=-D$EMULATION_DEV_ADDRESS
else
PGM=" "
fi
# check the compilation
echo "Bringup eNB interface"
sudo rmmod nasmesh
make all
sudo insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
#sudo route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
echo "Make sure that eth0 is the interface between the machines, otherwise change"
sudo ip route add 239.0.0.160/28 dev $EMULATION_DEV_INTERFACE
# when running as a suduoers, the following lines are not needed
#sudo ifconfig oai0 $OAI_LOCAL_ADDRESS netmask 255.255.255.0 broadcast 10.0.1.255
#echo "applying DRB classification"
#echo "$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s $OAI_LOCAL_ADDRESS -t $OAI_REMOTE_ADDRESS -r 1"
#$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s $OAI_LOCAL_ADDRESS -t $OAI_REMOTE_ADDRESS -r 1
if [ -z $1 ]; then
echo "$OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p2 -g$EMULATION_MULTICAST_GROUP -l$EMULATION_LOG_LEVEL $PGM > /dev/null"
sudo -E $OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p2 -g$EMULATION_MULTICAST_GROUP -l$EMULATION_LOG_LEVEL $PGM > /dev/null
else
if [ $1 = "all" ]; then
echo "$OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p2 -g$EMULATION_MULTICAST_GROUP -l$EMULATION_LOG_LEVEL $PGM"
sudo -E $OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p2 -g$EMULATION_MULTICAST_GROUP -l$EMULATION_LOG_LEVEL $PGM
else
echo "$OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p2 -g$EMULATION_MULTICAST_GROUP -l$EMULATION_LOG_LEVEL $PGM | grep -i $1"
sudo -E $OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p2 -g$EMULATION_MULTICAST_GROUP -l$EMULATION_LOG_LEVEL $PGM | grep -i $1
fi
fi
echo "End"
#!/bin/sh
sudo kill -9 `ps -ef | grep oaisim | awk '{print $2}'`
sudo pkill oaisim
# set params
EMULATION_DEV_INTERFACE="eth0"
EMULATION_MULTICAST_GROUP=1
EMULATION_LOG_LEVEL=7 # 3 = error, 5 info, 7 debug, trace= 9
#OAI_LOCAL_ADDRESS="10.0.1.2"
#OAI_REMOTE_ADDRESS="10.0.1.1"
#EMULATION_DEV_ADDRESS= `hostname -I cut -f1 -d' '`
EMULATION_DEV_ADDRESS=`LC_ALL=C ifconfig $EMULATION_DEV_INTERFACE | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
echo "Setting Emulation Interface to $EMULATION_DEV_INTERFACE ($EMULATION_DEV_ADDRESS)"
#funcs
test_install_package() {
# usage: test_install_package package_name
if [ $# -eq 1 ]; then
dpkg -s "$1" > /dev/null 2>&1 && {
echo "$1 is installed."
} || {
echo "$1 is not installed."
sudo apt-get install --assume-yes $1
}
fi
}
#PGM provide a reliable mutlicast data transport"
test_install_package libpgm-dev
test_install_package libpgm-5.1-0
PGM_FOUND=`dpkg-query -W -f='${Status}' libpgm-dev 2>/dev/null | grep -c "ok installed" `
if [ $PGM_FOUND = 1 ]; then
PGM=-D$EMULATION_DEV_ADDRESS
else
PGM=" "
fi
echo "Building"
sudo rmmod nasmesh
make nasmesh all
sudo insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
#sudo route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
echo "Make sure that eth0 is the interface between the machines, otherwise change"
sudo ip route add 239.0.0.160/28 dev $EMULATION_DEV_INTERFACE
# when running as a suduoers, the following lines are not needed
#sudo ifconfig oai0 $OAI_LOCAL_ADDRES netmask 255.255.255.0 broadcast 10.0.1.255
#$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s $OAI_LOCAL_ADDRESS -t $OAI_REMOTE_ADDRESS -r 1
# running oaisim
if [ -z $1 ]; then
echo "$OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p2 -g$EMULATION_MULTICAST_GROUP -l$EMULATION_LOG_LEVEL $PGM > /dev/null"
sudo -E $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p2 -g$EMULATION_MULTICAST_GROUP -l$EMULATION_LOG_LEVEL $PGM > /dev/null
else
if [ $1 = "all" ]; then
echo "$OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p2 -g$EMULATION_MULTICAST_GROUP -l$EMULATION_LOG_LEVEL $PGM "
sudo -E $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p2 -g$EMULATION_MULTICAST_GROUP -l$EMULATION_LOG_LEVEL $PGM
else
echo "$OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p2 -g$EMULATION_MULTICAST_GROUP -l$EMULATION_LOG_LEVEL $PGM | grep -i $1"
sudo -E $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p2 -g$EMULATION_MULTICAST_GROUP -l$EMULATION_LOG_LEVEL $PGM | grep -i $1
fi
fi
echo "End"
#!/usr/bin/python
import os, sys, warnings
import serial
def sendToTTY(lineP):
sys.stdout.write("\nSend:\n" + lineP+"\n")
g_ser.write(lineP)
g_ser.flush()
g_ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1)
buffer = ''
while True:
buffer += g_ser.read(1)
#sys.stdout.write("buffer is now:\n" + buffer+"\n")
buffer = buffer.lstrip('\r')
if '\r' in buffer:
at_received, buffer = buffer.split('\r')[-2:]
at_received = at_received.strip('\n')
at_received = at_received.strip('\r')
if at_received == '\n' or at_received == '' or at_received == '\r':
break
else:
sys.stdout.write("Receive stripped:\n" + at_received+"\n")
# Q0 = enable codes
# Q1 = disable codes
if at_received == 'ATE0Q0V1':
sendToTTY('\rOK\r')
# ATS0, Automatic Answer
# This S-parameter controls the automatic answering feature of the modem
# 0 automatic answering is disabled
# 1 - 255 enable automatic answering on the ring number specified
# here value received is 0
elif at_received.startswith('ATS0='):
sendToTTY('\rOK\r')
# AT+CMEEReport mobile equipment error
#0 Disable +CME ERROR result code. Use ERROR instead.
#1 Enable +CME ERROR result code and use numeric<err> values
#2 Enable +CME ERROR result code and use verbose<err> values
# here value received is 1
elif at_received.startswith('AT+CMEE='):
sendToTTY('\rOK\r')
# Network registration events
# AT+CREGNetwork registration (ver. 2)
# Description:
# Controls the presentation of an unsolicited result code +CREG : <stat>
# when <n>=1 and there is a change in the ME network registration status or
# code +CREG: <stat>[,<lac>,<ci>] when <n>=2 and there is a change of thenetwork cell.
# Read command returns the status of result code presentation and an integer <stat>,
# which shows whether the network has currently indicated the registration of the ME.
# Location information elements <lac> and <ci> are returned only when <n>=2 and ME
# is registered in the network.
# <n>:
# 0 Disable network registration unsolicited result code. Default value
# 1 Enable network registration unsolicited result code,+CREG: <stat>
# 2 Enable network registration and location information unsolicited result code, +CREG:<stat>[,<lac>,<ci>]
# <stat>:
# 0 not registered new operator to registered and not searching
# 1 registered, home network
# 2 not registered, currently searching a new operator to register with
# 3 registration denied
# 4 unknown
# 5 registered, roaming
elif at_received == 'AT+CREG=2':
sendToTTY('\rOK\r')
sendToTTY('+CREG: 1,00C3,01021A02 \r')
elif at_received == 'AT+CREG=1':
sendToTTY('\rOK\r')
sendToTTY('+CREG: 1\r')
elif at_received == 'AT+CREG?':
sendToTTY('+CREG: 1,00C3,01021A02\r\nOK\r')
# GPRS registration events
# +CGREGNetwork registration reporting
# Packet domain network registration status AT+CGPADDRShow PDP address
# Description:
# Controls the presentation of the unsolicited result code +CGREG: <stat>
# when <n>='1' and there is a change in the ME GPRS network registration status or
# +CGREG: <stat>[,<lac>,<ci>] when <n>='2' and there is achange of the network cell.
# ---
# Note: If the GPRS MT also supports circuit mode services,
# AT+CREG and the +CREG result code apply to the registration status and location
# information for those services. The read command returns the status of result
# code presentation and an integer <stat> which shows whether the network has
# currently indicated the registration of the ME.
# Location information elements <lac> and <ci> are returned only when <n>=2
# and ME is registered in the network.
elif at_received == 'AT+CGREG=1':
sendToTTY('\rOK\r')
sendToTTY('+CGREG: 1\r')
elif at_received == 'AT+CGREG?':
sendToTTY('+CGREG: 0,1\r\nOK\r')
# Call Waiting notifications
elif at_received == 'AT+CCWA=1':
sendToTTY('\rOK\r')
# Alternating voice/data off
elif at_received == 'AT+CMOD=0':
sendToTTY('\rOK\r')
# +CSSU unsolicited supp service notifications
elif at_received == 'AT+CSSN=0,1':
sendToTTY('\rOK\r')
# no connected at_received identification
elif at_received == 'AT+COLP=0':
sendToTTY('+COLP:0\r\nOK\r')
# HEX character set
# AT+CSCSSelect TE character set (ver. 3)
elif at_received == 'AT+CSCS=\"HEX\"':
sendToTTY('\rOK\r')
# USSD unsolicited
# AT+CUSD Unstructured supplementary service data (ver. 2)
# <n>
# 0 Disable result code presentation in the TA.Defaultvalue
# 1 Enable result code presentation in the TA
# 2 Terminate (abort) USSD dialogue. This value is not applicable to the read command response. Notsupported
elif at_received == 'AT+CUSD=1':
sendToTTY('\rOK\r')
# Enable +CGEV GPRS event notifications, but don't buffer
# AT+CGEREPPacket domain event reporting (ver. 1)
elif at_received == 'AT+CGEREP=1,0':
sendToTTY('\rOK\r')
# SMS PDU mode
# AT+CMGF Message format (ver. 1)
elif at_received == 'AT+CMGF=0':
sendToTTY('\rOK\r')
elif at_received == 'AT+CPIN?':
sendToTTY('\r+CPIN: READY\r\nOK\r')
#sendToTTY('\rOK\r')
# AT+CFUNSet phone functionality (ver. 2)
# 0 Minimum functionality, that is, the phone is turnedoff. Default value
# 1 Full functionality, that is, the phone is turned on
# 2 Disable phone transmit RF circuits only. Notsupported
# 3 Disable phone receive RF circuits only. Notsupported
# 4 Disable phone transmit and receive RF circuits.Note: This is often referred to as "flight mode"
# 5 GSM only (WCDMA radio off)
# 6 WCDMA only (GSM radio off)
elif at_received == 'AT+CFUN?':
sendToTTY('+CFUN: 1\r\nOK\r')
elif at_received == 'AT+CFUN=1':
sendToTTY('\rOK\r')
# AT+CLCCList current calls
# Description:
# Returns the list of current calls. If command succeeds but no calls areavailable, no information response is sent to TE
elif at_received == 'AT+CLCC':
sendToTTY('+CLCC: \r\nOK\r')
# AT+COPSOperator selection (ver. 2)
# AT+COPS=[<mode>[,<format>[,<oper>[,AcT]]]]
#
# <mode> Description
# 0 Automatic (<oper> field is ignored.) Default value
# 1 Manual (<oper> field will be present)
# 2 Deregister from network. Not supported
# 3 Set only <format> (for read command +COPS?), donot attempt registration/deregistration (<oper> field is ignored).
# This value is not applicable in readcommand response
# 4 Manual/automatic (<oper> field will be present). Ifmanual selection fails, automatic mode (<mode>=0)is entered
elif at_received == 'AT+COPS=3,0;+COPS?;+COPS=3,1;+COPS?;+COPS=3,2;+COPS?':
sendToTTY('+COPS: 0,0, \"Free - Mobile\"\r\n+COPS: 0,1, \"Free\"\r\n+COPS: 0,2, \"310170\"\r\nOK\r')
elif at_received == 'AT+COPS?':
#sendToTTY('+COPS: 0,0, \"Free - Mobile\"\r\n+COPS: 0,1, \"Free\"\r\n+COPS: 0,2, \"310170\"\r\nOK\r')
sendToTTY('+COPS: 0,0, \"Free - Mobile\"\r\nOK\r')
elif at_received == 'AT+COPS=0':
#sendToTTY('+COPS: 0,0, \"Free - Mobile\"\r\n+COPS: 0,1, \"Free\"\r\n+COPS: 0,2, \"310170\"\r\nOK\r')
sendToTTY('+COPS: 0,0, \"Free - Mobile\"\r\nOK\r')
# IMEI
elif at_received == 'AT+CGSN':
sendToTTY('+CGSN:534500314160207\r\nOK\r')
# Signal quality (ver.1)
# Returns received signal strength indication <rssi> and channel bit errorrate <ber> from the phone.
elif at_received == 'AT+CSQ':
#31,7
sendToTTY('+CSQ:8,7\r\nOK\r')
else:
sendToTTY('\rOK\r')
all: oaisim naslite_netlink_ether
oaisim:
(cd $(OPENAIR_TARGETS)/SIMU/USER && make oaisim OAI_NW_DRIVER_TYPE_ETHERNET=1 PDCP_USE_NETLINK=1)
naslite_netlink_ether:
(cd $(OPENAIR2_DIR) && make naslite_netlink_ether.ko)
(cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE/RB_TOOL/ && make)
remserial:
(cd $(OPENAIR3_DIR)/UTILS/REMSERIAL-1.4.UDP && make all)
(cp -upv $(OPENAIR3_DIR)/UTILS/REMSERIAL-1.4.UDP/remserial /usr/bin/remserial.udp)
one_eNB_one_UE: oaisim naslite_netlink_ether
userclean: clean oaisim naslite_netlink_ether
clean:
(cd $(OPENAIR_TARGETS)/SIMU/USER && make clean)
(cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE && make clean)
(cd $(OPENAIR2_DIR) && make clean)
#!/bin/sh
echo "Bringup eNB interface"
ip link set oai0 down
rmmod nasmesh
make naslite_netlink_ether oaisim
insmod $OPENAIR2_DIR/NAS/DRIVER/LITE/nasmesh.ko nas_IMEI=3,9,1,8,3,6,6,2,0,0,0,0,0,0
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
#route add -net 224.0.0.0 netmask 240.0.0.0 dev eth2
#ip addr add dev eth1 192.168.14.145/24 broadcast 192.168.14.255
ip link set oai0 broadcast ff:ff:ff:ff:ff:ff
#ip route add 192.168.14.0/24 dev eth2
ip route add 224.0.0.160/28 dev eth1
ip link set oai0 up
sleep 1
EXTIF="eth0"
INTIF="oai0"
IPTABLES=/sbin/iptables
#IPTABLES=/usr/local/sbin/iptables
DEPMOD=/sbin/depmod
MODPROBE=/sbin/modprobe
echo " External Interface: $EXTIF"
echo " Internal Interface: $INTIF"
echo "----------------------------------------------------------------------"
echo -en "ip_tables, "
$MODPROBE ip_tables
echo -en "ip_conntrack, "
$MODPROBE ip_conntrack
echo -en "ip_conntrack_irc, "
$MODPROBE ip_conntrack_irc
echo -en "iptable_nat, "
$MODPROBE iptable_nat
echo -e " Done loading modules.\n"
echo " Enabling forwarding.."
echo "1" > /proc/sys/net/ipv4/ip_forward
echo " Enabling DynamicAddr.."
echo "1" > /proc/sys/net/ipv4/ip_dynaddr
echo " Clearing any existing rules and setting default policy.."
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -t nat -F
$IPTABLES -t mangle -F
$IPTABLES -t filter -F
echo " FWD: Allow all connections OUT and only existing and related ones IN"
$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
#$IPTABLES -A FORWARD -j LOG
echo " Enabling SNAT (MASQUERADE) functionality on $EXTIF"
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
ifconfig oai0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255
sleep 1
#$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s 10.0.1.1 -t 10.0.1.2 -r 3
ip addr add dev oai0 2001:1::1/64
# -a -> Add RB
# -d -> Delete RB
# -cxx -> lcr (uid of a cx_entity)
# -ixx -> instance
# -zxx -> dscp
# -fxxx -> classref (uid of a classifier entry) if fn is used , fn is used for send classifier and n+1 for receive classifier
# -sxxx -> source ipv4 address
# -txxx -> destination ipv4 address
# -x -> source ipv6 address
# -y -> destination ipv6 address
# -r -> radio bearer id
echo "rb_tool -a -c0 -i0 -f0 -z0 -x 2001:1::1/128 -y 2001:1::2/128 -r 1"
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f0 -z0 -x 2001:1::1/128 -y 2001:1::2/128 -r 1
echo "rb_tool -a -c0 -i0 -f2 -z63 -s 10.0.1.1/32 -t 10.0.1.2/32 -r 1"
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f2 -z64 -s 10.0.1.1/32 -t 10.0.1.2/32 -r 1
echo "rb_tool -a -c0 -i0 -f2 -z63 -s 10.0.1.1/32 -t 10.0.1.2/32 -r 1"
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f4 -z64 -s 0.0.0.0/32 -t 0.0.0.0/32 -r 1
echo "to see eNB stats, please run : watch_enb script"
echo "$OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p2 -g3 -l3 > /dev/null"
nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p2 -g3 -l3 | grep RLC
echo "End"
#!/bin/bash
#
#------------------------------------------------
MAKE_IP_DRIVER_TARGET="naslite_netlink_ether"
MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim"
IP_DRIVER_NAME=oai_nw_drv
###########################################################
# CONFIGURE OPTIONS
EMULIF="eth1"
LTEIF="oai0"
EXTIF="eth0"
INTIF=$LTEIF
#----------------------------------------------------------
LTE_NETWORK_CIDR="10.0.1.0/24"
ENB_IPv4="10.0.1.1"
ENB_IPv6="2001:1::1"
ENB_IPv6_CIDR=$ENB_IPv6"/64"
ENB_IPv4_CIDR=$ENB_IPv4"/24"
ENB_IF_ID="3,9,1,8,3,6,6,2,0,0,0,0,0,0"
#----------------------------------------------------------
UE_IPv4="10.0.1.2"
UE_IPv6="2001:1::2"
UE_IPv6_CIDR=$UE_IPv6"/64"
UE_IPv4_CIDR=$UE_IPv4"/24"
#----------------------------------------------------------
# +-------+ +-------+
# | eNB | EMULIF | UE |
# | +---------------------+ |
# | | | |
# | | | |
# | | | |
# | | | |
# | | | |
# | | | |
# | | LTEIF | |
# | +.................... + |
# | |ENB_IPv4 UE_IPv4_CIDR| |
# +-------+ LTE link over +-------+
# UDP over ethernet
###########################################################
IPTABLES=/sbin/iptables
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
declare -x OPENAIR_DIR=""
declare -x OPENAIR1_DIR=""
declare -x OPENAIR2_DIR=""
declare -x OPENAIR3_DIR=""
declare -x OPENAIR_TARGETS=""
###########################################################
black='\E[30m'
red='\E[31m'
green='\E[32m'
yellow='\E[33m'
blue='\E[34m'
magenta='\E[35m'
cyan='\E[36m'
white='\E[37m'
ROOT_UID=0
E_NOTROOT=67
cecho() # Color-echo
# arg1 = message
# arg2 = color
{
local default_msg="No Message."
message=${1:-$default_msg}
color=${2:-$black}
echo -e "$color"
echo -n "$message"
tput sgr0
echo
return
}
echo_error() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
done
cecho "$my_string" $red
}
echo_warning() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
done
cecho "$my_string" $yellow
}
echo_success() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
done
cecho "$my_string" $green
}
set_openair() {
path=`pwd`
declare -i length_path
declare -i index
length_path=${#path}
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
#echo ${path%$token*}
if [[ $index -lt $length_path && index -gt 0 ]]
then
declare -x OPENAIR_DIR
index=`expr $index - 1`
openair_path=`echo $path | cut -c1-$index`
#openair_path=`echo ${path:0:$index}`
export OPENAIR_DIR=$openair_path
export OPENAIR1_DIR=$openair_path/openair1
export OPENAIR2_DIR=$openair_path/openair2
export OPENAIR3_DIR=$openair_path/openair3
export OPENAIR_TARGETS=$openair_path/targets
return 0
fi
return -1
}
bash_exec() {
output=$($1 2>&1)
result=$?
if [ $result -eq 0 ]
then
echo_success "$1"
else
echo_error "$1: $output"
fi
}
wait_process_started () {
if [ -z "$1" ]
then
echo_error "WAITING FOR PROCESS START: NO PROCESS"
return 1
fi
ps -C $1 > /dev/null 2>&1
while [ $? -ne 0 ]; do
echo_warning "WAITING FOR $1 START"
sleep 2
ps -C $1 > /dev/null 2>&1
done
echo_success "PROCESS $1 STARTED"
return 0
}
assert() {
# If condition false
# exit from script with error message
E_PARAM_ERR=98
E_PARAM_FAILED=99
if [ -z "$2" ] # Not enought parameters passed.
then
return $E_PARAM_ERR
fi
lineno=$2
if [ ! $1 ]
then
echo "Assertion failed: \"$1\""
echo "File \"$0\", line $lineno"
exit $E_ASSERT_FAILED
fi
}
#bash_exec "set_openair"
set_openair
cecho "OPENAIR_DIR = $OPENAIR_DIR" $green
cecho "OPENAIR1_DIR = $OPENAIR1_DIR" $green
cecho "OPENAIR2_DIR = $OPENAIR2_DIR" $green
cecho "OPENAIR3_DIR = $OPENAIR3_DIR" $green
cecho "OPENAIR_TARGETS = $OPENAIR_TARGETS" $green
echo "Bringup UE interface"
bash_exec "rmmod $IP_DRIVER_NAME"
cecho "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET....." $green
bash_exec "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET"
bash_exec "insmod $OPENAIR2_DIR/NAS/DRIVER/LITE/$IP_DRIVER_NAME.ko oai_nw_drv_IMEI=$ENB_IF_ID"
echo " Enabling proxy ARP.."
bash_exec "sysctl -w net.ipv4.conf.all.proxy_arp=1"
assert "`sysctl -n net.ipv4.conf.all.proxy_arp` -eq 1" $LINENO
echo " Enabling ipv4 forwarding.."
bash_exec "sysctl -w net.ipv4.ip_forward=1"
assert "`sysctl -n net.ipv4.ip_forward` -eq 1" $LINENO
bash_exec "sysctl -w net.ipv4.conf.all.forwarding=1"
assert "`sysctl -n net.ipv4.conf.all.forwarding` -eq 1" $LINENO
echo " Enabling ipv6 forwarding.."
bash_exec "sysctl -w net.ipv6.conf.all.forwarding=1"
assert "`sysctl -n net.ipv6.conf.all.forwarding` -eq 1" $LINENO
echo " Enabling DynamicAddr.."
bash_exec "sysctl -w net.ipv4.ip_dynaddr=1"
assert " `sysctl -n net.ipv4.ip_dynaddr` -eq 1" $LINENO
bash_exec "ip route flush cache"
bash_exec "ip route add 239.0.0.160/28 dev $EMULIF"
bash_exec "ip link set $LTEIF broadcast ff:ff:ff:ff:ff:ff"
bash_exec "ip link set $LTEIF up"
sleep 1
assert " -x $IPTABLES " $LINENO
bash_exec "$IPTABLES -P INPUT ACCEPT"
bash_exec "$IPTABLES -F INPUT"
bash_exec "$IPTABLES -P OUTPUT ACCEPT"
bash_exec "$IPTABLES -F OUTPUT"
bash_exec "$IPTABLES -P FORWARD DROP"
bash_exec "$IPTABLES -F FORWARD"
bash_exec "$IPTABLES -t nat -F"
bash_exec "$IPTABLES -t mangle -F"
bash_exec "$IPTABLES -t filter -F"
echo " External Interface: $EXTIF"
echo " Internal Interface: $INTIF"
bash_exec "modprobe ip_tables"
bash_exec "modprobe ip_conntrack"
bash_exec "modprobe ip_conntrack_ftp"
bash_exec "modprobe nf_conntrack_h323"
bash_exec "modprobe nf_conntrack_irc"
bash_exec "modprobe nf_conntrack_pptp"
bash_exec "modprobe nf_conntrack_proto_gre"
bash_exec "modprobe nf_conntrack_proto_sctp"
bash_exec "modprobe nf_conntrack_tftp"
bash_exec "modprobe nf_conntrack_sip"
bash_exec "modprobe iptable_nat"
bash_exec "modprobe x_tables"
bash_exec "sysctl -w net.ipv4.conf.all.log_martians=1"
assert " `sysctl -n net.ipv4.conf.all.log_martians` -eq 1" $LINENO
bash_exec "sysctl -w net.ipv4.conf.$LTEIF.log_martians=1"
assert " `sysctl -n net.ipv4.conf.$LTEIF.log_martians` -eq 1" $LINENO
bash_exec "sysctl -w net.ipv4.conf.$EXTIF.log_martians=1"
assert " `sysctl -n net.ipv4.conf.$EXTIF.log_martians` -eq 1" $LINENO
bash_exec "sysctl -w net.ipv4.conf.$INTIF.log_martians=1"
assert " `sysctl -n net.ipv4.conf.$INTIF.log_martians` -eq 1" $LINENO
echo " Disabling reverse path filtering"
bash_exec "sysctl -w net.ipv4.conf.all.rp_filter=0"
assert " `sysctl -n net.ipv4.conf.all.rp_filter` -eq 0" $LINENO
bash_exec "sysctl -w net.ipv4.conf.$LTEIF.rp_filter=0"
assert " `sysctl -n net.ipv4.conf.$LTEIF.rp_filter` -eq 0" $LINENO
bash_exec "sysctl -w net.ipv4.conf.$EXTIF.rp_filter=0"
assert " `sysctl -n net.ipv4.conf.$EXTIF.rp_filter` -eq 0" $LINENO
bash_exec "sysctl -w net.ipv4.conf.$INTIF.rp_filter=0"
assert " `sysctl -n net.ipv4.conf.$INTIF.rp_filter` -eq 0" $LINENO
bash_exec "$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT"
bash_exec "$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT"
bash_exec "$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE"
bash_exec "ip route flush cache"
bash_exec "ip addr add dev $LTEIF $ENB_IPv4_CIDR"
sleep 1
bash_exec "ip addr add dev $LTEIF $ENB_IPv6_CIDR"
sleep 1
# -a -> Add RB
# -d -> Delete RB
# -cxx -> lcr
# -ixx -> instance
# -zxx -> dscp
# -fxxx -> classref (uid of a classifier entry) if fn is used , fn is used for send classifier and n+1 for receive classifier
# -sxxx -> source ipv4 address
# -txxx -> destination ipv4 address
# -x -> source ipv6 address
# -y -> destination ipv6 address
# -r -> radio bearer id
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f0 -i0 -z0 -x $ENB_IPv6 -y $UE_IPv6 -r 1"
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f2 -i0 -z64 -s $ENB_IPv4/32 -t $UE_IPv4/32 -r 1"
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f4 -i0 -z64 -s 0.0.0.0/32 -t 0.0.0.0/32 -r 1"
sleep 1
echo "#####################################################################"
echo "iptables -t nat -nvL"
echo "---------------------------------------------------------------------"
iptables -t nat -nvL
echo "#####################################################################"
echo "ip route show table main"
echo "---------------------------------------------------------------------"
ip route show table main
echo "$OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p2 -g3 -l3 > /dev/null"
nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p2 -g3 -l3 > /dev/null
#!/bin/bash
#
#------------------------------------------------
MAKE_IP_DRIVER_TARGET="naslite_netlink_ether"
MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim"
IP_DRIVER_NAME=oai_nw_drv
###########################################################
# CONFIGURE OPTIONS
EMULIF="eth0"
LTEIF="oai0"
#----------------------------------------------------------
LTE_NETWORK_CIDR="10.0.1.0/24"
ENB_IPv4="10.0.1.1"
ENB_IPv6="2001:1::1"
#----------------------------------------------------------
UE_IPv4="10.0.1.2"
UE_IPv6="2001:1::2"
UE_IPv6_CIDR=$UE_IPv6"/64"
UE_IPv4_CIDR=$UE_IPv4"/24"
UE_IMEI="3,9,1,8,3,6,7,3,0,0,0,0,0,0"
#----------------------------------------------------------
# +-------+ +-------+
# | eNB | EMULIF | UE |
# | +---------------------+ +
# | | | |
# | | | |
# | | | |
# | | | |
# | | | +
# | | | |
# | | LTEIF | |
# | +.................... + |
# | |ENB_IPv4 UE_IPv4_CIDR| |
# +-------+ LTE link over +-------+
###########################################################
IPTABLES=/sbin/iptables
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
declare -x OPENAIR_DIR=""
declare -x OPENAIR1_DIR=""
declare -x OPENAIR2_DIR=""
declare -x OPENAIR3_DIR=""
declare -x OPENAIR_TARGETS=""
###########################################################
black='\E[30m'
red='\E[31m'
green='\E[32m'
yellow='\E[33m'
blue='\E[34m'
magenta='\E[35m'
cyan='\E[36m'
white='\E[37m'
ROOT_UID=0
E_NOTROOT=67
cecho() # Color-echo
# arg1 = message
# arg2 = color
{
local default_msg="No Message."
message=${1:-$default_msg}
color=${2:-$black}
echo -e "$color"
echo -n "$message"
tput sgr0
echo
return
}
echo_error() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
done
cecho "$my_string" $red
}
echo_warning() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
done
cecho "$my_string" $yellow
}
echo_success() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
done
cecho "$my_string" $green
}
set_openair() {
path=`pwd`
declare -i length_path
declare -i index
length_path=${#path}
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
#echo ${path%$token*}
if [[ $index -lt $length_path && index -gt 0 ]]
then
declare -x OPENAIR_DIR
index=`expr $index - 1`
openair_path=`echo $path | cut -c1-$index`
#openair_path=`echo ${path:0:$index}`
export OPENAIR_DIR=$openair_path
export OPENAIR1_DIR=$openair_path/openair1
export OPENAIR2_DIR=$openair_path/openair2
export OPENAIR3_DIR=$openair_path/openair3
export OPENAIR_TARGETS=$openair_path/targets
return 0
fi
return -1
}
bash_exec() {
output=$($1 2>&1)
result=$?
if [ $result -eq 0 ]
then
echo_success "$1"
else
echo_error "$1: $output"
fi
}
wait_process_started () {
if [ -z "$1" ]
then
echo_error "WAITING FOR PROCESS START: NO PROCESS"
return 1
fi
ps -C $1 > /dev/null 2>&1
while [ $? -ne 0 ]; do
echo_warning "WAITING FOR $1 START"
sleep 2
ps -C $1 > /dev/null 2>&1
done
echo_success "PROCESS $1 STARTED"
return 0
}
assert() {
# If condition false
# exit from script with error message
E_PARAM_ERR=98
E_PARAM_FAILED=99
if [ -z "$2" ] # Not enought parameters passed.
then
return $E_PARAM_ERR
fi
lineno=$2
if [ ! $1 ]
then
echo "Assertion failed: \"$1\""
echo "File \"$0\", line $lineno"
exit $E_ASSERT_FAILED
fi
}
ctrl_c() {
bash_exec "pkill oaisim"
bash_exec "ip link set $LTEIF down"
bash_exec "rmmod $IP_DRIVER_NAME"
bash_exec "$IPTABLES -P INPUT ACCEPT"
bash_exec "$IPTABLES -F INPUT"
bash_exec "$IPTABLES -P OUTPUT ACCEPT"
bash_exec "$IPTABLES -F OUTPUT"
bash_exec "$IPTABLES -P FORWARD ACCEPT"
bash_exec "$IPTABLES -F FORWARD"
bash_exec "$IPTABLES -t nat -F"
bash_exec "$IPTABLES -t mangle -F"
bash_exec "$IPTABLES -t filter -F"
bash_exec "ip route flush cache"
}
#bash_exec "set_openair"
set_openair
cecho "OPENAIR_DIR = $OPENAIR_DIR" $green
cecho "OPENAIR1_DIR = $OPENAIR1_DIR" $green
cecho "OPENAIR2_DIR = $OPENAIR2_DIR" $green
cecho "OPENAIR3_DIR = $OPENAIR3_DIR" $green
cecho "OPENAIR_TARGETS = $OPENAIR_TARGETS" $green
echo "Bringup UE interface"
bash_exec "rmmod $IP_DRIVER_NAME"
cecho "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET ....." $green
bash_exec "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET "
bash_exec "insmod $OPENAIR2_DIR/NAS/DRIVER/LITE/$IP_DRIVER_NAME.ko oai_nw_drv_IMEI=$UE_IMEI"
bash_exec "ip route flush cache"
bash_exec "ip route add 239.0.0.160/28 dev $EMULIF"
bash_exec "ip link set $LTEIF broadcast ff:ff:ff:ff:ff:ff"
bash_exec "ip link set $LTEIF up"
sleep 1
bash_exec "ip addr add dev $LTEIF $UE_IPv4_CIDR"
bash_exec "ip addr add dev $LTEIF $UE_IPv6_CIDR"
# -a -> Add RB
# -d -> Delete RB
# -cxx -> lcr
# -ixx -> instance
# -zxx -> dscp
# -fxxx -> classref (uid of a classifier entry) if fn is used , fn is used for send classifier and n+1 for receive classifier
# -sxxx -> source ipv4 address
# -txxx -> destination ipv4 address
# -x -> source ipv6 address
# -y -> destination ipv6 address
# -r -> radio bearer id
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f0 -i0 -z0 -x $UE_IPv6 -y $ENB_IPv6 -r 1"
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f2 -i0 -z64 -s $UE_IPv4/32 -t $ENB_IPv4/32 -r 1"
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f4 -i0 -z64 -s 0.0.0.0/32 -t 0.0.0.0/32 -r 1"
sleep 1
bash_exec "sysctl -w net.ipv4.conf.all.log_martians=1"
assert " `sysctl -n net.ipv4.conf.all.log_martians` -eq 1" $LINENO
echo " Disabling reverse path filtering"
bash_exec "sysctl -w net.ipv4.conf.all.rp_filter=0"
assert " `sysctl -n net.ipv4.conf.all.rp_filter` -eq 0" $LINENO
bash_exec "ip route flush cache"
echo "#####################################################################"
echo "ip route show table main"
echo "---------------------------------------------------------------------"
ip route show table main
trap ctrl_c INT
echo "to see UE stats, please run : watch_ue script"
echo "$OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p2 -g3 -l3 > /dev/null"
nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p2 -g3 -l3 > /dev/null
#gdb $OPENAIR_TARGETS/SIMU/USER/oaisim
echo "End"
ctrl_c
#!/bin/bash
#
#------------------------------------------------
MAKE_IP_DRIVER_TARGET="naslite_netlink_ether"
MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim"
MAKE_REMSERIAL_TARGET="remserial"
IP_DRIVER_NAME=oai_nw_drv
###########################################################
# CONFIGURE OPTIONS
EMULIF="eth0"
LTEIF="oai0"
INTIF="ppp0"
EXTIF=$LTEIF
#----------------------------------------------------------
LTE_NETWORK_CIDR="10.0.1.0/24"
ENB_IPv4="10.0.1.1"
ENB_IPv6="2001:1::1"
#----------------------------------------------------------
UE_IPv4="10.0.1.2"
UE_IPv6="2001:1::2"
UE_IPv6_CIDR=$UE_IPv6"/64"
UE_IPv4_CIDR=$UE_IPv4"/24"
UE_IMEI="3,9,1,8,3,6,7,3,0,0,0,0,0,0"
#----------------------------------------------------------
USE_PPP="yes"
PPP_OPTIONS="proxyarp passive nodetach ipcp-accept-remote"
PPP_DEVICE="ttyPPP_DROID"
PPP_SPEED="460800"
UE_PPP_IPv4="192.168.15.1"
TERMINAL_PPP_IPv4="192.168.15.175"
REMSERIAL_UDP_PORT="23001"
#----------------------------------------------------------
# +-------+ +-------+ +-------+
# | eNB | EMULIF | UE |INTIF |ANDROID|
# | +---------------------+ +---------------------+ TERMIN|
# | | | | ppp link over | AL |
# | | | | UDP over ethernet | |
# | | | | (remserial) | |
# | | | | | |
# | | | +---serial link-------+ |
# | | | | for AT commands | |
# | | LTEIF | | | |
# | +.................... + | | |
# | |ENB_IPv4 UE_IPv4_CIDR| | | |
# +-------+ LTE link over +-------+ +-------+
###########################################################
IPTABLES=/sbin/iptables
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
declare -x OPENAIR_DIR=""
declare -x OPENAIR1_DIR=""
declare -x OPENAIR2_DIR=""
declare -x OPENAIR3_DIR=""
declare -x OPENAIR_TARGETS=""
###########################################################
black='\E[30m'
red='\E[31m'
green='\E[32m'
yellow='\E[33m'
blue='\E[34m'
magenta='\E[35m'
cyan='\E[36m'
white='\E[37m'
ROOT_UID=0
E_NOTROOT=67
cecho() # Color-echo
# arg1 = message
# arg2 = color
{
local default_msg="No Message."
message=${1:-$default_msg}
color=${2:-$black}
echo -e "$color"
echo -n "$message"
tput sgr0
echo
return
}
echo_error() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
done
cecho "$my_string" $red
}
echo_warning() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
done
cecho "$my_string" $yellow
}
echo_success() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
done
cecho "$my_string" $green
}
set_openair() {
path=`pwd`
declare -i length_path
declare -i index
length_path=${#path}
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
#echo ${path%$token*}
if [[ $index -lt $length_path && index -gt 0 ]]
then
declare -x OPENAIR_DIR
index=`expr $index - 1`
openair_path=`echo $path | cut -c1-$index`
#openair_path=`echo ${path:0:$index}`
export OPENAIR_DIR=$openair_path
export OPENAIR1_DIR=$openair_path/openair1
export OPENAIR2_DIR=$openair_path/openair2
export OPENAIR3_DIR=$openair_path/openair3
export OPENAIR_TARGETS=$openair_path/targets
return 0
fi
return -1
}
bash_exec() {
output=$($1 2>&1)
result=$?
if [ $result -eq 0 ]
then
echo_success "$1"
else
echo_error "$1: $output"
fi
}
wait_process_started () {
if [ -z "$1" ]
then
echo_error "WAITING FOR PROCESS START: NO PROCESS"
return 1
fi
ps -C $1 > /dev/null 2>&1
while [ $? -ne 0 ]; do
echo_warning "WAITING FOR $1 START"
sleep 2
ps -C $1 > /dev/null 2>&1
done
echo_success "PROCESS $1 STARTED"
return 0
}
assert() {
# If condition false
# exit from script with error message
E_PARAM_ERR=98
E_PARAM_FAILED=99
if [ -z "$2" ] # Not enought parameters passed.
then
return $E_PARAM_ERR
fi
lineno=$2
if [ ! $1 ]
then
echo "Assertion failed: \"$1\""
echo "File \"$0\", line $lineno"
exit $E_ASSERT_FAILED
fi
}
ctrl_c() {
bash_exec "pkill oaisim"
if [ "$USE_PPP"x = yesx ]; then
bash_exec "pkill remserial.bash"
bash_exec "pkill ppp_android.bash"
fi
bash_exec "pkill AT_serial_bouchon.py"
bash_exec "ip link set $LTEIF down"
bash_exec "ip route del default via $ENB_IPv4 dev $EXTIF table int2lte"
bash_exec "ip route flush table int2lte"
bash_exec "ip rule del prio 1000"
bash_exec "rmmod $IP_DRIVER_NAME"
bash_exec "$IPTABLES -P INPUT ACCEPT"
bash_exec "$IPTABLES -F INPUT"
bash_exec "$IPTABLES -P OUTPUT ACCEPT"
bash_exec "$IPTABLES -F OUTPUT"
bash_exec "$IPTABLES -P FORWARD ACCEPT"
bash_exec "$IPTABLES -F FORWARD"
bash_exec "$IPTABLES -t nat -F"
bash_exec "$IPTABLES -t mangle -F"
bash_exec "$IPTABLES -t filter -F"
bash_exec "ip route flush cache"
}
#bash_exec "set_openair"
set_openair
cecho "OPENAIR_DIR = $OPENAIR_DIR" $green
cecho "OPENAIR1_DIR = $OPENAIR1_DIR" $green
cecho "OPENAIR2_DIR = $OPENAIR2_DIR" $green
cecho "OPENAIR3_DIR = $OPENAIR3_DIR" $green
cecho "OPENAIR_TARGETS = $OPENAIR_TARGETS" $green
echo "Bringup UE interface"
bash_exec "rmmod $IP_DRIVER_NAME"
cecho "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET $MAKE_REMSERIAL_TARGET....." $green
bash_exec "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET $MAKE_REMSERIAL_TARGET"
bash_exec "insmod $OPENAIR2_DIR/NAS/DRIVER/LITE/$IP_DRIVER_NAME.ko oai_nw_drv_IMEI=$UE_IMEI"
echo " Enabling ipv4 forwarding.."
bash_exec "sysctl -w net.ipv4.ip_forward=1"
assert "`sysctl -n net.ipv4.ip_forward` -eq 1" $LINENO
bash_exec "sysctl -w net.ipv4.conf.all.forwarding=1"
assert "`sysctl -n net.ipv4.conf.all.forwarding` -eq 1" $LINENO
echo " Enabling ipv6 forwarding.."
bash_exec "sysctl -w net.ipv6.conf.all.forwarding=1"
assert "`sysctl -n net.ipv6.conf.all.forwarding` -eq 1" $LINENO
if [ "$USE_PPP"x = yesx ]; then
echo " PPP enabled.."
command -v pppd > /dev/null 2>&1 || { echo_error "pppd executable needed - please install it"; exit 1;}
command -v remserial.udp > /dev/null 2>&1 || { echo_error "remserial.udp executable needed - please install it"; exit 1;}
#generate pppd script
rm -f /tmp/ppp_android.bash
bash_exec "touch /tmp/ppp_android.bash"
if [ ! -f /tmp/ppp_android.bash ]; then
echo_error "Cannot generate /tmp/ppp_android.bash file, exiting"
exit 1
fi
echo "#!/bin/bash" >> /tmp/ppp_android.bash
echo "pppd $PPP_OPTIONS $UE_PPP_IPv4:$TERMINAL_PPP_IPv4 /dev/$PPP_DEVICE $PPP_SPEED" >> /tmp/ppp_android.bash
bash_exec "chmod 777 /tmp/ppp_android.bash"
assert " -x /tmp/ppp_android.bash " $LINENO
#generate remserial script
rm -f /tmp/remserial.bash
bash_exec "touch /tmp/remserial.bash"
if [ ! -f /tmp/remserial.bash ]; then
echo_error "Cannot generate /tmp/remserial.bash file, exiting"
exit 1
fi
echo "#!/bin/bash" >> /tmp/remserial.bash
echo "remserial.udp -s \"$PPP_SPEED raw\" -p $REMSERIAL_UDP_PORT -l /dev/$PPP_DEVICE /dev/ptmx" >> /tmp/remserial.bash
bash_exec "chmod 777 /tmp/remserial.bash"
assert " -x /tmp/remserial.bash " $LINENO
fi
xterm -e $THIS_SCRIPT_PATH/AT_serial_bouchon.py &
wait_process_started AT_serial_bouchon.py
if [ "$USE_PPP"x = yesx ]; then
xterm -e /tmp/remserial.bash &
wait_process_started remserial.bash
xterm -e /tmp/ppp_android.bash &
wait_process_started ppp_android.bash
fi
assert " -x $IPTABLES " $LINENO
bash_exec "ip route del default via $ENB_IPv4 dev $EXTIF table int2lte"
bash_exec "ip route flush table int2lte"
bash_exec "ip rule del prio 1000"
bash_exec "$IPTABLES -P INPUT ACCEPT"
bash_exec "$IPTABLES -F INPUT"
bash_exec "$IPTABLES -P OUTPUT ACCEPT"
bash_exec "$IPTABLES -F OUTPUT"
bash_exec "$IPTABLES -P FORWARD DROP"
bash_exec "$IPTABLES -F FORWARD"
bash_exec "$IPTABLES -t nat -F"
bash_exec "$IPTABLES -t mangle -F"
bash_exec "$IPTABLES -t filter -F"
bash_exec "ip route flush cache"
bash_exec "ip route add 239.0.0.160/28 dev $EMULIF"
bash_exec "ip link set $LTEIF broadcast ff:ff:ff:ff:ff:ff"
bash_exec "ip link set $LTEIF up"
sleep 1
bash_exec "ip addr add dev $LTEIF $UE_IPv4_CIDR"
bash_exec "ip addr add dev $LTEIF $UE_IPv6_CIDR"
echo " Enabling proxy ARP.."
bash_exec "sysctl -w net.ipv4.conf.all.proxy_arp=1"
assert "`sysctl -n net.ipv4.conf.all.proxy_arp` -eq 1" $LINENO
# -a -> Add RB
# -d -> Delete RB
# -cxx -> lcr
# -ixx -> instance
# -zxx -> dscp
# -fxxx -> classref (uid of a classifier entry) if fn is used , fn is used for send classifier and n+1 for receive classifier
# -sxxx -> source ipv4 address
# -txxx -> destination ipv4 address
# -x -> source ipv6 address
# -y -> destination ipv6 address
# -r -> radio bearer id
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f0 -i0 -z0 -x $UE_IPv6 -y $ENB_IPv6 -r 3"
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f2 -i0 -z64 -s $UE_IPv4/32 -t $ENB_IPv4/32 -r 3"
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f4 -i0 -z64 -s 0.0.0.0/32 -t 0.0.0.0/32 -r 3"
sleep 1
echo " External Interface: $EXTIF"
echo " Internal Interface: $INTIF"
bash_exec "modprobe ip_tables"
bash_exec "modprobe ip_conntrack"
bash_exec "modprobe ip_conntrack_ftp"
bash_exec "modprobe nf_conntrack_h323"
bash_exec "modprobe nf_conntrack_irc"
bash_exec "modprobe nf_conntrack_pptp"
bash_exec "modprobe nf_conntrack_proto_gre"
bash_exec "modprobe nf_conntrack_proto_sctp"
bash_exec "modprobe nf_conntrack_tftp"
bash_exec "modprobe nf_conntrack_sip"
bash_exec "modprobe iptable_nat"
bash_exec "modprobe x_tables"
echo " Enabling DynamicAddr.."
bash_exec "sysctl -w net.ipv4.ip_dynaddr=1"
assert " `sysctl -n net.ipv4.ip_dynaddr` -eq 1" $LINENO
bash_exec "sysctl -w net.ipv4.conf.all.log_martians=1"
assert " `sysctl -n net.ipv4.conf.all.log_martians` -eq 1" $LINENO
bash_exec "sysctl -w net.ipv4.conf.$LTEIF.log_martians=1"
assert " `sysctl -n net.ipv4.conf.$LTEIF.log_martians` -eq 1" $LINENO
bash_exec "sysctl -w net.ipv4.conf.$EMULIF.log_martians=1"
assert " `sysctl -n net.ipv4.conf.$EMULIF.log_martians` -eq 1" $LINENO
if [ ! "$USE_PPP"x = yesx ]; then
bash_exec "sysctl -w net.ipv4.conf.$INTIF.log_martians=1"
assert " `sysctl -n net.ipv4.conf.$INTIF.log_martians` -eq 1" $LINENO
fi
echo " Disabling reverse path filtering"
bash_exec "sysctl -w net.ipv4.conf.all.rp_filter=0"
assert " `sysctl -n net.ipv4.conf.all.rp_filter` -eq 0" $LINENO
bash_exec "sysctl -w net.ipv4.conf.$LTEIF.rp_filter=0"
assert " `sysctl -n net.ipv4.conf.$LTEIF.rp_filter` -eq 0" $LINENO
bash_exec "sysctl -w net.ipv4.conf.$EMULIF.rp_filter=0"
assert " `sysctl -n net.ipv4.conf.$EMULIF.rp_filter` -eq 0" $LINENO
if [ ! "$USE_PPP"x = yesx ]; then
bash_exec "sysctl -w net.ipv4.conf.$INTIF.rp_filter=0"
assert " `sysctl -n net.ipv4.conf.$INTIF.rp_filter` -eq 0" $LINENO
fi
bash_exec "$IPTABLES -t mangle -A PREROUTING -i $INTIF -j MARK --set-mark 22"
bash_exec "$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT"
bash_exec "$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT"
bash_exec "$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE"
bash_exec "ip route add 127.0.0.0/8 dev lo table int2lte"
bash_exec "ip route add $LTE_NETWORK_CIDR dev $EXTIF table int2lte scope link"
bash_exec "ip route add default via $ENB_IPv4 dev $EXTIF table int2lte scope global"
bash_exec "ip route flush cache"
bash_exec "ip rule add fwmark 22 lookup int2lte prio 1000"
echo "#####################################################################"
echo "iptables -t nat -nvL"
echo "---------------------------------------------------------------------"
iptables -t nat -nvL
echo "#####################################################################"
echo "iptables -t mangle -nvL"
echo "---------------------------------------------------------------------"
iptables -t mangle -nvL
echo "#####################################################################"
echo "iptables -t filter -nvL"
echo "---------------------------------------------------------------------"
iptables -t filter -nvL
echo "#####################################################################"
echo "ip rule show"
echo "---------------------------------------------------------------------"
ip rule show
echo "#####################################################################"
echo "ip route show table int2lte"
echo "---------------------------------------------------------------------"
ip route show table int2lte
echo "#####################################################################"
echo "ip route show table main"
echo "---------------------------------------------------------------------"
ip route show table main
trap ctrl_c INT
echo "to see UE stats, please run : watch_ue script"
echo "$OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p2 -g3 -l3 > /dev/null"
nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p2 -g3 -l3 > /dev/null
#gdb $OPENAIR_TARGETS/SIMU/USER/oaisim
echo "End"
ctrl_c
all: oaisim nasmesh
userclean: clean oaisim nasmesh
oaisim:
(cd $(OPENAIR_TARGETS)/SIMU/USER && make LINK_ENB_PDCP_TO_IP_DRIVER=1 -j2)
nasmesh:
(cd $(OPENAIR2_DIR) && make nasmesh_netlink.ko)
(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL/ && make)
clean:
(cd $(OPENAIR_TARGETS)/SIMU/USER && make clean)
#!/bin/sh
echo "Bringup eNB interface"
sudo rmmod nasmesh
make all
sudo insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
#sudo route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
sudo ip route add 239.0.0.160/28 dev eth0
sudo ifconfig oai0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s 10.0.1.1 -t 10.0.1.2 -r 1
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c1 -i0 -z0 -s 10.0.1.1 -t 10.0.1.3 -r 12
#xterm -T ENB -hold -e ping 10.0.1.2&
#xterm -T ENB -hold -e ping 10.0.1.3&
if [ -z $1 ]; then
echo "nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p3 -g3 -l3 > /dev/null"
nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p3 -g3 -l3 > /dev/null
else
if [ $1 = "all" ]; then
echo "nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p3 -g3 -l7"
nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p3 -g3 -l7
else
echo "nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p3 -g3 -l7 | grep -i $1"
nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p3 -g3 -l7 | grep -i $1
fi
fi
echo "End"
#!/bin/sh
echo "Bringup UE interface"
sudo rmmod nasmesh
make all
sudo insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
#sudo route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
sudo ip route add 239.0.0.160/28 dev eth0
sudo ifconfig oai0 10.0.1.2 netmask 255.255.255.0 broadcast 10.0.1.255
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s 10.0.1.2 -t 10.0.1.1 -r 1
#xterm -T UE1 -hold -e ping 10.0.1.1&
if [ -z $1 ]; then
echo "nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p3 -g3 -l3 > /dev/null"
nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p3 -g3 -l3 > /dev/null
else
if [ $1 = "all" ]; then
echo "nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p3 -g3 -l7"
nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p3 -g3 -l7
else
echo "nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p3 -g3 -l7 | grep -i $1"
nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p3 -g3 -l7 | grep -i $1
fi
fi
echo "End"
#!/bin/sh
echo "Bringup UE interface"
sudo rmmod nasmesh
make all
sudo insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
#sudo route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
sudo ip route add 239.0.0.160/28 dev eth0
sudo ifconfig oai0 10.0.1.3 netmask 255.255.255.0 broadcast 10.0.1.255
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s 10.0.1.3 -t 10.0.1.1 -r 1
#xterm -T UE2 -hold -e ping 10.0.1.1&
if [ -z $1 ]; then
echo "nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M2 -p3 -g3 -l3 > /dev/null"
nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M2 -p3 -g3 -l3 > /dev/null
else
if [ $1 = "all" ]; then
echo "nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M2 -p3 -g3 -l7"
nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M2 -p3 -g3 -l7
else
echo "nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M2 -p3 -g3 -l7 | grep -i $1"
nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M2 -p3 -g3 -l7 | grep -i $1
fi
fi
echo "End"
This is the folder used by the OCG(openair config generation) to parse a xml-based scenario defined by the user in the WEBXML directory, and produce emulation results in the RESULTS directory.
Please make sure that you have correctly set the OPENAIR_TARGETS variables.
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE> <!-- OPTIONS: urban, rural, indoor -->
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2.0</PATHLOSS_EXPONENT> <!-- OPTIONS: >1 -->
<PATHLOSS_0_dB>-50</PATHLOSS_0_dB>
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>Rayleigh1</SMALL_SCALE> <!-- OPTIONS: SCM_A, SCM_B, SCM_C, SCM_D, EPA, EVA, ETU, Rayleigh8, Rayleigh1, Rayleigh1_corr, Rayleigh1_anticorr, Rice8, Rice1, Rice1_corr, Rice1_anticorr, AWGN -->
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>5</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>3</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>16</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>40</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>1</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>5</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_km>1</X_km>
<Y_km>1</Y_km>
</AREA>
<NETWORK_TYPE>homogeneous</NETWORK_TYPE> <!-- OPTIONS: homogeneous, heterogeneous -->
<CELL_TYPE>macrocell</CELL_TYPE> <!-- OPTIONS: macrocell, microcell, picocell, femtocell -->
<RELAY></RELAY>
<MOBILITY>
<UE_MOBILITY>
<UE_INITIAL_DISTRIBUTION>random</UE_INITIAL_DISTRIBUTION> <!-- OPTIONS: random, concentrated, grid -->
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>fixed</UE_MOBILITY_TYPE> <!-- OPTIONS: fixed, random_waypoint, random_walk, grid_walk, trace, sumo -->
<UE_MOVING_DYNAMICS>
<MIN_SPEED_mps>1</MIN_SPEED_mps>
<MAX_SPEED_mps>200</MAX_SPEED_mps>
<MIN_SLEEP_ms>0.1</MIN_SLEEP_ms>
<MAX_SLEEP_ms>5.0</MAX_SLEEP_ms>
<MIN_JOURNEY_TIME_ms>0.1</MIN_JOURNEY_TIME_ms>
<MAX_JOURNEY_TIME_ms>10</MAX_JOURNEY_TIME_ms>
</UE_MOVING_DYNAMICS>
<SUMO_CONFIG> <!-- Simulation for Urban Mobility -->
<SUMO_CMD> sumo-gui </SUMO_CMD>
<SUMO_CONFIG_FILE>$OPENAIR2_DIR/UTIL/OMG/SUMO/SCENARIOS/scen.sumo.cfg</SUMO_CONFIG_FILE>
<SUMO_START> 0 </SUMO_START>
<SUMO_END> 10 </SUMO_END>
<SUMO_STEP> 10</SUMO_STEP>
<SUMO_HOST_IP> 127.0.1.1</SUMO_HOST_IP>
<SUMO_HOST_PORT> 8883</SUMO_HOST_PORT>
</SUMO_CONFIG>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION> <!-- OPTIONS: random, hexagonal, grid -->
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>fixed</eNB_MOBILITY_TYPE> <!-- OPTIONS: fixed, mobile -->
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>gaming_OA</APPLICATION_TYPE> <!-- OPTIONS: scbr, mcbr, bcbr, m2m_AP, m2m_BR, gaming_OA, gaming_TF, full_buffer -->
<DESTINATION_ID>1</DESTINATION_ID>
<FLOW_START_ms>400</FLOW_START_ms> <!-- not less than 310 -->
<FLOW_DURATION_ms>2000</FLOW_DURATION_ms> <!-- less than simu time - FLOW_START_ms -->
</PREDEFINED_TRAFFIC>
<CUSTOMIZED_TRAFFIC>
<PU> <!-- we are generating only one packet -->
<PROB_OFF_PU>0.9</PROB_OFF_PU> <!-- prob to transit from off to PU -->
<PROB_PU_ED>0.1</PROB_PU_ED> <!-- prob to transit from PU to ED -->
<HOLDING_TIME_OFF_PU>100</HOLDING_TIME_OFF_PU> <!-- in off state -->
</PU>
<ED> <!-- we are generating only one packet -->
<PROB_OFF_ED>0.1</PROB_OFF_ED> <!-- prob to transit from off to PU -->
<PROB_ED_PE>0.1</PROB_ED_PE> <!-- prob to transit from off to PU -->
<HOLDING_TIME_OFF_ED>10000</HOLDING_TIME_OFF_ED> <!-- in off state -->
</ED>
<PE>
<HOLDING_TIME_OFF_PE>100</HOLDING_TIME_OFF_PE> <!-- in off state, how much time we should generate traffic -->
</PE>
<SOURCE_ID>2</SOURCE_ID> <!-- <SOURCE_ID> 1:100 </SOURCE_ID> -->
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv6</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>0</DESTINATION_ID>
<FLOW_START_ms>400</FLOW_START_ms> <!-- not less than 310 -->
<FLOW_DURATION_ms>2000</FLOW_DURATION_ms> <!-- less than simu time - FLOW_START_ms -->
<IDT_DIST>uniform</IDT_DIST> <!-- OPTIONS: no_customized_traffic (default), uniform, poission, gaussian, exponential, fixed, weibull, pareto, gamma, cauchy -->
<IDT_MIN_ms>100</IDT_MIN_ms>
<IDT_MAX_ms>1000</IDT_MAX_ms>
<IDT_STANDARD_DEVIATION>1</IDT_STANDARD_DEVIATION>
<IDT_LAMBDA>7</IDT_LAMBDA>
<SIZE_DIST>gaussian</SIZE_DIST> <!-- OPTIONS: no_customized_traffic (default), uniform, poission, gaussian, exponential, fixed, weibull, pareto, gamma, cauchy -->
<SIZE_MIN_byte>200</SIZE_MIN_byte>
<SIZE_MAX_byte>500</SIZE_MAX_byte>
<SIZE_STANDARD_DEVIATION>5</SIZE_STANDARD_DEVIATION>
<SIZE_LAMBDA>4</SIZE_LAMBDA>
<DESTINATION_PORT>8080</DESTINATION_PORT>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>5000</EMULATION_TIME_ms>
<PERFORMANCE>
<METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>disable</LATENCY>
</METRICS>
<LAYER>
<MAC>1</MAC>
<RLC></RLC>
<PDCP></PDCP>
</LAYER>
<LOG_EMU>
<DEBUG>1</DEBUG>
</LOG_EMU>
<SEED>
<SEED_VALUE>1</SEED_VALUE>
</SEED>
</PERFORMANCE>
</EMULATION_CONFIG>
<PROFILE>EURECOM</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>500</EMULATION_TIME_ms>
<LOG> <!-- set the global log level -->
<LEVEL>debug</LEVEL>
</LOG>
</EMULATION_CONFIG>
<PROFILE>EMU-TEST</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>5000</X_m>
<Y_m>5000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>3</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>random</APPLICATION_TYPE> <!-- OPTIONS: scbr,mcbr,bcbr, gaming_OA, gaming_TF, m2m_AP, m2m_BR, , random, ,full_buffer -->
<DESTINATION_ID>1:3</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1:2</SOURCE_ID> <!-- <SOURCE_ID> 1:100 </SOURCE_ID> -->
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv6</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>0</DESTINATION_ID>
<!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gamma,-->
<IDT_DIST>poisson</IDT_DIST> <!-- similar for exponential, -->
<IDT_LAMBDA>7.3</IDT_LAMBDA>
<SIZE_DIST>unifrom</SIZE_DIST> <!-- OPTIONS: no_transmission (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gamma,-->
<SIZE_MIN_byte>100</SIZE_MIN_byte>
<SIZE_MAX_byte>500</SIZE_MAX_byte>
</CUSTOMIZED_TRAFFIC>
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>3</SOURCE_ID> <!-- <SOURCE_ID> 1:100 </SOURCE_ID> -->
<TRANSPORT_PROTOCOL>tcp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv4</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>0</DESTINATION_ID>
<!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gamma,-->
<IDT_DIST>fixed</IDT_DIST> <!---->
<IDT_MIN_ms>100</IDT_MIN_ms>
<SIZE_DIST>exponential</SIZE_DIST> <!-- OPTIONS: no_transmission (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gamma,-->
<SIZE_LAMBDA>2.2</SIZE_LAMBDA>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>0</EMULATION_TIME_ms> <!--set to infinity-->
<PERFORMANCE_METRICS>
<THROUGHPUT>1</THROUGHPUT>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OTG_3</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2.0</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-50</PATHLOSS_0_dB>
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>Rayleigh1</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>5</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>3</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>16</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>40</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>1</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>5</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>5000</X_m>
<Y_m>5000</Y_m>
</AREA>
<NETWORK_TYPE>homogeneous</NETWORK_TYPE>
<CELL_TYPE>macrocell</CELL_TYPE>
<RELAY></RELAY>
<MOBILITY>
<UE_MOBILITY>
<UE_INITIAL_DISTRIBUTION>random</UE_INITIAL_DISTRIBUTION>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
<UE_MOVING_DYNAMICS>
<MIN_SPEED_mps>1</MIN_SPEED_mps>
<MAX_SPEED_mps>200</MAX_SPEED_mps>
<MIN_SLEEP_ms>0.1</MIN_SLEEP_ms>
<MAX_SLEEP_ms>5.0</MAX_SLEEP_ms>
<MIN_JOURNEY_TIME_ms>0.1</MIN_JOURNEY_TIME_ms>
<MAX_JOURNEY_TIME_ms>10</MAX_JOURNEY_TIME_ms>
</UE_MOVING_DYNAMICS>
<SUMO_CONFIG>
<SUMO_CMD> sumo-gui </SUMO_CMD>
<SUMO_CONFIG_FILE>$OPENAIR2_DIR/UTIL/OMG/SUMO/SCENARIOS/scen.sumo.cfg</SUMO_CONFIG_FILE>
<SUMO_START> 0 </SUMO_START>
<SUMO_END> 10 </SUMO_END>
<SUMO_STEP> 10</SUMO_STEP>
<SUMO_HOST_IP> 127.0.1.1</SUMO_HOST_IP>
<SUMO_HOST_PORT> 8883</SUMO_HOST_PORT>
</SUMO_CONFIG>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<APPLICATION_TYPE>mcbr</APPLICATION_TYPE> <!-- OPTIONS: scbr,mcbr,bcbr, gaming_OA, gaming_TF, m2m_AP, m2m_BR, , random, ,full_buffer -->
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID> <!-- <SOURCE_ID> 1:100 </SOURCE_ID> -->
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv6</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>1</DESTINATION_ID>
<IDT_DIST>poisson</IDT_DIST> <!-- OPTIONS: no_transmission (default), uniform, poission, gaussian, exponential -->
<IDT_MIN_ms>100</IDT_MIN_ms>
<IDT_MAX_ms>1000</IDT_MAX_ms>
<IDT_STANDARD_DEVIATION>4.5</IDT_STANDARD_DEVIATION>
<IDT_LAMBDA>7.3</IDT_LAMBDA>
<IDT_SCALE>30</IDT_SCALE>
<IDT_SHAPE>15</IDT_SHAPE>
<SIZE_DIST>uniform</SIZE_DIST>
<SIZE_MIN_byte>100</SIZE_MIN_byte>
<SIZE_MAX_byte>500</SIZE_MAX_byte>
<SIZE_STANDARD_DEVIATION>5.3</SIZE_STANDARD_DEVIATION>
<SIZE_LAMBDA>2.2</SIZE_LAMBDA>
<SIZE_SCALE>0.5</SIZE_SCALE>
<SIZE_SHAPE>30</SIZE_SHAPE>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>0</EMULATION_TIME_ms> <!--set to infinity-->
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY> <!-- include both OWD and RTT-->
<LOSS_RATE>enable</LOSS_RATE>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>warning</LEVEL>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OCM_OMG_OTG_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-100</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>5</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>16</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>40</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>1</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>5</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>2000</X_m>
<Y_m>2000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>1</DESTINATION_ID>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
</PREDEFINED_TRAFFIC>
<!-- UL -->
<!-- <PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<FLOW_START_ms>200</FLOW_START_ms>
<FLOW_DURATION_ms>600</FLOW_DURATION_ms>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
<IP_VERSION>ipv4</IP_VERSION>
<DESTINATION_ID>0</DESTINATION_ID>
<IDT_DIST>uniform</IDT_DIST>
<IDT_MIN_ms>1</IDT_MIN_ms>
<IDT_MAX_ms>10</IDT_MAX_ms>
<SIZE_DIST>uniform</SIZE_DIST>
<SIZE_MIN_byte>10</SIZE_MIN_byte>
<SIZE_MAX_byte>100</SIZE_MAX_byte>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>60000</EMULATION_TIME_ms>
<CURVE>disable</CURVE>
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY>
<LOSS_RATE>enable</LOSS_RATE>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>low</VERBOSITY>
</LOG>
<SEED_VALUE>2013</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>CBA_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-100</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>5</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>16</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>40</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>1</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>5</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>2000</X_m>
<Y_m>2000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>1</DESTINATION_ID>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
</PREDEFINED_TRAFFIC>
<!-- UL -->
<!-- <PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<FLOW_START_ms>200</FLOW_START_ms>
<FLOW_DURATION_ms>600</FLOW_DURATION_ms>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
<IP_VERSION>ipv4</IP_VERSION>
<DESTINATION_ID>0</DESTINATION_ID>
<IDT_DIST>uniform</IDT_DIST>
<IDT_MIN_ms>1</IDT_MIN_ms>
<IDT_MAX_ms>10</IDT_MAX_ms>
<SIZE_DIST>uniform</SIZE_DIST>
<SIZE_MIN_byte>100</SIZE_MIN_byte>
<SIZE_MAX_byte>500</SIZE_MAX_byte>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>60000</EMULATION_TIME_ms>
<CURVE>disable</CURVE>
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY>
<LOSS_RATE>enable</LOSS_RATE>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>low</VERBOSITY>
</LOG>
<SEED_VALUE>2013</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>CBA_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-100</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>5</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>16</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>40</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>1</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>5</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>2000</X_m>
<Y_m>2000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>1</DESTINATION_ID>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
</PREDEFINED_TRAFFIC>
<!-- UL -->
<!-- <PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<FLOW_START_ms>200</FLOW_START_ms>
<FLOW_DURATION_ms>600</FLOW_DURATION_ms>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
<IP_VERSION>ipv4</IP_VERSION>
<DESTINATION_ID>0</DESTINATION_ID>
<IDT_DIST>uniform</IDT_DIST>
<IDT_MIN_ms>10</IDT_MIN_ms>
<IDT_MAX_ms>100</IDT_MAX_ms>
<SIZE_DIST>unifrom</SIZE_DIST>
<SIZE_MIN_byte>10</SIZE_MIN_byte>
<SIZE_MAX_byte>100</SIZE_MAX_byte>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>60000</EMULATION_TIME_ms>
<CURVE>disable</CURVE>
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY>
<LOSS_RATE>enable</LOSS_RATE>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>low</VERBOSITY>
</LOG>
<SEED_VALUE>2013</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>CBA_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-100</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>5</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>16</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>40</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>1</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>5</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>2000</X_m>
<Y_m>2000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>1</DESTINATION_ID>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
</PREDEFINED_TRAFFIC>
<!-- UL -->
<!-- <PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<FLOW_START_ms>200</FLOW_START_ms>
<FLOW_DURATION_ms>600</FLOW_DURATION_ms>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
<IP_VERSION>ipv4</IP_VERSION>
<DESTINATION_ID>0</DESTINATION_ID>
<IDT_DIST>uniform</IDT_DIST>
<IDT_MIN_ms>10</IDT_MIN_ms>
<IDT_MAX_ms>100</IDT_MAX_ms>
<SIZE_DIST>uniform</SIZE_DIST>
<SIZE_MIN_byte>100</SIZE_MIN_byte>
<SIZE_MAX_byte>1000</SIZE_MAX_byte>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>60000</EMULATION_TIME_ms> <!--set to infinity-->
<CURVE>disable</CURVE>
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY>
<LOSS_RATE>enable</LOSS_RATE>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>low</VERBOSITY>
</LOG>
<SEED_VALUE>2013</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>CBA_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-100</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>5</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>16</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>40</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>1</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>5</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>2000</X_m>
<Y_m>2000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>1</DESTINATION_ID>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
</PREDEFINED_TRAFFIC>
<!-- UL -->
<!-- <PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<FLOW_START_ms>200</FLOW_START_ms>
<FLOW_DURATION_ms>600</FLOW_DURATION_ms>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
<IP_VERSION>ipv4</IP_VERSION>
<DESTINATION_ID>0</DESTINATION_ID>
<IDT_DIST>uniform</IDT_DIST>
<IDT_MIN_ms>10</IDT_MIN_ms>
<IDT_MAX_ms>100</IDT_MAX_ms>
<SIZE_DIST>uniform</SIZE_DIST>
<SIZE_MIN_byte>1000</SIZE_MIN_byte>
<SIZE_MAX_byte>6000</SIZE_MAX_byte>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>60000</EMULATION_TIME_ms> <!--set to infinity-->
<CURVE>disable</CURVE>
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY>
<LOSS_RATE>enable</LOSS_RATE>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>low</VERBOSITY>
</LOG>
<SEED_VALUE>2013</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>CBA_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-100</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>5</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>16</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>40</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>1</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>5</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>2000</X_m>
<Y_m>2000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>1</DESTINATION_ID>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
</PREDEFINED_TRAFFIC>
<!-- UL -->
<!-- <PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<FLOW_START_ms>200</FLOW_START_ms>
<FLOW_DURATION_ms>600</FLOW_DURATION_ms>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
<IP_VERSION>ipv4</IP_VERSION>
<DESTINATION_ID>0</DESTINATION_ID>
<IDT_DIST>uniform</IDT_DIST>
<IDT_MIN_ms>100</IDT_MIN_ms>
<IDT_MAX_ms>1000</IDT_MAX_ms>
<SIZE_DIST>uniform</SIZE_DIST>
<SIZE_MIN_byte>10</SIZE_MIN_byte>
<SIZE_MAX_byte>100</SIZE_MAX_byte>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>60000</EMULATION_TIME_ms> <!--set to infinity-->
<CURVE>disable</CURVE>
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY>
<LOSS_RATE>enable</LOSS_RATE>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>low</VERBOSITY>
</LOG>
<SEED_VALUE>2013</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>CBA_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-100</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>5</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>16</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>40</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>1</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>5</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>2000</X_m>
<Y_m>2000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>1</DESTINATION_ID>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
</PREDEFINED_TRAFFIC>
<!-- UL -->
<!-- <PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<FLOW_START_ms>200</FLOW_START_ms>
<FLOW_DURATION_ms>600</FLOW_DURATION_ms>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
<IP_VERSION>ipv4</IP_VERSION>
<DESTINATION_ID>0</DESTINATION_ID>
<IDT_DIST>uniform</IDT_DIST>
<IDT_MIN_ms>100</IDT_MIN_ms>
<IDT_MAX_ms>1000</IDT_MAX_ms>
<SIZE_DIST>uniform</SIZE_DIST>
<SIZE_MIN_byte>100</SIZE_MIN_byte>
<SIZE_MAX_byte>1000</SIZE_MAX_byte>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>60000</EMULATION_TIME_ms> <!--set to infinity-->
<CURVE>disable</CURVE>
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY>
<LOSS_RATE>enable</LOSS_RATE>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>low</VERBOSITY>
</LOG>
<SEED_VALUE>2013</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>CBA_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-100</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>5</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>16</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>40</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>1</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>5</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>2000</X_m>
<Y_m>2000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>1</DESTINATION_ID>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
</PREDEFINED_TRAFFIC>
<!-- UL -->
<!-- <PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<FLOW_START_ms>200</FLOW_START_ms>
<FLOW_DURATION_ms>600</FLOW_DURATION_ms>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
<IP_VERSION>ipv4</IP_VERSION>
<DESTINATION_ID>0</DESTINATION_ID>
<IDT_DIST>uniform</IDT_DIST>
<IDT_MIN_ms>100</IDT_MIN_ms>
<IDT_MAX_ms>1000</IDT_MAX_ms>
<SIZE_DIST>uniform</SIZE_DIST>
<SIZE_MIN_byte>1000</SIZE_MIN_byte>
<SIZE_MAX_byte>9000</SIZE_MAX_byte>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>60000</EMULATION_TIME_ms> <!--set to infinity-->
<CURVE>disable</CURVE>
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY>
<LOSS_RATE>enable</LOSS_RATE>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>low</VERBOSITY>
</LOG>
<SEED_VALUE>2013</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>CBA_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-100</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>5</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>16</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>40</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>1</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>5</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>2000</X_m>
<Y_m>2000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>1</DESTINATION_ID>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
</PREDEFINED_TRAFFIC>
<!-- UL -->
<!-- <PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<FLOW_START_ms>200</FLOW_START_ms>
<FLOW_DURATION_ms>600</FLOW_DURATION_ms>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
<IP_VERSION>ipv4</IP_VERSION>
<DESTINATION_ID>0</DESTINATION_ID>
<IDT_DIST>uniform</IDT_DIST>
<IDT_MIN_ms>1000</IDT_MIN_ms>
<IDT_MAX_ms>10000</IDT_MAX_ms>
<SIZE_DIST>uniform</SIZE_DIST>
<SIZE_MIN_byte>10</SIZE_MIN_byte>
<SIZE_MAX_byte>100</SIZE_MAX_byte>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>60000</EMULATION_TIME_ms> <!--set to infinity-->
<CURVE>disable</CURVE>
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY>
<LOSS_RATE>enable</LOSS_RATE>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>low</VERBOSITY>
</LOG>
<SEED_VALUE>2013</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>CBA_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-100</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>5</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>16</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>40</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>1</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>5</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>2000</X_m>
<Y_m>2000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>1</DESTINATION_ID>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
</PREDEFINED_TRAFFIC>
<!-- UL -->
<!-- <PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<FLOW_START_ms>200</FLOW_START_ms>
<FLOW_DURATION_ms>600</FLOW_DURATION_ms>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
<IP_VERSION>ipv4</IP_VERSION>
<DESTINATION_ID>0</DESTINATION_ID>
<IDT_DIST>uniform</IDT_DIST>
<IDT_MIN_ms>1000</IDT_MIN_ms>
<IDT_MAX_ms>10000</IDT_MAX_ms>
<SIZE_DIST>uniform</SIZE_DIST>
<SIZE_MIN_byte>100</SIZE_MIN_byte>
<SIZE_MAX_byte>1000</SIZE_MAX_byte>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>60000</EMULATION_TIME_ms> <!--set to infinity-->
<CURVE>disable</CURVE>
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY>
<LOSS_RATE>enable</LOSS_RATE>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>low</VERBOSITY>
</LOG>
<SEED_VALUE>2013</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>CBA_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>500</X_m>
<Y_m>500</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>3</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE> <!-- STATIC -->
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<!-- Basic configuration of a customized traffic : one state-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<TRANSPORT_PROTOCOL>tcp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv4</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>1:3</DESTINATION_ID>
<BACKGROUND_TRAFFIC>disable</BACKGROUND_TRAFFIC> <!-- options: enable, disable. If enable, it generates a background traffic corresponding to the traffic direction-->
<AGGREGATION_LEVEL>1</AGGREGATION_LEVEL> <!-- options: default=1, the number of traffic to aggregate-->
<IDT_DIST>uniform</IDT_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<IDT_MIN_ms>30</IDT_MIN_ms> <!--Minimum IDT values in milliseconds-->
<IDT_MAX_ms>50</IDT_MAX_ms> <!--MAximum IDT values in milliseconds-->
<SIZE_DIST>uniform</SIZE_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<SIZE_MIN_byte>512</SIZE_MIN_byte> <!--Minimum PAYLOAD size values in bytes-->
<SIZE_MAX_byte>1024</SIZE_MAX_byte> <!--MAximum PAYLOAD size values in bytes-->
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>10000</EMULATION_TIME_ms> <!--if 0 set to infinity-->
<CURVE>enabled</CURVE> <!-- option: enabled, disabled. If CURVE is enabled, graphes are ploted in real time (UL and DL) of WOD and throughput measurement for each packet -->
<BACKGROUND_STATS>enable</BACKGROUND_STATS> <!-- option: enable, disable. If enable, it allows to ptrint BACKGROUNS statistics: Nb packets, throughputs,etc-->
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT> <!-- option: enable, disable. If enable, throughput measurements are plotted in real time-->
<LATENCY>enable</LATENCY> <!-- option: enable, disable. If enable, latency measurements are plotted in real time-->
<OWD_RADIO_ACCESS>enable</OWD_RADIO_ACCESS> <!-- option: enable, disable. If enable owd curve shows the one way radio access delay, else it shows end to end owd -->
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>debug</LEVEL>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OTG_2</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>500</X_m>
<Y_m>500</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE> <!-- STATIC -->
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<!-- Basic configuration of a customized traffic : one state-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<TRANSPORT_PROTOCOL>tcp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv4</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>1</DESTINATION_ID>
<BACKGROUND_TRAFFIC>disable</BACKGROUND_TRAFFIC> <!-- options: enable, disable. If enable, it generates a background traffic corresponding to the traffic direction-->
<AGGREGATION_LEVEL>1</AGGREGATION_LEVEL> <!-- options: default=1, the number of traffic to aggregate-->
<IDT_DIST>uniform</IDT_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<IDT_MIN_ms>500</IDT_MIN_ms> <!--Minimum IDT values in milliseconds-->
<IDT_MAX_ms>500</IDT_MAX_ms> <!--Minimum IDT values in milliseconds-->
<SIZE_DIST>uniform</SIZE_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<SIZE_MIN_byte>1000</SIZE_MIN_byte> <!--Minimum PAYLOAD size values in bytes-->
<SIZE_MAX_byte>1500</SIZE_MAX_byte> <!--MAximum PAYLOAD size values in bytes-->
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>0</EMULATION_TIME_ms> <!--if 0 set to infinity-->
<CURVE>enable</CURVE> <!-- option: enabled, disabled. If CURVE is enabled, graphes are ploted in real time (UL and DL) of WOD and throughput measurement for each packet -->
<BACKGROUND_STATS>enable</BACKGROUND_STATS> <!-- option: enable, disable. If enable, it allows to ptrint BACKGROUNS statistics: Nb packets, throughputs,etc-->
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT> <!-- option: enable, disable. If enable, throughput measurements are plotted in real time-->
<LATENCY>enable</LATENCY> <!-- option: enable, disable. If enable, latency measurements are plotted in real time-->
<OWD_RADIO_ACCESS>disable</OWD_RADIO_ACCESS> <!-- option: enable, disable. If enable owd curve shows the one way radio access delay, else it shows end to end owd -->
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>trace</LEVEL>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OTG_2</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>500</X_m>
<Y_m>500</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE> <!-- STATIC -->
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<CUSTOMIZED_TRAFFIC>
<PROB_OFF_PE>0.6</PROB_OFF_PE> <!-- Probability threshold to move from OFF to PE state. -->
<HOLDING_TIME_OFF_PE>10</HOLDING_TIME_OFF_PE> <!--Holding time in OFF state before moving to PE -->
<HOLDING_TIME_PE_OFF>200</HOLDING_TIME_PE_OFF> <!--Holding time in PE state before moving to OFF -->
<SOURCE_ID>1</SOURCE_ID>
<TRANSPORT_PROTOCOL>tcp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv4</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>0</DESTINATION_ID>
<BACKGROUND_TRAFFIC>enable</BACKGROUND_TRAFFIC> <!-- options: enable, disable. If enable, it generates a background traffic corresponding to the traffic direction-->
<AGGREGATION_LEVEL>1</AGGREGATION_LEVEL> <!-- options: default=1, the number of traffic to aggregate-->
<IDT_DIST>uniform</IDT_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<IDT_MIN_ms>80</IDT_MIN_ms> <!--Minimum IDT values in milliseconds-->
<IDT_MAX_ms>100</IDT_MAX_ms> <!--MAximum IDT values in milliseconds-->
<SIZE_DIST>uniform</SIZE_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<SIZE_MIN_byte>100</SIZE_MIN_byte> <!--Minimum PAYLOAD size values in bytes-->
<SIZE_MAX_byte>200</SIZE_MAX_byte> <!--MAximum PAYLOAD size values in bytes-->
</CUSTOMIZED_TRAFFIC>
<CUSTOMIZED_TRAFFIC>
<PROB_OFF_PE>0.6</PROB_OFF_PE> <!-- Probability threshold to move from OFF to PE state. -->
<HOLDING_TIME_OFF_PE>10</HOLDING_TIME_OFF_PE> <!--Holding time in OFF state before moving to PE -->
<HOLDING_TIME_PE_OFF>200</HOLDING_TIME_PE_OFF> <!--Holding time in PE state before moving to OFF -->
<SOURCE_ID>0</SOURCE_ID>
<TRANSPORT_PROTOCOL>tcp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv4</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>1</DESTINATION_ID>
<BACKGROUND_TRAFFIC>enable</BACKGROUND_TRAFFIC> <!-- options: enable, disable. If enable, it generates a background traffic corresponding to the traffic direction-->
<AGGREGATION_LEVEL>1</AGGREGATION_LEVEL> <!-- options: default=1, the number of traffic to aggregate-->
<IDT_DIST>uniform</IDT_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<IDT_MIN_ms>1000</IDT_MIN_ms> <!--Minimum IDT values in milliseconds-->
<IDT_MAX_ms>2000</IDT_MAX_ms> <!--MAximum IDT values in milliseconds-->
<SIZE_DIST>uniform</SIZE_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<SIZE_MIN_byte>100</SIZE_MIN_byte> <!--Minimum PAYLOAD size values in bytes-->
<SIZE_MAX_byte>200</SIZE_MAX_byte> <!--MAximum PAYLOAD size values in bytes-->
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>100000</EMULATION_TIME_ms> <!--if 0 set to infinity-->
<CURVE>enable</CURVE> <!-- option: enabled, disabled. If CURVE is enabled, graphes are ploted in real time (UL and DL) of WOD and throughput measurement for each packet -->
<BACKGROUND_STATS>enable</BACKGROUND_STATS> <!-- option: enable, disable. If enable, it allows to ptrint BACKGROUNS statistics: Nb packets, throughputs,etc-->
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT> <!-- option: enable, disable. If enable, throughput measurements are plotted in real time-->
<LATENCY>enable</LATENCY> <!-- option: enable, disable. If enable, latency measurements are plotted in real time-->
<OWD_RADIO_ACCESS>enable</OWD_RADIO_ACCESS> <!-- option: enable, disable. If enable owd curve shows the one way radio access delay, else it shows end to end owd -->
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>trace</LEVEL>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OTG_2</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>500</X_m>
<Y_m>500</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>3</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE> <!-- STATIC -->
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<!-- High complexity configuration of a customized traffic with 2 states: OFF, PU and PE-->
<!-- We configure OFF and PE holding time and off_pe, off_pu probabilities. They will be preconfigured automatically -->
<CUSTOMIZED_TRAFFIC>
<PU_SIZE_PKTS>70</PU_SIZE_PKTS> <!-- PU state packet size in bytes-->
<PROB_OFF_PU>0.1</PROB_OFF_PU> <!-- Probability threshold to move from OFF to PU state. -->
<PROB_OFF_PE>0.8</PROB_OFF_PE> <!-- Probability threshold to move from OFF to PE state. -->
<HOLDING_TIME_OFF_PU>50</HOLDING_TIME_OFF_PU> <!--Holding time in OFF state before moving to PU -->
<HOLDING_TIME_OFF_PE>13</HOLDING_TIME_OFF_PE> <!--Holding time in OFF state before moving to PE -->
<HOLDING_TIME_PE_OFF>230</HOLDING_TIME_PE_OFF> <!--Holding time in PE state before moving to OFF -->
<SOURCE_ID>1:3</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv6</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>0</DESTINATION_ID>
<BACKGROUND_TRAFFIC>enable</BACKGROUND_TRAFFIC> <!-- options: enable, disable. If enable, it generates a background traffic corresponding to the traffic direction-->
<AGGREGATION_LEVEL>1</AGGREGATION_LEVEL> <!-- options: default=1, the number of traffic to aggregate-->
<IDT_DIST>uniform</IDT_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<IDT_STANDARD_DEVIATION>4.5</IDT_STANDARD_DEVIATION> <!-- Standard deviation-->
<SIZE_DIST>pareto</SIZE_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<SIZE_SCALE>0.5</SIZE_SCALE> <!-- Scale-->
<SIZE_SHAPE>30</SIZE_SHAPE> <!-- Shape-->
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>1000</EMULATION_TIME_ms> <!--if 0 set to infinity-->
<CURVE>enable</CURVE> <!-- option: enabled, disabled. If CURVE is enabled, graphes are ploted in real time (UL and DL) of WOD and throughput measurement for each packet -->
<BACKGROUND_STATS>enable</BACKGROUND_STATS> <!-- option: enable, disable. If enable, it allows to ptrint BACKGROUNS statistics: Nb packets, throughputs,etc-->
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT> <!-- option: enable, disable. If enable, throughput measurements are plotted in real time-->
<LATENCY>enable</LATENCY> <!-- option: enable, disable. If enable, latency measurements are plotted in real time-->
<OWD_RADIO_ACCESS>enable</OWD_RADIO_ACCESS> <!-- option: enable, disable. If enable owd curve shows the one way radio access delay, else it shows end to end owd -->
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>trace</LEVEL>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OTG_2</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>500</X_m>
<Y_m>500</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>3</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE> <!-- STATIC -->
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<!-- High complexity configuration of a customized traffic with 2 states: OFF, ED and PE-->
<!-- We configure OFF and PE holding time and off_pe, off_ED probabilities. They will be preconfigured automatically -->
<CUSTOMIZED_TRAFFIC>
<ED_SIZE_PKTS>70</ED_SIZE_PKTS>
<PROB_OFF_ED>0.1</PROB_OFF_ED>
<PROB_OFF_PE>0.2</PROB_OFF_PE> <!-- Probability threshold to move from OFF to PE state. -->
<HOLDING_TIME_OFF_ED>100</HOLDING_TIME_OFF_ED> <!--Holding time in OFF state before moving to ED -->
<HOLDING_TIME_OFF_PE>200</HOLDING_TIME_OFF_PE> <!--Holding time in OFF state before moving to PE -->
<HOLDING_TIME_PE_OFF>230</HOLDING_TIME_PE_OFF> <!--Holding time in PE state before moving to OFF -->
<SOURCE_ID>1:3</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv6</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>0</DESTINATION_ID>
<BACKGROUND_TRAFFIC>enable</BACKGROUND_TRAFFIC> <!-- options: enable, disable. If enable, it generates a background traffic corresponding to the traffic direction-->
<AGGREGATION_LEVEL>1</AGGREGATION_LEVEL> <!-- options: default=1, the number of traffic to aggregate-->
<IDT_DIST>uniform</IDT_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<IDT_MIN_ms>100</IDT_MIN_ms> <!--Minimum IDT values in milliseconds-->
<IDT_MAX_ms>200</IDT_MAX_ms> <!--MAximum IDT values in milliseconds-->
<SIZE_DIST>pareto</SIZE_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<SIZE_SCALE>0.5</SIZE_SCALE> <!-- Scale-->
<SIZE_SHAPE>30</SIZE_SHAPE> <!-- Shape-->
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>3000</EMULATION_TIME_ms> <!--if 0 set to infinity-->
<CURVE>enable</CURVE> <!-- option: enabled, disabled. If CURVE is enabled, graphes are ploted in real time (UL and DL) of WOD and throughput measurement for each packet -->
<BACKGROUND_STATS>enable</BACKGROUND_STATS> <!-- option: enable, disable. If enable, it allows to ptrint BACKGROUNS statistics: Nb packets, throughputs,etc-->
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT> <!-- option: enable, disable. If enable, throughput measurements are plotted in real time-->
<LATENCY>enable</LATENCY> <!-- option: enable, disable. If enable, latency measurements are plotted in real time-->
<OWD_RADIO_ACCESS>enable</OWD_RADIO_ACCESS> <!-- option: enable, disable. If enable owd curve shows the one way radio access delay, else it shows end to end owd -->
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>trace</LEVEL>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OTG_2</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>500</X_m>
<Y_m>500</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>3</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE> <!-- STATIC -->
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<!-- Basic configuration of a preconfigured M2M traffic with 4 states: OFF, PU, ED and PE-->
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>m2m_traffic</APPLICATION_TYPE> <!-- options: scbr,mcbr,bcbr, gaming_OA, gaming_TF, m2m_AP, m2m_BR ,m2m_traffic -->
<BACKGROUND_TRAFFIC>enable</BACKGROUND_TRAFFIC> <!-- options: enable, disable. If enable, it generates a background traffic corresponding to the traffic direction-->
<AGGREGATION_LEVEL>1</AGGREGATION_LEVEL> <!-- options: default=1, the number of traffic to aggregate-->
<DESTINATION_ID>1:3</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>5000</EMULATION_TIME_ms> <!--if 0 set to infinity-->
<CURVE>enable</CURVE> <!-- option: enable, disable. If CURVE is enable, graphes are ploted in real time (UL and DL) of WOD and throughput measurement for each packet -->
<BACKGROUND_STATS>enable</BACKGROUND_STATS> <!-- option: enable, disable. If enable, it allows to ptrint BACKGROUNS statistics: Nb packets, throughputs,etc-->
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT> <!-- option: enable, disable. If enable, throughput measurements are plotted in real time-->
<LATENCY>enable</LATENCY> <!-- option: enable, disable. If enable, latency measurements are plotted in real time-->
<OWD_RADIO_ACESS>enable</OWD_RADIO_ACESS> <!-- option: enable, disable. If enable owd curve shows the one way radio access delay, else it shows end to end owd -->
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>trace</LEVEL>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OTG_2</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>500</X_m>
<Y_m>500</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>3</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE> <!-- STATIC -->
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<!-- High complexity configuration of a customized traffic with 3 states: OFF, ED, PU and PE-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<TRANSPORT_PROTOCOL>tcp</TRANSPORT_PROTOCOL>
<IP_VERSION>ipv4</IP_VERSION>
<DESTINATION_ID>1:3</DESTINATION_ID>
<BACKGROUND_TRAFFIC>enable</BACKGROUND_TRAFFIC> <!-- options: enable, disable. If enable, it generates a background traffic corresponding to the traffic direction-->
<AGGREGATION_LEVEL>1</AGGREGATION_LEVEL> <!-- options: default=1, the number of traffic to aggregate-->
<IDT_DIST>uniform</IDT_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<IDT_MIN_ms>400</IDT_MIN_ms> <!--Minimum IDT values in milliseconds-->
<IDT_MAX_ms>500</IDT_MAX_ms> <!--Maximum IDT values in milliseconds-->
<SIZE_DIST>uniform</SIZE_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<SIZE_MIN_byte>80</SIZE_MIN_byte> <!--Minimum PAYLOAD size in bytes-->
<SIZE_MAX_byte>150</SIZE_MAX_byte> <!--Maximum PAYLOAD size in bytes-->
<PU_SIZE_PKTS>60</PU_SIZE_PKTS> <!-- PU state packet size in bytes-->
<ED_SIZE_PKTS>70</ED_SIZE_PKTS> <!-- ED state packet size in bytes-->
<PROB_OFF_PU>0.2</PROB_OFF_PU> <!-- Probability threshold to move from OFF to PU state. -->
<PROB_OFF_ED>0.1</PROB_OFF_ED> <!-- Probability threshold to move from OFF to ED state. -->
<PROB_OFF_PE>0.2</PROB_OFF_PE> <!-- Probability threshold to move from OFF to PE state. -->
<PROB_PU_ED>0.1</PROB_PU_ED> <!-- Probability threshold to move from PU to ED state. -->
<PROB_PU_PE>0.3</PROB_PU_PE> <!-- Probability threshold to move from PU to PE state. -->
<PROB_ED_PE>0.1</PROB_ED_PE> <!-- Probability threshold to move from ED to PE state. -->
<PROB_ED_PU>0.2</PROB_ED_PU> <!-- Probability threshold to move from ED to PU state. -->
<HOLDING_TIME_OFF_ED>100</HOLDING_TIME_OFF_ED> <!--Holding time in OFF state before moving to ED -->
<HOLDING_TIME_OFF_PU>120</HOLDING_TIME_OFF_PU> <!--Holding time in OFF state before moving to PU -->
<HOLDING_TIME_OFF_PE>150</HOLDING_TIME_OFF_PE> <!--Holding time in OFF state before moving to PE -->
<HOLDING_TIME_PE_OFF>500</HOLDING_TIME_PE_OFF> <!--Holding time in PE state before moving to OFF -->
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>0</EMULATION_TIME_ms> <!--if0 set to infinity-->
<CURVE>enable</CURVE> <!-- option: enabled, disabled. If CURVE is enabled, graphes are ploted in real time (UL and DL) of WOD and throughput measurement for each packet -->
<BACKGROUND_STATS>enable</BACKGROUND_STATS>
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY>
<OWD_RADIO_ACCESS>enable</OWD_RADIO_ACCESS> <!-- option: 0, 1. If 1 owd curve shows the one way radio access delay,else shows end to end owd -->
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>debug</LEVEL>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OTG_2</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>free_space</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-50</PATHLOSS_0_dB>
</FREE_SPACE_MODEL_PARAMETERS>
</FADING>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>-90</RX_NOISE_LEVEL_dB>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>-90</RX_NOISE_LEVEL_dB>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>1000</X_m>
<Y_m>1000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<UE_INITIAL_DISTRIBUTION>random</UE_INITIAL_DISTRIBUTION>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>2</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>RWP</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>2</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>0</EMULATION_TIME_ms>
<LOG> <!-- set the global log level -->
<LEVEL>debug</LEVEL>
</LOG>
</EMULATION_CONFIG>
<PROFILE>OCM_OMG_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2.0</PATHLOSS_EXPONENT>
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>500</X_m>
<Y_m>500</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>4</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE> <!-- STATIC -->
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<!-- Basic configuration of a customized traffic : one state-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv6</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>1:3</DESTINATION_ID>
<BACKGROUND_TRAFFIC>disable</BACKGROUND_TRAFFIC> <!-- options: enable, disable. If enable, it generates a background traffic corresponding to the traffic direction-->
<IDT_DIST>uniform</IDT_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<IDT_MIN_ms>40</IDT_MIN_ms> <!--Minimum IDT values in milliseconds-->
<IDT_MAX_ms>50</IDT_MAX_ms> <!--Minimum IDT values in milliseconds-->
<SIZE_DIST>fixed</SIZE_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<SIZE_MIN_byte>1400</SIZE_MIN_byte> <!--Minimum PAYLOAD size values in bytes-->
<SIZE_MAX_byte>1400</SIZE_MAX_byte> <!--MAximum PAYLOAD size values in bytes-->
</CUSTOMIZED_TRAFFIC>
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1:3</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv6</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>0</DESTINATION_ID>
<FLOW_START_ms>200</FLOW_START_ms> <!-- indicates the start time of the app or the actual duration of the traffic-->
<FLOW_DURATION_ms>7000</FLOW_DURATION_ms> <!-- indicates the duration of the app or the actual duration of the traffic-->
<BACKGROUND_TRAFFIC>disable</BACKGROUND_TRAFFIC> <!-- options: enable, disable. If enable, it generates a background traffic corresponding to the traffic direction-->
<IDT_DIST>fixed</IDT_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<IDT_MIN_ms>40</IDT_MIN_ms> <!--Minimum IDT values in milliseconds-->
<IDT_MAX_ms>50</IDT_MAX_ms> <!--Minimum IDT values in milliseconds-->
<SIZE_DIST>uniform</SIZE_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<SIZE_MIN_byte>256</SIZE_MIN_byte> <!--Minimum PAYLOAD size values in bytes-->
<SIZE_MAX_byte>768</SIZE_MAX_byte> <!--Maximum PAYLOAD size values in bytes-->
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>30000</EMULATION_TIME_ms> <!--if 0 set to infinity-->
<CURVE>disable</CURVE> <!-- option: enabled, disabled. If CURVE is enabled, graphes are ploted in real time (UL and DL) of WOD and throughput measurement for each packet -->
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT> <!-- option: enable, disable. If enable, throughput measurements are plotted in real time-->
<LATENCY>enable</LATENCY> <!-- option: enable, disable. If enable, latency measurements are plotted in real time-->
<OWD_RADIO_ACCESS>enable</OWD_RADIO_ACCESS> <!-- option: enable, disable. If enable owd curve shows the one way radio access delay, else it shows end to end owd -->
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>low</VERBOSITY>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>MEDIEVAL_OTG_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>500</X_m>
<Y_m>500</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE> <!-- STATIC -->
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<!-- Basic configuration of a preconfigured M2M traffic with 4 states: OFF, PU, ED and PE-->
<PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<APPLICATION_TYPE>alarm_temperature</APPLICATION_TYPE> <!-- options: scbr,mcbr,bcbr, auto_pilot_l (LOW speed), auto_pilot_m (MEDIEUM speed), auto_pilot_h (HIGH speed), auto_pilot_e (EMERGENCY), virtual_race_l (LOW speed), virtual_race_m (MEDIUM speed), virtual_race_h (HIGH speed), virtual_race_f (FINISH speed), alarm_humidity, alarm_smoke, alarm_temperature -->
<BACKGROUND_TRAFFIC>disable</BACKGROUND_TRAFFIC> <!-- options: enable, disable. If enable, it generates a background traffic corresponding to the traffic direction-->
<AGGREGATION_LEVEL>1</AGGREGATION_LEVEL> <!-- options: default=1, the number of traffic to aggregate-->
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>10000</EMULATION_TIME_ms> <!--if 0 set to infinity-->
<CURVE>enable</CURVE> <!-- option: enable, disable. If CURVE is enable, graphes are ploted in real time (UL and DL) of WOD and throughput measurement for each packet -->
<BACKGROUND_STATS>enable</BACKGROUND_STATS> <!-- option: enable, disable. If enable, it allows to ptrint BACKGROUNS statistics: Nb packets, throughputs,etc-->
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT> <!-- option: enable, disable. If enable, throughput measurements are plotted in real time-->
<LATENCY>enable</LATENCY> <!-- option: enable, disable. If enable, latency measurements are plotted in real time-->
<OWD_RADIO_ACCESS>enable</OWD_RADIO_ACCESS> <!-- option: enable, disable. If enable owd curve shows the one way radio access delay, else it shows end to end owd -->
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>trace</LEVEL>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OTG_2</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-100</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>5</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>16</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>40</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>1</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>5</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>2000</X_m>
<Y_m>2000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>7</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<!-- DL
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>1:9</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
-->
<!-- UL -->
<!-- <PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<FLOW_START_ms>200</FLOW_START_ms>
<FLOW_DURATION_ms>600</FLOW_DURATION_ms>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1:7</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL>
<FLOW_START_ms>0</FLOW_START_ms>
<FLOW_DURATION_ms>8000</FLOW_DURATION_ms>
<IP_VERSION>ipv4</IP_VERSION>
<DESTINATION_ID>0</DESTINATION_ID>
<IDT_DIST>fixed</IDT_DIST>
<IDT_MIN_ms>30</IDT_MIN_ms>
<IDT_MAX_ms>2000</IDT_MAX_ms>
<SIZE_DIST>fixed</SIZE_DIST>
<SIZE_MIN_byte>100</SIZE_MIN_byte>
<SIZE_MAX_byte>200</SIZE_MAX_byte>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>10000</EMULATION_TIME_ms> <!--set to infinity-->
<CURVE>disable</CURVE>
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY>
<LOSS_RATE>enable</LOSS_RATE>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>trace</LEVEL>
<VERBOSITY>medium</VERBOSITY>
</LOG>
<SEED_VALUE>2014</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>CBA_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2.0</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-100</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<TRANSMISSION_MODE>1</TRANSMISSION_MODE> <!-- validavalue: 1, 2, 5, 6 -->
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>1000</X_m>
<Y_m>1000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>7</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE> <!-- STATIC -->
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<!-- Basic configuration of a customized traffic : one state-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv6</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>1:7</DESTINATION_ID>
<FLOW_START_ms>1000</FLOW_START_ms> <!-- indicates the start time of the app or the actual duration of the traffic-->
<FLOW_DURATION_ms>10000</FLOW_DURATION_ms> <!-- indicates the start time of the app or the actual duration of the traffic-->
<BACKGROUND_TRAFFIC>disable</BACKGROUND_TRAFFIC> <!-- options: enable, disable. If enable, it generates a background traffic corresponding to the traffic direction-->
<IDT_DIST>uniform</IDT_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<IDT_MIN_ms>50</IDT_MIN_ms> <!--Minimum IDT values in milliseconds-->
<IDT_MAX_ms>100</IDT_MAX_ms> <!--Minimum IDT values in milliseconds-->
<SIZE_DIST>uniform</SIZE_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<SIZE_MIN_byte>128</SIZE_MIN_byte> <!--Minimum PAYLOAD size values in bytes-->
<SIZE_MAX_byte>1400</SIZE_MAX_byte> <!--MAximum PAYLOAD size values in bytes-->
</CUSTOMIZED_TRAFFIC>
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1:7</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv6</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>0</DESTINATION_ID>
<FLOW_START_ms>0</FLOW_START_ms> <!-- indicates the start time of the app or the actual duration of the traffic-->
<FLOW_DURATION_ms>10000</FLOW_DURATION_ms> <!-- indicates the start time of the app or the actual duration of the traffic-->
<BACKGROUND_TRAFFIC>disable</BACKGROUND_TRAFFIC> <!-- options: enable, disable. If enable, it generates a background traffic corresponding to the traffic direction-->
<IDT_DIST>uniform</IDT_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<IDT_MIN_ms>100</IDT_MIN_ms> <!--Minimum IDT values in milliseconds-->
<IDT_MAX_ms>150</IDT_MAX_ms> <!--Minimum IDT values in milliseconds-->
<SIZE_DIST>uniform</SIZE_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<SIZE_MIN_byte>256</SIZE_MIN_byte> <!--Minimum PAYLOAD size values in bytes-->
<SIZE_MAX_byte>768</SIZE_MAX_byte> <!--Maximum PAYLOAD size values in bytes-->
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>15000</EMULATION_TIME_ms> <!--if 0 set to infinity-->
<CURVE>disable</CURVE> <!-- option: enable, disable. If CURVE is enabled, graphes are ploted in real time (UL and DL) of WOD and throughput measurement for each packet -->
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT> <!-- option: enable, disable. If enable, throughput measurements are plotted in real time-->
<LATENCY>enable</LATENCY> <!-- option: enable, disable. If enable, latency measurements are plotted in real time-->
<OWD_RADIO_ACCESS>enable</OWD_RADIO_ACCESS> <!-- option: enable, disable. If enable owd curve shows the one way radio access delay, else it shows end to end owd -->
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>low</VERBOSITY>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>0</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>MEDIEVAL_OTG_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2.0</PATHLOSS_EXPONENT>
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>1000</X_m>
<Y_m>1000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE> <!-- STATIC -->
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<!-- Basic configuration of a customized traffic : one state-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv4</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>1</DESTINATION_ID>
<FLOW_START_ms>1000</FLOW_START_ms> <!-- indicates the start time of the app or the actual duration of the traffic-->
<FLOW_DURATION_ms>10000</FLOW_DURATION_ms> <!-- indicates the start time of the app or the actual duration of the traffic-->
<BACKGROUND_TRAFFIC>disable</BACKGROUND_TRAFFIC> <!-- options: enable, disable. If enable, it generates a background traffic corresponding to the traffic direction-->
<IDT_DIST>fixed</IDT_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<IDT_MIN_ms>1000</IDT_MIN_ms> <!--Minimum IDT values in milliseconds-->
<IDT_MAX_ms>1000</IDT_MAX_ms> <!--Minimum IDT values in milliseconds-->
<SIZE_DIST>fixed</SIZE_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<SIZE_MIN_byte>32</SIZE_MIN_byte> <!--Minimum PAYLOAD size values in bytes-->
<SIZE_MAX_byte>32</SIZE_MAX_byte> <!--MAximum PAYLOAD size values in bytes-->
</CUSTOMIZED_TRAFFIC>
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv6</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>0</DESTINATION_ID>
<FLOW_START_ms>1000</FLOW_START_ms> <!-- indicates the start time of the app or the actual duration of the traffic-->
<FLOW_DURATION_ms>10000</FLOW_DURATION_ms> <!-- indicates the start time of the app or the actual duration of the traffic-->
<BACKGROUND_TRAFFIC>disable</BACKGROUND_TRAFFIC> <!-- options: enable, disable. If enable, it generates a background traffic corresponding to the traffic direction-->
<IDT_DIST>fixed</IDT_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<IDT_MIN_ms>1000</IDT_MIN_ms> <!--Minimum IDT values in milliseconds-->
<IDT_MAX_ms>1000</IDT_MAX_ms> <!--Minimum IDT values in milliseconds-->
<SIZE_DIST>uniform</SIZE_DIST> <!-- available distributions: none (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gammav-->
<SIZE_MIN_byte>32</SIZE_MIN_byte> <!--Minimum PAYLOAD size values in bytes-->
<SIZE_MAX_byte>32</SIZE_MAX_byte> <!--Maximum PAYLOAD size values in bytes-->
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>15000</EMULATION_TIME_ms> <!--if 0 set to infinity-->
<CURVE>disable</CURVE> <!-- option: enable, disable. If CURVE is enabled, graphes are ploted in real time (UL and DL) of WOD and throughput measurement for each packet -->
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT> <!-- option: enable, disable. If enable, throughput measurements are plotted in real time-->
<LATENCY>enable</LATENCY> <!-- option: enable, disable. If enable, latency measurements are plotted in real time-->
<OWD_RADIO_ACCESS>enable</OWD_RADIO_ACCESS> <!-- option: enable, disable. If enable owd curve shows the one way radio access delay, else it shows end to end owd -->
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>debug</LEVEL>
<VERBOSITY>medium</VERBOSITY>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>0</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>MEDIEVAL_OTG_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>free_space</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-50</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<TRANSMISSION_MODE>1</TRANSMISSION_MODE>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>0</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>0</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>43</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>0</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>0</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>500</X_m>
<Y_m>500</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<UE_INITIAL_DISTRIBUTION>random</UE_INITIAL_DISTRIBUTION>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>2</NUMBER_OF_NODES> <!-- num UE -->
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
<!-- <UE_MOVING_DYNAMICS>
<MIN_SPEED_mps>0.1</MIN_SPEED_mps>
<MAX_SPEED_mps>20</MAX_SPEED_mps>
<MIN_SLEEP_ms>0.1</MIN_SLEEP_ms>
<MAX_SLEEP_ms>5.0</MAX_SLEEP_ms>
<MIN_JOURNEY_TIME_ms>0.1</MIN_JOURNEY_TIME_ms>
<MAX_JOURNEY_TIME_ms>10</MAX_JOURNEY_TIME_ms>
</UE_MOVING_DYNAMICS> -->
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>2</NUMBER_OF_CELLS> <!-- num eNB -->
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<!-- DL -->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<DESTINATION_ID>2</DESTINATION_ID>
<IDT_DIST>fixed</IDT_DIST> <!-- option: no_customized_traffic, uniform, gaussian, exponential, poisson, fixed, weibull, pareto, gamma, cauchy, log_normal -->
<IDT_MIN_ms>10</IDT_MIN_ms>
<SIZE_DIST>fixed</SIZE_DIST> <!-- option: no_customized_traffic, uniform, gaussian, exponential, poisson, fixed, weibull, pareto, gamma, cauchy, log_normal -->
<SIZE_MIN_byte>125</SIZE_MIN_byte>
</CUSTOMIZED_TRAFFIC>
<!-- UL -->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>2</SOURCE_ID>
<DESTINATION_ID>0</DESTINATION_ID>
<IDT_DIST>fixed</IDT_DIST> <!-- option: no_customized_traffic, uniform, gaussian, exponential, poisson, fixed, weibull, pareto, gamma, cauchy, log_normal -->
<IDT_MIN_ms>10</IDT_MIN_ms>
<SIZE_DIST>fixed</SIZE_DIST> <!-- option: no_customized_traffic, uniform, gaussian, exponential, poisson, fixed, weibull, pareto, gamma, cauchy, log_normal -->
<SIZE_MIN_byte>125</SIZE_MIN_byte>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>10000</EMULATION_TIME_ms> <!--0 == infinity-->
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY>
<OWD_RADIO_ACCESS>enable</OWD_RADIO_ACCESS>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>debug</LEVEL>
<VERBOSITY>medium</VERBOSITY> <!-- low, medium, high, full -->
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>LOLA_SCHED_1</PROFILE>
</OAI_EMULATION>
<!-- how to configure: talk about the convention, range -->
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>free_space</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-50</PATHLOSS_0_dB>
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>Rice1</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL>-90</RX_NOISE_LEVEL>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL>-90</RX_NOISE_LEVEL>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>500</X_m>
<Y_m>500</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<UE_INITIAL_DISTRIBUTION>random</UE_INITIAL_DISTRIBUTION> <!-- options, range -->
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>5000</EMULATION_TIME_ms>
<LOG> <!-- set the global log level -->
<LEVEL>debug</LEVEL>
</LOG>
</EMULATION_CONFIG>
<PROFILE>OCM_OMG_2</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>500</X_m>
<Y_m>500</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE> <!-- STATIC -->
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<!-- M2M: MANGO AGGREGATED TRAFFIC -->
<!-- M2M: NEWSTEO AGGREGATED TRAFFIC-->
<!-- VOIP TRAFFICS: G729 + G711-->
<!-- 1st VOIP TRAFFICS: G729 bidirectional -->
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>voip_g729</APPLICATION_TYPE>
<DESTINATION_ID>1</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<APPLICATION_TYPE>voip_g729</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
<!-- 2nd VOIP TRAFFICS: G711 bidirectional-->
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>voip_g711</APPLICATION_TYPE>
<DESTINATION_ID>1</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<APPLICATION_TYPE>voip_g711</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
<!-- 1st M2M: MANGO AGGREGATED TRAFFIC bidirectional-->
<PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<APPLICATION_TYPE>iqsim_mango</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
<BACKGROUND_TRAFFIC>disable</BACKGROUND_TRAFFIC>
</PREDEFINED_TRAFFIC>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>iqsim_mango</APPLICATION_TYPE>
<DESTINATION_ID>1</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
<!-- 2nd M2M: NEWSTEO AGGREGATED TRAFFIC bidirectional-->
<PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<APPLICATION_TYPE>iqsim_newsteo</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>iqsim_newsteo</APPLICATION_TYPE>
<DESTINATION_ID>1</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>10000</EMULATION_TIME_ms> <!--if 0 set to infinity-->
<CURVE>enable</CURVE> <!-- option: enabled, disabled. If CURVE is enabled, graphes are ploted in real time (UL and DL) of WOD and throughput measurement for each packet -->
<BACKGROUND_STATS>enable</BACKGROUND_STATS> <!-- option: enable, disable. If enable, it allows to ptrint BACKGROUND statistics: Nb packets, throughputs,etc-->
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT> <!-- option: enable, disable. If enable, throughput measurements are plotted in real time-->
<LATENCY>enable</LATENCY> <!-- option: enable, disable. If enable, latency measurements are plotted in real time-->
<OWD_RADIO_ACCESS>disable</OWD_RADIO_ACCESS> <!-- option: enable, disable. If enable owd curve shows the one way radio access delay, else it shows end to end owd -->
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OTG_2</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>500</X_m>
<Y_m>500</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<UE_INITIAL_DISTRIBUTION>random</UE_INITIAL_DISTRIBUTION>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>RWP</UE_MOBILITY_TYPE>
<UE_MOVING_DYNAMICS>
<MIN_SPEED_mps>5</MIN_SPEED_mps>
<MAX_SPEED_mps>5</MAX_SPEED_mps>
<MIN_SLEEP_ms>0.1</MIN_SLEEP_ms>
<MAX_SLEEP_ms>5.0</MAX_SLEEP_ms>
<MIN_JOURNEY_TIME_ms>0.1</MIN_JOURNEY_TIME_ms>
<MAX_JOURNEY_TIME_ms>10</MAX_JOURNEY_TIME_ms>
</UE_MOVING_DYNAMICS>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>10000</EMULATION_TIME_ms> <!--set to infinity-->
<PERFORMANCE_METRICS>
<THROUGHPUT>1</THROUGHPUT>
<LATENCY>enable</LATENCY>
<OWD_RADIO_ACCESS>enable</OWD_RADIO_ACCESS>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>medium</VERBOSITY> <!-- low, medium, high, full -->
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>0</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>eMBMS_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>100</X_m>
<Y_m>100</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<UE_INITIAL_DISTRIBUTION>random</UE_INITIAL_DISTRIBUTION>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>RWP</UE_MOBILITY_TYPE>
<GRID_WALK>
<GRID_MAP>RESTRICTED</GRID_MAP>
</GRID_WALK>
<UE_MOVING_DYNAMICS>
<MIN_SPEED_mps>0.01</MIN_SPEED_mps>
<MAX_SPEED_mps>10</MAX_SPEED_mps>
<MIN_PAUSE_TIME_ms>0.01</MIN_PAUSE_TIME_ms>
<MAX_PAUSE_TIME_ms>10</MAX_PAUSE_TIME_ms>
<MIN_JOURNEY_TIME_ms>0.01</MIN_JOURNEY_TIME_ms>
<MAX_JOURNEY_TIME_ms>10</MAX_JOURNEY_TIME_ms>
</UE_MOVING_DYNAMICS>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
<!--OMV>1</OMV-->
</TOPOLOGY_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>1000</EMULATION_TIME_ms>
</EMULATION_CONFIG>
<PROFILE>OMG_OMV</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>3.67</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-128</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>Rayleigh1</SMALL_SCALE>
</FADING>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<TRANSMISSION_MODE>6</TRANSMISSION_MODE> <!-- validavalue: 1, 2, 5, 6 -->
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>0</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS><!--this means we use an omnidirectional antenna and the following parameter is ignored-->
<BEAM_WIDTH_dB>0</BEAM_WIDTH_dB><!--3dB beam width per sector-->
<ANTENNA_GAIN_dBi>0</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>43</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>0</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>0</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>5000</X_m>
<Y_m>5000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<UE_INITIAL_DISTRIBUTION>random</UE_INITIAL_DISTRIBUTION>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>TRACE</UE_MOBILITY_TYPE>
<TRACE_MOBILITY_FILE>static_2ues.tr</TRACE_MOBILITY_FILE> <!-- file should be located at $(OPENAIR2)/UTIL/OMG/TRACE/, see README there-->
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
<!--<TRACE_MOBILITY_FILE>static_1enb.tr</TRACE_MOBILITY_FILE>--> <!-- file should be located at $(OPENAIR2)/UTIL/OMG/TRACE/, see README there-->
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<!--DL-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<DESTINATION_ID>1</DESTINATION_ID>
<IDT_DIST>fixed</IDT_DIST> <!-- option: no_customized_traffic, uniform, gaussian, exponential, poisson, fixed, weibull, pareto, gamma, cauchy, log_normal -->
<IDT_MIN_ms>10</IDT_MIN_ms>
<SIZE_DIST>fixed</SIZE_DIST> <!-- option: no_customized_traffic, uniform, gaussian, exponential, poisson, fixed, weibull, pareto, gamma, cauchy, log_normal -->
<SIZE_MIN_byte>1000</SIZE_MIN_byte>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>10000</EMULATION_TIME_ms>
<CURVE>disable</CURVE>
<PERFORMANCE_METRICS>
<THROUGHPUT>1</THROUGHPUT>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>high</VERBOSITY> <!-- low, medium, high, full -->
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>7111</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OCM_OMG_OTG_REF_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>3.67</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-128</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<TRANSMISSION_MODE>1</TRANSMISSION_MODE> <!-- validavalue: 1, 2, 5, 6 -->
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>0</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS><!--this means we use an omnidirectional antenna and the following parameter is ignored-->
<BEAM_WIDTH_dB>0</BEAM_WIDTH_dB><!--3dB beam width per sector-->
<ANTENNA_GAIN_dBi>0</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>43</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>0</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>0</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>5000</X_m>
<Y_m>5000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<UE_INITIAL_DISTRIBUTION>random</UE_INITIAL_DISTRIBUTION>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>TRACE</UE_MOBILITY_TYPE>
<TRACE_MOBILITY_FILE>static_2ues.tr</TRACE_MOBILITY_FILE> <!-- file should be located at $(OPENAIR2)/UTIL/OMG/TRACE/, see README there-->
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<!--DL-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<DESTINATION_ID>1</DESTINATION_ID>
<IDT_DIST>fixed</IDT_DIST> <!-- option: no_customized_traffic, uniform, gaussian, exponential, poisson, fixed, weibull, pareto, gamma, cauchy, log_normal -->
<IDT_MIN_ms>10</IDT_MIN_ms>
<SIZE_DIST>fixed</SIZE_DIST> <!-- option: no_customized_traffic, uniform, gaussian, exponential, poisson, fixed, weibull, pareto, gamma, cauchy, log_normal -->
<SIZE_MIN_byte>1500</SIZE_MIN_byte>
</CUSTOMIZED_TRAFFIC>
<!--UL-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<DESTINATION_ID>0</DESTINATION_ID>
<IDT_DIST>fixed</IDT_DIST> <!-- option: no_customized_traffic, uniform, gaussian, exponential, poisson, fixed, weibull, pareto, gamma, cauchy, log_normal -->
<IDT_MIN_ms>10</IDT_MIN_ms>
<SIZE_DIST>fixed</SIZE_DIST> <!-- option: no_customized_traffic, uniform, gaussian, exponential, poisson, fixed, weibull, pareto, gamma, cauchy, log_normal -->
<SIZE_MIN_byte>1000</SIZE_MIN_byte>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>10000</EMULATION_TIME_ms>
<PERFORMANCE_METRICS>
<THROUGHPUT>1</THROUGHPUT>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>medium</VERBOSITY> <!-- low, medium, high, full -->
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>7111</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OCM_OMG_OTG_REF_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>3.67</PATHLOSS_EXPONENT>
<!-- <PATHLOSS_0_dB>-100</PATHLOSS_0_dB> --> <!--pathloss at 1km -->
<PATHLOSS_0_dB>-120</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<TRANSMISSION_MODE>1</TRANSMISSION_MODE> <!-- validavalue: 1, 2, 5, 6 -->
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>0</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS><!--this means we use an omnidirectional antenna and the following parameter is ignored-->
<BEAM_WIDTH_dB>0</BEAM_WIDTH_dB><!--3dB beam width per sector-->
<ANTENNA_GAIN_dBi>0</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>15</TX_POWER_dBm><!--this is currently ignored and set in asn1_msg.c-->
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>0</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>0</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>0</TX_POWER_dBm><!--this is ignored since UE TX power is controlled by eNB-->
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>10000</X_m> //2400
<Y_m>10000</Y_m> //2400
</AREA>
<MOBILITY>
<UE_MOBILITY>
<UE_INITIAL_DISTRIBUTION>random</UE_INITIAL_DISTRIBUTION>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>TRACE</UE_MOBILITY_TYPE>
<TRACE_MOBILITY_FILE>handover.tr</TRACE_MOBILITY_FILE>
<!-- file should be located at $(OPENAIR2)/UTIL/OMG/TRACE/, see README there-->
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION> <!-- use random here and trace for the mobility to define your own positions -->
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>3</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>TRACE</eNB_MOBILITY_TYPE>
<TRACE_MOBILITY_FILE>hexagonal_eNBs.tr</TRACE_MOBILITY_FILE> <!-- file should be located at $(OPENAIR2)/UTIL/OMG/TRACE/, see README there-->
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>10000</EMULATION_TIME_ms>
<LOG> <!-- set the global log level -->
<LEVEL>debug</LEVEL>
<VERBOSITY>high</VERBOSITY> <!-- low, medium, high, full -->
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>HO_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
-
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>3.67</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-111</PATHLOSS_0_dB>
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>Rayleigh1</SMALL_SCALE>
</FADING>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<TRANSMISSION_MODE>1</TRANSMISSION_MODE>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>0</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>0</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>0</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>15</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>0</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>0</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>800</X_m>
<Y_m>800</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<UE_INITIAL_DISTRIBUTION>random</UE_INITIAL_DISTRIBUTION>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>TRACE</UE_MOBILITY_TYPE>
<TRACE_MOBILITY_FILE>static_1ue.tr</TRACE_MOBILITY_FILE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>1200</EMULATION_TIME_ms>
<CURVE>disable</CURVE>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>low</VERBOSITY> <!-- low, medium, high, full -->
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>69</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>eMBMS_OMG_REF_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2.67</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-100</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>5</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>16</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>40</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>1</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>5</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>1000</X_m>
<Y_m>1000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<UE_INITIAL_DISTRIBUTION>random</UE_INITIAL_DISTRIBUTION>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>2</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>RWP</UE_MOBILITY_TYPE>
<UE_MOVING_DYNAMICS>
<MIN_SPEED_mps>1</MIN_SPEED_mps>
<MAX_SPEED_mps>2</MAX_SPEED_mps>
<MIN_SLEEP_ms>0.1</MIN_SLEEP_ms>
<MAX_SLEEP_ms>15.0</MAX_SLEEP_ms>
</UE_MOVING_DYNAMICS>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>mcbr</APPLICATION_TYPE>
<DESTINATION_ID>1:2</DESTINATION_ID>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>6000</FLOW_DURATION_ms>
</PREDEFINED_TRAFFIC>
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1:2</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL>
<FLOW_START_ms>100</FLOW_START_ms>
<FLOW_DURATION_ms>6000</FLOW_DURATION_ms>
<IP_VERSION>ipv4</IP_VERSION>
<DESTINATION_ID>0</DESTINATION_ID>
<IDT_DIST>uniform</IDT_DIST>
<IDT_MIN_ms>10</IDT_MIN_ms>
<IDT_MAX_ms>100</IDT_MAX_ms>
<SIZE_DIST>uniform</SIZE_DIST>
<SIZE_MIN_byte>64</SIZE_MIN_byte>
<SIZE_MAX_byte>1024</SIZE_MAX_byte>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>10000</EMULATION_TIME_ms> <!--set to infinity-->
<CURVE>disable</CURVE>
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY>
<LOSS_RATE>enable</LOSS_RATE>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>low</VERBOSITY>
</LOG>
<SEED_VALUE>0</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OCM_OMG_OTG</PROFILE>
</OAI_EMULATION>
<!-- template for OAI CLI interface. To connect from local host: telnet 127.0.1.1 1352 from the remot: telnet ip@ 1352-->
<OAI_EMULATION>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>5000</X_m>
<Y_m>5000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>0</EMULATION_TIME_ms> <!--set to infinity-->
<LOG> <!-- set the global log level -->
<LEVEL>debug</LEVEL>
<VERBOSITY>high</VERBOSITY>
<INTERVAL>10</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
<CLI> <!-- start the cli server, a simple TCP server -->
<START_ENB>1</START_ENB>
<START_UE>0</START_UE>
</CLI>
</EMULATION_CONFIG>
<PROFILE>CLI</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-100</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<!-- <SYSTEM_BANDWIDTH_MB>20</SYSTEM_BANDWIDTH_MB> -->
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>5</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>16</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>40</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>1</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>5</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>500</X_m>
<Y_m>500</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>1</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>fixed</eNB_INITIAL_DISTRIBUTION>
<eNB_INITIAL_COORDINATES>
<POS_X>10</POS_X>
<POS_Y>10</POS_Y>
</eNB_INITIAL_COORDINATES>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<!-- 1st VOIP TRAFFICS: VOIP G729 bidirectional -->
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>voip_g729</APPLICATION_TYPE>
<DESTINATION_ID>1</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>1</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<APPLICATION_TYPE>voip_g729</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>10000</EMULATION_TIME_ms>
<BACKGROUND_STATS>enable</BACKGROUND_STATS>
<CURVE>enable</CURVE>
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY>
<LOSS_RATE>enable</LOSS_RATE>
<OWD_RADIO_ACESS>enable</OWD_RADIO_ACESS>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>debug</LEVEL>
<VERBOSITY>low</VERBOSITY>
</LOG>
</EMULATION_CONFIG>
<PROFILE>TEST1</PROFILE>
</OAI_EMULATION>
<!-- test OMG with sumo -->
<OAI_EMULATION>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>700</X_m>
<Y_m>700</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<UE_INITIAL_DISTRIBUTION>random</UE_INITIAL_DISTRIBUTION>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>8</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>SUMO</UE_MOBILITY_TYPE>
<UE_MOVING_DYNAMICS>
<MIN_SPEED_mps>1</MIN_SPEED_mps>
<MAX_SPEED_mps>20</MAX_SPEED_mps>
<MIN_SLEEP_ms>0.1</MIN_SLEEP_ms>
<MAX_SLEEP_ms>5.0</MAX_SLEEP_ms>
<MIN_JOURNEY_TIME_ms>0.1</MIN_JOURNEY_TIME_ms>
<MAX_JOURNEY_TIME_ms>10</MAX_JOURNEY_TIME_ms>
</UE_MOVING_DYNAMICS>
<SUMO_CONFIG>
<SUMO_CMD>sumo-gui</SUMO_CMD>
<SUMO_CONFIG_FILE>$OPENAIR2_DIR/UTIL/OMG/SUMO/SCENARIOS/traci.scen.sumo.cfg</SUMO_CONFIG_FILE>
<SUMO_START>0</SUMO_START>
<SUMO_END>10000</SUMO_END>
<SUMO_STEP>1</SUMO_STEP>
<SUMO_HOST_IP>127.0.1.1</SUMO_HOST_IP>
<SUMO_HOST_PORT>8890</SUMO_HOST_PORT>
</SUMO_CONFIG>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
<!-- <OMV>1</OMV> -->
</TOPOLOGY_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>10000</EMULATION_TIME_ms> <!--set to infinity-->
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>974930</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OMG_SUMO</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<ENVIRONMENT_SYSTEM_CONFIG>
<FADING>
<LARGE_SCALE>urban</LARGE_SCALE>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2</PATHLOSS_EXPONENT>
<PATHLOSS_0_dB>-100</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
<WALL_PENETRATION_LOSS_dB>5</WALL_PENETRATION_LOSS_dB>
<SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB>
<SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
<ANTENNA>
<eNB_ANTENNA>
<RX_NOISE_LEVEL_dB>5</RX_NOISE_LEVEL_dB>
<NUMBER_OF_SECTORS>1</NUMBER_OF_SECTORS>
<BEAM_WIDTH_dB>1.13</BEAM_WIDTH_dB>
<ANTENNA_GAIN_dBi>16</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>40</TX_POWER_dBm>
</eNB_ANTENNA>
<UE_ANTENNA>
<RX_NOISE_LEVEL_dB>1</RX_NOISE_LEVEL_dB>
<ANTENNA_GAIN_dBi>5</ANTENNA_GAIN_dBi>
<TX_POWER_dBm>20</TX_POWER_dBm>
</UE_ANTENNA>
</ANTENNA>
</ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>2000</X_m>
<Y_m>2000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>2</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>1:2</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
<!-- UL -->
<!-- <PREDEFINED_TRAFFIC>
<SOURCE_ID>1</SOURCE_ID>
<FLOW_START_ms>200</FLOW_START_ms>
<FLOW_DURATION_ms>600</FLOW_DURATION_ms>
<APPLICATION_TYPE>scbr</APPLICATION_TYPE>
<DESTINATION_ID>0</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
-->
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1:2</SOURCE_ID>
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL>
<FLOW_START_ms>0</FLOW_START_ms>
<FLOW_DURATION_ms>55000</FLOW_DURATION_ms>
<IP_VERSION>ipv4</IP_VERSION>
<DESTINATION_ID>0</DESTINATION_ID>
<IDT_DIST>uniform</IDT_DIST>
<IDT_MIN_ms>100</IDT_MIN_ms>
<IDT_MAX_ms>1000</IDT_MAX_ms>
<SIZE_DIST>uniform</SIZE_DIST>
<SIZE_MIN_byte>100</SIZE_MIN_byte>
<SIZE_MAX_byte>1000</SIZE_MAX_byte>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>60000</EMULATION_TIME_ms> <!--set to infinity-->
<CURVE>disable</CURVE>
<PERFORMANCE_METRICS>
<THROUGHPUT>enable</THROUGHPUT>
<LATENCY>enable</LATENCY>
<LOSS_RATE>enable</LOSS_RATE>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>info</LEVEL>
<VERBOSITY>low</VERBOSITY>
</LOG>
<SEED_VALUE>2013</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROTOCOL>
<MAC>
<NUM_GROUPS>10</NUM_GROUPS>
</MAC>
</PROTOCOL>
<PROFILE>CBA_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>5000</X_m>
<Y_m>5000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>4</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID> <!-- valid formats are: -->
<APPLICATION_TYPE>mcbr</APPLICATION_TYPE> <!-- OPTIONS: scbr,mcbr,bcbr, gaming_OA, gaming_TF, m2m_AP, m2m_BR, , random, ,full_buffer -->
<DESTINATION_ID>1:3</DESTINATION_ID> <!-- valid formats are: -->
</PREDEFINED_TRAFFIC>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>1:3</SOURCE_ID> <!-- valid formats are: -->
<APPLICATION_TYPE>scbr</APPLICATION_TYPE> <!-- OPTIONS: scbr,mcbr,bcbr, gaming_OA, gaming_TF, m2m_AP, m2m_BR, , random, ,full_buffer -->
<DESTINATION_ID>1:3</DESTINATION_ID> <!-- valid formats are: -->
</PREDEFINED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>30000</EMULATION_TIME_ms> <!--set to infinity-->
<PERFORMANCE_METRICS>
<THROUGHPUT>1</THROUGHPUT>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>debug</LEVEL>
<VERBOSITY>medium</VERBOSITY>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OTG_1</PROFILE>
</OAI_EMULATION>
<OAI_EMULATION>
<TOPOLOGY_CONFIG>
<AREA>
<X_m>5000</X_m>
<Y_m>5000</Y_m>
</AREA>
<MOBILITY>
<UE_MOBILITY>
<RANDOM_UE_DISTRIBUTION>
<NUMBER_OF_NODES>3</NUMBER_OF_NODES>
</RANDOM_UE_DISTRIBUTION>
<UE_MOBILITY_TYPE>STATIC</UE_MOBILITY_TYPE>
</UE_MOBILITY>
<eNB_MOBILITY>
<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
<RANDOM_eNB_DISTRIBUTION>
<NUMBER_OF_CELLS>1</NUMBER_OF_CELLS>
</RANDOM_eNB_DISTRIBUTION>
<eNB_MOBILITY_TYPE>STATIC</eNB_MOBILITY_TYPE>
</eNB_MOBILITY>
</MOBILITY>
</TOPOLOGY_CONFIG>
<APPLICATION_CONFIG>
<PREDEFINED_TRAFFIC>
<SOURCE_ID>0</SOURCE_ID>
<APPLICATION_TYPE>gaming_OA</APPLICATION_TYPE> <!-- OPTIONS: scbr,mcbr,bcbr, gaming_OA, gaming_TF, m2m_AP, m2m_BR, , random, ,full_buffer -->
<DESTINATION_ID>3</DESTINATION_ID>
</PREDEFINED_TRAFFIC>
<CUSTOMIZED_TRAFFIC>
<SOURCE_ID>1:3</SOURCE_ID> <!-- <SOURCE_ID> 1:100 </SOURCE_ID> -->
<TRANSPORT_PROTOCOL>udp</TRANSPORT_PROTOCOL> <!-- OPTIONS: tcp (default), udp -->
<IP_VERSION>ipv6</IP_VERSION> <!-- OPTIONS: ipv4 (default), ipv6 -->
<DESTINATION_ID>0</DESTINATION_ID>
<IDT_DIST>gaussian</IDT_DIST> <!-- OPTIONS: no_transmission (default), uniform, poission, gaussian, exponential,pareto, cauchy,fixed, weibull, gamma,-->
<IDT_MIN_ms>100</IDT_MIN_ms>
<IDT_MAX_ms>1000</IDT_MAX_ms>
<IDT_STANDARD_DEVIATION>4.5</IDT_STANDARD_DEVIATION>
<SIZE_DIST>pareto</SIZE_DIST> <!-- similar for weibull and cauchy and gamma-->
<SIZE_SCALE>0.5</SIZE_SCALE>
<SIZE_SHAPE>30</SIZE_SHAPE>
</CUSTOMIZED_TRAFFIC>
</APPLICATION_CONFIG>
<EMULATION_CONFIG>
<EMULATION_TIME_ms>5000</EMULATION_TIME_ms> <!--set to infinity-->
<PERFORMANCE_METRICS>
<THROUGHPUT>1</THROUGHPUT>
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
<LEVEL>debug</LEVEL>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>1234</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
</EMULATION_CONFIG>
<PROFILE>OTG_2</PROFILE>
</OAI_EMULATION>
#ifdef cygwin
#cyg=cygwin
#endif
help:
@echo "make one_eNB_two_UE_nas: compiles the code and performs a simulation with IP traffic between two virtual nodes (Linux only)"
@echo "make one_eNB_one_UE: compiles the code and performs a small simulation (30 frames) with 1 eNB and 1 UE and checks that RLC data is transported between the two nodes after the connection setup"
@echo "make one_eNB_four_UE: comples the code and performs a small simulation (60 frames) with 1 eNB and 4 UE and checks that all 4 UEs have established a complete connection (RRC output is traced)"
@echo "make clean: Removes all .o files"
all: help
oaisim:
(cd $(OPENAIR_TARGETS)/SIMU/USER && $(MAKE) oaisim LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 DEBUG=1)
oaisim_nas:
(cd $(OPENAIR_TARGETS)/SIMU/USER && $(MAKE) oaisim OAI_NW_DRIVER_TYPE_ETHERNET=1 LINK_ENB_PDCP_TO_IP_DRIVER=1)
nasmesh:
(cd $(OPENAIR2_DIR) && make nasmesh_netlink_address_fix.ko)
(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && make)
one_eNB_one_UE_nas: oaisim_nas nasmesh
./start_one_eNB_multi_UE_nas 1
one_eNB_two_UE_nas: oaisim_nas nasmesh
./start_one_eNB_multi_UE_nas 2
one_eNB_three_UE_nas: oaisim_nas nasmesh
./start_one_eNB_multi_UE_nas 3
one_eNB_one_UE : oaisim
../../USER/oaisim -n30 | egrep SEND_SDU
one_eNB_four_UE : oaisim
../../USER/oaisim -n60 -u4 | egrep "\[RRC\]"
one_eNB_one_UE_PHY : oaisim_nas nasmesh
./start_one_eNB_two_UE_PHY_nas 2
clean:
(cd $(OPENAIR_TARGETS)/SIMU/USER && make clean)
echo_vars:
echo $(OPENAIR1_DIR)
echo $(OPENAIR2_DIR)
echo $(OPENAIR3_DIR)
echo $(OPENAIR_TARGETS)
#!/bin/sh
echo "Bringup eNB interface"
sudo rmmod nasmesh
sudo insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
#sudo route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
sudo ip route add 224.0.0.160/28 dev eth0
echo "bring up oai0 interface for enb"
sudo ifconfig oai0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255
echo "bring up oai1 interface for ue 1"
sudo ifconfig oai1 10.0.2.2 netmask 255.255.255.0 broadcast 10.0.2.255
# enb -> ue1
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s 10.0.1.1 -t 10.0.1.2 -r 1
# ue1 -> enb
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i1 -z0 -s 10.0.2.2 -t 10.0.2.1 -r 1
if [ $1 -ge 2 ]; then
echo "bring up oai2 interface for ue 2"
sudo ifconfig oai2 10.0.3.3 netmask 255.255.255.0 broadcast 10.0.3.255
# enb -> ue2
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c1 -i0 -z0 -s 10.0.1.1 -t 10.0.1.3 -r 12
# ue2 -> enb
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c1 -i2 -z0 -s 10.0.3.3 -t 10.0.3.1 -r 1
fi
if [ $1 -ge 3 ]; then
echo "bring up oai3 interface for ue 3"
sudo ifconfig oai3 10.0.4.4 netmask 255.255.255.0 broadcast 10.0.4.255
# enb -> ue2
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c2 -i0 -z0 -s 10.0.1.1 -t 10.0.1.4 -r 23
# ue2 -> enb
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c2 -i3 -z0 -s 10.0.4.4 -t 10.0.4.1 -r 1
fi
if [ $1 -ge 4 ]; then
echo "add oai interfaces for more UEs here"
fi
echo "start the emulation with 1eNB and" $1 "UE"
echo "$OPENAIR_TARGETS/SIMU/USER/oaisim -a -V -u" $1 ">/dev/null"
$OPENAIR_TARGETS/SIMU/USER/oaisim -a -V -u $1 > /dev/null
echo "End"
#!/bin/sh
echo "Bringup eNB interface"
sudo rmmod nasmesh
sudo insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
#sudo route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
sudo ip route add 224.0.0.160/28 dev eth0
echo "bring up oai0 interface for enb"
sudo ifconfig oai0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255
echo "bring up oai1 interface for ue 1"
sudo ifconfig oai1 10.0.2.2 netmask 255.255.255.0 broadcast 10.0.2.255
# enb -> ue1
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s 10.0.1.1 -t 10.0.1.2 -r 1
# ue1 -> enb
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i1 -z0 -s 10.0.2.2 -t 10.0.2.1 -r 1
if [ $1 -ge 2 ]; then
echo "bring up oai2 interface for ue 2"
sudo ifconfig oai2 10.0.3.3 netmask 255.255.255.0 broadcast 10.0.3.255
# enb -> ue2
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c1 -i0 -z0 -s 10.0.1.1 -t 10.0.1.3 -r 12
# ue2 -> enb
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c1 -i2 -z0 -s 10.0.3.3 -t 10.0.3.1 -r 1
fi
if [ $1 -ge 3 ]; then
echo "bring up oai3 interface for ue 3"
sudo ifconfig oai3 10.0.4.4 netmask 255.255.255.0 broadcast 10.0.4.255
# enb -> ue2
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c2 -i0 -z0 -s 10.0.1.1 -t 10.0.1.4 -r 23
# ue2 -> enb
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c2 -i3 -z0 -s 10.0.4.4 -t 10.0.4.1 -r 1
fi
if [ $1 -ge 4 ]; then
echo "add oai interfaces for more UEs here"
fi
echo "start the emulation with 1eNB and 2 UE"
echo "$OPENAIR_TARGETS/SIMU/USER/oaisim -c40 > /dev/null"
$OPENAIR_TARGETS/SIMU/USER/oaisim -c40 > /dev/null
echo "End"
all: oaisim naslite_netlink_ether
oaisim:
(cd $(OPENAIR_TARGETS)/SIMU/USER && $(MAKE) oaisim OAI_NW_DRIVER_TYPE_ETHERNET=1 LINK_ENB_PDCP_TO_IP_DRIVER=1)
naslite_netlink_ether:
(cd $(OPENAIR2_DIR) && $(MAKE) naslite_netlink_ether.ko)
(cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE/RB_TOOL/ && $(MAKE))
userclean: clean oaisim naslite_netlink_ether
one_eNB_one_UE_nas: oaisim naslite_netlink_ether
/bin/bash ./start_one_eNB_multi_UE_nas 1
one_eNB_two_UE_nas: oaisim naslite_netlink_ether
/bin/bash ./start_one_eNB_multi_UE_nas 2
one_eNB_three_UE_nas: oaisim naslite_netlink_ether
/bin/bash ./start_one_eNB_multi_UE_nas 3
clean:
(cd $(OPENAIR_TARGETS)/SIMU/USER && $(MAKE) clean)
(cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE && $(MAKE) clean)
echo_vars:
echo $(OPENAIR1_DIR)
echo $(OPENAIR2_DIR)
echo $(OPENAIR3_DIR)
echo $(OPENAIR_TARGETS)
#!/bin/bash
echo "Bash version ${BASH_VERSION}..."
declare GENERATE_SEQ_DIAGRAM="no"
declare LOG_FILE_LTE="no"
#------------------------------------------------
declare MAKE_IP_DRIVER_TARGET="naslite_netlink_ether"
declare MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim"
declare IP_DRIVER_NAME="oai_nw_drv"
#------------------------------------------------
declare -a NAS_IMEI=( 3 9 1 8 3 6 6 2 0 0 0 0 0 0 )
# first value is for ENB, then UE0, UE1, etc.
declare -a MARKING=( 1 2 3 4 5 6 7 8 9 10 11 12 14 15 16 )
# BE CAREFULL MAY NOT WORK WITH OTHER VALUES (TO DO)
declare -i NUM_ENB=1
#------------------------------------------------
# Notes:
# We would like to remove the ipv4 addresses swap in the IP driver code for oai virtualized.
# Let's say oai0 has ipv4 @ 10.0.1.1, oai1 has ipv4 @ 10.0.2.2 etc.
# In the past when we generated some local traffic on the computer and wanted to make it go
# through for example oai1 to oai0, the ipv4 destination address was 10.0.2.1
# meaning 10.0.2.2 wants to send a paquet to 10.0.1.1,
# so ip_destination[2] has the digit corresponding to the source
# so ip_destination[3] has the digit corresponding to the destination
# then in the driver we modified at the receiving side (oai0 here) the ip source and destination
# addresses in this way:
# Originating packet: SRC 10.0.X.X -> 10.0.2.1
# Resulting modified packet at the receiving side: SRC 10.0.1.2 -> 10.0.1.1
# So the packet could be accepted by the device (same dest @) and the fake source was was recorded (1.2).
# So the response to this packet could return to the interface by where the request was pulled.
# But this solution lead to recompute checksums of packets in the driver.
#
# So here we describe a solution where packets are not modified by the IP driver but by the kernel:
#
# +---------------+ +---------------+ +---------------+
# |APP "VIRTUALLY"| |APP "VIRTUALLY"| |APP "VIRTUALLY"| etc
# |running on eNB | |running on UE0 | |running on UE1 |
# |sending traffic| | | | |
# | to UE 1 | | | | |
# +---------------+ +---------------+ +---------------+
# | ^ | ^ | ^
# | | | | | |
# Tx packet (n1) | | | Tx packet (n2) |
# XXXX->10.0.1.3 | | | XXXX->10.0.1.3 |
# | | | | | |
# | Rx packet (n2) | | | Rx packet (n1)
# | 10.0.1.3->10.0.1.1 | | | 10.0.3.1->10.0.3.3
# V | V | V |
# +-----------------------------------------------------------------------------+
# | IPTABLES Table mangle chain OUTPUT TARGET MARK OPERATION setmark |
# | On packets coming from applications |
# |-----------------------------------------------------------------------------|
# | Example for packet n1: |
# | iptables -t mangle -A OUTPUT --dst 10.0.1.3 -j MARK --set-mark 0x0103 |
# +-----------------------------------------------------------------------------+
# | | | | | |
# Tx packet (n1) | | | | |
# XXXX->10.0.1.3 | | | | |
# mark 0x0103 | | | | |
# | | | | | |
# V | V | V |
# +-----------------------------------------------------------------------------+
# | IPTABLES Table nat chain POSTROUTING TARGET SNAT OPERATION --to Fake IP SRC|
# | On packets coming from applications |
# |-----------------------------------------------------------------------------|
# | Example for packet n1: |
# | iptables -t nat -A POSTROUTING -m mark --mark 0x0103 -j SNAT --to 10.0.3.1 |
# +-----------------------------------------------------------------------------+
# | | | | | |
# | | | | | Rx packet (n1)
# | | | | | 10.0.3.1->10.0.3.3
# | | | | | mark 0x0103
# | | | | | |
# +-----------------------------------------------------------------------------+
# | IPTABLES Table mangle chain PREROUTING TARGET MARK OPERATION setmark |
# | On packets coming from applications |
# |-----------------------------------------------------------------------------|
# | Example for packet n1: |
# | iptables -t nat -A PREROUTING -m mark --mark 0x0103 -j DNAT --to 10.0.3.3 |
# +-----------------------------------------------------------------------------+
# | ^ | ^ | ^
# | | | | | |
# Tx packet (n1) | | | | Rx packet (n1)
# 10.0.3.1->10.0.1.3 | | | 10.0.3.1->10.0.1.3
# mark 0x0103 | | | | mark 0x0103
# | | | | | |
# +-----------------------------------------------------------------------------+
# | IPTABLES Table mangle chain PREROUTING TARGET MARK OPERATION setmark |
# | On packets coming from applications |
# |-----------------------------------------------------------------------------|
# | Example for packet n1: |
# | iptables -t mangle -A PREROUTING --dst 10.0.1.3 -j MARK --set-mark 0x0103 |
# +-----------------------------------------------------------------------------+
# | ^ | ^ | ^
# | | | | | Rx packet (n1)
# | | | | | 10.0.3.1->10.0.1.3
# | | | | | |
# |10.0.1.1| |10.0.2.2| |10.0.3.3|
# V | V | V |
# +----------+ +----------+ +----------+
# | oai0 | | oai1 | | oai2 |
# | (eNB) | | (UE0) | | (UE1) |
# +----------+ +----------+ +----------+
####################################################################################
# HERE IS A DISPLAY OF THE CONTENT OF THE NAT TABLE FOR THE DESCRIBED SETTING
####################################################################################
# Chain PREROUTING (policy ACCEPT 1108 packets, 242K bytes)
# pkts bytes target prot opt in out source destination
# 0 0 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x102 to:10.0.2.2
# 0 0 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x103 to:10.0.3.3
# 0 0 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x201 to:10.0.1.1
# 0 0 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x203 to:10.0.3.3
# 0 0 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x301 to:10.0.1.1
# 0 0 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x302 to:10.0.2.2
#
# Chain POSTROUTING (policy ACCEPT 2118 packets, 175K bytes)
# pkts bytes target prot opt in out source destination
# 0 0 SNAT all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x102 to:10.0.2.1
# 0 0 SNAT all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x103 to:10.0.3.1
# 0 0 SNAT all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x201 to:10.0.1.2
# 0 0 SNAT all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x203 to:10.0.3.2
# 0 0 SNAT all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x301 to:10.0.1.3
# 0 0 SNAT all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x302 to:10.0.2.3
#
# Chain OUTPUT (policy ACCEPT 2133 packets, 186K bytes)
# pkts bytes target prot opt in out source destination
####################################################################################
# HERE IS A DISPLAY OF THE CONTENT OF THE MANGLE TABLE FOR THE DESCRIBED SETTING
####################################################################################
#root@hades:~# iptables -t mangle -nvL
# Chain PREROUTING (policy ACCEPT 2008K packets, 316M bytes)
# pkts bytes target prot opt in out source destination
# 0 0 MARK all -- * * 0.0.0.0/0 10.0.1.2 MARK xset 0x102/0xffffffff
# 0 0 MARK all -- * * 0.0.0.0/0 10.0.1.3 MARK xset 0x103/0xffffffff
# 0 0 MARK all -- * * 0.0.0.0/0 10.0.2.1 MARK xset 0x201/0xffffffff
# 0 0 MARK all -- * * 0.0.0.0/0 10.0.2.3 MARK xset 0x203/0xffffffff
# 0 0 MARK all -- * * 0.0.0.0/0 10.0.3.1 MARK xset 0x301/0xffffffff
# 0 0 MARK all -- * * 0.0.0.0/0 10.0.3.2 MARK xset 0x302/0xffffffff
#
# Chain INPUT (policy ACCEPT 2008K packets, 316M bytes)
# pkts bytes target prot opt in out source destination
#
# Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
# pkts bytes target prot opt in out source destination
#
# Chain OUTPUT (policy ACCEPT 1989K packets, 331M bytes)
# pkts bytes target prot opt in out source destination
# 0 0 MARK all -- * * 0.0.0.0/0 10.0.1.2 MARK xset 0x102/0xffffffff
# 0 0 MARK all -- * * 0.0.0.0/0 10.0.1.3 MARK xset 0x103/0xffffffff
# 0 0 MARK all -- * * 0.0.0.0/0 10.0.2.1 MARK xset 0x201/0xffffffff
# 0 0 MARK all -- * * 0.0.0.0/0 10.0.2.3 MARK xset 0x203/0xffffffff
# 0 0 MARK all -- * * 0.0.0.0/0 10.0.3.1 MARK xset 0x301/0xffffffff
# 0 0 MARK all -- * * 0.0.0.0/0 10.0.3.2 MARK xset 0x302/0xffffffff
#
# Chain POSTROUTING (policy ACCEPT 1990K packets, 331M bytes)
# pkts bytes target prot opt in out source destination
#
####################################################################################
# We also avoid the manipulation of ipv4 ARP packets by setting ourselves the neighbour cache:
####################################################################################
#root@hades:~# ip neigh show
#...
#10.0.3.1 dev oai1 lladdr 00:39:18:36:62:00 PERMANENT
#10.0.2.1 dev oai1 lladdr 00:39:18:36:62:00 PERMANENT
#10.0.1.1 dev oai1 lladdr 00:39:18:36:62:00 PERMANENT
#...
#10.0.1.2 dev oai0 lladdr 00:39:18:36:62:01 PERMANENT
#10.0.2.2 dev oai0 lladdr 00:39:18:36:62:01 PERMANENT
#10.0.3.2 dev oai0 lladdr 00:39:18:36:62:01 PERMANENT
#...
#10.0.1.3 dev oai0 lladdr 00:39:18:36:62:02 PERMANENT
#10.0.2.3 dev oai0 lladdr 00:39:18:36:62:02 PERMANENT
#10.0.3.3 dev oai0 lladdr 00:39:18:36:62:02 PERMANENT
#
###########################################################
IPTABLES=/sbin/iptables
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
declare -x OPENAIR_DIR=""
declare -x OPENAIR1_DIR=""
declare -x OPENAIR2_DIR=""
declare -x OPENAIR3_DIR=""
declare -x OPENAIR_TARGETS=""
###########################################################
black='\E[30m'
red='\E[31m'
green='\E[32m'
yellow='\E[33m'
blue='\E[34m'
magenta='\E[35m'
cyan='\E[36m'
white='\E[37m'
ROOT_UID=0
E_NOTROOT=67
cecho() # Color-echo
# arg1 = message
# arg2 = color
{
local default_msg="No Message."
message=${1:-$default_msg}
color=${2:-$black}
echo -e "$color"
echo -n "$message"
tput sgr0
echo
return
}
echo_error() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
done
cecho "$my_string" $red
}
echo_warning() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
done
cecho "$my_string" $yellow
}
echo_success() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
done
cecho "$my_string" $green
}
set_openair() {
path=`pwd`
declare -i length_path
declare -i index
length_path=${#path}
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
#echo ${path%$token*}
if [[ $index -lt $length_path && index -gt 0 ]]
then
declare -x OPENAIR_DIR
index=`expr $index - 1`
openair_path=`echo $path | cut -c1-$index`
#openair_path=`echo ${path:0:$index}`
export OPENAIR_DIR=$openair_path
export OPENAIR1_DIR=$openair_path/openair1
export OPENAIR2_DIR=$openair_path/openair2
export OPENAIR3_DIR=$openair_path/openair3
export OPENAIR_TARGETS=$openair_path/targets
return 0
fi
return -1
}
bash_exec() {
output=$($1 2>&1)
result=$?
if [ $result -eq 0 ]
then
echo_success "$1"
else
echo_error "$1: $output"
fi
}
wait_process_started () {
if [ -z "$1" ]
then
echo_error "WAITING FOR PROCESS START: NO PROCESS"
return 1
fi
ps -C $1 > /dev/null 2>&1
while [ $? -ne 0 ]; do
echo_warning "WAITING FOR $1 START"
sleep 2
ps -C $1 > /dev/null 2>&1
done
echo_success "PROCESS $1 STARTED"
return 0
}
assert() {
# If condition false
# exit from script with error message
E_PARAM_ERR=98
E_PARAM_FAILED=99
if [ -z "$2" ] # Not enought parameters passed.
then
return $E_PARAM_ERR
fi
lineno=$2
if [ ! $1 ]
then
echo "Assertion failed: \"$1\""
echo "File \"$0\", line $lineno"
exit $E_ASSERT_FAILED
fi
}
ctrl_c() {
bash_exec "pkill oaisim"
bash_exec "ip link set $LTEIF down"
bash_exec "rmmod $IP_DRIVER_NAME"
bash_exec "$IPTABLES -P INPUT ACCEPT"
bash_exec "$IPTABLES -F INPUT"
bash_exec "$IPTABLES -P OUTPUT ACCEPT"
bash_exec "$IPTABLES -F OUTPUT"
bash_exec "$IPTABLES -P FORWARD ACCEPT"
bash_exec "$IPTABLES -F FORWARD"
bash_exec "$IPTABLES -t nat -F"
bash_exec "$IPTABLES -t mangle -F"
bash_exec "$IPTABLES -t filter -F"
bash_exec "ip route flush cache"
}
set_openair
cecho "OPENAIR_DIR = $OPENAIR_DIR" $green
cecho "OPENAIR1_DIR = $OPENAIR1_DIR" $green
cecho "OPENAIR2_DIR = $OPENAIR2_DIR" $green
cecho "OPENAIR3_DIR = $OPENAIR3_DIR" $green
cecho "OPENAIR_TARGETS = $OPENAIR_TARGETS" $green
declare -i NUM_MOBILES
declare -i INSTANCE
declare -i IP_SOURCE
declare -i IP_DEST
declare -i IP
declare -i RB_ID
declare -i CLASSIFIER_ID
trap ctrl_c INT
bash_exec "ip route flush cache"
bash_exec "$IPTABLES -P INPUT ACCEPT"
bash_exec "$IPTABLES -F INPUT"
bash_exec "$IPTABLES -P OUTPUT ACCEPT"
bash_exec "$IPTABLES -F OUTPUT"
bash_exec "$IPTABLES -P FORWARD DROP"
bash_exec "$IPTABLES -F FORWARD"
bash_exec "$IPTABLES -t nat -F"
bash_exec "$IPTABLES -t mangle -F"
bash_exec "$IPTABLES -t filter -F"
NUM_MOBILES=$1
for ((i=0 ; i < `expr $NUM_MOBILES + $NUM_ENB`; i++ ))
do
TEST_OAI=`/sbin/ifconfig | grep oai$i | awk '{print $1}'`
if [ "$TEST_OAI" = oai"$i"x ]; then
bash_exec "ip link set oai$i down"
fi
done
echo "Bringup OAI network interfaces"
bash_exec "rmmod $IP_DRIVER_NAME"
cecho "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET....." $green
bash_exec "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET"
bash_exec "insmod $OPENAIR2_DIR/NAS/DRIVER/LITE/$IP_DRIVER_NAME.ko oai_nw_drv_IMEI=${NAS_IMEI[0]},${NAS_IMEI[1]},${NAS_IMEI[2]},${NAS_IMEI[3]},${NAS_IMEI[4]},${NAS_IMEI[5]},${NAS_IMEI[6]},${NAS_IMEI[7]},${NAS_IMEI[8]},${NAS_IMEI[9]},${NAS_IMEI[10]},${NAS_IMEI[11]},${NAS_IMEI[12]},${NAS_IMEI[13]}"
NUM_MOBILES=$1
IP=1
########################
# #
# CONFIGURE OAI IF #
# #
########################
for ((i=0 ; i < `expr $NUM_MOBILES + $NUM_ENB`; i++ ))
do
bash_exec "ip link set oai$i broadcast ff:ff:ff:ff:ff:ff"
bash_exec "ip link set oai$i up"
sleep 1
bash_exec "ifconfig oai$i 10.0.$IP.$IP netmask 255.255.255.0 broadcast 10.0.$IP.255"
sleep 1
bash_exec "ip addr add dev oai$i 2001:$IP::$IP/64"
# avoid arp in virtualization
for ((j=0 ; j <= $NUM_MOBILES ; j++ ))
do
if [[ $i -ne $j ]]
then
bash_exec "ip neighbour add to 10.0.$IP.$IP lladdr 00:${NAS_IMEI[0]}${NAS_IMEI[1]}:${NAS_IMEI[2]}${NAS_IMEI[3]}:${NAS_IMEI[4]}${NAS_IMEI[5]}:${NAS_IMEI[6]}${NAS_IMEI[7]}:${NAS_IMEI[8]}$i nud permanent dev oai$j"
fi
done
let IP=IP+1
done
for ((src=0 ; src < `expr $NUM_ENB + $NUM_MOBILES` ; src++))
do
let IP_SRC=$src+1
for ((dst=0 ; dst < `expr $NUM_ENB + $NUM_MOBILES` ; dst++))
do
if [[ $src -ne $dst ]]
then
let IP_DST=$dst+1
let marksrc=${MARKING[$src]}
marksrc16=`printf '%02x' $marksrc`
let markdst=${MARKING[$dst]}
markdst16=`printf '%02x' $markdst`
bash_exec "iptables -t mangle -A OUTPUT --dst 10.0.$IP_SRC.$IP_DST -j MARK --set-mark 0x$marksrc16$markdst16"
bash_exec "iptables -t nat -A POSTROUTING -m mark --mark 0x$marksrc16$markdst16 -j SNAT --to 10.0.$IP_DST.$IP_SRC"
# we can use same mark since not same path (PREROUTING)
bash_exec "iptables -t mangle -A PREROUTING --dst 10.0.$IP_SRC.$IP_DST -j MARK --set-mark 0x$marksrc16$markdst16"
bash_exec "iptables -t nat -A PREROUTING -m mark --mark 0x$marksrc16$markdst16 -j DNAT --to 10.0.$IP_DST.$IP_DST"
fi
done
done
echo "########################################################################################"
echo "# IPTABLES MANGLE #"
echo "########################################################################################"
iptables -t mangle -nvL
echo "########################################################################################"
echo "# IPTABLES NAT #"
echo "########################################################################################"
iptables -t nat -nvL
########################
# #
# CONFIGURE RABS #
# #
########################
# Loop Cx 0 -> NUM_MOBILES - 1 for configuring default RABS on eNB
CLASSIFIER_ID=4
for ((instance=0 ; instance < $NUM_ENB ; instance++ ))
do
let IP_SRC=instance+1
for ((cx=0 ; cx < $NUM_MOBILES ; cx++ ))
do
let IP_DEST=cx+2
if [[ $IP_SRC -ne $IP_DEST ]]
then
# ON eNB
let RB_ID=(cx*8)+3
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c$cx -i$instance -f$CLASSIFIER_ID -z0 -s 10.0.$IP_DEST.$IP_SRC/32 -t 10.0.$IP_SRC.$IP_DEST/32 -r $RB_ID"
let CLASSIFIER_ID=CLASSIFIER_ID+2
# ON UE
let IP_SOURCE=instance+1
let instance_ue=cx+$NUM_ENB
RB_ID=3
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c$instance -i$instance_ue -f$CLASSIFIER_ID -z0 -s 10.0.$IP_SRC.$IP_DEST/32 -t 10.0.$IP_DEST.$IP_SRC/32 -r $RB_ID"
let CLASSIFIER_ID=CLASSIFIER_ID+2
# ON eNB
bash_exec "ip neighbour add to 10.0.$IP_SRC.$IP_DEST lladdr 00:${NAS_IMEI[0]}${NAS_IMEI[1]}:${NAS_IMEI[2]}${NAS_IMEI[3]}:${NAS_IMEI[4]}${NAS_IMEI[5]}:${NAS_IMEI[6]}${NAS_IMEI[7]}:${NAS_IMEI[8]}$instance_ue nud permanent dev oai$instance"
# ON UE
bash_exec "ip neighbour add to 10.0.$IP_DEST.$IP_SRC lladdr 00:${NAS_IMEI[0]}${NAS_IMEI[1]}:${NAS_IMEI[2]}${NAS_IMEI[3]}:${NAS_IMEI[4]}${NAS_IMEI[5]}:${NAS_IMEI[6]}${NAS_IMEI[7]}:${NAS_IMEI[8]}$instance nud permanent dev oai$instance_ue"
fi
done
done
IP=1
for ((i=0 ; i < `expr $NUM_MOBILES + $NUM_ENB`; i++ ))
do
# avoid arp in virtualization
for ((j=0 ; j <= $NUM_MOBILES ; j++ ))
do
if [[ $i -ne $j ]]
then
bash_exec "ip neighbour add to 10.0.$IP.$IP lladdr 00:${NAS_IMEI[0]}${NAS_IMEI[1]}:${NAS_IMEI[2]}${NAS_IMEI[3]}:${NAS_IMEI[4]}${NAS_IMEI[5]}:${NAS_IMEI[6]}${NAS_IMEI[7]}:${NAS_IMEI[8]}$i nud permanent dev oai$j"
fi
done
let IP=IP+1
done
# echo "start the emulation with 1eNB and" $1 "UE"
if [ "$GENERATE_SEQ_DIAGRAM"x = yesx ]; then
if [ -e /tmp/msc_log.txt ]; then
bash_exec "rm -f /tmp/msc_log.txt"
fi
if [ "$LOG_FILE_LTE"x = yesx ]; then
if [ -e /tmp/lte_log.txt ]; then
bash_exec "rm -f /tmp/lte_log.txt"
fi
$OPENAIR_TARGETS/SIMU/USER/oaisim -a -u $1 > /tmp/lte_log.txt
chmod 777 /tmp/lte_log.txt
cat /tmp/lte_log.txt | grep MSC_ > /tmp/msc_log.txt
else
$OPENAIR_TARGETS/SIMU/USER/oaisim -a -u $1 | grep MSC_ > /tmp/msc_log.txt
fi
chmod 777 /tmp/msc_log.txt
echo "End of emulation, now generating sequence diagrams..."
$OPENAIR_TARGETS/SCRIPTS/msc_gen.py /tmp/msc_log.txt
else
if [ "$LOG_FILE_LTE"x = yesx ]; then
if [ -e /tmp/lte_log.txt ]; then
bash_exec "rm -f /tmp/lte_log.txt"
fi
$OPENAIR_TARGETS/SIMU/USER/oaisim -a -u $1 > /tmp/lte_log.txt
chmod 777 /tmp/lte_log.txt
else
$OPENAIR_TARGETS/SIMU/USER/oaisim -a -u $1 -F -P wireshark > /tmp/lte_log.txt
fi
echo "End of emulation"
fi
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include "SIMULATION/TOOLS/defs.h"
#include "SIMULATION/RF/defs.h"
#include "PHY/types.h"
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "MAC_INTERFACE/extern.h"
#ifdef OPENAIR2
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/extern.h"
#include "PHY_INTERFACE/extern.h"
#endif
#include "../USER/oaisim.h"
#include "channel_sim_proc.h"
#include "interface.h"
#include "Tsync.h"
#include "Process.h"
#define FILENAMEMAX 255
//#define DEBUG_SIM
void Process_Func(int node_id,int port,double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im,
node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms)
{
if(node_id<MAX_eNB)
eNB_Inst(node_id,port,r_re0,r_im0,r_re,r_im,s_re,s_im,enb_data,abstraction_flag,frame_parms);
else
UE_Inst(node_id,port,r_re0,r_im0,r_re,r_im,s_re,s_im,ue_data,abstraction_flag,frame_parms);
}
void UE_Inst(int node_id,int port,double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im,
node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms)
{
int next_slot,last_slot,slot=0,UE_id=0,eNB_id=0;
lte_subframe_t direction;
printf("UE [ %d ] Starts \n",node_id-MAX_eNB);
// init_mmap(node_id,frame_parms, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0);
init_channel_vars (frame_parms, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0);
mmap_ue(node_id,&PHY_vars_UE_g[0]->lte_ue_common_vars.txdata,&PHY_vars_UE_g[0]->lte_ue_common_vars.rxdata,frame_parms);
// Interface_init(port,node_id);
char p_input[FILENAMEMAX];
int fd_pipe;
int fd_channel;
mkfifo("/tmp/channel", 0666);
fd_channel=open("/tmp/channel",O_RDWR,0);
sprintf(p_input,"/tmp/pipe_%d",node_id);
mkfifo(p_input, 0666);
fd_pipe=open(p_input,O_RDWR,0);
// IntInitAll();
mac_xface->frame=0;
while(1) {
// wait_4slot(&slot,&mac_xface->frame);
read(fd_pipe,&slot,sizeof(slot));
last_slot = (slot - 1)%20;
if (last_slot <0)
last_slot+=20;
next_slot = (slot + 1)%20;
direction = subframe_select(frame_parms,next_slot>>1);
#ifdef DEBUG_SIM
printf("\n\n[SIM] EMU PHY procedures UE %d for frame %d, slot %d (subframe %d)\n",
UE_id,mac_xface->frame, slot, (next_slot >> 1));
#endif
if (PHY_vars_UE_g[UE_id]->UE_mode[0] != NOT_SYNCHED) {
if ((mac_xface->frame)>0) {
phy_procedures_UE_lte ((last_slot),(next_slot), PHY_vars_UE_g[UE_id], 0, abstraction_flag);
}
} else {
if (((mac_xface->frame)>0) && ((last_slot) == (SLOTS_PER_FRAME-1))) {
initial_sync(PHY_vars_UE_g[UE_id]);
}
}
if( direction == SF_UL || (direction == SF_S && next_slot%2!=0)) {
do_OFDM_mod(PHY_vars_UE_g[UE_id]->lte_ue_common_vars.txdataF,PHY_vars_UE_g[UE_id]->lte_ue_common_vars.txdata,next_slot,&PHY_vars_UE_g[UE_id]->lte_frame_parms);
}
write(fd_channel,&node_id,sizeof(node_id));
// send_exec_complete(CHANNEL_PORT);
if(slot==19)
(mac_xface->frame)++;
}
}
void eNB_Inst(int node_id,int port,double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im,
node_desc_t *enb_data[NUMBER_OF_eNB_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms)
{
int next_slot,last_slot,slot=0,UE_id=0,eNB_id=0;
lte_subframe_t direction;
printf("eNB [ %d ] Starts \n",node_id);
// init_mmap(node_id,frame_parms, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0);
init_channel_vars (frame_parms, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0);
mmap_enb(node_id,PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata,PHY_vars_eNB_g[0]->lte_eNB_common_vars.rxdata,frame_parms);
// Interface_init(port,node_id);
// IntInitAll();
char p_input[FILENAMEMAX];
int fd_pipe;
int fd_channel;
mkfifo("/tmp/channel", 0666);
fd_channel=open("/tmp/channel",O_RDWR,0);
sprintf(p_input,"/tmp/pipe_%d",node_id);
mkfifo(p_input, 0666);
fd_pipe=open(p_input, O_RDWR,0);
mac_xface->frame=0;
while(1) {
// wait_4slot(&slot,&mac_xface->frame);
read(fd_pipe,&slot,sizeof(slot));
last_slot = (slot - 1)%20;
if (last_slot <0)
last_slot+=20;
next_slot = (slot + 1)%20;
direction = subframe_select(frame_parms,next_slot>>1);
#ifdef DEBUG_SIM
printf
("\n\n [SIM]EMU PHY procedures eNB %d for frame %d, slot %d (subframe %d) (rxdataF_ext %p) Nid_cell %d\n",
eNB_id, mac_xface->frame, slot, next_slot >> 1,
PHY_vars_eNB_g[0]->lte_eNB_ulsch_vars[0]->rxdataF_ext, PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Nid_cell);
#endif
phy_procedures_eNB_lte (last_slot, next_slot, PHY_vars_eNB_g[eNB_id], abstraction_flag);
if( direction == SF_DL || (direction == SF_S && next_slot%2==0)) {
do_OFDM_mod(PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.txdataF[0],
PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.txdata[0],
next_slot,
&PHY_vars_eNB_g[eNB_id]->lte_frame_parms);
}
write(fd_channel,&node_id,sizeof(node_id));
// send_exec_complete(CHANNEL_PORT);
if(slot==19)
(mac_xface->frame)++;
}
}
void Channel_Inst(int node_id,int port,double **s_re[MAX_eNB+MAX_UE],double **s_im[MAX_eNB+MAX_UE],double **r_re[MAX_eNB+MAX_UE],double **r_im[MAX_eNB+MAX_UE],double **r_re0,double **r_im0,
double **r_re0_d[MAX_UE][MAX_eNB],double **r_im0_d[MAX_UE][MAX_eNB],double **r_re0_u[MAX_eNB][MAX_UE],double **r_im0_u[MAX_eNB][MAX_UE],channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX],
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms)
{
// Interface_init(port,node_id);
// IntInitAll();
mkfifo("/tmp/channel", 0666);
fd_channel=open("/tmp/channel", O_RDWR ,0);
int next_slot,last_slot,slot=0,UE_id=0,eNB_id=0;
lte_subframe_t direction;
char in_buffer[100];
int ci,ji=0;
for(ci=0; ci<NB_eNB_INST; ci++) {
mmap_enb(ji,tx[ci],rx[ci],frame_parms);
init_channel_vars (frame_parms, &(s_re[ci]), &(s_im[ci]), &(r_re[ci]), &(r_im[ci]), &(r_re0), &(r_im0));
// init_mmap_channel(ji,frame_parms, &(s_re[ci]), &(s_im[ci]), &(r_re[ci]), &(r_im[ci]), &(r_re0), &(r_im0));
sprintf(in_buffer, "/tmp/pipe_%d",ji);
mkfifo(in_buffer, 0666);
fd_NB[ci]=open(in_buffer, O_RDWR ,0);
ji++;
}
ji=0;
for(ci=NB_eNB_INST; ci<(NB_eNB_INST+NB_UE_INST); ci++) {
mmap_enb(MAX_eNB+ji,tx[ci],rx[ci],frame_parms);
init_channel_vars (frame_parms, &(s_re[ci]), &(s_im[ci]), &(r_re[ci]), &(r_im[ci]), &(r_re0), &(r_im0));
// init_mmap_channel(MAX_eNB+ji,frame_parms, &(s_re[ci]), &(s_im[ci]), &(r_re[ci]), &(r_im[ci]), &(r_re0), &(r_im0));
sprintf(in_buffer, "/tmp/pipe_%d",MAX_eNB+ji);
mkfifo(in_buffer, 0666);
fd_NB[ci]=open(in_buffer, O_RDWR ,0);
ji++;
}
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
init_rre(frame_parms,&(r_re0_u[eNB_id][UE_id]),&(r_im0_u[eNB_id][UE_id]));
init_rre(frame_parms,&(r_re0_d[UE_id][eNB_id]),&(r_im0_d[UE_id][eNB_id]));
}
}
for(eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
for(UE_id=0; UE_id<NB_UE_INST; UE_id++) {
e2u_t[eNB_id][UE_id]=(ch_thread*)calloc(1,sizeof(ch_thread));
}
}
for(UE_id=0; UE_id<NB_UE_INST; UE_id++) {
for(eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
u2e_t[UE_id][eNB_id]=(ch_thread*)calloc(1,sizeof(ch_thread));
}
}
pthread_t cthr_u[NB_eNB_INST][NB_UE_INST];
pthread_t cthr_d[NB_UE_INST][NB_eNB_INST];
pthread_mutex_init(&downlink_mutex_channel,NULL);
pthread_mutex_init(&uplink_mutex_channel,NULL);
pthread_mutex_init(&exclusive,NULL);
if (pthread_cond_init (&downlink_cond_channel, NULL)) exit(1);
if (pthread_cond_init (&uplink_cond_channel, NULL)) exit(1);
if (pthread_mutex_lock(&downlink_mutex_channel)) exit(1);
if (pthread_mutex_lock(&uplink_mutex_channel)) exit(1);
NUM_THREAD_DOWNLINK=0;
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++) {
for (eNB_id=0; eNB_id<(NB_eNB_INST); eNB_id++) {
u2e_t[UE_id][eNB_id]->thread_id=NUM_THREAD_DOWNLINK;
u2e_t[UE_id][eNB_id]->eNB_id=eNB_id;
u2e_t[UE_id][eNB_id]->UE_id=UE_id;
u2e_t[UE_id][eNB_id]->r_re0=r_re0_d[UE_id][eNB_id];
u2e_t[UE_id][eNB_id]->r_im0=r_im0_d[UE_id][eNB_id];
u2e_t[UE_id][eNB_id]->r_re=r_re[NB_eNB_INST+UE_id];
u2e_t[UE_id][eNB_id]->r_im=r_im[NB_eNB_INST+UE_id];
u2e_t[UE_id][eNB_id]->s_im=s_im[eNB_id];
u2e_t[UE_id][eNB_id]->s_re=s_re[eNB_id];
u2e_t[UE_id][eNB_id]->eNB2UE=eNB2UE[eNB_id][UE_id];
u2e_t[UE_id][eNB_id]->UE2eNB=UE2eNB[UE_id][eNB_id];
u2e_t[UE_id][eNB_id]->enb_data=enb_data[eNB_id];
u2e_t[UE_id][eNB_id]->ue_data=ue_data[UE_id];
u2e_t[UE_id][eNB_id]->next_slot=&next_slot;
u2e_t[UE_id][eNB_id]->abstraction_flag=&abstraction_flag;
u2e_t[UE_id][eNB_id]->frame_parms=frame_parms;
for (int i=0;i<3;i++)
{
u2e_t[UE_id][eNB_id]->tx_data[i]=tx[eNB_id][i];
u2e_t[UE_id][eNB_id]->rx_data[i]=rx[NB_eNB_INST+UE_id][i];
}
if(pthread_cond_init (&downlink_cond[eNB_id][UE_id], NULL)) exit(1);
if(pthread_mutex_lock(&downlink_mutex[eNB_id][UE_id])) exit(1);
pthread_create (&cthr_d[UE_id][eNB_id], NULL, do_DL_sig_channel_T,(void*)(u2e_t[UE_id][eNB_id]));
NUM_THREAD_DOWNLINK++;
}
}
NUM_THREAD_UPLINK=0;
for (eNB_id=0; eNB_id<(NB_eNB_INST); eNB_id++) {
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++) {
e2u_t[eNB_id][UE_id]->thread_id=NUM_THREAD_UPLINK;
e2u_t[eNB_id][UE_id]->eNB_id=eNB_id;
e2u_t[eNB_id][UE_id]->UE_id=UE_id;
e2u_t[eNB_id][UE_id]->r_re=r_re[eNB_id];
e2u_t[eNB_id][UE_id]->r_im=r_im[eNB_id];
e2u_t[eNB_id][UE_id]->r_re0=r_re0_u[eNB_id][UE_id];
e2u_t[eNB_id][UE_id]->r_im0=r_im0_u[eNB_id][UE_id];
e2u_t[eNB_id][UE_id]->s_im=s_im[NB_eNB_INST+UE_id];
e2u_t[eNB_id][UE_id]->s_re=s_re[NB_eNB_INST+UE_id];
e2u_t[eNB_id][UE_id]->eNB2UE=eNB2UE[eNB_id][UE_id];
e2u_t[eNB_id][UE_id]->UE2eNB=UE2eNB[UE_id][eNB_id];
e2u_t[eNB_id][UE_id]->enb_data=enb_data[eNB_id];
e2u_t[eNB_id][UE_id]->ue_data=ue_data[UE_id];
e2u_t[eNB_id][UE_id]->next_slot=&next_slot;
e2u_t[eNB_id][UE_id]->abstraction_flag=&abstraction_flag;
e2u_t[eNB_id][UE_id]->frame_parms=frame_parms;
for (int i=0;i<3;i++)
{
e2u_t[eNB_id][UE_id]->tx_data[i]=tx[NB_eNB_INST+UE_id][i];
e2u_t[eNB_id][UE_id]->rx_data[i]=rx[eNB_id][i];
}
if(pthread_cond_init (&uplink_cond[UE_id][eNB_id], NULL)) exit(1);
if(pthread_mutex_lock(&uplink_mutex[UE_id][eNB_id])) exit(1);
pthread_create (&cthr_u[eNB_id][UE_id], NULL, do_UL_sig_channel_T,(void*)e2u_t[eNB_id][UE_id]);
NUM_THREAD_UPLINK++;
}
}
}
void Channel_DL(double **s_re[MAX_eNB+MAX_UE],double **s_im[MAX_eNB+MAX_UE],double **r_re[MAX_eNB+MAX_UE],double **r_im[MAX_eNB+MAX_UE],double **r_re0,double **r_im0,
double **r_re0_d[MAX_UE][MAX_eNB],double **r_im0_d[MAX_UE][MAX_eNB],double **r_re0_u[MAX_eNB][MAX_UE],double **r_im0_u[MAX_eNB][MAX_UE],channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX],
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,
int slot)
{
int count=0;
int next_slot,last_slot,UE_id=0,eNB_id=0;
lte_subframe_t direction;
s32 **txdata,**rxdata;
double tx_pwr, rx_pwr;
s32 rx_pwr2;
u32 i;
u32 slot_offset;
for (eNB_id=0; eNB_id<(NB_eNB_INST); eNB_id++) {
write(fd_NB[eNB_id],&slot,sizeof(slot));
count++;
//send_exec_msg(mac_xface->frame,slot,eNB_PORT+eNB_id);
}
while(count--) {
int dummy=1;
read(fd_channel,&dummy,sizeof(dummy));
//wait_4Msg();
}
for (eNB_id=0; eNB_id<(NB_eNB_INST); eNB_id++) {
frame_parms = &PHY_vars_eNB_g[eNB_id]->lte_frame_parms;
slot_offset = (nslot)*(frame_parms->samples_per_tti>>1);
txdata =tx[eNB_id][0];
tx_pwr = dac_fixed_gain(s_re[eNB_id],
s_im[eNB_id],
txdata,
slot_offset,
frame_parms->nb_antennas_tx,
frame_parms->samples_per_tti>>1,
14,
40);
printf("[SIM][DL] eNB %d: tx_pwr %f dB for slot %d (subframe %d)\n",eNB_id,10*log10(tx_pwr),nslot,nslot>>1);
}
_COT=0;
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++) {
for (eNB_id=0; eNB_id<(NB_eNB_INST); eNB_id++) {
if(pthread_cond_signal(&downlink_cond[eNB_id][UE_id])) exit(1);
if(pthread_mutex_unlock(&downlink_mutex[eNB_id][UE_id])) exit(1);
}
}
if(pthread_cond_wait(&downlink_cond_channel, &downlink_mutex_channel)) exit(1);
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++) {
Clean_Param(r_re[NB_eNB_INST+UE_id],r_im[NB_eNB_INST+UE_id],frame_parms);
for (eNB_id=0; eNB_id<(NB_eNB_INST); eNB_id++) {
Channel_Out(SF_DL,eNB_id,UE_id,r_re[NB_eNB_INST+UE_id],r_im[NB_eNB_INST+UE_id],r_re0_d[UE_id][eNB_id],r_im0_d[UE_id][eNB_id],frame_parms);
// adc_channel(eNB_id,UE_id,r_re[NB_eNB_INST+UE_id],r_im[NB_eNB_INST+UE_id]);
}
}
count=0;
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++)
if (mac_xface->frame >= (UE_id * 10)) {
write(fd_NB[NB_eNB_INST+UE_id],&slot,sizeof(slot));
//send_exec_msg(mac_xface->frame,slot,UE_PORT+UE_id);
count++;
}
while(count--) {
int dummy=1;
read(fd_channel,&dummy,sizeof(dummy));
//wait_4Msg();
}
}
void Channel_UL(double **s_re[MAX_eNB+MAX_UE],double **s_im[MAX_eNB+MAX_UE],double **r_re[MAX_eNB+MAX_UE],double **r_im[MAX_eNB+MAX_UE],double **r_re0,double **r_im0,
double **r_re0_d[MAX_UE][MAX_eNB],double **r_im0_d[MAX_UE][MAX_eNB],double **r_re0_u[MAX_eNB][MAX_UE],double **r_im0_u[MAX_eNB][MAX_UE],channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX],
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,
int slot)
{
int count=0;
int next_slot,last_slot,UE_id=0,eNB_id=0;
lte_subframe_t direction;
s32 **txdata,**rxdata;
double tx_pwr, rx_pwr;
s32 rx_pwr2;
u32 i;
u32 slot_offset;
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++)
if (mac_xface->frame >= (UE_id * 10)) {
write(fd_NB[NB_eNB_INST+UE_id],&slot,sizeof(slot));
//send_exec_msg(mac_xface->frame,slot,UE_PORT+UE_id);
count++;
}
while(count--) {
int dummy=1;
read(fd_channel,&dummy,sizeof(dummy));
//wait_4Msg();
}
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++) {
frame_parms = &PHY_vars_UE_g[UE_id]->lte_frame_parms;
slot_offset = (nslot)*(frame_parms->samples_per_tti>>1);
txdata =tx[NB_eNB_INST+UE_id][0]; //PHY_vars_UE_g[UE_id]->lte_ue_common_vars.txdata;
tx_pwr = dac_fixed_gain(s_re[NB_eNB_INST+UE_id],
s_im[NB_eNB_INST+UE_id],
txdata,
slot_offset,
frame_parms->nb_antennas_tx,
frame_parms->samples_per_tti>>1,
14,
18);
printf("[SIM][UL] UE %d tx_pwr %f dB for slot %d (subframe %d)\n",UE_id,10*log10(tx_pwr),nslot,nslot>>1);
rx_pwr = signal_energy_fp(s_re[NB_eNB_INST+UE_id],s_im[NB_eNB_INST+UE_id],frame_parms->nb_antennas_rx,frame_parms->samples_per_tti>>1,0);
printf("[SIM][UL] UE %d tx_pwr %f dB for slot %d (subframe %d)\n",UE_id,10*log10(rx_pwr),nslot,nslot>>1);
}
_COT_U=0;
for (eNB_id=0; eNB_id<(NB_eNB_INST); eNB_id++) {
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++) {
if ( pthread_cond_signal(&uplink_cond[UE_id][eNB_id])) exit(1);
if ( pthread_mutex_unlock(&uplink_mutex[UE_id][eNB_id])) exit(1);
}
}
if ( pthread_cond_wait(&uplink_cond_channel, &uplink_mutex_channel)) exit(1);
for (eNB_id=0; eNB_id<(NB_eNB_INST); eNB_id++) {
Clean_Param(r_re[eNB_id],r_im[eNB_id],frame_parms);
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++) {
Channel_Out(SF_UL,eNB_id,UE_id,r_re[eNB_id],r_im[eNB_id],r_re0_u[eNB_id][UE_id],r_im0_u[eNB_id][UE_id],frame_parms);
printf("[SIM][DL] eNB %d: tx_pwr %f dB for slot %d (subframe %d)\n",eNB_id,10*log10(tx_pwr),next_slot,next_slot>>1);
}
}
count=0;
for (eNB_id=0; eNB_id<(NB_eNB_INST); eNB_id++) {
write(fd_NB[eNB_id],&slot,sizeof(slot));
// send_exec_msg(mac_xface->frame,slot,eNB_PORT+eNB_id);
count++;
}
while(count--) {
int dummy=1;
read(fd_channel,&dummy,sizeof(dummy));
// wait_4Msg();
}
}
void Channel_Func(double **s_re[MAX_eNB+MAX_UE],double **s_im[MAX_eNB+MAX_UE],double **r_re[MAX_eNB+MAX_UE],double **r_im[MAX_eNB+MAX_UE],double **r_re0,double **r_im0,
double **r_re0_d[MAX_UE][MAX_eNB],double **r_im0_d[MAX_UE][MAX_eNB],double **r_re0_u[MAX_eNB][MAX_UE],double **r_im0_u[MAX_eNB][MAX_UE],channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX],
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,
int slot)
{
int last_slot;
lte_subframe_t direction;
last_slot = (slot - 1)%20;
if (last_slot <0)
last_slot+=20;
nslot = (slot + 1)%20;
direction = subframe_select(frame_parms,nslot>>1);
if( direction == SF_DL || (direction == SF_S && nslot%2==0)) {
Channel_DL(s_re,s_im,r_re,r_im,r_re0,r_im0,r_re0_d,r_im0_d,r_re0_u,r_im0_u,eNB2UE,UE2eNB,enb_data,ue_data,abstraction_flag,frame_parms,slot);
} else {
Channel_UL(s_re,s_im,r_re,r_im,r_re0,r_im0,r_re0_d,r_im0_d,r_re0_u,r_im0_u,eNB2UE,UE2eNB,enb_data,ue_data,abstraction_flag,frame_parms,slot);
}
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef __PROCESS_H__
# define __PROCESS_H__
#include "interface.h"
int32_t **tx[MAX_eNB+MAX_UE][3],**rx[MAX_eNB+MAX_UE][3];
int nslot;
void Process_Func(int node_id,int port,double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im,
node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms);
void UE_Inst(int node_id,int port,double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im,
node_desc_t *ue_data[NUMBER_OF_UE_MAX],uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms);
void eNB_Inst(int node_id,int port,double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im,
node_desc_t *enb_data[NUMBER_OF_eNB_MAX],uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms);
void Channel_Inst(int node_id,int port,double **s_re[MAX_eNB+MAX_UE],double **s_im[MAX_eNB+MAX_UE],double **r_re[MAX_eNB+MAX_UE],double **r_im[MAX_eNB+MAX_UE],double **r_re0,double **r_im0,
double **r_re0_d[MAX_UE][MAX_eNB],double **r_im0_d[MAX_UE][MAX_eNB],double **r_re0_u[MAX_eNB][MAX_UE],double **r_im0_u[MAX_eNB][MAX_UE],channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX],
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms);
void Channel_DL(double **s_re[MAX_eNB+MAX_UE],double **s_im[MAX_eNB+MAX_UE],double **r_re[MAX_eNB+MAX_UE],double **r_im[MAX_eNB+MAX_UE],double **r_re0,double **r_im0,
double **r_re0_d[MAX_UE][MAX_eNB],double **r_im0_d[MAX_UE][MAX_eNB],double **r_re0_u[MAX_eNB][MAX_UE],double **r_im0_u[MAX_eNB][MAX_UE],channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX],
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,
int slot);
void Channel_UL(double **s_re[MAX_eNB+MAX_UE],double **s_im[MAX_eNB+MAX_UE],double **r_re[MAX_eNB+MAX_UE],double **r_im[MAX_eNB+MAX_UE],double **r_re0,double **r_im0,
double **r_re0_d[MAX_UE][MAX_eNB],double **r_im0_d[MAX_UE][MAX_eNB],double **r_re0_u[MAX_eNB][MAX_UE],double **r_im0_u[MAX_eNB][MAX_UE],channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX],
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,
int slot);
void Channel_Func(double **s_re[MAX_eNB+MAX_UE],double **s_im[MAX_eNB+MAX_UE],double **r_re[MAX_eNB+MAX_UE],double **r_im[MAX_eNB+MAX_UE],double **r_re0,double **r_im0,
double **r_re0_d[MAX_UE][MAX_eNB],double **r_im0_d[MAX_UE][MAX_eNB],double **r_re0_u[MAX_eNB][MAX_UE],double **r_im0_u[MAX_eNB][MAX_UE],channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX],
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,
int slot);
#endif
#!/usr/bin/env python
import subprocess
import optparse
import re
OPT=" "
TERMINAL="gnome-terminal -x "
TIME="time"
def runBash(cmd):
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
out = p.stdout.read().strip()
return out
def main():
global OPT,TIME,TERMINAL
subprocess.call('ps | nawk \'/oaisim/ {system("kill " $1)}\'', shell=True)
p = optparse.OptionParser()
p.add_option('--eNB', '-b', default="1")
p.add_option('--UE', '-u', default="1")
p.add_option('--frame','-n', default="100")
p.add_option('--terminal','-t', default="1")
p.add_option('--time','--time', default="0")
options, arguments = p.parse_args()
print '---- Configuration ---- '
print 'Number of eNB : %s' % options.eNB
print 'Number of UE : %s' % options.UE
if(options.terminal=='1'):
OPT+=TERMINAL
if(options.time=='1'):
OPT+=TIME
#CHANNEL= 'valgrind --tool=callgrind --collect-bus=yes --branch-sim=yes $OPENAIR_TARGETS/SIMU/USER/oaisim -X0 -b%s -u%s -n%s' % (options.eNB,options.UE,options.frame)
CHANNEL= '$OPENAIR_TARGETS/SIMU/USER/oaisim -X0 -b%s -u%s -n%s' % (options.eNB,options.UE,options.frame)
#subprocess.call(CHANNEL, shell=True)
print CHANNEL
nb_enb=int(options.eNB)
nb_ue=int(options.UE)
frame=int(options.frame)
for x in xrange(0,nb_enb):
ENB='%s $OPENAIR_TARGETS/SIMU/USER/oaisim -X1 -i%s &' % (OPT,x)
print ENB
subprocess.call(ENB,shell=True)
subprocess.call('sleep 1', shell=True)
for x in xrange(0,nb_ue):
UE='%s $OPENAIR_TARGETS/SIMU/USER/oaisim -X2 -i%s &' % (OPT,x)
print UE
subprocess.call(UE,shell=True)
subprocess.call('sleep 1', shell=True)
# subprocess.call('sleep 2', shell=True)
subprocess.call(CHANNEL, shell=True)
# subprocess.call('ps | nawk \'/oaisim/ {system("kill " $1)}\'', shell=True)
if __name__ == '__main__':
main()
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*
* Tsync.h
*
*/
#include <pthread.h>
#ifndef TSYNC_H_
#define TSYNC_H_
#define COMPILER_BARRIER() __asm__ __volatile__ ("" ::: "memory")
int mycount;
pthread_mutex_t exclusive;
pthread_mutex_t downlink_mutex[MAX_eNB][MAX_UE];
pthread_mutex_t downlink_mutex_channel;
pthread_cond_t downlink_cond[MAX_eNB][MAX_UE];
pthread_cond_t downlink_cond_channel;
pthread_mutex_t uplink_mutex[MAX_UE][MAX_eNB];
pthread_mutex_t uplink_mutex_channel;
pthread_cond_t uplink_cond[MAX_UE][MAX_eNB];
pthread_cond_t uplink_cond_channel;
int COT;
int COT_U;
volatile int _COT;
volatile int _COT_U;
int NUM_THREAD_DOWNLINK;
int NUM_THREAD_UPLINK;
ch_thread *e2u_t[MAX_UE][MAX_eNB];
ch_thread *u2e_t[MAX_UE][MAX_eNB];
pthread_t cthr_u[MAX_eNB][MAX_UE];
pthread_t cthr_d[MAX_eNB][MAX_UE];
int fd_NB[MAX_eNB+MAX_UE];
int fd_channel;
#endif /* TSYNC_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include "SIMULATION/TOOLS/defs.h"
#include "SIMULATION/RF/defs.h"
#include "PHY/types.h"
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "MAC_INTERFACE/extern.h"
#ifdef OPENAIR2
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/extern.h"
#include "UTIL/LOG/log_if.h"
#include "RRC/LITE/extern.h"
#include "PHY_INTERFACE/extern.h"
#endif
#include "../USER/oaisim.h"
#include "channel_sim_proc.h"
#include "interface.h"
#include "Tsync.h"
#include "Process.h"
#define RF
//#define DEBUG_SIM
void init_rre(LTE_DL_FRAME_PARMS *frame_parms,double ***r_re0,double ***r_im0)
{
int i;
(*r_re0) = malloc(2*sizeof(double*));
(*r_im0) = malloc(2*sizeof(double*));
for (i=0; i<2; i++) {
(*r_re0)[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
bzero((*r_re0)[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
(*r_im0)[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
bzero((*r_im0)[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
}
}
void mmap_enb(int id,int **tx_data[3],int **rx_data[3],LTE_DL_FRAME_PARMS *frame_parms)
{
int i;
int fd[20];
int result;
unsigned int FILESIZE;
FILESIZE=FRAME_LENGTH_COMPLEX_SAMPLES*(sizeof(s32));
char buffer[100];
int j=0,k=0;
char sect=1;
for(k=0; k<sect; k++) {
(*(tx_data+k)) = malloc(2*sizeof(s32*));
(*(rx_data+k)) = malloc(2*sizeof(s32*));
}
for (k=0; k<sect; k++) {
for (i=0; i<2; i++) {
sprintf(buffer,"/tmp/tx_data_%d_%d_%d.bin",id,k,i);
fd[j] = open(buffer, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
result = lseek(fd[j], FILESIZE-1, SEEK_SET);
result = write(fd[j], "", 1);
(*(tx_data+k))[i] = mmap(0, FILESIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd[j], 0);
j++;
sprintf(buffer,"/tmp/rx_data_%d_%d_%d.bin",id,k,i);
fd[j] = open(buffer, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
result = lseek(fd[j], FILESIZE-1, SEEK_SET);
result = write(fd[j], "", 1);
(*(rx_data+k))[i] = mmap(0, FILESIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd[j], 0);
j++;
}
}
}
void mmap_ue(int id,int ***tx_data,int ***rx_data,LTE_DL_FRAME_PARMS *frame_parms)
{
int i;
int fd[20];
int result;
unsigned int FILESIZE;
FILESIZE=FRAME_LENGTH_COMPLEX_SAMPLES*(sizeof(s32));
char buffer[100];
int j=0,k=0;
(*tx_data) = malloc(2*sizeof(s32*));
(*rx_data) = malloc(2*sizeof(s32*));
for (i=0; i<2; i++) {
sprintf(buffer,"/tmp/tx_data_%d_%d_%d.bin",id,k,i);
fd[j] = open(buffer, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
result = lseek(fd[j], FILESIZE-1, SEEK_SET);
result = write(fd[j], "", 1);
(*tx_data)[i] = mmap(0, FILESIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd[j], 0);
j++;
sprintf(buffer,"/tmp/rx_data_%d_%d_%d.bin",id,k,i);
fd[j] = open(buffer, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
result = lseek(fd[j], FILESIZE-1, SEEK_SET);
result = write(fd[j], "", 1);
(*rx_data)[i] = mmap(0, FILESIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd[j], 0);
j++;
}
}
void do_DL_sig_channel_T(void *param)
{
ch_thread* cthread = (ch_thread*)param;
int count;
u8 eNB_i,UE_i;
int thread_id;
double **r_re0,**r_re,**r_im,**r_im0,**s_re,**s_im;
channel_desc_t *eNB2UE[3][8];
node_desc_t *enb_data[3];
node_desc_t *ue_data[8];
int *next_slot,abstraction_flag;
LTE_DL_FRAME_PARMS *frame_parms;
int **tx_data[3],**rx_data[3];
node_desc_t *enb_data_2[3];
eNB_i=(cthread->eNB_id);
UE_i=(cthread->UE_id);
r_re0=cthread->r_re0;
r_re=cthread->r_re;
r_im=cthread->r_im;
r_im0=cthread->r_im0;
s_im=cthread->s_im;
s_re=cthread->s_re;
eNB2UE[eNB_i][UE_i]=cthread->eNB2UE;
enb_data[0]=(cthread->enb_data);
enb_data_2[eNB_i]=cthread->enb_data;
ue_data[UE_i]=cthread->ue_data;
frame_parms=cthread->frame_parms;
next_slot=(cthread->next_slot);
abstraction_flag=*(cthread->abstraction_flag);
thread_id=(cthread->thread_id);
for (int i=0;i<3;i++)
{
tx_data[i]=cthread->tx_data[i];
rx_data[i]=cthread->rx_data[i];
}
s32 att_eNB_id=-1;
s32 **txdata,**rxdata;
double tx_pwr, rx_pwr;
s32 rx_pwr2;
u32 i,aa;
u32 slot_offset;
while(1) {
if(pthread_cond_wait(&downlink_cond[eNB_i][UE_i], &downlink_mutex[eNB_i][UE_i])) exit(1);
slot_offset = (nslot)*(frame_parms->samples_per_tti>>1);
// pthread_mutex_lock(&exclusive);
multipath_channel(eNB2UE[eNB_i][UE_i],s_re,s_im,r_re0,r_im0,
frame_parms->samples_per_tti>>1,0);
rx_pwr = signal_energy_fp2(eNB2UE[eNB_i][UE_i]->ch[0],eNB2UE[eNB_i][UE_i]->channel_length)*eNB2UE[eNB_i][UE_i]->channel_length;
printf("[SIM][DL] Channel eNB %d => UE %d : tx_power %f dBm, path_loss %f dB\n",
eNB_i,UE_i,
enb_data_2[eNB_i]->tx_power_dBm,
eNB2UE[eNB_i][UE_i]->path_loss_dB);
printf("[SIM][DL] Channel eNB %d => UE %d : Channel gain %f dB (%f)\n",eNB_i,UE_i,10*log10(rx_pwr),rx_pwr);
rx_pwr = signal_energy_fp(r_re0,r_im0,frame_parms->nb_antennas_rx,frame_parms->samples_per_tti>>1,0);
printf("[SIM][DL] UE %d : rx_pwr %f dB for slot %d (subframe %d)\n",UE_i,10*log10(rx_pwr),nslot,nslot>>1);
if (eNB2UE[eNB_i][UE_i]->first_run == 1)
eNB2UE[eNB_i][UE_i]->first_run = 0;
rf_rx(r_re0,
r_im0,
NULL,
NULL,
0,
frame_parms->nb_antennas_rx,
frame_parms->samples_per_tti>>1,
1e3/eNB2UE[eNB_i][UE_i]->BW, // sampling time (ns)
0.0, // freq offset (Hz) (-20kHz..20kHz)
0.0, // drift (Hz) NOT YET IMPLEMENTED
ue_data[UE_i]->rx_noise_level, // noise_figure NOT YET IMPLEMENTED
110.00 - 66.227, // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
200, // IP3_dBm (dBm)
&eNB2UE[eNB_i][UE_i]->ip, // initial phase
30.0e3, // pn_cutoff (kHz)
-500.0, // pn_amp (dBc) default: 50
0.0, // IQ imbalance (dB),
0.0); // IQ phase imbalance (rad)
rx_pwr = signal_energy_fp(r_re0,r_im0,frame_parms->nb_antennas_rx,frame_parms->samples_per_tti>>1,0);
printf("[SIM][DL] UE %d : ADC in (eNB %d) %f dB for slot %d (subframe %d)\n",UE_i,eNB_i,10*log10(rx_pwr),nslot,nslot>>1);
//count = __sync_add_and_fetch(&_COT, 1);
//COMPILER_BARRIER();
if (pthread_mutex_lock(&downlink_mutex_channel)) exit(1);
_COT++;
if(_COT==NUM_THREAD_DOWNLINK) {
// if(count==NUM_THREAD_DOWNLINK){
if(pthread_cond_signal(&downlink_cond_channel)) exit(1);
}
if(pthread_mutex_unlock(&downlink_mutex_channel)) exit(1);
// pthread_mutex_unlock(&exclusive);
}
}
void do_UL_sig_channel_T(void *param)
{
ch_thread* cthread = (ch_thread*)param;
int count=0;
u8 eNB_i,UE_i;
double **r_re0,**r_re,**r_im,**r_im0,**s_re,**s_im;
channel_desc_t *UE2eNB[8][3];
node_desc_t *enb_data2[3];
node_desc_t *ue_data[8];
u16 next_slot,abstraction_flag;
LTE_DL_FRAME_PARMS *frame_parms;
int thread_id;
eNB_i=(cthread->eNB_id);
UE_i=(cthread->UE_id);
r_re0=cthread->r_re0;
r_re=cthread->r_re;
r_im=cthread->r_im;
r_im0=cthread->r_im0;
s_im=cthread->s_im;
s_re=cthread->s_re;
UE2eNB[UE_i][eNB_i]=cthread->UE2eNB;
enb_data2[eNB_i]=cthread->enb_data;
ue_data[UE_i]=cthread->ue_data;
next_slot=*(cthread->next_slot);
abstraction_flag=*(cthread->abstraction_flag);
frame_parms=cthread->frame_parms;
thread_id=(cthread->thread_id);
s32 **txdata,**rxdata;
u8 UE_id=0,eNB_id=0,aa;
double tx_pwr, rx_pwr;
s32 rx_pwr2;
u32 i;
u32 slot_offset;
double nf = 0; //currently unused
while(1) {
slot_offset = (nslot)*(frame_parms->samples_per_tti>>1);
if(pthread_cond_wait(&uplink_cond[UE_i][eNB_i], &uplink_mutex[UE_i][eNB_i])) exit(1);//[UE_i][eNB_i]);
// pthread_mutex_lock(&exclusive);
multipath_channel(UE2eNB[UE_i][eNB_i],s_re,s_im,r_re0,r_im0,
frame_parms->samples_per_tti>>1,0);
printf("[SIM][UL] Channel UE %d => eNB %d : %f dB\n",UE_i,eNB_i,10*log10(rx_pwr));
rx_pwr = signal_energy_fp(r_re0,r_im0,frame_parms->nb_antennas_rx,frame_parms->samples_per_tti>>1,0);
printf("[SIM][UL] eNB %d : eNB out %f dB for slot %d (subframe %d), sptti %d\n",eNB_i,10*log10(rx_pwr),nslot,nslot>>1,frame_parms->samples_per_tti);
if (UE2eNB[UE_i][eNB_i]->first_run == 1)
UE2eNB[UE_i][eNB_i]->first_run = 0;
// RF model
rf_rx(r_re0,
r_im0,
NULL,
NULL,
0,
frame_parms->nb_antennas_rx,
frame_parms->samples_per_tti>>1,
(UE_id==0) ? (1.0/7.68e6 * 1e9) : 1e9, // sampling time (ns) + set noise bandwidth to 0 for UE>0 (i.e. no noise except for first UE)
0.0, // freq offset (Hz) (-20kHz..20kHz)
0.0, // drift (Hz) NOT YET IMPLEMENTED
nf, // noise_figure NOT YET IMPLEMENTED
150.00 - 66.227, // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
200, // IP3_dBm (dBm)
&UE2eNB[UE_i][eNB_i]->ip, // initial phase
30.0e3, // pn_cutoff (kHz)
-500.0, // pn_amp (dBc) default: 50
0.0, // IQ imbalance (dB),
0.0); // IQ phase imbalance (rad)
rx_pwr = signal_energy_fp(r_re,r_im,frame_parms->nb_antennas_rx,frame_parms->samples_per_tti>>1,0);
printf("[SIM][UL] rx_pwr (ADC in) %f dB for slot %d (subframe %d)\n",10*log10(rx_pwr),nslot,nslot>>1);
// count = __sync_add_and_fetch(&_COT_U, 1);
// COMPILER_BARRIER();
if (pthread_mutex_lock(&uplink_mutex_channel)) exit(1);
_COT_U++;
if(_COT_U==NUM_THREAD_UPLINK) {
//if(count==NUM_THREAD_UPLINK){
if (pthread_cond_signal(&uplink_cond_channel)) exit(1);
}
if(pthread_mutex_unlock(&uplink_mutex_channel)) exit(1);
// pthread_mutex_unlock(&exclusive);
}
}
void Clean_Param(double **r_re,double **r_im,LTE_DL_FRAME_PARMS *frame_parms)
{
u32 i,aa;
for (i=0; i<(frame_parms->samples_per_tti>>1); i++) {
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
r_re[aa][i]=0.0;
r_im[aa][i]=0.0;
}
}
}
void Channel_Out(lte_subframe_t direction,int eNB_id,int UE_id,double **r_re,double **r_im,double **r_re0,double **r_im0,LTE_DL_FRAME_PARMS *frame_parms)
{
u32 i,aa;
double alpha=0.0;
u32 slot_offset;
frame_parms = &PHY_vars_UE_g[0]->lte_frame_parms;
slot_offset = (nslot)*(frame_parms->samples_per_tti>>1);
s32 rx_pwr2;
s32 **rxdata;
if(eNB_id==(UE_id % NB_eNB_INST))
alpha=1;
for (i=0; i<(frame_parms->samples_per_tti>>1); i++) {
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
r_re[aa][i]+=(r_re0[aa][i]*alpha);
r_im[aa][i]+=(r_im0[aa][i]*alpha);
}
}
rxdata=rx[eNB_id][0];
if (direction == SF_DL ) {
frame_parms = &PHY_vars_eNB_g[0]->lte_frame_parms;
slot_offset = (nslot)*(frame_parms->samples_per_tti>>1);
adc(r_re,
r_im,
0,
slot_offset,
rx[NB_eNB_INST+UE_id][0],
frame_parms->nb_antennas_rx,
frame_parms->samples_per_tti>>1,
12);
} else {
frame_parms = &PHY_vars_UE_g[0]->lte_frame_parms;
slot_offset = (nslot)*(frame_parms->samples_per_tti>>1);
adc(r_re,
r_im,
0,
slot_offset,
rx[eNB_id][0],
frame_parms->nb_antennas_rx,
frame_parms->samples_per_tti>>1,
12);
}
rx_pwr2 = signal_energy(rxdata[0]+slot_offset,frame_parms->samples_per_tti>>1);
// printf("[SIM][DL/UL] UE/eNB %d : rx_pwr (ADC out) %f dB (%d) for slot %d (subframe %d), writing to %p\n",UE_id, 10*log10((double)rx_pwr2),rx_pwr2,nslot,nslot>>1,rxdata);
}
/*
void do_UL_sig_channel(u8 eNB_i,u8 UE_i,double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im,channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],u16 next_slot,u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms) {
s32 **txdata,**rxdata;
u8 UE_id=0,eNB_id=0,aa;
double tx_pwr, rx_pwr;
s32 rx_pwr2;
u32 i;
u32 slot_offset;
double nf = 0; //currently unused
slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1);
multipath_channel(UE2eNB[UE_i][eNB_i],s_re,s_im,r_re0,r_im0,
frame_parms->samples_per_tti>>1,0);
rx_pwr = signal_energy_fp(r_re0,r_im0,frame_parms->nb_antennas_rx,frame_parms->samples_per_tti>>1,0);
if (UE2eNB[UE_i][eNB_i]->first_run == 1)
UE2eNB[UE_i][eNB_i]->first_run = 0;
// RF model
rf_rx(r_re0,
r_im0,
NULL,
NULL,
0,
frame_parms->nb_antennas_rx,
frame_parms->samples_per_tti>>1,
(UE_id==0) ? (1.0/7.68e6 * 1e9) : 1e9, // sampling time (ns) + set noise bandwidth to 0 for UE>0 (i.e. no noise except for first UE)
0.0, // freq offset (Hz) (-20kHz..20kHz)
0.0, // drift (Hz) NOT YET IMPLEMENTED
nf, // noise_figure NOT YET IMPLEMENTED
150.00 - 66.227, // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
200, // IP3_dBm (dBm)
&UE2eNB[UE_i][eNB_i]->ip, // initial phase
30.0e3, // pn_cutoff (kHz)
-500.0, // pn_amp (dBc) default: 50
0.0, // IQ imbalance (dB),
0.0); // IQ phase imbalance (rad)
rx_pwr = signal_energy_fp(r_re,r_im,frame_parms->nb_antennas_rx,frame_parms->samples_per_tti>>1,0);
printf("[SIM][UL] rx_pwr (ADC in) %f dB for slot %d (subframe %d)\n",10*log10(rx_pwr),next_slot,next_slot>>1);
}
*/
/*
void do_DL_sig_channel(u8 eNB_i,u8 UE_i,double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im,channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX],
node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX], u16 next_slot,u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms) {
s32 att_eNB_id=-1;
s32 **txdata,**rxdata;
u8 eNB_id=0,UE_id=0;
double tx_pwr, rx_pwr;
s32 rx_pwr2;
u32 i,aa;
u32 slot_offset;
multipath_channel(eNB2UE[eNB_i][UE_i],s_re,s_im,r_re0,r_im0,
frame_parms->samples_per_tti>>1,0);
rx_pwr = signal_energy_fp2(eNB2UE[eNB_i][UE_i]->ch[0],eNB2UE[eNB_i][UE_i]->channel_length)*eNB2UE[eNB_i][UE_i]->channel_length;
printf("[SIM][DL] Channel eNB %d => UE %d : tx_power %f dBm, path_loss %f dB\n",
eNB_i,UE_i,
enb_data[eNB_id]->tx_power_dBm,
eNB2UE[eNB_id][UE_id]->path_loss_dB);
printf("[SIM][DL] Channel eNB %d => UE %d : Channel gain %f dB (%f)\n",eNB_id,UE_id,10*log10(rx_pwr),rx_pwr);
rx_pwr = signal_energy_fp(r_re0,r_im0,frame_parms->nb_antennas_rx,frame_parms->samples_per_tti>>1,0);
printf("[SIM][DL] UE %d : rx_pwr %f dB for slot %d (subframe %d)\n",UE_id,10*log10(rx_pwr),next_slot,next_slot>>1);
if (eNB2UE[eNB_id][UE_id]->first_run == 1)
eNB2UE[eNB_id][UE_id]->first_run = 0;
rf_rx(r_re0,
r_im0,
NULL,
NULL,
0,
frame_parms->nb_antennas_rx,
frame_parms->samples_per_tti>>1,
1e3/eNB2UE[eNB_i][UE_i]->BW, // sampling time (ns)
0.0, // freq offset (Hz) (-20kHz..20kHz)
0.0, // drift (Hz) NOT YET IMPLEMENTED
ue_data[UE_id]->rx_noise_level, // noise_figure NOT YET IMPLEMENTED
110.00 - 66.227, // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
200, // IP3_dBm (dBm)
&eNB2UE[eNB_i][UE_i]->ip, // initial phase
30.0e3, // pn_cutoff (kHz)
-500.0, // pn_amp (dBc) default: 50
0.0, // IQ imbalance (dB),
0.0); // IQ phase imbalance (rad)
rx_pwr = signal_energy_fp(r_re0,r_im0,frame_parms->nb_antennas_rx,frame_parms->samples_per_tti>>1,0);
printf("[SIM][DL] UE %d : ADC in (eNB %d) %f dB for slot %d (subframe %d)\n",UE_id,eNB_id,10*log10(rx_pwr),next_slot,next_slot>>1);
}
*/
/*
void init_mmap_channel(int id,LTE_DL_FRAME_PARMS *frame_parms, double ***s_re,double ***s_im,double ***r_re,double ***r_im,double ***r_re0,double ***r_im0) {
int i;
int fd[20];
int result;
double *map;
unsigned int FILESIZE;
FILESIZE=FRAME_LENGTH_COMPLEX_SAMPLES*(sizeof(double));
(*s_re) = malloc(2*sizeof(double*));
(*s_im) = malloc(2*sizeof(double*));
(*r_re) = malloc(2*sizeof(double*));
(*r_im) = malloc(2*sizeof(double*));
(*r_re0) = malloc(2*sizeof(double*));
(*r_im0) = malloc(2*sizeof(double*));
char buffer[100];
int j=0;
for (i=0;i<2;i++) {
sprintf(buffer,"/tmp/s_re_%d_%d.bin",id,i);
fd[j] = open(buffer, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
result = lseek(fd[j], FILESIZE-1, SEEK_SET);
result = write(fd[j], "", 1);
(*s_re)[i] = mmap(0, FILESIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd[j], 0);
j++;
sprintf(buffer,"/tmp/s_im_%d_%d.bin",id,i);
fd[j] = open(buffer, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
result = lseek(fd[j], FILESIZE-1, SEEK_SET);
result = write(fd[j], "", 1);
(*s_im)[i] = mmap(0, FILESIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd[j], 0);
j++;
sprintf(buffer,"/tmp/r_re_%d_%d.bin",id,i);
fd[j] = open(buffer, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
result = lseek(fd[j], FILESIZE-1, SEEK_SET);
result = write(fd[j], "", 1);
(*r_re)[i] = mmap(0, FILESIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd[j], 0);
j++;
sprintf(buffer,"/tmp/r_im_%d_%d.bin",id,i);
fd[j] = open(buffer, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
result = lseek(fd[j], FILESIZE-1, SEEK_SET);
result = write(fd[j], "", 1);
(*r_im)[i] = mmap(0, FILESIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd[j], 0);
j++;
}
for (i=0;i<2;i++) {
(*r_re0)[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
bzero((*r_re0)[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
(*r_im0)[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
bzero((*r_im0)[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
}
}
void init_mmap(int id,LTE_DL_FRAME_PARMS *frame_parms, double ***s_re,double ***s_im,double ***r_re,double ***r_im,double ***r_re0,double ***r_im0) {
int i;
int fd[20];
int result;
double *map;
unsigned int FILESIZE;
FILESIZE=FRAME_LENGTH_COMPLEX_SAMPLES*(sizeof(double));
*s_re = malloc(2*sizeof(double*));
*s_im = malloc(2*sizeof(double*));
*r_re = malloc(2*sizeof(double*));
*r_im = malloc(2*sizeof(double*));
*r_re0 = malloc(2*sizeof(double*));
*r_im0 = malloc(2*sizeof(double*));
char buffer[100];
int j=0;
for (i=0;i<2;i++) {
sprintf(buffer,"/tmp/s_re_%d_%d.bin",id,i);
fd[j] = open(buffer, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
result = lseek(fd[j], FILESIZE-1, SEEK_SET);
result = write(fd[j], "", 1);
(*s_re)[i] = mmap(0, FILESIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd[j], 0);
j++;
sprintf(buffer,"/tmp/s_im_%d_%d.bin",id,i);
fd[j] = open(buffer, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
result = lseek(fd[j], FILESIZE-1, SEEK_SET);
result = write(fd[j], "", 1);
(*s_im)[i] = mmap(0, FILESIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd[j], 0);
j++;
sprintf(buffer,"/tmp/r_re_%d_%d.bin",id,i);
fd[j] = open(buffer, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
result = lseek(fd[j], FILESIZE-1, SEEK_SET);
result = write(fd[j], "", 1);
(*r_re)[i] = mmap(0, FILESIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd[j], 0);
j++;
sprintf(buffer,"/tmp/r_im_%d_%d.bin",id,i);
fd[j] = open(buffer, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
result = lseek(fd[j], FILESIZE-1, SEEK_SET);
result = write(fd[j], "", 1);
(*r_im)[i] = mmap(0, FILESIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd[j], 0);
j++;
}
for (i=0;i<2;i++) {
(*r_re0)[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
bzero((*r_re0)[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
(*r_im0)[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
bzero((*r_im0)[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
}
}
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*
* channel_sim_proc.h
*
*/
#ifndef CHANNEL_SIM_PROC_H_
#define CHANNEL_SIM_PROC_H_
void mmap_enb(int id,int **tx_data[3],int **rx_data[3],LTE_DL_FRAME_PARMS *frame_parms);
void mmap_ue(int id,int ***tx_data,int ***rx_data,LTE_DL_FRAME_PARMS *frame_parms);
void Clean_Param(double **r_re,double **r_im,LTE_DL_FRAME_PARMS *frame_parms);
void do_DL_sig_channel_T(void *param);
void do_UL_sig_channel_T(void *param);
void init_rre(LTE_DL_FRAME_PARMS *frame_parms,double ***r_re0,double ***r_im0);
void Channel_Out(lte_subframe_t direction,int eNB_id,int UE_id,double **r_re,double **r_im,double **r_re0,double **r_im0,LTE_DL_FRAME_PARMS *frame_parms);
#endif /* CHANNEL_SIM_PROC_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef __INTERFACE_H__
# define __INTERFACE_H__
typedef struct {
void* pointer;
} memory_reference_t2;
typedef struct {
memory_reference_t2 mem_ref;
} obj_ref_t2;
typedef struct {
obj_ref_t2 *gm;
} HO;
typedef struct {
void* pointer;
int port;
int Exec_Msg_Flag;
int node_id;
int node_role ;
int next_slot;
int last_slot;
int frame;
int sub_frame;
int slot;
int Exec_FLAG;
int EResp_FLAG;
int ue_id;
} s_t;
HO Instance[3];
typedef struct {
int thread_id;
int eNB_id;
int UE_id;
double **s_re;
double **s_im;
double **r_re;
double **r_im;
double **r_re0;
double **r_im0;
struct channel_desc_t *eNB2UE;
struct channel_desc_t *UE2eNB;
struct node_desc_t *enb_data;
struct node_desc_t *ue_data;
int *next_slot;
int *abstraction_flag;
struct LTE_DL_FRAME_PARMS *frame_parms;
int **tx_data[3];
int **rx_data[3];
} ch_thread;
#define CHANNEL_PORT 37800
#define eNB_PORT 38800
#define UE_PORT 39800
#define MAX_eNB 20
#define MAX_UE 20
#endif
# Include some shared directives
include $(OPENAIR_TARGETS)/Makerules
default: oaisim
include $(OPENAIR_TARGETS)/Makefile.common
TOP_DIR = $(OPENAIR1_DIR)
OPENAIR1_TOP = $(OPENAIR1_DIR)
OPENAIR2_TOP = $(OPENAIR2_DIR)
OPENAIR3_TOP = $(OPENAIR3_DIR)
OPENAIR3 = $(OPENAIR3_DIR)
ifeq ($(DEBUG),1)
CFLAGS += -g -ggdb -DDEBUG_PHY -DDEBUG_MEAS
CFLAGS += -DRRC_MSG_PRINT
CFLAGS += -DPDCP_MSG_PRINT
CFLAGS += -DTRACE_RLC_UM_PDU
CFLAGS += -DTRACE_RLC_AM_PDU
else
CFLAGS += -DTRACE_RLC_UM_PDU
CFLAGS += -DTRACE_RLC_AM_PDU
endif
ifeq ($(MSG_PRINT),1)
CFLAGS += -DRRC_MSG_PRINT
CFLAGS += -DPDCP_MSG_PRINT
endif
CFLAGS += -Wpointer-sign
CFLAGS += -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 $(CPUFLAGS) -I/usr/include/X11 #-Wno-packed-bitfield-compat
ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
CFLAGS += -DOPENAIR_LTE #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 #-DRLC_UM_TEST_TRAFFIC=1
#CFLAGS += -DLLR8
CFLAGS += -DPACKAGE_NAME='"oaisim"'
ifndef OPENAIR2
OPENAIR2=1
endif
ifdef DEBUG
DISABLE_XER_PRINT=0
MSG_PRINT=1
endif
ifeq ($(LOCALIZATION), 1)
CFLAGS += -DLOCALIZATION
endif
ifeq ($(LINUX_LIST), 1)
CFLAGS += -DLINUX_LIST
endif
ifdef TRAFFIC_TM5
CFLAGS += -DRLC_UM_TEST_TRAFFIC=1 #-DFULL_BUFFER=1
endif
# activate OCG and libxml only under linux
ifeq ($(linux),1)
CFLAGS += $(LIBXML2_CFLAGS) -L/usr/local/lib -I/usr/include/atlas -L/usr/X11R6/lib
OCG_FLAG =1
CFLAGS += -DLINUX
endif
ifdef SMBV
CFLAGS += -DSMBV
endif
ifeq ($(XFORMS), 1)
CFLAGS += -DXFORMS
endif
ifdef DB
# Check if libmysqlclient is installed and use it if found to store simulation data for postprocessing
ENABLE_DB = $(shell if [ `dpkg -l | grep libmysqlclient -c` = "0" ]; then echo "0" ; else echo "1" ; fi )
ifeq ($(ENABLE_DB), 1)
CFLAGS +=-I/usr/include/mysql -L/usr/lib/mysql -DENABLE_DB_STATS
DB_LDFLAGS = -lmysqlclient
endif
endif
ifdef PRINT_STATS
CFLAGS += -DPRINT_STATS
endif
ifndef rrc_cellular
rrc_cellular = 0
rrc_cellular_eNB = 0
rrc_cellular_UE = 0
else
ifeq ($(eNB_flag),1)
rrc_cellular_eNB=1
endif
ifeq ($(UE_flag),1)
rrc_cellular_UE=1
endif
endif
ifdef LS
CFLAGS += -DLARGE_SCALE
endif
# ln -sf EUTRA-RRC-Definitions-a20.asn EUTRA-RRC-Definitions.asn
# make cleanasn1
#make all Rel10=1
ifdef CBA
CFLAGS += -DRel10
CFLAGS += -DCBA
$(info "Rel10=1 CBA=1")
else ifdef Rel10
CFLAGS += -DRel10
$(info "Rel10=1")
else # default is rel 8
$(info "Rel8=1")
CFLAGS += -DRel8
endif
#CFLAGS += -DMAX_NUM_CCs=1
ifeq ($(RLC_STOP_ON_LOST_PDU), 1)
CFLAGS += -DRLC_STOP_ON_LOST_PDU
endif
ifeq ($(STOP_ON_IP_TRAFFIC_OVERLOAD), 1)
CFLAGS += -DSTOP_ON_IP_TRAFFIC_OVERLOAD
endif
ifeq ($(USE_3GPP_ADDR_AS_LINK_ADDR), 1)
CFLAGS += -DUSE_3GPP_ADDR_AS_LINK_ADDR
endif
endif
ifeq ($(LINK_ENB_PDCP_TO_IP_DRIVER), 1)
CFLAGS += -DPDCP_USE_NETLINK -DLINUX
NAS_FLAG=1
endif
ifeq ($(LINK_ENB_PDCP_TO_GTPV1U), 1)
CFLAGS += -DLINK_ENB_PDCP_TO_GTPV1U
endif
ifdef TEST_OMG
CFLAGS += -DTEST_OMG
#CFLAGS += -DDEBUG_OMG
endif
# after the execution, a profiling output "gmon.out" will be created,
#then we need to run "gprof ./oaisim > gmon.txt" in the same directory as "gmon.out"
# you could also use the script "grpof2dot.py gmon.txt" for visual diagrams
ifdef GPROF
CFLAGS += -pg
endif
#require kernel patch for oai driver to enable address autoconfiguration (IPv6 only)
ifdef ADDCONF
CFLAGS+=-DADDRCONF
endif
ifdef OAI_NW_DRIVER_TYPE_ETHERNET
CFLAGS+=-DOAI_NW_DRIVER_TYPE_ETHERNET
endif
CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME
ifndef DISABLE_XER_PRINT
CFLAGS += -DXER_PRINT
endif
ifdef SECU
ifeq ($(NETTLE_FOUND), 0)
$(warning "Nettle library >= 2.5 is not installed on your system, nettle-dev lib needed, continuing with security disabled")
SECU=0
else
ifeq ($(OPENSSL_FOUND), 0)
$(warning "openssl library is not installed on your system, openssl lib needed, continuing with security disabled")
SECU=0
else
CFLAGS += -DENABLE_SECURITY
LIBS += $(OPENSSL_LIBS) $(NETTLE_LIBS)
endif
endif
endif
include $(OPENAIR1_DIR)/PHY/Makefile.inc
include $(OPENAIR1_DIR)/SCHED/Makefile.inc
include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
include $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/Makefile.inc
include $(OPENAIR2_DIR)/RRC/NAS/Makefile.inc
include $(OPENAIR2_DIR)/UTIL/Makefile.inc
include $(OPENAIR3_DIR)/RAL-LTE/Makefile.inc
include $(OPENAIR2_DIR)/ENB_APP/Makefile.inc
INCLUDES += -I$(TOP_DIR)
INCLUDES += $(L2_incl)
INCLUDES += $(ENB_APP_incl)
INCLUDES += $(UTIL_incl)
INCLUDES += $(UTILS_incl)
INCLUDES += -I$(ASN1_MSG_INC)
INCLUDES += -I$(COMMON_UTILS_DIR)/collection
SIMULATION_OBJS = $(TOP_DIR)/SIMULATION/TOOLS/gauss.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/random_channel.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/rangen_double.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/taus.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/multipath_channel.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/abstraction.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/RF/rf.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/RF/adc.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/RF/dac.o
ASN1_RRC_MSG_OBJS1=$(addprefix $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/, $(ASN1_MSG_OBJS))
OAISIM_OBJS_COMMON = $(OPENAIR_TARGETS)/SIMU/USER/channel_sim.o
OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/init_lte.o
OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/oaisim_config.o
OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/sinr_sim.o
OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/cor_SF_sim.o
OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/oaisim_functions.o
OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/event_handler.o
OAISIM_OBJS = $(OPENAIR_TARGETS)/SIMU/USER/oaisim.o
ifeq ($(XFORMS), 1)
TOOLS_OBJS += $(OPENAIR1_DIR)/PHY/TOOLS/lte_phy_scope.o
endif
ifdef PAD
CFLAGS += -DPAD
endif
OAISIM_PAD_OBJS = $(OPENAIR_TARGETS)/SIMU/USER/discrete_event_generator.o
OAISIM_PAD_OBJS += $(OPENAIR_TARGETS)/SIMU/USER/threadpool.o
OAISIM_PAD_OBJS += $(OPENAIR_TARGETS)/SIMU/USER/oaisim_pad.o
#deactivate the log offloading
ifndef LOG_THREAD
CFLAGS +=-DLOG_NO_THREAD
endif
ifdef PROC
INT_OBJS += $(OPENAIR_TARGETS)/SIMU/PROC/channel_sim_proc.o
INT_OBJS += $(OPENAIR_TARGETS)/SIMU/PROC/Process.o
CFLAGS += -DPROC
endif
CFLAGS += -DENABLE_VCD_FIFO
CFLAGS += -DENABLE_NEW_MULTICAST
ifdef NAS
CFLAGS += -DPDCP_USE_NETLINK_QUEUES
endif
# CFLAGS += -DENABLE_LOG_FIFO
# Check if libpgm is installed and use it if found instead of the unreliable
# multicast
ifeq ($(PGM_FOUND), 1)
CFLAGS += $(PGM_CFLAGS)
LIBS += $(PGM_LIBS)
endif
OBJ += $(PHY_OBJS) $(SIMULATION_OBJS) $(ETHERNET_TRANSPORT_OBJS) $(TOOLS_OBJS) $(SCHED_OBJS) $(STATS_OBJS) $(NAS_OBJS)
OBJ += $(INT_OBJS) $(UTIL_OBJ) $(UTILS_OBJS) $(OAISIM_OBJS_COMMON) $(ENB_APP_OBJS)
ifeq ($(OPENAIR2),1)
OBJ += $(L2_OBJS)
endif
LFDS_OBJ_DIR = $(subst $(OPENAIR_DIR),$(OBJS_DIR),$(LFDS_DIR))
LFDS_LIB = $(LFDS_OBJ_DIR)/bin/liblfds611.a
LIBS += $(LFDS_LIB)
SHARED_DEPENDENCIES += $(LFDS_LIB)
all: oaisim
pad: oaisim_pad
userclean: cleanall oaisim
objsdir:
@if [ ! -d $(OBJS_DIR) ]; then mkdir -p $(OBJS_DIR); fi
printvars:
@echo rrc_cellular variable is $(rrc_cellular)
@echo EXTRA_CFLAGS = $(EXTRA_CFLAGS)
@echo OAI Config generator is $(OCG_FLAG)
@echo OAI NETLINK FLAG is $(NAS_FLAG)
@echo SSE3 proc is $(SSE3PROC)
@echo L2 objs are $(L2_OBJS)
@echo eNB_flag is $(eNB_flag)
@echo UE_flag is $(UE_flag)
@echo S1AP objs: $(S1AP_BUILT_OBJS)
@echo X2AP objs: $(X2AP_BUILT_OBJS)
@echo CFLAGS: $(CFLAGS)
@echo Enable PGM: $(PGM_FOUND)
##UTIL_YAC_C = $(OPENAIR2_TOP)/UTIL/enb_parser.o
##$(UTIL_LEX_C) = $(subst $(OPENAIR_DIR), $(OBJS_DIR), $(OBJ) $(OAISIM_OBJS) $(ASN1_RRC_MSG_OBJS1))
OAISIM_COMPILED_OBJECTS = $(subst $(OPENAIR_DIR), $(OBJS_DIR), $(OBJ) $(OAISIM_OBJS) $(ASN1_RRC_MSG_OBJS1))
-include $(ITTI_MESSAGES_XML:.xml=.d)
-include $(OAISIM_PAD_OBJS:.o=.d)
-include $(OAISIM_COMPILED_OBJECTS:.o=.d)
ifdef ENABLE_ITTI
$(OAISIM_COMPILED_OBJECTS): $(ITTI_MESSAGES_H)
oaisim_pad.o: $(ITTI_MESSAGES_H)
endif
$(OAISIM_COMPILED_OBJECTS): | objsdir
.SECONDEXPANSION:
$(OAISIM_COMPILED_OBJECTS) $(OAISIM_PAD_OBJS): %.o : $$(subst $(OBJS_DIR), $(OPENAIR_DIR), $$*.c)
@echo Compiling $<
@if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi;
@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -DPHY_CONTEXT=1 $(INCLUDES) -o $@ $<
@$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) -DPHY_CONTEXT=1 $(INCLUDES) $< > $*.d
@mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
@rm -f $*.d.tmp
$(LFDS_LIB):
@if [ ! -d $(LFDS_OBJ_DIR)/bin ]; then mkdir -p $(LFDS_OBJ_DIR)/bin; fi;
@if [ ! -d $(LFDS_OBJ_DIR)/obj ]; then mkdir -p $(LFDS_OBJ_DIR)/obj; fi;
$(MAKE) -C $(LFDS_DIR) -f makefile.linux OUTDIR=$(LFDS_OBJ_DIR)
oaisim_pad: $(OBJ) $(OAISIM_PAD_OBJS) $(ASN1_RRC_MSG_OBJS1)
@echo "Linking oaisim_pad ..."
@$(MPICC) $(INCLUDES) $(S1AP_Incl) $(X2AP_Incl) -o oaisim_pad $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(OAISIM_PAD_OBJS) $(ASN1_RRC_MSG_OBJS1) \
-lpthread -llapack_atlas -lforms -lrt -lconfig $(LIBS) $(DB_LDFLAGS)
oaisim: $(OAISIM_COMPILED_OBJECTS) $(SHARED_DEPENDENCIES)
@echo "Linking oaisim ..."
@$(CC) $(INCLUDES) $(S1AP_Incl) $(X2AP_Incl) -o oaisim $(CFLAGS) $(EXTRA_CFLAGS) $(OAISIM_COMPILED_OBJECTS) \
-lpthread -llapack_atlas -lforms -lrt -lconfig $(LIBS) $(DB_LDFLAGS)
ifeq ($(rrc_cellular_eNB),1)
mv oaisim oaisim_eNB
endif
ifeq ($(rrc_cellular_UE),1)
mv oaisim oaisim_UE
endif
oaisimCROWN: $(OBJ) $(ASN1_RRC_MSG_OBJS1) oaisimCROWN.c
@echo "Compiling oaisimCROWN.c ..."
@$(CC) oaisimCROWN.c $(INCLUDES) $(S1AP_Incl) $(X2AP_Incl) -o oaisimCROWN $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(ASN1_RRC_MSG_OBJS1) -lm -lblas -lpthread -llapack_atlas -lforms $(LIBXML2_LIBS) -lX11 -lXpm -lrt -lconfig
oai_nw_drv:
(cd $(OPENAIR2_DIR) && $(MAKE) oai_nw_drv.ko)
(cp $(OPENAIR2_DIR)/NAS/DRIVER/LITE/oai_nw_drv.ko . )
oai_nw_drv_clean:
(cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE && $(MAKE) clean)
nasmesh_fix:
(cd $(OPENAIR2_DIR)/NETWORK_DRIVER/MESH/RB_TOOL && $(MAKE) clean && $(MAKE))
(cd $(OPENAIR2_DIR) && $(MAKE) clean && $(MAKE) nasmesh_netlink_address_fix.ko)
nasmesh_fix_uninstall:
(sudo rmmod nasmesh.ko)
nasmesh_fix_install:
(sudo insmod $(OPENAIR2_DIR)/NETWORK_DRIVER/MESH/nasmesh.ko)
nasmesh_fix_reinstall:
(sudo rmmod nasmesh.ko)
(sudo insmod $(OPENAIR2_DIR)/NETWORK_DRIVER/MESH/nasmesh.ko)
nasmesh_nl:
(cd $(OPENAIR2_DIR)/NETWORK_RIVER/MESH/RB_TOOL && $(MAKE))
(cd $(OPENAIR2_DIR) && $(MAKE) nasmesh_netlink.ko)
(sudo insmod $(OPENAIR2_DIR)/NETWORK_DRIVER/MESH/nasmesh.ko)
rb_tool:
(cd $(OPENAIR2_DIR)/NETWORK_DRIVER/MESH/RB_TOOL && $(MAKE))
nasmesh_install:
(sudo rmmod nasmesh)
(sudo insmod $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko)
nasmesh_clean:
(cd $(OPENAIR2_DIR) && $(MAKE) clean)
nas_sim_mt_cellular:
( cd $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR && make nasmt_sim CELLULAR=1 NO_RRM=1)
nas_sim_rg_cellular:
( cd $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR && make nasrg_sim MASTER=1 CELLULAR=1 NO_RRM=1)
rrm_std_cellular:
( cd $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR && make cell_rrm CELL_RRM=1 CELLULAR=1 NO_RRM=1)
cleanall: common-cleanall clean cleanasn1
cleanalmostall: clean
rm -f $(ASN1_RRC_MSG_OBJS1)
clean: common-clean
@$(RM_F_V) oaisim
@$(RM_F_V) oaisim_pad
# @$(RM_F_V) $(ITTI_MESSAGES_H) $(ITTI_MESSAGES_XML) $(ITTI_MESSAGES_XML:.xml=.d)
@$(RM_F_V) $(OAISIM_PAD_OBJS)
@$(RM_F_V) $(OAISIM_PAD_OBJS:.o=.d)
@$(RM_F_V) $(OAISIM_COMPILED_OBJECTS)
@$(RM_F_V) $(OAISIM_COMPILED_OBJECTS:.o=.d)
@$(RM_F_V) *.exe*
@$(RM_F_V) $(ASN1_MSG_INC)/asn1_msg.o
cleanl1:
@$(RM_F_V) LOG_THREAD oaisim
@$(RM_F_V) $(PHY_OBJS) $(SCHED_OBJS)
@$(RM_F_V) *.o
@$(RM_F_V) *.exe
cleanl2:
@$(RM_F_V) $(L2_OBJS)
@$(RM_F_V) $(ASN1_MSG_INC)/asn1_msg.o
cleanasn1:
@$(RM_F_V) $(ASN1_RRC_MSG_OBJS1)
$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ; rm -f $(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) *.o *.d)
@$(RM_F_V) $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.am.sample
@$(RM_F_V) $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated
@$(RM_F_V) $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel*
cleancell:
@$(RM_F_V) $(OPENAIR2_DIR)/RRC/CELLULAR/*.o
@$(RM_F_V) $(OPENAIR2_DIR)/RRC/CELLULAR/*.d
@$(RM_F_V) $(OPENAIR2_DIR)/RRC/L2_INTERFACE/*.o
@$(RM_F_V) $(OPENAIR2_DIR)/RRC/L2_INTERFACE/*.d
@$(RM_F_V) $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR/*.o
@$(RM_F_V) $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR/*.d
cleanlfds:
$(MAKE) -C $(LFDS_DIR) -f makefile.linux clean
cppcheck:
@echo "cppcheck oaisim ..."
cppcheck $(INCLUDES) ${OBJ:.o=.c} ${OAISIM_OBJS,.o=.c} ${ASN1_RRC_MSG_OBJS1,.o=.c}
print:
@echo "OBJ " $(OBJ)
@echo "OAISIM_OBJS " $(OAISIM_OBJS)
@echo "OAISIM_PAD_OBJS " $(OAISIM_PAD_OBJS)
@echo "OCG_FLAG are " $(OCG_FLAG)
@echo "CFLAGS are " $(CFLAGS)
@echo "EXTRA_CFLAGS are" $(EXTRA_CFLAGS)
@echo "COMMON_CFLAGS are" $(COMMON_CFLAGS)
@echo "L2 includes are" $(L2_incl)
@echo "INCLUDES are" $(INCLUDES)
@echo "S1AP Includes are" $(S1AP_Incl)
@echo "X2AP Includes are" $(X2AP_Incl)
@echo "TOP_DIR Include is" I$(TOP_DIR)
@echo "UTIL includes are" $(UTIL_incl)
@echo "UTILS includes are" $(UTILS_incl)
@echo "IS_REL8 is " $(IS_REL8)
@echo "IS_REL10 is " $(IS_REL10)
@echo "ENABLE_DB is " $(ENABLE_DB)
@echo "Libs are" $(LIBS)
@echo "NAS" $(NAS)
showcflags:
@echo oaisim cflags: $(CFLAGS)
@echo oaisim includes: $(INCLUDES)
@if [ -d $(S1AP_DIR) ]; then $(MAKE) -C $(S1AP_DIR) -f Makefile.eNB showcflags; fi
@if [ -d $(X2AP_DIR) ]; then $(MAKE) -C $(X2AP_DIR) -f Makefile.inc showcflags; fi
otg_all: otg_latency otg_gp
# need to check if the file exists before calling otgplot
otg_latency:
export TITLE="Application OWD(ms)"
cp /tmp/otg_latency.dat /tmp/onewaydelay.dat
$(OPENAIR2_DIR)/UTIL/OTG/OTGplot "/tmp/otg_latency.dat" "[$(COL1):$(COL2)]"
otg_latency_bg:
export TITLE="Background OWD(ms)"
$(OPENAIR2_DIR)/UTIL/OTG/OTGplot "/tmp/otg_latency_bg.dat" "[$(COL1):$(COL2)]"
otg_gp:
export TITLE="Application Goodput(Kb/s)"
cp /tmp/otg_goodput.dat /tmp/goodput.dat
$(OPENAIR2_DIR)/UTIL/OTG/OTGplot "/tmp/goodput.dat" "[$(COL1):$(COL2)]"
otg_gp_bg:
export TITLE="Background Goodput(Kb/s)"
$(OPENAIR2_DIR)/UTIL/OTG/OTGplot "/tmp/otg_goodput_bg.dat" "[$(COL1):$(COL2)]"
otg_jitter:
export TITLE="Aplication Jitter(ms)"
$(OPENAIR2_DIR)/UTIL/OTG/OTGplot "/tmp/otg_jitter.dat" "[$(COL1):$(COL2)]"
pexpect = $(shell if [ `dpkg -l | grep pexpect -c` = "0" ]; then echo "0" ; else echo "1" ; fi )
pre-ci:
@echo "Pre-commit check"
ifeq ($(pexpect), 1)
ifndef PW
@echo "Usage: make pre-ci PW=mypassword"
@echo "Password is used to access the local host through ssh."
python $(OPENAIR_TARGETS)/TEST/OAI/test01.py
else
python $(OPENAIR_TARGETS)/TEST/OAI/test01.py -w $(PW)
endif
else
@echo "Python pexpect package is missing, please install"
endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "cor_SF_sim.h"
double ** createMat (int nbRow, int nbCol)
{
double **matrice;
int initcol, countr, countc;
matrice = malloc (nbRow * sizeof (double*));
for (initcol = 0; initcol < nbRow; initcol++) {
matrice[initcol] = malloc(nbCol * sizeof(double));
}
for (countr = 0; countr < nbRow; countr++) {
for (countc = 0; countc < nbCol; countc++) {
matrice[countr][countc] = 0;
}
}
return matrice;
}
void destroyMat(double **mat1,int row,int col)
{
int i;
for (i = 0; i < row; i++)
free(mat1[i]);
free(mat1);
}
double **init_SF (int map_length, int map_height, double decor_dist,
double variance)
{
double **SF = createMat (map_length, map_height);
double **unc_SF = createMat (map_length, map_height);
/*
double **L1 = createMat (2, 2);
double **L2 = createMat (3, 3);
double **L3 = createMat (4, 4);
double **L4 = createMat (5, 5);
*/
double L1[2][2] = {{0.0}}, L2[3][3] = {{0.0}}, L3[4][4] = {{0.0}}, L4[5][5] = {{0.0}};
double temp[2] = { 0.0 }, temp1[2] = {0.0}, temp2[3] = {0.0}, temp21[2] = {0.0}, temp3[4] = {0.0}, temp31[3] = {0.0}, temp4[5] = {0.0}, temp41[4] = {0.0}, temp211[3] = {0.0}, temp311[4] = {0.0},
temp411[5] = {0.0};
int i, j, aa, b, c, d, k, l, m, dd, kk, ll, mm, ii, jj;
/*double L1[2][2] = {{1.0000,0.0},{0.9512,0.3085}};
double L2[3][3] = {{1.0000,0.0,0.0},{0.9512,0.3085,0},{0.9512,0.0872,0.2959}};
double L3[4][4] = {{1.0000,0.0,0.0,0.0},{0.9512,0.3085,0.0,0.0},{0.9512,0.0872,0.2959 ,0.0},{0.9317,0.2105,0.1574,0.2506}};
double L4[5][5] = {{1.0000,0.0,0.0,0.0,0.0},{0.9512,0.3085,0.0,0.0,0.0},{ 0.9048,0.2934,0.3085,0.0,0.0},{0.9512,0.0872,0.0257,0.2948,0.0},{0.9317,0.2105,0.0872, 0.1504,0.2394}};
*/
double r = exp (-1 / decor_dist); // decorrelation factor mostly equal to 20
double r1 = pow (r, sqrt (2));
double r2 = pow (r, 2);
double r3 = pow (r, sqrt (5));
double L11[2][2] = { {1, r}, {r, 1} };
double L21[3][3] = { {1, r, r}, {r, 1, r1}, {r, r1, 1} };
double L31[4][4] = { {1, r, r, r1}, {r, 1, r1, r}, {r, r1, 1, r}, {r1, r, r, 1} };
double L41[5][5] = { {1, r, r2, r, r1}, {r, 1, r, r1, r}, {r2, r, 1, r3, r1}, {r, r1,r3, 1, r},
{r1, r, r1, r, 1}
};
L1[0][0] = L11[0][0];
L1[0][1] = L11[0][1];
L1[1][0] = L11[1][0];
L1[1][1] = L11[1][1];
/*for (bb = 0; bb < 2; bb++)
{
for (cc = 0; cc < 2; cc++)
{
//Lt1[bb*2+cc] = L11[bb][cc];
L1[bb][cc]=L11[bb][cc];
}
}*/
for (dd = 0; dd < 3; dd++) {
for (kk = 0; kk < 3; kk++) {
L2[dd][kk]=L21[dd][kk];
}
}
for (ll = 0; ll < 4; ll++) {
for (mm = 0; mm < 4; mm++) {
L3[ll][mm]=L31[ll][mm];
}
}
for (ii = 0; ii < 5; ii++) {
for (jj = 0; jj < 5; jj++) {
L4[ii][jj]=L41[ii][jj];
}
}
clapack_dpotrf(CblasRowMajor,CblasLower,2,&L1[0][0],2);
clapack_dpotrf(CblasRowMajor,CblasLower,3,&L2[0][0],3);
clapack_dpotrf(CblasRowMajor,CblasLower,4,&L3[0][0],4);
clapack_dpotrf(CblasRowMajor,CblasLower,5,&L4[0][0],5);
randominit (0);
for (i = 0; i < map_length; i++) {
for (j = 0; j < map_height; j++)
unc_SF[i][j] = gaussdouble (0.0, variance);
}
SF[0][0] = unc_SF[0][0];
//printf ("%f", SF[0][0]);
for (aa = 0; aa < 2; aa++) {
temp[aa] = L1[1][aa];
}
for (k = 1; k < map_height; k++) {
temp1[0] = SF[0][k - 1];
temp1[1] = unc_SF[0][k];
SF[0][k] = cblas_ddot (2, temp, 1, temp1, 1);
}
for (b = 0; b < 3; b++) {
temp2[b] = L2[2][b];
}
for (c = 0; c < 4; c++) {
temp3[c] = L3[3][c];
}
for (d = 0; d < 5; d++) {
temp4[d] = L4[4][d];
}
for (l = 1; l < map_length; l++) {
for (m = 0; m < map_height; m++) {
if (m == 0) {
temp21[0] = SF[l - 1][m];
temp21[1] = SF[l - 1][m + 1];
cblas_dtrsv (CblasRowMajor, CblasLower, CblasNoTrans,
CblasNonUnit, 2, &L1[0][0], 2, temp21, 1);
temp211[0] = temp21[0];
temp211[1] = temp21[1];
temp211[2] = unc_SF[l][m];
SF[l][m] = cblas_ddot (3, temp2, 1, temp211, 1);
} else if (m == map_height - 1) {
temp31[0] = SF[l - 1][m - 1];
temp31[1] = SF[l - 1][m];
temp31[2] = SF[l][m - 1];
cblas_dtrsv (CblasRowMajor, CblasLower, CblasNoTrans,
CblasNonUnit, 3, &L2[0][0], 3, temp31, 1);
temp311[0] = temp31[0];
temp311[1] = temp31[1];
temp311[2] = temp31[2];
temp311[3] = unc_SF[l][m];
SF[l][m] = cblas_ddot (4, temp3, 1, temp311, 1);
} else {
temp41[0] = SF[l - 1][m - 1];
temp41[1] = SF[l - 1][m];
temp41[2] = SF[l - 1][m + 1];
temp41[3] = SF[l][m - 1];
cblas_dtrsv (CblasRowMajor, CblasLower, CblasNoTrans,
CblasNonUnit, 4, &L3[0][0], 4, temp41, 1);
temp411[0] = temp41[0];
temp411[1] = temp41[1];
temp411[2] = temp41[2];
temp411[3] = temp41[3];
temp411[4] = unc_SF[l][m];
SF[l][m] = cblas_ddot (5, temp4, 1, temp411, 1);
}
}
}
destroyMat(unc_SF,map_length, map_height);
/*
destroyMat(L1,2,2);
destroyMat(L2,3,3);
destroyMat(L3,4,4);
destroyMat(L4,5,5);
*/
return SF;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include<stdio.h>
#include<math.h>
#include<cblas.h>
//#include<atlas_lapack.h>
#include<clapack.h>
#include<oaisim.h>
double **init_SF (int map_length, int map_height, double decor_dist, double variance); //,double decor,double var);
double **createMat (int nbRow, int nbCol);
void destroyMat(double **mat1,int row,int col);
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file event_handler.h
* \brief primitives to handle event acting on oai
* \author Navid Nikaein and Mohamed Said MOSLI BOUKSIAA,
* \date 2014
* \version 0.5
* @ingroup _oai
*/
#include "oaisim.h"
#include "UTIL/FIFO/pad_list.h"
void add_event(Event_t event);
void schedule(Operation_Type_t op, Event_Type_t type, int frame, char * key, void* value, int ue, int lcid);
void schedule_delayed(Operation_Type_t op, Event_Type_t type, char * key, void* value, char * time, int ue, int lcid);
void schedule_events(void);
void execute_events(frame_t frame);
void update_oai_model(char * key, void * value);
void update_sys_model(Event_t event);
void update_topo_model(Event_t event);
void update_app_model(Event_t event);
void update_emu_model(Event_t event);
void update_mac(Event_t event);
int validate_mac(Event_t event);
/*
void schedule_end_of_simulation(End_Of_Sim_Event_Type type, int value);
int end_of_simulation();
*/
-20,-19.8,-19.6,-19.4,-19.2,-19,-18.8,-18.6,-18.4,-18.2,-18,-17.8,-17.6,-17.4,-17.2,-17,-16.8,-16.6,-16.4,-16.2,-16,-15.8,-15.6,-15.4,-15.2,-15,-14.8,-14.6,-14.4,-14.2,-14,-13.8,-13.6,-13.4,-13.2,-13,-12.8,-12.6,-12.4,-12.2,-12,-11.8,-11.6,-11.4,-11.2,-11,-10.8,-10.6,-10.4,-10.2,-10,-9.8,-9.6,-9.4,-9.2,-9,-8.8,-8.6,-8.4,-8.2,-8,-7.8,-7.6,-7.4,-7.2,-7,-6.8,-6.6,-6.4,-6.2,-6,-5.8,-5.6,-5.4,-5.2,-5,-4.8,-4.6,-4.4,-4.2,-4,-3.8,-3.6,-3.4,-3.2,-3,-2.8,-2.6,-2.4,-2.2,-2,-1.8,-1.6,-1.4,-1.2,-1,-0.8,-0.6,-0.4,-0.2,0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2,2.2,2.4,2.6,2.8,3,3.2,3.4,3.6,3.8,4,4.2,4.4,4.6,4.8,5,5.2,5.4,5.6,5.8,6,6.2,6.4,6.6,6.8,7,7.2,7.4,7.6,7.8,8,8.2,8.4,8.6,8.8,9,9.2,9.4,9.6,9.8,10,10.2,10.4,10.6,10.8,11,11.2,11.4,11.6,11.8,12,12.2,12.4,12.6,12.8,13,13.2,13.4,13.6,13.8,14,14.2,14.4,14.6,14.8,15,15.2,15.4,15.6,15.8,16,16.2,16.4,16.6,16.8,17,17.2,17.4,17.6,17.8,18,18.2,18.4,18.6,18.8,19,19.2
0.014138,0.014992,0.015845,0.016699,0.017553,0.018407,0.01923,0.020054,0.020878,0.021701,0.022525,0.02368,0.024834,0.025989,0.027144,0.028299,0.029822,0.031346,0.03287,0.034393,0.035917,0.03769,0.039464,0.041237,0.043011,0.044784,0.047124,0.049465,0.051806,0.054146,0.056487,0.059209,0.061931,0.064654,0.067376,0.070098,0.073673,0.077247,0.080822,0.084396,0.087971,0.092295,0.09662,0.10094,0.10527,0.10959,0.11501,0.12043,0.12585,0.13127,0.13669,0.14362,0.15054,0.15747,0.1644,0.17133,0.17954,0.18776,0.19598,0.2042,0.21241,0.2223,0.23219,0.24208,0.25197,0.26186,0.27399,0.28613,0.29827,0.31041,0.32255,0.33706,0.35158,0.36609,0.38061,0.39513,0.41234,0.42955,0.44676,0.46397,0.48118,0.50187,0.52256,0.54325,0.56394,0.58463,0.60797,0.63131,0.65465,0.678,0.70134,0.72903,0.75673,0.78442,0.81212,0.83981,0.86994,0.90007,0.9302,0.96033,0.99047,1.0241,1.0577,1.0914,1.125,1.1587,1.1954,1.2321,1.2688,1.3054,1.3421,1.3818,1.4214,1.4611,1.5007,1.5404,1.5828,1.6253,1.6678,1.7102,1.7527,1.7968,1.8408,1.8849,1.929,1.9731,2.0189,2.0647,2.1105,2.1563,2.2022,2.2501,2.298,2.346,2.3939,2.4418,2.4901,2.5384,2.5867,2.6349,2.6832,2.7321,2.7811,2.83,2.8789,2.9279,2.9751,3.0224,3.0697,3.117,3.1643,3.2083,3.2524,3.2964,3.3404,3.3844,3.4235,3.4626,3.5017,3.5407,3.5798,3.6112,3.6426,3.674,3.7054,3.7368,3.7602,3.7835,3.8068,3.8302,3.8535,3.8685,3.8836,3.8986,3.9137,3.9288,3.9372,3.9456,3.954,3.9624,3.9708,3.9747,3.9786,3.9825,3.9864,3.9903,3.9918,3.9932,3.9947,3.9961,3.9975,3.9979,3.9983,3.9987,3.9991,3.9995,4
0.0035344,0.0037479,0.0039613,0.0041748,0.0043882,0.0046017,0.0048076,0.0050135,0.0052194,0.0054254,0.0056313,0.0059199,0.0062086,0.0064973,0.006786,0.0070746,0.0074556,0.0078365,0.0082174,0.0085983,0.0089792,0.0094226,0.0098659,0.010309,0.010753,0.011196,0.011781,0.012366,0.012951,0.013537,0.014122,0.014802,0.015483,0.016163,0.016844,0.017525,0.018418,0.019312,0.020205,0.021099,0.021993,0.023074,0.024155,0.025236,0.026317,0.027398,0.028753,0.030108,0.031463,0.032818,0.034173,0.035904,0.037636,0.039368,0.0411,0.042831,0.044886,0.04694,0.048994,0.051049,0.053103,0.055575,0.058047,0.06052,0.062992,0.065464,0.068498,0.071533,0.074568,0.077602,0.080637,0.084266,0.087895,0.091524,0.095153,0.098782,0.10308,0.10739,0.11169,0.11599,0.12029,0.12547,0.13064,0.13581,0.14098,0.14616,0.15199,0.15783,0.16366,0.1695,0.17533,0.18226,0.18918,0.19611,0.20303,0.20995,0.21749,0.22502,0.23255,0.24008,0.24762,0.25603,0.26444,0.27285,0.28126,0.28967,0.29884,0.30801,0.31719,0.32636,0.33554,0.34545,0.35536,0.36527,0.37518,0.3851,0.39571,0.40632,0.41694,0.42755,0.43817,0.44919,0.46021,0.47123,0.48226,0.49328,0.50473,0.51618,0.52763,0.53909,0.55054,0.56252,0.57451,0.58649,0.59847,0.61046,0.62253,0.6346,0.64667,0.65874,0.67081,0.68304,0.69527,0.7075,0.71973,0.73196,0.74379,0.75561,0.76743,0.77925,0.79108,0.80208,0.81309,0.8241,0.8351,0.84611,0.85588,0.86565,0.87541,0.88518,0.89495,0.9028,0.91065,0.9185,0.92635,0.93421,0.94004,0.94587,0.95171,0.95754,0.96337,0.96714,0.9709,0.97466,0.97843,0.98219,0.98429,0.98639,0.9885,0.9906,0.9927,0.99368,0.99465,0.99563,0.99661,0.99758,0.99794,0.9983,0.99866,0.99902,0.99938,0.99948,0.99958,0.99968,0.99978,0.99988,1
-20;-19.8;-19.6;-19.4;-19.2;-19;-18.8;-18.6;-18.4;-18.2;-18;-17.8;-17.6;-17.4;-17.2;-17;-16.8;-16.6;-16.4;-16.2;-16;-15.8;-15.6;-15.4;-15.2;-15;-14.8;-14.6;-14.4;-14.2;-14;-13.8;-13.6;-13.4;-13.2;-13;-12.8;-12.6;-12.4;-12.2;-12;-11.8;-11.6;-11.4;-11.2;-11;-10.8;-10.6;-10.4;-10.2;-10;-9.8;-9.6;-9.4;-9.2;-9;-8.8;-8.6;-8.4;-8.2;-8;-7.8;-7.6;-7.4;-7.2;-7;-6.8;-6.6;-6.4;-6.2;-6;-5.8;-5.6;-5.4;-5.2;-5;-4.8;-4.6;-4.4;-4.2;-4;-3.8;-3.6;-3.4;-3.2;-3;-2.8;-2.6;-2.4;-2.2;-2;-1.8;-1.6;-1.4;-1.2;-1;-0.8;-0.6;-0.4;-0.2;0;0.2;0.4;0.6;0.8;1;1.2;1.4;1.6;1.8;2;2.2;2.4;2.6;2.8;3;3.2;3.4;3.6;3.8;4;4.2;4.4;4.6;4.8;5;5.2;5.4;5.6;5.8;6;6.2;6.4;6.6;6.8;7;7.2;7.4;7.6;7.8;8;8.2;8.4;8.6;8.8;9;9.2;9.4;9.6;9.8;10;10.2;10.4;10.6;10.8;11;11.2;11.4;11.6;11.8;12;12.2;12.4;12.6;12.8;13;13.2;13.4;13.6;13.8;14;14.2;14.4;14.6;14.8;15;15.2;15.4;15.6;15.8;16;16.2;16.4;16.6;16.8;17;17.2;17.4;17.6;17.8;18;18.2;18.4;18.6;18.8;19;19.2
0.014138;0.014992;0.015845;0.016699;0.017553;0.018407;0.01923;0.020054;0.020878;0.021701;0.022525;0.02368;0.024834;0.025989;0.027144;0.028299;0.029822;0.031346;0.03287;0.034393;0.035917;0.03769;0.039464;0.041237;0.043011;0.044784;0.047124;0.049465;0.051806;0.054146;0.056487;0.059209;0.061931;0.064654;0.067376;0.070098;0.073673;0.077247;0.080822;0.084396;0.087971;0.092295;0.09662;0.10094;0.10527;0.10959;0.11501;0.12043;0.12585;0.13127;0.13669;0.14362;0.15054;0.15747;0.1644;0.17133;0.17954;0.18776;0.19598;0.2042;0.21241;0.2223;0.23219;0.24208;0.25197;0.26186;0.27399;0.28613;0.29827;0.31041;0.32255;0.33706;0.35158;0.36609;0.38061;0.39513;0.41234;0.42955;0.44676;0.46397;0.48118;0.50187;0.52256;0.54325;0.56394;0.58463;0.60797;0.63131;0.65465;0.678;0.70134;0.72903;0.75673;0.78442;0.81212;0.83981;0.86994;0.90007;0.9302;0.96033;0.99047;1.0241;1.0577;1.0914;1.125;1.1587;1.1954;1.2321;1.2688;1.3054;1.3421;1.3818;1.4214;1.4611;1.5007;1.5404;1.5828;1.6253;1.6678;1.7102;1.7527;1.7968;1.8408;1.8849;1.929;1.9731;2.0189;2.0647;2.1105;2.1563;2.2022;2.2501;2.298;2.346;2.3939;2.4418;2.4901;2.5384;2.5867;2.6349;2.6832;2.7321;2.7811;2.83;2.8789;2.9279;2.9751;3.0224;3.0697;3.117;3.1643;3.2083;3.2524;3.2964;3.3404;3.3844;3.4235;3.4626;3.5017;3.5407;3.5798;3.6112;3.6426;3.674;3.7054;3.7368;3.7602;3.7835;3.8068;3.8302;3.8535;3.8685;3.8836;3.8986;3.9137;3.9288;3.9372;3.9456;3.954;3.9624;3.9708;3.9747;3.9786;3.9825;3.9864;3.9903;3.9918;3.9932;3.9947;3.9961;3.9975;3.9979;3.9983;3.9987;3.9991;3.9995;4
0.0035344;0.0037479;0.0039613;0.0041748;0.0043882;0.0046017;0.0048076;0.0050135;0.0052194;0.0054254;0.0056313;0.0059199;0.0062086;0.0064973;0.006786;0.0070746;0.0074556;0.0078365;0.0082174;0.0085983;0.0089792;0.0094226;0.0098659;0.010309;0.010753;0.011196;0.011781;0.012366;0.012951;0.013537;0.014122;0.014802;0.015483;0.016163;0.016844;0.017525;0.018418;0.019312;0.020205;0.021099;0.021993;0.023074;0.024155;0.025236;0.026317;0.027398;0.028753;0.030108;0.031463;0.032818;0.034173;0.035904;0.037636;0.039368;0.0411;0.042831;0.044886;0.04694;0.048994;0.051049;0.053103;0.055575;0.058047;0.06052;0.062992;0.065464;0.068498;0.071533;0.074568;0.077602;0.080637;0.084266;0.087895;0.091524;0.095153;0.098782;0.10308;0.10739;0.11169;0.11599;0.12029;0.12547;0.13064;0.13581;0.14098;0.14616;0.15199;0.15783;0.16366;0.1695;0.17533;0.18226;0.18918;0.19611;0.20303;0.20995;0.21749;0.22502;0.23255;0.24008;0.24762;0.25603;0.26444;0.27285;0.28126;0.28967;0.29884;0.30801;0.31719;0.32636;0.33554;0.34545;0.35536;0.36527;0.37518;0.3851;0.39571;0.40632;0.41694;0.42755;0.43817;0.44919;0.46021;0.47123;0.48226;0.49328;0.50473;0.51618;0.52763;0.53909;0.55054;0.56252;0.57451;0.58649;0.59847;0.61046;0.62253;0.6346;0.64667;0.65874;0.67081;0.68304;0.69527;0.7075;0.71973;0.73196;0.74379;0.75561;0.76743;0.77925;0.79108;0.80208;0.81309;0.8241;0.8351;0.84611;0.85588;0.86565;0.87541;0.88518;0.89495;0.9028;0.91065;0.9185;0.92635;0.93421;0.94004;0.94587;0.95171;0.95754;0.96337;0.96714;0.9709;0.97466;0.97843;0.98219;0.98429;0.98639;0.9885;0.9906;0.9927;0.99368;0.99465;0.99563;0.99661;0.99758;0.99794;0.9983;0.99866;0.99902;0.99938;0.99948;0.99958;0.99968;0.99978;0.99988;1
-20,-19.8,-19.6,-19.4,-19.2,-19,-18.8,-18.6,-18.4,-18.2,-18,-17.8,-17.6,-17.4,-17.2,-17,-16.8,-16.6,-16.4,-16.2,-16,-15.8,-15.6,-15.4,-15.2,-15,-14.8,-14.6,-14.4,-14.2,-14,-13.8,-13.6,-13.4,-13.2,-13,-12.8,-12.6,-12.4,-12.2,-12,-11.8,-11.6,-11.4,-11.2,-11,-10.8,-10.6,-10.4,-10.2,-10,-9.8,-9.6,-9.4,-9.2,-9,-8.8,-8.6,-8.4,-8.2,-8,-7.8,-7.6,-7.4,-7.2,-7,-6.8,-6.6,-6.4,-6.2,-6,-5.8,-5.6,-5.4,-5.2,-5,-4.8,-4.6,-4.4,-4.2,-4,-3.8,-3.6,-3.4,-3.2,-3,-2.8,-2.6,-2.4,-2.2,-2,-1.8,-1.6,-1.4,-1.2,-1,-0.8,-0.6,-0.4,-0.2,0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2,2.2,2.4,2.6,2.8,3,3.2,3.4,3.6,3.8,4,4.2,4.4,4.6,4.8,5,5.2,5.4,5.6,5.8,6,6.2,6.4,6.6,6.8,7,7.2,7.4,7.6,7.8,8,8.2,8.4,8.6,8.8,9,9.2,9.4,9.6,9.8,10,10.2,10.4,10.6,10.8,11,11.2,11.4,11.6,11.8,12,12.2
0.014938,0.015535,0.016131,0.016727,0.017324,0.01792,0.018791,0.019662,0.020533,0.021404,0.022276,0.023689,0.025102,0.026515,0.027928,0.029341,0.030588,0.031835,0.033082,0.034329,0.035575,0.03748,0.039384,0.041289,0.043193,0.045098,0.047475,0.049853,0.05223,0.054607,0.056985,0.059606,0.062228,0.06485,0.067472,0.070094,0.07367,0.077247,0.080824,0.0844,0.087977,0.092384,0.096792,0.1012,0.10561,0.11001,0.11567,0.12133,0.12699,0.13265,0.13831,0.14512,0.15193,0.15874,0.16555,0.17236,0.18045,0.18854,0.19663,0.20472,0.21282,0.22319,0.23357,0.24395,0.25433,0.26471,0.27602,0.28733,0.29863,0.30994,0.32125,0.33583,0.35041,0.36499,0.37957,0.39415,0.4114,0.42865,0.4459,0.46315,0.4804,0.50048,0.52055,0.54063,0.5607,0.58078,0.60421,0.62764,0.65107,0.6745,0.69793,0.72389,0.74984,0.7758,0.80176,0.82771,0.85656,0.88541,0.91425,0.9431,0.97194,1.0031,1.0343,1.0655,1.0967,1.1279,1.1592,1.1905,1.2218,1.2531,1.2845,1.3156,1.3467,1.3778,1.4089,1.44,1.4699,1.4999,1.5298,1.5598,1.5897,1.6156,1.6414,1.6672,1.6931,1.7189,1.7397,1.7606,1.7814,1.8022,1.823,1.839,1.8549,1.8708,1.8868,1.9027,1.9124,1.922,1.9317,1.9414,1.9511,1.9569,1.9628,1.9687,1.9745,1.9804,1.9831,1.9857,1.9884,1.991,1.9937,1.9947,1.9957,1.9967,1.9977,1.9986,1.9989,1.9991,1.9993,1.9996,1.9998,2
0.0074691,0.0077673,0.0080654,0.0083636,0.0086618,0.00896,0.0093955,0.0098311,0.010267,0.010702,0.011138,0.011844,0.012551,0.013257,0.013964,0.014671,0.015294,0.015917,0.016541,0.017164,0.017788,0.01874,0.019692,0.020644,0.021597,0.022549,0.023738,0.024926,0.026115,0.027304,0.028492,0.029803,0.031114,0.032425,0.033736,0.035047,0.036835,0.038623,0.040412,0.0422,0.043988,0.046192,0.048396,0.050599,0.052803,0.055007,0.057836,0.060666,0.063496,0.066325,0.069155,0.07256,0.075965,0.07937,0.082775,0.08618,0.090225,0.094271,0.098317,0.10236,0.10641,0.1116,0.11679,0.12198,0.12717,0.13235,0.13801,0.14366,0.14932,0.15497,0.16063,0.16792,0.17521,0.1825,0.18979,0.19708,0.2057,0.21433,0.22295,0.23158,0.2402,0.25024,0.26028,0.27031,0.28035,0.29039,0.3021,0.31382,0.32553,0.33725,0.34897,0.36194,0.37492,0.3879,0.40088,0.41386,0.42828,0.4427,0.45713,0.47155,0.48597,0.50156,0.51715,0.53275,0.54834,0.56393,0.57959,0.59525,0.61091,0.62657,0.64223,0.65779,0.67334,0.68889,0.70445,0.72,0.73497,0.74994,0.76492,0.77989,0.79486,0.80778,0.8207,0.83362,0.84654,0.85946,0.86987,0.88029,0.8907,0.90111,0.91152,0.91948,0.92745,0.93542,0.94338,0.95135,0.95619,0.96102,0.96586,0.9707,0.97554,0.97847,0.9814,0.98433,0.98727,0.9902,0.99153,0.99286,0.99419,0.99552,0.99685,0.99735,0.99784,0.99834,0.99883,0.99932,0.99944,0.99956,0.99967,0.99979,0.9999,1
-20;-19.8;-19.6;-19.4;-19.2;-19;-18.8;-18.6;-18.4;-18.2;-18;-17.8;-17.6;-17.4;-17.2;-17;-16.8;-16.6;-16.4;-16.2;-16;-15.8;-15.6;-15.4;-15.2;-15;-14.8;-14.6;-14.4;-14.2;-14;-13.8;-13.6;-13.4;-13.2;-13;-12.8;-12.6;-12.4;-12.2;-12;-11.8;-11.6;-11.4;-11.2;-11;-10.8;-10.6;-10.4;-10.2;-10;-9.8;-9.6;-9.4;-9.2;-9;-8.8;-8.6;-8.4;-8.2;-8;-7.8;-7.6;-7.4;-7.2;-7;-6.8;-6.6;-6.4;-6.2;-6;-5.8;-5.6;-5.4;-5.2;-5;-4.8;-4.6;-4.4;-4.2;-4;-3.8;-3.6;-3.4;-3.2;-3;-2.8;-2.6;-2.4;-2.2;-2;-1.8;-1.6;-1.4;-1.2;-1;-0.8;-0.6;-0.4;-0.2;0;0.2;0.4;0.6;0.8;1;1.2;1.4;1.6;1.8;2;2.2;2.4;2.6;2.8;3;3.2;3.4;3.6;3.8;4;4.2;4.4;4.6;4.8;5;5.2;5.4;5.6;5.8;6;6.2;6.4;6.6;6.8;7;7.2;7.4;7.6;7.8;8;8.2;8.4;8.6;8.8;9;9.2;9.4;9.6;9.8;10;10.2;10.4;10.6;10.8;11;11.2;11.4;11.6;11.8;12;12.2
0.014938;0.015535;0.016131;0.016727;0.017324;0.01792;0.018791;0.019662;0.020533;0.021404;0.022276;0.023689;0.025102;0.026515;0.027928;0.029341;0.030588;0.031835;0.033082;0.034329;0.035575;0.03748;0.039384;0.041289;0.043193;0.045098;0.047475;0.049853;0.05223;0.054607;0.056985;0.059606;0.062228;0.06485;0.067472;0.070094;0.07367;0.077247;0.080824;0.0844;0.087977;0.092384;0.096792;0.1012;0.10561;0.11001;0.11567;0.12133;0.12699;0.13265;0.13831;0.14512;0.15193;0.15874;0.16555;0.17236;0.18045;0.18854;0.19663;0.20472;0.21282;0.22319;0.23357;0.24395;0.25433;0.26471;0.27602;0.28733;0.29863;0.30994;0.32125;0.33583;0.35041;0.36499;0.37957;0.39415;0.4114;0.42865;0.4459;0.46315;0.4804;0.50048;0.52055;0.54063;0.5607;0.58078;0.60421;0.62764;0.65107;0.6745;0.69793;0.72389;0.74984;0.7758;0.80176;0.82771;0.85656;0.88541;0.91425;0.9431;0.97194;1.0031;1.0343;1.0655;1.0967;1.1279;1.1592;1.1905;1.2218;1.2531;1.2845;1.3156;1.3467;1.3778;1.4089;1.44;1.4699;1.4999;1.5298;1.5598;1.5897;1.6156;1.6414;1.6672;1.6931;1.7189;1.7397;1.7606;1.7814;1.8022;1.823;1.839;1.8549;1.8708;1.8868;1.9027;1.9124;1.922;1.9317;1.9414;1.9511;1.9569;1.9628;1.9687;1.9745;1.9804;1.9831;1.9857;1.9884;1.991;1.9937;1.9947;1.9957;1.9967;1.9977;1.9986;1.9989;1.9991;1.9993;1.9996;1.9998;2
0.0074691;0.0077673;0.0080654;0.0083636;0.0086618;0.00896;0.0093955;0.0098311;0.010267;0.010702;0.011138;0.011844;0.012551;0.013257;0.013964;0.014671;0.015294;0.015917;0.016541;0.017164;0.017788;0.01874;0.019692;0.020644;0.021597;0.022549;0.023738;0.024926;0.026115;0.027304;0.028492;0.029803;0.031114;0.032425;0.033736;0.035047;0.036835;0.038623;0.040412;0.0422;0.043988;0.046192;0.048396;0.050599;0.052803;0.055007;0.057836;0.060666;0.063496;0.066325;0.069155;0.07256;0.075965;0.07937;0.082775;0.08618;0.090225;0.094271;0.098317;0.10236;0.10641;0.1116;0.11679;0.12198;0.12717;0.13235;0.13801;0.14366;0.14932;0.15497;0.16063;0.16792;0.17521;0.1825;0.18979;0.19708;0.2057;0.21433;0.22295;0.23158;0.2402;0.25024;0.26028;0.27031;0.28035;0.29039;0.3021;0.31382;0.32553;0.33725;0.34897;0.36194;0.37492;0.3879;0.40088;0.41386;0.42828;0.4427;0.45713;0.47155;0.48597;0.50156;0.51715;0.53275;0.54834;0.56393;0.57959;0.59525;0.61091;0.62657;0.64223;0.65779;0.67334;0.68889;0.70445;0.72;0.73497;0.74994;0.76492;0.77989;0.79486;0.80778;0.8207;0.83362;0.84654;0.85946;0.86987;0.88029;0.8907;0.90111;0.91152;0.91948;0.92745;0.93542;0.94338;0.95135;0.95619;0.96102;0.96586;0.9707;0.97554;0.97847;0.9814;0.98433;0.98727;0.9902;0.99153;0.99286;0.99419;0.99552;0.99685;0.99735;0.99784;0.99834;0.99883;0.99932;0.99944;0.99956;0.99967;0.99979;0.9999;1
-20,-19.8,-19.6,-19.4,-19.2,-19,-18.8,-18.6,-18.4,-18.2,-18,-17.8,-17.6,-17.4,-17.2,-17,-16.8,-16.6,-16.4,-16.2,-16,-15.8,-15.6,-15.4,-15.2,-15,-14.8,-14.6,-14.4,-14.2,-14,-13.8,-13.6,-13.4,-13.2,-13,-12.8,-12.6,-12.4,-12.2,-12,-11.8,-11.6,-11.4,-11.2,-11,-10.8,-10.6,-10.4,-10.2,-10,-9.8,-9.6,-9.4,-9.2,-9,-8.8,-8.6,-8.4,-8.2,-8,-7.8,-7.6,-7.4,-7.2,-7,-6.8,-6.6,-6.4,-6.2,-6,-5.8,-5.6,-5.4,-5.2,-5,-4.8,-4.6,-4.4,-4.2,-4,-3.8,-3.6,-3.4,-3.2,-3,-2.8,-2.6,-2.4,-2.2,-2,-1.8,-1.6,-1.4,-1.2,-1,-0.8,-0.6,-0.4,-0.2,0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2,2.2,2.4,2.6,2.8,3,3.2,3.4,3.6,3.8,4,4.2,4.4,4.6,4.8,5,5.2,5.4,5.6,5.8,6,6.2,6.4,6.6,6.8,7,7.2,7.4,7.6,7.8,8,8.2,8.4,8.6,8.8,9,9.2,9.4,9.6,9.8,10,10.2,10.4,10.6,10.8,11,11.2,11.4,11.6,11.8,12,12.2,12.4,12.6,12.8,13,13.2,13.4,13.6,13.8,14,14.2,14.4,14.6,14.8,15,15.2,15.4,15.6,15.8,16,16.2,16.4,16.6,16.8,17,17.2,17.4,17.6,17.8,18,18.2,18.4,18.6,18.8,19,19.2,19.4,19.6,19.8,20,20.2,20.4,20.6,20.8,21,21.2,21.4,21.6,21.8,22,22.2,22.4,22.6,22.8,23,23.2,23.4,23.6,23.8,24,24.2,24.4,24.6,24.8,25,25.2
0.014329,0.015063,0.015797,0.016531,0.017266,0.018,0.01893,0.01986,0.020791,0.021721,0.022651,0.023849,0.025047,0.026245,0.027443,0.028642,0.03008,0.031518,0.032957,0.034395,0.035834,0.037611,0.039388,0.041166,0.042943,0.04472,0.046979,0.049237,0.051496,0.053755,0.056013,0.058941,0.061869,0.064797,0.067725,0.070653,0.074193,0.077734,0.081274,0.084814,0.088355,0.092706,0.097057,0.10141,0.10576,0.11011,0.11555,0.121,0.12644,0.13188,0.13733,0.14408,0.15084,0.1576,0.16435,0.17111,0.17937,0.18763,0.19589,0.20415,0.21241,0.22245,0.23248,0.24252,0.25256,0.2626,0.27469,0.28678,0.29888,0.31097,0.32306,0.33766,0.35225,0.36685,0.38144,0.39604,0.41344,0.43084,0.44824,0.46564,0.48304,0.50338,0.52372,0.54407,0.56441,0.58475,0.60833,0.63192,0.6555,0.67908,0.70266,0.73007,0.75747,0.78488,0.81228,0.83969,0.86999,0.9003,0.9306,0.96091,0.99121,1.0254,1.0595,1.0937,1.1279,1.162,1.1993,1.2365,1.2737,1.3109,1.3482,1.3887,1.4293,1.4699,1.5104,1.551,1.5939,1.6368,1.6797,1.7226,1.7655,1.8112,1.8568,1.9025,1.9482,1.9938,2.041,2.0882,2.1353,2.1825,2.2296,2.2795,2.3293,2.3791,2.4289,2.4788,2.53,2.5813,2.6326,2.6839,2.7351,2.7877,2.8403,2.8929,2.9455,2.9981,3.0522,3.1063,3.1604,3.2145,3.2686,3.3237,3.3788,3.4339,3.489,3.5441,3.6003,3.6564,3.7125,3.7686,3.8247,3.8815,3.9384,3.9952,4.052,4.1089,4.1662,4.2235,4.2808,4.3381,4.3954,4.4527,4.5099,4.5671,4.6244,4.6816,4.7375,4.7934,4.8492,4.9051,4.961,5.0138,5.0666,5.1195,5.1723,5.2251,5.2722,5.3192,5.3662,5.4132,5.4603,5.4992,5.538,5.5769,5.6158,5.6547,5.684,5.7134,5.7427,5.772,5.8013,5.821,5.8408,5.8605,5.8803,5.9,5.9114,5.9229,5.9343,5.9458,5.9572,5.9628,5.9684,5.974,5.9796,5.9852,5.9874,5.9895,5.9917,5.9938,5.996,5.9967,5.9973,5.998,5.9986,5.9993,6
0.0023882,0.0025106,0.0026329,0.0027552,0.0028776,0.0029999,0.003155,0.00331,0.0034651,0.0036202,0.0037752,0.0039749,0.0041746,0.0043742,0.0045739,0.0047736,0.0050133,0.0052531,0.0054928,0.0057325,0.0059723,0.0062685,0.0065647,0.0068609,0.0071571,0.0074534,0.0078298,0.0082062,0.0085827,0.0089591,0.0093356,0.0098236,0.010312,0.0108,0.011288,0.011776,0.012366,0.012956,0.013546,0.014136,0.014726,0.015451,0.016176,0.016901,0.017627,0.018352,0.019259,0.020166,0.021073,0.02198,0.022888,0.024014,0.02514,0.026266,0.027392,0.028519,0.029895,0.031272,0.032648,0.034025,0.035401,0.037074,0.038747,0.04042,0.042094,0.043767,0.045782,0.047797,0.049813,0.051828,0.053844,0.056276,0.058709,0.061141,0.063574,0.066006,0.068906,0.071806,0.074706,0.077606,0.080506,0.083897,0.087287,0.090678,0.094068,0.097458,0.10139,0.10532,0.10925,0.11318,0.11711,0.12168,0.12625,0.13081,0.13538,0.13995,0.145,0.15005,0.1551,0.16015,0.1652,0.1709,0.17659,0.18228,0.18798,0.19367,0.19988,0.20608,0.21229,0.21849,0.22469,0.23146,0.23822,0.24498,0.25174,0.2585,0.26565,0.2728,0.27995,0.2871,0.29425,0.30186,0.30947,0.31708,0.32469,0.3323,0.34016,0.34803,0.35589,0.36375,0.37161,0.37991,0.38822,0.39652,0.40482,0.41313,0.42167,0.43022,0.43876,0.44731,0.45586,0.46462,0.47338,0.48215,0.49091,0.49968,0.50869,0.51771,0.52673,0.53575,0.54476,0.55395,0.56313,0.57232,0.58151,0.59069,0.60004,0.6094,0.61875,0.6281,0.63745,0.64692,0.6564,0.66587,0.67534,0.68481,0.69437,0.70392,0.71347,0.72302,0.73257,0.74211,0.75165,0.76119,0.77073,0.78026,0.78958,0.79889,0.80821,0.81752,0.82683,0.83564,0.84444,0.85325,0.86205,0.87085,0.87869,0.88653,0.89437,0.90221,0.91004,0.91653,0.92301,0.92949,0.93597,0.94245,0.94734,0.95223,0.95711,0.962,0.96688,0.97017,0.97346,0.97675,0.98004,0.98333,0.98524,0.98715,0.98906,0.99096,0.99287,0.9938,0.99474,0.99567,0.9966,0.99754,0.9979,0.99826,0.99862,0.99897,0.99933,0.99944,0.99955,0.99966,0.99977,0.99988,1
-20;-19.8;-19.6;-19.4;-19.2;-19;-18.8;-18.6;-18.4;-18.2;-18;-17.8;-17.6;-17.4;-17.2;-17;-16.8;-16.6;-16.4;-16.2;-16;-15.8;-15.6;-15.4;-15.2;-15;-14.8;-14.6;-14.4;-14.2;-14;-13.8;-13.6;-13.4;-13.2;-13;-12.8;-12.6;-12.4;-12.2;-12;-11.8;-11.6;-11.4;-11.2;-11;-10.8;-10.6;-10.4;-10.2;-10;-9.8;-9.6;-9.4;-9.2;-9;-8.8;-8.6;-8.4;-8.2;-8;-7.8;-7.6;-7.4;-7.2;-7;-6.8;-6.6;-6.4;-6.2;-6;-5.8;-5.6;-5.4;-5.2;-5;-4.8;-4.6;-4.4;-4.2;-4;-3.8;-3.6;-3.4;-3.2;-3;-2.8;-2.6;-2.4;-2.2;-2;-1.8;-1.6;-1.4;-1.2;-1;-0.8;-0.6;-0.4;-0.2;0;0.2;0.4;0.6;0.8;1;1.2;1.4;1.6;1.8;2;2.2;2.4;2.6;2.8;3;3.2;3.4;3.6;3.8;4;4.2;4.4;4.6;4.8;5;5.2;5.4;5.6;5.8;6;6.2;6.4;6.6;6.8;7;7.2;7.4;7.6;7.8;8;8.2;8.4;8.6;8.8;9;9.2;9.4;9.6;9.8;10;10.2;10.4;10.6;10.8;11;11.2;11.4;11.6;11.8;12;12.2;12.4;12.6;12.8;13;13.2;13.4;13.6;13.8;14;14.2;14.4;14.6;14.8;15;15.2;15.4;15.6;15.8;16;16.2;16.4;16.6;16.8;17;17.2;17.4;17.6;17.8;18;18.2;18.4;18.6;18.8;19;19.2;19.4;19.6;19.8;20;20.2;20.4;20.6;20.8;21;21.2;21.4;21.6;21.8;22;22.2;22.4;22.6;22.8;23;23.2;23.4;23.6;23.8;24;24.2;24.4;24.6;24.8;25;25.2
0.014329;0.015063;0.015797;0.016531;0.017266;0.018;0.01893;0.01986;0.020791;0.021721;0.022651;0.023849;0.025047;0.026245;0.027443;0.028642;0.03008;0.031518;0.032957;0.034395;0.035834;0.037611;0.039388;0.041166;0.042943;0.04472;0.046979;0.049237;0.051496;0.053755;0.056013;0.058941;0.061869;0.064797;0.067725;0.070653;0.074193;0.077734;0.081274;0.084814;0.088355;0.092706;0.097057;0.10141;0.10576;0.11011;0.11555;0.121;0.12644;0.13188;0.13733;0.14408;0.15084;0.1576;0.16435;0.17111;0.17937;0.18763;0.19589;0.20415;0.21241;0.22245;0.23248;0.24252;0.25256;0.2626;0.27469;0.28678;0.29888;0.31097;0.32306;0.33766;0.35225;0.36685;0.38144;0.39604;0.41344;0.43084;0.44824;0.46564;0.48304;0.50338;0.52372;0.54407;0.56441;0.58475;0.60833;0.63192;0.6555;0.67908;0.70266;0.73007;0.75747;0.78488;0.81228;0.83969;0.86999;0.9003;0.9306;0.96091;0.99121;1.0254;1.0595;1.0937;1.1279;1.162;1.1993;1.2365;1.2737;1.3109;1.3482;1.3887;1.4293;1.4699;1.5104;1.551;1.5939;1.6368;1.6797;1.7226;1.7655;1.8112;1.8568;1.9025;1.9482;1.9938;2.041;2.0882;2.1353;2.1825;2.2296;2.2795;2.3293;2.3791;2.4289;2.4788;2.53;2.5813;2.6326;2.6839;2.7351;2.7877;2.8403;2.8929;2.9455;2.9981;3.0522;3.1063;3.1604;3.2145;3.2686;3.3237;3.3788;3.4339;3.489;3.5441;3.6003;3.6564;3.7125;3.7686;3.8247;3.8815;3.9384;3.9952;4.052;4.1089;4.1662;4.2235;4.2808;4.3381;4.3954;4.4527;4.5099;4.5671;4.6244;4.6816;4.7375;4.7934;4.8492;4.9051;4.961;5.0138;5.0666;5.1195;5.1723;5.2251;5.2722;5.3192;5.3662;5.4132;5.4603;5.4992;5.538;5.5769;5.6158;5.6547;5.684;5.7134;5.7427;5.772;5.8013;5.821;5.8408;5.8605;5.8803;5.9;5.9114;5.9229;5.9343;5.9458;5.9572;5.9628;5.9684;5.974;5.9796;5.9852;5.9874;5.9895;5.9917;5.9938;5.996;5.9967;5.9973;5.998;5.9986;5.9993;6
0.0023882;0.0025106;0.0026329;0.0027552;0.0028776;0.0029999;0.003155;0.00331;0.0034651;0.0036202;0.0037752;0.0039749;0.0041746;0.0043742;0.0045739;0.0047736;0.0050133;0.0052531;0.0054928;0.0057325;0.0059723;0.0062685;0.0065647;0.0068609;0.0071571;0.0074534;0.0078298;0.0082062;0.0085827;0.0089591;0.0093356;0.0098236;0.010312;0.0108;0.011288;0.011776;0.012366;0.012956;0.013546;0.014136;0.014726;0.015451;0.016176;0.016901;0.017627;0.018352;0.019259;0.020166;0.021073;0.02198;0.022888;0.024014;0.02514;0.026266;0.027392;0.028519;0.029895;0.031272;0.032648;0.034025;0.035401;0.037074;0.038747;0.04042;0.042094;0.043767;0.045782;0.047797;0.049813;0.051828;0.053844;0.056276;0.058709;0.061141;0.063574;0.066006;0.068906;0.071806;0.074706;0.077606;0.080506;0.083897;0.087287;0.090678;0.094068;0.097458;0.10139;0.10532;0.10925;0.11318;0.11711;0.12168;0.12625;0.13081;0.13538;0.13995;0.145;0.15005;0.1551;0.16015;0.1652;0.1709;0.17659;0.18228;0.18798;0.19367;0.19988;0.20608;0.21229;0.21849;0.22469;0.23146;0.23822;0.24498;0.25174;0.2585;0.26565;0.2728;0.27995;0.2871;0.29425;0.30186;0.30947;0.31708;0.32469;0.3323;0.34016;0.34803;0.35589;0.36375;0.37161;0.37991;0.38822;0.39652;0.40482;0.41313;0.42167;0.43022;0.43876;0.44731;0.45586;0.46462;0.47338;0.48215;0.49091;0.49968;0.50869;0.51771;0.52673;0.53575;0.54476;0.55395;0.56313;0.57232;0.58151;0.59069;0.60004;0.6094;0.61875;0.6281;0.63745;0.64692;0.6564;0.66587;0.67534;0.68481;0.69437;0.70392;0.71347;0.72302;0.73257;0.74211;0.75165;0.76119;0.77073;0.78026;0.78958;0.79889;0.80821;0.81752;0.82683;0.83564;0.84444;0.85325;0.86205;0.87085;0.87869;0.88653;0.89437;0.90221;0.91004;0.91653;0.92301;0.92949;0.93597;0.94245;0.94734;0.95223;0.95711;0.962;0.96688;0.97017;0.97346;0.97675;0.98004;0.98333;0.98524;0.98715;0.98906;0.99096;0.99287;0.9938;0.99474;0.99567;0.9966;0.99754;0.9979;0.99826;0.99862;0.99897;0.99933;0.99944;0.99955;0.99966;0.99977;0.99988;1
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include "init_lte.h"
#include "PHY/phy_extern.h"
#include "LAYER2/MAC/mac.h"
#include "LAYER2/MAC/mac_extern.h"
#include "UTIL/LOG/log_if.h"
#include "PHY_INTERFACE/phy_interface.h"
/*
PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t eNB_id,
uint8_t Nid_cell,
node_function_t node_function,
uint8_t abstraction_flag)
{
int i,j;
PHY_VARS_eNB* PHY_vars_eNB = malloc(sizeof(PHY_VARS_eNB));
memset(PHY_vars_eNB,0,sizeof(PHY_VARS_eNB));
PHY_vars_eNB->Mod_id=eNB_id;
memcpy(&(PHY_vars_eNB->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS));
PHY_vars_eNB->frame_parms.Nid_cell = ((Nid_cell/3)*3)+((eNB_id+Nid_cell)%3);
PHY_vars_eNB->frame_parms.nushift = PHY_vars_eNB->frame_parms.Nid_cell%6;
phy_init_lte_eNB(PHY_vars_eNB,0,abstraction_flag);
LOG_I(PHY,"init eNB: Node Function %d\n",node_function);
LOG_I(PHY,"init eNB: Nid_cell %d\n", frame_parms->Nid_cell);
LOG_I(PHY,"init eNB: frame_type %d,tdd_config %d\n", frame_parms->frame_type,frame_parms->tdd_config);
LOG_I(PHY,"init eNB: number of ue max %d number of enb max %d number of harq pid max %d\n",
NUMBER_OF_UE_MAX, NUMBER_OF_eNB_MAX, NUMBER_OF_HARQ_PID_MAX);
LOG_I(PHY,"init eNB: N_RB_DL %d\n", frame_parms->N_RB_DL);
LOG_I(PHY,"init eNB: prach_config_index %d\n", frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex);
if (node_function >= NGFI_RRU_IF5)
// For RRU, don't allocate DLSCH/ULSCH Transport channel buffers
return (PHY_vars_eNB);
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH, UE %d\n",i);
for (j=0; j<2; j++) {
PHY_vars_eNB->dlsch[i][j] = new_eNB_dlsch(1,8,NSOFT,frame_parms->N_RB_DL,abstraction_flag,frame_parms);
if (!PHY_vars_eNB->dlsch[i][j]) {
LOG_E(PHY,"Can't get eNB dlsch structures for UE %d \n", i);
exit(-1);
} else {
LOG_D(PHY,"dlsch[%d][%d] => %p\n",i,j,PHY_vars_eNB->dlsch[i][j]);
PHY_vars_eNB->dlsch[i][j]->rnti=0;
}
}
LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n",i);
PHY_vars_eNB->ulsch[1+i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,frame_parms->N_RB_UL, abstraction_flag);
if (!PHY_vars_eNB->ulsch[1+i]) {
LOG_E(PHY,"Can't get eNB ulsch structures\n");
exit(-1);
}
// this is the transmission mode for the signalling channels
// this will be overwritten with the real transmission mode by the RRC once the UE is connected
PHY_vars_eNB->transmission_mode[i] = frame_parms->nb_antenna_ports_eNB==1 ? 1 : 2;
#ifdef LOCALIZATION
PHY_vars_eNB->ulsch[1+i]->aggregation_period_ms = 5000; // 5000 milliseconds // could be given as an argument (TBD))
struct timeval ts;
gettimeofday(&ts, NULL);
PHY_vars_eNB->ulsch[1+i]->reference_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
int j;
for (j=0; j<10; j++) {
initialize(&PHY_vars_eNB->ulsch[1+i]->loc_rss_list[j]);
initialize(&PHY_vars_eNB->ulsch[1+i]->loc_rssi_list[j]);
initialize(&PHY_vars_eNB->ulsch[1+i]->loc_subcarrier_rss_list[j]);
initialize(&PHY_vars_eNB->ulsch[1+i]->loc_timing_advance_list[j]);
initialize(&PHY_vars_eNB->ulsch[1+i]->loc_timing_update_list[j]);
}
initialize(&PHY_vars_eNB->ulsch[1+i]->tot_loc_rss_list);
initialize(&PHY_vars_eNB->ulsch[1+i]->tot_loc_rssi_list);
initialize(&PHY_vars_eNB->ulsch[1+i]->tot_loc_subcarrier_rss_list);
initialize(&PHY_vars_eNB->ulsch[1+i]->tot_loc_timing_advance_list);
initialize(&PHY_vars_eNB->ulsch[1+i]->tot_loc_timing_update_list);
#endif
}
// ULSCH for RA
PHY_vars_eNB->ulsch[0] = new_eNB_ulsch(MAX_TURBO_ITERATIONS, frame_parms->N_RB_UL, abstraction_flag);
if (!PHY_vars_eNB->ulsch[0]) {
LOG_E(PHY,"Can't get eNB ulsch structures\n");
exit(-1);
}
PHY_vars_eNB->dlsch_SI = new_eNB_dlsch(1,8,NSOFT,frame_parms->N_RB_DL, abstraction_flag, frame_parms);
LOG_D(PHY,"eNB %d : SI %p\n",eNB_id,PHY_vars_eNB->dlsch_SI);
PHY_vars_eNB->dlsch_ra = new_eNB_dlsch(1,8,NSOFT,frame_parms->N_RB_DL, abstraction_flag, frame_parms);
LOG_D(PHY,"eNB %d : RA %p\n",eNB_id,PHY_vars_eNB->dlsch_ra);
PHY_vars_eNB->dlsch_MCH = new_eNB_dlsch(1,8,NSOFT,frame_parms->N_RB_DL, 0, frame_parms);
LOG_D(PHY,"eNB %d : MCH %p\n",eNB_id,PHY_vars_eNB->dlsch_MCH);
PHY_vars_eNB->rx_total_gain_dB=130;
for(i=0; i<NUMBER_OF_UE_MAX; i++)
PHY_vars_eNB->mu_mimo_mode[i].dl_pow_off = 2;
PHY_vars_eNB->check_for_total_transmissions = 0;
PHY_vars_eNB->check_for_MUMIMO_transmissions = 0;
PHY_vars_eNB->FULL_MUMIMO_transmissions = 0;
PHY_vars_eNB->check_for_SUMIMO_transmissions = 0;
PHY_vars_eNB->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1;
return (PHY_vars_eNB);
}
*/
/*
PHY_VARS_RN* init_lte_RN(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t RN_id,
uint8_t eMBMS_active_state)
{
int i;
PHY_VARS_RN* PHY_vars_RN = malloc(sizeof(PHY_VARS_RN));
memset(PHY_vars_RN,0,sizeof(PHY_VARS_RN));
PHY_vars_RN->Mod_id=RN_id;
if (eMBMS_active_state == multicast_relay) {
for (i=0; i < 10 ; i++) { // num SF in a frame
PHY_vars_RN->dlsch_rn_MCH[i] = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS_MBSFN,frame_parms->N_RB_DL, 0);
LOG_D(PHY,"eNB %d : MCH[%d] %p\n",RN_id,i,PHY_vars_RN->dlsch_rn_MCH[i]);
}
} else {
PHY_vars_RN->dlsch_rn_MCH[0] = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,frame_parms->N_RB_DL, 0);
LOG_D(PHY,"eNB %d : MCH[0] %p\n",RN_id,PHY_vars_RN->dlsch_rn_MCH[0]);
}
return (PHY_vars_RN);
}
void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
uint8_t frame_type,
uint8_t tdd_config,
uint8_t tdd_config_S,
uint8_t extended_prefix_flag,
uint8_t N_RB_DL,
uint16_t Nid_cell,
uint8_t cooperation_flag,
uint8_t nb_antenna_ports,
uint8_t abstraction_flag,
int nb_antennas_rx,
int nb_antennas_tx,
int nb_antennas_rx_ue,
uint8_t eMBMS_active_state)
{
uint8_t eNB_id,UE_id,CC_id;
int i;
mac_xface = malloc(sizeof(MAC_xface));
memset(mac_xface, 0, sizeof(MAC_xface));
LOG_I(PHY,"init lte parms: Nid_cell %d, Frame type %d, N_RB_DL %d\n",Nid_cell,frame_type,N_RB_DL);
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
frame_parms[CC_id] = calloc(1, sizeof(LTE_DL_FRAME_PARMS));
(frame_parms[CC_id])->frame_type = frame_type;
(frame_parms[CC_id])->tdd_config = tdd_config;
(frame_parms[CC_id])->tdd_config_S = tdd_config_S;
(frame_parms[CC_id])->N_RB_DL = N_RB_DL;
(frame_parms[CC_id])->N_RB_UL = (frame_parms[CC_id])->N_RB_DL;
(frame_parms[CC_id])->phich_config_common.phich_resource = oneSixth;
(frame_parms[CC_id])->phich_config_common.phich_duration = normal;
(frame_parms[CC_id])->Ncp = extended_prefix_flag;
(frame_parms[CC_id])->Ncp_UL = extended_prefix_flag;
(frame_parms[CC_id])->Nid_cell = Nid_cell;
(frame_parms[CC_id])->nushift = (Nid_cell%6);
(frame_parms[CC_id])->nb_antennas_tx = nb_antennas_tx;
(frame_parms[CC_id])->nb_antennas_rx = nb_antennas_rx;
(frame_parms[CC_id])->nb_antenna_ports_eNB = nb_antenna_ports;
(frame_parms[CC_id])->mode1_flag = (frame_parms[CC_id])->nb_antenna_ports_eNB==1 ? 1 : 0;
init_frame_parms(frame_parms[CC_id],1);
(frame_parms[CC_id])->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = 0;//n_DMRS1 set to 0
(frame_parms[CC_id])->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 1;
(frame_parms[CC_id])->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 0;
(frame_parms[CC_id])->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0;
init_ul_hopping(frame_parms[CC_id]);
}
// phy_init_top(frame_parms[0]);
phy_init_lte_top(frame_parms[0]);
RC.nb_inst = NB_eNB_INST;
RC.nb_CC = (int *)malloc(MAX_NUM_CCs*sizeof(int));
RC.nb_RU = NB_RU;
for (i=0;i<NB_eNB_INST;i++) RC.nb_CC[i] = MAX_NUM_CCs;
RC.eNB = (PHY_VARS_eNB***)malloc(NB_eNB_INST*sizeof(PHY_VARS_eNB**));
for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
RC.eNB[eNB_id] = (PHY_VARS_eNB**) malloc(MAX_NUM_CCs*sizeof(PHY_VARS_eNB*));
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
RC.eNB[eNB_id][CC_id] = init_lte_eNB(frame_parms[CC_id],eNB_id,Nid_cell,eNodeB_3GPP,abstraction_flag);
RC.eNB[eNB_id][CC_id]->Mod_id=eNB_id;
RC.eNB[eNB_id][CC_id]->CC_id=CC_id;
}
}
PHY_vars_UE_g = (PHY_VARS_UE***)malloc(NB_UE_INST*sizeof(PHY_VARS_UE**));
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
PHY_vars_UE_g[UE_id] = (PHY_VARS_UE**) malloc(MAX_NUM_CCs*sizeof(PHY_VARS_UE*));
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
(frame_parms[CC_id])->nb_antennas_tx = 1;
(frame_parms[CC_id])->nb_antennas_rx = nb_antennas_rx_ue;
PHY_vars_UE_g[UE_id][CC_id] = init_lte_UE(frame_parms[CC_id], UE_id,abstraction_flag);
PHY_vars_UE_g[UE_id][CC_id]->Mod_id=UE_id;
PHY_vars_UE_g[UE_id][CC_id]->CC_id=CC_id;
}
}
// if (NB_RN_INST > 0) {
// PHY_vars_RN_g = malloc(NB_RN_INST*sizeof(PHY_VARS_RN*));
// for (RN_id=0; RN_id<NB_RN_INST; RN_id++) {
// PHY_vars_RN_g[RN_id] = init_lte_RN(*frame_parms,RN_id,eMBMS_active_state);
// }
// }
}
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "PHY/types.h"
#include "PHY/defs_eNB.h"
PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t eNB_id,
uint8_t Nid_cell,
node_function_t node_function,
uint8_t abstraction_flag);
PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t UE_id,
uint8_t abstraction_flag);
void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
uint8_t frame_type,
uint8_t tdd_config,
uint8_t tdd_config_S,
uint8_t extended_prefix_flag,
uint8_t N_RB_DL,
uint16_t Nid_cell,
uint8_t cooperation_flag,
uint8_t nb_antenna_ports,
uint8_t abstraction_flag,
int nb_antennas_rx,
int nb_antennas_tx,
int nb_antennas_rx_ue,
uint8_t eMBMS_active_state);
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file oaisim.c
* \brief oaisim top level
* \author Navid Nikaein
* \date 2013-2015
* \version 1.0
* \company Eurecom
* \email: openair_tech@eurecom.fr
* \note
* \warning
*/
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <cblas.h>
#include <execinfo.h>
#include "event_handler.h"
#include "SIMULATION/RF/rf.h"
#include "PHY/types.h"
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
#include "PHY/phy_vars.h"
#include "PHY/phy_vars_ue.h"
#include "SCHED/sched_common_vars.h"
#include "LAYER2/MAC/mac.h"
#include "LAYER2/MAC/mac_proto.h"
#include "LAYER2/MAC/mac_vars.h"
#include "pdcp.h"
#include "RRC/LTE/rrc_vars.h"
#include "RRC/NAS/nas_config.h"
#include "system.h"
#include "PHY/TOOLS/lte_phy_scope.h"
#ifdef SMBV
// Rohde&Schwarz SMBV100A vector signal generator
#include "PHY/TOOLS/smbv.h"
char smbv_fname[] = "smbv_config_file.smbv";
unsigned short smbv_nframes = 4; // how many frames to configure 1,..,4
unsigned short config_frames[4] = {2,9,11,13};
unsigned char smbv_frame_cnt = 0;
uint8_t config_smbv = 0;
char smbv_ip[16];
#endif
#include "flexran_agent.h"
#include "oaisim_functions.h"
#include "oaisim.h"
#include "oaisim_config.h"
#include "UTIL/OCG/OCG_extern.h"
#include "cor_SF_sim.h"
#include "UTIL/OMG/omg_constants.h"
#include "UTIL/FIFO/pad_list.h"
#include "enb_app.h"
#include "../PROC/interface.h"
#include "../PROC/channel_sim_proc.h"
#include "../PROC/Tsync.h"
#include "../PROC/Process.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/OTG/otg_kpi.h"
#include "assertions.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
# include "create_tasks.h"
# include "intertask_interface_init.h"
#endif
#include "T.h"
/*
DCI0_5MHz_TDD0_t UL_alloc_pdu;
DCI1A_5MHz_TDD_1_6_t CCCH_alloc_pdu;
DCI2_5MHz_2A_L10PRB_TDD_t DLSCH_alloc_pdu1;
DCI2_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu2;
*/
#define UL_RB_ALLOC computeRIV(lte_frame_parms->N_RB_UL,0,24)
#define CCCH_RB_ALLOC computeRIV(lte_frame_parms->N_RB_UL,0,3)
#define RA_RB_ALLOC computeRIV(lte_frame_parms->N_RB_UL,0,3)
#define DLSCH_RB_ALLOC 0x1fff
#define DECOR_DIST 100
#define SF_VAR 10
//constant for OAISIM soft realtime calibration
//#define SF_DEVIATION_OFFSET_NS 100000 /*= 0.1ms : should be as a number of UE */
//#define SLEEP_STEP_US 100 /* = 0.01ms could be adaptive, should be as a number of UE */
//#define K 2 /* averaging coefficient */
//#define TARGET_SF_TIME_NS 1000000 /* 1ms = 1000000 ns */
uint8_t usim_test = 0;
frame_t frame = 0;
char stats_buffer[16384];
channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs];
channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM_CCs];
//Added for PHY abstraction
node_desc_t *enb_data[NUMBER_OF_RU_MAX];
node_desc_t *ue_data[NUMBER_OF_UE_MAX];
pthread_cond_t sync_cond;
pthread_mutex_t sync_mutex;
int sync_var=-1;
pthread_mutex_t subframe_mutex;
int subframe_ru_mask=0,subframe_UE_mask=0;
openair0_config_t openair0_cfg[MAX_CARDS];
uint32_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
openair0_rf_map rf_map[MAX_NUM_CCs];
#if defined(ENABLE_ITTI)
volatile int start_eNB = 0;
volatile int start_UE = 0;
#endif
volatile int oai_exit = 0;
//int32_t **rxdata;
//int32_t **txdata;
uint16_t sf_ahead=4;
uint8_t nfapi_mode = 0;
// Added for PHY abstraction
extern node_list* ue_node_list;
extern node_list* enb_node_list;
extern int pdcp_period, omg_period;
extern double **s_re, **s_im, **r_re, **r_im, **r_re0, **r_im0;
int map1, map2;
extern double **ShaF;
double snr_dB, sinr_dB, snr_direction; //,sinr_direction;
extern double snr_step;
extern uint8_t set_sinr;
extern uint8_t ue_connection_test;
extern uint8_t set_seed;
extern uint8_t target_dl_mcs;
extern uint8_t target_ul_mcs;
extern uint8_t abstraction_flag;
extern uint8_t ethernet_flag;
extern uint16_t Nid_cell;
double cpuf;
#include "threads_t.h"
threads_t threads= {-1,-1,-1,-1,-1,-1,-1};
//#ifdef XFORMS
int otg_enabled;
int xforms=0;
//#endif
time_stats_t oaisim_stats;
time_stats_t oaisim_stats_f;
time_stats_t dl_chan_stats;
time_stats_t ul_chan_stats;
int emulate_rf = 0;
int numerology = 0;
int codingw = 0;
int fepw = 0;
// this should reflect the channel models in openair1/SIMULATION/TOOLS/defs.h
mapping small_scale_names[] = {
{ "custom", custom }, { "SCM_A", SCM_A },
{ "SCM_B", SCM_B }, { "SCM_C", SCM_C },
{ "SCM_D", SCM_D }, { "EPA", EPA },
{ "EVA", EVA }, { "ETU", ETU },
{ "MBSFN", MBSFN }, { "Rayleigh8", Rayleigh8 },
{ "Rayleigh1", Rayleigh1 }, { "Rayleigh1_800", Rayleigh1_800 },
{ "Rayleigh1_corr", Rayleigh1_corr }, { "Rayleigh1_anticorr", Rayleigh1_anticorr },
{ "Rice8", Rice8 }, { "Rice1", Rice1 }, { "Rice1_corr", Rice1_corr },
{ "Rice1_anticorr", Rice1_anticorr }, { "AWGN", AWGN }, { NULL,-1 }
};
#if !defined(ENABLE_ITTI)
static void *
sigh (void *arg);
#endif
void
oai_shutdown (void);
void reset_opp_meas_oaisim (void);
void wait_eNBs(void)
{
return;
}
void
help (void)
{
printf ("Usage: oaisim -h -a -F -C tdd_config -K [log_file] -V [vcd_file] -R N_RB_DL -e -x transmission_mode -m target_dl_mcs -r(ate_adaptation) -n n_frames -s snr_dB -k ricean_factor -t max_delay -f forgetting factor -A channel_model -z cooperation_flag -u nb_local_ue -U UE mobility -b nb_local_enb -B eNB_mobility -M ethernet_flag -p nb_master -g multicast_group -l log_level -c ocg_enable -T traffic model -D multicast network device\n");
printf ("-h provides this help message!\n");
printf ("-a Activates PHY abstraction mode\n");
printf ("-A set the multipath channel simulation, options are: SCM_A, SCM_B, SCM_C, SCM_D, EPA, EVA, ETU, Rayleigh8, Rayleigh1, Rayleigh1_corr,Rayleigh1_anticorr, Rice8,, Rice1, AWGN \n");
printf ("-b Set the number of local eNB\n");
printf ("-B Set the mobility model for eNB, options are: STATIC, RWP, RWALK, \n");
printf ("-c [1,2,3,4] Activate the config generator (OCG) to process the scenario descriptor, or give the scenario manually: -c template_1.xml \n");
printf ("-C [0-6] Sets TDD configuration\n");
printf ("-e Activates extended prefix mode\n");
printf ("-E Random number generator seed\n");
printf ("-f Set the forgetting factor for time-variation\n");
printf ("-F Activates FDD transmission (TDD is default)\n");
printf ("-g Set multicast group ID (0,1,2,3) - valid if M is set\n");
printf ("-G Enable background traffic \n");
printf ("-H Enable handover operation (default disabled) \n");
printf ("-I Enable CLI interface (to connect use telnet localhost 1352)\n");
printf ("-k Set the Ricean factor (linear)\n");
printf ("-K [log_file] Enable ITTI logging into log_file\n");
printf ("-l Set the global log level (8:trace, 7:debug, 6:info, 4:warn, 3:error) \n");
printf ("-L [0-1] 0 to disable new link adaptation, 1 to enable new link adapatation\n");
printf ("-m Gives a fixed DL mcs for eNB scheduler\n");
printf ("-M Set the machine ID for Ethernet-based emulation\n");
printf ("-n Set the number of frames for the simulation. 0 for no limit\n");
printf ("-O [enb_conf_file] eNB configuration file name\n");
printf ("-p Set the total number of machine in emulation - valid if M is set\n");
printf ("-P [trace type] Enable protocol analyzer. Possible values for OPT:\n");
printf (" - wireshark: Enable tracing of layers above PHY using an UDP socket\n");
printf (" - pcap: Enable tracing of layers above PHY to a pcap file\n");
printf (" - tshark: Not implemented yet\n");
printf ("-q Enable Openair performance profiler \n");
printf ("-Q Activate and set the MBMS service: 0 : not used (default eMBMS disabled), 1: eMBMS and RRC Connection enabled, 2: eMBMS relaying and RRC Connection enabled, 3: eMBMS enabled, RRC Connection disabled, 4: eMBMS relaying enabled, RRC Connection disabled\n");
printf ("-R [6,15,25,50,75,100] Sets N_RB_DL\n");
printf ("-r Activates rate adaptation (DL for now)\n");
printf ("-s snr_dB set a fixed (average) SNR, this deactivates the openair channel model generator (OCM)\n");
printf ("-S snir_dB set a fixed (average) SNIR, this deactivates the openair channel model generator (OCM)\n");
printf ("-t Gives a fixed UL mcs for eNB scheduler\n");
printf ("-T activate the traffic generator. Valide options are m2m,scbr,mcbr,bcbr,auto_pilot,bicycle_race,open_arena,team_fortress,m2m_traffic,auto_pilot_l,auto_pilot_m,auto_pilot_h,auto_pilot_e,virtual_game_l,virtual_game_m,virtual_game_h,virtual_game_f,alarm_humidity,alarm_smoke,alarm_temperature,openarena_dl,openarena_ul,voip_g711,voip_g729,video_vbr_10mbps,video_vbr_4mbps,video_vbr_2mbp,video_vbr_768kbps,video_vbr_384kbps,video_vbr_192kpbs,background_users\n");
printf ("-u Set the number of local UE\n");
printf ("-U Set the mobility model for UE, options are: STATIC, RWP, RWALK\n");
printf ("-V [vcd_file] Enable VCD dump into vcd_file\n");
printf ("-w number of CBA groups, if not specified or zero, CBA is inactive\n");
#ifdef SMBV
printf ("-W IP address to connect to Rohde&Schwarz SMBV100A and configure SMBV from config file. -W0 uses default IP 192.168.12.201\n");
#else
printf ("-W [Rohde&Schwarz SMBV100A functions disabled. Recompile with SMBV=1]\n");
#endif
printf ("-x deprecated. Set the transmission mode in config file!\n");
printf ("-y Set the number of receive antennas at the UE (1 or 2)\n");
printf ("-Y Set the global log verbosity (none, low, medium, high, full) \n");
printf ("-z Set the cooperation flag (0 for no cooperation, 1 for delay diversity and 2 for distributed alamouti\n");
printf ("-Z Reserved\n");
printf ("--xforms Activate the grapical scope\n");
#if T_TRACER
printf ("--T_port [port] use given port\n");
printf ("--T_nowait don't wait for tracer, start immediately\n");
printf ("--T_dont_fork to ease debugging with gdb\n");
#endif
}
pthread_t log_thread;
void
log_thread_init (void)
{
//create log_list
//log_list_init(&log_list);
#ifndef LOG_NO_THREAD
log_shutdown = 0;
if ((pthread_mutex_init (&log_lock, NULL) != 0)
|| (pthread_cond_init (&log_notify, NULL) != 0)) {
return;
}
if (pthread_create (&log_thread, NULL, log_thread_function, (void*) NULL)
!= 0) {
log_thread_finalize ();
return;
}
#endif
}
//Call it after the last LOG call
int
log_thread_finalize (void)
{
int err = 0;
#ifndef LOG_NO_THREAD
if (pthread_mutex_lock (&log_lock) != 0) {
return -1;
}
log_shutdown = 1;
/* Wake up LOG thread */
if ((pthread_cond_broadcast (&log_notify) != 0)
|| (pthread_mutex_unlock (&log_lock) != 0)) {
err = -1;
}
if (pthread_join (log_thread, NULL) != 0) {
err = -1;
}
if (pthread_mutex_unlock (&log_lock) != 0) {
err = -1;
}
if (!err) {
//log_list_free(&log_list);
pthread_mutex_lock (&log_lock);
pthread_mutex_destroy (&log_lock);
pthread_cond_destroy (&log_notify);
}
#endif
return err;
}
#if defined(ENABLE_ITTI)
static void set_cli_start(module_id_t module_idP, uint8_t start)
{
if (module_idP < NB_eNB_INST) {
oai_emulation.info.cli_start_enb[module_idP] = start;
} else {
oai_emulation.info.cli_start_ue[module_idP - NB_eNB_INST] = start;
}
}
#endif
#ifdef OPENAIR2
int omv_write(int pfd, node_list* enb_node_list, node_list* ue_node_list, Data_Flow_Unit omv_data)
{
module_id_t i;
omv_data.end = 0;
//omv_data.total_num_nodes = NB_UE_INST + NB_eNB_INST;
for (i = 0; i < NB_eNB_INST; i++) {
if (enb_node_list != NULL) {
omv_data.geo[i].x = (enb_node_list->node->x_pos < 0.0) ? 0.0 : enb_node_list->node->x_pos;
omv_data.geo[i].y = (enb_node_list->node->y_pos < 0.0) ? 0.0 : enb_node_list->node->y_pos;
omv_data.geo[i].z = 1.0;
omv_data.geo[i].mobility_type = oai_emulation.info.omg_model_enb;
omv_data.geo[i].node_type = 0; //eNB
enb_node_list = enb_node_list->next;
omv_data.geo[i].Neighbors = 0;
/*
for (j = NB_RU; j < NB_UE_INST + NB_RU; j++) {
if (is_UE_active (i, j - NB_RU) == 1) {
omv_data.geo[i].Neighbor[omv_data.geo[i].Neighbors] = j;
omv_data.geo[i].Neighbors++;
LOG_D(
OMG,
"[RU %d][UE %d] is_UE_active(i,j) %d geo (x%d, y%d) num neighbors %d\n", i, j-NB_RU, is_UE_active(i,j-NB_RU), omv_data.geo[i].x, omv_data.geo[i].y, omv_data.geo[i].Neighbors);
}
}
*/
}
}
for (i = NB_RU; i < NB_UE_INST + NB_RU; i++) {
if (ue_node_list != NULL) {
omv_data.geo[i].x = (ue_node_list->node->x_pos < 0.0) ? 0.0 : ue_node_list->node->x_pos;
omv_data.geo[i].y = (ue_node_list->node->y_pos < 0.0) ? 0.0 : ue_node_list->node->y_pos;
omv_data.geo[i].z = 1.0;
omv_data.geo[i].mobility_type = oai_emulation.info.omg_model_ue;
omv_data.geo[i].node_type = 1; //UE
//trial
omv_data.geo[i].state = 1;
omv_data.geo[i].rnti = 88;
omv_data.geo[i].connected_eNB = 0;
omv_data.geo[i].RSRP = 66;
omv_data.geo[i].RSRQ = 55;
omv_data.geo[i].Pathloss = 44;
omv_data.geo[i].RSSI[0] = 33;
omv_data.geo[i].RSSI[1] = 22;
if ((sizeof(omv_data.geo[0].RSSI) / sizeof(omv_data.geo[0].RSSI[0])) > 2) {
omv_data.geo[i].RSSI[2] = 11;
}
ue_node_list = ue_node_list->next;
omv_data.geo[i].Neighbors = 0;
/*
for (j = 0; j < NB_RU; j++) {
if (is_UE_active (j, i - NB_RU) == 1) {
omv_data.geo[i].Neighbor[omv_data.geo[i].Neighbors] = j;
omv_data.geo[i].Neighbors++;
LOG_D(
OMG,
"[UE %d][RU %d] is_UE_active %d geo (x%d, y%d) num neighbors %d\n", i-NB_RU, j, is_UE_active(j,i-NB_RU), omv_data.geo[i].x, omv_data.geo[i].y, omv_data.geo[i].Neighbors);
}
}
*/
}
}
LOG_E(OMG, "pfd %d \n", pfd);
if (write (pfd, &omv_data, sizeof(struct Data_Flow_Unit)) == -1)
perror ("write omv failed");
return 1;
}
void omv_end(int pfd, Data_Flow_Unit omv_data)
{
omv_data.end = 1;
if (write (pfd, &omv_data, sizeof(struct Data_Flow_Unit)) == -1)
perror ("write omv failed");
}
#endif
#ifdef OPENAIR2
int pfd[2]; // fd for omv : fixme: this could be a local var
#endif
#ifdef OPENAIR2
static Data_Flow_Unit omv_data;
#endif //ALU
static module_id_t UE_inst = 0;
static module_id_t eNB_inst = 0;
static module_id_t ru_id;
Packet_OTG_List_t *otg_pdcp_buffer;
typedef enum l2l1_task_state_e {
L2L1_WAITTING, L2L1_RUNNING, L2L1_TERMINATED,
} l2l1_task_state_t;
l2l1_task_state_t l2l1_state = L2L1_WAITTING;
extern openair0_timestamp current_ru_rx_timestamp[NUMBER_OF_RU_MAX][MAX_NUM_CCs];
extern openair0_timestamp current_UE_rx_timestamp[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
extern openair0_timestamp last_eNB_rx_timestamp[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
extern openair0_timestamp last_UE_rx_timestamp[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
/*------------------------------------------------------------------------------*/
void *
l2l1_task (void *args_p)
{
int CC_id;
// Framing variables
int32_t sf;
//char fname[64], vname[64];
//#ifdef XFORMS
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
// at eNB 0, an UL scope for every UE
FD_lte_phy_scope_ue *form_ue[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
FD_lte_phy_scope_enb *form_enb[NUMBER_OF_UE_MAX];
char title[255];
char xname[32] = "oaisim";
int xargc = 1;
char *xargv[1];
//#endif
#undef PRINT_STATS /* this undef is to avoid gcc warnings */
#define PRINT_STATS
#ifdef PRINT_STATS
//int len;
FILE *UE_stats[NUMBER_OF_UE_MAX];
FILE *UE_stats_th[NUMBER_OF_UE_MAX];
FILE *eNB_stats[NUMBER_OF_eNB_MAX];
FILE *eNB_avg_thr;
FILE *eNB_l2_stats;
char UE_stats_filename[255];
char eNB_stats_filename[255];
char UE_stats_th_filename[255];
char eNB_stats_th_filename[255];
#endif
if (xforms==1) {
xargv[0] = xname;
fl_initialize (&xargc, xargv, NULL, 0, 0);
eNB_inst = 0;
for (UE_inst = 0; UE_inst < NB_UE_INST; UE_inst++) {
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
// DL scope at UEs
form_ue[CC_id][UE_inst] = create_lte_phy_scope_ue();
sprintf (title, "LTE DL SCOPE eNB %d to UE %d CC_id %d", eNB_inst, UE_inst, CC_id);
fl_show_form (form_ue[CC_id][UE_inst]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
if (PHY_vars_UE_g[UE_inst][CC_id]->use_ia_receiver == 1) {
fl_set_button(form_ue[CC_id][UE_inst]->button_0,1);
fl_set_object_label(form_ue[CC_id][UE_inst]->button_0, "IA Receiver ON");
fl_set_object_color(form_ue[CC_id][UE_inst]->button_0, FL_GREEN, FL_GREEN);
}
}
}
}
#ifdef PRINT_STATS
for (UE_inst=0; UE_inst<NB_UE_INST; UE_inst++) {
sprintf(UE_stats_filename,"UE_stats%d.txt",UE_inst);
UE_stats[UE_inst] = fopen (UE_stats_filename, "w");
}
for (eNB_inst=0; eNB_inst<NB_eNB_INST; eNB_inst++) {
sprintf(eNB_stats_filename,"eNB_stats%d.txt",eNB_inst);
eNB_stats[eNB_inst] = fopen (eNB_stats_filename, "w");
}
if(abstraction_flag==0) {
for (UE_inst=0; UE_inst<NB_UE_INST; UE_inst++) {
/* TODO: transmission_mode is defined per CC, we set 0 for now */
sprintf(UE_stats_th_filename,"UE_stats_th%d_tx%d.txt",UE_inst,oai_emulation.info.transmission_mode[0]);
UE_stats_th[UE_inst] = fopen (UE_stats_th_filename, "w");
}
/* TODO: transmission_mode is defined per CC, we set 0 for now */
sprintf(eNB_stats_th_filename,"eNB_stats_th_tx%d.txt",oai_emulation.info.transmission_mode[0]);
eNB_avg_thr = fopen (eNB_stats_th_filename, "w");
} else {
for (UE_inst=0; UE_inst<NB_UE_INST; UE_inst++) {
/* TODO: transmission_mode is defined per CC, we set 0 for now */
sprintf(UE_stats_th_filename,"UE_stats_abs_th%d_tx%d.txt",UE_inst,oai_emulation.info.transmission_mode[0]);
UE_stats_th[UE_inst] = fopen (UE_stats_th_filename, "w");
}
/* TODO: transmission_mode is defined per CC, we set 0 for now */
sprintf(eNB_stats_th_filename,"eNB_stats_abs_th_tx%d.txt",oai_emulation.info.transmission_mode[0]);
eNB_avg_thr = fopen (eNB_stats_th_filename, "w");
}
#ifdef OPENAIR2
eNB_l2_stats = fopen ("eNB_l2_stats.txt", "w");
LOG_I(EMU,"eNB_l2_stats=%p\n", eNB_l2_stats);
#endif
#endif
#if defined(ENABLE_ITTI)
MessageDef *message_p = NULL;
const char *msg_name = NULL;
int result;
itti_mark_task_ready (TASK_L2L1);
LOG_I(EMU, "TASK_L2L1 is READY\n");
if ((oai_emulation.info.nb_enb_local > 0) &&
(oai_emulation.info.node_function[0] < NGFI_RAU_IF4p5)) {
/* Wait for the initialize message */
do {
if (message_p != NULL) {
result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}
itti_receive_msg (TASK_L2L1, &message_p);
msg_name = ITTI_MSG_NAME (message_p);
LOG_I(EMU, "TASK_L2L1 received %s in state L2L1_WAITTING\n", msg_name);
switch (ITTI_MSG_ID(message_p)) {
case INITIALIZE_MESSAGE:
l2l1_state = L2L1_RUNNING;
start_eNB = 1;
break;
case ACTIVATE_MESSAGE:
set_cli_start(ITTI_MSG_INSTANCE (message_p), 1);
break;
case DEACTIVATE_MESSAGE:
set_cli_start(ITTI_MSG_INSTANCE (message_p), 0);
break;
case TERMINATE_MESSAGE:
l2l1_state = L2L1_TERMINATED;
break;
default:
LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
break;
}
} while (l2l1_state == L2L1_WAITTING);
result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}
#endif
start_meas (&oaisim_stats);
for (frame = 0;
(l2l1_state != L2L1_TERMINATED) &&
((oai_emulation.info.n_frames_flag == 0) ||
(frame < oai_emulation.info.n_frames));
frame++) {
#if defined(ENABLE_ITTI)
do {
// Checks if a message has been sent to L2L1 task
itti_poll_msg (TASK_L2L1, &message_p);
if (message_p != NULL) {
msg_name = ITTI_MSG_NAME (message_p);
LOG_I(EMU, "TASK_L2L1 received %s\n", msg_name);
switch (ITTI_MSG_ID(message_p)) {
case ACTIVATE_MESSAGE:
set_cli_start(ITTI_MSG_INSTANCE (message_p), 1);
break;
case DEACTIVATE_MESSAGE:
set_cli_start(ITTI_MSG_INSTANCE (message_p), 0);
break;
case TERMINATE_MESSAGE:
l2l1_state = L2L1_TERMINATED;
break;
case MESSAGE_TEST:
break;
default:
LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
break;
}
result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}
} while(message_p != NULL);
#endif
//Run the aperiodic user-defined events
if (oai_emulation.info.oeh_enabled == 1)
execute_events (frame);
if (ue_connection_test == 1) {
if ((frame % 20) == 0) {
snr_dB += snr_direction;
sinr_dB -= snr_direction;
}
if (snr_dB == -20) {
snr_direction = snr_step;
} else if (snr_dB == 20) {
snr_direction = -snr_step;
}
}
oai_emulation.info.frame = frame;
//oai_emulation.info.time_ms += 1;
oai_emulation.info.time_s += 0.01; // emu time in s, each frame lasts for 10 ms // JNote: TODO check the coherency of the time and frame (I corrected it to 10 (instead of 0.01)
//update_omg (frame); // frequency is defined in the omg_global params configurable by the user
//update_omg_ocm ();
#ifdef OPENAIR2
// check if pipe is still open
if ((oai_emulation.info.omv_enabled == 1)) {
omv_write (pfd[1], enb_node_list, ue_node_list, omv_data);
}
#endif
for (sf = 0; sf < 10; sf++) {
LOG_D(EMU,"************************* Subframe %d\n",sf);
start_meas (&oaisim_stats_f);
wait_for_slot_isr ();
#if defined(ENABLE_ITTI)
itti_update_lte_time(frame % MAX_FRAME_NUMBER, sf<<1);
#endif
oai_emulation.info.time_ms = frame * 10 + sf;
#ifdef PROC
if(Channel_Flag==1)
Channel_Func(s_re2,s_im2,r_re2,r_im2,r_re02,r_im02,r_re0_d,r_im0_d,r_re0_u,r_im0_u,RU2UE,UE2RU,enb_data,ue_data,abstraction_flag,frame_parms,sf<<1);
if(Channel_Flag==0)
#endif
{ // SUBFRAME INNER PART
#if defined(ENABLE_ITTI)
log_set_instance_type (LOG_INSTANCE_ENB);
#endif
CC_id=0;
int all_done=0;
while (all_done==0) {
pthread_mutex_lock(&subframe_mutex);
int subframe_ru_mask_local = (subframe_select(&RC.ru[0]->frame_parms,(sf+4)%10)!=SF_UL) ? subframe_ru_mask : ((1<<NB_RU)-1);
int subframe_UE_mask_local = (RC.ru[0]->frame_parms.frame_type == FDD || subframe_select(&RC.ru[0]->frame_parms,(sf+4)%10)!=SF_DL) ? subframe_UE_mask : ((1<<NB_UE_INST)-1);
pthread_mutex_unlock(&subframe_mutex);
LOG_D(EMU,"Frame %d, Subframe %d, NB_RU %d, NB_UE %d: Checking masks %x,%x\n",frame,sf,NB_RU,NB_UE_INST,subframe_ru_mask_local,subframe_UE_mask_local);
if ((subframe_ru_mask_local == ((1<<NB_RU)-1)) &&
(subframe_UE_mask_local == ((1<<NB_UE_INST)-1))) all_done=1;
else usleep(1500);
}
//clear subframe masks for next round
pthread_mutex_lock(&subframe_mutex);
subframe_ru_mask=0;
subframe_UE_mask=0;
pthread_mutex_unlock(&subframe_mutex);
// increment timestamps
/*
for (ru_id = oai_emulation.info.first_enb_local;
(ru_id
< (oai_emulation.info.first_enb_local
+ oai_emulation.info.nb_enb_local));
ru_id++) {
*/
for (ru_id=0;ru_id<NB_RU;ru_id++) {
current_ru_rx_timestamp[ru_id][CC_id] += RC.ru[ru_id]->frame_parms.samples_per_tti;
LOG_D(EMU,"RU %d/%d: TS %"PRIi64"\n",ru_id,CC_id,current_ru_rx_timestamp[ru_id][CC_id]);
}
for (UE_inst = 0; UE_inst<NB_UE_INST;UE_inst++) {
current_UE_rx_timestamp[UE_inst][CC_id] += PHY_vars_UE_g[UE_inst][CC_id]->frame_parms.samples_per_tti;
LOG_D(EMU,"UE %d/%d: TS %"PRIi64"\n",UE_inst,CC_id,current_UE_rx_timestamp[UE_inst][CC_id]);
}
for (eNB_inst = oai_emulation.info.first_enb_local;
(eNB_inst
< (oai_emulation.info.first_enb_local
+ oai_emulation.info.nb_enb_local));
eNB_inst++) {
if (oai_emulation.info.cli_start_enb[eNB_inst] != 0) {
/*
LOG_D(EMU,
"PHY procedures eNB %d for frame %d, subframe %d TDD %d/%d Nid_cell %d\n",
eNB_inst,
frame % MAX_FRAME_NUMBER,
sf,
PHY_vars_eNB_g[eNB_inst][0]->frame_parms.frame_type,
PHY_vars_eNB_g[eNB_inst][0]->frame_parms.tdd_config,
PHY_vars_eNB_g[eNB_inst][0]->frame_parms.Nid_cell);
*/
#ifdef PRINT_STATS
if((sf==9) && frame%10==0)
if(eNB_avg_thr)
fprintf(eNB_avg_thr,"%d %d\n",RC.eNB[eNB_inst][0]->proc.proc_rxtx[sf&1].frame_tx,
(RC.eNB[eNB_inst][0]->total_system_throughput)/((RC.eNB[eNB_inst][0]->proc.proc_rxtx[sf&1].frame_tx+1)*10));
/*
if (eNB_stats[eNB_inst]) {
len = dump_eNB_stats(RC.eNB[eNB_inst][0], stats_buffer, 0);
rewind (eNB_stats[eNB_inst]);
fwrite (stats_buffer, 1, len, eNB_stats[eNB_inst]);
fflush(eNB_stats[eNB_inst]);
}
#ifdef OPENAIR2
if (eNB_l2_stats) {
len = dump_eNB_l2_stats (stats_buffer, 0);
rewind (eNB_l2_stats);
fwrite (stats_buffer, 1, len, eNB_l2_stats);
fflush(eNB_l2_stats);
}
#endif
*/
#endif
}
}// eNB_inst loop
#if defined(ENABLE_ITTI)
log_set_instance_type (LOG_INSTANCE_UE);
#endif
if ((sf == 0) && ((frame % MAX_FRAME_NUMBER) == 0) && (abstraction_flag == 0)
&& (oai_emulation.info.n_frames == 1)) {
write_output ("dlchan0.m",
"dlch0",
&(PHY_vars_UE_g[0][0]->common_vars.common_vars_rx_data_per_thread[0].dl_ch_estimates[0][0][0]),
(6
* (PHY_vars_UE_g[0][0]->frame_parms.ofdm_symbol_size)),
1, 1);
write_output ("dlchan1.m",
"dlch1",
&(PHY_vars_UE_g[0][0]->common_vars.common_vars_rx_data_per_thread[0].dl_ch_estimates[1][0][0]),
(6
* (PHY_vars_UE_g[0][0]->frame_parms.ofdm_symbol_size)),
1, 1);
write_output ("dlchan2.m",
"dlch2",
&(PHY_vars_UE_g[0][0]->common_vars.common_vars_rx_data_per_thread[0].dl_ch_estimates[2][0][0]),
(6
* (PHY_vars_UE_g[0][0]->frame_parms.ofdm_symbol_size)),
1, 1);
write_output ("pbch_rxF_comp0.m",
"pbch_comp0",
PHY_vars_UE_g[0][0]->pbch_vars[0]->rxdataF_comp[0],
6 * 12 * 4, 1, 1);
write_output ("pbch_rxF_llr.m", "pbch_llr",
PHY_vars_UE_g[0][0]->pbch_vars[0]->llr,
(PHY_vars_UE_g[0][0]->frame_parms.Ncp == 0) ? 1920 : 1728, 1,
4);
}
stop_meas (&oaisim_stats_f);
} // SUBFRAME INNER PART
}
//update_ocm ();
/*
if ((frame >= 10) && (frame <= 11) && (abstraction_flag == 0)
#ifdef PROC
&&(Channel_Flag==0)
#endif
) {
sprintf (fname, "UEtxsig%d.m", frame % MAX_FRAME_NUMBER);
sprintf (vname, "txs%d", frame % MAX_FRAME_NUMBER);
write_output (fname,
vname,
PHY_vars_UE_g[0][0]->common_vars.txdata[0],
PHY_vars_UE_g[0][0]->frame_parms.samples_per_tti
* 10,
1, 1);
sprintf (fname, "eNBtxsig%d.m", frame % MAX_FRAME_NUMBER);
sprintf (vname, "txs%d", frame % MAX_FRAME_NUMBER);
write_output (fname,
vname,
PHY_vars_eNB_g[0][0]->common_vars.txdata[0][0],
PHY_vars_UE_g[0][0]->frame_parms.samples_per_tti
* 10,
1, 1);
sprintf (fname, "eNBtxsigF%d.m", frame % MAX_FRAME_NUMBER);
sprintf (vname, "txsF%d", frame % MAX_FRAME_NUMBER);
write_output (fname,
vname,
PHY_vars_eNB_g[0][0]->common_vars.txdataF[0][0],
PHY_vars_eNB_g[0][0]->frame_parms.symbols_per_tti
* PHY_vars_eNB_g[0][0]->frame_parms.ofdm_symbol_size,
1, 1);
sprintf (fname, "UErxsig%d.m", frame % MAX_FRAME_NUMBER);
sprintf (vname, "rxs%d", frame % MAX_FRAME_NUMBER);
write_output (fname,
vname,
PHY_vars_UE_g[0][0]->common_vars.rxdata[0],
PHY_vars_UE_g[0][0]->frame_parms.samples_per_tti
* 10,
1, 1);
sprintf (fname, "eNBrxsig%d.m", frame % MAX_FRAME_NUMBER);
sprintf (vname, "rxs%d", frame % MAX_FRAME_NUMBER);
write_output (fname,
vname,
PHY_vars_eNB_g[0][0]->common_vars.rxdata[0][0],
PHY_vars_UE_g[0][0]->frame_parms.samples_per_tti
* 10,
1, 1);
}
*/
//#ifdef XFORMS
if (xforms==1) {
eNB_inst = 0;
for (UE_inst = 0; UE_inst < NB_UE_INST; UE_inst++) {
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
phy_scope_UE(form_ue[CC_id][UE_inst],
PHY_vars_UE_g[UE_inst][CC_id],
eNB_inst,
UE_inst,
7);
}
if (RC.eNB && RC.eNB[eNB_inst] && RC.eNB[eNB_inst][0] )
phy_scope_eNB(form_enb[UE_inst],
RC.eNB[eNB_inst][0],
UE_inst);
}
}
//#endif
#ifdef SMBV
// Rohde&Schwarz SMBV100A vector signal generator
if ((frame % MAX_FRAME_NUMBER == config_frames[0]) || (frame % MAX_FRAME_NUMBER == config_frames[1]) || (frame % MAX_FRAME_NUMBER == config_frames[2]) || (frame % MAX_FRAME_NUMBER == config_frames[3])) {
smbv_frame_cnt++;
}
#endif
} // frame loop
stop_meas (&oaisim_stats);
oai_shutdown ();
#ifdef PRINT_STATS
for (UE_inst=0; UE_inst<NB_UE_INST; UE_inst++) {
if (UE_stats[UE_inst])
fclose (UE_stats[UE_inst]);
if(UE_stats_th[UE_inst])
fclose (UE_stats_th[UE_inst]);
}
for (eNB_inst=0; eNB_inst<NB_eNB_INST; eNB_inst++) {
if (eNB_stats[eNB_inst])
fclose (eNB_stats[eNB_inst]);
}
if (eNB_avg_thr)
fclose (eNB_avg_thr);
if (eNB_l2_stats)
fclose (eNB_l2_stats);
#endif
#if defined(ENABLE_ITTI)
itti_terminate_tasks(TASK_L2L1);
#endif
return NULL;
}
/*
* The following two functions are meant to restart *the lte-softmodem* and are
* here to make oaisim compile. A restart command from the controller will be
* ignored in oaisim.
*/
int stop_L1L2(int enb_id)
{
LOG_W(FLEXRAN_AGENT, "stop_L1L2() not supported in oaisim\n");
return 0;
}
int restart_L1L2(int enb_id)
{
LOG_W(FLEXRAN_AGENT, "restart_L1L2() not supported in oaisim\n");
return 0;
}
#if T_TRACER
int T_wait = 1; /* by default we wait for the tracer */
int T_port = 2021; /* default port to listen to to wait for the tracer */
int T_dont_fork = 0; /* default is to fork, see 'T_init' to understand */
#endif
void wait_RUs(void)
{
int i;
// wait for all RUs to be configured over fronthaul
pthread_mutex_lock(&RC.ru_mutex);
while (RC.ru_mask>0) {
pthread_cond_wait(&RC.ru_cond,&RC.ru_mutex);
}
// copy frame parameters from RU to UEs
for (i=0;i<NB_UE_INST;i++) {
PHY_vars_UE_g[i][0]->frame_parms.N_RB_DL = RC.ru[0]->frame_parms.N_RB_DL;
PHY_vars_UE_g[i][0]->frame_parms.N_RB_UL = RC.ru[0]->frame_parms.N_RB_UL;
PHY_vars_UE_g[i][0]->frame_parms.nb_antennas_tx = 1;
PHY_vars_UE_g[i][0]->frame_parms.nb_antennas_rx = 1;
// set initially to 2, it will be revised after initial synchronization
PHY_vars_UE_g[i][0]->frame_parms.nb_antenna_ports_eNB = 2;
PHY_vars_UE_g[i][0]->frame_parms.tdd_config = 1;
PHY_vars_UE_g[i][0]->frame_parms.dl_CarrierFreq = RC.ru[0]->frame_parms.dl_CarrierFreq;
PHY_vars_UE_g[i][0]->frame_parms.ul_CarrierFreq = RC.ru[0]->frame_parms.ul_CarrierFreq;
PHY_vars_UE_g[i][0]->frame_parms.eutra_band = RC.ru[0]->frame_parms.eutra_band;
LOG_I(PHY,"Initializing UE %d frame parameters from RU information: N_RB_DL %d, p %d, dl_Carrierfreq %u, ul_CarrierFreq %u, eutra_band %d\n",
i,
PHY_vars_UE_g[i][0]->frame_parms.N_RB_DL,
PHY_vars_UE_g[i][0]->frame_parms.nb_antenna_ports_eNB,
PHY_vars_UE_g[i][0]->frame_parms.dl_CarrierFreq,
PHY_vars_UE_g[i][0]->frame_parms.ul_CarrierFreq,
PHY_vars_UE_g[i][0]->frame_parms.eutra_band);
current_UE_rx_timestamp[i][0] = RC.ru[0]->frame_parms.samples_per_tti + RC.ru[0]->frame_parms.ofdm_symbol_size + RC.ru[0]->frame_parms.nb_prefix_samples0;
}
for (ru_id=0;ru_id<RC.nb_RU;ru_id++) current_ru_rx_timestamp[ru_id][0] = RC.ru[ru_id]->frame_parms.samples_per_tti;
printf("RUs are ready, let's go\n");
}
void init_UE(int,int,int,int);
void init_RU(const char*);
void set_UE_defaults(int nb_ue) {
for (int UE_id = 0;UE_id<nb_ue;UE_id++) {
for (int CC_id = 0;CC_id<MAX_NUM_CCs;CC_id++) {
for (uint8_t i=0; i<RX_NB_TH_MAX; i++) {
PHY_vars_UE_g[UE_id][CC_id]->pdcch_vars[i][0]->dciFormat = 0;
PHY_vars_UE_g[UE_id][CC_id]->pdcch_vars[i][0]->agregationLevel = 0xFF;
}
PHY_vars_UE_g[UE_id][CC_id]->current_dlsch_cqi[0] = 10;
PHY_vars_UE_g[UE_id][CC_id]->tx_power_max_dBm = 23;
}
}
}
static void print_current_directory(void)
{
char dir[8192]; /* arbitrary size (should be big enough) */
if (getcwd(dir, 8192) == NULL)
printf("ERROR getting working directory\n");
else
printf("working directory: %s\n", dir);
}
void init_devices(void);
int main (int argc, char **argv)
{
clock_t t;
print_current_directory();
start_background_system();
#ifdef SMBV
// Rohde&Schwarz SMBV100A vector signal generator
strcpy(smbv_ip,DEFAULT_SMBV_IP);
#endif
#ifdef PROC
int node_id;
int port,Process_Flag=0,wgt,Channel_Flag=0,temp;
#endif
//default parameters
oai_emulation.info.n_frames = MAX_FRAME_NUMBER; //1024; //10;
oai_emulation.info.n_frames_flag = 0; //fixme
snr_dB = 30;
NB_UE_INST = 1;
//Default values if not changed by the user in get_simulation_options();
pdcp_period = 1;
omg_period = 1;
//Clean ip rule table
for(int i =0; i<NUMBER_OF_UE_MAX; i++){
char command_line[100];
sprintf(command_line, "while ip rule del table %d; do true; done",i+201);
/* we don't care about return value from system(), but let's the
* compiler be silent, so let's do "if (XX);"
*/
if (system(command_line)) /* nothing */;
}
// start thread for log gen
log_thread_init ();
//init_oai_emulation (); // to initialize everything !!!
// get command-line options
get_simulation_options (argc, argv); //Command-line options
#if T_TRACER
T_init(T_port, T_wait, T_dont_fork);
#endif
// Initialize VCD LOG module
VCD_SIGNAL_DUMPER_INIT (oai_emulation.info.vcd_file);
#if !defined(ENABLE_ITTI)
pthread_t tid;
int err;
sigset_t sigblock;
sigemptyset (&sigblock);
sigaddset (&sigblock, SIGHUP);
sigaddset (&sigblock, SIGINT);
sigaddset (&sigblock, SIGTERM);
sigaddset (&sigblock, SIGQUIT);
//sigaddset(&sigblock, SIGKILL);
if ((err = pthread_sigmask (SIG_BLOCK, &sigblock, NULL)) != 0) {
printf ("SIG_BLOCK error\n");
return -1;
}
if (pthread_create (&tid, NULL, sigh, NULL)) {
printf ("Pthread for tracing Signals is not created!\n");
return -1;
} else {
printf ("Pthread for tracing Signals is created!\n");
}
#endif
// configure oaisim with OCG
//oaisim_config (); // config OMG and OCG, OPT, OTG, OLG
logInit();
#if defined(ENABLE_ITTI)
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, oai_emulation.info.itti_dump_file);
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
#endif
set_glog(LOG_INFO, 0x15);
//set_log(OCG, LOG_DEBUG, 1);
//set_log(EMU, LOG_INFO, 20);
set_log(MAC, LOG_DEBUG, 1);
set_log(RLC, LOG_TRACE, 1);
//set_log(PHY, LOG_DEBUG, 1);
set_log(PDCP, LOG_TRACE, 1);
set_log(RRC, LOG_DEBUG, 1);
//set_log(OCM, LOG_INFO, 20);
//set_log(OTG, LOG_INFO, 1);
set_comp_log(OCG, LOG_ERR, 0x15,1);
set_comp_log(EMU, LOG_DEBUG, 0x15,20);
set_comp_log(MAC, LOG_TRACE, 0x15,1);
set_comp_log(RLC, LOG_TRACE, 0x15,1);
set_comp_log(PHY, LOG_TRACE, 0x15, 1);
set_comp_log(PDCP, LOG_DEBUG, 0x15,1);
set_comp_log(RRC, LOG_DEBUG, 0x15,1);
set_comp_log(OCM, LOG_DEBUG, 0x15,20);
set_comp_log(OTG, LOG_DEBUG, 0x15,1);
set_comp_log(OMG, LOG_NOTICE, 0x15,1);
set_comp_log(OPT, LOG_ERR, 0x15,1);
if (ue_connection_test == 1) {
snr_direction = -snr_step;
snr_dB = 20;
sinr_dB = -20;
}
pthread_cond_init(&sync_cond,NULL);
pthread_mutex_init(&sync_mutex, NULL);
pthread_mutex_init(&subframe_mutex, NULL);
//Before this call, NB_UE_INST and NB_eNB_INST are not set correctly
check_and_adjust_params ();
set_seed = oai_emulation.emulation_config.seed.value;
init_seed (set_seed);
init_RU(NULL);
init_devices ();
// init_openair2 ();
// init_openair0();
if (create_tasks_ue(NB_UE_INST) < 0)
exit(-1); // need a softer mode
printf("Waiting for RUs to get set up\n");
wait_RUs();
init_UE(NB_UE_INST,0,0,1);
set_UE_defaults(NB_UE_INST);
init_ocm ();
printf("Sending sync to all threads\n");
pthread_mutex_lock(&sync_mutex);
sync_var=0;
pthread_cond_broadcast(&sync_cond);
pthread_mutex_unlock(&sync_mutex);
/* #if defined (FLEXRAN_AGENT_SB_IF)
flexran_agent_start();
#endif */
// add events to future event list: Currently not used
//oai_emulation.info.oeh_enabled = 1;
if (oai_emulation.info.oeh_enabled == 1)
schedule_events ();
// oai performance profiler is enabled
if (oai_emulation.info.opp_enabled == 1)
reset_opp_meas_oaisim ();
cpuf=get_cpu_freq_GHz();
init_time ();
init_slot_isr ();
t = clock ();
LOG_N(EMU,
">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU initialization done <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
#ifndef PACKAGE_VERSION
# define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
#endif
LOG_I(EMU, "Version: %s\n", PACKAGE_VERSION);
#if defined(ENABLE_ITTI)
// Handle signals until all tasks are terminated
itti_wait_tasks_end();
#else
if (oai_emulation.info.nb_enb_local > 0) {
eNB_app_task (NULL); // do nothing for the moment
}
l2l1_task (NULL);
#endif
t = clock () - t;
LOG_I(EMU, "Duration of the simulation: %f seconds\n",
((float) t) / CLOCKS_PER_SEC);
LOG_N(EMU,
">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU Ending <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
raise (SIGINT);
// oai_shutdown ();
return (0);
}
void
reset_opp_meas_oaisim (void)
{
uint8_t eNB_id = 0, UE_id = 0;
reset_meas (&oaisim_stats);
reset_meas (&oaisim_stats_f); // frame
// init time stats here (including channel)
reset_meas (&dl_chan_stats);
reset_meas (&ul_chan_stats);
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
reset_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc[0]);
reset_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc[1]);
reset_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc_rx[0]);
reset_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc_rx[1]);
reset_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc_tx);
// reset_meas (&PHY_vars_UE_g[UE_id][0]->ofdm_demod_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->rx_dft_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_channel_estimation_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_freq_offset_estimation_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_decoding_stats[0]);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_decoding_stats[1]);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_rate_unmatching_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_turbo_decoding_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_deinterleaving_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_llr_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_unscrambling_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_tc_init_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_tc_alpha_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_tc_beta_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_tc_gamma_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_tc_ext_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_tc_intl1_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_tc_intl2_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->tx_prach);
reset_meas (&PHY_vars_UE_g[UE_id][0]->ofdm_mod_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_encoding_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_modulation_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_segmentation_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_rate_matching_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_turbo_encoding_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_interleaving_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_multiplexing_stats);
/*
* L2 functions
*/
// UE MAC
reset_meas (&UE_mac_inst[UE_id].ue_scheduler); // total
reset_meas (&UE_mac_inst[UE_id].tx_ulsch_sdu); // inlcude rlc_data_req + mac header gen
reset_meas (&UE_mac_inst[UE_id].rx_dlsch_sdu); // include mac_rrc_data_ind or mac_rlc_status_ind+mac_rlc_data_ind and mac header parser
reset_meas (&UE_mac_inst[UE_id].ue_query_mch);
reset_meas (&UE_mac_inst[UE_id].rx_mch_sdu); // include rld_data_ind+ parse mch header
reset_meas (&UE_mac_inst[UE_id].rx_si); // include rlc_data_ind + mac header parser
reset_meas (&UE_pdcp_stats[UE_id].pdcp_run);
reset_meas (&UE_pdcp_stats[UE_id].data_req);
reset_meas (&UE_pdcp_stats[UE_id].data_ind);
reset_meas (&UE_pdcp_stats[UE_id].apply_security);
reset_meas (&UE_pdcp_stats[UE_id].validate_security);
reset_meas (&UE_pdcp_stats[UE_id].pdcp_ip);
reset_meas (&UE_pdcp_stats[UE_id].ip_pdcp);
}
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
reset_meas (&RU2UE[eNB_id][UE_id][0]->random_channel);
reset_meas (&RU2UE[eNB_id][UE_id][0]->interp_time);
reset_meas (&RU2UE[eNB_id][UE_id][0]->interp_freq);
reset_meas (&RU2UE[eNB_id][UE_id][0]->convolution);
reset_meas (&UE2RU[UE_id][eNB_id][0]->random_channel);
reset_meas (&UE2RU[UE_id][eNB_id][0]->interp_time);
reset_meas (&UE2RU[UE_id][eNB_id][0]->interp_freq);
reset_meas (&UE2RU[UE_id][eNB_id][0]->convolution);
}
reset_meas (&RC.eNB[eNB_id][0]->phy_proc);
reset_meas (&RC.eNB[eNB_id][0]->phy_proc_rx);
reset_meas (&RC.eNB[eNB_id][0]->phy_proc_tx);
reset_meas (&RC.eNB[eNB_id][0]->rx_prach);
reset_meas (&RC.eNB[eNB_id][0]->ofdm_mod_stats);
reset_meas (&RC.eNB[eNB_id][0]->dlsch_encoding_stats);
reset_meas (&RC.eNB[eNB_id][0]->dlsch_modulation_stats);
reset_meas (&RC.eNB[eNB_id][0]->dlsch_scrambling_stats);
reset_meas (&RC.eNB[eNB_id][0]->dlsch_rate_matching_stats);
reset_meas (&RC.eNB[eNB_id][0]->dlsch_turbo_encoding_stats);
reset_meas (&RC.eNB[eNB_id][0]->dlsch_interleaving_stats);
// reset_meas (&RC.eNB[eNB_id][0]->ofdm_demod_stats);
//reset_meas(&RC.eNB[eNB_id]->rx_dft_stats);
//reset_meas(&RC.eNB[eNB_id]->ulsch_channel_estimation_stats);
//reset_meas(&RC.eNB[eNB_id]->ulsch_freq_offset_estimation_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_decoding_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_demodulation_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_rate_unmatching_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_turbo_decoding_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_deinterleaving_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_demultiplexing_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_llr_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_tc_init_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_tc_alpha_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_tc_beta_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_tc_gamma_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_tc_ext_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_tc_intl1_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_tc_intl2_stats);
#ifdef LOCALIZATION
reset_meas(&RC.eNB[eNB_id][0]->localization_stats);
#endif
/*
* L2 functions
*/
// eNB MAC
reset_meas (&RC.mac[eNB_id]->eNB_scheduler); // total
reset_meas (&RC.mac[eNB_id]->schedule_si); // only schedule + tx
reset_meas (&RC.mac[eNB_id]->schedule_ra); // only ra
reset_meas (&RC.mac[eNB_id]->schedule_ulsch); // onlu ulsch
reset_meas (&RC.mac[eNB_id]->fill_DLSCH_dci); // only dci
reset_meas (&RC.mac[eNB_id]->schedule_dlsch_preprocessor); // include rlc_data_req + MAC header gen
reset_meas (&RC.mac[eNB_id]->schedule_dlsch); // include rlc_data_req + MAC header gen + pre-processor
reset_meas (&RC.mac[eNB_id]->schedule_mch); // only embms
reset_meas (&RC.mac[eNB_id]->rx_ulsch_sdu); // include rlc_data_ind + mac header parser
reset_meas (&eNB_pdcp_stats[eNB_id].pdcp_run);
reset_meas (&eNB_pdcp_stats[eNB_id].data_req);
reset_meas (&eNB_pdcp_stats[eNB_id].data_ind);
reset_meas (&eNB_pdcp_stats[eNB_id].apply_security);
reset_meas (&eNB_pdcp_stats[eNB_id].validate_security);
reset_meas (&eNB_pdcp_stats[eNB_id].pdcp_ip);
reset_meas (&eNB_pdcp_stats[eNB_id].ip_pdcp);
}
}
void
print_opp_meas_oaisim (void)
{
uint8_t eNB_id = 0, UE_id = 0;
print_meas (&oaisim_stats, "[OAI][total_exec_time]", &oaisim_stats,
&oaisim_stats);
print_meas (&oaisim_stats_f, "[OAI][SF_exec_time]", &oaisim_stats,
&oaisim_stats_f);
print_meas (&dl_chan_stats, "[DL][chan_stats]", &oaisim_stats,
&oaisim_stats_f);
print_meas (&ul_chan_stats, "[UL][chan_stats]", &oaisim_stats,
&oaisim_stats_f);
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
for (ru_id = 0; ru_id < NB_RU; ru_id++) {
print_meas (&RU2UE[ru_id][UE_id][0]->random_channel,
"[DL][random_channel]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RU2UE[ru_id][UE_id][0]->interp_time,
"[DL][interp_time]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RU2UE[ru_id][UE_id][0]->interp_freq,
"[DL][interp_freq]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RU2UE[ru_id][UE_id][0]->convolution,
"[DL][convolution]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2RU[UE_id][ru_id][0]->random_channel,
"[UL][random_channel]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2RU[UE_id][ru_id][0]->interp_time,
"[UL][interp_time]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2RU[UE_id][ru_id][0]->interp_freq,
"[UL][interp_freq]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2RU[UE_id][ru_id][0]->convolution,
"[UL][convolution]", &oaisim_stats, &oaisim_stats_f);
}
}
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
print_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc[0], "[UE][total_phy_proc[0]]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc[1], "[UE][total_phy_proc[1]]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc_rx[0],
"[UE][total_phy_proc_rx[0]]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc_rx[1],
"[UE][total_phy_proc_rx[1]]", &oaisim_stats, &oaisim_stats_f);
// print_meas (&PHY_vars_UE_g[UE_id][0]->ofdm_demod_stats,
// "[UE][ofdm_demod]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->rx_dft_stats, "[UE][rx_dft]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_channel_estimation_stats,
"[UE][channel_est]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_freq_offset_estimation_stats,
"[UE][freq_offset]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_llr_stats, "[UE][llr]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_unscrambling_stats,
"[UE][unscrambling]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_decoding_stats[0],
"[UE][decoding[0]]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_decoding_stats[1],
"[UE][decoding[1]]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_rate_unmatching_stats,
"[UE][rate_unmatching]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_deinterleaving_stats,
"[UE][deinterleaving]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_turbo_decoding_stats,
"[UE][turbo_decoding]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_tc_init_stats,
"[UE][ |_tc_init]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_tc_alpha_stats,
"[UE][ |_tc_alpha]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_tc_beta_stats,
"[UE][ |_tc_beta]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_tc_gamma_stats,
"[UE][ |_tc_gamma]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_tc_ext_stats,
"[UE][ |_tc_ext]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_tc_intl1_stats,
"[UE][ |_tc_intl1]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_tc_intl2_stats,
"[UE][ |_tc_intl2]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc_tx,
"[UE][total_phy_proc_tx]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->ofdm_mod_stats, "[UE][ofdm_mod]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_modulation_stats,
"[UE][modulation]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_encoding_stats,
"[UE][encoding]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_segmentation_stats,
"[UE][segmentation]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_rate_matching_stats,
"[UE][rate_matching]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_turbo_encoding_stats,
"[UE][turbo_encoding]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_interleaving_stats,
"[UE][interleaving]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_multiplexing_stats,
"[UE][multiplexing]", &oaisim_stats, &oaisim_stats_f);
}
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
print_meas (&RC.eNB[eNB_id][0]->phy_proc,
"[eNB][total_phy_proc]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->phy_proc_tx,
"[eNB][total_phy_proc_tx]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->ofdm_mod_stats,
"[eNB][ofdm_mod]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->dlsch_modulation_stats,
"[eNB][modulation]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->dlsch_scrambling_stats,
"[eNB][scrambling]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->dlsch_encoding_stats,
"[eNB][encoding]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->dlsch_interleaving_stats,
"[eNB][|_interleaving]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->dlsch_rate_matching_stats,
"[eNB][|_rate_matching]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->dlsch_turbo_encoding_stats,
"[eNB][|_turbo_encoding]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->phy_proc_rx,
"[eNB][total_phy_proc_rx]", &oaisim_stats, &oaisim_stats_f);
// print_meas (&RC.eNB[eNB_id][0]->ofdm_demod_stats,
// "[eNB][ofdm_demod]", &oaisim_stats, &oaisim_stats_f);
//print_meas(&RC.eNB[eNB_id][0]->ulsch_channel_estimation_stats,"[eNB][channel_est]");
//print_meas(&RC.eNB[eNB_id][0]->ulsch_freq_offset_estimation_stats,"[eNB][freq_offset]");
//print_meas(&RC.eNB[eNB_id][0]->rx_dft_stats,"[eNB][rx_dft]");
print_meas (&RC.eNB[eNB_id][0]->ulsch_demodulation_stats,
"[eNB][demodulation]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->ulsch_decoding_stats,
"[eNB][decoding]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->ulsch_deinterleaving_stats,
"[eNB][|_deinterleaving]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->ulsch_demultiplexing_stats,
"[eNB][|_demultiplexing]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->ulsch_rate_unmatching_stats,
"[eNB][|_rate_unmatching]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->ulsch_turbo_decoding_stats,
"[eNB][|_turbo_decoding]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->ulsch_tc_init_stats,
"[eNB][ |_tc_init]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->ulsch_tc_alpha_stats,
"[eNB][ |_tc_alpha]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->ulsch_tc_beta_stats,
"[eNB][ |_tc_beta]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->ulsch_tc_gamma_stats,
"[eNB][ |_tc_gamma]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->ulsch_tc_ext_stats,
"[eNB][ |_tc_ext]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->ulsch_tc_intl1_stats,
"[eNB][ |_tc_intl1]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->ulsch_tc_intl2_stats,
"[eNB][ |_tc_intl2]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.eNB[eNB_id][0]->rx_prach, "[eNB][rx_prach]",
&oaisim_stats, &oaisim_stats_f);
#ifdef LOCALIZATION
print_meas(&RC.eNB[eNB_id][0]->localization_stats, "[eNB][LOCALIZATION]",&oaisim_stats,&oaisim_stats_f);
#endif
}
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
print_meas (&UE_mac_inst[UE_id].ue_scheduler, "[UE][mac_scheduler]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&UE_mac_inst[UE_id].tx_ulsch_sdu, "[UE][tx_ulsch_sdu]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&UE_mac_inst[UE_id].rx_dlsch_sdu, "[UE][rx_dlsch_sdu]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&UE_mac_inst[UE_id].ue_query_mch, "[UE][query_MCH]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&UE_mac_inst[UE_id].rx_mch_sdu, "[UE][rx_mch_sdu]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&UE_mac_inst[UE_id].rx_si, "[UE][rx_si]", &oaisim_stats,
&oaisim_stats_f);
print_meas (&UE_pdcp_stats[UE_id].pdcp_run, "[UE][total_pdcp_run]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&UE_pdcp_stats[UE_id].data_req, "[UE][DL][pdcp_data_req]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&UE_pdcp_stats[UE_id].data_ind, "[UE][UL][pdcp_data_ind]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&UE_pdcp_stats[UE_id].apply_security,
"[UE][DL][apply_security]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE_pdcp_stats[UE_id].validate_security,
"[UE][UL][validate_security]", &oaisim_stats,
&oaisim_stats_f);
print_meas (&UE_pdcp_stats[UE_id].ip_pdcp, "[UE][DL][ip_pdcp]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&UE_pdcp_stats[UE_id].pdcp_ip, "[UE][UL][pdcp_ip]",
&oaisim_stats, &oaisim_stats_f);
}
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
print_meas (&RC.mac[eNB_id]->eNB_scheduler, "[eNB][mac_scheduler]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&RC.mac[eNB_id]->schedule_si, "[eNB][DL][SI]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&RC.mac[eNB_id]->schedule_ra, "[eNB][DL][RA]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&RC.mac[eNB_id]->fill_DLSCH_dci,
"[eNB][DL/UL][fill_DCI]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.mac[eNB_id]->schedule_dlsch_preprocessor,
"[eNB][DL][preprocessor]", &oaisim_stats, &oaisim_stats_f);
print_meas (&RC.mac[eNB_id]->schedule_dlsch,
"[eNB][DL][schedule_tx_dlsch]", &oaisim_stats,
&oaisim_stats_f);
print_meas (&RC.mac[eNB_id]->schedule_mch, "[eNB][DL][mch]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&RC.mac[eNB_id]->schedule_ulsch, "[eNB][UL][ULSCH]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&RC.mac[eNB_id]->rx_ulsch_sdu,
"[eNB][UL][rx_ulsch_sdu]", &oaisim_stats, &oaisim_stats_f);
print_meas (&eNB_pdcp_stats[eNB_id].pdcp_run, "[eNB][pdcp_run]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&eNB_pdcp_stats[eNB_id].data_req,
"[eNB][DL][pdcp_data_req]", &oaisim_stats, &oaisim_stats_f);
print_meas (&eNB_pdcp_stats[eNB_id].data_ind,
"[eNB][UL][pdcp_data_ind]", &oaisim_stats, &oaisim_stats_f);
print_meas (&eNB_pdcp_stats[eNB_id].apply_security,
"[eNB][DL][apply_security]", &oaisim_stats,
&oaisim_stats_f);
print_meas (&eNB_pdcp_stats[eNB_id].validate_security,
"[eNB][UL][validate_security]", &oaisim_stats,
&oaisim_stats_f);
print_meas (&eNB_pdcp_stats[eNB_id].ip_pdcp, "[eNB][DL][ip_pdcp]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&eNB_pdcp_stats[eNB_id].pdcp_ip, "[eNB][UL][pdcp_ip]",
&oaisim_stats, &oaisim_stats_f);
}
}
#if !defined(ENABLE_ITTI)
static void *
sigh (void *arg)
{
int signum;
sigset_t sigcatch;
sigemptyset (&sigcatch);
sigaddset (&sigcatch, SIGHUP);
sigaddset (&sigcatch, SIGINT);
sigaddset (&sigcatch, SIGTERM);
sigaddset (&sigcatch, SIGQUIT);
for (;;) {
sigwait (&sigcatch, &signum);
//sigwait(&sigblock, &signum);
switch (signum) {
case SIGHUP:
case SIGINT:
case SIGTERM:
case SIGQUIT:
fprintf (stderr, "received signal %d \n", signum);
// no need for mutx: when ITTI not used, this variable is only accessed by this function
l2l1_state = L2L1_TERMINATED;
break;
default:
fprintf (stderr, "Unexpected signal %d \n", signum);
exit (-1);
break;
}
}
pthread_exit (NULL);
}
#endif /* !defined(ENABLE_ITTI) */
void
oai_shutdown (void)
{
static int done = 0;
if (done)
return;
free (otg_pdcp_buffer);
otg_pdcp_buffer = 0;
#ifdef SMBV
// Rohde&Schwarz SMBV100A vector signal generator
if (config_smbv) {
smbv_send_config (smbv_fname,smbv_ip);
}
#endif
if (oai_emulation.info.opp_enabled == 1)
print_opp_meas_oaisim ();
#ifdef PROC
if (abstraction_flag == 0 && Channel_Flag==0 && Process_Flag==0)
#else
if (abstraction_flag == 0)
#endif
{
/*
#ifdef IFFT_FPGA
free(txdataF2[0]);
free(txdataF2[1]);
free(txdataF2);
free(txdata[0]);
free(txdata[1]);
free(txdata);
#endif
*/
/*
for (int i = 0; i < 2; i++) {
free (s_re[i]);
free (s_im[i]);
free (r_re[i]);
free (r_im[i]);
}
free (s_re);
free (s_im);
free (r_re);
free (r_im);
s_re = 0;
s_im = 0;
r_re = 0;
r_im = 0;*/
lte_sync_time_free ();
}
// added for PHY abstraction
if (oai_emulation.info.ocm_enabled == 1) {
for (eNB_inst = 0; eNB_inst < NUMBER_OF_eNB_MAX; eNB_inst++) {
free (enb_data[eNB_inst]);
enb_data[eNB_inst] = 0;
}
for (UE_inst = 0; UE_inst < NUMBER_OF_UE_MAX; UE_inst++) {
free (ue_data[UE_inst]);
ue_data[UE_inst] = 0;
}
} //End of PHY abstraction changes
if ((oai_emulation.info.ocm_enabled == 1) && (ethernet_flag == 0)
&& (ShaF != NULL)) {
destroyMat (ShaF, map1, map2);
ShaF = 0;
}
if (opt_enabled == 1)
terminate_opt ();
for (int i = 0; i < NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX; i++)
if (oai_emulation.info.oai_ifup[i] == 1) {
char interfaceName[8];
snprintf (interfaceName, sizeof(interfaceName), "oai%d", i);
bringInterfaceUp (interfaceName, 0);
}
log_thread_finalize ();
logClean ();
VCD_SIGNAL_DUMPER_CLOSE ();
done = 1; // prevent next invokation of this function
LOG_N(EMU,
">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU shutdown <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
}
eNB_MAC_INST*
get_eNB_mac_inst (module_id_t module_idP)
{
return (RC.mac[module_idP]);
}
OAI_Emulation*
get_OAI_emulation ()
{
return &oai_emulation;
}
// dummy function declarations
void *rrc_enb_task(void *args_p)
{
return NULL;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include "SIMULATION/TOOLS/sim.h"
#include "SIMULATION/RF/rf.h"
#include "PHY/types.h"
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
#include "oaisim_config.h"
#include "init_lte.h"
#ifdef OPENAIR2
#include "LAYER2/MAC/mac.h"
#include "UTIL/OMV/structures.h"
#endif
eNB_MAC_INST* get_eNB_mac_inst(module_id_t module_idP);
OAI_Emulation* get_OAI_emulation(void);
void init_channel_vars(LTE_DL_FRAME_PARMS *frame_parms, double ***s_re,double ***s_im,double ***r_re,double ***r_im,double ***r_re0,double ***r_im0);
void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM_CCs],
node_desc_t *enb_data[NUMBER_OF_RU_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],
uint16_t subframe,uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,int eNB_id,uint8_t CC_id);
void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs],
node_desc_t *enb_data[NUMBER_OF_RU_MAX],
node_desc_t *ue_data[NUMBER_OF_UE_MAX],
uint16_t subframe,
uint32_t offset,
uint32_t length,
uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,uint8_t UE_id,int CC_id);
void init_ue(node_desc_t *ue_data, UE_Antenna ue_ant);//Abstraction changes
void init_enb(node_desc_t *enb_data, eNB_Antenna enb_ant);//Abstraction changes
void extract_position(node_list* input_node_list, node_desc_t**, int nb_nodes);//Abstraction changes
void get_beta_map(void);//Abstraction changes
void get_MIESM_param(void);
void init_snr(channel_desc_t *, node_desc_t *, node_desc_t *, double*, double*, uint8_t, uint16_t, uint8_t, uint16_t);//Abstraction changes
void init_snr_up(channel_desc_t *, node_desc_t *, node_desc_t *, double*, double*, uint16_t, uint16_t);//Abstraction changes
void calculate_sinr(channel_desc_t *, node_desc_t *, node_desc_t *, double *sinr_dB, uint16_t);//Abstraction changes
void get_beta_map(void);
int dlsch_abstraction_EESM(double* sinr_dB, uint32_t rb_alloc[4], uint8_t mcs, uint8_t); //temporary testing for PHY abstraction
int dlsch_abstraction_MIESM(double* sinr_dB,uint8_t TM, uint32_t rb_alloc[4], uint8_t mcs,uint8_t);
int ulsch_abstraction_MIESM(double* sinr_dB,uint8_t TM, uint8_t mcs,uint16_t nb_rb, uint16_t first_rb);
int ulsch_abstraction(double* sinr_dB,uint8_t TM, uint8_t mcs,uint16_t nb_rb, uint16_t first_rb);
void calc_path_loss(node_desc_t* node_tx, node_desc_t* node_rx, channel_desc_t *ch_desc, Environment_System_Config env_desc, double **SF);
void do_OFDM_mod(int32_t **txdataF, int32_t **txdata, frame_t frame, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms);
void reset_opp_meas(void);
void print_opp_meas(void);
#ifdef OPENAIR2
int omv_write (int pfd, node_list* enb_node_list, node_list* ue_node_list, Data_Flow_Unit omv_data);
void omv_end (int pfd, Data_Flow_Unit omv_data);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file oaisim_config.c
* \brief Configuration of oaisim
* \author Navid Nikaein
* \date 2013-2015
* \version 1.0
* \company Eurecom
* \email: openair_tech@eurecom.fr
* \note
* \warning
*/
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include "oaisim_config.h"
#include "OCG.h"
#include "OCG_extern.h"
#include "UTIL/OMG/omg.h"
#include "UTIL/OMG/grid.h"
#include "UTIL/OTG/otg_tx.h"
#include "UTIL/OTG/otg.h"
#include "UTIL/OTG/otg_externs.h"
#include "oml.h"
#include "msc.h"
#if ENABLE_RAL
#include "lteRALenb.h"
#include "lteRALue.h"
#endif
#if defined(ENABLE_ITTI)
# include "intertask_interface_init.h"
#endif
mapping omg_model_names[] = {
{"STATIC", STATIC},
{"RWP", RWP},
{"RWALK", RWALK},
{"TRACE", TRACE},
{"SUMO", SUMO},
{"STEADY_RWP", STEADY_RWP},
{"MAX_NUM_MOB_TYPES", MAX_NUM_MOB_TYPES},
{NULL, -1}
};
// subtypes for RWP in grid map
mapping omg_rwp_names[] = {
{"MIN_RWP_TYPES", MIN_RWP_TYPES},
{"RESTRICTED_RWP",RESTIRICTED_RWP},
{"CONNECTED_DOMAIN", CONNECTED_DOMAIN},
{"MAX_RWP_TYPES", MAX_RWP_TYPES},
{NULL, -1}
};
void ocg_config_proto(void);
void init_oai_emulation(void)
{
int i;
int CC_id;
oai_emulation.environment_system_config.fading.large_scale.selected_option = "free_space";
oai_emulation.environment_system_config.fading.free_space_model_parameters.pathloss_exponent = 3.00;
oai_emulation.environment_system_config.fading.free_space_model_parameters.pathloss_0_dB = -100;
oai_emulation.environment_system_config.fading.small_scale.selected_option = "AWGN";
oai_emulation.environment_system_config.fading.ricean_8tap.rice_factor_dB = 0;
oai_emulation.environment_system_config.fading.shadowing.decorrelation_distance_m = 0;
oai_emulation.environment_system_config.fading.shadowing.variance_dB = 0;
oai_emulation.environment_system_config.fading.shadowing.inter_site_correlation = 0;
oai_emulation.environment_system_config.antenna.eNB_antenna.number_of_sectors = 1;
oai_emulation.environment_system_config.antenna.eNB_antenna.beam_width_dB = 1.13;
oai_emulation.environment_system_config.antenna.eNB_antenna.alpha_rad[0] = 0;
oai_emulation.environment_system_config.antenna.eNB_antenna.alpha_rad[1] = 0;
oai_emulation.environment_system_config.antenna.eNB_antenna.alpha_rad[2] = 0;
oai_emulation.environment_system_config.antenna.eNB_antenna.antenna_gain_dBi = 0;
oai_emulation.environment_system_config.antenna.eNB_antenna.tx_power_dBm = 15;
oai_emulation.environment_system_config.antenna.eNB_antenna.rx_noise_level_dB = 0;
oai_emulation.environment_system_config.antenna.eNB_antenna.antenna_orientation_degree[0] = 0;
oai_emulation.environment_system_config.antenna.eNB_antenna.antenna_orientation_degree[1] = 0;
oai_emulation.environment_system_config.antenna.eNB_antenna.antenna_orientation_degree[2] = 0;
oai_emulation.environment_system_config.antenna.UE_antenna.antenna_gain_dBi = 0;
oai_emulation.environment_system_config.antenna.UE_antenna.tx_power_dBm = 20;
oai_emulation.environment_system_config.antenna.UE_antenna.rx_noise_level_dB = 0; // noise figure
oai_emulation.environment_system_config.wall_penetration_loss_dB = 5;
oai_emulation.environment_system_config.system_bandwidth_MB = 7.68;
oai_emulation.environment_system_config.system_frequency_GHz = 1.9;
oai_emulation.topology_config.area.x_m = 1000;
oai_emulation.topology_config.area.y_m = 1000;
oai_emulation.topology_config.network_type.selected_option = "homogeneous";
oai_emulation.topology_config.cell_type.selected_option = "macrocell";
oai_emulation.topology_config.relay.number_of_relays = 0;
oai_emulation.topology_config.mobility.UE_mobility.UE_mobility_type.selected_option = "STATIC";
oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.selected_option="MAX_RWP_TYPES";
//oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.horizontal_grid = 1;
//oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.vertical_grid = 1;
oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_trip_type.selected_option = "random_destination";
oai_emulation.topology_config.mobility.UE_mobility.UE_initial_distribution.selected_option = "random";
oai_emulation.topology_config.mobility.UE_mobility.random_UE_distribution.number_of_nodes = 1;
oai_emulation.topology_config.mobility.UE_mobility.concentrated_UE_distribution.number_of_nodes = 1;
oai_emulation.topology_config.mobility.UE_mobility.grid_UE_distribution.random_grid.number_of_nodes = 1;
oai_emulation.topology_config.mobility.UE_mobility.grid_UE_distribution.border_grid.number_of_nodes = 1;
oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_speed_mps = 0.1;
oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_speed_mps = 20.0;
oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_sleep_ms = 0.1;
oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_sleep_ms = 5.0;
oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_journey_time_ms = 0.1;
oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_journey_time_ms = 10.0;
oai_emulation.topology_config.mobility.eNB_mobility.eNB_mobility_type.selected_option = "STATIC";
oai_emulation.topology_config.mobility.eNB_mobility.eNB_initial_distribution.selected_option = "random";
oai_emulation.topology_config.mobility.eNB_mobility.fixed_eNB_distribution.pos_x = 1;
oai_emulation.topology_config.mobility.eNB_mobility.fixed_eNB_distribution.pos_y = 1;
oai_emulation.topology_config.mobility.eNB_mobility.random_eNB_distribution.number_of_cells = 1;
oai_emulation.topology_config.mobility.eNB_mobility.hexagonal_eNB_distribution.number_of_cells = 1;
oai_emulation.topology_config.mobility.eNB_mobility.hexagonal_eNB_distribution.inter_eNB_distance_km = 1;
oai_emulation.topology_config.mobility.eNB_mobility.grid_eNB_distribution.number_of_grid_x = 1;
oai_emulation.topology_config.mobility.eNB_mobility.grid_eNB_distribution.number_of_grid_y = 1;
oai_emulation.topology_config.mobility.eNB_mobility.trace_config.trace_mobility_file = (char*) malloc(256);
sprintf(oai_emulation.topology_config.mobility.eNB_mobility.trace_config.trace_mobility_file,"static_1enb.tr");
oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file = (char*) malloc(256);
sprintf(oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file,"static_2ues.tr");
oai_emulation.topology_config.mobility.UE_mobility.sumo_config.command = (char*) malloc(20);
sprintf(oai_emulation.topology_config.mobility.UE_mobility.sumo_config.command,"sumo");
oai_emulation.topology_config.mobility.UE_mobility.sumo_config.file = (char*) malloc(256);
snprintf( oai_emulation.topology_config.mobility.UE_mobility.sumo_config.file, 256, "%s/UTIL/OMG/SUMO/SCENARIOS/scen.sumo.cfg", getenv("OPENAIR2_DIR") );
oai_emulation.topology_config.mobility.UE_mobility.sumo_config.start=0;
oai_emulation.topology_config.mobility.UE_mobility.sumo_config.end=0;
oai_emulation.topology_config.mobility.UE_mobility.sumo_config.step=1; // 1000ms
oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hip = (char*) malloc(40);
sprintf(oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hip,"127.0.1.1");
oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hport = 8883;
oai_emulation.application_config.packet_gen_type = "substract_string";
for (i = 0; i < NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX; i++) {
oai_emulation.application_config.predefined_traffic.source_id[i] = "1:10";
oai_emulation.application_config.predefined_traffic.application_type[i] = "no_predefined_traffic";
oai_emulation.application_config.predefined_traffic.background[i] = "disable";
oai_emulation.application_config.predefined_traffic.aggregation_level[i] = 1;
oai_emulation.application_config.predefined_traffic.flow_start[i] = 0;
oai_emulation.application_config.predefined_traffic.flow_duration[i] = 1000;//uniform_dist((i+1)*100,0xffff);
oai_emulation.application_config.predefined_traffic.destination_id[i] = 0;
oai_emulation.application_config.customized_traffic.source_id[i] = "1";
oai_emulation.application_config.customized_traffic.destination_id[i] = "2";
oai_emulation.application_config.customized_traffic.transport_protocol[i] = "udp";
oai_emulation.application_config.customized_traffic.background[i] = "disable";
oai_emulation.application_config.customized_traffic.m2m[i] = "disable";
oai_emulation.application_config.customized_traffic.ip_version[i] = "ipv4";
oai_emulation.application_config.customized_traffic.aggregation_level[i] = 1;
oai_emulation.application_config.customized_traffic.flow_start[i] = 0;// (i+1)*30;
oai_emulation.application_config.customized_traffic.flow_duration[i] = 1000;// uniform_dist((i+1)*100,0xffff);
oai_emulation.application_config.customized_traffic.idt_dist[i] = "uniform";
oai_emulation.application_config.customized_traffic.idt_min_ms[i] = 100;
oai_emulation.application_config.customized_traffic.idt_max_ms[i] = 1000;
oai_emulation.application_config.customized_traffic.idt_standard_deviation[i] = 1;
oai_emulation.application_config.customized_traffic.idt_lambda[i] = 1;
oai_emulation.application_config.customized_traffic.size_dist[i] = "uniform";
oai_emulation.application_config.customized_traffic.size_min_byte[i] = 200;
oai_emulation.application_config.customized_traffic.size_max_byte[i] = 500;
oai_emulation.application_config.customized_traffic.size_standard_deviation[i] = 1;
oai_emulation.application_config.customized_traffic.size_lambda[i] = 1;
oai_emulation.application_config.customized_traffic.stream[i] = 1;
oai_emulation.application_config.customized_traffic.destination_port[i] = 8080;
oai_emulation.application_config.customized_traffic.prob_off_pu[i]= 0;
oai_emulation.application_config.customized_traffic.prob_off_ed[i]= 0;
oai_emulation.application_config.customized_traffic.prob_off_pe[i]= 0;
oai_emulation.application_config.customized_traffic.prob_pu_ed[i]= 0;
oai_emulation.application_config.customized_traffic.prob_pu_pe[i]= 0;
oai_emulation.application_config.customized_traffic.prob_ed_pe[i]= 0;
oai_emulation.application_config.customized_traffic.prob_ed_pu[i]= 0;
oai_emulation.application_config.customized_traffic.holding_time_off_ed[i]= 0;
oai_emulation.application_config.customized_traffic.holding_time_off_pu[i]= 0;
oai_emulation.application_config.customized_traffic.holding_time_off_pe[i]= 0;
oai_emulation.application_config.customized_traffic.holding_time_pe_off[i]= 0;
oai_emulation.application_config.customized_traffic.pu_size_pkts[i]= 0;
oai_emulation.application_config.customized_traffic.ed_size_pkts[i]= 0;
}
/* protocol config */
oai_emulation.protocol_config.eNB_mac_config.num_groups=1;
oai_emulation.emulation_config.emulation_time_ms = 0;
oai_emulation.emulation_config.curve = "disable";
oai_emulation.emulation_config.background_stats = "disable";
oai_emulation.emulation_config.performance_metrics.throughput = "disable";
oai_emulation.emulation_config.performance_metrics.latency ="disable";
oai_emulation.emulation_config.performance_metrics.loss_rate ="disable";
oai_emulation.emulation_config.performance_metrics.owd_radio_access = "disable";
oai_emulation.emulation_config.layer.phy = 0;
oai_emulation.emulation_config.layer.mac = 0;
oai_emulation.emulation_config.layer.rlc = 0;
oai_emulation.emulation_config.layer.pdcp = 0;
oai_emulation.emulation_config.layer.rrc = 0;
oai_emulation.emulation_config.layer.omg = 0;
oai_emulation.emulation_config.layer.otg = 0;
oai_emulation.emulation_config.layer.emu = 1;
oai_emulation.emulation_config.log_emu.level = "debug";
oai_emulation.emulation_config.log_emu.verbosity = "low";
oai_emulation.emulation_config.log_emu.interval = 1;
oai_emulation.emulation_config.packet_trace.enabled = 0;
oai_emulation.emulation_config.seed.value = 0; // 0 means randomly generated by OAI
oai_emulation.info.ocg_ok = 0;
// phy related params :
oai_emulation.info.n_frames=MAX_FRAME_NUMBER; // number of frames simulated by default
oai_emulation.info.n_frames_flag=0; // if set, then let the emulation goes to infinity
//status
oai_emulation.info.is_primary_master=0;
oai_emulation.info.master_list=0;
oai_emulation.info.nb_ue_remote=0;
oai_emulation.info.nb_enb_remote=0;
oai_emulation.info.nb_rn_remote=0;
oai_emulation.info.first_ue_local=0;
oai_emulation.info.first_enb_local=0;
oai_emulation.info.first_rn_local=0;
oai_emulation.info.master_id=0;
oai_emulation.info.nb_ue_local= 1;//default 1 UE
oai_emulation.info.nb_enb_local= 0;//default 0 eNB (to be loaded from config)
oai_emulation.info.nb_ru_local= 0;//default 0 ru (to be loaded from config)
oai_emulation.info.nb_rn_local= 0;//default 0 RN : currently only applicable for eMBMS
oai_emulation.info.ethernet_flag=0;
oai_emulation.info.ocm_enabled=1;// flag ?
oai_emulation.info.ocg_enabled=0;// flag c
oai_emulation.info.otg_enabled=0;// flag T
oai_emulation.info.opt_enabled=0; // P flag
oai_emulation.info.opt_mode=-1; // arg for P flag
oai_emulation.info.cli_enabled=0;// I flag
oai_emulation.info.omv_enabled =0; // v flag
oai_emulation.info.vcd_enabled=0;
oai_emulation.info.opp_enabled=0;
oai_emulation.info.oeh_enabled=0;
oai_emulation.info.cba_group_active=0;
oai_emulation.info.cba_backoff=30;
oai_emulation.info.eMBMS_active_state=0;
oai_emulation.info.handover_active=0;
oai_emulation.info.omg_model_enb=STATIC; //default to static mobility model
oai_emulation.info.omg_model_rn=STATIC; //default to static mobility model
oai_emulation.info.omg_model_ue=STATIC; //default to static mobility model
oai_emulation.info.omg_rwp_type = RESTIRICTED_RWP;
oai_emulation.info.omg_model_ue_current=STATIC; //default to static mobility model
oai_emulation.info.otg_traffic="no_predefined_traffic";
oai_emulation.info.otg_bg_traffic_enabled = 0; // G flag
oai_emulation.info.max_predefined_traffic_config_index = 0;
oai_emulation.info.max_customized_traffic_config_index = 0;
oai_emulation.info.frame = 0; // frame counter of emulation
oai_emulation.info.time_s = 0; // time of emulation
oai_emulation.info.time_ms = 0; // time of emulation
oai_emulation.info.seed = time(NULL); // time-based random seed , , included in ocg report
oai_emulation.info.cli_num_enb= NUMBER_OF_eNB_MAX;
oai_emulation.info.cli_num_ue= NUMBER_OF_UE_MAX;
oai_emulation.info.slot_isr = 0;
oai_emulation.info.slot_sfd = -1;
//for (i=0; i < oai_emulation.info.cli_num_enb; i++)
for (i=0; i < NUMBER_OF_eNB_MAX; i++)
oai_emulation.info.cli_start_enb[i]=1;
// for (i=0; i < oai_emulation.info.cli_num_ue; i++)
for (i=0; i < NUMBER_OF_UE_MAX; i++)
oai_emulation.info.cli_start_ue[i]=1;
for (i=0; i < NUMBER_OF_eNB_MAX+NUMBER_OF_UE_MAX; i++)
oai_emulation.info.oai_ifup[i]=0;
oai_emulation.info.nb_master =0;
oai_emulation.info.ethernet_id =0;
oai_emulation.info.multicast_group =0;
oai_emulation.info.multicast_ifname=NULL;
oai_emulation.info.g_log_level = LOG_INFO;
oai_emulation.info.g_log_verbosity = 0x15;
oai_emulation.info.g_log_verbosity_option = "medium";
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
oai_emulation.info.frame_type[CC_id]=TDD;
oai_emulation.info.frame_type_name[CC_id]="TDD";
oai_emulation.info.tdd_config[CC_id]=3;
oai_emulation.info.tdd_config_S[CC_id]=0;
oai_emulation.info.extended_prefix_flag[CC_id]=0;
oai_emulation.info.N_RB_DL[CC_id]=25;
oai_emulation.info.transmission_mode[CC_id]=2;
}
oai_emulation.profile = "EURECOM";
}
void oaisim_config(void)
{
// init log gen first
//initialize the log generator
logInit();
#if defined(ENABLE_ITTI)
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, oai_emulation.info.itti_dump_file);
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
#endif
// init ocg if enabled, otherwise take the params form the init_oai_emulation()
// and command line options given by the user
if (oai_emulation.info.ocg_enabled == 1) { // activate OCG: xml-based scenario parser
OCG_main(oai_emulation.info.local_server);// eurecom or portable
if (oai_emulation.info.ocg_ok != 1) {
LOG_E(OCG, "Error found by OCG; emulation not launched.\n");
LOG_E(OCG, "Please find more information in the OCG_report.xml located at %s.\n", oai_emulation.info.output_path);
exit (-1);
}
}
#if ENABLE_RAL
mRAL_init_default_values();
eRAL_init_default_values();
#endif
olg_config();
ocg_config_emu();
ocg_config_env();// mobility gen
ocg_config_topo(); // packet tracer using wireshark
ocg_config_proto();
// if T is set or ocg enabled
if (oai_emulation.info.otg_enabled ) {
set_component_filelog(OTG);
set_component_filelog(OTG_LATENCY);
set_component_filelog(OTG_GP);
set_component_filelog(OTG_LATENCY_BG);
set_component_filelog(OTG_GP_BG);
set_component_filelog(OTG_JITTER);
/* g_log->log_component[OTG].filelog=1;
g_log->log_component[OTG_LATENCY].filelog=1;
g_log->log_component[OTG_OWD].filelog = 1;*/
ocg_config_app(); // packet generator
}
// add a var to control this, and pass this var to OMG
set_component_filelog(OMG);
LOG_I(OMG,"setting OMG file log \n");
}
int olg_config(void)
{
int comp;
int ocg_log_level = map_str_to_int(log_level_names, oai_emulation.emulation_config.log_emu.level);
int ocg_log_verbosity = map_str_to_int(log_verbosity_names, oai_emulation.emulation_config.log_emu.verbosity);
// fix me:
oai_emulation.info.g_log_level = ((oai_emulation.info.ocg_enabled == 1) && (ocg_log_level != -1)) ? ocg_log_level : oai_emulation.info.g_log_level;
oai_emulation.info.g_log_verbosity = (((oai_emulation.info.ocg_enabled == 1) && (ocg_log_verbosity != -1)) ? ocg_log_verbosity :
map_str_to_int(log_verbosity_names, oai_emulation.info.g_log_verbosity_option));
set_glog(oai_emulation.info.g_log_level, oai_emulation.info.g_log_verbosity ); //g_glog
// component, log level, log interval
for (comp = PHY; comp < MAX_LOG_COMPONENTS ; comp++)
set_comp_log(comp,
oai_emulation.info.g_log_level,
oai_emulation.info.g_log_verbosity,
oai_emulation.emulation_config.log_emu.interval);
LOG_I(EMU, "OCG log level %d, oai log level%d \n ",ocg_log_level, oai_emulation.info.g_log_level);
LOG_N(EMU,"global log level is set to (%s,%d) with vebosity (%s, 0x%x) and frequency %d\n",
map_int_to_str (log_level_names, oai_emulation.info.g_log_level),
oai_emulation.info.g_log_level,
map_int_to_str (log_verbosity_names,oai_emulation.info.g_log_verbosity),
oai_emulation.info.g_log_verbosity,
oai_emulation.emulation_config.log_emu.interval );
/*
// if perf eval then reset the otg log level
set_comp_log(PHY, LOG_EMERG, 0x15,1);
set_comp_log(EMU, LOG_EMERG, 0x15,1);
set_comp_log(OCG, LOG_EMERG, 0x15,1);
set_comp_log(OCM, LOG_EMERG, 0x15,1);
set_comp_log(OTG, LOG_EMERG, 0x15,1);
set_comp_log(MAC, LOG_EMERG, 0x15,1);
set_comp_log(OMG, LOG_EMERG, 0x15,1);
set_comp_log(OPT, LOG_EMERG, 0x15,1);
set_comp_log(PDCP, LOG_DEBUG, LOG_MED,1);
set_comp_log(RLC, LOG_DEBUG, LOG_MED,1);
set_comp_log(RRC, LOG_DEBUG, LOG_MED,1);
*/
#if defined(ENABLE_USE_MME)
set_comp_log(UDP_, LOG_DEBUG, LOG_MED,1);
set_comp_log(GTPU, LOG_DEBUG, LOG_MED,1);
set_comp_log(SPGW, LOG_DEBUG, LOG_MED,1);
set_comp_log(S1AP, LOG_DEBUG, LOG_MED,1);
set_comp_log(SCTP, LOG_DEBUG, LOG_MED,1);
#endif
#if ENABLE_RAL
set_comp_log(RAL_ENB, LOG_TRACE, LOG_MED,1);
set_comp_log(RAL_UE, LOG_TRACE, LOG_MED,1);
set_log(RAL_ENB, LOG_DEBUG, 1);
set_log(RAL_UE, LOG_DEBUG, 1);
#endif
//set_log(OCG, LOG_DEBUG, 1);
//set_log(EMU, LOG_INFO, 20);
set_log(MAC, LOG_DEBUG, 1);
set_log(RLC, LOG_TRACE, 1);
//set_log(PHY, LOG_DEBUG, 1);
set_log(PDCP, LOG_TRACE, 1);
set_log(RRC, LOG_DEBUG, 1);
//set_log(OCM, LOG_INFO, 20);
//set_log(OTG, LOG_INFO, 1);
set_comp_log(OCG, LOG_ERR, 0x15,1);
set_comp_log(EMU, LOG_DEBUG, 0x15,20);
set_comp_log(MAC, LOG_TRACE, 0x15,1);
set_comp_log(RLC, LOG_TRACE, 0x15,1);
set_comp_log(PHY, LOG_TRACE, 0x15, 1);
set_comp_log(PDCP, LOG_DEBUG, 0x15,1);
set_comp_log(RRC, LOG_DEBUG, 0x15,1);
set_comp_log(OCM, LOG_DEBUG, 0x15,20);
set_comp_log(OTG, LOG_DEBUG, 0x15,1);
set_comp_log(OMG, LOG_NOTICE, 0x15,1);
set_comp_log(OPT, LOG_ERR, 0x15,1);
// set_comp_log(MAC, LOG_TRACE, LOG_FULL,1);
return 1;
}
int ocg_config_env(void)
{
// int func related to channel desc from oaisim.c could be moved here
int CC_id;
if (oai_emulation.info.ocg_enabled) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
oai_emulation.info.frame_type[CC_id] = map_str_to_int(frame_type_names, oai_emulation.info.frame_type_name[CC_id]);
if (oai_emulation.info.frame_type[CC_id] == -1) {
LOG_E(EMU,"frame type incorrect %s, set it to TDD \n",oai_emulation.info.frame_type_name[CC_id]);
oai_emulation.info.frame_type[CC_id]=TDD;
} else
LOG_I(EMU,"Frame type is %s \n",oai_emulation.info.frame_type_name[CC_id]);
if (oai_emulation.info.frame_type[CC_id] == TDD ) {
if ((oai_emulation.info.tdd_config[CC_id] > 6) || (oai_emulation.info.tdd_config[CC_id] < 0)) {
LOG_E(EMU,"TDD config %d out of range, set it to 3\n",oai_emulation.info.tdd_config[CC_id]);
oai_emulation.info.tdd_config[CC_id]=3;
} else
LOG_I(EMU,"TDD config is set to %d\n",oai_emulation.info.tdd_config[CC_id]);
}
}
}
return 1;
}
int ocg_config_topo(void)
{
int i;
// omg
init_omg_global_params();
// setup params for openair mobility generator
//common params
for(i=0; i < MAX_NUM_NODE_TYPES; i++) {
omg_param_list[i].min_x = 0;
omg_param_list[i].max_x = oai_emulation.topology_config.area.x_m;
omg_param_list[i].min_y = 0;
omg_param_list[i].max_y= oai_emulation.topology_config.area.y_m;
// init values
omg_param_list[i].min_speed = 0.1;
omg_param_list[i].max_speed = 20.0;
omg_param_list[i].min_journey_time = 0.1;
omg_param_list[i].max_journey_time = 10.0;
omg_param_list[i].min_azimuth = 0; // ???
omg_param_list[i].max_azimuth = 360; // ???
omg_param_list[i].min_sleep = 0.1;
omg_param_list[i].max_sleep = 8.0;
omg_param_list[i].nodes_type = i;
omg_param_list[i].nodes=0;
omg_param_list[i].mobility_type=STATIC;
// init OMG for eNBs
if(i==eNB) {
if ((oai_emulation.info.omg_model_enb = map_str_to_int(omg_model_names, oai_emulation.topology_config.mobility.eNB_mobility.eNB_mobility_type.selected_option))== -1)
oai_emulation.info.omg_model_enb = STATIC;
LOG_I(OMG,"eNB mobility model is (%s, %d)\n",
oai_emulation.topology_config.mobility.eNB_mobility.eNB_mobility_type.selected_option,
oai_emulation.info.omg_model_enb);
omg_param_list[i].mobility_type = oai_emulation.info.omg_model_enb;
omg_param_list[i].nodes = oai_emulation.info.nb_enb_local + oai_emulation.info.nb_rn_local;
omg_param_list[i].seed = oai_emulation.info.seed; // specific seed for enb and ue to avoid node overlapping
if (oai_emulation.info.omg_model_enb == TRACE) {
omg_param_list[i].mobility_file = (char*) malloc(256);// user-specific trace file "%s/UTIL/OMG/mobility.txt",getenv("OPENAIR2_DIR")
//memset(oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file,0,256);
//sprintf(omg_param_list.mobility_file,"%s",oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file);
sprintf(omg_param_list[i].mobility_file,"%s/UTIL/OMG/TRACE/%s",
getenv("OPENAIR2_DIR"),
oai_emulation.topology_config.mobility.eNB_mobility.trace_config.trace_mobility_file);
LOG_I(OMG,"TRACE file at %s\n", omg_param_list[i].mobility_file);
// notify the user if the file is not found
}
if (strcmp(oai_emulation.topology_config.mobility.eNB_mobility.eNB_initial_distribution.selected_option, "fixed") == 0) {
omg_param_list[i].user_fixed = true;
omg_param_list[i].fixed_x = (double)oai_emulation.topology_config.mobility.eNB_mobility.fixed_eNB_distribution.pos_x;
omg_param_list[i].fixed_y = (double)oai_emulation.topology_config.mobility.eNB_mobility.fixed_eNB_distribution.pos_y;
}
/*// at this moment, we use the above moving dynamics for mobile eNB
if (omg_param_list.nodes >0 )
init_mobility_generator(omg_param_list);*/
} else if (i== UE) { // init OMG for UE
// input of OMG: STATIC: 0, RWP: 1, RWALK 2, or TRACE 3, or SUMO or STEADY_RWP
if ((oai_emulation.info.omg_model_ue = map_str_to_int(omg_model_names, oai_emulation.topology_config.mobility.UE_mobility.UE_mobility_type.selected_option))== -1)
oai_emulation.info.omg_model_ue = STATIC;
LOG_I(OMG,"UE mobility model is (%s, %d)\n",
oai_emulation.topology_config.mobility.UE_mobility.UE_mobility_type.selected_option,
oai_emulation.info.omg_model_ue);
if (oai_emulation.info.omg_model_ue == RWP) {
oai_emulation.info.omg_rwp_type = map_str_to_int(omg_rwp_names,oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.selected_option);
if (oai_emulation.info.omg_rwp_type == -1) {
LOG_I(OMG,"Apply standard RWP model \n");
} else {
LOG_I(OMG,"Apply %s mobility model (%d) \n", oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.selected_option,
oai_emulation.info.omg_rwp_type);
omg_param_list[i].rwp_type= oai_emulation.info.omg_rwp_type;
omg_param_list[i].max_vertices =
max_vertices_ongrid (omg_param_list[i]);
omg_param_list[i].max_block_num =
max_connecteddomains_ongrid (omg_param_list[i]);
}
}
omg_param_list[i].mobility_type = oai_emulation.info.omg_model_ue;
omg_param_list[i].nodes = oai_emulation.info.nb_ue_local+ oai_emulation.info.nb_rn_local;
omg_param_list[i].seed = oai_emulation.info.seed + oai_emulation.info.nb_ue_local; //fixme: specific seed for enb and ue to avoid node overlapping
omg_param_list[i].min_speed = (oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_speed_mps == 0) ? 0.1 :
oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_speed_mps;
omg_param_list[i].max_speed = (oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_speed_mps == 0) ? 0.1 :
oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_speed_mps;
omg_param_list[i].min_journey_time = (oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_journey_time_ms == 0) ? 0.1 :
oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_journey_time_ms;
omg_param_list[i].max_journey_time = (oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_journey_time_ms == 0) ? 0.1 :
oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_journey_time_ms;
omg_param_list[i].min_azimuth = 0.1; // wait for advanced OSD
omg_param_list[i].max_azimuth = 360;
omg_param_list[i].min_sleep = (oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_sleep_ms == 0) ? 0.1 :
oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_sleep_ms;
omg_param_list[i].max_sleep = (oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_sleep_ms == 0) ? 0.1 :
oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_sleep_ms;
if (oai_emulation.info.omg_model_ue == TRACE) {
omg_param_list[i].mobility_file = (char*) malloc(256);// user-specific trace file "%s/UTIL/OMG/mobility.txt",getenv("OPENAIR2_DIR")
//memset(oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file,0,256);
//sprintf(omg_param_list.mobility_file,"%s",oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file);
snprintf( omg_param_list[i].mobility_file, 256, "%s/UTIL/OMG/TRACE/%s",
getenv("OPENAIR2_DIR"),
oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file);
LOG_I(OMG,"TRACE file at %s\n", omg_param_list[i].mobility_file);
} else if (oai_emulation.info.omg_model_ue == SUMO) {
omg_param_list[i].sumo_command = (char*) malloc(20);
sprintf(omg_param_list[i].sumo_command, "%s", oai_emulation.topology_config.mobility.UE_mobility.sumo_config.command);
omg_param_list[i].sumo_config = (char*) malloc(256);
sprintf(omg_param_list[i].sumo_config, "%s", oai_emulation.topology_config.mobility.UE_mobility.sumo_config.file);
omg_param_list[i].sumo_start = oai_emulation.topology_config.mobility.UE_mobility.sumo_config.start;
if (oai_emulation.topology_config.mobility.UE_mobility.sumo_config.end > 0 )
omg_param_list[i].sumo_end = oai_emulation.topology_config.mobility.UE_mobility.sumo_config.end;
else
omg_param_list[i].sumo_end = (oai_emulation.info.n_frames_flag == 1 ) ? oai_emulation.info.n_frames : MAX_FRAME_NUMBER ; // fixme: the else case is infinity
omg_param_list[i].sumo_step = oai_emulation.topology_config.mobility.UE_mobility.sumo_config.step=1; // 1000ms
omg_param_list[i].sumo_host = (char*) malloc(40);
sprintf(omg_param_list[i].sumo_host,"%s",oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hip);
omg_param_list[i].sumo_port = oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hport ;
LOG_D(OMG, "opt (%s,%d) cmd (%s,%s) config_file (%s,%s) hip (%s,%s) \n",
oai_emulation.topology_config.mobility.UE_mobility.UE_mobility_type.selected_option,oai_emulation.info.omg_model_ue,
omg_param_list[i].sumo_command, oai_emulation.topology_config.mobility.UE_mobility.sumo_config.command,
omg_param_list[i].sumo_config, oai_emulation.topology_config.mobility.UE_mobility.sumo_config.file,
omg_param_list[i].sumo_host, oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hip);
}
}
if (oai_emulation.topology_config.omv == 1 )
oai_emulation.info.omv_enabled = 1;
}//for
init_mobility_generator(omg_param_list);
return 1;
}
int ocg_config_app(void)
{
char colon[] = ":";
char comma[] = ",";
char tmp_source_id[128];
char tmp_destination_id[128];
char *check_format1;
char *check_format2;
char *check_format1_dst;
char *source_id_start = NULL;
char *source_id_end = NULL;
char *destination_id_start;
char *destination_id_end;
int sid_start;
int sid_end;
int did_start;
int did_end;
char *per_source_id;
int source_id_index;
int destination_id_index;
int i,j,k,l;
int predefined_traffic_config_index;
int customized_traffic_config_index;
unsigned int state;
init_all_otg(oai_emulation.info.n_frames);
g_otg->seed= oai_emulation.info.seed;
g_otg->num_nodes = oai_emulation.info.nb_enb_local + oai_emulation.info.nb_ue_local;
g_otg->throughput_metric =map_str_to_int(switch_names,oai_emulation.emulation_config.performance_metrics.throughput);
g_otg->latency_metric =map_str_to_int(switch_names,oai_emulation.emulation_config.performance_metrics.latency);
g_otg->loss_metric =map_str_to_int(switch_names,oai_emulation.emulation_config.performance_metrics.loss_rate);
g_otg->owd_radio_access =map_str_to_int(switch_names,oai_emulation.emulation_config.performance_metrics.owd_radio_access);
g_otg->curve=map_str_to_int(switch_names,oai_emulation.emulation_config.curve);
g_otg->background_stats=map_str_to_int(switch_names,oai_emulation.emulation_config.background_stats);
g_otg->packet_gen_type=map_str_to_int(packet_gen_names,oai_emulation.application_config.packet_gen_type);
LOG_I(OTG,"Metrics: Throuput %s(%d), One-way latency %s(%d) for %s, loss rate %s(%d), online curves %s(%d)\n",
oai_emulation.emulation_config.performance_metrics.throughput,g_otg->throughput_metric,
oai_emulation.emulation_config.performance_metrics.latency,g_otg->latency_metric,
(g_otg->owd_radio_access==1)? "Radio Access Network" : "End to End",
oai_emulation.emulation_config.performance_metrics.loss_rate,g_otg->loss_metric,
oai_emulation.emulation_config.curve,g_otg->curve );
for (i=0; i<g_otg->num_nodes; i++) {
for (j=0; j<g_otg->num_nodes; j++) {
// g_otg->duration[i][j]=oai_emulation.emulation_config.emulation_time_ms;
g_otg->dst_port[i][j]=oai_emulation.application_config.customized_traffic.destination_port[i];
g_otg->dst_ip[i][j]=oai_emulation.application_config.customized_traffic.destination_id[i];
for (k=0; k<MAX_NUM_APPLICATION; k++) {
g_otg->ip_v[i][j][k]=map_str_to_int(otg_ip_version_names, oai_emulation.application_config.customized_traffic.ip_version[i]);
g_otg->trans_proto[i][j][k]=map_str_to_int(otg_transport_protocol_names, oai_emulation.application_config.customized_traffic.transport_protocol[i]);
g_otg->application_type[i][j][k]=map_str_to_int(otg_app_type_names, "no_predefined_traffic");
g_otg->aggregation_level[i][j][k]=oai_emulation.application_config.customized_traffic.aggregation_level[i];
g_otg->flow_start[i][j][k]=flow_start_time(i,j,oai_emulation.info.n_frames,
oai_emulation.application_config.customized_traffic.flow_start[i+j],
oai_emulation.application_config.customized_traffic.flow_duration[i+j]);
g_otg->flow_duration[i][j][k]=oai_emulation.application_config.customized_traffic.flow_duration[i+j];
for (l=0; l<MAX_NUM_TRAFFIC_STATE; l++) {
g_otg->idt_dist[i][j][k][l]=map_str_to_int(otg_distribution_names, "no_customized_traffic");
g_otg->idt_min[i][j][k][l]=oai_emulation.application_config.customized_traffic.idt_min_ms[i];
g_otg->idt_max[i][j][k][l]=oai_emulation.application_config.customized_traffic.idt_max_ms[i];
g_otg->idt_std_dev[i][j][k][l]=oai_emulation.application_config.customized_traffic.idt_standard_deviation[i];
g_otg->idt_lambda[i][j][k][l]=oai_emulation.application_config.customized_traffic.idt_lambda[i];
g_otg->idt_scale[i][j][k][l]=oai_emulation.application_config.customized_traffic.idt_scale[i];
g_otg->idt_shape[i][j][k][l]=oai_emulation.application_config.customized_traffic.idt_shape[i];
g_otg->size_dist[i][j][k][l]=map_str_to_int(otg_distribution_names, "no_customized_traffic");
g_otg->size_min[i][j][k][l]=oai_emulation.application_config.customized_traffic.size_min_byte[i];
g_otg->size_max[i][j][k][l]=oai_emulation.application_config.customized_traffic.size_max_byte[i];
g_otg->size_std_dev[i][j][k][l]=oai_emulation.application_config.customized_traffic.size_standard_deviation[i];
g_otg->size_lambda[i][j][k][l]=oai_emulation.application_config.customized_traffic.size_lambda[i];
g_otg->size_scale[i][j][k][l]=oai_emulation.application_config.customized_traffic.size_scale[i];
g_otg->size_shape[i][j][k][l]=oai_emulation.application_config.customized_traffic.size_shape[i];
}
}
}
}
LOG_D(OTG,"initializing the RNG with %s %d\n",(g_otg->seed==0)?"Random Seed" : "Fixed Seed", g_otg->seed);
init_seeds(g_otg->seed); // initialize all the nodes, then configure the nodes the user specifically did in the XML in the following
LOG_I(OTG,"oai_emulation.info.max_predefined_traffic_config_index = %d\n", oai_emulation.info.max_predefined_traffic_config_index);
LOG_I(OTG,"oai_emulation.info.max_customized_traffic_config_index = %d\n", oai_emulation.info.max_customized_traffic_config_index);
if (oai_emulation.info.ocg_ok) {
///// for the predefined traffic
for (predefined_traffic_config_index = 1;
predefined_traffic_config_index <= oai_emulation.info.max_predefined_traffic_config_index;
predefined_traffic_config_index++) {
LOG_I(OTG,"OCG_config_OTG: predefined no. %d\n", predefined_traffic_config_index);
//strcpy(tmp_source_id, oai_emulation.application_config.predefined_traffic.source_id[predefined_traffic_config_index]);
//strcpy(tmp_destination_id, oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);
strncpy(tmp_source_id, oai_emulation.application_config.predefined_traffic.source_id[predefined_traffic_config_index], sizeof(tmp_source_id));
tmp_source_id[sizeof(tmp_source_id) - 1] = 0; // terminate string
strncpy(tmp_destination_id, oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index], sizeof(tmp_destination_id));
tmp_destination_id[sizeof(tmp_destination_id) - 1] = 0; // terminate string
check_format1 = strstr(tmp_source_id, colon);
check_format2 = strstr(tmp_source_id, comma);
check_format1_dst = strstr(tmp_destination_id, colon);
if (check_format1 != NULL) { // format 1:10
source_id_start = strtok(tmp_source_id, colon);
source_id_end = strtok(NULL, colon);
sid_start = atoi(source_id_start);
sid_end = atoi(source_id_end);
//destination_id_index = atoi(oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);
if (check_format1_dst != NULL) { // format 1:10
destination_id_start = strtok(tmp_destination_id, colon);
destination_id_end = strtok(NULL, colon);
did_start = atoi(destination_id_start);
did_end = atoi(destination_id_end);
} else {
did_start = atoi(oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);
did_end = atoi(oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);
}
for (destination_id_index = did_start; destination_id_index <= did_end; destination_id_index++) {
for (source_id_index = sid_start; source_id_index <= sid_end; source_id_index++) {
if (g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] == 0) { // no app is defined for this pair src.dst
g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_app_type_names,
oai_emulation.application_config.predefined_traffic.application_type[predefined_traffic_config_index]);
g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] =map_str_to_int(switch_names,
oai_emulation.application_config.predefined_traffic.background[predefined_traffic_config_index]);
g_otg->aggregation_level[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.predefined_traffic.aggregation_level[predefined_traffic_config_index];
g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]= flow_start_time(source_id_index,destination_id_index,
oai_emulation.info.n_frames,oai_emulation.application_config.predefined_traffic.flow_start[predefined_traffic_config_index],
oai_emulation.application_config.predefined_traffic.flow_duration[predefined_traffic_config_index]);
g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.predefined_traffic.flow_duration[predefined_traffic_config_index];
LOG_I(OTG,"predef (1):: OCG_config_OTG [MAX UE=%d] [MAX eNB=%d]: FORMAT (%d:%d) source = %d, dest = %d, Application ID = %d background %d, Aggregation=%d , m2m= %d, flow start/duration %d/%d \n",
oai_emulation.info.nb_ue_local, oai_emulation.info.nb_enb_local, sid_start, sid_end, source_id_index, destination_id_index,
g_otg->application_idx[source_id_index][destination_id_index],
g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
g_otg->aggregation_level[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
g_otg->m2m[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]);
g_otg->application_idx[source_id_index][destination_id_index]+=1;
}
}
}
} else if (check_format2 != NULL) { // format 1,2,3,5
per_source_id = strtok(tmp_source_id, comma);
destination_id_index = atoi(oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);
while (per_source_id != NULL) {
source_id_index = atoi(per_source_id);
if (g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] == 0) { // no app is defined for this pair src.dst
g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_app_type_names,
oai_emulation.application_config.predefined_traffic.application_type[predefined_traffic_config_index]);
g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] =map_str_to_int(switch_names,
oai_emulation.application_config.predefined_traffic.background[predefined_traffic_config_index]);
g_otg->aggregation_level[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.predefined_traffic.aggregation_level[predefined_traffic_config_index];
g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=flow_start_time(source_id_index, destination_id_index,
oai_emulation.info.n_frames,oai_emulation.application_config.predefined_traffic.flow_start[predefined_traffic_config_index],
oai_emulation.application_config.predefined_traffic.flow_duration[predefined_traffic_config_index]);
g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.predefined_traffic.flow_duration[predefined_traffic_config_index];
g_otg->application_idx[source_id_index][destination_id_index]+=1;
}
per_source_id = strtok(NULL, comma);
}
} else { // single node configuration
source_id_index = atoi(oai_emulation.application_config.predefined_traffic.source_id[predefined_traffic_config_index]);
//destination_id_index = atoi(oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);
sid_start = atoi(oai_emulation.application_config.predefined_traffic.source_id[predefined_traffic_config_index]);
sid_end = atoi(oai_emulation.application_config.predefined_traffic.source_id[predefined_traffic_config_index]);
if (check_format1_dst != NULL) { // format 1:10
destination_id_start = strtok(tmp_destination_id, colon);
destination_id_end = strtok(NULL, colon);
did_start = atoi(destination_id_start);
did_end = atoi(destination_id_end);
} else {
did_start = atoi(oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);
did_end = atoi(oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);
}
for (destination_id_index = did_start; destination_id_index <= did_end; destination_id_index++) {
for (source_id_index = sid_start; source_id_index <= sid_end; source_id_index++) {
if (g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] == 0) { // no app is defined for this pair src.dst
g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_app_type_names,
oai_emulation.application_config.predefined_traffic.application_type[predefined_traffic_config_index]);
g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] =map_str_to_int(switch_names,
oai_emulation.application_config.predefined_traffic.background[predefined_traffic_config_index]);
g_otg->aggregation_level[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.predefined_traffic.aggregation_level[predefined_traffic_config_index];
g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=flow_start_time(source_id_index,destination_id_index,
oai_emulation.info.n_frames,oai_emulation.application_config.predefined_traffic.flow_start[predefined_traffic_config_index],
oai_emulation.application_config.predefined_traffic.flow_duration[predefined_traffic_config_index]);
g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.predefined_traffic.flow_duration[predefined_traffic_config_index];
LOG_I(OTG,"predef (2):: OCG_config_OTG: [MAX UE=%d] [MAX eNB=%d]: FORMAT (%d:%d) source = %d, dest = %d, Application ID %d, type %d, Background=%d, Aggregation=%d, m2m=%d, start/duration %d/%d\n",
oai_emulation.info.nb_ue_local, oai_emulation.info.nb_enb_local, sid_start, sid_end, source_id_index, destination_id_index,
g_otg->application_idx[source_id_index][destination_id_index],
g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
g_otg->aggregation_level[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
g_otg->m2m[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]);
g_otg->application_idx[source_id_index][destination_id_index]+=1;
}
}
}
}
init_predef_traffic(oai_emulation.info.nb_ue_local, oai_emulation.info.nb_enb_local);
}
///////// for the customized traffic
for (customized_traffic_config_index = 1;
customized_traffic_config_index <= oai_emulation.info.max_customized_traffic_config_index;
customized_traffic_config_index++) {
LOG_I(OTG,"OCG_config_OTG: customized no. %d, max_customized %d \n", customized_traffic_config_index, oai_emulation.info.max_customized_traffic_config_index);
strcpy(tmp_source_id, oai_emulation.application_config.customized_traffic.source_id[customized_traffic_config_index]);
check_format1 = strstr(tmp_source_id, colon);
check_format2 = strstr(tmp_source_id, comma);
strcpy(tmp_destination_id, oai_emulation.application_config.customized_traffic.destination_id[customized_traffic_config_index]);
check_format1_dst = strstr(tmp_destination_id, colon);
state=PE_STATE;
if (check_format1 != NULL) { // format 1:10
source_id_start = strtok(tmp_source_id, colon);
source_id_end = strtok(NULL, colon) ;
sid_start = atoi(source_id_start);
sid_end = atoi(source_id_end);
if (check_format1_dst != NULL) { // format 1:10
destination_id_start = strtok(tmp_destination_id, colon);
destination_id_end = strtok(NULL, colon);
did_start = atoi(destination_id_start);
did_end = atoi(destination_id_end);
} else {
did_start = atoi(oai_emulation.application_config.customized_traffic.destination_id[customized_traffic_config_index]);
did_end = atoi(oai_emulation.application_config.customized_traffic.destination_id[customized_traffic_config_index]);
}
for (destination_id_index = did_start; destination_id_index <= did_end; destination_id_index++) {
for (source_id_index = sid_start; source_id_index <= sid_end; source_id_index++) {
if (g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] == 0) { // no app is defined for this pair src.dst
g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(switch_names,
oai_emulation.application_config.customized_traffic.background[customized_traffic_config_index]);
g_otg->m2m[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] =map_str_to_int(switch_names,
oai_emulation.application_config.customized_traffic.m2m[customized_traffic_config_index]);
g_otg->trans_proto[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_transport_protocol_names,
oai_emulation.application_config.customized_traffic.transport_protocol[customized_traffic_config_index]);
g_otg->ip_v[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_ip_version_names,
oai_emulation.application_config.customized_traffic.ip_version[customized_traffic_config_index]);
g_otg->aggregation_level[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.aggregation_level[customized_traffic_config_index];
g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]= flow_start_time(source_id_index,destination_id_index,
oai_emulation.info.n_frames,oai_emulation.application_config.customized_traffic.flow_start[customized_traffic_config_index],
oai_emulation.application_config.customized_traffic.flow_duration[customized_traffic_config_index]);
g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.flow_duration[customized_traffic_config_index];
g_otg->idt_dist[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] = map_str_to_int(otg_distribution_names,
oai_emulation.application_config.customized_traffic.idt_dist[customized_traffic_config_index]);
// printf("[OTG] config index %d dist %s\n", customized_traffic_config_index,oai_emulation.application_config.customized_traffic.idt_dist[customized_traffic_config_index]);
g_otg->idt_min[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_min_ms[customized_traffic_config_index];
g_otg->idt_max[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_max_ms[customized_traffic_config_index];
g_otg->idt_std_dev[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_standard_deviation[customized_traffic_config_index];
g_otg->idt_lambda[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_lambda[customized_traffic_config_index];
g_otg->idt_scale[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_scale[customized_traffic_config_index];
g_otg->idt_shape[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_shape[customized_traffic_config_index];
g_otg->size_dist[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] = map_str_to_int(otg_distribution_names,
oai_emulation.application_config.customized_traffic.size_dist[customized_traffic_config_index]);
g_otg->size_min[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_min_byte[customized_traffic_config_index];
g_otg->size_max[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_max_byte[customized_traffic_config_index];
g_otg->size_std_dev[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_standard_deviation[customized_traffic_config_index];
g_otg->size_lambda[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_lambda[customized_traffic_config_index];
g_otg->size_scale[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_scale[customized_traffic_config_index];
g_otg->size_shape[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_shape[customized_traffic_config_index];
g_otg->dst_port[source_id_index][destination_id_index] = oai_emulation.application_config.customized_traffic.destination_port[customized_traffic_config_index];
g_otg->pu_size_pkts[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.pu_size_pkts[customized_traffic_config_index];
g_otg->ed_size_pkts[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.ed_size_pkts[customized_traffic_config_index];
g_otg->prob_off_pu[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_off_pu[customized_traffic_config_index];
g_otg->prob_off_ed[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_off_ed[customized_traffic_config_index];
g_otg->prob_off_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_off_pe[customized_traffic_config_index];
g_otg->prob_pu_ed[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_pu_ed[customized_traffic_config_index];
g_otg->prob_pu_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_pu_pe[customized_traffic_config_index];
g_otg->prob_ed_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_ed_pe[customized_traffic_config_index];
g_otg->prob_ed_pu[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_ed_pu[customized_traffic_config_index];
g_otg->holding_time_off_ed[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.holding_time_off_ed[customized_traffic_config_index];
g_otg->holding_time_off_pu[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.holding_time_off_pu[customized_traffic_config_index];
g_otg->holding_time_off_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.holding_time_off_pe[customized_traffic_config_index];
g_otg->holding_time_pe_off[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.holding_time_pe_off[customized_traffic_config_index];
LOG_I(OTG,"customized:: OCG_config_OTG: (1) FORMAT (%d:%d) source = %d, dest = %d, Application = %d, state %d, background %d IDT DIST %d start/duration %d/%d\n", sid_start, sid_end, source_id_index,
destination_id_index,
g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
state,
g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
g_otg->idt_dist[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state],
g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]);
g_otg->application_idx[source_id_index][destination_id_index]+=1;
}
}
}
} else if (check_format2 != NULL) { // format 1,2,3,5
per_source_id = strtok(tmp_source_id, comma);
destination_id_index = atoi(oai_emulation.application_config.customized_traffic.destination_id[customized_traffic_config_index]);
while (per_source_id != NULL) {
source_id_index = atoi(per_source_id);
if (g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] == 0) { // no app is defined for this pair src.dst
g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] =map_str_to_int(switch_names,
oai_emulation.application_config.customized_traffic.background[customized_traffic_config_index]);
g_otg->m2m[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] =map_str_to_int(switch_names,
oai_emulation.application_config.customized_traffic.m2m[customized_traffic_config_index]);
g_otg->trans_proto[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_transport_protocol_names,
oai_emulation.application_config.customized_traffic.transport_protocol[customized_traffic_config_index]);
g_otg->ip_v[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_ip_version_names,
oai_emulation.application_config.customized_traffic.ip_version[customized_traffic_config_index]);
g_otg->aggregation_level[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.aggregation_level[customized_traffic_config_index];
g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=flow_start_time(source_id_index,destination_id_index,
oai_emulation.info.n_frames,oai_emulation.application_config.customized_traffic.flow_start[customized_traffic_config_index],
oai_emulation.application_config.customized_traffic.flow_duration[customized_traffic_config_index]);
g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.flow_duration[customized_traffic_config_index];
g_otg->idt_dist[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] = map_str_to_int(otg_distribution_names,
oai_emulation.application_config.customized_traffic.idt_dist[customized_traffic_config_index]);
g_otg->idt_min[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_min_ms[customized_traffic_config_index];
g_otg->idt_max[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_max_ms[customized_traffic_config_index];
g_otg->idt_std_dev[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_standard_deviation[customized_traffic_config_index];
g_otg->idt_lambda[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_lambda[customized_traffic_config_index];
g_otg->idt_scale[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_scale[customized_traffic_config_index];
g_otg->idt_shape[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_shape[customized_traffic_config_index];
g_otg->size_dist[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] = map_str_to_int(otg_distribution_names,
oai_emulation.application_config.customized_traffic.size_dist[customized_traffic_config_index]);
g_otg->size_min[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_min_byte[customized_traffic_config_index];
g_otg->size_max[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_max_byte[customized_traffic_config_index];
g_otg->size_std_dev[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_standard_deviation[customized_traffic_config_index];
g_otg->size_lambda[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_lambda[customized_traffic_config_index];
g_otg->size_scale[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_scale[customized_traffic_config_index];
g_otg->size_shape[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_shape[customized_traffic_config_index];
g_otg->dst_port[source_id_index][destination_id_index] = oai_emulation.application_config.customized_traffic.destination_port[customized_traffic_config_index];
g_otg->pu_size_pkts[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.pu_size_pkts[customized_traffic_config_index];
g_otg->ed_size_pkts[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.ed_size_pkts[customized_traffic_config_index];
g_otg->prob_off_pu[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_off_pu[customized_traffic_config_index];
g_otg->prob_off_ed[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_off_ed[customized_traffic_config_index];
g_otg->prob_off_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_off_pe[customized_traffic_config_index];
g_otg->prob_pu_ed[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_pu_ed[customized_traffic_config_index];
g_otg->prob_pu_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_pu_pe[customized_traffic_config_index];
g_otg->prob_ed_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_ed_pe[customized_traffic_config_index];
g_otg->prob_ed_pu[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_ed_pu[customized_traffic_config_index];
g_otg->holding_time_off_ed[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.holding_time_off_ed[customized_traffic_config_index];
g_otg->holding_time_off_pu[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.holding_time_off_pu[customized_traffic_config_index];
g_otg->holding_time_off_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.holding_time_off_pe[customized_traffic_config_index];
g_otg->holding_time_pe_off[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.holding_time_pe_off[customized_traffic_config_index];
LOG_I(OTG,"customized:: OCG_config_OTG: (2) FORMAT (%s:%s) source = %d, dest = %d, dist type for size = %d [TODO: check code, printed value may not be correct, checks the indexes of the arry access] start/duration %d/%d\n", source_id_start, source_id_end, source_id_index,
destination_id_index, g_otg->size_dist[source_id_index][destination_id_index][0][0],
g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]);
per_source_id = strtok(NULL, comma);
g_otg->application_idx[source_id_index][destination_id_index]+=1;
}
}
} else { // single node configuration
source_id_index = atoi(oai_emulation.application_config.customized_traffic.source_id[customized_traffic_config_index]);
//destination_id_index = atoi(oai_emulation.application_config.customized_traffic.destination_id[customized_traffic_config_index]);
sid_start = atoi(oai_emulation.application_config.customized_traffic.source_id[customized_traffic_config_index]);
sid_end = atoi(oai_emulation.application_config.customized_traffic.source_id[customized_traffic_config_index]);
if (check_format1_dst != NULL) { // format 1:10
destination_id_start = strtok(tmp_destination_id, colon);
destination_id_end = strtok(NULL, colon);
did_start = atoi(destination_id_start);
did_end = atoi(destination_id_end);
} else {
did_start = atoi(oai_emulation.application_config.customized_traffic.destination_id[customized_traffic_config_index]);
did_end = atoi(oai_emulation.application_config.customized_traffic.destination_id[customized_traffic_config_index]);
}
for (destination_id_index = did_start; destination_id_index <= did_end; destination_id_index++) {
for (source_id_index = sid_start; source_id_index <= sid_end; source_id_index++) {
if (g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] == 0) { // no app is defined for this pair src.dst
g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] =map_str_to_int(switch_names,
oai_emulation.application_config.customized_traffic.background[customized_traffic_config_index]);
g_otg->m2m[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] =map_str_to_int(switch_names,
oai_emulation.application_config.customized_traffic.m2m[customized_traffic_config_index]);
/* LOG_I(OTG, "[src %d][dst %d][app %d]test_m2m %d \n",source_id_index, destination_id_index , g_otg->application_idx[source_id_index][destination_id_index] , g_otg->m2m[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] );
*/
g_otg->trans_proto[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_transport_protocol_names,
oai_emulation.application_config.customized_traffic.transport_protocol[customized_traffic_config_index]);
g_otg->ip_v[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_ip_version_names,
oai_emulation.application_config.customized_traffic.ip_version[customized_traffic_config_index]);
g_otg->aggregation_level[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.aggregation_level[customized_traffic_config_index];
g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=flow_start_time(source_id_index,destination_id_index,
oai_emulation.info.n_frames,oai_emulation.application_config.customized_traffic.flow_start[customized_traffic_config_index],
oai_emulation.application_config.customized_traffic.flow_duration[customized_traffic_config_index]);
g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.flow_duration[customized_traffic_config_index];
g_otg->idt_dist[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] = map_str_to_int(otg_distribution_names,
oai_emulation.application_config.customized_traffic.idt_dist[customized_traffic_config_index]);
g_otg->idt_min[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_min_ms[customized_traffic_config_index];
g_otg->idt_max[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_max_ms[customized_traffic_config_index];
g_otg->idt_std_dev[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_standard_deviation[customized_traffic_config_index];
g_otg->idt_lambda[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_lambda[customized_traffic_config_index];
g_otg->idt_scale[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_scale[customized_traffic_config_index];
g_otg->idt_shape[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.idt_shape[customized_traffic_config_index];
g_otg->size_dist[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] = map_str_to_int(otg_distribution_names,
oai_emulation.application_config.customized_traffic.size_dist[customized_traffic_config_index]);
g_otg->size_min[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_min_byte[customized_traffic_config_index];
g_otg->size_max[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_max_byte[customized_traffic_config_index];
g_otg->size_std_dev[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_standard_deviation[customized_traffic_config_index];
g_otg->size_lambda[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_lambda[customized_traffic_config_index];
g_otg->size_scale[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_scale[customized_traffic_config_index];
g_otg->size_shape[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
oai_emulation.application_config.customized_traffic.size_shape[customized_traffic_config_index];
g_otg->dst_port[source_id_index][destination_id_index] = oai_emulation.application_config.customized_traffic.destination_port[customized_traffic_config_index];
g_otg->pu_size_pkts[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.pu_size_pkts[customized_traffic_config_index];
g_otg->ed_size_pkts[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.ed_size_pkts[customized_traffic_config_index];
g_otg->prob_off_pu[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_off_pu[customized_traffic_config_index];
g_otg->prob_off_ed[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_off_ed[customized_traffic_config_index];
g_otg->prob_off_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_off_pe[customized_traffic_config_index];
g_otg->prob_pu_ed[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_pu_ed[customized_traffic_config_index];
g_otg->prob_pu_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_pu_pe[customized_traffic_config_index];
g_otg->prob_ed_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_ed_pe[customized_traffic_config_index];
g_otg->prob_ed_pu[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.prob_ed_pu[customized_traffic_config_index];
g_otg->holding_time_off_ed[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.holding_time_off_ed[customized_traffic_config_index];
g_otg->holding_time_off_pu[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.holding_time_off_pu[customized_traffic_config_index];
g_otg->holding_time_off_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.holding_time_off_pe[customized_traffic_config_index];
g_otg->holding_time_pe_off[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
oai_emulation.application_config.customized_traffic.holding_time_pe_off[customized_traffic_config_index];
LOG_I(OTG,"OCG_config_OTG (single node config): source = %d, dest = %d\n", source_id_index, destination_id_index);
LOG_I(OTG,"customized:: OCG_config_OTG:(3) FORMAT (%d:%d) source = %d, dest = %d, Application = %d, IDT dist %d flow start %d duration %d \n",
did_start, did_end, source_id_index, destination_id_index,
g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
g_otg->idt_dist[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state],
g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]);
g_otg->application_idx[source_id_index][destination_id_index]+=1;
}
}
}
}
}
}
if ((oai_emulation.info.max_predefined_traffic_config_index == 0) &&
(oai_emulation.info.max_customized_traffic_config_index == 0) &&
(oai_emulation.info.otg_enabled==1)) { // OCG not used to configure OTG, but -T option is used, so config here
LOG_I(OTG,"configure OTG through options %s\n", oai_emulation.info.otg_traffic);
for (i=0; i<g_otg->num_nodes; i++) {
for (j=0; j<g_otg->num_nodes; j++) {
g_otg->application_idx[i][j]=1;
for (k=0; k<g_otg->application_idx[i][j]; k++) {
g_otg->application_type[i][j][k] = map_str_to_int(otg_app_type_names, oai_emulation.info.otg_traffic);
g_otg->background[i][j][k]=oai_emulation.info.otg_bg_traffic_enabled;
g_otg->packet_gen_type=SUBSTRACT_STRING;
g_otg->flow_start[i][j][k]=flow_start_time(i,j,oai_emulation.info.n_frames,
oai_emulation.application_config.customized_traffic.flow_start[i+j],
oai_emulation.application_config.customized_traffic.flow_duration[i+j]);
g_otg->flow_duration[i][j][k]=oai_emulation.application_config.customized_traffic.flow_duration[i+j];
LOG_I(OTG,"predefined traffic:: source = %d, dest = %d, Application = %d, start %d duration %d \n",
i,j, g_otg->application_type[i][j][k],g_otg->flow_start[i][j][k],g_otg->flow_duration[i][j][k]);
}
}
}
init_predef_traffic(oai_emulation.info.nb_ue_local, oai_emulation.info.nb_enb_local);
for (i=0; i<NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX; i++) { //maxServiceCount
for (j=0; j<NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX; j++) { // maxSessionPerPMCH
for (k=0; k<MAX_NUM_APPLICATION; k++) {
g_otg_multicast->application_type[i][j][k] = map_str_to_int( otg_multicast_app_type_names, oai_emulation.info.otg_traffic);
}
}
}
init_predef_multicast_traffic();
LOG_I(OTG,"initilizae multicast traffic %s\n",oai_emulation.info.otg_traffic);
}
return 1;
}
int flow_start_time(int sid, int did, uint32_t n_frames, uint32_t start, uint32_t duration)
{
int offset0=uniform_dist(1,10);
int offset1=uniform_dist(10,100);
int offset2=uniform_dist(100,1000);
int interval = 300;
int flow_start_margin_1=0;
int flow_start_margin_2=0;
// return user-defined flow start time
if (start > 0 )
return start;
//determine the flow start time
start = (sid+did+1)*interval;
flow_start_margin_1 = 10*n_frames - (start + offset1 + duration);
flow_start_margin_2 = 10*n_frames - (start + offset2 + duration);
//LOG_I(OTG,"nframes %d start %d margin_1 %d margin_2 %d\n",n_frames, start,flow_start_margin_1, flow_start_margin_2);
if (flow_start_margin_2 > 0 )
return uniform_dist(start, start+offset2);
else if (flow_start_margin_1 > 0 )
return uniform_dist(start, start+offset1);
else
return uniform_dist(start, start+offset0);
}
int ocg_config_emu(void)
{
if (oai_emulation.emulation_config.emulation_time_ms != 0) {
oai_emulation.info.n_frames = (int) oai_emulation.emulation_config.emulation_time_ms / 10; // configure the number of frame
oai_emulation.info.n_frames_flag = 1;
}
if (oai_emulation.info.n_frames_flag) {
LOG_I(OCG, "number of frames in emulation is set to %d\n", oai_emulation.info.n_frames);
} else {
LOG_I(OCG, "number of frames in emulation is set to infinity\n");
}
oai_emulation.info.seed = (oai_emulation.emulation_config.seed.value == 0) ? oai_emulation.info.seed : oai_emulation.emulation_config.seed.value;
LOG_I (OCG,"The seed value is set to %d \n", oai_emulation.info.seed );
if (oai_emulation.info.cli_enabled == 1) {
if (cli_server_init(cli_server_recv) < 0) {
LOG_E(EMU,"cli server init failed \n");
exit(-1);
}
LOG_I(EMU, "OAI CLI is enabled\n");
LOG_I(EMU,"eNB start state is %d, UE start state %d\n",
oai_emulation.info.cli_start_enb[0],
oai_emulation.info.cli_start_ue[0]);
}
if (oai_emulation.info.opp_enabled)
opp_enabled = 1;
//bin/LOG_I(OCG, "OPT output file directory = %s\n", oai_emulation.info.output_path);
oai_emulation.info.opt_enabled = ( oai_emulation.emulation_config.packet_trace.enabled == 0) ? oai_emulation.info.opt_enabled : oai_emulation.emulation_config.packet_trace.enabled;
if (oai_emulation.info.opt_enabled == 1) {
radio_type_t radio_type;
opt_enabled = 1;
if (oai_emulation.info.frame_type[0] == FDD) {
radio_type = RADIO_TYPE_FDD;
} else {
radio_type = RADIO_TYPE_TDD;
}
opt_type = oai_emulation.info.opt_mode;
if (init_opt(NULL, NULL, NULL, radio_type) == -1) {
LOG_E(OPT,"failed to run OPT \n");
}
}
return 1;
}
void ocg_config_proto(void)
{
LOG_I(MAC,"num groups is set to %d\n",oai_emulation.protocol_config.eNB_mac_config.num_groups);
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file oaisim_config.h
* \brief configure an emulation
* \author navid nikaein & Lusheng Wang
* \date 2006-2010
* \version 4.0
* \company Eurecom
* \email: openair_tech@eurecom.fr
* \note this a note
* \bug this is a bug
* \warning this is a warning
*/
//-----------------------------------begin group-----------------------------
/** @defgroup _oaisim The sturcture of OAISIM
The current sturcture of oaisim is shown by the figure.
\image html new_OCG_structure.png "new_OCG_structure"
* @{*/
/* @}*/
#include "UTIL/LOG/log_if.h"
#include "UTIL/LOG/log_extern.h"
#include "UTIL/OCG/OCG.h"
#include "UTIL/OPT/opt.h" // to test OPT
#include "UTIL/OMG/omg.h"
#include "UTIL/CLI/cli_if.h"
#include "PHY/defs_eNB.h"
#include "PHY/phy_extern.h"
/** @defgroup _init_oai Initial oaisim
* @ingroup _fn
* @brief Initialize all the parameters before start an emulation
* @{*/
void init_oai_emulation(void);
/* @}*/
/** @defgroup _config_oaisim All the configurations for an emulation
* @ingroup _fn
* @brief This is the function that calls all the other configuration functions
* @{*/
void oaisim_config(void);
/* @}*/
/** @defgroup _config_module Configuration functions for various modules
* @ingroup _fn
* @brief There are the functions to configure different various modules in the emulator
* @{*/
int olg_config(void);
int ocg_config_env(void);
int ocg_config_omg(void);
int ocg_config_topo(void);
int ocg_config_app(void);
int ocg_config_emu(void);
int flow_start_time(int sid, int did, uint32_t n_frames, uint32_t start, uint32_t duration);
/* @}*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file oaisim_functions.c
* \brief function primitives of oaisim
* \author Navid Nikaein
* \date 2013-2015
* \version 1.0
* \company Eurecom
* \email: openair_tech@eurecom.fr
* \note
* \warning
*/
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <execinfo.h>
#include <time.h>
#include <mcheck.h>
#include <sys/timerfd.h>
#include "assertions.h"
#include "oaisim_functions.h"
#include "PHY/phy_extern.h"
#include "PHY/phy_extern_ue.h"
#include "LAYER2/MAC/mac_extern.h"
#include "LAYER2/MAC/mac_proto.h"
#include "LAYER2/PDCP_v10.1.0/pdcp.h"
#include "LAYER2/PDCP_v10.1.0/pdcp_primitives.h"
#include "RRC/LTE/rrc_extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "PHY_INTERFACE/phy_interface_extern.h"
//#include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h"
#include "SIMULATION/ETH_TRANSPORT/proto.h"
#include "UTIL/OCG/OCG_extern.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#include "UTIL/OTG/otg_config.h"
#include "UTIL/OTG/otg_tx.h"
#include "cor_SF_sim.h"
#include "enb_config.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
#if defined(ENABLE_USE_MME)
# include "s1ap_eNB.h"
#endif
#include "../../ARCH/COMMON/common_lib.h"
#include "../../ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
#include "ENB_APP/enb_paramdef.h"
#include "common/config/config_userapi.h"
//constant for OAISIM soft realtime calibration
#define SF_DEVIATION_OFFSET_NS 100000 //= 0.1ms : should be as a number of UE
#define SLEEP_STEP_US 100 // = 0.01ms could be adaptive, should be as a number of UE
#define K 2 // averaging coefficient
#define TARGET_SF_TIME_NS 1000000 // 1ms = 1000000 ns
int otg_times = 0;
int if_times = 0;
int for_times = 0;
uint16_t Nid_cell = 0; //needed by init_lte_vars
int nb_antennas_rx_ue = 1; // //
uint8_t target_dl_mcs = 16; // max mcs used by MAC scheduler
uint8_t rate_adaptation_flag = 0;
uint8_t set_snr = 0;
uint8_t set_sinr = 0;
double snr_dB=0, sinr_dB=0;
uint8_t set_seed = 0;
uint8_t cooperation_flag; // for cooperative communication
uint8_t abstraction_flag = 0;
uint8_t ethernet_flag = 0;
double snr_step = 1.0;
uint8_t ue_connection_test = 0;
double forgetting_factor = 0.0;
uint8_t beta_ACK = 0;
uint8_t beta_RI = 0;
uint8_t beta_CQI = 2;
uint8_t target_ul_mcs = 16;
//LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
int map1,map2;
double **ShaF = NULL;
// pointers signal buffers (s = transmit, r,r0 = receive)
double **s_re, **s_im, **r_re, **r_im, **r_re0, **r_im0;
node_list* ue_node_list = NULL;
node_list* enb_node_list = NULL;
int omg_period = 10000;
int pdcp_period = 0;
int cba_backoff = 30;
// time calibration for soft realtime mode
struct timespec time_spec;
unsigned long time_last = 0;
unsigned long time_now = 0;
int td = 0;
int td_avg = 0;
int sleep_time_us = 0;
int phy_test = 0;
extern node_desc_t *enb_data[NUMBER_OF_RU_MAX];
extern node_desc_t *ue_data[MAX_MOBILES_PER_ENB];
extern channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][MAX_MOBILES_PER_ENB][MAX_NUM_CCs];
extern channel_desc_t *UE2RU[MAX_MOBILES_PER_ENB][NUMBER_OF_RU_MAX][MAX_NUM_CCs];
extern mapping small_scale_names[];
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
extern pdcp_mbms_t pdcp_mbms_array_ue[MAX_MOBILES_PER_ENB][maxServiceCount][maxSessionPerPMCH];
extern pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH];
#endif
extern time_stats_t dl_chan_stats;
extern time_stats_t ul_chan_stats;
extern int xforms;
extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
int oaisim_flag=1;
void RCConfig_sim(void) {
paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
// Get num RU instances
config_getlist( &RUParamList,NULL,0, NULL);
RC.nb_RU = RUParamList.numelt;
}
void get_simulation_options(int argc, char *argv[])
{
int option;
enum long_option_e {
LONG_OPTION_START = 0x100, /* Start after regular single char options */
LONG_OPTION_ENB_CONF,
LONG_OPTION_PDNC_PERIOD,
LONG_OPTION_OMG_PERIOD,
LONG_OPTION_OEH_ENABLED,
LONG_OPTION_ENB_RAL_LISTENING_PORT,
LONG_OPTION_ENB_RAL_IP_ADDRESS,
LONG_OPTION_ENB_RAL_LINK_ID,
LONG_OPTION_ENB_RAL_LINK_ADDRESS,
LONG_OPTION_ENB_MIHF_REMOTE_PORT,
LONG_OPTION_ENB_MIHF_IP_ADDRESS,
LONG_OPTION_ENB_MIHF_ID,
LONG_OPTION_UE_RAL_LISTENING_PORT,
LONG_OPTION_UE_RAL_IP_ADDRESS,
LONG_OPTION_UE_RAL_LINK_ID,
LONG_OPTION_UE_RAL_LINK_ADDRESS,
LONG_OPTION_UE_MIHF_REMOTE_PORT,
LONG_OPTION_UE_MIHF_IP_ADDRESS,
LONG_OPTION_UE_MIHF_ID,
LONG_OPTION_MALLOC_TRACE_ENABLED,
LONG_OPTION_CBA_BACKOFF_TIMER,
LONG_OPTION_PHYTEST,
LONG_OPTION_XFORMS,
#if T_TRACER
LONG_OPTION_T_PORT,
LONG_OPTION_T_NOWAIT,
LONG_OPTION_T_DONT_FORK,
#endif
};
static struct option long_options[] = {
{"enb-conf", required_argument, 0, LONG_OPTION_ENB_CONF},
{"pdcp-period", required_argument, 0, LONG_OPTION_PDNC_PERIOD},
{"omg-period", required_argument, 0, LONG_OPTION_OMG_PERIOD},
{"oeh-enabled", no_argument, 0, LONG_OPTION_OEH_ENABLED},
{"enb-ral-listening-port", required_argument, 0, LONG_OPTION_ENB_RAL_LISTENING_PORT},
{"enb-ral-ip-address", required_argument, 0, LONG_OPTION_ENB_RAL_IP_ADDRESS},
{"enb-ral-link-id", required_argument, 0, LONG_OPTION_ENB_RAL_LINK_ID},
{"enb-ral-link-address", required_argument, 0, LONG_OPTION_ENB_RAL_LINK_ADDRESS},
{"enb-mihf-remote-port", required_argument, 0, LONG_OPTION_ENB_MIHF_REMOTE_PORT},
{"enb-mihf-ip-address", required_argument, 0, LONG_OPTION_ENB_MIHF_IP_ADDRESS},
{"enb-mihf-id", required_argument, 0, LONG_OPTION_ENB_MIHF_ID},
{"ue-ral-listening-port", required_argument, 0, LONG_OPTION_UE_RAL_LISTENING_PORT},
{"ue-ral-ip-address", required_argument, 0, LONG_OPTION_UE_RAL_IP_ADDRESS},
{"ue-ral-link-id", required_argument, 0, LONG_OPTION_UE_RAL_LINK_ID},
{"ue-ral-link-address", required_argument, 0, LONG_OPTION_UE_RAL_LINK_ADDRESS},
{"ue-mihf-remote-port", required_argument, 0, LONG_OPTION_UE_MIHF_REMOTE_PORT},
{"ue-mihf-ip-address", required_argument, 0, LONG_OPTION_UE_MIHF_IP_ADDRESS},
{"ue-mihf-id", required_argument, 0, LONG_OPTION_UE_MIHF_ID},
{"malloc-trace-enabled", no_argument, 0, LONG_OPTION_MALLOC_TRACE_ENABLED},
{"cba-backoff", required_argument, 0, LONG_OPTION_CBA_BACKOFF_TIMER},
{"phy-test", no_argument, NULL, LONG_OPTION_PHYTEST},
{"xforms", no_argument, 0, LONG_OPTION_XFORMS},
#if T_TRACER
{"T_port", required_argument, 0, LONG_OPTION_T_PORT},
{"T_nowait", no_argument, 0, LONG_OPTION_T_NOWAIT},
{"T_dont_fork", no_argument, 0, LONG_OPTION_T_DONT_FORK},
#endif
{NULL, 0, NULL, 0}
};
while ((option = getopt_long (argc, argv, "aA:b:B:c:C:D:d:eE:f:FGg:hHi:IJ:j:k:K:l:L:m:M:n:N:oO:p:P:qQ:rR:s:S:t:T:u:U:vV:w:W:x:X:y:Y:z:Z:", long_options, NULL)) != -1) {
switch (option) {
case LONG_OPTION_PHYTEST:
phy_test = 1;
break;
case LONG_OPTION_ENB_CONF:
if (optarg) {
free(RC.config_file_name); // prevent memory leak if option is used multiple times
RC.config_file_name = strdup(optarg);
printf("eNB configuration file is %s\n", RC.config_file_name);
}
break;
case LONG_OPTION_PDNC_PERIOD:
if (optarg) {
pdcp_period = atoi(optarg);
printf("PDCP period is %d\n", pdcp_period);
}
break;
case LONG_OPTION_OMG_PERIOD:
if (optarg) {
omg_period = atoi(optarg);
printf("OMG period is %d\n", omg_period);
}
break;
case LONG_OPTION_OEH_ENABLED:
oai_emulation.info.oeh_enabled = 1;
break;
case LONG_OPTION_MALLOC_TRACE_ENABLED:
mtrace();
break;
case LONG_OPTION_CBA_BACKOFF_TIMER:
oai_emulation.info.cba_backoff=atoi(optarg);
cba_backoff=atoi(optarg);
printf("setting CBA backoff to %d\n", cba_backoff);
break;
#if ENABLE_RAL
case LONG_OPTION_ENB_RAL_LISTENING_PORT:
if (optarg) {
g_conf_enb_ral_listening_port = strdup(optarg);
printf("eNB RAL listening port is %s\n", g_conf_enb_ral_listening_port);
}
break;
case LONG_OPTION_ENB_RAL_IP_ADDRESS:
if (optarg) {
g_conf_enb_ral_ip_address = strdup(optarg);
printf("eNB RAL IP address is %s\n", g_conf_enb_ral_ip_address);
}
break;
case LONG_OPTION_ENB_RAL_LINK_ADDRESS:
if (optarg) {
g_conf_enb_ral_link_address = strdup(optarg);
printf("eNB RAL link address is %s\n", g_conf_enb_ral_link_address);
}
break;
case LONG_OPTION_ENB_RAL_LINK_ID:
if (optarg) {
g_conf_enb_ral_link_id = strdup(optarg);
printf("eNB RAL link id is %s\n", g_conf_enb_ral_link_id);
}
break;
case LONG_OPTION_ENB_MIHF_REMOTE_PORT:
if (optarg) {
g_conf_enb_mihf_remote_port = strdup(optarg);
printf("eNB MIH-F remote port is %s\n", g_conf_enb_mihf_remote_port);
}
break;
case LONG_OPTION_ENB_MIHF_IP_ADDRESS:
if (optarg) {
g_conf_enb_mihf_ip_address = strdup(optarg);
printf("eNB MIH-F IP address is %s\n", g_conf_enb_mihf_ip_address);
}
break;
case LONG_OPTION_ENB_MIHF_ID:
if (optarg) {
g_conf_enb_mihf_id = strdup(optarg);
printf("eNB MIH-F id is %s\n", g_conf_enb_mihf_id);
}
break;
case LONG_OPTION_UE_RAL_LISTENING_PORT:
if (optarg) {
g_conf_ue_ral_listening_port = strdup(optarg);
printf("UE RAL listening port is %s\n", g_conf_ue_ral_listening_port);
}
break;
case LONG_OPTION_UE_RAL_IP_ADDRESS:
if (optarg) {
g_conf_ue_ral_ip_address = strdup(optarg);
printf("UE RAL IP address is %s\n", g_conf_ue_ral_ip_address);
}
break;
case LONG_OPTION_UE_RAL_LINK_ID:
if (optarg) {
g_conf_ue_ral_link_id = strdup(optarg);
printf("UE RAL link id is %s\n", g_conf_ue_ral_link_id);
}
break;
case LONG_OPTION_UE_RAL_LINK_ADDRESS:
if (optarg) {
g_conf_ue_ral_link_address = strdup(optarg);
printf("UE RAL link address is %s\n", g_conf_ue_ral_link_address);
}
break;
case LONG_OPTION_UE_MIHF_REMOTE_PORT:
if (optarg) {
g_conf_ue_mihf_remote_port = strdup(optarg);
printf("UE MIH-F remote port is %s\n", g_conf_ue_mihf_remote_port);
}
break;
case LONG_OPTION_UE_MIHF_IP_ADDRESS:
if (optarg) {
g_conf_ue_mihf_ip_address = strdup(optarg);
printf("UE MIH-F IP address is %s\n", g_conf_ue_mihf_ip_address);
}
break;
case LONG_OPTION_UE_MIHF_ID:
if (optarg) {
g_conf_ue_mihf_id = strdup(optarg);
printf("UE MIH-F id is %s\n", g_conf_ue_mihf_id);
}
break;
#endif
case LONG_OPTION_XFORMS:
xforms=1;
break;
#if T_TRACER
case LONG_OPTION_T_PORT: {
extern int T_port;
if (optarg == NULL) abort(); /* should not happen */
T_port = atoi(optarg);
break;
}
case LONG_OPTION_T_NOWAIT: {
extern int T_wait;
T_wait = 0;
break;
}
case LONG_OPTION_T_DONT_FORK: {
extern int T_dont_fork;
T_dont_fork = 1;
break;
}
#endif
case 'a':
abstraction_flag = 1;
printf("FATAL: -a flag not functional for the moment.\nWe are working on fixing the abstraction mode.\n");
exit(1);
break;
case 'A':
//oai_emulation.info.ocm_enabled=1;
if (optarg == NULL)
oai_emulation.environment_system_config.fading.small_scale.selected_option="AWGN";
else
oai_emulation.environment_system_config.fading.small_scale.selected_option= optarg;
//awgn_flag = 1;
break;
case 'b':
oai_emulation.info.nb_enb_local = atoi (optarg);
break;
case 'B':
oai_emulation.topology_config.mobility.eNB_mobility.eNB_mobility_type.selected_option = optarg;
//oai_emulation.info.omg_model_enb = atoi (optarg);
break;
case 'c':
//strcpy(oai_emulation.info.local_server, optarg);
strncpy(oai_emulation.info.local_server, optarg, sizeof(oai_emulation.info.local_server));
oai_emulation.info.local_server[sizeof(oai_emulation.info.local_server) - 1] = 0; // terminate string
oai_emulation.info.ocg_enabled=1;
break;
case 'C':
oai_emulation.info.tdd_config[0] = atoi (optarg);
AssertFatal (oai_emulation.info.tdd_config[0] <= TDD_Config__subframeAssignment_sa6, "Illegal tdd_config %d (should be 0-%d)!",
oai_emulation.info.tdd_config[0], TDD_Config__subframeAssignment_sa6);
break;
case 'D':
oai_emulation.info.multicast_ifname = strdup(optarg);
break;
case 'e':
oai_emulation.info.extended_prefix_flag[0] = 1;
break;
case 'E':
set_seed = 1;
oai_emulation.info.seed = atoi (optarg);
break;
case 'f':
forgetting_factor = atof (optarg);
break;
case 'F': // set FDD
printf("Setting Frame to FDD\n");
oai_emulation.info.frame_type[0] = 0;
oai_emulation.info.frame_type_name[0] = "FDD";
break;
case 'g':
oai_emulation.info.multicast_group = atoi (optarg);
break;
case 'G' :
oai_emulation.info.otg_bg_traffic_enabled = 1;
break;
case 'h':
help ();
exit (1);
break;
case 'H':
oai_emulation.info.handover_active=1;
printf("Activate the handover procedure at RRC\n");
break;
case 'i':
#ifdef PROC
Process_Flag=1;
node_id = wgt+atoi(optarg);
port+=atoi(optarg);
#endif
break;
case 'I':
oai_emulation.info.cli_enabled = 1;
break;
case 'j' :
// number of relay nodes: currently only applicable to eMBMS
oai_emulation.info.nb_rn_local = atoi (optarg);
break;
case 'J':
ue_connection_test=1;
oai_emulation.info.ocm_enabled=0;
snr_step = atof(optarg);
break;
case 'k':
//ricean_factor = atof (optarg);
printf("[SIM] Option k is no longer supported on the command line. Please specify your channel model in the xml template\n");
exit(-1);
break;
case 'K':
oai_emulation.info.itti_dump_file = optarg;
break;
case 'l':
oai_emulation.info.g_log_level = atoi(optarg);
break;
case 'L': // set FDD
flag_LA = atoi(optarg);
break;
case 'm':
target_dl_mcs = atoi (optarg);
printf("Max target downlink MCS used by MAC scheduler is set to %d\n", target_dl_mcs);
break;
case 'M':
abstraction_flag = 1;
ethernet_flag = 1;
oai_emulation.info.ethernet_id = atoi (optarg);
oai_emulation.info.master_id = oai_emulation.info.ethernet_id;
oai_emulation.info.ethernet_flag = 1;
break;
case 'n':
oai_emulation.info.n_frames = atoi (optarg);
oai_emulation.emulation_config.emulation_time_ms= oai_emulation.info.n_frames * 10; // 10 ms frame
//n_frames = (n_frames >1024) ? 1024: n_frames; // adjust the n_frames if higher that 1024
oai_emulation.info.n_frames_flag = 1;
break;
case 'N':
Nid_cell = atoi (optarg);
if (Nid_cell > 503) {
printf("Illegal Nid_cell %d (should be 0 ... 503)\n", Nid_cell);
exit(-1);
}
break;
case 'O':
if (optarg) {
free(RC.config_file_name); // prevent memory leak if option is used multiple times
RC.config_file_name = strdup(optarg);
}
break;
case 'o':
oai_emulation.info.slot_isr = 1;
break;
case 'p':
oai_emulation.info.nb_master = atoi (optarg);
break;
case 'P':
oai_emulation.info.opt_enabled = 1;
opt_enabled = 1;
if (strcmp(optarg, "wireshark") == 0) {
opt_type = OPT_WIRESHARK;
printf("Enabling OPT for wireshark\n");
} else if (strcmp(optarg, "pcap") == 0) {
opt_type = OPT_PCAP;
printf("Enabling OPT for pcap\n");
} else {
printf("Unrecognized option for OPT module. -> Disabling it\n");
printf("Possible values are either wireshark or pcap\n");
opt_type = OPT_NONE;
oai_emulation.info.opt_enabled = 0;
opt_enabled = 0;
}
oai_emulation.info.opt_mode = opt_type;
break;
case 'q':
// openair performane profiler
oai_emulation.info.opp_enabled = 1; // this var is used for OCG
opp_enabled = 1; // this is the global var used by oaisim
break;
case 'Q':
//eMBMS_active=1;
// 0 : not used (default), 1: eMBMS and RRC enabled, 2: eMBMS relaying and RRC enabled, 3: eMBMS enabled, RRC disabled, 4: eMBMS relaying enabled, RRC disabled
oai_emulation.info.eMBMS_active_state = atoi (optarg);
break;
case 'r':
rate_adaptation_flag = 1;
break;
case 'R':
oai_emulation.info.N_RB_DL[0] = atoi (optarg);
if ((oai_emulation.info.N_RB_DL[0] != 6) && (oai_emulation.info.N_RB_DL[0] != 15) && (oai_emulation.info.N_RB_DL[0] != 25)
&& (oai_emulation.info.N_RB_DL[0] != 50) && (oai_emulation.info.N_RB_DL[0] != 75) && (oai_emulation.info.N_RB_DL[0] != 100)) {
printf("Illegal N_RB_DL %d (should be one of 6,15,25,50,75,100)\n", oai_emulation.info.N_RB_DL[0]);
exit (-1);
}
break;
case 's':
snr_dB = atoi (optarg);
// set_snr = 1;
oai_emulation.info.ocm_enabled=0;
break;
case 'S':
sinr_dB = atoi (optarg);
set_sinr = 1;
oai_emulation.info.ocm_enabled=0;
break;
case 't':
target_ul_mcs = atoi (optarg);
printf("Max target uplink MCS used by MAC scheduler is set to %d\n", target_ul_mcs);
break;
case 'T':
oai_emulation.info.otg_enabled = 1;
oai_emulation.info.otg_traffic = optarg;
break;
case 'u':
NB_UE_INST = atoi (optarg);
break;
case 'U':
oai_emulation.topology_config.mobility.UE_mobility.UE_mobility_type.selected_option = optarg;
break;
case 'v':
oai_emulation.info.omv_enabled = 1;
break;
case 'V':
ouput_vcd = 1;
oai_emulation.info.vcd_enabled = 1;
oai_emulation.info.vcd_file = optarg;
break;
case 'w':
oai_emulation.info.cba_group_active = atoi (optarg);
break;
case 'W':
#ifdef SMBV
config_smbv = 1;
if(atoi(optarg)!=0)
strcpy(smbv_ip,optarg);
#endif
break;
case 'x':
/*
oai_emulation.info.transmission_mode[0] = atoi (optarg);
if ((oai_emulation.info.transmission_mode[0] != 1) && (oai_emulation.info.transmission_mode[0] != 2) &&
(oai_emulation.info.transmission_mode[0] != 3) && (oai_emulation.info.transmission_mode[0] != 4) &&
(oai_emulation.info.transmission_mode[0] != 5) && (oai_emulation.info.transmission_mode[0] != 6)) && (oai_emulation.info.transmission_mode[0] !=7)) {
printf("Unsupported transmission mode %d\n",oai_emulation.info.transmission_mode[0]);
exit(-1);
}
*/
printf("Option -x deprecated. Please set transmission mode in eNB config file\n");
exit(-1);
break;
case 'X':
#ifdef PROC
temp=atoi(optarg);
if(temp==0) {
port=CHANNEL_PORT;
Channel_Flag=1;
Process_Flag=0;
wgt=0;
} else if(temp==1) {
port=eNB_PORT;
wgt=0;
} else {
port=UE_PORT;
wgt=MAX_eNB;
}
#endif
break;
case 'y':
nb_antennas_rx_ue=atoi(optarg);
if (nb_antennas_rx_ue>4) {
printf("Cannot have more than 4 antennas\n");
exit(-1);
}
break;
case 'Y':
oai_emulation.info.g_log_verbosity_option = strdup(optarg);
break;
case 'z':
cooperation_flag = atoi (optarg);
break;
case 'Z':
/* Sebastien ROUX: Reserved for future use (currently used in ltenow branch) */
break;
default:
help ();
exit (-1);
break;
}
}
if ( load_configmodule(argc,argv) == NULL) {
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
}
if (RC.config_file_name != NULL) {
/* Read eNB configuration file */
RCConfig_sim();
printf("returned with %d eNBs, %d rus\n",RC.nb_inst,RC.nb_RU);
oai_emulation.info.nb_enb_local = RC.nb_inst;
oai_emulation.info.nb_ru_local = RC.nb_RU;
/*
for (int j=0; j<enb_properties->nb_ru; j++) {
// local_remote_radio = BBU_REMOTE_RADIO_HEAD;
(eth_params+j)->local_if_name = enb_properties->ru_config[j]->ru_if_name;
(eth_params+j)->my_addr = enb_properties->ru_config[j]->local_address;
(eth_params+j)->my_port = enb_properties->ru_config[j]->local_port;
(eth_params+j)->remote_addr = enb_properties->ru_config[j]->remote_address;
(eth_params+j)->remote_port = enb_properties->ru_config[j]->remote_port;
if (enb_properties->ru_config[j]->raw == 1) {
(eth_params+j)->transp_preference = ETH_RAW_MODE;
ru_if_in[j] = REMOTE_IF5;
node_function[j] = NGFI_RRU_IF5;
} else if (enb_properties->ru_config[j]->rawif4p5 == 1) {
(eth_params+j)->transp_preference = ETH_RAW_IF4p5_MODE;
ru_if_in[j] = REMOTE_IF4p5;
node_function[j] = NGFI_RRU_IF4p5;
} else if (enb_properties->ru_config[j]->udpif4p5 == 1) {
(eth_params+j)->transp_preference = ETH_UDP_IF4p5_MODE;
ru_if_in[j] = REMOTE_IF4p5;
node_function[j] = NGFI_RRU_IF4p5;
} else if (enb_properties->ru_config[j]->rawif5_mobipass == 1) {
(eth_params+j)->transp_preference = ETH_RAW_IF5_MOBIPASS;
ru_if_in[j] = REMOTE_IF5;
LOG_E(EMU,"Don't use 8-bit IF5 format with oaisim, please change in configuration file\n");
} else {
(eth_params+j)->transp_preference = ETH_UDP_MODE;
ru_if_in[j] = REMOTE_IF5;
node_function[j] = NGFI_RRU_IF5;
}
node_timing[j] = synch_to_ext_device;
if (enb_properties->number > 0) {
//Update some simulation parameters
oai_emulation.info.frame_type[0] = enb_properties->properties[0]->frame_type[0];
oai_emulation.info.tdd_config[0] = enb_properties->properties[0]->tdd_config[0];
oai_emulation.info.tdd_config_S[0] = enb_properties->properties[0]->tdd_config_s[0];
oai_emulation.info.extended_prefix_flag[0] = enb_properties->properties[0]->prefix_type[0];
oai_emulation.info.node_function[0] = enb_properties->properties[0]->cc_node_function[0];
oai_emulation.info.node_timing[0] = enb_properties->properties[0]->cc_node_timing[0];
downlink_frequency[0][0] = enb_properties->properties[0]->downlink_frequency[0];
uplink_frequency_offset[0][0] = enb_properties->properties[0]->uplink_frequency_offset[0];
oai_emulation.info.N_RB_DL[0] = enb_properties->properties[0]->N_RB_DL[0];
LOG_E(EMU,"Please use only RRU with oaisim, remove eNB descriptors in configuration file\n");
exit(-1);
}
}*/
}
else {
printf("Please provide a configuration file\n");
exit(-1);
}
}
void check_and_adjust_params(void)
{
int32_t ret;
//int i,j;
if (oai_emulation.info.nb_ue_local + oai_emulation.info.nb_rn_local > MAX_MOBILES_PER_ENB) {
LOG_E(EMU,"Enter fewer than %d UEs/RNs for the moment or change the MAX_MOBILES_PER_ENB\n", MAX_MOBILES_PER_ENB);
exit(EXIT_FAILURE);
}
if (oai_emulation.info.nb_enb_local + oai_emulation.info.nb_rn_local > NUMBER_OF_eNB_MAX) {
LOG_E(EMU,"Enter fewer than %d eNBs/RNs for the moment or change the MAX_MOBILES_PER_ENB\n", NUMBER_OF_eNB_MAX);
exit(EXIT_FAILURE);
}
if (oai_emulation.info.nb_rn_local > NUMBER_OF_RN_MAX) {
LOG_E(EMU,"Enter fewer than %d RNs for the moment or change the NUMBER_OF_RN_MAX\n", NUMBER_OF_RN_MAX);
exit(EXIT_FAILURE);
}
// fix ethernet and abstraction with RRC_CELLULAR Flag
#ifdef RRC_CELLULAR
abstraction_flag = 1;
ethernet_flag = 1;
#endif
if (set_sinr == 0)
sinr_dB = snr_dB - 20;
// setup netdevice interface (netlink socket)
LOG_I(EMU,"[INIT] Starting NAS netlink interface\n");
ret = netlink_init();
if (ret < 0)
LOG_W(EMU,"[INIT] Netlink not available, careful ...\n");
/*
if (ethernet_flag == 1) {
oai_emulation.info.master[oai_emulation.info.master_id].nb_ue = oai_emulation.info.nb_ue_local + oai_emulation.info.nb_rn_local;
oai_emulation.info.master[oai_emulation.info.master_id].nb_enb = oai_emulation.info.nb_enb_local + oai_emulation.info.nb_rn_local;
if (oai_emulation.info.nb_rn_local>0)
LOG_N(EMU,"Ethernet emulation is not yet tested with the relay nodes\n");
if (!oai_emulation.info.master_id)
oai_emulation.info.is_primary_master = 1;
j = 1;
for (i = 0; i < oai_emulation.info.nb_master; i++) {
if (i != oai_emulation.info.master_id)
oai_emulation.info.master_list = oai_emulation.info.master_list + j;
LOG_I (EMU, "Index of master id i=%d MASTER_LIST %d\n", i, oai_emulation.info.master_list);
j *= 2;
}
LOG_I (EMU, " Total number of master %d my master id %d\n", oai_emulation.info.nb_master, oai_emulation.info.master_id);
// init_bypass ();
while (emu_tx_status != SYNCED_TRANSPORT) {
LOG_I (EMU, " Waiting for EMU Transport to be synced\n");
emu_transport_sync (); //emulation_tx_rx();
}
} // ethernet flag
*/
//
NB_RU = RC.nb_RU;
#if defined(PDCP_USE_NETLINK_QUEUES) && defined(OPENAIR2)
pdcp_netlink_init();
#endif
}
void init_seed(uint8_t set_seed)
{
if(set_seed) {
randominit (oai_emulation.info.seed);
set_taus_seed (oai_emulation.info.seed);
} else {
randominit (0);
set_taus_seed (0);
}
}
openair0_timestamp current_ru_rx_timestamp[NUMBER_OF_RU_MAX][MAX_NUM_CCs];
openair0_timestamp current_UE_rx_timestamp[MAX_MOBILES_PER_ENB][MAX_NUM_CCs];
openair0_timestamp last_ru_rx_timestamp[NUMBER_OF_RU_MAX][MAX_NUM_CCs];
openair0_timestamp last_UE_rx_timestamp[MAX_MOBILES_PER_ENB][MAX_NUM_CCs];
int ru_trx_start(openair0_device *device) {
return(0);
}
void ru_trx_end(openair0_device *device) {
return;
}
int ru_trx_stop(openair0_device *device) {
return(0);
}
int UE_trx_start(openair0_device *device) {
return(0);
}
void UE_trx_end(openair0_device *device) {
return;
}
int UE_trx_stop(openair0_device *device) {
return(0);
}
int ru_trx_set_freq(openair0_device *device, openair0_config_t *openair0_cfg, int dummy) {
return(0);
}
int ru_trx_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) {
return(0);
}
int UE_trx_set_freq(openair0_device *device, openair0_config_t *openair0_cfg, int dummy) {
return(0);
}
int UE_trx_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) {
return(0);
}
extern pthread_mutex_t subframe_mutex;
extern int subframe_ru_mask,subframe_UE_mask;
int ru_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
int ru_id = device->Mod_id;
int CC_id = device->CC_id;
int subframe;
int sample_count=0;
*ptimestamp = last_ru_rx_timestamp[ru_id][CC_id];
LOG_D(EMU,"RU_trx_read nsamps %d TS(%llu,%llu) => subframe %d\n",nsamps,
(unsigned long long)current_ru_rx_timestamp[ru_id][CC_id],
(unsigned long long)last_ru_rx_timestamp[ru_id][CC_id],
(int)((*ptimestamp/RC.ru[ru_id]->frame_parms.samples_per_tti)%10));
// if we're at a subframe boundary generate UL signals for this ru
while (sample_count<nsamps) {
while (current_ru_rx_timestamp[ru_id][CC_id]<
(nsamps+last_ru_rx_timestamp[ru_id][CC_id])) {
LOG_D(EMU,"RU: current TS %"PRIi64", last TS %"PRIi64", sleeping\n",current_ru_rx_timestamp[ru_id][CC_id],last_ru_rx_timestamp[ru_id][CC_id]);
usleep(500);
}
subframe = (last_ru_rx_timestamp[ru_id][CC_id]/RC.ru[ru_id]->frame_parms.samples_per_tti)%10;
if (subframe_select(&RC.ru[ru_id]->frame_parms,subframe) != SF_DL || RC.ru[ru_id]->frame_parms.frame_type == FDD) {
LOG_D(EMU,"RU_trx_read generating UL subframe %d (Ts %llu, current TS %llu)\n",
subframe,(unsigned long long)*ptimestamp,
(unsigned long long)current_ru_rx_timestamp[ru_id][CC_id]);
do_UL_sig(UE2RU,
enb_data,
ue_data,
subframe,
0, // abstraction_flag
&RC.ru[ru_id]->frame_parms,
0, // frame is only used for abstraction
ru_id,
CC_id);
}
last_ru_rx_timestamp[ru_id][CC_id] += RC.ru[ru_id]->frame_parms.samples_per_tti;
sample_count += RC.ru[ru_id]->frame_parms.samples_per_tti;
}
return(nsamps);
}
int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc)
{
int UE_id = device->Mod_id;
int CC_id = device->CC_id;
int subframe;
int sample_count=0;
int read_size;
int sptti = PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti;
*ptimestamp = last_UE_rx_timestamp[UE_id][CC_id];
LOG_D(EMU,"UE %d DL simulation 0: UE_trx_read nsamps %d TS %llu (%llu, offset %d) antenna %d\n",
UE_id,
nsamps,
(unsigned long long)current_UE_rx_timestamp[UE_id][CC_id],
(unsigned long long)last_UE_rx_timestamp[UE_id][CC_id],
(int)(last_UE_rx_timestamp[UE_id][CC_id]%sptti),
cc);
if (nsamps < sptti)
read_size = nsamps;
else
read_size = sptti;
while (sample_count<nsamps) {
LOG_D(EMU,"UE %d: DL simulation 1: UE_trx_read : current TS now %"PRIi64", last TS %"PRIi64"\n",UE_id,current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
while (current_UE_rx_timestamp[UE_id][CC_id] <
(last_UE_rx_timestamp[UE_id][CC_id]+read_size)) {
LOG_D(EMU,"UE %d: DL simulation 2: UE_trx_read : current TS %"PRIi64", last TS %"PRIi64", sleeping\n",UE_id,current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
usleep(500);
}
LOG_D(EMU,"UE %d: DL simulation 3: UE_trx_read : current TS now %"PRIi64", last TS %"PRIi64"\n",UE_id,current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
// if we cross a subframe-boundary
subframe = (last_UE_rx_timestamp[UE_id][CC_id]/sptti)%10;
// tell top-level we are busy
pthread_mutex_lock(&subframe_mutex);
subframe_UE_mask|=(1<<UE_id);
LOG_D(EMU,"Setting UE_id %d mask to busy (%d)\n",UE_id,subframe_UE_mask);
pthread_mutex_unlock(&subframe_mutex);
LOG_D(PHY,"UE %d: DL simulation 4: UE_trx_read generating DL subframe %d (Ts %llu, current TS %llu,nsamps %d)\n",
UE_id,subframe,(unsigned long long)*ptimestamp,
(unsigned long long)current_UE_rx_timestamp[UE_id][CC_id],
nsamps);
LOG_D(EMU,"UE %d: DL simulation 5: Doing DL simulation for %d samples starting in subframe %d at offset %d\n",
UE_id,nsamps,subframe,
(int)(last_UE_rx_timestamp[UE_id][CC_id]%sptti));
do_DL_sig(RU2UE,
enb_data,
ue_data,
subframe,
last_UE_rx_timestamp[UE_id][CC_id]%sptti,
sptti,
0, //abstraction_flag,
&PHY_vars_UE_g[UE_id][CC_id]->frame_parms,
UE_id,
CC_id);
LOG_D(EMU,"UE %d: DL simulation 6: UE_trx_read @ TS %"PRIi64" (%"PRIi64")=> frame %d, subframe %d\n",
UE_id, current_UE_rx_timestamp[UE_id][CC_id],
last_UE_rx_timestamp[UE_id][CC_id],
(int)((last_UE_rx_timestamp[UE_id][CC_id]/(sptti*10))&1023),
subframe);
last_UE_rx_timestamp[UE_id][CC_id] += read_size;
sample_count += read_size;
}
return(nsamps);
}
extern double ru_amp[NUMBER_OF_RU_MAX];
int ru_trx_write(openair0_device *device,openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
int ru_id = device->Mod_id;
LTE_DL_FRAME_PARMS *frame_parms = &RC.ru[ru_id]->frame_parms;
pthread_mutex_lock(&subframe_mutex);
LOG_D(EMU,"[TXPATH] ru_trx_write: RU %d mask %d\n",ru_id,subframe_ru_mask);
pthread_mutex_unlock(&subframe_mutex);
// compute amplitude of TX signal from first symbol in subframe
// note: assumes that the packet is an entire subframe
ru_amp[ru_id] = 0;
for (int aa=0; aa<RC.ru[ru_id]->nb_tx; aa++) {
ru_amp[ru_id] += (double)signal_energy((int32_t*)buff[aa],frame_parms->ofdm_symbol_size)/(12*frame_parms->N_RB_DL);
}
ru_amp[ru_id] = sqrt(ru_amp[ru_id]);
LOG_D(EMU,"Setting amp for RU %d to %f (%d)\n",ru_id,ru_amp[ru_id], dB_fixed((double)signal_energy((int32_t*)buff[0],frame_parms->ofdm_symbol_size)));
// tell top-level we are done
pthread_mutex_lock(&subframe_mutex);
subframe_ru_mask|=(1<<ru_id);
LOG_D(EMU,"Setting RU %d to busy\n",ru_id);
pthread_mutex_unlock(&subframe_mutex);
return(nsamps);
}
int UE_trx_write(openair0_device *device,openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
return(nsamps);
}
//void init_openair0(void);
//openair0_config_t openair0_cfg[MAX_CARDS];
/*
void init_openair0() {
int card;
int i;
for (card=0; card<MAX_CARDS; card++) {
openair0_cfg[card].configFilename = NULL;
if(frame_parms[0]->N_RB_DL == 100) {
if (frame_parms[0]->threequarter_fs) {
openair0_cfg[card].sample_rate=23.04e6;
openair0_cfg[card].samples_per_frame = 230400;
openair0_cfg[card].tx_bw = 10e6;
openair0_cfg[card].rx_bw = 10e6;
}
else {
openair0_cfg[card].sample_rate=30.72e6;
openair0_cfg[card].samples_per_frame = 307200;
openair0_cfg[card].tx_bw = 10e6;
openair0_cfg[card].rx_bw = 10e6;
}
} else if(frame_parms[0]->N_RB_DL == 50) {
openair0_cfg[card].sample_rate=15.36e6;
openair0_cfg[card].samples_per_frame = 153600;
openair0_cfg[card].tx_bw = 5e6;
openair0_cfg[card].rx_bw = 5e6;
} else if (frame_parms[0]->N_RB_DL == 25) {
openair0_cfg[card].sample_rate=7.68e6;
openair0_cfg[card].samples_per_frame = 76800;
openair0_cfg[card].tx_bw = 2.5e6;
openair0_cfg[card].rx_bw = 2.5e6;
} else if (frame_parms[0]->N_RB_DL == 6) {
openair0_cfg[card].sample_rate=1.92e6;
openair0_cfg[card].samples_per_frame = 19200;
openair0_cfg[card].tx_bw = 1.5e6;
openair0_cfg[card].rx_bw = 1.5e6;
}
if (frame_parms[0]->frame_type==TDD)
openair0_cfg[card].duplex_mode = duplex_mode_TDD;
else //FDD
openair0_cfg[card].duplex_mode = duplex_mode_FDD;
openair0_cfg[card].remote_addr = (eth_params+card)->remote_addr;
openair0_cfg[card].remote_port = (eth_params+card)->remote_port;
openair0_cfg[card].my_addr = (eth_params+card)->my_addr;
openair0_cfg[card].my_port = (eth_params+card)->my_port;
printf("HW: Configuring card %d, nb_antennas_tx/rx %d/%d\n",card,
RC.ru[0]->nb_tx,
RC.ru[0]->nb_rx);
openair0_cfg[card].Mod_id = 0;
openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
openair0_cfg[card].tx_num_channels=min(2,RC.ru[0]->nb_tx);
openair0_cfg[card].rx_num_channels=min(2,RC.ru[0]->nb_rx);
for (i=0; i<4; i++) {
openair0_cfg[card].rx_gain[i] = RC.ru[0]->rx_total_gain_dB;
printf("Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f\n",
card,i, openair0_cfg[card].tx_gain[i],
openair0_cfg[card].rx_gain[i],
openair0_cfg[card].tx_freq[i],
openair0_cfg[card].rx_freq[i]);
}
}
}
*/
void init_devices(void){
module_id_t UE_id, ru_id;
uint8_t CC_id;
RU_t *ru;
// allocate memory for RU if not already done
if (RC.ru==NULL) RC.ru = (RU_t**)malloc(RC.nb_RU*sizeof(RU_t*));
for (ru_id=0;ru_id<RC.nb_RU;ru_id++) {
LOG_I(EMU,"Initiaizing rfdevice for RU %d\n",ru_id);
if (RC.ru[ru_id]==NULL) RC.ru[ru_id] = (RU_t*)malloc(sizeof(RU_t));
ru = RC.ru[ru_id];
ru->rfdevice.Mod_id = ru_id;
ru->rfdevice.CC_id = 0;
ru->rfdevice.trx_start_func = ru_trx_start;
ru->rfdevice.trx_read_func = ru_trx_read;
ru->rfdevice.trx_write_func = ru_trx_write;
ru->rfdevice.trx_end_func = ru_trx_end;
ru->rfdevice.trx_stop_func = ru_trx_stop;
ru->rfdevice.trx_set_freq_func = ru_trx_set_freq;
ru->rfdevice.trx_set_gains_func = ru_trx_set_gains;
last_ru_rx_timestamp[ru_id][0] = 0;
}
if (PHY_vars_UE_g==NULL) {
PHY_vars_UE_g = (PHY_VARS_UE ***)malloc((1+NB_UE_INST)*sizeof(PHY_VARS_UE*));
for (UE_id=0;UE_id<NB_UE_INST;UE_id++) {
printf("Initializing UE %d\n",UE_id);
PHY_vars_UE_g[UE_id] = (PHY_VARS_UE **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_UE*));
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
PHY_vars_UE_g[UE_id][CC_id] = (PHY_VARS_UE *)malloc(sizeof(PHY_VARS_UE));
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.Mod_id = UE_id;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.CC_id = CC_id;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_start_func = UE_trx_start;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_read_func = UE_trx_read;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_write_func = UE_trx_write;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_end_func = UE_trx_end;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_stop_func = UE_trx_stop;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_set_freq_func = UE_trx_set_freq;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_set_gains_func = UE_trx_set_gains;
last_UE_rx_timestamp[UE_id][CC_id] = 0;
}
}
}
}
void init_ocm(void)
{
module_id_t UE_id, ru_id;
int CC_id;
/* Added for PHY abstraction */
/* TODO: frame_type is unused, is it intended? */
//char* frame_type = "unknown";
LTE_DL_FRAME_PARMS *fp = &RC.ru[0]->frame_parms;
init_channel_vars (fp, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0);
// initialize channel descriptors
LOG_I(PHY,"Initializing channel descriptors (nb_RU %d, nb_UE %d)\n",RC.nb_RU,NB_UE_INST);
for (ru_id = 0; ru_id < RC.nb_RU; ru_id++) {
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
LOG_I(PHY,"Initializing channel descriptors (RU %d, UE %d) for N_RB_DL %d\n",ru_id,UE_id,
RC.ru[ru_id]->frame_parms.N_RB_DL);
RU2UE[ru_id][UE_id][CC_id] =
new_channel_desc_scm(RC.ru[ru_id]->nb_tx,
PHY_vars_UE_g[UE_id][CC_id]->frame_parms.nb_antennas_rx,
map_str_to_int(small_scale_names,oai_emulation.environment_system_config.fading.small_scale.selected_option),
N_RB2sampling_rate(RC.ru[ru_id]->frame_parms.N_RB_DL),
N_RB2channel_bandwidth(RC.ru[ru_id]->frame_parms.N_RB_DL),
forgetting_factor,
0,
0);
random_channel(RU2UE[ru_id][UE_id][CC_id],abstraction_flag);
LOG_D(OCM,"[SIM] Initializing channel (%s, %d) from UE %d to ru %d\n", oai_emulation.environment_system_config.fading.small_scale.selected_option,
map_str_to_int(small_scale_names, oai_emulation.environment_system_config.fading.small_scale.selected_option),UE_id, ru_id);
UE2RU[UE_id][ru_id][CC_id] =
new_channel_desc_scm(PHY_vars_UE_g[UE_id][CC_id]->frame_parms.nb_antennas_tx,
RC.ru[ru_id]->nb_rx,
map_str_to_int(small_scale_names, oai_emulation.environment_system_config.fading.small_scale.selected_option),
N_RB2sampling_rate(RC.ru[ru_id]->frame_parms.N_RB_UL),
N_RB2channel_bandwidth(RC.ru[ru_id]->frame_parms.N_RB_UL),
forgetting_factor,
0,
0);
random_channel(UE2RU[UE_id][ru_id][CC_id],abstraction_flag);
// to make channel reciprocal uncomment following line instead of previous. However this only works for SISO at the moment. For MIMO the channel would need to be transposed.
//UE2RU[UE_id][ru_id] = RU2UE[ru_id][UE_id];
AssertFatal(RU2UE[ru_id][UE_id][CC_id]!=NULL,"RU2UE[%d][%d][%d] is null\n",ru_id,UE_id,CC_id);
AssertFatal(UE2RU[UE_id][ru_id][CC_id]!=NULL,"UE2RU[%d][%d][%d] is null\n",UE_id,ru_id,CC_id);
//pathloss: -132.24 dBm/15kHz RE + target SNR - eNB TX power per RE
if (ru_id == (UE_id % RC.nb_RU)) {
RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
} else {
RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
}
LOG_D(OCM,"Path loss from eNB %d to UE %d (CCid %d)=> %f dB (eNB TX %d, SNR %f)\n",ru_id,UE_id,CC_id,
RU2UE[ru_id][UE_id][CC_id]->path_loss_dB,
RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower,snr_dB);
}
}
}
}
/*
void update_omg (frame_t frameP)
{
module_id_t UE_id, eNB_id;
int new_omg_model;
if ((frameP % omg_period) == 0 ) { // call OMG every 10ms
update_nodes(oai_emulation.info.time_s);
display_node_list(enb_node_list);
display_node_list(ue_node_list);
if (oai_emulation.info.omg_model_ue >= MAX_NUM_MOB_TYPES) { // mix mobility model
for(UE_id=oai_emulation.info.first_ue_local; UE_id<(oai_emulation.info.first_ue_local+oai_emulation.info.nb_ue_local); UE_id++) {
new_omg_model = randomgen(STATIC,RWALK);
LOG_D(OMG, "[UE] Node of ID %d is changing mobility generator ->%d \n", UE_id, new_omg_model);
// reset the mobility model for a specific node
set_new_mob_type (UE_id, UE, new_omg_model, oai_emulation.info.time_s);
}
}
if (oai_emulation.info.omg_model_enb >= MAX_NUM_MOB_TYPES) { // mix mobility model
for (eNB_id = oai_emulation.info.first_enb_local; eNB_id < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local); eNB_id++) {
new_omg_model = randomgen (STATIC, RWALK);
LOG_D (OMG,"[eNB] Node of ID %d is changing mobility generator ->%d \n", eNB_id, new_omg_model);
// reset the mobility model for a specific node
set_new_mob_type (eNB_id, eNB, new_omg_model, oai_emulation.info.time_s);
}
}
}
}
void update_omg_ocm()
{
enb_node_list=get_current_positions(oai_emulation.info.omg_model_enb, eNB, oai_emulation.info.time_s);
ue_node_list=get_current_positions(oai_emulation.info.omg_model_ue, UE, oai_emulation.info.time_s);
}
void update_ocm()
{
module_id_t UE_id, ru_id;
int CC_id;
// check if the openair channel model is activated used for PHY abstraction : path loss
if ((oai_emulation.info.ocm_enabled == 1)&& (ethernet_flag == 0 )) {
for (ru_id = 0; ru_id < RC.nb_RU; ru_id++)
enb_data[ru_id]->tx_power_dBm = RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++)
ue_data[UE_id]->tx_power_dBm = PHY_vars_UE_g[UE_id][0]->tx_power_dBm[0];
//LOG_D(OMG," extracting position of eNb...\n");
//display_node_list(enb_node_list);
// display_node_list(ue_node_list);
//extract_position(enb_node_list, enb_data, RC.nb_RU);
//extract_position_fixed_enb(enb_data, NB_eNB_INST,frame);
//LOG_D(OMG," extracting position of UE...\n");
// if (oai_emulation.info.omg_model_ue == TRACE)
//extract_position(ue_node_list, ue_data, NB_UE_INST);
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
for (ru_id = 0; ru_id < RC.nb_RU; ru_id++) {
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
calc_path_loss (enb_data[ru_id], ue_data[UE_id], RU2UE[ru_id][UE_id][CC_id], oai_emulation.environment_system_config,ShaF);
//calc_path_loss (enb_data[ru_id], ue_data[UE_id], RU2UE[ru_id][UE_id], oai_emulation.environment_system_config,0);
UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = RU2UE[ru_id][UE_id][CC_id]->path_loss_dB;
// if (frame % 50 == 0)
LOG_D(OCM,"Path loss (CCid %d) between eNB %d at (%f,%f) and UE %d at (%f,%f) is %f, angle %f\n",
CC_id,ru_id,enb_data[ru_id]->x,enb_data[ru_id]->y,UE_id,ue_data[UE_id]->x,ue_data[UE_id]->y,
RU2UE[ru_id][UE_id][CC_id]->path_loss_dB, RU2UE[ru_id][UE_id][CC_id]->aoa);
//double dx, dy, distance;
//dx = enb_data[ru_id]->x - ue_data[UE_id]->x;
//dy = enb_data[ru_id]->y - ue_data[UE_id]->y;
//distance = sqrt(dx * dx + dy * dy);
///LOG_D(LOCALIZE, " OCM distance between eNB %d at (%f,%f) and UE %d at (%f,%f) is %f \n",
// ru_id, enb_data[ru_id]->x,enb_data[ru_id]->y,
// UE_id, ue_data[UE_id]->x,ue_data[UE_id]->y,
// distance);
}
}
}
}
else {
for (ru_id = 0; ru_id < RC.nb_RU; ru_id++) {
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
AssertFatal(RU2UE[ru_id][UE_id][CC_id]!=NULL,"RU2UE[%d][%d][%d] is null\n",ru_id,UE_id,CC_id);
AssertFatal(UE2RU[UE_id][ru_id][CC_id]!=NULL,"UE2RU[%d][%d][%d] is null\n",UE_id,ru_id,CC_id);
//pathloss: -132.24 dBm/15kHz RE + target SNR - eNB TX power per RE
if (ru_id == (UE_id % RC.nb_RU)) {
RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
} else {
RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
}
LOG_D(OCM,"Path loss from eNB %d to UE %d (CCid %d)=> %f dB (eNB TX %d, SNR %f)\n",ru_id,UE_id,CC_id,
RU2UE[ru_id][UE_id][CC_id]->path_loss_dB,
RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower,snr_dB);
}
}
}
}
}
#ifdef OPENAIR2
void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime)
{
#if defined(USER_MODE) && defined(OAI_EMU)
//int rrc_state=0;
if (oai_emulation.info.otg_enabled ==1 ) {
int dst_id, app_id;
Packet_otg_elt_t *otg_pkt;
for (dst_id = 0; dst_id < MAX_MOBILES_PER_ENB; dst_id++) {
for_times += 1;
// generate traffic if the ue is rrc reconfigured state
//if ((rrc_state=mac_eNB_get_rrc_status(enb_module_idP, dst_id)) > 2 //RRC_CONNECTED
{
if (mac_eNB_get_rrc_status(enb_module_idP, oai_emulation.info.eNB_ue_module_id_to_rnti[enb_module_idP][dst_id]) > 2 ){
if_times += 1;
for (app_id=0; app_id<MAX_NUM_APPLICATION; app_id++) {
otg_pkt = malloc (sizeof(Packet_otg_elt_t));
(otg_pkt->otg_pkt).sdu_buffer = (uint8_t*) packet_gen(enb_module_idP, dst_id + NB_eNB_INST, app_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size));
if ((otg_pkt->otg_pkt).sdu_buffer != NULL) {
otg_times += 1;
(otg_pkt->otg_pkt).rb_id = DTCH-2; // app could be binded to a given DRB
(otg_pkt->otg_pkt).module_id = enb_module_idP;
(otg_pkt->otg_pkt).dst_id = dst_id;
(otg_pkt->otg_pkt).is_ue = 0;
(otg_pkt->otg_pkt).mode = PDCP_TRANSMISSION_MODE_DATA;
//Adding the packet to the OTG-PDCP buffer
pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[enb_module_idP]));
LOG_D(EMU,"[eNB %d] ADD pkt to OTG buffer with size %d for dst %d on rb_id %d for app id %d \n",
(otg_pkt->otg_pkt).module_id, otg_pkt->otg_pkt.sdu_buffer_size, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id, app_id);
} else {
free(otg_pkt);
otg_pkt=NULL;
}
}
}
}
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
mbms_service_id_t service_id;
mbms_session_id_t session_id;
rb_id_t rb_id;
// MBSM multicast traffic
if (ctime >= 500 ) {// only generate when UE can receive MTCH (need to control this value)
for (service_id = 0; service_id < 2 ; service_id++) { //maxServiceCount
for (session_id = 0; session_id < 2; session_id++) { // maxSessionPerPMCH
if (pdcp_mbms_array_eNB[enb_module_idP][service_id][session_id].instanciated_instance == TRUE) { // this service/session is configured
otg_pkt = malloc (sizeof(Packet_otg_elt_t));
// LOG_T(OTG,"multicast packet gen for (service/mch %d, session/lcid %d, rb_id %d)\n", service_id, session_id, service_id*maxSessionPerPMCH + session_id);
rb_id = pdcp_mbms_array_eNB[enb_module_idP][service_id][session_id].rb_id;
(otg_pkt->otg_pkt).sdu_buffer = (uint8_t*) packet_gen_multicast(enb_module_idP, session_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size));
if ((otg_pkt->otg_pkt).sdu_buffer != NULL) {
(otg_pkt->otg_pkt).rb_id = rb_id;
(otg_pkt->otg_pkt).module_id = enb_module_idP;
(otg_pkt->otg_pkt).dst_id = session_id;
(otg_pkt->otg_pkt).is_ue = FALSE;
//Adding the packet to the OTG-PDCP buffer
(otg_pkt->otg_pkt).mode = PDCP_TRANSMISSION_MODE_TRANSPARENT;
pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[enb_module_idP]));
LOG_D(EMU, "[eNB %d] ADD packet (%p) multicast to OTG buffer for dst %d on rb_id %d\n",
(otg_pkt->otg_pkt).module_id, otg_pkt, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id);
} else {
//LOG_I(EMU, "OTG returns null \n");
free(otg_pkt);
otg_pkt=NULL;
}
// old version
// MBSM multicast traffic
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
if (frame >= 46) {// only generate when UE can receive MTCH (need to control this value)
for (service_id = 0; service_id < 2 ; service_id++) { //maxServiceCount
for (session_id = 0; session_id < 2; session_id++) { // maxSessionPerPMCH
// LOG_I(OTG,"DUY:frame %d, pdcp_mbms_array[module_id][rb_id].instanciated_instance is %d\n",frame,pdcp_mbms_array[module_id][service_id*maxSessionPerPMCH + session_id].instanciated_instance);
if ((pdcp_mbms_array[module_idP][service_id*maxSessionPerPMCH + session_id].instanciated_instance== module_idP + 1) && (eNB_flag == 1)){ // this service/session is configured
// LOG_T(OTG,"multicast packet gen for (service/mch %d, session/lcid %d)\n", service_id, session_id);
// Duy add
LOG_I(OTG, "frame %d, multicast packet gen for (service/mch %d, session/lcid %d, rb_id %d)\n",frame, service_id, session_id,service_id*maxSessionPerPMCH + session_id);
// end Duy add
rb_id = pdcp_mbms_array[module_id][service_id*maxSessionPerPMCH + session_id].rb_id;
otg_pkt=(uint8_t*) packet_gen_multicast(module_idP, session_id, ctime, &pkt_size);
if (otg_pkt != NULL) {
LOG_D(OTG,"[eNB %d] sending a multicast packet from module %d on rab id %d (src %d, dst %d) pkt size %d\n", eNB_index, module_idP, rb_id, module_idP, session_id, pkt_size);
pdcp_data_req(module_id, frame, eNB_flag, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, pkt_size, otg_pkt,PDCP_TM);
free(otg_pkt);
}
}
}
}
} // end multicast traffic
#endif
}
}
}
} // end multicast traffic
#endif
}
#else
#if 0 // defined(EXMIMO) || defined(OAI_USRP)
if (otg_enabled==1) {
ctime = frame * 100;
for (dst_id = 0; dst_id < MAX_MOBILES_PER_ENB; dst_id++) {
if (mac_get_rrc_status(eNB_index, eNB_flag, dst_id ) > 2) {
otg_pkt = malloc (sizeof(Packet_otg_elt_t));
(otg_pkt->otg_pkt).sdu_buffer = packet_gen(module_instP, dst_id, ctime, &pkt_size);
if (otg_pkt != NULL) {
rb_id = DTCH-2;
(otg_pkt->otg_pkt).rb_id = rb_id;
(otg_pkt->otg_pkt).module_id = module_idP;
(otg_pkt->otg_pkt).is_ue = FALSE;
(otg_pkt->otg_pkt).mode = PDCP_TRANSMISSION_MODE_DATA;
//Adding the packet to the OTG-PDCP buffer
pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[module_idP]));
LOG_D(EMU, "[eNB %d] ADD pkt to OTG buffer for dst %d on rb_id %d\n", (otg_pkt->otg_pkt).module_id, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id);
} else {
//LOG_I(EMU, "OTG returns null \n");
free(otg_pkt);
otg_pkt=NULL;
}
}
}
}
#endif
}
void update_otg_UE(module_id_t ue_mod_idP, unsigned int ctime)
{
}
#endif
*/
int init_slot_isr(void)
{
if (oai_emulation.info.slot_isr) {
struct itimerspec its;
int sfd;
sfd = timerfd_create(CLOCK_REALTIME, 0);
if (sfd == -1) {
LOG_E(EMU, "Failed in timerfd_create (%d:%s)\n", errno, strerror(errno));
exit(EXIT_FAILURE);
}
/* Start the timer */
its.it_value.tv_sec = 0;
its.it_value.tv_nsec = 500 * 1000;
its.it_interval.tv_sec = its.it_value.tv_sec;
its.it_interval.tv_nsec = its.it_value.tv_nsec;
if (timerfd_settime(sfd, TFD_TIMER_ABSTIME, &its, NULL) == -1) {
LOG_E(EMU, "Failed in timer_settime (%d:%s)\n", errno, strerror(errno));
exit(EXIT_FAILURE);
}
oai_emulation.info.slot_sfd = sfd;
}
return 0;
}
void wait_for_slot_isr(void)
{
uint64_t exp;
ssize_t res;
if (oai_emulation.info.slot_sfd > 0) {
res = read(oai_emulation.info.slot_sfd, &exp, sizeof(exp));
if ((res < 0) || (res != sizeof(exp))) {
LOG_E(EMU, "Failed in read (%d:%s)\n", errno, strerror(errno));
exit(EXIT_FAILURE);
}
}
}
void exit_fun(const char* s)
{
void *array[10];
size_t size;
size = backtrace(array, 10);
backtrace_symbols_fd(array, size, 2);
fprintf(stderr, "Error: %s. Exiting!\n",s);
exit (-1);
}
void init_time()
{
clock_gettime (CLOCK_REALTIME, &time_spec);
time_now = (unsigned long) time_spec.tv_nsec;
td_avg = 0;
sleep_time_us = SLEEP_STEP_US;
td_avg = TARGET_SF_TIME_NS;
}
// dummy function
int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind) {
return(0);
}
/*
int openair0_transport_load(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * eth_params) {
return(0);
}
int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cfg) {
return(0);
}
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "oaisim.h"
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include "UTIL/FIFO/pad_list.h"
#ifndef OAISIM_FUNCTIONS_H_
#define OAISIM_FUNCTIONS_H_
void get_simulation_options(int argc, char *argv[]);
void check_and_adjust_params(void);
void init_omv(void);
void init_seed(uint8_t set_seed);
void init_openair1(void);
void init_openair2(void);
void init_ocm(void);
void init_otg_pdcp_buffer(void);
void update_omg(frame_t frameP);
void update_omg_ocm(void);
void update_ocm(void);
void update_otg_eNB(module_id_t module_idP, unsigned int ctime);
void update_otg_UE(module_id_t module_idP, unsigned int ctime);
void exit_fun(const char* s);
void init_time(void);
void init_pad(void);
void help(void);
int init_slot_isr(void);
void wait_for_slot_isr(void);
#endif /* OAISIM_FUNCTIONS_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <cblas.h>
#include <execinfo.h>
//<<PAD>>//
//#include <mpi.h>
//#include "UTIL/FIFO/pad_list.h"
#include "discrete_event_generator.h"
#include "threadpool.h"
#include <pthread.h>
#include "oaisim_functions.h"
//<<PAD>>//
#include "SIMULATION/RF/defs.h"
#include "PHY/types.h"
#include "PHY/defs.h"
#include "PHY/vars.h"
#include "MAC_INTERFACE/vars.h"
//#ifdef OPENAIR2
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/vars.h"
#include "RRC/LITE/vars.h"
#include "PHY_INTERFACE/vars.h"
//#endif
#include "ARCH/CBMIMO1/DEVICE_DRIVER/vars.h"
#ifdef IFFT_FPGA
//#include "PHY/LTE_REFSIG/mod_table.h"
#endif //IFFT_FPGA
#include "SCHED/defs.h"
#include "SCHED/vars.h"
#include "oaisim.h"
#include "oaisim_config.h"
#include "UTIL/OCG/OCG_extern.h"
#include "cor_SF_sim.h"
#include "UTIL/OMG/omg_constants.h"
//#include "UTIL/LOG/vcd_signal_dumper.h"
#define RF
//#define DEBUG_SIM
#define MCS_COUNT 24//added for PHY abstraction
#define N_TRIALS 1
/*
DCI0_5MHz_TDD0_t UL_alloc_pdu;
DCI1A_5MHz_TDD_1_6_t CCCH_alloc_pdu;
DCI2_5MHz_2A_L10PRB_TDD_t DLSCH_alloc_pdu1;
DCI2_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu2;
*/
#define UL_RB_ALLOC computeRIV(lte_frame_parms->N_RB_UL,0,24)
#define CCCH_RB_ALLOC computeRIV(lte_frame_parms->N_RB_UL,0,3)
#define RA_RB_ALLOC computeRIV(lte_frame_parms->N_RB_UL,0,3)
#define DLSCH_RB_ALLOC 0x1fff
#define DECOR_DIST 100
#define SF_VAR 10
//constant for OAISIM soft realtime calibration
#define SF_DEVIATION_OFFSET_NS 100000 //= 0.1ms : should be as a number of UE
#define SLEEP_STEP_US 100 // = 0.01ms could be adaptive, should be as a number of UE
#define K 2 // averaging coefficient
#define TARGET_SF_TIME_NS 1000000 // 1ms = 1000000 ns
//#ifdef OPENAIR2
//uint16_t NODE_ID[1];
//uint8_t NB_INST = 2;
//#endif //OPENAIR2
extern int otg_times;
extern int for_times;
extern int if_times;
int for_main_times = 0;
frame_t frame=0;
char stats_buffer[16384];
channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX];
Signal_buffers *signal_buffers_g;
//Added for PHY abstraction
node_desc_t *enb_data[NUMBER_OF_eNB_MAX];
node_desc_t *ue_data[NUMBER_OF_UE_MAX];
//double sinr_bler_map[MCS_COUNT][2][16];
//double sinr_bler_map_up[MCS_COUNT][2][16];
//extern double SINRpost_eff[301];
extern int mcsPost;
extern int nrbPost;
extern int frbPost;
extern void kpi_gen();
extern uint16_t Nid_cell;
extern uint8_t target_dl_mcs;
extern uint8_t rate_adaptation_flag;
extern double snr_dB, sinr_dB;
extern uint8_t set_seed;
extern uint8_t cooperation_flag; // for cooperative communication
extern uint8_t abstraction_flag, ethernet_flag;
extern uint8_t ue_connection_test;
extern int map1,map2;
extern double **ShaF;
// pointers signal buffers (s = transmit, r,r0 = receive)
extern double **s_re, **s_im, **r_re, **r_im, **r_re0, **r_im0;
extern Node_list ue_node_list;
extern Node_list enb_node_list;
extern int pdcp_period, omg_period;
extern LTE_DL_FRAME_PARMS *frame_parms;
// time calibration for soft realtime mode
extern struct timespec time_spec;
extern unsigned long time_last, time_now;
extern int td, td_avg, sleep_time_us;
int eMBMS_active = 0;
threadpool_t * pool;
#ifdef OPENAIR2
extern int pfd[2];
#endif
// this should reflect the channel models in openair1/SIMULATION/TOOLS/defs.h
mapping small_scale_names[] = {
{"custom", custom},
{"SCM_A", SCM_A},
{"SCM_B", SCM_B},
{"SCM_C", SCM_C},
{"SCM_D", SCM_D},
{"EPA", EPA},
{"EVA", EVA},
{"ETU", ETU},
{"Rayleigh8", Rayleigh8},
{"Rayleigh1", Rayleigh1},
{"Rayleigh1_800", Rayleigh1_800},
{"Rayleigh1_corr", Rayleigh1_corr},
{"Rayleigh1_anticorr", Rayleigh1_anticorr},
{"Rice8", Rice8},
{"Rice1", Rice1},
{"Rice1_corr", Rice1_corr},
{"Rice1_anticorr", Rice1_anticorr},
{"AWGN", AWGN},
{NULL, -1}
};
//static void *sigh(void *arg);
void terminate(void);
void
help (void)
{
printf
("Usage: oaisim -h -a -F -C tdd_config -V -R N_RB_DL -e -x transmission_mode -m target_dl_mcs -r(ate_adaptation) -n n_frames -s snr_dB -k ricean_factor -t max_delay -f forgetting factor -A channel_model -z cooperation_flag -u nb_local_ue -U UE mobility -b nb_local_enb -B eNB_mobility -M ethernet_flag -p nb_master -g multicast_group -l log_level -c ocg_enable -T traffic model -D multicast network device\n");
printf ("-h provides this help message!\n");
printf ("-a Activates PHY abstraction mode\n");
printf ("-F Activates FDD transmission (TDD is default)\n");
printf ("-C [0-6] Sets TDD configuration\n");
printf ("-R [6,15,25,50,75,100] Sets N_RB_DL\n");
printf ("-e Activates extended prefix mode\n");
printf ("-m Gives a fixed DL mcs\n");
printf ("-r Activates rate adaptation (DL for now)\n");
printf ("-n Set the number of frames for the simulation\n");
printf ("-s snr_dB set a fixed (average) SNR, this deactivates the openair channel model generator (OCM)\n");
printf ("-S snir_dB set a fixed (average) SNIR, this deactivates the openair channel model generator (OCM)\n");
printf ("-k Set the Ricean factor (linear)\n");
printf ("-t Set the delay spread (microseconds)\n");
printf ("-f Set the forgetting factor for time-variation\n");
printf ("-A set the multipath channel simulation, options are: SCM_A, SCM_B, SCM_C, SCM_D, EPA, EVA, ETU, Rayleigh8, Rayleigh1, Rayleigh1_corr,Rayleigh1_anticorr, Rice8,, Rice1, AWGN \n");
printf ("-b Set the number of local eNB\n");
printf ("-u Set the number of local UE\n");
printf ("-M Set the machine ID for Ethernet-based emulation\n");
printf ("-p Set the total number of machine in emulation - valid if M is set\n");
printf ("-g Set multicast group ID (0,1,2,3) - valid if M is set\n");
printf ("-l Set the global log level (8:trace, 7:debug, 6:info, 4:warn, 3:error) \n");
printf
("-c [1,2,3,4] Activate the config generator (OCG) to process the scenario descriptor, or give the scenario manually: -c template_1.xml \n");
printf ("-x Set the transmission mode (1,2,5,6 supported for now)\n");
printf ("-z Set the cooperation flag (0 for no cooperation, 1 for delay diversity and 2 for distributed alamouti\n");
printf ("-T activate the traffic generator: 0 for NONE, 1 for CBR, 2 for M2M, 3 for FPS Gaming, 4 for mix\n");
printf ("-B Set the mobility model for eNB, options are: STATIC, RWP, RWALK, \n");
printf ("-U Set the mobility model for UE, options are: STATIC, RWP, RWALK \n");
printf ("-E Random number generator seed\n");
printf ("-P enable protocol analyzer : 0 for wireshark interface, 1: for pcap , 2 : for tshark \n");
printf ("-I Enable CLI interface (to connect use telnet localhost 1352)\n");
printf ("-V Enable VCD dump, file = openair_vcd_dump.vcd\n");
printf ("-G Enable background traffic \n");
printf ("-O [mme ipv4 address] Enable MME mode\n");
printf ("-Z Reserved\n");
}
#ifdef OPENAIR2
void omv_end (int pfd, Data_Flow_Unit omv_data);
int omv_write (int pfd, Node_list enb_node_list, Node_list ue_node_list, Data_Flow_Unit omv_data);
#endif
//<<<< PAD >>>>//
#define PAD 1
//#define PAD_FINE 1
//#define PAD_SYNC 1
#define JOB_REQUEST_TAG 246
#define JOB_REPLY_TAG 369
#define FRAME_END 888
#define NO_JOBS_TAG 404
#define JOB_DIST_DEBUG 33
//Global Variables
int worker_number;
int frame_number = 1;
//<<<< PAD >>>>//
//<<<< DEG >>>>//
extern End_Of_Sim_Event end_event; //Could later be a list of condition_events
extern Event_List event_list;
//<<<< DEG >>>>//
extern Packet_OTG_List *otg_pdcp_buffer;
void run(int argc, char *argv[]);
#ifdef PAD
void pad_init()
{
int UE_id, i;
pool = threadpool_create(PAD);
if (pool == NULL) {
printf("ERROR threadpool allocation\n");
return;
}
signal_buffers_g = malloc(NB_UE_INST * sizeof(Signal_buffers));
if (abstraction_flag == 0) {
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
signal_buffers_g[UE_id].s_re = malloc(2*sizeof(double*));
signal_buffers_g[UE_id].s_im = malloc(2*sizeof(double*));
signal_buffers_g[UE_id].r_re = malloc(2*sizeof(double*));
signal_buffers_g[UE_id].r_im = malloc(2*sizeof(double*));
signal_buffers_g[UE_id].r_re0 = malloc(2*sizeof(double*));
signal_buffers_g[UE_id].r_im0 = malloc(2*sizeof(double*));
for (i=0; i<2; i++) {
signal_buffers_g[UE_id].s_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
bzero(signal_buffers_g[UE_id].s_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
signal_buffers_g[UE_id].s_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
bzero(signal_buffers_g[UE_id].s_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
signal_buffers_g[UE_id].r_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
bzero(signal_buffers_g[UE_id].r_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
signal_buffers_g[UE_id].r_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
bzero(signal_buffers_g[UE_id].r_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
signal_buffers_g[UE_id].r_re0[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
bzero(signal_buffers_g[UE_id].r_re0[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
signal_buffers_g[UE_id].r_im0[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
bzero(signal_buffers_g[UE_id].r_im0[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
}
}
}
}
void pad_finalize()
{
int ret, i;
module_id_t UE_id;
ret = threadpool_destroy(pool);
if (ret)
printf("ERROR threadpool destroy = %d\n", ret);
if (abstraction_flag == 0) {
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
for (i = 0; i < 2; i++) {
free(signal_buffers_g[UE_id].s_re[i]);
free(signal_buffers_g[UE_id].s_im[i]);
free(signal_buffers_g[UE_id].r_re[i]);
free(signal_buffers_g[UE_id].r_im[i]);
}
free(signal_buffers_g[UE_id].s_re);
free(signal_buffers_g[UE_id].s_im);
free(signal_buffers_g[UE_id].r_re);
free(signal_buffers_g[UE_id].r_im);
}
//free node by node here same pattern as below
}
free(signal_buffers_g);
}
void pad_inject_job(int eNB_flag, int nid, int frame, int next_slot, int last_slot, enum Job_type type, int ctime)
{
int ret;
Job_elt *job_elt;
job_elt = malloc(sizeof(Job_elt));
job_elt->next = NULL;
(job_elt->job).eNB_flag = eNB_flag;
(job_elt->job).nid = nid;
(job_elt->job).frame = frame;
(job_elt->job).next_slot = next_slot;
(job_elt->job).last_slot = last_slot;
(job_elt->job).type = type;
(job_elt->job).ctime = ctime;
ret = threadpool_add(pool, job_elt);
if (ret) {
printf("ERROR threadpool_add %d\n", ret);
return;
}
}
void pad_synchronize()
{
pthread_mutex_lock(&(pool->sync_lock));
while(pool->active > 0) {
pthread_cond_wait(&(pool->sync_notify), &(pool->sync_lock));
}
pthread_mutex_unlock(&(pool->sync_lock));
}
#endif
//<<PAD(DEG_MAIN)>>//
int main (int argc, char *argv[])
{
//Mobility *mobility_frame_10;
//Application_Config *application_frame_20;
//Here make modifications on the mobility and traffic new models
//mob_frame_10 -> ...
//application_frame_30 -> ...
//schedule(ET_OMG, 10, NULL, mobility_frame_10);
//schedule(ET_OTG, 15, NULL, application_frame_20);
//event_list_display(&event_list);
schedule_end_of_simulation(FRAME, 100);
run(argc, argv);
return 0;
}
//<<PAD>>//
//<<PAD(RUN)>>//
void run(int argc, char *argv[])
{
int32_t i;
module_id_t UE_id, eNB_id;
Job_elt *job_elt;
int ret;
clock_t t;
Event_elt *user_defined_event;
Event event;
// Framing variables
int32_t slot, last_slot, next_slot;
FILE *SINRpost;
char SINRpost_fname[512];
sprintf(SINRpost_fname,"postprocSINR.m");
SINRpost = fopen(SINRpost_fname,"w");
// variables/flags which are set by user on command-line
double snr_direction,snr_step=1.0;//,sinr_direction;
lte_subframe_t direction;
char fname[64],vname[64];
#ifdef XFORMS
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
// at eNB 0, an UL scope for every UE
FD_lte_phy_scope_ue *form_ue[NUMBER_OF_UE_MAX];
FD_lte_phy_scope_enb *form_enb[NUMBER_OF_UE_MAX];
char title[255];
#endif
#ifdef PROC
int node_id;
int port,Process_Flag=0,wgt,Channel_Flag=0,temp;
#endif
// uint8_t awgn_flag = 0;
#ifdef PRINT_STATS
int len;
FILE *UE_stats[NUMBER_OF_UE_MAX], *UE_stats_th[NUMBER_OF_UE_MAX], *eNB_stats, *eNB_avg_thr, *eNB_l2_stats;
char UE_stats_filename[255];
char UE_stats_th_filename[255];
char eNB_stats_th_filename[255];
#endif
#ifdef SMBV
uint8_t config_smbv = 0;
char smbv_ip[16];
strcpy(smbv_ip,DEFAULT_SMBV_IP);
#endif
#ifdef OPENAIR2
Data_Flow_Unit omv_data;
#endif
//time_t t0,t1;
//clock_t start, stop;
//double **s_re2[MAX_eNB+MAX_UE], **s_im2[MAX_eNB+MAX_UE], **r_re2[MAX_eNB+MAX_UE], **r_im2[MAX_eNB+MAX_UE], **r_re02, **r_im02;
//double **r_re0_d[MAX_UE][MAX_eNB], **r_im0_d[MAX_UE][MAX_eNB], **r_re0_u[MAX_eNB][MAX_UE],**r_im0_u[MAX_eNB][MAX_UE];
//default parameters
//{
/* INITIALIZATIONS */
target_dl_mcs = 0;
rate_adaptation_flag = 0;
oai_emulation.info.n_frames = 0xffff;//1024; //10;
oai_emulation.info.n_frames_flag = 0;//fixme
snr_dB = 30;
cooperation_flag = 0; // default value 0 for no cooperation, 1 for Delay diversity, 2 for Distributed Alamouti
//Default values if not changed by the user in get_simulation_options();
pdcp_period = 1;
omg_period = 10;
mRAL_init_default_values(); //Default values
eRAL_init_default_values(); //Default values
init_oai_emulation(); //Default values
get_simulation_options(argc, argv); //Command-line options
oaisim_config(); // config OMG and OCG, OPT, OTG, OLG
//To fix eventual conflict on the value of n_frames
if (oai_emulation.info.n_frames_flag) {
schedule_end_of_simulation(FRAME, oai_emulation.info.n_frames);
}
VCD_SIGNAL_DUMPER_INIT(); // Initialize VCD LOG module
#ifdef OPENAIR2
init_omv();
#endif
check_and_adjust_params(); //Before this call, NB_UE_INST and NB_eNB_INST are not set correctly
init_otg_pdcp_buffer();
#ifdef PRINT_STATS
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
sprintf(UE_stats_filename,"UE_stats%d.txt",UE_id);
UE_stats[UE_id] = fopen (UE_stats_filename, "w");
}
eNB_stats = fopen ("eNB_stats.txt", "w");
printf ("UE_stats=%p, eNB_stats=%p\n", UE_stats, eNB_stats);
eNB_avg_thr = fopen ("eNB_stats_th.txt", "w");
#endif
LOG_I(EMU,"total number of UE %d (local %d, remote %d) mobility %s \n", NB_UE_INST,oai_emulation.info.nb_ue_local,oai_emulation.info.nb_ue_remote,
oai_emulation.topology_config.mobility.eNB_mobility.eNB_mobility_type.selected_option);
LOG_I(EMU,"Total number of eNB %d (local %d, remote %d) mobility %s \n", NB_eNB_INST,oai_emulation.info.nb_enb_local,oai_emulation.info.nb_enb_remote,
oai_emulation.topology_config.mobility.UE_mobility.UE_mobility_type.selected_option);
LOG_I(OCM,"Running with frame_type %d, Nid_cell %d, N_RB_DL %d, EP %d, mode %d, target dl_mcs %d, rate adaptation %d, nframes %d, abstraction %d, channel %s\n",
oai_emulation.info.frame_type, Nid_cell, oai_emulation.info.N_RB_DL, oai_emulation.info.extended_prefix_flag, oai_emulation.info.transmission_mode,target_dl_mcs,rate_adaptation_flag,
oai_emulation.info.n_frames,abstraction_flag,oai_emulation.environment_system_config.fading.small_scale.selected_option);
init_seed(set_seed);
init_openair1();
init_openair2();
init_ocm();
#ifdef XFORMS
init_xforms();
#endif
printf ("before L2 init: Nid_cell %d\n", PHY_vars_eNB_g[0]->lte_frame_parms.Nid_cell);
printf ("before L2 init: frame_type %d,tdd_config %d\n",
PHY_vars_eNB_g[0]->lte_frame_parms.frame_type,
PHY_vars_eNB_g[0]->lte_frame_parms.tdd_config);
init_time();
#ifdef PAD
pad_init();
#endif
if (ue_connection_test == 1) {
snr_direction = -snr_step;
snr_dB=20;
sinr_dB=-20;
}
frame = 0;
slot = 0;
LOG_I(EMU,">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU initialization done <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
printf ("after init: Nid_cell %d\n", PHY_vars_eNB_g[0]->lte_frame_parms.Nid_cell);
printf ("after init: frame_type %d,tdd_config %d\n",
PHY_vars_eNB_g[0]->lte_frame_parms.frame_type,
PHY_vars_eNB_g[0]->lte_frame_parms.tdd_config);
t = clock();
while (!end_of_simulation()) {
last_slot = (slot - 1)%20;
if (last_slot <0)
last_slot+=20;
next_slot = (slot + 1)%20;
oai_emulation.info.time_ms = frame * 10 + (next_slot>>1);
oai_emulation.info.frame = frame;
if (slot == 0) { //Frame's Prologue
//Run the aperiodic user-defined events
while ((user_defined_event = event_list_get_head(&event_list)) != NULL) {
event = user_defined_event->event;
if (event.frame == frame) {
switch (event.type) {
case ET_OMG:
update_omg_model(event.key, event.value); //implement it with assigning the new values to that of oai_emulation & second thing is to ensure mob model is always read from oai_emulation
user_defined_event = event_list_remove_head(&event_list);
break;
case ET_OTG:
update_otg_model(event.key, event.value);
user_defined_event = event_list_remove_head(&event_list);
break;
}
} else {
break;
}
}
//Comment (handle cooperation flag) deleted here. Look at oaisim.c to see it
if (ue_connection_test==1) {
if ((frame%20) == 0) {
snr_dB += snr_direction;
sinr_dB -= snr_direction;
}
if (snr_dB == -20) {
snr_direction=snr_step;
} else if (snr_dB==20) {
snr_direction=-snr_step;
}
}
update_omg(); // frequency is defined in the omg_global params configurable by the user
update_omg_ocm();
#ifdef OPENAIR2
// check if pipe is still open
if ((oai_emulation.info.omv_enabled == 1) ) {
omv_write(pfd[1], enb_node_list, ue_node_list, omv_data);
}
#endif
#ifdef DEBUG_OMG
if ((((int) oai_emulation.info.time_s) % 100) == 0) {
for (UE_id = oai_emulation.info.first_ue_local; UE_id < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); UE_id++) {
get_node_position (UE, UE_id);
}
}
#endif
update_ocm();
}
direction = subframe_select(frame_parms,next_slot>>1);
if((next_slot %2) ==0)
clear_eNB_transport_info(oai_emulation.info.nb_enb_local);
for (eNB_id=oai_emulation.info.first_enb_local;
(eNB_id<(oai_emulation.info.first_enb_local+oai_emulation.info.nb_enb_local)) && (oai_emulation.info.cli_start_enb[eNB_id]==1);
eNB_id++) {
for_main_times += 1;
//printf ("debug: Nid_cell %d\n", PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Nid_cell);
//printf ("debug: frame_type %d,tdd_config %d\n", PHY_vars_eNB_g[eNB_id]->lte_frame_parms.frame_type,PHY_vars_eNB_g[eNB_id]->lte_frame_parms.tdd_config);
LOG_D(EMU,"PHY procedures eNB %d for frame %d, slot %d (subframe TX %d, RX %d) TDD %d/%d Nid_cell %d\n",
eNB_id, frame, slot, next_slot >> 1,last_slot>>1,
PHY_vars_eNB_g[eNB_id]->lte_frame_parms.frame_type,
PHY_vars_eNB_g[eNB_id]->lte_frame_parms.tdd_config,PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Nid_cell);
//Appliation
#ifdef PAD_FINE
pad_inject_job(1, eNB_id, frame, next_slot, last_slot, JT_OTG, oai_emulation.info.time_ms);
#else
update_otg_eNB(eNB_id, oai_emulation.info.time_ms);
#endif
//Access layer
if (frame % pdcp_period == 0) {
#ifdef PAD_FINE
pad_inject_job(1, eNB_id, frame, next_slot, last_slot, JT_PDCP, oai_emulation.info.time_ms);
#else
pdcp_run(frame, 1, 0, eNB_id);//PHY_vars_eNB_g[eNB_id]->Mod_id
#endif
}
//Phy/Mac layer
#ifdef PAD_FINE
pad_inject_job(1, eNB_id, frame, next_slot, last_slot, JT_PHY_MAC, oai_emulation.info.time_ms);
#else
phy_procedures_eNB_lte (last_slot, next_slot, PHY_vars_eNB_g[eNB_id], abstraction_flag, no_relay, NULL);
#endif
#ifdef PRINT_STATS
if(last_slot==9 && frame%10==0)
if(eNB_avg_thr)
fprintf(eNB_avg_thr,"%d %d\n",PHY_vars_eNB_g[eNB_id]->frame,(PHY_vars_eNB_g[eNB_id]->total_system_throughput)/((PHY_vars_eNB_g[eNB_id]->frame+1)*10));
if (eNB_stats) {
len = dump_eNB_stats(PHY_vars_eNB_g[eNB_id], stats_buffer, 0);
rewind (eNB_stats);
fwrite (stats_buffer, 1, len, eNB_stats);
fflush(eNB_stats);
}
#ifdef OPENAIR2
if (eNB_l2_stats) {
len = dump_eNB_l2_stats (stats_buffer, 0);
rewind (eNB_l2_stats);
fwrite (stats_buffer, 1, len, eNB_l2_stats);
fflush(eNB_l2_stats);
}
#endif
#endif
}
#ifdef PAD_SYNC
if ((direction == SF_DL) || ((direction == SF_S) && (next_slot%2==0)) )
pad_synchronize();
#endif
// Call ETHERNET emulation here
//emu_transport (frame, last_slot, next_slot, direction, oai_emulation.info.frame_type, ethernet_flag);
if ((next_slot % 2) == 0)
clear_UE_transport_info (oai_emulation.info.nb_ue_local);
for (UE_id = oai_emulation.info.first_ue_local;
(UE_id < (oai_emulation.info.first_ue_local+oai_emulation.info.nb_ue_local)) && (oai_emulation.info.cli_start_ue[UE_id]==1);
UE_id++)
if (frame >= (UE_id * 20)) { // activate UE only after 20*UE_id frames so that different UEs turn on separately
LOG_D(EMU,"PHY procedures UE %d for frame %d, slot %d (subframe TX %d, RX %d)\n",
UE_id, frame, slot, next_slot >> 1,last_slot>>1);
if (PHY_vars_UE_g[UE_id]->UE_mode[0] != NOT_SYNCHED) {
if (frame>0) {
PHY_vars_UE_g[UE_id]->frame = frame;
//Application UE
#ifdef PAD_FINE
pad_inject_job(0, UE_id, frame, next_slot, last_slot, JT_OTG, oai_emulation.info.time_ms);
#else
update_otg_UE(UE_id + NB_eNB_INST, oai_emulation.info.time_ms);
#endif
//Access layer UE
if (frame % pdcp_period == 0) {
#ifdef PAD_FINE
pad_inject_job(0, UE_id, frame, next_slot, last_slot, JT_PDCP, oai_emulation.info.time_ms);
#else
pdcp_run(frame, 0, UE_id, 0);
#endif
}
//Phy/Mac layer UE
#ifdef PAD_FINE
pad_inject_job(0, UE_id, frame, next_slot, last_slot, JT_PHY_MAC, oai_emulation.info.time_ms);
#else
phy_procedures_UE_lte (last_slot, next_slot, PHY_vars_UE_g[UE_id], 0, abstraction_flag, normal_txrx, no_relay, NULL);
ue_data[UE_id]->tx_power_dBm = PHY_vars_UE_g[UE_id]->tx_power_dBm;
#endif
}
} else {
if (abstraction_flag==1) {
LOG_E(EMU, "sync not supported in abstraction mode (UE%d,mode%d)\n", UE_id, PHY_vars_UE_g[UE_id]->UE_mode[0]);
exit(-1);
}
if ((frame>0) && (last_slot == (LTE_SLOTS_PER_FRAME-2))) {
#ifdef PAD_FINE
pad_inject_job(0, UE_id, frame, next_slot, last_slot, JT_INIT_SYNC, oai_emulation.info.time_ms);
#else
initial_sync(PHY_vars_UE_g[UE_id],normal_txrx);
#endif
/* LONG write output comment DELETED here */
}
}
#ifdef PRINT_STATS
if(last_slot==2 && frame%10==0)
if (UE_stats_th[UE_id])
fprintf(UE_stats_th[UE_id],"%d %d\n",frame, PHY_vars_UE_g[UE_id]->bitrate[0]/1000);
if (UE_stats[UE_id]) {
len = dump_ue_stats (PHY_vars_UE_g[UE_id], stats_buffer, 0, normal_txrx, 0);
rewind (UE_stats[UE_id]);
fwrite (stats_buffer, 1, len, UE_stats[UE_id]);
fflush(UE_stats[UE_id]);
}
#endif
}
#ifdef PAD_SYNC
if ((direction == SF_UL) || ((direction == SF_S) && (next_slot%2==1)) )
pad_synchronize();
#endif
emu_transport (frame, last_slot, next_slot,direction, oai_emulation.info.frame_type, ethernet_flag);
if ((direction == SF_DL)|| (frame_parms->frame_type==0)) {
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
#ifdef PAD
pad_inject_job(0, UE_id, frame, next_slot, last_slot, JT_DL, oai_emulation.info.time_ms);
#else
do_DL_sig(r_re0,r_im0,r_re,r_im,s_re,s_im,eNB2UE,enb_data,ue_data,next_slot,abstraction_flag,frame_parms,UE_id);
#endif
}
}
if ((direction == SF_UL)|| (frame_parms->frame_type==0)) { //if ((subframe<2) || (subframe>4))
do_UL_sig(r_re0,r_im0,r_re,r_im,s_re,s_im,UE2eNB,enb_data,ue_data,next_slot,abstraction_flag,frame_parms,frame);
/*
int ccc;
fprintf(SINRpost,"SINRdb For eNB New Subframe : \n ");
for(ccc = 0 ; ccc<301; ccc++)
{
fprintf(SINRpost,"_ %f ", SINRpost_eff[ccc]);
}
fprintf(SINRpost,"SINRdb For eNB : %f \n ", SINRpost_eff[ccc]);
*/
}
if ((direction == SF_S)) {//it must be a special subframe
if (next_slot%2==0) {//DL part
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
#ifdef PAD
pad_inject_job(0, UE_id, frame, next_slot, last_slot, JT_DL, oai_emulation.info.time_ms);
#else
do_DL_sig(r_re0,r_im0,r_re,r_im,s_re,s_im,eNB2UE,enb_data,ue_data,next_slot,abstraction_flag,frame_parms,UE_id);
#endif
}
/*
for (aarx=0;aarx<UE2eNB[1][0]->nb_rx;aarx++)
for (aatx=0;aatx<UE2eNB[1][0]->nb_tx;aatx++)
for (k=0;k<UE2eNB[1][0]->channel_length;k++)
printf("SB(%d,%d,%d)->(%f,%f)\n",k,aarx,aatx,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].r,UE2eNB[1][0]->ch[aarx+(aatx*UE2eNB[1][0]->nb_rx)][k].i);
*/
} else { // UL part
/*#ifdef PAD
pthread_mutex_lock(&(pool->sync_lock));
while(pool->active != 0) {
pthread_cond_wait(&(pool->sync_notify), &(pool->sync_lock));
}
pthread_mutex_unlock(&(pool->sync_lock));
#endif*/
do_UL_sig(r_re0,r_im0,r_re,r_im,s_re,s_im,UE2eNB,enb_data,ue_data,next_slot,abstraction_flag,frame_parms,frame);
/*
int ccc;
fprintf(SINRpost,"SINRdb For eNB New Subframe : \n ");
for(ccc = 0 ; ccc<301; ccc++)
{
fprintf(SINRpost,"_ %f ", SINRpost_eff[ccc]);
}
fprintf(SINRpost,"SINRdb For eNB : %f \n ", SINRpost_eff[ccc]);
*/
}
}
if ((last_slot == 1) && (frame == 0)
&& (abstraction_flag == 0) && (oai_emulation.info.n_frames == 1)) {
write_output ("dlchan0.m", "dlch0",
&(PHY_vars_UE_g[0]->lte_ue_common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[0][0][0]),
(6 * (PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)), 1, 1);
write_output ("dlchan1.m", "dlch1",
&(PHY_vars_UE_g[0]->lte_ue_common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[1][0][0]),
(6 * (PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)), 1, 1);
write_output ("dlchan2.m", "dlch2",
&(PHY_vars_UE_g[0]->lte_ue_common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[2][0][0]),
(6 * (PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)), 1, 1);
write_output ("pbch_rxF_comp0.m", "pbch_comp0",
PHY_vars_UE_g[0]->lte_ue_pbch_vars[0]->rxdataF_comp[0], 6 * 12 * 4, 1, 1);
write_output ("pbch_rxF_llr.m", "pbch_llr",
PHY_vars_UE_g[0]->lte_ue_pbch_vars[0]->llr, (frame_parms->Ncp == 0) ? 1920 : 1728, 1, 4);
}
if (next_slot %2 == 0) {
clock_gettime (CLOCK_REALTIME, &time_spec);
time_last = time_now;
time_now = (unsigned long) time_spec.tv_nsec;
td = (int) (time_now - time_last);
if (td>0) {
td_avg = (int)(((K*(long)td) + (((1<<3)-K)*((long)td_avg)))>>3); // in us
LOG_T(EMU,"sleep frame %d, time_now %ldus,time_last %ldus,average time difference %ldns, CURRENT TIME DIFF %dus, avgerage difference from the target %dus\n",
frame, time_now,time_last,td_avg, td/1000,(td_avg-TARGET_SF_TIME_NS)/1000);
}
if (td_avg<(TARGET_SF_TIME_NS - SF_DEVIATION_OFFSET_NS)) {
sleep_time_us += SLEEP_STEP_US;
LOG_D(EMU,"Faster than realtime increase the avg sleep time for %d us, frame %d\n",
sleep_time_us,frame);
// LOG_D(EMU,"Faster than realtime increase the avg sleep time for %d us, frame %d, time_now %ldus,time_last %ldus,average time difference %ldns, CURRENT TIME DIFF %dus, avgerage difference from the target %dus\n", sleep_time_us,frame, time_now,time_last,td_avg, td/1000,(td_avg-TARGET_SF_TIME_NS)/1000);
} else if (td_avg > (TARGET_SF_TIME_NS + SF_DEVIATION_OFFSET_NS)) {
sleep_time_us-= SLEEP_STEP_US;
LOG_D(EMU,"Slower than realtime reduce the avg sleep time for %d us, frame %d, time_now\n",
sleep_time_us,frame);
//LOG_T(EMU,"Slower than realtime reduce the avg sleep time for %d us, frame %d, time_now %ldus,time_last %ldus,average time difference %ldns, CURRENT TIME DIFF %dus, avgerage difference from the target %dus\n", sleep_time_us,frame, time_now,time_last,td_avg, td/1000,(td_avg-TARGET_SF_TIME_NS)/1000);
}
} // end if next_slot%2
slot++;
if (slot == 20) { //Frame's Epilogue
frame++;
slot = 0;
// if n_frames not set by the user or is greater than max num frame then set adjust the frame counter
if ( (oai_emulation.info.n_frames_flag == 0) || (oai_emulation.info.n_frames >= 0xffff) ) {
frame %=(oai_emulation.info.n_frames-1);
}
oai_emulation.info.time_s += 0.01;
if ((frame>=1)&&(frame<=9)&&(abstraction_flag==0)) {
write_output("UEtxsig0.m","txs0", PHY_vars_UE_g[0]->lte_ue_common_vars.txdata[0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
sprintf(fname,"eNBtxsig%d.m",frame);
sprintf(vname,"txs%d",frame);
write_output(fname,vname, PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata[0][0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
write_output("eNBtxsigF0.m","txsF0",PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdataF[0][0],PHY_vars_eNB_g[0]->lte_frame_parms.symbols_per_tti*PHY_vars_eNB_g[0]->lte_frame_parms.ofdm_symbol_size,1,1);
write_output("UErxsig0.m","rxs0", PHY_vars_UE_g[0]->lte_ue_common_vars.rxdata[0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
write_output("eNBrxsig0.m","rxs0", PHY_vars_eNB_g[0]->lte_eNB_common_vars.rxdata[0][0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
}
#ifdef XFORMS
do_xforms();
#endif
// calibrate at the end of each frame if there is some time left
if((sleep_time_us > 0)&& (ethernet_flag ==0)) {
LOG_I(EMU,"[TIMING] Adjust average frame duration, sleep for %d us\n",sleep_time_us);
usleep(sleep_time_us);
sleep_time_us=0; // reset the timer, could be done per n SF
}
#ifdef SMBV
if ((frame == config_frames[0]) || (frame == config_frames[1]) || (frame == config_frames[2]) || (frame == config_frames[3])) {
smbv_frame_cnt++;
}
#endif
}
}
t = clock() - t;
printf("rrc Duration of the simulation: %f seconds\n",((float)t)/CLOCKS_PER_SEC);
fclose(SINRpost);
LOG_I(EMU,">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU Ending <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
free(otg_pdcp_buffer);
#ifdef SMBV
if (config_smbv) {
smbv_send_config (smbv_fname,smbv_ip);
}
#endif
//Perform KPI measurements
if (oai_emulation.info.otg_enabled==1)
kpi_gen();
#ifdef PAD
pad_finalize();
#endif
// relase all rx state
if (ethernet_flag == 1) {
emu_transport_release ();
}
if (abstraction_flag == 0) {
/*
#ifdef IFFT_FPGA
free(txdataF2[0]);
free(txdataF2[1]);
free(txdataF2);
free(txdata[0]);
free(txdata[1]);
free(txdata);
#endif
*/
for (i = 0; i < 2; i++) {
free (s_re[i]);
free (s_im[i]);
free (r_re[i]);
free (r_im[i]);
}
free (s_re);
free (s_im);
free (r_re);
free (r_im);
lte_sync_time_free ();
}
// pthread_join(sigth, NULL);
// added for PHY abstraction
if (oai_emulation.info.ocm_enabled == 1) {
for (eNB_id = 0; eNB_id < NUMBER_OF_eNB_MAX; eNB_id++)
free(enb_data[eNB_id]);
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++)
free(ue_data[UE_id]);
} //End of PHY abstraction changes
#ifdef OPENAIR2
mac_top_cleanup();
#endif
#ifdef PRINT_STATS
for(UE_id=0; UE_id<NB_UE_INST; UE_id++) {
if (UE_stats[UE_id])
fclose (UE_stats[UE_id]);
if(UE_stats_th[UE_id])
fclose (UE_stats_th[UE_id]);
}
if (eNB_stats)
fclose (eNB_stats);
if (eNB_avg_thr)
fclose (eNB_avg_thr);
if (eNB_l2_stats)
fclose (eNB_l2_stats);
#endif
// stop OMG
stop_mobility_generator(oai_emulation.info.omg_model_ue);//omg_param_list.mobility_type
#ifdef OPENAIR2
if (oai_emulation.info.omv_enabled == 1)
omv_end(pfd[1],omv_data);
#endif
if ((oai_emulation.info.ocm_enabled == 1) && (ethernet_flag == 0) && (ShaF != NULL))
destroyMat(ShaF,map1, map2);
if (opt_enabled == 1 )
terminate_opt();
if (oai_emulation.info.cli_enabled)
cli_server_cleanup();
//bring oai if down
terminate();
logClean();
VCD_SIGNAL_DUMPER_CLOSE();
//printf("FOR MAIN TIMES = %d &&&& OTG TIMES = %d <-> FOR TIMES = %d <-> IF TIMES = %d\n", for_main_times, otg_times, for_times, if_times);
}
//<<PAD>>//
void terminate(void)
{
int i;
char interfaceName[8];
for (i=0; i < NUMBER_OF_eNB_MAX+NUMBER_OF_UE_MAX; i++)
if (oai_emulation.info.oai_ifup[i]==1) {
sprintf(interfaceName, "oai%d", i);
bringInterfaceUp(interfaceName,0);
}
}
#ifdef OPENAIR2
int omv_write (int pfd, Node_list enb_node_list, Node_list ue_node_list, Data_Flow_Unit omv_data)
{
int i,j;
omv_data.end=0;
//omv_data.total_num_nodes = NB_UE_INST + NB_eNB_INST;
for (i=0; i<NB_eNB_INST; i++) {
if (enb_node_list != NULL) {
omv_data.geo[i].x = (enb_node_list->node->X_pos < 0.0)? 0.0 : enb_node_list->node->X_pos;
omv_data.geo[i].y = (enb_node_list->node->Y_pos < 0.0)? 0.0 : enb_node_list->node->Y_pos;
omv_data.geo[i].z = 1.0;
omv_data.geo[i].mobility_type = oai_emulation.info.omg_model_enb;
omv_data.geo[i].node_type = 0; //eNB
enb_node_list = enb_node_list->next;
omv_data.geo[i].Neighbors=0;
for (j=NB_eNB_INST; j< NB_UE_INST + NB_eNB_INST ; j++) {
if (is_UE_active(i,j - NB_eNB_INST ) == 1) {
omv_data.geo[i].Neighbor[omv_data.geo[i].Neighbors]= j;
omv_data.geo[i].Neighbors++;
LOG_D(OMG,"[eNB %d][UE %d] is_UE_active(i,j) %d geo (x%d, y%d) num neighbors %d\n", i,j-NB_eNB_INST, is_UE_active(i,j-NB_eNB_INST),
omv_data.geo[i].x, omv_data.geo[i].y, omv_data.geo[i].Neighbors);
}
}
}
}
for (i=NB_eNB_INST; i<NB_UE_INST+NB_eNB_INST; i++) {
if (ue_node_list != NULL) {
omv_data.geo[i].x = (ue_node_list->node->X_pos < 0.0) ? 0.0 : ue_node_list->node->X_pos;
omv_data.geo[i].y = (ue_node_list->node->Y_pos < 0.0) ? 0.0 : ue_node_list->node->Y_pos;
omv_data.geo[i].z = 1.0;
omv_data.geo[i].mobility_type = oai_emulation.info.omg_model_ue;
omv_data.geo[i].node_type = 1; //UE
//trial
omv_data.geo[i].state = 1;
omv_data.geo[i].rnti = 88;
omv_data.geo[i].connected_eNB = 0;
omv_data.geo[i].RSRP = 66;
omv_data.geo[i].RSRQ = 55;
omv_data.geo[i].Pathloss = 44;
omv_data.geo[i].RSSI[0] = 33;
omv_data.geo[i].RSSI[1] = 22;
omv_data.geo[i].RSSI[2] = 11;
ue_node_list = ue_node_list->next;
omv_data.geo[i].Neighbors=0;
for (j=0; j< NB_eNB_INST ; j++) {
if (is_UE_active(j,i-NB_eNB_INST) == 1) {
omv_data.geo[i].Neighbor[ omv_data.geo[i].Neighbors]=j;
omv_data.geo[i].Neighbors++;
LOG_D(OMG,"[UE %d][eNB %d] is_UE_active %d geo (x%d, y%d) num neighbors %d\n", i-NB_eNB_INST,j, is_UE_active(j,i-NB_eNB_INST),
omv_data.geo[i].x, omv_data.geo[i].y, omv_data.geo[i].Neighbors);
}
}
}
}
if( write( pfd, &omv_data, sizeof(struct Data_Flow_Unit) ) == -1 )
perror( "write omv failed" );
return 1;
}
void omv_end (int pfd, Data_Flow_Unit omv_data)
{
omv_data.end=1;
if( write( pfd, &omv_data, sizeof(struct Data_Flow_Unit) ) == -1 )
perror( "write omv failed" );
}
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/* Form definition file generated with fdesign. */
#include <forms.h>
#include <stdlib.h>
#include "phy_procedures_sim_form.h"
FD_phy_procedures_sim *create_form_phy_procedures_sim(void)
{
FL_OBJECT *obj;
FD_phy_procedures_sim *fdui = (FD_phy_procedures_sim *) fl_calloc(1, sizeof(*fdui));
fdui->phy_procedures_sim = fl_bgn_form(FL_NO_BOX, 640, 320);
obj = fl_add_box(FL_UP_BOX,0,0,640,320,"");
fdui->pusch_constellation = obj = fl_add_xyplot(FL_POINTS_XYPLOT,50,30,220,190,"PUSCH constellation");
fl_set_object_color(obj,FL_BLACK,FL_YELLOW);
fdui->pdsch_constellation = obj = fl_add_xyplot(FL_POINTS_XYPLOT,370,30,220,190,"PDSCH constellation");
fl_set_object_color(obj,FL_BLACK,FL_YELLOW);
fdui->ch00 = obj = fl_add_xyplot(FL_IMPULSE_XYPLOT,370,240,210,60,"CH00");
fl_set_object_color(obj,FL_BLACK,FL_YELLOW);
fl_end_form();
fdui->phy_procedures_sim->fdui = fdui;
return fdui;
}
/*---------------------------------------*/
Magic: 13000
Internal Form Definition File
(do not change)
Number of forms: 1
Unit of measure: FL_COORD_PIXEL
=============== FORM ===============
Name: phy_procedures_sim
Width: 640
Height: 320
Number of Objects: 4
--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 640 320
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
--------------------
class: FL_XYPLOT
type: POINTS_XYPLOT
box: 50 30 220 190
boxtype: FL_FLAT_BOX
colors: FL_BLACK FL_YELLOW
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_BLACK
label: PUSCH constellation
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: pusch_constellation
callback:
argument:
--------------------
class: FL_XYPLOT
type: POINTS_XYPLOT
box: 370 30 220 190
boxtype: FL_FLAT_BOX
colors: FL_BLACK FL_YELLOW
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_BLACK
label: PDSCH constellation
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: pdsch_constellation
callback:
argument:
--------------------
class: FL_XYPLOT
type: IMPULSE_XYPLOT
box: 370 240 210 60
boxtype: FL_FLAT_BOX
colors: FL_BLACK FL_YELLOW
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_BLACK
label: CH00
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: ch00
callback:
argument:
==============================
create_the_forms
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/** Header file generated with fdesign on Tue Jul 27 16:31:42 2010.**/
#ifndef FD_phy_procedures_sim_h_
#define FD_phy_procedures_sim_h_
/** Callbacks, globals and object handlers **/
/**** Forms and Objects ****/
typedef struct {
FL_FORM *phy_procedures_sim;
void *vdata;
char *cdata;
long ldata;
FL_OBJECT *pusch_constellation;
FL_OBJECT *pdsch_constellation;
FL_OBJECT *ch00;
} FD_phy_procedures_sim;
extern FD_phy_procedures_sim * create_form_phy_procedures_sim(void);
#endif /* FD_phy_procedures_sim_h_ */
function plot_results(tm)
data_abs = dlmread(sprintf('UE_stats_abs_th0_tx%d.txt',tm));
data = dlmread(sprintf('UE_stats_th0_tx%d.txt',tm));
figure
plot(data(:,1),data(:,2))
hold on
plot(data_abs(:,1),data_abs(:,2),'r')
title(sprintf('Average Throughput of System for TM %d',tm))
xlabel('Frames')
ylabel('Throughput [kbps]')
legend('Full PHY','PHY ABSTRACTION')
hold off
%figure
%[f x]=ecdf(data(:,2));
%plot(x,f);
%hold on
%[f x]=ecdf(data_abs(:,2));
%plot(x,f);
%hold off
% figure
% cdfplot(data(:,2));
% hold on
% cdfplot(data_abs(:,2));
% hold off
%data0 = dlmread(sprintf('UE_stats_th0_tx%d.txt',tm));
%if(users>1)
%data1 = dlmread(sprintf('UE_stats_th1_tx%d.txt',tm));
%data1_abs = dlmread(sprintf('UE_stats_abs_th1_tx%d.txt',tm));
%end
%data0_abs = dlmread(sprintf('UE_stats_abs_th0_tx%d.txt',tm));
%figure
%plot(data0(:,1),data0(:,2))
%hold on;
%plot(data0_abs(:,1),data0_abs(:,2),'r')
%title(sprintf('Instanteneous Throughput of UE 1 for TM %d',tm))
%xlabel('Frames')
%ylabel('Throughput [kbps]')
%legend('Full PHY','PHY ABSTRACTION')
%hold off
% figure
% [f x]=ecdf(data0(:,2));
% plot(x,f);
% hold on
% [f x]=ecdf(data0_abs(:,2));
% plot(x,f);
% hold off
%if(users>1)
%figure
%plot(data1(:,1),data1(:,2))
%hold on;
%plot(data1_abs(:,1),data1_abs(:,2),'r')
%title(sprintf('Instanteneous Throughput of UE 2 for TM %d',tm))
%xlabel('Frames')
%ylabel('Throughput [kbps]')
%legend('Full PHY','PHY ABSTRACTION')
%hold off
%end
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include <cblas.h>
#include "SIMULATION/TOOLS/sim.h"
#include "SIMULATION/RF/rf.h"
#include "PHY/types.h"
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
#include "PHY/phy_extern.h"
#include "oaisim_config.h"
#ifdef OPENAIR2
#include "LAYER2/MAC/mac.h"
#include "LAYER2/MAC/mac_extern.h"
#include "UTIL/LOG/log_if.h"
#include "UTIL/LOG/log_extern.h"
#include "RRC/LTE/rrc_extern.h"
#include "PHY_INTERFACE/phy_interface_extern.h"
#include "UTIL/OCG/OCG.h"
#include "UTIL/OMG/omg.h"
#include "UTIL/OPT/opt.h" // to test OPT
#endif
#include "oaisim.h"
#define PI 3.1416
#define Am 20
#define MCL (-70) /*minimum coupling loss (MCL) in dB*/
//double sinr[NUMBER_OF_eNB_MAX][2*25];
/*
extern double sinr_bler_map[MCS_COUNT][2][16];
extern double sinr_bler_map_up[MCS_COUNT][2][16];
double SINRpost_eff[301];
extern double MI_map_4qam[3][162];
extern double MI_map_16qam[3][197];
extern double MI_map_64qam[3][227];
*/
// Extract the positions of UE and ENB from the mobility model
void extract_position (node_list* input_node_list, node_desc_t **node_data, int nb_nodes)
{
int i;
for (i=0; i<nb_nodes; i++) {
if ((input_node_list != NULL) && (node_data[i] != NULL)) {
node_data[i]->x = input_node_list->node->x_pos;
if (node_data[i]->x <0.0)
node_data[i]->x = 0.0;
node_data[i]->y = input_node_list->node->y_pos;
if (node_data[i]->y <0.0)
node_data[i]->y = 0.0;
LOG_D(OCM, "extract_position: added node_data %d with position X: %f and Y: %f \n", i,input_node_list->node->x_pos, input_node_list->node->y_pos );
input_node_list = input_node_list->next;
} else {
LOG_E(OCM, "extract_position: Null pointer!!!\n");
//exit(-1);
}
}
}
void extract_position_fixed_enb (node_desc_t **node_data, int nb_nodes, frame_t frame)
{
int i;
for (i=0; i<nb_nodes; i++) {
if (i==0) {
node_data[i]->x = 0;
node_data[i]->y = 500;
} else if (i == 1 ) {
node_data[i]->x = 866;//
node_data[i]->y = 1000;
} else if (i == 2 ) {
node_data[i]->x = 866;
node_data[i]->y = 0;
}
}
}
void extract_position_fixed_ue (node_desc_t **node_data, int nb_nodes, frame_t frame)
{
int i;
if(frame<50)
for (i=0; i<nb_nodes; i++) {
if (i==0) {
node_data[i]->x = 2050;
node_data[i]->y = 1500;
} else {
node_data[i]->x = 2150;
node_data[i]->y = 1500;
}
}
else {
for (i=0; i<nb_nodes; i++) {
if (i==0) {
node_data[i]->x = 1856 - (frame - 49);
// if(node_data[i]->x > 2106)
// node_data[i]->x = 2106;
node_data[i]->y = 1813 + (frame - 49);
// if(node_data[i]->y < 1563)
// node_data[i]->y = 1563;
// if( node_data[i]->x == 2106)
// node_data[i]->x = 2106 - (frame - 49);
} else {
node_data[i]->x = 2106 - (frame - 49);
// if(node_data[i]->x < 1856)
// node_data[i]->x = 1856;
node_data[i]->y = 1563 + (frame - 49);
// if(node_data[i]->y < 1813)
// node_data[i]->y = 1813;
}
}
}
}
void init_ue(node_desc_t *ue_data, UE_Antenna ue_ant) //changed from node_struct
{
ue_data->n_sectors = 1;
ue_data->phi_rad = 2 * PI;
ue_data->ant_gain_dBi = ue_ant.antenna_gain_dBi;
ue_data->tx_power_dBm = ue_ant.tx_power_dBm;
ue_data->rx_noise_level = ue_ant.rx_noise_level_dB; //value in db
}
void init_enb(node_desc_t *enb_data, eNB_Antenna enb_ant) //changed from node_struct
{
int i;
double sect_angle[3]= {0,2*PI/3,4*PI/3};
enb_data->n_sectors = enb_ant.number_of_sectors;
for (i=0; i<enb_data->n_sectors; i++)
enb_data->alpha_rad[i] = sect_angle[i]; //enb_ant.alpha_rad[i];
enb_data->phi_rad = enb_ant.beam_width_dB;
enb_data->ant_gain_dBi = enb_ant.antenna_gain_dBi;
enb_data->tx_power_dBm = enb_ant.tx_power_dBm;
enb_data->rx_noise_level = enb_ant.rx_noise_level_dB;
}
void calc_path_loss(node_desc_t* enb_data, node_desc_t* ue_data, channel_desc_t *ch_desc, Environment_System_Config env_desc, double **Shad_Fad)
{
double dist;
double path_loss;
double gain_max;
double gain_sec[3];
double alpha, theta;
int count;
dist = sqrt(pow((enb_data->x - ue_data->x), 2) + pow((enb_data->y - ue_data->y), 2));
path_loss = env_desc.fading.free_space_model_parameters.pathloss_0_dB -
10*env_desc.fading.free_space_model_parameters.pathloss_exponent * log10(dist/1000);
LOG_D(OCM,"dist %f, Path loss %f\n",dist,ch_desc->path_loss_dB);
/* Calculating the angle in the range -pi to pi from the slope */
alpha = atan2((ue_data->y - enb_data->y),(ue_data->x - enb_data->x));
if (alpha < 0)
alpha += 2*PI;
//printf("angle in radians is %lf\n", ue_data[UE_id]->alpha_rad[eNB_id]);
ch_desc->aoa = alpha;
ch_desc->random_aoa = 0;
if (enb_data->n_sectors==1) //assume omnidirectional antenna
gain_max = 0;
else {
gain_max = -1000;
for(count = 0; count < enb_data->n_sectors; count++) {
theta = enb_data->alpha_rad[count] - alpha;
/* gain = -min(Am , 12 * (theta/theta_3dB)^2) */
gain_sec[count] = -(Am < (12 * pow((theta/enb_data->phi_rad),2)) ? Am : (12 * pow((theta/enb_data->phi_rad),2)));
if (gain_sec[count]>gain_max) //take the sector that we are closest too (or where the gain is maximum)
gain_max = gain_sec[count];
}
}
path_loss += enb_data->ant_gain_dBi + gain_max + ue_data->ant_gain_dBi;
if (Shad_Fad!=NULL)
path_loss += Shad_Fad[(int)ue_data->x][(int)ue_data->y];
ch_desc->path_loss_dB = MCL < path_loss ? MCL : path_loss;
//LOG_D(OCM,"x_coordinate\t%f\t,y_coordinate\t%f\t, path_loss %f\n",ue_data->x,ue_data->y,ch_desc->path_loss_dB);
}
void init_snr(channel_desc_t* eNB2UE, node_desc_t *enb_data, node_desc_t *ue_data, double* sinr_dB, double* N0, uint8_t transmission_mode, uint16_t q, uint8_t dl_power_off, uint16_t nb_rb)
{
double thermal_noise,abs_channel,channelx, channely,channelx_i, channely_i ;
int count;
int aarx,aatx;
uint8_t qq;
/* Thermal noise is calculated using 10log10(K*T*B) K = Boltzmann's constant T = room temperature B = bandwidth*/
thermal_noise = -174 + 10*log10(15000); //per RE; value in dBm
//for (aarx=0; aarx<eNB2UE->nb_rx; aarx++)
*N0 = thermal_noise + ue_data->rx_noise_level;
LOG_D(OCM,"Path loss %lf, noise (N0) %lf, signal %lf, snr %lf\n",
eNB2UE->path_loss_dB,
thermal_noise + ue_data->rx_noise_level,
enb_data->tx_power_dBm + eNB2UE->path_loss_dB,
enb_data->tx_power_dBm + eNB2UE->path_loss_dB - (thermal_noise + ue_data->rx_noise_level));
if(transmission_mode == 5 && dl_power_off==1)
transmission_mode = 6;
switch(transmission_mode) {
case 1:
//printf ("coupling factor is %lf\n", coupling);
for (count = 0; count < (12 * nb_rb); count++) {
sinr_dB[count] = enb_data->tx_power_dBm
+ eNB2UE->path_loss_dB
- (thermal_noise + ue_data->rx_noise_level)
+ 10 * log10 (pow(eNB2UE->chF[0][count].x, 2)
+ pow(eNB2UE->chF[0][count].y, 2));
//printf("sinr_dB[%d]: %1f\n",count,sinr_dB[count]);
//printf("Dl_link SNR for res. block %d is %lf\n", count, sinr[eNB_id][count]);
}
break;
case 2:
for (count = 0; count < (12 * nb_rb); count++) {
abs_channel=0;
for (aarx=0; aarx<eNB2UE->nb_rx; aarx++) {
for (aatx=0; aatx<eNB2UE->nb_tx; aatx++) {
abs_channel += (pow(eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x, 2) + pow(eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y, 2));
}
}
sinr_dB[count] = enb_data->tx_power_dBm
+ eNB2UE->path_loss_dB
- (thermal_noise + ue_data->rx_noise_level)
+ 10 * log10 (abs_channel/2);
// printf("sinr_dB[%d]: %1f\n",count,sinr_dB[count]);
}
break;
case 5:
for (count = 0; count < (12 * nb_rb); count++) {
channelx=0;
channely=0;
channelx_i=0;
channely_i=0;
qq = (q>>(((count/12)>>2)<<1))&3;
//printf("pmi_alloc %d: rb %d, pmi %d\n",q,count/12,qq);
// qq = q;
for (aarx=0; aarx<eNB2UE->nb_rx; aarx++) {
for (aatx=0; aatx<eNB2UE->nb_tx; aatx++) {
switch(qq) {
case 0:
if (channelx==0 || channely==0) {
channelx = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
channelx_i = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely_i = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
} else {
channelx += eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely += eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
channelx_i -= eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely_i -= eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
}
break;
case 1:
if (channelx==0 || channely==0) {
channelx = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
channelx_i = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely_i = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
} else {
channelx -= eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely -= eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
channelx_i += eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely_i += eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
}
break;
case 2:
if (channelx==0 || channely==0) {
channelx = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
channelx_i = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely_i = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
} else {
channelx -= eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
channely += eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channelx_i += eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
channely_i -= eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
}
break;
case 3:
if (channelx==0 || channely==0) {
channelx = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
channelx_i = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely_i = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
} else {
channelx += eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
channely -= eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channelx_i -= eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
channely_i += eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
}
break;
default:
LOG_E(EMU,"Problem in SINR Calculation for TM5 \n");
break;
}//switch(q)
}//aatx
}//aarx
/* sinr_dB[count] = enb_data->tx_power_dBm
+ eNB2UE->path_loss_dB
- (thermal_noise + ue_data->rx_noise_level)
+ 10 * log10 ((pow(channelx,2) + pow(channely,2))/2) - 10 * log10 ((pow(channelx_i,2) + pow(channely_i,2))/2);
*/
sinr_dB[count] = enb_data->tx_power_dBm
+ eNB2UE->path_loss_dB
- (thermal_noise + ue_data->rx_noise_level)
+ 10 * log10 ((pow(channelx,2) + pow(channely,2))) - 10 * log10 ((pow(channelx_i,2) + pow(channely_i,2))) - 3; // 3dB is subtracted as the tx_power_dBm is to be adjusted on per user basis
// printf("sinr_dB[%d]: %1f\n",count,sinr_dB[count]);
}
break;
case 6:
for (count = 0; count < (12 * nb_rb); count++) {
channelx=0;
channely=0;
qq = (q>>(((count/12)>>2)<<1))&3;
//printf("pmi_alloc %d: rb %d, pmi %d\n",q,count/12,qq);
// qq = q;
for (aarx=0; aarx<eNB2UE->nb_rx; aarx++) {
for (aatx=0; aatx<eNB2UE->nb_tx; aatx++) {
switch(qq) {
case 0:
if (channelx==0 || channely==0) {
channelx = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
} else {
channelx += eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely += eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
}
break;
case 1:
if (channelx==0 || channely==0) {
channelx = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
} else {
channelx -= eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely -= eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
}
break;
case 2:
if (channelx==0 || channely==0) {
channelx = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
} else {
channelx -= eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
channely += eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
}
break;
case 3:
if (channelx==0 || channely==0) {
channelx = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
channely = eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
} else {
channelx += eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].y;
channely -= eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][count].x;
}
break;
default:
LOG_E(EMU,"Problem in SINR Calculation for TM6 \n");
break;
}//switch(q)
}//aatx
}//aarx
sinr_dB[count] = enb_data->tx_power_dBm
+ eNB2UE->path_loss_dB
- (thermal_noise + ue_data->rx_noise_level)
+ 10 * log10 ((pow(channelx,2) + pow(channely,2))/2);
// printf("sinr_dB[%d]: %1f\n",count,sinr_dB[count]);
}
break;
default:
LOG_E(EMU,"Problem in SINR Initialization in sinr_sim.c\n");
break;
}//switch
}//function ends
void calculate_sinr(channel_desc_t* eNB2UE, node_desc_t *enb_data, node_desc_t *ue_data, double *sinr_dB, uint16_t nb_rb)
{
double sir, thermal_noise;
short count;
/* Thermal noise is calculated using 10log10(K*T*B) K = Boltzmann's constant T = room temperature B = bandwidth */
thermal_noise = -174 + 10*log10(15000); //per RE, value in dBm
for (count = 0; count < 12 * nb_rb; count++) {
sir = enb_data->tx_power_dBm
+ eNB2UE->path_loss_dB
- (thermal_noise + ue_data->rx_noise_level)
+ 10 * log10 (pow(eNB2UE->chF[0][count].x, 2)
+ pow(eNB2UE->chF[0][count].y, 2));
if (sir > 0)
sinr_dB[count] -= sir;
//printf("*****sinr% lf \n",sinr_dB[count]);
}
}
void get_beta_map()
{
char *file_path = NULL;
//int table_len = 0;
int t,u;
int mcs = 0;
char *sinr_bler;
char buffer[1000];
FILE *fp;
double perf_array[13];
file_path = (char*) malloc(512);
for (mcs = 0; mcs < MCS_COUNT; mcs++) {
snprintf( file_path, 512, "%s/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results/bler_tx1_chan18_nrx1_mcs%d.csv", getenv("OPENAIR1_DIR"), mcs );
fp = fopen(file_path,"r");
if (fp == NULL) {
LOG_E(OCM,"ERROR: Unable to open the file %s! Exitng.\n", file_path);
exit(-1);
}
// else {
if (fgets (buffer, 1000, fp) != NULL) {
if (fgets (buffer, 1000, fp) != NULL) {
table_length[mcs] = 0;
while (!feof (fp)) {
u = 0;
sinr_bler = strtok (buffer, ";");
while (sinr_bler != NULL) {
perf_array[u] = atof (sinr_bler);
u++;
sinr_bler = strtok (NULL, ";");
}
if ((perf_array[4] / perf_array[5]) < 1) {
sinr_bler_map[mcs][0][table_length[mcs]] = perf_array[0];
sinr_bler_map[mcs][1][table_length[mcs]] = (perf_array[4] / perf_array[5]);
table_length[mcs]++;
if (table_length[mcs]>MCS_TABLE_LENGTH_MAX) {
LOG_E(OCM,"Error reading MCS table. Increase MCS_TABLE_LENGTH_MAX (mcs %d)!\n",mcs);
exit(-1);
}
}
if (fgets (buffer, 1000, fp) != NULL) {
}
}
}
}
fclose(fp);
// }
LOG_D(OCM,"Print the table for mcs %d\n",mcs);
for (t = 0; t<table_length[mcs]; t++)
LOG_D(OCM,"%lf %lf \n ",sinr_bler_map[mcs][0][t],sinr_bler_map[mcs][1][t]);
}
free(file_path);
}
//this function reads and stores the Mutual information tables for the MIESM abstraction.
void get_MIESM_param()
{
char *file_path = NULL;
char buffer[10000];
FILE *fp;
int qam[3] = {4,16,64};
int q,cnt;
char *result = NULL;
int table_len=0;
int t;
file_path = (char*) malloc(512);
for (q=0; q<3; q++) {
sprintf(file_path,"%s/SIMU/USER/files/MI_%dqam.csv",getenv("OPENAIR_TARGETS"),qam[q]);
fp = fopen(file_path,"r");
if (fp == NULL) {
printf("ERROR: Unable to open the file %s\n", file_path);
exit(-1);
} else {
cnt=-1;
switch(qam[q]) {
case 4:
while (!feof(fp)) {
table_len =0;
cnt++;
if (fgets(buffer, 10000, fp) != NULL) {
result = strtok (buffer, ",");
while (result != NULL) {
MI_map_4qam[cnt][table_len] = atof (result);
result = strtok (NULL, ",");
table_len++;
}
}
}
for (t = 0; t < 162; t++) {
// MI_map_4Qam[0][t] = pow(10,0.1*(MI_map_4Qam[0][t]));
LOG_D(OCM, "MIESM 4QAM Table: %lf %lf %1f\n ",MI_map_4qam[0][t],MI_map_4qam[1][t], MI_map_4qam[2][t]);
// printf("MIESM 4QAM Table: %lf %lf %1f\n ",MI_map_4qam[0][t],MI_map_4qam[1][t], MI_map_4qam[2][t]);
}
break;
case 16:
while (!feof(fp)) {
table_len =0;
cnt++;
if (fgets (buffer, 10000, fp) != NULL) {
result = strtok (buffer, ",");
while (result != NULL) {
MI_map_16qam[cnt][table_len] = atof (result);
result = strtok (NULL, ",");
table_len++;
}
}
}
for (t = 0; t < 197; t++) {
// MI_map_16Qam[0][t] = pow(10,0.1*(MI_map_16Qam[0][t]));
LOG_D(OCM, "MIESM 16 QAM Table: %lf %lf %1f\n ",MI_map_16qam[0][t],MI_map_16qam[1][t], MI_map_16qam[2][t]);
// printf("MIESM 16 QAM Table: %lf %lf %1f\n ",MI_map_16qam[0][t],MI_map_16qam[1][t], MI_map_16qam[2][t]);
}
break;
case 64:
while (!feof(fp)) {
table_len=0;
cnt++;
if(cnt==3)
break;
if (fgets (buffer, 10000, fp) != NULL) {
result = strtok(buffer, ",");
while (result != NULL) {
MI_map_64qam[cnt][table_len]= atof(result);
result = strtok(NULL, ",");
table_len++;
}
}
}
for (t = 0; t < 227; t++) {
//MI_map_64Qam[0][t] = pow(10,0.1*(MI_map_64Qam[0][t]));
LOG_D(OCM, "MIESM 64QAM Table: %lf %lf %1f\n ",MI_map_64qam[0][t],MI_map_64qam[1][t], MI_map_64qam[2][t]);
// printf("MIESM 64QAM Table: %lf %lf %1f\n ",MI_map_64qam[0][t],MI_map_64qam[1][t], MI_map_64qam[2][t]);
}
break;
default:
LOG_E(EMU,"Error, bad input, quitting\n");
break;
}
}
fclose(fp);
}
free(file_path);
}
/*
* Copyright (c) 2011, Mathias Brossard <mathias@brossard.org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file threadpool.c
* @brief Threadpool implementation file
*/
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include "oaisim.h"
#include "UTIL/OCG/OCG_extern.h"
#include "UTIL/FIFO/pad_list.h"
#include "threadpool.h"
extern uint8_t abstraction_flag;
extern Signal_buffers *signal_buffers_g;
extern channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
extern channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX];
extern node_desc_t *enb_data[NUMBER_OF_eNB_MAX];
extern node_desc_t *ue_data[NUMBER_OF_UE_MAX];
extern LTE_DL_FRAME_PARMS *frame_parms;
/**
* @function void *threadpool_thread(void *threadpool)
* @brief the worker thread
* @param threadpool the pool which own the thread
*/
void *threadpool_thread(void *threadpool);
int threadpool_free(threadpool_t *pool);
threadpool_t *threadpool_create(int thread_count)
{
threadpool_t *pool;
int i;
/* TODO: Check for negative or otherwise very big input parameters */
if((pool = (threadpool_t *)malloc(sizeof(threadpool_t))) == NULL) {
goto err;
}
// memset
/* Initialize */
pool->thread_count = thread_count;
job_list_init(&(pool->job_queue));
pool->shutdown = pool->started = pool->active = 0;
/* Allocate thread and task queue */
pool->threads = (pthread_t *)malloc(sizeof (pthread_t) * thread_count);
// memset
/* Initialize mutex and conditional variable first */
if((pthread_mutex_init(&(pool->lock), NULL) != 0) ||
(pthread_mutex_init(&(pool->sync_lock), NULL) != 0) ||
(pthread_cond_init(&(pool->notify), NULL) != 0) ||
(pthread_cond_init(&(pool->sync_notify), NULL) != 0) ||
(pool->threads == NULL)) {
goto err;
}
/* Start worker threads */
for(i = 0; i < thread_count; i++) {
if(pthread_create(&(pool->threads[i]), NULL,
threadpool_thread, (void*)pool) != 0) {
threadpool_destroy(pool);
return NULL;
} else {
pool->started++;
}
}
return pool;
err:
if(pool) {
threadpool_free(pool);
}
return NULL;
}
int threadpool_add(threadpool_t *pool, Job_elt *job)
{
int err = 0;
if(pool == NULL || job == NULL) {
return threadpool_invalid;
}
if(pthread_mutex_lock(&(pool->lock)) != 0) {
return threadpool_lock_failure;
}
do {
/* Are we shutting down ? */
if(pool->shutdown) {
err = threadpool_shutdown;
break;
}
/* Add task to queue */
job_list_add_tail_eurecom(job, &(pool->job_queue));
/* pthread_cond_broadcast */
if(pthread_cond_signal(&(pool->notify)) != 0) {
err = threadpool_lock_failure;
break;
}
} while(0);
if(pthread_mutex_unlock(&pool->lock) != 0) {
err = threadpool_lock_failure;
}
return err;
}
int threadpool_destroy(threadpool_t *pool)
{
int i, err = 0;
if(pool == NULL) {
return threadpool_invalid;
}
if(pthread_mutex_lock(&(pool->lock)) != 0) {
return threadpool_lock_failure;
}
do {
/* Already shutting down */
if(pool->shutdown) {
err = threadpool_shutdown;
break;
}
pool->shutdown = 1;
/* Wake up all worker threads */
if((pthread_cond_broadcast(&(pool->notify)) != 0) ||
(pthread_mutex_unlock(&(pool->lock)) != 0)) {
err = threadpool_lock_failure;
break;
}
/* Join all worker thread */
for(i = 0; i < pool->thread_count; i++) {
if(pthread_join(pool->threads[i], NULL) != 0) {
err = threadpool_thread_failure;
}
}
} while(0);
if(pthread_mutex_unlock(&pool->lock) != 0) {
err = threadpool_lock_failure;
}
/* Only if everything went well do we deallocate the pool */
if(!err) {
threadpool_free(pool);
}
return err;
}
int threadpool_free(threadpool_t *pool)
{
if(pool == NULL || pool->started > 0) {
return -1;
}
/* Did we manage to allocate ? */
if(pool->threads) {
free(pool->threads);
job_list_free (&(pool->job_queue));
/* Because we allocate pool->threads after initializing the
mutex and condition variable, we're sure they're
initialized. Let's lock the mutex just in case. */
pthread_mutex_lock(&(pool->lock));
pthread_mutex_destroy(&(pool->lock));
pthread_mutex_destroy(&(pool->sync_lock));
pthread_cond_destroy(&(pool->notify));
pthread_cond_destroy(&(pool->sync_notify));
}
free(pool);
return 0;
}
void *threadpool_thread(void *threadpool)
{
threadpool_t *pool = (threadpool_t *)threadpool;
Job_elt * job_elt;
int err;
printf("The ID of this thread is: %u\n", (unsigned int)pthread_self());
for(;;) {
/* Lock must be taken to wait on conditional variable */
pthread_mutex_lock(&(pool->lock));
/* Wait on condition variable, check for spurious wakeups.
When returning from pthread_cond_wait(), we own the lock. */
while(((pool->job_queue).nb_elements == 0) && (!pool->shutdown)) {
pthread_cond_wait(&(pool->notify), &(pool->lock));
}
if(pool->shutdown) {
break;
}
/* Grab our task */
job_elt = job_list_remove_head(&(pool->job_queue));
if((err = pthread_mutex_lock(&(pool->sync_lock))) != 0) {
printf("Mutex Error \n");
return err;
}
pool->active++;
if((err = pthread_mutex_unlock(&pool->sync_lock)) != 0) {
printf("Mutex Error \n");
return err;
}
/* Unlock */
pthread_mutex_unlock(&(pool->lock));
/* Get to work */
switch((job_elt->job).type) {
case JT_OTG:
if ((job_elt->job).eNB_flag)
update_otg_eNB((job_elt->job).nid, (unsigned int) oai_emulation.info.time_ms);
else
update_otg_UE((job_elt->job).nid, (unsigned int) oai_emulation.info.time_ms);
break;
case JT_PDCP://do not forget adding flag enb
if ((job_elt->job).eNB_flag)
pdcp_run(frame, 1, 0, (job_elt->job).nid);
else
pdcp_run(frame, 0, (job_elt->job).nid, 0);
break;
case JT_PHY_MAC:
if ((job_elt->job).eNB_flag)
phy_procedures_eNB_lte ((job_elt->job).last_slot, (job_elt->job).next_slot, PHY_vars_eNB_g[(job_elt->job).nid], abstraction_flag);
else
phy_procedures_UE_lte ((job_elt->job).last_slot, (job_elt->job).next_slot, PHY_vars_UE_g[(job_elt->job).nid], 0, abstraction_flag, normal_txrx);
ue_data[(job_elt->job).nid]->tx_power_dBm = PHY_vars_UE_g[(job_elt->job).nid]->tx_power_dBm;
break;
case JT_INIT_SYNC:
initial_sync(PHY_vars_UE_g[(job_elt->job).nid],normal_txrx);
break;
case JT_DL:
do_DL_sig(signal_buffers_g[(job_elt->job).nid].r_re0,signal_buffers_g[(job_elt->job).nid].r_im0,signal_buffers_g[(job_elt->job).nid].r_re,signal_buffers_g[(job_elt->job).nid].r_im,
signal_buffers_g[(job_elt->job).nid].s_re,signal_buffers_g[(job_elt->job).nid].s_im,eNB2UE,enb_data,ue_data,(job_elt->job).next_slot,abstraction_flag,
frame_parms,(job_elt->job).nid);
break;
case JT_UL:
do_UL_sig(signal_buffers_g[(job_elt->job).nid].r_re0,signal_buffers_g[(job_elt->job).nid].r_im0,signal_buffers_g[(job_elt->job).nid].r_re,signal_buffers_g[(job_elt->job).nid].r_im,
signal_buffers_g[(job_elt->job).nid].s_re,signal_buffers_g[(job_elt->job).nid].s_im,UE2eNB,enb_data,ue_data,(job_elt->job).next_slot,abstraction_flag,
frame_parms,frame);
break;
}
if((err = pthread_mutex_lock(&(pool->sync_lock))) != 0) {
printf("Mutex Error \n");
return err;
}
pool->active--;
if ((pool->active <= 0) && ((pool->job_queue).nb_elements == 0)) {
pool->active=0;
if(pthread_cond_signal(&(pool->sync_notify)) != 0) {
printf("Condition Error \n");
break;
}
}
if((err = pthread_mutex_unlock(&pool->sync_lock)) != 0) {
printf("Mutex Error \n");
return err;
}
}
pool->started--;
pthread_mutex_unlock(&(pool->lock));
pthread_exit(NULL);
return(NULL);
}
/*
* Copyright (c) 2011, Mathias Brossard <mathias@brossard.org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _THREADPOOL_H_
#define _THREADPOOL_H_
/**
* @file threadpool.h
* @brief Threadpool Header file
*/
/**
* @struct threadpool
* @brief The threadpool struct
*
* @var notify Condition variable to notify worker threads.
* @var threads Array containing worker threads ID.
* @var thread_count Number of threads
* @var job_queue Array containing the task queue.
* @var shutdown Flag indicating if the pool is shutting down
*/
struct threadpool_t {
pthread_mutex_t lock; // used to get / put a job in the queue, protect job_queue
pthread_mutex_t sync_lock; // used when there is a dependancy between two consecutive jobs, protect active
pthread_cond_t notify; // wakup threads
pthread_cond_t sync_notify; // last worker sends this
pthread_t *threads;
Job_List job_queue;
int thread_count;
int count; // ????
int shutdown; // end of sim/emu
int started; // total number of thread started , after init: started == count
int active; // num active threads
};
typedef struct threadpool_t threadpool_t;
typedef enum {
threadpool_invalid = -1,
threadpool_lock_failure = -2,
threadpool_queue_full = -3,
threadpool_shutdown = -4,
threadpool_thread_failure = -5
} threadpool_error_t;
/**
* @function threadpool_create
* @brief Creates a threadpool_t object.
* @param thread_count Number of worker threads.
* @param queue_size Size of the queue.
* @param flags Unused parameter.
* @return a newly created thread pool or NULL
*/
threadpool_t *threadpool_create(int thread_count);
/**
* @function threadpool_add
* @brief add a new task in the queue of a thread pool
* @param pool Thread pool to which add the task.
* @param function Pointer to the function that will perform the task.
* @param argument Argument to be passed to the function.
* @param flags Unused parameter.
* @return 0 if all goes well, negative values in case of error (@see
* threadpool_error_t for codes).
*/
int threadpool_add(threadpool_t *pool, Job_elt *job);
/**
* @function threadpool_destroy
* @brief Stops and destroys a thread pool.
* @param pool Thread pool to destroy.
* @param flags Unused parameter.
*/
int threadpool_destroy(threadpool_t *pool);
#endif /* _THREADPOOL_H_ */
#!/bin/sh
valgrind --tool=memcheck --leak-check=full --show-reachable=yes --num-callers=20 --track-origins=yes --track-fds=yes ./oaisim -b1 -u1 -F -n100 2>leakage
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment