DESERT 4.0.0
UwAloha_Q_Sync_NODE Class Reference

#include <uw-aloha-q-sync-node.h>

Inheritance diagram for UwAloha_Q_Sync_NODE:
Inheritance graph
Collaboration diagram for UwAloha_Q_Sync_NODE:
Collaboration graph

Public Member Functions

 UwAloha_Q_Sync_NODE ()
 
virtual ~UwAloha_Q_Sync_NODE ()=default
 
virtual int recvSyncClMsg (ClMessage *m)
 

Protected Types

enum  UWALOHAQ_STATUS { IDLE , TRANSMITTING , RECEIVING }
 
enum  SLOT_STATUS { TRANSMIT , RECEIVE }
 

Protected Member Functions

virtual void stateRxAck (Packet *p, int addr)
 
virtual void findMySlot ()
 
virtual void updateQ_table (int ack_received)
 
virtual void handleTimerExpiration ()
 
virtual void txData ()
 
virtual void start (double delay)
 
virtual void stop ()
 
virtual void recvFromUpperLayers (Packet *p)
 
virtual void Phy2MacEndRx (Packet *p)
 
virtual void Phy2MacStartRx (Packet *p)
 
virtual void Mac2PhyStartTx (Packet *p)
 
virtual void Phy2MacEndTx (const Packet *p)
 
virtual void rxPacketNotForMe (Packet *p)
 
virtual void initPkt (Packet *p)
 
virtual int command (int argc, const char *const *argv)
 

Protected Attributes

UwAlohaQSyncTimer alohaq_sync_timer
 
std::vector< std::vector< double > > Q_table {}
 
double start_time
 
UWALOHAQ_STATUS transceiver_status
 
SLOT_STATUS slot_status
 
std::ofstream out_file_stats
 
int HDR_size
 
int packet_sent_curr_frame
 
int max_queue_size
 
int drop_old_
 
bool enable
 
int checkPriority
 
int debug_
 
int sea_trial_
 
std::deque< Packet * > buffer
 
int curr_slot
 
int curr_subslot
 
int my_curr_slot
 
int my_curr_subslot
 
double t_prop_max
 
double t_dp
 
double t_guard
 
std::vector< int > ack_data
 
double slot_duration_factor
 
int nn
 
int subslot_num
 

Friends

class UwAlohaQSyncTimer
 

Detailed Description

Class that represents a UwAlohaQSync Node

Member Enumeration Documentation

◆ SLOT_STATUS

Enumerator
TRANSMIT 
RECEIVE 

◆ UWALOHAQ_STATUS

Enumerator
IDLE 
TRANSMITTING 
RECEIVING 

Constructor & Destructor Documentation

◆ UwAloha_Q_Sync_NODE()

UwAloha_Q_Sync_NODE::UwAloha_Q_Sync_NODE ( )

◆ ~UwAloha_Q_Sync_NODE()

virtual UwAloha_Q_Sync_NODE::~UwAloha_Q_Sync_NODE ( )
virtualdefault

Destructor of the UwAloha_Q_Sync_NODE class

Member Function Documentation

◆ command()

int UwAloha_Q_Sync_NODE::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.

References start(), start_time, and stop().

Referenced by recvSyncClMsg().

Here is the call graph for this function:

◆ findMySlot()

void UwAloha_Q_Sync_NODE::findMySlot ( )
protectedvirtual

Search Q-table and find slot for transmission in the following frame

References my_curr_slot, my_curr_subslot, nn, Q_table, and subslot_num.

Referenced by handleTimerExpiration().

◆ handleTimerExpiration()

void UwAloha_Q_Sync_NODE::handleTimerExpiration ( )
protectedvirtual

◆ initPkt()

void UwAloha_Q_Sync_NODE::initPkt ( Packet *  p)
protectedvirtual

Method called to add the MAC header size

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in transmission

References HDR_size.

Referenced by recvFromUpperLayers().

◆ Mac2PhyStartTx()

void UwAloha_Q_Sync_NODE::Mac2PhyStartTx ( Packet *  p)
protectedvirtual

Method called when the Mac Layer start to transmit a Packet

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in transmission

References debug_, IDLE, transceiver_status, and TRANSMITTING.

Referenced by txData().

◆ Phy2MacEndRx()

void UwAloha_Q_Sync_NODE::Phy2MacEndRx ( Packet *  p)
protectedvirtual

