You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 32 Next »


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.

After X samplesTime (ns)Error in Background Noise (μV)
1666~4214.98~37.03125
1476~16653734.28~4212.4574.0625
1369~14753463.57~3731.75111.09375
1295~13683276.35~3461.04148.125
1237~12943129.61~3273.82185.15625
1190~12363010.7~3127.08222.1875
1151~11892912.03~3008.17259.21875
1117~11502826.01~2909.5296.25
1086~11162747.58~2823.48333.28125
1060~10852681.8~2745.05370.3125
1035~10592618.55~2679.27407.34375
1013~10342562.89~2616.02444.375
993~10122512.29~2560.36481.40625
974~9922464.22~2509.76518.4375
956~9732418.68~2461.69555.46875
940~9552378.2~2416.15592.5
924~9392337.72~2375.67629.53125
910~9232302.3~2335.19666.5625
896~9092266.88~2299.77703.59375
883~8952233.99~2264.35740.625
870~8822201.1~2231.46777.65625
858~8692170.74~2198.57814.6875
847~8572142.91~2168.21851.71875
836~8462115.08~2140.38888.75
826~8352089.78~2112.55925.78125
816~8252064.48~2087.25962.8125
806~8152039.18~2061.95999.84375
797~8052016.41~2036.651036.875
788~7961993.64~2013.881073.90625
779~7871970.87~1991.111110.9375
771~7781950.63~1968.341147.96875
763~7701930.39~1948.11185
755~7621910.15~1927.861222.03125
747~7541889.91~1907.621259.0625
740~7461872.2~1887.381296.09375
733~7391854.49~1869.671333.125
726~7321836.78~1851.961370.15625
719~7251819.07~1834.251407.1875
712~7181801.36~1816.541444.21875
706~7111786.18~1798.831481.25
699~7051768.47~1783.651518.28125
693~6981753.29~1765.941555.3125
687~6921738.11~1750.761592.34375
681~6861722.93~1735.581629.375
676~6801710.28~1720.41666.40625
670~6751695.1~1707.751703.4375
664~6691679.92~1692.571740.46875
659~6631667.27~1677.391777.5
654~6581654.62~1664.741814.53125
649~6531641.97~1652.091851.5625
644~6481629.32~1639.441888.59375
639~6431616.67~1626.791925.625
634~6381604.02~1614.141962.65625
629~6331591.37~1601.491999.6875
624~6281578.72~1588.842036.71875
620~6231568.6~1576.192073.75
615~6191555.95~1566.072110.78125
611~6141545.83~1553.422147.8125
606~6101533.18~1543.32184.84375
602~6051523.06~1530.652221.875
598~6011512.94~1520.532258.90625
594~5971502.82~1510.412295.9375
590~5931492.7~1500.292332.96875
586~5891482.58~1490.172370
582~5851472.46~1480.052407.03125
578~5811462.34~1469.932444.0625
574~5771452.22~1459.812481.09375
570~5731442.1~1449.692518.125
566~5691431.98~1439.572555.15625
563~5651424.39~1429.452592.1875
559~5621414.27~1421.862629.21875
556~5581406.68~1411.742666.25
552~5551396.56~1404.152703.28125
549~5511388.97~1394.032740.3125
545~5481378.85~1386.442777.34375
542~5441371.26~1376.322814.375
538~5411361.14~1368.732851.40625
535~5371353.55~1358.612888.4375
532~5341345.96~1351.022925.46875
529~5311338.37~1343.432962.5
526~5281330.78~1335.842999.53125
522~5251320.66~1328.253036.5625
519~5211313.07~1318.133073.59375
516~5181305.48~1310.543110.625
513~5151297.89~1302.953147.65625
510~5121290.3~1295.363184.6875
507~5091282.71~1287.773221.71875
504~5061275.12~1280.183258.75
501~5031267.53~1272.593295.78125
499~5001262.47~1265.03332.8125
496~4981254.88~1259.943369.84375
493~4951247.29~1252.353406.875
490~4921239.7~1244.763443.90625
487~4891232.11~1237.173480.9375
485~4861227.05~1229.583517.96875
482~4841219.46~1224.523555
479~4811211.87~1216.933592.03125
477~4781206.81~1209.343629.0625
474~4761199.22~1204.283666.09375
472~4731194.16~1196.693703.125
469~4711186.57~1191.633740.15625
467~4681181.51~1184.043777.1875
464~4661173.92~1178.983814.21875
462~4631168.86~1171.393851.25
459~4611161.27~1166.333888.28125
457~4581156.21~1158.743925.3125
454~4561148.62~1153.683962.34375
452~4531143.56~1146.093999.375
450~4511138.5~1141.034036.40625
447~4491130.91~1135.974073.4375
445~4461125.85~1128.384110.46875
443~4441120.79~1123.324147.5
440~4421113.2~1118.264184.53125
438~4391108.14~1110.674221.5625
436~4371103.08~1105.614258.59375
434~4351098.02~1100.554295.625
432~4331092.96~1095.494332.65625
429~4311085.37~1090.434369.6875
427~4281080.31~1082.844406.71875
425~4261075.25~1077.784443.75
423~4241070.19~1072.724480.78125
421~4221065.13~1067.664517.8125
419~4201060.07~1062.64554.84375
417~4181055.01~1057.544591.875
415~4161049.95~1052.484628.90625
413~4141044.89~1047.424665.9375
411~4121039.83~1042.364702.96875
409~4101034.77~1037.34740
407~4081029.71~1032.244777.03125
405~4061024.65~1027.184814.0625
403~4041019.59~1022.124851.09375
401~4021014.53~1017.064888.125
399~4001009.47~1012.04925.15625
397~3981004.41~1006.944962.1875
395~396999.35~1001.884999.21875
393~394994.29~996.825036.25
391~392989.23~991.765073.28125
389~390984.17~986.75110.3125
388981.645147.34375
386~387976.58~979.115184.375
384~385971.52~974.055221.40625
382~383966.46~968.995258.4375
380~381961.4~963.935295.46875
378~379956.34~958.875332.5
377953.815369.53125
375~376948.75~951.285406.5625
373~374943.69~946.225443.59375
372941.165480.625
370~371936.1~938.635517.65625
368~369931.04~933.575554.6875
366~367925.98~928.515591.71875
365923.455628.75
363~364918.39~920.925665.78125
361~362913.33~915.865702.8125
360910.85739.84375
358~359905.74~908.275776.875
356~357900.68~903.215813.90625
355898.155850.9375
353~354893.09~895.625887.96875
352890.565925
350~351885.5~888.035962.03125
348~349880.44~882.975999.0625
347877.916036.09375
345~346872.85~875.386073.125
344870.326110.15625
342~343865.26~867.796147.1875
341862.736184.21875
339~340857.67~860.26221.25
338855.146258.28125
336~337850.08~852.616295.3125
335847.556332.34375
333~334842.49~845.026369.375
332839.966406.40625
330~331834.9~837.436443.4375
329832.376480.46875
327~328827.31~829.846517.5
326824.786554.53125
324~325819.72~822.256591.5625
323817.196628.59375
322814.666665.625
320~321809.6~812.136702.65625
319807.076739.6875
317~318802.01~804.546776.71875
316799.486813.75
315796.956850.78125
313~314791.89~794.426887.8125
312789.366924.84375
310~311784.3~786.836961.875
309781.776998.90625
308779.247035.9375
306~307774.18~776.717072.96875
305771.657110
304769.127147.03125
302~303764.06~766.597184.0625
301761.537221.09375
3007597258.125
298~299753.94~756.477295.15625
297751.417332.1875
296748.887369.21875
295746.357406.25
293~294741.29~743.827443.28125
292738.767480.3125
291736.237517.34375
290733.77554.375
288~289728.64~731.177591.40625
287726.117628.4375
286723.587665.46875
285721.057702.5
283~284715.99~718.527739.53125
282713.467776.5625
281710.937813.59375
280708.47850.625
278~279703.34~705.877887.65625
277700.817924.6875
276698.287961.71875
275695.757998.75
274693.228035.78125
273690.698072.8125
271~272685.63~688.168109.84375
270683.18146.875
269680.578183.90625
268678.048220.9375
267675.518257.96875
266672.988295
264~265667.92~670.458332.03125
263665.398369.0625
262662.868406.09375
261660.338443.125
260657.88480.15625
259655.278517.1875
258652.748554.21875
257650.218591.25
256647.688628.28125
254~255642.62~645.158665.3125
253640.098702.34375
252637.568739.375
251635.038776.40625
250632.58813.4375
249629.978850.46875
248627.448887.5
247624.918924.53125
246622.388961.5625
245619.858998.59375
244617.329035.625
243614.799072.65625
242612.269109.6875
241609.739146.71875
240607.29183.75
239604.679220.78125
238602.149257.8125
237599.619294.84375
236597.089331.875
235594.559368.90625
234592.029405.9375
233589.499442.96875
232586.969480
231584.439517.03125
230581.99554.0625
229579.379591.09375
228576.849628.125
227574.319665.15625
226571.789702.1875
225569.259739.21875
224566.729776.25
223564.199813.28125
222561.669850.3125
221559.139887.34375
220556.69924.375
219554.079961.40625
218551.549998.4375
217549.0110035.46875
216546.4810072.5
215543.9510109.53125
214541.4210146.5625
213538.8910183.59375
212536.3610220.625
211533.8310257.65625
210531.310331.71875
209528.7710368.75
208526.2410405.78125
207523.7110442.8125
206521.1810479.84375
205518.6510516.875
204516.1210553.90625
203513.5910590.9375
202511.0610627.96875
201508.5310665
20050610739.0625
199503.4710776.09375
198500.9410813.125
197498.4110850.15625
196495.8810887.1875
195493.3510924.21875
194490.8210961.25
193488.2911035.3125
192485.7611072.34375
191483.2311109.375
190480.711146.40625
189478.1711183.4375
188475.6411257.5
187473.1111294.53125
186470.5811331.5625
185468.0511368.59375
184465.5211405.625
183462.9911442.65625
182460.4611516.71875
181457.9311553.75
180455.411590.78125
179452.8711627.8125
178450.3411701.875
177447.8111738.90625
176445.2811775.9375
175442.7511812.96875
174440.2211887.03125
173437.6911924.0625
172435.1611961.09375
171432.6311998.125
170430.112072.1875
169427.5712109.21875
168425.0412146.25
167422.5112183.28125
166419.9812257.34375
165417.4512294.375
164414.9212331.40625
163412.3912405.46875
162409.8612442.5
161407.3312479.53125
160404.812553.59375
159402.2712590.625
158399.7412627.65625
157397.2112701.71875
156394.6812738.75
155392.1512775.78125
154389.6212849.84375
153387.0912886.875
152384.5612923.90625
151382.0312997.96875
150379.513035
149376.9713072.03125
148374.4413146.09375
147371.9113183.125
146369.3813257.1875
145366.8513294.21875
144364.3213331.25
143361.7913405.3125
142359.2613442.34375
141356.7313516.40625
140354.213553.4375
139351.6713627.5
138349.1413664.53125
137346.6113701.5625
136344.0813775.625
135341.5513812.65625
134339.0213886.71875
133336.4913923.75
132333.9613997.8125
131331.4314034.84375
130328.914108.90625
129326.3714145.9375
128323.8414220
127321.3114257.03125
126318.7814331.09375
125316.2514368.125
124313.7214442.1875
123311.1914479.21875
122308.6614553.28125
121306.1314590.3125
120303.614664.375
119301.0714701.40625
118298.5414775.46875
117296.0114849.53125
116293.4814886.5625
115290.9514960.625
114288.4214997.65625
113285.8915071.71875
112283.3615108.75
111280.8315182.8125
110278.315256.875
109275.7715293.90625
108273.2415367.96875
107270.7115442.03125
106268.1815479.0625
105265.6515553.125
104263.1215590.15625
103260.5915664.21875
102258.0615738.28125
101255.5315775.3125
10025315849.375
99250.4715923.4375
98247.9415960.46875
97245.4116034.53125
96242.8816108.59375
95240.3516182.65625
94237.8216219.6875
93235.2916293.75
92232.7616367.8125
91230.2316404.84375
90227.716478.90625
89225.1716552.96875
88222.6416627.03125
87220.1116664.0625
86217.5816738.125
85215.0516812.1875
84212.5216886.25
83209.9916960.3125
82207.4616997.34375
81204.9317071.40625
80202.417145.46875
79199.8717219.53125
78197.3417293.59375
77194.8117330.625
76192.2817404.6875
75189.7517478.75
74187.2217552.8125
73184.6917626.875
72182.1617700.9375
71179.6317737.96875
70177.117812.03125
69174.5717886.09375
68172.0417960.15625
67169.5118034.21875
66166.9818108.28125
65164.4518182.34375
64161.9218256.40625
63159.3918330.46875
62156.8618404.53125
61154.3318478.59375
60151.818552.65625
59149.2718626.71875
58146.7418663.75
57144.2118737.8125
56141.6818811.875
55139.1518885.9375
54136.6218960
53134.0919034.0625
52131.5619108.125
51129.0319182.1875
50126.519293.28125
49123.9719367.34375
48121.4419441.40625
47118.9119515.46875
46116.3819589.53125
45113.8519663.59375
44111.3219737.65625
43108.7919811.71875
42106.2619885.78125
41103.7319959.84375
40101.220033.90625
3998.6720107.96875
3896.1420219.0625
3793.6120293.125
3691.0820367.1875
3588.5520441.25
3486.0220515.3125
3383.4920589.375
3280.9620663.4375
3178.4320774.53125
3075.920848.59375
2973.3720922.65625
2870.8420996.71875
2768.3121070.78125
2665.7821181.875
2563.2521255.9375
2460.7221330
2358.1921404.0625
2255.6621515.15625
2153.1321589.21875
2050.621663.28125
1948.0721774.375
1845.5421848.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.





  • No labels