A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
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
20
#include "
microwave-oven-spectrum-value-helper.h
"
21
22
#include "ns3/log.h"
23
24
namespace
ns3
25
{
26
27
NS_LOG_COMPONENT_DEFINE
(
"MicrowaveOvenSpectrumValue"
);
28
30
static
Ptr<SpectrumModel>
g_MicrowaveOvenSpectrumModel5Mhz
;
32
static
Ptr<SpectrumModel>
g_MicrowaveOvenSpectrumModel6Mhz
;
33
38
static
class
MicrowaveOvenSpectrumModel5MhzInitializer
39
{
40
public
:
41
MicrowaveOvenSpectrumModel5MhzInitializer
()
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
}
56
}
g_MicrowaveOvenSpectrumModel5MhzInitializerInstance
;
57
62
static
class
MicrowaveOvenSpectrumModel6MhzInitializer
63
{
64
public
:
65
MicrowaveOvenSpectrumModel6MhzInitializer
()
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
}
80
}
g_MicrowaveOvenSpectrumModel6MhzInitializerInstance
;
81
82
Ptr<SpectrumValue>
83
MicrowaveOvenSpectrumValueHelper::CreatePowerSpectralDensityMwo1
()
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
123
Ptr<SpectrumValue>
124
MicrowaveOvenSpectrumValueHelper::CreatePowerSpectralDensityMwo2
()
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
ns3::MicrowaveOvenSpectrumModel5MhzInitializer
Init a static class containing the MWO #2 model (5Mhz)
Definition:
microwave-oven-spectrum-value-helper.cc:39
ns3::MicrowaveOvenSpectrumModel5MhzInitializer::MicrowaveOvenSpectrumModel5MhzInitializer
MicrowaveOvenSpectrumModel5MhzInitializer()
Definition:
microwave-oven-spectrum-value-helper.cc:41
ns3::MicrowaveOvenSpectrumModel6MhzInitializer
Init a static class containing the MWO #1 model (6Mhz)
Definition:
microwave-oven-spectrum-value-helper.cc:63
ns3::MicrowaveOvenSpectrumModel6MhzInitializer::MicrowaveOvenSpectrumModel6MhzInitializer
MicrowaveOvenSpectrumModel6MhzInitializer()
Definition:
microwave-oven-spectrum-value-helper.cc:65
ns3::MicrowaveOvenSpectrumValueHelper::CreatePowerSpectralDensityMwo1
static Ptr< SpectrumValue > CreatePowerSpectralDensityMwo1()
Definition:
microwave-oven-spectrum-value-helper.cc:83
ns3::MicrowaveOvenSpectrumValueHelper::CreatePowerSpectralDensityMwo2
static Ptr< SpectrumValue > CreatePowerSpectralDensityMwo2()
Definition:
microwave-oven-spectrum-value-helper.cc:124
ns3::Ptr< SpectrumModel >
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:202
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition:
log.h:282
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition:
log-macros-enabled.h:240
ns3::g_MicrowaveOvenSpectrumModel5MhzInitializerInstance
static class ns3::MicrowaveOvenSpectrumModel5MhzInitializer g_MicrowaveOvenSpectrumModel5MhzInitializerInstance
MWO model #2.
ns3::g_MicrowaveOvenSpectrumModel6MhzInitializerInstance
static class ns3::MicrowaveOvenSpectrumModel6MhzInitializer g_MicrowaveOvenSpectrumModel6MhzInitializerInstance
MWO model #1.
microwave-oven-spectrum-value-helper.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Pow
SpectrumValue Pow(double lhs, const SpectrumValue &rhs)
Definition:
spectrum-value.cc:530
ns3::Bands
std::vector< BandInfo > Bands
Container of BandInfo.
Definition:
spectrum-model.h:60
ns3::g_MicrowaveOvenSpectrumModel6Mhz
static Ptr< SpectrumModel > g_MicrowaveOvenSpectrumModel6Mhz
Spectrum model for the 6MHz model (model #1)
Definition:
microwave-oven-spectrum-value-helper.cc:32
ns3::g_MicrowaveOvenSpectrumModel5Mhz
static Ptr< SpectrumModel > g_MicrowaveOvenSpectrumModel5Mhz
Spectrum model for the 5MHz model (model #2)
Definition:
microwave-oven-spectrum-value-helper.cc:27
ns3::BandInfo
The building block of a SpectrumModel.
Definition:
spectrum-model.h:53
ns3::BandInfo::fc
double fc
center frequency
Definition:
spectrum-model.h:55
ns3::BandInfo::fl
double fl
lower limit of subband
Definition:
spectrum-model.h:54
ns3::BandInfo::fh
double fh
upper limit of subband
Definition:
spectrum-model.h:56
src
spectrum
model
microwave-oven-spectrum-value-helper.cc
Generated on Sun Mar 3 2024 17:11:08 for ns-3 by
1.9.1