Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TEXT VIEWER FOR RAPID

Status
Not open for further replies.

RAGEE

Electrical
Jan 7, 2003
12
0
0
AU
Hi all,

In this string I am posting the key & certificate for rapid programming language for use with crimson editor. I would also like to know if any body would like to exchange robot programs in an effort that we may all see some new ways of doing things. I,ll start it with a program for a Irb 6400 palletiser routine.


[-COMMENT-:GLOBAL]
# RAPID LANGUAGE SPECIFICATION FILE FOR CRIMSON EDITOR
# FIRST EDITED Kevin Day 22.07.02

[KEYWORDS0:GLOBAL]
MODULE
ENDMODULE
PROC
ENDPROC

[KEYWORDS1:GLOBAL]
robtarget
num
jointtarget
bool
tooldata
wobjdata
byte
clock
aiotrigg
confdata
errdomain
errnum
errtype
extjoint
intnum
iodev
loaddata
loadsession
mecunit
motsetdata
o_jointtarget
opnum
orient
o_robtarget
pos
pose
progdisp
robjoint
shapedata
signalxx
speeddata
stoppointdata
string
symnum
taskid
testsignal
tpnum
trapdata
triggdata
tunetype
wzstationary
WZtemporary
zonedata

[KEYWORDS2:GLOBAL]
AccSet
ActUnit
Add
AliasIO
Break
CallByVar
CancelLoad
Clear
ClearPath
ClearIOBuff
ClkReset
ClkStart
ClkStop
Close
ConfJ
ConfL
CONNECT
CirPathReori
DeactUnit
Decr
EOffsOff
EOffsOn
EOffsSet
ErrWrite
EXIT
ExitCycle
GetSysData
GetTrapData
GOTO
GripLoad
IDelete
IDisable
IEnable
IError
Incr
InvertDO
IODisable
IOEnable
ISignalAI
ISignalAO
ISignalDI
ISignalDO
ISleep
ITimer
IVarValue
IWatch
Load
MechUnitLoad
MoveAbsJ
MoveC
MoveCDO
MoveCSync
MoveJ
MoveJDO
MoveJSync
MoveL
MoveLDO
MoveLSync
Open
PathResol
PDispOff
PDispOn
PDispSet
PathAccLim
PulseDO
RAISE
ReadAnyBin
ReadErrData
Reset
RestoPath
RETRY
RETURN
Rewind
Save
SearchC
SearchL
Set
SetAO
SetDO
SetGO
SingArea
SkipWarn
SoftAct
SoftDeact
SpyStart
SpyStop
StartLoad
StartMove
Stop
StopMove
StorePath
TestSignDefine
TestSignReset
TPErase
TPReadFK
TPReadNUM
TPShow
TPWrite
TriggC
TriggCheckIO
TriggEquip
TriggInt
TriggIO
TriggL
TriggJ
TRYNEXT
TuneReset
TuneServo
UnLoad
WaitDI
WaitDO
WaitLoad
WarmStart
WaitTime
WaitUntil
VelSet
Write
WriteAnyBin
WriteBin
WriteStrBin
WZBoxDef
WZCylDef
WZDisable
WZDOSet
WZEnable
WZFree
WZLimSup
WZSphDef

[KEYWORDS3:GLOBAL]
Abs
ACos
AOutput
ASin
ATan
ATan2
ByteToStr
CalcJointT
CalcRobT
CDate
CJointT
ClkRead
Cos
CPos
CRotT
CTime
CTool
CWObj
DefDFrame
DefFrame
Dim
Distance
DotProd
DOutput
EulerZYX
Exp
FileTime
GOutpot
GetTime
IsPers
IsVar
MaxRobSpeed
MirPos
ModTime
NOrient
NumToStr
Offs
OpMode
OrientZYX
ORobT
PoseInv
PoseMult
PoseVect
Pow
Present
ReadBin
ReadMotor
ReadNum
ReadStr
ReadStrBin
Reltool
Round
Runmode
Sin
Sqrt
StrFind
StrLen
StrMap
StrMatch
StrMemb
StrOrder
StrPart
StrToByte
StrToVal
Tan
TestAndSet
TestDI
Trunc
TestSignRead
ValToStr
VectMagn

[KEYWORDS4:GLOBAL]
OR
AND
TRUE
FALSE

[KEYWORDS5:GLOBAL]
IF
ENDIF
THEN
ELSEIF
ELSE

[KEYWORDS6:GLOBAL]
WHILE
ENDWHILE
DO
FOR
FROM
TO
ENDFOR

[KEYWORDS7:GLOBAL]
CONST
PERS
VAR

[KEYWORDS8:GLOBAL]
TEST
ENDTEST
CASE
DEFAULT

[KEYWORDS9:GLOBAL]
WObj
Rx
Ry
Rz
MaxTime
TimeFlag
InPos
On
Off
RL2
RL3
RL4
W
Single
DPos
DNeg
Dynamic
File
Conc
V
T
Z
Corr
Read
Write
Append
Bin
ExeP
Rot
High
PLength
Time
Task
FilePath
Stop
PStop
SStop
Sup
Flanks
SDelay
Wrist
MechUnit
Ramp
NoRegain
DIBreak
BreakFlag
Start
Time
DOp
GOp
AOp
ProcID
Inhib
DODelay
T2
T3
T4
T5
T6
Type
NoNewLine
Temp
Stat
Inside
Before
Outside


# RAPID LANGUAGE SPECIFICATION FILE FOR CRIMSON EDITOR
# FIRST EDITED Kevin Day 22.07.02
# derived from PHP.SPC, Geert van Boven (g.vanboven@dignion.com or gvb@vbit.nl) 26 sept. 2001

$CASESENSITIVE=NO
$DELIMITERS=(){}[]<>+-*/%&quot;'~!@#&$^&|\?:=;,.
$KEYWORDPREFIX=
$QUOTATIONMARK1=&quot;
$QUOTATIONMARK2='
$LINECOMMENT=!
$PAIRS1=()
$PAIRS2=[]
$PAIRS3={}
$VARIABLEPREFIX=
$SHADOWON=[
$SHADOWOFF=]


%%%
VERSION:1
LANGUAGE:ENGLISH
%%%

