Compare commits

...

2 Commits

Author SHA1 Message Date
xyy
9d59b439eb 2026-06-02 20:13:30 +08:00
xyy
dea0d29d18 2026-06-01 19:25:57 +08:00
3 changed files with 19 additions and 14 deletions

View File

@@ -68,8 +68,11 @@ public class TestParameters
public double FitStartTime { get; set; } = 0.01; // 默认0.35秒,避开早期扰动
public double FitEndTime { get; set; } = 0.3;
//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;
}

View File

@@ -90,9 +90,8 @@ public partial class D7896ViewModel : ObservableObject
private const double EulerGamma = 0.5772156649; // 欧拉常数
//private const double WireRadius = 0.00003; // 铂丝半径 (0.03 mm)
private const double WireRadius = 0.00010; // 铂丝半径 (0.03 mm)
[ObservableProperty] private double _sampleDensity = 1000.0; // 新增密度默认值1000 kg/m³
int samples = 1000; // 1秒 * 1000点/秒
int samples = 800; // 1秒 * 1000点/秒
double heatingDuration = 1; // 加热时间 0.8 秒(需与您的加热脉冲宽度一致)
double totalDuration = 2; // 总采样时间(加热 + 冷却)
public D7896ViewModel()
@@ -343,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)
{
@@ -355,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} Ω");
}
}
@@ -409,7 +408,7 @@ public partial class D7896ViewModel : ObservableObject
if (i < _config.TestParameters.MeasurementCount && !_stopRequested)
{
try { await Task.Delay(_config.TestParameters.IntervalSeconds * 1000, _testCts.Token); } catch (OperationCanceledException) { break; }
try { await Task.Delay(_config.TestParameters.IntervalSeconds * 500, _testCts.Token); } catch (OperationCanceledException) { break; }
}
}
@@ -550,7 +549,9 @@ public partial class D7896ViewModel : ObservableObject
// 计算热扩散率
double exponent = intercept / slope + EulerGamma;
if (exponent > 30) exponent = 30;
double alpha = (WireRadius * WireRadius / 4.0) * Math.Exp(exponent);
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;
@@ -635,7 +636,7 @@ public partial class D7896ViewModel : ObservableObject
for (int i = 0; i < n; i++)
{
bool inFit = (i >= fitStart && i <= fitEnd);
sw.WriteLine($"{i},{time[i]:F6},{ustd[i]:F6},{upt[i]:F6},{(double.IsNaN(deltaT[i])?0:deltaT[i]):F6},{(inFit?1:0)}");
sw.WriteLine($"{i},{time[i]:F6},{ustd[i]:F6},{upt[i]:F6},{(double.IsNaN(deltaT[i]) ? 0 : deltaT[i]):F6},{(inFit ? 1 : 0)}");
}
}

View File

@@ -25,9 +25,10 @@
"TestParameters": {
"MeasurementCount": 10,
"IntervalSeconds": 30,
//"PlatinumWireLength": 0.056, //铂丝长度(单位:米)
"PlatinumWireLength": 0.41, //铂丝长度(单位:米)
"PlatinumWireDiameter": 0.000025,
"PlatinumWireLength": 0.1250, //铂丝长度(单位:米)
"PlatinumWireDiameter": 0.00006,
//"PlatinumWireLength": 0.41, //铂丝长度(单位:米)
//"PlatinumWireDiameter": 0.00021,
"ReportOutputPath": "Reports\\",
"DefaultSampleVolume": 40.0,
"DefaultPressure": 0.0,