namespace SHARP_CLAS_UI
|
{
|
public class StageUnit
|
{
|
#region Enum
|
private enum StageUnitWork
|
{
|
Wait,
|
|
BeforeBlowSolOn,
|
BeforeBlowSolOnCheck,
|
BeforeBlowSolOff,
|
BeforeBlowSolOffCheck,
|
VacuumSolOn,
|
VacuumSolOnCheck,
|
IsVacuumOnCheck,
|
|
VacuumSolOff,
|
VacuumSolOffCheck,
|
AfterBlowSolOn,
|
AfterBlowSolOnCheck,
|
AfterBlowSolOff,
|
AfterBlowSolOffCheck,
|
IsVacuumOffCheck,
|
}
|
#endregion
|
|
#region Property
|
public bool VacuumSolOn
|
{
|
get
|
{
|
return _equip.Board_Control.IO_manager.Get_Output(_vacuumSolOn);
|
}
|
|
set
|
{
|
_equip.Board_Control.IO_manager.Set_Output(_vacuumSolOn, value);
|
}
|
}
|
|
public bool BlowSolOn
|
{
|
get
|
{
|
return _equip.Board_Control.IO_manager.Get_Output(_blowSolOn);
|
}
|
|
set
|
{
|
_equip.Board_Control.IO_manager.Set_Output(_blowSolOn, value);
|
}
|
}
|
|
public bool IsVacuumOn
|
{
|
get
|
{
|
return _equip.Board_Control.IO_manager.Get_Input(_isVacuumOn);
|
}
|
}
|
|
public bool IsStageUnitWorkEnd
|
{
|
get
|
{
|
if (_stageUnitWorking == StageUnitWork.Wait)
|
{
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
}
|
|
public Panel_Info PanelInfo
|
{
|
get
|
{
|
return _panelInfo;
|
}
|
set
|
{
|
Panel_Info_Manager.Instance.Set_Panel_Info(_panelInfoName, value);
|
_panelInfo = value.Clone();
|
}
|
}
|
#endregion
|
|
#region Field
|
Equipment _equip;
|
|
private Panel_Info _panelInfo;
|
private Panel_Info_Names _panelInfoName;
|
private OutputData _vacuumSolOn;
|
private OutputData _blowSolOn;
|
private InputData _isVacuumOn;
|
|
private En_Alarm_List _vacuumSensorAlarm;
|
|
private StageUnitWork _stageUnitWorking;
|
private Time_Checker _sequenceTimer;
|
|
private readonly int _retryLimitCount = 3;
|
private int _retryCount;
|
#endregion
|
|
#region Construct
|
public StageUnit(Equipment equip)
|
{
|
_equip = equip;
|
_retryCount = 0;
|
|
_sequenceTimer = new Time_Checker();
|
_stageUnitWorking = StageUnitWork.Wait;
|
_panelInfoName = Panel_Info_Names.Ablation_1_1;
|
}
|
#endregion
|
|
#region Function
|
public void StageUnitInitialize(Panel_Info_Names panelInfoName, OutputData vacuumSolOn, OutputData blowSolOn, InputData isVacuumOn)
|
{
|
_panelInfoName = panelInfoName;
|
_panelInfo = Panel_Info_Manager.Instance.Get_Panel_Info(_panelInfoName);
|
_vacuumSolOn = vacuumSolOn;
|
_blowSolOn = blowSolOn;
|
_isVacuumOn = isVacuumOn;
|
}
|
|
public void StageUnitAlarmInitialize(En_Alarm_List vacuumSensorAlarm)
|
{
|
_vacuumSensorAlarm = vacuumSensorAlarm;
|
}
|
|
public void StageUnitLogicWorking()
|
{
|
switch (_stageUnitWorking)
|
{
|
case StageUnitWork.Wait:
|
{
|
break;
|
}
|
case StageUnitWork.BeforeBlowSolOn:
|
{
|
BlowSolOn = true;
|
_sequenceTimer.Start();
|
_stageUnitWorking = StageUnitWork.BeforeBlowSolOnCheck;
|
break;
|
}
|
case StageUnitWork.BeforeBlowSolOnCheck:
|
{
|
if (BlowSolOn == true)
|
{
|
_retryCount = 0;
|
_sequenceTimer.Stop();
|
_stageUnitWorking = StageUnitWork.BeforeBlowSolOff;
|
}
|
else
|
{
|
if (_sequenceTimer.Seconds > 3)
|
{
|
if (_retryCount < _retryLimitCount)
|
{
|
_retryCount++;
|
_stageUnitWorking = StageUnitWork.BeforeBlowSolOn;
|
}
|
else
|
{
|
_retryCount = 0;
|
Interlock_Manager.Add_Interlock_Msg($"{_blowSolOn} on fail.", $"{_blowSolOn} on is fail (retry 3).");
|
_stageUnitWorking = StageUnitWork.Wait;
|
}
|
}
|
}
|
break;
|
}
|
case StageUnitWork.BeforeBlowSolOff:
|
{
|
BlowSolOn = false;
|
_sequenceTimer.Start();
|
_stageUnitWorking = StageUnitWork.BeforeBlowSolOffCheck;
|
break;
|
}
|
case StageUnitWork.BeforeBlowSolOffCheck:
|
{
|
if(BlowSolOn == false)
|
{
|
_retryCount = 0;
|
_sequenceTimer.Stop();
|
_stageUnitWorking = StageUnitWork.VacuumSolOn;
|
}
|
else
|
{
|
if(_sequenceTimer.Seconds > 3)
|
{
|
if (_retryCount < _retryLimitCount)
|
{
|
_retryCount++;
|
_stageUnitWorking = StageUnitWork.BeforeBlowSolOff;
|
}
|
else
|
{
|
_retryCount = 0;
|
Interlock_Manager.Add_Interlock_Msg($"{_blowSolOn} off fail.", $"{_blowSolOn} off is fail (retry 3).");
|
_stageUnitWorking = StageUnitWork.Wait;
|
}
|
}
|
}
|
break;
|
}
|
case StageUnitWork.VacuumSolOn:
|
{
|
VacuumSolOn = true;
|
_sequenceTimer.Start();
|
_stageUnitWorking = StageUnitWork.VacuumSolOnCheck;
|
break;
|
}
|
case StageUnitWork.VacuumSolOnCheck:
|
{
|
if (VacuumSolOn == true)
|
{
|
_retryCount = 0;
|
_sequenceTimer.Start();
|
_stageUnitWorking = StageUnitWork.IsVacuumOnCheck;
|
}
|
else
|
{
|
if (_sequenceTimer.Seconds > 3)
|
{
|
if (_retryCount < _retryLimitCount)
|
{
|
_retryCount++;
|
_stageUnitWorking = StageUnitWork.VacuumSolOn;
|
}
|
else
|
{
|
_retryCount = 0;
|
Interlock_Manager.Add_Interlock_Msg($"{_vacuumSolOn} on fail.", $"{_vacuumSolOn} on is fail (retry 3).");
|
_stageUnitWorking = StageUnitWork.Wait;
|
}
|
}
|
}
|
break;
|
}
|
case StageUnitWork.IsVacuumOnCheck:
|
{
|
if(IsVacuumOn == true)
|
{
|
_sequenceTimer.Stop();
|
_stageUnitWorking = StageUnitWork.Wait;
|
}
|
else
|
{
|
if (_sequenceTimer.Seconds > _equip.Setting.Vacuum_Timeout)
|
{
|
Alarm_Manager.Instance.Occurred(_vacuumSensorAlarm);
|
_stageUnitWorking = StageUnitWork.Wait;
|
}
|
}
|
break;
|
}
|
case StageUnitWork.VacuumSolOff:
|
{
|
VacuumSolOn = false;
|
_sequenceTimer.Start();
|
_stageUnitWorking = StageUnitWork.VacuumSolOffCheck;
|
break;
|
}
|
case StageUnitWork.VacuumSolOffCheck:
|
{
|
if (VacuumSolOn == false)
|
{
|
_retryCount = 0;
|
_sequenceTimer.Start();
|
_stageUnitWorking = StageUnitWork.AfterBlowSolOn;
|
}
|
else
|
{
|
if (_sequenceTimer.Seconds > 3)
|
{
|
if (_retryCount < _retryLimitCount)
|
{
|
_retryCount++;
|
_stageUnitWorking = StageUnitWork.VacuumSolOff;
|
}
|
else
|
{
|
_retryCount = 0;
|
Interlock_Manager.Add_Interlock_Msg($"{_vacuumSolOn} off fail.", $"{_vacuumSolOn} off is fail (retry 3).");
|
_stageUnitWorking = StageUnitWork.Wait;
|
}
|
}
|
}
|
break;
|
}
|
case StageUnitWork.AfterBlowSolOn:
|
{
|
BlowSolOn = true;
|
_sequenceTimer.Start();
|
_stageUnitWorking = StageUnitWork.AfterBlowSolOnCheck;
|
break;
|
}
|
case StageUnitWork.AfterBlowSolOnCheck:
|
{
|
if (BlowSolOn == true)
|
{
|
_retryCount = 0;
|
_sequenceTimer.Stop();
|
_stageUnitWorking = StageUnitWork.AfterBlowSolOff;
|
}
|
else
|
{
|
if (_sequenceTimer.Seconds > 3)
|
{
|
if (_retryCount < _retryLimitCount)
|
{
|
_retryCount++;
|
_stageUnitWorking = StageUnitWork.AfterBlowSolOn;
|
}
|
else
|
{
|
_retryCount = 0;
|
Interlock_Manager.Add_Interlock_Msg($"{_blowSolOn} on fail.", $"{_blowSolOn} on is fail (retry 3).");
|
_stageUnitWorking = StageUnitWork.Wait;
|
}
|
}
|
}
|
break;
|
}
|
case StageUnitWork.AfterBlowSolOff:
|
{
|
BlowSolOn = false;
|
_sequenceTimer.Start();
|
_stageUnitWorking = StageUnitWork.AfterBlowSolOffCheck;
|
break;
|
}
|
case StageUnitWork.AfterBlowSolOffCheck:
|
{
|
if (BlowSolOn == false)
|
{
|
_retryCount = 0;
|
_sequenceTimer.Stop();
|
_stageUnitWorking = StageUnitWork.IsVacuumOffCheck;
|
}
|
else
|
{
|
if (_sequenceTimer.Seconds > 3)
|
{
|
if (_retryCount < _retryLimitCount)
|
{
|
_retryCount++;
|
_stageUnitWorking = StageUnitWork.AfterBlowSolOff;
|
}
|
else
|
{
|
_retryCount = 0;
|
Interlock_Manager.Add_Interlock_Msg($"{_blowSolOn} off fail.", $"{_blowSolOn} off is fail (retry 3).");
|
_stageUnitWorking = StageUnitWork.Wait;
|
_retryCount = 0;
|
}
|
}
|
}
|
break;
|
}
|
case StageUnitWork.IsVacuumOffCheck:
|
{
|
if (IsVacuumOn == false)
|
{
|
_sequenceTimer.Stop();
|
_stageUnitWorking = StageUnitWork.Wait;
|
}
|
else
|
{
|
if (_sequenceTimer.Seconds > _equip.Setting.Vacuum_Timeout)
|
{
|
Alarm_Manager.Instance.Occurred(_vacuumSensorAlarm);
|
_stageUnitWorking = StageUnitWork.Wait;
|
}
|
}
|
break;
|
}
|
}
|
}
|
|
public bool VacuumOn()
|
{
|
if (IsStageUnitWorkEnd)
|
{
|
if(IsVacuumOn && VacuumSolOn)
|
{
|
return true;
|
}
|
else
|
{
|
_stageUnitWorking = StageUnitWork.BeforeBlowSolOn;
|
return false;
|
}
|
}
|
else
|
{
|
return false;
|
}
|
}
|
|
public bool VacuumOff()
|
{
|
if (IsStageUnitWorkEnd)
|
{
|
if (IsVacuumOn == false && VacuumSolOn == false)
|
{
|
return true;
|
}
|
else
|
{
|
_stageUnitWorking = StageUnitWork.VacuumSolOff;
|
return false;
|
}
|
}
|
else
|
{
|
return false;
|
}
|
}
|
#endregion
|
}
|
}
|