更新1222
This commit is contained in:
@@ -233,8 +233,6 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
private bool _lastRealtimeReadFailed;
|
private bool _lastRealtimeReadFailed;
|
||||||
private bool _hasReportedRunStateCommunicationLoss;
|
private bool _hasReportedRunStateCommunicationLoss;
|
||||||
private DateTime _lastSuccessfulRealtimeReadAt = DateTime.MinValue;
|
private DateTime _lastSuccessfulRealtimeReadAt = DateTime.MinValue;
|
||||||
private bool _isAutoStoppingDisplacement;
|
|
||||||
private bool _isAutoStoppingSpeedTorque;
|
|
||||||
private bool _isConfirmingDisplacementStop;
|
private bool _isConfirmingDisplacementStop;
|
||||||
private bool _isConfirmingSpeedTorqueStop;
|
private bool _isConfirmingSpeedTorqueStop;
|
||||||
private bool _isApplyingParameterConfigToInputs;
|
private bool _isApplyingParameterConfigToInputs;
|
||||||
@@ -866,9 +864,6 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
ReadCoilValue(coilValues, SpeedTorqueEnabledCoil),
|
ReadCoilValue(coilValues, SpeedTorqueEnabledCoil),
|
||||||
ReadCoilValue(coilValues, SpeedTorqueDoneCoil));
|
ReadCoilValue(coilValues, SpeedTorqueDoneCoil));
|
||||||
|
|
||||||
await AutoStopIfSetpointReachedAsync();
|
|
||||||
await AutoStopIfSpeedTorqueProtectionReachedAsync();
|
|
||||||
|
|
||||||
if (_lastRealtimeReadFailed)
|
if (_lastRealtimeReadFailed)
|
||||||
{
|
{
|
||||||
if (HasActiveControlRun())
|
if (HasActiveControlRun())
|
||||||
@@ -2184,8 +2179,6 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
UpdateParameterSummaries();
|
UpdateParameterSummaries();
|
||||||
UpdateDisplacementDisplay();
|
UpdateDisplacementDisplay();
|
||||||
UpdateSpeedTorqueDisplay();
|
UpdateSpeedTorqueDisplay();
|
||||||
await AutoStopIfSetpointReachedAsync();
|
|
||||||
await AutoStopIfSpeedTorqueProtectionReachedAsync();
|
|
||||||
_hasLoadedParameterConfigFromPlc = true;
|
_hasLoadedParameterConfigFromPlc = true;
|
||||||
_parameterRetryTimer.Stop();
|
_parameterRetryTimer.Stop();
|
||||||
|
|
||||||
@@ -2409,7 +2402,6 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
AxialForceModeCoil,
|
AxialForceModeCoil,
|
||||||
usePullForceSetpoint ? 1 : 0,
|
usePullForceSetpoint ? 1 : 0,
|
||||||
GetActiveAxialForceSetpointName());
|
GetActiveAxialForceSetpointName());
|
||||||
await AutoStopIfSetpointReachedAsync();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -2552,10 +2544,6 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
SetTestPageInputStatus($"{fieldName}已自动写入并回读确认:{FormatConfigNumber(confirmedValue)}");
|
SetTestPageInputStatus($"{fieldName}已自动写入并回读确认:{FormatConfigNumber(confirmedValue)}");
|
||||||
Log.Information("{FieldName}自动写入并回读成功,D{RegisterAddress}={Value}", fieldName, registerAddress, confirmedValue);
|
Log.Information("{FieldName}自动写入并回读成功,D{RegisterAddress}={Value}", fieldName, registerAddress, confirmedValue);
|
||||||
|
|
||||||
if (parameter is TestPageInputParameter.AxialPullForceSetpoint or TestPageInputParameter.AxialJumpForceSetpoint)
|
|
||||||
{
|
|
||||||
await AutoStopIfSetpointReachedAsync();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApplyConfirmedTestPageInputToEditor(TestPageInputParameter parameter, double requestedValue, double confirmedValue)
|
private void ApplyConfirmedTestPageInputToEditor(TestPageInputParameter parameter, double requestedValue, double confirmedValue)
|
||||||
@@ -2749,7 +2737,6 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
_realtimeSpeed,
|
_realtimeSpeed,
|
||||||
GetScaledTorque(),
|
GetScaledTorque(),
|
||||||
_speedTorqueDisplacement);
|
_speedTorqueDisplacement);
|
||||||
await AutoStopIfSpeedTorqueProtectionReachedAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> WaitForSpeedTorqueStartAsync()
|
private async Task<bool> WaitForSpeedTorqueStartAsync()
|
||||||
@@ -3015,7 +3002,6 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
_maxDisplacement = Math.Abs(_relativeDisplacement);
|
_maxDisplacement = Math.Abs(_relativeDisplacement);
|
||||||
UpdateDisplacementDisplay();
|
UpdateDisplacementDisplay();
|
||||||
Log.Information("轴向测试已启动,起始位移 {Displacement},起始轴向力 {AxialForce}", _relativeDisplacement, GetScaledAxialForce());
|
Log.Information("轴向测试已启动,起始位移 {Displacement},起始轴向力 {AxialForce}", _relativeDisplacement, GetScaledAxialForce());
|
||||||
await AutoStopIfSetpointReachedAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task StopDisplacementAsync()
|
private async Task StopDisplacementAsync()
|
||||||
@@ -3365,7 +3351,6 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
UpdateSpeedTorqueDisplay();
|
UpdateSpeedTorqueDisplay();
|
||||||
await AutoStopIfSpeedTorqueProtectionReachedAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task MoveAxialDisplacementAsync()
|
private async Task MoveAxialDisplacementAsync()
|
||||||
@@ -3384,7 +3369,6 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
UpdateDisplacementDisplay();
|
UpdateDisplacementDisplay();
|
||||||
await AutoStopIfSetpointReachedAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateAxialForceFromInputAsync()
|
private async Task UpdateAxialForceFromInputAsync()
|
||||||
@@ -3396,50 +3380,6 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
|
|
||||||
_axialForce = force;
|
_axialForce = force;
|
||||||
UpdateDisplacementDisplay();
|
UpdateDisplacementDisplay();
|
||||||
await AutoStopIfSetpointReachedAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task AutoStopIfSetpointReachedAsync()
|
|
||||||
{
|
|
||||||
if (!_isDisplacementRunning || _isAutoStoppingDisplacement)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_parameterConfig.AxialDisplacementLimit > 0
|
|
||||||
&& Math.Abs(_relativeDisplacement) >= _parameterConfig.AxialDisplacementLimit)
|
|
||||||
{
|
|
||||||
await AutoStopDisplacementAsync("状态:位移极限保护,已停止");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
double activeAxialForceSetpoint = GetActiveAxialForceSetpoint();
|
|
||||||
if (activeAxialForceSetpoint > 0
|
|
||||||
&& GetScaledAxialForce() >= activeAxialForceSetpoint)
|
|
||||||
{
|
|
||||||
await AutoStopDisplacementAsync($"状态:达到{GetActiveAxialForceSetpointName()},已停止");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_parameterConfig.AxialForceProtection > 0
|
|
||||||
&& GetScaledAxialForce() >= _parameterConfig.AxialForceProtection)
|
|
||||||
{
|
|
||||||
await AutoStopDisplacementAsync("状态:轴向力保护,已停止");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task AutoStopDisplacementAsync(string status)
|
|
||||||
{
|
|
||||||
_isAutoStoppingDisplacement = true;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Log.Warning("轴向测试触发自动停止:{Status},位移 {Displacement},轴向力 {AxialForce}", status, _relativeDisplacement, GetScaledAxialForce());
|
|
||||||
await StopDisplacementControlAsync(status, "轴向保护停止");
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
_isAutoStoppingDisplacement = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> StopDisplacementControlAsync(string status, string actionName)
|
private async Task<bool> StopDisplacementControlAsync(string status, string actionName)
|
||||||
@@ -3535,42 +3475,6 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
|
|
||||||
_realtimeTorque = torque;
|
_realtimeTorque = torque;
|
||||||
UpdateSpeedTorqueDisplay();
|
UpdateSpeedTorqueDisplay();
|
||||||
await AutoStopIfSpeedTorqueProtectionReachedAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task AutoStopIfSpeedTorqueProtectionReachedAsync()
|
|
||||||
{
|
|
||||||
if (!_isSpeedTorqueRunning || _isAutoStoppingSpeedTorque)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_parameterConfig.SpeedTorqueDisplacementLimit > 0
|
|
||||||
&& Math.Abs(_speedTorqueDisplacement) >= _parameterConfig.SpeedTorqueDisplacementLimit)
|
|
||||||
{
|
|
||||||
await AutoStopSpeedTorqueAsync("状态:位移极限保护,已停止");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_parameterConfig.TorqueProtection > 0
|
|
||||||
&& GetScaledTorque() >= _parameterConfig.TorqueProtection)
|
|
||||||
{
|
|
||||||
await AutoStopSpeedTorqueAsync("状态:扭矩保护,已停止");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task AutoStopSpeedTorqueAsync(string status)
|
|
||||||
{
|
|
||||||
_isAutoStoppingSpeedTorque = true;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Log.Warning("转速/扭矩测试触发自动停止:{Status},位移 {Displacement},转速 {Speed},扭矩 {Torque}", status, _speedTorqueDisplacement, _realtimeSpeed, GetScaledTorque());
|
|
||||||
await StopSpeedTorqueControlAsync(status, "转速/扭矩保护停止");
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
_isAutoStoppingSpeedTorque = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> StopSpeedTorqueControlAsync(string status, string actionName)
|
private async Task<bool> StopSpeedTorqueControlAsync(string status, string actionName)
|
||||||
|
|||||||
Reference in New Issue
Block a user