This commit is contained in:
GukSang.Jin
2026-06-10 11:26:33 +08:00
parent 155f0cb536
commit da74c0a523
2 changed files with 122 additions and 29 deletions

View File

@@ -418,7 +418,21 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="实时轴向力" Style="{StaticResource MetricTitle}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="实时轴向力" Style="{StaticResource MetricTitle}" HorizontalAlignment="Left" />
<Button Grid.Column="1"
Content="归零"
Command="{Binding ZeroAxialForceCommand}"
FontSize="13"
Padding="8,3"
MinHeight="28"
Background="#64748B"
BorderBrush="#475569" />
</Grid>
<TextBlock Grid.Row="1"
x:Name="AxialForceText"
Text="{Binding AxialForceText}"
@@ -681,7 +695,21 @@
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Text="实时转速" Style="{StaticResource MetricTitle}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="实时转速" Style="{StaticResource MetricTitle}" HorizontalAlignment="Left" />
<Button Grid.Column="1"
Content="转速归零"
Command="{Binding ZeroSpeedCommand}"
FontSize="13"
Padding="8,3"
MinHeight="28"
Background="#64748B"
BorderBrush="#475569" />
</Grid>
<TextBlock Grid.Row="1"
x:Name="RealtimeSpeedText"
Text="{Binding RealtimeSpeedText}"
@@ -690,11 +718,27 @@
Foreground="#0F766E"
VerticalAlignment="Center" />
<Border Grid.Row="2" Style="{StaticResource InfoStrip}">
<TextBlock x:Name="RealtimePressureText"
Text="{Binding RealtimePressureText}"
FontSize="16"
HorizontalAlignment="Center"
Foreground="#52616F" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock x:Name="RealtimePressureText"
Text="{Binding RealtimePressureText}"
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#52616F" />
<Button Grid.Column="1"
Content="压力归零"
Command="{Binding ZeroPressureCommand}"
FontSize="13"
Padding="8,3"
MinHeight="28"
Background="#64748B"
BorderBrush="#475569"
Margin="8,0,0,0" />
</Grid>
</Border>
</Grid>
</Border>
@@ -707,7 +751,21 @@
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Text="实时扭矩" Style="{StaticResource MetricTitle}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="实时扭矩" Style="{StaticResource MetricTitle}" HorizontalAlignment="Left" />
<Button Grid.Column="1"
Content="归零"
Command="{Binding ZeroTorqueCommand}"
FontSize="13"
Padding="8,3"
MinHeight="28"
Background="#64748B"
BorderBrush="#475569" />
</Grid>
<TextBlock Grid.Row="1"
x:Name="RealtimeTorqueText"
Text="{Binding RealtimeTorqueText}"

View File

@@ -287,6 +287,10 @@ public sealed class MainWindowViewModel : ObservableObject
StopSpeedTorqueCommand = new AsyncRelayCommand(StopSpeedTorqueAsync);
ResetSpeedTorqueCommand = new AsyncRelayCommand(ResetSpeedTorqueAsync);
ToggleVentValveCommand = new AsyncRelayCommand(ToggleVentValveAsync);
ZeroAxialForceCommand = new AsyncRelayCommand(ZeroAxialForceAsync);
ZeroTorqueCommand = new AsyncRelayCommand(ZeroTorqueAsync);
ZeroSpeedCommand = new AsyncRelayCommand(ZeroSpeedAsync);
ZeroPressureCommand = new AsyncRelayCommand(ZeroPressureAsync);
SaveNoLoadSpeedSettingCommand = new AsyncRelayCommand(SaveNoLoadSpeedSettingAsync);
RecordNoLoadSpeedCommand = new AsyncRelayCommand(RecordNoLoadSpeedAsync);
@@ -348,6 +352,14 @@ public sealed class MainWindowViewModel : ObservableObject
public IAsyncRelayCommand ToggleVentValveCommand { get; }
public IAsyncRelayCommand ZeroAxialForceCommand { get; }
public IAsyncRelayCommand ZeroTorqueCommand { get; }
public IAsyncRelayCommand ZeroSpeedCommand { get; }
public IAsyncRelayCommand ZeroPressureCommand { get; }
public IAsyncRelayCommand SaveNoLoadSpeedSettingCommand { get; }
public IAsyncRelayCommand RecordNoLoadSpeedCommand { get; }
@@ -2419,18 +2431,8 @@ public sealed class MainWindowViewModel : ObservableObject
return;
}
SpeedTorqueTestButtonText = "归零中";
StatusText = "转速/扭矩测试启动前归零中。";
if (!await ExecuteZeroingSequenceAsync(
"转速/扭矩测试",
(TorqueZeroCoil, "扭矩归零 M1101"),
(SpeedZeroCoil, "转速归零 M1300"),
(PressureZeroCoil, "压力归零 M1301"),
(SecondaryTorqueZeroCoil, "扭矩归零 M1302")))
{
SpeedTorqueTestButtonText = "测试";
return;
}
SpeedTorqueTestButtonText = "启动中";
StatusText = "转速/扭矩测试启动中...";
if (!await WriteAndVerifyVentValveStateAsync(true, "转速/扭矩测试启动前"))
{
@@ -2714,15 +2716,8 @@ public sealed class MainWindowViewModel : ObservableObject
return;
}
DisplacementTestButtonText = "归零中";
StatusText = "轴向测试启动前归零中。";
if (!await ExecuteZeroingSequenceAsync(
"轴向测试",
(AxialForceZeroCoil, "轴向力归零 M1100")))
{
DisplacementTestButtonText = "测试";
return;
}
DisplacementTestButtonText = "启动中";
StatusText = "轴向测试启动中...";
if (!await PulsePlcAsync(AxialStartCoil, "轴向测试"))
{
@@ -2890,6 +2885,46 @@ public sealed class MainWindowViewModel : ObservableObject
return true;
}
private async Task ZeroAxialForceAsync()
{
if (!await PulsePlcAsync(AxialForceZeroCoil, "轴向力归零 M1100"))
{
return;
}
StatusText = "轴向力归零完成。";
}
private async Task ZeroTorqueAsync()
{
if (!await PulsePlcAsync(TorqueZeroCoil, "扭矩归零 M1101"))
{
return;
}
StatusText = "扭矩归零完成。";
}
private async Task ZeroSpeedAsync()
{
if (!await PulsePlcAsync(SpeedZeroCoil, "转速归零 M1300"))
{
return;
}
StatusText = "转速归零完成。";
}
private async Task ZeroPressureAsync()
{
if (!await PulsePlcAsync(PressureZeroCoil, "压力归零 M1301"))
{
return;
}
StatusText = "压力归零完成。";
}
private async Task<bool> BeginAxialManualMotionAsync(ushort coilAddress, string actionName)
{
if (!await WriteManualMotionCoilAsync(coilAddress, true, $"{actionName}按下"))