Files
L007/新建文本文档 - 副本.txt
2026-01-30 11:37:04 +08:00

410 lines
22 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<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>