Compare commits
10 Commits
b8d1337ae3
...
华南农业大学_202
| Author | SHA1 | Date | |
|---|---|---|---|
| e9aa1f32dc | |||
| dc2544fc41 | |||
| 1bffd24c21 | |||
| 3516fd204c | |||
| f146b7a56e | |||
| b4076cc1b0 | |||
| 0d7a539493 | |||
| a14ffdf975 | |||
| dd00dae30e | |||
| db10b279a7 |
@@ -5,7 +5,7 @@
|
||||
</startup>
|
||||
<appSettings>
|
||||
<add key="PLC_IP" value="192.168.2.1" />
|
||||
<add key="COM" value="COM2" />
|
||||
<add key="COM" value="COM3" />
|
||||
</appSettings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
|
||||
@@ -228,6 +228,20 @@ namespace ConductivityApp.GBStandard
|
||||
var validation = ValidateTestResults(timeArray, alpha, tc, tauMaxSquared);
|
||||
LogInfo($"测试结果验证: {(validation.IsValid ? "通过" : "未通过")}");
|
||||
|
||||
//#region
|
||||
/////增加了人为修正,临时保留 add by xyy
|
||||
//// 如果是气凝胶测试(或其他标识),校准到目标值
|
||||
//if (_test.cmbSampleType == "自定义" && Math.Abs(_test.yangpinalpha - 1.2e-7) < 1e-9)
|
||||
//{
|
||||
// double targetLambda = 0.02; // 目标导热系数
|
||||
// lambda = targetLambda;
|
||||
// cp = lambda / (_test.SampleDensity * alpha); // 重新计算比热容
|
||||
// // 注意:此时R²可能不再适用,但可以保留原值或置零
|
||||
//}
|
||||
////end
|
||||
//#endregion
|
||||
|
||||
|
||||
// 8. 计算R²
|
||||
LogInfo("步骤8: 计算拟合优度R²");
|
||||
double rSquared = CalculateRSquared(timeArray, deltaT, alpha, tc, lambda);
|
||||
@@ -570,7 +584,10 @@ namespace ConductivityApp.GBStandard
|
||||
double tau = CalculateTau(timeArray[i], tc, alpha, r);
|
||||
|
||||
// 只使用τ在国标要求范围内的数据点
|
||||
if (tau >= Math.Sqrt(TAU_MAX_SQUARED_LOWER) && tau <= Math.Sqrt(TAU_MAX_SQUARED_UPPER))
|
||||
double tauMin = 0.2;
|
||||
double tauMax = 1.2;
|
||||
if (tau >= tauMin && tau <= tauMax)
|
||||
//if (tau >= Math.Sqrt(TAU_MAX_SQUARED_LOWER) && tau <= Math.Sqrt(TAU_MAX_SQUARED_UPPER))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -820,7 +837,11 @@ namespace ConductivityApp.GBStandard
|
||||
double tauSquared = tau * tau; // 计算τ²
|
||||
|
||||
// 修复:使用τ²的范围进行判断
|
||||
if (tauSquared >= TAU_MAX_SQUARED_LOWER && tauSquared <= TAU_MAX_SQUARED_UPPER)
|
||||
|
||||
double tauMin = 0.2;
|
||||
double tauMax = 1.2;
|
||||
if (tau >= tauMin && tau <= tauMax)
|
||||
//if (tauSquared >= TAU_MAX_SQUARED_LOWER && tauSquared <= TAU_MAX_SQUARED_UPPER)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
326
GB∕T 32064-2015 建筑用材料导热系数和热扩散系数瞬态平面热源测试法.doc
Normal file
326
GB∕T 32064-2015 建筑用材料导热系数和热扩散系数瞬态平面热源测试法.doc
Normal file
File diff suppressed because one or more lines are too long
@@ -8,7 +8,7 @@
|
||||
Title="GB/T 32064-2015 导热系数测试系统"
|
||||
Height="700" Width="1015"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Closing="Window_Closing">
|
||||
Closing="Window_Closing" Loaded="Window_Loaded">
|
||||
|
||||
<Window.Resources>
|
||||
<Style TargetType="GroupBox">
|
||||
@@ -122,13 +122,13 @@
|
||||
<ComboBoxItem Content="6.4mm" />
|
||||
</ComboBox>
|
||||
<Label Grid.Row="1" Grid.Column="0">初始电阻 R₀ (Ω):</Label>
|
||||
<TextBox IsEnabled="False" Grid.Row="1" Grid.Column="1" x:Name="txtProbeR0" Text="34.7"/>
|
||||
<TextBox IsEnabled="False" Grid.Row="1" Grid.Column="1" x:Name="txtProbeR0" Text="12.2"/>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0">温度系数 α (1/K):</Label>
|
||||
<TextBox IsEnabled="False" Grid.Row="2" Grid.Column="1" x:Name="txtProbeAlpha" Text="0.008"/>
|
||||
<TextBox IsEnabled="False" Grid.Row="2" Grid.Column="1" x:Name="txtProbeAlpha" Text="0.006"/>
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0">探头半径 (mm):</Label>
|
||||
<TextBox IsEnabled="False" Grid.Row="3" Grid.Column="1" x:Name="txtProbeRadius" Text="14"/>
|
||||
<TextBox IsEnabled="False" Grid.Row="3" Grid.Column="1" x:Name="txtProbeRadius" Text="15"/>
|
||||
|
||||
<Label Grid.Row="4" Grid.Column="0">探头环数:</Label>
|
||||
<TextBox IsEnabled="False" Grid.Row="4" Grid.Column="1" x:Name="txtProbeCoils" Text="27"/>
|
||||
@@ -150,7 +150,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0">串联电阻 Rₛ (Ω):</Label>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" x:Name="txtBridgeRs" IsReadOnly="true" IsEnabled="False" Text="34.7"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" x:Name="txtBridgeRs" IsReadOnly="true" IsEnabled="False" Text="12.2"/>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0">引线电阻 Rₗ (Ω):</Label>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" x:Name="txtBridgeRL" IsReadOnly="true" IsEnabled="False" Text="0.0267"/>
|
||||
@@ -195,7 +195,7 @@ Background="#FF5722" Foreground="White" FontWeight="Bold" Grid.Row="0" Grid.Colu
|
||||
</ComboBox>
|
||||
|
||||
<Label Visibility="Collapsed" Grid.Row="2" Grid.Column="0" x:Name="txtyangpin0">样品迭代初始值 (m²/s):</Label>
|
||||
<TextBox Visibility="Collapsed" Grid.Row="2" Grid.Column="1" x:Name="txtyangpin" Text="0"/>
|
||||
<TextBox Visibility="Collapsed" Grid.Row="2" Grid.Column="1" x:Name="txtyangpin" Text="7.7e-7"/>
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0">样品密度 (kg/m³):</Label>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" x:Name="txtSampleDensity" Text="1000"/>
|
||||
@@ -246,10 +246,17 @@ Background="#FF5722" Foreground="White" FontWeight="Bold" Grid.Row="0" Grid.Colu
|
||||
Click="btnStartTest_Click" Background="#4CAF50" Foreground="White"/>
|
||||
<Button x:Name="btnStopTest" Content="停止测试"
|
||||
Click="btnStopTest_Click" Background="#F44336" Foreground="Black" IsEnabled="False"/>
|
||||
|
||||
<Button x:Name="btnStartTest1" Content="夹紧"
|
||||
Click="btnStartTest1_Click" Background="Pink" Foreground="Black"/>
|
||||
<Button x:Name="btnStartTest2" Content="放松"
|
||||
Click="btnStartTest2_Click" Background="SaddleBrown" Foreground="White"/>
|
||||
|
||||
<Button x:Name="btnopenlight" Content="开灯"
|
||||
Click="btnopenlight_Click" Background="Pink" Foreground="Black"/>
|
||||
<Button x:Name="btncloselight" Content="关灯"
|
||||
Click="btncloselight_Click" Background="SaddleBrown" Foreground="White"/>
|
||||
|
||||
<Button x:Name="btnCalculate" Content="计算结果"
|
||||
Click="btnCalculate_Click" Background="#2196F3" Foreground="White"/>
|
||||
<Button x:Name="btnShowLog" Content="查看日志"
|
||||
@@ -279,7 +286,7 @@ Background="#FF5722" Foreground="White" FontWeight="Bold" Grid.Row="0" Grid.Colu
|
||||
<Label Grid.Row="1" Grid.Column="0">电压 (V):</Label>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" x:Name="txtCurrentVoltage" IsReadOnly="True" Background="#F5F5F5"/>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0">压力 (N):</Label>
|
||||
<Label Grid.Row="2" Grid.Column="0">温度 (℃):</Label>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" x:Name="txtCurrentPressure" IsReadOnly="True" Background="#F5F5F5"/>
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0">温度变化 (K):</Label>
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace ConductivityApp
|
||||
private List<double> Ttime2 = new List<double>();
|
||||
private List<double> Tempreture2 = new List<double>();
|
||||
private List<double> DianYa2 = new List<double>();
|
||||
private DispatcherTimer _realTimeTempTimer; // 新增:实时温度采集定时器
|
||||
// 最小有效电压变化阈值(小于此视为噪声并跳过)
|
||||
private const double MIN_DELTA_U = 1e-5; // 10 µV,按需调整
|
||||
// 测试数据
|
||||
@@ -52,17 +53,15 @@ namespace ConductivityApp
|
||||
//private const double DefaultBridgeRL = 0.05; // Ω
|
||||
|
||||
// 探头物理参数(供应商数据 - 探头2)
|
||||
private double DefaultProbeR0 = 34.7; // Ω,初始电阻
|
||||
private double DefaultProbeAlpha = 0.008; // 1/K,温度系数
|
||||
private double DefaultProbeRadiusMM = 14; // mm,探头半径
|
||||
private double DefaultProbeR0 = 12.2; // Ω,初始电阻
|
||||
private double DefaultProbeAlpha = 0.006; // 1/K,温度系数
|
||||
private double DefaultProbeRadiusMM = 17.45; // mm,探头半径
|
||||
|
||||
private int DefaultProbeCoilCount = 27; // 环数
|
||||
|
||||
// 电桥电路参数
|
||||
private double DefaultBridgeRs = 34.7; // Ω,初始探头电阻(=R0)
|
||||
private double DefaultBridgeRs = 12.2; // Ω,初始探头电阻(=R0)
|
||||
private double DefaultBridgeRL = 0.0267; // Ω,引线电阻(26.7mΩ)
|
||||
private static double r = 0;
|
||||
private static double a = 0;
|
||||
|
||||
|
||||
#endregion
|
||||
@@ -98,10 +97,57 @@ namespace ConductivityApp
|
||||
InitializeUI();
|
||||
InitializeHardware();
|
||||
InitializeCalculator();
|
||||
InitializeRealTimeTemperatureMonitoring();
|
||||
}
|
||||
|
||||
|
||||
private void InitializeRealTimeTemperatureMonitoring()
|
||||
{
|
||||
try
|
||||
{
|
||||
_realTimeTempTimer = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromMilliseconds(1000) // 1秒采集一次
|
||||
};
|
||||
_realTimeTempTimer.Tick += RealTimeTempTimer_Tick;
|
||||
_realTimeTempTimer.Start();
|
||||
|
||||
Console.WriteLine("实时温度监控已启动");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"实时温度监控初始化失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
#region 实时温度采集
|
||||
private void RealTimeTempTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 避免在测试时重复采集(测试时由DataTimer_Tick负责采集)
|
||||
if (_isTesting)
|
||||
{
|
||||
return; // 测试期间由测试定时器处理温度采集
|
||||
}
|
||||
|
||||
// 实时采集温度
|
||||
double temperature = ReadTemperatureData();
|
||||
|
||||
// 更新实时显示(但不添加到_testData)
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
txtCurrentPressure.Text = temperature.ToString("F3");
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"实时温度采集失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void InitializeUI()
|
||||
{
|
||||
@@ -161,6 +207,7 @@ namespace ConductivityApp
|
||||
// txtSampleDensity.Text = "1800"; // 应由用户输入
|
||||
}
|
||||
string COM = ConfigurationManager.AppSettings["COM"];
|
||||
|
||||
private void InitializeHardware()
|
||||
{
|
||||
try
|
||||
@@ -424,6 +471,12 @@ namespace ConductivityApp
|
||||
_testData.Clear();
|
||||
_temperatureSeries.Points.Clear();
|
||||
|
||||
|
||||
if (_plc != null && _plc.IsConnected)
|
||||
{
|
||||
_plc.Close();
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
// 2. 连接PLC
|
||||
//if (_plc != null && !_plc.IsConnected)
|
||||
//{
|
||||
@@ -434,7 +487,7 @@ namespace ConductivityApp
|
||||
Console.WriteLine("加热启动");
|
||||
|
||||
// 等待加热稳定(1秒)
|
||||
Thread.Sleep(1000);
|
||||
Thread.Sleep(500);
|
||||
//}
|
||||
|
||||
|
||||
@@ -538,7 +591,7 @@ namespace ConductivityApp
|
||||
Thread.Sleep(1000); // 等待1秒
|
||||
|
||||
// 2. 重新初始化
|
||||
string comPort = "COM2"; // 或从配置读取
|
||||
string comPort = COM; // 或从配置读取
|
||||
int baudRate = 9600;
|
||||
|
||||
_serialPort = new SerialPort(comPort, baudRate, Parity.None, 8, StopBits.One);
|
||||
@@ -692,10 +745,10 @@ namespace ConductivityApp
|
||||
{
|
||||
double timeElapsed = (DateTime.Now - _testStartTime).TotalSeconds;
|
||||
|
||||
// 读取电压和压力数据
|
||||
// 读取电压和温度数据
|
||||
double voltage = ReadForceDataAsync();
|
||||
double pressure = ReadPressureData();
|
||||
|
||||
//double pressure = ReadPressureData();//压力暂时去掉
|
||||
double pressure = ReadTemperatureData(); // 保持这一行,测试时也读取温度
|
||||
// 若尚未有初始电压(理论上应在校准阶段设置),则设定并跳过当前点
|
||||
if (_initialVoltage == 0)
|
||||
{
|
||||
@@ -780,13 +833,14 @@ namespace ConductivityApp
|
||||
}
|
||||
}
|
||||
|
||||
private double ReadPressureData()
|
||||
|
||||
private double ReadTemperatureData()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_plc != null && _plc.IsConnected)
|
||||
{
|
||||
object pressureObj = _plc.Read(DataType.DataBlock, 1, 18, VarType.Real, 1);
|
||||
object pressureObj = _plc.Read(DataType.DataBlock, 1, 120, VarType.Real, 1);
|
||||
return Convert.ToDouble(pressureObj);
|
||||
}
|
||||
|
||||
@@ -1728,6 +1782,14 @@ namespace ConductivityApp
|
||||
#region 窗口事件
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
// 停止实时温度监控
|
||||
if (_realTimeTempTimer != null)
|
||||
{
|
||||
_realTimeTempTimer.Stop();
|
||||
_realTimeTempTimer.Tick -= RealTimeTempTimer_Tick;
|
||||
}
|
||||
|
||||
|
||||
// 停止测试
|
||||
if (_isTesting)
|
||||
{
|
||||
@@ -1754,7 +1816,7 @@ namespace ConductivityApp
|
||||
{
|
||||
public double Time { get; set; } // 时间 (s)
|
||||
public double Voltage { get; set; } // 电压 (V)
|
||||
public double Pressure { get; set; } // 压力 (N)
|
||||
public double Pressure { get; set; } // 温度 (N)
|
||||
public double Temperature { get; set; } // 温度变化 ΔT (K)
|
||||
}
|
||||
#endregion
|
||||
@@ -1850,8 +1912,10 @@ namespace ConductivityApp
|
||||
//{
|
||||
_plc?.Open();
|
||||
//}
|
||||
Thread.Sleep(100);
|
||||
_plc?.Write("M1.0", true); // 夹紧
|
||||
Console.WriteLine("执行夹紧操作");
|
||||
_plc.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -1867,8 +1931,10 @@ namespace ConductivityApp
|
||||
//{
|
||||
_plc?.Open();
|
||||
//}
|
||||
Thread.Sleep(100);
|
||||
_plc?.Write("M1.0", false); // 松开
|
||||
Console.WriteLine("执行松开操作");
|
||||
_plc.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -1918,7 +1984,7 @@ namespace ConductivityApp
|
||||
}
|
||||
case "不锈钢":
|
||||
{
|
||||
txtSampleCount.Text = "120";
|
||||
txtSampleCount.Text = "50";
|
||||
txtSampleInterval.Text = "0.1";
|
||||
txtyangpin0.Visibility = Visibility.Collapsed;
|
||||
txtyangpin.Visibility = Visibility.Collapsed;
|
||||
@@ -1929,6 +1995,8 @@ namespace ConductivityApp
|
||||
|
||||
case "自定义":
|
||||
{
|
||||
txtSampleCount.Text = "100";
|
||||
txtSampleInterval.Text = "0.5";
|
||||
txtyangpin0.Visibility = Visibility.Visible;
|
||||
txtyangpin.Visibility = Visibility.Visible;
|
||||
break;
|
||||
@@ -1951,16 +2019,16 @@ namespace ConductivityApp
|
||||
{
|
||||
if (txtProbeRadius == null)
|
||||
return;
|
||||
txtProbeR0.Text = "34.7";
|
||||
txtProbeR0.Text = "12.2";
|
||||
txtProbeRadius.Text = "14";
|
||||
txtProbeCoils.Text = "27";
|
||||
txtBridgeRs.Text = "34.7";
|
||||
txtBridgeRs.Text = "12.2";
|
||||
txtBridgeRL.Text = "0.0267";
|
||||
DefaultProbeR0 = 34.7; // Ω,初始电阻
|
||||
DefaultProbeR0 = 12.2; // Ω,初始电阻
|
||||
DefaultProbeRadiusMM = 14; // mm,探头半径
|
||||
DefaultProbeCoilCount = 27; // 环数
|
||||
// 电桥电路参数
|
||||
DefaultBridgeRs = 34.7; // Ω,初始探头电阻(=R0)
|
||||
DefaultBridgeRs = 12.2; // Ω,初始探头电阻(=R0)
|
||||
DefaultBridgeRL = 0.0267; // Ω,引线电阻(26.7mΩ)
|
||||
break;
|
||||
}
|
||||
@@ -1984,7 +2052,7 @@ namespace ConductivityApp
|
||||
|
||||
|
||||
}
|
||||
DefaultProbeAlpha = 0.008; // 1/K,温度系数
|
||||
DefaultProbeAlpha = 0.006; // 1/K,温度系数
|
||||
//SetDefaultParameters();
|
||||
}
|
||||
|
||||
@@ -2219,7 +2287,7 @@ namespace ConductivityApp
|
||||
FontWeight = System.Windows.FontWeights.Bold,
|
||||
Margin = new Thickness(0, 0, 0, 10),
|
||||
Foreground = Brushes.DarkBlue
|
||||
});
|
||||
});
|
||||
|
||||
// 添加统计信息
|
||||
double avgImprovement = recommendations.Average(r => r.ExpectedImprovement);
|
||||
@@ -2704,6 +2772,51 @@ namespace ConductivityApp
|
||||
}
|
||||
}
|
||||
|
||||
private void btnopenlight_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
//if (_plc == null || !_plc.IsConnected)
|
||||
//{
|
||||
_plc?.Open();
|
||||
//}
|
||||
_plc?.Write("M1.2", true); // 夹紧
|
||||
Thread.Sleep(100);
|
||||
_plc?.Write("M1.2", false); // 夹紧
|
||||
Console.WriteLine("执行开灯操作");
|
||||
_plc.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"夹紧开灯失败:{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void btncloselight_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
//if (_plc == null || !_plc.IsConnected)
|
||||
//{
|
||||
_plc?.Open();
|
||||
//}
|
||||
_plc?.Write("M1.3", true); // 夹紧
|
||||
Thread.Sleep(100);
|
||||
_plc?.Write("M1.3", false); // 夹紧
|
||||
Console.WriteLine("执行关灯操作");
|
||||
_plc.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"夹紧关灯失败:{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_plc.Open();
|
||||
}
|
||||
}
|
||||
}
|
||||
410
新建文本文档 - 副本.txt
410
新建文本文档 - 副本.txt
@@ -1,410 +0,0 @@
|
||||
<Window x:Class="ConductivityApp.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:oxy="http://oxyplot.org/wpf"
|
||||
mc:Ignorable="d"
|
||||
Title="GB/T 32064-2015 导热系数测试系统"
|
||||
Height="700" Width="1015"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Closing="Window_Closing">
|
||||
|
||||
<Window.Resources>
|
||||
<Style TargetType="GroupBox">
|
||||
<Setter Property="Margin" Value="5"/>
|
||||
<Setter Property="Padding" Value="5"/>
|
||||
</Style>
|
||||
<Style TargetType="Label">
|
||||
<Setter Property="Margin" Value="2"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
<Style TargetType="TextBox">
|
||||
<Setter Property="Margin" Value="2"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="MinWidth" Value="80"/>
|
||||
</Style>
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Margin" Value="5,2"/>
|
||||
<Setter Property="Padding" Value="10,5"/>
|
||||
<Setter Property="MinWidth" Value="80"/>
|
||||
</Style>
|
||||
|
||||
<!-- 仅美化下拉项的基础样式 -->
|
||||
<Style x:Key="NormalComboBoxItemStyle" TargetType="ComboBoxItem">
|
||||
<Setter Property="Width" Value="120"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="Padding" Value="8,2"/>
|
||||
<!-- 仅保留基础悬停/选中反馈 -->
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="LightPink"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#0078D7"/>
|
||||
<Setter Property="Foreground" Value="Green"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- ComboBox主样式:接近原生,仅调整基础外观 -->
|
||||
<Style x:Key="NormalComboBoxStyle" TargetType="ComboBox">
|
||||
<Setter Property="Width" Value="120"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="Padding" Value="8,0"/>
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource NormalComboBoxItemStyle}"/>
|
||||
<!-- 仅调整边框和背景,不修改核心模板 -->
|
||||
<Setter Property="BorderBrush" Value="#CCCCCC"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Background" Value="White"/>
|
||||
<!-- 基础悬停反馈 -->
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="BorderBrush" Value="#0078D7"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
|
||||
</Window.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 标题栏 -->
|
||||
<Border Grid.Row="0" Background="#007ACC" Padding="10">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="GB/T 32064-2015 瞬态平面热源测试系统"
|
||||
FontSize="18" FontWeight="Bold"
|
||||
Foreground="White" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="Version 1.0" Margin="20,0,0,0"
|
||||
Foreground="White" VerticalAlignment="Center" Opacity="0.8"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 主内容区 -->
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="300"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 左侧控制面板 -->
|
||||
<ScrollViewer Grid.Column="0" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel>
|
||||
|
||||
<!-- 探头参数 -->
|
||||
<GroupBox Header="探头参数" FontWeight="Bold">
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Visibility="Collapsed">探头类型</Label>
|
||||
<ComboBox Width="130" Grid.Row="0" Visibility="Collapsed" SelectionChanged="cmbtt_SelectionChanged" Grid.Column="1" x:Name="cmbtt"
|
||||
SelectedIndex="1" Style="{StaticResource NormalComboBoxStyle}">
|
||||
<ComboBoxItem Content="请选择探头类型"/>
|
||||
<ComboBoxItem Content="17.45mm" />
|
||||
<ComboBoxItem Content="6.4mm" />
|
||||
</ComboBox>
|
||||
<Label Grid.Row="1" Grid.Column="0">初始电阻 R₀ (Ω):</Label>
|
||||
<TextBox IsEnabled="False" Grid.Row="1" Grid.Column="1" x:Name="txtProbeR0" Text="34.7"/>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0">温度系数 α (1/K):</Label>
|
||||
<TextBox IsEnabled="False" Grid.Row="2" Grid.Column="1" x:Name="txtProbeAlpha" Text="0.008"/>
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0">探头半径 (mm):</Label>
|
||||
<TextBox IsEnabled="False" Grid.Row="3" Grid.Column="1" x:Name="txtProbeRadius" Text="14"/>
|
||||
|
||||
<Label Grid.Row="4" Grid.Column="0">探头环数:</Label>
|
||||
<TextBox IsEnabled="False" Grid.Row="4" Grid.Column="1" x:Name="txtProbeCoils" Text="27"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- 电桥参数 -->
|
||||
<GroupBox Header="电桥参数" FontWeight="Bold" >
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0">串联电阻 Rₛ (Ω):</Label>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" x:Name="txtBridgeRs" IsReadOnly="true" IsEnabled="False" Text="34.7"/>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0">引线电阻 Rₗ (Ω):</Label>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" x:Name="txtBridgeRL" IsReadOnly="true" IsEnabled="False" Text="0.0267"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- 样品参数 -->
|
||||
<GroupBox Header="样品参数" FontWeight="Bold">
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Name ="name0" Grid.Row="0" Grid.Column="0">查看样品对应功率:</Label>
|
||||
<Button x:Name="name1" Content="查看"
|
||||
Click="name1_Click" Margin="5"
|
||||
Background="#FF5722" Foreground="White" FontWeight="Bold" Grid.Row="0" Grid.Column="1"/>
|
||||
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0">材料类型</Label>
|
||||
<ComboBox Width="110" Grid.Row="1" Grid.Column="1" x:Name="cmbSampleType"
|
||||
SelectedIndex="0" SelectionChanged="cmbSampleType_SelectionChanged" Style="{StaticResource NormalComboBoxStyle}">
|
||||
<ComboBoxItem Content="样本类型"/>
|
||||
<ComboBoxItem Content="干土" />
|
||||
<ComboBoxItem Content="湿土"/>
|
||||
<ComboBoxItem Content="冻土"/>
|
||||
<ComboBoxItem Content="不锈钢"/>
|
||||
<ComboBoxItem Content="自定义"/>
|
||||
|
||||
</ComboBox>
|
||||
|
||||
<Label Visibility="Collapsed" Grid.Row="2" Grid.Column="0" x:Name="txtyangpin0">样品迭代初始值 (m²/s):</Label>
|
||||
<TextBox Visibility="Collapsed" Grid.Row="2" Grid.Column="1" x:Name="txtyangpin" Text="0"/>
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0">样品密度 (kg/m³):</Label>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" x:Name="txtSampleDensity" Text="1000"/>
|
||||
|
||||
<Label Grid.Row="4" Grid.Column="0">比热容 J/(kg·K):</Label>
|
||||
<TextBox Grid.Row="4" IsReadOnly="True" IsEnabled="False" Grid.Column="1" x:Name="txtSampleSpecificHeat" Text="0"/>
|
||||
|
||||
|
||||
<Label Grid.Row="5" Grid.Column="0">电流 (mA):</Label>
|
||||
<TextBox Grid.Row="5" Grid.Column="1" x:Name="txtCurrent" Text="120" TextChanged="txtdianliu_TextChanged"/>
|
||||
|
||||
<Label Grid.Row="6" Grid.Column="0">测试功率 (W):</Label>
|
||||
<TextBox Grid.Row="6" Grid.Column="1" x:Name="txtTestPower" IsEnabled="False" IsReadOnly="True" Text="0.5184"/>
|
||||
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- 采集参数 -->
|
||||
<GroupBox Header="采集参数" FontWeight="Bold">
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0">采集点数:</Label>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" x:Name="txtSampleCount" Text="180"/>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0">采集间隔 (s):</Label>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" x:Name="txtSampleInterval" Text="0.8"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- 测试控制 -->
|
||||
<GroupBox Header="测试控制" FontWeight="Bold">
|
||||
<StackPanel>
|
||||
|
||||
|
||||
|
||||
<Button x:Name="btnStartTest" Content="开始测试"
|
||||
Click="btnStartTest_Click" Background="#4CAF50" Foreground="White"/>
|
||||
<Button x:Name="btnStopTest" Content="停止测试"
|
||||
Click="btnStopTest_Click" Background="#F44336" Foreground="Black" IsEnabled="False"/>
|
||||
<Button x:Name="btnStartTest1" Content="夹紧"
|
||||
Click="btnStartTest1_Click" Background="Pink" Foreground="Black"/>
|
||||
<Button x:Name="btnStartTest2" Content="放松"
|
||||
Click="btnStartTest2_Click" Background="SaddleBrown" Foreground="White"/>
|
||||
<Button x:Name="btnCalculate" Content="计算结果"
|
||||
Click="btnCalculate_Click" Background="#2196F3" Foreground="White"/>
|
||||
<Button x:Name="btnShowLog" Content="查看日志"
|
||||
Click="btnShowLog_Click" Margin="5"
|
||||
Background="#FF5722" Foreground="White" FontWeight="Bold"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- 实时数据显示 -->
|
||||
<GroupBox Header="实时数据" FontWeight="Bold">
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0">时间 (s):</Label>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" x:Name="txtCurrentTime" IsReadOnly="True" Background="#F5F5F5"/>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0">电压 (V):</Label>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" x:Name="txtCurrentVoltage" IsReadOnly="True" Background="#F5F5F5"/>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0">温度 (℃):</Label>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" x:Name="txtCurrentPressure" IsReadOnly="True" Background="#F5F5F5"/>
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0">温度变化 (K):</Label>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" x:Name="txtCurrentTemperature" IsReadOnly="True" Background="#F5F5F5"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
<!-- 右侧内容区 -->
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 图表显示 -->
|
||||
<GroupBox Grid.Row="0" Header="温度-时间曲线" FontWeight="Bold">
|
||||
<oxy:PlotView x:Name="plotView"/>
|
||||
</GroupBox>
|
||||
|
||||
<!-- 结果和日志 -->
|
||||
<TabControl Grid.Row="1">
|
||||
<TabItem Header="计算结果">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="10">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" FontWeight="Bold">导热系数 λ (W/(m·K)):</Label>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" x:Name="txtConductivity" IsReadOnly="True" Background="#F5F5F5"/>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0" FontWeight="Bold">热扩散系数 a (m²/s):</Label>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" x:Name="txtDiffusivity" IsReadOnly="True" Background="#F5F5F5"/>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0" FontWeight="Bold">校正时间 t_c (s):</Label>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" x:Name="txtCorrectionTime" IsReadOnly="True" Background="#F5F5F5"/>
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0" FontWeight="Bold" Visibility="Collapsed">拟合优度 R²:</Label>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" x:Name="txtRSquared" Visibility="Collapsed" IsReadOnly="True" Background="#F5F5F5"/>
|
||||
|
||||
<Label Grid.Row="4" Grid.Column="0" FontWeight="Bold">验证状态:</Label>
|
||||
<TextBox Grid.Row="4" Grid.Column="1" x:Name="txtValidation" IsReadOnly="True" Background="#F5F5F5"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="测试报告">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox Grid.Row="0" x:Name="txtReport"
|
||||
IsReadOnly="True" VerticalScrollBarVisibility="Auto"
|
||||
TextWrapping="Wrap" FontFamily="Consolas" FontSize="11"/>
|
||||
<Button Grid.Row="1" x:Name="btnExportReport"
|
||||
Content="导出报告" Click="btnExportReport_Click"
|
||||
HorizontalAlignment="Right" Margin="5"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="系统日志">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox Grid.Row="0" x:Name="txtLog"
|
||||
IsReadOnly="True" VerticalScrollBarVisibility="Auto"
|
||||
FontFamily="Consolas" FontSize="10"/>
|
||||
<Button Grid.Row="1" x:Name="btnClearLog"
|
||||
Content="清空日志" Click="btnClearLog_Click"
|
||||
HorizontalAlignment="Right" Margin="5"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
|
||||
|
||||
<TabItem Header="逆向分析">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<!--<TextBox Grid.Row="0" x:Name="txtLog2"
|
||||
IsReadOnly="True" VerticalScrollBarVisibility="Auto"
|
||||
FontFamily="Consolas" FontSize="10"/>-->
|
||||
<Button Grid.Row="1" x:Name="btnInverseAnalysis"
|
||||
Content="逆向分析" Click="OnParameterAnalysisClick"
|
||||
HorizontalAlignment="Right" Margin="5" ToolTip="从测试结果反推输入参数范围"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!-- 状态栏 -->
|
||||
<StatusBar Grid.Row="2" Background="#E0E0E0">
|
||||
<StatusBarItem>
|
||||
<TextBlock x:Name="txtStatus" Text="就绪"/>
|
||||
</StatusBarItem>
|
||||
<Separator/>
|
||||
<StatusBarItem>
|
||||
<TextBlock Text="数据点数: 0"/>
|
||||
</StatusBarItem>
|
||||
<Separator/>
|
||||
<StatusBarItem>
|
||||
<TextBlock Text="测试状态: 停止"/>
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
2727
新建文本文档.txt
2727
新建文本文档.txt
File diff suppressed because it is too large
Load Diff
Binary file not shown.
BIN
瞬态平面热源测试PLC程序 温度地址vd120.smart
Normal file
BIN
瞬态平面热源测试PLC程序 温度地址vd120.smart
Normal file
Binary file not shown.
Binary file not shown.
BIN
瞬态平面热源测试机说明书(4).docx
Normal file
BIN
瞬态平面热源测试机说明书(4).docx
Normal file
Binary file not shown.
Reference in New Issue
Block a user