int start_steadystaterwp_generator (omg_global_param omg_param_list) { static int n_id = 0; int id; double cur_time = 0.0, pause_p; node_struct *node = NULL; mobility_struct *mobility = NULL; pair_struct *pair = NULL; pause_p = pause_probability (omg_param_list); srand (omg_param_list.seed + RWP); LOG_I (OMG, "STEADY_RWP 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 = STEADY_RWP; node->event_num = 0; place_rwp_node (node); //initial positions pair = (pair_struct *) malloc (sizeof (struct pair_struct)); pair->b = node; //pause probability...some of the nodes start at pause & the other on move if (randomgen (0, 1) < pause_p) sleep_steadystaterwp_node (pair, cur_time); //sleep else move_steadystaterwp_node (pair, cur_time); job_vector_end[STEADY_RWP] = add_job (pair, job_vector_end[STEADY_RWP]); if (job_vector[STEADY_RWP] == NULL) job_vector[STEADY_RWP] = job_vector_end[STEADY_RWP]; job_vector_len[STEADY_RWP]++; } n_id += omg_param_list.nodes; if (job_vector[STEADY_RWP] == NULL) LOG_E (OMG, "[STEADY_RWP] Job Vector is NULL\n"); return (0); }
int start_rwp_generator (omg_global_param omg_param_list) { static int n_id = 0; int id; double cur_time = 0.0; node_struct *node = NULL; mobility_struct *mobility = NULL; pair_struct *pair = NULL; srand (omg_param_list.seed + RWP); LOG_I (OMG, "# RWP mobility model for %d type %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 = RWP; node->event_num = 0; place_rwp_node (node); //initial positions pair = (pair_struct *) malloc (sizeof (struct pair_struct)); pair->b = node; sleep_rwp_node (pair, cur_time); //sleep job_vector_end[RWP] = add_job (pair, job_vector_end[RWP]); if (job_vector[RWP] == NULL) job_vector[RWP] = job_vector_end[RWP]; job_vector_len[RWP]++; } n_id += omg_param_list.nodes; if (job_vector[RWP] == NULL) LOG_E (OMG, "[RWP] Job Vector is NULL\n"); return (0); }
int start_rwalk_generator(omg_global_param omg_param_list) { int n_id=0; //omg_omg_param_list.seed= time(NULL); srand(omg_param_list.seed + RWALK); double cur_time = 0.0; NodePtr node = NULL; MobilityPtr mobility = NULL; if (omg_param_list.nodes <= 0){ LOG_W(OMG, "Number of nodes has not been set\n"); return(-1); } if (omg_param_list.nodes_type == eNB) { LOG_I(OMG, "Node type has been set to eNB\n"); } else if (omg_param_list.nodes_type == UE) { LOG_I(OMG, "Node type has been set to UE\n"); } LOG_I(OMG, "Number of random walk nodes has been set to %d\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->mobile = 0; // static for the moment node->ID = n_id; node->type = omg_param_list.nodes_type; node->generator = omg_param_list.mobility_type; node->mob = mobility; place_rwalk_node(node); //initial positions Pair pair = malloc (sizeof(Pair)); pair = (Pair) sleep_rwalk_node(node, cur_time); //sleep Job_Vector = add_job(pair, Job_Vector); Job_Vector_len ++; if (Job_Vector == NULL) LOG_E(OMG, "Job Vector is NULL\n"); } return(0); }
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(-1); } LOG_D(OMG, "Start STATIC Mobility MODEL\n"); 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, "Node type has been set to eNB\n"); } else if (omg_param_list.nodes_type == UE) { LOG_I(OMG, "Node type has been set to UE\n"); } LOG_D(OMG, "Number of static nodes has been set to %d\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 } }
int start_rwalk_generator (omg_global_param omg_param_list) { int id; static int n_id = 0; double cur_time = 0.0, pause_p, mean_pause, mean_travel; node_struct *node = NULL; mobility_struct *mobility = NULL; pair_struct *pair = NULL; srand (omg_param_list.seed + RWALK); mean_pause = (omg_param_list.max_sleep - omg_param_list.min_sleep) / 2; mean_travel = (omg_param_list.max_journey_time - omg_param_list.min_journey_time) / 2; pause_p = mean_pause / (mean_travel + mean_pause); LOG_I (OMG, "#RWALK 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 = RWALK; node->event_num = 0; place_rwalk_node (node); //initial positions pair = (pair_struct *) malloc (sizeof (struct pair_struct)); pair->b = node; // sleep_rwalk_node (pair, cur_time); //sleep //pause probability...some of the nodes start at pause & the other on move if (randomgen (0, 1) < pause_p) sleep_steadystaterwp_node (pair, cur_time); //sleep else move_steadystaterwp_node (pair, cur_time); job_vector_end[RWALK] = add_job (pair, job_vector_end[RWALK]); if (job_vector[RWALK] == NULL) job_vector[RWALK] = job_vector_end[RWALK]; job_vector_len[RWALK]++; } n_id += omg_param_list.nodes; if (job_vector[RWALK] == NULL) LOG_E (OMG, "[RWP] Job Vector is NULL\n"); return (0); }