A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
spectrum-analyzer-helper.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010 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 SPECTRUM_ANALYZER_HELPER_H
21
#define SPECTRUM_ANALYZER_HELPER_H
22
23
#include <ns3/attribute.h>
24
#include <ns3/net-device-container.h>
25
#include <ns3/node-container.h>
26
#include <ns3/object-factory.h>
27
#include <ns3/queue.h>
28
29
#include <string>
30
31
namespace
ns3
32
{
33
34
class
SpectrumValue;
35
class
SpectrumChannel;
36
class
SpectrumModel;
37
38
/**
39
* \ingroup spectrum
40
* \brief Class to allow the Spectrum Analysis
41
*/
42
class
SpectrumAnalyzerHelper
43
{
44
public
:
45
SpectrumAnalyzerHelper
();
46
~SpectrumAnalyzerHelper
();
47
48
/**
49
* Set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper
50
*
51
* @param channel
52
*/
53
void
SetChannel
(
Ptr<SpectrumChannel>
channel);
54
55
/**
56
* Set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper
57
*
58
* @param channelName
59
*/
60
void
SetChannel
(std::string channelName);
61
62
/**
63
* @param name the name of the attribute to set
64
* @param v the value of the attribute
65
*
66
* Set these attributes on each HdOfdmSpectrumPhy instance to be created
67
*/
68
void
SetPhyAttribute
(std::string name,
const
AttributeValue
& v);
69
70
/**
71
* @param n1 the name of the attribute to set
72
* @param v1 the value of the attribute to set
73
*
74
* Set these attributes on each AlohaNoackNetDevice created
75
*/
76
void
SetDeviceAttribute
(std::string n1,
const
AttributeValue
& v1);
77
78
/**
79
* \tparam Ts \deduced Argument types
80
* \param type the type of the model to set
81
* \param [in] args Name and AttributeValue pairs to set.
82
*
83
* Configure the AntennaModel instance for each new device to be created
84
*/
85
template
<
typename
... Ts>
86
void
SetAntenna
(std::string type, Ts&&... args);
87
88
/**
89
* Set the spectrum model used by the created SpectrumAnalyzer instances to represent incoming
90
* signals
91
*
92
* @param m
93
*/
94
void
SetRxSpectrumModel
(
Ptr<SpectrumModel>
m);
95
96
/**
97
* Enable ASCII output. This will create one filename for every created SpectrumAnalyzer
98
* instance.
99
*
100
* @param prefix the prefix of the filename of the traces that will be created.
101
*/
102
void
EnableAsciiAll
(std::string prefix);
103
104
/**
105
* @param c the set of nodes on which a device must be created
106
* @return a device container which contains all the devices created by this method.
107
*/
108
NetDeviceContainer
Install
(
NodeContainer
c)
const
;
109
/**
110
* @param node the node on which a device must be created
111
* \returns a device container which contains all the devices created by this method.
112
*/
113
NetDeviceContainer
Install
(
Ptr<Node>
node)
const
;
114
/**
115
* @param nodeName the name of node on which a device must be created
116
* @return a device container which contains all the devices created by this method.
117
*/
118
NetDeviceContainer
Install
(std::string nodeName)
const
;
119
120
private
:
121
ObjectFactory
m_phy
;
//!< Object factory for the phy objects
122
ObjectFactory
m_device
;
//!< Object factory for the NetDevice objects
123
ObjectFactory
m_antenna
;
//!< Object factory for the Antenna objects
124
125
Ptr<SpectrumChannel>
m_channel
;
//!< Channel
126
Ptr<SpectrumModel>
m_rxSpectrumModel
;
//!< Spectrum model
127
std::string
m_prefix
;
//!< Prefix for the output files
128
};
129
130
/***************************************************************
131
* Implementation of the templates declared above.
132
***************************************************************/
133
134
template
<
typename
... Ts>
135
void
136
SpectrumAnalyzerHelper::SetAntenna
(std::string type, Ts&&... args)
137
{
138
m_antenna
=
ObjectFactory
(type, std::forward<Ts>(args)...);
139
}
140
141
}
// namespace ns3
142
143
#endif
/* SPECTRUM_ANALYZER_HELPER_H */
ns3::AttributeValue
Hold a value for an Attribute.
Definition:
attribute.h:70
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition:
net-device-container.h:43
ns3::NodeContainer
keep track of a set of node pointers.
Definition:
node-container.h:40
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition:
object-factory.h:48
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::SpectrumAnalyzerHelper
Class to allow the Spectrum Analysis.
Definition:
spectrum-analyzer-helper.h:43
ns3::SpectrumAnalyzerHelper::m_phy
ObjectFactory m_phy
Object factory for the phy objects.
Definition:
spectrum-analyzer-helper.h:121
ns3::SpectrumAnalyzerHelper::SetAntenna
void SetAntenna(std::string type, Ts &&... args)
Definition:
spectrum-analyzer-helper.h:136
ns3::SpectrumAnalyzerHelper::Install
NetDeviceContainer Install(NodeContainer c) const
Definition:
spectrum-analyzer-helper.cc:125
ns3::SpectrumAnalyzerHelper::m_rxSpectrumModel
Ptr< SpectrumModel > m_rxSpectrumModel
Spectrum model.
Definition:
spectrum-analyzer-helper.h:126
ns3::SpectrumAnalyzerHelper::SetPhyAttribute
void SetPhyAttribute(std::string name, const AttributeValue &v)
Definition:
spectrum-analyzer-helper.cc:97
ns3::SpectrumAnalyzerHelper::SetDeviceAttribute
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
Definition:
spectrum-analyzer-helper.cc:104
ns3::SpectrumAnalyzerHelper::SetChannel
void SetChannel(Ptr< SpectrumChannel > channel)
Set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper.
Definition:
spectrum-analyzer-helper.cc:82
ns3::SpectrumAnalyzerHelper::m_antenna
ObjectFactory m_antenna
Object factory for the Antenna objects.
Definition:
spectrum-analyzer-helper.h:123
ns3::SpectrumAnalyzerHelper::~SpectrumAnalyzerHelper
~SpectrumAnalyzerHelper()
Definition:
spectrum-analyzer-helper.cc:76
ns3::SpectrumAnalyzerHelper::m_prefix
std::string m_prefix
Prefix for the output files.
Definition:
spectrum-analyzer-helper.h:127
ns3::SpectrumAnalyzerHelper::EnableAsciiAll
void EnableAsciiAll(std::string prefix)
Enable ASCII output.
Definition:
spectrum-analyzer-helper.cc:118
ns3::SpectrumAnalyzerHelper::SpectrumAnalyzerHelper
SpectrumAnalyzerHelper()
Definition:
spectrum-analyzer-helper.cc:68
ns3::SpectrumAnalyzerHelper::m_channel
Ptr< SpectrumChannel > m_channel
Channel.
Definition:
spectrum-analyzer-helper.h:125
ns3::SpectrumAnalyzerHelper::m_device
ObjectFactory m_device
Object factory for the NetDevice objects.
Definition:
spectrum-analyzer-helper.h:122
ns3::SpectrumAnalyzerHelper::SetRxSpectrumModel
void SetRxSpectrumModel(Ptr< SpectrumModel > m)
Set the spectrum model used by the created SpectrumAnalyzer instances to represent incoming signals.
Definition:
spectrum-analyzer-helper.cc:111
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
spectrum
helper
spectrum-analyzer-helper.h
Generated on Tue May 28 2024 23:39:15 for ns-3 by
1.9.6