DESERT 3.5.1
Loading...
Searching...
No Matches
UwRangingTokenBus Class Reference

#include <uwranging_tokenbus.h>

Inheritance diagram for UwRangingTokenBus:
Collaboration diagram for UwRangingTokenBus:

Public Member Functions

 UwRangingTokenBus ()
 
virtual ~UwRangingTokenBus ()
 
- Public Member Functions inherited from UwTokenBus
 UwTokenBus ()
 
virtual ~UwTokenBus ()
 

Protected Member Functions

virtual bool validToken (Packet *p) const override
 
virtual void sendToken (int next_id) override
 
virtual void Phy2MacEndRx (Packet *p) override
 
virtual void computeDist ()
 
virtual int command (int argc, const char *const *argv)
 
- Protected Member Functions inherited from UwTokenBus
virtual void expireBusIdle ()
 
virtual void expireTokenPass ()
 
virtual void initRing ()
 
virtual void txData ()
 
virtual int normId (int id) const
 
virtual int nextId (int id) const
 
virtual int nextIdOwned (int id) const
 
virtual void recvFromUpperLayers (Packet *p) override
 
virtual void Phy2MacStartRx (const Packet *p) override
 
virtual void Mac2PhyStartTx (Packet *p)
 
virtual void Phy2MacEndTx (const Packet *p) override
 
virtual void initPkt (Packet *p)
 
constexpr int NMOD (int n)
 

Protected Attributes

const int dist_num
 
double epsilon
 
double max_tt
 
std::vector< std::vector< int > > dist_map
 
std::vector< std::vector< double > > times_mat
 
std::vector< std::vector< int > > times_age
 
std::vector< std::vector< double > > x_mat
 
std::vector< double > distances
 
double time_last_range
 
int id_last_range
 
- Protected Attributes inherited from UwTokenBus
int node_id
 
int n_nodes
 
int last_token_id_heard = 0
 
int last_token_id_owned = 0
 
double max_token_hold_time
 
double min_token_hold_time
 
double token_rx_time
 
int max_queue_size
 
std::deque< Packet * > buffer
 
UWTokenBus_STATUS rtx_status
 
bool got_token
 
double slot_time
 
double token_pass_timeout
 
double bus_idle_timeout
 
TimerTokenPass token_pass_timer
 
TimerBusIdle bus_idle_timer
 
int count_token_resend
 
int count_token_regen
 
int count_token_invalid
 
int debug
 
int drop_old_
 
int checkPriority
 

Additional Inherited Members

- Public Types inherited from UwTokenBus
enum  UWTokenBus_STATUS { IDLE , TRANSMITTING , RECEIVING }
 
- Static Protected Attributes inherited from UwTokenBus
static int count_nodes = 0
 
static int count_token_pass_exp = 0
 
static int count_bus_idle_exp = -1
 

Detailed Description

Class that represents a TokenBus Node.

Definition at line 49 of file uwranging_tokenbus.h.

Constructor & Destructor Documentation

◆ UwRangingTokenBus()

UwRangingTokenBus::UwRangingTokenBus ( )

Default constructor of the TokenBus class.

Definition at line 84 of file uwranging_tokenbus.cpp.

◆ ~UwRangingTokenBus()

UwRangingTokenBus::~UwRangingTokenBus ( )
virtual

Destructor of the TokenBus class.

Definition at line 141 of file uwranging_tokenbus.cpp.

Member Function Documentation

◆ command()

int UwRangingTokenBus::command ( int  argc,
const char *const *  argv 
)
protectedvirtual

TCL command interpreter.

It implements the following OTcl methods:

Parameters
argcNumber of arguments in argv.
argvArray of strings which are the command parameters (Note that argv[0] is the name of the object).
Returns
TCL_OK or TCL_ERROR whether the command has been dispatched successfully or not.

Reimplemented from UwTokenBus.

Definition at line 392 of file uwranging_tokenbus.cpp.

◆ computeDist()

void UwRangingTokenBus::computeDist ( )
protectedvirtual

compute the linear regression and updates the distances vector

Definition at line 315 of file uwranging_tokenbus.cpp.

◆ Phy2MacEndRx()

void UwRangingTokenBus::Phy2MacEndRx ( Packet *  p)
overrideprotectedvirtual

Method called when the Phy Layer finish to receive a Packet.

Parameters
ppointer to a Packet object that rapresent the Packet in reception

Reimplemented from UwTokenBus.

Definition at line 145 of file uwranging_tokenbus.cpp.

◆ sendToken()

void UwRangingTokenBus::sendToken ( int  next_id)
overrideprotectedvirtual

Passes the token to the next node.

Parameters
next_idnode receiving the token

Reimplemented from UwTokenBus.

Definition at line 261 of file uwranging_tokenbus.cpp.

◆ validToken()

bool UwRangingTokenBus::validToken ( Packet *  p) const
overrideprotectedvirtual

Assert if the received token id is valid, i.e it follows the monotonic progression taking in account overflow.

Parameters
pPacket with token

Reimplemented from UwTokenBus.

Definition at line 425 of file uwranging_tokenbus.cpp.

Member Data Documentation

◆ dist_map

std::vector<std::vector<int> > UwRangingTokenBus::dist_map
protected

of size [n_nodes][n_nodes] maps(nodeX,nodeY) -> distance

Definition at line 111 of file uwranging_tokenbus.h.

◆ dist_num

const int UwRangingTokenBus::dist_num
protected

num of distances: will be initialized to n_nodes*(n_nodes-1)/2

Definition at line 107 of file uwranging_tokenbus.h.

◆ distances

std::vector<double> UwRangingTokenBus::distances
protected

vector of shape [D], contains the one way travel times between nodes to be transformed to distances by the user according to the chosen speed of sound model

Definition at line 118 of file uwranging_tokenbus.h.

◆ epsilon

double UwRangingTokenBus::epsilon
protected

difference between virtually equal distances can result in small negative numbers due to floating point precision so values within epsilon will not be discarded by NNLS algo

Definition at line 109 of file uwranging_tokenbus.h.

◆ id_last_range

int UwRangingTokenBus::id_last_range
protected

node id from which I received the last ranging pkt

Definition at line 120 of file uwranging_tokenbus.h.

◆ max_tt

double UwRangingTokenBus::max_tt
protected

max travel time between nodes in seconds, used to discard bad nnleast_squares() results

Definition at line 110 of file uwranging_tokenbus.h.

◆ time_last_range

double UwRangingTokenBus::time_last_range
protected

time of last ping reception (or transmission)

Definition at line 119 of file uwranging_tokenbus.h.

◆ times_age

std::vector<std::vector<int> > UwRangingTokenBus::times_age
protected

vector of shape [n_nodes][n_nodes-1] holds the age of a time (slot number in which the time was calculate or received)

Definition at line 115 of file uwranging_tokenbus.h.

◆ times_mat

std::vector<std::vector<double> > UwRangingTokenBus::times_mat
protected

vector of shape [n_nodes][n_nodes-1] holds the travel times: the first index is the node_id which has calculated them

Definition at line 113 of file uwranging_tokenbus.h.

◆ x_mat

std::vector<std::vector<double> > UwRangingTokenBus::x_mat
protected

of size [2D][D] it's the sparse matrix with the equations coefficients (-1,0,1)

Definition at line 116 of file uwranging_tokenbus.h.


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