INET Framework for OMNeT++/OMNEST
inet::Posture Class Reference

to store the specification of a posture on the MoBAN mobility model. More...

#include <Posture.h>

Public Member Functions

 Posture (unsigned int, unsigned int)
 Construct a posture object with the given ID and number of nodes, respectively. More...
 
 ~Posture ()
 
int getNumNodes () const
 Return the number of nodes existing in the WBAN. More...
 
bool setPostureName (char *)
 Set the given name for the posture. More...
 
bool setPostureSpeed (double, double)
 Set the minimum and maximum value for the speed range of the whole WBAN (global movement) in this posture. More...
 
bool setRadius (unsigned int, double)
 Set the radius of the sphere for movement of a singular node in this posture. More...
 
bool setSpeed (unsigned int, double)
 Set the velocity for movement of a singular node in this posture. More...
 
bool setPs (unsigned int, Coord)
 Set the relative position of a node in this posture. More...
 
bool setAlphaMean (unsigned int, unsigned int, double)
 Set the mean value of a normal distribution for path lost coefficient of wave propagation between two nodes in this posture. More...
 
bool setAlphaSD (unsigned int, unsigned int, double)
 Set the standard deviation of a normal distribution for path lost coefficient of wave propagation between two nodes in this posture. More...
 
bool isMobile ()
 Check if this posture is mobile by checking the maximum possible speed. More...
 
int getPostureID ()
 Returns the unique Id (index) of this posture. More...
 
char * getPostureName ()
 Returns posture name. More...
 
double getMaxSpeed ()
 Returns maximum value of the speed range of this posture. More...
 
double getMinSpeed ()
 Returns minimum value of the speed range of this posture. More...
 
double getRadius (unsigned int)
 Returns the singular movement radius of a node in this posture. More...
 
double getSpeed (unsigned int)
 Returns the singular movement speed of a node in this posture. More...
 
Coord getPs (unsigned int)
 Returns the relative position of a node in this posture. More...
 
double getAlphaMean (unsigned int, unsigned int)
 Returns the mean value of a normal distribution for path lost coefficient of wave propagation between two nodes in this posture. More...
 
double getAlphaSD (unsigned int, unsigned int)
 Returns the standard deviation of a normal distribution for path lost coefficient of wave propagation between two nodes in this posture. More...
 

Protected Attributes

unsigned int numNodes = 0
 Number of nodes existing in the WBAN. More...
 
unsigned int postureID = 0
 The unique ID of the posture. More...
 
CoordnodePs = nullptr
 The relative reference position of each node in this posture. More...
 
char * posture_name = nullptr
 A given name to the posture like walking, sitting. More...
 
double ** alphaMean = nullptr
 Mean value of the normal distribution for the path lost coefficient (alpha) for any pair of nodes (numNodes by numNodes matrix) More...
 
double ** alphaSD = nullptr
 Mean value of the normal distribution for the path lost coefficient (alpha) for any pair of nodes (numNodes by numNodes matrix) More...
 
double * nodeRadius = nullptr
 Radious of the sphere around each node for individual mobility. More...
 
double * nodeSpeed = nullptr
 Movement speed of the node for individual mobility. More...
 
double maxSpeed = NaN
 Maximum value of the speed range for the global movement in this posture. More...
 
double minSpeed = NaN
 Minimum value of the speed range for the global movement in this posture. More...
 

Detailed Description

to store the specification of a posture on the MoBAN mobility model.

Author
Majid Nabi

Constructor & Destructor Documentation

◆ Posture()

inet::Posture::Posture ( unsigned int  ID,
unsigned int  num 
)

Construct a posture object with the given ID and number of nodes, respectively.

45 {
46  postureID = ID;
47  numNodes = num;
48 
49  nodePs = new Coord[numNodes];
50  nodeRadius = new double[numNodes];
51  nodeSpeed = new double[numNodes];
52 
53  alphaMean = new double *[numNodes];
54  for (unsigned int i = 0; i < numNodes; ++i)
55  alphaMean[i] = new double[numNodes];
56 
57  alphaSD = new double *[numNodes];
58  for (unsigned int i = 0; i < numNodes; ++i)
59  alphaSD[i] = new double[numNodes];
60 }

◆ ~Posture()

inet::Posture::~Posture ( )
63 {
64  delete[] nodePs;
65  delete[] nodeRadius;
66  delete[] nodeSpeed;
67 
68  for (unsigned int i = 0; i < numNodes; ++i)
69  delete[] alphaMean[i];
70  delete[] alphaMean;
71 
72  for (unsigned int i = 0; i < numNodes; ++i)
73  delete[] alphaSD[i];
74  delete[] alphaSD;
75 
76  delete[] posture_name;
77 }

