Difference between revisions of "Data mode"

From MCEWiki
(1<sup>st</sup> Stage SQUID Feedback Calculation)
 
(47 intermediate revisions by 7 users not shown)
Line 1: Line 1:
= 1<sup>st</sup> Stage SQUID Feedback Calculation =
+
During data readout from the MCE, there are different types of data associated with each detector. These are:
* The error calculated by the MCE from the Series Array output is:
 
'''sq_error''' = <math>\Sigma</math>(adc_reading – adc_offset)
 
* The feedback applied by the MCE to the 1<sup>st</sup> stage SQUIDs is:
 
'''sq_feedback''' = [(p_coeff*'''sq_error''')+(i_coeff*integral)+(d_coeff*difference)] / ['''2<sup>12</sup>''']
 
  
= Table of Data Modes (Current as of Revision 4.0.c)=
+
# calculated SQ1 feedback ('''''sq1_fb'''''):
* The the formulas for the data modes listed below make liberal use of the '''sq_error''' and '''sq_feedback''' variables, which are defined above.
+
#* <math>sq1\_fb_{n+1} = \frac{1}{2^{12}} \left[\left(gainp \times q_{n}\right) + \left(gaini \times \sum_{i=1}^{n} error_i\right) + \left(gaind \times [error_{n} - error_{n-1}]\right)\right] </math>
 +
#* where <math> q_n=error_n + b\times q_{n-1}</math>
 +
#* ''n'' is the multiplexing-frame index
 +
#*''i'' is reset when the PID servo is restarted by setting the {{param|rc|servo_mode}} to 3 or {{param|rc|flx_lp_init}} to 1.
 +
#*''b'' < 1 and specified by {{param|rc|pterm_decay_bits}}
 +
# coadded error ('''''error'''''):
 +
#* calculated from the Series-Array signal sampled @ 50MHz by the ADC
 +
#* <math>error = \sum_{1}^{sample\_num} (adc\_reading_{i} - adc\_offset)</math>
 +
# low-pass filtered SQ1 feedback ('''''sq1_fb_filtered'''''):
 +
#*see [[ Digital 4-pole Butterworth Low-pass filter | 4-pole Butterworth low-pass filter ]]. 
 +
#* The effective DC gain, including quantization error, is approximately: <math>sq1\_fb\_filtered_{n} \simeq 1218 \times \left[sq1\_fb_{n-1}\right]</math>
 +
# flux-jump counter ('''''num_flux_jumps''''').  See [[ Flux jumping ]].
 +
# raw ADC samples @ 50 MHz ('''''raw''''').  See [[ Raw-mode readout ]].
  
