/// <summary> /// 普通逐个计算 /// </summary> private void CommonCalculation() { try { DataProcess.CITDataProcess citProcess = new DataProcess.CITDataProcess(); InvalidDataProcessing.CalculateDistrubtionClass calculateDistrubtion = new InvalidDataProcessing.CalculateDistrubtionClass(); foreach (var sFile in citSourceCheckFileList) { int channelId1 = citProcess.GetChannelNumberByChannelNameLike(sFile, "SPEED", "速度"); int channelId2 = citProcess.GetChannelNumberByChannelNameLike(sFile, "AB_Vt_L_RMS", "左轴垂有效值"); int channelId3 = citProcess.GetChannelNumberByChannelNameLike(sFile, "AB_Vt_R_RMS", "右轴垂有效值"); int channelId4 = citProcess.GetChannelNumberByChannelNameLike(sFile, "AB_Lt_L_RMS", "左轴横有效值"); double[] d1 = citProcess.GetSingleChannelData(sFile, channelId1); //double[] d2 = citProcess.GetSingleChannelData(sFile, channelId2); //double[] d3 = citProcess.GetSingleChannelData(sFile, channelId3); //double[] d4 = citProcess.GetSingleChannelData(sFile, channelId4); string folderPath = sFile.Substring(0, sFile.LastIndexOf('\\')); string fileName = sFile.Substring(sFile.LastIndexOf('\\') + 1); //CreateExcelNew(d1, folderPath, "cit数据1", "速度"); //CreateExcelNew(d2, folderPath, "cit数据2", "左轴垂有效值AB_Vt_L_RMS"); double rmsMean1 = Convert.ToDouble(this.txtRmsMean1.Text); double rmsMean2 = Convert.ToDouble(this.txtRmsMean2.Text); double rmsMean3 = Convert.ToDouble(this.txtRmsMean3.Text); double[] d2 = citProcess.GetSingleChannelData(sFile, channelId2); calculateDistrubtion.CalDistrubtionProcess(d2, d1, folderPath, fileName + "左轴垂_rms_distribution", rmsMean1, fileName + "左轴垂_tii_distribution"); Array.Clear(d2, 0, d2.Length); double[] d3 = citProcess.GetSingleChannelData(sFile, channelId3); calculateDistrubtion.CalDistrubtionProcess(d3, d1, folderPath, fileName + "右轴垂_rms_distribution", rmsMean2, fileName + "右轴垂_tii_distribution"); Array.Clear(d3, 0, d3.Length); double[] d4 = citProcess.GetSingleChannelData(sFile, channelId4); calculateDistrubtion.CalDistrubtionProcess(d4, d1, folderPath, fileName + "左轴横_rms_distribution", rmsMean3, fileName + "左轴横_tii_distribution"); Array.Clear(d4, 0, d4.Length); MessageBox.Show("完成"); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
/// <summary> /// cit合并计算 /// </summary> private void CitMergeCalculation() { List <double> list1 = new List <double>(); List <double> list2 = new List <double>(); List <double> list3 = new List <double>(); List <double> list4 = new List <double>(); string folderPath = ""; try { DataProcess.CITDataProcess citProcess = new DataProcess.CITDataProcess(); foreach (var sFile in citSourceCheckFileList) { if (folderPath == "") { folderPath = sFile.Substring(0, sFile.LastIndexOf('\\')); } int channelId1 = citProcess.GetChannelNumberByChannelNameLike(sFile, "SPEED", "速度"); double[] d1 = citProcess.GetSingleChannelData(sFile, channelId1); list1.AddRange(d1); } double[] speedArray = list1.ToArray(); list1.Clear(); InvalidDataProcessing.CalculateDistrubtionClass calculateDistrubtion = new InvalidDataProcessing.CalculateDistrubtionClass(); GetDataAndProcess(citProcess, calculateDistrubtion, speedArray, folderPath, "AB_Vt_L_RMS", "左轴垂有效值"); GetDataAndProcess(citProcess, calculateDistrubtion, speedArray, folderPath, "AB_Vt_R_RMS", "右轴垂有效值"); GetDataAndProcess(citProcess, calculateDistrubtion, speedArray, folderPath, "AB_Lt_L_RMS", "左轴横有效值"); MessageBox.Show("完成"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void GetDataAndProcess(DataProcess.CITDataProcess citProcess, InvalidDataProcessing.CalculateDistrubtionClass calculateDistrubtion, double[] arraySpeed, string folderPath, string channelNameEn, string channelNameCn) { List <double> list = new List <double>(); double[] d2 = null; foreach (var sFile in citSourceCheckFileList) { int channelId2 = citProcess.GetChannelNumberByChannelNameLike(sFile, channelNameEn, channelNameCn); d2 = citProcess.GetSingleChannelData(sFile, channelId2); list.AddRange(d2); } double[] array = list.ToArray(); list.Clear(); string fileName = "有效值概率分布计算_"; string datetime = DateTime.Now.ToString("yyyyMMdd_HHmm"); calculateDistrubtion.CalDistrubtionProcess_Prev(array, arraySpeed, folderPath, fileName + channelNameEn + "_" + datetime); Array.Clear(array, 0, array.Length); Array.Clear(d2, 0, d2.Length); GC.Collect(); }