A Discrete-Event Network Simulator
API
microwave-oven-spectrum-value-helper.cc
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#include "ns3/log.h"
23
24namespace ns3 {
25
26NS_LOG_COMPONENT_DEFINE ("MicrowaveOvenSpectrumValue");
27
32
38{
39public:
41 {
42 NS_LOG_FUNCTION (this);
43 Bands bands;
44 for (double fl = 2400e6; fl < 2499e6; fl += 5e6)
45 {
46 BandInfo bi;
47 bi.fl = fl;
48 bi.fc = fl + 5e6;
49 bi.fh = fl + 10e6;
50 bands.push_back (bi);
51 }
52 NS_LOG_LOGIC ("bands.size () :" << bands.size ());
53 g_MicrowaveOvenSpectrumModel5Mhz = Create<SpectrumModel> (bands);
54 }
56
57
58
64{
65public:
67 {
68 NS_LOG_FUNCTION (this);
69 Bands bands;
70 for (double fl = 2360e6; fl < 2479e6; fl += 6e6)
71 {
72 BandInfo bi;
73 bi.fl = fl;
74 bi.fc = fl + 6e6;
75 bi.fh = fl + 12e6;
76 bands.push_back (bi);
77 }
78 NS_LOG_LOGIC ("bands.size () :" << bands.size ());
79 g_MicrowaveOvenSpectrumModel6Mhz = Create<SpectrumModel> (bands);
80 }
82
83
84
85
86
87Ptr<SpectrumValue>
89{
90 Ptr<SpectrumValue> psd = Create <SpectrumValue> (g_MicrowaveOvenSpectrumModel6Mhz);
91
92 // values from this paper:
93 // Tanim M. Taher, Matthew J. Misurac, Joseph L. LoCicero, and Donald R. Ucci,
94 // "MICROWAVE OVEN SIGNAL MODELING", in Proc. of IEEE WCNC, 2008,
95 // see Figure 3, "Experimental PSD of MWO #1"
96 // the figure has a resolution of 12 MHz per division; we use a
97 // SpectrumModel with a per-subband bandwidth of 6MHz, so we have
98 // two samples per division. The values used here are an approximation
99 // of what appears in the figure.
100
101 (*psd)[0] = -67.5;
102 (*psd)[1] = -67.5;
103 (*psd)[2] = -67.5;
104 (*psd)[3] = -67.5;
105 (*psd)[4] = -67.5;
106 (*psd)[5] = -66;
107 (*psd)[6] = -64;
108 (*psd)[7] = -63;
109 (*psd)[8] = -62.5;
110 (*psd)[9] = -63;
111 (*psd)[10] = -62.5;
112 (*psd)[11] = -62.5;
113 (*psd)[12] = -58;
114 (*psd)[13] = -53.5;
115 (*psd)[14] = -44;
116 (*psd)[15] = -38;
117 (*psd)[16] = -45;
118 (*psd)[17] = -65;
119 (*psd)[18] = -67.5;
120 (*psd)[19] = -67.5;
121
122 // convert to W/Hz
123 (*psd) = Pow (10.0, ((*psd) - 30) / 10.0);
124
125 return psd;
126}
127
128
129
132{
133 // values from this paper:
134 // Tanim M. Taher, Matthew J. Misurac, Joseph L. LoCicero, and Donald R. Ucci,
135 // "MICROWAVE OVEN SIGNAL MODELING", in Proc. of IEEE WCNC, 2008,
136 // see Figure 9, "Experimental PSD of actual MWO #2"
137 // the figure has a resolution of 10 MHz per division; we use a
138 // SpectrumModel with a per-subband bandwidth of 5MHz, so we have
139 // two samples per division. The values used here are an approximation
140 // of what appears in the figure.
141
142 Ptr<SpectrumValue> psd = Create <SpectrumValue> (g_MicrowaveOvenSpectrumModel5Mhz);
143
144 (*psd)[0] = -68;
145 (*psd)[1] = -68;
146 (*psd)[2] = -68;
147 (*psd)[3] = -68;
148 (*psd)[4] = -65;
149 (*psd)[5] = -62;
150 (*psd)[6] = -56;
151 (*psd)[7] = -55;
152 (*psd)[8] = -47;
153 (*psd)[9] = -40;
154 (*psd)[10] = -37;
155 (*psd)[11] = -33;
156 (*psd)[12] = -45;
157 (*psd)[13] = -67;
158 (*psd)[14] = -68;
159 (*psd)[15] = -68;
160 (*psd)[16] = -68;
161 (*psd)[17] = -68;
162 (*psd)[18] = -68;
163 (*psd)[19] = -68;
164
165 // convert to W/Hz
166 (*psd) = Pow (10.0, ((*psd) - 30) / 10.0);
167
168 return psd;
169}
170
171
172
173} // namespace ns3
Init a static class containing the MWO #2 model (5Mhz)
Init a static class containing the MWO #1 model (6Mhz)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
#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