89 tid = |
89 tid = |
90 TypeId ("ns3::LenaHelper") |
90 TypeId ("ns3::LenaHelper") |
91 .SetParent<Object> () |
91 .SetParent<Object> () |
92 .AddConstructor<LenaHelper> () |
92 .AddConstructor<LenaHelper> () |
93 .AddAttribute ("Scheduler", |
93 .AddAttribute ("Scheduler", |
94 "The type of scheduler to be used for eNBs", |
94 "The type of scheduler to be used for eNBs", |
95 StringValue ("ns3::PfFfMacScheduler"), |
95 StringValue ("ns3::PfFfMacScheduler"), |
96 MakeStringAccessor (&LenaHelper::SetSchedulerType), |
96 MakeStringAccessor (&LenaHelper::SetSchedulerType), |
97 MakeStringChecker ()) |
97 MakeStringChecker ()) |
98 .AddAttribute ("PropagationModel", |
98 .AddAttribute ("PropagationModel", |
99 "The type of propagation model to be used", |
99 "The type of propagation model to be used", |
100 StringValue ("ns3::FriisSpectrumPropagationLossModel"), |
100 StringValue ("ns3::FriisSpectrumPropagationLossModel"), |
101 MakeStringAccessor (&LenaHelper::SetPropagationModelType), |
101 MakeStringAccessor (&LenaHelper::SetPropagationModelType), |
102 MakeStringChecker ()) |
102 MakeStringChecker ()) |
103 ; |
103 ; |
104 return tid; |
104 return tid; |
105 } |
105 } |
106 |
106 |
107 void |
107 void |
108 LenaHelper::SetSchedulerType (std::string type) |
108 LenaHelper::SetSchedulerType (std::string type) |
379 void |
379 void |
380 DlSchedulingCallback (Ptr<MacStatsCalculator> mac, std::string path, |
380 DlSchedulingCallback (Ptr<MacStatsCalculator> mac, std::string path, |
381 uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, |
381 uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, |
382 uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2) |
382 uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2) |
383 { |
383 { |
384 mac->DlScheduling(frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2); |
384 mac->DlScheduling (frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2); |
385 } |
385 } |
386 |
386 |
387 void |
387 void |
388 LenaHelper::EnableDlMacTraces (void) |
388 LenaHelper::EnableDlMacTraces (void) |
389 { |
389 { |
390 Config::Connect("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling", |
390 Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling", |
391 MakeBoundCallback(&DlSchedulingCallback, macStats)); |
391 MakeBoundCallback (&DlSchedulingCallback, macStats)); |
392 } |
392 } |
393 |
393 |
394 void |
394 void |
395 UlSchedulingCallback (Ptr<MacStatsCalculator> mac, std::string path, |
395 UlSchedulingCallback (Ptr<MacStatsCalculator> mac, std::string path, |
396 uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, |
396 uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, |
397 uint8_t mcs, uint16_t size) |
397 uint8_t mcs, uint16_t size) |
398 { |
398 { |
399 mac->UlScheduling(frameNo, subframeNo, rnti, mcs, size); |
399 mac->UlScheduling (frameNo, subframeNo, rnti, mcs, size); |
400 } |
400 } |
401 |
401 |
402 void |
402 void |
403 LenaHelper::EnableUlMacTraces (void) |
403 LenaHelper::EnableUlMacTraces (void) |
404 { |
404 { |
405 Config::Connect("/NodeList/0/DeviceList/0/LteEnbMac/UlScheduling", |
405 Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/UlScheduling", |
406 MakeBoundCallback(&UlSchedulingCallback, macStats)); |
406 MakeBoundCallback (&UlSchedulingCallback, macStats)); |
407 } |
407 } |
408 |
408 |
409 void |
409 void |
410 LenaHelper::EnableRlcTraces (void) |
410 LenaHelper::EnableRlcTraces (void) |
411 { |
411 { |
419 { |
419 { |
420 // Sample path input: |
420 // Sample path input: |
421 // /NodeList/#NodeId/DeviceList/#DeviceId/LteEnbRrc/UeMap/#C-RNTI/RadioBearerMap/#LCID/LteRlc/RxPDU |
421 // /NodeList/#NodeId/DeviceList/#DeviceId/LteEnbRrc/UeMap/#C-RNTI/RadioBearerMap/#LCID/LteRlc/RxPDU |
422 |
422 |
423 // We retrieve the UeInfo accociated to the C-RNTI and perform the IMSI lookup |
423 // We retrieve the UeInfo accociated to the C-RNTI and perform the IMSI lookup |
424 std::string ueMapPath = path.substr (0, path.find("/RadioBearerMap")); |
424 std::string ueMapPath = path.substr (0, path.find ("/RadioBearerMap")); |
425 Config::MatchContainer match = Config::LookupMatches (ueMapPath); |
425 Config::MatchContainer match = Config::LookupMatches (ueMapPath); |
426 |
426 |
427 if (match.GetN () != 0) |
427 if (match.GetN () != 0) |
428 { |
428 { |
429 Ptr<Object> ueInfo = match.Get(0); |
429 Ptr<Object> ueInfo = match.Get (0); |
430 return ueInfo->GetObject<UeInfo> ()->GetImsi (); |
430 return ueInfo->GetObject<UeInfo> ()->GetImsi (); |
431 } |
431 } |
432 else |
432 else |
433 { |
433 { |
434 NS_FATAL_ERROR ("Lookup " << ueMapPath << " got no matches"); |
434 NS_FATAL_ERROR ("Lookup " << ueMapPath << " got no matches"); |
435 } |
435 } |
441 // Sample path input: |
441 // Sample path input: |
442 // /NodeList/1/DeviceList/0/LteUeRrc/RlcMap/1/RxPDU |
442 // /NodeList/1/DeviceList/0/LteUeRrc/RlcMap/1/RxPDU |
443 // /NodeList/#NodeId/DeviceList/#DeviceId/LteUeRrc/RlcMap/#LCID/RxPDU |
443 // /NodeList/#NodeId/DeviceList/#DeviceId/LteUeRrc/RlcMap/#LCID/RxPDU |
444 |
444 |
445 // We retrieve the LteUeNetDevice path |
445 // We retrieve the LteUeNetDevice path |
446 std::string lteUeNetDevicePath = path.substr (0, path.find("/LteUeRrc")); |
446 std::string lteUeNetDevicePath = path.substr (0, path.find ("/LteUeRrc")); |
447 Config::MatchContainer match = Config::LookupMatches (lteUeNetDevicePath); |
447 Config::MatchContainer match = Config::LookupMatches (lteUeNetDevicePath); |
448 |
448 |
449 if (match.GetN () != 0) |
449 if (match.GetN () != 0) |
450 { |
450 { |
451 Ptr<Object> ueNetDevice = match.Get(0); |
451 Ptr<Object> ueNetDevice = match.Get (0); |
452 return ueNetDevice->GetObject<LteUeNetDevice> ()->GetImsi (); |
452 return ueNetDevice->GetObject<LteUeNetDevice> ()->GetImsi (); |
453 } |
453 } |
454 else |
454 else |
455 { |
455 { |
456 NS_FATAL_ERROR ("Lookup " << lteUeNetDevicePath << " got no matches"); |
456 NS_FATAL_ERROR ("Lookup " << lteUeNetDevicePath << " got no matches"); |
457 } |
457 } |
459 } |
459 } |
460 |
460 |
461 |
461 |
462 void |
462 void |
463 DlTxPduCallback (Ptr<RlcStatsCalculator> rlcStats, std::string path, |
463 DlTxPduCallback (Ptr<RlcStatsCalculator> rlcStats, std::string path, |
464 uint16_t rnti, uint8_t lcid, uint32_t packetSize) |
464 uint16_t rnti, uint8_t lcid, uint32_t packetSize) |
465 { |
465 { |
466 uint64_t imsi = FindImsiFromEnbRlcPath (path); |
466 uint64_t imsi = FindImsiFromEnbRlcPath (path); |
467 rlcStats->DlTxPdu (imsi, rnti, lcid, packetSize); |
467 rlcStats->DlTxPdu (imsi, rnti, lcid, packetSize); |
468 } |
468 } |
469 |
469 |
470 void |
470 void |
471 DlRxPduCallback (Ptr<RlcStatsCalculator> rlcStats, std::string path, |
471 DlRxPduCallback (Ptr<RlcStatsCalculator> rlcStats, std::string path, |
472 uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay) |
472 uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay) |
473 { |
473 { |
474 uint64_t imsi = FindImsiFromUeRlc (path); |
474 uint64_t imsi = FindImsiFromUeRlc (path); |
475 rlcStats->DlRxPdu (imsi, rnti, lcid, packetSize, delay); |
475 rlcStats->DlRxPdu (imsi, rnti, lcid, packetSize, delay); |
476 } |
476 } |
477 |
477 |
478 void |
478 void |
479 LenaHelper::EnableDlRlcTraces (void) |
479 LenaHelper::EnableDlRlcTraces (void) |
480 { |
480 { |
481 Config::Connect ("/NodeList/*/DeviceList/*/LteEnbRrc/UeMap/*/RadioBearerMap/*/LteRlc/TxPDU", |
481 Config::Connect ("/NodeList/*/DeviceList/*/LteEnbRrc/UeMap/*/RadioBearerMap/*/LteRlc/TxPDU", |
482 MakeBoundCallback(&DlTxPduCallback, rlcStats)); |
482 MakeBoundCallback (&DlTxPduCallback, rlcStats)); |
483 Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/RlcMap/*/RxPDU", |
483 Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/RlcMap/*/RxPDU", |
484 MakeBoundCallback(&DlRxPduCallback, rlcStats)); |
484 MakeBoundCallback (&DlRxPduCallback, rlcStats)); |
485 } |
485 } |
486 |
486 |
487 void |
487 void |
488 UlTxPduCallback(Ptr<RlcStatsCalculator> rlcStats, std::string path, |
488 UlTxPduCallback (Ptr<RlcStatsCalculator> rlcStats, std::string path, |
489 uint16_t rnti, uint8_t lcid, uint32_t packetSize) |
489 uint16_t rnti, uint8_t lcid, uint32_t packetSize) |
490 { |
490 { |
491 uint64_t imsi = FindImsiFromUeRlc (path); |
491 uint64_t imsi = FindImsiFromUeRlc (path); |
492 rlcStats->UlTxPdu (imsi, rnti, lcid, packetSize); |
492 rlcStats->UlTxPdu (imsi, rnti, lcid, packetSize); |
493 } |
493 } |
494 |
494 |
495 void |
495 void |
496 UlRxPduCallback(Ptr<RlcStatsCalculator> rlcStats, std::string path, |
496 UlRxPduCallback (Ptr<RlcStatsCalculator> rlcStats, std::string path, |
497 uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay) |
497 uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay) |
498 { |
498 { |
499 uint64_t imsi = FindImsiFromEnbRlcPath (path); |
499 uint64_t imsi = FindImsiFromEnbRlcPath (path); |
500 rlcStats->UlRxPdu (imsi, rnti, lcid, packetSize, delay); |
500 rlcStats->UlRxPdu (imsi, rnti, lcid, packetSize, delay); |
501 } |
501 } |
502 |
502 |
503 |
503 |
504 |
504 |
505 void |
505 void |
506 LenaHelper::EnableUlRlcTraces (void) |
506 LenaHelper::EnableUlRlcTraces (void) |
507 { |
507 { |
508 Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/RlcMap/*/TxPDU", |
508 Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/RlcMap/*/TxPDU", |
509 MakeBoundCallback(&UlTxPduCallback, rlcStats)); |
509 MakeBoundCallback (&UlTxPduCallback, rlcStats)); |
510 Config::Connect ("/NodeList/0/DeviceList/*/LteEnbRrc/UeMap/*/RadioBearerMap/*/LteRlc/RxPDU", |
510 Config::Connect ("/NodeList/0/DeviceList/*/LteEnbRrc/UeMap/*/RadioBearerMap/*/LteRlc/RxPDU", |
511 MakeBoundCallback(&UlRxPduCallback, rlcStats)); |
511 MakeBoundCallback (&UlRxPduCallback, rlcStats)); |
512 } |
512 } |
513 |
513 |
514 Ptr<RlcStatsCalculator> |
514 Ptr<RlcStatsCalculator> |
515 LenaHelper::GetRlcStats (void) |
515 LenaHelper::GetRlcStats (void) |
516 { |
516 { |