A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
microwave-oven-spectrum-value-helper.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 CTTC
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Nicola Baldo <nbaldo@cttc.es>
7
*/
8
9
#include "
microwave-oven-spectrum-value-helper.h
"
10
11
#include "ns3/log.h"
12
13
namespace
ns3
14
{
15
16
NS_LOG_COMPONENT_DEFINE
(
"MicrowaveOvenSpectrumValue"
);
17
18
/// Spectrum model for the 5MHz model (model #2)
19
static
Ptr<SpectrumModel>
g_MicrowaveOvenSpectrumModel5Mhz
;
20
/// Spectrum model for the 6MHz model (model #1)
21
static
Ptr<SpectrumModel>
g_MicrowaveOvenSpectrumModel6Mhz
;
22
23
/**
24
* \ingroup spectrum
25
* Init a static class containing the MWO #2 model (5Mhz)
26
*/
27
static
class
MicrowaveOvenSpectrumModel5MhzInitializer
28
{
29
public
:
30
MicrowaveOvenSpectrumModel5MhzInitializer
()
31
{
32
NS_LOG_FUNCTION
(
this
);
33
Bands
bands;
34
for
(
double
fl = 2400e6; fl < 2499e6; fl += 5e6)
35
{
36
BandInfo
bi;
37
bi.
fl
= fl;
38
bi.
fc
= fl + 5e6;
39
bi.
fh
= fl + 10e6;
40
bands.push_back(bi);
41
}
42
NS_LOG_LOGIC
(
"bands.size () :"
<< bands.size());
43
g_MicrowaveOvenSpectrumModel5Mhz
=
Create<SpectrumModel>
(bands);
44
}
45
}
g_MicrowaveOvenSpectrumModel5MhzInitializerInstance
;
//!< MWO model #2
46
47
/**
48
* \ingroup spectrum
49
* Init a static class containing the MWO #1 model (6Mhz)
50
*/
51
static
class
MicrowaveOvenSpectrumModel6MhzInitializer
52
{
53
public
:
54
MicrowaveOvenSpectrumModel6MhzInitializer
()
55
{
56
NS_LOG_FUNCTION
(
this
);
57
Bands
bands;
58
for
(
double
fl = 2360e6; fl < 2479e6; fl += 6e6)
59
{
60
BandInfo
bi;
61
bi.
fl
= fl;
62
bi.
fc
= fl + 6e6;
63
bi.
fh
= fl + 12e6;
64
bands.push_back(bi);
65
}
66
NS_LOG_LOGIC
(
"bands.size () :"
<< bands.size());
67
g_MicrowaveOvenSpectrumModel6Mhz
=
Create<SpectrumModel>
(bands);
68
}
69
}
g_MicrowaveOvenSpectrumModel6MhzInitializerInstance
;
//!< MWO model #1
70
71
Ptr<SpectrumValue>
72
MicrowaveOvenSpectrumValueHelper::CreatePowerSpectralDensityMwo1
()
73
{
74
Ptr<SpectrumValue>
psd =
Create<SpectrumValue>
(
g_MicrowaveOvenSpectrumModel6Mhz
);
75
76
// values from this paper:
77
// Tanim M. Taher, Matthew J. Misurac, Joseph L. LoCicero, and Donald R. Ucci,
78
// "MICROWAVE OVEN SIGNAL MODELING", in Proc. of IEEE WCNC, 2008,
79
// see Figure 3, "Experimental PSD of MWO #1"
80
// the figure has a resolution of 12 MHz per division; we use a
81
// SpectrumModel with a per-subband bandwidth of 6MHz, so we have
82
// two samples per division. The values used here are an approximation
83
// of what appears in the figure.
84
85
(*psd)[0] = -67.5;
86
(*psd)[1] = -67.5;
87
(*psd)[2] = -67.5;
88
(*psd)[3] = -67.5;
89
(*psd)[4] = -67.5;
90
(*psd)[5] = -66;
91
(*psd)[6] = -64;
92
(*psd)[7] = -63;
93
(*psd)[8] = -62.5;
94
(*psd)[9] = -63;
95
(*psd)[10] = -62.5;
96
(*psd)[11] = -62.5;
97
(*psd)[12] = -58;
98
(*psd)[13] = -53.5;
99
(*psd)[14] = -44;
100
(*psd)[15] = -38;
101
(*psd)[16] = -45;
102
(*psd)[17] = -65;
103
(*psd)[18] = -67.5;
104
(*psd)[19] = -67.5;
105
106
// convert to W/Hz
107
(*psd) =
Pow
(10.0, ((*psd) - 30) / 10.0);
108
109
return
psd;
110
}
111
112
Ptr<SpectrumValue>
113
MicrowaveOvenSpectrumValueHelper::CreatePowerSpectralDensityMwo2
()
114
{
115
// values from this paper:
116
// Tanim M. Taher, Matthew J. Misurac, Joseph L. LoCicero, and Donald R. Ucci,
117
// "MICROWAVE OVEN SIGNAL MODELING", in Proc. of IEEE WCNC, 2008,
118
// see Figure 9, "Experimental PSD of actual MWO #2"
119
// the figure has a resolution of 10 MHz per division; we use a
120
// SpectrumModel with a per-subband bandwidth of 5MHz, so we have
121
// two samples per division. The values used here are an approximation
122
// of what appears in the figure.
123
124
Ptr<SpectrumValue>
psd =
Create<SpectrumValue>
(
g_MicrowaveOvenSpectrumModel5Mhz
);
125
126
(*psd)[0] = -68;
127
(*psd)[1] = -68;
128
(*psd)[2] = -68;
129
(*psd)[3] = -68;
130
(*psd)[4] = -65;
131
(*psd)[5] = -62;
132
(*psd)[6] = -56;
133
(*psd)[7] = -55;
134
(*psd)[8] = -47;
135
(*psd)[9] = -40;
136
(*psd)[10] = -37;
137
(*psd)[11] = -33;
138
(*psd)[12] = -45;
139
(*psd)[13] = -67;
140
(*psd)[14] = -68;
141
(*psd)[15] = -68;
142
(*psd)[16] = -68;
143
(*psd)[17] = -68;
144
(*psd)[18] = -68;
145
(*psd)[19] = -68;
146
147
// convert to W/Hz
148
(*psd) =
Pow
(10.0, ((*psd) - 30) / 10.0);
149
150
return
psd;
151
}
152
153
}
// namespace ns3
ns3::MicrowaveOvenSpectrumModel5MhzInitializer
Init a static class containing the MWO #2 model (5Mhz)
Definition
microwave-oven-spectrum-value-helper.cc:28
ns3::MicrowaveOvenSpectrumModel5MhzInitializer::MicrowaveOvenSpectrumModel5MhzInitializer
MicrowaveOvenSpectrumModel5MhzInitializer()
Definition
microwave-oven-spectrum-value-helper.cc:30
ns3::MicrowaveOvenSpectrumModel6MhzInitializer
Init a static class containing the MWO #1 model (6Mhz)
Definition
microwave-oven-spectrum-value-helper.cc:52
ns3::MicrowaveOvenSpectrumModel6MhzInitializer::MicrowaveOvenSpectrumModel6MhzInitializer
MicrowaveOvenSpectrumModel6MhzInitializer()
Definition
microwave-oven-spectrum-value-helper.cc:54
ns3::MicrowaveOvenSpectrumValueHelper::CreatePowerSpectralDensityMwo1
static Ptr< SpectrumValue > CreatePowerSpectralDensityMwo1()
Definition
microwave-oven-spectrum-value-helper.cc:72
ns3::MicrowaveOvenSpectrumValueHelper::CreatePowerSpectralDensityMwo2
static Ptr< SpectrumValue > CreatePowerSpectralDensityMwo2()
Definition
microwave-oven-spectrum-value-helper.cc:113
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition
log.h:271
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:229
ns3::Create
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition
ptr.h:436
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:527
ns3::Bands
std::vector< BandInfo > Bands
Container of BandInfo.
Definition
spectrum-model.h:49
ns3::g_MicrowaveOvenSpectrumModel6Mhz
static Ptr< SpectrumModel > g_MicrowaveOvenSpectrumModel6Mhz
Spectrum model for the 6MHz model (model #1)
Definition
microwave-oven-spectrum-value-helper.cc:21
ns3::g_MicrowaveOvenSpectrumModel5Mhz
static Ptr< SpectrumModel > g_MicrowaveOvenSpectrumModel5Mhz
Spectrum model for the 5MHz model (model #2)
Definition
microwave-oven-spectrum-value-helper.cc:19
ns3::BandInfo
The building block of a SpectrumModel.
Definition
spectrum-model.h:42
ns3::BandInfo::fc
double fc
center frequency
Definition
spectrum-model.h:44
ns3::BandInfo::fl
double fl
lower limit of subband
Definition
spectrum-model.h:43
ns3::BandInfo::fh
double fh
upper limit of subband
Definition
spectrum-model.h:45
src
spectrum
model
microwave-oven-spectrum-value-helper.cc
Generated on Fri Nov 8 2024 13:59:06 for ns-3 by
1.11.0