39#ifndef UWRANGINGTOKENBUS_H
40#define UWRANGINGTOKENBUS_H
72 virtual bool validToken(Packet *p)
const override;
78 virtual void sendToken(
int next_id)
override;
105 virtual int command(
int argc,
const char *
const *argv);
116 std::vector<std::vector<double>>
x_mat;
Class that represents a TokenBus Node.
const int dist_num
num of distances: will be initialized to n_nodes*(n_nodes-1)/2
std::vector< std::vector< double > > times_mat
vector of shape [n_nodes][n_nodes-1] holds the travel times: the first index is the node_id which has...
int id_last_range
node id from which I received the last ranging pkt
virtual void computeDist()
compute the linear regression and updates the distances vector
double max_tt
max travel time between nodes in seconds, used to discard bad nnleast_squares() results
virtual bool validToken(Packet *p) const override
Assert if the received token id is valid, i.e it follows the monotonic progression taking in account ...
virtual ~UwRangingTokenBus()
Destructor of the TokenBus class.
std::vector< double > distances
vector of shape [D], contains the one way travel times between nodes to be transformed to distances b...
std::vector< std::vector< int > > dist_map
of size [n_nodes][n_nodes] maps(nodeX,nodeY) -> distance
double time_last_range
time of last ping reception (or transmission)
std::vector< std::vector< int > > times_age
vector of shape [n_nodes][n_nodes-1] holds the age of a time (slot number in which the time was calcu...
virtual void sendToken(int next_id) override
Passes the token to the next node.
std::vector< std::vector< double > > x_mat
of size [2D][D] it's the sparse matrix with the equations coefficients (-1,0,1)
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
virtual void Phy2MacEndRx(Packet *p) override
Method called when the Phy Layer finish to receive a Packet.
UwRangingTokenBus()
Default constructor of the TokenBus class.
double epsilon
difference between virtually equal distances can result in small negative numbers due to floating poi...
Class that represents a TokenBus Node.
packet_t PT_UWRANGING_TOKENBUS
Provides the definition of the class UwTokenBus.