pro bcs_old_struct, BCS_QS_0211_Instr = BCS_QS_0211_Instr,  $
                     BCS_0211_Index = BCS_0211_Index,  $
                     BCS_2021_DP_Sync = BCS_2021_DP_Sync
   
   
;+
;       NAME:
;               BCS_OLD_STRUCT
;       PURPOSE:
;               Define the following BCS specific database structures
;                       * BCS_QS_0211_Instr_Rec          
;                       * BCS_0211_Index_Rec
;                       * BCS_2021_DP_Sync_Rec
;
;       CALLING SEQUENCE:
;               BCS_OLD_STRUCT
;       HISTORY:
;               written by Mons Morrison, Fall 91.
;
;-
   
   
BCS_QS_0211_Instr = { BCS_QS_0211_Instr_Rec,              $
      entry_type : FIX('0211'),  $           ;
                                             ; 00- Structure/Entry type
                                             ;
      st_time: LONG(0),  $                   ; 02- Start time (millisec of day) of valid data
      st_day: FIX(0),  $                     ; 06- Start day (since 1-Jan-79)
      en_time: LONG(0),  $                   ; 08- End time (millisec of day)
      en_day: FIX(0),  $                     ; 12- End day (since 1-Jan-79)
                                             ;
                                             ;     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      SCAval: BYTARR(4,2),  $                ; 14- Upper and lower channel SCA settings                      W49 F32
                                             ;       (Channel, 1=lower)                                             
                                             ;       (channel, 2=upper)
      hv_control: BYTARR(2),  $              ; 22- HV control (commanded)                                    W49 F32
                                             ;       LSB = b0
                                             ;       b0:2 = trim for HVA
                                             ;       b4:6 = trim for HVB
                                             ;       NOTE: Changes in one orbit during a cal
                                             ;TODO - change to be one element
      stim_control: BYTARR(2),  $            ; 24- Stimulus on/off                                           W49 F32
                                             ;       LSB = b0
                                             ;       b0: Detector A internal stim generator (set=off)
                                             ;       b1: Detector A stim source (set=internal)
                                             ;       b2: Detector A multiplexor (set=disable)
                                             ;       b4: Detector B internal stim generator (set=off)
                                             ;       b5: Detector B stim source (set=internal)
                                             ;       b6: Detector B multiplexor (set=disable)
                                             ;TODO - change to be one element
                                             ;     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
                                             ;
      sensitivity: BYTARR(4),  $             ; 26- Det. Sensitivity (Nominal Val= 200)                       Ground 
      posGain: LONARR(4),  $                 ; 30- Position Gain for det (Angstrom/Bin)                      Ground 
      posOffset: LONARR(4),  $               ; 46- Position Offsets. (micro-Angstrom)                        Ground 
                                             ;       NOTE that the Gain and offset are the 
                                             ;       slope and intercept of the line giving 
                                             ;       the conversion between bin numbers and 
                                             ;       wavelength.
                                             ;
      bcs2dp_ver: FIX(0),  $                 ; 62- Algorithm and parameters used to convert                  Ground 
                                             ;       between BCS timer and DP timer
      spare: BYTARR(16) }                    ; 64-
   
   
   
