A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
microwave-oven-spectrum-value-helper.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 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
21
22#include "ns3/log.h"
23
24namespace ns3
25{
26
27NS_LOG_COMPONENT_DEFINE("MicrowaveOvenSpectrumValue");
28
29/// Spectrum model for the 5MHz model (model #2)
31/// Spectrum model for the 6MHz model (model #1)
33
34/**
35 * \ingroup spectrum
36 * Init a static class containing the MWO #2 model (5Mhz)
37 */
39{
40 public:
42 {
43 NS_LOG_FUNCTION(this);
44 Bands bands;
45 for (double fl = 2400e6; fl < 2499e6; fl += 5e6)
46 {
47 BandInfo bi;
48 bi.fl = fl;
49 bi.fc = fl + 5e6;
50 bi.fh = fl + 10e6;
51 bands.push_back(bi);
52 }
53 NS_LOG_LOGIC("bands.size () :" << bands.size());
54 g_MicrowaveOvenSpectrumModel5Mhz = Create<SpectrumModel>(bands);
55 }
57
58/**
59 * \ingroup spectrum
60 * Init a static class containing the MWO #1 model (6Mhz)
61 */
63{
64 public:
66 {
67 NS_LOG_FUNCTION(this);
68 Bands bands;
69 for (double fl = 2360e6; fl < 2479e6; fl += 6e6)
70 {
71 BandInfo bi;
72 bi.fl = fl;
73 bi.fc = fl + 6e6;
74 bi.fh = fl + 12e6;
75 bands.push_back(bi);
76 }
77 NS_LOG_LOGIC("bands.size () :" << bands.size());
78 g_MicrowaveOvenSpectrumModel6Mhz = Create<SpectrumModel>(bands);
79 }
81
82Ptr<SpectrumValue>
84{
85 Ptr<SpectrumValue> psd = Create<SpectrumValue>(g_MicrowaveOvenSpectrumModel6Mhz);
86
87 // values from this paper:
88 // Tanim M. Taher, Matthew J. Misurac, Joseph L. LoCicero, and Donald R. Ucci,
89 // "MICROWAVE OVEN SIGNAL MODELING", in Proc. of IEEE WCNC, 2008,
90 // see Figure 3, "Experimental PSD of MWO #1"
91 // the figure has a resolution of 12 MHz per division; we use a
92 // SpectrumModel with a per-subband bandwidth of 6MHz, so we have
93 // two samples per division. The values used here are an approximation
94 // of what appears in the figure.
95
96 (*psd)[0] = -67.5;
97 (*psd)[1] = -67.5;
98 (*psd)[2] = -67.5;
99 (*psd)[3] = -67.5;
100 (*psd)[4] = -67.5;
101 (*psd)[5] = -66;
102 (*psd)[6] = -64;
103 (*psd)[7] = -63;
104 (*psd)[8] = -62.5;
105 (*psd)[9] = -63;
106 (*psd)[10] = -62.5;
107 (*psd)[11] = -62.5;
108 (*psd)[12] = -58;
109 (*psd)[13] = -53.5;
110 (*psd)[14] = -44;
111 (*psd)[15] = -38;
112 (*psd)[16] = -45;
113 (*psd)[17] = -65;
114 (*psd)[18] = -67.5;
115 (*psd)[19] = -67.5;
116
117 // convert to W/Hz
118 (*psd) = Pow(10.0, ((*psd) - 30) / 10.0);
119
120 return psd;
121}
122
125{
126 // values from this paper:
127 // Tanim M. Taher, Matthew J. Misurac, Joseph L. LoCicero, and Donald R. Ucci,
128 // "MICROWAVE OVEN SIGNAL MODELING", in Proc. of IEEE WCNC, 2008,
129 // see Figure 9, "Experimental PSD of actual MWO #2"
130 // the figure has a resolution of 10 MHz per division; we use a
131 // SpectrumModel with a per-subband bandwidth of 5MHz, so we have
132 // two samples per division. The values used here are an approximation
133 // of what appears in the figure.
134
135 Ptr<SpectrumValue> psd = Create<SpectrumValue>(g_MicrowaveOvenSpectrumModel5Mhz);
136
137 (*psd)[0] = -68;
138 (*psd)[1] = -68;
139 (*psd)[2] = -68;
140 (*psd)[3] = -68;
141 (*psd)[4] = -65;
142 (*psd)[5] = -62;
143 (*psd)[6] = -56;
144 (*psd)[7] = -55;
145 (*psd)[8] = -47;
146 (*psd)[9] = -40;
147 (*psd)[10] = -37;
148 (*psd)[11] = -33;
149 (*psd)[12] = -45;
150 (*psd)[13] = -67;
151 (*psd)[14] = -68;
152 (*psd)[15] = -68;
153 (*psd)[16] = -68;
154 (*psd)[17] = -68;
155 (*psd)[18] = -68;
156 (*psd)[19] = -68;
157
158 // convert to W/Hz
159 (*psd) = Pow(10.0, ((*psd) - 30) / 10.0);
160
161 return psd;
162}
163
164} // namespace ns3
Init a static class containing the MWO #2 model (5Mhz)
Init a static class containing the MWO #1 model (6Mhz)
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
static class ns3::MicrowaveOvenSpectrumModel5MhzInitializer g_MicrowaveOvenSpectrumModel5MhzInitializerInstance
MWO model #2.
static class ns3::MicrowaveOvenSpectrumModel6MhzInitializer g_MicrowaveOvenSpectrumModel6MhzInitializerInstance
MWO model #1.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
SpectrumValue Pow(double lhs, const SpectrumValue &rhs)
std::vector< BandInfo > Bands
Container of BandInfo.
static Ptr< SpectrumModel > g_MicrowaveOvenSpectrumModel6Mhz
Spectrum model for the 6MHz model (model #1)
static Ptr< SpectrumModel > g_MicrowaveOvenSpectrumModel5Mhz
Spectrum model for the 5MHz model (model #2)
The building block of a SpectrumModel.
double fc
center frequency
double fl
lower limit of subband
double fh
upper limit of subband