A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
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
/* -*- 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"
22
#include "
microwave-oven-spectrum-value-helper.h
"
23
24
namespace
ns3
{
25
26
NS_LOG_COMPONENT_DEFINE
(
"MicrowaveOvenSpectrumValue"
);
27
29
static
Ptr<SpectrumModel>
g_MicrowaveOvenSpectrumModel5Mhz
;
31
static
Ptr<SpectrumModel>
g_MicrowaveOvenSpectrumModel6Mhz
;
32
37
static
class
MicrowaveOvenSpectrumModel5MhzInitializer
38
{
39
public
:
40
MicrowaveOvenSpectrumModel5MhzInitializer
()
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
}
55
}
g_MicrowaveOvenSpectrumModel5MhzInitializerInstance
;
56
57
58
63
static
class
MicrowaveOvenSpectrumModel6MhzInitializer
64
{
65
public
:
66
MicrowaveOvenSpectrumModel6MhzInitializer
()
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
}
81
}
g_MicrowaveOvenSpectrumModel6MhzInitializerInstance
;
82
83
84
85
86
87
Ptr<SpectrumValue>
88
MicrowaveOvenSpectrumValueHelper::CreatePowerSpectralDensityMwo1
()
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
130
Ptr<SpectrumValue>
131
MicrowaveOvenSpectrumValueHelper::CreatePowerSpectralDensityMwo2
()
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
ns3::MicrowaveOvenSpectrumModel5MhzInitializer
Init a static class containing the MWO #2 model (5Mhz)
Definition:
microwave-oven-spectrum-value-helper.cc:38
ns3::MicrowaveOvenSpectrumModel5MhzInitializer::MicrowaveOvenSpectrumModel5MhzInitializer
MicrowaveOvenSpectrumModel5MhzInitializer()
Definition:
microwave-oven-spectrum-value-helper.cc:40
ns3::MicrowaveOvenSpectrumModel6MhzInitializer
Init a static class containing the MWO #1 model (6Mhz)
Definition:
microwave-oven-spectrum-value-helper.cc:64
ns3::MicrowaveOvenSpectrumModel6MhzInitializer::MicrowaveOvenSpectrumModel6MhzInitializer
MicrowaveOvenSpectrumModel6MhzInitializer()
Definition:
microwave-oven-spectrum-value-helper.cc:66
ns3::MicrowaveOvenSpectrumValueHelper::CreatePowerSpectralDensityMwo1
static Ptr< SpectrumValue > CreatePowerSpectralDensityMwo1()
Definition:
microwave-oven-spectrum-value-helper.cc:88
ns3::MicrowaveOvenSpectrumValueHelper::CreatePowerSpectralDensityMwo2
static Ptr< SpectrumValue > CreatePowerSpectralDensityMwo2()
Definition:
microwave-oven-spectrum-value-helper.cc:131
ns3::Ptr< SpectrumModel >
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:205
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition:
log.h:289
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:244
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:565
ns3::Bands
std::vector< BandInfo > Bands
Container of BandInfo.
Definition:
spectrum-model.h:59
ns3::g_MicrowaveOvenSpectrumModel6Mhz
static Ptr< SpectrumModel > g_MicrowaveOvenSpectrumModel6Mhz
Spectrum model for the 6MHz model (model #1)
Definition:
microwave-oven-spectrum-value-helper.cc:31
ns3::g_MicrowaveOvenSpectrumModel5Mhz
static Ptr< SpectrumModel > g_MicrowaveOvenSpectrumModel5Mhz
Spectrum model for the 5MHz model (model #2)
Definition:
microwave-oven-spectrum-value-helper.cc:26
ns3::BandInfo
The building block of a SpectrumModel.
Definition:
spectrum-model.h:51
ns3::BandInfo::fc
double fc
center frequency
Definition:
spectrum-model.h:53
ns3::BandInfo::fl
double fl
lower limit of subband
Definition:
spectrum-model.h:52
ns3::BandInfo::fh
double fh
upper limit of subband
Definition:
spectrum-model.h:54
src
spectrum
model
microwave-oven-spectrum-value-helper.cc
Generated on Tue Feb 6 2024 19:21:27 for ns-3 by
1.9.1