BCS_0211_Index = { BCS_0211_Index_Rec,              $
      index_version : FIX('0211'x),  $       ;
                                             ; 00- Index structure version
                                             ;
      dp_time_out: BYTARR(4),  $             ; 02- DP time (timer1,2,3 and FI) for when                      TODO-NE
                                             ;     the data is read out
                                             ;     Use this time to check the state of the
                                             ;     Spacecraft during readout - see 
                                             ;     BCS_DP_Sync_Rec structure
                                             ;
                                             ;     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      blockID: BYTE(0),  $                   ; 06- BCS Block ID                                              Derived
                                             ;      =0: Normal Queue Data Block
                                             ;      =1: Fast Queue Data Block
                                             ;      =2: Micro Dump Block (fixed extraction)
                                             ;      =3: Cal Data Block (fixed extraction)
      SeqID: BYTE(0),  $                     ; 07- Observation Sequence ID                                   (From M
      FlrFlagOpt: BYTE(0),  $                ; 08- Flare Flag Option Number                                  (From M
                                             ;
      ModeID: BYTE(0),  $                    ; 09- Mode ID (Grouper Plan)                                    (From M
                                             ;       For "Cal Mode" (BlockID = 2)
                                             ;       this holds the channel number as
                                             ;       derived from PHA_CONTROL with a
                                             ;       1.5 major frame delay
                                             ;               b4:7 = first 256 bytes
                                             ;               b0:3 = last 256 bytes
                                             ;       Value = 1,2,3,4
                                             ;       Value = 0 if unknown (data dropouts)
      ModeRepNum: BYTE(0),  $                ; 10- Mode Repeat Number                                        (From M
      ControlTally: BYTE(0),  $              ; 11- Control Byte Tally                                        (From M
      ControlByte: BYTE(0),  $               ; 12- Control Byte                                              (From M
                                             ;
      dgi: BYTE(0),  $                       ; 13- Data Gather Interval (125 msec units)                     (From M
                                             ;       For "Cal Mode" (BlockID = 2)
                                             ;       this value comes from                                   W49 F22
      nSampPChan: INTARR(4),  $              ; 14- Number of data samples per channel                        (From G
                                             ;
      total_cnts: INTARR(4),  $              ; 22- Total counts in each channel for the mode                 Derived
                                             ;
      DP_Flags: BYTE(0),  $                  ; 30- DP Flags received by BCS                                  (From M
                                             ;       7: Radiation Belt monitor (set = yes)
                                             ;       6,5:    = 0,0: No flare
                                             ;               = 1,0: Normal Flare
                                             ;               = 1,1: Great Flare
                                             ;               = 0,1: BCS MEM Mode
                                             ;       4,3:    = 0,0: Low (1 kps)
                                             ;               = 1,0: Med (4 kps)
                                             ;               = 0,1: Hi (32 kps)
                                             ;               = 1,1: Hi (32 kps)
                                             ;       2: BCS-OUT after flare (set = enable)
                                             ;       1: BCS-OUT after night (set = enable)
                                             ;       0: Currently BCS-OUT mode 
      BCS_Status: BYTE(0),  $                ; 31- BCS Status                                                (From M
                                             ;       7: SAA Threshold exceeded (set = yes)
                                             ;       6: Flare threshold exceeded (set = yes)
                                             ;       5: HVU's turned off by BVS SAA algorithm
                                             ;       4: Fe XXVI thershold exceeded
                                             ;       3: BCS is in night state
                                             ;       2: BCS is in SAA state
                                             ;       1: Status of data in queue (set = hi)
                                             ;       0: Status of BCS flare flag (set = hi)
                                             ;
      MissBasicData: BYTE(0),  $             ; 32- Flag to mark if the DP major frames                       Derived
                                             ;     for the period when the data was taken
                                             ;     were telemetered down (set = got the data)
                                             ;       (ie: got the basic part data for
                                             ;       the period when the data was taken)
      MissModeID: BYTE(0),  $                ; 33- Missing the beginning of the data which                   Derived
                                             ;     has the mode ID so all information is
                                             ;     guessed.
                                             ;
                                             ;     TODO - add percent data present
                                             ;
      spare: BYTARR(14) }                    ; 34- Spare bytes
   
   
   
BCS_2021_DP_Sync = { BCS_2021_DP_Sync_Rec,              $
      index_version : FIX('2021'x),  $       ;
                                             ; 00- Index structure version
                                             ;
      time: LONG(0),  $                      ; 02- Time (ms of day) of major frame during readout
      day: FIX(0),  $                        ; 06- Day since 1-Jan-79 or major frame during readout
                                             ;
      dp_time: BYTARR(4),  $                 ; 08- DP time (timer1,2,3 and FI) for when
                                             ;     the data is read out
      DP_mode: BYTE(0),  $                   ; 12- DP Mode during the readout 
                                             ;     (see Gen_Index for an explanation of the values)
      DP_rate: BYTE(0),  $                   ; 13- DP Rate during readout 
                                             ;     (see Gen_Index for an explanation of the values)
      Flare_Control: BYTE(0),  $             ; 14- Flare flag control during readout 
                                             ;     (see Gen_Index for an explanation of the values)
      Flare_Status: BYTARR(4),  $            ; 15- Flare flag status during readout 
                                             ;     (see Gen_Index for an explanation of the values)
      RBM_Status: BYTE(0),  $                ; 19- Radiation Belt Montitor Status
                                             ;     (see Gen_Index for an explanation of the values)
      Telemetry_mode: BYTE(0),  $            ; 20- Telemetry mode                   
                                             ;     (see Gen_Index for an explanation of the values)
      cal_status: BYTE(0),  $                ; 21- CAL status                       
                                             ;     (see Gen_Index for an explanation of the values)
                                             ;
                                             ;     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
                                             ;
      All_Cnts: INTARR(4,2),  $              ; 22- All counts for the 4 channels                             W66 F00
                                             ;                                                               W66 F32
                                             ;     Units = counts per "Acc_Interval" (see below)
      Lim_Cnts: INTARR(4,2),  $              ; 38- Limited for the 4 channels                                W66 F02
                                             ;                                                               W66 F34
                                             ;     Units = counts per "Acc_Interval" (see below)
      Acc_Cnts: INTARR(4,2),  $              ; 54- Accepted for the 4 channels                               W66 F04
                                             ;                                                               W66 F36
                                             ;   NOTE: For All_Cnts, Lim_Cnts, and Acc_cnts
                                             ;       the following applies
                                             ;     Units = counts per "Acc_Interval" (see below)
                                             ;       Cnts(n,m)       n = channel
                                             ;                       m = 2 per major frame
                                             ;       The onboard counter is an unsigned 16-bit counter
                                             ;       The reformatted data is saved as a signed 16-bit value
                                             ;       If the value is negative, then 65536 (which is 2^16)
                                             ;       needs to be added to the value.
      Acc_interval: BYTARR(2),  $            ; 70- Accumulation interval (sec)                               Derived
                                             ;     This value is only relevant for the differences
                                             ;     made to the PREVIOUS major frame for all_cnts(*,0)
                                             ;     Since there are two values dumped each major frame, 
                                             ;     the delta within the single major frame all_cnts(*,1)
                                             ;     is defined by the DP_RATE for that major frame.
                                             ;     TODO - check timing with BOB
                                             ;       Valid values are:
                                             ;               0 = Raw number (not counts/sec)
                                             ;                   Implies dropout for previous major frame
                                             ;               8 sec = 1/2 * 16 sec (med rate)
                                             ;               1 sec = 1/2 * 2 sec (high rate)
                                             ;               ? sec = transition high to med- TODO
                                             ;               ? sec = transition med to high - TODO
                                             ;     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
                                             ;
      pha_counts: BYTARR(8),  $              ; 72- PHA Data                                                  W66 F24
                                             ;                                                                   F56
      PHA_Control: BYTARR(2),  $             ; 80- PHA Control                                               W49 F32
                                             ;     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      SpecStatus: BYTARR(2),  $              ; 82- Spectrometer status                                       W112 F3
                                             ;       LSB = b0
                                             ;       b0 = Calibibration-B (set=enabled)
                                             ;       b1 = HVB logical flag (set=enabled)
                                             ;       b2 = HVB power (set=on)
                                             ;       b3 = Spectrometer B (set=on)
                                             ;       b4 = Calibibration-A (set=enabled)
                                             ;       b5 = HVA logical flag (set=enabled)
                                             ;       b6 = HVA power (set=on)
                                             ;       b7 = Spectrometer A (set=on)
      cpu: BYTARR(4,2),  $                   ; 84- Microprocessor information/diagnostics                    W66 F28
                                             ;                                                                   F60
                                             ;     Has the clock value to tie the DP clock
                                             ;     to the BCS clock.
                                             ;
                                             ;     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      HV_mon: BYTARR(2),  $                  ; 92- HV monitor voltage (0-255)                                W32 F32
                                             ;       SF2n ==> changes every 2 MF!!?!?!
                                             ;     (See quasi-static section for conversions)
      crytemp: BYTARR(2),  $                 ; 94- Crystal Bank Temperatures (milli-Celsius)                 W32 F31
                                             ;     (See quasi-static section for conversions)
      Elec_Temp: BYTE(0),  $                 ; 96- Electronics temperature                                   W32 F33
                                             ;     (See quasi-static section for conversions)
      spare: BYTARR(15) }                    ; 97
   
   
   
  
  
end