MODULE P51_0709
CONST robtarget InterStn5:=[[-1568.02,1704.4,512.95],[0.370196,-0.917579,0.042943,-0.13842],[1,-1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p70:=[[1660.58,144.9,1636.85],[0.621451,-0.393809,0.362362,-0.572195],[0,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget SlipPlace6:=[[1728.93,95.03,420],[0.011104,-0.017464,0.707076,-0.706835],[0,-1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget SlipPlace5:=[[585.94,-1577.12,-25.83],[0.004628,-0.004528,-0.706966,0.707219],[-1,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget SlipPlace4:=[[-1580.53,1331.63,449.7],[0.707123,-0.706941,0.010223,-0.010363],[1,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
PERS bool b2LSlipEachLayer:=TRUE;
CONST robtarget pSynch:=[[2092.58,-0.42,2074.62],[0.70702,0.000231,0.707194,9E-05],[-1,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p220:=[[2092.59,-0.41,2074.62],[0.707025,0.000232,0.707189,9.5E-05],[-1,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget InterStn4:=[[-754.25,-1353.92,2600.04],[0.458258,-0.408496,-0.534839,0.580584],[-2,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget InterStn1:=[[131.89,1939.07,2600],[0.724624,-0.688384,0.030306,-0.011373],[0,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget InterStn2:=[[1549.83,5.64,2600.02],[0.069247,-0.032496,0.713886,-0.696072],[0,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget InterStn3:=[[-1063.31,-1460.03,2745.05],[0.203701,-0.215626,-0.654349,0.695585],[-2,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p11:=[[-926.38,216.81,1669.46],[0.019993,0.690317,0.723221,-0.003889],[1,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p12:=[[-2198.23,267.24,409.98],[0.110128,-0.708042,-0.688217,0.11361],[1,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p13:=[[-2357.67,274.03,274.01],[0.026542,-0.712264,-0.700538,0.034955],[1,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p14:=[[-2530.34,257.24,337.06],[9E-05,-0.708431,-0.705762,0.005173],[1,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p190:=[[1382.42,1602.38,2549.87],[0.707335,-0.706829,0.005756,-0.006079],[0,-2,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p21:=[[-200,1165.01,1615],[4.8E-05,-0.999994,0.003642,9.2E-05],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p210:=[[-333.66,1170.21,1913.43],[0.000416,-0.999996,0.002944,0.000246],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p21b:=[[-200,1165.56,1286.06],[0.067486,0.997714,-0.003662,0.000519],[1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p22:=[[-200.00999,1145.12,492.5],[0.268531,0.963265,-0.003155,0.001748],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p23:=[[-8.71,1210.21,-56.97],[0.699041,0.715051,-0.006679,0.000623],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p30a:=[[-35,1588.41,1195.77],[2.1E-05,-1,-2.1E-05,5.7E-05],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget Pickup1:=[[-2316.86,250.73,484.5],[0.506512,-0.511049,-0.50272,0.479111],[1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget Pickup3:=[[-1303.63,-2262.97,366.93],[0.002113,-0.00354,0.707839,-0.706362],[-2,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget Place1A:=[[1329.15,1684.34,173.00999],[0.707107,-0.707082,0.004183,0.004182],[0,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget Place2a:=[[1828,93.45,88.75],[0.000577,0.005811,-0.707159,0.707031],[0,-1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget Place3b:=[[604.44,-1682.21,115],[0.006075,0.000681,0.709899,-0.704278],[-1,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget SearchBag1:=[[-191.99,1250.02,255.12],[0.713446,0.700697,0.000707,-0.004239],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget SlipPlace1:=[[1382.37,1610,-150],[0.707323,-0.706841,0.005788,-0.006092],[0,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget SlipPlace2:=[[1580,0,-168],[0.496625,-0.501485,0.500628,-0.501248],[-1,-1,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget SlipPlace3:=[[590,-1570,-175.83],[0.004614,-0.004509,-0.706974,0.707211],[-1,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget SSOrient1:=[[-2017.4,1264.6,1156.73],[0.707113,-0.706951,0.010232,-0.010359],[1,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget SSstackBottom:=[[-1619.99,1349.16,-187.51],[0.70583,-0.708366,0.003256,-0.003524],[1,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST string line:=&quot;---------------------------------&quot;;
PERS bool BagReq1:=FALSE;
PERS bool DayFlag:=TRUE;
PERS bool PalletiseReq1:=FALSE;
PERS bool PalletiseReq3:=FALSE;
PERS num bag1length:=1520;
PERS num BagDrop:=0;
PERS num BagDropOld:=0;
PERS num BagOk:=59;
PERS num BagOkayOld:=93;
PERS num LayPadReq1:=0;
PERS num LayPadReq2:=0;
PERS num LayPadReq3:=0;
PERS num MidOffset:=-8;
PERS num PackCfgStn1:=42;
PERS num PackCfgStn2:=0;
PERS num posX:=1374.49;
PERS num posY:=1585.45;
PERS num ProductSelect1:=40593;
PERS num ProductSelect3:=0;
PERS num SlipOnPallet:=1;
PERS num SSthickness:=2;
PERS num Stn1BagCount:=3;
PERS num Stn1BagHeight:=260;
PERS num Stn1LayerOffset:=801;
PERS num Stn1TotalBags:=9;
PERS num Stn2BagCount:=0;
PERS num Stn23BagHeight:=265;
PERS num Stn2LayerOffset:=1068;
PERS num Stn2TotalBags:=9;
PERS num Stn3BagCount:=0;
PERS num Stn3LayerOffset:=0;
PERS num Stn3TotalBags:=9;
PERS robtarget BagEnd1:=[[-191.972,1250.091,-21.3976],[0.713434,0.70071,0.000710547,-0.00429219],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
PERS robtarget p140:=[[-1933.87,1361.63,1156.78],[0.707127,-0.706935,0.0102727,-0.0104085],[1,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
PERS string d:=&quot;D&quot;;
PERS string string1:=&quot;E. Next Screen&quot;;
PERS tooldata BagGrip:=[TRUE,[[0,0,0],[1,0,0,0]],[25,[0,0,300],[1,0,0,0],20,20,20]];
VAR bool BagOkay:=TRUE;
VAR bool VacFlag:=FALSE;
VAR iodev iodev1;
VAR num BagMid:=0;
VAR num BagZ:=0;
VAR num check:=0;
VAR num continue:=4;
VAR num PosZ:=0;
VAR num seln1:=0;
VAR num seln2:=0;
VAR num Stickout2:=0;
VAR num stuck:=0;
VAR pos pos1:=[0,0,0];
VAR robtarget again2:=[[-1974.98,1435.15,502.02],[0.707122,-0.707085,0.002218,-0.002219],[1,-2,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
VAR robtarget BagLeft:=[[-30.84,-1201.61,-55.35],[0.00113,0.001733,-0.708687,-0.705521],[-2,-1,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
VAR robtarget BagRight:=[[469.17,-1201.57,-55.35],[0.001146,0.001745,-0.708675,-0.705533],[-1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
VAR robtarget p16:=[[252.85,1676.23,978.63],[0.707201,-0.706974,-0.005273,0.005191],[0,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
VAR robtarget SlipSearch:=[[550.07,1084.86,888.23],[7.7E-05,0.404679,0.914459,8.5E-05],[0,-1,1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
!Variables for Vaccum Gripper
PERS num nSet2:=5;
PERS num nSet1:=1;
PERS num nProduct:=1;
PERS string strProduct:=&quot;P&N 2 Litre&quot;;
CONST string strCurrProd:=&quot;Current Product = &quot;;
CONST string string4:=&quot;A. Change product from &quot;;
PERS num BottleWidth:=130;
PERS num BottleHeight:=320;
PERS num LayerQty:=4;
PERS num RowQty:=9;
PERS num LayerCount:=0;
PERS num LayerOffset:=0;
PERS num RowOffset:=0;
PERS num LayPadReq4:=0;
PERS bool PalletiseReq4:=FALSE;

PROC Palletise4()
!New program for palletising
!bottles with vaccum gripper
start:
VelSet 100,700;
RowOffset:=(RowQty*BottleWidth)/2-(RowCount*BottleWidth)-BottleWidth;
IF LayerQty-1=LayerCount AND RowCount>=RowQty THEN
Incr LayerCount;
LayerOffset:=(BottleHeight+SSthickness)*LayerCount;
SearchSlip;
PulseDO\PLength:=0.5,doPall3Compl;
TPErase;
TPWrite &quot;Waiting for full pallet exit&quot;;
WaitDI diPall3InPos,low;
LayerCount:=0;
LayerOffset:=0;
RowCount:=0;
RowOffset:=(RowQty*BottleWidth)/2-(RowCount*BottleWidth)-BottleWidth;
MoveJ Offs(SSstackBottom,0,0,2900),v1500,z200,BagGrip;
TPErase;
TPWrite &quot;Waiting for new pallet&quot;;
WaitDI diPall3InPos,high;
SearchSlip;
ENDIF
RowOffset:=(RowQty*BottleWidth)/2-(RowCount*BottleWidth)-BottleWidth;
LayerOffset:=(BottleHeight+SSthickness)*LayerCount;
IF RowCount>=RowQty THEN
RowCount:=0;
Incr LayerCount;
PickSlip;
ELSEIF RowCount=0 AND bForceSSPick=TRUE THEN
PickSlip;
ENDIF
bForceSSPick:=FALSE;
IF LayerOffset<370 THEN
OffsetUp:=BottleHeight+75;
ELSE
OffsetUp:=BottleHeight+LayerOffset-395;
ENDIF
MoveJ Offs(Pickup,0,200,OffsetUp),vmax,z20,tcp0;
label10:
TPErase;
WHILE diPall3InPos=low DO
TPWrite &quot;Waiting for pallet in position&quot;;
WaitTime 0.2;
TPErase;
ENDWHILE
WHILE diPickReady=low DO
TPWrite &quot;Waiting to palletise layer &quot;\Num:=LayerCount+1;
TPWrite &quot; row &quot;\Num:=RowCount+1;
WaitTime 0.1;
TPErase;
ENDWHILE
label20:
MoveL Offs(Pickup,0,50,0),v2500,z10,tcp0;
Set doPicking;
MoveL Pickup,v500,fine,tcp0;
Reset doAirBlast;
Reset doBottVacSw;
Set doVacuum;
WaitDI diVacuum,high\MaxTime:=4\TimeFlag:=VacFlag;
WaitTime 2;
IF diVacuum=high GOTO label30;
Reset doVacuum;
Reset doPicking;
Set doAirBlast;
MoveL Offs(Pickup,0,50,0),v500,fine,tcp0;
Reset doAirBlast;
TPErase;
TPReadFK continue,&quot;Vacuum fault. Rectify then press OK&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;OK&quot;;
GOTO label20;
label30:
RowOffset:=(RowQty*BottleWidth)/2-(RowCount*BottleWidth)-BottleWidth;
LayerOffset:=(BottleHeight+SSthickness)*LayerCount;
TPErase;
TPWrite &quot;Palletising layer &quot;\Num:=LayerCount+1;
TPWrite &quot; row &quot;\Num:=RowCount+1;
MoveL Offs(Pickup,0,0,OffsetUp),v500,z50,tcp0;
Reset doPicking;
IF LayerOffset<500 AND RowCount<3 THEN
MoveJ Offs(Place,RowOffset-200,0,800),v2000,z50,tcp0;
ELSEIF LayerOffset<500 THEN
MoveJ Offs(Place,RowOffset-50,0,800),v2000,z50,tcp0;
ENDIF
IF RowCount<2 OR (LayerOffset>900 AND RowCount<5) THEN
MoveJ Offs(Place,RowOffset-200,0,LayerOffset+100),v2000,z50,tcp0;
ELSE
MoveJ Offs(Place,RowOffset-50,0,LayerOffset+BottleHeight+50),v2000,z50,tcp0;
ENDIF
IF LayerCount=0 AND RowCount=0 THEN
MoveL Offs(Place,RowOffset-90,0,LayerOffset),v1000,fine,tcp0;
ELSEIF LayerCount=0 AND RowCount=1 THEN
MoveL Offs(Place,RowOffset-150,0,LayerOffset),v1000,fine,tcp0;
ELSE
MoveL Offs(Place,RowOffset-50,0,LayerOffset),v1000,fine,tcp0;
ENDIF
Reset doVacuum;
Set doAirBlast;
WaitDI diVacuum,low;
IF LayerCount=0 AND RowCount=0 THEN
WaitTime 0;
ELSE
MoveL Offs(Place,RowOffset,0,LayerOffset),v30,fine,tcp0;
MoveL Offs(Place,RowOffset-50,0,LayerOffset),v80,fine,tcp0;
ENDIF
IF RowCount=0 OR (LayerOffset>900 AND RowCount<5) THEN
MoveL Offs(Place,RowOffset-200,0,LayerOffset+BottleHeight+50),v1500,z30,tcp0;
ELSE
MoveL Offs(Place,RowOffset-50,0,LayerOffset+BottleHeight-100),v1500,z30,tcp0;
MoveL Offs(Place,RowOffset-50,0,LayerOffset+BottleHeight+50),v1500,z30,tcp0;
ENDIF
Reset doAirBlast;
IF LayerOffset<370 MoveJ Offs(Place,RowOffset-50,0,BottleHeight+440),v1500,z50,tcp0;
Incr RowCount;
PalletiseReq4=FALSE
RETURN;
MoveL Place,v500,fine,tcp0;
MoveL Pickup,v500,z10,tcp0;
ENDPROC


ENDPROC

PROC ProdSelect3()
!New program for palletising
!bottles with vaccum gripper
start;
nSet1:=5;
nSet2:=5;
WHILE nSet1=5 AND nSet2=5 DO
TPErase;
TPWrite &quot;A. P&N 2 litre&quot;;
TPWrite &quot;B. Product 2&quot;;
TPWrite &quot;C. Product 3&quot;;
TPWrite &quot;D. Product 4&quot;;
TPReadFK nSet1,&quot;Select Product or press Next.&quot;,&quot;A&quot;,&quot;B&quot;,&quot;C&quot;,&quot;D&quot;,&quot;Next&quot;;
IF nSet1=5 THEN
TPErase;
TPWrite &quot;E. Product 5&quot;;
TPWrite &quot;F. Product 6&quot;;
TPWrite &quot;G. Product 7&quot;;
TPWrite &quot;H. Product 8&quot;;
TPReadFK nSet2,&quot;Select Product or press Previous.&quot;,&quot;E&quot;,&quot;F&quot;,&quot;G&quot;,&quot;H&quot;,&quot;Previous&quot;;
ENDIF
ENDWHILE
IF nSet1=5 THEN
nProduct:=nSet2+4;
ELSE
nProduct:=nSet1;
ENDIF
TEST nProduct
CASE 1:
strProduct:=&quot;P&N 2 litre&quot;;
BottleHeight:=320;
BottleWidth:=130;
LayerQty:=4;
RowQty:=9;
CASE 2:
strProduct:=&quot;Product 2&quot;;
BottleHeight:=294;
BottleWidth:=150;
LayerQty:=4;
RowQty:=7;
CASE 3:
strProduct:=&quot;Product 3&quot;;
BottleHeight:=283;
BottleWidth:=135;
LayerQty:=4;
RowQty:=8;
CASE 4:
strProduct:=&quot;Product 4&quot;;
BottleHeight:=300;
BottleWidth:=161;
LayerQty:=4;
RowQty:=7;
CASE 5:
strProduct:=&quot;Product 5&quot;;
BottleHeight:=255;
BottleWidth:=161;
LayerQty:=4;
RowQty:=7;
CASE 6:
strProduct:=&quot;Product 6&quot;;
BottleHeight:=237;
BottleWidth:=135;
LayerQty:=4;
RowQty:=8;
CASE 7:
strProduct:=&quot;Product 7&quot;;
BottleHeight:=277;
BottleWidth:=114;
LayerQty:=5;
RowQty:=10;
CASE 8:
strProduct:=&quot;Product 8&quot;;
BottleHeight:=340;
BottleWidth:=117;
LayerQty:=4;
RowQty:=10;
DEFAULT:
TPErase;
TPReadFK continue,&quot;Packing selection fault. Press OK to continue.&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;OK&quot;;
GOTO start;
ENDTEST


ENDPROC


PROC HelpScreen()
HelpMenu:
LayPadReq2:=0;
LayPadReq3:=0;
TPErase;
TPWrite &quot;Current Status on 4L Milk Line&quot;;
TPWrite line;
TPWrite &quot;Product code =&quot;\Num:=ProductSelect1;
TPWrite &quot;Bags on pallet =&quot;\Num:=Stn1BagCount;
IF LayPadReq1>0 THEN
TPWrite &quot;Slip sheet is required&quot;;
ELSE
TPWrite &quot;Slip sheet is not required&quot;;
ENDIF
IF PalletiseReq1=TRUE THEN
TPWrite &quot;Bag ready for pickup&quot;;
string1:=&quot;&quot;;
ELSE
TPWrite &quot;Bag not ready for pickup&quot;;
IF BagReq1=FALSE THEN
string1:=&quot;Bag is on bagger&quot;;
ELSE
string1:=&quot;Bag is not on bagger&quot;;
ENDIF
ENDIF
TPReadFK seln1,string1,&quot;CHANGE&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;OK&quot;;
IF seln1=1 THEN
SubMenu1:
TPErase;
TPWrite &quot;Bagger 1 parameters (screen 1)&quot;;
TPWrite line;
TPWrite &quot;A. Change product code from &quot;\Num:=ProductSelect1;
TPWrite &quot;B. Change pallet 1 quantity from &quot;\Num:=Stn1BagCount;
IF PalletiseReq1=TRUE THEN
TPWrite &quot;C. Palletise bag&quot;;
d:=&quot;&quot;;
ELSE
TPWrite &quot;C. No bag to be palletised&quot;;
d:=&quot;D&quot;;
IF BagReq1=TRUE THEN
TPWrite &quot;D. Place bag on bagger&quot;;
ELSE
TPWrite &quot;D. Do not place bag on bagger&quot;;
ENDIF
ENDIF
TPWrite &quot;E. Next Screen&quot;;
TPReadFK seln2,&quot;&quot;,&quot;A&quot;,&quot;B&quot;,&quot;C&quot;,d,&quot;E&quot;;
TEST seln2
CASE 1:
ProdSelect1;
CASE 2:
TPErase;
TPWrite &quot;Change pallet quantity from &quot;\Num:=Stn1BagCount;
TPReadNum Stn1BagCount,&quot;Enter new pallet quantity&quot;;
CASE 3:
PalletiseReq1:=NOT PalletiseReq1;
CASE 4:
BagReq1:=NOT BagReq1;
DEFAULT:
TPErase;
ENDTEST
IF seln2<>5 GOTO SubMenu1;
submenu2:
TPErase;
TPWrite &quot;Bagger 1 parameters (screen 2)&quot;;
TPWrite line;
TPWrite &quot;A. Previous screen&quot;;
IF LayPadReq1=2 THEN
TPWrite &quot;B. 2 Slip sheets are required&quot;;
ELSEIF LayPadReq1=1 THEN
TPWrite &quot;B. 1 Slip sheet is required&quot;;
ELSE
TPWrite &quot;B. Slip sheet is not required&quot;;
ENDIF
TPWrite &quot;C. Bag Length = &quot;\Num:=bag1length;
TPWrite &quot;D. Eject Pallet&quot;;
string1:=&quot;E. Next Screen&quot;;
TPReadFK seln2,string1,&quot;A&quot;,&quot;B&quot;,&quot;C&quot;,&quot;D&quot;,&quot;E&quot;;
TEST seln2
CASE 1:
GOTO SubMenu1;
CASE 2:
LayPadReq1:=LayPadReq1-1;
IF LayPadReq1<0 OR LayPadReq1>2 LayPadReq1:=2;
CASE 3:
TPErase;
TPWrite &quot;Bag Length = &quot;\Num:=bag1length;
TPReadNum bag1length,&quot;Enter new baglength &quot;;
CASE 4:
TPErase;
TPReadFK continue,&quot;Are you sure you want to eject pallet1&quot;,&quot;YES&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;NO&quot;;
IF continue=1 THEN
Set doPall1Compl;
WaitTime 0.5;
Reset doPall1Compl;
Stn1BagCount:=0;
Stn1LayerOffset:=0;
LayPadReq1:=1;
ENDIF
DEFAULT:
TPErase;
ENDTEST
IF seln2<>5 GOTO submenu2;
ENDIF
HelpMenu2:
TPErase;
TPWrite &quot;Current Status of 2L Milk Line&quot;;
TPWrite line;
TPWrite &quot;Product code for conveyor 2 & 3 = &quot;\Num:=ProductSelect3;
TPWrite &quot;Bags on pallet 2 = &quot;\Num:=Stn2BagCount;
TPWrite &quot;Bags on pallet 3 = &quot;\Num:=Stn3BagCount;
IF PalletiseReq3=FALSE THEN
TPWrite &quot;Bag not ready for pickup at auto-bagger&quot;;
ELSE
TPWrite &quot;Bag ready for pickup at auto-bagger&quot;;
ENDIF
TPReadFK seln1,&quot;Continue palletising on pallets 2 & 3&quot;,&quot;CHANGE&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;OK&quot;;
TPErase;
IF seln1=1 THEN
submenu3:
TPErase;
TPWrite &quot;Bagger 2 parameters&quot;;
TPWrite line;
TPWrite &quot;A. Change product code from &quot;\Num:=ProductSelect3;
TPWrite &quot;B. Change pallet 2 quantity from &quot;\Num:=Stn2BagCount;
TPWrite &quot;C. Change pallet 3 quantity from &quot;\Num:=Stn3BagCount;
IF PalletiseReq3=TRUE THEN
TPWrite &quot;D. Force pickup from auto-bagger&quot;;
ELSE
TPWrite &quot;D. Dont Force auto-bagger pickup&quot;;
ENDIF
TPWrite &quot;E. NEXT SCREEN&quot;;
TPReadFK seln2,&quot;&quot;,&quot;A&quot;,&quot;B&quot;,&quot;C&quot;,&quot;D&quot;,&quot;E&quot;;
TEST seln2
CASE 1:
ProdSelect2;
CASE 2:
TPErase;
TPWrite &quot;Change pallet 2 quantity from &quot;\Num:=Stn2BagCount;
TPReadNum Stn2BagCount,&quot;Enter new pallet quantity&quot;;
CASE 3:
TPWrite &quot;Change pallet 3 quantity from &quot;\Num:=Stn3BagCount;
TPReadNum Stn3BagCount,&quot;Enter new pallet quantity&quot;;
CASE 4:
PalletiseReq3:=NOT PalletiseReq3;
DEFAULT:
TPErase;
ENDTEST
IF seln2<>5 GOTO submenu3;
submenu4:
TPErase;
TPWrite &quot;Bagger 2 parameters (screen 2)&quot;;
TPWrite line;
TPWrite &quot;A. Eject Pallet 2&quot;;
TPWrite &quot;B. Eject Pallet 3&quot;;
TPWrite &quot;C. Clear Auto-bagger ready signal&quot;;
IF b2LSlipEachLayer=TRUE THEN
TPWrite &quot;D. Place slipsheet on every layer&quot;;
ELSE
TPWrite &quot;D. Place slipsheet on pallet only&quot;;
ENDIF
string1:=&quot;E. Previous Screen&quot;;
TPReadFK seln2,string1,&quot;A&quot;,&quot;B&quot;,&quot;C&quot;,&quot;D&quot;,&quot;E&quot;;
TEST seln2
CASE 1:
TPErase;
TPReadFK continue,&quot;Are you sure you want to eject pallet2&quot;,&quot;YES&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;NO&quot;;
IF continue=1 THEN
Set doPall2Compl;
WaitTime 0.5;
Reset doPall2Compl;
Stn2BagCount:=0;
Stn2LayerOffset:=0;
LayPadReq2:=1;
GOTO submenu4;
ENDIF
CASE 2:
TPErase;
TPReadFK continue,&quot;Are you sure you want to eject pallet3&quot;,&quot;YES&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;NO&quot;;
IF continue=1 THEN
Set doPall3Compl;
WaitTime 0.5;
Reset doPall3Compl;
Stn3BagCount:=0;
Stn3LayerOffset:=0;
LayPadReq3:=1;
GOTO submenu4;
ENDIF
CASE 3:
PulseDO\PLength:=0.5,doStn2BagP_U;
CASE 4:
b2LSlipEachLayer:=NOT b2LSlipEachLayer;
CASE 5:
GOTO HelpMenu2;
DEFAULT:
TPErase;
ENDTEST
ENDIF
HelpMenu3:
!new program
TPErase;
TPWrite &quot;Current Status of Vaccum Gripper Line&quot;;
TPWrite line;
TPWrite &quot;Product 3 = &quot;\string:=strCurrProd;
TPWrite &quot;Layers on pallet 3 = &quot;\Num:=LayerCount;
IF PalletiseReq4=FALSE THEN
TPWrite &quot;Infeed not ready for pickup &quot;;
ELSE
TPWrite &quot;Infeed ready for pickup&quot;;
ENDIF
TPReadFK seln1,&quot;Continue palletising on pallet 3&quot;,&quot;CHANGE&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;OK&quot;;
TPErase;
IF seln1=1 THEN
submenu5:
TPErase;
TPWrite &quot;Pallet 3 Parameters&quot;;
TPWrite line;
TPWrite &quot;A. Change product from &quot;\string:=strCurrProd;
TPWrite &quot;B.&quot;
TPWrite &quot;C. Change pallet 3 quantity from &quot;\Num:=LayerCount;
IF PalletiseReq4=TRUE THEN
TPWrite &quot;D. Force pickup from Infeed&quot;;
ELSE
TPWrite &quot;D. Dont Force Infeed pickup&quot;;
ENDIF
TPWrite &quot;E. NEXT SCREEN&quot;;
TPReadFK seln2,&quot;&quot;,&quot;A&quot;,&quot;B&quot;,&quot;C&quot;,&quot;D&quot;,&quot;E&quot;;
TEST seln2
CASE 1:
ProdSelect3;
CASE 2:
TPErase;
GOTO submenu5;
CASE 3:
TPWrite &quot;Change pallet 3 quantity from &quot;\Num:=LayerCount;
TPReadNum Stn3BagCount,&quot;Enter new pallet quantity&quot;;
CASE 4:
PalletiseReq4:=NOT PalletiseReq4;
DEFAULT:
TPErase;
ENDTEST
IF seln2<>5 GOTO submenu5;
submenu6:
TPErase;
TPWrite &quot;Pallet 3 Parameters (screen 2)&quot;;
TPWrite line;
TPWrite &quot;A. Eject Pallet 3&quot;;
TPWrite &quot;B. Clear Infeed3 ready signal&quot;;
string1:=&quot;E. Previous Screen&quot;;
TPReadFK seln2,string1,&quot;A&quot;,&quot;B&quot;,&quot;C&quot;,&quot;D&quot;,&quot;E&quot;;
TEST seln2
CASE 1:
TPErase;
TPReadFK continue,&quot;Are you sure you want to eject pallet3&quot;,&quot;YES&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;NO&quot;;
IF continue=1 THEN
Set doPall3Compl;
WaitTime 0.5;
Reset doPall3Compl;
Stn3BagCount:=0;
Stn3LayerOffset:=0;
LayPadReq3:=1;
GOTO submenu4;
ENDIF
CASE 2:
TPErase;
TPReadFK continue,&quot;Are you sure you want to eject pallet3&quot;,&quot;YES&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;NO&quot;;
IF continue=1 THEN
Set doPall3Compl;
WaitTime 0.5;
Reset doPall3Compl;
Stn3BagCount:=0;
Stn3LayerOffset:=0;
LayPadReq3:=1;
GOTO submenu4;
ENDIF
CASE 3:
PulseDO\PLength:=0.5,doStn2BagP_U;
CASE 4:
b2LSlipEachLayer:=NOT b2LSlipEachLayer;
CASE 5:
GOTO HelpMenu3;
DEFAULT:
TPErase;
ENDTEST
ENDIF






IF PalletiseReq1=FALSE AND diStn1BagReady=high THEN
TPErase;
TPWrite &quot;Current situation has changed.&quot;;
TPReadFK check,&quot;Bag ready to be Picked up on Bagger1&quot;,&quot;YES&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;NO&quot;;
IF check=5 THEN
Set doStn1BagP_U;
WaitDI diStn1BagReady,low;
Reset doStn1BagP_U;
ENDIF
ENDIF
IF PalletiseReq3=FALSE AND diStn3BagReady=high THEN
TPErase;
TPWrite &quot;Current situation has changed.&quot;;
TPReadFK check,&quot;Bag ready to be Picked up on Bagger3&quot;,&quot;YES&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;NO&quot;;
IF check=5 THEN
Set doStn2BagP_U;
WaitTime 0.5;
Reset doStn2BagP_U;
ENDIF
!new program
IF PalletiseReq3=FALSE AND diInfeed3=high THEN
TPErase;
TPWrite &quot;Current situation has changed.&quot;;
TPReadFK check,&quot;Infeed ready to be picked up on bottle conveyor&quot;,&quot;YES&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;NO&quot;;
IF check=5 THEN
Set doStn2BagP_U;
WaitTime 0.5;
Reset doStn2BagP_U;
ENDIF
ENDIF
!end new program
IF Stn2BagCount=0 AND diPall2InPos=high THEN
TPErase;
TPReadFK check,&quot;Place Layer Pad on pallet 2?&quot;,&quot;YES&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;NO&quot;;
IF check=1 LayPadReq2:=1;
ENDIF
IF Stn3BagCount=0 AND diPall3InPos=high THEN
TPErase;
TPReadFK check,&quot;Place Layer pad on pallet 3?&quot;,&quot;YES&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;NO&quot;;
IF check=1 LayPadReq3:=1;
ENDIF
!new program
IF LayerCount=0 AND diPall3InPos=high THEN
TPErase;
TPReadFK check,&quot;Place Layer pad on pallet 3?&quot;,&quot;YES&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;NO&quot;;
IF check=1 LayPadReq4:=1;
ENDIF
!end new program
ENDPROC

PROC Palletise2()
start:
ConfJ\On;
MoveJ InterStn3,vmax,z50,BagGrip;
Set doStn2BagP_U;
MoveJ Offs(Pickup3,0,600,400),v1500,z150,BagGrip;
MoveL Offs(Pickup3,0,0,100),v1000,z50,BagGrip;
MoveL Pickup3,v300,fine,BagGrip;
Set doVacuum;
WaitDI diVacuum,1\MaxTime:=5\TimeFlag:=VacFlag;
WaitTime 1.4;
Incr Stn2BagCount;
Stn2LayerOffset:=(Stn2BagCount-1)*Stn23BagHeight;
TPWrite &quot;Palletising Stn 2 bag &quot;\Num:=Stn2BagCount;
AccSet 5,5;
IF Stn2BagCount<=3 THEN
reg1:=500;
reg5:=800;
ELSE
reg1:=Stn2LayerOffset+220;
reg5:=Stn2LayerOffset+200;
ENDIF
MoveL Offs(Pickup3,0,700,500),v200,z150,BagGrip;
Reset doStn2BagP_U;
MoveJ [[-756.62,-1157.94,2600.08],[0.331925,-0.273417,-0.621204,0.655115],[-2,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v300,fine,BagGrip;
MoveJ InterStn2,v800,z50,BagGrip;
MoveJ Offs(Place2a,0,0,reg5),v800,z200,BagGrip;
MoveL Offs(Place2a,0,0,Stn2LayerOffset),v300,fine,BagGrip;
Reset doVacuum;
WaitTime 1;
AccSet 100,100;
MoveJ InterStn2,v600,z50,BagGrip;
IF b2LSlipEachLayer=TRUE AND Stn2BagCount<9 THEN
SlipOnPallet:=2;
SearchSlip;
ENDIF
IF Stn2TotalBags<=Stn2BagCount THEN
Set doPall2Compl;
WaitTime 0.5;
Reset doPall2Compl;
Stn2BagCount:=0;
Stn2LayerOffset:=0;
WaitDI diPall2InPos,low;
LayPadReq2:=1;
ENDIF
PalletiseReq3:=FALSE;
RETURN;
MoveJ Place2a,v500,fine,BagGrip;
MoveL Pickup3,v300,fine,BagGrip;
MoveL InterStn3,v300,fine,BagGrip;
MoveJ InterStn3,v500,fine,BagGrip;
RETURN;
MoveJ InterStn2,v300,fine,BagGrip;
MoveL Place2a,v300,fine,BagGrip;
MoveJ InterStn2,v300,fine,BagGrip;
MoveL Offs(Place2a,0,0,Stn2LayerOffset),v300,z20,BagGrip;
ENDPROC

PROC Bag2Safe()
Reset doGrip;
Set doOpen;
MoveJ Offs(SearchBag1,0,0,-250),v100,fine,BagGrip;
MoveJ p22,v100,z20,BagGrip;
MoveJ p21,v100,z20,BagGrip;
ENDPROC

PROC bag1()
GetBag:
AccSet 100,100;
pos1:=CPos();
posX:=pos1.x;
posY:=pos1.y;
PosZ:=pos1.z;
IF posX<300 AND posY<-100 AND PosZ>800 THEN
MoveJ InterStn3,v1500,z200,BagGrip;
MoveJ InterStn1,vmax,z200,BagGrip;
ELSE
IF posX<-900 AND posY>1700 AND PosZ>1000 THEN
MoveJ [[-500,1165.02,1815.02],[7.5E-05,-0.994063,-0.108804,0.000111],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v1500,z20,BagGrip;
ENDIF
MoveJ InterStn1,vmax,z200,BagGrip;
MoveJ [[-500,1165.02,1815.02],[7.5E-05,-0.994063,-0.108804,0.000111],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v1500,z20,BagGrip;
ENDIF
MoveJ p21,v1500,z20,BagGrip;
Reset doGrip;
Set doOpen;
MoveL p21b,v800,z20,BagGrip;
MoveJ p22,v800,z20,BagGrip;
label10:
MoveJ Offs(SearchBag1,0,0,-300),v500,fine,BagGrip;
WHILE diBagSensor1=high DO
TPErase;
Reset doStn1BagClamp;
Set doFault;
TPReadFK continue,&quot;Too much bag hanging out&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;OK&quot;;
ENDWHILE
Set doStn1BagClamp;
Reset doFault;
SearchL\Stop,diBagSensor1,BagEnd1,SearchBag1,v40,BagGrip;
BagZ:=BagEnd1.trans.z;
Stickout2:=334-BagEnd1.trans.z;
TPErase;
TPWrite &quot;Bag stickout= &quot;\Num:=Stickout2;
IF Stickout2<230 THEN
Reset doStn1BagClamp;
Set doFault;
MoveL Offs(SearchBag1,0,0,-220),v500,fine,BagGrip;
TPReadFK continue,&quot;Bag stickout incorrect. Move bag end to sensor then press OK&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;OK&quot;;
Reset doFault;
Set doStn1BagClamp;
GOTO label10;
ENDIF
label20:
MoveL Offs(BagEnd1,0,0,150),v500,fine,BagGrip;
MoveL Offs(BagEnd1,-120,0,150),v500,fine,BagGrip;
SearchL\Stop,diBagSensor1,BagRight,Offs(BagEnd1,20,0,150),v50,BagGrip;
WaitTime 0.1;
MoveL Offs(BagEnd1,160,0,150),v500,fine,BagGrip;
SearchL\Stop,diBagSensor2,BagLeft,Offs(BagEnd1,-20,0,150),v50,BagGrip;
WaitTime 0.1;
BagMid:=((BagRight.trans.x+BagLeft.trans.x)/2)-BagEnd1.trans.x+MidOffset;
MoveL Offs(BagEnd1,BagMid,0,50),v500,z10,BagGrip;
MoveL Offs(BagEnd1,BagMid,0,230),v500,fine,BagGrip;
Reset doGrip;
Reset doOpen;
WaitTime 3;
IF stuck=1 THEN
Set doGrip;
WaitTime 1;
PulseDO\PLength:=1,doOpen;
WaitTime 1;
Reset doGrip;
ENDIF
WaitTime 2;
Reset doStn1BagClamp;
WaitTime 1;
MoveL p22,v300,z20,BagGrip;
MoveJ p21b,v150,z20,BagGrip;
MoveJ Offs(p21,0,0,-240),v100,z10,BagGrip;
MoveL Offs(p21,0,0,bag1length-1130-Stickout2),v60,fine,BagGrip;
WaitTime 1;
Set doStn1BagClamp;
Set doGrip;
WaitTime 1;
MoveL p210,v80,z40,BagGrip;
Set doOpen;
WaitTime 1;
Reset doStn1BagClamp;
CheckBag;
IF BagOkay=FALSE THEN
MoveJ [[-500,1165.02,1815.02],[7.5E-05,-0.994063,-0.108804,0.000111],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v1500,z20,BagGrip;
MoveL InterStn1,v1500,fine,BagGrip;
RETURN;
GOTO GetBag;
ENDIF
Bagger1;
TPErase;
BagReq1:=FALSE;
RETURN;
MoveL SearchBag1,v500,fine,BagGrip;
ERROR
IF ERRNO=ERR_WHLSEARCH THEN
RETRY;
ENDIF
ENDPROC

PROC Display()
TPErase;
TPWrite &quot;Stn 1 bags okay this shift = &quot;\Num:=BagOk;
TPWrite &quot;Stn 1 bags dropped this shift = &quot;\Num:=BagDrop;
TPWrite &quot;Stn 1 bags okay last shift = &quot;\Num:=BagOkayOld;
TPWrite &quot;Stn 1 bags dropped last shift = &quot;\Num:=BagDropOld;
IF DayFlag=FALSE AND GetTime(\Hour)>=6 AND GetTime(\Hour)<18 THEN
BagOkayOld:=BagOk;
BagDropOld:=BagDrop;
DayFlag:=TRUE;
BagDrop:=0;
BagOk:=0;
ELSEIF (DayFlag=TRUE AND GetTime(\Hour)<6) OR (DayFlag=TRUE AND GetTime(\Hour)>=18) THEN
BagDropOld:=BagDrop;
BagOkayOld:=BagOk;
DayFlag:=FALSE;
BagDrop:=0;
BagOk:=0;
ENDIF
TPWrite line;
TPWrite &quot;Waiting to palletise stn 1 bag &quot;\Num:=Stn1BagCount+1;
IF Stn2BagCount>Stn3BagCount THEN
TPWrite &quot;Waiting to palletise stn 2 bag &quot;\Num:=Stn2BagCount+1;
ELSE
TPWrite &quot;Waiting to palletise stn 3 bag &quot;\Num:=Stn3BagCount+1;
ENDIF
IF diPall1InPos=low TPWrite &quot;Pallet 1 not in position&quot;;
IF diPall2InPos=low TPWrite &quot;Pallet 2 not in position&quot;;
IF diPall3InPos=low TPWrite &quot;Pallet 3 not in position&quot;;
ENDPROC

PROC CheckBag()
MoveJ p30a,v1000,z100,BagGrip;
WaitTime 2;
MoveJ Offs(p30a,0,320,0),v500,z20,BagGrip;
MoveL Offs(p30a,-170,320,0),v200,fine,BagGrip;
IF diLever=1 THEN
MoveL Offs(p30a,0,320,0),v100,z20,BagGrip;
MoveL Offs(p30a,0,170,0),v500,z20,BagGrip;
MoveL Offs(p30a,-935,170,0),v1000,z20,BagGrip;
MoveL Offs(p30a,-935,340,0),v500,z20,BagGrip;
MoveL Offs(p30a,-760,340,0),v200,fine,BagGrip;
IF diLever=1 THEN
BagOkay:=TRUE;
Incr BagOk;
ELSE
BagOkay:=FALSE;
Incr BagDrop;
ENDIF
ELSE
BagOkay:=FALSE;
Incr BagDrop;
ENDIF
MoveL [[-969.92,1789.09,1195.69],[2.4E-05,-1,-2.4E-05,3.3E-05],[1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v1000,z100,BagGrip;
IF BagOkay=FALSE THEN
Reset doGrip;
WaitTime 1;
ENDIF
ENDPROC

PROC Bagger1()
! Bag on bagging m/c 1
Set doRetractTable1;
WaitTime 0.5;
MoveL [[-689.51,624.58,1540.58],[0.018375,0.848572,0.528688,-0.008778],[1,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v500,z100,BagGrip;
MoveJ p11,v500,z100,BagGrip;
MoveL p11,v1000,z100,BagGrip;
MoveL Offs(p11,-500,0,-200),v800,z50,BagGrip;
MoveL p12,v600,z10,BagGrip;
MoveL p13,v400,z5,BagGrip;
MoveL p14,v400,fine,BagGrip;
Set doStn1BagInPlace;
WaitTime 1.8;
Reset doGrip;
MoveL p13,v300,fine,BagGrip;
Set doGrip;
MoveL Offs(p13,55,0,0),v200,fine,BagGrip;
MoveL Offs(p13,55,-250,-25),v300,fine,BagGrip;
MoveL Offs(p13,60,300,-35),v300,fine,BagGrip;
MoveL [[-2247.56,220.28,353.68],[0.119665,-0.714517,-0.689129,-0.015732],[1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v300,z10,BagGrip;
MoveL [[-2260.33,195.37,352.66],[0.095575,-0.729491,-0.67522,0.052794],[1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v100,fine,BagGrip;
MoveL [[-2262.51,175.11,501.76],[0.047018,-0.712388,-0.697732,0.05885],[1,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v300,z10,BagGrip;
MoveL Offs(p12,800,0,300),v1000,z100,BagGrip;
Reset doGrip;
Reset doRetractTable1;
MoveL Offs(p12,800,0,300),v1000,z100,BagGrip;
Reset doStn1BagInPlace;
Set doStn1BagP_U;
WaitDI diStn1BagReady,low;
Reset doStn1BagP_U;
MoveJ Offs(Pickup1,700,0,2100),v1500,z200,BagGrip;
ENDPROC

PROC Palletise3()
start:
MoveJ InterStn3,vmax,z150,BagGrip;
MoveJ Offs(Pickup3,0,700,500),vmax,z150,BagGrip;
Set doStn2BagP_U;
MoveL Offs(Pickup3,0,0,100),v1000,z50,BagGrip;
MoveL Pickup3,v300,fine,BagGrip;
Set doVacuum;
WaitDI diVacuum,1\MaxTime:=5\TimeFlag:=VacFlag;
WaitTime 0.5;
Incr Stn3BagCount;
Stn3LayerOffset:=(Stn3BagCount-1)*Stn23BagHeight;
TPWrite &quot;Palletising station 3 bag &quot;\Num:=Stn3BagCount;
AccSet 5,5;
IF Stn3BagCount<=3 THEN
reg1:=500;
reg5:=800;
ELSE
reg1:=Stn3LayerOffset+20;
reg5:=Stn3LayerOffset+250;
ENDIF
MoveL Offs(Pickup3,0,700,500),v300,z150,BagGrip;
Reset doStn2BagP_U;
MoveL Offs(Pickup3,0,700,reg1),v500,z150,BagGrip;
MoveL Offs(Place3b,0,0,reg5),v500,z20,BagGrip;
MoveL Offs(Place3b,0,0,Stn3LayerOffset),v500,fine,BagGrip;
Reset doVacuum;
WaitTime 1;
AccSet 100,100;
MoveL Offs(Place3b,0,0,2200),v2000,z50,BagGrip;
MoveJ InterStn3,v2000,fine,BagGrip;
IF b2LSlipEachLayer=TRUE AND Stn3BagCount<9 THEN
SlipOnPallet:=3;
SearchSlip;
ENDIF
IF Stn3TotalBags<=Stn3BagCount THEN
Set doPall3Compl;
WaitTime 0.5;
Reset doPall3Compl;
Stn3BagCount:=0;
Stn3LayerOffset:=0;
WaitDI diPall3InPos,low;
LayPadReq3:=1;
ENDIF
PalletiseReq3:=FALSE;
RETURN;
MoveJ Place3b,v500,fine,BagGrip;
MoveL Place3b,v500,fine,BagGrip;
MoveL Pickup3,v300,fine,BagGrip;
MoveJ InterStn3,v500,fine,BagGrip;
RETURN;
ENDPROC

PROC SearchSlip()
start:
AccSet 100,100;
pos1:=CPos();
posX:=pos1.x;
posY:=pos1.y;
PosZ:=pos1.z;
IF posX<300 AND posY<-100 AND PosZ>800 THEN
MoveJ InterStn3,v1500,z200,BagGrip;
MoveJ InterStn1,v2500,z200,BagGrip;
ELSE
MoveJ Offs(SSstackBottom,0,0,2900),v1500,z200,BagGrip;
ENDIF
Reset doVacuum;
MoveL Offs(SSstackBottom,0,0,800),v1500,fine,BagGrip;
GOTO label20;
label15:
Set doFault;
TPErase;
Reset doVacuum;
WaitTime 1;
MoveL Offs(SSstackBottom,0,0,1000),v1000,fine,BagGrip;
TPReadFK continue,&quot;Unable to pickup slipsheet. Fix stack then press OK&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;OK&quot;;
Reset doFault;
label20:
SearchL\Stop,diBoardSens,SlipSearch,SSstackBottom,v150,BagGrip;
MoveL Offs(SlipSearch,0,0,-30),v100,fine,BagGrip;
Set doVacuum;
WaitDI diVacuum,high\MaxTime:=5\TimeFlag:=VacFlag;
WaitTime 1;
MoveL Offs(SlipSearch,0,0,0),v30,fine,BagGrip;
IF di8=high GOTO label15;
MoveL RelTool(SlipSearch,0,-20,-100\Rx:=15\Ry:=0\Rz:=0),v50,fine,BagGrip;
WaitTime 2;
MoveL Offs(SlipSearch,0,0,100),v400,z100,BagGrip;
IF diBoardSens=low GOTO label15;
TPErase;
MoveL Offs(SSstackBottom,0,0,1000),v500,z100,BagGrip;
IF SlipOnPallet=1 THEN
Stn1LayerOffset:=Stn1BagCount*(Stn23BagHeight+SSthickness);
IF Stn1LayerOffset>1700 THEN
MoveL Offs(SSstackBottom,0,0,Stn1LayerOffset+300),v1000,z100,BagGrip;
ELSE
MoveL Offs(SSstackBottom,0,0,2300),v1000,z100,BagGrip;
MoveJ Offs(SlipPlace1,p140.trans.x+1910,p140.trans.y-1420,1800),v1000,z100,BagGrip;
ENDIF
MoveJ Offs(SlipPlace1,p140.trans.x+1910,p140.trans.y-1420,Stn1LayerOffset+300),v1000,z100,BagGrip;
MoveL Offs(SlipPlace1,p140.trans.x+1910,p140.trans.y-1420,Stn1LayerOffset),v500,fine,BagGrip;
Reset doVacuum;
WaitTime 1;
MoveL Offs(SlipPlace1,p140.trans.x+1910,p140.trans.y-1420,Stn1LayerOffset+50),v60,fine,BagGrip;
MoveL p190,v1500,z50,BagGrip;
LayPadReq1:=LayPadReq1-1;
IF LayPadReq1<1 LayPadReq1:=0;
ELSEIF SlipOnPallet=2 THEN
TPErase;
TPWrite &quot;Placing slipheet on pall 2 layer &quot;\Num:=Stn2BagCount;
Stn2LayerOffset:=Stn2BagCount*(Stn23BagHeight+SSthickness);
MoveL Offs(SSstackBottom,0,0,2600),v1000,z100,BagGrip;
MoveJ [[1650.23,47.1,2802.92],[0.6126,-0.439765,0.269666,-0.59884],[0,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v1000,z100,BagGrip;
ConfJ\Off;
MoveJ Offs(SlipPlace2,0,0,Stn2LayerOffset+150),v1000,z100,BagGrip;
MoveL Offs(SlipPlace2,0,0,Stn2LayerOffset),v500,fine,BagGrip;
Reset doVacuum;
WaitTime 1;
MoveL Offs(SlipPlace2,0,0,Stn2LayerOffset+150),v60,fine,BagGrip;
ConfJ\On;
MoveJ [[1650.25,47.12,2513.25],[0.612585,-0.439777,0.269679,-0.598839],[0,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v1000,z100,BagGrip;
LayPadReq2:=LayPadReq2-1;
IF LayPadReq2<1 LayPadReq2:=0;
ELSEIF SlipOnPallet=3 THEN
TPErase;
TPWrite &quot;Placing slipheet on pall 3 layer &quot;\Num:=Stn3BagCount;
Stn3LayerOffset:=Stn3BagCount*(Stn23BagHeight+SSthickness);
MoveL Offs(SSstackBottom,0,0,2300),v1000,z100,BagGrip;
MoveJ [[1088.34,-1355.64,2679.14],[0.015682,-0.015647,-0.706838,0.707029],[-1,1,-3,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v1500,z80,BagGrip;
MoveL Offs(SlipPlace3,0,0,Stn3LayerOffset+150),v500,z100,BagGrip;
MoveL Offs(SlipPlace3,0,0,Stn3LayerOffset),v500,fine,BagGrip;
Reset doVacuum;
WaitTime 1;
MoveL Offs(SlipPlace3,0,0,Stn3LayerOffset+150),v200,z10,BagGrip;
MoveL [[538.99,-1563.23,2572.46],[0.014872,-0.016182,-0.705032,0.708836],[-1,1,-3,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v1500,z80,BagGrip;
LayPadReq3:=LayPadReq3-1;
IF LayPadReq3<1 LayPadReq3:=0;
ELSEIF SlipOnPallet=4 THEN
!new program
TPErase;
TPWrite &quot;Placing slipheet on pall 3 layer &quot;\Num:=LayerCount;
LayerOffset:=(BottleHeight+SSthickness)*LayerCount;
MoveL Offs(SSstackBottom,0,0,2300),v1000,z100,BagGrip;
MoveJ [[1088.34,-1355.64,2679.14],[0.015682,-0.015647,-0.706838,0.707029],[-1,1,-3,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v1500,z80,BagGrip;
MoveL Offs(SlipPlace3,0,0,LayerOffset+150),v500,z100,BagGrip;
MoveL Offs(SlipPlace3,0,0,LayerOffset),v500,fine,BagGrip;
Reset doVacuum;
WaitTime 1;
MoveL Offs(SlipPlace3,0,0,LayerOffset+150),v200,z10,BagGrip;
MoveL [[538.99,-1563.23,2572.46],[0.014872,-0.016182,-0.705032,0.708836],[-1,1,-3,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v1500,z80,BagGrip;
LayPadReq4:=LayPadReq4-1;
IF LayPadReq4<1 LayPadReq4:=0;
ENDIF
ERROR
IF ERRNO=ERR_WHLSEARCH THEN
MoveL Offs(SSstackBottom,0,0,1000),v1000,fine,tool0;
RETRY;
ENDIF
ENDPROC

PROC ProdSelect2()
start:
Reset doBufferTime2;
Reset doCheckPCode1;
Reset doCheckPCode2;
Reset doPackCfgNG;
Reset doPackCfgOK;
TPErase;
TPWrite &quot;Input product code for &quot;;
TPWrite &quot;Stations 2 and 3&quot;;
TPReadNum ProductSelect3,&quot;Then press OK&quot;;
TPErase;
IF ProductSelect3>=65535 THEN
SetGO goProductCodeA,65535;
SetGO goProductCodeB,ProductSelect3-65535;
ELSE
SetGO goProductCodeA,ProductSelect3;
SetGO goProductCodeB,0;
ENDIF
WaitTime 0.5;
Set doCheckPCode2;
WaitTime 0.5;
WHILE diProdCodeOK=low AND diProdCodeNG=low AND diServerDown=low DO
TPWrite &quot;Waiting for AGV server&quot;;
WaitTime 0.2;
TPErase;
ENDWHILE
PackCfgStn2:=GInput(giPackCfg3);
label5:
IF diServerDown=high THEN
TPWrite &quot;AGV server down&quot;;
TPWrite &quot;Enter PACK code for&quot;;
TPReadNum PackCfgStn2,&quot;Stations 2 and 3&quot;;
WaitTime 0.1;
GOTO label15;
ELSEIF diProdCodeNG=high THEN
TPErase;
Reset doCheckPCode2;
TPWrite &quot;Incorrect product code for&quot;;
TPReadFK continue,&quot;Stations 2 and 3&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;OK&quot;;
GOTO start;
WaitTime 0.1;
ENDIF
label10:
Reset doFault;
WHILE diServerDown=low AND diCheckPackCfg=low DO
TPErase;
TPWrite &quot;Waiting on server pack config for &quot;;
TPWrite &quot;Stations 2 and 3&quot;;
ENDWHILE
IF diServerDown=high GOTO label5;
label15:
TEST PackCfgStn2
CASE 1:
! 2 Litre Milk
Stn23BagHeight:=265;
Stn2TotalBags:=9;
Stn3TotalBags:=9;
SetGO goTimeToEnd,60;
DEFAULT:
TPErase;
TPWrite &quot;STN 2 and 3 Packing selection fault&quot;;
TPReadFK continue,&quot;Press OK to continue.&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;OK&quot;;
TPErase;
Set doPackCfgNG;
WaitDI diCheckPackCfg,low;
Reset doPackCfgNG;
GOTO start;
ENDTEST
Set doBufferTime2;
Reset doCheckPCode2;
Set doPackCfgOK;
IF diServerDown=low WaitDI diCheckPackCfg,low;
Reset doPackCfgOK;
WaitTime 0.5;
Reset doBufferTime2;
RETURN;
ENDPROC

PROC Palletise1()
start:
MoveJ InterStn1,vmax,z200,BagGrip;
MoveJ Offs(Pickup1,650,0,500),v3000,z150,BagGrip;
MoveL Offs(Pickup1,0,0,200),v1500,z50,BagGrip;
MoveL Pickup1,v300,fine,BagGrip;
Set doVacuum;
WaitTime 5;
WaitDI diVacuum,1\MaxTime:=5\TimeFlag:=VacFlag;
Incr Stn1BagCount;
TPWrite &quot;Palletising stn1 bag &quot;\Num:=Stn1BagCount;
Stn1LayerOffset:=(Stn1BagCount-1)*Stn1BagHeight;
AccSet 3,3;
IF Stn1BagCount<4 THEN
reg1:=500;
reg5:=800;
ELSE
reg1:=Stn1LayerOffset-60;
reg5:=Stn1LayerOffset+275;
ENDIF
MoveL Offs(Pickup1,0,0,200),v200,z50,BagGrip;
IF diVacuum=low THEN
MoveL Pickup1,v300,fine,BagGrip;
MoveL Offs(Pickup1,0,0,200),v50,z50,BagGrip;
ENDIF
MoveL Offs(Pickup1,650,0,500),v400,z50,BagGrip;
MoveL Offs(Pickup1,650,0,reg1),v400,z200,BagGrip;
PulseDO\PLength:=0.5,doStn1BagP_U;
WaitDI diStn1BagReady,0;
p16.trans.z:=reg5+143;
WaitTime 0.5;
MoveJ p16,v400,z200,BagGrip;
MoveL Offs(Place1A,0,0,reg5),v400,z100,BagGrip;
IF diVacuum=low THEN
TPErase;
TPReadFK check,&quot;Transfer fault. Put bag on pallet then press OK.&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;OK&quot;;
ENDIF
again2:=CRobT();
MoveL Offs(Place1A,0,0,Stn1LayerOffset),v500,fine,BagGrip;
AccSet 100,100;
Reset doVacuum;
WaitTime 1;
MoveL Offs(again2,0,0,0),v1500,z50,BagGrip;
MoveL p190,v1000,z150,BagGrip;
BagReq1:=TRUE;
PalletiseReq1:=FALSE;
RETURN;
MoveJ Place1A,v500,fine,BagGrip;
MoveL Pickup1,v300,fine,BagGrip;
MoveJ InterStn1,v500,fine,BagGrip;
RETURN;
ENDPROC

PROC ProdSelect1()
start:
Reset doBufferTime1;
Reset doCheckPCode1;
Reset doCheckPCode2;
Reset doPackCfgNG;
Reset doPackCfgOK;
TPErase;
TPWrite &quot;Input product code for STN 1&quot;;
TPReadNum ProductSelect1,&quot;Then press OK&quot;;
TPErase;
IF ProductSelect1>=65535 THEN
SetGO goProductCodeA,65535;
SetGO goProductCodeB,ProductSelect1-65535;
ELSE
SetGO goProductCodeA,ProductSelect1;
SetGO goProductCodeB,0;
ENDIF
WaitTime 0.5;
Set doCheckPCode1;
WaitTime 1;
WHILE diProdCodeOK=low AND diProdCodeNG=low AND diServerDown=low DO
TPWrite &quot;Waiting for AGV server&quot;;
WaitTime 0.2;
TPErase;
ENDWHILE
PackCfgStn1:=GInput(giPackCfg1);
label5:
IF diServerDown=high THEN
TPWrite &quot;AGV server down.&quot;;
TPReadNum PackCfgStn1,&quot;Enter PACK code for STN 1&quot;;
WaitTime 0.1;
GOTO label15;
ELSEIF diProdCodeNG=high THEN
TPErase;
Reset doCheckPCode1;
TPReadFK continue,&quot;Incorrect product code for STN 1&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;OK&quot;;
GOTO start;
WaitTime 0.1;
ENDIF
label10:
Reset doFault;
WHILE diServerDown=low AND diCheckPackCfg=low DO
TPErase;
TPWrite &quot;Waiting on server pack config for STN 1&quot;;
ENDWHILE
IF diServerDown=high GOTO label5;
label15:
TEST PackCfgStn1
CASE 42:
! 4 Litre Jug
Stn1BagHeight:=260;
Stn1TotalBags:=9;
SetGO goTimeToEnd,400;
DEFAULT:
TPErase;
TPWrite &quot;STN 1 Packing selection fault&quot;;
TPReadFK continue,&quot;Press OK to continue.&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;OK&quot;;
TPErase;
Set doPackCfgNG;
WaitDI diCheckPackCfg,low;
Reset doPackCfgNG;
GOTO start;
ENDTEST
Set doBufferTime1;
Reset doCheckPCode1;
Set doPackCfgOK;
IF diServerDown=low WaitDI diCheckPackCfg,low;
Reset doPackCfgOK;
WaitTime 0.5;
Reset doBufferTime1;
RETURN;
ENDPROC

PROC main()
! Start of program
start:
TPErase;
Reset doStn1BagClamp;
Reset doVacuum;
pos1:=CPos();
posX:=pos1.x;
posY:=pos1.y;
PosZ:=pos1.z;
IF posX<-1000 AND posY>10 AND PosZ>1000 THEN
MoveJ Offs(Pickup1,800,0,2000),v200,z100,BagGrip;
ELSEIF posX<-1000 AND posY>860 THEN
MoveL Offs(SSstackBottom,0,0,2800),v600,z50,BagGrip;
ELSEIF posX<-100 AND posX>-400 AND posY>1000 AND PosZ>1000 THEN
MoveJ InterStn1,v300,fine,BagGrip;
ELSEIF posX>-300 AND posX<-100 AND posY>1000 AND PosZ>400 AND PosZ<900 THEN
Reset doGrip;
Set doOpen;
MoveJ Offs(p21,-300,0,0),v200,z100,BagGrip;
MoveJ p21,v200,z100,BagGrip;
MoveJ InterStn1,v300,fine,BagGrip;
ELSEIF posX>-300 AND posX<-50 AND posY>1000 AND posY<1300 AND PosZ>0 AND PosZ<320 THEN
Bag2Safe;
MoveJ InterStn1,v300,fine,BagGrip;
ELSEIF posX>100 AND PosZ>2300 THEN
MoveJ InterStn2,v200,z100,BagGrip;
ELSEIF posX<-100 AND posY<-100 AND PosZ>1000 THEN
MoveJ InterStn3,v300,fine,BagGrip;
ELSE
TPWrite &quot;Robot outside programmed path.&quot;;
TPReadFK check,&quot;Jog near path then press OK.&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;OK&quot;;
GOTO start;
ENDIF
pos1:=CPos();
posX:=pos1.x;
posY:=pos1.y;
PosZ:=pos1.z;
SSthickness:=2;
AccSet 100,30;
Reset doVacuum;
Reset doGrip;
Set doOpen;
TPErase;
HelpScreen;
label20:
VelSet 100,3500;
IF Stn1TotalBags<=Stn1BagCount AND LayPadReq1=0 THEN
Set doPall1Compl;
WaitTime 0.5;
Reset doPall1Compl;
Stn1BagCount:=0;
Stn1LayerOffset:=0;
WaitDI diPall1InPos,low;
LayPadReq1:=1;
ENDIF
IF Stn2TotalBags<=Stn2BagCount AND LayPadReq2<1 THEN
Set doPall2Compl;
WaitTime 0.5;
Reset doPall2Compl;
Stn2BagCount:=0;
Stn2LayerOffset:=0;
WaitDI diPall2InPos,low;
LayPadReq2:=1;
ENDIF
IF Stn3TotalBags<=Stn3BagCount AND LayPadReq3<1 THEN
Set doPall3Compl;
WaitTime 0.5;
Reset doPall3Compl;
Stn3BagCount:=0;
Stn3LayerOffset:=0;
WaitDI diPall3InPos,low;
LayPadReq3:=1;
ENDIF
!modified section for
!new vaccum gripper
!single bottle palletising

IF Stn3TotalBags<=Stn3BagCount AND LayPadReq4<1 THEN
Set doPall3Compl;
WaitTime 0.5;
Reset doPall3Compl;
Stn3BagCount:=0;
Stn3LayerOffset:=0;
WaitDI diPall3InPos,low;
LayPadReq4:=1;
ENDIF
IF diMenu=high THEN
PulseDO\PLength:=0.5,doMenuCancel;
HelpScreen;
ELSEIF diPall2InPos=high AND (diStn3BagReady=high OR PalletiseReq3=TRUE) AND Stn2BagCount<Stn2TotalBags AND Stn2BagCount>=Stn3BagCount AND LayPadReq2<1 THEN
Palletise2;
Display;
ELSEIF diPall3InPos=high AND (diStn3BagReady=high OR PalletiseReq3=TRUE) AND Stn3BagCount<Stn3TotalBags AND Stn3BagCount>=Stn2BagCount AND LayPadReq3<1 THEN
Palletise3;
Display;
ELSEIF diPall3InPos=high AND LayPadReq3>0 THEN
SlipOnPallet:=3;
SearchSlip;
ELSEIF diPall2InPos=high AND LayPadReq2>0 THEN
SlipOnPallet:=2;
SearchSlip;
ELSEIF diPall1InPos=high AND (diStn1BagReady=high OR PalletiseReq1=TRUE) AND Stn1BagCount<Stn1TotalBags AND LayPadReq1=0 THEN
Palletise1;
IF Stn1BagCount=Stn1TotalBags THEN
LayPadReq1:=2;
ELSE
LayPadReq1:=1;
ENDIF
BagReq1:=TRUE;
Display;
ELSEIF diPall1InPos=high AND LayPadReq1>0 THEN
SlipOnPallet:=1;
SearchSlip;
ELSEIF BagReq1=TRUE THEN
bag1;
ELSE
Display;
ENDIF
GOTO label20;
RETURN;
MoveJ p21,v100,z10,BagGrip;
MoveJ p22,v100,z10,BagGrip;
MoveJ p23,v100,z10,BagGrip;
MoveJ [[1360.57,20.72,1435.5],[0.539109,-0.454573,0.523166,-0.478563],[0,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v100,fine,BagGrip;
MoveJ InterStn1,v300,fine,BagGrip;
MoveJ InterStn2,v300,fine,BagGrip;
MoveJ InterStn3,v300,fine,BagGrip;
MoveL Place2a,v100,z20,BagGrip;
MoveJ SlipPlace2,v100,z20,BagGrip;
MoveJ pSynch,v1000,fine,BagGrip;
ENDPROC
END
 
Status
Not open for further replies.
Back
Top