function [hdr1,BL1,hdr2,BL2,hdr3,BL3] = read_his_hk_files(filename) % % function [hdr1,BL1,hdr2,BL2,hdr3,BL3] = read_his_hk_files(filename); % % ....This Matlab function reads HIS housekeeping files and returns the data in the following structures: % % NOTE THAT filename does NOT include the file extension!! (ie, 'e:\ac980518\980518') % % BL1 % record_number % time % BB_readout_select % cold_BB_controller_onoff % hot_BB_controller_onoff % aft_pilot_switch_onoff % aft_pilot_switch_standby % fwd_pilot_switch_onoff % fwd_pilot_switch_standby % electronic_heater_onoff % electronic_heater_endis % scam_dipsw0_scene_mirror % scam_dipsw1_instr_mode % ascent_duration_time_limit % ascent_duration_limit_endis % warmup_duration_time_limit % warmup_duration_limit_endis % hot_BB_temperature_setting % hot_BB_controller_onoff % cold_BB_temperature_setting % cold_BB_controller_onoff % electronic_heater_endis % interferometer_scan_speed % interferometer_scan_length % scene_mirror_position % hot_BB_setpoint % hot_BB_temperature % cold_BB_setpoint % cold_BB_temperature % % BL2 % record_number % time % beamsplitter_temperature % laser_temperature % aperture_stop_temperature % scam_enclosure_temperature % recorder_drive_temperature % power_supply_temperature % bomem_power_supply_temperature % pod_inside_air_temperature % dewar_window_temperature % optics_mirror_temperature % optics_bench_temperature % blackbody_heatsink_temperature % atmospheric_pressure % detector1_output_DC_level % detector2_output_DC_level % detector3_output_DC_level % dewar1_temperature % dewar2_temperature % % BL3 % record_number3 % record_type % misalignment % overflow % scan_direction % mirror_position % % % ....Matlab function to read HIS housekeeping files. % % Written by Von P. Walden % 15 May 1998 % Modified: 17 May 1998 (Added capability to read BL1 and BL3 files. Also now using % structures as return variables.) % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BL1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % file1 = [filename,'.BL1']; fp = fopen(file1); hdr1 = char(fread(fp,136*2,'char'))'; tmp = fread(fp,[34 inf],'float32'); fclose(fp); BL1.record_number = tmp(1,:); BL1.time = tmp(2,:); BL1.BB_readout_select = tmp(3,:); BL1.cold_BB_controller_onoff = tmp(4,:); BL1.hot_BB_controller_onoff = tmp(5,:); BL1.aft_pilot_switch_onoff = tmp(6,:); BL1.aft_pilot_switch_standby = tmp(7,:); BL1.fwd_pilot_switch_onoff = tmp(8,:); BL1.fwd_pilot_switch_standby = tmp(9,:); BL1.electronic_heater_onoff = tmp(10,:); BL1.electronic_heater_endis = tmp(11,:); BL1.scam_dipsw0_scene_mirror = tmp(12,:); BL1.scam_dipsw1_instr_mode = tmp(13,:); BL1.ascent_duration_time_limit = tmp(14,:); BL1.ascent_duration_limit_endis = tmp(15,:); BL1.warmup_duration_time_limit = tmp(16,:); BL1.warmup_duration_limit_endis = tmp(17,:); BL1.hot_BB_temperature_setting = tmp(18,:); BL1.hot_BB_controller_onoff = tmp(19,:); BL1.cold_BB_temperature_setting = tmp(20,:); BL1.cold_BB_controller_onoff = tmp(21,:); BL1.electronic_heater_endis = tmp(22,:); BL1.interferometer_scan_speed = tmp(23,:); BL1.interferometer_scan_length = tmp(24,:); BL1.scene_mirror_position = tmp(25,:); BL1.hot_BB_setpoint = tmp(26,:); BL1.hot_BB_temperature = tmp(27,:); BL1.cold_BB_setpoint = tmp(28,:); BL1.cold_BB_temperature = tmp(29,:); clear tmp; % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BL2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % file2 = [filename,'.BL2']; fp = fopen(file2); hdr2 = char(fread(fp,100*2,'char'))'; tmp = fread(fp,[25 inf],'float32'); fclose(fp); % % ....Copies temporary data to correct variables. % BL2.record_number2 = tmp(1,:); BL2.time2 = tmp(2,:); BL2.beamsplitter_temperature = tmp(3,:); BL2.laser_temperature = tmp(4,:); BL2.aperture_stop_temperature = tmp(5,:); BL2.scam_enclosure_temperature = tmp(6,:); BL2.recorder_drive_temperature = tmp(7,:); BL2.power_supply_temperature = tmp(8,:); BL2.bomem_power_supply_temperature = tmp(9,:); BL2.pod_inside_air_temperature = tmp(10,:); BL2.dewar_window_temperature = tmp(11,:); BL2.optics_mirror_temperature = tmp(12,:); BL2.optics_bench_temperature = tmp(13,:); BL2.blackbody_heatsink_temperature = tmp(14,:); BL2.atmospheric_pressure = tmp(15,:); BL2.detector1_output_DC_level = tmp(16,:); BL2.detector2_output_DC_level = tmp(17,:); BL2.detector3_output_DC_level = tmp(18,:); BL2.dewar1_temperature = tmp(19,:); BL2.dewar2_temperature = tmp(20,:); clear tmp; % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BL3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % file3 = [filename,'.BL3']; fp = fopen(file3); hdr3 = char(fread(fp,9*2,'char'))'; % Reads in data as an array of bytes. tmpbyte = fread(fp,[9 inf],'char'); % Now reads the int32 record number. frewind(fp); % Rewind to beg of file fseek(fp,9*2,'cof'); % Skip header tmpint = fread(fp,inf,'int32',5); fclose(fp); % % ....Copies temporary data to correct variables. % BL3.record_number3 = tmpint'; BL3.record_type = tmpbyte(5,:); BL3.misalignment = tmpbyte(6,:); BL3.overflow = tmpbyte(7,:); BL3.scan_direction = tmpbyte(8,:); BL3.mirror_position = tmpbyte(9,:); clear tmpint tmpbyte; return;