Member Function Documentation

◆ getAlphaMean()

double inet::Posture::getAlphaMean ( unsigned int  i,
unsigned int  j 
)

Returns the mean value of a normal distribution for path lost coefficient of wave propagation between two nodes in this posture.

150 {
151  if (i < numNodes && j < numNodes)
152  return alphaMean[i][j];
153 
154  return -1;
155 }

◆ getAlphaSD()

double inet::Posture::getAlphaSD ( unsigned int  i,
unsigned int  j 
)

Returns the standard deviation of a normal distribution for path lost coefficient of wave propagation between two nodes in this posture.

158 {
159  if (i < numNodes && j < numNodes)
160  return alphaSD[i][j];
161 
162  return -1;
163 }

◆ getMaxSpeed()

double inet::Posture::getMaxSpeed ( )

Returns maximum value of the speed range of this posture.

192 {
193  return maxSpeed;
194 }

Referenced by inet::MoBanCoordinator::selectSpeed().

◆ getMinSpeed()

double inet::Posture::getMinSpeed ( )

Returns minimum value of the speed range of this posture.

197 {
198  return minSpeed;
199 }

Referenced by inet::MoBanCoordinator::selectSpeed().

◆ getNumNodes()

int inet::Posture::getNumNodes ( ) const
inline

Return the number of nodes existing in the WBAN.

101 { return numNodes; }

◆ getPostureID()

int inet::Posture::getPostureID ( )

Returns the unique Id (index) of this posture.

187 {
188  return postureID;
189 }

Referenced by inet::MoBanCoordinator::selectPosture(), and inet::MoBanCoordinator::setTargetPosition().

◆ getPostureName()

char * inet::Posture::getPostureName ( )

◆ getPs()

Coord inet::Posture::getPs ( unsigned int  i)

Returns the relative position of a node in this posture.

142 {
143  if (i < numNodes)
144  return nodePs[i];
145 
146  return Coord(-1, -1, -1);
147 }

Referenced by inet::MoBanCoordinator::isInsideWorld(), and inet::MoBanCoordinator::publishToNodes().

◆ getRadius()

double inet::Posture::getRadius ( unsigned int  i)

Returns the singular movement radius of a node in this posture.

166 {
167  if (i < numNodes)
168  return nodeRadius[i];
169 
170  return -1;
171 }

Referenced by inet::MoBanCoordinator::publishToNodes().

◆ getSpeed()

double inet::Posture::getSpeed ( unsigned int  i)

Returns the singular movement speed of a node in this posture.

174 {
175  if (i < numNodes)
176  return nodeSpeed[i];
177 
178  return -1;
179 }

Referenced by inet::MoBanCoordinator::publishToNodes().

◆ isMobile()

bool inet::Posture::isMobile ( )

Check if this posture is mobile by checking the maximum possible speed.

202 {
203  return maxSpeed > 0;
204 }

Referenced by inet::MoBanCoordinator::setTargetPosition().

◆ setAlphaMean()

bool inet::Posture::setAlphaMean ( unsigned int  i,
unsigned int  j,
double  alpha_mean 
)

Set the mean value of a normal distribution for path lost coefficient of wave propagation between two nodes in this posture.

96 {
97  if (i < numNodes && j < numNodes) {
98  alphaMean[i][j] = alpha_mean;
99  return true;
100  }
101  return false;
102 }

◆ setAlphaSD()

bool inet::Posture::setAlphaSD ( unsigned int  i,
unsigned int  j,
double  alpha_sd 
)

Set the standard deviation of a normal distribution for path lost coefficient of wave propagation between two nodes in this posture.

105 {
106  if (i < numNodes && j < numNodes) {
107  alphaSD[i][j] = alpha_sd;
108  return true;
109  }
110  return false;
111 }

◆ setPostureName()

bool inet::Posture::setPostureName ( char *  str)

Set the given name for the posture.

89 {
90  delete[] posture_name;
91  posture_name = opp_strdup(str);
92  return true;
93 }

◆ setPostureSpeed()

bool inet::Posture::setPostureSpeed ( double  min,
double  max 
)

Set the minimum and maximum value for the speed range of the whole WBAN (global movement) in this posture.

132 {
133  if (max < min)
134  return false;
135 
136  maxSpeed = max;
137  minSpeed = min;
138  return true;
139 }

◆ setPs()

bool inet::Posture::setPs ( unsigned int  i,
Coord  ps 
)

Set the relative position of a node in this posture.

