XScript 매뉴얼 · Chapter 11

title: "Cylinder — 실린더 제어 객체" chapter: 11

Cylinder — 실린더 제어 객체

CYL["이름"] 으로 접근하는 공압/유압 실린더 제어 객체입니다. Cylinder Editor 에서 Action A / Action B 솔레노이드·센서를 등록하면, 스크립트에서 의미적 메서드 (Up/Down, Forward/Backward, Clamp/UnClamp …) 로 호출할 수 있습니다.

기본 예제

if (CYL["Cyl_InStopper"].Push(true) == false)
{
    // ERROR — 센서 체크 실패
}
else
{
    // SUCCESS
}
 
if (CYL["Cyl_InStopper"].Pull(true) == false)
{
    // ERROR
}

실전 예제 — 판넬 클램프 시퀀스

Gaon Stage.xms 에서 추출한 실제 코드. Post Pin 다운 → 판넬 클램프 → Vac 흡착 → Spindle Fix 해제 순서의 인터락 처리 패턴입니다.

FUNCTION PanelClamp()
{
    if (IO["I_PanelClampL"] && IO["I_PanelClampR"]
        && IO["I_PostPinDownF"] && IO["I_PostPinDownR"])
    {
        DeviceClampCompleteFlag = true;
        return true;
    }
 
    if (CYL["Cyl_PostPin"].Down(true) == false)
    {
        CYL["Cyl_PostPin"].ShowCylinderError(ModuleName);
        return false;
    }
    Sleep(100);
 
    if (CYL["Cyl_PanelClamp"].Clamp(true) == false)
    {
        CYL["Cyl_SpindleFix"].ShowCylinderError(ModuleName);
        return false;
    }
    Sleep(SS.ClampAfterDelay);
 
    if (SS.UseStageVac)
    {
        if (CYL["Cyl_StageVac"].Suck(true) == false)
        {
            CYL["Cyl_StageVac"].Off();
            CYL["Cyl_PanelClamp"].UnClamp(true);
            ShowError(EB_Reset, 208, "");
            return false;
        }
    }
 
    // Fix 실린더 후진
    if (CYL["Cyl_SpindleFix"].Backward(true) == false)
    {
        CYL["Cyl_SpindleFix"].ShowCylinderError(ModuleName);
        return false;
    }
 
    DeviceClampCompleteFlag = true;
    return true;
}

액션 메서드

모든 액션 메서드는 공통 규칙을 따릅니다.

  • wait == true 시 센서 체크 완료까지 대기. 하나라도 꺼져 있으면 false 반환.
  • wait == false 시 솔레노이드만 출력하고 즉시 반환.

Action A / Action B (의미 쌍)

A 동작B 동작용도
Open(wait)Close(wait)개폐
Up(wait)Down(wait)상승·하강
Left(wait)Right(wait)좌우
Forward(wait)Backward(wait)전후진
Lock(wait)Unlock(wait)잠금
Suck(wait)Eject(wait)흡착·배출
Push(wait)Pull(wait)밀기·당기기
Clamp(wait)UnClamp(wait)클램프
Turn(wait)Return(wait)회전·복귀
Pass(wait)통과(단일 방향)
Toggle(wait)현재 상태 반전

기타

시그니처설명
bool Stop(bool wait)중립 정지
bool Off(void)출력 OFF (센서 체크 없음)
bool ReadSensorA(void) / bool ReadSensorB(void)현재 센서 상태

프로퍼티

프로퍼티설명
Name / Description / GroupName메타 정보
TimeOutA / TimeOutB센서 체크 타임아웃 (ms)
DelayA / DelayB동작 후 지연 (ms)
SubModel실린더 서브 모델
SolIndexA1..A4 / SolIndexB1..B4솔레노이드 인덱스
SensorIndexA1..A4 / SensorIndexB1..B4센서 인덱스
SolListA / SolListB / SensorListA / SensorListB솔/센서 이름 목록
Info현재 상태 문자열 (로그용)
ActionA / ActionBA/B 액션 라벨

에러 표시

에러 대화상자는 ShowCylinderError() 유틸을 사용하면, 실린더 이름·센서 상태· 타임아웃 값을 자동 구성해 표시합니다.

if (CYL["Cyl_PanelClamp"].Clamp(true) == false)
{
    CYL["Cyl_PanelClamp"].ShowCylinderError(ModuleName);
    return false;
}

  • 공압 계열은 센서 위치 공차가 커서 TimeOutA/B 를 여유 있게(기본 1500 ms+) 잡기.
  • 연속 동작 사이에는 Sleep(100~200)압력 안정화 여유를 줄 것.
  • 같은 실린더에 대해 A/B 를 연속 호출할 때 센서 중첩 상태가 풀릴 때까지 대기 필요 시 Off() 로 중립 후 반대 방향 호출.