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

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

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

48 {
49  postureID = ID;
50  numNodes = num;
51 
52  nodePs = new Coord[numNodes];
53  nodeRadius = new double[numNodes];
54  nodeSpeed = new double[numNodes];
55 
56  alphaMean = new double *[numNodes];
57  for (unsigned int i = 0; i < numNodes; ++i)
58  alphaMean[i] = new double[numNodes];
59 
60  alphaSD = new double *[numNodes];
61  for (unsigned int i = 0; i < numNodes; ++i)
62  alphaSD[i] = new double[numNodes];
63 }
double ** alphaMean
Mean value of the normal distribution for the path lost coefficient (alpha) for any pair of nodes (nu...
Definition: Posture.h:80
Coord * nodePs
The relative reference position of each node in this posture.
Definition: Posture.h:72
double * nodeRadius
Radious of the sphere around each node for individual mobility.
Definition: Posture.h:87
double ** alphaSD
Mean value of the normal distribution for the path lost coefficient (alpha) for any pair of nodes (nu...
Definition: Posture.h:84
unsigned int numNodes
Number of nodes existing in the WBAN.
Definition: Posture.h:66
unsigned int ID
Definition: Macho.h:318
double * nodeSpeed
Movement speed of the node for individual mobility.
Definition: Posture.h:90
unsigned int postureID
The unique ID of the posture.
Definition: Posture.h:69
inet::Posture::~Posture ( )
66 {
67  delete [] nodePs;
68  delete [] nodeRadius;
69  delete [] nodeSpeed;
70 
71  for (unsigned int i = 0; i < numNodes; ++i)
72  delete [] alphaMean[i];
73  delete [] alphaMean;
74 
75  for (unsigned int i = 0; i < numNodes; ++i)
76  delete [] alphaSD[i];
77  delete [] alphaSD;
78 
79  delete [] posture_name;
80 }
double ** alphaMean
Mean value of the normal distribution for the path lost coefficient (alpha) for any pair of nodes (nu...
Definition: Posture.h:80
Coord * nodePs
The relative reference position of each node in this posture.
Definition: Posture.h:72
double * nodeRadius
Radious of the sphere around each node for individual mobility.
Definition: Posture.h:87
char * posture_name
A given name to the posture like walking, sitting.
Definition: Posture.h:76
double ** alphaSD
Mean value of the normal distribution for the path lost coefficient (alpha) for any pair of nodes (nu...
Definition: Posture.h:84
unsigned int numNodes
Number of nodes existing in the WBAN.
Definition: Posture.h:66
double * nodeSpeed
Movement speed of the node for individual mobility.
Definition: Posture.h:90

Member Function Documentation

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.

153 {
154  if (i < numNodes && j < numNodes)
155  return alphaMean[i][j];
156 
157  return -1;
158 }
double ** alphaMean
Mean value of the normal distribution for the path lost coefficient (alpha) for any pair of nodes (nu...
Definition: Posture.h:80
unsigned int numNodes
Number of nodes existing in the WBAN.
Definition: Posture.h:66
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.

161 {
162  if (i < numNodes && j < numNodes)
163  return alphaSD[i][j];
164 
165  return -1;
166 }
double ** alphaSD
Mean value of the normal distribution for the path lost coefficient (alpha) for any pair of nodes (nu...
Definition: Posture.h:84
unsigned int numNodes
Number of nodes existing in the WBAN.
Definition: Posture.h:66
double inet::Posture::getMaxSpeed ( )

Returns maximum value of the speed range of this posture.

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

195 {
196  return maxSpeed;
197 }
double maxSpeed
Maximum value of the speed range for the global movement in this posture.
Definition: Posture.h:93
double inet::Posture::getMinSpeed ( )

Returns minimum value of the speed range of this posture.

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

200 {
201  return minSpeed;
202 }
double minSpeed
Minimum value of the speed range for the global movement in this posture.
Definition: Posture.h:96
int inet::Posture::getNumNodes ( ) const
inline

Return the number of nodes existing in the WBAN.

105 { return numNodes; }
unsigned int numNodes
Number of nodes existing in the WBAN.
Definition: Posture.h:66
int inet::Posture::getPostureID ( )

Returns the unique Id (index) of this posture.

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

190 {
191  return postureID;
192 }
unsigned int postureID
The unique ID of the posture.
Definition: Posture.h:69
char * inet::Posture::getPostureName ( )

Returns posture name.

Referenced by inet::MoBANCoordinator::readConfigurationFile(), inet::MoBANCoordinator::refreshDisplay(), and inet::MoBANCoordinator::setTargetPosition().

185 {
186  return posture_name;
187 }
char * posture_name
A given name to the posture like walking, sitting.
Definition: Posture.h:76
Coord inet::Posture::getPs ( unsigned int  i)

Returns the relative position of a node in this posture.

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

145 {
146  if (i < numNodes)
147  return nodePs[i];
148 
149  return Coord(-1, -1, -1);
150 }
Coord * nodePs
The relative reference position of each node in this posture.
Definition: Posture.h:72
unsigned int numNodes
Number of nodes existing in the WBAN.
Definition: Posture.h:66
double inet::Posture::getRadius ( unsigned int  i)

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

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

169 {
170  if (i < numNodes)
171  return nodeRadius[i];
172 
173  return -1;
174 }
double * nodeRadius
Radious of the sphere around each node for individual mobility.
Definition: Posture.h:87
unsigned int numNodes
Number of nodes existing in the WBAN.
Definition: Posture.h:66
double inet::Posture::getSpeed ( unsigned int  i)

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

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

177 {
178  if (i < numNodes)
179  return nodeSpeed[i];
180 
181  return -1;
182 }
unsigned int numNodes
Number of nodes existing in the WBAN.
Definition: Posture.h:66
double * nodeSpeed
Movement speed of the node for individual mobility.
Definition: Posture.h:90
bool inet::Posture::isMobile ( )

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

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

205 {
206  return maxSpeed > 0;
207 }
double maxSpeed
Maximum value of the speed range for the global movement in this posture.
Definition: Posture.h:93
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.

99 {
100  if (i < numNodes && j < numNodes) {
101  alphaMean[i][j] = alpha_mean;
102  return true;
103  }
104  return false;
105 }
double ** alphaMean
Mean value of the normal distribution for the path lost coefficient (alpha) for any pair of nodes (nu...
Definition: Posture.h:80
unsigned int numNodes
Number of nodes existing in the WBAN.
Definition: Posture.h:66
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.

108 {
109  if (i < numNodes && j < numNodes) {
110  alphaSD[i][j] = alpha_sd;
111  return true;
112  }
113  return false;
114 }
double ** alphaSD
Mean value of the normal distribution for the path lost coefficient (alpha) for any pair of nodes (nu...
Definition: Posture.h:84
unsigned int numNodes
Number of nodes existing in the WBAN.
Definition: Posture.h:66
bool inet::Posture::setPostureName ( char *  str)

Set the given name for the posture.

92 {
93  delete [] posture_name;
94  posture_name = opp_strdup(str);
95  return true;
96 }
char * posture_name
A given name to the posture like walking, sitting.
Definition: Posture.h:76
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.

135 {
136  if (max < min)
137  return false;
138 
139  maxSpeed = max;
140  minSpeed = min;
141  return true;
142 }
double minSpeed
Minimum value of the speed range for the global movement in this posture.
Definition: Posture.h:96
double min(const double a, const double b)
Returns the minimum of a and b.
Definition: SCTPAssociation.h:270
double max(double a, double b)
Returns the greater of the given parameters.
Definition: INETMath.h:161
double maxSpeed
Maximum value of the speed range for the global movement in this posture.
Definition: Posture.h:93
bool inet::Posture::setPs ( unsigned int  i,
Coord  ps 
)

Set the relative position of a node in this posture.

83 {
84  if (i < numNodes) {
85  nodePs[i] = ps;
86  return true;
87  }
88  return false;
89 }
Coord * nodePs
The relative reference position of each node in this posture.
Definition: Posture.h:72
unsigned int numNodes
Number of nodes existing in the WBAN.
Definition: Posture.h:66
bool inet::Posture::setRadius ( unsigned int  i,
double  radius 
)

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

117 {
118  if (i < numNodes) {
119  nodeRadius[i] = radius;
120  return true;
121  }
122  return false;
123 }
double * nodeRadius
Radious of the sphere around each node for individual mobility.
Definition: Posture.h:87
unsigned int numNodes
Number of nodes existing in the WBAN.
Definition: Posture.h:66
bool inet::Posture::setSpeed ( unsigned int  i,
double  speed 
)

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

126 {
127  if (i < numNodes) {
128  nodeSpeed[i] = speed;
129  return true;
130  }
131  return false;
132 }
unsigned int numNodes
Number of nodes existing in the WBAN.
Definition: Posture.h:66
double * nodeSpeed
Movement speed of the node for individual mobility.
Definition: Posture.h:90

Member Data Documentation

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().

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().

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().

double inet::Posture::minSpeed = NaN
protected

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

Referenced by getMinSpeed(), and setPostureSpeed().

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

The relative reference position of each node in this posture.

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

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

Radious of the sphere around each node for individual mobility.

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

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

Movement speed of the node for individual mobility.

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

unsigned int inet::Posture::numNodes = 0
protected
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().

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: