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

This is the coordinator module of the MoBAN mobility model. More...

#include <MoBANCoordinator.h>

Inheritance diagram for inet::MoBANCoordinator:
inet::LineSegmentsMobilityBase inet::MovingMobilityBase inet::MobilityBase inet::IMobility

Classes

struct  pattern
 Data type for one instance of mobility pattern. More...
 

Public Member Functions

 MoBANCoordinator ()
 
 ~MoBANCoordinator ()
 
virtual double getMaxSpeed () const override
 Returns the maximum possible speed at any future time. More...
 
- Public Member Functions inherited from inet::LineSegmentsMobilityBase
 LineSegmentsMobilityBase ()
 
- Public Member Functions inherited from inet::MovingMobilityBase
virtual Coord getCurrentPosition () override
 Returns the current position at the current simulation time. More...
 
virtual Coord getCurrentSpeed () override
 Returns the current speed at the current simulation time. More...
 
virtual EulerAngles getCurrentAngularPosition () override
 Returns the current angular position at the current simulation time. More...
 
- Public Member Functions inherited from inet::MobilityBase
virtual EulerAngles getCurrentAngularSpeed () override
 Returns the current angular speed at the current simulation time. More...
 
virtual Coord getConstraintAreaMax () const override
 Returns the current angular acceleration at the current simulation time. More...
 
virtual Coord getConstraintAreaMin () const override
 
- Public Member Functions inherited from inet::IMobility
virtual ~IMobility ()
 

Protected Types

enum  posture_sel_type { UNIFORM_RANDOM = 0, MARKOV_BASE }
 Possible (supported) strategies for posture selection. More...
 
typedef struct inet::MoBANCoordinator::pattern Pattern
 Data type for one instance of mobility pattern. More...
 

Protected Member Functions

virtual int numInitStages () const override
 Returns the required number of initialize stages. More...
 
virtual void initialize (int) override
 Initializes mobility model parameters. More...
 
virtual void setInitialPosition () override
 Initializes the position from the display string or from module parameters. More...
 
virtual void setTargetPosition () override
 Set a new target position from the next posture. More...
 
virtual cModule * findVisualRepresentation () override
 Returns the module that represents the object moved by this mobility module. More...
 
virtual void finish () override
 To be called at the end of simulation run. More...
 
virtual void refreshDisplay () const override
 
void selectPosture ()
 Function to select the next posture considering the current posture and the Markov model. More...
 
Coord selectDestination ()
 Function to select the destination in the case of a mobile posture. More...
 
double selectSpeed ()
 Select a velocity value within the given velocity range. More...
 
simtime_t selectDuration ()
 Select a stay time duration in the specified range for the new posture. More...
 
bool isInsideWorld (Coord)
 Checks if all nodes of the WBAN are inside the simulation environment with the given position of the logical center. More...
 
bool readPostureSpecificationFile ()
 Reading the input postures specification file and making the posture data base. More...
 
bool readConfigurationFile ()
 Reads the input configuration file. More...
 
bool readMobilityPatternFile ()
 Reads the previously logged mobility pattern and make mobility pattern data base. More...
 
void publishToNodes ()
 Publishes the reference point and other information of the posture to the blackboard of the belonging nodes. More...
 
void collectLocalModules (cModule *module)
 Collect MoBAN local modules. More...
 
void computeMaxSpeed ()
 
- Protected Member Functions inherited from inet::LineSegmentsMobilityBase
virtual void initializePosition () override
 Initializes mobility position. More...
 
virtual void move () override
 Moves according to the mobility model to the current simulation time. More...
 
- Protected Member Functions inherited from inet::MovingMobilityBase
 MovingMobilityBase ()
 
virtual ~MovingMobilityBase ()
 
virtual void handleSelfMessage (cMessage *message) override
 Called upon arrival of a self messages, subclasses must override. More...
 
void scheduleUpdate ()
 Schedules the move timer that will update the mobility state. More...
 
void moveAndUpdate ()
 Moves and notifies listeners. More...
 
- Protected Member Functions inherited from inet::MobilityBase
 MobilityBase ()
 
virtual void checkPosition ()
 Checks whether the position is valid or not. More...
 
virtual void initializeOrientation ()
 Initializes the orientation from module parameters. More...
 
virtual void handleMessage (cMessage *msg) override
 This modules should only receive self-messages. More...
 
virtual void updateVisualRepresentation ()
 Moves the visual representation module's icon to the new position on the screen. More...
 
virtual void emitMobilityStateChangedSignal ()
 Emits a signal with the updated mobility state. More...
 
virtual Coord getRandomPosition ()
 Returns a new random position satisfying the constraint area. More...
 
virtual bool isOutside ()
 Returns true if the mobility is outside of the constraint area. More...
 
virtual void reflectIfOutside (Coord &targetPosition, Coord &speed, double &angle)
 Utility function to reflect the node if it goes outside the constraint area. More...
 
virtual void wrapIfOutside (Coord &targetPosition)
 Utility function to wrap the node to the opposite edge (torus) if it goes outside the constraint area. More...
 
virtual void placeRandomlyIfOutside (Coord &targetPosition)
 Utility function to place the node randomly if it goes outside the constraint area. More...
 
virtual void raiseErrorIfOutside ()
 Utility function to raise an error if the node gets outside the constraint area. More...
 
virtual void handleIfOutside (BorderPolicy policy, Coord &targetPosition, Coord &speed, double &angle)
 Invokes one of reflectIfOutside(), wrapIfOutside() and placeRandomlyIfOutside(), depending on the given border policy. More...
 

Protected Attributes

std::vector< MoBANLocal * > localModules
 The mobility modules of the nodes in this WBAN. More...
 
double speed
 Currently selected speed for the mobile posture. More...
 
double maxSpeed
 The possible maximum speed at any future time. More...
 
FILE * logfile
 Pointer to the file for logging MoBAN mobility pattern for future use. More...
 
unsigned int numPostures
 Number of predefined postures. More...
 
std::vector< Posture * > postureList
 The list of all predefined postures (posture data base) More...
 
PosturecurrentPosture
 The current selected posture. More...
 
simtime_t minDuration
 The minimum value of the duration for stable postures. More...
 
simtime_t maxDuration
 The maximum value of the duration for stable postures. More...
 
bool useMobilityPattern
 Variable that shows if reusing previously logged mobility pattern is requested. More...
 
PatternmobilityPattern
 The mobility pattern data base. More...
 
int patternLength
 The number of mobility pattern instances which has been read from the input file (length of mobility pattern data base). More...
 
int currentPattern
 The index of the currently applied mobility pattern from. More...
 
double ** markovMatrix
 A matrix which maintains the transition probabilities of the Markov Model of posture pattern. More...
 
