NetSim Source Code Help v14.4
All 13 Components
 
Loading...
Searching...
No Matches
Mobility.h
1/************************************************************************************
2* Copyright (C) 2023 *
3* TETCOS, Bangalore. India *
4* *
5* Tetcos owns the intellectual property rights in the Product and its content. *
6* The copying, redistribution, reselling or publication of any or all of the *
7* Product or its content without express prior written consent of Tetcos is *
8* prohibited. Ownership and / or any other right relating to the software and all *
9* intellectual property rights therein shall remain at all times with Tetcos. *
10* *
11* Author: Shashi Kant Suman *
12* *
13* ---------------------------------------------------------------------------------*/
14#include <Animation.h>
15#ifndef _NETSIM_MOBILITY_H_
16#define _NETSIM_MOBILITY_H_
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#define Mobility_MODEL_DEFAULT _strdup("NO_MOBILITY")
22#define Mobility_GROUP_ID_DEFAULT 1
23#define Mobility_FILE_NAME_DEFAULT _strdup("")
24#define Mobility_OPEN_MOBILITY_FILE_DEFAULT _strdup("")
25#define Mobility_STEP_SIZE_DEFAULT 1
26#define Mobility_CALCULATION_INTERVAL_DEFAULT 1
27#define Mobility_MAX_SPEED_M_S_DEFAULT 3
28#define Mobility_MIN_SPEED_M_S_DEFAULT 1
29#define Mobility_STOP_PROBABILITY_DEFAULT 0.5
30#define Mobility_STOP_DURATION_S_DEFAULT 5
31
32 typedef enum enum_MobilityModel MOBILITY_MODEL;
33
34 typedef struct stru_NetSim_Mobility NetSim_MOBILITY;
35 typedef struct stru_NetSim_MobilityVar MOBILITY_VAR;
36 /** Structure to store the mobility variables */
37
38 typedef enum
39 {
40 MOVE_GROUP = PROTOCOL_MOBILITY * 100 + 1,
41 NODE_JOIN,
42 NODE_LEAVE,
43 }MOBILTY_SUBEVNET;
44 /* Enumeration for mobility model*/
45 enum enum_MobilityModel
46 {
47 MobilityModel_NOMOBILITY,
48 MobilityModel_RANDOMWAYPOINT,
49 MobilityModel_RANDOMWALK,
50 MobilityModel_FILEBASEDMOBILITY,
51 MobilityModel_GROUP,
52 MobilityModel_SUMO,
53 MobilityModel_PEDESTRAIN,
54 };
55
56 //double dSimulationArea_X; //Store the simulation area_x
57 //double dSimulationArea_Y;//Store the simulationar area_y
58 double dOrigin_X; //Store the origin_x
59 double dOrigin_Y; //Store the origin_y
60 double dGridWidth; //Store the grid width
61 double dGridLength; //Store the grid length
62 double dGridMax_x; //Store the grid max_x
63 double dGridMax_y; //Store the grid max_y
64
65 /* Store the mobility variable for each device*/
67 {
68 double dAvgSpeed; //Average speed of device
69 MOBILITY_MODEL nMobilityType; //Mobility model
70 void* pstruMobVar; /*Pointer pointing to addition mobility model variables
71 *That may be used by developer. This can be accessed by
72 *DEVICE[]->Mobility->MobilityVar
73 */
74 struct stru_NetSim_Coordinates* pstruCurrentPosition; //Current position for device
75 struct stru_NetSim_Coordinates* pstruNextPosition; //Next position of device
76 };
77
79 {
80 double dPauseTime; ///< To store the pause time.
81 double dVelocity; ///< To store the velocity.
82 unsigned long ulSeed1; ///< Used to generate random point.
83 unsigned long ulSeed2; ///< Used to generate random point
84 double dLastTime; ///< Represent the devices last move time.
85 NETSIM_ID nGroupId; ///< To store group id of device.
86 double dCalculationInterval;
87 //Sumo
88 char* sumoFileName;
89 double step_size;
90 //File-Based Mobility
91 char* mobilityFileName;
92 //Pedestrain
93 double Max_Speed;
94 double Min_Speed;
95 double Stop_Probability;
96 double Stop_Duration;
97 double Pedestrain_Speed;
98 double angel;
99 };
100
101 void add_mobility_animation(NETSIM_ID d,
102 double t,
103 double x,
104 double y,
105 double z);
106 int FileBasedMobilityPointersFree();
107 int fn_NMo_RandomPoint(double* X, double* Y, double velocity, double interval, unsigned long* pulSeed1, unsigned long* pulSeed2);
108 int fn_NetSim_MoveGroup();
109 int fn_NetSim_Mobility_Group_init();
110 int add_to_group(NETSIM_ID group_id, NETSIM_ID dev_id);
111 void mobility_pass_position_to_animation(NETSIM_ID devId, double time, NetSim_COORDINATES* coor);
112 void log_mobility(MOVENODE log);
113 void init_mobility_log();
114 void close_mobility_logs();
115 bool get_protocol_log_status(char* logname);
116
117 // Sumo Interface
118 double* corr(char* id);
119 void pipes_init();
120 void init_sumo();
121 void sumo_run();
122
123 //File based mobility
124 int FileBasedMobilityReadingFile();
125 void process_filebased_mobility_event();
126 int FileBasedMobilityPointersFree();
127
128 //Office
129 void fn_NetSim_MObility_configureOffice(void* xmlNetSimNode);
130
131#ifdef __cplusplus
132}
133#endif
134#endif
135
double dPauseTime
To store the pause time.
Definition Mobility.h:80
double dLastTime
Represent the devices last move time.
Definition Mobility.h:84
unsigned long ulSeed1
Used to generate random point.
Definition Mobility.h:82
NETSIM_ID nGroupId
To store group id of device.
Definition Mobility.h:85
unsigned long ulSeed2
Used to generate random point.
Definition Mobility.h:83
double dVelocity
To store the velocity.
Definition Mobility.h:81