From 9d59b439ebb1bad510ac7c1f5dcfb8260aea3683 Mon Sep 17 00:00:00 2001 From: xyy <544939200@qq.com> Date: Tue, 2 Jun 2026 20:13:30 +0800 Subject: [PATCH] --- Models/AppConfig.cs | 9 ++++++--- ViewModels/D7896ViewModel.cs | 12 +++++++----- appsettings.json | 8 ++++---- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Models/AppConfig.cs b/Models/AppConfig.cs index 103c8d6..607b12f 100644 --- a/Models/AppConfig.cs +++ b/Models/AppConfig.cs @@ -68,8 +68,11 @@ public class TestParameters - public double FitStartTime { get; set; } = 0.01; // 默认0.35秒,避开早期扰动 - public double FitEndTime { get; set; } = 0.1; + //public double FitStartTime { get; set; } = 0.01; // 默认0.35秒,避开早期扰动 + //public double FitEndTime { get; set; } = 0.1; + + public double FitStartTime { get; set; } = 0.20; // 默认0.35秒,避开早期扰动 + public double FitEndTime { get; set; } = 0.60; @@ -89,6 +92,6 @@ public class CalibrationCoefficients public ushort TemperatureCoefficient { get; set; } public ushort ResistanceCoefficient { get; set; } - public double ThermalConductivityCorrection { get; set; } = 0.606; + public double ThermalConductivityCorrection { get; set; } = 36.8; public double ThermalDiffusivityCorrection { get; set; } = 19.9; } \ No newline at end of file diff --git a/ViewModels/D7896ViewModel.cs b/ViewModels/D7896ViewModel.cs index 136ef19..1b17661 100644 --- a/ViewModels/D7896ViewModel.cs +++ b/ViewModels/D7896ViewModel.cs @@ -91,8 +91,8 @@ public partial class D7896ViewModel : ObservableObject private const double EulerGamma = 0.5772156649; // 欧拉常数 //private const double WireRadius = 0.00003; // 铂丝半径 (0.03 mm) [ObservableProperty] private double _sampleDensity = 1000.0; // 新增,密度默认值1000 kg/m³(水) - int samples = 1000; // 1秒 * 1000点/秒 - double heatingDuration =1; // 加热时间 0.8 秒(需与您的加热脉冲宽度一致) + int samples = 800; // 1秒 * 1000点/秒 + double heatingDuration = 1; // 加热时间 0.8 秒(需与您的加热脉冲宽度一致) double totalDuration = 2; // 总采样时间(加热 + 冷却) public D7896ViewModel() { @@ -342,8 +342,8 @@ public partial class D7896ViewModel : ObservableObject if (dynamicR0 == 2.45) // 仍为默认值,说明基线无效 { double sumR0 = 0; int cnt = 0; - // 改用第 10 到 19 点(共10个点),避开前10个点的干扰 - for (int j = 10; j < Math.Min(20, ustd.Length); j++) + // 改用第 2~5 点(索引 2,3,4,5) + for (int j = 2; j < Math.Min(6, ustd.Length); j++) { if (ustd[j] > 0.01 && upt[j] > 0.01) { @@ -354,7 +354,7 @@ public partial class D7896ViewModel : ObservableObject if (cnt > 0) { dynamicR0 = sumR0 / cnt; - Logger.Log($"使用加热段第10~19点计算 R0 = {dynamicR0:F6} Ω"); + Logger.Log($"使用加热段第2~5点计算 R0 = {dynamicR0:F6} Ω"); } } @@ -550,6 +550,8 @@ public partial class D7896ViewModel : ObservableObject double exponent = intercept / slope + EulerGamma; if (exponent > 30) exponent = 30; double alpha = (_config.TestParameters.PlatinumWireDiameter / 2 * _config.TestParameters.PlatinumWireDiameter / 2 / 4.0) * Math.Exp(exponent); + + alpha *= _config.TestParameters.CalibrationCoefficients.ThermalConductivityCorrection; if (_config.TestParameters.UseFixedAlpha) { alpha = _config.TestParameters.FixedAlpha; diff --git a/appsettings.json b/appsettings.json index 421342b..a342f16 100644 --- a/appsettings.json +++ b/appsettings.json @@ -25,10 +25,10 @@ "TestParameters": { "MeasurementCount": 10, "IntervalSeconds": 30, - //"PlatinumWireLength": 0.056, //铂丝长度(单位:米) - //"PlatinumWireDiameter": 0.00006, - "PlatinumWireLength": 0.41, //铂丝长度(单位:米) - "PlatinumWireDiameter": 0.00018, + "PlatinumWireLength": 0.1250, //铂丝长度(单位:米) + "PlatinumWireDiameter": 0.00006, + //"PlatinumWireLength": 0.41, //铂丝长度(单位:米) + //"PlatinumWireDiameter": 0.00021, "ReportOutputPath": "Reports\\", "DefaultSampleVolume": 40.0, "DefaultPressure": 0.0,