This commit is contained in:
GukSang.Jin
2026-06-10 15:20:43 +08:00
parent 19d7a9d1ec
commit b7cf3ab0aa

View File

@@ -139,6 +139,7 @@ public sealed class MainWindowViewModel : ObservableObject
SpeedTorqueManualDisplacementRegister,
TorqueCoefficientRegister,
TorqueProtectionRegister,
HoldTorqueRegister,
SpeedCoefficientRegister,
SpeedStopThresholdRegister,
PressureCoefficientRegister,
@@ -482,7 +483,7 @@ public sealed class MainWindowViewModel : ObservableObject
return;
}
QueueTenthsTestPageInputWrite(TestPageInputParameter.HoldTorque, HoldTorqueRegister, "保持扭矩设置", value);
QueueFloatTestPageInputWrite(TestPageInputParameter.HoldTorque, HoldTorqueRegister, "保持扭矩设置", value);
}
}
@@ -878,7 +879,7 @@ public sealed class MainWindowViewModel : ObservableObject
double speedTorqueManualDisplacement = ReadFloatValue(values, SpeedTorqueManualDisplacementRegister, "1号手动位移输入");
double torqueCoefficient = ReadFloatValue(values, TorqueCoefficientRegister, "扭矩系数");
double torqueProtection = ReadFloatValue(values, TorqueProtectionRegister, "扭矩保护输入");
double holdTorque = ScaleTenthsFromPlc(await _plcRegisterService.ReadUInt16Async(config, HoldTorqueRegister));
double holdTorque = ReadFloatValue(values, HoldTorqueRegister, "保持扭矩设置");
double torqueHoldTime = ScaleTenthsFromPlc(await _plcRegisterService.ReadUInt16Async(config, TorqueHoldTimeRegister));
double speedCoefficient = ReadFloatValue(values, SpeedCoefficientRegister, "转速系数");
double speedStopThreshold = ReadFloatValue(values, SpeedStopThresholdRegister, "低速停止设置");
@@ -1989,7 +1990,7 @@ public sealed class MainWindowViewModel : ObservableObject
await WriteChangedFloatAsync(SpeedCoefficientRegister, "转速系数", current.SpeedCoefficient, updated.SpeedCoefficient);
await WriteChangedFloatAsync(SpeedStopThresholdRegister, "低速停止", current.SpeedStopThreshold, updated.SpeedStopThreshold);
await WriteChangedFloatAsync(PressureCoefficientRegister, "压力系数", current.PressureCoefficient, updated.PressureCoefficient);
await WriteChangedTenthsAsync(HoldTorqueRegister, "保持扭矩设置", current.HoldTorque, updated.HoldTorque);
await WriteChangedFloatAsync(HoldTorqueRegister, "保持扭矩设置", current.HoldTorque, updated.HoldTorque);
return changedItems;
@@ -2432,8 +2433,24 @@ public sealed class MainWindowViewModel : ObservableObject
return;
}
if (!await PulsePlcAsync(NoLoadSpeedRecordCoil, "空载转速测试"))
try
{
await _plcCoilService.WriteCoilAsync(
_parameterConfig.ToPlcConnectionConfig(),
NoLoadSpeedRecordCoil,
true);
Log.Information(
"PLC动作成功{ActionName}M{CoilAddress}=1",
"空载转速测试",
NoLoadSpeedRecordCoil);
}
catch (Exception ex)
{
StatusText = $"PLC 空载转速测试失败:{OperatorMessageFormatter.FromException(ex)}";
Log.Error(
ex,
"PLC动作失败空载转速测试M{CoilAddress}",
NoLoadSpeedRecordCoil);
return;
}
@@ -3641,6 +3658,27 @@ public sealed class MainWindowViewModel : ObservableObject
NoLoadSpeedTestButtonText = "测试";
PersistCurrentPayloadSnapshot("空载转速记录完成");
UpdateDataCaptureStatus();
_ = Task.Run(async () =>
{
try
{
await _plcCoilService.WriteCoilAsync(
_parameterConfig.ToPlcConnectionConfig(),
NoLoadSpeedRecordCoil,
false);
Log.Information(
"PLC复位成功空载转速测试M{CoilAddress}=0",
NoLoadSpeedRecordCoil);
}
catch (Exception ex)
{
Log.Error(
ex,
"PLC复位失败空载转速测试M{CoilAddress}",
NoLoadSpeedRecordCoil);
}
});
}
private void PrepareSessionForNewRun()