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
12
13namespace ns3
14{
15namespace lorawan
16{
17
19
20SubBand::SubBand(uint32_t firstFrequencyHz,
21 uint32_t lastFrequencyHz,
22 double dutyCycle,
23 double maxTxPowerDbm)
24 : m_firstFrequencyHz(firstFrequencyHz),
25 m_lastFrequencyHz(lastFrequencyHz),
26 m_dutyCycle(dutyCycle),
28 m_maxTxPowerDbm(maxTxPowerDbm)
29{
30 NS_LOG_FUNCTION(this << firstFrequencyHz << lastFrequencyHz << dutyCycle << maxTxPowerDbm);
31}
32
38
44
45double
47{
48 return m_dutyCycle;
49}
50
51bool
52SubBand::Contains(uint32_t frequencyHz) const
53{
54 return (frequencyHz > m_firstFrequencyHz) && (frequencyHz < m_lastFrequencyHz);
55}
56
57bool
59{
60 return Contains(logicalChannel->GetFrequency());
61}
62
63void
68
69Time
74
75void
76SubBand::SetMaxTxPowerDbm(double maxTxPowerDbm)
77{
78 m_maxTxPowerDbm = maxTxPowerDbm;
79}
80
81double
83{
84 return m_maxTxPowerDbm;
85}
86
87} // namespace lorawan
88} // namespace ns3
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
double GetDutyCycle() const
Get the duty cycle of the subband.
Definition sub-band.cc:46
bool Contains(uint32_t frequencyHz) const
Return whether or not a frequency belongs to this SubBand.
Definition sub-band.cc:52
Time GetNextTransmissionTime()
Returns the next time from which transmission on this subband will be possible.
Definition sub-band.cc:70
Time m_nextTransmissionTime
The next time a transmission will be allowed in this subband.
Definition sub-band.h:123
double m_dutyCycle
The duty cycle that needs to be enforced on this subband.
Definition sub-band.h:122
void SetNextTransmissionTime(Time nextTime)
Update the next transmission time.
Definition sub-band.cc:64
uint32_t GetFirstFrequency() const
Get the lowest frequency of the SubBand.
Definition sub-band.cc:34
uint32_t m_firstFrequencyHz
Starting frequency of the subband, in Hz.
Definition sub-band.h:120
double GetMaxTxPowerDbm() const
Return the maximum transmission power that is allowed on this SubBand.
Definition sub-band.cc:82
uint32_t m_lastFrequencyHz
Ending frequency of the subband, in Hz.
Definition sub-band.h:121
SubBand(uint32_t firstFrequencyHz, uint32_t lastFrequencyHz, double dutyCycle, double maxTxPowerDbm)
Create a new SubBand by specifying all of its properties.
Definition sub-band.cc:20
uint32_t GetLastFrequency() const
Get the highest frequency of the SubBand.
Definition sub-band.cc:40
void SetMaxTxPowerDbm(double maxTxPowerDbm)
Set the maximum transmission power that is allowed on this SubBand.
Definition sub-band.cc:76
double m_maxTxPowerDbm
The maximum transmission power that is admitted on this subband.
Definition sub-band.h:124
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:194
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Every class exported by the ns3 library is enclosed in the ns3 namespace.