Compare commits
2 Commits
19d7a9d1ec
...
3a9710e6fa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a9710e6fa | ||
|
|
b7cf3ab0aa |
@@ -139,6 +139,7 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
SpeedTorqueManualDisplacementRegister,
|
SpeedTorqueManualDisplacementRegister,
|
||||||
TorqueCoefficientRegister,
|
TorqueCoefficientRegister,
|
||||||
TorqueProtectionRegister,
|
TorqueProtectionRegister,
|
||||||
|
HoldTorqueRegister,
|
||||||
SpeedCoefficientRegister,
|
SpeedCoefficientRegister,
|
||||||
SpeedStopThresholdRegister,
|
SpeedStopThresholdRegister,
|
||||||
PressureCoefficientRegister,
|
PressureCoefficientRegister,
|
||||||
@@ -154,7 +155,8 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
SpeedTorqueResetEnabledCoil,
|
SpeedTorqueResetEnabledCoil,
|
||||||
SpeedTorqueResetDoneCoil,
|
SpeedTorqueResetDoneCoil,
|
||||||
AxialResetEnabledCoil,
|
AxialResetEnabledCoil,
|
||||||
AxialResetDoneCoil
|
AxialResetDoneCoil,
|
||||||
|
NoLoadSpeedRecordCoil
|
||||||
];
|
];
|
||||||
|
|
||||||
private readonly IPlcCoilService _plcCoilService;
|
private readonly IPlcCoilService _plcCoilService;
|
||||||
@@ -482,7 +484,7 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueTenthsTestPageInputWrite(TestPageInputParameter.HoldTorque, HoldTorqueRegister, "保持扭矩设置", value);
|
QueueFloatTestPageInputWrite(TestPageInputParameter.HoldTorque, HoldTorqueRegister, "保持扭矩设置", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -878,7 +880,7 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
double speedTorqueManualDisplacement = ReadFloatValue(values, SpeedTorqueManualDisplacementRegister, "1号手动位移输入");
|
double speedTorqueManualDisplacement = ReadFloatValue(values, SpeedTorqueManualDisplacementRegister, "1号手动位移输入");
|
||||||
double torqueCoefficient = ReadFloatValue(values, TorqueCoefficientRegister, "扭矩系数");
|
double torqueCoefficient = ReadFloatValue(values, TorqueCoefficientRegister, "扭矩系数");
|
||||||
double torqueProtection = ReadFloatValue(values, TorqueProtectionRegister, "扭矩保护输入");
|
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 torqueHoldTime = ScaleTenthsFromPlc(await _plcRegisterService.ReadUInt16Async(config, TorqueHoldTimeRegister));
|
||||||
double speedCoefficient = ReadFloatValue(values, SpeedCoefficientRegister, "转速系数");
|
double speedCoefficient = ReadFloatValue(values, SpeedCoefficientRegister, "转速系数");
|
||||||
double speedStopThreshold = ReadFloatValue(values, SpeedStopThresholdRegister, "低速停止设置");
|
double speedStopThreshold = ReadFloatValue(values, SpeedStopThresholdRegister, "低速停止设置");
|
||||||
@@ -1989,7 +1991,7 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
await WriteChangedFloatAsync(SpeedCoefficientRegister, "转速系数", current.SpeedCoefficient, updated.SpeedCoefficient);
|
await WriteChangedFloatAsync(SpeedCoefficientRegister, "转速系数", current.SpeedCoefficient, updated.SpeedCoefficient);
|
||||||
await WriteChangedFloatAsync(SpeedStopThresholdRegister, "低速停止", current.SpeedStopThreshold, updated.SpeedStopThreshold);
|
await WriteChangedFloatAsync(SpeedStopThresholdRegister, "低速停止", current.SpeedStopThreshold, updated.SpeedStopThreshold);
|
||||||
await WriteChangedFloatAsync(PressureCoefficientRegister, "压力系数", current.PressureCoefficient, updated.PressureCoefficient);
|
await WriteChangedFloatAsync(PressureCoefficientRegister, "压力系数", current.PressureCoefficient, updated.PressureCoefficient);
|
||||||
await WriteChangedTenthsAsync(HoldTorqueRegister, "保持扭矩设置", current.HoldTorque, updated.HoldTorque);
|
await WriteChangedFloatAsync(HoldTorqueRegister, "保持扭矩设置", current.HoldTorque, updated.HoldTorque);
|
||||||
|
|
||||||
return changedItems;
|
return changedItems;
|
||||||
|
|
||||||
@@ -2432,8 +2434,24 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
return;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3624,15 +3642,27 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
private void FinalizeNoLoadSpeedRunIfDue()
|
private void FinalizeNoLoadSpeedRunIfDue()
|
||||||
{
|
{
|
||||||
if (_activeNoLoadSpeedRun is null
|
if (_activeNoLoadSpeedRun is null
|
||||||
|| !_noLoadCaptureDeadline.HasValue
|
|| !_noLoadCaptureDeadline.HasValue)
|
||||||
|| DateTime.Now < _noLoadCaptureDeadline.Value)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 实际转速达到设定转速的 98%:立即结束
|
||||||
|
bool speedReached = _parameterConfig.NoLoadSpeedSetting > 0
|
||||||
|
&& _realtimeSpeed >= _parameterConfig.NoLoadSpeedSetting * 0.98;
|
||||||
|
|
||||||
|
// 转速未达标且未超时:继续等待
|
||||||
|
if (!speedReached && DateTime.Now < _noLoadCaptureDeadline.Value)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转速已达标或已超时:结束测试
|
||||||
AppendLatestSample(_activeNoLoadSpeedRun);
|
AppendLatestSample(_activeNoLoadSpeedRun);
|
||||||
_activeNoLoadSpeedRun.CompletedAt = DateTime.Now;
|
_activeNoLoadSpeedRun.CompletedAt = DateTime.Now;
|
||||||
_activeNoLoadSpeedRun.CompletionStatus = "记录完成";
|
_activeNoLoadSpeedRun.CompletionStatus = speedReached
|
||||||
|
? "状态:达到系统转速,记录完成"
|
||||||
|
: "记录完成";
|
||||||
_activeNoLoadSpeedRun.NoLoadSpeedRpm = _noLoadSpeedRecord;
|
_activeNoLoadSpeedRun.NoLoadSpeedRpm = _noLoadSpeedRecord;
|
||||||
_activeNoLoadSpeedRun.NoLoadSpeedErrorRatePercent = _noLoadSpeedErrorRate;
|
_activeNoLoadSpeedRun.NoLoadSpeedErrorRatePercent = _noLoadSpeedErrorRate;
|
||||||
_completedRuns.Add(_activeNoLoadSpeedRun);
|
_completedRuns.Add(_activeNoLoadSpeedRun);
|
||||||
@@ -3641,6 +3671,27 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
NoLoadSpeedTestButtonText = "测试";
|
NoLoadSpeedTestButtonText = "测试";
|
||||||
PersistCurrentPayloadSnapshot("空载转速记录完成");
|
PersistCurrentPayloadSnapshot("空载转速记录完成");
|
||||||
UpdateDataCaptureStatus();
|
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()
|
private void PrepareSessionForNewRun()
|
||||||
|
|||||||
Reference in New Issue
Block a user