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