/// <summary> /// 窗体收到频谱分析执行成功的消息后,调用该函数,将其告之循环 /// </summary> internal void Spectrum_Succed() { float dBmValue = float.MinValue; float dBmNoise = 0; PointF[] values; //获取频谱分析数据 values = (PointF[])ISpectrumObj.GetSpectrumData(); //在取得的频谱分析数据中,搜索Y值最大点,将其Y值作为收信值 for (int J = 0; J < values.Length; J++) { if (values[J].Y > dBmValue) { dBmValue = values[J].Y; } } //计算平均底噪 for (int K = 0; K < values.Length; K++) { if (values[K].Y != dBmValue) { dBmNoise += values[K].Y; } } dBmNoise = dBmNoise / values.Length; //构造扫描结果值对象 sweepValue.dBmValue = dBmValue; sweepValue.dBmNosie = dBmNoise; }
/// <summary> /// 窗体收到频谱分析执行成功的消息后,调用该函数,将其告之循环 /// </summary> public void Spectrum_Succed() { bool bQuit = false; float dBmValue = float.MinValue; float dBmNoise = 0; PointF[] values; bQuit = ctrl.Quit; if (!bQuit) { //获取频谱分析数据 values = (PointF[])ISpectrumObj.GetSpectrumData(); if (values == null) { return; } //在取得的频谱分析数据中,搜索Y值最大点,将其Y值作为收信值 for (int J = 0; J < values.Length; J++) { if (values[J].Y > dBmValue) { dBmValue = values[J].Y; } } //计算平均底噪 for (int K = 0; K < values.Length; K++) { if (values[K].Y != dBmValue) { dBmNoise += values[K].Y; } } dBmNoise = dBmNoise / values.Length; //构造扫描结果值对象 sweepValue.dBmValue = dBmValue; sweepValue.dBmNosie = dBmNoise; } }