posture_sel_type postureSelStrategy
 The requested strategy for posture selection. More...
 
PostureTransitiontransitions
 Class for performing operation for spatial and temporal correlations in posture selection. More...
 
- Protected Attributes inherited from inet::LineSegmentsMobilityBase
Coord targetPosition
 End position of current linear movement. More...
 
- Protected Attributes inherited from inet::MovingMobilityBase
cMessage * moveTimer
 The message used for mobility state changes. More...
 
simtime_t updateInterval
 The simulation time interval used to regularly signal mobility state changes. More...
 
bool stationary
 A mobility model may decide to become stationary at any time. More...
 
Coord lastSpeed
 The last speed that was reported at lastUpdate. More...
 
simtime_t lastUpdate
 The simulation time when the mobility state was last updated. More...
 
simtime_t nextChange
 The next simulation time when the mobility module needs to update its internal state. More...
 
- Protected Attributes inherited from inet::MobilityBase
cModule * visualRepresentation
 Pointer to visual representation module, to speed up repeated access. More...
 
const CanvasProjectioncanvasProjection
 The 2D projection used on the canvas. More...
 
Coord constraintAreaMin
 3 dimensional position and size of the constraint area (in meters). More...
 
Coord constraintAreaMax
 
Coord lastPosition
 The last position that was reported. More...
 
EulerAngles lastOrientation
 The last position that was reported. More...
 

Additional Inherited Members

- Public Types inherited from inet::MobilityBase
enum  BorderPolicy { REFLECT, WRAP, PLACERANDOMLY, RAISEERROR }
 Selects how a mobility module should behave if it reaches the edge of the constraint area. More...
 
- Static Public Attributes inherited from inet::IMobility
static simsignal_t mobilityStateChangedSignal = cComponent::registerSignal("mobilityStateChanged")
 A signal used to publish mobility state changes. More...
 

Detailed Description

This is the coordinator module of the MoBAN mobility model.

It should be instantiated in the top level simulation network, once per WBAN. The coordinator module is the main module that provides the group mobility and correlation between nodes in a WBAN. In the initialization phase, it reads three user defined input files which are the postures specification file, a configuration file which includes all required parameter for specific distributions, and the previously logged mobility pattern, if it is requested to use a logged pattern. Note that all WBAN instances may use the same input files if they are exactly in the same situation.

After the initialization phase, the MoBAN coordinator decides about the posture and the position of the Logical center of the group (WBAN). The absolute position of the reference point of each belonging node is calculated by adding the current position of the logical center by the reference point of that node in the selected posture. The coordinator sets the position of the reference point as well as the speed and the radius of the local movement of nodes.

Author
Majid Nabi

Member Typedef Documentation

Data type for one instance of mobility pattern.

Member Enumeration Documentation

Possible (supported) strategies for posture selection.

Enumerator
UNIFORM_RANDOM 
MARKOV_BASE 
154  {
155  UNIFORM_RANDOM = 0, // uniform random posture selection. No correlation is applied.
156  MARKOV_BASE // Either a Markov model matrix or a steady state vector is given for space-time domains
157  };
Definition: MoBANCoordinator.h:156
Definition: MoBANCoordinator.h:155

Constructor & Destructor Documentation

