页面代码提交
This commit is contained in:
@@ -21,18 +21,17 @@ namespace 头罩视野.Services
|
||||
public const int maxRadius_mm = 330;
|
||||
|
||||
/// <summary>单眼标准标定面积:无面罩空标准头模的单眼实测面积 国标视野保存率计算的基准值,单位:cm²</summary>
|
||||
public const double SingleEyeStandardArea = 5180;
|
||||
public const double standardArea = 5180;
|
||||
|
||||
/// <summary>双目标准标定总面积:无面罩空标准头模的双目总实测面积国标总视野保存率计算的基准值,单位:cm²</summary>
|
||||
public const double StandardTotal = 10360;
|
||||
|
||||
// 补充:用半径计算的单眼理论圆面积(供参考) 公式:π × 半径²,单位:cm²
|
||||
public static readonly double standardArea = Math.PI * maxRadius_mm * maxRadius_mm / 100;
|
||||
public static readonly double standardAreaOus = Math.PI * maxRadius_mm * maxRadius_mm / 100;
|
||||
|
||||
//双目重叠标准
|
||||
public static double StandardBinocular = 4150;
|
||||
|
||||
|
||||
// 剔除异常值,用相邻数据插值
|
||||
|
||||
public static List<dynamic> RemoveOutliers(List<dynamic> data)
|
||||
@@ -76,9 +75,6 @@ namespace 头罩视野.Services
|
||||
return (valid / lightNum) * standardArea;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//计算双目视野面积
|
||||
/// <summary>
|
||||
/// 计算双目视野面积(左右眼同时可见)
|
||||
@@ -89,22 +85,10 @@ namespace 头罩视野.Services
|
||||
)
|
||||
{
|
||||
// 1. 左眼平均数据
|
||||
double[] leftAvg = new double[lightNum];
|
||||
for (int i = 0; i < lightNum; i++)
|
||||
{
|
||||
double sum = 0;
|
||||
foreach (var g in leftGroups) sum += g[i];
|
||||
leftAvg[i] = sum / leftGroups.Count;
|
||||
}
|
||||
double[] leftAvg = GetEyeAvgArray(leftGroups);
|
||||
|
||||
// 2. 右眼平均数据
|
||||
double[] rightAvg = new double[lightNum];
|
||||
for (int i = 0; i < lightNum; i++)
|
||||
{
|
||||
double sum = 0;
|
||||
foreach (var g in rightGroups) sum += g[i];
|
||||
rightAvg[i] = sum / rightGroups.Count;
|
||||
}
|
||||
double[] rightAvg = GetEyeAvgArray(rightGroups);
|
||||
|
||||
// 3. 双目同时有效点数(左右都亮才算)
|
||||
int biValid = 0;
|
||||
|
||||
@@ -29,10 +29,6 @@ namespace 头罩视野.Views
|
||||
/// 只加这一个变量
|
||||
private CancellationTokenSource? _cts;
|
||||
private IModbusMaster _modbusMaster => ModbusResourceManager.Instance.ModbusMaster;
|
||||
|
||||
//public List<dynamic> LeftEyeDataList { get; private set; }
|
||||
//public List<dynamic> RightEyeDataList { get; private set; }
|
||||
|
||||
DispatcherTimer _timer;
|
||||
DataChange c = new DataChange();
|
||||
Function ma;
|
||||
@@ -43,6 +39,7 @@ namespace 头罩视野.Views
|
||||
private TestDataStore.TestRecord? _lastRecord;
|
||||
private object btnLeftEye;
|
||||
|
||||
|
||||
public PageTest()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -314,9 +311,11 @@ namespace 头罩视野.Views
|
||||
isFinished = _modbusMaster.ReadCoils(1, 102, 1)[0];
|
||||
if (isFinished)
|
||||
{
|
||||
int.TryParse(fbspeed.Text, out int speedValue);
|
||||
// 还不确定?
|
||||
var recordPage = GetRecordDatePage();
|
||||
recordPage?.getAllData(LeftEyeDataList, RightEyeDataList);
|
||||
recordPage?.StopPlcTimer();
|
||||
recordPage?.getAllData(recordPage.LeftEyeDataList, recordPage.RightEyeDataList, int.Parse(fbspeed.Text));
|
||||
//值显示在页面,
|
||||
zmsyarea.Text = GlobalData.LeftEyeArea.ToString("0.00"); // 左目
|
||||
smsyarea.Text = GlobalData.BinocularArea.ToString("0.00"); // 双目
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace 头罩视野.Views
|
||||
}
|
||||
|
||||
//面积的计算方法
|
||||
public void getAllData(List<dynamic> leftEyeDataList, List<dynamic> RightEyeDataList, double perAngle)
|
||||
public void getAllData(List<dynamic> leftEyeDataList, List<dynamic> RightEyeDataList, int perAngle)
|
||||
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user