using System;
|
using System.Collections.Generic;
|
|
namespace SHARP_CLAS_UI
|
{
|
public class LoaderLiftOut : Lift
|
{
|
#region Property
|
public override bool IsWorkEnd
|
{
|
get
|
{
|
if (Step == LiftOutSteps.S0000_WAIT)
|
{
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
}
|
|
public LiftOutSteps Step
|
{
|
get
|
{
|
return _step;
|
}
|
|
set
|
{
|
_step = value;
|
}
|
}
|
|
public override bool IsStayPosition
|
{
|
get
|
{
|
object value;
|
|
equipment.sm.Get_Value(Position_Parameter_Address.LD_Tray_Empty_Z_Wait_Position, out value);
|
var position = double.Parse($"{value}");
|
|
return MotorZ.Is_Inposition(position, equipment.Setting.Inposition_Offset);
|
}
|
}
|
|
public override bool IsPanelEmpty
|
{
|
get
|
{
|
return true;
|
}
|
}
|
|
public override bool IsPanelFull
|
{
|
get
|
{
|
return false;
|
}
|
}
|
|
public override double TrayInPosition
|
{
|
get
|
{
|
if (equipment.Cur_Main_Recipe.tray_info == null)
|
return 0;
|
|
var position = UpPosition - (equipment.Cur_Main_Recipe.tray_info.LD_Tray_Empty_Tray_Pitch * equipment.LoaderOutTrayCount);
|
|
position = double.Parse(position.ToString("F3"));
|
return position;
|
}
|
}
|
|
public override double TrayWaitPosition
|
{
|
get
|
{
|
if (equipment.Cur_Main_Recipe.tray_info == null)
|
return 0;
|
|
var position = UpPosition - (equipment.Cur_Main_Recipe.tray_info.LD_Tray_Empty_Tray_Pitch * (equipment.LoaderOutTrayCount + 1));
|
|
position = double.Parse(position.ToString("F3"));
|
return position;
|
}
|
}
|
|
protected override double UpPosition
|
{
|
get
|
{
|
object value;
|
|
equipment.sm.Get_Value(Position_Parameter_Address.LD_Tray_Empty_Z_Process_Position, out value);
|
var position = double.Parse($"{value}");
|
|
return position;
|
}
|
}
|
|
public override string TrayID
|
{
|
get
|
{
|
return _trayId;
|
}
|
|
set
|
{
|
_trayId = value;
|
}
|
}
|
#endregion
|
|
#region Field
|
private LiftOutSteps _step;
|
private LiftOutSteps _oldStep;
|
private LiftHomeSteps _homeStep;
|
|
private string _trayId;
|
#endregion
|
|
#region Construct
|
public LoaderLiftOut(Equipment equipment) : base(equipment, MotorAxis.LD_Tray_Out_Lift, "LoaderLiftOut")
|
{
|
Step = LiftOutSteps.S0000_WAIT;
|
_oldStep = LiftOutSteps.S0000_WAIT;
|
|
Initialize(InputData.LD_Tray_Out_Lift_Up_1_1_Sensor, InputData.LD_Tray_Out_Lift_Up_1_2_Sensor, InputData.LD_Tray_Out_Lift_Up_2_1_Sensor, InputData.LD_Tray_Out_Lift_Up_2_2_Sensor);
|
|
pauseDisableList.Add(LiftOutSteps.S1415_LIFT_PITCH_DOWN_CHECK);
|
pauseDisableList.Add(LiftOutSteps.S1425_LIFT_PITCH_UP_CHECK);
|
pauseDisableList.Add(LiftOutSteps.S1435_LIFT_PITCH_LAST_UP_CHECK);
|
pauseDisableList.Add(LiftOutSteps.S2405_LIFT_DOWN_CHECK);
|
|
AlignerTop.Initialize(OutputData.LD_Tray_Out_Align_Top_Sol_Valve, InputData.LD_Tray_Out_Align_Top_1_Fwd_Sensor, InputData.LD_Tray_Out_Align_Top_2_Fwd_Sensor, InputData.LD_Tray_Out_Align_Top_1_Bwd_Sensor, InputData.LD_Tray_Out_Align_Top_2_Bwd_Sensor, En_Alarm_List.AL_0607_LD_TRAY_OUT_ALIGN_TOP_1_FWD_SENSOR_CHECK, En_Alarm_List.AL_0608_LD_TRAY_OUT_ALIGN_TOP_2_FWD_SENSOR_CHECK, En_Alarm_List.AL_0609_LD_TRAY_OUT_ALIGN_TOP_1_BWD_SENSOR_CHECK, En_Alarm_List.AL_0610_LD_TRAY_OUT_ALIGN_TOP_2_BWD_SENSOR_CHECK);
|
Clamper.Initialize(OutputData.LD_Tray_Out_Clamp_Sol_Valve, InputData.LD_Tray_Out_Clamp_1_Clamp_Sensor, InputData.LD_Tray_Out_Clamp_2_Clamp_Sensor, InputData.LD_Tray_Out_Clamp_1_Unclamp_Sensor, InputData.LD_Tray_Out_Clamp_2_Unclamp_Sensor, En_Alarm_List.AL_0611_LD_TRAY_OUT_CLAMP_1_SENSOR_CHECK, En_Alarm_List.AL_0612_LD_TRAY_OUT_CLAMP_2_SENSOR_CHECK, En_Alarm_List.AL_0613_LD_TRAY_OUT_UNCLAMP_1_SENSOR_CHECK, En_Alarm_List.AL_0614_LD_TRAY_OUT_UNCLAMP_2_SENSOR_CHECK);
|
Stacker.Initialize(OutputData.LD_Tray_Out_Stacker_Sol_Valve, InputData.LD_Tray_Out_Stacker_1_Fwd_Sensor, InputData.LD_Tray_Out_Stacker_2_Fwd_Sensor, InputData.LD_Tray_Out_Stacker_3_Fwd_Sensor, InputData.LD_Tray_Out_Stacker_4_Fwd_Sensor, InputData.LD_Tray_Out_Stacker_1_Bwd_Sensor, InputData.LD_Tray_Out_Stacker_2_Bwd_Sensor, InputData.LD_Tray_Out_Stacker_3_Bwd_Sensor, InputData.LD_Tray_Out_Stacker_4_Bwd_Sensor, En_Alarm_List.AL_0615_LD_TRAY_OUT_STACKER_1_FWD_SENSOR_CHECK, En_Alarm_List.AL_0616_LD_TRAY_OUT_STACKER_2_FWD_SENSOR_CHECK, En_Alarm_List.AL_0617_LD_TRAY_OUT_STACKER_3_FWD_SENSOR_CHECK, En_Alarm_List.AL_0618_LD_TRAY_OUT_STACKER_4_FWD_SENSOR_CHECK, En_Alarm_List.AL_0619_LD_TRAY_OUT_STACKER_1_BWD_SENSOR_CHECK, En_Alarm_List.AL_0620_LD_TRAY_OUT_STACKER_2_BWD_SENSOR_CHECK, En_Alarm_List.AL_0621_LD_TRAY_OUT_STACKER_3_BWD_SENSOR_CHECK, En_Alarm_List.AL_0622_LD_TRAY_OUT_STACKER_4_BWD_SENSOR_CHECK);
|
|
MotorZ.Check_Jog_Interlock = Jog_Interlock;
|
MotorZ.Check_Move_Interlock = Move_Interlock;
|
}
|
#endregion
|
|
#region Function
|
private bool Move_Interlock()
|
{
|
if (equipment.User.Level != En_User_Level.Master && equipment.Door_Opened)
|
{
|
return true;
|
}
|
|
return false;
|
}
|
|
private bool Jog_Interlock(bool positive)
|
{
|
if (equipment.User.Level != En_User_Level.Master && equipment.Door_Opened)
|
{
|
return true;
|
}
|
|
return false;
|
}
|
|
public void Init_Seq()
|
{
|
if (Step < LiftOutSteps.S2000_TRAY_UNLOADING_START || LiftOutSteps.S2999_TRAY_UNLOADING_END < Step)
|
Step = LiftOutSteps.S0000_WAIT;
|
|
_homeStep = LiftHomeSteps.S0000_WAIT;
|
}
|
|
public void ExecuteAuto()
|
{
|
if (IsWorkEnd)
|
{
|
if(equipment.LoaderOutTrayCount >= equipment.Cur_Main_Recipe.tray_info.LD_Tray_Empty_Tray_Count)
|
{
|
if (IsStayPosition == false)
|
{
|
Step = LiftOutSteps.S2000_TRAY_UNLOADING_START;
|
}
|
}
|
else
|
{
|
if(equipment.loader.ConveyorOut.IsWorkEnd)
|
{
|
if (equipment.loader.ConveyorOut.IsLiftInSensor == false && equipment.loader.ConveyorOut.IsLiftInCompleteSensor == false)
|
{
|
if (equipment.LoaderInTrayCount == 0)
|
{
|
Step = LiftOutSteps.S1000_LIFT_MOVE_START;
|
}
|
else
|
{
|
if(equipment.loader.TrayTransfer.IsWorkEnd)
|
{
|
Step = LiftOutSteps.S1000_LIFT_MOVE_START;
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
|
public override void MonitoringStatus()
|
{
|
if (equipment.User.Level != En_User_Level.Master && equipment.Door_Opened)
|
{
|
if (MotorZ.MotionComplete == false)
|
{
|
MotorZ.Move_Stop();
|
}
|
}
|
}
|
|
public override void ExecuteStep()
|
{
|
if (_oldStep != Step)
|
{
|
sequenceChangedTime.Restart();
|
_oldStep = Step;
|
WriteSequenceLog(Step.ToString());
|
}
|
|
AlignerTop.ExecuteProcess();
|
Clamper.ExecuteProcess();
|
Stacker.ExecuteProcess();
|
|
//상시 Run.
|
if (UnitMode != En_Equipment_Mode.Home)
|
{
|
UnloadingTray();
|
}
|
|
if (UnitMode == En_Equipment_Mode.Stop)
|
{
|
Init_Seq();
|
isHomeComplete = false;
|
return;
|
}
|
else if (UnitMode == En_Equipment_Mode.Pause)
|
{
|
sequenceChangedTime.Stop();
|
|
return;
|
}
|
else if (UnitMode == En_Equipment_Mode.Home)
|
{
|
if(!IsHomeComplete)
|
{
|
ExecuteHome();
|
}
|
|
return;
|
}
|
if (UnitMode == En_Equipment_Mode.Auto || UnitMode == En_Equipment_Mode.Manual)
|
{
|
sequenceChangedTime.Start();
|
|
if (equipment.equip_mode == En_Equipment_Mode.Pause)
|
{
|
if (pauseDisableList.Contains(Step) == false)
|
{
|
UnitMode = En_Equipment_Mode.Pause;
|
return;
|
}
|
}
|
|
if (UnitMode == En_Equipment_Mode.Auto)
|
{
|
ExecuteAuto();
|
}
|
|
LoadingTray();
|
}
|
}
|
|
public void ExecuteHome()
|
{
|
switch (_homeStep)
|
{
|
case LiftHomeSteps.S0000_WAIT:
|
{
|
_homeStep = LiftHomeSteps.S1000_STATUS_CHECK;
|
break;
|
}
|
case LiftHomeSteps.S1000_STATUS_CHECK:
|
{
|
if (MotorZ.ErrorStop)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0131_LD_TRAT_OUT_LIFT_Z_ERROR_STOP);
|
}
|
else if (!MotorZ.PowerOn)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0130_LD_TRAT_OUT_LIFT_Z_POWER_OFF);
|
}
|
else
|
{
|
_homeStep = LiftHomeSteps.S1100_CONVEYOR_HOME_CHECK;
|
}
|
break;
|
}
|
case LiftHomeSteps.S1100_CONVEYOR_HOME_CHECK:
|
{
|
if (equipment.loader.ConveyorOut.IsHomeComplete)
|
{
|
_homeStep = LiftHomeSteps.S1110_CONVEYOR_LIFT_SENSOR_CHECK;
|
}
|
break;
|
}
|
case LiftHomeSteps.S1110_CONVEYOR_LIFT_SENSOR_CHECK:
|
{
|
if (equipment.loader.ConveyorOut.IsLiftInSensor || equipment.loader.ConveyorOut.IsLiftInCompleteSensor)
|
{
|
if (equipment.loader.ConveyorOut.IsLiftInSensor)
|
{
|
Interlock_Manager.Add_Interlock_Msg("LD Tray Out Lift Home can't run.", "Conveyor in sensor detected.");
|
}
|
|
if (equipment.loader.ConveyorOut.IsLiftInCompleteSensor)
|
{
|
Interlock_Manager.Add_Interlock_Msg("LD Tray Out Lift Home can't run.", "Conveyor in complete sensor detected.");
|
}
|
}
|
else
|
{
|
_homeStep = LiftHomeSteps.S1200_MOTOR_Z_HOME;
|
}
|
break;
|
}
|
case LiftHomeSteps.S1200_MOTOR_Z_HOME:
|
{
|
if (MotorZ.Home())
|
{
|
homeCheckedTime.Restart();
|
_homeStep = LiftHomeSteps.S1205_MOTOR_Z_HOME_CHECK;
|
}
|
break;
|
}
|
case LiftHomeSteps.S1205_MOTOR_Z_HOME_CHECK:
|
{
|
if (homeCheckedTime.Seconds < 1) return;
|
|
if (!MotorZ.IsHomed)
|
{
|
if (MotorZ.Homing == false && MotorZ.ErrorStop)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0131_LD_TRAT_OUT_LIFT_Z_ERROR_STOP);
|
}
|
}
|
else
|
{
|
_homeStep = LiftHomeSteps.S1300_MOVE_STAY_POSITION;
|
}
|
break;
|
}
|
case LiftHomeSteps.S1300_MOVE_STAY_POSITION:
|
{
|
if (MoveStayPosition())
|
{
|
homeCheckedTime.Restart();
|
_homeStep = LiftHomeSteps.S1305_POSITION_CHECK;
|
}
|
break;
|
}
|
case LiftHomeSteps.S1305_POSITION_CHECK:
|
{
|
if (homeCheckedTime.Seconds < 1) return;
|
|
if (MotorZ.ErrorStop)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0131_LD_TRAT_OUT_LIFT_Z_ERROR_STOP);
|
}
|
else if (MotorZ.MotionComplete)
|
{
|
if (IsStayPosition)
|
{
|
_homeStep = LiftHomeSteps.S9999_END;
|
}
|
else
|
{
|
Interlock_Manager.Add_Interlock_Msg("LD Tray Out Lift Home can't run.", "Position is not wait.");
|
}
|
}
|
break;
|
}
|
case LiftHomeSteps.S9999_END:
|
{
|
isHomeComplete = true;
|
_homeStep = LiftHomeSteps.S0000_WAIT;
|
break;
|
}
|
}
|
}
|
|
public void LoadingTray()
|
{
|
switch (Step)
|
{
|
case LiftOutSteps.S1000_LIFT_MOVE_START:
|
{
|
Step = LiftOutSteps.S1100_CONVEYOR_LIFT_SENSOR_CHECK;
|
break;
|
}
|
case LiftOutSteps.S1100_CONVEYOR_LIFT_SENSOR_CHECK:
|
{
|
if (equipment.loader.ConveyorOut.IsLiftInSensor || equipment.loader.ConveyorOut.IsLiftInCompleteSensor)
|
{
|
if (equipment.loader.ConveyorOut.IsLiftInSensor)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0592_LD_TRAY_OUT_CONVEYOR_LIFT_IN_SENSOR_CHECK);
|
}
|
|
if (equipment.loader.ConveyorOut.IsLiftInCompleteSensor)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0593_LD_TRAY_OUT_CONVEYOR_LIFT_IN_COMPLETE_SENSOR_CHECK);
|
}
|
}
|
else
|
{
|
Step = LiftOutSteps.S1110_TRAY_TRANSTER_POSITION_STAY_CHECK;
|
}
|
break;
|
}
|
case LiftOutSteps.S1110_TRAY_TRANSTER_POSITION_STAY_CHECK:
|
{
|
if (equipment.loader.TrayTransfer.IsStayPosition)
|
{
|
Step = LiftOutSteps.S1200_ALIGN_TOP_BACKWARD;
|
}
|
else
|
{
|
Interlock_Manager.Add_Interlock_Msg("LD Tray Out Lift Loading can't run.", "LD Tray X is not empty position.");
|
}
|
break;
|
}
|
case LiftOutSteps.S1200_ALIGN_TOP_BACKWARD:
|
{
|
if (AlignerTop.IsWorkEnd)
|
{
|
if (AlignerTop.IsBackward)
|
{
|
Step = LiftOutSteps.S1210_STACKER_BACKWARD;
|
}
|
else
|
{
|
AlignerTop.Backward();
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S1210_STACKER_BACKWARD:
|
{
|
if (Stacker.IsWorkEnd)
|
{
|
if (Stacker.IsBackward)
|
{
|
Step = LiftOutSteps.S1220_UNCLAMP;
|
}
|
else
|
{
|
Stacker.Backward();
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S1220_UNCLAMP:
|
{
|
if (Clamper.IsWorkEnd)
|
{
|
if (Clamper.IsUnclamp)
|
{
|
Step = LiftOutSteps.S1300_LIFT_MOVE;
|
}
|
else
|
{
|
Clamper.Unclamp();
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S1300_LIFT_MOVE:
|
{
|
if (MoveTrayInPosition(TrayWaitPosition))
|
{
|
Step = LiftOutSteps.S1305_LIFT_MOVE_CHECK;
|
}
|
break;
|
}
|
case LiftOutSteps.S1305_LIFT_MOVE_CHECK:
|
{
|
if (sequenceChangedTime.Seconds < 0.5) return;
|
|
if (IsLiftLimitSensor1 || IsLiftLimitSensor2)
|
{
|
if (MotorZ.Move_Stop())
|
{
|
if (IsLiftLimitSensor1)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0603_LD_TRAY_OUT_LIFT_UP_1_1_SENSOR_CHECK);
|
}
|
|
if (IsLiftLimitSensor2)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0604_LD_TRAY_OUT_LIFT_UP_1_2_SENSOR_CHECK);
|
}
|
//Step = LiftOutSteps.S1440_TRAY_SCRAP_CHECK;
|
|
return;
|
}
|
}
|
else if (MotorZ.MotionComplete)
|
{
|
if (MotorZ.Is_Inposition(TrayWaitPosition, equipment.Setting.Inposition_Offset))
|
{
|
if(IsLiftInSensor1 || IsLiftInSensor2)
|
{
|
if (IsLiftInSensor1)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0605_LD_TRAY_OUT_LIFT_UP_2_1_SENSOR_CHECK);
|
}
|
|
if (IsLiftInSensor2)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0606_LD_TRAY_OUT_LIFT_UP_2_2_SENSOR_CHECK);
|
}
|
}
|
else
|
{
|
Step = LiftOutSteps.S1310_ALIGN_TOP_FORWARD;
|
}
|
}
|
else
|
{
|
Interlock_Manager.Add_Interlock_Msg("LD Tray Empty Lift Loading can't run.", $"LD Tray Lift is not up position({TrayWaitPosition}).");
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S1310_ALIGN_TOP_FORWARD:
|
{
|
if (AlignerTop.IsWorkEnd)
|
{
|
if (AlignerTop.IsForward)
|
{
|
Step = LiftOutSteps.S1320_CLAMP;
|
}
|
else
|
{
|
AlignerTop.Forward();
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S1320_CLAMP:
|
{
|
if (Clamper.IsWorkEnd)
|
{
|
if (Clamper.IsClamp)
|
{
|
Step = LiftOutSteps.S1400_TRAY_TRANSFER_PLACE_WAIT;
|
}
|
else
|
{
|
Clamper.Clamp();
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S1400_TRAY_TRANSFER_PLACE_WAIT:
|
{
|
if(equipment.LoaderOutTrayCount != _trayCount)
|
{
|
if (equipment.LoaderOutTrayCount == 1)
|
{
|
IsFirstTray = true;
|
}
|
|
_pitchPosition = 0;
|
|
if (IsLiftInSensor1 && IsLiftInSensor2)
|
{
|
Step = LiftOutSteps.S1410_LIFT_PITCH_DOWN;
|
}
|
else
|
{
|
Step = LiftOutSteps.S1420_LIFT_PITCH_UP;
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S1410_LIFT_PITCH_DOWN:
|
{
|
if (Math.Abs(_pitchPosition) > equipment.Setting.Tray_Alarm_Range)
|
{
|
_pitchPosition = 0;
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0951_LD_TRAY_EMPTY_PITCH_RANGE_ALARM);
|
|
//Step = LiftOutSteps.S1440_TRAY_SCRAP_CHECK;
|
}
|
else
|
{
|
_pitchPosition -= equipment.Setting.Tray_Move_Pitch;
|
|
MoveTrayInPosition(TrayInPosition + _pitchPosition);
|
Step = LiftOutSteps.S1415_LIFT_PITCH_DOWN_CHECK;
|
}
|
break;
|
}
|
case LiftOutSteps.S1415_LIFT_PITCH_DOWN_CHECK:
|
{
|
if (sequenceChangedTime.Seconds < 0.5) return;
|
|
if (MotorZ.MotionComplete)
|
{
|
if (MotorZ.Is_Inposition(TrayInPosition + _pitchPosition, equipment.Setting.Inposition_Offset))
|
{
|
if(IsLiftInSensor1 && IsLiftInSensor2)
|
{
|
Step = LiftOutSteps.S1410_LIFT_PITCH_DOWN;
|
}
|
else
|
{
|
Step = LiftOutSteps.S1420_LIFT_PITCH_UP;
|
}
|
}
|
else
|
{
|
Interlock_Manager.Add_Interlock_Msg("LD Tray Out Lift Down can't run.", $"LD Tray Out Lift is not down position({TrayInPosition + _pitchPosition}).");
|
Step = LiftOutSteps.S1410_LIFT_PITCH_DOWN;
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S1420_LIFT_PITCH_UP:
|
{
|
if (Math.Abs(_pitchPosition) > equipment.Setting.Tray_Alarm_Range)
|
{
|
_pitchPosition = 0;
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0951_LD_TRAY_EMPTY_PITCH_RANGE_ALARM);
|
|
//Step = LiftOutSteps.S1440_TRAY_SCRAP_CHECK;
|
}
|
else
|
{
|
_pitchPosition += equipment.Setting.Tray_Move_Pitch;
|
|
MoveTrayInPosition(TrayInPosition + _pitchPosition);
|
Step = LiftOutSteps.S1425_LIFT_PITCH_UP_CHECK;
|
}
|
break;
|
}
|
case LiftOutSteps.S1425_LIFT_PITCH_UP_CHECK:
|
{
|
if (sequenceChangedTime.Seconds < 0.5) return;
|
|
if (IsLiftLimitSensor1 || IsLiftLimitSensor2)
|
{
|
if (MotorZ.Move_Stop())
|
{
|
_pitchPosition = 0;
|
|
if (IsLiftLimitSensor1)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0603_LD_TRAY_OUT_LIFT_UP_1_1_SENSOR_CHECK);
|
}
|
|
if (IsLiftLimitSensor2)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0604_LD_TRAY_OUT_LIFT_UP_1_2_SENSOR_CHECK);
|
}
|
|
//Step = LiftOutSteps.S1440_TRAY_SCRAP_CHECK;
|
|
return;
|
}
|
}
|
|
if (MotorZ.MotionComplete)
|
{
|
if (MotorZ.Is_Inposition(TrayInPosition + _pitchPosition, equipment.Setting.Inposition_Offset))
|
{
|
if (IsLiftInSensor1 && IsLiftInSensor2)
|
{
|
Step = LiftOutSteps.S1430_LIFT_PITCH_LAST_UP;
|
}
|
else
|
{
|
Step = LiftOutSteps.S1420_LIFT_PITCH_UP;
|
}
|
}
|
else
|
{
|
Interlock_Manager.Add_Interlock_Msg("LD Tray Out Lift Down can't run.", $"LD Tray Out Lift is not down position({TrayInPosition + _pitchPosition}).");
|
Step = LiftOutSteps.S1420_LIFT_PITCH_UP;
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S1430_LIFT_PITCH_LAST_UP:
|
{
|
_pitchPosition += equipment.Setting.LD_Empty_Tray_Move_Last_Pitch;
|
|
MoveTrayInPosition(TrayInPosition + _pitchPosition);
|
Step = LiftOutSteps.S1435_LIFT_PITCH_LAST_UP_CHECK;
|
break;
|
}
|
case LiftOutSteps.S1435_LIFT_PITCH_LAST_UP_CHECK:
|
{
|
if (sequenceChangedTime.Seconds < 0.5) return;
|
|
if (MotorZ.MotionComplete)
|
{
|
if (MotorZ.Is_Inposition(TrayInPosition + _pitchPosition, equipment.Setting.Inposition_Offset))
|
{
|
if (IsLiftInSensor1 && IsLiftInSensor2)
|
{
|
_trayCount = equipment.LoaderOutTrayCount;
|
Step = LiftOutSteps.S1500_CLAMP;
|
}
|
else
|
{
|
if (!IsLiftInSensor1)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0565_LD_TRAY_IN_LIFT_UP_2_1_SENSOR_CHECK);
|
}
|
|
if (!IsLiftInSensor2)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0566_LD_TRAY_IN_LIFT_UP_2_2_SENSOR_CHECK);
|
}
|
|
_pitchPosition = 0;
|
//Step = LiftOutSteps.S1440_TRAY_SCRAP_CHECK;
|
}
|
}
|
else
|
{
|
Interlock_Manager.Add_Interlock_Msg("LD Tray Out Lift Down can't run.", $"LD Tray Out Lift is not down position({TrayInPosition + _pitchPosition}).");
|
Step = LiftOutSteps.S1430_LIFT_PITCH_LAST_UP;
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S1440_TRAY_SCRAP_CHECK:
|
{
|
Step = LiftOutSteps.S0000_WAIT;
|
break;
|
}
|
case LiftOutSteps.S1500_CLAMP:
|
{
|
if (Clamper.IsWorkEnd)
|
{
|
if (Clamper.IsClamp)
|
{
|
Step = LiftOutSteps.S1510_ALIGN_TOP_FORWARD;
|
}
|
else
|
{
|
Clamper.Clamp();
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S1510_ALIGN_TOP_FORWARD:
|
{
|
if (AlignerTop.IsWorkEnd)
|
{
|
if (AlignerTop.IsForward)
|
{
|
Step = LiftOutSteps.S1600_TRAY_PANEL_DATA_SET;
|
}
|
else
|
{
|
AlignerTop.Forward();
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S1600_TRAY_PANEL_DATA_SET:
|
{
|
Step = LiftOutSteps.S1605_TRAY_PANEL_DATA_SET_CHECK;
|
break;
|
}
|
case LiftOutSteps.S1605_TRAY_PANEL_DATA_SET_CHECK:
|
{
|
if (equipment.cim_mode == En_Cim_Mode.Online)
|
{
|
//if (IsFirstTray)
|
//{
|
// IsFirstTray = false;
|
// Step = LiftOutSteps.S1610_PORT_STATUS_CIM_SEND;
|
//}
|
//else
|
//{
|
// Step = LiftOutSteps.S1620_PANEL_IN_DATA_CIM_SEND;
|
//}
|
if (IsFirstTray)
|
{
|
IsFirstTray = false;
|
}
|
|
Step = LiftOutSteps.S1620_PANEL_IN_DATA_CIM_SEND;
|
}
|
else
|
{
|
if (IsFirstTray)
|
{
|
IsFirstTray = false;
|
}
|
|
Step = LiftOutSteps.S1999_LIFT_MOVE_END;
|
}
|
break;
|
}
|
case LiftOutSteps.S1610_PORT_STATUS_CIM_SEND:
|
{
|
if (equipment.cim_mode != En_Cim_Mode.Online)
|
{
|
Step = LiftOutSteps.S1999_LIFT_MOVE_END;
|
return;
|
}
|
|
if (equipment.cim_client.Send_Port_Status("E12345678", En_Port_ID.P02, En_Tray_Code.P, true, En_Port_Status.CMP, TrayID))
|
{
|
Step = LiftOutSteps.S1615_PORT_STATUS_CIM_SEND_CHECK;
|
}
|
break;
|
}
|
case LiftOutSteps.S1615_PORT_STATUS_CIM_SEND_CHECK:
|
{
|
if (equipment.cim_mode != En_Cim_Mode.Online)
|
{
|
Step = LiftOutSteps.S1999_LIFT_MOVE_END;
|
return;
|
}
|
|
if (equipment.cim_client.Get_Command_Ack(En_Cim_Command.PTSTR))
|
{
|
if (equipment.cim_client.Get_Command_Result(En_Cim_Command.PTSTR))
|
{
|
Step = LiftOutSteps.S1620_PANEL_IN_DATA_CIM_SEND;
|
}
|
else
|
{
|
Step = LiftOutSteps.S1610_PORT_STATUS_CIM_SEND;
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S1620_PANEL_IN_DATA_CIM_SEND:
|
{
|
if (equipment.cim_mode != En_Cim_Mode.Online)
|
{
|
Step = LiftOutSteps.S1999_LIFT_MOVE_END;
|
return;
|
}
|
|
if (equipment.cim_client.Send_Panel_Tray_In("E123456", TrayID, "", "", En_Port_ID.P02))
|
{
|
Step = LiftOutSteps.S1625_PANEL_IN_DATA_CIM_SEND_CHECK;
|
}
|
break;
|
}
|
case LiftOutSteps.S1625_PANEL_IN_DATA_CIM_SEND_CHECK:
|
{
|
if (equipment.cim_mode != En_Cim_Mode.Online)
|
{
|
Step = LiftOutSteps.S1999_LIFT_MOVE_END;
|
return;
|
}
|
|
if (equipment.cim_client.Get_Command_Ack(En_Cim_Command.PTINR))
|
{
|
if (equipment.cim_client.Get_Command_Result(En_Cim_Command.PTINR))
|
{
|
Step = LiftOutSteps.S1999_LIFT_MOVE_END;
|
}
|
else
|
{
|
Step = LiftOutSteps.S1620_PANEL_IN_DATA_CIM_SEND;
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S1999_LIFT_MOVE_END:
|
{
|
Step = LiftOutSteps.S0000_WAIT;
|
break;
|
}
|
}
|
}
|
|
public void UnloadingTray()
|
{
|
switch (Step)
|
{
|
case LiftOutSteps.S2000_TRAY_UNLOADING_START:
|
{
|
if (equipment.cim_mode == En_Cim_Mode.Online)
|
{
|
Step = LiftOutSteps.S2100_PANEL_REPORT_CIM_SEND;
|
}
|
else
|
{
|
Step = LiftOutSteps.S2200_UNCLAMP;
|
}
|
break;
|
}
|
case LiftOutSteps.S2100_PANEL_REPORT_CIM_SEND:
|
{
|
if (equipment.cim_mode != En_Cim_Mode.Online)
|
{
|
Step = LiftOutSteps.S2200_UNCLAMP;
|
return;
|
}
|
|
if (equipment.cim_client.Send_Panel_Form_Report("E12345678", TrayID, En_Port_ID.P02))
|
{
|
Step = LiftOutSteps.S2105_PANEL_REPORT_CIM_SEND_WAIT;
|
}
|
break;
|
}
|
case LiftOutSteps.S2105_PANEL_REPORT_CIM_SEND_WAIT:
|
{
|
if (equipment.cim_mode != En_Cim_Mode.Online)
|
{
|
Step = LiftOutSteps.S2200_UNCLAMP;
|
return;
|
}
|
|
if (equipment.cim_client.Get_Command_Ack(En_Cim_Command.PCMRT))
|
{
|
if (equipment.cim_client.Get_Command_Result(En_Cim_Command.PCMRT))
|
{
|
Step = LiftOutSteps.S2110_PORT_STATUS_CIM_SEND;
|
}
|
else
|
{
|
Step = LiftOutSteps.S2100_PANEL_REPORT_CIM_SEND;
|
}
|
}
|
|
break;
|
}
|
case LiftOutSteps.S2110_PORT_STATUS_CIM_SEND:
|
{
|
if (equipment.cim_mode != En_Cim_Mode.Online)
|
{
|
Step = LiftOutSteps.S2200_UNCLAMP;
|
return;
|
}
|
|
if (equipment.cim_client.Send_Port_Status("E12345678", En_Port_ID.P02, En_Tray_Code.P, true, En_Port_Status.CMP, TrayID))
|
{
|
Step = LiftOutSteps.S2115_PORT_STATUS_CIM_SEND_WAIT;
|
}
|
break;
|
}
|
case LiftOutSteps.S2115_PORT_STATUS_CIM_SEND_WAIT:
|
{
|
if (equipment.cim_mode != En_Cim_Mode.Online)
|
{
|
Step = LiftOutSteps.S2200_UNCLAMP;
|
return;
|
}
|
|
if (equipment.cim_client.Get_Command_Ack(En_Cim_Command.PTSTR))
|
{
|
if (equipment.cim_client.Get_Command_Result(En_Cim_Command.PTSTR))
|
{
|
Step = LiftOutSteps.S2200_UNCLAMP;
|
}
|
else
|
{
|
Step = LiftOutSteps.S2110_PORT_STATUS_CIM_SEND;
|
}
|
}
|
|
break;
|
}
|
case LiftOutSteps.S2200_UNCLAMP:
|
{
|
if (Clamper.IsWorkEnd)
|
{
|
if (Clamper.IsUnclamp)
|
{
|
Step = LiftOutSteps.S2210_STACKER_BACKWARD;
|
}
|
else
|
{
|
Clamper.Unclamp();
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S2210_STACKER_BACKWARD:
|
{
|
if (Stacker.IsWorkEnd)
|
{
|
if (Stacker.IsBackward)
|
{
|
Step = LiftOutSteps.S2220_ALIGN_TOP_BACKWARD;
|
}
|
else
|
{
|
Stacker.Backward();
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S2220_ALIGN_TOP_BACKWARD:
|
{
|
if (AlignerTop.IsWorkEnd)
|
{
|
if (AlignerTop.IsBackward)
|
{
|
Step = LiftOutSteps.S2300_CONVEYOR_LIFT_SENSOR_CHECK;
|
}
|
else
|
{
|
AlignerTop.Backward();
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S2300_CONVEYOR_LIFT_SENSOR_CHECK:
|
{
|
if (equipment.loader.ConveyorOut.IsLiftInSensor || equipment.loader.ConveyorOut.IsLiftInCompleteSensor)
|
{
|
if(equipment.loader.ConveyorOut.IsLiftInSensor)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0592_LD_TRAY_OUT_CONVEYOR_LIFT_IN_SENSOR_CHECK);
|
}
|
|
if (equipment.loader.ConveyorOut.IsLiftInCompleteSensor)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0593_LD_TRAY_OUT_CONVEYOR_LIFT_IN_COMPLETE_SENSOR_CHECK);
|
}
|
}
|
else
|
{
|
Step = LiftOutSteps.S2310_ALIGN_Y_FORWARD;
|
}
|
break;
|
}
|
case LiftOutSteps.S2310_ALIGN_Y_FORWARD:
|
{
|
if (equipment.loader.ConveyorOut.AlignerY.IsWorkEnd)
|
{
|
if(equipment.loader.ConveyorOut.AlignerY.IsForward)
|
{
|
Step = LiftOutSteps.S2320_ALIGN_X_BACKWARD;
|
}
|
else
|
{
|
equipment.loader.ConveyorOut.AlignerY.Forward();
|
}
|
}
|
|
break;
|
}
|
case LiftOutSteps.S2320_ALIGN_X_BACKWARD:
|
{
|
if (equipment.loader.ConveyorOut.AlignerX.IsWorkEnd)
|
{
|
if (equipment.loader.ConveyorOut.AlignerX.IsBackward)
|
{
|
Step = LiftOutSteps.S2400_LIFT_DOWN;
|
}
|
else
|
{
|
equipment.loader.ConveyorOut.AlignerX.Backward();
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S2400_LIFT_DOWN:
|
{
|
if (MoveStayPosition())
|
{
|
Step = LiftOutSteps.S2405_LIFT_DOWN_CHECK;
|
}
|
break;
|
}
|
case LiftOutSteps.S2405_LIFT_DOWN_CHECK:
|
{
|
if (sequenceChangedTime.Seconds < 0.5) return;
|
|
if (MotorZ.MotionComplete)
|
{
|
if (IsStayPosition)
|
{
|
if (equipment.loader.ConveyorOut.IsLiftInSensor || equipment.loader.ConveyorOut.IsLiftInCompleteSensor)
|
{
|
Step = LiftOutSteps.S2420_CONVEYOR_UNLOAD;
|
}
|
else
|
{
|
Step = LiftOutSteps.S2500_PORT_STATUS_CIM_SEND;
|
}
|
}
|
else
|
{
|
Interlock_Manager.Add_Interlock_Msg("LD Tray Out Lift Unloading can't run.", $"Lift is not wait position.");
|
Step = LiftOutSteps.S2400_LIFT_DOWN;
|
}
|
}
|
break;
|
}
|
case LiftOutSteps.S2420_CONVEYOR_UNLOAD:
|
{
|
equipment.loader.ConveyorOut.Unload();
|
Step = LiftOutSteps.S2425_CONVEYOR_UNLOAD_CHECK;
|
|
break;
|
}
|
case LiftOutSteps.S2425_CONVEYOR_UNLOAD_CHECK:
|
{
|
if (equipment.loader.ConveyorOut.IsWorkEnd)
|
{
|
_trayCount = 0;
|
if (equipment.cim_mode == En_Cim_Mode.Online)
|
{
|
Step = LiftOutSteps.S2500_PORT_STATUS_CIM_SEND;
|
}
|
else
|
{
|
Step = LiftOutSteps.S2999_TRAY_UNLOADING_END;
|
}
|
}
|
|
break;
|
}
|
case LiftOutSteps.S2500_PORT_STATUS_CIM_SEND:
|
{
|
if (equipment.cim_mode != En_Cim_Mode.Online)
|
{
|
Step = LiftOutSteps.S2999_TRAY_UNLOADING_END;
|
return;
|
}
|
|
if (equipment.cim_client.Send_Port_Status("E12345678", En_Port_ID.P02, En_Tray_Code.P, true, En_Port_Status.EMP))
|
{
|
Step = LiftOutSteps.S2505_PORT_STATUS_CIM_SEND_CHECK;
|
}
|
break;
|
}
|
case LiftOutSteps.S2505_PORT_STATUS_CIM_SEND_CHECK:
|
{
|
if (equipment.cim_mode != En_Cim_Mode.Online)
|
{
|
Step = LiftOutSteps.S2999_TRAY_UNLOADING_END;
|
return;
|
}
|
|
if (equipment.cim_client.Get_Command_Ack(En_Cim_Command.PTSTR))
|
{
|
if (equipment.cim_client.Get_Command_Result(En_Cim_Command.PTSTR))
|
{
|
Step = LiftOutSteps.S2999_TRAY_UNLOADING_END;
|
}
|
else
|
{
|
Step = LiftOutSteps.S2500_PORT_STATUS_CIM_SEND;
|
}
|
}
|
|
break;
|
}
|
case LiftOutSteps.S2999_TRAY_UNLOADING_END:
|
{
|
equipment.LoaderOutTrayCount = 0;
|
Step = LiftOutSteps.S0000_WAIT;
|
break;
|
}
|
}
|
}
|
|
public bool MoveStayPosition()
|
{
|
object value;
|
double position;
|
double velocity;
|
equipment.sm.Get_Value(Position_Parameter_Address.LD_Tray_Empty_Z_Wait_Position, out value);
|
position = double.Parse($"{value}");
|
equipment.sm.Get_Value(Position_Parameter_Address.LD_Tray_Empty_Z_Wait_Velocity, out value);
|
velocity = double.Parse($"{value}");
|
|
return MotorZ.Move_Absolute_Pos(position, velocity);
|
}
|
|
public bool MoveTrayInPosition(double position)
|
{
|
object value;
|
double velocity;
|
|
equipment.sm.Get_Value(Position_Parameter_Address.LD_Tray_Empty_Z_Process_Velocity, out value);
|
velocity = double.Parse($"{value}");
|
|
return MotorZ.Move_Absolute_Pos(position, velocity);
|
}
|
|
public bool Unload()
|
{
|
if (equipment.loader.TrayTransfer.IsWorkEnd || Step == LiftOutSteps.S1400_TRAY_TRANSFER_PLACE_WAIT)
|
{
|
Step = LiftOutSteps.S2000_TRAY_UNLOADING_START;
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
#endregion
|
}
|
}
|