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
......@@ -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
......
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,127 +44,172 @@
#include "omg.h"
Job_list add_job(Pair job, Job_list Job_Vector){
Job_list entry = malloc(sizeof(Job_list));
entry->pair = job;
//LOG_D(OMG, " Job_Vector_len %d", Job_Vector_len);
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);
return entry;
}
else {
Job_list 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;
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)
{
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)
{
return entry;
}
else
{
tmp = job_vector;
while (tmp->next != NULL)
{
tmp = tmp->next;
}
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
{
//LOG_D(OMG, "first_Job_time in Job_Vector %f\n", Job_Vector->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);
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);
tmp = tmp->next;
tmp = tmp->next;
}
}
}
}
//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 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 )
{
next = tmp->next;
if (tmp->pair->a > pivot->pair->a)
tmp->next = after, after = tmp;
else
tmp->next = before, before = tmp;
}
before = job_list_sort (before, pivot);
after = job_list_sort (after, end);
pivot->next = after;
return before;
job_list *
job_list_sort (job_list * list, job_list * 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)
{
next = tmp->next;
if (tmp->pair->next_event_t > pivot->pair->next_event_t)
tmp->next = after, after = tmp;
else
tmp->next = before, before = tmp;
}
before = job_list_sort (before, pivot);
after = job_list_sort (after, end);
pivot->next = after;
return before;
}
return list;
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
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;
free (current);
break;
}
previous = current;
current = current->next;
i++;
if (current ==NULL){LOG_D(OMG, "current ==NULL");}
}
//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");}
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;
}
}
return list;
}
}
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
......@@ -29,11 +29,11 @@
/*! \file rwalk.c
* \brief static mobility generator
* \author M. Mahersi, J. Harri, N. Nikaein, Andre Gomes (One source)
* \author M. Mahersi, N. Nikaein, J. Harri
* \date 2011
* \version 0.1
* \company Eurecom
* \email: openair_tech@eurecom.fr
* \email:
* \note
* \warning
*/
......@@ -41,79 +41,103 @@
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include "static.h"
void
start_static_generator (omg_global_param omg_param_list)
{
int id;
static int n_id = 0;
node_struct *node = NULL;
mobility_struct *mobility = NULL;
srand (omg_param_list.seed + STATIC);
LOG_I (OMG, "Static mobility model for %d %d nodes\n", omg_param_list.nodes,
omg_param_list.nodes_type);
for (id = n_id; id < (omg_param_list.nodes + n_id); id++)
{
node = create_node ();
mobility = create_mobility ();
node->id = id;
node->type = omg_param_list.nodes_type;
node->mob = mobility;
node->generator = STATIC;
place_static_node (node); //initial positions
}
n_id += omg_param_list.nodes;
#include "omg.h"
void place_static_node(NodePtr node);
void start_static_generator(omg_global_param omg_param_list) {
int n_id=0;
// double cur_time = 1.0;
NodePtr node = NULL;
MobilityPtr mobility = NULL;
if (omg_param_list.nodes <= 0){
LOG_W(OMG, "Number of static nodes has not been set\n");
return;
}
srand(omg_param_list.seed + STATIC);
// for (n_id = omg_param_list.first_ix; n_id< omg_param_list.first_ix + omg_param_list.nodes; n_id++){
if (omg_param_list.nodes_type == eNB) {
LOG_I(OMG, "Static mobility model for %d eNBs \n", omg_param_list.nodes);
} else if (omg_param_list.nodes_type == UE) {
LOG_I(OMG, "Static mobility model for %d UE\n",omg_param_list.nodes);
}
for (n_id = 0; n_id< omg_param_list.nodes; n_id++) {
node = (NodePtr) create_node();
mobility = (MobilityPtr) create_mobility();
node->ID = n_id;
node->generator = omg_param_list.mobility_type;
node->type = omg_param_list.nodes_type;
node->mob = mobility;
node->generator = STATIC;
place_static_node(node); //initial positions
}
}
void place_static_node(NodePtr node) {
if (omg_param_list.user_fixed && node->type == eNB) {
if (omg_param_list.fixed_X <= omg_param_list.max_X && omg_param_list.fixed_X >= omg_param_list.min_X)
node->X_pos = omg_param_list.fixed_X;
else
node->X_pos = (double) ((int) (randomGen(omg_param_list.min_X, omg_param_list.max_X)*100))/ 100;
node->mob->X_from = node->X_pos;
node->mob->X_to = node->X_pos;
if (omg_param_list.fixed_Y <= omg_param_list.max_Y && omg_param_list.fixed_Y >= omg_param_list.min_Y)
node->Y_pos = omg_param_list.fixed_Y;
else
node->Y_pos = (double) ((int) (randomGen(omg_param_list.min_Y,omg_param_list.max_Y)*100))/ 100;
node->mob->Y_from = node->Y_pos;
node->mob->Y_to = node->Y_pos;
}
else {
node->X_pos = (double) ((int) (randomGen(omg_param_list.min_X, omg_param_list.max_X)*100))/ 100;
node->mob->X_from = node->X_pos;
node->mob->X_to = node->X_pos;
node->Y_pos = (double) ((int) (randomGen(omg_param_list.min_Y,omg_param_list.max_Y)*100))/ 100;
node->mob->Y_from = node->Y_pos;
node->mob->Y_to = node->Y_pos;
}
void
place_static_node (node_struct * node)
{
if (omg_param_list[node->type].user_fixed && node->type == eNB)
{
if (omg_param_list[node->type].fixed_x <=
omg_param_list[node->type].max_x
&& omg_param_list[node->type].fixed_x >=
omg_param_list[node->type].min_x)
node->x_pos = omg_param_list[node->type].fixed_x;
else
node->x_pos =
(double) ((int)
(randomgen
(omg_param_list[node->type].min_x,
omg_param_list[node->type].max_x) * 100)) / 100;
node->mob->x_from = node->x_pos;
node->mob->x_to = node->x_pos;
if (omg_param_list[node->type].fixed_y <=
omg_param_list[node->type].max_y
&& omg_param_list[node->type].fixed_y >=
omg_param_list[node->type].min_y)
node->y_pos = omg_param_list[node->type].fixed_y;
else
node->y_pos =
(double) ((int)
(randomgen
(omg_param_list[node->type].min_y,
omg_param_list[node->type].max_y) * 100)) / 100;
node->mob->y_from = node->y_pos;
node->mob->y_to = node->y_pos;
}
else
{
node->x_pos =
(double) ((int)
(randomgen
(omg_param_list[node->type].min_x,
omg_param_list[node->type].max_x) * 100)) / 100;
node->mob->x_from = node->x_pos;
node->mob->x_to = node->x_pos;
node->y_pos =
(double) ((int)
(randomgen
(omg_param_list[node->type].min_y,
omg_param_list[node->type].max_y) * 100)) / 100;
node->mob->y_from = node->y_pos;
node->mob->y_to = node->y_pos;
}
node->mob->speed = 0.0;
node->mob->journey_time = 0.0;
LOG_I(OMG, "[STATIC] Initial position of node ID: %d type(UE, eNB): %d (X = %.2f, Y = %.2f) speed = 0.0\n", node->ID, node->type, node->X_pos, node->Y_pos);
Node_Vector[STATIC] = (Node_list) add_entry(node, Node_Vector[STATIC]);
Node_Vector_len[STATIC]++;
//Initial_Node_Vector_len[STATIC]++;
}
LOG_I (OMG,
"[STATIC] Initial position of node ID: %d type(%d): (X = %.2f, Y = %.2f) speed = 0.0\n",
node->id, node->type, node->x_pos, node->y_pos);
node_vector_end[node->type] =
(node_list *) add_entry (node, node_vector_end[node->type]);
if (node_vector[node->type] == NULL)
node_vector[node->type] = node_vector_end[node->type];
node_vector_len[node->type]++;
}
......@@ -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.
/*******************************************************************************
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 steadystaterwp.h
* \brief random waypoint mobility generator
* \date 2014
* \version 0.1
* \company Eurecom
* \email:
* \note
* \warning
*/
#ifndef STEADYSTATERWP_H_
#define STEADYSTATERWP_H_
int start_steadystaterwp_generator (omg_global_param omg_param_list);
void place_steadystaterwp_node (node_struct* node);
void sleep_steadystaterwp_node (pair_struct* pair, double cur_time);
void move_steadystaterwp_node (pair_struct* pair, double cur_time);
double pause_probability(omg_global_param omg_param);
double initial_pause(omg_global_param omg_param);
double initial_speed(omg_global_param omg_param);
void update_steadystaterwp_nodes (double cur_time);
void get_steadystaterwp_positions_updated (double cur_time);
#endif
......@@ -204,12 +204,12 @@ void writeString(char *s){
}
String_list readStringList(String_list vector){
string_list* readStringList(string_list* vector){
int i=0;
int len = readInt();
descLen = len;
String_list entry = NULL;
string_list* entry = NULL;
for (; i < len; i++) {
if (vector->string == NULL) {
......@@ -218,14 +218,14 @@ String_list readStringList(String_list vector){
vector->string = tmp;//readString();
}
else {
entry = (String_list)malloc(sizeof(String_list));
entry = (string_list*) malloc(sizeof(string_list));
char *tmp = readString();
//printf("OMG - SUMO ID: %s \n",tmp);
entry->string = tmp;//readString();
entry->next = NULL;
if(vector !=NULL) {
String_list tmp = vector;
string_list* tmp = vector;
while (tmp->next != NULL){
tmp = tmp->next;
}
......@@ -238,11 +238,11 @@ String_list readStringList(String_list vector){
}
void writeStringList(String_list vector){
void writeStringList(string_list* vector){
int count=0;
String_list tmp = vector;
string_list* tmp = vector;
// JHNote: a better solution would be to save the pointer to the reference of this Int and replace the value with count at the end....
if (tmp->string !=NULL)
count++;
......@@ -463,9 +463,9 @@ void freeStorage(storage * freePtr){
freePtr = NULL; // finally, mark as empty list.
}
void reset_String_list(String_list vector) {
String_list entry = vector;
String_list tmp;
void reset_String_list(string_list* vector) {
string_list* entry = vector;
string_list* tmp;
while (entry->next != NULL) {
tmp = entry;
......
......@@ -58,7 +58,7 @@ union n{
} un ;
void check_endianness();
void check_endianness(void);
//----------------STORAGE------------------------------------
struct Storage {
......@@ -78,36 +78,36 @@ int descLen;
extern int msgLength;
void reset();
void reset(void);
int storageLength(storage *);
void rearange();
unsigned char readChar();
void rearange(void);
unsigned char readChar(void);
void writeChar(unsigned char);
int readByte() ;
int readByte(void) ;
void writeByte(int) ;
int readUnsignedByte();
int readUnsignedByte(void);
void writeUnsignedByte(int);
char * readString() ;
char * readString(void) ;
void writeString(char *);
String_list readStringList(String_list) ;
void writeStringList(String_list);
string_list* readStringList(string_list*) ;
void writeStringList(string_list*);
int readShort() ;
int readShort(void) ;
void writeShort(int);
int readInt() ;
int readInt(void) ;
void writeInt(int);
float readFloat() ;
float readFloat(void) ;
void writeFloat( float );
double readDouble() ;
double readDouble(void) ;
void writeDouble( double );
storage* writePacket(unsigned char*, int);
......
This diff is collapsed.
......@@ -50,11 +50,11 @@
/*! A global variable used to store the SUMO process ID to later kill it smoothly when OAI askes OMG to stop SUMO*/
pid_t pid;
/*! A sumo global variable representing the OMG-SUMO ID manager. It is created at the start_sumo_generator() and keep a mapping between SUMO and OAI IDs. */
/*! A sumo global variable representing the OMG-SUMO ID manager. It is created at the start_sumo_generator(void) and keep a mapping between SUMO and OAI IDs. */
IDManagerPtr id_manager;
/*! A Node_list intended to contain the list of OAI 'active' nodes in SUMO. replaces the return of the full Node_Vector when OAI requests the new positions of its nodes. The list is reset at each use, but the pointer to the respective nodes is just set to NULL*/
Node_list active_nodes;
node_list* active_nodes;
/*! A global variable keeping track of the last update time of SUMO, to be used to get the update interval when update_sumo_nodes(cur_time) is called */
double last_update_time;
......@@ -79,7 +79,7 @@ void update_sumo_nodes(double cur_time) ;
* \brief Get the current position and speed of a node from SUMO. Invokes TraCI
* \param node the pointer to a node we want to synch with SUMO.
*/
void update_sumo_positions(NodePtr node);
void update_sumo_positions(node_struct* node);
/**
* \fn Node_list get_sumo_positions_updated(double cur_time);
......@@ -87,7 +87,7 @@ void update_sumo_positions(NodePtr node);
* \param cur_time a variable of type double that represents the current time
* \return the list of ACTIVE OAI nodes, which positions have been updated by SUMO
*/
Node_list get_sumo_positions_updated(double cur_time);
node_list* get_sumo_positions_updated(double cur_time);
/**
* \fn NodePtr get_first_inactive_OAI_node(Node_list list, int node_type)
......@@ -96,13 +96,13 @@ Node_list get_sumo_positions_updated(double cur_time);
* \param node_type the type of node we would like to locate (here: SUMO)
* \return the reference to the first inactive OAI node; returns NULL is none could be found (all OAI nodes are currently active)
*/
NodePtr get_first_inactive_OAI_node(Node_list list, int node_type);
node_struct* get_first_inactive_OAI_node(node_list* list, int node_type);
/**
* \fn void update_IDs(String_list *departed, String_list *arrived)
* \brief Updates the mapping between SUMO and OAI nodes; Once a node departs in SUMO, it is mapped to a inactive OAI node. If none are found, the SUMO node will not have any mapping. Once a node arrives, the mapping is removed and the OAI node becomes inactive again. When an OAI node is inactive, it mobility parameters are invalid and MUST NOT be used/requested by OAI.
*/
void update_IDs();
void update_IDs(void);
/**
* \fn bool desactive_and_unmap(char *sumo_id)
......@@ -122,10 +122,10 @@ bool desactivate_and_unmap(char *sumo_id);
bool activate_and_map(char *sumo_id);
/**
* \fn int stop_sumo_generator()
* \fn int stop_sumo_generator(void)
* \brief stops SUMO, stop the socket and kills SUMO process in the child domain.
* \return true in case of success; false otherwise
*/
bool stop_sumo_generator();
bool stop_sumo_generator(void);
#endif /* SUMO_H_ */
This diff is collapsed.
......@@ -42,65 +42,22 @@
#define TRACE_H_
//#include "defs.h"
#include "omg.h"
#include "hashtable.h"
#include "trace_hashtable.h"
#include "mobility_parser.h"
int start_trace_generator (omg_global_param omg_param_list);
/**
* \fn void start_trace_generator(omg_global_param omg_param_list)
* \brief Start the TRACE model by setting the initial positions of each node then letting it sleep for a random duration and adding this job to the Job_Vector
* \param omg_param_list a structure that contains the main parameters needed to establish the random positions distribution
*/
int start_trace_generator(omg_global_param omg_param_list) ;
/**
* \fn int create_trace_node(node_info *head_node)
* \brief Called by the function start_trace_generator(), it assigns position ((X,Y) coordinates) for a node from mobility file 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
*/
int create_trace_node(NodePtr node,node_info *head_node) ;
/**
* \fn void place_rwp_node(NodePtr node)
* \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_trace_node(NodePtr node) ;
int deploy_nodes();
/**
* \fn Pair sleep_rwp_node(NodePtr node, double cur_time)
* \brief Called by the function start_rwp_generator(omg_global_param omg_param_list) and update_rwp_nodes(double cur_time), it allows the node to sleep for a random duration starting
* from the current time
* \param node a pointer of type NodePtr that represents the node to which the random sleep duration is assigned
* \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_trace_node(NodePtr node, double cur_time,float sleep_duration) ;
Pair keep_awake_trace_node(NodePtr node, double cur_time,float duration,int jump);
/**
* \fn Pair move_rwp_node(NodePtr node, double cur_time)
* \brief Called by the function update_rwp_nodes(double cur_time), it computes the next destination of a node ((X,Y) coordinates and the arrival
* time at the destination)
* \param node a variable of type NodePtr that represents the node that has to move
* \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_trace_node(NodePtr node, double cur_time) ;
/**
* \fn void update_rwp_nodes(double cur_time)
* \brief Update the positions of the nodes. After comparing the current time to the first job_time, it is decided wether to start
* \ a new job or to keep the current job
* \param cur_time a variable of type double that represents the current time
*/
void update_trace_nodes(double cur_time) ;
/**
* \fn void get_rwp_positions_updated(double cur_time)
* \brief Compute the positions of the nodes at a given time in case they are moving (intermediate positions). Otherwise, generate a message saying that
* the nodes are still sleeping
* \param cur_time a variable of type double that represents the current time
*/
void get_trace_positions_updated(double cur_time);
void place_trace_node (node_struct* node, node_data* n);
void move_trace_node (pair_struct* pair, node_data* n_data, double cur_time);
void schedule_trace_node ( pair_struct* pair, node_data* n_data, double cur_time);
void sleep_trace_node ( pair_struct* pair, node_data* n_data, double cur_time);
void update_trace_nodes (double cur_time);
void get_trace_positions_updated (double cur_time);
void clear_list (void);
#endif /* TRACE_H_ */
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