Inspired by issue GMD-8.
Introduction
The current document is an understanding that has been obtained through code reading and simulations, and is not developed by the creator of the GMD system.
The GMD background noise average calculated by the firmware is nothing more than an approximation of the moving average based on 4096 samples (N). It is the first block at which the samples obtained from the ADC are processed. A common moving average equation is as follows:
Analyzing behavior
The implementation used in firmware simplifies the equation yet a bit more: It does not keep track of old samples and adds 1/0 based on some condition. Several simulation have been performed In order to understand the impact of this solution in conditions where the electron bunch rate increases (i.e. 1MHz or more). The electron bunch voltage pulse was modeled using a Gaussian distribution, and sampled with an ADC of 395MHz sampling rate. The resulting signal is shown in the following figure. The X-axis shows the sample number (period 2.53 ns), and both Y-axis show the ADC steps and their equivalent in volts ( 1 step = 39 μV ). For reference, these are the schematic and datasheet of the AMC and ADC, but the direct relation was derived by trial and error using the current ATCA test setup.
A simple simulation showing a single bunch pulse and the background noise (running average) estimated by the algorithm are depicted in the following figure.
The running average algorithm requires 1666 samples for it to reach the value of the true background noise (0V), which is approximately 4,214.98ns of time. For a 120Hz bunch rate (8.3ms period), there is enough time for the running average algorithm to approximate correctly the correct background noise voltage. Nonetheless, for the case a 1MHz bunch rate, where the period is 1000ns, the simulation shows that the closest the running average will get to measuring the background noise will be by the end of the period, and by 135 ADC steps ( ~ 5mV ) as shown in the following figure.
An estimate of the background error inaccuracy vs the number of samples/period is shown in the following table. Note that the Error is multiples of the step of the ADC, and no intermediate value can be reached. As mentioned earlier, each step has an increment of 37.03125μV in the Δ Background Noise.
Table
After X samples | Time (ns) | Error in Background Noise (μV) |
---|
1666~ | 4214.98~ | 37.03125 |
1476~1665 | 3734.28~4212.45 | 74.0625 |
1369~1475 | 3463.57~3731.75 | 111.09375 |
1295~1368 | 3276.35~3461.04 | 148.125 |
1237~1294 | 3129.61~3273.82 | 185.15625 |
1190~1236 | 3010.7~3127.08 | 222.1875 |
1151~1189 | 2912.03~3008.17 | 259.21875 |
1117~1150 | 2826.01~2909.5 | 296.25 |
1086~1116 | 2747.58~2823.48 | 333.28125 |
1060~1085 | 2681.8~2745.05 | 370.3125 |
1035~1059 | 2618.55~2679.27 | 407.34375 |
1013~1034 | 2562.89~2616.02 | 444.375 |
993~1012 | 2512.29~2560.36 | 481.40625 |
974~992 | 2464.22~2509.76 | 518.4375 |
956~973 | 2418.68~2461.69 | 555.46875 |
940~955 | 2378.2~2416.15 | 592.5 |
924~939 | 2337.72~2375.67 | 629.53125 |
910~923 | 2302.3~2335.19 | 666.5625 |
896~909 | 2266.88~2299.77 | 703.59375 |
883~895 | 2233.99~2264.35 | 740.625 |
870~882 | 2201.1~2231.46 | 777.65625 |
858~869 | 2170.74~2198.57 | 814.6875 |
847~857 | 2142.91~2168.21 | 851.71875 |
836~846 | 2115.08~2140.38 | 888.75 |
826~835 | 2089.78~2112.55 | 925.78125 |
816~825 | 2064.48~2087.25 | 962.8125 |
806~815 | 2039.18~2061.95 | 999.84375 |
797~805 | 2016.41~2036.65 | 1036.875 |
788~796 | 1993.64~2013.88 | 1073.90625 |
779~787 | 1970.87~1991.11 | 1110.9375 |
771~778 | 1950.63~1968.34 | 1147.96875 |
763~770 | 1930.39~1948.1 | 1185 |
755~762 | 1910.15~1927.86 | 1222.03125 |
747~754 | 1889.91~1907.62 | 1259.0625 |
740~746 | 1872.2~1887.38 | 1296.09375 |
733~739 | 1854.49~1869.67 | 1333.125 |
726~732 | 1836.78~1851.96 | 1370.15625 |
719~725 | 1819.07~1834.25 | 1407.1875 |
712~718 | 1801.36~1816.54 | 1444.21875 |
706~711 | 1786.18~1798.83 | 1481.25 |
699~705 | 1768.47~1783.65 | 1518.28125 |
693~698 | 1753.29~1765.94 | 1555.3125 |
687~692 | 1738.11~1750.76 | 1592.34375 |
681~686 | 1722.93~1735.58 | 1629.375 |
676~680 | 1710.28~1720.4 | 1666.40625 |
670~675 | 1695.1~1707.75 | 1703.4375 |
664~669 | 1679.92~1692.57 | 1740.46875 |
659~663 | 1667.27~1677.39 | 1777.5 |
654~658 | 1654.62~1664.74 | 1814.53125 |
649~653 | 1641.97~1652.09 | 1851.5625 |
644~648 | 1629.32~1639.44 | 1888.59375 |
639~643 | 1616.67~1626.79 | 1925.625 |
634~638 | 1604.02~1614.14 | 1962.65625 |
629~633 | 1591.37~1601.49 | 1999.6875 |
624~628 | 1578.72~1588.84 | 2036.71875 |
620~623 | 1568.6~1576.19 | 2073.75 |
615~619 | 1555.95~1566.07 | 2110.78125 |
611~614 | 1545.83~1553.42 | 2147.8125 |
606~610 | 1533.18~1543.3 | 2184.84375 |
602~605 | 1523.06~1530.65 | 2221.875 |
598~601 | 1512.94~1520.53 | 2258.90625 |
594~597 | 1502.82~1510.41 | 2295.9375 |
590~593 | 1492.7~1500.29 | 2332.96875 |
586~589 | 1482.58~1490.17 | 2370 |
582~585 | 1472.46~1480.05 | 2407.03125 |
578~581 | 1462.34~1469.93 | 2444.0625 |
574~577 | 1452.22~1459.81 | 2481.09375 |
570~573 | 1442.1~1449.69 | 2518.125 |
566~569 | 1431.98~1439.57 | 2555.15625 |
563~565 | 1424.39~1429.45 | 2592.1875 |
559~562 | 1414.27~1421.86 | 2629.21875 |
556~558 | 1406.68~1411.74 | 2666.25 |
552~555 | 1396.56~1404.15 | 2703.28125 |
549~551 | 1388.97~1394.03 | 2740.3125 |
545~548 | 1378.85~1386.44 | 2777.34375 |
542~544 | 1371.26~1376.32 | 2814.375 |
538~541 | 1361.14~1368.73 | 2851.40625 |
535~537 | 1353.55~1358.61 | 2888.4375 |
532~534 | 1345.96~1351.02 | 2925.46875 |
529~531 | 1338.37~1343.43 | 2962.5 |
526~528 | 1330.78~1335.84 | 2999.53125 |
522~525 | 1320.66~1328.25 | 3036.5625 |
519~521 | 1313.07~1318.13 | 3073.59375 |
516~518 | 1305.48~1310.54 | 3110.625 |
513~515 | 1297.89~1302.95 | 3147.65625 |
510~512 | 1290.3~1295.36 | 3184.6875 |
507~509 | 1282.71~1287.77 | 3221.71875 |
504~506 | 1275.12~1280.18 | 3258.75 |
501~503 | 1267.53~1272.59 | 3295.78125 |
499~500 | 1262.47~1265.0 | 3332.8125 |
496~498 | 1254.88~1259.94 | 3369.84375 |
493~495 | 1247.29~1252.35 | 3406.875 |
490~492 | 1239.7~1244.76 | 3443.90625 |
487~489 | 1232.11~1237.17 | 3480.9375 |
485~486 | 1227.05~1229.58 | 3517.96875 |
482~484 | 1219.46~1224.52 | 3555 |
479~481 | 1211.87~1216.93 | 3592.03125 |
477~478 | 1206.81~1209.34 | 3629.0625 |
474~476 | 1199.22~1204.28 | 3666.09375 |
472~473 | 1194.16~1196.69 | 3703.125 |
469~471 | 1186.57~1191.63 | 3740.15625 |
467~468 | 1181.51~1184.04 | 3777.1875 |
464~466 | 1173.92~1178.98 | 3814.21875 |
462~463 | 1168.86~1171.39 | 3851.25 |
459~461 | 1161.27~1166.33 | 3888.28125 |
457~458 | 1156.21~1158.74 | 3925.3125 |
454~456 | 1148.62~1153.68 | 3962.34375 |
452~453 | 1143.56~1146.09 | 3999.375 |
450~451 | 1138.5~1141.03 | 4036.40625 |
447~449 | 1130.91~1135.97 | 4073.4375 |
445~446 | 1125.85~1128.38 | 4110.46875 |
443~444 | 1120.79~1123.32 | 4147.5 |
440~442 | 1113.2~1118.26 | 4184.53125 |
438~439 | 1108.14~1110.67 | 4221.5625 |
436~437 | 1103.08~1105.61 | 4258.59375 |
434~435 | 1098.02~1100.55 | 4295.625 |
432~433 | 1092.96~1095.49 | 4332.65625 |
429~431 | 1085.37~1090.43 | 4369.6875 |
427~428 | 1080.31~1082.84 | 4406.71875 |
425~426 | 1075.25~1077.78 | 4443.75 |
423~424 | 1070.19~1072.72 | 4480.78125 |
421~422 | 1065.13~1067.66 | 4517.8125 |
419~420 | 1060.07~1062.6 | 4554.84375 |
417~418 | 1055.01~1057.54 | 4591.875 |
415~416 | 1049.95~1052.48 | 4628.90625 |
413~414 | 1044.89~1047.42 | 4665.9375 |
411~412 | 1039.83~1042.36 | 4702.96875 |
409~410 | 1034.77~1037.3 | 4740 |
407~408 | 1029.71~1032.24 | 4777.03125 |
405~406 | 1024.65~1027.18 | 4814.0625 |
403~404 | 1019.59~1022.12 | 4851.09375 |
401~402 | 1014.53~1017.06 | 4888.125 |
399~400 | 1009.47~1012.0 | 4925.15625 |
397~398 | 1004.41~1006.94 | 4962.1875 |
395~396 | 999.35~1001.88 | 4999.21875 |
393~394 | 994.29~996.82 | 5036.25 |
391~392 | 989.23~991.76 | 5073.28125 |
389~390 | 984.17~986.7 | 5110.3125 |
388 | 981.64 | 5147.34375 |
386~387 | 976.58~979.11 | 5184.375 |
384~385 | 971.52~974.05 | 5221.40625 |
382~383 | 966.46~968.99 | 5258.4375 |
380~381 | 961.4~963.93 | 5295.46875 |
378~379 | 956.34~958.87 | 5332.5 |
377 | 953.81 | 5369.53125 |
375~376 | 948.75~951.28 | 5406.5625 |
373~374 | 943.69~946.22 | 5443.59375 |
372 | 941.16 | 5480.625 |
370~371 | 936.1~938.63 | 5517.65625 |
368~369 | 931.04~933.57 | 5554.6875 |
366~367 | 925.98~928.51 | 5591.71875 |
365 | 923.45 | 5628.75 |
363~364 | 918.39~920.92 | 5665.78125 |
361~362 | 913.33~915.86 | 5702.8125 |
360 | 910.8 | 5739.84375 |
358~359 | 905.74~908.27 | 5776.875 |
356~357 | 900.68~903.21 | 5813.90625 |
355 | 898.15 | 5850.9375 |
353~354 | 893.09~895.62 | 5887.96875 |
352 | 890.56 | 5925 |
350~351 | 885.5~888.03 | 5962.03125 |
348~349 | 880.44~882.97 | 5999.0625 |
347 | 877.91 | 6036.09375 |
345~346 | 872.85~875.38 | 6073.125 |
344 | 870.32 | 6110.15625 |
342~343 | 865.26~867.79 | 6147.1875 |
341 | 862.73 | 6184.21875 |
339~340 | 857.67~860.2 | 6221.25 |
338 | 855.14 | 6258.28125 |
336~337 | 850.08~852.61 | 6295.3125 |
335 | 847.55 | 6332.34375 |
333~334 | 842.49~845.02 | 6369.375 |
332 | 839.96 | 6406.40625 |
330~331 | 834.9~837.43 | 6443.4375 |
329 | 832.37 | 6480.46875 |
327~328 | 827.31~829.84 | 6517.5 |
326 | 824.78 | 6554.53125 |
324~325 | 819.72~822.25 | 6591.5625 |
323 | 817.19 | 6628.59375 |
322 | 814.66 | 6665.625 |
320~321 | 809.6~812.13 | 6702.65625 |
319 | 807.07 | 6739.6875 |
317~318 | 802.01~804.54 | 6776.71875 |
316 | 799.48 | 6813.75 |
315 | 796.95 | 6850.78125 |
313~314 | 791.89~794.42 | 6887.8125 |
312 | 789.36 | 6924.84375 |
310~311 | 784.3~786.83 | 6961.875 |
309 | 781.77 | 6998.90625 |
308 | 779.24 | 7035.9375 |
306~307 | 774.18~776.71 | 7072.96875 |
305 | 771.65 | 7110 |
304 | 769.12 | 7147.03125 |
302~303 | 764.06~766.59 | 7184.0625 |
301 | 761.53 | 7221.09375 |
300 | 759 | 7258.125 |
298~299 | 753.94~756.47 | 7295.15625 |
297 | 751.41 | 7332.1875 |
296 | 748.88 | 7369.21875 |
295 | 746.35 | 7406.25 |
293~294 | 741.29~743.82 | 7443.28125 |
292 | 738.76 | 7480.3125 |
291 | 736.23 | 7517.34375 |
290 | 733.7 | 7554.375 |
288~289 | 728.64~731.17 | 7591.40625 |
287 | 726.11 | 7628.4375 |
286 | 723.58 | 7665.46875 |
285 | 721.05 | 7702.5 |
283~284 | 715.99~718.52 | 7739.53125 |
282 | 713.46 | 7776.5625 |
281 | 710.93 | 7813.59375 |
280 | 708.4 | 7850.625 |
278~279 | 703.34~705.87 | 7887.65625 |
277 | 700.81 | 7924.6875 |
276 | 698.28 | 7961.71875 |
275 | 695.75 | 7998.75 |
274 | 693.22 | 8035.78125 |
273 | 690.69 | 8072.8125 |
271~272 | 685.63~688.16 | 8109.84375 |
270 | 683.1 | 8146.875 |
269 | 680.57 | 8183.90625 |
268 | 678.04 | 8220.9375 |
267 | 675.51 | 8257.96875 |
266 | 672.98 | 8295 |
264~265 | 667.92~670.45 | 8332.03125 |
263 | 665.39 | 8369.0625 |
262 | 662.86 | 8406.09375 |
261 | 660.33 | 8443.125 |
260 | 657.8 | 8480.15625 |
259 | 655.27 | 8517.1875 |
258 | 652.74 | 8554.21875 |
257 | 650.21 | 8591.25 |
256 | 647.68 | 8628.28125 |
254~255 | 642.62~645.15 | 8665.3125 |
253 | 640.09 | 8702.34375 |
252 | 637.56 | 8739.375 |
251 | 635.03 | 8776.40625 |
250 | 632.5 | 8813.4375 |
249 | 629.97 | 8850.46875 |
248 | 627.44 | 8887.5 |
247 | 624.91 | 8924.53125 |
246 | 622.38 | 8961.5625 |
245 | 619.85 | 8998.59375 |
244 | 617.32 | 9035.625 |
243 | 614.79 | 9072.65625 |
242 | 612.26 | 9109.6875 |
241 | 609.73 | 9146.71875 |
240 | 607.2 | 9183.75 |
239 | 604.67 | 9220.78125 |
238 | 602.14 | 9257.8125 |
237 | 599.61 | 9294.84375 |
236 | 597.08 | 9331.875 |
235 | 594.55 | 9368.90625 |
234 | 592.02 | 9405.9375 |
233 | 589.49 | 9442.96875 |
232 | 586.96 | 9480 |
231 | 584.43 | 9517.03125 |
230 | 581.9 | 9554.0625 |
229 | 579.37 | 9591.09375 |
228 | 576.84 | 9628.125 |
227 | 574.31 | 9665.15625 |
226 | 571.78 | 9702.1875 |
225 | 569.25 | 9739.21875 |
224 | 566.72 | 9776.25 |
223 | 564.19 | 9813.28125 |
222 | 561.66 | 9850.3125 |
221 | 559.13 | 9887.34375 |
220 | 556.6 | 9924.375 |
219 | 554.07 | 9961.40625 |
218 | 551.54 | 9998.4375 |
217 | 549.01 | 10035.46875 |
216 | 546.48 | 10072.5 |
215 | 543.95 | 10109.53125 |
214 | 541.42 | 10146.5625 |
213 | 538.89 | 10183.59375 |
212 | 536.36 | 10220.625 |
211 | 533.83 | 10257.65625 |
210 | 531.3 | 10331.71875 |
209 | 528.77 | 10368.75 |
208 | 526.24 | 10405.78125 |
207 | 523.71 | 10442.8125 |
206 | 521.18 | 10479.84375 |
205 | 518.65 | 10516.875 |
204 | 516.12 | 10553.90625 |
203 | 513.59 | 10590.9375 |
202 | 511.06 | 10627.96875 |
201 | 508.53 | 10665 |
200 | 506 | 10739.0625 |
199 | 503.47 | 10776.09375 |
198 | 500.94 | 10813.125 |
197 | 498.41 | 10850.15625 |
196 | 495.88 | 10887.1875 |
195 | 493.35 | 10924.21875 |
194 | 490.82 | 10961.25 |
193 | 488.29 | 11035.3125 |
192 | 485.76 | 11072.34375 |
191 | 483.23 | 11109.375 |
190 | 480.7 | 11146.40625 |
189 | 478.17 | 11183.4375 |
188 | 475.64 | 11257.5 |
187 | 473.11 | 11294.53125 |
186 | 470.58 | 11331.5625 |
185 | 468.05 | 11368.59375 |
184 | 465.52 | 11405.625 |
183 | 462.99 | 11442.65625 |
182 | 460.46 | 11516.71875 |
181 | 457.93 | 11553.75 |
180 | 455.4 | 11590.78125 |
179 | 452.87 | 11627.8125 |
178 | 450.34 | 11701.875 |
177 | 447.81 | 11738.90625 |
176 | 445.28 | 11775.9375 |
175 | 442.75 | 11812.96875 |
174 | 440.22 | 11887.03125 |
173 | 437.69 | 11924.0625 |
172 | 435.16 | 11961.09375 |
171 | 432.63 | 11998.125 |
170 | 430.1 | 12072.1875 |
169 | 427.57 | 12109.21875 |
168 | 425.04 | 12146.25 |
167 | 422.51 | 12183.28125 |
166 | 419.98 | 12257.34375 |
165 | 417.45 | 12294.375 |
164 | 414.92 | 12331.40625 |
163 | 412.39 | 12405.46875 |
162 | 409.86 | 12442.5 |
161 | 407.33 | 12479.53125 |
160 | 404.8 | 12553.59375 |
159 | 402.27 | 12590.625 |
158 | 399.74 | 12627.65625 |
157 | 397.21 | 12701.71875 |
156 | 394.68 | 12738.75 |
155 | 392.15 | 12775.78125 |
154 | 389.62 | 12849.84375 |
153 | 387.09 | 12886.875 |
152 | 384.56 | 12923.90625 |
151 | 382.03 | 12997.96875 |
150 | 379.5 | 13035 |
149 | 376.97 | 13072.03125 |
148 | 374.44 | 13146.09375 |
147 | 371.91 | 13183.125 |
146 | 369.38 | 13257.1875 |
145 | 366.85 | 13294.21875 |
144 | 364.32 | 13331.25 |
143 | 361.79 | 13405.3125 |
142 | 359.26 | 13442.34375 |
141 | 356.73 | 13516.40625 |
140 | 354.2 | 13553.4375 |
139 | 351.67 | 13627.5 |
138 | 349.14 | 13664.53125 |
137 | 346.61 | 13701.5625 |
136 | 344.08 | 13775.625 |
135 | 341.55 | 13812.65625 |
134 | 339.02 | 13886.71875 |
133 | 336.49 | 13923.75 |
132 | 333.96 | 13997.8125 |
131 | 331.43 | 14034.84375 |
130 | 328.9 | 14108.90625 |
129 | 326.37 | 14145.9375 |
128 | 323.84 | 14220 |
127 | 321.31 | 14257.03125 |
126 | 318.78 | 14331.09375 |
125 | 316.25 | 14368.125 |
124 | 313.72 | 14442.1875 |
123 | 311.19 | 14479.21875 |
122 | 308.66 | 14553.28125 |
121 | 306.13 | 14590.3125 |
120 | 303.6 | 14664.375 |
119 | 301.07 | 14701.40625 |
118 | 298.54 | 14775.46875 |
117 | 296.01 | 14849.53125 |
116 | 293.48 | 14886.5625 |
115 | 290.95 | 14960.625 |
114 | 288.42 | 14997.65625 |
113 | 285.89 | 15071.71875 |
112 | 283.36 | 15108.75 |
111 | 280.83 | 15182.8125 |
110 | 278.3 | 15256.875 |
109 | 275.77 | 15293.90625 |
108 | 273.24 | 15367.96875 |
107 | 270.71 | 15442.03125 |
106 | 268.18 | 15479.0625 |
105 | 265.65 | 15553.125 |
104 | 263.12 | 15590.15625 |
103 | 260.59 | 15664.21875 |
102 | 258.06 | 15738.28125 |
101 | 255.53 | 15775.3125 |
100 | 253 | 15849.375 |
99 | 250.47 | 15923.4375 |
98 | 247.94 | 15960.46875 |
97 | 245.41 | 16034.53125 |
96 | 242.88 | 16108.59375 |
95 | 240.35 | 16182.65625 |
94 | 237.82 | 16219.6875 |
93 | 235.29 | 16293.75 |
92 | 232.76 | 16367.8125 |
91 | 230.23 | 16404.84375 |
90 | 227.7 | 16478.90625 |
89 | 225.17 | 16552.96875 |
88 | 222.64 | 16627.03125 |
87 | 220.11 | 16664.0625 |
86 | 217.58 | 16738.125 |
85 | 215.05 | 16812.1875 |
84 | 212.52 | 16886.25 |
83 | 209.99 | 16960.3125 |
82 | 207.46 | 16997.34375 |
81 | 204.93 | 17071.40625 |
80 | 202.4 | 17145.46875 |
79 | 199.87 | 17219.53125 |
78 | 197.34 | 17293.59375 |
77 | 194.81 | 17330.625 |
76 | 192.28 | 17404.6875 |
75 | 189.75 | 17478.75 |
74 | 187.22 | 17552.8125 |
73 | 184.69 | 17626.875 |
72 | 182.16 | 17700.9375 |
71 | 179.63 | 17737.96875 |
70 | 177.1 | 17812.03125 |
69 | 174.57 | 17886.09375 |
68 | 172.04 | 17960.15625 |
67 | 169.51 | 18034.21875 |
66 | 166.98 | 18108.28125 |
65 | 164.45 | 18182.34375 |
64 | 161.92 | 18256.40625 |
63 | 159.39 | 18330.46875 |
62 | 156.86 | 18404.53125 |
61 | 154.33 | 18478.59375 |
60 | 151.8 | 18552.65625 |
59 | 149.27 | 18626.71875 |
58 | 146.74 | 18663.75 |
57 | 144.21 | 18737.8125 |
56 | 141.68 | 18811.875 |
55 | 139.15 | 18885.9375 |
54 | 136.62 | 18960 |
53 | 134.09 | 19034.0625 |
52 | 131.56 | 19108.125 |
51 | 129.03 | 19182.1875 |
50 | 126.5 | 19293.28125 |
49 | 123.97 | 19367.34375 |
48 | 121.44 | 19441.40625 |
47 | 118.91 | 19515.46875 |
46 | 116.38 | 19589.53125 |
45 | 113.85 | 19663.59375 |
44 | 111.32 | 19737.65625 |
43 | 108.79 | 19811.71875 |
42 | 106.26 | 19885.78125 |
41 | 103.73 | 19959.84375 |
40 | 101.2 | 20033.90625 |
39 | 98.67 | 20107.96875 |
38 | 96.14 | 20219.0625 |
37 | 93.61 | 20293.125 |
36 | 91.08 | 20367.1875 |
35 | 88.55 | 20441.25 |
34 | 86.02 | 20515.3125 |
33 | 83.49 | 20589.375 |
32 | 80.96 | 20663.4375 |
31 | 78.43 | 20774.53125 |
30 | 75.9 | 20848.59375 |
29 | 73.37 | 20922.65625 |
28 | 70.84 | 20996.71875 |
27 | 68.31 | 21070.78125 |
26 | 65.78 | 21181.875 |
25 | 63.25 | 21255.9375 |
24 | 60.72 | 21330 |
23 | 58.19 | 21404.0625 |
22 | 55.66 | 21515.15625 |
21 | 53.13 | 21589.21875 |
20 | 50.6 | 21663.28125 |
19 | 48.07 | 21774.375 |
18 | 45.54 | 21848.4375 |
Worst case simulation using real data
A simulation was performed using an electron bunch pulses that were obtained straight from the production system of the NC accelerator. In order to represent the worst case, the pulse with the largest magnitude from a sample population of 154 was chosen for the simulation, and is shown in the following figure:
The background noise was estimated to be 1257 ADC steps (+48mV). The upper signal was repeated on a rate of 1MHz and was fed into the running average logic as input vectors. The simulation results for 4000 samples are shown in the following figure. At the point just before the new electron bunch arrives, the estimated background noise is approximately 91 ADC steps (3.55 mV) away from the real background noise.
One important point to note is that the running average algorithm constantly is updating an estimate of the background noise, and that value when the trigger arrives is not the only one used in the RMS calculation. The values used are either 128 (default), or user specified (12-15 samples). It can be seen that the running average value oscillates immediately after the pulse arrives between 886 and 1212 ADC steps ( Δ of 326 steps), which is a much larger deviation when compared to the background noise estimation error of 91 steps, and has been present in the NC accelerator with a 120Hz.
Note also that this is a worst case analysis chosen based on the largest amplitude pulse, and does not reflect the true situation. The true situation is that no two consecutive electron bunches have similar energy values or area under the curve. A more accurate simulation can be done by using a pulse train obtained from the current accelerator, and is shown in the next section.
Yet a more realistic analysis
The 154 pulse train was used to perform a simulation and understand further the behavior of the running average logic. The background noise is assumed as previously mentioned (1257 ADC steps, +48mV). The 154 pulse train was simulated in at a frequency of 1MHz and is shown in the following figure along with its calculated running average. You can observe the variation in the pulses used for this simulation.
To obtain a better understanding of the estimated running average and the real background noise, the following plot is depicted. The running average at point 0 can be ignored since this is the initial state of the running average algorithm. Note that (almost) every local maximum is the beginning of a new bunch pulse. Note also that the variation in the estimated background noise varies in some circumstances up to 576 ADC step.
Note that this largest variation (576 ADC steps) was reached in the first 14 samples and is shown in the following figure. Meaning that the used background noise value deviates more as it is being used by the root mean square algorithm.
Improving the running average implementation
The moving average algorithm subtracts the current sample from the previously calculated running average value at all times. This poses an issue for us when increasing the frequency of the x-ray bunch to frequencies larger than 120Hz. A Good way to go about this would be to control the enable of the running average block to to not consider the pulse in the background noise calculation. currently, the enable is enabled when there is a valid sample and the red (C & D) or green (A & B) calibration cycles are disabled. It will be enabled in these cases, but only X samples after receiving an event trigger. To demonstrate the improvement, a new simulation was performed using the pulse train used in the previous evaluation, and disabling the running average calculation up to 100 sample cycles after the trigger. The results are shown in the following figure. for more realistic results, a white noise was added to the signal with a peak of 100 ADC steps. It can be seen that the new running average implementation is converging to the value (1257) of the background noise, and maintaining a steady curve with a delta of 8 ADC steps.