A Discrete-Event Network Simulator
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
20namespace ns3
21{
22
23class SpectrumValue;
24class SpectrumChannel;
25class SpectrumModel;
26
27/**
28 * \ingroup spectrum
29 * \brief Class to allow the Spectrum Analysis
30 */
32{
33 public:
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 */
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 */
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 */
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
116 std::string m_prefix; //!< Prefix for the output files
117};
118
119/***************************************************************
120 * Implementation of the templates declared above.
121 ***************************************************************/
122
123template <typename... Ts>
124void
125SpectrumAnalyzerHelper::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 */
Hold a value for an Attribute.
Definition attribute.h:59
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Instantiate subclasses of ns3::Object.
Smart pointer class similar to boost::intrusive_ptr.
Class to allow the Spectrum Analysis.
ObjectFactory m_phy
Object factory for the phy objects.
void SetAntenna(std::string type, Ts &&... args)
NetDeviceContainer Install(NodeContainer c) const
Ptr< SpectrumModel > m_rxSpectrumModel
Spectrum model.
void SetPhyAttribute(std::string name, const AttributeValue &v)
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
void SetChannel(Ptr< SpectrumChannel > channel)
Set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper.
ObjectFactory m_antenna
Object factory for the Antenna objects.
std::string m_prefix
Prefix for the output files.
void EnableAsciiAll(std::string prefix)
Enable ASCII output.
Ptr< SpectrumChannel > m_channel
Channel.
ObjectFactory m_device
Object factory for the NetDevice objects.
void SetRxSpectrumModel(Ptr< SpectrumModel > m)
Set the spectrum model used by the created SpectrumAnalyzer instances to represent incoming signals.
Every class exported by the ns3 library is enclosed in the ns3 namespace.