A Discrete-Event Network Simulator
API
waveform-generator.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 CTTC
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Nicola Baldo <nbaldo@cttc.es>
18  */
19 
20 #ifndef WAVEFORM_GENERATOR_H
21 #define WAVEFORM_GENERATOR_H
22 
23 #include "spectrum-channel.h"
24 #include "spectrum-phy.h"
25 #include "spectrum-value.h"
26 
27 #include <ns3/event-id.h>
28 #include <ns3/mobility-model.h>
29 #include <ns3/net-device.h>
30 #include <ns3/nstime.h>
31 #include <ns3/packet.h>
32 #include <ns3/trace-source-accessor.h>
33 
34 namespace ns3
35 {
36 
37 class AntennaModel;
38 
53 {
54  public:
56  ~WaveformGenerator() override;
57 
62  static TypeId GetTypeId();
63 
64  // inherited from SpectrumPhy
65  void SetChannel(Ptr<SpectrumChannel> c) override;
66  void SetMobility(Ptr<MobilityModel> m) override;
67  void SetDevice(Ptr<NetDevice> d) override;
68  Ptr<MobilityModel> GetMobility() const override;
69  Ptr<NetDevice> GetDevice() const override;
71  Ptr<Object> GetAntenna() const override;
73 
80 
87  void SetPeriod(Time period);
88 
94  Time GetPeriod() const;
95 
100  void SetDutyCycle(double value);
101 
106  double GetDutyCycle() const;
107 
114 
119  virtual void Start();
120 
125  virtual void Stop();
126 
127  private:
128  void DoDispose() override;
129 
134 
138  virtual void GenerateWaveform();
139 
142  double m_dutyCycle;
145 
148 };
149 
150 } // namespace ns3
151 
152 #endif /* WAVEFORM_GENERATOR_H */
An identifier for simulation events.
Definition: event-id.h:55
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:46
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
Simple SpectrumPhy implementation that sends customizable waveform.
void SetDevice(Ptr< NetDevice > d) override
Set the associated NetDevice instance.
static TypeId GetTypeId()
Get the type ID.
void SetChannel(Ptr< SpectrumChannel > c) override
Set the channel attached to this device.
Ptr< MobilityModel > GetMobility() const override
Get the associated MobilityModel instance.
EventId m_nextWave
Next waveform generation event.
TracedCallback< Ptr< const Packet > > m_phyTxStartTrace
TracedCallback: Tx start.
Ptr< MobilityModel > m_mobility
Mobility model.
Ptr< Object > GetAntenna() const override
Get the AntennaModel used by this SpectrumPhy instance for transmission and/or reception.
Ptr< AntennaModel > m_antenna
Antenna model.
void SetAntenna(Ptr< AntennaModel > a)
set the AntennaModel to be used
void StartRx(Ptr< SpectrumSignalParameters > params) override
Notify the SpectrumPhy instance of an incoming signal.
Ptr< SpectrumChannel > m_channel
Channel.
Ptr< const SpectrumModel > GetRxSpectrumModel() const override
virtual void GenerateWaveform()
Generates a waveform.
Ptr< NetDevice > m_netDevice
Owning NetDevice.
Ptr< NetDevice > GetDevice() const override
Get the associated NetDevice instance.
Ptr< SpectrumValue > m_txPowerSpectralDensity
Tx PSD.
virtual void Start()
Start the waveform generator.
void DoDispose() override
Destructor implementation.
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txs)
Set the Power Spectral Density used for outgoing waveforms.
double m_dutyCycle
Duty Cycle (should be in [0,1])
void SetDutyCycle(double value)
void SetMobility(Ptr< MobilityModel > m) override
Set the mobility model associated with this device.
void SetPeriod(Time period)
Set the period according to which the WaveformGenerator switches on and off.
virtual void Stop()
Stop the waveform generator.
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
TracedCallback: Tx end.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.