Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG UE
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Michael Black
OpenXG UE
Commits
c2e7d80b
Commit
c2e7d80b
authored
Jul 28, 2020
by
frtabu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add telnet commands to show and modify channel simulation parameters
parent
8f28d4d5
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
147 additions
and
24 deletions
+147
-24
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+2
-2
cmake_targets/build_oai
cmake_targets/build_oai
+1
-1
executables/nr-softmodem.c
executables/nr-softmodem.c
+1
-1
executables/nr-uesoftmodem.c
executables/nr-uesoftmodem.c
+1
-4
openair1/PHY/TOOLS/nr_phy_scope.c
openair1/PHY/TOOLS/nr_phy_scope.c
+14
-2
openair1/SIMULATION/TOOLS/random_channel.c
openair1/SIMULATION/TOOLS/random_channel.c
+113
-8
openair1/SIMULATION/TOOLS/sim.h
openair1/SIMULATION/TOOLS/sim.h
+7
-2
targets/ARCH/rfsimulator/simulator.c
targets/ARCH/rfsimulator/simulator.c
+8
-4
No files found.
cmake_targets/CMakeLists.txt
View file @
c2e7d80b
...
...
@@ -2473,8 +2473,8 @@ add_library(uescope MODULE ${XFORMS_SOURCE} ${XFORMS_SOURCE_SOFTMODEM} ${XFORMS_
target_link_libraries
(
enbscope
${
XFORMS_LIBRARIES
}
)
target_link_libraries
(
uescope
${
XFORMS_LIBRARIES
}
)
add_library
(
gnb
scope MODULE
${
XFORMS_SOURCE_NR
}
)
target_link_libraries
(
gnb
scope
${
XFORMS_LIBRARIES
}
)
add_library
(
nr
scope MODULE
${
XFORMS_SOURCE_NR
}
)
target_link_libraries
(
nr
scope
${
XFORMS_LIBRARIES
}
)
add_library
(
rfsimulator MODULE
...
...
cmake_targets/build_oai
View file @
c2e7d80b
...
...
@@ -67,7 +67,7 @@ UE_TIMING_TRACE="False"
USRP_REC_PLAY
=
"False"
BUILD_ECLIPSE
=
0
NR
=
"False"
OPTIONAL_LIBRARIES
=
"telnetsrv enbscope uescope msc"
OPTIONAL_LIBRARIES
=
"telnetsrv enbscope uescope
nrscope
msc"
trap
handle_ctrl_c INT
function
print_help
()
{
...
...
executables/nr-softmodem.c
View file @
c2e7d80b
...
...
@@ -968,7 +968,7 @@ if(!IS_SOFTMODEM_NOS1)
p
.
argv
=
argv
;
p
.
gNB
=
RC
.
gNB
[
0
];
p
.
ru
=
RC
.
ru
[
0
];
load_softscope
(
"
gnb
"
,
&
p
);
load_softscope
(
"
nr
"
,
&
p
);
}
if
(
nfapi_mode
!=
1
&&
nfapi_mode
!=
2
)
{
...
...
executables/nr-uesoftmodem.c
View file @
c2e7d80b
...
...
@@ -152,9 +152,6 @@ char ref[128] = "internal";
char
channels
[
128
]
=
"0"
;
static
char
*
parallel_config
=
NULL
;
static
char
*
worker_config
=
NULL
;
int
rx_input_level_dBm
;
//static int online_log_messages=0;
...
...
@@ -764,7 +761,7 @@ int main( int argc, char **argv ) {
mlockall
(
MCL_CURRENT
|
MCL_FUTURE
);
if
(
IS_SOFTMODEM_DOFORMS
)
{
load_softscope
(
"
gnb
"
,
PHY_vars_UE_g
[
0
][
0
]);
load_softscope
(
"
nr
"
,
PHY_vars_UE_g
[
0
][
0
]);
}
number_of_cards
=
1
;
...
...
openair1/PHY/TOOLS/nr_phy_scope.c
View file @
c2e7d80b
...
...
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include "nr_phy_scope.h"
#include "executables/nr-softmodem-common.h"
#include "executables/softmodem-common.h"
#include <forms.h>
#define TPUT_WINDOW_LENGTH 100
...
...
@@ -416,7 +417,7 @@ static void *scope_thread_gNB(void *arg) {
return
NULL
;
}
void
g
nbscope_autoinit
(
scopeParms_t
*
p
)
{
void
g
NBinitScope
(
scopeParms_t
*
p
)
{
static
scopeParms_t
parms
;
memcpy
(
&
parms
,
p
,
sizeof
(
parms
));
pthread_t
forms_thread
;
...
...
@@ -763,11 +764,20 @@ static void *nrUEscopeThread(void *arg) {
pthread_exit
((
void
*
)
arg
);
}
void
nr
uescope_autoinit
(
PHY_VARS_NR_UE
*
ue
)
{
void
nr
UEinitScope
(
PHY_VARS_NR_UE
*
ue
)
{
pthread_t
forms_thread
;
threadCreate
(
&
forms_thread
,
nrUEscopeThread
,
ue
,
"scope"
,
-
1
,
OAI_PRIORITY_RT_LOW
);
}
void
nrscope_autoinit
(
void
*
dataptr
)
{
AssertFatal
(
(
IS_SOFTMODEM_GNB_BIT
||
IS_SOFTMODEM_5GUE_BIT
),
"Scope cannot find NRUE or GNB context"
);
if
(
IS_SOFTMODEM_GNB_BIT
)
gNBinitScope
(
dataptr
);
else
nrUEinitScope
(
dataptr
);
}
// Kept to put back the functionality soon
#if 0
//FD_stats_form *form_stats=NULL,*form_stats_l2=NULL;
...
...
@@ -795,6 +805,8 @@ static void reset_stats_gNB(FL_OBJECT *button,
}
}
static FD_stats_form *create_form_stats_form(int ID) {
FL_OBJECT *obj;
FD_stats_form *fdui = calloc(( sizeof *fdui ),1);
...
...
openair1/SIMULATION/TOOLS/random_channel.c
View file @
c2e7d80b
...
...
@@ -45,8 +45,10 @@ static mapping channelmod_names[] = {
};
static
int
channelmod_show_cmd
(
char
*
buff
,
int
debug
,
telnet_printfunc_t
prnt
);
static
int
channelmod_modify_cmd
(
char
*
buff
,
int
debug
,
telnet_printfunc_t
prnt
);
static
telnetshell_cmddef_t
channelmod_cmdarray
[]
=
{
{
"show"
,
""
,
channelmod_show_cmd
},
{
"show"
,
"<predef,current>"
,
channelmod_show_cmd
},
{
"modify"
,
"<channelid> <param> <value>"
,
channelmod_modify_cmd
},
{
""
,
""
,
NULL
},
};
...
...
@@ -56,7 +58,8 @@ static telnetshell_vardef_t channelmod_vardef[] = {
static
double
snr_dB
=
25
;
static
double
sinr_dB
=
0
;
static
unsigned
int
max_chan
;
static
channel_desc_t
**
defined_channels
;
void
fill_channel_desc
(
channel_desc_t
*
chan_desc
,
uint8_t
nb_tx
,
uint8_t
nb_rx
,
...
...
@@ -281,10 +284,22 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
int32_t
channel_offset
,
double
path_loss_dB
)
{
channel_desc_t
*
chan_desc
=
(
channel_desc_t
*
)
malloc
(
sizeof
(
channel_desc_t
));
for
(
int
i
=
0
;
i
<
max_chan
;
i
++
)
{
if
(
defined_channels
[
i
]
==
NULL
)
{
defined_channels
[
i
]
=
chan_desc
;
chan_desc
->
chan_idx
=
i
;
break
;
}
else
{
AssertFatal
(
i
<
(
max_chan
-
1
),
"No more channel descriptors available, increase channelmod.max_chan parameter above %u
\n
"
,
max_chan
);
}
}
uint16_t
i
,
j
;
double
sum_amps
;
double
aoa
,
ricean_factor
,
Td
,
maxDoppler
;
int
channel_length
,
nb_taps
;
chan_desc
->
modelid
=
channel_model
;
chan_desc
->
nb_tx
=
nb_tx
;
chan_desc
->
nb_rx
=
nb_rx
;
chan_desc
->
sampling_rate
=
sampling_rate
;
...
...
@@ -1295,6 +1310,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
void
free_channel_desc_scm
(
channel_desc_t
*
ch
)
{
// Must be made cleanly, a lot of leaks...
defined_channels
[
ch
->
chan_idx
]
=
NULL
;
free
(
ch
);
}
...
...
@@ -1408,11 +1424,11 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
desc
->
ch
[
aarx
+
(
aatx
*
desc
->
nb_rx
)][
k
].
y
=
0
.
0
;
for
(
l
=
0
;
l
<
desc
->
nb_taps
;
l
++
)
{
if
((
k
-
(
desc
->
delays
[
l
]
*
desc
->
sampling_rate
)
-
NB_SAMPLES_CHANNEL_OFFSET
)
==
0
)
if
((
k
-
(
desc
->
delays
[
l
]
*
desc
->
sampling_rate
)
-
desc
->
channel_offset
)
==
0
)
s
=
1
.
0
;
else
s
=
sin
(
M_PI
*
(
k
-
(
desc
->
delays
[
l
]
*
desc
->
sampling_rate
)
-
NB_SAMPLES_CHANNEL_OFFSET
))
/
(
M_PI
*
(
k
-
(
desc
->
delays
[
l
]
*
desc
->
sampling_rate
)
-
NB_SAMPLES_CHANNEL_OFFSET
));
s
=
sin
(
M_PI
*
(
k
-
(
desc
->
delays
[
l
]
*
desc
->
sampling_rate
)
-
desc
->
channel_offset
))
/
(
M_PI
*
(
k
-
(
desc
->
delays
[
l
]
*
desc
->
sampling_rate
)
-
desc
->
channel_offset
));
desc
->
ch
[
aarx
+
(
aatx
*
desc
->
nb_rx
)][
k
].
x
+=
s
*
desc
->
a
[
l
][
aarx
+
(
aatx
*
desc
->
nb_rx
)].
x
;
desc
->
ch
[
aarx
+
(
aatx
*
desc
->
nb_rx
)][
k
].
y
+=
s
*
desc
->
a
[
l
][
aarx
+
(
aatx
*
desc
->
nb_rx
)].
y
;
...
...
@@ -1491,13 +1507,99 @@ double N_RB2channel_bandwidth(uint16_t N_RB) {
return
(
channel_bandwidth
);
}
static
void
display_channelmodel_help
(
telnet_printfunc_t
prnt
)
{
}
static
void
display_channelmodel
(
channel_desc_t
*
cd
,
int
debug
,
telnet_printfunc_t
prnt
)
{
prnt
(
"nb_tx: %i nb_rx: %i taps: %i bandwidth: %lf sampling: %lf
\n
"
,
cd
->
nb_tx
,
cd
->
nb_rx
,
cd
->
nb_taps
,
cd
->
channel_bandwidth
,
cd
->
sampling_rate
);
prnt
(
"channel length: %i Max path delay: %lf ricean fact.: %lf angle of arrival: %lf (randomized:%s)
\n
"
,
cd
->
channel_length
,
cd
->
Td
,
cd
->
ricean_factor
,
cd
->
aoa
,
(
cd
->
random_aoa
?
"Yes"
:
"No"
));
prnt
(
"max Doppler: %lf path loss: %lf rchannel offset: %i forget factor; %lf
\n
"
,
cd
->
max_Doppler
,
cd
->
path_loss_dB
,
cd
->
channel_offset
,
cd
->
forgetting_factor
);
prnt
(
"Initial phase: %lf nb_path: %i
\n
"
,
cd
->
ip
,
cd
->
nb_paths
);
for
(
int
i
=
0
;
i
<
cd
->
nb_taps
;
i
++
)
{
prnt
(
"taps: %i lin. ampli. : %lf delay: %lf
\n
"
,
i
,
cd
->
amps
[
i
],
cd
->
delays
[
i
]);
}
}
static
int
channelmod_show_cmd
(
char
*
buff
,
int
debug
,
telnet_printfunc_t
prnt
)
{
for
(
int
i
=
0
;
channelmod_names
[
i
].
name
!=
NULL
;
i
++
)
{
prnt
(
" %i %s
\n
"
,
i
,
map_int_to_str
(
channelmod_names
,
i
));
char
*
subcmd
=
NULL
;
int
s
=
sscanf
(
buff
,
"%ms
\n
"
,
&
subcmd
);
if
(
s
>
0
)
{
if
(
strcmp
(
subcmd
,
"predef"
)
==
0
)
{
for
(
int
i
=
0
;
channelmod_names
[
i
].
name
!=
NULL
;
i
++
)
{
prnt
(
" %i %s
\n
"
,
i
,
map_int_to_str
(
channelmod_names
,
i
));
}
}
else
if
(
strcmp
(
subcmd
,
"current"
)
==
0
)
{
for
(
int
i
=
0
;
i
<
max_chan
;
i
++
)
{
if
(
defined_channels
[
i
]
!=
NULL
)
{
prnt
(
"model %i %s:
\n
----------------
\n
"
,
i
,
map_int_to_str
(
channelmod_names
,
defined_channels
[
i
]
->
modelid
));
display_channelmodel
(
defined_channels
[
i
],
debug
,
prnt
);
}
}
}
else
{
display_channelmodel_help
(
prnt
);
}
free
(
subcmd
);
}
return
CMDSTATUS_FOUND
;
}
return
0
;
static
int
channelmod_modify_cmd
(
char
*
buff
,
int
debug
,
telnet_printfunc_t
prnt
)
{
char
*
param
=
NULL
,
*
value
=
NULL
;
int
cd_id
=
-
1
;
int
s
=
sscanf
(
buff
,
"%i %ms %ms
\n
"
,
&
cd_id
,
&
param
,
&
value
);
if
(
cd_id
<
0
||
cd_id
>=
max_chan
)
{
prnt
(
"ERROR, %i: Channel model id outof range (0-%i)
\n
"
,
cd_id
,
max_chan
-
1
);
return
CMDSTATUS_FOUND
;
}
if
(
defined_channels
[
cd_id
]
==
NULL
)
{
prnt
(
"ERROR, %i: Channel model has not been set
\n
"
,
cd_id
);
return
CMDSTATUS_FOUND
;
}
if
(
s
==
3
)
{
if
(
strcmp
(
param
,
"riceanf"
)
==
0
)
{
double
dbl
=
atof
(
value
);
if
(
dbl
<
0
||
dbl
>
1
)
prnt
(
"ricean factor range: 0 to 1, %lf is outof range
\n
"
,
dbl
);
else
defined_channels
[
cd_id
]
->
ricean_factor
=
dbl
;
}
else
if
(
strcmp
(
param
,
"aoa"
)
==
0
)
{
double
dbl
=
atof
(
value
);
if
(
dbl
<
0
||
dbl
>
6
.
28
)
prnt
(
"angle of arrival range: 0 to 2*Pi, %lf is outof range
\n
"
,
dbl
);
else
defined_channels
[
cd_id
]
->
aoa
=
dbl
;
}
else
if
(
strcmp
(
param
,
"ploss"
)
==
0
)
{
double
dbl
=
atof
(
value
);
defined_channels
[
cd_id
]
->
path_loss_dB
=
dbl
;
}
else
if
(
strcmp
(
param
,
"offset"
)
==
0
)
{
int
i
=
atoi
(
value
);
defined_channels
[
cd_id
]
->
channel_offset
=
i
;
}
else
if
(
strcmp
(
param
,
"forgetf"
)
==
0
)
{
double
dbl
=
atof
(
value
);
if
(
dbl
<
0
||
dbl
>
1
)
prnt
(
"forgetting factor range: 0 to 1 (disable variation), %lf is outof range
\n
"
,
dbl
);
else
defined_channels
[
cd_id
]
->
forgetting_factor
=
dbl
;
}
else
{
}
display_channelmodel
(
defined_channels
[
cd_id
],
debug
,
prnt
);
free
(
param
);
free
(
value
);
}
return
CMDSTATUS_FOUND
;
}
int
modelid_fromname
(
char
*
modelname
)
{
...
...
@@ -1519,6 +1621,9 @@ void init_channelmod(void) {
paramdef_t
channelmod_params
[]
=
CHANNELMOD_PARAMS_DESC
;
int
ret
=
config_get
(
channelmod_params
,
sizeof
(
channelmod_params
)
/
sizeof
(
paramdef_t
),
CHANNELMOD_SECTION
);
AssertFatal
(
ret
>=
0
,
"configuration couldn't be performed"
);
defined_channels
=
calloc
(
max_chan
,
sizeof
(
channel_desc_t
*
));
AssertFatal
(
defined_channels
!=
NULL
,
"couldn't allocate %u channel descriptors
\n
"
,
max_chan
);
/* look for telnet server, if it is loaded, add the channel modeling commands to it */
add_telnetcmd_func_t
addcmd
=
(
add_telnetcmd_func_t
)
get_shlibmodule_fptr
(
"telnetsrv"
,
TELNET_ADDCMD_FNAME
);
...
...
openair1/SIMULATION/TOOLS/sim.h
View file @
c2e7d80b
...
...
@@ -92,6 +92,10 @@ typedef struct {
time_stats_t
interp_time
;
time_stats_t
interp_freq
;
time_stats_t
convolution
;
/// index in the channel descriptors array
unsigned
int
chan_idx
;
/// id of the channel modeling algorithm
int
modelid
;
}
channel_desc_t
;
typedef
struct
{
...
...
@@ -214,8 +218,9 @@ typedef enum {
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
#define CHANNELMOD_SECTION "channelmod"
#define CHANNELMOD_PARAMS_DESC { \
{"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB , defdblval:25, TYPE_DOUBLE, 0},\
{"sinr_dB", NULL , 0 , dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\
{"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0},\
{"sinr_dB", NULL, 0 , dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\
{"max_chan, CONFIG_HLP_MAX_CHAN", 0, uptr:&max_chan, defintval:10, TYPE_UINT, 0},\
}
#include "platform_constants.h"
...
...
targets/ARCH/rfsimulator/simulator.c
View file @
c2e7d80b
...
...
@@ -78,9 +78,11 @@ extern RAN_CONTEXT_t RC;
#define RFSIMULATOR_PARAMS_DESC {\
{"serveraddr", "<ip address to connect to>\n", 0, strptr:&(rfsimulator->ip), defstrval:"127.0.0.1", TYPE_STRING, 0 },\
{"serverport", "<port to connect to>\n", 0, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\
{RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0},\
{RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0
},\
{"IQfile", "<file path to use when saving IQs>\n", 0, strptr:&(saveF), defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\
{"modelname", "<channel model name>\n", 0, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 }\
{"modelname", "<channel model name>\n", 0, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 },\
{"ploss", "<channel path loss in dB>\n", 0, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\
{"forgetfact", "<channel forget factor ((0 to 1)>\n", 0, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 }\
};
pthread_mutex_t
Sockmutex
;
...
...
@@ -114,6 +116,8 @@ typedef struct {
double
sample_rate
;
double
tx_bw
;
int
channelmod
;
double
chan_pathloss
;
double
chan_forgetfact
;
}
rfsimulator_state_t
;
...
...
@@ -161,9 +165,9 @@ void allocCirBuf(rfsimulator_state_t *bridge, int sock) {
bridge
->
channelmod
,
bridge
->
sample_rate
,
bridge
->
tx_bw
,
0
.
0
,
// forgetting_factor
bridge
->
chan_forgetfact
,
// forgetting_factor
0
,
// maybe used for TA
0
);
// path_loss in dB
bridge
->
chan_pathloss
);
// path_loss in dB
random_channel
(
ptr
->
channel_model
,
false
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment