A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
24 NS_LOG_COMPONENT_DEFINE ("MicrowaveOvenSpectrumValue");
25 
26 namespace ns3 {
27 
28 
31 
32 
34 {
35 public:
37  {
38  NS_LOG_FUNCTION (this);
39  Bands bands;
40  for (double fl = 2400e6; fl < 2499e6; fl += 5e6)
41  {
42  BandInfo bi;
43  bi.fl = fl;
44  bi.fc = fl + 5e6;
45  bi.fh = fl + 10e6;
46  bands.push_back (bi);
47  }
48  NS_LOG_LOGIC ("bands.size () :" << bands.size ());
49  g_MicrowaveOvenSpectrumModel5Mhz = Create<SpectrumModel> (bands);
50  }
52 
53 
54 
56 {
57 public:
59  {
60  NS_LOG_FUNCTION (this);
61  Bands bands;
62  for (double fl = 2360e6; fl < 2479e6; fl += 6e6)
63  {
64  BandInfo bi;
65  bi.fl = fl;
66  bi.fc = fl + 6e6;
67  bi.fh = fl + 12e6;
68  bands.push_back (bi);
69  }
70  NS_LOG_LOGIC ("bands.size () :" << bands.size ());
71  g_MicrowaveOvenSpectrumModel6Mhz = Create<SpectrumModel> (bands);
72  }
74 
75 
76 
77 
78 
79 Ptr<SpectrumValue>
81 {
82  Ptr<SpectrumValue> psd = Create <SpectrumValue> (g_MicrowaveOvenSpectrumModel6Mhz);
83 
84  // values from this paper:
85  // Tanim M. Taher, Matthew J. Misurac, Joseph L. LoCicero, and Donald R. Ucci,
86  // "MICROWAVE OVEN SIGNAL MODELING", in Proc. of IEEE WCNC, 2008,
87  // see Figure 3, "Experimental PSD of MWO #1"
88  // the figure has a resolution of 12 MHz per division; we use a
89  // SpectrumModel with a per-subband bandwidth of 6MHz, so we have
90  // two samples per division. The values used here are an approximation
91  // of what appears in the figure.
92 
93  (*psd)[0] = -67.5;
94  (*psd)[1] = -67.5;
95  (*psd)[2] = -67.5;
96  (*psd)[3] = -67.5;
97  (*psd)[4] = -67.5;
98  (*psd)[5] = -66;
99  (*psd)[6] = -64;
100  (*psd)[7] = -63;
101  (*psd)[8] = -62.5;
102  (*psd)[9] = -63;
103  (*psd)[10] = -62.5;
104  (*psd)[11] = -62.5;
105  (*psd)[12] = -58;
106  (*psd)[13] = -53.5;
107  (*psd)[14] = -44;
108  (*psd)[15] = -38;
109  (*psd)[16] = -45;
110  (*psd)[17] = -65;
111  (*psd)[18] = -67.5;
112  (*psd)[19] = -67.5;
113 
114  // convert to W/Hz
115  (*psd) = Pow (10.0, ((*psd) - 30) / 10.0);
116 
117  return psd;
118 }
119 
120 
121 
124 {
125  // values from this paper:
126  // Tanim M. Taher, Matthew J. Misurac, Joseph L. LoCicero, and Donald R. Ucci,
127  // "MICROWAVE OVEN SIGNAL MODELING", in Proc. of IEEE WCNC, 2008,
128  // see Figure 9, "Experimental PSD of actual MWO #2"
129  // the figure has a resolution of 10 MHz per division; we use a
130  // SpectrumModel with a per-subband bandwidth of 5MHz, so we have
131  // two samples per division. The values used here are an approximation
132  // of what appears in the figure.
133 
134  Ptr<SpectrumValue> psd = Create <SpectrumValue> (g_MicrowaveOvenSpectrumModel5Mhz);
135 
136  (*psd)[0] = -68;
137  (*psd)[1] = -68;
138  (*psd)[2] = -68;
139  (*psd)[3] = -68;
140  (*psd)[4] = -65;
141  (*psd)[5] = -62;
142  (*psd)[6] = -56;
143  (*psd)[7] = -55;
144  (*psd)[8] = -47;
145  (*psd)[9] = -40;
146  (*psd)[10] = -37;
147  (*psd)[11] = -33;
148  (*psd)[12] = -45;
149  (*psd)[13] = -67;
150  (*psd)[14] = -68;
151  (*psd)[15] = -68;
152  (*psd)[16] = -68;
153  (*psd)[17] = -68;
154  (*psd)[18] = -68;
155  (*psd)[19] = -68;
156 
157  // convert to W/Hz
158  (*psd) = Pow (10.0, ((*psd) - 30) / 10.0);
159 
160  return psd;
161 }
162 
163 
164 
165 } // namespace ns3
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
#define NS_LOG_FUNCTION(parameters)
Definition: log.h:345
Ptr< SpectrumModel > g_MicrowaveOvenSpectrumModel6Mhz
std::vector< BandInfo > Bands
NS_LOG_COMPONENT_DEFINE("MicrowaveOvenSpectrumValue")
double fc
center frequency
SpectrumValue Pow(double lhs, const SpectrumValue &rhs)
#define NS_LOG_LOGIC(msg)
Definition: log.h:368
double fl
lower limit of subband
double fh
upper limit of subband
The building block of a SpectrumModel.
class ns3::MicrowaveOvenSpectrumModel6MhzInitializer g_MicrowaveOvenSpectrumModel6MhzInitializerInstance
Ptr< SpectrumModel > g_MicrowaveOvenSpectrumModel5Mhz
class ns3::MicrowaveOvenSpectrumModel5MhzInitializer g_MicrowaveOvenSpectrumModel5MhzInitializerInstance