DESERT 4.0.0
UWOFDMAloha Class Reference

#include <uw-ofdm-aloha.h>

Inheritance diagram for UWOFDMAloha:
Inheritance graph
Collaboration diagram for UWOFDMAloha:
Collaboration graph

Classes

class  AckTimer
 
class  BackOffTimer
 
class  UWOFDMAlohaTimer
 

Public Member Functions

 UWOFDMAloha ()
 
virtual ~UWOFDMAloha ()
 
virtual int command (int argc, const char *const *argv)
 
void init_macofdm_node (int subCarNum, double subCarSize, int ctrl_subCar, string modulation)
 

Protected Types

enum  UWOFDMALOHA_STATUS {
  UWOFDMALOHA_STATE_IDLE = 1 , UWOFDMALOHA_STATE_BACKOFF , UWOFDMALOHA_STATE_TX_DATA , UWOFDMALOHA_STATE_TX_ACK ,
  UWOFDMALOHA_STATE_WAIT_ACK , UWOFDMALOHA_STATE_DATA_RX , UWOFDMALOHA_STATE_ACK_RX , UWOFDMALOHA_STATE_NOT_SET ,
  UWOFDMALOHA_STATE_CHK_ACK_TIMEOUT , UWOFDMALOHA_STATE_RX_IDLE , UWOFDMALOHA_STATE_RX_WAIT_ACK , UWOFDMALOHA_STATE_CHK_BACKOFF_TIMEOUT ,
  UWOFDMALOHA_STATE_RX_BACKOFF , UWOFDMALOHA_STATE_WRONG_PKT_RX , UWOFDMALOHA_STATE_RX_IN_PROGRESS , UWOFDMALOHA_STATE_MULTIPLE_RX_IN_PROGRESS
}
 
enum  UWOFDMALOHA_REASON_STATUS {
  UWOFDMALOHA_REASON_DATA_PENDING , UWOFDMALOHA_REASON_DATA_RX , UWOFDMALOHA_REASON_DATA_TX , UWOFDMALOHA_REASON_ACK_TX ,
  UWOFDMALOHA_REASON_ACK_RX , UWOFDMALOHA_REASON_ACK_TIMEOUT , UWOFDMALOHA_REASON_DATA_EMPTY , UWOFDMALOHA_REASON_NOT_SET ,
  UWOFDMALOHA_REASON_MAX_TX_TRIES , UWOFDMALOHA_REASON_START_RX , UWOFDMALOHA_REASON_PKT_NOT_FOR_ME , UWOFDMALOHA_REASON_WAIT_ACK_PENDING ,
  UWOFDMALOHA_REASON_PKT_ERROR , UWOFDMALOHA_REASON_BACKOFF_TIMEOUT , UWOFDMALOHA_REASON_BACKOFF_PENDING , UWOFDMALOHA_REASON_PKT_RECEIVING
}
 
enum  UWOFDMALOHA_PKT_TYPE { UWOFDMALOHA_ACK_PKT = 1 , UWOFDMALOHA_DATA_PKT , UWOFDMALOHA_DATAMAX_PKT }
 
enum  UWOFDMALOHA_ACK_MODES { UWOFDMALOHA_ACK_MODE = 1 , UWOFDMALOHA_NO_ACK_MODE }
 
enum  UWOFDMALOHA_TIMER_STATUS { UWOFDMALOHA_IDLE = 1 , UWOFDMALOHA_RUNNING , UWOFDMALOHA_FROZEN , UWOFDMALOHA_EXPIRED }
 

Protected Member Functions

virtual void recvFromUpperLayers (Packet *p)
 
virtual void Mac2PhyStartTx (Packet *p)
 
virtual void Phy2MacEndTx (const Packet *p)
 
virtual void Phy2MacStartRx (const Packet *p)
 
virtual void Phy2MacEndRx (Packet *p)
 
virtual double computeTxTime (UWOFDMALOHA_PKT_TYPE type)
 
virtual void initPkt (Packet *p, UWOFDMALOHA_PKT_TYPE pkt_type, int dest_addr=0)
 
virtual double getBackoffTime ()
 
virtual void txData ()
 
virtual void txAck (int dest_addr)
 
virtual void stateIdle ()
 
virtual void stateRxIdle ()
 
virtual void stateTxData ()
 
virtual void stateTxAck (int dest_addr)
 
virtual void stateWaitAck ()
 
virtual void stateRxWaitAck ()
 
virtual void stateBackoff ()
 
virtual void stateRxBackoff ()
 
virtual void stateCheckAckExpired ()
 
virtual void stateCheckBackoffExpired ()
 
virtual void stateRxData (Packet *p)
 
virtual void stateRxAck (Packet *p)
 
