Commit ade7901f authored by Bartosz Podrygajlo's avatar Bartosz Podrygajlo

RFSim: Add beamids list based user interface for beam domain simulation

Add CLI parameter rfsimulator.beam_ids which uses a list of beam ids instead of a
beam map. The beam map API is still present and can be used interchangably.

Add telnet command setbeamids which has similar semantics
parent ac97ba4e
...@@ -239,13 +239,14 @@ these values onto the diagonals, making it symmetric. ...@@ -239,13 +239,14 @@ these values onto the diagonals, making it symmetric.
* `--rfsimulator.beam_map <beam_map>` : where `<beam_map>` is a `uint64_t` value where each bit is an enabled TX/RX beam. * `--rfsimulator.beam_map <beam_map>` : where `<beam_map>` is a `uint64_t` value where each bit is an enabled TX/RX beam.
For gNB: Initial beam_map, i.e. which beams gNB transmits/receives before calling beam APIs. For gNB: Initial beam_map, i.e. which beams gNB transmits/receives before calling beam APIs.
For UE: Beam position in beam space in the simulation. The UE is not expected to use the beam APIs for now. For UE: Beam position in beam space in the simulation. The UE is not expected to use the beam APIs for now.
* `--rfsimulator.beam_ids <beam_ids>` : where `<beam_ids>` is a comma separated list. Same as above but added for convenience.
## Runtime commands ## Runtime commands
### Moving the UE in beam space ### Moving the UE in beam space
Use telnet command `rfsimu setbeams <beam_map>`. It works similar to the CLI command `--rfsimulator.beam_map <beam_map>`. Use telnet command `rfsimu setbeams <beam_map>` or `rfsimu setbeamids <beam_ids>`. They correspond to the CLI parameters described
Suggest to only use single bits here above and work the same way.
### Modifying the gNB beam ### Modifying the gNB beam
......
...@@ -79,6 +79,7 @@ typedef enum { SIMU_ROLE_SERVER = 1, SIMU_ROLE_CLIENT } simuRole; ...@@ -79,6 +79,7 @@ typedef enum { SIMU_ROLE_SERVER = 1, SIMU_ROLE_CLIENT } simuRole;
#define RFSIMU_SECTION "rfsimulator" #define RFSIMU_SECTION "rfsimulator"
#define RFSIMU_OPTIONS_PARAMNAME "options" #define RFSIMU_OPTIONS_PARAMNAME "options"
#define RFSIMU_BEAM_GAINS "beam_gains" #define RFSIMU_BEAM_GAINS "beam_gains"
#define RFSIMU_BEAM_IDS "beam_ids"
#define RFSIM_CONFIG_HELP_OPTIONS \ #define RFSIM_CONFIG_HELP_OPTIONS \
" list of comma separated options to enable rf simulator functionalities. Available options: \n" \ " list of comma separated options to enable rf simulator functionalities. Available options: \n" \
...@@ -106,6 +107,7 @@ typedef enum { SIMU_ROLE_SERVER = 1, SIMU_ROLE_CLIENT } simuRole; ...@@ -106,6 +107,7 @@ typedef enum { SIMU_ROLE_SERVER = 1, SIMU_ROLE_CLIENT } simuRole;
BOOLPARAM("enable_beams", "<enable simplified beam simulation>\n", simBool,&(beam_ctrl->enable_beams), 0), \ BOOLPARAM("enable_beams", "<enable simplified beam simulation>\n", simBool,&(beam_ctrl->enable_beams), 0), \
INTPARAM("num_concurrent_beams", "<number of concurrent beams supported>\n", simOpt, &beam_ctrl->num_concurrent_beams, 1), \ INTPARAM("num_concurrent_beams", "<number of concurrent beams supported>\n", simOpt, &beam_ctrl->num_concurrent_beams, 1), \
UINT64PARAM("beam_map", "<initial beam map>\n", simOpt, &beam_map, 1), \ UINT64PARAM("beam_map", "<initial beam map>\n", simOpt, &beam_map, 1), \
STRINGPARAM(RFSIMU_BEAM_IDS, "<initial beam ids>\n", simOpt, NULL, NULL), \
STRINGPARAM(RFSIMU_BEAM_GAINS, "<beam gain matrix in toeplitz form>\n", simOpt, NULL, NULL), \ STRINGPARAM(RFSIMU_BEAM_GAINS, "<beam gain matrix in toeplitz form>\n", simOpt, NULL, NULL), \
}; };
// clang-format on // clang-format on
...@@ -119,6 +121,7 @@ static int rfsimu_setdistance_cmd(char *buff, int debug, telnet_printfunc_t prnt ...@@ -119,6 +121,7 @@ static int rfsimu_setdistance_cmd(char *buff, int debug, telnet_printfunc_t prnt
static int rfsimu_getdistance_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg); static int rfsimu_getdistance_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg);
static int rfsimu_vtime_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg); static int rfsimu_vtime_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg);
static int rfsimu_set_beam(char *buff, int debug, telnet_printfunc_t prnt, void *arg); static int rfsimu_set_beam(char *buff, int debug, telnet_printfunc_t prnt, void *arg);
static int rfsimu_set_beamids(char *buff, int debug, telnet_printfunc_t prnt, void *arg);
// clang-format off // clang-format off
static telnetshell_cmddef_t rfsimu_cmdarray[] = { static telnetshell_cmddef_t rfsimu_cmdarray[] = {
{"show models", "", (cmdfunc_t)rfsimu_setchanmod_cmd, {(webfunc_t)getset_currentchannels_type}, TELNETSRV_CMDFLAG_WEBSRVONLY | TELNETSRV_CMDFLAG_GETWEBTBLDATA, NULL}, {"show models", "", (cmdfunc_t)rfsimu_setchanmod_cmd, {(webfunc_t)getset_currentchannels_type}, TELNETSRV_CMDFLAG_WEBSRVONLY | TELNETSRV_CMDFLAG_GETWEBTBLDATA, NULL},
...@@ -127,6 +130,7 @@ static telnetshell_cmddef_t rfsimu_cmdarray[] = { ...@@ -127,6 +130,7 @@ static telnetshell_cmddef_t rfsimu_cmdarray[] = {
{"getdistance", "<model name>", (cmdfunc_t)rfsimu_getdistance_cmd, {NULL}, TELNETSRV_CMDFLAG_PUSHINTPOOLQ}, {"getdistance", "<model name>", (cmdfunc_t)rfsimu_getdistance_cmd, {NULL}, TELNETSRV_CMDFLAG_PUSHINTPOOLQ},
{"vtime", "", (cmdfunc_t)rfsimu_vtime_cmd, {NULL}, TELNETSRV_CMDFLAG_PUSHINTPOOLQ | TELNETSRV_CMDFLAG_AUTOUPDATE}, {"vtime", "", (cmdfunc_t)rfsimu_vtime_cmd, {NULL}, TELNETSRV_CMDFLAG_PUSHINTPOOLQ | TELNETSRV_CMDFLAG_AUTOUPDATE},
{"setbeam", "beam_map", (cmdfunc_t)rfsimu_set_beam, {NULL}, TELNETSRV_CMDFLAG_PUSHINTPOOLQ}, {"setbeam", "beam_map", (cmdfunc_t)rfsimu_set_beam, {NULL}, TELNETSRV_CMDFLAG_PUSHINTPOOLQ},
{"setbeamids", "beam_id1,beam_id2,...", (cmdfunc_t)rfsimu_set_beamids, {NULL}, TELNETSRV_CMDFLAG_PUSHINTPOOLQ},
{"", "", NULL}, {"", "", NULL},
}; };
// clang-format on // clang-format on
...@@ -562,6 +566,18 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) ...@@ -562,6 +566,18 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator)
beam_ctrl->rx.beams = initial_beams; beam_ctrl->rx.beams = initial_beams;
beam_ctrl->tx.beams = initial_beams; beam_ctrl->tx.beams = initial_beams;
int beam_ids_param_index = config_paramidx_fromname(rfsimu_params, sizeofArray(rfsimu_params), RFSIMU_BEAM_IDS);
if (rfsimu_params[beam_ids_param_index].strptr) {
std::vector<int> beam_ids;
std::stringstream ss(*rfsimu_params[beam_ids_param_index].strptr);
std::string token;
while (std::getline(ss, token, ',')) {
beam_ids.push_back(std::stoi(token));
}
beam_ctrl->rx.beams = beam_ids;
beam_ctrl->tx.beams = beam_ids;
}
if (strncasecmp(rfsimulator->ip, "enb", 3) == 0 || strncasecmp(rfsimulator->ip, "server", 3) == 0) if (strncasecmp(rfsimulator->ip, "enb", 3) == 0 || strncasecmp(rfsimulator->ip, "server", 3) == 0)
rfsimulator->role = SIMU_ROLE_SERVER; rfsimulator->role = SIMU_ROLE_SERVER;
else else
...@@ -582,6 +598,25 @@ static int rfsimu_set_beam(char *buff, int debug, telnet_printfunc_t prnt, void ...@@ -582,6 +598,25 @@ static int rfsimu_set_beam(char *buff, int debug, telnet_printfunc_t prnt, void
return CMDSTATUS_FOUND; return CMDSTATUS_FOUND;
} }
static int rfsimu_set_beamids(char *buff, int debug, telnet_printfunc_t prnt, void *arg)
{
rfsimulator_state_t *t = (rfsimulator_state_t *)arg;
rfsim_beam_ctrl_t *beam_ctrl = t->beam_ctrl;
AssertFatal(beam_ctrl->enable_beams, "Beam simualtion is disabled, cannot set beams\n");
std::vector<int> beam_ids;
std::stringstream ss(buff);
std::string token;
while (std::getline(ss, token, ',')) {
beam_ids.push_back(std::stoi(token));
}
std::lock_guard<std::mutex> lock_tx(beam_ctrl->tx.mutex);
std::lock_guard<std::mutex> lock_rx(beam_ctrl->rx.mutex);
beam_ctrl->rx.beams = beam_ids;
beam_ctrl->tx.beams = beam_ids;
prnt("Beam ids set\n");
return CMDSTATUS_FOUND;
}
static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg) static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg)
{ {
char *modelname = NULL; char *modelname = NULL;
......
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