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 */
virtual void DoDispose(void)
Destructor implementation.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:45
void SetDevice(Ptr< NetDevice > d)
Set the associated NetDevice instance.
Ptr< AntennaModel > m_antenna
Antenna model.
Ptr< MobilityModel > m_mobility
Mobility model.
Forward calls to a chain of Callback.
TracedCallback< Ptr< const Packet > > m_phyTxStartTrace
TracedCallback: Tx start.
Ptr< SpectrumValue > m_txPowerSpectralDensity
Tx PSD.
void StartRx(Ptr< SpectrumSignalParameters > params)
Notify the SpectrumPhy instance of an incoming signal.
void SetChannel(Ptr< SpectrumChannel > c)
Set the channel attached to this device.
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txs)
Set the Power Spectral Density used for outgoing waveforms.
void SetDutyCycle(double value)
virtual void Start()
Start the waveform generator.
Time m_startTime
Start time.
Simple SpectrumPhy implementation that sends customizable waveform.
Ptr< AntennaModel > GetRxAntenna()
Get the AntennaModel used by the NetDevice for reception.
virtual void GenerateWaveform()
Generates a waveform.
static TypeId GetTypeId(void)
Get the type ID.
Ptr< NetDevice > GetDevice() const
Get the associated NetDevice instance.
void SetPeriod(Time period)
Set the period according to which the WaveformGenerator switches on and off.
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
TracedCallback: Tx end.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const SpectrumModel > GetRxSpectrumModel() const
void SetAntenna(Ptr< AntennaModel > a)
set the AntennaModel to be used
virtual void Stop()
Stop the waveform generator.
Ptr< MobilityModel > GetMobility()
Get the associated MobilityModel instance.
An identifier for simulation events.
Definition: event-id.h:53
Ptr< SpectrumChannel > m_channel
Channel.
Ptr< NetDevice > m_netDevice
Owning NetDevice.
void SetMobility(Ptr< MobilityModel > m)
Set the mobility model associated with this device.
double m_dutyCycle
Duty Cycle (should be in [0,1])
EventId m_nextWave
Next waveform generation event.
a unique identifier for an interface.
Definition: type-id.h:58