Difference between revisions of "MCE flat-file format"

From MCEWiki
(Frame header)
(Frame header)
Line 13: Line 13:
 
= Frame header =
 
= Frame header =
  
The variety of frame headers is described in the document "MCE File Formats", version 3.3This document is out of date in many ways, but the descriptions of the frame headers up to version 6 should be accurate.
+
The frame header is 43 words longThe table below describes the most useful fields in the header. Esoteric fields are omitted; absent offsets are not necessarily unused.
 
 
http://www.phas.ubc.ca/%7Emce/mcedocs/index.html
 
 
 
 
 
A summary of the contents of the header are as follows: (some esoteric fields are omitted; absent offsets are not necessarily unused)
 
  
 
{| border="5"
 
{| border="5"
Line 48: Line 43:
 
| 12 || user_word || Status || Contents of "cc user_word", which the user may use to store other significant information.
 
| 12 || user_word || Status || Contents of "cc user_word", which the user may use to store other significant information.
 
|}
 
|}
 +
 +
A more complete description of the version 6 frame header can be found in the document "MCE File Formats", version 3.3:
 +
 +
http://www.phas.ubc.ca/%7Emce/mcedocs/index.html
 +
 +
This document is out of date in some respects, but the descriptions of the frame headers up to version 6 should be accurate.
 +
  
 
== Frame status bits ==
 
== Frame status bits ==
Line 86: Line 88:
 
The size and structure of the readout data block can be determined from
 
The size and structure of the readout data block can be determined from
 
* num_rows_reported
 
* num_rows_reported
* bits 10-13 of the frame status bits
+
* bits 10-13 of the frame status bits, which we will call RC1_on, RC2_on, RC3_on, RC4_on (each taking a value of 1 or 0)
 +
 
 +
In particular we can determine the number of readout cards reporting, as
 +
 
 +
N_card = (RC1_on + RC2_on + RC3_on + RC4_on)
 +
 
 +
and this gives the size of the readout data block, in words, as
 +
 
 +
N_data = 8 * num_rows_reported * N_card
 +
 
 +
with 8 representing the number of columns managed by each readout card.
 +
 
 +
The organization of the frame data is described in the next section.

Revision as of 12:17, 19 March 2008

This document describes one of MAS/MCE's output file formats. The "DAS flat-file" format is closely related to the form that frame data have when they arrive at the PC from the MCE. This format has many weaknesses as far as end users are concerned. Only flat-files with "header version 6" are described here.

The data consist of any number of "frames". In a given flat-file, all frames should have the same size. The frame size can be determined from the first 28 bytes of the file. No MCE flat-file will be shorter than 28 bytes.

The natural data unit of MCE data is the 32-bit unsigned integer. We refer to 32-bit integers as "words". All offsets are expressed in terms of words, and should be multiplied by 4 to get the byte offset.

An MCE/DAS frame, up to and including header version 6, consists of the following:

  • 43 words of header information
  • 8*R*N words of data, where N is the number of readout cards reporting and R is the number of rows reporting.
  • 1 word of checksum information

Frame header

The frame header is 43 words long. The table below describes the most useful fields in the header. Esoteric fields are omitted; absent offsets are not necessarily unused.

Offset Name Category Detail
0 Frame status bits Status/Structure described below
1 CC frame counter Status internal counter, starts at the value of "cc ret_dat_s" and increments by 1 for each output frame.
2 row_len Timing Dwell time of the multiplexer on each row, in units of 1/50 MHz
3 num_rows_reported Structure Number of rows in each column that are reported in each output frame.
4 data_rate Timing Number of internal frames that MCE processes before outputting one to the user.
6 header version Structure 6, the number "six". Subject to change in future header versions.
7 ramp value Status Current value of the internal ramping parameter
8 ramp address Status Card and parameter address of the internal ramping parameter (bits [31-16] are card_addr, bits [15-0] are param_id)
9 num_rows Timing Number of rows that the MCE is servoing
10 Sync box number Status Synchronization number, originating at the sync box, that is used to synchronize data from multiple MCEs and the housekeeping system
11 run_id Status Contents of "cc run_id", typically the ctime (unix time) associated with the acquisition.
12 user_word Status Contents of "cc user_word", which the user may use to store other significant information.

A more complete description of the version 6 frame header can be found in the document "MCE File Formats", version 3.3:

http://www.phas.ubc.ca/%7Emce/mcedocs/index.html

This document is out of date in some respects, but the descriptions of the frame headers up to version 6 should be accurate.


Frame status bits

Bit Category Detail
0 Status Last frame bit, indicates that current acquisition cycle has completed. This does not necessarily indicate the last frame in a flat-file.
1 Status Stop bit, indicates that MCE was commanded to stop acquisition and this is the last frame.
2 Status Sync box free run mode bit, indicates that sync box is generating the data valid information (rather than accepting an external trigger)
3 Status Sync box error bit.
4 Status TES bias square wave level (not present in most firmware)
10 Structure Readout card 1 data are present.
11 Structure Readout card 2 data are present.
12 Structure Readout card 3 data are present.
13 Structure Readout card 4 data are present.

Bits 10-13 are especially relevant for determining the frame size and data structure.

Timing parameters

The internal frame rate of the MCE (the rate at which a given row is servoed) and the output frame rate of the MCE (the rate at which frames are returned to the PC and recorded to disk) can be calculated as follows:

f_internal = 50 MHz / (num_rows * row_len)
f_output   = f_internal / data_rate

Structure determination

The size and structure of the readout data block can be determined from

  • num_rows_reported
  • bits 10-13 of the frame status bits, which we will call RC1_on, RC2_on, RC3_on, RC4_on (each taking a value of 1 or 0)

In particular we can determine the number of readout cards reporting, as

N_card = (RC1_on + RC2_on + RC3_on + RC4_on)

and this gives the size of the readout data block, in words, as

N_data = 8 * num_rows_reported * N_card

with 8 representing the number of columns managed by each readout card.

The organization of the frame data is described in the next section.