Hi Everyone,
Brief Resume:
I need to check the current distance of the part to the sensor that triggers the conveyor synchronization. According to the manual I have a function to read the current conveyor speed but not the current distance.
The code I am using is posted bellow the message.
System:
WorkVisual 5.0
KRC4
KSS 8.5.8
Conveyor 7.1.2
Manual I am reading: ConveyorTech 7.1 and Kuka System Variables
Context:
In the conveyor follow and conveyor skip instructions I have a Wait Distance parameter. After the wait distance is reached the program moves to de conv move instruction where I have my part program.
After browsing the follow and skip instructions I found that this distance is controlled using the $SEN_PREA_C[1] variable. According to the manual: "Exchange of real values in main run between the controller and the sensor interface program", which sounds about what I need.
Now, when I try to control this variable in my part program I get these values:
REAL PartDistances[4]
PartDistances[1]=0.0
PartDistances[2]=0.0
PartDistances[3]=1414.10522
PartDistances[4]=1738.78918
1- At the beggining of the program after the trigger (at 1230mm)
2- After running the Home Position (Base 0) and Waiting a Timer
3- In the middle of the program (Value Looks Ok)
4- At the end of the program (Value Looks Ok)
As you can see the first 2 values come out as 0.0 and I kinda need to know where the part is at these times. Is there a way to get the current distance or the variable $SEN_PREA_C only starts working after the first schyncronized movement?
Thanks For Your Help
CODE:
-----------------------------------------------------------------------------------------------------------------------
DEF Main_Del( )
INI
CONV INI
;Start the Conveyor
Conveyor.INI_OFF LinearConveyor1
Conveyor.ON LinearConveyor1
;Follow first Part
Conveyor.FOLLOW LinearConveyor1, Movement 1, Cancel on: Max_time 240, Input 1, Input-Level TRUE, Flag 1, Flag-Level TRUE, WaitDist 1230, MaxDist 3000
LOOP
Conveyor.Skip LinearConveyor1, Skip to part index 1, Movement 1, Cancel on: Max_time 240, Input 1, Input-Level TRUE, Flag 1, Flag-Level TRUE, WaitDist 1250, MaxDist 3000
Conveyor.Quit LinearConveyor1, Stop after error FALSE, Reset SEN_PREA_C TRUE
ENDLOOP
END
DEF CONV_MOV(Z_CONV_NBR:IN,Z_MOV_NBR:IN)
INI CONV_MOV
CONVEYOR 1 MOVEMENT GROUP 1
Part_Del()
CONVEYOR 1 MOVEMENT GROUP 2
CONVEYOR 2 MOVEMENT GROUP 1
CONVEYOR 2 MOVEMENT GROUP 2
CONVEYOR 3 MOVEMENT GROUP 1
CONVEYOR 3 MOVEMENT GROUP 2
CONVEYOR 4 MOVEMENT GROUP 1
CONVEYOR 4 MOVEMENT GROUP 2
CONVEYOR 5 MOVEMENT GROUP 1
CONVEYOR 5 MOVEMENT GROUP 2
END CONV_MOV
CONTINUE
END
-----------------------------------------------------------------------------------------------------------------------
DEF Part_Del( )
INI
;Read Distance
PartDistances[1]= $SEN_PREA_C[Z_SEN_PREA_NBR[1]]
PTP HOME1 VEL=100 % DEFAULT
WAIT TIME=2.1 SEC
;Read Distance
PartDistances[2]= $SEN_PREA_C[Z_SEN_PREA_NBR[1]]
;P4
$BWDSTART = FALSE
LDAT_ACT = LCPDAT4
FDAT_ACT = FP4
BAS(#CP_PARAMS, 0.25)
SET_CD_PARAMS (0)
LIN {X 0.0, Y 0.0, Z -170.0, A 0.0, B 0.0, C 0.0}:XP4 C_Dis C_Dis
;P3
$BWDSTART = FALSE
LDAT_ACT = LCPDAT3
FDAT_ACT = FP3
BAS(#CP_PARAMS, 2.0)
SET_CD_PARAMS (0)
LIN {X 0.0, Y 0.0, Z -70.0, A 0.0, B 0.0, C 0.0}:XP3 C_Dis C_Dis
;Read Distance
PartDistances[3]= $SEN_PREA_C[Z_SEN_PREA_NBR[1]]
;P2
$BWDSTART = FALSE
LDAT_ACT = LCPDAT2
FDAT_ACT = FP2
BAS(#CP_PARAMS, 2.0)
SET_CD_PARAMS (0)
LIN {X 0.0, Y 0.0, Z -170.0, A 0.0, B 0.0, C 0.0}:XP2 C_Dis C_Dis
;P1
$BWDSTART = FALSE
LDAT_ACT = LCPDAT1
FDAT_ACT = FP1
BAS(#CP_PARAMS, 0.25)
SET_CD_PARAMS (0)
LIN {X 0.0, Y 0.0, Z -20.0, A 0.0, B 0.0, C 0.0}:XP1 C_Dis C_Dis
;Read Distance
PartDistances[4]= $SEN_PREA_C[Z_SEN_PREA_NBR[1]]
PTP HOME1 VEL=100 % DEFAULT
END