This commit is contained in:
xyy
2026-06-16 21:18:46 +08:00
parent 8c0af19f02
commit 4489514b5d
7 changed files with 163 additions and 47 deletions

View File

@@ -28,7 +28,7 @@ namespace AciTester.Services
sheet.Cells["A5"].Value = "总质量F(g):";
sheet.Cells["B5"].Value = result.TotalMass;
// 在报告生成时添加
// 测试环境
sheet.Cells["A6"].Value = "测试环境:";
sheet.Cells["B6"].Value = $"流量: {result.FlowRate:F2} L/min, 温度: {result.Temperature:F1}℃, 压差: {result.DifferentialPressure:F2} kPa";
@@ -38,14 +38,28 @@ namespace AciTester.Services
sheet.Cells["A8"].Value = "微细粒子分数(FPF)";
sheet.Cells["B8"].Value = $"{result.FineParticleFraction:F2}%";
// 各级数据表
sheet.Cells["A10"].Value = "层级";
sheet.Cells["B10"].Value = "截止直径(μm)";
sheet.Cells["C10"].Value = "净重(g)";
sheet.Cells["D10"].Value = "占比(%)";
sheet.Cells["A10:D10"].Style.Font.Bold = true;
// ============ 新增:粒径分布参数 ============
sheet.Cells["A9"].Value = "粒径分布参数";
sheet.Cells["A9"].Style.Font.Bold = true;
int row = 11;
sheet.Cells["A10"].Value = "D10 (μm)";
sheet.Cells["B10"].Value = result.D10;
sheet.Cells["A11"].Value = "D50 (μm) (MMAD)";
sheet.Cells["B11"].Value = result.D50;
sheet.Cells["A12"].Value = "D90 (μm)";
sheet.Cells["B12"].Value = result.D90;
sheet.Cells["A13"].Value = "GSD (几何标准偏差)";
sheet.Cells["B13"].Value = result.GSD;
// 各级数据表起始行号调整为15
int dataStartRow = 15;
sheet.Cells[dataStartRow, 1].Value = "层级";
sheet.Cells[dataStartRow, 2].Value = "截止直径(μm)";
sheet.Cells[dataStartRow, 3].Value = "净重(g)";
sheet.Cells[dataStartRow, 4].Value = "占比(%)";
sheet.Cells[dataStartRow, 1, dataStartRow, 4].Style.Font.Bold = true;
int row = dataStartRow + 1;
double total = result.TotalMass;
foreach (var stage in result.Stages)
{

View File

@@ -88,10 +88,14 @@ namespace AciTester.Services
public async Task<bool> ReadCoilAsync(ushort coilAddress)
{
await EnsureConnectedAsync();
await Task.Delay(100);
bool[] result = await _master?.ReadCoilsAsync(_config.SlaveId, coilAddress, 1);
return result[0];
try
{
await EnsureConnectedAsync();
await Task.Delay(100);
bool[] result = await _master?.ReadCoilsAsync(_config.SlaveId, coilAddress, 1);
return result[0];
}
catch { return false; }
}
public bool IsConnected => _tcpClient != null && _tcpClient.Connected;