1 //============================================================================== 2 // 3 // This file is part of GPSTk, the GPS Toolkit. 4 // 5 // The GPSTk is free software; you can redistribute it and/or modify 6 // it under the terms of the GNU Lesser General Public License as published 7 // by the Free Software Foundation; either version 3.0 of the License, or 8 // any later version. 9 // 10 // The GPSTk is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU Lesser General Public License for more details. 14 // 15 // You should have received a copy of the GNU Lesser General Public 16 // License along with GPSTk; if not, write to the Free Software Foundation, 17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 18 // 19 // This software was developed by Applied Research Laboratories at the 20 // University of Texas at Austin. 21 // Copyright 2004-2020, The Board of Regents of The University of Texas System 22 // 23 //============================================================================== 24 25 //============================================================================== 26 // 27 // This software was developed by Applied Research Laboratories at the 28 // University of Texas at Austin, under contract to an agency or agencies 29 // within the U.S. Department of Defense. The U.S. Government retains all 30 // rights to use, duplicate, distribute, disclose, or release this software. 31 // 32 // Pursuant to DoD Directive 523024 33 // 34 // DISTRIBUTION STATEMENT A: This software has been approved for public 35 // release, distribution is unlimited. 36 // 37 //============================================================================== 38 39 /** 40 * @file AshtechMBEN.hpp 41 * gpstk::AshtechMBEN - class for Ashtech raw measurement data 42 */ 43 44 #ifndef ASHTECHMBEN_HPP 45 #define ASHTECHMBEN_HPP 46 47 #include <map> 48 #include <iostream> 49 #include <cmath> 50 #include "AshtechData.hpp" 51 52 #ifdef SWIG 53 %immutable gpstk::AshtechMBEN::mpcId; 54 %immutable gpstk::AshtechMBEN::mcaId; 55 #endif 56 57 namespace gpstk 58 { 59 class AshtechMBEN : public AshtechData 60 { 61 public: 62 AshtechMBEN()63 AshtechMBEN() {}; 64 65 std::string header; // 11 characters exactly 66 unsigned seq; // sow in units of 50 ms, modulo 36,000 67 // (36,000 * 50 ms = 30 minutes) 68 unsigned left; 69 unsigned svprn; // the PRN of the tracked satellite 70 unsigned el; // degrees 71 unsigned az; // degrees 72 unsigned chid; // 1..12 73 74 struct code_block 75 { 76 // Warning flag, a bit packed field 77 // bits 1&2: 0 same as goodbad=22, 1 same as goodbad=23, 78 // 3 same as goodbad=24 79 // bit 3: carrier phase questionable 80 // bit 4: code phase questionable 81 // bit 5: code phase integration not stable 82 // bit 6: Z tracking mode 83 // bit 7: possible lock of lock 84 // bit 8: loss of lock counter reset 85 unsigned warning; 86 // Measurement quality 87 // 0: measurement not available 88 // 22: code and or carrier phase measured 89 // P mode tracking on Z(Y)-12 units 90 // 23: 22 + nav msg obtained + obs NOT used in PVT computation 91 // 24: 22 + nav msg obtained + obs used in PVT computation 92 // Y mode tracking on Z(Y)-12 units 93 // 25: Z mode tracking on Z(Y)-12 units 94 unsigned goodbad; 95 unsigned polarity_known; // 'spare' in the ashtech docs 96 unsigned ireg; // SNR in custom units 97 unsigned qa_phase; // phase quality 0..5 and 95..100 are good 98 double full_phase; // cycles 99 double raw_range; // seconds 100 double doppler; // Hz 101 double smoothing; // meters 102 unsigned smooth_cnt; // 103 104 /** 105 * @throw std::exception 106 * @throw FFStreamError 107 */ 108 virtual void decodeASCII(std::stringstream& str); 109 /** 110 * @throw std::exception 111 * @throw FFStreamError 112 */ 113 virtual void decodeBIN(std::string& str); 114 /** Translate the ireg value to an SNR in dB*Hz. 115 * @param[in] chipRate The chipping rate of the code. 116 * @param[in] mag The magnitude of the carrier estimate. 117 * @note The magnitude of the carrier estimate is a factor 118 * specified by Ashtech. Currently this algorithm is 119 * designed for the Ashtech Z-12 receiver and will not 120 * yield correct results for other Ashtech receivers. 121 * The default setting in the Z-12 receiver is 2 bit 122 * quantization, for which the magnitude of the carrier 123 * estimate is 4.14. For Z-12 receivers using 1-bit 124 * quantization, the magnitude is 2.18. Other Ashtech 125 * receivers can only provide a 1-bit sample, however 126 * the magnitude for those receivers is not 2.18. 127 * @return the SNR in dB*Hz. 128 */ 129 float snr(float chipRate, float magnitude = 4.14) const throw(); 130 void dump(std::ostream& out) const; 131 }; 132 133 // The remaining block is repeated repeated three times for an MPC but 134 // only appears once for an MCA 135 code_block ca; 136 code_block p1; 137 code_block p2; 138 139 static const char *mpcId, *mcaId; 140 getName() const141 virtual std::string getName() const {return "mben";} 142 checkId(const std::string & hdrId) const143 virtual bool checkId(const std::string& hdrId) const 144 {return hdrId==mpcId || hdrId==mcaId;} 145 146 void dump(std::ostream& out) const throw(); 147 /** 148 * @throw std::exception 149 * @throw FFStreamError 150 */ 151 virtual void decode(const std::string& data) ; 152 153 protected: 154 /** 155 * @throw std::exception 156 * @throw FFStreamError 157 * @throw EndOfFile 158 */ 159 virtual void reallyGetRecord(FFStream& ffs); 160 }; 161 } // namespace gpstk 162 163 #endif 164