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
11namespace ns3
12{
13namespace lorawan
14{
15
17
18SubBand::SubBand(uint32_t firstFrequencyHz,
19 uint32_t lastFrequencyHz,
20 double dutyCycle,
21 double maxTxPowerDbm)
22 : m_firstFrequencyHz(firstFrequencyHz),
23 m_lastFrequencyHz(lastFrequencyHz),
24 m_dutyCycle(dutyCycle),
25 m_nextTransmissionTime(Time(0)),
26 m_maxTxPowerDbm(maxTxPowerDbm)
27{
28 NS_LOG_FUNCTION(this << firstFrequencyHz << lastFrequencyHz << dutyCycle << maxTxPowerDbm);
29}
30
36
42
43double
45{
46 return m_dutyCycle;
47}
48
49bool
50SubBand::Contains(uint32_t frequencyHz) const
51{
52 return (frequencyHz > m_firstFrequencyHz) && (frequencyHz < m_lastFrequencyHz);
53}
54
55bool
57{
58 return Contains(logicalChannel->GetFrequency());
59}
60
61void
66
67Time
72
73void
74SubBand::SetMaxTxPowerDbm(double maxTxPowerDbm)
75{
76 m_maxTxPowerDbm = maxTxPowerDbm;
77}
78
79double
81{
82 return m_maxTxPowerDbm;
83}
84} // namespace lorawan
85} // namespace ns3
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
double GetDutyCycle() const
Get the duty cycle of the subband.
Definition sub-band.cc:44
bool Contains(uint32_t frequencyHz) const
Return whether or not a frequency belongs to this SubBand.
Definition sub-band.cc:50
Time GetNextTransmissionTime()
Returns the next time from which transmission on this subband will be possible.
Definition sub-band.cc:68
Time m_nextTransmissionTime
The next time a transmission will be allowed in this subband.
Definition sub-band.h:122
double m_dutyCycle
The duty cycle that needs to be enforced on this subband.
Definition sub-band.h:121
void SetNextTransmissionTime(Time nextTime)
Update the next transmission time.
Definition sub-band.cc:62
uint32_t GetFirstFrequency() const
Get the lowest frequency of the SubBand.
Definition sub-band.cc:32
uint32_t m_firstFrequencyHz
Starting frequency of the subband, in Hz.
Definition sub-band.h:119
double GetMaxTxPowerDbm() const
Return the maximum transmission power that is allowed on this SubBand.
Definition sub-band.cc:80
uint32_t m_lastFrequencyHz
Ending frequency of the subband, in Hz.
Definition sub-band.h:120
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:18
uint32_t GetLastFrequency() const
Get the highest frequency of the SubBand.
Definition sub-band.cc:38
void SetMaxTxPowerDbm(double maxTxPowerDbm)
Set the maximum transmission power that is allowed on this SubBand.
Definition sub-band.cc:74
double m_maxTxPowerDbm
The maximum transmission power that is admitted on this subband.
Definition sub-band.h:123
#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 ",...
Every class exported by the ns3 library is enclosed in the ns3 namespace.