private void FftAnalyzerIf_FftCalculated(object sender, FftEventArgs e) { var bin = new FrequencyBins(e, new BinParameters { MinimumIntensityDb = _model.Settings.IfParameter.MinimumIntensityDb, SamplingRate = 100000000, BinsPerPoint = IfSpectrumView.SelectedResolution.Resolution, CalibrationAmplitude = _model.Settings.IfParameter.CalibrationAmplitude, CalibrationOffset = _model.Settings.IfParameter.CalibrationOffset }); if (SpectrumAnalyzerIf != null) { SpectrumAnalyzerIf.Update(bin); } if (Waterfall != null) { Waterfall.Update(bin); } /* * if (!VideoFilter) * bin = new FrequencyBins(e, _model.Radio.BinParametersDefault()); * else * bin = new FrequencyBins(e, _model.Radio.BinParametersVideoFilter(_model.FftAnalyzerIf.FftLength, VideoPoints)); */ /* * FrequencyBins bin = new FrequencyBins(e, new BinParameters * { * BinsPerPoint = 4, * CalibrationAmplitude = 1.1, //1.5,//1.0 in sweeper is better * CalibrationOffset = 20,//8, * MinimumIntensityDb = -150, * Relative = true, * SamplingRate = 100000000 * }); */ /* * if (_model.Settings.AsyncAnalyze) * TaskUtility.Run(() => Analyze(e, bin)); * else * Analyze(e, bin); * * UpdateSquelch(); * * if (AutoStep) * FrequencyStep = (uint)Math.Abs(MeterView.FrequencyErrorValue * 500000); * * if (AfcState) * { * if (Math.Abs(MeterView.FrequencyErrorValue * 1000000) > _model.Settings.AfcThreshold) //1000 as default * FrequencyValue = (uint)(MeterView.PeakFrequencyValue * 1000000); * } * RecordingView.Tick(); */ }
private void Analyze(FftEventArgs e, FrequencyBins bin) { var detailedBin = _model.Settings.DetailedAnalyze ? new FrequencyBins(e, _model.Radio.BinParametersDetailed()) : bin; UpdateMeterView(detailedBin); }
void LiveIf_FftCalculated(object sender, FftEventArgs e) { var bin = new FrequencyBins(e, _model.Radio.BinParametersDefault()); Debug.Print("peak at:{0}", bin.MaxIntensityAt()); spectrumAnalyzer.Update(bin); }
private void FftAnalyzerDdc2_FftCalculated(object sender, FftEventArgs e) { var bin = new FrequencyBins(e, new BinParameters { MinimumIntensityDb = _model.Settings.Ddc2Parameter.MinimumIntensityDb, SamplingRate = _model.Radio.Ddc2(0).DdcArgs().Info.SampleRate, // CarrierFrequency = (uint)Ddc2AbsoluteFrequency, BinsPerPoint = Ddc2SpectrumView.SelectedResolution.Resolution, CalibrationAmplitude = _model.Settings.Ddc2Parameter.CalibrationAmplitude, CalibrationOffset = _model.Settings.Ddc2Parameter.CalibrationOffset }, false); if (SpectrumAnalyzerDdc2 != null) { SpectrumAnalyzerDdc2.Update(bin); } /* * FrequencyBins bin = new FrequencyBins(e, new BinParameters * { * MinimumIntensityDb = -150, * SamplingRate = _model.Radio.Ddc2(_index).DdcArgs().Info.SampleRate, * Relative = true, * CarrierFrequency = _model.Ddc1Frequency, * BinsPerPoint = 4, * CalibrationAmplitude = 1.1, //1.5,//1.0 in sweeper is better * CalibrationOffset = 20,//8, * }); */ // MeterViewDemodulator.Update(e, bin); MeterViewDemodulator.Update(bin); SquelchView.UpdateSquelch(MeterViewDemodulator.RmsDbm); UpdateVolume(); if (AutoStep) { FrequencyStep = (uint)Math.Abs(MeterViewDemodulator.FrequencyErrorValue * 500000); } if (AfcState) { if (Math.Abs(MeterViewDemodulator.FrequencyErrorValue * 1000000) > _model.Settings.AfcThreshold) //1000 as default { DemodulatorFrequency = (int)(MeterViewDemodulator.PeakFrequency * 1000000); } } /* * RecordingView.Tick(); */ }
public void Update(FftEventArgs e, FrequencyBins bin) { if (_model.Settings.AsyncAnalyze) { TaskUtility.Run(() => Analyze(e, bin)); } else { Analyze(e, bin); } }
public void Update(FrequencyBins bins) { var data = bins.Intensities().ToArray(); try { Dispatcher.Invoke(new Action(() => _waveform.FeedData(data))); } catch (TaskCanceledException) { //closing app } }
private void UpdateMeterView(FrequencyBins detailedBin) { _updateMeterStep++; _updateMeterStep %= _model.Settings.MeterUpdateSpeed; //5; if (_updateMeterStep != 0) { return; } MeterView.PeakFrequencyValue = (detailedBin.MaxIntensityAt() / 1000000); MeterView.FrequencyErrorValue = (detailedBin.MaxIntensityAt() - FrequencyValue) / 1000000; MeterView.PowerDbmValue = _model.Radio.Demodulator().SignalStrength(); MeterView.PowerUVoltsValue = RfMath.DbmToMicroVolts(_model.Radio.Demodulator().SignalStrength()); MeterView.PowerWattsValue = RfMath.DbmToMicroWatts(_model.Radio.Demodulator().SignalStrength()); MeterView.SMeterValue = RfMath.DbmToSUnit(_model.Radio.Demodulator().SignalStrength()); }
private void FftAnalyzer_FftCalculated(object sender, FftEventArgs e) { FrequencyBins bin; // _spectrumAnalyzer.Clear(); if (!VideoFilter) { bin = new FrequencyBins(e, _model.Radio.BinParametersDefault()); } else { bin = new FrequencyBins(e, _model.Radio.BinParametersVideoFilter(_model.FftAnalyzer.FftLength, VideoPoints)); } SpectrumAnalyzer.Update(bin); if (_model.Settings.AsyncAnalyze) { TaskUtility.Run(() => Analyze(e, bin)); } else { Analyze(e, bin); } UpdateSquelch(); if (AutoStep) { FrequencyStep = (uint)Math.Abs(MeterView.FrequencyErrorValue * 500000); } if (AfcState) { if (Math.Abs(MeterView.FrequencyErrorValue * 1000000) > _model.Settings.AfcThreshold) //1000 as default { FrequencyValue = (uint)(MeterView.PeakFrequencyValue * 1000000); } } RecordingView.Tick(); }
private void UpdateMeterView(FrequencyBins detailedBin) { _updateMeterStep++; _updateMeterStep %= _model.Settings.MeterUpdateSpeed; //5; if (_updateMeterStep != 0) { return; } Signal = _model.Ddc2[_channel].Signal; PeakFrequency = 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); }
private SweepedFrequency SweepFrequency(FrequencyBins bin, double f) { var current = bin.Intensity(f); var min = current; var max = current; if (!_current.ContainsKey(f)) { _current.Add(f, current); } else { _current[f] = current; } if (!_min.ContainsKey(f)) { _min.Add(f, current); } else { min = Math.Min(_min[f], current); _min[f] = min; } if (!_max.ContainsKey(f)) { _max.Add(f, current); } else { max = Math.Max(_max[f], current); _max[f] = max; } var data = new SweepedFrequency(f, min, max, current); return(data); }
private void SweepBins(FftEventArgs e) { //mark frequencies based on current IF2 in [-10Khz, 10KHz] domain var bin = new FrequencyBins(e, /*_radio.BinParametersDefault()*/ _radio.BinParametersWideSpectrum()); var frequency = _radio.Frequency(); var minFrequency = frequency - _sweepParameters.SweepSpan; var maxFrequency = frequency + _sweepParameters.SweepSpan; var sweeped = new List <SweepedFrequency>(); var frequnecies = bin.Frequencies(); foreach (var f in frequnecies) { if (f > _lastFrequency && f >= minFrequency && f <= maxFrequency) { _lastFrequency = f; var data = SweepFrequency(bin, f); sweeped.Add(data); } } OnFrequencySweeped(sweeped, frequency, _sweepParameters.Precision); }
public void Update(FrequencyBins bin) { if (bin.BinsCount != _bins) { _bins = bin.BinsCount; CalculateXScale(); } var intensities = bin.Intensities().ToArray(); for (int n = 0; n < bin.BinsCount - _binsPerPoint; n += 1) { // averaging out bins double yPos = 0; for (int b = 0; b < _binsPerPoint; b++) { yPos += GetYPosLog(intensities[n + b], bin.MinimumIntensity); } AddResult(n / _binsPerPoint, yPos / _binsPerPoint); } Draw(bin.SpectralWidth); }
private void FftAnalyzer_FftCalculated(object sender, FftEventArgs e) { FrequencyBins bin; spectrumAnalyzer.Clear(); if (!_model.VideoFilter) { bin = new FrequencyBins(e, _model.Radio.BinParametersDefault()); } else { bin = new FrequencyBins(e, _model.Radio.BinParametersVideoFilter(_model.FftAnalyzer.FftLength, _model.VideoPoints)); } Debug.Print("peak at:{0}: {1}", bin.MaxIntensityAt(), bin.MaxIntensity()); spectrumAnalyzer.Update(bin); TaskUtility.Run(() => { Invoke(new Action(() => { try { labelPeakFrequency.Text = (bin.MaxIntensityAt() / 1000000).ToString(); labelFrequenccyError.Text = ((bin.MaxIntensityAt() - (double)numericUpDownFrequency.Value) / 1000000).ToString(); labelPowerDbm.Text = _model.Radio.Demodulator().SignalStrength().ToString(); labelPowerUVolt.Text = RfMath.DbmToMicroVolts(_model.Radio.Demodulator().SignalStrength()).ToString(); } catch { } })); }); }
public void Update(FrequencyBins bin) { UpdateMeterView(bin); }