Method called when the Phy Layer finish to receive a Packet

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in reception

References ack_data, debug_, IDLE, PT_ALOHAQ_SYNC_ACK, rxPacketNotForMe(), stateRxAck(), transceiver_status, and TRANSMITTING.

Here is the call graph for this function:

◆ Phy2MacEndTx()

void UwAloha_Q_Sync_NODE::Phy2MacEndTx ( const Packet *  p)
protectedvirtual

Method called when the Mac Layer finish to transmit a Packet

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in transmission

References IDLE, and transceiver_status.

◆ Phy2MacStartRx()

void UwAloha_Q_Sync_NODE::Phy2MacStartRx ( Packet *  p)
protectedvirtual

Method called when the Phy Layer start to receive a Packet

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in reception

References debug_, IDLE, RECEIVING, slot_status, transceiver_status, and TRANSMIT.

◆ recvFromUpperLayers()

void UwAloha_Q_Sync_NODE::recvFromUpperLayers ( Packet *  p)
protectedvirtual

Receive the packet from the upper layer (e.g. IP)

Parameters
Packet*pointer to the packet received

References buffer, initPkt(), and max_queue_size.

Here is the call graph for this function:

◆ recvSyncClMsg()

int UwAloha_Q_Sync_NODE::recvSyncClMsg ( ClMessage *  m)
virtual

Cross-Layer messages synchronous interpreter.

Parameters
ClMessage*an instance of ClMessage that represent the message received
Returns
0 if successful.

References CLMSG_UWMMAC_ENABLE, command(), ClMsgUwMmac::SET_REPLY, ClMsgUwMmac::SET_REQ, start(), start_time, and stop().

Here is the call graph for this function:

◆ rxPacketNotForMe()

void UwAloha_Q_Sync_NODE::rxPacketNotForMe ( Packet *  p)
protectedvirtual

Method called when the Packet received is determined to be not for me

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in reception

References debug_.

Referenced by Phy2MacEndRx().

◆ start()

void UwAloha_Q_Sync_NODE::start ( double  delay)
protectedvirtual

Schedule the beginning of each TDMA cycle, each one after delay

Parameters
delayto await before starting the protocol

References alohaq_sync_timer, enable, nn, Q_table, and subslot_num.

Referenced by command(), and recvSyncClMsg().

◆ stateRxAck()

void UwAloha_Q_Sync_NODE::stateRxAck ( Packet *  p,
int  addr 
)
protectedvirtual

Confirm ACK is received in desired time slot

Parameters
Packet*pointer to the ACK packet received
addrMAC adress of the receiving node

References ack_data, debug_, IDLE, out_file_stats, transceiver_status, and updateQ_table().

Referenced by Phy2MacEndRx().

Here is the call graph for this function:

◆ stop()

void UwAloha_Q_Sync_NODE::stop ( )
protectedvirtual

Cancel the timer

References alohaq_sync_timer, and enable.

Referenced by command(), and recvSyncClMsg().

◆ txData()

void UwAloha_Q_Sync_NODE::txData ( )
protectedvirtual

Transmit a data packet if in my slot

References buffer, debug_, IDLE, Mac2PhyStartTx(), packet_sent_curr_frame, and transceiver_status.

Referenced by handleTimerExpiration().

Here is the call graph for this function:

◆ updateQ_table()

void UwAloha_Q_Sync_NODE::updateQ_table ( int  ack_received)
protectedvirtual

Update Q-table based on reward value

Parameters
ack_receivedreward value - 1 if ACK received, 0 if not

References debug_, my_curr_slot, my_curr_subslot, nn, Q_table, and subslot_num.

Referenced by stateRxAck().

Friends And Related Symbol Documentation

◆ UwAlohaQSyncTimer

friend class UwAlohaQSyncTimer
friend

Member Data Documentation

◆ ack_data

std::vector<int> UwAloha_Q_Sync_NODE::ack_data
protected

Sink's list to store successful transmittors

Referenced by Phy2MacEndRx(), and stateRxAck().

◆ alohaq_sync_timer

UwAlohaQSyncTimer UwAloha_Q_Sync_NODE::alohaq_sync_timer
protected

UwAlohaQSync timer handler

Referenced by handleTimerExpiration(), start(), and stop().

◆ buffer

std::deque<Packet *> UwAloha_Q_Sync_NODE::buffer
protected

Buffer of the MAC node

