private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            weldList.Clear();
            //测试数据
            //weldList.Add(new WeldModel { Mile = "1", Speed = "2", RmsValue = "3", PeakValue = "4", SampleNo = "5" });

            //citFilePath = @"H:\工作文件汇总\铁科院\程序\离线加速度\cit文件\CitData_160612060534_CHSS_11corrugationRms.cit";
            double[] mileData  = citHelper.GetMilesData(citFilePath);
            double[] speedData = citHelper.GetSingleChannelData(citFilePath, 3);
            int      channelId = 4;

            if (this.radioButton1.Checked)
            {
                channelId = 4;
            }
            else if (this.radioButton2.Checked)
            {
                channelId = 5;
            }
            else if (this.radioButton3.Checked)
            {
                channelId = 6;
            }
            double[] rmsData = citHelper.GetSingleChannelData(citFilePath, channelId);
            double   avg     = rmsData.ToList().Average();

            double[] avgRmsData = new double[rmsData.Length];
            for (int i = 0; i < avgRmsData.Length; i++)
            {
                avgRmsData[i] = rmsData[i] / avg;
            }
            int    fs        = Convert.ToInt32(this.txt_fs.Text.Trim());
            double dist_weld = Convert.ToDouble(this.txt_dist_weld.Text.Trim());

            WeldProcess(mileData, speedData, rmsData, avgRmsData, fs, dist_weld);
        }
Exemplo n.º 2
0
        public List <PowerSpectrum> GetResult(string filePath, string channelName, double kmStart, double kmEnd, double Nlen, double dt)
        {
            long startPos = 0;
            long endPos   = 0;
            long pos1     = citHelper.GetCurrentPosition(filePath, Convert.ToSingle(kmStart) * 1000);
            long pos2     = citHelper.GetCurrentPosition(filePath, Convert.ToSingle(kmEnd) * 1000);

            if (pos1 > pos2)
            {
                startPos = pos2;
                endPos   = pos1;
            }
            else
            {
                startPos = pos1;
                endPos   = pos2;
            }

            double[] d_tt = citHelper.GetMilesData(filePath, startPos, endPos);

            int channelId = citHelper.GetChannelId(channelName, filePath);

            double[] d_wx = citHelper.GetSingleChannelData(filePath, channelId, startPos, endPos);

            #region 注释

            //int indexStart = 0;
            //int indexEnd = d_tt.Length - 1;

            //if (d_tt[0] < d_tt[d_tt.Length - 1])
            //{
            //    //增里程
            //    for (int i = 0; i < d_tt.Length; i++)
            //    {
            //        if (d_tt[i] >= kmStart)
            //        {
            //            indexStart = i;
            //            break;
            //        }
            //    }
            //    for (int i = 0; i < d_tt.Length; i++)
            //    {
            //        if (d_tt[i] >= kmEnd)
            //        {
            //            indexEnd = i;
            //            break;
            //        }
            //    }

            //}
            //else
            //{
            //    //减里程
            //    for (int i = 0; i < d_tt.Length; i++)
            //    {
            //        if (d_tt[i] <= kmStart)
            //        {
            //            indexStart = i;
            //            break;
            //        }
            //    }
            //    for (int i = 0; i < d_tt.Length; i++)
            //    {
            //        if (d_tt[i] <= kmEnd)
            //        {
            //            indexEnd = i;
            //            break;
            //        }
            //    }
            //}
            //int len = indexEnd - indexStart + 1;
            //double[] tt_new = new double[len];
            //double[] wx_new = new double[len];

            //Array.Copy(d_tt, indexStart, tt_new, 0, len);
            //Array.Copy(d_wx, indexStart, wx_new, 0, len);

            #endregion

            var list = Sub_Fourier_analysis(channelName, d_tt, d_wx, Nlen, dt);

            return(list);
        }