A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
buildings-pathloss-profiler.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Marco Miozzo <marco.miozzo@cttc.es>
7 */
8
9#include "ns3/config-store.h"
10#include "ns3/core-module.h"
11#include "ns3/mobility-module.h"
12#include "ns3/network-module.h"
13#include <ns3/buildings-helper.h>
14#include <ns3/constant-position-mobility-model.h>
15#include <ns3/hybrid-buildings-propagation-loss-model.h>
16
17#include <iomanip>
18#include <string>
19#include <vector>
20
21using namespace ns3;
22using std::vector;
23
24int
25main(int argc, char* argv[])
26{
27 double hEnb = 30.0;
28 double hUe = 1.0;
29 bool enbIndoor = false;
30 bool ueIndoor = false;
31 CommandLine cmd(__FILE__);
32
33 cmd.AddValue("hEnb", "Height of the eNB", hEnb);
34 cmd.AddValue("hUe", "Height of UE", hUe);
35 cmd.AddValue("enbIndoor", "Boolean for eNB Indoor/Outdoor selection", enbIndoor);
36 cmd.AddValue("ueIndoor", "Boolean for UE Indoor/Outdoor selection", ueIndoor);
37 cmd.Parse(argc, argv);
38
39 ConfigStore inputConfig;
40 inputConfig.ConfigureDefaults();
41
42 // parse again so you can override default values from the command line
43 cmd.Parse(argc, argv);
44
45 std::ofstream outFile;
46 outFile.open("buildings-pathloss-profiler.out");
47 if (!outFile.is_open())
48 {
49 NS_FATAL_ERROR("Can't open output file");
50 }
51
53 mmEnb->SetPosition(Vector(0.0, 0.0, hEnb));
54 if (enbIndoor)
55 {
56 Ptr<Building> building1 = CreateObject<Building>(-2, 2, -2, 2, 0.0, 20.0);
57 building1->SetBuildingType(Building::Residential);
58 building1->SetExtWallsType(Building::ConcreteWithWindows);
59 }
60
62 mmEnb->AggregateObject(buildingInfoEnb); // operation usually done by BuildingsHelper::Install
63 buildingInfoEnb->MakeConsistent(mmEnb);
64
65 Ptr<HybridBuildingsPropagationLossModel> propagationLossModel =
67 // cancel shadowing effect
68 propagationLossModel->SetAttribute("ShadowSigmaOutdoor", DoubleValue(0.0));
69 propagationLossModel->SetAttribute("ShadowSigmaIndoor", DoubleValue(0.0));
70 propagationLossModel->SetAttribute("ShadowSigmaExtWalls", DoubleValue(0.0));
71
72 // propagationLossModel->SetAttribute ("Los2NlosThr", DoubleValue (1550.0));
73
74 // for (uint8_t i = 0; i < 23; i++)
75 for (uint32_t i = 1; i < 2300; i++)
76 {
78 mmUe->SetPosition(Vector(i, 0.0, hUe));
80 mmUe->AggregateObject(buildingInfoUe); // operation usually done by BuildingsHelper::Install
81 buildingInfoUe->MakeConsistent(mmUe);
82 double loss = propagationLossModel->GetLoss(mmEnb, mmUe);
83 outFile << i << "\t" << loss << std::endl;
84 }
85
87
88 return 0;
89}
@ ConcreteWithWindows
Definition building.h:58
Parse command-line arguments.
void ConfigureDefaults()
Configure the default values.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition double.h:31
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
Every class exported by the ns3 library is enclosed in the ns3 namespace.