virtual void exitBackoff ()
 
virtual void printStateInfo (double delay=0)
 
virtual void initInfo ()
 
virtual void refreshState (UWOFDMALOHA_STATUS state)
 
virtual void refreshReason (UWOFDMALOHA_REASON_STATUS reason)
 
virtual void incrCurrTxRounds ()
 
virtual void resetCurrTxRounds ()
 
virtual void updateRTT (double rtt)
 
virtual double getRTT ()
 
virtual void updateAckTimeout (double rtt)
 
virtual void updateLastDataIdRx (int id)
 
int getPktSeqNum (Packet *p)
 
void putPktInQueue (Packet *p)
 
void eraseItemFromPktQueue (int seq_num)
 
void putAckTimerInMap (int seq_num)
 
void eraseItemFrommapAckTimer (int seq_num)
 
virtual int getRemainingPkts ()
 
virtual void incrUpperDataRx ()
 
int getUpLayersDataPktsRx ()
 
void displayCarriers (Packet *p)
 
void addInvalidCarriers (int c)
 

Protected Attributes

int max_tx_tries
 
double wait_constant
 
double backoff_tuner
 
int max_payload
 
int HDR_size
 
int ACK_size
 
double ACK_timeout
 
int buffer_pkts
 
double alpha_
 
double max_backoff_counter
 
int uwofdmaloha_debug
 
std::vector< string > mac_carMod
 
std::vector< int > mac_carVec
 
int mac_ncarriers
 
double mac_carrierSize
 
int ctrl_car
 
bool AckInBand = true
 
bool alohaOnCarrier = false
 
int waitforpktnum = 0
 
int n_receptions
 
std::vector< Packet * > pkt_rcv_queue
 
std::vector< int > nouse_carriers
 
bool disturbanceNode
 
int last_sent_data_id
 
bool print_transitions
 
bool has_buffer_queue
 
double start_tx_time
 
double srtt
 
double sumrtt
 
double sumrtt2
 
int rttsamples
 
int curr_tx_rounds
 
int last_data_id_rx
 
int recv_data_id
 
Packet * curr_data_pkt
 
int txsn
 
AckTimer ack_timer
 
BackOffTimer backoff_timer
 
UWOFDMALOHA_REASON_STATUS last_reason
 
UWOFDMALOHA_STATUS curr_state
 
UWOFDMALOHA_STATUS prev_state
 
UWOFDMALOHA_STATUS prev_prev_state
 
UWOFDMALOHA_ACK_MODES ack_mode
 
map< pktSeqNum, Packet * > mapPacket
 
map< pktSeqNum, AckTimermapAckTimer
 
ofstream fout
 

Static Protected Attributes

static bool initialized = false
 
static const double prop_speed = 1500.0
 
static map< UWOFDMALOHA_STATUS, string > status_info
 
static map< UWOFDMALOHA_REASON_STATUS, string > reason_info
 
static map< UWOFDMALOHA_PKT_TYPE, string > pkt_type_info
 

Member Enumeration Documentation

◆ UWOFDMALOHA_ACK_MODES

Enumeration class of UWOFDMAloha acknowledgement mode. First enumerator is given value 1. This protocol supports both acknowledgement and non-acknowledgement technique. If Acknowledgement is set, it uses Stop-And-Wait ARQ technique.

Enumerator
UWOFDMALOHA_ACK_MODE 
UWOFDMALOHA_NO_ACK_MODE 

◆ UWOFDMALOHA_PKT_TYPE

Enumeration class of UWOFDMAloha packet type. First enumerator is given value

  1. Three kinds of packets are supported by UWOFDMAloha protocol.
Enumerator
UWOFDMALOHA_ACK_PKT 
UWOFDMALOHA_DATA_PKT 
UWOFDMALOHA_DATAMAX_PKT 

◆ UWOFDMALOHA_REASON_STATUS

Enumeration class which tells the nodes the reason why it is in this state. First enumerator is given value 1.

Enumerator
UWOFDMALOHA_REASON_DATA_PENDING 
UWOFDMALOHA_REASON_DATA_RX 
UWOFDMALOHA_REASON_DATA_TX 
UWOFDMALOHA_REASON_ACK_TX 
UWOFDMALOHA_REASON_ACK_RX 
UWOFDMALOHA_REASON_ACK_TIMEOUT 
UWOFDMALOHA_REASON_DATA_EMPTY 
UWOFDMALOHA_REASON_NOT_SET 
UWOFDMALOHA_REASON_MAX_TX_TRIES 
UWOFDMALOHA_REASON_START_RX 
UWOFDMALOHA_REASON_PKT_NOT_FOR_ME 
UWOFDMALOHA_REASON_WAIT_ACK_PENDING 
UWOFDMALOHA_REASON_PKT_ERROR 
UWOFDMALOHA_REASON_BACKOFF_TIMEOUT 
UWOFDMALOHA_REASON_BACKOFF_PENDING 
UWOFDMALOHA_REASON_PKT_RECEIVING 

