private void UpdateMeterView(FastFrequencyBins detailedBin) { _updateMeterStep++; _updateMeterStep %= _model.Settings.MeterUpdateSpeed; //5; if (_updateMeterStep != 0) { return; } Signal = _model.Ddc2[_channel].Signal; PeakFrequency = detailedBin.FrequencyAt(detailedBin.MaxIntensityAt()) / 1000000.0; PeakPower = detailedBin.MaxIntensity(); FrequencyErrorValue = detailedBin.MaxIntensityAt() / 1000000; PowerDbmValue = PeakDbm; PowerUVoltsValue = RfMath.DbmToMicroVolts(PeakDbm); PowerWattsValue = RfMath.DbmToMicroWatts(PeakDbm); SMeterValue = RfMath.DbmToSUnit(PeakDbm); }
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; }
private void FftAnalyzerDdc1_FftCalculated(object sender, FftEventArgs e) { /* * var bin = new FrequencyBins(e, * new BinParameters * { * Relative = true, * CarrierFrequency = Ddc1Frequency, * MinimumIntensityDb = -120, * SamplingRate = Ddc1Info.SampleRate, * BinsPerPoint = Ddc1SpectrumView.SelectedResolution.Resolution * }, false); */ Wait = true; var bins = new FastFrequencyBins(e, new BinParameters { Relative = true, CarrierFrequency = Ddc1Frequency, MinimumIntensityDb = _model.Settings.Ddc1Parameter.MinimumIntensityDb, SamplingRate = Ddc1Info.SampleRate, BinsPerPoint = 1, CalibrationAmplitude = _model.Settings.Ddc1Parameter.CalibrationAmplitude, CalibrationOffset = _model.Settings.Ddc1Parameter.CalibrationOffset }, false); // Morse decoder if (SearchEventHandler != null) { SearchEventHandler(this, new SearchEventArgs(bins)); } Wait = false; var intensities = bins.Intensities().ToList <double>().Where((x, i) => i % Ddc1SpectrumView.SelectedResolution.Resolution == 0); if (SpectrumAnalyzerDdc1 != null) { SpectrumAnalyzerDdc1.Update(intensities.ToArray()); } MeterViewDdc1.Update(bins); /* * FrequencyBins bin = new FrequencyBins(e, new BinParameters * { * Relative = true, * CarrierFrequency = _model.Ddc1Frequency, * MinimumIntensityDb = -150, * SamplingRate = _model.Radio.Ddc1().DdcArgs().Info.SampleRate, * BinsPerPoint = 4, * CalibrationAmplitude = 1.1, //1.5,//1.0 in sweeper is better * CalibrationOffset = 20,//8, * }); * SpectrumAnalyzerDdc1.Update(bin); * * RecordingView.Tick(); */ }
public void Update(FastFrequencyBins bin) { UpdateMeterView(bin); }