A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-simple-spectrum-phy.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014 Piotr Gawlowicz
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Piotr Gawlowicz <gawlowicz.p@gmail.com>
7 *
8 */
9
11
12#include "ns3/lte-net-device.h"
13#include "ns3/lte-phy-tag.h"
14#include "ns3/lte-spectrum-signal-parameters.h"
15#include <ns3/antenna-model.h>
16#include <ns3/boolean.h>
17#include <ns3/double.h>
18#include <ns3/log.h>
19#include <ns3/simulator.h>
20
21#include <cmath>
22
23namespace ns3
24{
25
26NS_LOG_COMPONENT_DEFINE("LteSimpleSpectrumPhy");
27
28NS_OBJECT_ENSURE_REGISTERED(LteSimpleSpectrumPhy);
29
34
39
40void
42{
43 NS_LOG_FUNCTION(this);
44 m_channel = nullptr;
45 m_mobility = nullptr;
46 m_device = nullptr;
48}
49
52{
53 static TypeId tid =
54 TypeId("ns3::LteSimpleSpectrumPhy")
56 .AddTraceSource("RxStart",
57 "Data reception start",
59 "ns3::SpectrumValue::TracedCallback");
60 return tid;
61}
62
65{
66 NS_LOG_FUNCTION(this);
67 return m_device;
68}
69
76
77void
83
84void
90
91void
97
103
106{
107 return m_antenna;
108}
109
110void
112{
113 NS_LOG_DEBUG("LteSimpleSpectrumPhy::StartRx");
114
115 NS_LOG_FUNCTION(this << spectrumRxParams);
116 Ptr<const SpectrumValue> rxPsd = spectrumRxParams->psd;
117 Time duration = spectrumRxParams->duration;
118
119 // the device might start RX only if the signal is of a type
120 // understood by this device - in this case, an LTE signal.
123 if (lteDataRxParams)
124 {
125 if (m_cellId > 0)
126 {
127 if (m_cellId == lteDataRxParams->cellId)
128 {
129 m_rxStart(rxPsd);
130 }
131 }
132 else
133 {
134 m_rxStart(rxPsd);
135 }
136 }
137}
138
139void
145
146void
148{
149 NS_LOG_FUNCTION(this);
150 m_cellId = cellId;
151}
152
153} // namespace ns3
void SetMobility(Ptr< MobilityModel > m) override
Set the mobility model associated with this device.
Ptr< NetDevice > GetDevice() const override
Get the associated NetDevice instance.
Ptr< SpectrumChannel > m_channel
the channel
void SetRxSpectrumModel(Ptr< const SpectrumModel > model)
Set receive spectrum model.
void DoDispose() override
Destructor implementation.
Ptr< MobilityModel > GetMobility() const override
Get the associated MobilityModel instance.
Ptr< const SpectrumModel > GetRxSpectrumModel() const override
Ptr< AntennaModel > m_antenna
the antenna model
void SetDevice(Ptr< NetDevice > d) override
Set the associated NetDevice instance.
void StartRx(Ptr< SpectrumSignalParameters > params) override
Notify the SpectrumPhy instance of an incoming signal.
Ptr< Object > GetAntenna() const override
Get the AntennaModel used by this SpectrumPhy instance for transmission and/or reception.
Ptr< NetDevice > m_device
the device
Ptr< const SpectrumModel > m_rxSpectrumModel
the spectrum model
TracedCallback< Ptr< const SpectrumValue > > m_rxStart
receive start trace callback function
static TypeId GetTypeId()
Get the type ID.
Ptr< MobilityModel > m_mobility
the mobility model
void SetCellId(uint16_t cellId)
Set cell ID.
void SetChannel(Ptr< SpectrumChannel > c) override
Set the channel attached to this device.
virtual void DoDispose()
Destructor implementation.
Definition object.cc:433
Smart pointer class similar to boost::intrusive_ptr.
Abstract base class for Spectrum-aware PHY layers.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Definition ptr.h:580