示例#1
0
        /// <summary>
        /// 合并etrms
        /// </summary>
        internal void CombineEtrms()
        {
            string totalResult = null;
            string filePath    = null;
            //******************取出temp文件夹中的所有文件
            List <ResultFile> resultFiles = new List <ResultFile>();

            string[] files = Directory.GetFiles(this.projectPath + "\\" + "temp");
            foreach (string f in files)
            {
                ResultFile file = new ResultFile(f);
                resultFiles.Add(file);
            }
            //*********************************************
            List <string>             midPointFrequencies           = new List <string>();
            List <List <ResultFile> > sameRxTypeFile                = new List <List <ResultFile> >();
            List <List <ResultFile> > sameMidPointAndSameRxtypeFile = new List <List <ResultFile> >();

            if (resultFiles != null && resultFiles.Count > 0)
            {
                sameRxTypeFile = SearchSameRxTypeFile(resultFiles, GetRxType(resultFiles));
                foreach (List <ResultFile> singleRxTypeFile in sameRxTypeFile)
                {
                    midPointFrequencies           = GetMidPointFrequency(singleRxTypeFile);
                    sameMidPointAndSameRxtypeFile = SearchSameMidPointAndSameRxTypeFile(singleRxTypeFile, midPointFrequencies);
                    for (int i = 0; i < midPointFrequencies.Count; i++)
                    {
                        totalResult = CombineMethod.CombineEtrms(sameMidPointAndSameRxtypeFile[i]);
                        filePath    = this.projectPath + "\\" + this.projectName + "_etrms_" + midPointFrequencies[i] +
                                      "_" + singleRxTypeFile[0].FileNameInfo.ReceiverNumber + ".p2m";
                        filePathsAndTotalResults.Add(filePath, totalResult);
                    }
                }
            }
        }
示例#2
0
 /// </summary>
 /// 合并功率
 /// </summary>
 internal void CombinePower(List <ResultFile> resultTypes)
 {
     if (resultTypes != null && resultTypes.Count > 0)
     {
         List <List <ResultFile> > sameRxTypeFile = new List <List <ResultFile> >();
         sameRxTypeFile = SearchSameRxTypeFile(resultTypes, GetRxType(resultTypes));
         for (int i = 0; i < sameRxTypeFile.Count; i++)
         {
             string totalResult = CombineMethod.CombinePower(sameRxTypeFile[i]);
             string filePath    = this.projectPath + "\\" + this.projectName + "_power_" + GetRxType(resultTypes)[i] + ".p2m";
             filePathsAndTotalResults.Add(filePath, totalResult);
         }
     }
 }
示例#3
0
        /// <summary>
        /// 合并态势功率的方法
        /// </summary>
        /// <param name="resultType"></param>
        /// <param name="projectPath"></param>
        /// <param name="projectName"></param>
        internal void CombineSituationPower(List <ResultFile> resultTypes)
        {
            string totalResult = null;

            if (resultTypes != null && resultTypes.Count > 0)
            {
                totalResult = CombineMethod.CombineSituationPower(resultTypes);
                using (StreamWriter sw = File.CreateText(this.projectPath + "\\" + this.projectName + "_psum.p2m"))
                    sw.Write(totalResult);
                //********************添加生成bmp文件,有异常则不生成,跳至下一处
                do
                {
                    StreamReader      streamReader       = new StreamReader(this.projectPath + "\\" + this.projectName + "_psum.p2m");
                    List <PointValue> pointNormalizeList = new List <PointValue>();
                    List <PointValue> pointValueList     = new List <PointValue>();
                    streamReader.ReadLine();
                    streamReader.ReadLine();//第1、2行不读
                    string lineData = streamReader.ReadLine();
                    double tempMax  = -100;
                    double tempMin  = 0;
                    while (lineData != null)
                    {
                        PointValue pointValue = new PointValue();
                        lineData = lineData.Trim();
                        //按空格拆分
                        string[] tmp       = System.Text.RegularExpressions.Regex.Split(lineData, @"\s+");
                        bool     isSuccess = Double.TryParse(tmp[1], out pointValue.x);
                        if (!isSuccess)
                        {
                            break;
                        }
                        isSuccess = Double.TryParse(tmp[2], out pointValue.y);
                        if (!isSuccess)
                        {
                            break;
                        }
                        isSuccess = Double.TryParse(tmp[3], out pointValue.z);
                        if (!isSuccess)
                        {
                            break;
                        }
                        isSuccess = Double.TryParse(tmp[5], out pointValue.value);
                        if (!isSuccess)
                        {
                            break;
                        }
                        pointValueList.Add(pointValue);
                        pointNormalizeList.Add(pointValue);
                        if (pointValue.value > tempMax)
                        {
                            tempMax = pointValue.value;
                        }
                        if (pointValue.value < tempMin)
                        {
                            tempMin = pointValue.value;
                        }
                        lineData = streamReader.ReadLine();
                    }
                    streamReader.Close();
                    for (int itemp = 0; itemp < pointValueList.Count; itemp++)
                    {
                        pointNormalizeList[itemp].value = (pointValueList[itemp].value - tempMin) / (tempMax - tempMin);//以对数形式归一化
                    }
                    BmpResultUti.CreateBMP(pointValueList, this.projectPath + "\\" + this.projectName + "_situation_psum.bmp", tempMax, tempMin);
                    using (StreamWriter sw = File.CreateText(this.projectPath + "\\" + this.projectName + "_situation_psum_max_value" + ".p2m"))//将功率最大值最小值写入文件
                    {
                        sw.WriteLine(tempMax.ToString());
                        sw.WriteLine(tempMin.ToString());
                    }
                } while (false);
            }
        }
