From 20df6d2665cdf5fd53e799d140a0f66ed613ba06 Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Mon, 11 Aug 2014 13:58:06 +0000 Subject: [PATCH] few bug fixes for trace-drive openair mobility generator (OMG) git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5697 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openair2/UTIL/OMG/TRACE/README.TXT | 15 +++++++---- openair2/UTIL/OMG/TRACE/handover.tr | 20 ++++++++++----- openair2/UTIL/OMG/trace.c | 38 +++++++++++++++++++--------- targets/SIMU/USER/oaisim.c | 2 +- targets/SIMU/USER/oaisim_functions.c | 8 +++--- 5 files changed, 54 insertions(+), 29 deletions(-) diff --git a/openair2/UTIL/OMG/TRACE/README.TXT b/openair2/UTIL/OMG/TRACE/README.TXT index 525d0e951e..cc592be40c 100644 --- a/openair2/UTIL/OMG/TRACE/README.TXT +++ b/openair2/UTIL/OMG/TRACE/README.TXT @@ -11,12 +11,17 @@ Notes: - OMG TRACE support mobility input given in the following format: - TIME(s) NODE_ID NODE_POS_X NODE_POS_Y NODE_SPEED(m/s) + EXPECTED_TIME(s) NODE_ID NODE_POS_X NODE_POS_Y NODE_SPEED(m/s) - Note: OMG uses the speed (NODE_SPEED) at this time (TIME) from this position (NODE_POS_X,NODE_POS_Y) for this NODE_ID - - each input may be ordered (in time) or not - - - The mobility described in the mobility file strictly follows the simulation time, only condition where it doesn't follow is, when a node fails to reach its next point (in time) from where it has to start next journey. + Notes: + 1) OMG uses the speed (NODE_SPEED) at this time (TIME) from this position (NODE_POS_X,NODE_POS_Y) for this NODE_ID + 2) each input may be ordered (in time) or not + 3) early arrivals at each points cause a sleep for a duration of the time difference + 4) late arrivals for each points cause nothing (no jump), the point will be reached later in time. + 5) all the points will be reached based on their expected times. + 6) if the first expected time is greater than zero, then the node will be in a pause state at the initial position for the duration of the expected time + 7) The mobility described in the mobility file strictly follows the simulation time, only condition where it doesn't follow is, when a node fails to reach its next point (in time) from where it has to start next journey. + 8) the speed for the last expected time is ignored ---------------------------------------------------------------------------------- The OpenAirInterface Team diff --git a/openair2/UTIL/OMG/TRACE/handover.tr b/openair2/UTIL/OMG/TRACE/handover.tr index d865d3445c..cbfa892d8c 100644 --- a/openair2/UTIL/OMG/TRACE/handover.tr +++ b/openair2/UTIL/OMG/TRACE/handover.tr @@ -1,7 +1,13 @@ -0 0 867 1440 20 -25 0 965 1560 20 -50 0 867 1440 20 -75 0 965 1560 20 -100 0 867 1440 20 -125 0 965 1560 20 - +0 0 867 1440 40 +1 0 887 1460 40 +2 0 907 1480 30 +3 0 927 1500 30 +4 0 947 1520 30 +5 0 967 1540 30 +6 0 987 1560 30 +7 0 1007 1580 30 +8 0 1027 1600 30 +9 0 1047 1620 30 +10 0 1067 1640 30 +11 0 1087 1660 30 +12 0 1107 1680 30 diff --git a/openair2/UTIL/OMG/trace.c b/openair2/UTIL/OMG/trace.c index c9e685951a..080e4326a6 100644 --- a/openair2/UTIL/OMG/trace.c +++ b/openair2/UTIL/OMG/trace.c @@ -254,16 +254,18 @@ sleep_trace_node (pair_struct * pair, node_data * n_data, double cur_time) node->y_pos = node->mob->y_to; //sleep duration + /* */ if (n_data->x_pos == n_data->next->x_pos && n_data->y_pos == n_data->next->y_pos) { node->mob->sleep_duration = n_data->next->time - n_data->time; - + LOG_D(OMG,"[TRACE] curretn and next lcoation are the same : sleep for %f\n",node->mob->sleep_duration); } - else + else /* early arrival*/ { //sleep case 2 - node->mob->target_time - (journeytime + node->mob->start_journey); - + //node->mob->sleep_duration = node->mob->target_time - (journeytime + node->mob->start_journey); + node->mob->sleep_duration = node->mob->target_time - pair->next_event_t; + LOG_D(OMG,"[TRACE] Early Arrival (target time > journeytime), sleep for %f target time was %f\n",node->mob->sleep_duration,node->mob->target_time); } node->mob->start_journey = cur_time; @@ -292,7 +294,12 @@ update_trace_nodes (double cur_time) my_node = tmp->pair->b; node_n = get_next_data (table[my_node->type], my_node->gid, DATA_ONLY); - if (node_n->next->next == NULL) + + //case1:time to next event equals to current time + if (tmp->pair != NULL && tmp->pair->next_event_t >= cur_time - eps + && tmp->pair->next_event_t <= cur_time ) + { + if (node_n->next->next == NULL) { tmp->pair->b->x_pos = tmp->pair->b->mob->x_to; tmp->pair->b->mob->x_from = tmp->pair->b->x_pos; @@ -305,12 +312,6 @@ update_trace_nodes (double cur_time) continue; } - - - //case1:time to next event equals to current time - if (tmp->pair != NULL && tmp->pair->next_event_t >= cur_time - eps - && tmp->pair->next_event_t <= cur_time + eps) - { //LOG_D (OMG, "[TRACE] last data for all nodes\n"); if (my_node->mobile == 1) { @@ -366,8 +367,21 @@ update_trace_nodes (double cur_time) } //case2: current time is greater than the time to next event - else if (tmp->pair != NULL && cur_time - eps > tmp->pair->next_event_t) + else if (tmp->pair != NULL && cur_time > tmp->pair->next_event_t) + { + if (node_n->next->next == NULL) { + tmp->pair->b->x_pos = tmp->pair->b->mob->x_to; + tmp->pair->b->mob->x_from = tmp->pair->b->x_pos; + tmp->pair->b->y_pos = tmp->pair->b->mob->y_to; + tmp->pair->b->mob->y_from = tmp->pair->b->y_pos; + tmp->pair->b->mobile = 0; + tmp->pair->b->mob->speed = 0.0; + // LOG_D (OMG, "[TRACE] last data for all nodes\n"); + tmp = tmp->next; + continue; + } + while (cur_time >= tmp->pair->next_event_t) { diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index fc35dea4a2..97d472680f 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -631,7 +631,7 @@ void *l2l1_task(void *args_p) { oai_emulation.info.frame = frame; //oai_emulation.info.time_ms += 1; - oai_emulation.info.time_s += 0.1; // emu time in s, each frame lasts for 10 ms // JNote: TODO check the coherency of the time and frame (I corrected it to 10 (instead of 0.01) + oai_emulation.info.time_s += 0.01; // emu time in s, each frame lasts for 10 ms // JNote: TODO check the coherency of the time and frame (I corrected it to 10 (instead of 0.01) // if n_frames not set by the user or is greater than max num frame then set adjust the frame counter if ((oai_emulation.info.n_frames_flag == 0) || (oai_emulation.info.n_frames >= 0xffff)) { frame %= (oai_emulation.info.n_frames - 1); diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index 39c450d2ba..d75f87e80a 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -1000,8 +1000,8 @@ void update_omg (frame_t frameP) { if ((frameP % omg_period) == 0 ) { // call OMG every 10ms update_nodes(oai_emulation.info.time_s); - //display_node_list(enb_node_list); - //display_node_list(ue_node_list); + display_node_list(enb_node_list); + display_node_list(ue_node_list); if (oai_emulation.info.omg_model_ue >= MAX_NUM_MOB_TYPES){ // mix mobility model for(UE_id=oai_emulation.info.first_ue_local; UE_id<(oai_emulation.info.first_ue_local+oai_emulation.info.nb_ue_local);UE_id++){ new_omg_model = randomgen(STATIC,RWALK); @@ -1039,8 +1039,8 @@ void update_ocm() { /* check if the openair channel model is activated used for PHY abstraction : path loss*/ if ((oai_emulation.info.ocm_enabled == 1)&& (ethernet_flag == 0 )) { //LOG_D(OMG," extracting position of eNb...\n"); - display_node_list(enb_node_list); - display_node_list(ue_node_list); + //display_node_list(enb_node_list); + // display_node_list(ue_node_list); extract_position(enb_node_list, enb_data, NB_eNB_INST); //extract_position_fixed_enb(enb_data, NB_eNB_INST,frame); //LOG_D(OMG," extracting position of UE...\n"); -- GitLab