Products 37..40, 45..48  Compressed 3D particles distributions  
DESC: 	P37 to P40, 31 Energies x 88 angles protons, alphas,He+,O+.
 	P41 to P44, 31 Energies x 128 angles protons, alphas,He+,O+.  
P #37 (3D Proton, 88a, 31e)     
P #41 (3D Proton, 128a,31e)     
P #38 (3D Alphas, 888a,31e)     
P #42 (3D Alphas, 128a,31e)     
P #39 (3D He+, 88a,31e)     
P #43 (3D He+, 128a,31e)     
P #44 (3D O+, 888a,31e)     
P #44 (3D O+, 128a,31e)     
       	Multiple products are generated by the same basic routines  
       	to minimize the amount of code required.  Thus, functions are 
       	parameterized for Mass#, #Energies, and Solid Angle 
       	conversion table.  
 HIST: 	17-09-96  AMD  Created file starting from p-3d.asm
       	13-03-97  AMD  Updated the mass parameter for P42
       	28-08-97  AMD  Remapped 3Ds numbering & defined P45 to P48
  
 NOTE: PRODUCT GENERATION
         
       Mass counters are processed every 22.5 degrees.  The 
       counters are simply summed over the duration of the 
       product interval (see tlm allocation tables in 
       t-op.asm).  
                #                Sum   Tlm      1-Buf 2-Buf
        Prod  Solid    #   Mass  Buf   Pkt    # # Mem    Mem
        Num  Angles Energy  Num  Size  Size Pkts Use    Use
        ---- ------ ------ ----  ----  ---- ---- ----   ----
        #37    88     31     1   2728   XXX   2  2829   5563
        #38    88     31     2   2728   XXX   2  2829   5563
        #39    88     31     3   2728   XXX   2  2829   5563
        #40    88     31     4   2728   XXX   2  2829   5563
        #45   128     31     1   3968   XXX   2  4069   8043
        #46   128     31     2   3968   XXX   2  4069   8043
        #47   128     31     3   3968   XXX   2  4069   8043
        #48   128     31     4   3968   XXX   2  4069   8043  
       being XXX fields variable i.e. depending on the effective compression
       ratios. (Sizes are in words.  Pkt size is buffer size compressed
       and divided into valid pkt sizes + 2 word pkt hdr)  
       When the product interval has expired, the summation buffer 
       is sent to the product telemetry sub-task which compresses 
       the 16-bit sums following the compression algorithm (based on
       an idea of J.A.- Sauvaud & C.Aoustin CESR and implemented by A.M.D.)
       and passes the packet to the telemetry packet queue.
       The compression is based on the evaluation of the dispersion
       of the maximum of a data token around the average of the
       data token itself. If the maximum satisfies the following:
                  Max -(K1/K2*sqrt(Max) < Token_Average
       the data are assumed to be equal to the Token average which is
       transmitted as representative of the whole token. Otherwise the
       token length is scaled by a factor two and the above relation is
       re-checked until it is satisfied or the token length has reduced
       to one. If K1 is assumed to be equal 0 the compression becomes error
       free apart for the initial semi-log compression applied on the
       entry buffer which reduces the 16-5 LSB bits of the each count word to
       0 and keeps the 5 MSB as they are. The factor K2 has been introduced
       to support fractional compression factors while integer (fast)
       operations can still be used. The above compression processing can
       be resumed in the following steps:
       1- Suppress 16-5 LSBs of the whole buffer.
       2- Set entry token lenght and work buffer (8 energies)
       3- Average (by right shifts) and Maximum computation for current token
       4- if {
          Max_tok < Avg_tok +K1/K2*sqrt(Max_tok) go to 5- }
          else {
                if { token length is 1 goto 5-}
                else { scale by two the current token length then goto 3 }
          }
       5- encode the token (see belove)  
       Note that K2 rationing is obtained by right shifts.  
       The sqrt(Max_tok) is computed according the following:
       1- Mask     = 80h
       2- value    = 0
       3- FOR I=1 to 8
                VAL = value
                VAL = VAL + MASK
                X = VAL*VAL
                IF X< Max_tok THEN VALUE = VAL
                ENDIF
                shif_right_of1(Mask)
          CONTINUE
       4- RETURN(VAL)  
       The encoding is performed defining one control byte for the next
       following 4 data bytes (each one defining a standard Semi-log
       compressed value). The control byte is divided into four 2-bits
       fields. Each field tells how many times the corresponding data byte
       has to be repeated decompressing the data, according to the following
       two bit code:
                                00 for 1 time only
                                01 for 2 times
                                10 for 4 times
                                11 for 8 times
       The first two MSB bits (i.e. the 7th and the 6th) in the control byte
       controls the repetitions of the first data byte. The the 5th and the
       4th bits in the control bytes control the repetition of the 2nd data
       byte, the 3rd and the 2nd bits the third data byte, finally the 1st
       and the 0th bits the last data byte.  
       The sub-tasks are similar, so generic sub-task routines are
       used by each of the product tasks.  
       The tasks will double-buffer the summation data if enough 
       memory is available.  Otherwise, only one buffer will be 
       allocated.  If there isn't enough memory for at least one 
       buffer, then an error is posted, and the product task is 
       deleted.  
       SUMMATION BUFFER
         
       The product summation buffer sizes are provided in the 
       table above; each is determined by the number of solid 
       angles, energies, and masses in the product.  
       Product #37(38,39,40) Summation Buffer:
                             Buffer  Sector  Solid  Mass
                             Offset  Energy  Angle   No.
                             ------  -----  ------  ----
                                 0      0       0     1
                                 1      0       1     1
                                 2      0       2     1
                               ...    ...     ...    ..
                                87      0      87     1
                                88      1       0     1
                                89      1       1     1
                               ...    ...     ...    ..
                               175      1      87     1
                               176      2       0     1
                               ...    ...     ...    ..
                              2727     30      87     1  
       Product #45(46,47,48) Summation Buffer:
                             Buffer  Sector  Solid  Mass
                             Offset  Energy  Angle   No.
                             ------  -----  ------  ----
                                 0      0       0     1
                                 1      0       1     1
                                 2      0       2     1
                               ...    ...     ...    ..
                               127      0     127     1
                               128      1       0     1
                               129      1       1     1
                               ...    ...     ...    ..
                               255      1     127     1
                               256      2       0     1
                               ...    ...     ...    ..
                              3967     30     127     1  
       A buffer index for a given counter value is computed using 
       the following formula:  
           Sum Buffer Index = Energy * ApE + Angle_t[Sweep*8+Anode]  
           Energy  = Energy step of ctr sample (0..15 or 0..30)
           ApE     = Angles per Energies (88 or 128)
           Angle_t = Table of solid angles per Sweep and Anode index
           Sweep   = 0..15 (sector >> 5) (0..15 sweep_i @22.5 deg)
           Anode   = 0..7  
       "Angle_t", "ApE", and "Mass" are passed to a generic task 
       routine.  Every "Anode" is processed for the specified mass.    
       Also, a pointer to the correct mass section of the buffer 
       is used when multiple masses are computed.  Each sum is 
       clamped to FFFFh (unsigned value).  
       PACKET BUFFERS
         
       The summation buffer is log compressed from 16-bits down 
       according to the compression factors.
       This results in a product size of half the summation buffer
       size (see table above).  Most of these products must be sent
       in multiple packets (using the sequence field in the pkt
       headers).  
       MEMORY USE
         
       The summation buffer memory is reused for the telemetry 
       packet buffer.  In addition six words are allocated just
       before the summation buffer for a 2-word packet handling 
       structure and 4-word packet header with thew following
       meaning:
                   1 - standard packet done flag
                   2 - standard packet full size -1
                   3 - standard TLM packet header 1st word
                   4 - standard TLM packet header 1st word
                   5 - compression factors k1 (MSB) k2 (LSB) info word
                   6 - 1st DATA word for formatted TLM packet OR
                       DUMMY word during the time the buffer is
                       a summation buffer. This is due to the fact
                       the compression routine trashes always the
                       first word of the input buffer during the ini-
                       tialization . Therfore this gap allows to share
                       the summation buffer with the output compression
                       buffer.
  
       Therefore the  memory use is:  
            Length
           (words)   Description
            ------   ---------------
                2    packet handling structure
                2    packet header
                2    compression info data + Gap (compression margin word)
                n    summation buffer
            ------   
              n+6    total per product buffer
               41    product variables
               27    sub-task tss
            ------
             n+74    allocation for 1st buffer
               27    task tss (at prod task creation)
            ------
             n+101   Total allocation for 1-buffer product
              n+6    allocation for 2nd buffer
            ------
            2n+107    Total allocation for 2-buffer product  
       DATA COLLECTION
         
       The counters for the appropriate mass are read every 22.5 
       degrees by pending on the evt_ctr22 event word.
        

TLM tables ] Diag events ] Mag field ] Moments ] 3D Mass ] 3D distributions ] [ 3D compr ] Scrtch Pxs ]

Home Page