39#ifndef UWRANGINGTDOA_H
40#define UWRANGINGTDOA_H
62 virtual void expire(Event *e);
90 virtual void recv(Packet *)
override;
98 virtual void recv(Packet *p, Handler *h)
override;
113 virtual int command(
int argc,
const char *
const *argv)
override;
118 virtual void start();
131 virtual bool isValid(
double value)
const;
148 virtual void rangeRX(
const Packet * p);
160 virtual int calcOptEntries(std::vector<int> *sorted_entries =
nullptr)
const;
167 virtual double entryWeight(
int entry,
int pkt_size,
int mode)
const;
206 const size_t PKTIDMAX = std::numeric_limits<uwrange_pkt_t>::max();
UwRangeTimer class is used to schedule the transmission of ranging packets.
virtual void expire(Event *e)
UwRangeTimer(UwRangingTDOA *m)
Class that represents a UwRangingTDOA Node.
double delay_start
Starting delay in seconds.
int dist_num
Number of distances each node computes.
virtual void updateHoldoverTime(Packet *p, double tx_duration)
Update the holdover time with the actual time of transmission.
double full_pkt_tx_dur
TX duration for a full range packet.
virtual void recv(Packet *) override
Performs the reception of packets from upper and lower layers.
virtual int calcOptEntries(std::vector< int > *sorted_entries=nullptr) const
Compute the optimal number of entries for the ranging message.
std::vector< double > entries_timestamps
int phy_id
Id of the PHY module.
virtual void rangeRX(const Packet *p)
int range_pkts_recv
Counter of received ranging packets.
double max_tt
Floating numbers within this value won't be discarded by NNLS.
virtual void stop()
Stop to send packets.
virtual int recvSyncClMsg(ClMessage *m) override
Retrieve packets from other modules.
int range_entries
Number of entries per ranging packet, if <= 0 enable adaptive payload size.
int n_nodes
Number of nodes.
virtual void rangeTX()
Send a ranging message down to the MAC layer.
UwRangingTDOA()
Constructor of the UwRangingTDOA class.
UwRangeTimer send_timer
Timer that schedules ranging packet transmissions.
int range_pkts_sent
Counter of sent ranging packets.
int packet_id
id of the last ranging packet sent (= node_id + k*n_nodes)
const size_t PKTIDMAX
Max number of ranging packets that can be saved.
std::vector< double > entry_last_tx
Vector of the last (actual) TX times of each entry.
std::vector< std::vector< int > > tof_map
std::vector< double > time_of_flights
bool scheduler_active
True if the ranging scheduler is been activated with Tcl "start" command.
int saved_entries
Total number of entries not sent in the ranging packets.
int range_bytes_sent
Counter of sent ranging bytes.
virtual ~UwRangingTDOA()=default
Destructor of the UwRangingTDOA class.
double max_age
Max age of a ranging packet in seconds.
virtual int command(int argc, const char *const *argv) override
TCL command interpreter.
std::vector< int > last_ids
int range_pkts_err
Counter of lost ranging packets.
double range_period
Ranging period in seconds.
std::vector< std::vector< double > > times_mat
virtual double entryWeight(int entry, int pkt_size, int mode) const
Compute the weight of the entry given the packet size in bits.
virtual bool isValid(double value) const
Check if value is not negative.
int poisson_traffic
If true the ranging packets are sent according to a poisson process with rate range_period.
std::vector< std::vector< std::vector< tdoa_entry > > > entries_mat
virtual void start()
Start to send packets.
int node_id
Id of the current node.
std::vector< uwrange_time_t > tx_timestamp
Vector of the TX timestamp for each packet to be sent.
double soundspeed
Speed of sound in m/s.
virtual void throttleTX()
Schedule the transmission of a rangig message.
int queue_size
Counts the packet sent to the MAC waiting to be transmitted.
std::vector< double > ber
Define the struct of a single tdoa payload entry.
Common structures and variables in the protocol.