{| border="1"
+
Note that '''''error''''', '''''sq1_fb''''', and '''''sq1_fb_filtered''''' are internally stored as 32 bits while '''''num_flux_jumps''''' are stored as 8 bits and '''''raw''''' as 14 bits. During readout the appropriate windowing is chosen for each data type.
 +
== Data Modes and Windowing ==
 +
The type of data reported by the MCE during data acquisition is determined by the MCE parameter {{param|rc|data_mode}}. Depending on the data mode, the reported data will be windowed in a different way. The notes in the table below explain the windowing, in terms of how many bits are reported and the relative scaling of the windowed value relative to some reference data mode. The reference data modes for error, sq1fb and filtered_sq1fb are, respectively, 0, 1, and 2.
 +
 
 +
{| class="wikitable"
 
|-
 
|-
! Data Mode !! Summary !! Pixel-Data Description !! RC Firmware Revision  
+
! data-mode !! data-type !! Description !! RC Firmware Revision  
 
|-
 
|-
 
| 0  
 
| 0  
|| Error
+
|| <center>''error''</center>
|| 32b (signed) co-added Error signal err[31:0].
+
|| 32b (signed) co-added error <br />
 
+
* [31:0] = error
'''error_mode0''' = sq_error
 
  
 
|| all
 
|| all
 
|-
 
|-
 
| 1  
 
| 1  
|| Feedback
+
|| <center>''sq1_fb''</center>
||32b (signed) SQ1 Feedback data fb[31:0]. When servo_mode = 3:  
+
|| 32b (signed) calculated SQ1 feedback.
 
+
* [31:0] = sq1_fb * 2<sup>12</sup> when {{param|rc|servo_mode}} = 3
'''feedback_mode1''' = sq_feedback
+
* [31:0] = sq1_fb when {{param|rc|servo_mode}} != 3
 
+
''Note that {{param|rc|servo_mode}}=3 is the normal running condition. The non-servoing form, used at times during array-auto-tune for example, is included here for completeness.
 +
''  
 
|| all
 
|| all
 
|-
 
|-
 
| 2  
 
| 2  
|| Filtered feedback
+
|| <center>''filtered_sq1_fb''</center>
||32b (signed) low-pass filtered SQ1 feedback data fb[31:0]
+
||32b (signed) low-pass filtered SQ1 feedback data.  <br />
 
+
* [31:0] = sq1_fb_filtered
'''flt_fb_mode2''' = sq_feedback * 1218 (@ DC)
 
  
 
|| 2.0.5 and later
 
|| 2.0.5 and later
 
|-
 
|-
| 3  
+
| 3 obsolete <br /> (see 12)
|| Raw 50 MHz
+
|| <center>raw</center>
|| Raw 50 MHz ADC samples raw[13:6].
+
|| Raw 50 MHz ADC samples raw[13:i], where i=0 in rev. 4.3.7 and i=6 in all previous firmware. <br />
 
+
* [31:0] = raw_data / (2<sup>i</sup>),
'''raw_mode3''' = (adc_reading – adc_offset) / (2<sup>6</sup>),
 
 
 
except in rev. 4.3.7 where the gain is unity
 
  
 
|| Only 3.0.6, 3.0.16, 3.0.25, 4.1.7, 4.2.7, 4.3.7
 
|| Only 3.0.6, 3.0.16, 3.0.25, 4.1.7, 4.2.7, 4.3.7
 
|-
 
|-
 
| 4  
 
| 4  
|| 18:14 Mixed
+
|| <center>18:14 mixed </center>
||Signed 18b SQ1 feedback fb[31] & fb[28:12] + signed 14b coadded error signal err[31] & err[12:0].  
+
||signed 18b SQ1 feedback + signed 14b coadded error   <br />
 
+
* [31:14] = sq1_fb
'''feedback_mode4''' = sq_feedback / (2<sup>12</sup>)
+
* [13:0]  = error
 
 
'''error_mode4''' = sq_error
 
  
 
|| 2.0.9 and later
 
|| 2.0.9 and later
 
|-
 
|-
 
| 5  
 
| 5  
|| 24:8 mixed  
+
|| <center>24:8 mixed </center>
|| Signed 24b SQ1 feedback fb[31:8] + signed 8b num_flux_jumps fj[7:0].
+
|| signed 24b SQ1 feedback + signed 8b num_flux_jumps[7:0]. <br />
 
+
* [31:8] = sq1_fb * 2<sup>4</sup>
'''feedback_mode5''' = sq_feedback / (2<sup>8</sup>)
+
* [7:0]  = num_flux_jumps
  
 
|| all
 
|| all
 
|-
 
|-
 
| 6 obsolete  
 
| 6 obsolete  
|| 18:14 mixed
+
|| <center>18:14 mixed</center>
|| Signed 18b filtered data filter[31] & filter[27:11] + signed 14b coadded error signal err[31] & err[12:0].
+
|| signed 18b filtered data + signed 14b co-added <br />
 
+
* [31:13] = sq1_fb_filtered / (2<sup>11</sup>)
'''filtered_fb_mode6''' = sq_feedback * 1218 / (2<sup>11</sup>)
+
* [12:0]  = error
 
 
'''error_mode6''' = sq_error
 
  
 
|| 3.0.30 to 4.0.6 only
 
|| 3.0.30 to 4.0.6 only
 
|-
 
|-
 
| 7  
 
| 7  
|| 22:10 mixed
+
|| <center>22:10 mixed</center>
|| Signed 22b filtered data filter[31] & filter[27:7] + signed 10b coadded error signal err[31] & err[12:4].
+
|| signed 22b filtered data + signed 10b coadded error<br />
 
+
* [31:10] = sq1_fb_filtered / (2<sup>7</sup>)
'''filtered_fb_mode7''' = sq_feedback * 1218 / (2<sup>7</sup>)
+
* [9:0]  = error / (2<sup>4</sup>)
 
 
'''error_mode7''' = sq_error / (2<sup>4</sup>)
 
  
 
|| 4.0.2 and later
 
|| 4.0.2 and later
 
|-
 
|-
 
| 8 obsolete
 
| 8 obsolete
||24:8 mixed  
+
||<center>24:8 mixed</center>
|| Signed 24b filtered data filter[31:8] + signed 8b num_flux_jumps fj[7:0].
+
|| signed 24b filtered data + signed 8b num_flux_jumps[7:0]. <br />
 
+
* [31:8] = sq1_fb_filtered / (2<sup>8</sup>)
'''filtered_fb_mode8''' = sq_feedback * 1218 / (2<sup>8</sup>)
+
* [7:0]  = num_flux_jumps
  
 
|| 4.0.4 only
 
|| 4.0.4 only
 
|-
 
|-
| 9  
+
| 9 obsolete
|| 24:8 mixed  
+
|| <center>24:8 mixed </center>
|| Signed 24b filtered data filter[31] & filter[23:1] + signed 8b num_flux_jumps fj[7:0].
+
|| signed 24b filtered data + signed 8b num_flux_jumps[7:0]. <br />
 
+
* [31:8] = sq1_fb_filtered/ (2<sup>1</sup>)
'''filtered_fb_mode9''' = sq_feedback * 1218 / (2<sup>1</sup>)
+
* [7:0]  = num_flux_jumps
  
|| 4.0.5 and later
+
|| 4.0.5 till 4.0.a
 
|-
 
|-
 
| 10  
 
| 10  
|| 25:7 mixed  
+
|| <center>25:7 mixed</center>
|| Signed 25b filtered data filter[27:3] + signed 7b num_flux_jumps fj[6:0].
+
|| Signed 25b filtered data + signed 7b num_flux_jumps. <br />
 
+
* [31:7] = sq1_fb_filtered / (2<sup>3</sup>)
'''filtered_fb_mode10''' = sq_feedback * 1218 / (2<sup>3</sup>)
+
* [6:0]  = num_flux_jumps
  
 
|| 4.1.6, 4.0.b and later
 
|| 4.1.6, 4.0.b and later
|}
+
|-
 +
| 11
 +
|| <center>6:3 mixed, debugging mode </center>
 +
|| Unsigned 6b row_index + unsigned 3b column_index. <br />
 +
* [31:10] '''----'''
 +
* [9:3] '''row_index'''
 +
* [2:0] '''column_index'''
  
= Note regarding units =
+
|| 5.0.0 and later
 +
|-
 +
| 12
 +
||<center> raw</center>
 +
|| Raw 50 MHz ADC samples raw[13:0], sign-extended to 32 bits.
 +
* [31:0] = raw_data
  
During normal readout (i.e. not raw mode), there are 4 data associated with each channel. These are:
+
|| 4.0.d, 4.0.e, 5.0.1+
* co-added error ("error")
 
* sq1 feedback ("sq1fb")
 
* filtered sq1 feedback ("filtered sq1fb")
 
* flux jump counter ("num_flux_jumps")
 
 
 
Depending on the data mode, these values will be windowed in a different way. The notes in the table above explain the windowing, in terms of how many bits are reported and the relative scaling of the windowed value relative to some reference data mode.
 
 
 
The scaling is quoted as being relative to some reference data mode.  For example, in data mode 4 the text
 
 
 
"The feedback reported in this mode is divided by 2<sup>12</sup> compared to data_mode=1."
 
 
 
is meant to imply that if I were to observe the same system's feedback in data_mode 4 and data_mode 1, and call the two measurements fb_4 and fb_1, then I would expect
 
 
 
  fb_4 = fb_1 >> 12 = floor[ fb_1 / 2^12 ]
 
 
 
where >> denotes the right-bit-shift operator.
 
 
 
The reference data modes for error, sq1fb and filtered sq1fb are, respectively, 0, 1, and 2. In these modes, the meaning of the data are as follows:
 
 
 
{| border="1"
 
|-
 
!width="10%"| Signal !!width="10%"| Reference data mode !! Description
 
|-
 
| co-added error || 0 || Co-added error for the current internal MCE frame. For ADC readings Y, adc_offset Y<sub>o</sub> and where n is the sample_num, the error e is  <math>e = \sum_1^n (Y - Y_0)</math>, where n is sample_num.
 
|-
 
| SQ1 feedback || 1 || Calculated squid1 feedback.  Note that this number should be distinguished from the sq1_DAC value, which is obtained from bits [25:12] of the SQ1 feedback.  When flux-jumping is active, an integer multiple of the flux_quanta value will be subtracted from sq1_DAC prior to application to the DAC.
 
|-
 
| filtered SQ1 feedback || 2 || The output from the [[ Digital 4-pole Butterworth Low-pass filter | 4-pole Butterworth low-pass filter ]].  The input to the filter is the SQ1 feedback signal.  The effective DC gain, including quantization error, is approximately 1216.
 
|-
 
 
|}
 
|}
  
 +