◆ UWOFDMALOHA_STATUS

Enumeration class of UWOFDMAloha status. First enumerator is given value 1.

Enumerator
UWOFDMALOHA_STATE_IDLE 
UWOFDMALOHA_STATE_BACKOFF 
UWOFDMALOHA_STATE_TX_DATA 
UWOFDMALOHA_STATE_TX_ACK 
UWOFDMALOHA_STATE_WAIT_ACK 
UWOFDMALOHA_STATE_DATA_RX 
UWOFDMALOHA_STATE_ACK_RX 
UWOFDMALOHA_STATE_NOT_SET 
UWOFDMALOHA_STATE_CHK_ACK_TIMEOUT 
UWOFDMALOHA_STATE_RX_IDLE 
UWOFDMALOHA_STATE_RX_WAIT_ACK 
UWOFDMALOHA_STATE_CHK_BACKOFF_TIMEOUT 
UWOFDMALOHA_STATE_RX_BACKOFF 
UWOFDMALOHA_STATE_WRONG_PKT_RX 
UWOFDMALOHA_STATE_RX_IN_PROGRESS 
UWOFDMALOHA_STATE_MULTIPLE_RX_IN_PROGRESS 

◆ UWOFDMALOHA_TIMER_STATUS

Enumeration class of UWOFDMAloha timer status. First enumerator is given value

  1. It is employed to know the current status of a timer.
Enumerator
UWOFDMALOHA_IDLE 
UWOFDMALOHA_RUNNING 
UWOFDMALOHA_FROZEN 
UWOFDMALOHA_EXPIRED 

Constructor & Destructor Documentation

◆ UWOFDMAloha()

◆ ~UWOFDMAloha()

UWOFDMAloha::~UWOFDMAloha ( )
virtual

Destructor of UWOFDMAloha Class

Member Function Documentation

◆ addInvalidCarriers()

void UWOFDMAloha::addInvalidCarriers ( int  c)
inlineprotected

Adds carriers that should not be used

References nouse_carriers.

Referenced by command().

◆ command()

int UWOFDMAloha::command ( int  argc,
const char *const *  argv 
)
virtual

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 succesfully or not

References ack_mode, addInvalidCarriers(), disturbanceNode, fout, getUpLayersDataPktsRx(), init_macofdm_node(), initialized, initInfo(), mapPacket, print_transitions, UWOFDMALOHA_ACK_MODE, and UWOFDMALOHA_NO_ACK_MODE.

Here is the call graph for this function:

◆ computeTxTime()

double UWOFDMAloha::computeTxTime ( UWOFDMALOHA_PKT_TYPE  type)
protectedvirtual

Compute the transmission time of a packet. It uses a cross-layer message to calculate the duration of that packet.

Parameters
typeis a UWOFDMALOHA_PKT_TYPE
Returns
tranmission time of a packet which is a double data type.

References ACK_size, HDR_size, mapPacket, max_payload, UWOFDMALOHA_ACK_PKT, and UWOFDMALOHA_DATA_PKT.

◆ displayCarriers()

void UWOFDMAloha::displayCarriers ( Packet *  p)
inlineprotected

Prints the carriers as a sequence of 0s and 1s

References hdr_OFDM::carriers, and mac_ncarriers.

Referenced by initPkt(), and stateBackoff().

◆ eraseItemFrommapAckTimer()

void UWOFDMAloha::eraseItemFrommapAckTimer ( int  seq_num)
inlineprotected

Erase an item from acknowledgement stored container.

Parameters
seq_numwhich is an integer data type.

References mapAckTimer.

Referenced by stateRxAck().

◆ eraseItemFromPktQueue()

void UWOFDMAloha::eraseItemFromPktQueue ( int  seq_num)
inlineprotected

It erases the packet from the container.

Parameters
seq_numwhich is an integer data type.

References mapPacket, and uwofdmaloha_debug.

Referenced by stateRxAck(), stateTxData(), and txData().

◆ exitBackoff()

void UWOFDMAloha::exitBackoff ( )
protectedvirtual

It stops the backoff timer.

References backoff_timer, and UWOFDMAloha::UWOFDMAlohaTimer::stop().

Referenced by stateCheckBackoffExpired().

Here is the call graph for this function:

◆ getBackoffTime()

double UWOFDMAloha::getBackoffTime ( )
protectedvirtual

This function calculates the backoff duration and return the backoff time.It employs the exponential backoff algorithm.

