/// <summary>
        /// 互调
        /// </summary>
        /// <param name="imInterfResult"></param>
        /// <returns></returns>
        internal List <InterferedBindingData> GetBindingData(IMCompareResult imInterfResult)
        {
            List <InterferedBindingData> bindingDatas = new List <InterferedBindingData>();

            IMItemBase[] results = imInterfResult.Values;
            if (results == null || results.Length == 0)
            {
                return(bindingDatas);
            }

            foreach (IMItemBase imItemBase in results)
            {
                InterferedBindingData bindingData = new InterferedBindingData();
                if (imItemBase is SecondOrderIMItem)
                {
                    bindingData.InterferedType = "二阶互调干扰";
                }
                else if (imItemBase is ThirdOrderIMItem)
                {
                    bindingData.InterferedType = "三阶互调干扰";
                }
                else if (imItemBase is FifthIMItem)
                {
                    bindingData.InterferedType = "五阶阶互调干扰";
                }
                foreach (ComparableFreq freqinfo in imItemBase.IMFreqs)
                {
                    bindingData.InterferedFreq = string.Join(",", imItemBase.IMFreqs);
                    if (LoadBaseBindingData(bindingData, freqinfo.FreqID))
                    {
                        bindingDatas.Add(bindingData);
                    }
                }
            }

            return(bindingDatas);
        }
        /// <summary>
        /// 获取发射机互调
        /// </summary>
        /// <param name="transmResult"></param>
        /// <returns></returns>
        private List <IMInterfereResult> GetTransmitterImResult(IMCompareResult transmResult)
        {
            List <IMInterfereResult> imInterfresultlst = new List <IMInterfereResult>();

            if (transmResult != null)
            {
                #region 获取干扰结果

                IMItemBase imBase = null;
                for (int i = 0; i < transmResult.Values.Length; i++)
                {
                    imBase = transmResult.Values[i];
                    ActivityEquipmentInfo equ = new ActivityEquipmentInfo();

                    ComparableFreq imfreq = imBase.IMFreqs[0];//发射互调的干扰频率存在IMFreqs中
                    equ = _equipments.FirstOrDefault(r => r.GUID == imfreq.FreqID);

                    bool isnewInterfere = true; //新的干扰,不存在dicIMInterfereResult字典中
                    if (equ != null)
                    {
                        if (this.dicIMInterfereResult.TryGetValue(equ, out imInterfresultlst))
                        {
                            isnewInterfere = false;
                        }
                        else
                        {
                            isnewInterfere    = true;
                            imInterfresultlst = new List <IMInterfereResult>();
                        }

                        IMInterfereResult iminterfinfo = new IMInterfereResult();
                        iminterfinfo.InterfType   = InterfereTypeEnum.发射机互调干扰;
                        iminterfinfo.InterfOrder  = GetIMInterfOrder(imBase.Order);
                        iminterfinfo.Formual      = imBase.Formula;
                        iminterfinfo.InterfObject = new List <InterfereObject>();


                        #region  获取干扰台站


                        ComparableFreq disfreq = imBase.DisturbedFreqs[0];

                        //先在设备列表中查找,如果有,则认为干扰物为设备
                        ActivityEquipmentInfo Interfequ1    = _equipments.FirstOrDefault(r => r.GUID == disfreq.FreqID);
                        InterfereObject       interfobject1 = null;
                        if (Interfequ1 != null)
                        {
                            interfobject1 = CreateInterfObjectFromEqu(Interfequ1);
                        }
                        else
                        {
                            //如设备列表中没有,则在周围台站列表中查找,如果有,则认为干扰物为设备
                            RoundStationInfo Interfstation = _aroundStation.FirstOrDefault(r => r.STATGUID == disfreq.FreqID);
                            if (Interfstation != null)
                            {
                                interfobject1 = CreateInterfObjectFromStation(Interfstation, disfreq);
                            }
                            else
                            {
                                //如设备列表和周围台站列表中都没有此干扰物,则认为干扰物为其他(这种情况应该不会出现??)
                                interfobject1 = CreateInterfObjectFromOther(imBase.DisturbedFreqs[0]);
                            }
                        }
                        iminterfinfo.InterfObject.Add(interfobject1);

                        //先在设备列表中查找,如果有,则认为干扰物为设备
                        ActivityEquipmentInfo Interfequ2    = _equipments.FirstOrDefault(r => r.GUID == imBase.IMFreqs[1].FreqID);
                        InterfereObject       interfobject2 = null;
                        if (Interfequ2 != null)
                        {
                            interfobject2 = CreateInterfObjectFromEqu(Interfequ2);
                        }
                        else
                        {
                            //如设备列表中没有,则在周围台站列表中查找,如果有,则认为干扰物为设备
                            RoundStationInfo Interfstation = _aroundStation.FirstOrDefault(r => r.STATGUID == imBase.IMFreqs[1].FreqID);
                            if (Interfstation != null)
                            {
                                interfobject2 = CreateInterfObjectFromStation(Interfstation, imBase.IMFreqs[1]);
                            }
                            else
                            {
                                //如设备列表和周围台站列表中都没有此干扰物,则认为干扰物为其他(这种情况应该不会出现??)
                                interfobject2 = CreateInterfObjectFromOther(imBase.IMFreqs[1]);
                            }
                        }
                        iminterfinfo.InterfObject.Add(interfobject2);

                        #endregion

                        imInterfresultlst.Add(iminterfinfo);

                        if (isnewInterfere)
                        {
                            this.dicIMInterfereResult.Add(equ, imInterfresultlst);
                        }
                    }
                }
                #endregion
            }
            return(imInterfresultlst);
        }
        /// <summary>
        /// 计算的实现
        /// </summary>
        /// <param name="p_calculateAllFreqs"></param>
        /// <param name="p_calculateAllRCFreqs"></param>
        /// <param name="p_unKnowSignalFreqs"></param>
        private void CalculateRealize(List <ComparableFreq> p_calculateAllFreqs, List <ComparableFreq> p_calculateAllRCFreqs, List <ComparableFreq> p_unKnowSignalFreqs)
        {
            #region
            //if(p_unKnowSignalFreqs.Count > 15)
            //{
            //    //发 106.5 ,96.8 收 106 , 96.8
            //    p_unKnowSignalFreqs[0] = new ComparableFreq(106.4, 0, 0, 0.5, ""); //同频
            //    p_unKnowSignalFreqs[1] = new ComparableFreq(96.8, 0, 0, 0.200, "");  //同频

            //    p_unKnowSignalFreqs[2] = new ComparableFreq(105.5, 0, 0, 0.400, ""); //邻频
            //    p_unKnowSignalFreqs[3] = new ComparableFreq(107.5, 0, 0, 0.400, ""); //邻频
            //    p_unKnowSignalFreqs[4] = new ComparableFreq(95.8, 0, 0, 0.400, "");  //邻频
            //    p_unKnowSignalFreqs[5] = new ComparableFreq(97.8, 0, 0, 0.400, "");  //邻频

            //    p_unKnowSignalFreqs[6] = new ComparableFreq(206, 0, 0, 0.400, "");  //二阶互调
            //    p_unKnowSignalFreqs[7] = new ComparableFreq(100, 0, 0, 0.400, "");  //二阶互调
            //    p_unKnowSignalFreqs[8] = new ComparableFreq(50, 0, 0, 0.400, "");   //二阶互调
            //    p_unKnowSignalFreqs[9] = new ComparableFreq(56, 0, 0, 0.400, "");   //二阶互调

            //    p_unKnowSignalFreqs[10] = new ComparableFreq(90, 0, 0, 0.400, "");     //三阶互调
            //    p_unKnowSignalFreqs[11] = new ComparableFreq(106.8, 0, 0, 0.400, "");  //三阶互调
            //    p_unKnowSignalFreqs[12] = new ComparableFreq(100, 0, 0, 0.400, "");    //三阶互调

            //    p_unKnowSignalFreqs[13] = new ComparableFreq(95, 0, 0, 0.400, "");     //五阶互调
            //    p_unKnowSignalFreqs[14] = new ComparableFreq(94.1, 0, 0, 0.400, "");   //五阶互调
            //}
            #endregion



            CompareResultToBindingData bindingData = new CompareResultToBindingData(GetEquipment, GetSurroundStation);
            //同频干扰
            List <InterferedBindingData> gridSource   = new List <InterferedBindingData>();
            SameFreqCalculator           samefreqCalc = new SameFreqCalculator(p_calculateAllFreqs.ToArray(), p_unKnowSignalFreqs.ToArray());
            SameFreqCompareResult[]      sameResults  = samefreqCalc.CalcSameFreqInterference();
            if (sameResults != null && sameResults.Length > 0)
            {
                foreach (var sameResult in sameResults)
                {
                    List <InterferedBindingData> sameFreqlist = bindingData.GetBindingData(sameResult);
                    gridSource.AddRange(sameFreqlist);
                }
            }

            //邻频干扰
            AdjFreqCalculator      adjfreqCalc     = new AdjFreqCalculator(p_calculateAllFreqs.ToArray(), p_unKnowSignalFreqs.ToArray());
            AdjFreqCompareResult[] adjInterfResult = adjfreqCalc.CalcAdjFreqInterference();
            if (adjInterfResult != null && adjInterfResult.Length > 0)
            {
                List <InterferedBindingData> adjFreqlist = bindingData.GetBindingData(adjInterfResult);
                gridSource.AddRange(adjFreqlist);
            }
            //互调干扰
            IMCalculator    calculator     = new IMCalculator(GetTransmitter(p_unKnowSignalFreqs), new Receiver[0], GetTransmitter(p_calculateAllFreqs), GetReceivers(p_calculateAllRCFreqs));
            IMOrder         order          = IMOrder.Second | IMOrder.Third | IMOrder.Fifth;
            IMCompareResult imInterfResult = calculator.CalcReceiverIMInterference(order);
            if (imInterfResult != null)
            {
                List <InterferedBindingData> imFreqlist = bindingData.GetBindingData(imInterfResult);
                gridSource.AddRange(imFreqlist);
            }
            ItemsSourceBinding(gridSource);
        }
