|
@@ -4,6 +4,7 @@ using System.Diagnostics;
|
|
|
using System.IO;
|
|
|
using System.Xml;
|
|
|
using System.Xml.Serialization;
|
|
|
+using Aitex.Common.Util;
|
|
|
using Aitex.Core.Common.DeviceData;
|
|
|
using Aitex.Core.RT.DataCenter;
|
|
|
using Aitex.Core.RT.Device;
|
|
@@ -86,6 +87,8 @@ namespace Venus_RT.Devices
|
|
|
public bool HostControl { get; set; }
|
|
|
private bool _buzzerSwitchOff = false;
|
|
|
private bool _buzzerAndRed = false;
|
|
|
+ private bool _buzzer1SwitchOff = false;
|
|
|
+ private bool _buzzer2SwitchOff = false;
|
|
|
|
|
|
private RfPowerBase _Generator;
|
|
|
public DeviceTimer _timerBuzzerBlinking = new DeviceTimer();
|
|
@@ -107,6 +110,7 @@ namespace Venus_RT.Devices
|
|
|
IsBlueLightOn = _blue != null && _blue.Value,
|
|
|
|
|
|
IsBuzzerOn = (_buzzer1 != null && _buzzer1.Value) || (_buzzer2 != null && _buzzer2.Value),
|
|
|
+ IsBuzzerOff = !((_buzzer1 != null && _buzzer1.Value) || (_buzzer2 != null && _buzzer2.Value)),
|
|
|
};
|
|
|
|
|
|
return data;
|
|
@@ -119,6 +123,7 @@ namespace Venus_RT.Devices
|
|
|
new Dictionary<string, Dictionary<IoSignalLight, TowerLightStatus>>();
|
|
|
|
|
|
private Dictionary<IoSignalLight, TowerLightStatus> _cmdSetPoint = new Dictionary<IoSignalLight, TowerLightStatus>();
|
|
|
+ private Dictionary<IoSignalLight, TowerLightStatus> dicState = new Dictionary<IoSignalLight, TowerLightStatus>();
|
|
|
|
|
|
public IoSignalTower(string module, XmlElement node, string ioModule = "")
|
|
|
{
|
|
@@ -172,7 +177,7 @@ namespace Venus_RT.Devices
|
|
|
|
|
|
public bool Initialize()
|
|
|
{
|
|
|
- OP.Subscribe($"{Module}.{Name}.{AITSignalTowerOperation.SwitchOffBuzzer}", SwitchOffBuzzer);
|
|
|
+ OP.Subscribe($"System.{AITSignalTowerOperation.SwitchOffBuzzer}", SwitchOffBuzzer);
|
|
|
|
|
|
OP.Subscribe($"{Module}.{Name}.{AITSignalTowerOperation.SwitchOnBuzzerAndRed}", SwitchOnBuzzerAndRed);
|
|
|
|
|
@@ -183,6 +188,9 @@ namespace Venus_RT.Devices
|
|
|
DATA.Subscribe($"{Module}.{Name}.IsGreenLightOn", () => _green != null && _green.Value);
|
|
|
DATA.Subscribe($"{Module}.{Name}.IsBlueLightOn", () => _blue != null && _blue.Value);
|
|
|
DATA.Subscribe($"{Module}.{Name}.IsBuzzerOn", () => (_buzzer1 != null && _buzzer1.Value) || (_buzzer2 != null && _buzzer2.Value));
|
|
|
+
|
|
|
+ CustomSignalTower();
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -239,6 +247,17 @@ namespace Venus_RT.Devices
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public bool CustomSignalTower()
|
|
|
+ {
|
|
|
+ string pathFile = PathManager.GetCfgDir() + "_VenusSignalTower.xml";
|
|
|
+ if (!File.Exists(pathFile))
|
|
|
+ {
|
|
|
+ pathFile = PathManager.GetCfgDir() + "VenusSignalTower.xml";
|
|
|
+ }
|
|
|
+ return CustomSignalTower(pathFile);
|
|
|
+ }
|
|
|
+
|
|
|
public bool CustomSignalTower(string configPathFile)
|
|
|
{
|
|
|
try
|
|
@@ -266,6 +285,8 @@ namespace Venus_RT.Devices
|
|
|
|
|
|
if (_buzzer1 != null)
|
|
|
_config[e.Name][_buzzer1] = ParseLight(e.Buzzer1);
|
|
|
+ if (_buzzer2 != null)
|
|
|
+ _config[e.Name][_buzzer2] = ParseLight(e.Buzzer2);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -290,54 +311,77 @@ namespace Venus_RT.Devices
|
|
|
|
|
|
public void Monitor()
|
|
|
{
|
|
|
- if (DATA.Poll(Module, StateData.PMState.ToString()) != null)
|
|
|
- state = (PMState)DATA.Poll(Module, StateData.PMState.ToString());
|
|
|
- List<IoValve> valves = DEVICE.GetDevice<IoValve>();
|
|
|
- //if (DEVICE.GetDevice<IoRf>() != null)
|
|
|
- //{
|
|
|
- // _Generator = DEVICE.GetDevice<IoRf>($"{Module}.{VenusDevice.Rf}");
|
|
|
- //}
|
|
|
- //else
|
|
|
- if (DEVICE.GetDevice<AdTecGenerator>() != null)
|
|
|
- {
|
|
|
- _Generator = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VenusDevice.Rf}");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- _Generator = null;
|
|
|
- }
|
|
|
- //pumping valve开,vent purge valve开,Gas valve开,RF开,只要有其中之一处于开的状态,就是绿灯
|
|
|
- if (state == PMState.Error || _buzzerAndRed)
|
|
|
- {
|
|
|
- SetLight(LightType.GREEN, LightState.Off);
|
|
|
- SetLight(LightType.RED, LightState.On);
|
|
|
- SetLight(LightType.YELLOW, LightState.Off);
|
|
|
- SetLight(LightType.BUZZER1, _buzzerSwitchOff ? LightState.Off : LightState.On);
|
|
|
- }
|
|
|
- else if ((_Generator != null && _Generator.IsPowerOn) || valves.Exists(v => v.Status))
|
|
|
- {
|
|
|
- SetLight(LightType.GREEN, LightState.On);
|
|
|
- SetLight(LightType.RED, LightState.Off);
|
|
|
- SetLight(LightType.YELLOW, LightState.Off);
|
|
|
- SetLight(LightType.BUZZER1, LightState.Off);
|
|
|
- }
|
|
|
- else if (state == PMState.PreProcess || state == PMState.Processing || state == PMState.PostProcess)
|
|
|
+ if (_red != null)
|
|
|
+ dicState[_red] = TowerLightStatus.Off;
|
|
|
+ if (_yellow != null)
|
|
|
+ dicState[_yellow] = TowerLightStatus.Off;
|
|
|
+ if (_green != null)
|
|
|
+ dicState[_green] = TowerLightStatus.Off;
|
|
|
+ if (_blue != null)
|
|
|
+ dicState[_blue] = TowerLightStatus.Off;
|
|
|
+ if (_white != null)
|
|
|
+ dicState[_white] = TowerLightStatus.Off;
|
|
|
+ if (_buzzer1 != null)
|
|
|
+ dicState[_buzzer1] = TowerLightStatus.Off;
|
|
|
+ if (_buzzer2 != null)
|
|
|
+ dicState[_buzzer2] = TowerLightStatus.Off;
|
|
|
+
|
|
|
+ foreach (var trigCondition in _config)
|
|
|
{
|
|
|
- SetLight(LightType.GREEN, LightState.On);
|
|
|
- SetLight(LightType.RED, LightState.Off);
|
|
|
- SetLight(LightType.YELLOW, LightState.Off);
|
|
|
- SetLight(LightType.BUZZER1, LightState.Off);
|
|
|
+ var conditionValue = DATA.Poll(trigCondition.Key);
|
|
|
+ if (conditionValue == null)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ bool isTrig = (bool)conditionValue;
|
|
|
+ if (isTrig)
|
|
|
+ {
|
|
|
+ if (_red != null)
|
|
|
+ {
|
|
|
+ dicState[_red] = MergeCondition(dicState[_red], trigCondition.Value[_red]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_yellow != null)
|
|
|
+ {
|
|
|
+ dicState[_yellow] = MergeCondition(dicState[_yellow], trigCondition.Value[_yellow]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_green != null)
|
|
|
+ {
|
|
|
+ dicState[_green] = MergeCondition(dicState[_green], trigCondition.Value[_green]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_white != null)
|
|
|
+ {
|
|
|
+ dicState[_white] = MergeCondition(dicState[_white], trigCondition.Value[_white]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_blue != null)
|
|
|
+ {
|
|
|
+ dicState[_blue] = MergeCondition(dicState[_blue], trigCondition.Value[_blue]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_buzzer1 != null)
|
|
|
+ {
|
|
|
+ dicState[_buzzer1] = _buzzer1SwitchOff ? TowerLightStatus.Off : MergeCondition(dicState[_buzzer1], trigCondition.Value[_buzzer1]);
|
|
|
+ }
|
|
|
+ if (_buzzer2 != null)
|
|
|
+ {
|
|
|
+ dicState[_buzzer2] = _buzzer2SwitchOff ? TowerLightStatus.Off : MergeCondition(dicState[_buzzer2], trigCondition.Value[_buzzer2]);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- else
|
|
|
+
|
|
|
+ if (_config.Count > 0 && !HostControl)
|
|
|
{
|
|
|
- SetLight(LightType.GREEN, LightState.Off);
|
|
|
- SetLight(LightType.RED, LightState.Off);
|
|
|
- SetLight(LightType.YELLOW, LightState.On);
|
|
|
- SetLight(LightType.BUZZER1, LightState.Off);
|
|
|
+ SetLight(_red, dicState);
|
|
|
+ SetLight(_blue, dicState);
|
|
|
+ SetLight(_yellow, dicState);
|
|
|
+ SetLight(_green, dicState);
|
|
|
+ SetLight(_white, dicState);
|
|
|
+ SetLight(_buzzer1, dicState);
|
|
|
+ SetLight(_buzzer2, dicState);
|
|
|
}
|
|
|
|
|
|
- if (!_timerBuzzerBlinking.IsIdle() && !_timerBuzzerBlinking.IsTimeout())
|
|
|
- SetLight(LightType.BUZZER1, LightState.Blink);
|
|
|
|
|
|
MonitorLight(_red);
|
|
|
MonitorLight(_blue);
|
|
@@ -346,6 +390,62 @@ namespace Venus_RT.Devices
|
|
|
MonitorLight(_white);
|
|
|
MonitorLight(_buzzer1);
|
|
|
MonitorLight(_buzzer2);
|
|
|
+ //if (DATA.Poll(Module, StateData.PMState.ToString()) != null)
|
|
|
+ // state = (PMState)DATA.Poll(Module, StateData.PMState.ToString());
|
|
|
+ //List<IoValve> valves = DEVICE.GetDevice<IoValve>();
|
|
|
+ //if (DEVICE.GetDevice<IoRf>() != null)
|
|
|
+ //{
|
|
|
+ // _Generator = DEVICE.GetDevice<IoRf>($"{Module}.{VenusDevice.Rf}");
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //if (DEVICE.GetDevice<AdTecGenerator>() != null)
|
|
|
+ //{
|
|
|
+ // _Generator = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VenusDevice.Rf}");
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // _Generator = null;
|
|
|
+ //}
|
|
|
+ ////pumping valve开,vent purge valve开,Gas valve开,RF开,只要有其中之一处于开的状态,就是绿灯
|
|
|
+ //if (state == PMState.Error || _buzzerAndRed)
|
|
|
+ //{
|
|
|
+ // SetLight(LightType.GREEN, LightState.Off);
|
|
|
+ // SetLight(LightType.RED, LightState.On);
|
|
|
+ // SetLight(LightType.YELLOW, LightState.Off);
|
|
|
+ // SetLight(LightType.BUZZER1, _buzzerSwitchOff ? LightState.Off : LightState.On);
|
|
|
+ //}
|
|
|
+ //else if ((_Generator != null && _Generator.IsPowerOn) || valves.Exists(v => v.Status))
|
|
|
+ //{
|
|
|
+ // SetLight(LightType.GREEN, LightState.On);
|
|
|
+ // SetLight(LightType.RED, LightState.Off);
|
|
|
+ // SetLight(LightType.YELLOW, LightState.Off);
|
|
|
+ // SetLight(LightType.BUZZER1, LightState.Off);
|
|
|
+ //}
|
|
|
+ //else if (state == PMState.PreProcess || state == PMState.Processing || state == PMState.PostProcess)
|
|
|
+ //{
|
|
|
+ // SetLight(LightType.GREEN, LightState.On);
|
|
|
+ // SetLight(LightType.RED, LightState.Off);
|
|
|
+ // SetLight(LightType.YELLOW, LightState.Off);
|
|
|
+ // SetLight(LightType.BUZZER1, LightState.Off);
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // SetLight(LightType.GREEN, LightState.Off);
|
|
|
+ // SetLight(LightType.RED, LightState.Off);
|
|
|
+ // SetLight(LightType.YELLOW, LightState.On);
|
|
|
+ // SetLight(LightType.BUZZER1, LightState.Off);
|
|
|
+ //}
|
|
|
+ //
|
|
|
+ //if (!_timerBuzzerBlinking.IsIdle() && !_timerBuzzerBlinking.IsTimeout())
|
|
|
+ // SetLight(LightType.BUZZER1, LightState.Blink);
|
|
|
+ //
|
|
|
+ //MonitorLight(_red);
|
|
|
+ //MonitorLight(_blue);
|
|
|
+ //MonitorLight(_yellow);
|
|
|
+ //MonitorLight(_green);
|
|
|
+ //MonitorLight(_white);
|
|
|
+ //MonitorLight(_buzzer1);
|
|
|
+ //MonitorLight(_buzzer2);
|
|
|
}
|
|
|
|
|
|
public void Reset()
|
|
@@ -360,13 +460,17 @@ namespace Venus_RT.Devices
|
|
|
ResetLight(_buzzer2);
|
|
|
_buzzerAndRed = false;
|
|
|
_buzzerSwitchOff = false;
|
|
|
+ _buzzer1SwitchOff = false;
|
|
|
+ _buzzer2SwitchOff = false;
|
|
|
}
|
|
|
|
|
|
public bool SwitchOffBuzzer(string cmd, object[] objs)
|
|
|
{
|
|
|
- if (cmd == $"{ Module}.{ Name}.{ AITSignalTowerOperation.SwitchOffBuzzer}" && _buzzer1 != null && _buzzer1.StateSetPoint != TowerLightStatus.Off)
|
|
|
+ if (cmd == $"System.{ AITSignalTowerOperation.SwitchOffBuzzer}" && _buzzer1 != null && _buzzer1.StateSetPoint != TowerLightStatus.Off)
|
|
|
{
|
|
|
_buzzerSwitchOff = true;
|
|
|
+ _buzzer1SwitchOff = true;
|
|
|
+ _buzzer2SwitchOff = true;
|
|
|
}
|
|
|
return true;
|
|
|
}
|