Returns
backoff duration which is a double data type.

References ACK_timeout, backoff_timer, backoff_tuner, UWOFDMAloha::UWOFDMAlohaTimer::getCounter(), UWOFDMAloha::UWOFDMAlohaTimer::incrCounter(), max_backoff_counter, and uwofdmaloha_debug.

Referenced by stateBackoff().

Here is the call graph for this function:

◆ getPktSeqNum()

int UWOFDMAloha::getPktSeqNum ( Packet *  p)
inlineprotected

This method is used to get the sequence number from a packet.

Parameters
packetpointer
Returns
it returns sequence number which is an integer data type.

Referenced by initPkt(), Mac2PhyStartTx(), Phy2MacEndRx(), Phy2MacStartRx(), putPktInQueue(), stateRxAck(), stateRxData(), stateTxData(), and txData().

◆ getRemainingPkts()

virtual int UWOFDMAloha::getRemainingPkts ( )
inlineprotectedvirtual

Number of packets which MAC layer receives form upper layer(s) but were not transmitted.

Returns
an integer value.

References mapPacket.

◆ getRTT()

virtual double UWOFDMAloha::getRTT ( )
inlineprotectedvirtual

This method is used to get the average RTT over all the receives RTT.

Returns
average RTT time which is a double data type.

References rttsamples, and sumrtt.

◆ getUpLayersDataPktsRx()

int UWOFDMAloha::getUpLayersDataPktsRx ( )
inlineprotected

Referenced by command().

◆ incrCurrTxRounds()

virtual void UWOFDMAloha::incrCurrTxRounds ( )
inlineprotectedvirtual

Increments the current transmission round of a packet. It keeps track of the number of retransmition of a packet.

References curr_tx_rounds.

Referenced by stateTxData(), and txData().

◆ incrUpperDataRx()

virtual void UWOFDMAloha::incrUpperDataRx ( )
inlineprotectedvirtual

Increment the number of Data packet receive for the upper layer.

Referenced by recvFromUpperLayers().

◆ init_macofdm_node()

void UWOFDMAloha::init_macofdm_node ( int  subCarNum,
double  subCarSize,
int  ctrl_subCar,
string  modulation 
)

Initialize subCarriers parameters inside a node, default all carriers are used

Parameters
subCarNumnumber of subcarriers used in the system
carSizesize of carriers
ctrl_subCarnumber of control subcarriers if used
modulationmodulation used in the subcarriers

References ctrl_car, mac_carMod, mac_carrierSize, mac_carVec, mac_ncarriers, and nouse_carriers.

Referenced by command().

◆ initInfo()

◆ initPkt()

void UWOFDMAloha::initPkt ( Packet *  p,
UWOFDMALOHA_PKT_TYPE  pkt_type,
int  dest_addr = 0 
)
protectedvirtual

This method, initialize the packet. If the packet is received from the upper layer, it adds the header (if any). In case of UWOFDMAloha with ARQ technique, it set the fields of ACK packet.

Parameters
Packetpointer P. The packet can be Data packet or ACK packet.
pkt_typeis an UWOFDMALOHA_PKT_TYPE. Packet can be either Data packet or ACK packet.
dest_addris a integer data type. It is initialized as 0.

References ACK_size, hdr_OFDM::carMod, hdr_OFDM::carrierNum, hdr_OFDM::carriers, hdr_OFDM::carrierSize, displayCarriers(), disturbanceNode, getPktSeqNum(), HDR_size, mac_carMod, mac_carrierSize, mac_carVec, mac_ncarriers, hdr_OFDM::nativeOFDM, PT_MMAC_ACK, recv_data_id, UWOFDMALOHA_ACK_PKT, UWOFDMALOHA_DATA_PKT, and uwofdmaloha_debug.

Referenced by recvFromUpperLayers(), and txAck().

Here is the call graph for this function:

◆ Mac2PhyStartTx()

void UWOFDMAloha::Mac2PhyStartTx ( Packet *  p)
protectedvirtual

It informs that a packet transmission started.

Parameters
Packetpointer

References getPktSeqNum(), and uwofdmaloha_debug.

Referenced by txAck(), and txData().

Here is the call graph for this function:

◆ Phy2MacEndRx()

void UWOFDMAloha::Phy2MacEndRx ( Packet *  p)
protectedvirtual

◆ Phy2MacEndTx()

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

◆ Phy2MacStartRx()

void UWOFDMAloha::Phy2MacStartRx ( const Packet *  p)
protectedvirtual

PHY layer informs the MAC layer that it is receiving a packet. @Param Packet pointer (constant)

References getPktSeqNum(), n_receptions, and uwofdmaloha_debug.