== Links ==
 +
* [[ MCE firmware ]]
  
Please note that, by default, [[ mas_data.pro ]] will rescale data in the following way:
+
[[Category:Readout Card Firmware]]
 
+
[[Category:MAS]]
* error signals are rescaled to match the units of data mode 0.
+
[[Category:MCE Script]]
* sq1 feedback is rescaled to sq1_DAC units (i.e. data mode 1 divided by 2<sup>12</sup>)
 
* filtered sq1 feedback is rescaled to the units of data mode 2.
 

Latest revision as of 14:35, 6 August 2019

During data readout from the MCE, there are different types of data associated with each detector. These are:

  1. calculated SQ1 feedback (sq1_fb):
    • <math>sq1\_fb_{n+1} = \frac{1}{2^{12}} \left[\left(gainp \times q_{n}\right) + \left(gaini \times \sum_{i=1}^{n} error_i\right) + \left(gaind \times [error_{n} - error_{n-1}]\right)\right] </math>
    • where <math> q_n=error_n + b\times q_{n-1}</math>
    • n is the multiplexing-frame index
    • i is reset when the PID servo is restarted by setting the servo_mode to 3 or flx_lp_init to 1.
    • b < 1 and specified by pterm_decay_bits
  2. coadded error (error):
    • calculated from the Series-Array signal sampled @ 50MHz by the ADC
    • <math>error = \sum_{1}^{sample\_num} (adc\_reading_{i} - adc\_offset)</math>
  3. low-pass filtered SQ1 feedback (sq1_fb_filtered):
    • see 4-pole Butterworth low-pass filter .
    • The effective DC gain, including quantization error, is approximately: <math>sq1\_fb\_filtered_{n} \simeq 1218 \times \left[sq1\_fb_{n-1}\right]</math>
  4. flux-jump counter (num_flux_jumps). See Flux jumping .
  5. raw ADC samples @ 50 MHz (raw). See Raw-mode readout .

