页面样式
This commit is contained in:
@@ -23,6 +23,8 @@ public static class ModbusHelper
|
||||
// 判断是否连接成功
|
||||
public static bool IsConnected => TcpClient != null && TcpClient.Connected;
|
||||
|
||||
public static ushort ValidThreshold { get; private set; }
|
||||
|
||||
|
||||
// <summary>
|
||||
/// 公共保存方法(用户自选文件夹)
|
||||
@@ -66,6 +68,36 @@ public static class ModbusHelper
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 剔除异常值,用相邻数据插值
|
||||
private static List<ushort> RemoveOutliers(List<ushort> data)
|
||||
{
|
||||
for (int i = 1; i < data.Count - 1; i++)
|
||||
{
|
||||
if (Math.Abs(data[i] - data[i - 1]) > 30 && Math.Abs(data[i] - data[i + 1]) > 30)
|
||||
{
|
||||
data[i] = (ushort)((data[i - 1] + data[i + 1]) / 2);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
//// 过滤无效信号
|
||||
private const int ValidSignalThreshold = 10;
|
||||
|
||||
private static void FilterInvalidSignals(List<ushort> data)
|
||||
{
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
if (data[i] < ValidSignalThreshold)
|
||||
data[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 计算单眼视野面积
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user