Here is the call graph for this function:

◆ printStateInfo()

void UWOFDMAloha::printStateInfo ( double  delay = 0)
protectedvirtual

◆ putAckTimerInMap()

void UWOFDMAloha::putAckTimerInMap ( int  seq_num)
inlineprotected

Put acknowledgement timer in the container.

Parameters
seq_numwhich is an integer data type.

References ack_timer, and mapAckTimer.

Referenced by stateTxData().

◆ putPktInQueue()

void UWOFDMAloha::putPktInQueue ( Packet *  p)
inlineprotected

A node receives packet(s) from upper layer and store them in the container.

Parameters
packetpointer

References getPktSeqNum(), mapPacket, and uwofdmaloha_debug.

Referenced by recvFromUpperLayers().

Here is the call graph for this function:

◆ recvFromUpperLayers()

void UWOFDMAloha::recvFromUpperLayers ( Packet *  p)
protectedvirtual

This function receives the packet from upper layer and save it in the queue.

Parameters
Packetpointer

References buffer_pkts, curr_state, has_buffer_queue, incrUpperDataRx(), initPkt(), mapPacket, n_receptions, pkt_rcv_queue, prev_prev_state, prev_state, putPktInQueue(), refreshReason(), stateTxData(), status_info, UWOFDMALOHA_DATA_PKT, uwofdmaloha_debug, UWOFDMALOHA_REASON_DATA_PENDING, and UWOFDMALOHA_STATE_IDLE.

Here is the call graph for this function:

◆ refreshReason()

virtual void UWOFDMAloha::refreshReason ( UWOFDMALOHA_REASON_STATUS  reason)
inlineprotectedvirtual

To know the reason why a node is in this current state.

Parameters
reasonis an UWOFDMALOHA_REASON_STATUS type.

References last_reason.

Referenced by Phy2MacEndRx(), Phy2MacEndTx(), recvFromUpperLayers(), stateCheckAckExpired(), stateCheckBackoffExpired(), stateRxAck(), stateRxData(), and stateTxData().

◆ refreshState()

virtual void UWOFDMAloha::refreshState ( UWOFDMALOHA_STATUS  state)
inlineprotectedvirtual

Refreshes the states of the node. The node save the information of three states, they are: previous to previous state, previous state and current state of the node.

Parameters
statewhich is an UWOFDMALOHA_STATUS type.

References curr_state, prev_prev_state, and prev_state.

Referenced by stateBackoff(), stateCheckAckExpired(), stateCheckBackoffExpired(), stateIdle(), stateRxAck(), stateRxBackoff(), stateRxData(), stateRxIdle(), stateRxWaitAck(), stateTxAck(), stateTxData(), and stateWaitAck().

◆ resetCurrTxRounds()

virtual void UWOFDMAloha::resetCurrTxRounds ( )
inlineprotectedvirtual

If a node is going to transmit a new packet, it resets the tx counter.

References curr_tx_rounds.

Referenced by stateTxData().

◆ stateBackoff()

◆ stateCheckAckExpired()

void UWOFDMAloha::stateCheckAckExpired ( )
protectedvirtual

It checks whether the ack timer is already expired while it was busy with other activities.

References curr_state, mapAckTimer, print_transitions, printStateInfo(), refreshReason(), refreshState(), stateBackoff(), stateIdle(), status_info, uwofdmaloha_debug, UWOFDMALOHA_REASON_ACK_TIMEOUT, UWOFDMALOHA_REASON_WAIT_ACK_PENDING, UWOFDMALOHA_STATE_CHK_ACK_TIMEOUT, and UWOFDMALOHA_STATE_WAIT_ACK.

Referenced by stateTxData().

Here is the call graph for this function:

◆ stateCheckBackoffExpired()

void UWOFDMAloha::stateCheckBackoffExpired ( )
protectedvirtual

◆ stateIdle()

void UWOFDMAloha::stateIdle ( )
protectedvirtual

Node is in Idle state. It only changes its state if it has packet(s) to transmit or it receives a packet.

References backoff_timer, mapAckTimer, mapPacket, n_receptions, pkt_rcv_queue, print_transitions, printStateInfo(), refreshState(), stateTxData(), UWOFDMAloha::UWOFDMAlohaTimer::stop(), uwofdmaloha_debug, and UWOFDMALOHA_STATE_IDLE.

Referenced by Phy2MacEndTx(), stateCheckAckExpired(), stateCheckBackoffExpired(), stateRxAck(), stateRxData(), and stateTxData().

Here is the call graph for this function:

◆ stateRxAck()

void UWOFDMAloha::stateRxAck ( Packet *  p)
protectedvirtual

The node comes to this state if it receives an ACK packet. After receiving an ACK packet it changes it states according to the previously stored status information.

