Пример #1
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="equipID">所属设备编号</param>
 /// <param name="freq">发射频率</param>
 /// <param name="transmitter">发射机参数</param>
 /// <param name="coordinate">地理坐标</param>
 public Transmitter(string equipID, ComparableFreq freq, TransmitterParams transmitter, EMCGeographyCoordinate coordinate)
 {
     this.equipID           = equipID;
     this.freqValue         = freq;
     this.transmitterParams = transmitter;
     this.coordinate        = coordinate;
 }
        /// <summary>
        /// 向结果中增加上邻频信息
        /// </summary>
        /// <param name="freq">参考频率</param>
        /// <param name="disturbFreq">参考频率的上邻频频率</param>
        private void AddLowerAdjCompareResult(ComparableFreq freq, ComparableFreq disturbFreq, string interfdescribe)
        {
            disturbFreq.InterfereResult = interfdescribe;
            AdjFreqCompareResult  result;
            List <ComparableFreq> list;

            if (!this.resultList.TryGetValue(freq, out result))
            {
                if (this.dicFreqMapping.TryGetValue(freq, out list))
                {
                    ComparableFreq[] freqArray = new ComparableFreq[dicFreqMapping[freq].Count + 1];
                    freqArray[0] = freq;
                    dicFreqMapping[freq].CopyTo(freqArray, 1);
                    result = new AdjFreqCompareResult(freqArray);
                }
                else
                {
                    result = new AdjFreqCompareResult(freq);
                }
                this.resultList.Add(freq, result);
            }
            result.AddLowerAdjFreq(disturbFreq);
            if (this.dicFreqMapping.TryGetValue(disturbFreq, out list))
            {
                result.AddLowerAdjFreq(list.ToArray());
            }
        }
        /// <summary>
        /// 取台站的频率,转成ComparableFreq
        /// </summary>
        /// <param name="aroundstations"></param>
        /// <returns></returns>
        private static ComparableFreq[] GetStationFreqs(List <ActivitySurroundStation> stations)
        {
            List <ComparableFreq> freqs = new List <ComparableFreq>();

            if (stations != null)
            {
                foreach (ActivitySurroundStation station in stations)
                {
                    if (station.EmitInfo != null)
                    {
                        foreach (StationEmitInfo freqem in station.EmitInfo)
                        {
                            //只计算频点干扰,不计算频段干扰
                            if (freqem.FreqType == FreqType.频点)
                            {
                                double         freqEC = freqem.FreqEC.Value;
                                double         band   = freqem.FreqBand;
                                ComparableFreq freq   = new ComparableFreq(freqEC, 0, band, station.STATGUID);

                                if (!freqs.Contains(freq))
                                {
                                    freqs.Add(freq);
                                }
                            }
                        }
                    }
                }
            }
            return(freqs.ToArray());
        }
Пример #4
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();
        }
Пример #5
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="equipID">设备编号</param>
 /// <param name="freqValue">接收机频率</param>
 /// <param name="receiverParams">接收机参数</param>
 /// <param name="coordinate">接收机坐标</param>
 public Receiver(string equipID, ComparableFreq freqValue, ReceiverParams receiverParams, EMCGeographyCoordinate coordinate)
 {
     this.equipID        = equipID;
     this.receiverParams = receiverParams;
     this.freqValue      = freqValue;
     this.coordinate     = coordinate;
 }
        /// <summary>
        /// 向结果中添加同频结果
        /// </summary>
        /// <param name="freq">检索同频干扰关键字</param>
        /// <param name="disturbFreq">同频干扰频率 </param>
        private void Add(ComparableFreq freq, ComparableFreq disturbFreq)
        {
            SameFreqCompareResult result;
            List <ComparableFreq> list;

            if (!this.resultList.TryGetValue(freq, out result))
            {
                if (this.dicFreqMapping.TryGetValue(freq, out list))
                {
                    ComparableFreq[] freqArray = new ComparableFreq[dicFreqMapping[freq].Count + 1];
                    freqArray[0] = freq;
                    dicFreqMapping[freq].CopyTo(freqArray, 1);
                    result = new SameFreqCompareResult(freqArray);
                }
                else
                {
                    result = new SameFreqCompareResult(freq);
                }
                this.resultList.Add(freq, result);
            }
            result.AddFreq(disturbFreq);
            if (this.dicFreqMapping.TryGetValue(disturbFreq, out list))
            {
                result.AddFreqRange(list.ToArray());
            }
        }
