A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
sub-band.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 University of Padova
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Davide Magrin <magrinda@dei.unipd.it>
7 */
8
9#include "sub-band.h"
10
11#include "ns3/log.h"
12
13namespace ns3
14{
15namespace lorawan
16{
17
19
21
22TypeId
24{
25 static TypeId tid = TypeId("ns3::SubBand").SetParent<Object>().SetGroupName("lorawan");
26 return tid;
27}
28
33
34SubBand::SubBand(double firstFrequency,
35 double lastFrequency,
36 double dutyCycle,
37 double maxTxPowerDbm)
38 : m_firstFrequency(firstFrequency),
39 m_lastFrequency(lastFrequency),
40 m_dutyCycle(dutyCycle),
41 m_nextTransmissionTime(Seconds(0)),
42 m_maxTxPowerDbm(maxTxPowerDbm)
43{
44 NS_LOG_FUNCTION(this << firstFrequency << lastFrequency << dutyCycle << maxTxPowerDbm);
45}
46
51
52double
57
58double
60{
61 return m_dutyCycle;
62}
63
64bool
65SubBand::BelongsToSubBand(double frequency) const
66{
67 return (frequency > m_firstFrequency) && (frequency < m_lastFrequency);
68}
69
70bool
72{
73 double frequency = logicalChannel->GetFrequency();
74 return BelongsToSubBand(frequency);
75}
76
77void
82
83Time
88
89void
90SubBand::SetMaxTxPowerDbm(double maxTxPowerDbm)
91{
92 m_maxTxPowerDbm = maxTxPowerDbm;
93}
94
95double
97{
98 return m_maxTxPowerDbm;
99}
100} // namespace lorawan
101} // namespace ns3
A base class which provides memory management and object aggregation.
Definition object.h:78
Smart pointer class similar to boost::intrusive_ptr.
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
double GetDutyCycle() const
Get the last frequency of the subband.
Definition sub-band.cc:59
Time GetNextTransmissionTime()
Returns the next time from which transmission on this subband will be possible.
Definition sub-band.cc:84
Time m_nextTransmissionTime
The next time a transmission will be allowed in this subband.
Definition sub-band.h:130
double m_dutyCycle
The duty cycle that needs to be enforced on this subband.
Definition sub-band.h:129
double m_firstFrequency
Starting frequency of the subband, in MHz.
Definition sub-band.h:127
bool BelongsToSubBand(double frequency) const
Return whether or not a frequency belongs to this SubBand.
Definition sub-band.cc:65
static TypeId GetTypeId()
Register this type.
Definition sub-band.cc:23
void SetNextTransmissionTime(Time nextTime)
Update the next transmission time.
Definition sub-band.cc:78
double GetFirstFrequency() const
Get the lowest frequency of the SubBand.
Definition sub-band.cc:53
~SubBand() override
Destructor.
Definition sub-band.cc:47
double GetMaxTxPowerDbm() const
Return the maximum transmission power that is allowed on this SubBand.
Definition sub-band.cc:96
double m_lastFrequency
Ending frequency of the subband, in MHz.
Definition sub-band.h:128
SubBand()
Default constructor.
Definition sub-band.cc:29
void SetMaxTxPowerDbm(double maxTxPowerDbm)
Set the maximum transmission power that is allowed on this SubBand.
Definition sub-band.cc:90
double m_maxTxPowerDbm
The maximum transmission power that is admitted on this subband.
Definition sub-band.h:131
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#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
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
Every class exported by the ns3 library is enclosed in the ns3 namespace.