References eraseItemFrommapAckTimer(), eraseItemFromPktQueue(), getPktSeqNum(), mapAckTimer, refreshReason(), refreshState(), start_tx_time, stateIdle(), updateAckTimeout(), uwofdmaloha_debug, UWOFDMALOHA_REASON_ACK_RX, and UWOFDMALOHA_STATE_ACK_RX.

Referenced by Phy2MacEndRx().

Here is the call graph for this function:

◆ stateRxBackoff()

void UWOFDMAloha::stateRxBackoff ( )
protectedvirtual

If a node start receiving a packet when it is in backoff state. The node first freeze (or another word, hold) the backoff timer and start receiving the packet.

References backoff_timer, UWOFDMAloha::UWOFDMAlohaTimer::freeze(), print_transitions, printStateInfo(), refreshState(), and UWOFDMALOHA_STATE_RX_BACKOFF.

Here is the call graph for this function:

◆ stateRxData()

void UWOFDMAloha::stateRxData ( Packet *  p)
protectedvirtual

It process the packet which is received. After receiving a packet it changes it states according to the previously stored status information.

Parameters
<i>Data</i>packet pointer

References ack_mode, ack_timer, getPktSeqNum(), HDR_size, recv_data_id, refreshReason(), refreshState(), stateIdle(), stateTxAck(), UWOFDMAloha::UWOFDMAlohaTimer::stop(), UWOFDMALOHA_ACK_MODE, uwofdmaloha_debug, UWOFDMALOHA_REASON_DATA_RX, and UWOFDMALOHA_STATE_DATA_RX.

Referenced by Phy2MacEndRx().

Here is the call graph for this function:

◆ stateRxIdle()

void UWOFDMAloha::stateRxIdle ( )
protectedvirtual

If a node start receiving a packet in Idle state.

References print_transitions, printStateInfo(), refreshState(), and UWOFDMALOHA_STATE_RX_IDLE.

Here is the call graph for this function:

◆ stateRxWaitAck()

void UWOFDMAloha::stateRxWaitAck ( )
protectedvirtual

If a node receives any packet while it was waiting for ACK packet, it moves to this state. The packet it is receiving can be a Data packet from another node or ACK packet.

References print_transitions, printStateInfo(), refreshState(), and UWOFDMALOHA_STATE_RX_WAIT_ACK.

Here is the call graph for this function:

◆ stateTxAck()

void UWOFDMAloha::stateTxAck ( int  dest_addr)
protectedvirtual

If the protocl uses ARQ technique, in that case, after receiving a Data packet the node sends an ACK packet.

References print_transitions, printStateInfo(), refreshState(), txAck(), uwofdmaloha_debug, and UWOFDMALOHA_STATE_TX_ACK.

Referenced by stateRxData().

Here is the call graph for this function:

◆ stateTxData()

◆ stateWaitAck()

void UWOFDMAloha::stateWaitAck ( )
protectedvirtual

After transmitting a Data packet, a node waits for the ACK packet.

References ACK_timeout, mapAckTimer, print_transitions, printStateInfo(), refreshState(), uwofdmaloha_debug, UWOFDMALOHA_STATE_WAIT_ACK, and wait_constant.

Referenced by Phy2MacEndTx().

Here is the call graph for this function:

◆ txAck()

void UWOFDMAloha::txAck ( int  dest_addr)
protectedvirtual

This methods transmits ACK packet from MAC layer to PHY layer.

Parameters
dest_addrwhich is an integer data type.

References initPkt(), Mac2PhyStartTx(), UWOFDMALOHA_ACK_PKT, and uwofdmaloha_debug.

Referenced by stateTxAck().

Here is the call graph for this function:

◆ txData()

void UWOFDMAloha::txData ( )
protectedvirtual

This method transmits Data packets from MAC layer to PHY layer.

References ack_mode, curr_data_pkt, eraseItemFromPktQueue(), getPktSeqNum(), incrCurrTxRounds(), Mac2PhyStartTx(), uwofdmaloha_debug, UWOFDMALOHA_NO_ACK_MODE, and waitforpktnum.

Referenced by stateTxData().

Here is the call graph for this function:

◆ updateAckTimeout()

void UWOFDMAloha::updateAckTimeout ( double  rtt)
protectedvirtual

Like updateRTT() function.

References ACK_timeout, updateRTT(), and uwofdmaloha_debug.

Referenced by stateRxAck().

Here is the call graph for this function:

◆ updateLastDataIdRx()

virtual void UWOFDMAloha::updateLastDataIdRx ( int  id)
inlineprotectedvirtual

It updates the sequence number of the last data packet rx.

Parameters
idis an integer data type.

