| | |
| | | // 修正组合偏差 |
| | | static void Main(string[] args) |
| | | { |
| | | Console.WriteLine("start"); |
| | | //Station1Helper.Start(); //1 数据修正 |
| | | //Station2Helper.Start(); //2 模型修正 |
| | | // 3 python修正 ,目前有些数据问题还需要解决 |
| | |
| | | //StationCombineHelper.Start(1);// 5 组合偏差修正 |
| | | //StationCombineHelper.Start(2);// 5 组合偏差修正 |
| | | |
| | | // 6 分析泵频谱系数 |
| | | // 7 |
| | | // Station2TotalFlowDiffHelper.Start();// 8 补全流量偏差 + python |
| | | // AnalysisDeviation(); // 6 分析泵频谱系数 |
| | | |
| | | // 7 |
| | | // Station2TotalFlowDiffHelper.Start();// 8 C# 导出数据 补全流量偏差 + python |
| | | |
| | | |
| | | //test |
| | | |
| | | StationTotalFlowPressureHelper.Start(); |
| | | Console.WriteLine(); |
| | | Console.WriteLine("ok"); |
| | | Console.ReadKey(); |
| | | |
| | | } |
| | | |
| | | public static void AnalysisDeviation() |
| | | { |
| | | var fullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "pumpcombine"); |
| | | var fileNameList = Directory.GetFiles(fullPath).Select(x => x).ToList(); |
| | | if (fileNameList == null || fileNameList.Count < 1) |
| | | return; |
| | | |
| | | var stationDict = new Dictionary<int, long> |
| | | { |
| | | { 1, 462958406303813 }, |
| | | { 2, 462958422204485 } |
| | | }; |
| | | |
| | | var bllEquipment = new IStation.BLL.Equipment(); |
| | | var bllCurve = new IStation.BLL.PumpCurve(); |
| | | var combineList = new List<ModelCombineViewModel>(); |
| | | |
| | | var minFlow = 0; |
| | | var maxFlow = 100000; |
| | | var spaceFlow = 100; |
| | | foreach (var fileName in fileNameList) |
| | | { |
| | | Console.WriteLine(Path.GetFileNameWithoutExtension(fileName) + ":Start"); |
| | | var indexStr = Path.GetFileNameWithoutExtension(fileName).Substring(0, 1); |
| | | var index = int.Parse(indexStr); |
| | | var stationId = stationDict[index]; |
| | | var pumpList = bllEquipment.GetPumpModelListByBelongTypeAndBelongID(IStation.ObjectType.Station, stationId); |
| | | var flagList = pumpList.Select(x => x.SortCode).OrderBy(x => x).ToList(); |
| | | var flagPumpDict = pumpList.ToDictionary(x => x.SortCode, x => x.RatedParas); |
| | | |
| | | |
| | | var json = File.ReadAllText(fileName); |
| | | var templist = JsonHelper.Json2Object<List<ModelCombineViewModel>>(json); |
| | | var run_flags_flow_pressure_diff_dict = templist |
| | | .Select(x => (x.RunFlags, x.ScadaTotalFlow, x.ModelDeviation)) |
| | | .ToList(); |
| | | var ana_dev_list = StationCombineHelper.GetAnalysisDeviationDtoList(flagPumpDict, run_flags_flow_pressure_diff_dict, minFlow, maxFlow, spaceFlow); |
| | | ana_dev_list.ForEach(x => x.Station = index); |
| | | var root_folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "pumpcombineana"); |
| | | if (!Directory.Exists(root_folder)) |
| | | { |
| | | Directory.CreateDirectory(root_folder); |
| | | } |
| | | var fileNameDev = Path.Combine(root_folder, $"AnalysisDeviation{spaceFlow}.json"); |
| | | StationCombineHelper.SaveAnalysisDeviationDtoList(index, ana_dev_list, fileNameDev); |
| | | Console.WriteLine(Path.GetFileNameWithoutExtension(fileName) + ":Save"); |
| | | } |
| | | |
| | | } |
| | | |
| | | public static void Completion() |
| | | { |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | //static void Main(string[] args) |
| | | //{ |
| | | // var splineList = new List<CurvePoint>(); |
| | | // var measuredList = new List<CurvePoint>(); |
| | | |
| | | // var path = AppDomain.CurrentDomain.BaseDirectory; |
| | | // var lienPaht = path + @"\pumpcsv\23_44_old_curve.csv"; |
| | | // var measuredPath = path + @"\pumpcsv\23_44.csv"; |
| | | |
| | | // using (var fs = new FileStream(lienPaht, FileMode.Open, FileAccess.Read)) |
| | | // using (var sr = new StreamReader(fs, Encoding.UTF8)) |
| | | // { |
| | | // var strLine = string.Empty; |
| | | // sr.ReadLine(); |
| | | // while (!string.IsNullOrEmpty(strLine = sr.ReadLine())) |
| | | // { |
| | | // var strList = strLine.Split(','); |
| | | // var x = double.Parse(strList[0]); |
| | | // var y = double.Parse(strList[1]); |
| | | // splineList.Add(new CurvePoint(x, y)); |
| | | // } |
| | | // } |
| | | |
| | | // using (var fs = new FileStream(measuredPath, FileMode.Open, FileAccess.Read)) |
| | | // using (var sr = new StreamReader(fs, Encoding.UTF8)) |
| | | // { |
| | | // var strLine = string.Empty; |
| | | // sr.ReadLine(); |
| | | // while (!string.IsNullOrEmpty(strLine = sr.ReadLine())) |
| | | // { |
| | | // var strList = strLine.Split(','); |
| | | // var x = double.Parse(strList[4]); |
| | | // var y = double.Parse(strList[5]); |
| | | // measuredList.Add(new CurvePoint(x, y)); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | // // 样条曲线处理 |
| | | // double[] splineX = splineList.Select(x => x.X).ToArray(); |
| | | // double[] splineY = splineList.Select(x => x.Y).ToArray(); |
| | | |
| | | // // 实测数据处理 |
| | | // double[] measuredXAll = measuredList.Select(x => x.X).ToArray(); |
| | | // double[] measuredYAll = measuredList.Select(x => x.Y).ToArray(); |
| | | |
| | | |
| | | |
| | | // var helper = new PumpCurveDataFusionCorrectorHelper(); |
| | | // (double[] mergedX, double[] mergedY, double[] optimizedX, double[] optimizedY) = helper.Corrent(splineX, splineY, measuredXAll, measuredYAll); |
| | | |
| | | // var pt_list = new List<CurvePoint>(); |
| | | // for (int i = 0; i < optimizedX.Length; i++) |
| | | // { |
| | | // var x = optimizedX[i]; |
| | | // var y = optimizedY[i]; |
| | | // pt_list.Add(new CurvePoint(x, y)); |
| | | // } |
| | | // var fullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "pumpcsv"); |
| | | // CsvHelper.ExportToCsv(pt_list, Path.Combine(fullPath, $"23_44_update_curve.csv")); |
| | | |
| | | // Console.WriteLine("ok"); |
| | | // Console.ReadKey(); |
| | | //} |
| | | |
| | | |
| | | private static Dictionary<int, IStation.Model.CurveExpress> GetFlagCurveDict() |
| | | { |