80 {
81  if (i < numNodes) {
82  nodePs[i] = ps;
83  return true;
84  }
85  return false;
86 }

◆ setRadius()

bool inet::Posture::setRadius ( unsigned int  i,
double  radius 
)

Set the radius of the sphere for movement of a singular node in this posture.

114 {
115  if (i < numNodes) {
116  nodeRadius[i] = radius;
117  return true;
118  }
119  return false;
120 }

◆ setSpeed()

bool inet::Posture::setSpeed ( unsigned int  i,
double  speed 
)

Set the velocity for movement of a singular node in this posture.

123 {
124  if (i < numNodes) {
125  nodeSpeed[i] = speed;
126  return true;
127  }
128  return false;
129 }

Member Data Documentation

◆ alphaMean

double** inet::Posture::alphaMean = nullptr
protected

Mean value of the normal distribution for the path lost coefficient (alpha) for any pair of nodes (numNodes by numNodes matrix)

Referenced by getAlphaMean(), Posture(), setAlphaMean(), and ~Posture().

◆ alphaSD

double** inet::Posture::alphaSD = nullptr
protected

Mean value of the normal distribution for the path lost coefficient (alpha) for any pair of nodes (numNodes by numNodes matrix)

Referenced by getAlphaSD(), Posture(), setAlphaSD(), and ~Posture().

◆ maxSpeed

double inet::Posture::maxSpeed = NaN
protected

Maximum value of the speed range for the global movement in this posture.

Referenced by getMaxSpeed(), isMobile(), and setPostureSpeed().

◆ minSpeed

double inet::Posture::minSpeed = NaN
protected

Minimum value of the speed range for the global movement in this posture.

Referenced by getMinSpeed(), and setPostureSpeed().

◆ nodePs

Coord* inet::Posture::nodePs = nullptr
protected

The relative reference position of each node in this posture.

Referenced by getPs(), Posture(), setPs(), and ~Posture().

◆ nodeRadius

double* inet::Posture::nodeRadius = nullptr
protected

Radious of the sphere around each node for individual mobility.

Referenced by getRadius(), Posture(), setRadius(), and ~Posture().

◆ nodeSpeed

double* inet::Posture::nodeSpeed = nullptr
protected

Movement speed of the node for individual mobility.

Referenced by getSpeed(), Posture(), setSpeed(), and ~Posture().

◆ numNodes

unsigned int inet::Posture::numNodes = 0
protected

◆ posture_name

char* inet::Posture::posture_name = nullptr
protected

A given name to the posture like walking, sitting.

It might be used for showing the current posture in the graphical interface during the simulation run

Referenced by getPostureName(), setPostureName(), and ~Posture().

◆ postureID

unsigned int inet::Posture::postureID = 0
protected

The unique ID of the posture.

Referenced by getPostureID(), and Posture().


The documentation for this class was generated from the following files:
inet::Posture::maxSpeed
double maxSpeed
Maximum value of the speed range for the global movement in this posture.
Definition: Posture.h:89
inet::Posture::nodeRadius
double * nodeRadius
Radious of the sphere around each node for individual mobility.
Definition: Posture.h:83
inet::Posture::posture_name
char * posture_name
A given name to the posture like walking, sitting.
Definition: Posture.h:72
inet::Posture::alphaSD
double ** alphaSD
Mean value of the normal distribution for the path lost coefficient (alpha) for any pair of nodes (nu...
Definition: Posture.h:80
inet::sctp::min
double min(const double a, const double b)
Returns the minimum of a and b.
Definition: SctpAssociation.h:261
inet::Posture::nodeSpeed
double * nodeSpeed
Movement speed of the node for individual mobility.
Definition: Posture.h:86
inet::Posture::postureID
unsigned int postureID
The unique ID of the posture.
Definition: Posture.h:65
inet::Posture::numNodes
unsigned int numNodes
Number of nodes existing in the WBAN.
Definition: Posture.h:62
inet::Posture::minSpeed
double minSpeed
Minimum value of the speed range for the global movement in this posture.
Definition: Posture.h:92
inet::Macho::ID
unsigned int ID
Definition: Macho.h:320
inet::Posture::alphaMean
double ** alphaMean
Mean value of the normal distribution for the path lost coefficient (alpha) for any pair of nodes (nu...
Definition: Posture.h:76
inet::sctp::max
double max(const double a, const double b)
Returns the maximum of a and b.
Definition: SctpAssociation.h:266
inet::units::units::ps
pico< s >::type ps
Definition: Units.h:1073
inet::Posture::nodePs
Coord * nodePs
The relative reference position of each node in this posture.
Definition: Posture.h:68