Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/stack/mac/LteMacBase.ned
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ simple LteMacBase like ILteMac
//#
@signal[macDelayDl];
@statistic[macDelayDl](title="Delay at the MAC layer UL"; unit="s"; source="macDelayDl"; record=mean,vector);
@signal[macThroughputDl];
@statistic[macThroughputDl](title="Throughput at the MAC layer DL"; unit="Bps"; source="macThroughputDl"; record=mean);
@signal[macPacketDl](type=inet::Packet);
@statistic[macThroughputDl](title="Throughput at the MAC layer DL"; unit=bps; source="throughput(macPacketDl)"; record=mean);
@signal[macDelayUl];
@statistic[macDelayUl](title="Delay at the MAC layer UL"; unit="s"; source="macDelayUl"; record=mean,vector);
@signal[macThroughputUl];
@statistic[macThroughputUl](title="Throughput at the MAC layer UL"; unit="Bps"; source="macThroughputUl"; record=mean);
@signal[macCellThroughputUl];
@statistic[macCellThroughputUl](title="Cell Throughput at the MAC layer UL"; unit="Bps"; source="macCellThroughputUl"; record=mean);
@signal[macCellThroughputDl];
@statistic[macCellThroughputDl](title="Cell Throughput at the MAC layer DL"; unit="Bps"; source="macCellThroughputDl"; record=mean);
@signal[macPacketUl](type=inet::Packet);
@statistic[macThroughputUl](title="Throughput at the MAC layer UL"; unit=bps; source="throughput(macPacketUl)"; record=mean);
@signal[macCellPacketUl](type=inet::Packet);
@statistic[macCellThroughputUl](title="Cell Throughput at the MAC layer UL"; unit=bps; source="throughput(macCellPacketUl)"; record=mean);
@signal[macCellPacketDl](type=inet::Packet);
@statistic[macCellThroughputDl](title="Cell Throughput at the MAC layer DL"; unit=bps; source="throughput(macCellPacketDl)"; record=mean);
@signal[macCellPacketLossDl];
@statistic[macCellPacketLossDl](title="Mac Cell Packet Loss Dl"; unit=""; source="macCellPacketLossDl"; record=mean);
@signal[macCellPacketLossUl];
Expand Down
4 changes: 2 additions & 2 deletions src/stack/mac/LteMacEnbD2D.ned
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ simple LteMacEnbD2D extends LteMacEnb
bool msHarqInterrupt = default(true);
bool msClearRlcBuffer = default(true);

@signal[macCellThroughputD2D];
@statistic[macCellThroughputD2D](title="Cell Throughput at the MAC layer D2D"; unit="Bps"; source="macCellThroughputD2D"; record=mean);
@signal[macCellPacketD2D](type=inet::Packet);
@statistic[macCellThroughputD2D](title="Cell throughput at the MAC layer D2D"; unit=bps; source="throughput(macCellPacketD2D)"; record=mean);
@signal[macCellPacketLossD2D];
@statistic[macCellPacketLossD2D](title="Mac Cell Packet Loss D2D"; unit=""; source="macCellPacketLossD2D"; record=mean);
}
4 changes: 2 additions & 2 deletions src/stack/mac/LteMacUeD2D.ned
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ simple LteMacUeD2D extends LteMacUe
@statistic[macPacketLossD2D](title="Mac Packet Loss D2D"; unit=""; source="macPacketLossD2D"; record=mean);
@signal[macDelayD2D];
@statistic[macDelayD2D](title="Delay at the MAC layer D2D"; unit="s"; source="macDelayD2D"; record=mean,vector);
@signal[macThroughputD2D];
@statistic[macThroughputD2D](title="Throughput at the MAC layer D2D"; unit="Bps"; source="macThroughputD2D"; record=mean);
@signal[macPacketD2D](type=inet::Packet);
@statistic[macThroughputD2D](title="Throughput at the MAC layer D2D"; unit=bps; source="throughput(macPacketD2D)"; record=mean);

@signal[rcvdD2DModeSwitchNotification];
@statistic[rcvdD2DModeSwitchNotification](title="Reception of mode switch notification (tx side)"; unit=""; source="rcvdD2DModeSwitchNotification"; record=count,vector);
Expand Down
72 changes: 36 additions & 36 deletions src/stack/mac/amc/LteAmc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ void LteAmc::pushFeedbackD2D(MacNodeId id, LteFeedback fb, MacNodeId peerId, dou
// DEBUG
EV << "PeerId: " << peerId << ", Antenna: " << dasToA(antenna) << ", TxMode: " << txMode << ", Index: " << index << endl;
EV << "RECEIVED" << endl;
fb.print(NODEID_NONE, id, D2D, "LteAmc::pushFeedbackD2D");
fb.print(cellId_, id, D2D, "LteAmc::pushFeedbackD2D");
}

