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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Nicola Baldo <nbaldo@cttc.es>
7
*/
8
9
#ifndef SPECTRUM_ANALYZER_HELPER_H
10
#define SPECTRUM_ANALYZER_HELPER_H
11
12
#include <ns3/attribute.h>
13
#include <ns3/net-device-container.h>
14
#include <ns3/node-container.h>
15
#include <ns3/object-factory.h>
16
#include <ns3/queue.h>
17
18
#include <string>
19
20
namespace
ns3
21
{
22
23
class
SpectrumValue;
24
class
SpectrumChannel;
25
class
SpectrumModel;
26
27
/**
28
* \ingroup spectrum
29
* \brief Class to allow the Spectrum Analysis
30
*/
31
class
SpectrumAnalyzerHelper
32
{
33
public
:
34
SpectrumAnalyzerHelper
();
35
~SpectrumAnalyzerHelper
();
36
37
/**
38
* Set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper
39
*
40
* @param channel
41
*/
42
void
SetChannel
(
Ptr<SpectrumChannel>
channel);
43
44
/**
45
* Set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper
46
*
47
* @param channelName
48
*/
49
void
SetChannel
(std::string channelName);
50
51
/**
52
* @param name the name of the attribute to set
53
* @param v the value of the attribute
54
*
55
* Set these attributes on each HdOfdmSpectrumPhy instance to be created
56
*/
57
void
SetPhyAttribute
(std::string name,
const
AttributeValue
& v);
58
59
/**
60
* @param n1 the name of the attribute to set
61
* @param v1 the value of the attribute to set
62
*
63
* Set these attributes on each AlohaNoackNetDevice created
64
*/
65
void
SetDeviceAttribute
(std::string n1,
const
AttributeValue
& v1);
66
67
/**
68
* \tparam Ts \deduced Argument types
69
* \param type the type of the model to set
70
* \param [in] args Name and AttributeValue pairs to set.
71
*
72
* Configure the AntennaModel instance for each new device to be created
73
*/
74
template
<
typename
... Ts>
75
void
SetAntenna
(std::string type, Ts&&... args);
76
77
/**
78
* Set the spectrum model used by the created SpectrumAnalyzer instances to represent incoming
79
* signals
80
*
81
* @param m
82
*/
83
void
SetRxSpectrumModel
(
Ptr<SpectrumModel>
m);
84
85
/**
86
* Enable ASCII output. This will create one filename for every created SpectrumAnalyzer
87
* instance.
88
*
89
* @param prefix the prefix of the filename of the traces that will be created.
90
*/
91
void
EnableAsciiAll
(std::string prefix);
92
93
/**
94
* @param c the set of nodes on which a device must be created
95
* @return a device container which contains all the devices created by this method.
96
*/
97
NetDeviceContainer
Install
(
NodeContainer
c)
const
;
98
/**
99
* @param node the node on which a device must be created
100
* \returns a device container which contains all the devices created by this method.
101
*/
102
NetDeviceContainer
Install
(
Ptr<Node>
node)
const
;
103
/**
104
* @param nodeName the name of node on which a device must be created
105
* @return a device container which contains all the devices created by this method.
106
*/
107
NetDeviceContainer
Install
(std::string nodeName)
const
;
108
109
private
:
110
ObjectFactory
m_phy
;
//!< Object factory for the phy objects
111
ObjectFactory
m_device
;
//!< Object factory for the NetDevice objects
112
ObjectFactory
m_antenna
;
//!< Object factory for the Antenna objects
113
114
Ptr<SpectrumChannel>
m_channel
;
//!< Channel
115
Ptr<SpectrumModel>
m_rxSpectrumModel
;
//!< Spectrum model
116
std::string
m_prefix
;
//!< Prefix for the output files
117
};
118
119
/***************************************************************
120
* Implementation of the templates declared above.
121
***************************************************************/
122
123
template
<
typename
... Ts>
124
void
125
SpectrumAnalyzerHelper::SetAntenna
(std::string type, Ts&&... args)
126
{
127
m_antenna
=
ObjectFactory
(type, std::forward<Ts>(args)...);
128
}
129
130
}
// namespace ns3
131
132
#endif
/* SPECTRUM_ANALYZER_HELPER_H */
ns3::AttributeValue
Hold a value for an Attribute.
Definition
attribute.h:59
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition
net-device-container.h:32
ns3::NodeContainer
keep track of a set of node pointers.
Definition
node-container.h:29
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition
object-factory.h:37
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::SpectrumAnalyzerHelper
Class to allow the Spectrum Analysis.
Definition
spectrum-analyzer-helper.h:32
ns3::SpectrumAnalyzerHelper::m_phy
ObjectFactory m_phy
Object factory for the phy objects.
Definition
spectrum-analyzer-helper.h:110
ns3::SpectrumAnalyzerHelper::SetAntenna
void SetAntenna(std::string type, Ts &&... args)
Definition
spectrum-analyzer-helper.h:125
ns3::SpectrumAnalyzerHelper::Install
NetDeviceContainer Install(NodeContainer c) const
Definition
spectrum-analyzer-helper.cc:114
ns3::SpectrumAnalyzerHelper::m_rxSpectrumModel
Ptr< SpectrumModel > m_rxSpectrumModel
Spectrum model.
Definition
spectrum-analyzer-helper.h:115
ns3::SpectrumAnalyzerHelper::SetPhyAttribute
void SetPhyAttribute(std::string name, const AttributeValue &v)
Definition
spectrum-analyzer-helper.cc:86
ns3::SpectrumAnalyzerHelper::SetDeviceAttribute
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
Definition
spectrum-analyzer-helper.cc:93
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:71
ns3::SpectrumAnalyzerHelper::m_antenna
ObjectFactory m_antenna
Object factory for the Antenna objects.
Definition
spectrum-analyzer-helper.h:112
ns3::SpectrumAnalyzerHelper::~SpectrumAnalyzerHelper
~SpectrumAnalyzerHelper()
Definition
spectrum-analyzer-helper.cc:65
ns3::SpectrumAnalyzerHelper::m_prefix
std::string m_prefix
Prefix for the output files.
Definition
spectrum-analyzer-helper.h:116
ns3::SpectrumAnalyzerHelper::EnableAsciiAll
void EnableAsciiAll(std::string prefix)
Enable ASCII output.
Definition
spectrum-analyzer-helper.cc:107
ns3::SpectrumAnalyzerHelper::SpectrumAnalyzerHelper
SpectrumAnalyzerHelper()
Definition
spectrum-analyzer-helper.cc:57
ns3::SpectrumAnalyzerHelper::m_channel
Ptr< SpectrumChannel > m_channel
Channel.
Definition
spectrum-analyzer-helper.h:114
ns3::SpectrumAnalyzerHelper::m_device
ObjectFactory m_device
Object factory for the NetDevice objects.
Definition
spectrum-analyzer-helper.h:111
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:100
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
spectrum
helper
spectrum-analyzer-helper.h
Generated on Fri Nov 8 2024 13:59:06 for ns-3 by
1.11.0