Пример #1
0
 private void Update(ConsecutiveObservation consecutiveObservation, SimpleObservation simpleObservation)
 {
     consecutiveObservation.HitCount += simpleObservation.HitCount;
     consecutiveObservation.HitTime  += simpleObservation.HitTime;
     consecutiveObservation.EndTime   = simpleObservation.EndTime;
     consecutiveObservation.ObservationDetailSeries.Add(simpleObservation);
 }
Пример #2
0
        private void Add(SimpleObservation simpleObservation)
        {
            ConsecutiveObservation observationResult = new ConsecutiveObservation();

            observationResult.Frequency = simpleObservation.Frequency;
            observationResult.Stage     = simpleObservation.Stage;
            observationResult.StartTime = simpleObservation.StartTime;
            observationResult.EndTime   = simpleObservation.EndTime;
            observationResult.HitCount  = simpleObservation.HitCount;
            observationResult.HitTime   = simpleObservation.HitTime;
            observationResult.ObservationDetailSeries.Add(simpleObservation);
            consecutiveObservations_.Add(observationResult);
        }
Пример #3
0
        internal void NewObserve(SimpleObservation simpleObservation)
        {
            double frequency = simpleObservation.Frequency;

            var lastResult = consecutiveObservations_.FindLast(x => x.Frequency == frequency);

            if (lastResult == null)
            {
                Add(simpleObservation);
            }
            else
            {
                SimpleObservation lastDetail = lastResult.ObservationDetailSeries.Last();
                if (simpleObservation.Stage - lastDetail.Stage > 3)
                {
                    Add(simpleObservation);
                }
                else
                {
                    Update(lastResult, simpleObservation);
                }
            }
        }
Пример #4
0
        public void SearchDataReceived(object sender, Operations.SearchEventArgs e)
        {
            if (!_search)
            {
                return;
            }

            _wait = true;

            FastFrequencyBins bin = (FastFrequencyBins)e.Bins;

            var startTime = _lastTime;

            var index     = bin.MaxIntensityAt();
            var frequency = bin.FrequencyAt(index);
            var peak      = bin.IntensityAt(index);

            //var frequency = bin.MaxIntensityAt();
            //var peak = bin.Intensity(frequency);

            if (peak < observable_.SignalLevel)
            {
                // _maxFrequency = null;
                _wait = false;
                return;
            }

            // _maxFrequency = Convert.ToUInt32(frequency);

            var fRounded = Math.Round(frequency / 1000, 1) * 1000;

            if (!RoundFrequencies)
            {
                fRounded = frequency;
            }

            var hitTime = DateTime.Now - _lastTime;
            var endTime = DateTime.Now;

            _lastTime = endTime;

            if (!_frequencies.ContainsKey(fRounded))
            {
                SimpleObservation result = new SimpleObservation();
                result.Stage     = _stage;
                result.Frequency = fRounded;
                result.HitCount  = 1;
                result.HitTime   = hitTime.TotalMilliseconds;
                result.StartTime = startTime;
                result.EndTime   = endTime;
                result.Duration  = endTime - startTime;
                _frequencies.Add(fRounded, result);
            }
            else
            {
                SimpleObservation result = _frequencies[fRounded];
                result.Frequency = fRounded;
                result.HitCount++;
                result.HitTime += hitTime.TotalMilliseconds;
                result.EndTime  = endTime;
                result.Duration = endTime - result.StartTime;
            }

            _wait = false;
        }