Note that error, sq1_fb, and sq1_fb_filtered are internally stored as 32 bits while num_flux_jumps are stored as 8 bits and raw as 14 bits. During readout the appropriate windowing is chosen for each data type.

Data Modes and Windowing

The type of data reported by the MCE during data acquisition is determined by the MCE parameter data_mode. Depending on the data mode, the reported data will be windowed in a different way. The notes in the table below explain the windowing, in terms of how many bits are reported and the relative scaling of the windowed value relative to some reference data mode. The reference data modes for error, sq1fb and filtered_sq1fb are, respectively, 0, 1, and 2.

data-mode data-type Description RC Firmware Revision
0
error
32b (signed) co-added error
  • [31:0] = error
all
1
sq1_fb
32b (signed) calculated SQ1 feedback.

Note that servo_mode=3 is the normal running condition. The non-servoing form, used at times during array-auto-tune for example, is included here for completeness.

all
2
filtered_sq1_fb
32b (signed) low-pass filtered SQ1 feedback data.
  • [31:0] = sq1_fb_filtered
2.0.5 and later
3 obsolete
(see 12)
raw
Raw 50 MHz ADC samples raw[13:i], where i=0 in rev. 4.3.7 and i=6 in all previous firmware.
  • [31:0] = raw_data / (2i),
Only 3.0.6, 3.0.16, 3.0.25, 4.1.7, 4.2.7, 4.3.7
4
18:14 mixed
signed 18b SQ1 feedback + signed 14b coadded error
  • [31:14] = sq1_fb
  • [13:0] = error
2.0.9 and later
5
24:8 mixed
signed 24b SQ1 feedback + signed 8b num_flux_jumps[7:0].
  • [31:8] = sq1_fb * 24
  • [7:0] = num_flux_jumps
all
6 obsolete
18:14 mixed
signed 18b filtered data + signed 14b co-added
  • [31:13] = sq1_fb_filtered / (211)
  • [12:0] = error
3.0.30 to 4.0.6 only
7
22:10 mixed
signed 22b filtered data + signed 10b coadded error
  • [31:10] = sq1_fb_filtered / (27)
  • [9:0] = error / (24)
4.0.2 and later
8 obsolete
24:8 mixed
signed 24b filtered data + signed 8b num_flux_jumps[7:0].
  • [31:8] = sq1_fb_filtered / (28)
  • [7:0] = num_flux_jumps
4.0.4 only
9 obsolete
24:8 mixed
signed 24b filtered data + signed 8b num_flux_jumps[7:0].
  • [31:8] = sq1_fb_filtered/ (21)
  • [7:0] = num_flux_jumps
4.0.5 till 4.0.a
10
25:7 mixed
Signed 25b filtered data + signed 7b num_flux_jumps.
  • [31:7] = sq1_fb_filtered / (23)
  • [6:0] = num_flux_jumps
4.1.6, 4.0.b and later
11
6:3 mixed, debugging mode
Unsigned 6b row_index + unsigned 3b column_index.
  • [31:10] ----
  • [9:3] row_index
  • [2:0] column_index
5.0.0 and later
12
raw
Raw 50 MHz ADC samples raw[13:0], sign-extended to 32 bits.
  • [31:0] = raw_data
4.0.d, 4.0.e, 5.0.1+

Links