/// <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);
        }
Example #2
0
        /// <summary>
        /// 领频计算
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnAdjFreq_Click(object sender, RoutedEventArgs e)
        {
            adjfreqresult.Text = null;
            AdjFreqCalculator adjfreqCalc = new AdjFreqCalculator(calcFreqs, compareFreqs);

            AdjFreqCompareResult[] adjcompareResult = adjfreqCalc.CalcAdjFreqInterference();
            StringBuilder          strmsg           = new StringBuilder();

            if (adjcompareResult != null && adjcompareResult.Length > 0)
            {
                for (int i = 0; i < adjcompareResult.Length; i++)
                {
                    AdjFreqCompareResult adjresult = adjcompareResult[i];
                    ComparableFreq       ifreq     = adjresult.Keys[0];
                    strmsg.AppendFormat("{0}:受干扰频率:ID:{1},频率:{2},带宽:{3} \r", i + 1, ifreq.FreqID, ifreq.Freq, ifreq.Band);
                    //上邻频干扰
                    if (adjresult.HasUpperAdjFreq)
                    {
                        foreach (ComparableFreq item in adjresult.UpperAdjFreqs)
                        {
                            strmsg.AppendFormat("上邻频干扰:ID:{0},频率:{1},带宽:{2} \r", item.FreqID, item.Freq, item.Band);
                        }
                    }

                    //下邻频干扰
                    if (adjresult.HasLowerAdjFreq)
                    {
                        foreach (ComparableFreq item in adjresult.LowerAdjFreqs)
                        {
                            strmsg.AppendFormat("下邻频干扰:ID:{0},频率:{1},带宽:{2} \r", item.FreqID, item.Freq, item.Band);
                        }
                    }
                    strmsg.Append("\r");
                }
            }
            adjfreqresult.Text = strmsg.ToString();
        }