References last_data_id_rx.

◆ updateRTT()

void UWOFDMAloha::updateRTT ( double  rtt)
protectedvirtual

Update the Round Trip Time (RTT) which is necessary to compute the acknowledgement duration as well as backoff duration.

Parameters
rttis a double data type.

References ACK_timeout, alpha_, rttsamples, srtt, sumrtt, and sumrtt2.

Referenced by updateAckTimeout().

Member Data Documentation

◆ ack_mode

UWOFDMALOHA_ACK_MODES UWOFDMAloha::ack_mode
protected

Enum variable. It tells the node whether to use ARQ technique or not.

Referenced by command(), Phy2MacEndRx(), Phy2MacEndTx(), stateRxData(), and txData().

◆ ACK_size

int UWOFDMAloha::ACK_size
protected

Size of the ACK, if the node uses ARQ technique

Referenced by computeTxTime(), initPkt(), and UWOFDMAloha().

◆ ACK_timeout

double UWOFDMAloha::ACK_timeout
protected

ACK timeout for the initial packet

Referenced by getBackoffTime(), stateWaitAck(), updateAckTimeout(), updateRTT(), and UWOFDMAloha().

◆ ack_timer

AckTimer UWOFDMAloha::ack_timer
protected

An object of the AckTimer class

Referenced by putAckTimerInMap(), and stateRxData().

◆ AckInBand

bool UWOFDMAloha::AckInBand = true
protected

◆ alohaOnCarrier

bool UWOFDMAloha::alohaOnCarrier = false
protected

◆ alpha_

double UWOFDMAloha::alpha_
protected

This variable is used to tune the RTT

Referenced by updateRTT(), and UWOFDMAloha().

◆ backoff_timer

BackOffTimer UWOFDMAloha::backoff_timer
protected

◆ backoff_tuner

double UWOFDMAloha::backoff_tuner
protected

Tunes the backoff duration.

Referenced by getBackoffTime(), and UWOFDMAloha().

◆ buffer_pkts

int UWOFDMAloha::buffer_pkts
protected

Number of packets a node can store in the container

Referenced by recvFromUpperLayers(), and UWOFDMAloha().

◆ ctrl_car

int UWOFDMAloha::ctrl_car
protected

Referenced by init_macofdm_node().

◆ curr_data_pkt

Packet* UWOFDMAloha::curr_data_pkt
protected

Pointer of the latest selected data packet.

Referenced by stateTxData(), and txData().

◆ curr_state

UWOFDMALOHA_STATUS UWOFDMAloha::curr_state
protected

Enum variable. It stores the current state of a node

Referenced by Phy2MacEndRx(), Phy2MacEndTx(), printStateInfo(), recvFromUpperLayers(), refreshState(), stateCheckAckExpired(), and stateCheckBackoffExpired().

◆ curr_tx_rounds

int UWOFDMAloha::curr_tx_rounds
protected

How many times a packet is transmitted

Referenced by incrCurrTxRounds(), resetCurrTxRounds(), and stateTxData().

◆ disturbanceNode

bool UWOFDMAloha::disturbanceNode
protected

Referenced by command(), and initPkt().

◆ fout

ofstream UWOFDMAloha::fout
protected

An object of ofstream class

Referenced by command(), and printStateInfo().

◆ has_buffer_queue

bool UWOFDMAloha::has_buffer_queue
protected

Whether the node has buffer to store data or not

Referenced by recvFromUpperLayers(), and UWOFDMAloha().

◆ HDR_size

int UWOFDMAloha::HDR_size
protected

Size of the HDR if any

Referenced by computeTxTime(), initPkt(), stateRxData(), and UWOFDMAloha().

◆ initialized

bool UWOFDMAloha::initialized = false
staticprotected

It checks whether UWOFDMAloha protocol is initialized or not. If FALSE means, not initialized and if TRUE means it is initialized

Referenced by command(), and initInfo().

◆ last_data_id_rx

int UWOFDMAloha::last_data_id_rx
protected

The sequence number of last received packet

Referenced by updateLastDataIdRx().

◆ last_reason

UWOFDMALOHA_REASON_STATUS UWOFDMAloha::last_reason
protected

Enum variable which stores the last reason why a node changes its state

Referenced by Phy2MacEndTx(), printStateInfo(), and refreshReason().

◆ last_sent_data_id

int UWOFDMAloha::last_sent_data_id
protected

sequence number of the last sent packet

Referenced by stateTxData().

◆ mac_carMod

std::vector<string> UWOFDMAloha::mac_carMod
protected

--— OFDM PARAMS

Referenced by init_macofdm_node(), and initPkt().

◆ mac_carrierSize

double UWOFDMAloha::mac_carrierSize
protected

