A Discrete-Event Network Simulator
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
10
11#include "ns3/log.h"
12
13namespace ns3
14{
15
16NS_LOG_COMPONENT_DEFINE("MicrowaveOvenSpectrumValue");
17
18/// Spectrum model for the 5MHz model (model #2)
20/// Spectrum model for the 6MHz model (model #1)
22
23/**
24 * \ingroup spectrum
25 * Init a static class containing the MWO #2 model (5Mhz)
26 */
28{
29 public:
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());
44 }
46
47/**
48 * \ingroup spectrum
49 * Init a static class containing the MWO #1 model (6Mhz)
50 */
52{
53 public:
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());
68 }
70
71Ptr<SpectrumValue>
73{
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
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
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
Init a static class containing the MWO #2 model (5Mhz)
Init a static class containing the MWO #1 model (6Mhz)
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
static class ns3::MicrowaveOvenSpectrumModel5MhzInitializer g_MicrowaveOvenSpectrumModel5MhzInitializerInstance
MWO model #2.
static class ns3::MicrowaveOvenSpectrumModel6MhzInitializer g_MicrowaveOvenSpectrumModel6MhzInitializerInstance
MWO model #1.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
SpectrumValue Pow(double lhs, const SpectrumValue &rhs)
std::vector< BandInfo > Bands
Container of BandInfo.
static Ptr< SpectrumModel > g_MicrowaveOvenSpectrumModel6Mhz
Spectrum model for the 6MHz model (model #1)
static Ptr< SpectrumModel > g_MicrowaveOvenSpectrumModel5Mhz
Spectrum model for the 5MHz model (model #2)
The building block of a SpectrumModel.
double fc
center frequency
double fl
lower limit of subband
double fh
upper limit of subband