/// <summary>
        /// 如果有效,则直接返回,如果无效则重置先验值重新计算。
        /// </summary>
        /// <param name="epochInfo"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        private SingleSiteGnssResult CheckOrRecaculate(EpochInformation epochInfo, SingleSiteGnssResult result)
        {
            if (Geo.Algorithm.Vector.IsValid(result.ResultMatrix.StdOfEstimatedParam))
            {
                return(result);
            }

            var lastOkIndex = PrevResults.LastKey;
            var differIndex = CurrentIndex - lastOkIndex;

            var newAprioriIndex = PrevResults.LastKey - differIndex;

            while (newAprioriIndex > 0)
            {
                if (PrevResults.Contains(newAprioriIndex))
                {
                    var product = PrevResults[newAprioriIndex];
                    this.SetProduct(product);

                    if (differIndex > 5)
                    {
                        //this.MatrixBuilder.IsResetCovaOfApriori = true;
                    }

                    break;
                }
                newAprioriIndex--;
            }

            return(base.CaculateKalmanFilter(epochInfo, this.CurrentProduct));
        }
        public override SingleSiteGnssResult CaculateKalmanFilter(EpochInformation epochInfo, SingleSiteGnssResult lastResult)
        {
            CurrentIndex++;

            var result = base.CaculateKalmanFilter(epochInfo, lastResult);

            if (CurrentProduct != null)
            {
                if (XYZ.IsValueValid(CurrentProduct.EstimatedXyzRms))
                {
                    LastValidXyzRms = CurrentProduct.EstimatedXyzRms;
                }
            }

            result = CheckOrRecaculate(epochInfo, result);

            if (!XYZ.IsValueValid(result.EstimatedXyzRms))
            {
                log.Error("RMS 检核未通过 " + result.EstimatedXyzRms);
                return(null);
            }


            //if (LastValidXyzRms != null
            //    && CurrentIndex > 10 //先让其浪一会儿
            //    && (result.EstimatedXyzRms.Length > LastValidXyzRms.Length * 50))
            //{
            //    log.Error("RMS 检核未通过 " + result.EstimatedXyzRms);
            //    return null;
            //}
            //ok
            PrevResults.Add(CurrentIndex, result);

            return(result);
        }
Exemple #3
0
        private PrevResults m_PRes = null;                                                 // Previous buffer and related data.


        /// <param name="i_wNoiseLevel">16-bit value for noise level.  Default is 1600.</param>
        /// <param name="i_iEndpointInMilliSeconds">Amount of trailing silence in miliseconds before determining end of speech.</param>
        public EnergyDetector(Int16 i_wNoiseLevel, Int32 i_iEndpointInMilliSeconds)
        {
            m_wNoiseLevel      = i_wNoiseLevel;
            m_iEndpointInBytes = ConvertMilliSecondsToBytes(i_iEndpointInMilliSeconds);

            m_aiPcmData = new Int16[FRAME_SIZE_MIN];                                            // Pre-alloc array for converting muLaw to PCM.

            m_PRes = new PrevResults();
            Reset();
        }