namespace IStation.Test
|
{
|
internal class Program
|
{
|
|
//static BLL.StationSignalRecordPacket bll = new BLL.StationSignalRecordPacket();
|
//static long projectId = 661070185922629;
|
//static long monitorDataSourcesId = 606203941007429;
|
//static DateTime dateStart = new DateTime(2024, 1, 1);
|
//static DateTime dateEnd = new DateTime(2025, 1, 1);
|
//static Dictionary<int, long> stationDict = new Dictionary<int, long>
|
// {
|
// { 1, 462958406303813 },
|
// { 2, 462958422204485 }
|
// };
|
|
//// 过滤无效数据
|
//// 1输模型修正
|
//// 2输数据修正
|
//// 修正组合偏差
|
//static void Main(string[] args)
|
//{
|
|
|
// IStation.SettingsD.Project.ID = projectId;
|
|
// var ptList = new List<PointViewModel>();
|
// var ptFilterList = new List<PointViewModel>();
|
// foreach (var station in stationDict)
|
// {
|
// var stationIndex = station.Key;
|
// var stationId = station.Value;
|
// var packets = bll.Get(monitorDataSourcesId, stationId);
|
// var list = new List<PointViewModel>();
|
|
// var records = packets.SelectMany(x => x.StationSignalRecords).ToList();
|
// foreach (var x in records)
|
// {
|
// //if (x.TotalPressure > 0 && x.TotalFlow > 0)
|
// //{
|
// // if (stationIndex == 2 && x.DiffFlow > 0)
|
// // {
|
// // continue;
|
// // }
|
// // ptList.Add(new PointViewModel(x.Time, x.TotalFlow, x.TotalPressure, x.DiffFlow, stationIndex));
|
// //}
|
// if (x.TotalPressure < 0 || x.TotalPressure > 40)
|
// {
|
// continue;
|
// }
|
// if (x.TotalFlow < 1000)
|
// {
|
// continue;
|
// }
|
// if (x.TotalPressure < 13 && stationIndex == 1)
|
// {
|
// continue;
|
// }
|
// if (stationIndex == 2 && Math.Abs(x.DiffFlow) > 3500)
|
// {
|
// continue;
|
// }
|
// list.Add(new PointViewModel(x.Time, x.TotalFlow, x.TotalPressure, x.DiffFlow, stationIndex));
|
// }
|
|
|
// ptList.AddRange(list);
|
// var newPtList = DynamicThresholdProcessorHelper.Filter(list);
|
// ptFilterList.AddRange(newPtList);
|
// }
|
|
// var fullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "csv");
|
// if (!Directory.Exists(fullPath))
|
// {
|
// Directory.CreateDirectory(fullPath);
|
// }
|
|
// var recordFilterList = GetRecordList(ptFilterList, Path.Combine(fullPath, "allFilter.csv"));
|
// var recordList = GetRecordList(ptList, Path.Combine(fullPath, "all.csv"));
|
|
// var fc = recordFilterList.Count;
|
// var c=recordList.Count;
|
// Console.WriteLine($"recordFilterList:{fc} recordList:{c} diff:{c-fc}");
|
// Console.WriteLine("ok");
|
// Console.ReadKey();
|
|
//}
|
|
|
//static List<RecordViewModel> GetRecordList(List<PointViewModel> list,string filePath)
|
//{
|
// var recordList = new List<RecordViewModel>();
|
// var timeGroup = list.GroupBy(x => x.Time);
|
// foreach (var group in timeGroup)
|
// {
|
// if (group.Count() < 2)
|
// continue;
|
// var record = new RecordViewModel
|
// {
|
// Time = group.Key
|
// };
|
// foreach (var item in group)
|
// {
|
// if (item.Index == 1)
|
// {
|
// record.Flow1 = item.X;
|
// record.Pressure1 = item.Y;
|
// }
|
// else
|
// {
|
// record.Flow2 = item.X;
|
// record.Pressure2 = item.Y;
|
// record.FlowDiff2 = item.Diff;
|
// }
|
// }
|
|
// recordList.Add(record);
|
// }
|
|
// {
|
// using StreamWriter writer = new StreamWriter(filePath, false, System.Text.Encoding.UTF8);
|
// writer.WriteLine($"Time,Flow1,Pressure1,Flow2,Pressure2,FlowDiff2");
|
|
// foreach (var record in recordList)
|
// {
|
// writer.WriteLine($"{record.Time},{record.Flow1},{record.Pressure1},{record.Flow2:N3},{record.Pressure2:N5},{record.FlowDiff2}");
|
// // writer.WriteLine($"{record.Time},{record.Flow1},{record.Pressure1},{record.Flow2},{record.Pressure2},{Math.Abs(record.FlowDiff2)}");
|
// }
|
|
// }
|
// return recordList;
|
|
//}
|
|
|
// 过滤无效数据
|
// 1输模型修正
|
// 2输数据修正
|
// 修正组合偏差
|
static void Main(string[] args)
|
{
|
Station2Helper.Start();
|
Console.WriteLine();
|
Console.WriteLine();
|
Console.WriteLine("ok");
|
Console.ReadKey();
|
}
|
|
|
|
}
|
|
}
|