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 */
An identifier for simulation events.
Definition: event-id.h:54
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:46
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
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 StartRx(Ptr< SpectrumSignalParameters > params)
Notify the SpectrumPhy instance of an incoming signal.
void SetMobility(Ptr< MobilityModel > m)
Set the mobility model associated with this device.
void SetChannel(Ptr< SpectrumChannel > c)
Set the channel attached to this device.
EventId m_nextWave
Next waveform generation event.
TracedCallback< Ptr< const Packet > > m_phyTxStartTrace
TracedCallback: Tx start.
Ptr< MobilityModel > m_mobility
Mobility model.
void SetDevice(Ptr< NetDevice > d)
Set the associated NetDevice instance.
Ptr< AntennaModel > m_antenna
Antenna model.
void SetAntenna(Ptr< AntennaModel > a)
set the AntennaModel to be used
Ptr< SpectrumChannel > m_channel
Channel.
Ptr< NetDevice > GetDevice() const
Get the associated NetDevice instance.
virtual void GenerateWaveform()
Generates a waveform.
Ptr< NetDevice > m_netDevice
Owning NetDevice.
Ptr< const SpectrumModel > GetRxSpectrumModel() const
Ptr< MobilityModel > GetMobility() const
Get the associated MobilityModel instance.
Ptr< SpectrumValue > m_txPowerSpectralDensity
Tx PSD.
virtual void Start()
Start the waveform generator.
virtual void DoDispose(void)
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)
static TypeId GetTypeId(void)
Get the type ID.
void SetPeriod(Time period)
Set the period according to which the WaveformGenerator switches on and off.
virtual void Stop()
Stop the waveform generator.
Ptr< AntennaModel > GetRxAntenna() const
Get the AntennaModel used by the NetDevice for reception.
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
TracedCallback: Tx end.
Every class exported by the ns3 library is enclosed in the ns3 namespace.