42#include <ns3/constant-position-mobility-model.h>
43#include <ns3/core-module.h>
45#include <ns3/lr-wpan-module.h>
46#include <ns3/packet.h>
47#include <ns3/propagation-delay-model.h>
48#include <ns3/propagation-loss-model.h>
49#include <ns3/simulator.h>
50#include <ns3/single-model-spectrum-channel.h>
62 std::cout <<
"Results for Energy Scan:"
63 <<
"\nPage: " << params.
m_chPage <<
"\n";
66 std::cout <<
"Channel " <<
static_cast<uint32_t>(i + 11) <<
": "
73main(
int argc,
char* argv[])
93 CreateObject<LogDistancePropagationLossModel>();
95 CreateObject<ConstantSpeedPropagationDelayModel>();
96 channel->AddPropagationLossModel(propModel);
97 channel->SetPropagationDelayModel(delayModel);
110 dev1->
GetMac()->SetMlmeScanConfirmCallback(scb);
113 CreateObject<ConstantPositionMobilityModel>();
114 PanCoordinatorN0Mobility->SetPosition(
Vector(0, 0, 0));
115 dev0->
GetPhy()->SetMobility(PanCoordinatorN0Mobility);
118 CreateObject<ConstantPositionMobilityModel>();
119 endDeviceN1Mobility->SetPosition(
Vector(10, 0, 0));
120 dev1->
GetPhy()->SetMobility(endDeviceN1Mobility);
123 CreateObject<ConstantPositionMobilityModel>();
124 PanCoordinatorN2Mobility->SetPosition(
Vector(40, 0, 0));
125 dev2->
GetPhy()->SetMobility(PanCoordinatorN2Mobility);
134 Simulator::ScheduleWithContext(1,
136 &LrWpanMac::MlmeStartRequest,
147 Simulator::ScheduleWithContext(1,
149 &LrWpanMac::MlmeStartRequest,
164 Simulator::ScheduleWithContext(1,
166 &LrWpanMac::MlmeScanRequest,
170 Simulator::Stop(
Seconds(2000));
173 Simulator::Destroy();
void SetChannel(Ptr< SpectrumChannel > channel)
Set the channel to which the NetDevice, and therefore the PHY, should be attached to.
Ptr< LrWpanMac > GetMac() const
Get the MAC used by this NetDevice.
Ptr< LrWpanPhy > GetPhy() const
Get the PHY used by this NetDevice.
void SetAddress(Address address) override
This method indirects to LrWpanMac::SetShortAddress ()
This class can contain 16 bit addresses.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Vector3D Vector
Vector alias typedef for compatibility with mobility models.
Time Now()
create an ns3::Time instance which contains the current simulation time.
Time Seconds(double value)
Construct a Time in the indicated unit.
static void ScanConfirm(MlmeScanConfirmParams params)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
LogLevel
Logging severity classes and levels.
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
void LogComponentEnableAll(enum LogLevel level)
Enable the logging output for all registered log components.
MLME-SCAN.confirm params.
LrWpanMlmeScanType m_scanType
Indicates the type of scan performed (ED,ACTIVE,PASSIVE,ORPHAN).
uint32_t m_chPage
The channel page on which the scan was performed.
LrWpanMlmeScanConfirmStatus m_status
The status of the scan request.
std::vector< uint8_t > m_energyDetList
A list of energy measurements, one for each channel searched during ED scan (Not valid for Active,...
MLME-SCAN.request params.
uint32_t m_scanChannels
The channel numbers to be scanned.
uint32_t m_chPage
The channel page on which to perform scan.
uint8_t m_scanDuration
A value used to calculate the length of time to spend scanning [aBaseSuperframeDuration * (2^m_scanDu...
LrWpanMlmeScanType m_scanType
Indicates the type of scan performed as described in IEEE 802.15.4-2011 (5.1.2.1).
MLME-START.request params.
uint8_t m_logCh
Logical channel on which to start using the new superframe configuration.
bool m_panCoor
On true this device will become coordinator.
uint8_t m_bcnOrd
Beacon Order, Used to calculate the beacon interval, a value of 15 indicates no periodic beacons will...
uint16_t m_PanId
Pan Identifier used by the device.
uint8_t m_sfrmOrd
Superframe Order, indicates the length of the CAP in time slots.