5G-LENA nr-v3.3-159-ga6832aa7
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
cttc-error-model-comparison.cc
Go to the documentation of this file.
1// Copyright (c) 2019 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2//
3// SPDX-License-Identifier: GPL-2.0-only
4
5#include "ns3/applications-module.h"
6#include "ns3/core-module.h"
7#include "ns3/ipv4-global-routing-helper.h"
8#include "ns3/log.h"
9#include "ns3/mobility-module.h"
10#include "ns3/nr-module.h"
11#include "ns3/nr-point-to-point-epc-helper.h"
12#include "ns3/point-to-point-helper.h"
13
43using namespace ns3;
44
45NS_LOG_COMPONENT_DEFINE("CttcErrorModelComparisonExample");
46
47int
48main(int argc, char* argv[])
49{
50 std::string errorModel = "ns3::NrEesmCcT1";
51
52 CommandLine cmd(__FILE__);
53
54 cmd.AddValue("errorModelType",
55 "Error model type: ns3::NrEesmCcT1, ns3::NrEesmCcT2, ns3::NrEesmIrT1, "
56 "ns3::NrEesmIrT2, ns3::NrLteMiErrorModel",
57 errorModel);
58
59 cmd.Parse(argc, argv);
60
61 /*
62 * TODO: remove all the instances of SetDefault, NrEesmErrorModel, NrAmc
63 */
64 Config::SetDefault("ns3::NrAmc::ErrorModelType", TypeIdValue(TypeId::LookupByName(errorModel)));
65 Config::SetDefault("ns3::NrAmc::AmcModel", EnumValue(NrAmc::ShannonModel));
66
67 // Compute number of RBs that fit in 100 MHz channel bandwidth with numerology 4 (240 kHz SCS)
68 const uint8_t numerology = 4;
69 const uint32_t bandwidth = 100e6;
70 const uint32_t numRbsInBandwidth = bandwidth / (15e3 * std::pow(2, numerology) * 12);
71
72 Ptr<NrAmc> amc = CreateObject<NrAmc>();
73 amc->SetDlMode();
74
75 std::string tbs;
76 for (uint32_t mcs = 0; mcs <= amc->GetMaxMcs(); ++mcs)
77 {
78 uint8_t rank{1};
79 std::stringstream ss;
80 ss << "\nResults for DL (UL only in NR case): MCS " << mcs << ". TBS in 1 RB: ["
81 << amc->CalculateTbSize(mcs, rank, 1) << "] bytes. TBS in 1 sym: ["
82 << amc->CalculateTbSize(mcs, rank, numRbsInBandwidth) << "] bytes.";
83 tbs += ss.str();
84 }
85
86 std::cout << "NUMEROLOGY 4, 100e6 BANDWIDTH, Error Model: ";
87 std::cout << errorModel << ". Results: " << std::endl;
88 std::cout << tbs << std::endl;
89
90 return 0;
91}
@ ShannonModel
Shannon based model (very conservative)
Definition nr-amc.h:80