📄 onefreqcsdetector.hpp
字号:
/** Method to set the default return type to be used. * @param returnT TypeID to be returned */ virtual void setResultType(const TypeID& resultT) { resultType = resultT; }; /// Method to get the default return type being used. virtual TypeID getResultType() const { return resultType; }; /** Method to set the maximum interval of time allowed between two successive epochs. * @param maxDelta Maximum interval of time, in seconds */ virtual void setDeltaTMax(const double& maxDelta) { deltaTMax = maxDelta; }; /// Method to get the maximum interval of time allowed between two successive epochs. virtual double getDeltaTMax() const { return deltaTMax; }; /** Method to set the maximum size of filter window, in samples. * @param maxSize Maximum size of filter window, in samples. */ virtual void setMaxWindowSize(const int& maxSize) { // Don't allow window sizes less than 1 if (maxSize > 1) maxWindowSize = maxSize; else maxWindowSize = 60; }; /// Method to get the maximum size of filter window, in samples. virtual int getMaxWindowSize() const { return maxWindowSize; }; /** Method to set the maximum deviation allowed before declaring cycle slip (in number of sigmas). * @param maxNSigmas Maximum deviation allowed before declaring cycle slip (in number of sigmas). */ virtual void setMaxNumSigmas(const double& maxNSigmas) { maxNumSigmas = maxNSigmas; }; /// Method to get the maximum deviation allowed before declaring cycle slip (in number of sigmas). virtual double getMaxNumSigmas() const { return maxNumSigmas; }; /** Method to set the default value assigned to sigma when filter starts. * @param defSigma Default value assigned to sigma when filter starts. */ virtual void setDefaultBiasSigma(const double& defSigma) { defaultBiasSigma = defSigma; }; /// Method to get the default value assigned to sigma when filter starts. virtual double getDefaultBiasSigma() const { return defaultBiasSigma; }; /** Returns a gnnsSatTypeValue object, adding the new data generated when calling this object. * * @param gData Data object holding the data. */ virtual gnssSatTypeValue& Process(gnssSatTypeValue& gData) { (*this).Process(gData.header.epoch, gData.body); return gData; }; /** Returns a gnnsRinex object, adding the new data generated when calling this object. * * @param gData Data object holding the data. */ virtual gnssRinex& Process(gnssRinex& gData) { (*this).Process(gData.header.epoch, gData.body, gData.header.epochFlag); return gData; }; /// Returns an index identifying this object. virtual int getIndex(void) const; /// Returns a string identifying this object. virtual std::string getClassName(void) const; /** Sets the index to a given arbitrary value. Use with caution. * * @param newindex New integer index to be assigned to current object. */ void setIndex(const int newindex) { (*this).index = newindex; }; /// Destructor virtual ~OneFreqCSDetector() {}; private: /// Type of code. TypeID codeType; /// Type of phase. TypeID phaseType; /// Type of LLI record. TypeID lliType; /// Type of result. TypeID resultType; /// Maximum interval of time allowed between two successive epochs. double deltaTMax; /// Maximum size of filter window, in samples. int maxWindowSize; /// Maximum deviation allowed before declaring cycle slip (in number of sigmas). double maxNumSigmas; /// Default value assigned to sigma when filter starts. double defaultBiasSigma; /// A structure used to store filter data for a SV. struct filterData { // Default constructor initializing the data in the structure filterData() : previousEpoch(DayTime::BEGINNING_OF_TIME), windowSize(0), meanBias(0.0), meanSigma2(0.0) {}; DayTime previousEpoch; ///< The previous epoch time stamp. int windowSize; ///< The filter window size. double meanBias; ///< Accumulated mean bias (pseudorange - phase). double meanSigma2; ///< Accumulated mean bias sigma squared. }; /// Map holding the information regarding every satellite std::map<SatID, filterData> OneFreqData; /** Returns a satTypeValueMap object, adding the new data generated when calling this object. * * @param epoch Time of observations. * @param sat SatID. * @param tvMap Data structure of TypeID and values. * @param epochflag Epoch flag. * @param code Current code observation value. * @param phase Current phase observation value. */ virtual double getDetection(const DayTime& epoch, const SatID& sat, typeValueMap& tvMap, const short& epochflag, const double& code, const double& phase) { bool reportCS(false); double deltaT(0.0); // Difference between current and former epochs, in sec double bias(0.0); // Code-phase bias double dif2(0.0); // Difference between biases, squared. double thr2(0.0); // Threshold in sigmas, squared. double deltaBias(0.0); // Difference between biases double tempLLI(0.0); // Get the difference between current epoch and former epoch, in seconds deltaT = ( epoch.MJDdate() - OneFreqData[sat].previousEpoch.MJDdate() ) * DayTime::SEC_DAY; // Store current epoch as former epoch OneFreqData[sat].previousEpoch = epoch; bias = code - phase; // Current value of code-phase bias // Increment size of window and check limit ++OneFreqData[sat].windowSize; if (OneFreqData[sat].windowSize > maxWindowSize) OneFreqData[sat].windowSize = maxWindowSize; // Check if receiver already declared cycle slip or too much time has elapsed // Note: If tvMap(lliType) doesn't exist, then 0 will be returned and that test will pass if ( (tvMap(lliType)==1.0) || (tvMap(lliType)==3.0) || (tvMap(lliType)==5.0) || (tvMap(lliType)==7.0) ) tempLLI = 1.0; if ( (epochflag==1) || (epochflag==6) || (tempLLI==1.0) || (deltaT > deltaTMax) ) { OneFreqData[sat].windowSize = 1; } if (OneFreqData[sat].windowSize > 1) { deltaBias = (bias - OneFreqData[sat].meanBias); dif2 = deltaBias*deltaBias; // Square difference between biases thr2 = OneFreqData[sat].meanSigma2 * maxNumSigmas * maxNumSigmas; // Compute threshold^2 // If difference in biases is bigger or equal to threshold, then cycle slip if (dif2 >= thr2) { OneFreqData[sat].windowSize = 1; } else { // Update mean bias OneFreqData[sat].meanBias = OneFreqData[sat].meanBias + deltaBias/(static_cast<double>(OneFreqData[sat].windowSize)); // Update mean variance OneFreqData[sat].meanSigma2 = OneFreqData[sat].meanSigma2 + ( (dif2-OneFreqData[sat].meanSigma2) ) / (static_cast<double>(OneFreqData[sat].windowSize)); } } if (OneFreqData[sat].windowSize <= 1) // If a cycle-slip happened { // Set mean bias to current code-phase bias OneFreqData[sat].meanBias = bias; // Set mean variance to default variance OneFreqData[sat].meanSigma2 = defaultBiasSigma * defaultBiasSigma; reportCS = true; } if (reportCS) return 1.0; else return 0.0; }; /// Initial index assigned to this class. static int classIndex; /// Index belonging to this object. int index; /// Sets the index and increment classIndex. void setIndex(void) { (*this).index = classIndex++; }; }; // end class OneFreqCSDetector //@} }#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -