This commit is contained in:
2026-05-18 11:28:52 +08:00
parent bcf689c0fb
commit d924fbce45
5 changed files with 16 additions and 16 deletions

View File

@@ -9,17 +9,16 @@
// 硬度
public ushort HardnessMax { get; set; }
public ushort HardnessStartCoil { get; set; }
public ushort HardnessCompleteCoil { get; set; }
public ushort HardnessStartReset { get; set; }
public ushort HardnessStartStop { get; set; }
public ushort HardnessSudu { get; set; }
public ushort HardnessWeiyi { get; set; }
public ushort HardnessPoSun { get; set; }
public ushort HardnessForward { get; set; }
public ushort HardnessBack { get; set; }
public ushort HardnessShishilizhi { get; set; }
// 脆碎度
public ushort FriabilityStartCoil { get; set; }
public ushort WeightBefore { get; set; } // 天平重量寄存器(可选)

View File

@@ -15,7 +15,7 @@ namespace TabletTester2025.Models
public double HardnessMax { get; set; }
public double HardnessMin { get; set; }
public int HardnessTestCount { get; set; }
//public double HardnessMax { get; set; }
public double HardnessShishilizhi { get; set; }
// 脆碎度
public double FriabilityLoss { get; set; }

View File

@@ -70,6 +70,7 @@ namespace TabletTester2025.ViewModels
[ObservableProperty] private double _hardnessWeiyi = 100; // 硬度位移输入mm
//[ObservableProperty] private double _hardnessPoSun = 400; // 硬度破损判定输入N
[ObservableProperty] private double _hardnessMaxN = 72; //最大力采集
//[ObservableProperty] private double HardnessShishilizhi = 72; //最大力采集
@@ -100,6 +101,7 @@ namespace TabletTester2025.ViewModels
[ObservableProperty] private int _hardnessCurrentCount;
[ObservableProperty] private double _hardnessMax;
[ObservableProperty] private double _hardnessMin;
[ObservableProperty] private bool _disintegrationPass; // 新增
@@ -828,18 +830,9 @@ namespace TabletTester2025.ViewModels
await _plc.WriteFloatAsync(_plcConfig.HardnessWeiyi, (float)currentWeiyi);
await _plc.WriteCoilAsync(_plcConfig.HardnessStartCoil, true);
await _plc.WriteCoilAsync(_plcConfig.HardnessStartCoil, true);//启动
bool completed = false;
while (!completed && Phase == TestPhase.Running)
{
await Task.Delay(200);
completed = await _plc.ReadCoilAsync(_plcConfig.HardnessCompleteCoil);
}
HardnessMax = await _plc.ReadFloatAsync(_plcConfig.HardnessMax);
Phase = TestPhase.Completed;
}
catch (Exception ex)
{

View File

@@ -295,6 +295,13 @@
<TextBlock Text="最大力值(N)" Style="{StaticResource MetricLabel}"/>
<TextBlock Text="{Binding HardnessMax, StringFormat=F1}" Foreground="#1565C0" Style="{StaticResource MetricValue}"/>
</StackPanel>
</Border>
<Border Style="{StaticResource MetricCard}">
<StackPanel>
<TextBlock Text="实时力值(N)" Style="{StaticResource MetricLabel}"/>
<TextBlock Text="{Binding HardnessShishilizhi, StringFormat=F1}" Foreground="#1565C0" Style="{StaticResource MetricValue}"/>
</StackPanel>
</Border>
</UniformGrid>
</GroupBox>

View File

@@ -22,6 +22,7 @@
"HardnessWeiyi": 310, // 硬度位移输入mm/min
"HardnessPoSun": 400, // 硬度破损判定输入N
"HardnessMax": 72, //最大力采集
"HardnessShishilizhi": 1314, //力显示
@@ -32,7 +33,7 @@
"FriabilityStartCoil3": 80, //脆碎工位1启动测试M70
"FriabilityStartCoilStop": 83, // 脆碎停止
"FriabilityStartCoilReset": 95, // 脆碎复位启动
"HardnessCompleteCoil": 11,
"WeightBefore": 200,
"WeightAfter": 202,