Beispiel #1
0
        //private void InitData()
        //{
        //    compareFreqs = new ComparableFreq[6];
        //    compareFreqs[0] = new ComparableFreq(18, 0, 2, "1");
        //    compareFreqs[1] = new ComparableFreq(19, 0, 2, "2");
        //    compareFreqs[2] = new ComparableFreq(20, 0, 2, "3");
        //    compareFreqs[3] = new ComparableFreq(20, 0, 4, "4");
        //    compareFreqs[4] = new ComparableFreq(21, 0, 2, "5");
        //    compareFreqs[5] = new ComparableFreq(22, 0, 4, "6");
        //    datagrid.ItemsSource = compareFreqs;

        //    calcFreqs = new ComparableFreq[1];
        //    calcFreqs[0] = new ComparableFreq(20, 0, 2, "1");

        //    //互调干扰数据源
        //    //接收  new EMCGeographyCoordinate(109, 36.01)
        //    receivers = new Receiver[1];
        //    receivers[0] = new Receiver("1",
        //        new ComparableFreq(30, 0,2, "1"),
        //        new ReceiverParams()
        //        {
        //            TuningRangeStart = new EMCFreqValue(EMCFreqUnitEnum.MHZ, 8),
        //            TuningRangeEnd = new EMCFreqValue(EMCFreqUnitEnum.MHZ, 32),
        //            IFBand = new EMCFreqValue(EMCFreqUnitEnum.MHZ, 4),
        //            Sensitivity = -1000,
        //            SensitivityUnit = SensitivityUnitEnum.dBm

        //        }, null );

        //    //发射 new EMCGeographyCoordinate(109, 36)
        //    transmitters = new Transmitter[4];

        //    transmitters[0] = new Transmitter("4", new ComparableFreq(10, 2, "2"),
        //        new TransmitterParams()
        //        {
        //            TuningRangeStart = new EMCFreqValue(EMCFreqUnitEnum.MHZ, 9),
        //            TuningRangeEnd = new EMCFreqValue(EMCFreqUnitEnum.MHZ, 15),
        //            Power = new EMCPowerValue(EMCPowerUnitEnum.W, 10)
        //        }, null
        //        );

        //    transmitters[1] = new Transmitter("5", new ComparableFreq(15, 2, "1"),
        //        new TransmitterParams()
        //        {
        //            TuningRangeStart = new EMCFreqValue(EMCFreqUnitEnum.MHZ, 10),
        //            TuningRangeEnd = new EMCFreqValue(EMCFreqUnitEnum.MHZ, 18),
        //            Power = new EMCPowerValue(EMCPowerUnitEnum.W, 10)
        //        }, null);

        //    transmitters[2] = new Transmitter("6", new ComparableFreq(20, 2, "1"),
        //        new TransmitterParams()
        //        {
        //            TuningRangeStart = new EMCFreqValue(EMCFreqUnitEnum.MHZ, 19),
        //            TuningRangeEnd = new EMCFreqValue(EMCFreqUnitEnum.MHZ, 22),
        //            Power = new EMCPowerValue(EMCPowerUnitEnum.W, 10)
        //        },
        //       null);

        //    transmitters[3] = new Transmitter("7", new ComparableFreq(40, 2, "2"),
        //       new TransmitterParams()
        //       {
        //           TuningRangeStart = new EMCFreqValue(EMCFreqUnitEnum.MHZ, 35),
        //           TuningRangeEnd = new EMCFreqValue(EMCFreqUnitEnum.MHZ, 45),
        //           Power = new EMCPowerValue(EMCPowerUnitEnum.W, 10)
        //       },
        //       null);

        //    transdatagrid.ItemsSource = transmitters;

        //}

        /// <summary>
        /// 同频计算
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSameFreq_Click(object sender, RoutedEventArgs e)
        {
            //AnalysisType analysisType = AnalysisType.None ;
            //InterferenceAnalysisResult result = InterferenceAnalysis.Calculator(analysisType,compareFreqs, transmitters, receivers);

            this.samefreqresult.Text = null;
            SameFreqCalculator samefreqCalc = new SameFreqCalculator(calcFreqs, compareFreqs);

            SameFreqCompareResult[] samecompareResult = samefreqCalc.CalcSameFreqInterference();

            StringBuilder strmsg = new StringBuilder();

            if (samecompareResult != null && samecompareResult.Length > 0)
            {
                for (int i = 0; i < samecompareResult.Length; i++)
                {
                    SameFreqCompareResult sameresult = samecompareResult[i];
                    ComparableFreq        ifreq      = sameresult.Keys[0];
                    strmsg.AppendFormat("{0}:受干扰频率:ID:{1},频率:{2},带宽:{3} \r", i + 1, ifreq.FreqID, ifreq.Freq, ifreq.Band);
                    strmsg.Append("  干扰频率:");
                    string disfreq = string.Empty;
                    foreach (ComparableFreq item in sameresult.Values)
                    {
                        strmsg.AppendFormat("干扰频率:ID:{0},频率:{1},带宽:{2}\r", item.FreqID, item.Freq, item.Band);
                    }
                    strmsg.Append("\r");
                }
            }
            this.samefreqresult.Text = strmsg.ToString();
        }
        /// <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);
        }