Пример #7
0
        /// <summary>
        /// 获取同频映射表
        /// </summary>
        /// <param name="freq">用于比较的频率</param>
        /// <returns>和当前参数指定频率完全一直的频率组</returns>
        public ComparableFreq[] GetSameFreqMapping(ComparableFreq freq)
        {
            List <ComparableFreq> listFreq;

            if (this.sameFreqMapping.TryGetValue(freq, out listFreq))
            {
                return(listFreq.ToArray());
            }
            return(new ComparableFreq[0]);
        }
Пример #8
0
 /// <summary>
 /// 获取所有参与计算的频率
 /// </summary>
 /// <param name="item">要计算的互调项目</param>
 /// <returns>参与计算的频率</returns>
 private ComparableFreq[] GetCalcFreqs(IMItemBase item)
 {
     ComparableFreq[] resultFreqs = new ComparableFreq[item.CalcFreqCount + 1];
     for (int i = 0; i < item.CalcFreqCount; i++)
     {
         resultFreqs[i] = item[i];
     }
     resultFreqs[item.CalcFreqCount] = item.DisturbedFreqs[0];
     return(resultFreqs);
 }
Пример #9
0
        /// <summary>
        /// 登记五阶互调
        /// </summary>
        /// <param name="one">计算互调用频率</param>
        /// <param name="other">另一个计算互调用频率</param>
        private void RegisterFifthOrderIMItem(ComparableFreq one, ComparableFreq other)
        {
            double freqValue = one.Freq * 3 - other.Freq * 2;

            if (freqValue > 0 && this.currentReceiver.IsValidatingFreq(freqValue))
            {
                FifthIMItem item = new FifthIMItem(new ComparableFreq[] { one, other }, new int[] { 3, -2 });
                item.DisturbedFreqs = new ComparableFreq[] { this.currentReceiver.ComparableFreq };
                this.imResult.RegisterIMItem(item);
            }
        }
Пример #10
0
 /// <summary>
 /// 判断干扰公式是否涉及参数指定频率
 /// </summary>
 /// <param name="freq">判定频率</param>
 /// <returns>判断结果:true,公式中使用的该频率;false,公式中未使用该频率</returns>
 public bool ReferFreq(ComparableFreq freq)
 {
     foreach (ComparableFreq compareFreq in this.imFreqs)
     {
         if (freq.Equals(compareFreq))
         {
             return(true);
         }
     }
     foreach (ComparableFreq compareFreq in this.disturbedFreqs)
     {
         if (freq.Equals(compareFreq))
         {
             return(true);
         }
     }
     return(false);
 }
Пример #11
0
        /// <summary>
        /// 获取参数指定频率参与的互调公式
        /// </summary>
        /// <param name="freq">参考频率</param>
        /// <returns>互调结果</returns>
        public IMCompareResult GetIMCompareResult(ComparableFreq freq)
        {
            IMCompareResult result  = new IMCompareResult(this.sameFreqMapping);
            ComparableFreq  keyFreq = freq;

            foreach (ComparableFreq key in sameFreqMapping.Keys)
            {
                if (freq.IsValueEquals(key))
                {
                    keyFreq = key;
                    break;
                }
            }
            foreach (IMItemBase item in this.imList)
            {
                if (item.ReferFreq(freq))
                {
                    result.RegisterIMItem(item);
                }
            }
            return(result);
        }
Пример #12
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();
        }
Пример #13
0
        /// <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();
        }
Пример #14
0
 /// <summary>
 /// 向结果中添加频率
 /// </summary>
 /// <param name="freq">待添加频率</param>
 public void AddFreq(ComparableFreq freq)
 {
     this.list.Add(freq);
 }
Пример #15
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="key">用于获取结果的频率</param>
 public SameFreqCompareResult(ComparableFreq key)
 {
     this.keys    = new ComparableFreq[1];
     this.keys[0] = key;
 }
Пример #16
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="freq">计算邻频的频率</param>
 public AdjFreqCompareResult(ComparableFreq freq)
 {
     this.keys    = new ComparableFreq[1];
     this.keys[0] = freq;
 }