const LteSummaryFeedback& LteAmc::getFeedback(MacNodeId id, Remote antenna, TxMode txMode, const Direction dir, double carrierFrequency)
Expand Down Expand Up @@ -591,9 +591,9 @@ unsigned int LteAmc::computeBitsOnNRbs(MacNodeId id, Band b, unsigned int blocks
return 0;

// DEBUG
EV << NOW << " LteAmc::blocks2bits Node: " << id << "\n";
EV << NOW << " LteAmc::blocks2bits Band: " << b << "\n";
EV << NOW << " LteAmc::blocks2bits Direction: " << dirToA(dir) << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs Node: " << id << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs Band: " << b << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs Direction: " << dirToA(dir) << "\n";

// Acquiring current user scheduling information
const UserTxParams& info = computeTxParams(id, dir, carrierFrequency);
Expand All @@ -605,7 +605,7 @@ unsigned int LteAmc::computeBitsOnNRbs(MacNodeId id, Band b, unsigned int blocks
for (Codeword cw = 0; cw < codewords; ++cw) {
// if CQI == 0 the UE is out of range, thus bits=0
if (info.readCqiVector().at(cw) == 0) {
EV << NOW << " LteAmc::blocks2bits - CQI equal to zero on cw " << cw << ", return no blocks available" << endl;
EV << NOW << " LteAmc::computeBitsOnNRbs - CQI equal to zero on cw " << cw << ", return no blocks available" << endl;
continue;
}

Expand All @@ -614,43 +614,43 @@ unsigned int LteAmc::computeBitsOnNRbs(MacNodeId id, Band b, unsigned int blocks
unsigned int i = (mod == _QPSK ? 0 : (mod == _16QAM ? 9 : (mod == _64QAM ? 15 : 0)));

// DEBUG
EV << NOW << " LteAmc::blocks2bits ---::[ Codeword = " << cw << "\n";
EV << NOW << " LteAmc::blocks2bits Modulation: " << modToA(mod) << "\n";
EV << NOW << " LteAmc::blocks2bits iTbs: " << iTbs << "\n";
EV << NOW << " LteAmc::blocks2bits i: " << i << "\n";
EV << NOW << " LteAmc::blocks2bits CQI: " << info.readCqiVector().at(cw) << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs ---::[ Codeword = " << cw << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs Modulation: " << modToA(mod) << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs iTbs: " << iTbs << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs i: " << i << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs CQI: " << info.readCqiVector().at(cw) << "\n";

const unsigned int *tbsVect = itbs2tbs(mod, info.readTxMode(), layers.at(cw), iTbs - i);
bits += tbsVect[blocks - 1];
}

// DEBUG
EV << NOW << " LteAmc::blocks2bits Resource Blocks: " << blocks << "\n";
EV << NOW << " LteAmc::blocks2bits Available space: " << bits << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs Resource Blocks: " << blocks << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs Available space: " << bits << "\n";

return bits;
}

unsigned int LteAmc::computeBitsOnNRbs(MacNodeId id, Band b, Codeword cw, unsigned int blocks, const Direction dir, double carrierFrequency)
{
if (blocks > 110) // Safety check to avoid segmentation fault
throw cRuntimeError("LteAmc::blocks2bits(): Too many blocks");
throw cRuntimeError("LteAmc::computeBitsOnNRbs(): Too many blocks");

if (blocks == 0)
return 0;

// DEBUG
EV << NOW << " LteAmc::blocks2bits Node: " << id << "\n";
EV << NOW << " LteAmc::blocks2bits Band: " << b << "\n";
EV << NOW << " LteAmc::blocks2bits Codeword: " << cw << "\n";
EV << NOW << " LteAmc::blocks2bits Direction: " << dirToA(dir) << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs Node: " << id << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs Band: " << b << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs Codeword: " << cw << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs Direction: " << dirToA(dir) << "\n";

// Acquiring current user scheduling information
UserTxParams info = computeTxParams(id, dir, carrierFrequency);

// if CQI == 0 the UE is out of range, thus return 0
if (info.readCqiVector().at(cw) == 0) {
EV << NOW << " LteAmc::blocks2bits - CQI equal to zero, return no blocks available" << endl;
EV << NOW << " LteAmc::computeBitsOnNRbs - CQI equal to zero, return no blocks available" << endl;
return 0;
}
unsigned char layers = info.getLayers().at(cw);
Expand All @@ -660,45 +660,45 @@ unsigned int LteAmc::computeBitsOnNRbs(MacNodeId id, Band b, Codeword cw, unsign
unsigned int i = (mod == _QPSK ? 0 : (mod == _16QAM ? 9 : (mod == _64QAM ? 15 : 0)));

// DEBUG
EV << NOW << " LteAmc::blocks2bits Modulation: " << modToA(mod) << "\n";
EV << NOW << " LteAmc::blocks2bits iTbs: " << iTbs << "\n";
EV << NOW << " LteAmc::blocks2bits i: " << i << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs Modulation: " << modToA(mod) << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs iTbs: " << iTbs << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs i: " << i << "\n";

const unsigned int *tbsVect = itbs2tbs(mod, info.readTxMode(), layers, iTbs - i);

// DEBUG
EV << NOW << " LteAmc::blocks2bits Resource Blocks: " << blocks << "\n";
EV << NOW << " LteAmc::blocks2bits Available space: " << tbsVect[blocks - 1] << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs Resource Blocks: " << blocks << "\n";
EV << NOW << " LteAmc::computeBitsOnNRbs Available space: " << tbsVect[blocks - 1] << "\n";

return tbsVect[blocks - 1];
}

unsigned int LteAmc::computeBytesOnNRbs(MacNodeId id, Band b, unsigned int blocks, const Direction dir, double carrierFrequency)
{
EV << NOW << " LteAmc::blocks2bytes Node " << id << ", Band " << b << ", direction " << dirToA(dir) << ", blocks " << blocks << "\n";
EV << NOW << " LteAmc::computeBytesOnNRbs Node " << id << ", Band " << b << ", direction " << dirToA(dir) << ", blocks " << blocks << "\n";

unsigned int bits = computeBitsOnNRbs(id, b, blocks, dir, carrierFrequency);
unsigned int bytes = bits / 8;

// DEBUG
EV << NOW << " LteAmc::blocks2bytes Resource Blocks: " << blocks << "\n";
EV << NOW << " LteAmc::blocks2bytes Available space: " << bits << "\n";
EV << NOW << " LteAmc::blocks2bytes Available space: " << bytes << "\n";
EV << NOW << " LteAmc::computeBytesOnNRbs Resource Blocks: " << blocks << "\n";
EV << NOW << " LteAmc::computeBytesOnNRbs Available space: " << bits << "\n";
EV << NOW << " LteAmc::computeBytesOnNRbs Available space: " << bytes << "\n";

return bytes;
}

unsigned int LteAmc::computeBytesOnNRbs(MacNodeId id, Band b, Codeword cw, unsigned int blocks, const Direction dir, double carrierFrequency)
{
EV << NOW << " LteAmc::blocks2bytes Node " << id << ", Band " << b << ", Codeword " << cw << ", direction " << dirToA(dir) << ", blocks " << blocks << "\n";
EV << NOW << " LteAmc::computeBytesOnNRbs Node " << id << ", Band " << b << ", Codeword " << cw << ", direction " << dirToA(dir) << ", blocks " << blocks << "\n";

unsigned int bits = computeBitsOnNRbs(id, b, cw, blocks, dir, carrierFrequency);
unsigned int bytes = bits / 8;

// DEBUG
EV << NOW << " LteAmc::blocks2bytes Resource Blocks: " << blocks << "\n";
EV << NOW << " LteAmc::blocks2bytes Available space: " << bits << "\n";
EV << NOW << " LteAmc::blocks2bytes Available space: " << bytes << "\n";
EV << NOW << " LteAmc::computeBytesOnNRbs Resource Blocks: " << blocks << "\n";
EV << NOW << " LteAmc::computeBytesOnNRbs Available space: " << bits << "\n";
EV << NOW << " LteAmc::computeBytesOnNRbs Available space: " << bytes << "\n";

return bytes;
}
Expand All @@ -712,8 +712,8 @@ unsigned int LteAmc::computeBytesOnNRbs_MB(MacNodeId id, Band b, unsigned int bl

// DEBUG
EV << NOW << " LteAmc::computeBytesOnNRbs_MB Resource Blocks: " << blocks << "\n";
EV << NOW << " LteAmc::computeBytesOnNRbs_MB Available space: " << bits << "\n";
EV << NOW << " LteAmc::computeBytesOnNRbs_MB Available space: " << bytes << "\n";
EV << NOW << " LteAmc::computeBytesOnNRbs_MB Available space: " << bits << " bits\n";
EV << NOW << " LteAmc::computeBytesOnNRbs_MB Available space: " << bytes << " bytes\n";

return bytes;
}
Expand Down Expand Up @@ -980,7 +980,7 @@ Cqi LteAmc::readWbCqi(const CqiVector& cqi)
// consider the cqi of each band
unsigned int bands = cqi.size();
for (Band b = 0; b < bands; ++b) {
EV << "LteAmc::getWbCqi - Cqi " << cqi.at(b) << " on band " << (int)b << endl;
EV << "LteAmc::readWbCqi - Cqi " << cqi.at(b) << " on band " << (int)b << endl;

cqiCounter += cqi.at(b);
cqiMin = cqiMin < cqi.at(b) ? cqiMin : cqi.at(b);
Expand Down Expand Up @@ -1091,7 +1091,7 @@ Pmi LteAmc::readWbPmi(const PmiVector& pmi)
throw cRuntimeError("LteAmc::readWbPmi(): Unknown weight %f", pmiComputationWeight_);
}

EV << "LteAmc::getWbPmi - Pmi " << pmiRet << " evaluated\n";
EV << "LteAmc::readWbPmi - Pmi " << pmiRet << " evaluated\n";

return pmiRet;
}
Expand Down Expand Up @@ -1328,7 +1328,7 @@ void LteAmc::testUe(MacNodeId nodeId, Direction dir)
numTxModes = UL_NUM_TXMODE;
}
else {
throw cRuntimeError("LteAmc::attachUser(): Unrecognized direction");
throw cRuntimeError("LteAmc::testUe(): Unrecognized direction");
}

unsigned int nodeIndex = (*nodeIndexMap).at(nodeId);
Expand Down
24 changes: 5 additions & 19 deletions src/stack/mac/buffer/harq/LteHarqBufferRx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@

namespace simu5g {

unsigned int LteHarqBufferRx::totalCellRcvdBytes_ = 0;

using namespace omnetpp;

simsignal_t LteHarqBufferRx::macCellThroughputSignal_[2] = { cComponent::registerSignal("macCellThroughputDl"), cComponent::registerSignal("macCellThroughputUl") };
simsignal_t LteHarqBufferRx::macCellPacketSignal_[2] = { cComponent::registerSignal("macCellPacketDl"), cComponent::registerSignal("macCellPacketUl") };
simsignal_t LteHarqBufferRx::macDelaySignal_[2] = { cComponent::registerSignal("macDelayDl"), cComponent::registerSignal("macDelayUl") };
simsignal_t LteHarqBufferRx::macThroughputSignal_[2] = { cComponent::registerSignal("macThroughputDl"), cComponent::registerSignal("macThroughputUl") };
simsignal_t LteHarqBufferRx::macPacketSignal_[2] = { cComponent::registerSignal("macPacketDl"), cComponent::registerSignal("macPacketUl") };

LteHarqBufferRx::LteHarqBufferRx(unsigned int num, LteMacBase *owner, Binder *binder, MacNodeId srcId)
: binder_(binder), macOwner_(owner), numHarqProcesses_(num), srcId_(srcId), processes_(num, nullptr), isMulticast_(false)
Expand Down Expand Up @@ -127,24 +125,12 @@ std::list<Packet *> LteHarqBufferRx::extractCorrectPdus()
auto temp = pktTemp->peekAtFront<LteMacPdu>();
auto uInfo = pktTemp->getTag<UserControlInfo>();

unsigned int size = pktTemp->getByteLength();

// emit delay statistic
macUe_emit(macDelaySignal_[dir], (NOW - pktTemp->getCreationTime()).dbl());

// Calculate Throughput by sending the number of bits for this packet
totalCellRcvdBytes_ += size;
totalRcvdBytes_ += size;
double den = (NOW - getSimulation()->getWarmupPeriod()).dbl();

// emit throughput statistics
if (den > 0) {
double tputSample = (double)totalRcvdBytes_ / den;
double cellTputSample = (double)totalCellRcvdBytes_ / den;

nodeB_->emit(macCellThroughputSignal_[dir], cellTputSample);
macUe_emit(macThroughputSignal_[dir], tputSample);
}
// emit packet statistics
nodeB_->emit(macCellPacketSignal_[dir], pktTemp);
macUe_emit(macPacketSignal_[dir], pktTemp);

macOwner_->dropObj(pktTemp);
ret.push_back(pktTemp);
Expand Down
12 changes: 8 additions & 4 deletions src/stack/mac/buffer/harq/LteHarqBufferRx.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@ class LteHarqBufferRx
bool isMulticast_;

// Statistics
static unsigned int totalCellRcvdBytes_;
unsigned int totalRcvdBytes_ = 0;
Direction dir = UNKNOWN_DIRECTION;

static simsignal_t macCellThroughputSignal_[2];
static simsignal_t macCellPacketSignal_[2];
static simsignal_t macDelaySignal_[2];
static simsignal_t macThroughputSignal_[2];
static simsignal_t macPacketSignal_[2];

// reference to the eNB module
opp_component_ptr<cModule> nodeB_;
Expand Down Expand Up @@ -170,6 +168,12 @@ class LteHarqBufferRx
macUe_->emit(signal, val);
}
}
virtual void macUe_emit(simsignal_t signal, inet::Packet *pkt)
{
if (macUe_ != nullptr) {
macUe_->emit(signal, pkt);
}
}

/**
* macSource_ is a private member, so derived classes need this member function to
Expand Down
31 changes: 9 additions & 22 deletions src/stack/mac/buffer/harq_d2d/LteHarqBufferRxD2D.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ namespace simu5g {

using namespace omnetpp;

simsignal_t LteHarqBufferRxD2D::macThroughputD2D_ = cComponent::registerSignal("macThroughputD2D");
simsignal_t LteHarqBufferRxD2D::macPacketD2D_ = cComponent::registerSignal("macPacketD2D");
simsignal_t LteHarqBufferRxD2D::macDelayD2D_ = cComponent::registerSignal("macDelayD2D");
simsignal_t LteHarqBufferRxD2D::macCellThroughputD2D_ = cComponent::registerSignal("macCellThroughputD2D");
simsignal_t LteHarqBufferRxD2D::macCellPacketD2D_ = cComponent::registerSignal("macCellPacketD2D");

LteHarqBufferRxD2D::LteHarqBufferRxD2D(unsigned int num, LteMacBase *owner, Binder *binder, MacNodeId srcId, bool isMulticast)
: LteHarqBufferRx(binder, owner, num, srcId)
Expand Down Expand Up @@ -116,7 +116,6 @@ std::list<Packet *> LteHarqBufferRxD2D::extractCorrectPdus()
for (Codeword cw = 0; cw < MAX_CODEWORDS; ++cw) {
if (processes_[i]->isCorrect(cw)) {
auto temp = processes_[i]->extractPdu(cw);
unsigned int size = temp->getByteLength();
auto info = temp->getTag<UserControlInfo>();

// emit delay statistic
Expand All @@ -125,25 +124,13 @@ std::list<Packet *> LteHarqBufferRxD2D::extractCorrectPdus()
else
macUe_emit(macDelaySignal_[dir], (NOW - temp->getCreationTime()).dbl()); // TODO `info->getDirection()` and `dir` maybe differs

// Calculate Throughput by sending the number of bits for this packet
totalRcvdBytes_ += size;
totalCellRcvdBytes_ += size;

double den = (NOW - getSimulation()->getWarmupPeriod()).dbl();

if (den > 0) {
double tputSample = (double)totalRcvdBytes_ / den;
double cellTputSample = (double)totalCellRcvdBytes_ / den;

// emit throughput statistics
if (info->getDirection() == D2D) {
check_and_cast<LteMacEnbD2D *>(nodeB_.get())->emit(macCellThroughputD2D_, cellTputSample);
macUe_emit(macThroughputD2D_, tputSample);
}
else {
nodeB_->emit(macCellThroughputSignal_[dir], cellTputSample); // TODO `info->getDirection()` and `dir` maybe differs
macUe_emit(macThroughputSignal_[dir], tputSample); // TODO `info->getDirection()` and `dir` maybe differs
}
if (info->getDirection() == D2D) {
check_and_cast<LteMacEnbD2D *>(nodeB_.get())->emit(macCellPacketD2D_, temp);
macUe_emit(macPacketD2D_, temp);
}
else {
nodeB_->emit(macCellPacketSignal_[dir], temp); // TODO `info->getDirection()` and `dir` maybe differs
macUe_emit(macPacketSignal_[dir], temp); // TODO `info->getDirection()` and `dir` maybe differs
}

ret.push_back(temp);
Expand Down
4 changes: 2 additions & 2 deletions src/stack/mac/buffer/harq_d2d/LteHarqBufferRxD2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class LteHarqBufferRxD2D : public LteHarqBufferRx

// D2D Statistics
static inet::simsignal_t macDelayD2D_;
static inet::simsignal_t macCellThroughputD2D_;
static inet::simsignal_t macThroughputD2D_;
static inet::simsignal_t macCellPacketD2D_;
static inet::simsignal_t macPacketD2D_;

/**
* Checks for all processes if the PDU has been evaluated and sends
Expand Down
Loading