This repository was archived by the owner on Feb 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathLtePhyUe.cc
More file actions
629 lines (535 loc) · 21.1 KB
/
LtePhyUe.cc
File metadata and controls
629 lines (535 loc) · 21.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
//
// SimuLTE
//
// This file is part of a software released under the license included in file
// "license.pdf". This license can be also found at http://www.ltesimulator.com/
// The above file and the present reference are part of the software itself,
// and cannot be removed from it.
//
#include <assert.h>
#include "stack/phy/layer/LtePhyUe.h"
#include "stack/phy/packet/LteFeedbackPkt.h"
#include "corenetwork/lteip/IP2lte.h"
#include "stack/phy/feedback/LteDlFeedbackGenerator.h"
Define_Module(LtePhyUe);
using namespace inet;
LtePhyUe::LtePhyUe()
{
handoverStarter_ = nullptr;
handoverTrigger_ = nullptr;
}
LtePhyUe::~LtePhyUe()
{
cancelAndDelete(handoverStarter_);
delete das_;
}
void LtePhyUe::initialize(int stage)
{
LtePhyBase::initialize(stage);
if (stage == inet::INITSTAGE_LOCAL)
{
nodeType_ = UE;
useBattery_ = false; // disabled
enableHandover_ = par("enableHandover");
handoverLatency_ = par("handoverLatency").doubleValue();
dynamicCellAssociation_ = par("dynamicCellAssociation");
currentMasterRssi_ = 0;
candidateMasterRssi_ = -120.0; // set do MIN_VALUE to allow best eNB selection during dynamic association
hysteresisTh_ = 0;
hysteresisFactor_ = 10;
handoverDelta_ = 0.00001;
dasRssiThreshold_ = 1.0e-5;
das_ = new DasFilter(this, binder_, nullptr, dasRssiThreshold_);
servingCell_ = registerSignal("servingCell");
averageCqiDl_ = registerSignal("averageCqiDl");
averageCqiUl_ = registerSignal("averageCqiUl");
if (!hasListeners(averageCqiDl_))
error("no phy listeners");
WATCH(nodeType_);
WATCH(masterId_);
WATCH(candidateMasterId_);
WATCH(dasRssiThreshold_);
WATCH(currentMasterRssi_);
WATCH(candidateMasterRssi_);
WATCH(hysteresisTh_);
WATCH(hysteresisFactor_);
WATCH(handoverDelta_);
WATCH(das_);
}
else if (stage == inet::INITSTAGE_PHYSICAL_ENVIRONMENT)
{
if (useBattery_)
{
// TODO register the device to the battery with two accounts, e.g. 0=tx and 1=rx
// it only affects statistics
//registerWithBattery("LtePhy", 2);
// txAmount_ = par("batteryTxCurrentAmount");
// rxAmount_ = par("batteryRxCurrentAmount");
//
// WATCH(txAmount_);
// WATCH(rxAmount_);
}
txPower_ = ueTxPower_;
lastFeedback_ = 0;
handoverStarter_ = new cMessage("handoverStarter");
mac_ = check_and_cast<LteMacUe *>(
getParentModule()-> // nic
getSubmodule("mac"));
rlcUm_ = check_and_cast<LteRlcUm*>(
getParentModule()-> // nic
getSubmodule("rlc")->
getSubmodule("um"));
}
else if (stage == inet::INITSTAGE_PHYSICAL_LAYER)
{
// find the best candidate master cell
if (dynamicCellAssociation_)
{
// this is a fictitious frame that needs to compute the SINR
LteAirFrame *frame = new LteAirFrame("cellSelectionFrame");
UserControlInfo *cInfo = new UserControlInfo();
// get the list of all eNodeBs in the network
std::vector<EnbInfo*>* enbList = binder_->getEnbList();
std::vector<EnbInfo*>::iterator it = enbList->begin();
for (; it != enbList->end(); ++it)
{
MacNodeId cellId = (*it)->id;
LtePhyBase* cellPhy = check_and_cast<LtePhyBase*>((*it)->eNodeB->getSubmodule("lteNic")->getSubmodule("phy"));
double cellTxPower = cellPhy->getTxPwr();
Coord cellPos = cellPhy->getCoord();
// build a control info
cInfo->setSourceId(cellId);
cInfo->setTxPower(cellTxPower);
cInfo->setCoord(cellPos);
cInfo->setFrameType(FEEDBACKPKT);
// get RSSI from the eNB
std::vector<double>::iterator it;
double rssi = 0;
std::vector<double> rssiV = channelModel_->getSINR(frame, cInfo);
for (it = rssiV.begin(); it != rssiV.end(); ++it)
rssi += *it;
rssi /= rssiV.size(); // compute the mean over all RBs
EV << "LtePhyUe::initialize - RSSI from eNodeB " << cellId << ": " << rssi << " dB (current candidate eNodeB "
<< candidateMasterId_ << ": " << candidateMasterRssi_ << " dB" << endl;
if (rssi > candidateMasterRssi_)
{
candidateMasterId_ = cellId;
candidateMasterRssi_ = rssi;
}
}
delete cInfo;
delete frame;
// set serving cell
masterId_ = candidateMasterId_;
getAncestorPar("masterId").setIntValue(masterId_);
currentMasterRssi_ = candidateMasterRssi_;
updateHysteresisTh(candidateMasterRssi_);
}
else
{
// get serving cell from configuration
masterId_ = getAncestorPar("masterId");
candidateMasterId_ = masterId_;
}
EV << "LtePhyUe::initialize - Attaching to eNodeB " << masterId_ << endl;
das_->setMasterRuSet(masterId_);
emit(servingCell_, (long)masterId_);
}
else if (stage == inet::INITSTAGE_NETWORK_CONFIGURATION)
{
// get local id
nodeId_ = getAncestorPar("macNodeId");
EV << "Local MacNodeId: " << nodeId_ << endl;
// get cellInfo at this stage because the next hop of the node is registered in the IP2Lte module at the INITSTAGE_NETWORK_LAYER
cellInfo_ = getCellInfo(nodeId_);
int index = intuniform(0, binder_->phyPisaData.maxChannel() - 1);
cellInfo_->lambdaInit(nodeId_, index);
cellInfo_->channelUpdate(nodeId_, intuniform(1, binder_->phyPisaData.maxChannel2()));
}
}
void LtePhyUe::handleSelfMessage(cMessage *msg)
{
if (msg->isName("handoverStarter"))
triggerHandover();
else if (msg->isName("handoverTrigger"))
{
doHandover();
delete msg;
handoverTrigger_ = nullptr;
}
}
void LtePhyUe::handoverHandler(LteAirFrame* frame, UserControlInfo* lteInfo)
{
lteInfo->setDestId(nodeId_);
if (!enableHandover_)
{
// Even if handover is not enabled, this call is necessary
// to allow Reporting Set computation.
if (getNodeTypeById(lteInfo->getSourceId()) == ENODEB && lteInfo->getSourceId() == masterId_)
{
// Broadcast message from my master enb
das_->receiveBroadcast(frame, lteInfo);
}
delete frame;
delete lteInfo;
return;
}
frame->setControlInfo(lteInfo);
double rssi;
if (getNodeTypeById(lteInfo->getSourceId()) == ENODEB && lteInfo->getSourceId() == masterId_)
{
// Broadcast message from my master enb
rssi = das_->receiveBroadcast(frame, lteInfo);
}
else
{
// Broadcast message from relay or not-master enb
std::vector<double>::iterator it;
rssi = 0;
std::vector<double> rssiV = channelModel_->getSINR(frame, lteInfo);
for (it = rssiV.begin(); it != rssiV.end(); ++it)
rssi += *it;
rssi /= rssiV.size();
}
EV << "UE " << nodeId_ << " broadcast frame from " << lteInfo->getSourceId()
<< " with RSSI: " << rssi << " at " << simTime() << endl;
if (rssi > candidateMasterRssi_ + hysteresisTh_)
{
if (lteInfo->getSourceId() == masterId_)
{
// receiving even stronger broadcast from current master
currentMasterRssi_ = rssi;
candidateMasterId_ = masterId_;
candidateMasterRssi_ = rssi;
hysteresisTh_ = updateHysteresisTh(currentMasterRssi_);
cancelEvent(handoverStarter_);
}
else
{
// broadcast from another master with higher rssi
candidateMasterId_ = lteInfo->getSourceId();
candidateMasterRssi_ = rssi;
hysteresisTh_ = updateHysteresisTh(rssi);
// schedule self message to evaluate handover parameters after
// all broadcast messages are arrived
if (!handoverStarter_->isScheduled())
{
// all broadcast messages are scheduled at the very same time, a small delta
// guarantees the ones belonging to the same turn have been received
scheduleAt(simTime() + handoverDelta_, handoverStarter_);
}
}
}
else
{
if (lteInfo->getSourceId() == masterId_)
{
currentMasterRssi_ = rssi;
candidateMasterRssi_ = rssi;
hysteresisTh_ = updateHysteresisTh(rssi);
}
}
delete frame;
}
void LtePhyUe::triggerHandover()
{
ASSERT(masterId_ != candidateMasterId_);
EV << "####Handover starting:####" << endl;
EV << "current master: " << masterId_ << endl;
EV << "current rssi: " << currentMasterRssi_ << endl;
EV << "candidate master: " << candidateMasterId_ << endl;
EV << "candidate rssi: " << candidateMasterRssi_ << endl;
EV << "############" << endl;
EV << NOW << " LtePhyUe::triggerHandover - UE " << nodeId_ << " is starting handover to eNB " << candidateMasterId_ << "... " << endl;
binder_->addUeHandoverTriggered(nodeId_);
// inform the UE's IP2lte module to start holding downstream packets
IP2lte* ip2lte = check_and_cast<IP2lte*>(getParentModule()->getSubmodule("ip2lte"));
ip2lte->triggerHandoverUe();
// inform the eNB's IP2lte module to forward data to the target eNB
IP2lte* enbIp2lte = check_and_cast<IP2lte*>(getSimulation()->getModule(binder_->getOmnetId(masterId_))->getSubmodule("lteNic")->getSubmodule("ip2lte"));
enbIp2lte->triggerHandoverSource(nodeId_,candidateMasterId_);
handoverTrigger_ = new cMessage("handoverTrigger");
scheduleAt(simTime() + handoverLatency_, handoverTrigger_);
}
void LtePhyUe::doHandover()
{
// Delete Old Buffers
deleteOldBuffers(masterId_);
// amc calls
LteAmc *oldAmc = getAmcModule(masterId_);
LteAmc *newAmc = getAmcModule(candidateMasterId_);
// TODO verify the amc is the relay one and remove after tests
assert(newAmc != nullptr);
oldAmc->detachUser(nodeId_, UL);
oldAmc->detachUser(nodeId_, DL);
newAmc->attachUser(nodeId_, UL);
newAmc->attachUser(nodeId_, DL);
// binder calls
binder_->unregisterNextHop(masterId_, nodeId_);
binder_->registerNextHop(candidateMasterId_, nodeId_);
binder_->updateUeInfoCellId(nodeId_,candidateMasterId_);
das_->setMasterRuSet(candidateMasterId_);
// change masterId and notify handover to the MAC layer
MacNodeId oldMaster = masterId_;
masterId_ = candidateMasterId_;
mac_->doHandover(candidateMasterId_); // do MAC operations for handover
currentMasterRssi_ = candidateMasterRssi_;
hysteresisTh_ = updateHysteresisTh(currentMasterRssi_);
// update cellInfo
LteMacEnb* newMacEnb = check_and_cast<LteMacEnb*>(getSimulation()->getModule(binder_->getOmnetId(candidateMasterId_))->getSubmodule("lteNic")->getSubmodule("mac"));
LteCellInfo* newCellInfo = newMacEnb->getCellInfo();
cellInfo_->detachUser(nodeId_);
newCellInfo->attachUser(nodeId_);
cellInfo_ = newCellInfo;
// update DL feedback generator
LteDlFeedbackGenerator* fbGen = check_and_cast<LteDlFeedbackGenerator*>(getParentModule()->getSubmodule("dlFbGen"));
fbGen->handleHandover(masterId_);
// collect stat
emit(servingCell_, (long)masterId_);
EV << NOW << " LtePhyUe::doHandover - UE " << nodeId_ << " has completed handover to eNB " << masterId_ << "... " << endl;
binder_->removeUeHandoverTriggered(nodeId_);
// inform the UE's IP2lte module to forward held packets
IP2lte* ip2lte = check_and_cast<IP2lte*>(getParentModule()->getSubmodule("ip2lte"));
ip2lte->signalHandoverCompleteUe();
// inform the eNB's IP2lte module to forward data to the target eNB
IP2lte* enbIp2lte = check_and_cast<IP2lte*>(getSimulation()->getModule(binder_->getOmnetId(masterId_))->getSubmodule("lteNic")->getSubmodule("ip2lte"));
enbIp2lte->signalHandoverCompleteTarget(nodeId_,oldMaster);
}
// TODO: ***reorganize*** method
void LtePhyUe::handleAirFrame(cMessage* msg)
{
UserControlInfo* lteInfo = dynamic_cast<UserControlInfo*>(msg->removeControlInfo());
if (useBattery_)
{
//TODO BatteryAccess::drawCurrent(rxAmount_, 0);
}
connectedNodeId_ = masterId_;
LteAirFrame* frame = check_and_cast<LteAirFrame*>(msg);
EV << "LtePhy: received new LteAirFrame with ID " << frame->getId() << " from channel" << endl;
int sourceId = binder_->getOmnetId(lteInfo->getSourceId());
if(sourceId == 0 )
{
// source has left the simulation
delete msg;
return;
}
//Update coordinates of this user
if (lteInfo->getFrameType() == HANDOVERPKT)
{
// check if handover is already in process
if (handoverTrigger_ != nullptr && handoverTrigger_->isScheduled())
{
delete lteInfo;
delete frame;
return;
}
handoverHandler(frame, lteInfo);
return;
}
// Check if the frame is for us ( MacNodeId matches )
if (lteInfo->getDestId() != nodeId_)
{
EV << "ERROR: Frame is not for us. Delete it." << endl;
EV << "Packet Type: " << phyFrameTypeToA((LtePhyFrameType)lteInfo->getFrameType()) << endl;
EV << "Frame MacNodeId: " << lteInfo->getDestId() << endl;
EV << "Local MacNodeId: " << nodeId_ << endl;
delete lteInfo;
delete frame;
return;
}
/*
* This could happen if the ue associates with a new master while the old one
* already scheduled a packet for him: the packet is in the air while the ue changes master.
* Event timing: TTI x: packet scheduled and sent for UE (tx time = 1ms)
* TTI x+0.1: ue changes master
* TTI x+1: packet from old master arrives at ue
*/
if (lteInfo->getSourceId() != masterId_)
{
EV << "WARNING: frame from an old master during handover: deleted " << endl;
EV << "Source MacNodeId: " << lteInfo->getSourceId() << endl;
EV << "Master MacNodeId: " << masterId_ << endl;
delete frame;
return;
}
// send H-ARQ feedback up
if (lteInfo->getFrameType() == HARQPKT || lteInfo->getFrameType() == GRANTPKT || lteInfo->getFrameType() == RACPKT)
{
handleControlMsg(frame, lteInfo);
return;
}
if ((lteInfo->getUserTxParams()) != nullptr)
{
int cw = lteInfo->getCw();
if (lteInfo->getUserTxParams()->readCqiVector().size() == 1)
cw = 0;
double cqi = lteInfo->getUserTxParams()->readCqiVector()[cw];
emit(averageCqiDl_, cqi);
}
// apply decider to received packet
bool result = true;
RemoteSet r = lteInfo->getUserTxParams()->readAntennaSet();
if (r.size() > 1)
{
// DAS
for (RemoteSet::iterator it = r.begin(); it != r.end(); it++)
{
EV << "LtePhy: Receiving Packet from antenna " << (*it) << "\n";
/*
* On UE set the sender position
* and tx power to the sender das antenna
*/
// cc->updateHostPosition(myHostRef,das_->getAntennaCoord(*it));
// Set position of sender
// Move m;
// m.setStart(das_->getAntennaCoord(*it));
RemoteUnitPhyData data;
data.txPower=lteInfo->getTxPower();
data.m=getRadioPosition();
frame->addRemoteUnitPhyDataVector(data);
}
// apply analog models For DAS
result=channelModel_->isCorruptedDas(frame,lteInfo);
}
else
{
//RELAY and NORMAL
result = channelModel_->isCorrupted(frame,lteInfo);
}
// update statistics
if (result)
numAirFrameReceived_++;
else
numAirFrameNotReceived_++;
EV << "Handled LteAirframe with ID " << frame->getId() << " with result "
<< ( result ? "RECEIVED" : "NOT RECEIVED" ) << endl;
auto pkt = check_and_cast<inet::Packet *>(frame->decapsulate());
// here frame has to be destroyed since it is no more useful
delete frame;
// attach the decider result to the packet as control info
lteInfo->setDeciderResult(result);
*(pkt->addTagIfAbsent<UserControlInfo>()) = *lteInfo;
delete lteInfo;
// send decapsulated message along with result control info to upperGateOut_
send(pkt, upperGateOut_);
if (getEnvir()->isGUI())
updateDisplayString();
}
void LtePhyUe::handleUpperMessage(cMessage* msg)
{
// if (useBattery_) {
// TODO BatteryAccess::drawCurrent(txAmount_, 1);
// }
auto pkt = check_and_cast<inet::Packet *>(msg);
auto lteInfo = pkt->getTag<UserControlInfo>();
MacNodeId dest = lteInfo->getDestId();
if (dest != masterId_)
{
// UE is not sending to its master!!
throw cRuntimeError("LtePhyUe::handleUpperMessage Ue preparing to send message to %d instead of its master (%d)", dest, masterId_);
}
if (lteInfo->getFrameType() == DATAPKT && (channelModel_->isUplinkInterferenceEnabled() || channelModel_->isD2DInterferenceEnabled()))
{
// Store the RBs used for data transmission to the binder (for UL interference computation)
RbMap rbMap = lteInfo->getGrantedBlocks();
Remote antenna = MACRO; // TODO fix for multi-antenna
binder_->storeUlTransmissionMap(antenna, rbMap, nodeId_, mac_->getMacCellId(), this, UL);
}
if (lteInfo->getFrameType() == DATAPKT && lteInfo->getUserTxParams() != nullptr)
{
double cqi = lteInfo->getUserTxParams()->readCqiVector()[lteInfo->getCw()];
if (lteInfo->getDirection() == UL)
emit(averageCqiUl_, cqi);
else if (lteInfo->getDirection() == D2D)
emit(averageCqiD2D_, cqi);
}
LtePhyBase::handleUpperMessage(msg);
}
double LtePhyUe::updateHysteresisTh(double v)
{
if (hysteresisFactor_ == 0)
return 0;
else
return v / hysteresisFactor_;
}
void LtePhyUe::deleteOldBuffers(MacNodeId masterId)
{
OmnetId masterOmnetId = binder_->getOmnetId(masterId);
/* Delete Mac Buffers */
// delete macBuffer[nodeId_] at old master
LteMacEnb *masterMac = check_and_cast<LteMacEnb *>(getSimulation()->getModule(masterOmnetId)->
getSubmodule("lteNic")->getSubmodule("mac"));
masterMac->deleteQueues(nodeId_);
// delete queues for master at this ue
mac_->deleteQueues(masterId_);
/* Delete Rlc UM Buffers */
// delete UmTxQueue[nodeId_] at old master
LteRlcUm *masterRlcUm = check_and_cast<LteRlcUm*>(getSimulation()->getModule(masterOmnetId)->
getSubmodule("lteNic")->getSubmodule("rlc")->getSubmodule("um"));
masterRlcUm->deleteQueues(nodeId_);
// delete queues for master at this ue
rlcUm_->deleteQueues(nodeId_);
}
DasFilter* LtePhyUe::getDasFilter()
{
return das_;
}
void LtePhyUe::sendFeedback(LteFeedbackDoubleVector fbDl, LteFeedbackDoubleVector fbUl, FeedbackRequest req)
{
Enter_Method("SendFeedback");
EV << "LtePhyUe: feedback from Feedback Generator" << endl;
//Create a feedback packet
auto fbPkt = makeShared<LteFeedbackPkt>();
//Set the feedback
fbPkt->setLteFeedbackDoubleVectorDl(fbDl);
fbPkt->setLteFeedbackDoubleVectorDl(fbUl);
fbPkt->setSourceNodeId(nodeId_);
auto pkt = new Packet("feedback_pkt");
pkt->insertAtFront(fbPkt);
UserControlInfo* uinfo = new UserControlInfo();
uinfo->setSourceId(nodeId_);
uinfo->setDestId(masterId_);
uinfo->setFrameType(FEEDBACKPKT);
uinfo->setIsCorruptible(false);
// create LteAirFrame and encapsulate a feedback packet
LteAirFrame* frame = new LteAirFrame("feedback_pkt");
frame->encapsulate(check_and_cast<cPacket*>(pkt));
uinfo->feedbackReq = req;
uinfo->setDirection(UL);
simtime_t signalLength = TTI;
uinfo->setTxPower(txPower_);
// initialize frame fields
frame->setSchedulingPriority(airFramePriority_);
frame->setDuration(signalLength);
uinfo->setCoord(getRadioPosition());
frame->setControlInfo(uinfo);
//TODO access speed data Update channel index
// if (coherenceTime(move.getSpeed())<(NOW-lastFeedback_)){
// cellInfo_->channelIncrease(nodeId_);
// cellInfo_->lambdaIncrease(nodeId_,1);
// }
lastFeedback_ = NOW;
EV << "LtePhy: " << nodeTypeToA(nodeType_) << " with id "
<< nodeId_ << " sending feedback to the air channel" << endl;
sendUnicast(frame);
}
void LtePhyUe::finish()
{
if (getSimulation()->getSimulationStage() != CTX_FINISH)
{
// do this only at deletion of the module during the simulation
// clear buffers
deleteOldBuffers(masterId_);
// amc calls
LteAmc *amc = getAmcModule(masterId_);
if (amc != nullptr)
{
amc->detachUser(nodeId_, UL);
amc->detachUser(nodeId_, DL);
}
// binder call
binder_->unregisterNextHop(masterId_, nodeId_);
// cellInfo call
cellInfo_->detachUser(nodeId_);
}
}