diff --git a/建材不燃性试验炉/CofficientSetting.xaml.cs b/建材不燃性试验炉/CofficientSetting.xaml.cs
index f52e8f1..2264d26 100644
--- a/建材不燃性试验炉/CofficientSetting.xaml.cs
+++ b/建材不燃性试验炉/CofficientSetting.xaml.cs
@@ -85,6 +85,7 @@ namespace 建材不燃性试验炉
// 初始化工具类
c = new DataChange();
+ ma=new Function(_modbusMaster);
// 启动状态定时器
_statusTimer.Start();
diff --git a/建材不燃性试验炉/MainWindow.xaml b/建材不燃性试验炉/MainWindow.xaml
index b80127e..c14d8d7 100644
--- a/建材不燃性试验炉/MainWindow.xaml
+++ b/建材不燃性试验炉/MainWindow.xaml
@@ -357,12 +357,6 @@
Padding="5,2"/>
-
-
-
-
-
-
@@ -433,7 +427,7 @@
Padding="5,3"
Margin="0,0,0,5"/>
-
@@ -789,17 +783,13 @@
FontWeight="Bold"
Foreground="#2C3E50"/>
-
+
+ Padding="8,4" Margin="0,5,0,5">
@@ -807,19 +797,19 @@
+ Padding="8,4" Margin="10,5,0,5">
+ FontWeight="SemiBold" />
+ Padding="8,4" Margin="10,5,0,5">
@@ -857,7 +847,7 @@
@@ -885,106 +875,102 @@
-
-
+
+ FontSize="13"
+ Foreground="#666666"
+ FontWeight="SemiBold"/>
+ Text="未开始"
+ FontSize="16"
+ FontWeight="Bold"
+ Foreground="#2C3E50"
+ Margin="0,0,15,0"/>
+ FontSize="14"
+ Foreground="#666666"
+ Margin="0,0,5,0"/>
+ Text="00:00"
+ FontSize="14"
+ FontWeight="SemiBold"
+ Foreground="#E74C3C"/>
+ FontSize="12"
+ Foreground="#666666"/>
+ Text="0.0°C"
+ FontSize="12"
+ FontWeight="SemiBold"
+ Foreground="#2C3E50"
+ Margin="0,0,10,0"/>
+ FontSize="12"
+ Foreground="#666666"/>
+ Text="0.0°C"
+ FontSize="12"
+ FontWeight="SemiBold"
+ Foreground="#E74C3C"
+ Margin="0,0,10,0"/>
+ FontSize="12"
+ Foreground="#666666"/>
+ Text="0.0°C"
+ FontSize="12"
+ FontWeight="SemiBold"
+ Foreground="#2C3E50"/>
+ FontSize="12"
+ Foreground="#666666"/>
+ Text="0"
+ FontSize="12"
+ FontWeight="SemiBold"
+ Foreground="#2C3E50"
+ Margin="0,0,10,0"/>
+ FontSize="12"
+ Foreground="#666666"/>
+ Text="0.0°C"
+ FontSize="12"
+ FontWeight="SemiBold"
+ Foreground="#2C3E50"/>
+ x:Name="finalBalanceStatusBorder"
+ Background="#BDC3C7"
+ CornerRadius="4"
+ Padding="8,4"
+ Margin="10,0,0,0"
+ VerticalAlignment="Center">
+ Text="等待开始"
+ Foreground="White"
+ FontSize="12"
+ FontWeight="SemiBold"/>
@@ -1004,31 +990,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1064,45 +1027,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/建材不燃性试验炉/MainWindow.xaml.cs b/建材不燃性试验炉/MainWindow.xaml.cs
index c4caba9..f8252f2 100644
--- a/建材不燃性试验炉/MainWindow.xaml.cs
+++ b/建材不燃性试验炉/MainWindow.xaml.cs
@@ -122,7 +122,7 @@ namespace 建材不燃性试验炉
private void InitializeBalanceDisplays()
{
txtBalanceTimeElapsed.Text = "0秒";
- txtBalanceCondition.Text = "平衡条件: 炉内温度波动:±5℃10分钟 且 最大温差≤10°C 且 温度漂移≤±2°C";
+ txtBalanceCondition.Text = "平衡条件: 炉内温度波动:±5℃10分钟 且 最大温差<10°C 且 温度漂移<2°C";
txtBalanceStatus.Text = "温度平衡状态: 未开始判断";
balanceStatusBorder.Background = new SolidColorBrush(Colors.Gray);
txtBalanceResult.Text = "未判断";
@@ -199,13 +199,7 @@ namespace 建材不燃性试验炉
if (_isTestRunning)
{
_testElapsedTime = _testElapsedTime.Add(TimeSpan.FromSeconds(1));
- txtTestTime.Text = _testElapsedTime.ToString(@"hh\:mm\:ss");
- // 更新进度
- UpdateTestProgress();
-
- // 检查计时节点
- CheckTimeReminders();
}
}
@@ -313,9 +307,6 @@ namespace 建材不燃性试验炉
// 启动试验计时器
_testTimer.Start();
- // 重置进度条
- progressBar.Width = 0;
- txtProgress.Text = "0%";
UpdateStatusBar("试验开始");
ResetFinalBalanceUI();
@@ -388,86 +379,7 @@ namespace 建材不燃性试验炉
{
ma?.BtnClickFunctionForNew(Function.ButtonType.切换型, 70);
}
-
-
- private void UpdateTestProgress()
- {
- // 假设试验总时长为60分钟
- TimeSpan totalDuration = TimeSpan.FromMinutes(60);
- double progress = (_testElapsedTime.TotalSeconds / totalDuration.TotalSeconds) * 100;
-
- if (progress > 100) progress = 100;
-
- Dispatcher.Invoke(() =>
- {
- // 更新进度条
- double maxWidth = 400; // 进度条容器宽度
- progressBar.Width = maxWidth * (progress / 100);
- txtProgress.Text = $"{progress:F1}%";
- });
- }
-
- private void CheckTimeReminders()
- {
- if (!_isTestRunning) return;
-
- TimeSpan reminderTime = TimeSpan.Zero;
- string reminderText = "";
-
- if (_testElapsedTime.TotalMinutes >= 10 && chkTime10min.IsChecked == true)
- {
- reminderTime = TimeSpan.FromMinutes(10);
- reminderText = "10分钟节点";
- }
- else if (_testElapsedTime.TotalMinutes >= 30 && chkTime30min.IsChecked == true)
- {
- reminderTime = TimeSpan.FromMinutes(30);
- reminderText = "30分钟节点";
- }
- else if (_testElapsedTime.TotalMinutes >= 60 && chkTime60min.IsChecked == true)
- {
- reminderTime = TimeSpan.FromMinutes(60);
- reminderText = "60分钟节点";
- }
-
- if (reminderTime != TimeSpan.Zero)
- {
- txtTimeReminder.Text = $"已完成: {reminderText}";
-
- // 显示消息
- if (_testElapsedTime.TotalMinutes >= reminderTime.TotalMinutes &&
- _testElapsedTime.TotalMinutes < reminderTime.TotalMinutes + 1)
- {
- UpdateStatusBar($"达到{reminderText}");
- }
- }
-
- // 更新下一个节点
- UpdateNextReminder();
- }
-
- private void UpdateNextReminder()
- {
- if (!_isTestRunning) return;
-
- if (_testElapsedTime.TotalMinutes < 10 && chkTime10min.IsChecked == true)
- {
- txtTimeReminder.Text = $"下一个节点: 10分钟 (剩余:{10 - _testElapsedTime.TotalMinutes:F1}分钟)";
- }
- else if (_testElapsedTime.TotalMinutes < 30 && chkTime30min.IsChecked == true)
- {
- txtTimeReminder.Text = $"下一个节点: 30分钟 (剩余:{30 - _testElapsedTime.TotalMinutes:F1}分钟)";
- }
- else if (_testElapsedTime.TotalMinutes < 60 && chkTime60min.IsChecked == true)
- {
- txtTimeReminder.Text = $"下一个节点: 60分钟 (剩余:{60 - _testElapsedTime.TotalMinutes:F1}分钟)";
- }
- else
- {
- txtTimeReminder.Text = "所有计时节点已完成";
- }
- }
-
+
#endregion
@@ -753,8 +665,16 @@ namespace 建材不燃性试验炉
return;
}
+
+
// 读取三个温度值
- float furnaceTemp = 0, sampleInternalTemp = 0, sampleSurfaceTemp = 0;
+ float TempSet = 0, furnaceTemp = 0, sampleInternalTemp = 0, sampleSurfaceTemp = 0;
+ //炉内温度设定
+ ReadAndUpdateRegister(350, 2, value =>
+ {
+ TempSet = value;
+ Dispatcher.Invoke(() => txtTestTemp.Text = $"{value:F0}°C");
+ });
// 炉内温度相关 (D1226, D1230)
ReadAndUpdateRegister(1230, 2, value =>
@@ -873,7 +793,13 @@ namespace 建材不燃性试验炉
}
// 获取目标温度
- if (!double.TryParse(txtTestTemp.Text, out double targetTemp))
+ //if (!double.TryParse(txtTestTemp.Text, out double targetTemp))
+ //{
+ // targetTemp = 0;
+ //}
+
+ // 获取目标温度
+ if (!double.TryParse(txtTestTemp.Text.Replace("°C", ""), out double targetTemp))
{
targetTemp = 0;
}
@@ -883,7 +809,7 @@ namespace 建材不燃性试验炉
txtFurnaceTempStatus);
// 检查样品内部温度波动
- CheckSingleTemperature("样品内部", sampleInternalTemp, targetTemp, allowedFluctuation,
+ CheckSingleTemperature("样品中心", sampleInternalTemp, targetTemp, allowedFluctuation,
txtSampleInternalTempStatus);
// 检查样品表面温度波动
@@ -908,26 +834,26 @@ namespace 建材不燃性试验炉
string statusText;
string backgroundColor;
- if (Math.Abs(targetTemp) < 0.001) // 目标温度为0,表示未设置
- {
- statusText = $"{tempName}温度: {currentTemp:F1}°C";
- backgroundColor = "#95A5A6"; // 灰色 - 未设置目标
- }
- else if (actualFluctuation <= allowedFluctuation)
- {
- statusText = $"{tempName}温度波动正常 (±{actualFluctuation:F1}°C)";
+ //if (Math.Abs(targetTemp) < 0.001) // 目标温度为0,表示未设置
+ //{
+ // statusText = $"{tempName}温度: {currentTemp:F1}°C";
+ // backgroundColor = "#95A5A6"; // 灰色 - 未设置目标
+ //}
+ //else if (actualFluctuation <= allowedFluctuation)
+ //{
+ statusText = $"{tempName}温度波动 (±{actualFluctuation:F1}°C)";
backgroundColor = "#27AE60"; // 绿色 - 正常
- }
- else if (actualFluctuation <= allowedFluctuation * 2) // 在2倍范围内
- {
- statusText = $"{tempName}温度波动警告 (±{actualFluctuation:F1}°C)";
- backgroundColor = "#F39C12"; // 橙色 - 警告
- }
- else
- {
- statusText = $"{tempName}温度波动异常 (±{actualFluctuation:F1}°C)";
- backgroundColor = "#E74C3C"; // 红色 - 异常
- }
+ //}
+ //else if (actualFluctuation <= allowedFluctuation * 2) // 在2倍范围内
+ //{
+ // statusText = $"{tempName}温度波动警告 (±{actualFluctuation:F1}°C)";
+ // backgroundColor = "#F39C12"; // 橙色 - 警告
+ //}
+ //else
+ //{
+ // statusText = $"{tempName}温度波动异常 (±{actualFluctuation:F1}°C)";
+ // backgroundColor = "#E74C3C"; // 红色 - 异常
+ //}
// 更新UI
Dispatcher.Invoke(() =>
@@ -1211,9 +1137,6 @@ namespace 建材不燃性试验炉
txtCombustionNote.Text = "";
// 重置复选框
- chkTime10min.IsChecked = false;
- chkTime30min.IsChecked = false;
- chkTime60min.IsChecked = false;
chkHasFlame.IsChecked = false;
chkHasSmoke.IsChecked = false;
@@ -1233,11 +1156,6 @@ namespace 建材不燃性试验炉
// 重置试验时间
_testElapsedTime = TimeSpan.Zero;
- txtTestTime.Text = "00:00:00";
-
- // 重置进度条
- progressBar.Width = 0;
- txtProgress.Text = "0%";
}
private void btnSaveData_Click(object sender, RoutedEventArgs e)
@@ -1306,7 +1224,7 @@ namespace 建材不燃性试验炉
// 试验过程
data.AppendLine("四、试验过程");
- data.AppendLine($" 试验时间: {txtTestTime.Text}");
+ //data.AppendLine($" 试验时间: {txtTestTime.Text}");
data.AppendLine($" 火焰: {(chkHasFlame.IsChecked == true ? "有" : "无")}");
data.AppendLine($" 冒烟: {(chkHasSmoke.IsChecked == true ? "有" : "无")}");
data.AppendLine($" 备注: {txtCombustionNote.Text}");
@@ -1348,7 +1266,7 @@ namespace 建材不燃性试验炉
csv.AppendLine($"重量损失百分比,{txtWeightLossDisplay.Text.Replace("损失:", "")},%,");
csv.AppendLine($"试验温度,{txtTestTemp.Text},°C,");
csv.AppendLine($"温度波动允许值,{txtTempFluctuation.Text},°C,");
- csv.AppendLine($"试验时间,{txtTestTime.Text},,");
+ //csv.AppendLine($"试验时间,{txtTestTime.Text},,");
csv.AppendLine($"是否有火焰,{(chkHasFlame.IsChecked == true ? "是" : "否")},,");
csv.AppendLine($"是否有冒烟,{(chkHasSmoke.IsChecked == true ? "是" : "否")},,");
csv.AppendLine($"燃烧状态备注,{txtCombustionNote.Text},,");
@@ -1568,7 +1486,7 @@ namespace 建材不燃性试验炉
private void ResetBalanceUI()
{
txtBalanceTimeElapsed.Text = "0秒";
- txtBalanceCondition.Text = "平衡条件: 炉温(750±5)℃ 10分钟, 最大温差≤10℃, 漂移≤2℃";
+ txtBalanceCondition.Text = "平衡条件: 炉温(750±5)℃ 10分钟, 最大温差<10℃, 漂移<2℃";
txtBalanceStatus.Text = "温度平衡状态: 判断中...";
balanceStatusBorder.Background = new SolidColorBrush(Colors.Gray);
txtBalanceResult.Text = "判断中";
@@ -1824,7 +1742,7 @@ namespace 建材不燃性试验炉
if (!_balanceStatistics.Condition2)
failureReasons += " 最大温差>10℃";
if (!_balanceStatistics.Condition3)
- failureReasons += " 10分钟漂移>2℃";
+ failureReasons += " 10分钟漂移<2℃";
txtBalanceStatus.Text = $"温度平衡状态: 未达到标准\n{failureReasons}";
}
@@ -2126,9 +2044,6 @@ namespace 建材不燃性试验炉
// 更新状态显示
Dispatcher.Invoke(() =>
{
- txtTestTime.Text = testDuration.ToString(@"hh\:mm\:ss");
- progressBar.Width = 400; // 进度条满
- txtProgress.Text = "100%";
// 显示平衡结果
string result = isForced ? "60分钟强制结束" : "达到温度平衡";
@@ -2271,7 +2186,7 @@ namespace 建材不燃性试验炉
LossPercent = weightLossPercent,
FlameDuration = flameDuration,
TestDate = DateTime.Now.ToString("yyyy-MM-dd"),
- TestDuration = txtTestTime.Text,
+ TestDuration = txtFinalBalanceTimer.Text,
BalanceStatus = "达到平衡",
Remarks = $"火焰:{(chkHasFlame.IsChecked == true ? "有" : "无")} 冒烟:{(chkHasSmoke.IsChecked == true ? "有" : "无")}"
};