A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
sub-band.h
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#ifndef SUB_BAND_H
10#define SUB_BAND_H
11
13
14#include "ns3/nstime.h"
15#include "ns3/object.h"
16
17namespace ns3
18{
19namespace lorawan
20{
21
22class LogicalLoraChannel;
23
24/**
25 * \ingroup lorawan
26 *
27 * Class representing a SubBand, i.e., a frequency band subject to some
28 * regulations on duty cycle and transmission power.
29 */
30class SubBand : public Object
31{
32 public:
33 /**
34 * Register this type.
35 * \return The object TypeId.
36 */
37 static TypeId GetTypeId();
38
39 SubBand(); //!< Default constructor
40 ~SubBand() override; //!< Destructor
41
42 /**
43 * Create a new SubBand by specifying all of its properties.
44 *
45 * \param firstFrequency The SubBand's lowest frequency [MHz].
46 * \param lastFrequency The SubBand's highest frequency [MHz].
47 * \param dutyCycle The duty cycle (as a fraction) allowed on this SubBand.
48 * \param maxTxPowerDbm The maximum transmission power [dBm] allowed on this SubBand.
49 */
50 SubBand(double firstFrequency, double lastFrequency, double dutyCycle, double maxTxPowerDbm);
51
52 /**
53 * Get the lowest frequency of the SubBand.
54 *
55 * \return The lowest frequency [MHz] of the SubBand.
56 */
57 double GetFirstFrequency() const;
58
59 ///**
60 // * Get the last frequency of the subband.
61 // *
62 // * \return The lowest frequency [MHz] of the SubBand.
63 // */
64 // double GetLastFrequency ();
65
66 /**
67 * Get the duty cycle of the subband.
68 *
69 * \return The duty cycle (as a fraction) that needs to be enforced on this
70 * SubBand.
71 */
72 double GetDutyCycle() const;
73
74 /**
75 * Update the next transmission time.
76 *
77 * This function is used by LogicalLoraChannelHelper, which computes the time
78 * based on the SubBand's duty cycle and on the transmission duration.
79 *
80 * \param nextTime The future time from which transmission should be allowed
81 * again.
82 */
83 void SetNextTransmissionTime(Time nextTime);
84
85 /**
86 * Returns the next time from which transmission on this subband will be
87 * possible.
88 *
89 * \return The next time at which transmission in this SubBand will be
90 * allowed.
91 */
93
94 /**
95 * Return whether or not a frequency belongs to this SubBand.
96 *
97 * \param frequency The frequency [MHz] we want to test against the current subband.
98 * \return True if the frequency is between firstFrequency and lastFrequency,
99 * false otherwise.
100 */
101 bool BelongsToSubBand(double frequency) const;
102
103 /**
104 * Return whether or not a channel belongs to this SubBand.
105 *
106 * \param channel The channel we want to test against the current subband.
107 * \return True if the channel's center frequency is between firstFrequency
108 * and lastFrequency, false otherwise.
109 */
110 bool BelongsToSubBand(Ptr<LogicalLoraChannel> channel) const;
111
112 /**
113 * Set the maximum transmission power that is allowed on this SubBand.
114 *
115 * \param maxTxPowerDbm The maximum transmission power [dBm] to set.
116 */
117 void SetMaxTxPowerDbm(double maxTxPowerDbm);
118
119 /**
120 * Return the maximum transmission power that is allowed on this SubBand.
121 *
122 * \return The maximum transmission power, in dBm.
123 */
124 double GetMaxTxPowerDbm() const;
125
126 private:
127 double m_firstFrequency; //!< Starting frequency of the subband, in MHz
128 double m_lastFrequency; //!< Ending frequency of the subband, in MHz
129 double m_dutyCycle; //!< The duty cycle that needs to be enforced on this subband
130 Time m_nextTransmissionTime; //!< The next time a transmission will be allowed in this subband
131 double m_maxTxPowerDbm; //!< The maximum transmission power that is admitted on this subband
132};
133} // namespace lorawan
134} // namespace ns3
135#endif /* SUB_BAND_H */
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
Class representing a SubBand, i.e., a frequency band subject to some regulations on duty cycle and tr...
Definition sub-band.h:31
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
Every class exported by the ns3 library is enclosed in the ns3 namespace.