Referenced by recvFromUpperLayers(), and txData().

◆ checkPriority

int UwAloha_Q_Sync_NODE::checkPriority
protected

flag to set to 1 if UWCBR module uses packets with priority, set to 0 otherwise. Priority can be used only with UWCBR module

Referenced by UwAloha_Q_Sync_NODE().

◆ curr_slot

int UwAloha_Q_Sync_NODE::curr_slot
protected

Current slot

Referenced by handleTimerExpiration().

◆ curr_subslot

int UwAloha_Q_Sync_NODE::curr_subslot
protected

Current subslot

Referenced by handleTimerExpiration().

◆ debug_

int UwAloha_Q_Sync_NODE::debug_
protected

◆ drop_old_

int UwAloha_Q_Sync_NODE::drop_old_
protected

flag to set the drop packet policy in case of buffer overflow: if 0 (default) drops the new packet, if 1 the oldest

Referenced by UwAloha_Q_Sync_NODE().

◆ enable

bool UwAloha_Q_Sync_NODE::enable
protected

Referenced by start(), and stop().

◆ HDR_size

int UwAloha_Q_Sync_NODE::HDR_size
protected

Size of the HDR if any

Referenced by initPkt(), and UwAloha_Q_Sync_NODE().

◆ max_queue_size

int UwAloha_Q_Sync_NODE::max_queue_size
protected

Maximum dimension of Queue

Referenced by recvFromUpperLayers(), and UwAloha_Q_Sync_NODE().

◆ my_curr_slot

int UwAloha_Q_Sync_NODE::my_curr_slot
protected

Node's slot chosen for transmission

Referenced by findMySlot(), handleTimerExpiration(), and updateQ_table().

◆ my_curr_subslot

int UwAloha_Q_Sync_NODE::my_curr_subslot
protected

Node's subslot chosen for transmission

Referenced by findMySlot(), handleTimerExpiration(), and updateQ_table().

◆ nn

int UwAloha_Q_Sync_NODE::nn
protected

◆ out_file_stats

std::ofstream UwAloha_Q_Sync_NODE::out_file_stats
protected

File stream for the statistics log file

Referenced by stateRxAck().

◆ packet_sent_curr_frame

int UwAloha_Q_Sync_NODE::packet_sent_curr_frame
protected

counter of packet has been sent in the current frame

Referenced by handleTimerExpiration(), and txData().

◆ Q_table

std::vector<std::vector<double> > UwAloha_Q_Sync_NODE::Q_table {}
protected

2D Q-table

Referenced by findMySlot(), start(), and updateQ_table().

◆ sea_trial_

int UwAloha_Q_Sync_NODE::sea_trial_
protected

Written log variable

Referenced by UwAloha_Q_Sync_NODE().

◆ slot_duration_factor

double UwAloha_Q_Sync_NODE::slot_duration_factor
protected

slot_duration = packet_duration * slot_duration_factor

Referenced by handleTimerExpiration(), and UwAloha_Q_Sync_NODE().

◆ slot_status

SLOT_STATUS UwAloha_Q_Sync_NODE::slot_status
protected

Variable that holds SLOT_STATUS

Referenced by handleTimerExpiration(), and Phy2MacStartRx().

◆ start_time

double UwAloha_Q_Sync_NODE::start_time
protected

Time to wait before starting the protocol

Referenced by command(), and recvSyncClMsg().

◆ subslot_num

int UwAloha_Q_Sync_NODE::subslot_num
protected

◆ t_dp

double UwAloha_Q_Sync_NODE::t_dp
protected

Transmission delay

Referenced by handleTimerExpiration(), and UwAloha_Q_Sync_NODE().

◆ t_guard

double UwAloha_Q_Sync_NODE::t_guard
protected

Guard interval

Referenced by handleTimerExpiration().

◆ t_prop_max

double UwAloha_Q_Sync_NODE::t_prop_max
protected

Maximal propagation delay

Referenced by handleTimerExpiration(), and UwAloha_Q_Sync_NODE().

◆ transceiver_status

UWALOHAQ_STATUS UwAloha_Q_Sync_NODE::transceiver_status
protected

Variable that holds UWALOHAQ_STATUS

Referenced by handleTimerExpiration(), Mac2PhyStartTx(), Phy2MacEndRx(), Phy2MacEndTx(), Phy2MacStartRx(), stateRxAck(), and txData().


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