-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathconstellationDiagram_BER_plot.html
More file actions
334 lines (276 loc) · 12.2 KB
/
Copy pathconstellationDiagram_BER_plot.html
File metadata and controls
334 lines (276 loc) · 12.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
<!DOCTYPE html>
<html>
<title>Constellation Diagram</title>
<script src=d3.v5.min.js></script>
<link rel="stylesheet" type="text/css" media="all" href="hlsi.css">
<script src=signal.js></script>
<script src=common.js></script>
<script src=label.js></script>
<script src=sliders.js></script>
<script src=https://cdnjs.cloudflare.com/ajax/libs/mathjs/3.3.0/math.min.js></script>
<script src=constellationDiagram_base.js></script>
<script src=BER_plot.js></script>
<link rel="stylesheet" type="text/css" media="all" href="base.css">
<link rel=stylesheet type=text/css href=sidebar.css />
<body style="margin:0; padding:0; overflow-x:hidden;">
<section class="banner" style="position: fixed; z-index: 11; background: rgba(0,0,0,0.85);top: 0; left: 0; width: 100%; height: 60px; ">
<label for="menu-control" class="hamburger">
<i class="hamburger__icon"></i>
<i class="hamburger__icon"></i>
<i class="hamburger__icon"></i>
</label>
<input type="checkbox" id="menu-control" class="menu-control">
<aside class="sidebar" style="z-index: 10;">
<nav class="sidebar__menu">
<a href="01_bw.html"><b>1</b> Bandwidth</a>
<a href="02_freq.html"><b>2</b> Frequency</a>
<a href="03_gn.html"><b>3</b> Gain</a>
<a href="04_freq_bw_gn.html"><b>4</b> Frequency, Bandwidth, and Gain</a>
<a href="05_capacity.html"><b>5</b> Information Capacity</a>
<a href="06_interference.html"><b>6</b> Interference and Information Capacity</a>
<a href="07_capacity.html"><b>7</b> Information Capacity</a>
<a href="08_capacity.html"><b>8</b> Information Capacity</a>
<a href="09_capacity.html"><b>9</b> Information Capacity</a>
<a href="10_capacity.html"><b>10</b> Information Capacity</a>
<a href="11_pathloss.html"><b>11</b> Path Loss</a>
<a href="12_pathloss_interference.html" class="selected"><b>12</b> Path Loss with Interference</a>
<a href="13_manual_avoidance.html"><b>13</b> Manual Interferer Avoidance</a>
<a href="" onclick="alert('Exercise 14: reserved for future use')"><b>14</b> SAS (Spectrum Access System)</a>
<a href="15_rule_based_avoidance.html"><b>15</b> Rule Based Interferer Avoidance</a>
<a href="16_programmable_avoidance.html"><b>16</b> Programmable Interferer Avoidance</a>
<a href="17_machine_learning_avoidance.html"><b>17</b> Machine Learning Interferer Avoidance</a>
<a href="18_machine_learning_time_based_avoidance.html"><b>18</b> Machine Learning With Periodic Interferer Avoidance</a>
<a href="19_rf_front_end_spectrum_sharing.html"><b>19</b> RF Front End Spectrum Sharing</a>
<a href="20_rf_front_end_spectrum_sharing.html"><b>20</b> Programmable RF Front End Spectrum Sharing</a>
<a href="21_rf_front_end_spectrum_sharing_with_interferer.html"><b>21</b> RF Front End Spectrum Sharing with Interferer</a>
<a href="22_rf_front_end_spectrum_sharing_with_interferer.html"><b>22</b> Programmable Spectrum Sharing with Interferer</a>
<a href="23_rf_front_end_spectrum_sharing_sliders_programmable.html"><b>23</b> RFFE Spectrum Sharing - Manual and Programmable</a>
<a href="25_rf_front_end_spectrum_sharing_menu.html"><b>25</b> RFFE Spectrum Sharing - Calculate SINR options menu</a>
<a href="26_rf_front_end_spectrum_sharing_ programmable.html"><b>26</b> RFFE Spectrum Sharing -- SINR Calculations Programmable</a>
</nav>
<label for="menu-control" class="sidebar__close"></label>
</aside>
<div style="margin-left: 6%; font-size: 1.3rem; margin-top: 0.3%; font-family: sans-serif; order: 1; width: inherit;"><span style="color: #ddd;">Special Exercise:</span> M-ary constellation diagram</div>
<div style="order: 2; margin-left: auto; margin-right: 2%; display: flex;">
<span style="font-size: 250%; font-family: monospace; letter-spacing: 2px; margin-left: auto; margin-right: 5px; color: #e6d9ba;"></span>
<div style="width: 20%;">
<img style="width: 100%;" src="images/wireless-logo.png">
</div>
</div>
</section>
<body>
<div style="height: 50px;"></div>
<div id="modCodeSlider" style="margin-left: 1%; margin-top:3%; width: 100%;"></div>
<div style="margin-left: 1%; margin-top: 1%;">
<label for="modulationType">Select Modulation Type:</label>
<select id="modulationType" >
<option value=1>PSK</option>
<option value=2>QAM</option>
</select>
</div>
<div id="modulationOrder" style="margin-left: 1%; margin-top:1%; width: 80%;"></div>
<div id="gainSlider" style="margin-left: 1%; margin-top:1%; width: 80%;"></div>
<button id="sendMessageButton">Send Message</button>
<button id = "clearMessagesButton">clear message</button>
<button id="freezeButton" onclick="freeze()">Run Continously</button>
<button id="toggleBER_SERButton">Show BER</button>
<div class="container">
<style>
.container {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: left;
gap: 1rem; /* Adjust the gap to bring the graphs closer */
margin: 1rem;
align-items: flex-start;
}
#constellationParent, #BER_plotParent {
flex: 1;
text-align: center;
margin: 0%;
padding: 0%;
width: auto;
padding: 0.5rem; /* Reduce padding */
/* margin: 0; Remove margin */
width: 1%; /* Adjust width to make them closer */
}
.modulation-table {
width: 10%;
border-collapse: collapse;
margin: 1rem auto;
font-family: Arial, sans-serif;
text-align: left;
border: 1px solid #ccc;
}
.modulation-table th, .modulation-table td {
padding: 0.5rem;
border: 1px solid #ccc;
}
.modulation-table th {
background-color: #747272;
font-weight: bold;
}
.color-box {
width: 20px;
height: 20px;
border: 1px solid #000;
display: inline-block;
}
.BERStats {
margin: 1rem 0;
height: 10rem;
width: 10%;
}
</style>
<div id="constellationParent"></div>
<div id="BER_plotParent"></div>
<!--
<table class="modulation-table">
<thead>
<tr>
<th>Modulation Scheme</th>
<th>Color</th>
</tr>
</thead>
<tbody>
<tr>
<td>BPSK</td>
<td><div class="color-box" style="background-color: #c51b7d;"></div></td>
</tr>
<tr>
<td>QPSK</td>
<td><div class="color-box" style="background-color: #e9a3c9;"></div></td>
</tr>
<tr>
<td>16-QAM</td>
<td><div class="color-box" style="background-color: #fde0ef;"></div></td>
</tr>
<tr>
<td>32-QAM</td>
<td><div class="color-box" style="background-color: #f7f7f7;"></div></td>
</tr>
<tr>
<td>64-QAM</td>
<td><div class="color-box" style="background-color: #e6f5d0;"></div></td>
</tr>
<tr>
<td>128-QAM</td>
<td><div class="color-box" style="background-color: #a1d76a;"></div></td>
</tr>
<tr>
<td>256-QAM</td>
<td><div class="color-box" style="background-color: #4d9221;"></div></td>
</tr>
</tbody> -->
</table>
<table class="BERStats"style="border-collapse: collapse; border: 1px solid #ccc; text-align: left;">
<thead>
<tr>
<th style="border: 1px solid #ccc; padding: 8px; text-align: left;">Parameter</th>
<th style="border: 1px solid #ccc; padding: 8px; text-align: left;">Value</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border: 1px solid #ccc; padding: 8px; text-align: left;">Iterations</td>
<td style="border: 1px solid #ccc; padding: 8px; text-align: left;" id="iterationsLabel">0</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 8px; text-align: left;">Measured Error Rate</td>
<td style="border: 1px solid #ccc; padding: 8px; text-align: left;" id="BERLabel">0.0</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 8px; text-align: left;">Theoretical Error Rate</td>
<td style="border: 1px solid #ccc; padding: 8px; text-align: left;" id="tBERLabel">0.0</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 8px; text-align: left;">Eb/No</td>
<td style="border: 1px solid #ccc; padding: 8px; text-align: left;" id="ebnoLabel">0 dB</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 8px; text-align: left;">Es/No</td>
<td style="border: 1px solid #ccc; padding: 8px; text-align: left;" id="esnoLabel">0 dB</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 8px; text-align: left;">SNR</td>
<td style="border: 1px solid #ccc; padding: 8px; text-align: left;" id="snrLabel">0 dB</td>
</tr>
</tbody>
</table>
</div>
<div class="slider-container" id="rateSlider" ></div>
</body>
<script>
let modulationOrder = 1; // default value
var sig = Signal(JSON.parse(JSON.stringify(conf.signal_multi)), '', {
gn_init: 0, // dB
gn_min: -60,
gn_max: 60,
mcs_init: 0, // array index int
});
var noise = Signal(JSON.parse(JSON.stringify(conf.signal_multi)), '', {
gn_init: -10, // dB
gn_min: -60,
gn_max: 20,
});
let BER_stats = new MessageStats();
// Slider(sig, 'mcs_simple', null, "modCodeSlider");
Slider(sig, 'gn', null, "gainSlider", "Energy per Symbol (dB)");
Slider(noise, 'gn', null, "gainSlider", "Noise Power Spectral Density (dB)");
modulationOrderSlider = document.createElement("INPUT");
// doing this manually because I don't want to edit sliders.js
// below generates p object inside the div for inPhaseMag which we can add stuff to
modulationOrderSlider.type = "range";
modulationOrderSlider.min = 1; // example: sig.freq_min
modulationOrderSlider.max = 4;
modulationOrderSlider.step = 1
modulationOrderSlider.value = 1;
let p = document.createElement("p");
p.appendChild(modulationOrderSlider);
// I'm sure I could have made this better but I didn't
document.getElementById("modulationOrder").appendChild(p);
// below sets up the label on the left of the slider
let label = document.createElement("label");
label.setAttribute("for", modulationOrderSlider.id);
label.appendChild(document.createTextNode("bits per symbol (m)"));
modulationOrderSlider.parentNode.prepend(label);
// below sets up the output value on the right of the slider
let output = document.createElement("output");
output.setAttribute("for", modulationOrderSlider.id);
modulationOrderSlider._output = output;
modulationOrderSlider.parentNode.append(output);
output.value = modulationOrderSlider.value;
// below tells css to make the slider look like the sliders were use to
modulationOrderSlider.className = "slider_bw";
// we will use floats on the output
var parseValue = parseFloat;
modulationOrderSlider.oninput = function () {
// This calls the parameter setter.
modulationOrder = parseValue(modulationOrderSlider.value);
};
var outputUnitsCallbackSig = function (modulationOrder, val) {
return d3.format("d")(val);
};
modulationOrderSlider.addEventListener("input", function () {
console.log("Modulation Order changed to:", modulationOrder);
// Add any additional logic here to handle the change in modulation order
output.value = outputUnitsCallbackSig(modulationOrder, modulationOrderSlider.value);
});
let frozenFlag = true;
constellationDiagram(300, 25,"constellationParent");
BER_plot()
// }
// use the clear all circles button
function buttonPressedClearPoints(){
d3.select("#constellationParent").selectAll("circle").remove();
}
let labels = document.querySelectorAll("label");
labels.forEach(label => {
if (label.htmlFor !== "mode" && !label.classList.contains("switch") && label.htmlFor !== "menu-control" ) {
label.style.display = "inline-block";
label.style.width = "150px";
}
});
</script>
</html>