Referenced by init_macofdm_node(), and initPkt().

◆ mac_carVec

std::vector<int> UWOFDMAloha::mac_carVec
protected

Referenced by init_macofdm_node(), and initPkt().

◆ mac_ncarriers

int UWOFDMAloha::mac_ncarriers
protected

◆ mapAckTimer

map<pktSeqNum, AckTimer> UWOFDMAloha::mapAckTimer
protected

Container where acknowledgement timer(s) is stored

Referenced by eraseItemFrommapAckTimer(), putAckTimerInMap(), stateCheckAckExpired(), stateIdle(), stateRxAck(), stateTxData(), and stateWaitAck().

◆ mapPacket

map<pktSeqNum, Packet *> UWOFDMAloha::mapPacket
protected

◆ max_backoff_counter

double UWOFDMAloha::max_backoff_counter
protected

Maximum number of backoff it will consider while it increases the backoff exponentially

Referenced by getBackoffTime(), and UWOFDMAloha().

◆ max_payload

int UWOFDMAloha::max_payload
protected

Maximum number of payload in a packet.

Referenced by computeTxTime(), and UWOFDMAloha().

◆ max_tx_tries

int UWOFDMAloha::max_tx_tries
protected

Maximum number of retransmissions attempt.

Referenced by stateTxData(), and UWOFDMAloha().

◆ n_receptions

int UWOFDMAloha::n_receptions
protected

◆ nouse_carriers

std::vector<int> UWOFDMAloha::nouse_carriers
protected

◆ pkt_rcv_queue

std::vector<Packet *> UWOFDMAloha::pkt_rcv_queue
protected

Referenced by recvFromUpperLayers(), and stateIdle().

◆ pkt_type_info

map< UWOFDMAloha::UWOFDMALOHA_PKT_TYPE, string > UWOFDMAloha::pkt_type_info
staticprotected

Container which stores all the packet type information of UWOFDMAloha

Referenced by initInfo().

◆ prev_prev_state

UWOFDMALOHA_STATUS UWOFDMAloha::prev_prev_state
protected

Enum variable. It stores the previous to previous state of a node

Referenced by recvFromUpperLayers(), and refreshState().

◆ prev_state

UWOFDMALOHA_STATUS UWOFDMAloha::prev_state
protected

Enum variable. It stores the previous state of a node

Referenced by Phy2MacEndTx(), printStateInfo(), recvFromUpperLayers(), and refreshState().

◆ print_transitions

bool UWOFDMAloha::print_transitions
protected

◆ prop_speed

const double UWOFDMAloha::prop_speed = 1500.0
staticprotected

Speed of the sound signal

Referenced by Phy2MacEndRx().

◆ reason_info

map< UWOFDMAloha::UWOFDMALOHA_REASON_STATUS, string > UWOFDMAloha::reason_info
staticprotected

Container which stores all the reason information

Referenced by initInfo(), Phy2MacEndTx(), and printStateInfo().

◆ recv_data_id

int UWOFDMAloha::recv_data_id
protected

The sequence number of the packet which is received

Referenced by initPkt(), and stateRxData().

◆ rttsamples

int UWOFDMAloha::rttsamples
protected

Number of RTT samples

Referenced by getRTT(), and updateRTT().

◆ srtt

double UWOFDMAloha::srtt
protected

Smoothed Round Trip Time, calculated as for TCP

Referenced by updateRTT().

◆ start_tx_time

double UWOFDMAloha::start_tx_time
protected

Time when a packet start transmitting

Referenced by stateRxAck(), and stateTxData().

◆ status_info

map< UWOFDMAloha::UWOFDMALOHA_STATUS, string > UWOFDMAloha::status_info
staticprotected

Container which stores all the status information

Referenced by initInfo(), Phy2MacEndRx(), Phy2MacEndTx(), printStateInfo(), recvFromUpperLayers(), stateCheckAckExpired(), and stateCheckBackoffExpired().

◆ sumrtt

double UWOFDMAloha::sumrtt
protected

Sum of RTT samples

Referenced by getRTT(), and updateRTT().

◆ sumrtt2

double UWOFDMAloha::sumrtt2
protected

Sum of (RTT^2)

Referenced by updateRTT().

◆ txsn

int UWOFDMAloha::txsn
protected

Sequence number of the packet which is transmitted

◆ uwofdmaloha_debug

◆ wait_constant

double UWOFDMAloha::wait_constant
protected

This fixed time is used to componsate different time variations.

Referenced by stateWaitAck(), and UWOFDMAloha().

◆ waitforpktnum

int UWOFDMAloha::waitforpktnum = 0
protected

Referenced by Phy2MacEndRx(), stateTxData(), and txData().


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