Commit 1ca500d2 authored by Navid Nikaein's avatar Navid Nikaein

* 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
......@@ -685,6 +712,7 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
unsigned char omg_model_rn;
unsigned char omg_model_enb;
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 */
......
......@@ -1016,13 +1016,17 @@ void characters(void *user_data, const xmlChar *xmlch, int xmllen) { // called o
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_) {
}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
......
This diff is collapsed.
This diff is collapsed.
/*******************************************************************************
Eurecom OpenAirInterface
Copyright(c) 1999 - 2011 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.frm
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*******************************************************************************/
/*! \file grid.c
* \brief
* \author S. Gashaw, N. Nikaein, J. Harri
* \date 2014
* \version 0.1
* \company Eurecom
* \email:
* \note
* \warning
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include "grid.h"
#define LEFT 0
#define RIGHT 1
#define UPPER 2
#define LOWER 3
int
max_vertices_ongrid (omg_global_param omg_param)
{
return ((int) (omg_param.max_x / xloc_div + 1.0) *
(int) (omg_param.max_y / yloc_div + 1.0)) - 1;
}
int
max_connecteddomains_ongrid (omg_global_param omg_param)
{
return ((int) (omg_param.max_x / xloc_div) *
(int) (omg_param.max_y / yloc_div)) - 1;
}
double
vertice_xpos (int loc_num, omg_global_param omg_param)
{
int div, mod;
double x_pos;
div = (int) (omg_param.max_x / xloc_div + 1.0);
mod = (loc_num % div) * xloc_div;
x_pos = omg_param.min_x + (double) mod;
//LOG_D(OMG,"mod %d div %d x pos %.2f \n\n",mod,div,x_pos);
return x_pos;
}
double
vertice_ypos (int loc_num, omg_global_param omg_param)
{
//LOG_D(OMG,"y pos %.2f \n\n",omg_param.min_y + (double)yloc_div * (int)( loc_num / (int)(omg_param.max_x/xloc_div + 1.0) ));
return omg_param.min_y +
(double) yloc_div *(int) (loc_num /
(int) (omg_param.max_x / xloc_div + 1.0));
}
double
area_minx (int block_num, omg_global_param omg_param)
{
return omg_param.min_x +
xloc_div * (block_num % (int) (omg_param.max_x / xloc_div));
}
double
area_miny (int block_num, omg_global_param omg_param)
{
return omg_param.min_y +
yloc_div * (int) (block_num / (int) (omg_param.max_x / xloc_div));
}
/*for connected domain that only move to the neighbor domains */
unsigned int
next_block (int current_bn, omg_global_param omg_param)
{
double rnd = randomgen (0, 1);
unsigned int blk;
int div = (int) (omg_param.max_x / xloc_div);
/*left border blocks*/
if ((current_bn % div) == 0)
{
/*case 1 for left upper and lower corners(only 2 neighbors) */
if ((int) (current_bn / div) == 0)
{
if (rnd <= 0.5)
blk = selected_blockn (current_bn, RIGHT, div);
else
blk = selected_blockn (current_bn, UPPER, div);
}
else if ((int) (current_bn / div) ==
(int) (omg_param.max_y / yloc_div) - 1)
{
if (rnd <= 0.5)
blk = selected_blockn (current_bn, RIGHT, div);
else
blk = selected_blockn (current_bn, LOWER, div);
}
/*for 3 neighbor blocks */
else
{
if (rnd <= 0.33)
blk = selected_blockn (current_bn, RIGHT, div);
else if (rnd > 0.33 && rnd <= 0.66)
blk = selected_blockn (current_bn, UPPER, div);
else
blk = selected_blockn (current_bn, LOWER, div);
}
}
/*right boredr blocks*/
else if ((current_bn % (int) (omg_param.max_x / xloc_div)) == div - 1)
{
/*case 1 for right upper and lower corners(only 2 neighbors) */
if ((int) (current_bn / div) == 0)
{
if (rnd <= 0.5)
blk = selected_blockn (current_bn, LEFT, div);
else
blk = selected_blockn (current_bn, UPPER, div);
}
else if ((int) (current_bn / div) ==
(int) (omg_param.max_y / yloc_div) - 1)
{
if (rnd <= 0.5)
blk = selected_blockn (current_bn, LEFT, div);
else
blk = selected_blockn (current_bn, LOWER, div);
}
/*for 3 neighbor blocks */
else
{
if (rnd <= 0.33)
blk = selected_blockn (current_bn, LEFT, div);
else if (rnd > 0.33 && rnd <= 0.66)
blk = selected_blockn (current_bn, UPPER, div);
else
blk = selected_blockn (current_bn, LOWER, div);
}
}
/*for 3 neighbor uper and lower borders*/
else if ((int) (current_bn / div) == 0
|| (int) (current_bn / div) ==
(int) (omg_param.max_y / yloc_div) - 1)
{
if ((int) (current_bn / div) == 0)
{
if (rnd <= 0.33)
blk = selected_blockn (current_bn, LEFT, div);
else if (rnd > 0.33 && rnd <= 0.66)
blk = selected_blockn (current_bn, RIGHT, div);
else
blk = selected_blockn (current_bn, UPPER, div);
}
else
{
if (rnd <= 0.33)
blk = selected_blockn (current_bn, LEFT, div);
else if (rnd > 0.33 && rnd <= 0.66)
blk = selected_blockn (current_bn, RIGHT, div);
else
blk = selected_blockn (current_bn, LOWER, div);
}
}
else
{
if (rnd <= 0.25)
blk = selected_blockn (current_bn, LEFT, div);
else if (rnd > 0.25 && rnd <= 0.50)
blk = selected_blockn (current_bn, RIGHT, div);
else if (rnd > 0.50 && rnd <= 0.75)
blk = selected_blockn (current_bn, UPPER, div);
else
blk = selected_blockn (current_bn, LOWER, div);
}
return blk;
}
/*retun the block number of neighbor selected for next move */
unsigned int
selected_blockn (int block_n, int type, int div)
{
unsigned int next_blk = 0;
switch (type)
{
case LEFT:
next_blk = block_n - 1;
break;
case RIGHT:
next_blk = block_n + 1;
break;
case UPPER:
next_blk = block_n + div;
break;
case LOWER:
next_blk = block_n - div;
break;
default:
LOG_E (OMG, "wrong type input\n");
}
return next_blk;
}
/*******************************************************************************
Eurecom OpenAirInterface
Copyright(c) 1999 - 2011 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*******************************************************************************/
/**
* \file grid.h **/
#ifndef GRID_H_
#define GRID_H_
#include "omg.h"
int max_vertices_ongrid(omg_global_param omg_param);
int max_connecteddomains_ongrid(omg_global_param omg_param);
double vertice_xpos(int loc_num, omg_global_param omg_param);
double vertice_ypos(int loc_num, omg_global_param omg_param);
double area_minx(int block_num, omg_global_param omg_param);
double area_miny(int block_num, omg_global_param omg_param);
unsigned int next_block(int current_bn, omg_global_param omg_param);
unsigned int selected_blockn(int block_n,int type,int div);
#endif
......@@ -29,8 +29,8 @@
/*! \file job.c
* \brief handle jobs for future nodes' update
* \author M. Mahersi, J. Harri, N. Nikaein,
* \date 2011
* \author S. Gashaw, M. Mahersi, J. Harri, N. Nikaein,
* \date 2014
* \version 0.1
* \company Eurecom
* \email:
......@@ -44,42 +44,78 @@
#include "omg.h"
Job_list add_job(Pair job, Job_list Job_Vector){
Job_list entry = malloc(sizeof(Job_list));
job_list *
add_job (pair_struct * job, job_list * job_vector)
{
job_list *tmp;
job_list *entry = (job_list *) malloc (sizeof (struct job_list_struct));
entry->pair = job;
entry->next = NULL;
if (job_vector != NULL)
{
//LOG_D(OMG, " Job_Vector_len %d", Job_Vector_len);
tmp = job_vector;
tmp->next = entry;
}
return entry;
}
//add_job2
job_list *
addjob (pair_struct * job, job_list * job_vector)
{
job_list *tmp;
job_list *entry = (job_list *) malloc (sizeof (struct job_list_struct));
entry->pair = job;
entry->next = NULL;
if (Job_Vector == NULL) {
//LOG_D(OMG, "empty Job_Vector\n");
//LOG_D(OMG, "added elmt ID %d\n", entry->pair->b->ID);
if (job_vector == NULL)
{
return entry;
}
else {
Job_list tmp = Job_Vector;
while (tmp->next != NULL){
else
{
tmp = job_vector;
while (tmp->next != NULL)
{
tmp = tmp->next;
}
tmp->next = entry;
//LOG_D(OMG, "non empty Job_Vector\n");
//LOG_D(OMG, "dded elmt ID %d\n", entry->pair->b->ID);
return Job_Vector;
tmp->next = entry;
}
}
return job_vector;
}
// display list of jobs
void display_job_list(Job_list Job_Vector){
void
display_job_list (double curr_t, job_list * job_vector)
{
Job_list tmp = Job_Vector;
if (tmp == NULL){LOG_D(OMG, "Empty Job_list\n");}
else{
job_list *tmp = job_vector;
if (tmp == NULL)
{
LOG_D (OMG, "Empty Job_list\n");
}
else
{
//LOG_D(OMG, "first_Job_time in Job_Vector %f\n", Job_Vector->pair->a);
while (tmp != NULL){
if ((tmp->pair != NULL))
LOG_D(OMG, "node %d \ttime %.2f\n", tmp->pair->b->ID, tmp->pair->a);
while (tmp != NULL)
{
if ((tmp->pair != NULL) /*&& tmp->pair->b->id==0 */ )
//LOG_D(OMG, "%.2f %.2f \n",tmp->pair->b->x_pos, tmp->pair->b->y_pos);
LOG_D (OMG, "%.2f %d %d %.2f %.2f %.2f\n", curr_t, tmp->pair->b->id,tmp->pair->b->gid,
tmp->pair->b->x_pos, tmp->pair->b->y_pos,
tmp->pair->b->mob->speed);
tmp = tmp->next;
......@@ -87,19 +123,48 @@ void display_job_list(Job_list Job_Vector){
}
}
//average nodes speed for each mobility type
unsigned int
nodes_avgspeed (job_list * job_vector)
{
job_list *tmp = job_vector;
unsigned int avg = 0, cnt = 0;
if (tmp == NULL)
{
LOG_D (OMG, "Empty Job_list\n");
return 0;
}
else
{
while (tmp != NULL)
{
if ((tmp->pair != NULL))
{
avg += tmp->pair->b->mob->speed;
cnt++;
}
tmp = tmp->next;
}
}
return avg / cnt;
}
// quick sort of the linked list
Job_list job_list_sort (Job_list list, Job_list end){
job_list *
job_list_sort (job_list * list, job_list * end)
{
Job_list pivot, tmp, next, before, after;
if ( list != end && list->next != end ){
job_list *pivot, *tmp, *next, *before, *after;
if (list != end && list->next != end)
{
pivot = list;
before = pivot;
after = end;
for ( tmp=list->next; tmp != end; tmp=next )
for (tmp = list->next; tmp != end; tmp = next)
{
next = tmp->next;
if (tmp->pair->a > pivot->pair->a)
if (tmp->pair->next_event_t > pivot->pair->next_event_t)
tmp->next = after, after = tmp;
else
tmp->next = before, before = tmp;
......@@ -114,57 +179,37 @@ Job_list job_list_sort (Job_list list, Job_list end){
return list;
}
Job_list quick_sort (Job_list list)
job_list *
quick_sort (job_list * list)
{
return job_list_sort(list, NULL);
return job_list_sort (list, NULL);
}
Job_list remove_job(Job_list list, int nID, int node_type){
Job_list current, previous;
//int cond=0;
int i=0;
if (list == NULL){
return NULL;
}
else{ //start search
current = list;
if ((current != NULL) && (current->pair->b->ID == nID) && (current->pair->b->type == node_type )){LOG_D(OMG, "(current != NULL) && (current->pair->b->ID != nID) && (current->pair->b->type != node_type ");}
while ( (current != NULL) && ((current->pair->b->ID != nID) || (current->pair->b->type != node_type ))){
LOG_D(OMG, "current->pair->b->ID %d",current->pair->b->ID);
LOG_D(OMG, "nID %d",nID);
LOG_D(OMG, "current->pair->b->type %d",current->pair->b->type ); // UE, eNB 1
LOG_D(OMG, "node_type %d",node_type ); //UE, eNB 0
LOG_D(OMG, "current->pair->b->generator %d",current->pair->b->generator ); //static
LOG_D(OMG, "i = %d", i);
previous = current; // previous hobbles after
current = current->next;
i++;
if (current ==NULL){LOG_D(OMG, "current ==NULL");}
job_list *
remove_job (job_list * list, int nid, int node_type)
{
}
job_list *current, *previous;
current = list;
previous = NULL;
while (current != NULL)
{
if (current->pair->b->id == nid && current->pair->b->type == node_type)
{
if (current == list || previous == NULL)
list = current->next;
else
previous->next = current->next;
//if (current->pair->b->ID == nID){LOG_D(OMG, "current->pair->b->ID == nID");}
//if (current->pair->b->type == node_type){LOG_D(OMG, "current->pair->b->type == node_type");}
free (current);
break;
if (current ==NULL) {
LOG_D(OMG," Job to remove is not found\n "); //LOG_N
return NULL;
} //value not found
else{
if (current == list) {
list = current->next ;
LOG_D(OMG,"Job to remove is found at the beginning\n");
}
else {
previous->next = current->next;
}
previous = current;
current = current->next;
}
return list;
}
}
}
CC= gcc
OBJstatic = omg.c common.c static.c
OBJrwp = omg.c common.c job.c rwp.c
OBJrwp = omg.c common.c job.c rwp.c grid.c
OBJrwalk = omg.c common.c job.c rwalk.c
OBJtrace = omg.c common.c job.c trace.c mobility_parser.c omg_hashtable.c
OBJtrace = omg.c common.c job.c trace.c mobility_parser.c hashtable.c
OBJsumo = omg.c common.c sumo.c client_traci_OMG.c socket_traci_OMG.c storage_traci_OMG.c id_manager.c
OBJ = omg.c common.c static.c job.c rwp.c rwalk.c trace.c sumo.c mobility_parser.c omg_hashtable.c client_traci_OMG.c socket_traci_OMG.c storage_traci_OMG.c id_manager.c
OBJ = omg.c common.c static.c job.c rwp.c rwalk.c trace.c steadystaterwp.c sumo.c grid.c mobility_parser.c hashtable.c client_traci_OMG.c socket_traci_OMG.c storage_traci_OMG.c id_manager.c
CFLAGS += -DSTANDALONE -DUSER_MODE
CFLAGS += -DSTANDALONE -DUSER_MODE -g
.PHONY: help staticOMG rwpOMG clean
......
This diff is collapsed.
......@@ -41,62 +41,16 @@
#ifndef MOBILITY_PARSER_H_
#define MOBILITY_PARSER_H_
#include "omg_hashtable.h"
#include "trace_hashtable.h"
/**
* @struct Simple struct to hold only few information
* @brief The entry in each node is a line from the external mobility file
*/
typedef struct Exnode {
double time;
int vid;
double x;
double y;
double speed;
int visit;
struct Exnode* next;
}Exnode;
/**
* @struct struct acts as gateway to hashtable
* @brief holds vehicle id and initial pointer to the head of the linked list in hastable
*/
typedef struct node_info {
int vid;
int *vid_addr;
struct node_info* next;
//struct node_info* prev;
}node_info;
// head pointer to a linked list containing vid,vid_addr
/**
* function just to initialize the head of the linked list to NULL, this can be removed later(check).
*/
struct Exnode* gen_list();
/**
* Function to append the line content to build a linked list.
* @param headRef is the pointer to the head of the existing list to which append has to be done
* @param newNode , item to be appended
*/
void AppendNode(struct Exnode* headRef, struct Exnode* newNode);
/**
* function just prints the linked list (need to be removed, used for testing)
* @param pointer to the head of the linked list
*/
void print_list(struct Exnode* head);
/**
/*
* function reads each line and checks if vehicle has an entry in the hastable,
* if so append append is called else a new linked list to the vehicle is created.
* @param need mobility file to be given
*/
void read_mobility_file(); // mobility file need to be given here, add in omg_param_list, get it from there
void parse_data (char *trace_file, int node_type); // mobility file need to be given here, add in omg_param_list, get it from there
/**
* function builds a linked list which holds vehicle id and its mapping pointer to
......@@ -105,23 +59,16 @@ void read_mobility_file(); // mobility file need to be given here, add in omg_pa
* @param vid is the vehicle id
* @param pointer to the head of the linked list to the vehicle entry in the hash table
*/
node_info* build_node_info(node_info* headRef, int vid, int *vid_addr);
void add_node_info (int nid,int n_gid, int node_type);
int find_node_info (int vid, int node_type);
/**
* just counts the number of nodes in the mobility file
*/
int get_num_nodes();
int get_number_of_nodes (int node_type);
/**
* these function are used since there might be a possibility if user provides a mobility
* discription which is out of order.
* @param hashtable
* @param starting pointer for the vehicles linked list
* @param ending pointer of the vehicles linked list
*/
void sort_veh_movement(omg_hash_table_t *table);
void quicksortlist(Exnode *pLeft, Exnode *pRight);
/**
* function returns the node containing next position (just reads the linked list from the hashtable)
......@@ -129,10 +76,8 @@ void quicksortlist(Exnode *pLeft, Exnode *pRight);
* @param hashtable from which the node is to be looked
* @param node_id is the nodes whose next location need to be retrieved from the linked list
*/
Exnode* get_next_position(omg_hash_table_t *table,int node_id);
node_data* get_next_data (hash_table_t* table, int vid, int flag);
void reset_visit_status(omg_hash_table_t *table, float time, int node_id);
void clear_llist();
#endif /* MOBILITY_PARSER_H_ */
This diff is collapsed.
......@@ -30,7 +30,7 @@
/*! \file OMG.h
* \brief Prototypes of OMG functions that may be called by OCG
* \author M. Mahersi, N. Nikaein, J. Harri
* \date 2011
* \date 2011 - 2014
* \version 0.1
* \company Eurecom
* \email:
......@@ -43,6 +43,7 @@
#include "omg_constants.h"
#include "defs.h"
#include "omg_vars.h"
#if STANDALONE
#define LOG_G(c, x...) printf(x)
#define LOG_A(c, x...) printf(x)
......@@ -57,6 +58,8 @@
#else
#include "UTIL/LOG/log.h"
#endif
/** @defgroup _omg OpenAir Mobility Generation (OMG)
......@@ -195,14 +198,14 @@ void init_omg_global_params(void);
* \brief Assign initial positions to all the nodes. To do so, call the start_generator..... function corresponding to each requested mobility generator
* \param omg_param_list a structure that contains the main parameters needed to establish the random positions distribution
*/
void init_mobility_generator(omg_global_param omg_param_list);
void init_mobility_generator(omg_global_param omg_param_list[]);
/**
* \fn void stop_mobility_generator(int mobility_type)
* \brief Call the destructor for the respective mobility type.
* \param int mobility_type to stop and call destructor
*/
void stop_mobility_generator(int mobility_type);
void stop_mobility_generator(omg_global_param* omg_param_list);
/**
* \fn void update_nodes(double cur_time)
......@@ -220,9 +223,9 @@ void update_nodes(double cur_time);
* \param cur_time a variable of type double that represents the current time
* \return a Node_list structure that stores the basic information about the all the nodes of a given mobility model
*/
Node_list get_current_positions(int mobility_type, int node_type, double cur_time);
node_list* get_current_positions(int mobility_type, int node_type, double cur_time);
void get_nodes_positions (int mobility_type, double cur_time);
/**
* \fn void set_new_mob_type(int nID, int node_type, int new_mob, double cur_time)
......
......@@ -45,14 +45,29 @@ RWP, /*!< Random Way Point mobility model */
RWALK, /*!< Random Walk mobility model */
TRACE, /*!< Trace-based Mobility description file */
SUMO, /*!< SUMO-based mobility model */
STEADY_RWP, /*!steady state RWP*/
MAX_NUM_MOB_TYPES /*!< The maximum number of mobility models. Used to adjust the length of the #Node_Vector */
}mobility_types;
/*
* this is a sub type of standard RWP (not steady_RWP)
*/
typedef enum {
MIN_RWP_TYPES=0, /*!< STATIC mobility model */
RESTIRICTED_RWP, /*!< Random Way Point mobility model */
CONNECTED_DOMAIN, /*!< Random Walk mobility model */
MAX_RWP_TYPES /*!< The maximum number of mobility models. Used to adjust the length of the #Node_Vector */
}omg_rwp_types;
//#define RESTIRICTED_RWP 1
//#define CONNECTED_DOMAIN 2
/*! The available nodes types */
typedef enum {
eNB=0, /*!< enhanced Node B */
UE, /*!< User Equipement */
ALL /*!< All the types. Used to perform the same operations to all the types of nodes */
RELAY,
MAX_NUM_NODE_TYPES /*!< All the types. Used to perform the same operations to all the types of nodes */
}node_types;
......@@ -60,6 +75,11 @@ ALL /*!< All the types. Used to perform the same operations to all the types of
/*! A constant used to compare two doubles */
#define eps 0.10 //10.99
#define SLEEP 1
#define GET_DATA 0
#define GET_DATA_UPDATE 1
#endif /* __OMG_H_ */
......@@ -39,21 +39,29 @@
#include "omg.h"
/*!A global variable used to store all the nodes information. It is an array in which every cell stocks the nodes information for a given mobility type. Its length is equal to the maximum number of mobility models that can exist in a single simulation scenario */
Node_list Node_Vector[MAX_NUM_MOB_TYPES];
node_list* node_vector[MAX_NUM_NODE_TYPES];
node_list* node_vector_end[MAX_NUM_NODE_TYPES];
/*! A global variable which represents the length of the Node_Vector */
int Node_Vector_len[MAX_NUM_MOB_TYPES];
int node_vector_len[MAX_NUM_NODE_TYPES];
/*!a global veriable used for event average computation*/
int event_sum[100];
int events[100];
/*!A global variable used to store the scheduled jobs, i.e (node, job_time) peers */
Job_list Job_Vector;
job_list* job_vector[MAX_NUM_MOB_TYPES];
job_list* job_vector_end[MAX_NUM_MOB_TYPES];
/*! A global variable which represents the length of the Job_Vector */
int Job_Vector_len;
int job_vector_len[MAX_NUM_MOB_TYPES];
/*! A global variable used gather the fondamental parameters needed to launch a simulation scenario*/
omg_global_param omg_param_list;
omg_global_param omg_param_list[MAX_NUM_NODE_TYPES];
//double m_time;
/*!A global variable used to store selected node position generation way*/
int grid;
double xloc_div;
double yloc_div;
#endif /* __OMG_VARS_H__ */
This diff is collapsed.
......@@ -49,7 +49,7 @@ int start_rwalk_generator(omg_global_param omg_param_list) ;
* \brief Called by the function start_rwalk_generator(), it generates a random position ((X,Y) coordinates) for a node and add it to the corresponding Node_Vector_Rwp
* \param node a pointer of type NodePtr that represents the node to which the random position is assigned
*/
void place_rwalk_node(NodePtr node) ;
void place_rwalk_node(node_struct* node) ;
/**
* \fn Pair sleep_rwalk_node(NodePtr node, double cur_time)
......@@ -58,7 +58,7 @@ void place_rwalk_node(NodePtr node) ;
* \param cur_time a variable of type double that represents the current time
* \return A Pair structure containing the node and the time when it is reaching the destination
*/
Pair sleep_rwalk_node(NodePtr node, double cur_time) ;
void sleep_rwalk_node(pair_struct* pair, double cur_time) ;
/**
......@@ -68,7 +68,7 @@ Pair sleep_rwalk_node(NodePtr node, double cur_time) ;
* \param cur_time a variable of type double that represents the current time
* \return A Pair structure containing the node structure and the arrival time at the destination
*/
Pair move_rwalk_node(NodePtr node, double cur_time) ;
void move_rwalk_node(pair_struct* pair, double cur_time) ;
/**
* \fn void update_rwalk_nodes(double cur_time)
......@@ -87,4 +87,7 @@ void update_rwalk_nodes(double cur_time) ; // need to implement an out-of-area c
*/
void get_rwalk_positions_updated(double cur_time) ;
/*for perfect simulation of random walk*/
double residualtime(omg_global_param omg_param);
#endif /* RWALK_H_ */
This diff is collapsed.
......@@ -37,7 +37,7 @@
#define RWP_H_
#include "omg.h"
#include "grid.h"
/**
* \fn void start_rwp_generator(omg_global_param omg_param_list)
......@@ -51,7 +51,7 @@ int start_rwp_generator(omg_global_param omg_param_list) ;
* \brief Called by the function start_rwp_generator(), it generates a random position ((X,Y) coordinates) for a node and add it to the Node_Vector_Rwp
* \param node a pointer of type NodePtr that represents the node to which the random position is assigned
*/
void place_rwp_node(NodePtr node);
void place_rwp_node(node_struct* node);
/**
* \fn Pair sleep_rwp_node(NodePtr node, double cur_time)
......@@ -61,7 +61,7 @@ void place_rwp_node(NodePtr node);
* \param cur_time a variable of type double that represents the current time
* \return A Pair structure containing the node and the time when it is reaching the destination
*/
Pair sleep_rwp_node(NodePtr node, double cur_time) ;
void sleep_rwp_node(pair_struct* pair, double cur_time) ;
/**
* \fn Pair move_rwp_node(NodePtr node, double cur_time)
......@@ -71,7 +71,7 @@ Pair sleep_rwp_node(NodePtr node, double cur_time) ;
* \param cur_time a variable of type double that represents the current time
* \return A Pair structure containing the node structure and the arrival time at the destination
*/
Pair move_rwp_node(NodePtr node, double cur_time) ;
void move_rwp_node(pair_struct* pair, double cur_time);
/**
* \fn void update_rwp_nodes(double cur_time)
......
......@@ -77,17 +77,17 @@ int connection_(char *, int);
void sendExact(int);
/**
* \fn recieveExact();
* \fn recieveExact(void);
* \brief Pack the data to storage from buf after reading from socket
* Returns storage pointer
*/
storage* receiveExact();
storage* receiveExact(void);
/**
* \fn close_connection();
* \fn close_connection(void);
* \brief close socket connection
*/
void close_connection();
void close_connection(void);
#endif
This diff is collapsed.
......@@ -51,6 +51,6 @@ void start_static_generator(omg_global_param omg_param_list);
* \brief Generates a random position ((X,Y) coordinates) and assign it to the node passed as argument. This latter node is then added to the Node_Vector[STATIC]
* \param node a pointer of type NodePtr that represents the node to which the random position is assigned
*/
void place_static_node(NodePtr node);
void place_static_node(node_struct* node);
#endif /* STATIC_H_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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