示例#4
0
 /// </summary>
 /// 合并态势显示的erm的方法
 /// </summary>
 internal void CombineSituationErms(List <ResultFile> resultTypes)
 {
     if (resultTypes != null && resultTypes.Count > 0)
     {
         string        totalResult         = null;
         List <string> midPointFrequencies = GetMidPointFrequency(resultTypes);
         List <Dictionary <ResultFile, double> > resultFilesWithWeights = GetWeight(resultTypes, midPointFrequencies);
         for (int i = 0; i < midPointFrequencies.Count; i++)
         {
             totalResult = CombineMethod.CombineSituationErms(resultFilesWithWeights[i]);
             using (StreamWriter sw = File.CreateText(this.projectPath + "\\" + this.projectName + "_erms_" + midPointFrequencies[i] + ".p2m"))
                 sw.Write(totalResult);
             //********************添加生成bmp文件,有异常则不生成,跳至下一处
             do
             {
                 StreamReader      streamReader       = new StreamReader(this.projectPath + "\\" + this.projectName + "_erms_" + midPointFrequencies[i] + ".p2m");
                 List <PointValue> pointValueList     = new List <PointValue>();
                 List <PointValue> pointNormalizeList = new List <PointValue>();
                 streamReader.ReadLine();
                 streamReader.ReadLine();//第1、2行不读
                 string lineData = streamReader.ReadLine();
                 double tempMax  = -80;
                 double tempMin  = 0;
                 while (lineData != null)
                 {
                     PointValue pointValue = new PointValue();
                     lineData = lineData.Trim();
                     string[] tmp       = System.Text.RegularExpressions.Regex.Split(lineData, @"\s+");
                     bool     isSuccess = Double.TryParse(tmp[1], out pointValue.x);
                     if (!isSuccess)
                     {
                         break;
                     }
                     isSuccess = Double.TryParse(tmp[2], out pointValue.y);
                     if (!isSuccess)
                     {
                         break;
                     }
                     isSuccess = Double.TryParse(tmp[3], out pointValue.z);
                     if (!isSuccess)
                     {
                         break;
                     }
                     isSuccess = Double.TryParse(tmp[5], out pointValue.value);
                     if (!isSuccess)
                     {
                         break;
                     }
                     pointValueList.Add(pointValue);
                     double tempValue = pointValue.value;
                     if (tempValue < 0.00000001)
                     {
                         tempValue = -80;
                     }
                     else
                     {
                         tempValue = 10 * Math.Log10(tempValue);
                     }
                     pointValue.value = tempValue;
                     pointNormalizeList.Add(pointValue);
                     if (pointValue.value > tempMax)
                     {
                         tempMax = pointValue.value;
                     }
                     if (pointValue.value < tempMin)
                     {
                         tempMin = pointValue.value;
                     }
                     lineData = streamReader.ReadLine();
                 }
                 streamReader.Close();
                 for (int itemp = 0; itemp < pointValueList.Count; itemp++)
                 {
                     pointNormalizeList[itemp].value = (pointValueList[itemp].value - tempMin) / (tempMax - tempMin);//以对数形式归一化
                 }
                 //生成bmp
                 BmpResultUti.CreateBMP(pointValueList, this.projectPath + "\\" + this.projectName + "_situation_erms_" + midPointFrequencies[i] + ".bmp", tempMax, tempMin);
                 using (StreamWriter sw = File.CreateText(this.projectPath + "\\" + this.projectName + "_situation_erms_max_value_" + midPointFrequencies[i] + ".p2m"))//将最大值写入文件
                 {
                     sw.WriteLine(tempMax.ToString());
                     sw.WriteLine(tempMin.ToString());
                 }
             } while (false);
         }
         //******************************************
     }
 }
