Commit 1ca500d2 authored by nikaeinn's avatar nikaeinn
Browse files

* update the Openair mobility generator, add steadystatefor RWP, trace-driven...

* update the Openair mobility generator, add steadystatefor RWP, trace-driven mobility, two grid-based mobility models (restricted RWP, and connected domains)


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5576 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent a1f4f1e5
......@@ -53,6 +53,8 @@ typedef enum {
/* decomposition of node functions into jobs for a given event */
typedef enum Job_type_e { JT_OTG, JT_PDCP, JT_PHY_MAC, JT_INIT_SYNC, JT_DL, JT_UL, RN_DL, RN_UL, JT_END} Job_Type_t;
typedef enum Operation_Type_e { READ, WRITE, RESET} Operation_Type_t;
typedef struct Job_s {
enum Job_type_e type;
int exe_time; /* execution time at the worker*/
......@@ -87,9 +89,12 @@ typedef struct Packet_otg_s {
typedef struct {
Event_Type_t type;
enum Operation_Type_e optype; //op
char *key;
void *value;
frame_t frame;
int ue;
int lcid;
} Event_t;
/*typedef struct Global_Time {
......@@ -101,6 +106,8 @@ typedef struct {
double time_ms;
};*/
typedef struct Packet_otg_elt_s {
struct Packet_otg_elt_s *next;
struct Packet_otg_elt_s *previous;
......
......@@ -178,7 +178,7 @@ int logInit (void)
g_log->log_component[OMG].interval = 1;
g_log->log_component[OMG].fd = 0;
g_log->log_component[OMG].filelog = 0;
g_log->log_component[OMG].filelog_name = "";
g_log->log_component[OMG].filelog_name = "/tmp/omg.csv";
g_log->log_component[OTG].name = "OTG";
g_log->log_component[OTG].level = LOG_EMERG;
......
......@@ -50,7 +50,7 @@ OMG_OBJS += $(OMG_DIR)/job.o
OMG_OBJS += $(OMG_DIR)/static.o
OMG_OBJS += $(OMG_DIR)/rwp.o
OMG_OBJS += $(OMG_DIR)/rwalk.o
OMG_OBJS += $(OMG_DIR)/omg_hashtable.o
#OMG_OBJS += $(OMG_DIR)/omg_hashtable.o
OMG_OBJS += $(OMG_DIR)/mobility_parser.o
OMG_OBJS += $(OMG_DIR)/trace.o
OMG_OBJS += $(OMG_DIR)/sumo.o
......@@ -58,6 +58,10 @@ OMG_OBJS += $(OMG_DIR)/id_manager.o
OMG_OBJS += $(OMG_DIR)/client_traci_OMG.o
OMG_OBJS += $(OMG_DIR)/storage_traci_OMG.o
OMG_OBJS += $(OMG_DIR)/socket_traci_OMG.o
OMG_OBJS += $(OMG_DIR)/steadystaterwp.o
OMG_OBJS += $(OMG_DIR)/grid.o
OMG_OBJS += $(OMG_DIR)/trace_hashtable.o
OTG_OBJS = $(OTG_DIR)/otg_tx.o
OTG_OBJS += $(OTG_DIR)/otg.o
......
......@@ -295,6 +295,7 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
////// options of UE_Mobility_Type
typedef struct
{
char *selected_option;
int horizontal_grid;
int vertical_grid;
} Grid_Map;
......@@ -464,6 +465,32 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
/* @}*/
typedef struct
{
uint16_t priority[11];//pas possible d'acceder au MAX_NUM_LCID
//
uint8_t DCI_aggregation_min;
uint8_t DLSCH_dci_size_bits;
//UL transmission bandwidth in RBs
uint8_t ul_bandwidth[11];
//DL transmission bandwidth in RBs
uint8_t dl_bandwidth[11];
//UL transmission bandwidth in RBs
uint8_t min_ul_bandwidth[11];
//DL transmission bandwidth in RBs
uint8_t min_dl_bandwidth[11];
//aggregated bit rate of non-gbr bearer per UE
uint64_t ue_AggregatedMaximumBitrateDL;
//aggregated bit rate of non-gbr bearer per UE
uint64_t ue_AggregatedMaximumBitrateUL;
//CQI scheduling interval in subframes.
uint16_t cqiSchedInterval;
//Contention resolution timer used during random access
uint8_t mac_ContentionResolutionTimer;
uint16_t max_allowed_rbs[11];
uint8_t max_mcs[11];
} Mac_config;
/** @defgroup _Predefined_traffic Configuration
* @ingroup _OSD_basic
* @brief Including Application type, Source, destination, background, etc
......@@ -684,7 +711,8 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
unsigned char otg_bg_traffic_enabled;
unsigned char omg_model_rn;
unsigned char omg_model_enb;
unsigned char omg_model_ue;
unsigned char omg_model_ue;
unsigned char omg_rwp_type;
unsigned char omg_model_ue_current; // when mixed mbility is used
// control eNB/UE instance through CLI
unsigned char cli_enabled;
......@@ -733,6 +761,7 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
* @{*/
typedef struct
{
Mac_config mac_config[NUMBER_OF_UE_MAX];
Environment_System_Config environment_system_config; /*!< \brief Evironment configuration */
Topology_Config topology_config; /*!< \brief Topology configuration */
Application_Config application_config; /*!< \brief Applications configuration */
......
......@@ -1015,14 +1015,18 @@ void characters(void *user_data, const xmlChar *xmlch, int xmllen) { // called o
} else if (mobility_) {
if (UE_mobility_) {
if (UE_mobility_type_) {
oai_emulation.topology_config.mobility.UE_mobility.UE_mobility_type.selected_option = strndup(ch, len);
} else if (grid_walk_) {
oai_emulation.topology_config.mobility.UE_mobility.UE_mobility_type.selected_option = strndup(ch, len);
}else if (grid_walk_) {
if (grid_map_) {
oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.selected_option = strndup(ch, len);
/*
if (horizontal_grid_) {
oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.horizontal_grid = atoi(ch);
} else if (vertical_grid_) {
oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.vertical_grid = atoi(ch);
}
*/
} else if (grid_trip_type_) {
oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_trip_type.selected_option = strndup(ch, len);
}
......@@ -1087,6 +1091,7 @@ void characters(void *user_data, const xmlChar *xmlch, int xmllen) { // called o
} else if (eNB_mobility_) {
if (eNB_mobility_type_) {
oai_emulation.topology_config.mobility.eNB_mobility.eNB_mobility_type.selected_option = strndup(ch, len);
} else if (eNB_initial_distribution_) {
oai_emulation.topology_config.mobility.eNB_mobility.eNB_initial_distribution.selected_option = strndup(ch, len);
} else if (eNB_initial_coordinates_) {
......
......@@ -105,12 +105,12 @@ void init(int max_sim_time) {
sendExact(storageLength(storageStart));
extractCommandStatus(receiveExact(), CMD_SUBSCRIBE_SIM_VARIABLE, description);
if (departed == NULL) {
departed = (String_list)malloc(sizeof(String_list)); // departed MUST point to HEAD
departed = (string_list*) malloc(sizeof(string_list)); // departed MUST point to HEAD
departed->string = NULL;
departed->next = NULL;
}
if (arrived == NULL) {
arrived = (String_list)malloc(sizeof(String_list)); // arrived MUST point to HEAD
arrived = (string_list*) malloc(sizeof(string_list)); // arrived MUST point to HEAD
arrived->string = NULL;
arrived->next = NULL;
}
......@@ -123,8 +123,8 @@ void init(int max_sim_time) {
void processSubscriptions() {
int noSubscriptions = readInt();
String_list tmp_departed = departed;
String_list tmp_arrived = arrived;
string_list* tmp_departed = departed;
string_list* tmp_arrived = arrived;
int s;
for (s = 0; s<noSubscriptions; ++s) {
......@@ -240,12 +240,12 @@ void commandSimulationStep(double time)
extractCommandStatus(receiveExact(), CMD_SIMSTEP2, description);
if (departed == NULL) {
departed = (String_list)malloc(sizeof(String_list)); // departed MUST point to HEAD
departed = (string_list*) malloc(sizeof(string_list)); // departed MUST point to HEAD
departed->string = NULL;
departed->next = NULL;
}
if (arrived == NULL) {
arrived = (String_list)malloc(sizeof(String_list)); // arrived MUST point to HEAD
arrived = (string_list*) malloc(sizeof(string_list)); // arrived MUST point to HEAD
arrived->string = NULL;
arrived->next = NULL;
}
......@@ -402,14 +402,14 @@ int commandGetMaxSUMONodesVariable()
void GetSpeed(NodePtr node, char * sumo_id)
void GetSpeed(node_struct* node, char * sumo_id)
{
commandGetVehicleVariable(sumo_id, VAR_SPEED);
double speed_double = readDouble();
node->mob->speed = speed_double;
}
void GetPosition(NodePtr node, char * sumo_id)
void GetPosition(node_struct* node, char * sumo_id)
{
commandGetVehicleVariable(sumo_id, VAR_POSITION);
double x_double = readDouble();
......@@ -420,6 +420,6 @@ void GetPosition(NodePtr node, char * sumo_id)
if (y_double < 0.0)
y_double = 0.0;
node->X_pos = x_double;
node->Y_pos = y_double;
node->x_pos = x_double;
node->y_pos = y_double;
}
......@@ -56,8 +56,8 @@ int targetTime;
char *description;
String_list departed; // string list of all vehicles appearing in SUMO at the current time step
String_list arrived; // string list of all vehicles leaving SUMO at the current time step
string_list* departed; // string list of all vehicles appearing in SUMO at the current time step
string_list* arrived; // string list of all vehicles leaving SUMO at the current time step
/**
* Global parameters defined in storage_traci_OMG.h
......@@ -89,10 +89,10 @@ int extractCommandStatus(storage *, unsigned char , char *);
void commandSimulationStep(double);
/**
* \fn commandClose();
* \fn commandClose(void);
* \brief Send termination command to SUMO
*/
void commandClose();
void commandClose(void);
/**
* \fn commandGetVehicleVariable(char *vehID, int varID)
......@@ -103,10 +103,10 @@ void commandGetVehicleVariable(char *vehID, int varID);
/**
* \fn get_num_sumo_nodes()
* \fn get_num_sumo_nodes(void)
* \brief Return the total number of nodes to be simulated in SUMO
*/
int commandGetMaxSUMONodesVariable();
int commandGetMaxSUMONodesVariable(void);
/**
* \fn init(int max_sim_time)
......@@ -126,7 +126,7 @@ void processSubscriptions(void);
* \param NodePtr node the pointer to the OAISim node
* \param char *sumo_id the SUMO ID of the target node
*/
void GetSpeed(NodePtr node, char * sumo_id);
void GetSpeed(node_struct* node, char * sumo_id);
/**
* \fn void Position(NodePtr node, char * sumo_id);
......@@ -134,7 +134,7 @@ void GetSpeed(NodePtr node, char * sumo_id);
* \param NodePtr node the pointer to the OAISim node
* \param char *sumo_id the SUMO ID of the target node
*/
void GetPosition(NodePtr node, char * sumo_id);
void GetPosition(node_struct* node, char * sumo_id);
#endif
......
......@@ -47,297 +47,392 @@
#define frand() ((double) rand() / (RAND_MAX+1))
//#ifndef STANDALONE
mapping nodes_type[] =
{
{"eNB", eNB},
{"UE", UE},
{NULL, -1}
mapping nodes_type[] = {
{"eNB", eNB}
,
{"UE", UE}
,
{NULL, -1}
};
mapping nodes_status[] =
{
{"sleeping", 0},
{"moving", 1},
{NULL, -1}
mapping nodes_status[] = {
{"sleeping", 0}
,
{"moving", 1}
,
{NULL, -1}
};
mapping mob_type[] =
{
{"STATIC", STATIC},
{"RWP", RWP},
{"RWALK", RWALK},
{"TRACE", TRACE},
{"SUMO", SUMO},
{NULL, -1}
mapping mob_type[] = {
{"STATIC", STATIC}
,
{"RWP", RWP}
,
{"RWALK", RWALK}
,
{"TRACE", TRACE}
,
{"SUMO", SUMO}
,
{NULL, -1}
};
//#endif
NodePtr create_node(void) {
NodePtr ptr;
ptr = calloc(1, sizeof(node_struct));
return ptr;
node_struct *
create_node (void)
{
node_struct *ptr;
ptr = calloc (1, sizeof (node_struct));
return ptr;
}
void delete_node(NodePtr node) {
free(node->mob);
void
delete_node (node_struct * node)
{
free (node->mob);
node->mob = NULL;
free(node);
free (node);
}
double randomGen(double a, double b){
double
randomgen (double a, double b)
{
return ( rand()/(double)RAND_MAX ) * (b-a) + a;
return (rand () / (double) RAND_MAX) * (b - a) + a;
}
MobilityPtr create_mobility(void) {
MobilityPtr ptr;
ptr = calloc(1, sizeof(mobility_struct));
return ptr;
mobility_struct *
create_mobility (void)
{
mobility_struct *ptr;
ptr = calloc (1, sizeof (mobility_struct));
return ptr;
}
Node_list add_entry(NodePtr node, Node_list Node_Vector){
Node_list entry = malloc(sizeof(node_list_struct));
entry->node = node;
entry->next = NULL;
if (Node_Vector == NULL) {
// LOG_D(OMG, "\nempty Node_list");
//LOG_D(OMG, "\nadded elmt ID %d\n", entry->node->ID);
return entry;
node_list *
add_entry (node_struct * node, node_list * node_vector_end)
{
node_list *entry = malloc (sizeof (struct node_list_struct));
entry->node = node;
entry->next = NULL;
if (node_vector_end == NULL)
{
return entry;
}
else {
Node_list tmp = Node_Vector;
while (tmp->next != NULL){
tmp = tmp->next;
}
tmp->next = entry;
//LOG_D(OMG, "\nnon empty Node_list");
//LOG_D(OMG, "added elmt ID %d\n", entry->node->ID);
return Node_Vector;
else
{
node_list *tmp = node_vector_end;
tmp->next = entry;
}
return entry;
}
Node_list remove_node_entry(NodePtr node, Node_list Node_Vector){
Node_list list = Node_Vector;
Node_list tmp, toRemove;
if (list == NULL){
return NULL;
}
if(list->node->ID == node->ID) {
// TODO delete the entry
toRemove = list;
LOG_D(OMG,"removed entry for node %d \n",list->node->ID);
if(list->next ==NULL) {
Node_Vector = NULL;
return NULL;
node_list *
remove_node_entry (node_struct * node, node_list * node_vector)
{
node_list *list = node_vector;
node_list *tmp, *toremove;
if (list == NULL)
{
return NULL;
}
else {
Node_Vector = list->next;
if (list->node->id == node->id)
{
// TODO delete the entry
toremove = list;
LOG_D (OMG, "removed entry for node %d \n", list->node->id);
if (list->next == NULL)
{
node_vector = NULL;
return NULL;
}
else
{
node_vector = list->next;
}
}
else
{
while (list->next != NULL)
{
tmp = list;
if (list->next->node->id == node->id)
{
toremove = tmp; // TODO delete the entry
tmp = list->next->next;
if (tmp != NULL)
{
list->next = tmp;
}
else
{
list->next = NULL;
}
}
}
}
}
else{
while (list->next !=NULL) {
tmp = list;
if(list->next->node->ID == node->ID) {
toRemove = tmp; // TODO delete the entry
tmp = list->next->next;
if(tmp !=NULL) {
list->next = tmp;
}
else{
list->next = NULL;
}
}
}
}
return Node_Vector;
return node_vector;
}
// display list of nodes
void display_node_list(Node_list Node_Vector){
Node_list tmp = Node_Vector;
while ((tmp != NULL) &&
(tmp->node != NULL)){
LOG_I(OMG,"[%s][%s] Node of ID %d is %s. Now, it is at location (%.3f, %.3f)\n",
map_int_to_str(mob_type, tmp->node->generator),
map_int_to_str(nodes_type, tmp->node->type),
tmp->node->ID,
map_int_to_str(nodes_status, tmp->node->mobile),
tmp->node->X_pos,
tmp->node->Y_pos );
//LOG_I(OMG, "node number %d\tstatus(fix/mobile) %d\tX_pos %.2f\tY_pos %.2f\tnode_type(eNB, UE)%d\t", tmp->node->ID,tmp->node->mobile, tmp->node->X_pos,tmp->node->Y_pos, tmp->node->type);
void
display_node_list (node_list * node_vector)
{
node_list *tmp = node_vector;
if (tmp == NULL)
{
#ifdef STANDALONE
printf ("Empty Node_list\n");
#else
LOG_I (OMG, "Empty Node_list\n");
#endif
}
while (tmp != NULL)
{
/*LOG_I(OMG,"[%s][%s] Node of ID %d is %s. Now, it is at location (%.3f, %.3f)\n",
map_int_to_str(mob_type, tmp->node->generator),
map_int_to_str(nodes_type, tmp->node->type),
tmp->node->ID,
map_int_to_str(nodes_status, tmp->node->mobile),
tmp->node->X_pos,
tmp->node->Y_pos ); */
LOG_I (OMG, "[%s %d][%s] \t at (%.3f, %.3f)\n",
map_int_to_str(nodes_type, tmp->node->type),
tmp->node->id,
map_int_to_str(mob_type, tmp->node->generator),
tmp->node->x_pos, tmp->node->y_pos);
// two options: view node mobility of one node during the entire simulation or just a snapshot of all nodes for different timestamps
// note:gnu plot requiredifferent files for each timestamp
//use a python script to postprocess the positions, check the
// support: view node mobility of one node during the entire simulation OR only one snapshot
LOG_F(OMG,"%d; %.3f; %.3f; %.3f\n",
tmp->node->id,
tmp->node->x_pos, tmp->node->y_pos);
//LOG_I(OMG, "node number %d\tstatus(fix/mobile) %d\tX_pos %.2f\tY_pos %.2f\tnode_type(eNB, UE)%d\t", tmp->node->ID,tmp->node->mobile, tmp->node->X_pos,tmp->node->Y_pos, tmp->node->type);
//LOG_D(OMG, "mob->X_from %.3f\tmob->Y_from %.3f\tmob->X_to %.3f\tmob->Y_to %.3f\t", tmp->node->mob->X_from,tmp->node->mob->Y_from, tmp->node->mob->X_to, tmp->node->mob->Y_to );
tmp = tmp->next;
}
}
void display_node_position(int ID, int generator, int type, int mobile, double X, double Y){
LOG_I(OMG,"[%s][%s] Node of ID %d is %s. Now, it is at location (%.2f, %.2f) \n",
map_int_to_str(mob_type, generator),
map_int_to_str(nodes_type, type),
ID,
map_int_to_str(nodes_status, mobile),
X,
Y
);
void
display_node_position (int id, int generator, int type, int mobile, double x,
double y)
{
LOG_I (OMG,
"[%s][%s] Node of ID %d is %s. Now, it is at location (%.2f, %.2f) \n",
map_int_to_str (mob_type, generator), map_int_to_str (nodes_type,
type), id,
map_int_to_str (nodes_status, mobile), x, y);
}
Node_list filter(Node_list Vector, int node_type){
Node_list tmp1, tmp2;
tmp1 = Vector;
node_list *
filter (node_list * vector, int node_type)
{
node_list *tmp1, *tmp2;
tmp1 = vector;
tmp2 = NULL;
while (tmp1 != NULL){
if (tmp1->node->type == node_type){
tmp2 = add_entry(tmp1->node, tmp2);
while (tmp1 != NULL)
{
if (tmp1->node->type == node_type)
{
tmp2 = add_entry (tmp1->node, tmp2);
}
tmp1 = tmp1->next;
}
tmp1 = tmp1->next;
}
return tmp2;
}
void delete_node_entry(Node_list entry) {
NodePtr node = entry->node;
delete_node(node);
entry->node = NULL;
free(entry);
void
delete_node_entry (node_list * entry)
{
node_struct *node = entry->node;
delete_node (node);
entry->node = NULL;
free (entry);
}
Node_list remove_node(Node_list list, int nID, int node_type){
node_list *
remove_node (node_list * list, int nid, int node_type)
{
int found;
Node_list current, previous;