[RT.EquipmentLibrary]

TV阀添加复位操作,上位机按钮按下后,置位DO_TVReset,1秒后复位DO_TVReset
This commit is contained in:
hanqiangqiang 2023-12-28 09:38:53 +08:00
parent 163d2ecad0
commit a400d95bc5
1 changed files with 36 additions and 0 deletions

View File

@ -246,6 +246,8 @@ namespace Aitex.Core.RT.Device.Devices
private double _rampInitValue1;
private int _rampTime1;
private DeviceTimer _resetTimer = new DeviceTimer();
private AITThrottleValveData DeviceData
{
get
@ -291,6 +293,8 @@ namespace Aitex.Core.RT.Device.Devices
private DOAccessor _doTVValveEnable = null;
private DOAccessor _doTVReset = null;
private string _unitPressure;
private Dictionary<PressureCtrlMode, int> _ctrlModeIoValue = new Dictionary<PressureCtrlMode, int>();
@ -326,6 +330,7 @@ namespace Aitex.Core.RT.Device.Devices
_aiPressureFeedback = ParseAiNode("aiPressureFeedback", node, ioModule);
_aoPressureSetPoint = ParseAoNode("aoPressureSetPoint", node, ioModule);
_doTVValveEnable = ParseDoNode("doTVValveEnable", node, ioModule);
_doTVReset= ParseDoNode("doTVReset", node, ioModule);
_positionDefaultValue = ParseScNode("positionDefaultValue", node, ioModule, $"{scBasePath}.ThrottlePositionDefaultValue");
_pressureDefaultValue = ParseScNode("pressureDefaultValue", node, ioModule, $"{scBasePath}.ThrottlePressureDefaultValue");
@ -382,6 +387,15 @@ namespace Aitex.Core.RT.Device.Devices
return true;
});
OP.Subscribe($"{Module}.{Name}.SetTVReset", (function, args) =>
{
bool bOn = Convert.ToBoolean((string)args[0]);
if (SetTVReset(bOn, out string reason))
_resetTimer.Start(1000);
return true;
});
return true;
}
@ -668,6 +682,18 @@ namespace Aitex.Core.RT.Device.Devices
return true;
}
public bool SetTVReset(bool reset, out string reason)
{
bool isResetOK = _doTVReset.SetValue(reset, out _);
reason = $"{Display} reset to {reset} ";
if (isResetOK)
EV.PostInfoLog(Module, reason);
else
EV.PostAlarmLog(Module, reason);
return isResetOK;
}
public void Terminate()
{
}
@ -687,6 +713,7 @@ namespace Aitex.Core.RT.Device.Devices
MonitorRamping();
MonitorRampingPosition();
//MonitorClose();
MonitorSetRest();//根据电气要求按钮复位按钮后1秒后复位DO信号
}
catch (Exception ex)
{
@ -793,6 +820,15 @@ namespace Aitex.Core.RT.Device.Devices
}
}
private void MonitorSetRest()
{
if (_resetTimer.IsTimeout())
{
_resetTimer.Stop();
SetTVReset(false, out _);
}
}
public void Reset()
{