Beispiel #4
0
        /// <summary>
        /// 获取接收机互调
        /// </summary>
        /// <param name="receiverResult"></param>
        /// <returns></returns>
        private List <IMInterfereResult> GetReceiverImResult(IMCompareResult receiverResult)
        {
            List <IMInterfereResult> imInterfresultlst = new List <IMInterfereResult>();

            if (receiverResult != null)
            {
                #region 获取干扰结果

                IMItemBase imBase = null;
                for (int i = 0; i < receiverResult.Values.Length; i++)
                {
                    imBase = receiverResult.Values[i];
                    ActivityEquipment equ     = new ActivityEquipment();
                    ComparableFreq    disfreq = imBase.DisturbedFreqs[0];
                    equ = _equipments.FirstOrDefault(r => r.Key == disfreq.FreqID);

                    bool isnewInterfere = true; //新的干扰,不存在dicIMInterfereResult字典中
                    if (equ != null)
                    {
                        if (this.dicIMInterfereResult.TryGetValue(equ, out imInterfresultlst))
                        {
                            isnewInterfere = false;
                        }
                        else
                        {
                            isnewInterfere    = true;
                            imInterfresultlst = new List <IMInterfereResult>();
                        }

                        IMInterfereResult iminterfinfo = new IMInterfereResult();
                        iminterfinfo.InterfType   = InterfereTypeEnum.接收机互调干扰;
                        iminterfinfo.InterfOrder  = GetIMInterfOrder(imBase.Order);
                        iminterfinfo.Formual      = imBase.Formula;
                        iminterfinfo.InterfObject = new List <InterfereObject>();


                        #region  获取干扰台站

                        for (int k = 0; k < imBase.IMFreqs.Length; k++)
                        {
                            ComparableFreq freq = imBase.IMFreqs[k];

                            //先在设备列表中查找,如果有,则认为干扰物为设备
                            ActivityEquipment Interfequ    = _equipments.FirstOrDefault(r => r.Key == freq.FreqID);
                            InterfereObject   interfobject = null;
                            if (Interfequ != null)
                            {
                                interfobject      = CreateInterfObjectFromEqu(Interfequ);
                                interfobject.Freq = freq.Freq; //干扰频率有可能是备用频率
                            }
                            else
                            {
                                //如设备列表中没有,则在周围台站列表中查找,如果有,则认为干扰物为设备
                                ActivitySurroundStation Interfstation = _aroundStation.FirstOrDefault(r => r.STATGUID == freq.FreqID);
                                if (Interfstation != null)
                                {
                                    interfobject = CreateInterfObjectFromStation(Interfstation, freq);
                                }
                                else
                                {
                                    //如设备列表和周围台站列表中都没有此干扰物,则认为干扰物为其他(这种情况应该不会出现??)
                                    interfobject = CreateInterfObjectFromOther(freq);
                                }
                            }
                            iminterfinfo.InterfObject.Add(interfobject);
                        }

                        #endregion

                        imInterfresultlst.Add(iminterfinfo);

                        if (isnewInterfere)
                        {
                            this.dicIMInterfereResult.Add(equ, imInterfresultlst);
                        }
                    }
                }
                #endregion
            }

            return(imInterfresultlst);
        }