![]() |
Observation
|
00001 /* HiRISE Science_Channel_Header 00002 00003 PIRL CVS ID: Science_Channel_Header.hh,v 1.42 2020/05/12 22:59:48 schaller Exp 00004 00005 Copyright (C) 2003-2020 Arizona Board of Regents on behalf of the Lunar and 00006 Planetary Laboratory at the University of Arizona. 00007 00008 Licensed under the Apache License, Version 2.0 (the "License"); you may not use 00009 this file except in compliance with the License. You may obtain a copy of the 00010 License at 00011 00012 http://www.apache.org/licenses/LICENSE-2.0 00013 00014 Unless required by applicable law or agreed to in writing, software distributed 00015 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 00016 CONDITIONS OF ANY KIND, either express or implied. See the License for the 00017 specific language governing permissions and limitations under the License. 00018 */ 00019 #ifndef _HiRISE_Science_Channel_Header_ 00020 #define _HiRISE_Science_Channel_Header_ 00021 00022 // UA::HiRISE 00023 #include "Data_Component.hh" 00024 00025 // PIRL 00026 #include "Data_Block.hh" 00027 00028 #if defined (INCLUDE_PVL) 00029 // idaeim::PVL 00030 #include "PVL.hh" 00031 #endif 00032 00033 #include <iostream> 00034 #include <string> 00035 00036 namespace UA 00037 { 00038 namespace HiRISE 00039 { 00040 /******************************************************************************* 00041 Science Channel Header 00042 */ 00241 class Science_Channel_Header 00242 : public Data_Component 00243 { 00244 public: 00245 /*============================================================================== 00246 Constants: 00247 */ 00249 static const char* const 00250 ID; 00251 00253 static const char* const 00254 NAME; 00255 00266 enum Element 00267 { 00268 Sync, 00269 Post_Binned_Pixels_Per_Line, 00270 Post_Binned_Lines, 00271 Alignment, 00272 CPMM, 00273 Channel, 00274 Observation_ID, 00275 Transaction_ID, 00276 Powered_CPMMs_Count, 00277 Powered_CPMMs_Map, 00278 Expose_MRO_Time, 00279 Expose_HiRISE_Time, 00280 Analog_Power_On_Time, 00281 Analog_Power_On_Start_Time, 00282 Exposure_Start_Time, 00283 Expose_Time_Ticks, 00284 Total_Image_Bytes, 00285 00286 Line_Time_Operation, 00287 Expose_Command, 00288 Expose_Response, 00289 Line_Time_Command_Received, 00290 Binning_Command_Received, 00291 TDI_Command_Received, 00292 Line_Count_Command_Received, 00293 CPMM_Power_Command_Received, 00294 Expose_Time_Command_Received, 00295 LUT_Command_Received, 00296 Pad_0, 00297 Digital_Power_Operation, 00298 Analog_Power_Operation, 00299 Trimming_Operation, 00300 TDI_Operation, 00301 Line_Count_Operation, 00302 Binning_Operation, 00303 LUT_Operation, 00304 00305 Expose_Time_Milliseconds, 00306 Readout_Start_Time, 00307 Readout_Pad_Bytes, 00308 Pixels_Per_Line, 00309 Extra_Pixels, 00310 Pixel_Bytes, 00311 Pixel_Data_Bytes, 00312 Line_Header_Bytes, 00313 Channel_Readout_Bytes, 00314 Channel_Readout_Ticks, 00315 Max_Storable_Lines, 00316 Max_Storable_Lines_Exceeded, 00317 Total_Lines_Collected, 00318 Total_Lines_Exposed, 00319 Line_Time_Nanoseconds, 00320 Channel_Readout_Command, 00321 Channel_Readout_Response, 00322 Pad_1, 00323 00324 Optical_Bench_Flexure_Temperature, 00325 Optical_Bench_Tertiary_Mirror_Temperature, 00326 Optical_Bench_Fold_Flat_Temperature, 00327 Optical_Bench_FPA_Temperature, 00328 Optical_Bench_FPE_Temperature, 00329 Optical_Bench_Living_Room_Temperature, 00330 Optical_Bench_Box_Beam_Temperature, 00331 Optical_Bench_Cover_Temperature, 00332 Field_Stop_Temperature, 00333 FPA_Positive_Y_Temperature, 00334 FPA_Negative_Y_Temperature, 00335 FPE_Temperature, 00336 Primary_Mirror_Mount_Temperature, 00337 Primary_Mirror_Temperature, 00338 Primary_Mirror_Baffle_Temperature, 00339 Metering_Structure_Truss_Leg_0_A_Temperature, 00340 Metering_Structure_Truss_Leg_0_B_Temperature, 00341 Metering_Structure_Truss_Leg_120_A_Temperature, 00342 Metering_Structure_Truss_Leg_120_B_Temperature, 00343 Metering_Structure_Truss_Leg_240_A_Temperature, 00344 Metering_Structure_Truss_Leg_240_B_Temperature, 00345 Barrel_Baffle_Temperature, 00346 Sun_Shade_Temperature, 00347 Spider_Leg_30_Temperature, 00348 Spider_Leg_150_Temperature, 00349 Spider_Leg_270_Temperature, 00350 Secondary_Mirror_Metering_Ring_Temperature, 00351 Secondary_Mirror_Temperature, 00352 Secondary_Mirror_Baffle_Temperature, 00353 IEA_Temperature, 00354 Focus_Motor_Temperature, 00355 00356 CPMM_Positive_29_Voltage, 00357 CPMM_Positive_29_Current, 00358 CPMM_Positive_10_Voltage, 00359 CPMM_Positive_10_Current, 00360 CPMM_Positive_5_Voltage, 00361 CPMM_Positive_5_Current, 00362 CPMM_Positive_3_3_Voltage, 00363 CPMM_Positive_3_3_Current, 00364 CPMM_Positive_2_5_Voltage, 00365 CPMM_Positive_2_5_Current, 00366 CPMM_Positive_1_8_Voltage, 00367 CPMM_Positive_1_8_Current, 00368 CPMM_Negative_5_Voltage, 00369 CPMM_Negative_5_Current, 00370 IE_PWS_Board_Temperature, 00371 CPMM_PWS_Board_Temperature, 00372 Heater_Current, 00373 Mech_TLM_Board_Temperature, 00374 Instrument_Control_Board_Temperature, 00375 Instrument_Control_FPGA_Positive_2_5_Voltage, 00376 Mech_TLM_FPGA_Positive_2_5_Voltage, 00377 IEA_Positive_28_Voltage, 00378 IEA_Negative_15_Voltage, 00379 IEA_Positive_15_Voltage, 00380 IEA_Positive_5_Voltage, 00381 00382 Exposure_Readout_Count, 00383 Default_TDI, 00384 Default_Trimming, 00385 Default_Line_Count, 00386 Default_Binning, 00387 Focus_Position, 00388 00389 Heater_Control_Mode, 00390 Heater_Zones_Enabled, 00391 Heater_Zones_State, 00392 Heater_Disabled_For_Exposure, 00393 Heater_Zones_Pre_Exposure_State, 00394 00395 FPGA_Last_Response, 00396 Heater_Controls, 00397 Last_Command_Time, 00398 Pad_2, 00399 Checksum, 00400 00401 // The total number of Elements: 00402 Total_Elements 00403 }; 00404 00406 static const char* 00407 NAMES[]; 00408 00410 static const Index 00411 COMPONENT_BYTES; 00412 00414 static const Index 00415 OFFSETS[]; 00416 00434 static const Index 00435 ARRAY_COUNTS[][2]; 00436 00438 static const u_int_32 00439 SYNC; 00440 00442 static const int 00443 SYNC_BYTES; 00444 00446 static const u_int_32 00447 FPGA_RESPONSE_CPMM_PWS_ENABLED_BIT_MASK, 00448 FPGA_RESPONSE_TELEMETRY_GATHERING_BIT_MASK, 00449 FPGA_RESPONSE_FM_RELAY_PHB_CLOSED_BIT_MASK, 00450 FPGA_RESPONSE_FM_RELAY_PHA_CLOSED_BIT_MASK, 00451 FPGA_RESPONSE_FM_OVERHEATED_BIT_MASK, 00452 FPGA_RESPONSE_FM_MOVING_BIT_MASK, 00453 FPGA_RESPONSE_STIM_LEDS_BIT_MASK, 00454 FPGA_RESPONSE_STIM_LEDS_BIT_MASK_SHIFT, 00455 FPGA_RESPONSE_HEATERS_ON_BIT_MASK; 00456 00458 enum Heater_Mode 00459 { 00460 CLOSED_LOOP, 00461 DUTY_CYCLES 00462 }; 00463 00465 enum Setpoint 00466 { 00467 LOW, 00468 HIGH 00469 }; 00470 00472 enum Duty_Cycle 00473 { 00474 ON_SECONDS, 00475 OFF_SECONDS 00476 }; 00477 00479 enum {TOTAL_CONVERSION_COEFFICIENTS = 7}; 00480 00492 struct Conversion_Coefficients 00493 { 00495 Index element; 00497 const char* units; 00499 double coefficient[TOTAL_CONVERSION_COEFFICIENTS]; 00500 }; 00501 00503 static const Conversion_Coefficients 00504 CONVERSION_COEFFICIENTS[]; 00505 00507 static const double 00508 CELSIUS_TO_KELVINS_OFFSET; 00509 00510 // Note: There was a typo in the above constant name ("CELCIUS"). Nothing seems 00511 // to use it at the moment, so I've renamed it. 00512 00514 static const char* const 00515 FORMAT_FILENAME; 00516 00517 /*============================================================================== 00518 Constructors 00519 */ 00526 Science_Channel_Header (); 00527 00538 explicit Science_Channel_Header (std::istream& stream); 00539 00548 Science_Channel_Header (const Science_Channel_Header& component, 00549 bool data_duplicate = true); 00550 00556 Science_Channel_Header& operator= (const Science_Channel_Header& component); 00557 00558 /*============================================================================== 00559 Accessors 00560 */ 00567 std::string id () const; 00568 00574 const char* name () const; 00575 00576 // Times: 00577 00601 std::string clock_count (Index element, Index index = 0) const; 00602 00622 Science_Channel_Header& clock_count 00623 (const std::string& counter, Index element, Index index = 0); 00624 00648 double time (Index element, Index index = 0) const; 00649 00670 Science_Channel_Header& time (double seconds, Index element, Index index = 0); 00671 00672 // Bit fields: 00673 00681 bool FPGA_last_response_CPMM_PWS_enabled () const; 00682 00691 Science_Channel_Header& FPGA_last_response_CPMM_PWS_enabled (bool enabled); 00692 00700 bool FPGA_last_response_telemetry_gathering () const; 00701 00710 Science_Channel_Header& FPGA_last_response_telemetry_gathering (bool enabled); 00711 00720 bool FPGA_last_response_FM_relay_PHB_closed () const; 00721 00730 Science_Channel_Header& FPGA_last_response_FM_relay_PHB_closed (bool closed); 00731 00740 bool FPGA_last_response_FM_relay_PHA_closed () const; 00741 00750 Science_Channel_Header& FPGA_last_response_FM_relay_PHA_closed (bool closed); 00751 00759 bool FPGA_last_response_FM_overheated () const; 00760 00769 Science_Channel_Header& FPGA_last_response_FM_overheated (bool overheated); 00770 00778 bool FPGA_last_response_FM_moving () const; 00779 00788 Science_Channel_Header& FPGA_last_response_FM_moving (bool moving); 00789 00799 u_int_32 FPGA_last_response_stim_LEDs_on () const; 00800 00811 Science_Channel_Header& FPGA_last_response_stim_LEDs_on (u_int_32 stim_LEDs_map); 00812 00822 u_int_32 FPGA_last_response_heaters_on () const; 00823 00834 Science_Channel_Header& FPGA_last_response_heaters_on (u_int_32 heaters_map); 00835 00836 // Conversion from sensor to real world units: 00837 00848 const Conversion_Coefficients* conversion (Index element) const; 00849 00861 double convert (Index element, Index index = 0) const; 00862 00872 const char* converted_units (Index element) const; 00873 00874 /*============================================================================== 00875 Printing 00876 */ 00889 std::ostream& print 00890 (std::ostream& stream = std::cout, bool verbose = false) const; 00891 00892 #if defined (INCLUDE_PVL) 00893 /*============================================================================== 00894 PVL 00895 */ 00904 idaeim::PVL::Aggregate* PVL () const; 00905 00916 idaeim::PVL::Aggregate* PVL_description () const; 00917 00918 #endif // defined (INCLUDE_PVL) 00919 00920 /*============================================================================== 00921 Validation 00922 */ 00931 bool is_valid () const; 00932 00933 /*============================================================================== 00934 Functions: 00935 */ 00946 static bool is_sync (const void* data_at); 00947 00964 static void* sync_at (void* begin, void* end); 00965 00966 }; // class Science_Channel_Header 00967 00968 } // namespace HiRISE 00969 } // namespace UA 00970 #endif