EPONImplementationforOMNet++
0.8Beta
|
Polling algorithm base. More...
#include <OLTQPerLLiDBase_P.h>
Public Member Functions | |
OLTQPerLLiDBase_P () | |
virtual | ~OLTQPerLLiDBase_P () |
Protected Member Functions | |
virtual void | initialize () |
virtual void | handleMessage (cMessage *msg) |
virtual void | sendSingleGate () |
Send a single GATE (unicast) to an ONU. | |
virtual void | SendGateUpdates () |
Override to cancel default behavior and do nothing This is automatically called on ONU registration. | |
virtual void | DoUpstreamDBA () |
Override the algorithm :) | |
Protected Attributes | |
double | wMax |
double | fixedWin |
cMessage * | sendGateMsg |
bool | pollerRunning |
int | nextONU |
simtime_t | expTxTime |
Polling algorithm base.
It extends the RR for its downstream queue functionality and the non-polling Base
{ sendGateMsg = new cMessage("sendGateMsg", SEND_GATE); }
OLTQPerLLiDBase_P::~OLTQPerLLiDBase_P | ( | ) | [virtual] |
{ cancelAndDelete(sendGateMsg); }
void OLTQPerLLiDBase_P::DoUpstreamDBA | ( | ) | [protected, virtual] |
Override the algorithm :)
In this polling example the algorithm is using the fixed service approach. It will ignore any requests and it will always allocate fixedWin time to each ONU.
This should be extended to implement new algorithms
Reimplemented from OLTQPerLLiDBase.
{ // Check we are not running... if (pollerRunning) return; if (onutbl->getTableSize()==0){ EV<<"No ONUs registered... returning"<<endl; pollerRunning=false; return; } pollerRunning=true; // Check that no ONU has been removed (not happening usually) if (nextONU>=onutbl->getTableSize()) nextONU=0; EV<< "GATE for ONU idx: "<<nextONU<<endl; // Set the allocation for this ONU ONUTableEntry * en = onutbl->getEntry(nextONU); CommitedTime ct; // Convert length from ms to ns16 ct.length=(fixedWin*pow(10,6))/16; // Calc the start time (update expected time 1st) if (expTxTime==0 || expTxTime<simTime()) expTxTime=simTime(); // guard time 5us (Kramer used it with T_max=2ms in "IPACT: A Dynamic Protocol for an // Ethernet PON (EPON)") simtime_t guard = 0.000005; // Start... ct.start = MPCPTools::simTimeToNS16((expTxTime+guard).raw()); EV << "GATE MESSAGE CREATED: start="<<ct.start<<", len="<<ct.length<<endl; en->setComTime(ct); // Now, schedule the GATE message (TODO: RTT here currently // we under-utilize the channel) simtime_t gateTime = expTxTime; EV << " Scheduled at expTime="<<expTxTime<<endl; scheduleAt(gateTime,sendGateMsg); // Now change/update the next expected finish time expTxTime = expTxTime+guard+(fixedWin/1000); EV << " Next GATE at expTime="<<expTxTime<<endl; // Leave the nextONU to be pointing to the entry we send the // GATE to... it will be updated later. }
void OLTQPerLLiDBase_P::handleMessage | ( | cMessage * | msg | ) | [protected, virtual] |
Reimplemented from OLTQPerLLiDBase.
{ if (msg->getKind() == SEND_GATE){ sendSingleGate(); return; } // Call base... OLT_QPL_RR::handleMessage(msg); }
void OLTQPerLLiDBase_P::initialize | ( | ) | [protected, virtual] |
Reimplemented from OLT_QPL_RR.
{ // Init base OLT_QPL_RR::initialize(); // Get our parameters wMax = par("wMax").doubleValue(); fixedWin = par("fixedWin").doubleValue(); pollerRunning=false; nextONU=0; expTxTime=simTime(); WATCH(nextONU); WATCH(pollerRunning); WATCH(expTxTime); }
void OLTQPerLLiDBase_P::SendGateUpdates | ( | ) | [protected, virtual] |
Override to cancel default behavior and do nothing This is automatically called on ONU registration.
On polling based DBAs we do not need to reschedule all the ONUs...
Reimplemented from OLTQPerLLiDBase.
{
EV<<"** OLTQPerLLiDBase_P::SendGateUpdates CANCELED **"<<endl;
}
void OLTQPerLLiDBase_P::sendSingleGate | ( | ) | [protected, virtual] |
Send a single GATE (unicast) to an ONU.
{ MPCPGate *gt = new MPCPGate(); gt->setName("MPCPGate"); gt->setEtherType(MPCP_TYPE); gt->setOpcode(MPCP_GATE); MPCPTools::setGateLen(*gt, 1); gt->setSlotTime(slotLength); gt->setSlotsNum(slotNumber); gt->setDest(onutbl->getEntry(nextONU)->getId()); gt->setStartTime(0, onutbl->getEntry(nextONU)->getComTime().start); gt->setDuration(0, onutbl->getEntry(nextONU)->getComTime().length); // Header + List + (start + Len) + slotNum + slotLen gt->setByteLength(MPCP_HEADER_LEN+MPCP_LIST_LEN+MPCP_TIMERS_LEN+MPCP_SLOTINFO_LEN); // Send directly send(gt, "lowerLayerOut"); // Now update the nextONU and call for DBA again... nextONU=(nextONU+1)%onutbl->getTableSize(); // Change it to force DBA to run... pollerRunning = false; DoUpstreamDBA(); }
simtime_t OLTQPerLLiDBase_P::expTxTime [protected] |
double OLTQPerLLiDBase_P::fixedWin [protected] |
int OLTQPerLLiDBase_P::nextONU [protected] |
bool OLTQPerLLiDBase_P::pollerRunning [protected] |
cMessage* OLTQPerLLiDBase_P::sendGateMsg [protected] |
double OLTQPerLLiDBase_P::wMax [protected] |