Skip to content

Commit

Permalink
Fix multi-user support in MmWaveSpectrumPhy, update examples (#100)
Browse files Browse the repository at this point in the history
* Fix multi-user support in spectrum phy

* Fix error msg in spectrum phy
  • Loading branch information
pagmatt authored Oct 21, 2022
1 parent 0e8842f commit a402f10
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 29 deletions.
6 changes: 2 additions & 4 deletions src/mmwave/examples/mmwave-amc-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ using namespace mmwave;
NS_LOG_COMPONENT_DEFINE ("MmwaveAmcTest");

double snrUpdateIntervalMs = 100.0; // in ms
double snrIncDb = 0.1; // increment by 10 meters
double snrIncDb = 0.5; // increment by 0.5 dB
double snrMinDb = -7.0; // eNB-UE distance in meters
double snrMaxDb = 30; // eNB-UE distance in meters

Expand Down Expand Up @@ -104,7 +104,6 @@ main (int argc, char *argv[])
uint16_t numEnb = 1;
uint16_t numUe = 1;

double simTime = 1.0;
bool harqEnabled = true;
int mcsDl = 28;
std::string channelState = "n";
Expand All @@ -113,7 +112,6 @@ main (int argc, char *argv[])
CommandLine cmd;
cmd.AddValue ("numEnb", "Number of eNBs", numEnb);
cmd.AddValue ("numUe", "Number of UEs per eNB", numUe);
cmd.AddValue ("simTime", "Total duration of the simulation [s])", simTime);
cmd.AddValue ("harq", "Enable Hybrid ARQ", harqEnabled);
cmd.AddValue ("mcsDl", "Fixed DL MCS", mcsDl);
cmd.AddValue ("channelState", "Channel state 'l'=LOS, 'n'=NLOS, 'a'=all", channelState);
Expand All @@ -123,7 +121,7 @@ main (int argc, char *argv[])
cmd.AddValue ("snrUpdateIntervalMs", "Period after which distance is updated", snrUpdateIntervalMs);
cmd.Parse (argc, argv);

simTime = ((snrMaxDb - snrMinDb) / snrIncDb) * (snrUpdateIntervalMs / 1000.0) + 1;
double simTime = ((snrMaxDb - snrMinDb) / snrIncDb) * (snrUpdateIntervalMs / 1000.0) + 1;

if (mcsDl >= 0 && mcsDl < 29)
{
Expand Down
6 changes: 2 additions & 4 deletions src/mmwave/examples/mmwave-amc-test2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ using namespace mmwave;

NS_LOG_COMPONENT_DEFINE ("MmwaveAmcTest2");

double updateInterval = 2000.0; // in ms
double updateInterval = 100.0; // in ms
double increment = 0.5; // increment by x dB
double lossMin = 100.0;
double lossMax = 145.0;
Expand Down Expand Up @@ -76,7 +76,6 @@ main (int argc, char *argv[])
uint16_t numEnb = 1;
uint16_t numUe = 1;

double simTime = 1.0;
bool harqEnabled = true;
bool rlcAmEnabled = true;
int mcs = -1;
Expand All @@ -86,7 +85,6 @@ main (int argc, char *argv[])
CommandLine cmd;
cmd.AddValue ("numEnb", "Number of eNBs", numEnb);
cmd.AddValue ("numUe", "Number of UEs per eNB", numUe);
cmd.AddValue ("simTime", "Total duration of the simulation [s])", simTime);
cmd.AddValue ("harq", "Enable Hybrid ARQ", harqEnabled);
cmd.AddValue ("mcs", "Fixed DL MCS", mcs);
cmd.AddValue ("channelState", "Channel state 'l'=LOS, 'n'=NLOS", channelState);
Expand All @@ -103,7 +101,7 @@ main (int argc, char *argv[])
lossMin = lossMax - 1;
}

simTime = ((lossMax - lossMin) / increment) * (updateInterval / 1000.0);
double simTime = ((lossMax - lossMin) / increment) * (updateInterval / 1000.0);

if (mcs >= 0 && mcs < 29)
{
Expand Down
2 changes: 1 addition & 1 deletion src/mmwave/examples/mmwave-ca-diff-bandwidth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ main (int argc, char *argv[])
double totalBandwidth = 800e6;
double frequency0 = 28e9;
double frequency1 = 73e9;
double simTime = 5;
double simTime = 1;
std::string condition = "l"; // channel condition, l = LOS, n = NLOS, otherwise the condition is randomly determined

CommandLine cmd;
Expand Down
2 changes: 1 addition & 1 deletion src/mmwave/examples/mmwave-ca-same-bandwidth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ main (int argc, char *argv[])
double totalBandwidth = 800e6;
double frequency0 = 28e9;
double frequency1 = 73e9;
double simTime = 5;
double simTime = 1;
std::string condition = "l"; // channel condition, l = LOS, n = NLOS, otherwise the condition is randomly determined

CommandLine cmd;
Expand Down
4 changes: 1 addition & 3 deletions src/mmwave/examples/mmwave-epc-amc-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ main (int argc, char *argv[])
uint16_t numEnb = 1;
uint16_t numUe = 1;

double simTime = 1.0;
bool harqEnabled = true;
bool rlcAmEnabled = true;
int mcsDl = -1;
Expand All @@ -87,7 +86,6 @@ main (int argc, char *argv[])
CommandLine cmd;
cmd.AddValue ("numEnb", "Number of eNBs", numEnb);
cmd.AddValue ("numUe", "Number of UEs per eNB", numUe);
cmd.AddValue ("simTime", "Total duration of the simulation [s])", simTime);
cmd.AddValue ("harq", "Enable Hybrid ARQ", harqEnabled);
cmd.AddValue ("mcsDl", "Fixed DL MCS", mcsDl);
cmd.AddValue ("channelState", "Channel state 'l'=LOS, 'n'=NLOS, 'a'=all", channelState);
Expand All @@ -98,7 +96,7 @@ main (int argc, char *argv[])
cmd.AddValue ("rlcAm", "Enable RLC-AM", rlcAmEnabled);
cmd.Parse (argc, argv);

simTime = ((lossMax - lossMin) / increment) * (updateInterval / 1000.0);
double simTime = ((lossMax - lossMin) / increment) * (updateInterval / 1000.0);

if (mcsDl >= 0 && mcsDl < 29)
{
Expand Down
2 changes: 1 addition & 1 deletion src/mmwave/examples/mmwave-epc-tdma.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ main (int argc, char *argv[])
{
uint16_t numEnb = 1;
uint16_t numUe = 1;
double simTime = 5.0;
double simTime = 1.0;
double interPacketInterval = 100;
double minDistance = 10.0; // eNB-UE distance in meters
double maxDistance = 200.0; // eNB-UE distance in meters
Expand Down
5 changes: 3 additions & 2 deletions src/mmwave/examples/mmwave-example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ main (int argc, char *argv[])
NodeContainer enbNodes;
NodeContainer ueNodes;
enbNodes.Create (1);
ueNodes.Create (1);
ueNodes.Create (2);

Ptr<ListPositionAllocator> enbPositionAlloc = CreateObject<ListPositionAllocator> ();
enbPositionAlloc->Add (Vector (0.0, 0.0, 0.0));
Expand All @@ -76,7 +76,8 @@ main (int argc, char *argv[])

MobilityHelper uemobility;
Ptr<ListPositionAllocator> uePositionAlloc = CreateObject<ListPositionAllocator> ();
uePositionAlloc->Add (Vector (80.0, 0.0, 0.0));
uePositionAlloc->Add (Vector (80.0, 10.0, 0.0));
uePositionAlloc->Add (Vector (80.0, -10.0, 0.0));

uemobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
uemobility.SetPositionAllocator (uePositionAlloc);
Expand Down
2 changes: 1 addition & 1 deletion src/mmwave/examples/mmwave-simple-epc-ipv6.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ main (int argc, char *argv[])
{
uint16_t numEnb = 1;
uint16_t numUe = 1;
double simTime = 2.0;
double simTime = 1.0;
double interPacketInterval = 100;
double minDistance = 10.0; // eNB-UE distance in meters
double maxDistance = 150.0; // eNB-UE distance in meters
Expand Down
8 changes: 4 additions & 4 deletions src/mmwave/examples/mmwave-tcp-building-example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ main (int argc, char *argv[])
* scenario 3: 6 random located small building, simulate tree and human blockage.
* */
int scenario = 1;
double stopTime = 8;
double simStopTime = 10;
double stopTime = 1.0;
double simStopTime = 1.5;
bool harqEnabled = true;
bool rlcAmEnabled = true;
bool tcp = true;
Expand Down Expand Up @@ -425,8 +425,8 @@ main (int argc, char *argv[])
ueNodes.Get (0)->GetObject<MobilityModel> ()->SetPosition (Vector (70, -2.0, 1.8));
ueNodes.Get (0)->GetObject<ConstantVelocityMobilityModel> ()->SetVelocity (Vector (0, 1.0, 0));

Simulator::Schedule (Seconds (2), &ChangeSpeed, ueNodes.Get (0), Vector (0, 1.5, 0));
Simulator::Schedule (Seconds (22), &ChangeSpeed, ueNodes.Get (0), Vector (0, 0, 0));
Simulator::Schedule (Seconds (0.5), &ChangeSpeed, ueNodes.Get (0), Vector (0, 1.5, 0));
Simulator::Schedule (Seconds (1.0), &ChangeSpeed, ueNodes.Get (0), Vector (0, 0, 0));

BuildingsHelper::Install (ueNodes);

Expand Down
4 changes: 2 additions & 2 deletions src/mmwave/examples/mmwave-tcp-example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ main (int argc, char *argv[])
// beware: proper configuration of the bearing and downtilt angles is needed
Config::SetDefault ("ns3::PhasedArrayModel::AntennaElement", PointerValue (CreateObject<IsotropicAntennaModel> ()));

double stopTime = 8;
double simStopTime = 10;
double stopTime = 1.0;
double simStopTime = 1.5;
Ipv4Address remoteHostAddr;

// Command line arguments
Expand Down
6 changes: 2 additions & 4 deletions src/mmwave/examples/mmwave-tdma.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ using namespace ns3;
using namespace mmwave;

double distUpdateInterval = 100.0; // in ms
double distInc = 0.5; // increment by 10 meters
double distInc = 5.0; // increment by 10 meters

void updateDistance (double dist, Ptr<Node> ue)
{
Expand All @@ -68,7 +68,6 @@ main (int argc, char *argv[])
uint16_t numUe = 1;
double distMin = 15.0; // eNB-UE distance in meters
double distMax = 250.0; // eNB-UE distance in meters
double simTime = 1.0;
bool harqEnabled = true;
int mcsDl = -1;
std::string channelState = "n";
Expand All @@ -77,7 +76,6 @@ main (int argc, char *argv[])
CommandLine cmd;
cmd.AddValue ("numEnb", "Number of eNBs", numEnb);
cmd.AddValue ("numUe", "Number of UEs per eNB", numUe);
cmd.AddValue ("simTime", "Total duration of the simulation [s])", simTime);
cmd.AddValue ("harq", "Enable Hybrid ARQ", harqEnabled);
cmd.AddValue ("mcsDl", "Fixed DL MCS", mcsDl);
cmd.AddValue ("channelState", "Channel state 'l'=LOS, 'n'=NLOS, 'a'=all", channelState);
Expand All @@ -87,7 +85,7 @@ main (int argc, char *argv[])
cmd.AddValue ("distUpdateInterval", "Period after which distance is updated", distUpdateInterval);
cmd.Parse (argc, argv);

simTime = ((distMax - distMin) / distInc) * (distUpdateInterval / 1000.0);
double simTime = ((distMax - distMin) / distInc) * (distUpdateInterval / 1000.0);

if (mcsDl >= 0 && mcsDl < 29)
{
Expand Down
4 changes: 2 additions & 2 deletions src/mmwave/model/mmwave-spectrum-phy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ MmWaveSpectrumPhy::StartRx (Ptr<SpectrumSignalParameters> params)

Ptr<MmWaveEnbNetDevice> enbTx = DynamicCast<MmWaveEnbNetDevice> (params->txPhy->GetDevice ());
Ptr<MmWaveEnbNetDevice> enbRx = DynamicCast<MmWaveEnbNetDevice> (GetDevice ());
if (( enbTx && enbRx) || ( enbTx && enbRx))
if ((enbTx && enbRx) || (!enbTx && !enbRx))
{
NS_LOG_INFO ("BS to BS or UE to UE transmission neglected.");
return;
Expand Down Expand Up @@ -471,7 +471,7 @@ MmWaveSpectrumPhy::StartRxCtrl (Ptr<MmWaveSpectrumSignalParametersDlCtrlFrame> d
switch (m_state)
{
case TX:
NS_FATAL_ERROR ("Cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
NS_FATAL_ERROR ("Cannot RX while TX: according to TDD channel access, the physical layer for transmission cannot be used for reception");
break;

case RX_DATA:
Expand Down

0 comments on commit a402f10

Please sign in to comment.