inet::MoBANCoordinator::MoBANCoordinator ( )
54  :
55  speed(0),
56  maxSpeed(0),
57  logfile(nullptr),
58  numPostures(0),
59  currentPosture(nullptr),
60  useMobilityPattern(false),
61  mobilityPattern(nullptr),
62  patternLength(0),
63  currentPattern(-1),
64  markovMatrix(nullptr),
66  transitions(nullptr)
67 {
68 }
double speed
Currently selected speed for the mobile posture.
Definition: MoBANCoordinator.h:101
Posture * currentPosture
The current selected posture.
Definition: MoBANCoordinator.h:116
FILE * logfile
Pointer to the file for logging MoBAN mobility pattern for future use.
Definition: MoBANCoordinator.h:107
PostureTransition * transitions
Class for performing operation for spatial and temporal correlations in posture selection.
Definition: MoBANCoordinator.h:163
double maxSpeed
The possible maximum speed at any future time.
Definition: MoBANCoordinator.h:104
int patternLength
The number of mobility pattern instances which has been read from the input file (length of mobility ...
Definition: MoBANCoordinator.h:143
int currentPattern
The index of the currently applied mobility pattern from.
Definition: MoBANCoordinator.h:146
unsigned int numPostures
Number of predefined postures.
Definition: MoBANCoordinator.h:110
Pattern * mobilityPattern
The mobility pattern data base.
Definition: MoBANCoordinator.h:138
posture_sel_type postureSelStrategy
The requested strategy for posture selection.
Definition: MoBANCoordinator.h:160
double ** markovMatrix
A matrix which maintains the transition probabilities of the Markov Model of posture pattern...
Definition: MoBANCoordinator.h:151
bool useMobilityPattern
Variable that shows if reusing previously logged mobility pattern is requested.
Definition: MoBANCoordinator.h:126
posture_sel_type
Possible (supported) strategies for posture selection.
Definition: MoBANCoordinator.h:154
inet::MoBANCoordinator::~MoBANCoordinator ( )
71 {
72  delete transitions;
73  delete [] mobilityPattern;
74  for (auto & elem : postureList)
75  delete elem;
76 }
std::vector< Posture * > postureList
The list of all predefined postures (posture data base)
Definition: MoBANCoordinator.h:113
PostureTransition * transitions
Class for performing operation for spatial and temporal correlations in posture selection.
Definition: MoBANCoordinator.h:163
Pattern * mobilityPattern
The mobility pattern data base.
Definition: MoBANCoordinator.h:138

Member Function Documentation

void inet::MoBANCoordinator::collectLocalModules ( cModule *  module)
protected

Collect MoBAN local modules.

Referenced by initialize().

717 {
718  for (cModule::SubmoduleIterator it(module); !it.end(); it++) {
719  cModule *submodule = *it;
720  collectLocalModules(submodule);
721  MoBANLocal *localModule = dynamic_cast<MoBANLocal *>(submodule);
722  if (localModule && localModule->par("coordinatorIndex").longValue() == getIndex()) {
723  localModule->setCoordinator(this);
724  localModules.push_back(localModule);
725  }
726  }
727 }
void collectLocalModules(cModule *module)
Collect MoBAN local modules.
Definition: MoBANCoordinator.cc:716
std::vector< MoBANLocal * > localModules
The mobility modules of the nodes in this WBAN.
Definition: MoBANCoordinator.h:98
void inet::MoBANCoordinator::computeMaxSpeed ( )
protected

Referenced by initialize().

730 {
731  if (useMobilityPattern)
732  {
733  for (int i = 0; i < patternLength; i++)
734  {
735  double patSpeed = mobilityPattern[i].speed;
736  if (maxSpeed < patSpeed)
737  maxSpeed = patSpeed;
738  }
739  }
740  else
741  {
742  for (auto & elem : postureList)
743  {
744  double postureMaxSpeed = elem->getMaxSpeed();
745  if (maxSpeed < postureMaxSpeed)
746  maxSpeed = postureMaxSpeed;
747  }
748 
749  }
750 }
std::vector< Posture * > postureList
The list of all predefined postures (posture data base)
Definition: MoBANCoordinator.h:113
double maxSpeed
The possible maximum speed at any future time.
Definition: MoBANCoordinator.h:104
double speed
Definition: MoBANCoordinator.h:133
int patternLength
The number of mobility pattern instances which has been read from the input file (length of mobility ...
Definition: MoBANCoordinator.h:143
Pattern * mobilityPattern
The mobility pattern data base.
Definition: MoBANCoordinator.h:138
bool useMobilityPattern
Variable that shows if reusing previously logged mobility pattern is requested.
Definition: MoBANCoordinator.h:126
virtual cModule* inet::MoBANCoordinator::findVisualRepresentation ( )
inlineoverrideprotectedvirtual

Returns the module that represents the object moved by this mobility module.

Reimplemented from inet::MobilityBase.

176 { return this; }
void inet::MoBANCoordinator::finish ( )
overrideprotectedvirtual

To be called at the end of simulation run.

287 {
288  fclose(logfile);
289 }
FILE * logfile
Pointer to the file for logging MoBAN mobility pattern for future use.
Definition: MoBANCoordinator.h:107
virtual double inet::MoBANCoordinator::getMaxSpeed ( ) const
inlineoverridevirtual

Returns the maximum possible speed at any future time.

Reimplemented from inet::MobilityBase.

Referenced by inet::MoBANLocal::computeMaxSpeed().

218 { return maxSpeed; }
double maxSpeed
The possible maximum speed at any future time.
Definition: MoBANCoordinator.h:104
void inet::MoBANCoordinator::initialize ( int  stage)
overrideprotectedvirtual

Initializes mobility model parameters.

Reimplemented from inet::MovingMobilityBase.

79 {
81 
82  EV_TRACE << "initializing MoBANCoordinator stage " << stage << endl;
83  if (stage == INITSTAGE_PHYSICAL_ENVIRONMENT) {
84  useMobilityPattern = par("useMobilityPattern").boolValue();
85  collectLocalModules(getParentModule());
86 
87  // preparing output mobility pattern log file
88  char log_file_name[70];
89  sprintf(log_file_name, "MoBAN_Pattern_out%d.txt", getIndex());
90  logfile = fopen(log_file_name, "w");
91 
93  throw cRuntimeError("MoBAN Coordinator: error in reading the posture specification file");
94 
95  if (!readConfigurationFile())
96  throw cRuntimeError("MoBAN Coordinator: error in reading the input configuration file");
97 
100  throw cRuntimeError("MoBAN Coordinator: error in reading the input mobility pattern file");
101 
102 
104  publishToNodes();
105  computeMaxSpeed();
106  }
107 }
virtual void initialize(int stage) override
Initializes mobility model parameters.
Definition: MovingMobilityBase.cc:42
bool readPostureSpecificationFile()
Reading the input postures specification file and making the posture data base.
Definition: MoBANCoordinator.cc:351
FILE * logfile
Pointer to the file for logging MoBAN mobility pattern for future use.
Definition: MoBANCoordinator.h:107
Physical environment initializations (mobility, obstacles, battery, annotations, etc).
Definition: InitStages.h:40
Coord lastPosition
The last position that was reported.
Definition: MobilityBase.h:78
void computeMaxSpeed()
Definition: MoBANCoordinator.cc:729
bool readMobilityPatternFile()
Reads the previously logged mobility pattern and make mobility pattern data base. ...
Definition: MoBANCoordinator.cc:295
void publishToNodes()
Publishes the reference point and other information of the posture to the blackboard of the belonging...
Definition: MoBANCoordinator.cc:277
Coord selectDestination()
Function to select the destination in the case of a mobile posture.
Definition: MoBANCoordinator.cc:233
void collectLocalModules(cModule *module)
Collect MoBAN local modules.
Definition: MoBANCoordinator.cc:716
bool useMobilityPattern
Variable that shows if reusing previously logged mobility pattern is requested.
Definition: MoBANCoordinator.h:126
bool readConfigurationFile()
Reads the input configuration file.
Definition: MoBANCoordinator.cc:440
bool inet::MoBANCoordinator::isInsideWorld ( Coord  tPos)
protected

Checks if all nodes of the WBAN are inside the simulation environment with the given position of the logical center.

Checks if all nodes of the WBAN are inside the simulation environment with the current position.

Referenced by selectDestination().

262 {
263  Coord absolutePosition;
264 
265  for (unsigned int i = 0; i < localModules.size(); ++i) {
266  absolutePosition = tPos + currentPosture->getPs(i);
267  if (!absolutePosition.isInBoundary(this->constraintAreaMin, this->constraintAreaMax))
268  return false;
269  }
270 
271  return true;
272 }
Posture * currentPosture
The current selected posture.
Definition: MoBANCoordinator.h:116
Coord getPs(unsigned int)
Returns the relative position of a node in this posture.
Definition: Posture.cc:144
std::vector< MoBANLocal * > localModules
The mobility modules of the nodes in this WBAN.
Definition: MoBANCoordinator.h:98
virtual int inet::MoBANCoordinator::numInitStages ( ) const
inlineoverrideprotectedvirtual

Returns the required number of initialize stages.

Reimplemented from inet::MobilityBase.

166 { return NUM_INIT_STAGES; }
The number of initialization stages.
Definition: InitStages.h:116
void inet::MoBANCoordinator::publishToNodes ( )
protected

Publishes the reference point and other information of the posture to the blackboard of the belonging nodes.

Referenced by initialize(), and setTargetPosition().

278 {
279  for (unsigned int i = 0; i < localModules.size(); ++i) {
280  MoBANLocal *localModule = localModules[i];
281  EV_DEBUG << "Publish data for: " << localModule->getParentModule()->getFullName() << endl;
282  localModule->setMoBANParameters(currentPosture->getPs(i), currentPosture->getRadius(i), currentPosture->getSpeed(i));
283  }
284 }
Posture * currentPosture
The current selected posture.
Definition: MoBANCoordinator.h:116
Coord getPs(unsigned int)
Returns the relative position of a node in this posture.
Definition: Posture.cc:144
double getRadius(unsigned int)
Returns the singular movement radius of a node in this posture.
Definition: Posture.cc:168
std::vector< MoBANLocal * > localModules
The mobility modules of the nodes in this WBAN.
Definition: MoBANCoordinator.h:98
double getSpeed(unsigned int)
Returns the singular movement speed of a node in this posture.
Definition: Posture.cc:176
bool inet::MoBANCoordinator::readConfigurationFile ( )
protected

Reads the input configuration file.

Function to read the configuration file which includes the information for configuring and tuning the model for a specific application scenario.

The configuration file can provide the Markov model transition matrices, different area types and time domains, and the proper matrix for each time-space combination. However, these are all optional and will be given just in the case that the space-time correlation are required to be simulated. The function will be called in the initialization phase.

Referenced by initialize().

441 {
442  cXMLElement *xmlConfig = par("configFile").xmlValue();
443  if (xmlConfig == nullptr)
444  return false;
445 
446  cXMLElementList tagList;
447  cXMLElement *tempTag;
448  const char *str;
449  std::string sstr; // for easier comparison
450 
451  /* Reading the initial posture if it is given*/
452  int postureID;
453  tagList = xmlConfig->getElementsByTagName("initialPosture");
454 
455  if (tagList.empty())
456  postureID = 0; // no initial posture has been specified. The first one is selected!
457  else {
458  tempTag = tagList.front();
459  str = tempTag->getAttribute("postureID");
460  postureID = strtol(str, nullptr, 0);
461  }
462  currentPosture = postureList[postureID];
463  EV_DEBUG << "Initial Posture: " << currentPosture->getPostureName() << endl;
464 
465  /* Reading the initial position if it is given */
466  tagList = xmlConfig->getElementsByTagName("initialLocation");
467  if (tagList.empty())
468  lastPosition = Coord(10, 10, 5); // no initial location has been specified .
469  else {
470  double x, y, z;
471  tempTag = tagList.front();
472 
473  str = tempTag->getAttribute("x");
474  x = strtod(str, nullptr);
475  str = tempTag->getAttribute("y");
476  y = strtod(str, nullptr);
477  str = tempTag->getAttribute("z");
478  z = strtod(str, nullptr);
479  lastPosition = Coord(x, y, z);
480  }
481  EV_DEBUG << "Initial position of the LC: " << lastPosition << endl;
482 
483  /* Reading the given range for duration of stable postures */
484  tagList = xmlConfig->getElementsByTagName("durationRange");
485  if (tagList.empty()) {
486  // no duration is specified. We assign a value!
487  minDuration = 0;
488  maxDuration = 100;
489  }
490  else {
491  tempTag = tagList.front();
492 
493  str = tempTag->getAttribute("min");
494  minDuration = strtod(str, nullptr);
495  str = tempTag->getAttribute("max");
496  maxDuration = strtod(str, nullptr);
497  }
498  EV_DEBUG << "Posture duration range: (" << minDuration << " , " << maxDuration << ")" << endl;
499 
500  transitions = new PostureTransition(numPostures);
501 
502  /* Reading the Markov transition matrices, if there are any. */
503  tagList = xmlConfig->getElementsByTagName("markovMatrices");
504 
505  if (tagList.empty()) {
506  postureSelStrategy = UNIFORM_RANDOM; // no posture selection strategy is required. uniform random is applied
507  EV_DEBUG << "Posture Selection strategy: UNIFORM_RANDOM " << endl;
508  return true;
509  }
510 
511  tempTag = tagList.front();
512 
513  cXMLElementList matrixList;
514  matrixList = tempTag->getElementsByTagName("MarkovMatrix");
515 
516  if (tagList.empty()) {
517  postureSelStrategy = UNIFORM_RANDOM; // no posture selection strategy is required. uniform random is applied
518  EV_DEBUG << "Posture Selection strategy: UNIFORM_RANDOM " << endl;
519  return true;
520  }
521 
523 
524  // make an empty matrix for the Markov Chain
525  double **matrix = new double *[numPostures];
526  for (unsigned int i = 0; i < numPostures; ++i)
527  matrix[i] = new double[numPostures];
528 
529  bool setDefault = false; // variable to remember if the default matrix is defined.
530  cXMLElementList::const_iterator matrixTag;
531  for (matrixTag = matrixList.begin(); matrixTag != matrixList.end(); matrixTag++) {
532  cXMLElementList rowList;
533  cXMLElementList cellList;
534  int i = 0, j = 0;
535  bool thisDefault = false;
536 
537  if ((*matrixTag)->getAttribute("type") != nullptr) {
538  sstr = (*matrixTag)->getAttribute("type");
539  if (sstr == "Default" || sstr == "default") {
540  if (setDefault)
541  throw cRuntimeError("There are more than one default matrix defined in the configuration file!");
542  else {
543  setDefault = true;
544  thisDefault = true;
545  }
546  }
547  }
548 
549  sstr = (*matrixTag)->getAttribute("name");
550 
551  rowList = (*matrixTag)->getElementsByTagName("row");
552  if (rowList.size() != numPostures && rowList.size() != 1)
553  throw cRuntimeError("Number of rows in the Markov transition matrix should be equal to either the number"
554  " of postures (full Markov matrix) or one (steady state vector)");
555 
556  if (rowList.size() != numPostures && thisDefault)
557  throw cRuntimeError("Dimension of the default Markov matrix should be equal to the number of postures in the configuration file");
558 
559  if ((rowList.size() == 1) && (!setDefault))
560  throw cRuntimeError("A default matrix is supposed to be defined before a steady state can be defined in the configuration file");
561 
562  for (cXMLElementList::const_iterator row = rowList.begin(); row != rowList.end(); row++) {
563  cellList = (*row)->getElementsByTagName("cell");
564  if (cellList.size() != numPostures)
565  throw cRuntimeError("Number of columns in the Markov transition matrix should be equal to the number of postures");
566 
567  j = 0;
568  for (cXMLElementList::const_iterator cell = cellList.begin(); cell != cellList.end(); cell++) {
569  str = (*cell)->getAttribute("value");
570  matrix[i][j] = strtod(str, nullptr);
571  j++;
572  }
573 
574  ++i;
575  }
576 
577  if (rowList.size() == 1)
578  transitions->addSteadyState(sstr, matrix[0]); // steady state
579  else
580  transitions->addMatrix(sstr, matrix, thisDefault); // A full Markovian matrix
581 
582  EV_DEBUG << "Markov transition matrix " << sstr << " : " << endl;
583  for (int k = 0; k < i; ++k) {
584  for (unsigned int f = 0; f < numPostures; ++f)
585  EV_DEBUG << matrix[k][f] << " ";
586  EV_DEBUG << endl;
587  }
588  }
589  for (unsigned int i = 0; i < numPostures; ++i)
590  delete [] matrix[i];
591  delete [] matrix;
592 
593  /* Reading the Area types, if there are any. */
594  tagList = xmlConfig->getElementsByTagName("areaTypes");
595 
596  if (tagList.empty())
597  EV_DEBUG << "No area type is given. So there is no spatial correlation in posture selection." << endl;
598  else {
599  tempTag = tagList.front();
600  cXMLElementList typeList = tempTag->getElementsByTagName("areaType");
601 
602  if (typeList.empty())
603  throw cRuntimeError("No areaType has been defined in areaTypes!");
604 
605  for (cXMLElementList::const_iterator aType = typeList.begin(); aType != typeList.end(); aType++) {
606  sstr = (*aType)->getAttribute("name");
607 
608  EV_DEBUG << "Area type " << sstr << " : " << endl;
609 
610  int typeID = transitions->addAreaType(sstr);
611 
612  cXMLElementList boundList = (*aType)->getElementsByTagName("boundary");
613  if (boundList.empty())
614  throw cRuntimeError("No boundary is given for a area type!");
615 
616  Coord minBound, maxBound;
617  for (cXMLElementList::const_iterator aBound = boundList.begin(); aBound != boundList.end(); aBound++) {
618  str = (*aBound)->getAttribute("xMin");
619  minBound.x = strtod(str, nullptr);
620  str = (*aBound)->getAttribute("yMin");
621  minBound.y = strtod(str, nullptr);
622  str = (*aBound)->getAttribute("zMin");
623  minBound.z = strtod(str, nullptr);
624 
625  str = (*aBound)->getAttribute("xMax");
626  maxBound.x = strtod(str, nullptr);
627  str = (*aBound)->getAttribute("yMax");
628  maxBound.y = strtod(str, nullptr);
629  str = (*aBound)->getAttribute("zMax");
630  maxBound.z = strtod(str, nullptr);
631 
632  transitions->setAreaBoundry(typeID, minBound, maxBound);
633  EV_DEBUG << "Low bound: " << minBound << endl;
634  EV_DEBUG << "High bound: " << maxBound << endl;
635  }
636  }
637  }
638 
639  /* Reading the time domains, if there are any. */
640  tagList = xmlConfig->getElementsByTagName("timeDomains");
641 
642  if (tagList.empty())
643  EV_DEBUG << "No time domain is given. So there is no temporal correlation in posture selection." << endl;
644  else {
645  tempTag = tagList.front();
646  cXMLElementList typeList = tempTag->getElementsByTagName("timeDomain");
647 
648  if (typeList.empty())
649  throw cRuntimeError("No timeDomain has been defined in timeDomains!");
650 
651  for (cXMLElementList::const_iterator aType = typeList.begin(); aType != typeList.end(); aType++) {
652  sstr = (*aType)->getAttribute("name");
653 
654  EV_DEBUG << "Time domain " << sstr << " : " << endl;
655 
656  int typeID = transitions->addTimeDomain(sstr);
657 
658  cXMLElementList boundList = (*aType)->getElementsByTagName("boundary");
659  if (boundList.empty())
660  throw cRuntimeError("No boundary is given for a time domain!");
661 
662  simtime_t minTime, maxTime;
663  for (cXMLElementList::const_iterator aBound = boundList.begin(); aBound != boundList.end(); aBound++) {
664  str = (*aBound)->getAttribute("tMin");
665  minTime = strtod(str, nullptr);
666  str = (*aBound)->getAttribute("tMax");
667  maxTime = strtod(str, nullptr);
668 
669  transitions->setTimeBoundry(typeID, minTime, maxTime);
670  EV_DEBUG << "Low bound: (" << minTime.dbl() << ", " << maxTime << ")" << endl;
671  }
672  }
673  }
674 
675  /* Reading the combinations, if there are any. */
676  tagList = xmlConfig->getElementsByTagName("combinations");
677 
678  if (tagList.empty())
679  EV_DEBUG << "No combination is given. The default Markov model is then used for the whole time and space!" << endl;
680  else {
681  tempTag = tagList.front();
682  cXMLElementList combList = tempTag->getElementsByTagName("combination");
683 
684  if (combList.empty())
685  throw cRuntimeError("No combination has been defined in combinations!");
686 
687  EV_DEBUG << "Combinations: " << endl;
688 
689  for (cXMLElementList::const_iterator aComb = combList.begin(); aComb != combList.end(); aComb++) {
690  std::string areaName, timeName, matrixName;
691 
692  if ((*aComb)->getAttribute("areaType") != nullptr)
693  areaName = (*aComb)->getAttribute("areaType");
694  else
695  areaName.clear();
696 
697  if ((*aComb)->getAttribute("timeDomain") != nullptr)
698  timeName = (*aComb)->getAttribute("timeDomain");
699  else
700  timeName.clear();
701 
702  if ((*aComb)->getAttribute("matrix") != nullptr)
703  matrixName = (*aComb)->getAttribute("matrix");
704  else
705  throw cRuntimeError("No transition matrix is specified for a combination");
706 
707  transitions->addCombination(areaName, timeName, matrixName);
708 
709  EV_DEBUG << "(" << areaName << ", " << timeName << ", " << matrixName << ")" << endl;
710  }
711  }
712 
713  return true;
714 }
simtime_t maxDuration
The maximum value of the duration for stable postures.
Definition: MoBANCoordinator.h:122
bool addCombination(std::string, std::string, std::string)
Adds a space-time combination to the list.
Definition: PostureTransition.cc:239
std::vector< Posture * > postureList
The list of all predefined postures (posture data base)
Definition: MoBANCoordinator.h:113
Posture * currentPosture
The current selected posture.
Definition: MoBANCoordinator.h:116
Definition: MoBANCoordinator.h:156
bool setTimeBoundry(int, simtime_t, simtime_t)
Adds the given boundary to the existing time domain specified by the given ID .
Definition: PostureTransition.cc:222
PostureTransition * transitions
Class for performing operation for spatial and temporal correlations in posture selection.
Definition: MoBANCoordinator.h:163
Coord lastPosition
The last position that was reported.
Definition: MobilityBase.h:78
simtime_t minDuration
The minimum value of the duration for stable postures.
Definition: MoBANCoordinator.h:119
unsigned int numPostures
Number of predefined postures.
Definition: MoBANCoordinator.h:110
posture_sel_type postureSelStrategy
The requested strategy for posture selection.
Definition: MoBANCoordinator.h:160
int addSteadyState(std::string, double *)
Receives a steady state vector, extracts the corresponding transition matrix considering the default ...
Definition: PostureTransition.cc:131
void addMatrix(double **, double **, double **)
Adds two matrices with dimension numPos*numPose .
Definition: PostureTransition.cc:430
int addTimeDomain(std::string)
Adds a time domain to the list with the given name and returns the index of the this time domain in t...
Definition: PostureTransition.cc:202
char * getPostureName()
Returns posture name.
Definition: Posture.cc:184
int addAreaType(std::string)
Adds a area type to the list with the given name and returns the index of this area type in the list...
Definition: PostureTransition.cc:167
Definition: MoBANCoordinator.h:155
const double k
Definition: QAM16Modulation.cc:24
bool setAreaBoundry(int, Coord, Coord)
Adds the given boundary to the existing area type specified by the given ID .
Definition: PostureTransition.cc:187
bool inet::MoBANCoordinator::readMobilityPatternFile ( )
protected

Reads the previously logged mobility pattern and make mobility pattern data base.

This function reads the input mobility pattern file and make a list of the mobility patterns.

It will be called in the initialization phase if the useMobilityPattern parameter is true.

Referenced by initialize().

296 {
297  patternLength = 0;
298  double x, y, z, s;
299  int id;
300  char file_name[70];
301  char posture_name[50];
302 
303  sprintf(file_name, "%s", par("mobilityPatternFile").stringValue());
304  FILE *fp = fopen(file_name, "r");
305  if (fp == nullptr)
306  return false;
307 
308  // count number of patterns (lines in the input file)
309  int c;
310  while ((c = fgetc(fp)) != EOF)
311  if (c == '\n')
312  patternLength++;
313 
314  fclose(fp);
315 
316  EV_DEBUG << "Mobility Pattern Length: " << patternLength << endl;
317 
319 
320  fp = fopen(file_name, "r");
321 
322  int i = 0;
323  while (fscanf(fp, "%49s %d", posture_name, &id) != -1) {
325  if (postureList[id]->isMobile()) {
326  assert(fscanf(fp, "%le %le %le %le", &x, &y, &z, &s) != -1);
327  mobilityPattern[i].targetPos = Coord(x, y, z);
328  mobilityPattern[i].speed = s;
329  }
330  else {
331  assert(fscanf(fp, "%le", &x) != -1);
332  mobilityPattern[i].duration = x;
333  }
334  ++i;
335  }
336 
337  fclose(fp);
338 
339  currentPattern = -1;
340 
341  return true;
342 }
struct inet::MoBANCoordinator::pattern Pattern
Data type for one instance of mobility pattern.
std::vector< Posture * > postureList
The list of all predefined postures (posture data base)
Definition: MoBANCoordinator.h:113
Coord targetPos
Definition: MoBANCoordinator.h:132
double speed
Definition: MoBANCoordinator.h:133
int patternLength
The number of mobility pattern instances which has been read from the input file (length of mobility ...
Definition: MoBANCoordinator.h:143
const value< double, compose< units::m, pow< units::s,-1 > > > c(299792458)
int currentPattern
The index of the currently applied mobility pattern from.
Definition: MoBANCoordinator.h:146
Pattern * mobilityPattern
The mobility pattern data base.
Definition: MoBANCoordinator.h:138
unsigned int postureID
Definition: MoBANCoordinator.h:131
#define stringValue()
Definition: NedFunctions.cc:24
uint16_t id
Definition: TCP_NSC.cc:85
value< double, units::s > s
Definition: Units.h:1049
simtime_t duration
Definition: MoBANCoordinator.h:134
bool inet::MoBANCoordinator::readPostureSpecificationFile ( )
protected

Reading the input postures specification file and making the posture data base.

Function to read the specified posture specification input file and make the posture data base.

The posture specification includes the specification of a set of possible body postures in the target application. The specification of each posture should provide the speed range of the global movement of the whole WBAN and the relative position of the reference point, movement radius around the reference point and movement velocity of all nodes in the WBAN. The function will be called in the initialization phase.

Referenced by initialize().

352 {
353  cXMLElement *xmlPosture = par("postureSpecFile").xmlValue();
354  if (xmlPosture == nullptr)
355  return false;
356 
357  const char *str;
358 
359  // read the specification of every posture from file and make a list of postures
360  cXMLElementList postures;
361 
362  postures = xmlPosture->getElementsByTagName("posture");
363 
364  // find the number of defined postures
365  numPostures = postures.size();
366  if (numPostures == 0)
367  throw cRuntimeError("No posture is defined in the input posture specification file");
368 
369  unsigned int postureID;
370 
371  cXMLElementList::const_iterator posture;
372  for (posture = postures.begin(); posture != postures.end(); posture++) {
373  str = (*posture)->getAttribute("postureID");
374  postureID = strtol(str, nullptr, 0);
375  if (postureID >= numPostures)
376  throw cRuntimeError("Posture ID in input posture specification file is out of the range");
377 
378  postureList.push_back(new Posture(postureID, localModules.size()));
379 
380  str = (*posture)->getAttribute("name");
381  postureList[postureID]->setPostureName(const_cast<char *>(str));
382 
383  str = (*posture)->getAttribute("minSpeed");
384  double minS = strtod(str, nullptr);
385  str = (*posture)->getAttribute("maxSpeed");
386  double maxS = strtod(str, nullptr);
387  postureList[postureID]->setPostureSpeed(minS, maxS);
388 
389  int i = 0;
390  double x, y, z, s, r;
391  cXMLElementList nodeParameters;
392 
393  nodeParameters = (*posture)->getElementsByTagName("nodeParameters");
394  if (nodeParameters.size() != localModules.size())
395  throw cRuntimeError("Some nodes may not have specified parameters in a posture in input posture specification file");
396 
397  cXMLElementList::const_iterator param;
398  for (param = nodeParameters.begin(); param != nodeParameters.end(); param++) {
399  str = (*param)->getAttribute("positionX");
400  x = strtod(str, nullptr);
401 
402  str = (*param)->getAttribute("positionY");
403  y = strtod(str, nullptr);
404 
405  str = (*param)->getAttribute("positionZ");
406  z = strtod(str, nullptr);
407 
408  str = (*param)->getAttribute("radius");
409  r = strtod(str, nullptr);
410 
411  str = (*param)->getAttribute("speed");
412  s = strtod(str, nullptr);
413 
414  postureList[postureID]->setPs(i, Coord(x, y, z));
415  postureList[postureID]->setRadius(i, r);
416  postureList[postureID]->setSpeed(i, s);
417 
418  i++;
419  }
420  }
421 
422  /* Report the obtained specification of the postures. */
423  for (unsigned int i = 0; i < numPostures; ++i) {
424  EV_DEBUG << "Information for the posture: " << i << " is" << endl;
425  for (unsigned int j = 0; j < localModules.size(); ++j)
426  EV_DEBUG << "Node " << j << " position: " << postureList[i]->getPs(j)
427  << " and radius: " << postureList[i]->getRadius(j) << " and speed: " << postureList[i]->getSpeed(j) << endl;
428  }
429 
430  return true;
431 }
std::vector< Posture * > postureList
The list of all predefined postures (posture data base)
Definition: MoBANCoordinator.h:113
unsigned int numPostures
Number of predefined postures.
Definition: MoBANCoordinator.h:110
std::vector< MoBANLocal * > localModules
The mobility modules of the nodes in this WBAN.
Definition: MoBANCoordinator.h:98
value< double, units::s > s
Definition: Units.h:1049
void inet::MoBANCoordinator::refreshDisplay ( ) const
overrideprotectedvirtual
174 {
175  //show posture name in the graphical interface
176  char dis_str[100];
177  sprintf(dis_str, "%s until %f", currentPosture->getPostureName(), nextChange.dbl());
178  getDisplayString().setTagArg("t", 0, dis_str);
179 }
Posture * currentPosture
The current selected posture.
Definition: MoBANCoordinator.h:116
simtime_t nextChange
The next simulation time when the mobility module needs to update its internal state.
Definition: MovingMobilityBase.h:60
char * getPostureName()
Returns posture name.
Definition: Posture.cc:184
Coord inet::MoBANCoordinator::selectDestination ( )
protected

Function to select the destination in the case of a mobile posture.

Select a position inside the simulation area as the destination for the new mobile posture.

It is called whenever a new mobile posture is selected. It is taken into account that all nodes should be inside the area.

Referenced by initialize(), and setTargetPosition().

234 {
235  Coord res;
236  res = getRandomPosition();
237  res.z = lastPosition.z; // the z value remain the same
238 
239  // check if it is okay using CoverRadius
240  while (!isInsideWorld(res)) {
241  res = getRandomPosition();
242  res.z = lastPosition.z;
243  }
244 
245  return res;
246 }
double z
Definition: Coord.h:51
virtual Coord getRandomPosition()
Returns a new random position satisfying the constraint area.
Definition: MobilityBase.cc:181
Coord lastPosition
The last position that was reported.
Definition: MobilityBase.h:78
bool isInsideWorld(Coord)
Checks if all nodes of the WBAN are inside the simulation environment with the given position of the ...
Definition: MoBANCoordinator.cc:261
simtime_t inet::MoBANCoordinator::selectDuration ( )
protected

Select a stay time duration in the specified range for the new posture.

Select a stay time duration in the specified duration range for the new posture.

It is called whenever a new stable posture is selected.

Referenced by setTargetPosition().

224 {
225  return uniform(minDuration, maxDuration);
226 }
simtime_t maxDuration
The maximum value of the duration for stable postures.
Definition: MoBANCoordinator.h:122
simtime_t minDuration
The minimum value of the duration for stable postures.
Definition: MoBANCoordinator.h:119
void inet::MoBANCoordinator::selectPosture ( )
protected

Function to select the next posture considering the current posture and the Markov model.

Select a new posture randomly or based on the given Markov model.

If the requested strategy is not uniform random, A Markov chain will be used. If the strategy is INDIVIDUAL_MARKOV, we should retrieve the transition matrix for the current part of the area. If it is INDIVIDUAL_MARKOV, we have the base transition matrix and a steady state vector for the current part of the area. So the closest transition matrix to the base matrix is calculated which satisfies the required steady state vector. In any case, the next posture is selected considering the current posture and according to the final Markov transition matrix.

Referenced by setTargetPosition().

191 {
192  int postureID = 0;
193 
195  postureID = floor(uniform(0, numPostures)); // uniformly random posture selection
196  currentPosture = postureList[postureID];
197  return;
198  }
199 
200  /* Here we check the area and the time to determine the corresponding posture transition matrix */
202 
203  /* Using transition matrix to select the next posture */
204  double randomValue = uniform(0, 1);
205  double comp = 0;
206  int currentP = currentPosture->getPostureID(); // it determines the column in the matrix
207 
208  for (int i = 0; i < static_cast<int>(numPostures); ++i) {
209  comp += markovMatrix[i][currentP];
210  if (randomValue < comp) {
211  postureID = i;
212  break;
213  }
214  }
215 
216  currentPosture = postureList[postureID];
217 }
std::vector< Posture * > postureList
The list of all predefined postures (posture data base)
Definition: MoBANCoordinator.h:113
Posture * currentPosture
The current selected posture.
Definition: MoBANCoordinator.h:116
PostureTransition * transitions
Class for performing operation for spatial and temporal correlations in posture selection.
Definition: MoBANCoordinator.h:163
Coord lastPosition
The last position that was reported.
Definition: MobilityBase.h:78
unsigned int numPostures
Number of predefined postures.
Definition: MoBANCoordinator.h:110
posture_sel_type postureSelStrategy
The requested strategy for posture selection.
Definition: MoBANCoordinator.h:160
double ** markovMatrix
A matrix which maintains the transition probabilities of the Markov Model of posture pattern...
Definition: MoBANCoordinator.h:151
int getPostureID()
Returns the unique Id (index) of this posture.
Definition: Posture.cc:189
double ** getMatrix(simtime_t, Coord)
Gets a time and location, and returns the corresponding Markov transition matrix. ...
Definition: PostureTransition.cc:305
Definition: MoBANCoordinator.h:155
double inet::MoBANCoordinator::selectSpeed ( )
protected

Select a velocity value within the given velocity range.

It is called whenever a new stable posture is selected. In the case of using a logged mobility pattern, the speed value is retrieved from the pattern.

Referenced by setTargetPosition().

254 {
255  return uniform(currentPosture->getMinSpeed(), currentPosture->getMaxSpeed());
256 }
double getMaxSpeed()
Returns maximum value of the speed range of this posture.
Definition: Posture.cc:194
Posture * currentPosture
The current selected posture.
Definition: MoBANCoordinator.h:116
double getMinSpeed()
Returns minimum value of the speed range of this posture.
Definition: Posture.cc:199
void inet::MoBANCoordinator::setInitialPosition ( )
overrideprotectedvirtual

Initializes the position from the display string or from module parameters.

Reimplemented from inet::MobilityBase.

110 {
111 // lastPosition = selectDestination();
112 }
void inet::MoBANCoordinator::setTargetPosition ( )
overrideprotectedvirtual

Set a new target position from the next posture.

The main process of the MoBAN mobility model.

To be called whenever a destination is reached or the duration of the previous posture expires. It select the behavior of the next movement (the posture and the destination), and prepare the required variables to make the movement. In the case of using a logged mobility pattern, the new posture and other parameters are obtained from the pattern.

Implements inet::LineSegmentsMobilityBase.

121 {
122  // select the new posture and set the variable currentPosture as well as the reference points of all nodes within the WBAN.
123  if (useMobilityPattern) {
125  int postureID = mobilityPattern[currentPattern].postureID;
126  currentPosture = postureList[postureID];
127  }
128  else
129  selectPosture();
130 
131  EV_DEBUG << "New posture is selected: " << currentPosture->getPostureName() << endl;
132 
133  simtime_t duration;
134  if (currentPosture->isMobile()) {
135  double distance;
136 
137  if (useMobilityPattern) {
140  }
141  else {
143  speed = selectSpeed();
144  }
145 
146  if (speed == 0)
147  throw cRuntimeError("The velocity in a mobile posture should not be zero!");
148 
150  duration = distance / speed;
151  }
152  else {
154  if (useMobilityPattern)
156  else
157  duration = selectDuration();
158  }
159  nextChange = simTime() + duration;
160 
161  // write the move step into the output log file
162  if (currentPosture->isMobile())
164  else
165  fprintf(logfile, "%s %d %f \n", currentPosture->getPostureName(), currentPosture->getPostureID(), duration.dbl());
166 
167  publishToNodes();
168 
169  EV_DEBUG << "New posture: " << currentPosture->getPostureName() << endl;
170  EV_DEBUG << "Destination: " << targetPosition << " Total Time = " << duration << endl;
171 }
double selectSpeed()
Select a velocity value within the given velocity range.
Definition: MoBANCoordinator.cc:253
std::vector< Posture * > postureList
The list of all predefined postures (posture data base)
Definition: MoBANCoordinator.h:113
double speed
Currently selected speed for the mobile posture.
Definition: MoBANCoordinator.h:101
Posture * currentPosture
The current selected posture.
Definition: MoBANCoordinator.h:116
simtime_t selectDuration()
Select a stay time duration in the specified range for the new posture.
Definition: MoBANCoordinator.cc:223
FILE * logfile
Pointer to the file for logging MoBAN mobility pattern for future use.
Definition: MoBANCoordinator.h:107
bool isMobile()
Check if this posture is mobile by checking the maximum possible speed.
Definition: Posture.cc:204
double z
Definition: Coord.h:51
Coord targetPos
Definition: MoBANCoordinator.h:132
void selectPosture()
Function to select the next posture considering the current posture and the Markov model...
Definition: MoBANCoordinator.cc:190
double speed
Definition: MoBANCoordinator.h:133
Coord lastPosition
The last position that was reported.
Definition: MobilityBase.h:78
simtime_t nextChange
The next simulation time when the mobility module needs to update its internal state.
Definition: MovingMobilityBase.h:60
int patternLength
The number of mobility pattern instances which has been read from the input file (length of mobility ...
Definition: MoBANCoordinator.h:143
Coord targetPosition
End position of current linear movement.
Definition: LineSegmentsMobilityBase.h:41
int currentPattern
The index of the currently applied mobility pattern from.
Definition: MoBANCoordinator.h:146
void publishToNodes()
Publishes the reference point and other information of the posture to the blackboard of the belonging...
Definition: MoBANCoordinator.cc:277
Coord selectDestination()
Function to select the destination in the case of a mobile posture.
Definition: MoBANCoordinator.cc:233
Pattern * mobilityPattern
The mobility pattern data base.
Definition: MoBANCoordinator.h:138
double distance(const Coord &a) const
Returns the distance to Coord &#39;a&#39;.
Definition: Coord.h:201
unsigned int postureID
Definition: MoBANCoordinator.h:131
int getPostureID()
Returns the unique Id (index) of this posture.
Definition: Posture.cc:189
bool useMobilityPattern
Variable that shows if reusing previously logged mobility pattern is requested.
Definition: MoBANCoordinator.h:126
char * getPostureName()
Returns posture name.
Definition: Posture.cc:184
simtime_t duration
Definition: MoBANCoordinator.h:134
double y
Definition: Coord.h:50
double x
Definition: Coord.h:49

Member Data Documentation

int inet::MoBANCoordinator::currentPattern
protected

The index of the currently applied mobility pattern from.

Referenced by readMobilityPatternFile(), and setTargetPosition().

Posture* inet::MoBANCoordinator::currentPosture
protected
std::vector<MoBANLocal *> inet::MoBANCoordinator::localModules
protected

The mobility modules of the nodes in this WBAN.

Referenced by collectLocalModules(), isInsideWorld(), publishToNodes(), and readPostureSpecificationFile().

FILE* inet::MoBANCoordinator::logfile
protected

Pointer to the file for logging MoBAN mobility pattern for future use.

Referenced by finish(), initialize(), and setTargetPosition().

double** inet::MoBANCoordinator::markovMatrix
protected

A matrix which maintains the transition probabilities of the Markov Model of posture pattern.

To be given through configuration file.

Referenced by selectPosture().

simtime_t inet::MoBANCoordinator::maxDuration
protected

The maximum value of the duration for stable postures.

Referenced by readConfigurationFile(), and selectDuration().

double inet::MoBANCoordinator::maxSpeed
protected

The possible maximum speed at any future time.

Referenced by computeMaxSpeed().

simtime_t inet::MoBANCoordinator::minDuration
protected

The minimum value of the duration for stable postures.

Referenced by readConfigurationFile(), and selectDuration().

Pattern* inet::MoBANCoordinator::mobilityPattern
protected

The mobility pattern data base.

Referenced by computeMaxSpeed(), readMobilityPatternFile(), setTargetPosition(), and ~MoBANCoordinator().

unsigned int inet::MoBANCoordinator::numPostures
protected

Number of predefined postures.

Referenced by readConfigurationFile(), readPostureSpecificationFile(), and selectPosture().

int inet::MoBANCoordinator::patternLength
protected

The number of mobility pattern instances which has been read from the input file (length of mobility pattern data base).

Referenced by computeMaxSpeed(), readMobilityPatternFile(), and setTargetPosition().

std::vector<Posture *> inet::MoBANCoordinator::postureList
protected
posture_sel_type inet::MoBANCoordinator::postureSelStrategy
protected

The requested strategy for posture selection.

To be given through configuration file.

Referenced by readConfigurationFile(), and selectPosture().

double inet::MoBANCoordinator::speed
protected

Currently selected speed for the mobile posture.

Referenced by setTargetPosition().

PostureTransition* inet::MoBANCoordinator::transitions
protected

Class for performing operation for spatial and temporal correlations in posture selection.

Referenced by readConfigurationFile(), selectPosture(), and ~MoBANCoordinator().

bool inet::MoBANCoordinator::useMobilityPattern
protected

Variable that shows if reusing previously logged mobility pattern is requested.

The value is gotten from the parameter of the module

Referenced by computeMaxSpeed(), initialize(), and setTargetPosition().


The documentation for this class was generated from the following files: