XScript Manual · Chapter 11

title: "Cylinder — pneumatic actuator" chapter: 11

Cylinder — pneumatic actuator

CYL["name"] accesses a pneumatic/hydraulic cylinder defined in the Cylinder Editor. Action A / B solenoids and sensors are registered once, then invoked with semantic methods (Up/Down, Forward/Backward, Clamp/UnClamp, …).

Basic example

if (CYL["Cyl_InStopper"].Push(true) == false)
{
    // ERROR — sensor check failed
}
else
{
    // SUCCESS
}
 
if (CYL["Cyl_InStopper"].Pull(true) == false)
{
    // ERROR
}

Real-world — panel clamp sequence

Adapted from Stage.xms: post-pin down → panel clamp → vacuum → release 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;
        }
    }
 
    if (CYL["Cyl_SpindleFix"].Backward(true) == false)
    {
        CYL["Cyl_SpindleFix"].ShowCylinderError(ModuleName);
        return false;
    }
 
    DeviceClampCompleteFlag = true;
    return true;
}

Action methods

Common rules:

  • wait == true — block until sensors confirm the action; return false if any required sensor fails to engage.
  • wait == false — fire the solenoid and return immediately.

Action A / Action B pairs

ABMeaning
Open(wait)Close(wait)Open / close
Up(wait)Down(wait)Raise / lower
Left(wait)Right(wait)Left / right
Forward(wait)Backward(wait)Forward / back
Lock(wait)Unlock(wait)Lock / unlock
Suck(wait)Eject(wait)Vacuum / release
Push(wait)Pull(wait)Push / pull
Clamp(wait)UnClamp(wait)Clamp
Turn(wait)Return(wait)Turn / return
Pass(wait)Single-direction pass
Toggle(wait)Flip current state

Misc

SignatureDescription
bool Stop(bool wait)Neutral stop
bool Off(void)Turn off output (no sensor check)
bool ReadSensorA(void) / bool ReadSensorB(void)Read sensor state

Properties

PropertyDescription
Name / Description / GroupNameMetadata
TimeOutA / TimeOutBSensor-check timeout (ms)
DelayA / DelayBPost-action delay (ms)
SubModelSub-model code
SolIndexA1..A4 / SolIndexB1..B4Solenoid indices
SensorIndexA1..A4 / SensorIndexB1..B4Sensor indices
SolListA / SolListB / SensorListA / SensorListBLists
InfoCurrent state (log-friendly string)
ActionA / ActionBAction labels

Error reporting

ShowCylinderError() auto-assembles a dialog showing cylinder name, sensor states, and timeout.

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

Tips

  • Pneumatic sensors have wide tolerance — keep TimeOutA/B generous (≥ 1500 ms).
  • Insert Sleep(100~200) between consecutive actions for pressure stabilization.
  • When A→B alternates rapidly, call Off() first to clear overlap.