A Discrete-Event Network Simulator
API
waveform-generator.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 CTTC
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Nicola Baldo <nbaldo@cttc.es>
19  */
20 
21 #ifndef WAVEFORM_GENERATOR_H
22 #define WAVEFORM_GENERATOR_H
23 
24 
25 #include <ns3/spectrum-value.h>
26 #include <ns3/mobility-model.h>
27 #include <ns3/packet.h>
28 #include <ns3/nstime.h>
29 #include <ns3/net-device.h>
30 #include <ns3/spectrum-phy.h>
31 #include <ns3/spectrum-channel.h>
32 #include <ns3/trace-source-accessor.h>
33 #include <ns3/event-id.h>
34 
35 namespace ns3 {
36 
37 
38 class AntennaModel;
39 
54 {
55 
56 public:
58  virtual ~WaveformGenerator ();
59 
64  static TypeId GetTypeId (void);
65 
66  // inherited from SpectrumPhy
69  void SetDevice (Ptr<NetDevice> d);
71  Ptr<NetDevice> GetDevice () const;
75 
76 
83 
90  void SetPeriod (Time period);
91 
92 
98  Time GetPeriod () const;
99 
100 
105  void SetDutyCycle (double value);
106 
111  double GetDutyCycle () const;
112 
118  void SetAntenna (Ptr<AntennaModel> a);
119 
124  virtual void Start ();
125 
130  virtual void Stop ();
131 
132 
133 private:
134  virtual void DoDispose (void);
135 
140 
144  virtual void GenerateWaveform ();
145 
148  double m_dutyCycle;
151 
154 };
155 
156 
157 
158 
159 
160 
161 } // namespace ns3
162 
163 
164 
165 
166 
167 #endif /* WAVEFORM_GENERATOR_H */
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::WaveformGenerator::SetDevice
void SetDevice(Ptr< NetDevice > d)
Set the associated NetDevice instance.
Definition: waveform-generator.cc:122
ns3::WaveformGenerator::Start
virtual void Start()
Start the waveform generator.
Definition: waveform-generator.cc:218
ns3::EventId
An identifier for simulation events.
Definition: event-id.h:54
ns3::WaveformGenerator::GetDevice
Ptr< NetDevice > GetDevice() const
Get the associated NetDevice instance.
Definition: waveform-generator.cc:101
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WaveformGenerator::GetPeriod
Time GetPeriod() const
Definition: waveform-generator.cc:177
ns3::WaveformGenerator::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: waveform-generator.cc:55
ns3::WaveformGenerator::m_phyTxEndTrace
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
TracedCallback: Tx end.
Definition: waveform-generator.h:153
ns3::WaveformGenerator::m_txPowerSpectralDensity
Ptr< SpectrumValue > m_txPowerSpectralDensity
Tx PSD.
Definition: waveform-generator.h:146
ns3::WaveformGenerator::m_startTime
Time m_startTime
Start time.
Definition: waveform-generator.h:149
ns3::WaveformGenerator::m_period
Time m_period
Period.
Definition: waveform-generator.h:147
ns3::WaveformGenerator::m_nextWave
EventId m_nextWave
Next waveform generation event.
Definition: waveform-generator.h:150
ns3::WaveformGenerator::SetTxPowerSpectralDensity
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txs)
Set the Power Spectral Density used for outgoing waveforms.
Definition: waveform-generator.cc:151
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::WaveformGenerator::SetChannel
void SetChannel(Ptr< SpectrumChannel > c)
Set the channel attached to this device.
Definition: waveform-generator.cc:136
ns3::WaveformGenerator::m_antenna
Ptr< AntennaModel > m_antenna
Antenna model.
Definition: waveform-generator.h:137
ns3::SpectrumPhy
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:46
ns3::WaveformGenerator::GetMobility
Ptr< MobilityModel > GetMobility() const
Get the associated MobilityModel instance.
Definition: waveform-generator.cc:108
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::WaveformGenerator::Stop
virtual void Stop()
Stop the waveform generator.
Definition: waveform-generator.cc:231
ns3::WaveformGenerator::m_phyTxStartTrace
TracedCallback< Ptr< const Packet > > m_phyTxStartTrace
TracedCallback: Tx start.
Definition: waveform-generator.h:152
ns3::WaveformGenerator::~WaveformGenerator
virtual ~WaveformGenerator()
Definition: waveform-generator.cc:48
ns3::WaveformGenerator::GenerateWaveform
virtual void GenerateWaveform()
Generates a waveform.
Definition: waveform-generator.cc:198
ns3::WaveformGenerator::StartRx
void StartRx(Ptr< SpectrumSignalParameters > params)
Notify the SpectrumPhy instance of an incoming signal.
Definition: waveform-generator.cc:145
ns3::WaveformGenerator::GetDutyCycle
double GetDutyCycle() const
Definition: waveform-generator.cc:190
ns3::WaveformGenerator
Simple SpectrumPhy implementation that sends customizable waveform.
Definition: waveform-generator.h:54
ns3::WaveformGenerator::GetRxAntenna
Ptr< AntennaModel > GetRxAntenna() const
Get the AntennaModel used by the NetDevice for reception.
Definition: waveform-generator.cc:158
ns3::WaveformGenerator::GetRxSpectrumModel
Ptr< const SpectrumModel > GetRxSpectrumModel() const
Definition: waveform-generator.cc:115
ns3::WaveformGenerator::m_netDevice
Ptr< NetDevice > m_netDevice
Owning NetDevice.
Definition: waveform-generator.h:138
ns3::WaveformGenerator::m_mobility
Ptr< MobilityModel > m_mobility
Mobility model.
Definition: waveform-generator.h:136
ns3::WaveformGenerator::SetAntenna
void SetAntenna(Ptr< AntennaModel > a)
set the AntennaModel to be used
Definition: waveform-generator.cc:164
ns3::WaveformGenerator::WaveformGenerator
WaveformGenerator()
Definition: waveform-generator.cc:37
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition: traced-callback.h:53
ns3::WaveformGenerator::m_dutyCycle
double m_dutyCycle
Duty Cycle (should be in [0,1])
Definition: waveform-generator.h:148
ns3::WaveformGenerator::SetDutyCycle
void SetDutyCycle(double value)
Definition: waveform-generator.cc:185
ns3::WaveformGenerator::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: waveform-generator.cc:68
ns3::WaveformGenerator::m_channel
Ptr< SpectrumChannel > m_channel
Channel.
Definition: waveform-generator.h:139
ns3::WaveformGenerator::SetMobility
void SetMobility(Ptr< MobilityModel > m)
Set the mobility model associated with this device.
Definition: waveform-generator.cc:129
ns3::WaveformGenerator::SetPeriod
void SetPeriod(Time period)
Set the period according to which the WaveformGenerator switches on and off.
Definition: waveform-generator.cc:171