示例#5
0
        /// <summary>
        /// 合并场强幅度或相位的方法
        /// </summary>
        /// <param name="resultType"></param>
        internal void CombineMagnitudeOrPhase(List <ResultFile> resultTypes)
        {
            string resultType  = null;                      //结果文件类型,比如:etxmag,etyphs
            string totalResult = null;                      //合成后的结果
            string filePath    = null;                      //合成结果的文件路径
            string typeSymbol  = null;                      //标识合成的是场强还是相位

            switch (resultTypes[0].FileNameInfo.ResultType) //根据输入的参数判断合成的是哪种类型的文件
            {
            case "exmag":
                resultType = "etxmag";
                typeSymbol = "magnitude";
                break;

            case "eymag":
                resultType = "etymag";
                typeSymbol = "magnitude";
                break;

            case "ezmag":
                resultType = "etzmag";
                typeSymbol = "magnitude";
                break;

            case "exphs":
                resultType = "etxphs";
                typeSymbol = "phase";
                break;

            case "eyphs":
                resultType = "etyphs";
                typeSymbol = "phase";
                break;

            case "ezphs":
                resultType = "etzphs";
                typeSymbol = "phase";
                break;
            }
            List <List <ResultFile> > sameRxTypeFile      = new List <List <ResultFile> >();
            List <string>             midPointFrequencies = new List <string>();
            List <Dictionary <ResultFile, double> > resultFilesWithWeights = new List <Dictionary <ResultFile, double> >();
            List <string> rxtypes = GetRxType(resultTypes);

            if (resultTypes != null && resultTypes.Count > 0)
            {
                sameRxTypeFile = SearchSameRxTypeFile(resultTypes, GetRxType(resultTypes));
                foreach (List <ResultFile> singleRxTypeFile in sameRxTypeFile)
                {
                    midPointFrequencies    = GetMidPointFrequency(singleRxTypeFile);
                    resultFilesWithWeights = GetWeight(singleRxTypeFile, midPointFrequencies);
                    for (int i = 0; i < midPointFrequencies.Count; i++)
                    {
                        if (typeSymbol == "magnitude")
                        {
                            totalResult = CombineMethod.CombineMag(resultFilesWithWeights[i]);
                            filePath    = this.projectPath + "\\" + "temp" + "\\" + this.projectName + "_" + resultType
                                          + "_" + midPointFrequencies[i] + "_" + singleRxTypeFile[0].FileNameInfo.ReceiverNumber + ".p2m";
                            filePathsAndTotalResults.Add(filePath, totalResult);
                        }
                        if (typeSymbol == "phase")
                        {
                            totalResult = CombineMethod.CombinePhase(resultFilesWithWeights[i]);
                            filePath    = this.projectPath + "\\" + this.projectName + "_" + resultType + "_" +
                                          midPointFrequencies[i] + "_" + singleRxTypeFile[0].FileNameInfo.ReceiverNumber + ".p2m";
                            filePathsAndTotalResults.Add(filePath, totalResult);
                        }
                    }
                }
            }
        }