|
DESERT 4.0.0
|
#include <uwranging_tokenbus.h>


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 () |
| compute the linear regression and updates the distances vector | |
| 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 |
Class that represents a TokenBus Node
| UwRangingTokenBus::UwRangingTokenBus | ( | ) |
Default constructor of the TokenBus class
References dist_map, dist_num, distances, epsilon, max_tt, UwTokenBus::n_nodes, UwTokenBus::NMOD(), times_age, times_mat, and x_mat.

|
virtual |
Destructor of the TokenBus class
|
protectedvirtual |
TCL command interpreter. It implements the following OTcl methods:
| argc | Number of arguments in argv. |
| argv | Array of strings which are the command parameters (Note that argv[0] is the name of the object). |
Reimplemented from UwTokenBus.
References UwTokenBus::command(), computeDist(), dist_map, distances, UwTokenBus::n_nodes, and UwTokenBus::NMOD().

|
protectedvirtual |
compute the linear regression and updates the distances vector
References dist_num, distances, epsilon, id_last_range, max_tt, UwTokenBus::n_nodes, UwTokenBus::NMOD(), LSSQ::nnLeastSquares(), UwTokenBus::normId(), LSSQ::OK, LSSQ::TIMEOUT, times_age, times_mat, and x_mat.
Referenced by command().

|
overrideprotectedvirtual |
Method called when the Phy Layer finish to receive a Packet
| p | pointer to a Packet object that rapresent the Packet in reception |
Reimplemented from UwTokenBus.
References UwTokenBus::bus_idle_timeout, UwTokenBus::bus_idle_timer, UwTokenBus::debug, UwTokenBus::got_token, id_last_range, UwTokenBus::IDLE, UwTokenBus::last_token_id_heard, UwTokenBus::last_token_id_owned, UwTokenBus::min_token_hold_time, UwTokenBus::n_nodes, UwTokenBus::NMOD(), UwTokenBus::node_id, UwTokenBus::normId(), PT_UWRANGING_TOKENBUS, PT_UWTOKENBUS, UwTokenBus::rtx_status, time_last_range, hdr_uwranging_tokenbus::times(), times_age, times_mat, hdr_uwranging_tokenbus::token_hold(), UwTokenBus::token_pass_timer, UwTokenBus::token_rx_time, hdr_tokenbus::tokenId(), UwTokenBus::TRANSMITTING, UwTokenBus::txData(), and validToken().

|
overrideprotectedvirtual |
Passes the token to the next node
| next_id | node receiving the token |
Reimplemented from UwTokenBus.
References hdr_tokenbus::getSize(), hdr_uwranging_tokenbus::getSize(), UwTokenBus::got_token, id_last_range, UwTokenBus::last_token_id_heard, UwTokenBus::Mac2PhyStartTx(), UwTokenBus::n_nodes, UwTokenBus::NMOD(), UwTokenBus::node_id, UwTokenBus::normId(), PT_UWRANGING_TOKENBUS, time_last_range, hdr_uwranging_tokenbus::times(), times_age, times_mat, hdr_uwranging_tokenbus::token_hold(), hdr_uwranging_tokenbus::token_resend(), UwTokenBus::token_rx_time, and hdr_tokenbus::tokenId().

|
overrideprotectedvirtual |
Assert if the received token id is valid, i.e it follows the monotonic progression taking in account overflow.
| p | Packet with token |
Reimplemented from UwTokenBus.
References UwTokenBus::last_token_id_owned, UwTokenBus::n_nodes, UwTokenBus::normId(), and UwTokenBus::validToken().
Referenced by Phy2MacEndRx().

|
protected |
of size [n_nodes][n_nodes] maps(nodeX,nodeY) -> distance
Referenced by command(), and UwRangingTokenBus().
|
protected |
num of distances: will be initialized to n_nodes*(n_nodes-1)/2
Referenced by computeDist(), and UwRangingTokenBus().
|
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
Referenced by command(), computeDist(), and UwRangingTokenBus().
|
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
Referenced by computeDist(), and UwRangingTokenBus().
|
protected |
node id from which I received the last ranging pkt
Referenced by computeDist(), Phy2MacEndRx(), and sendToken().
|
protected |
max travel time between nodes in seconds, used to discard bad nnleast_squares() results
Referenced by computeDist(), and UwRangingTokenBus().
|
protected |
time of last ping reception (or transmission)
Referenced by Phy2MacEndRx(), and sendToken().
|
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)
Referenced by computeDist(), Phy2MacEndRx(), sendToken(), and UwRangingTokenBus().
|
protected |
vector of shape [n_nodes][n_nodes-1] holds the travel times: the first index is the node_id which has calculated them
Referenced by computeDist(), Phy2MacEndRx(), sendToken(), and UwRangingTokenBus().
|
protected |
of size [2D][D] it's the sparse matrix with the equations coefficients (-1,0,1)
Referenced by computeDist(), and UwRangingTokenBus().