/// <summary> /// /// </summary> /// <param name="equs">设备集合</param> /// <param name="aroundstation">周围台站集合</param> /// <param name="analysisType">非法信息</param> /// <returns></returns> public static InterferenceAnalysisResult Calculator(List <ActivityEquipment> equs, List <ActivitySurroundStation> aroundstation, AnalysisType analysisType) { ConvertToCalcCondition(equs, aroundstation); InterferenceAnalysisResult Interfresult = new InterferenceAnalysisResult(); if ((analysisType & AnalysisType.SameFreq) == AnalysisType.SameFreq) { //同频干扰计算 SameFreqCalculator samefreqCalc = new SameFreqCalculator(EquFreqs, StationFreqs); SameFreqCompareResult[] sameInterfResult = samefreqCalc.CalcSameFreqInterference(); if (sameInterfResult != null && sameInterfResult.Length > 0) { Interfresult.SameFreqInterfResult = sameInterfResult; Interfresult.SameFreqInterfResultCount = sameInterfResult.Length; } } if ((analysisType & AnalysisType.ADJFreq) == AnalysisType.ADJFreq) { //邻频干扰计算 AdjFreqCalculator adjfreqCalc = new AdjFreqCalculator(EquFreqs, StationFreqs); AdjFreqCompareResult[] adjInterfResult = adjfreqCalc.CalcAdjFreqInterference(); if (adjInterfResult != null && adjInterfResult.Length > 0) { Interfresult.ADJFreqInterfResult = adjInterfResult; Interfresult.ADJFreqInterfResultCount = adjInterfResult.Length; } } if ((analysisType & AnalysisType.IM) == AnalysisType.IM) { //互调干扰计算 IMOrder order = IMOrder.Second | IMOrder.Third | IMOrder.Fifth; IMAnalysisResult imresult = new IMAnalysisResult(); IMCalculator calculator = new IMCalculator(EquTransmitters, EquReceivers, StationTransmitters, StationReceivers); imresult.SetReceiverImResult(calculator.CalcReceiverIMInterference(order)); //imresult.SetTransmitterImResult(calculator.CalcTransmitterIMInterference()); if (imresult != null) { Interfresult.IMInterfResult = imresult; int transcount = 0; int receivcount = 0; if (imresult.GetReceiverImResult() != null && imresult.GetReceiverImResult().Values.Length > 0) { receivcount = imresult.GetReceiverImResult().Values.Length; } //if (imresult.GetTransmitterImResult() != null && imresult.GetTransmitterImResult().Values.Length > 0) //{ // transcount = imresult.GetTransmitterImResult().Values.Length; //} Interfresult.IMInterfResultCount = transcount + receivcount; } } return(Interfresult); }
/// <summary> /// 互调干扰 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnIM_Click(object sender, RoutedEventArgs e) { imresult.Text = null; IMOrder order = IMOrder.Second | IMOrder.Third | IMOrder.Fifth; IMAnalysisResult result = new IMAnalysisResult(); IMCalculator calculator = new IMCalculator(transmitters, receivers, transmitters, receivers); result.SetReceiverImResult(calculator.ReceiverIM(order)); result.SetTransmitterImResult(calculator.TransmitterIM()); StringBuilder strmsg = new StringBuilder(); int index = 0; //接收互调 IMCompareResult receiverResult = result.GetReceiverImResult(); if (receiverResult != null) { strmsg.Append("接收机互调干扰: \r"); IMItemBase imBase = null; for (int i = 0; i < receiverResult.Values.Length; i++) { imBase = receiverResult.Values[i]; for (int j = 0; j < imBase.DisturbedFreqs.Length; j++) { index++; ComparableFreq disfreq = imBase.DisturbedFreqs[j]; strmsg.AppendFormat("{0}:受干扰接收机: 频率ID:{1},频率:{2},带宽:{3} \r", index, disfreq.FreqID, disfreq.Freq, disfreq.Band); strmsg.AppendFormat("干扰阶数:{0},干扰公式:{1} \r", GetIMOrder(imBase.Order), imBase.Formula); for (int k = 0; k < imBase.IMFreqs.Length; k++) { strmsg.AppendFormat("干扰频率{0}:频率:{1},带宽:{2} \r", k + 1, imBase.IMFreqs[k].Freq, imBase.IMFreqs[k].Band); } strmsg.Append("\r"); } } } //发射机互调 IMCompareResult transResult = result.GetTransmitterImResult(); if (transResult != null && transResult.Values.Length > 0) { strmsg.Append("发射机互调干扰: \r"); IMItemBase imBase = null; index = 0; for (int i = 0; i < transResult.Values.Length; i++) { imBase = transResult.Values[i]; for (int j = 0; j < imBase.DisturbedFreqs.Length; j++) { index++; ComparableFreq disfreq = imBase.DisturbedFreqs[j]; strmsg.AppendFormat("{0}:受干扰发射机: 频率ID:{1},频率:{2},带宽:{3} \r", index, disfreq.FreqID, disfreq.Freq, disfreq.Band); strmsg.AppendFormat("干扰阶数:{0},干扰公式:{1} \r", GetIMOrder(imBase.Order), imBase.Formula); for (int k = 0; k < imBase.IMFreqs.Length; k++) { strmsg.AppendFormat("干扰频率{0}:频率:{1},带宽:{2} \r", k + 1, imBase.IMFreqs[k].Freq, imBase.IMFreqs[k].Band); } strmsg.Append("\r"); } } } imresult.Text = strmsg.ToString(); }