I've been encountering a sporadic EKI error state when leaving our system unattended overnight.
I have a loop running in SPS which will use Ethernet.KRL to try to open a connection to a local server and then wait to be sent a command. I've found that sometimes when the kuka side of the system is left on (but no commands are being sent/the server is off), the following error occurs after a number of hours. To be clear, this is when SPS the running, but no other programs are selected.
First error: EKI00022: Error while reading the configuration. XML not valid. Originator: <EthernetKRL>
Upon clearing error 1: EKI00003: File access failed Originator: <EthernetKRL>
Upon clearing error 2: KSS02804: Internal error (file: ads_in.c, line 689, value: 'H5BF8') (yikes)
I've verified that the EKI XML file is correct, and a reboot will clear all the errors, so I assume that is caused by something else going wrong.
Kuka support informed me that the KSS error means a program has more than 9500 lines, but they were unable able to tell me what the function of ads_in.c was.
Does anyone know what could be causing this? I've included a stripped down (but still rather impenetrable) version of the SPS file below, along with the software versions.
What's confusing me is the randomness of the error, it only ever occurs when the system has been left inactive, but the times can range from 6 hours to 50.
I've tested to see if it's caused by the spam of MsgNotify() calls, but I've successfully called it far more than 9500 times without the error presenting.
My next theory was that I was somehow not correctly clearing the connection or RET object. Any help would be appreciated!
Robot: KR6 R900-2
Controller: KRC4 Compact
KSS: V8.3.36
Kernel: KS V8.3.403
Ethernet.KRL: Version 2.2.8
The server is just a linux NUC, but since this error presents when the nuc is off, I haven't included details on it.
&ACCESS RVP
&REL 31
&COMMENT PLC on control
DEF connectionSPS ( )
;FOLD DECLARATIONS
;FOLD BASISTECH DECL
;Automatik extern
DECL STATE_T STAT
DECL MODUS_T MODE
;ENDFOLD (BASISTECH DECL)
;FOLD USER DECL
; Please insert user defined declarations
DECL CHAR channelName[14]
DECL CHAR _command[24]
DECL EKI_STATUS Ret
DECL INT flagConnected
DECL INT flagDataReceived
DECL BOOL isSimulation ; true if a simulated commmand has been received
DECL INT simulationTime ; time the simulated action should last
DECL INT simulationTimerIndex
;ENDFOLD (USER DECL)
;ENDFOLD (DECLARATIONS)
;FOLD INI
;FOLD AUTOEXT INIT
INTERRUPT DECL 91 WHEN $PRO_STATE1==#P_FREE DO RESET_OUT ()
INTERRUPT ON 91
$LOOP_MSG[]=" "
MODE=#SYNC
$H_POS=$H_POS
;Automatik extern
IF $MODE_OP==#EX THEN
CWRITE($CMD,STAT,MODE,"RUN /R1/CELL()")
ENDIF
;ENDFOLD (AUTOEXT INIT)
;FOLD BACKUPMANAGER PLC INIT
BM_ENABLED = FALSE
BM_OUTPUTVALUE = 0
;ENDFOLD (BACKUPMANAGER PLC INIT)
;FOLD TQM_INIT
TorqueDefinitions()
;ENDFOLD (TQM_INIT)
;FOLD USER INIT
; Please insert user defined initialization commands
_command[] = "idle"
channelName[]="communication"
flagConnected = 100
flagDataReceived = 1
mainProgCommand = #idle ; waiting for a command
armState = #waiting
debugMode = FALSE ; make sure debugMode is off
isSimulation = FALSE ; make sure simulation mode is off
simulationTime = 0 ; initalise simulation time to 0
simulationTimerIndex = 1
Ret = EKI_Clear(channelName[]) ;tind up any open connections on reset just in case
;ENDFOLD (USER INIT)
;ENDFOLD (INI)
LOOP
WAIT FOR NOT($POWER_FAIL)
TORQUE_MONITORING()
;FOLD BACKUPMANAGER PLC
IF BM_ENABLED THEN
BM_OUTPUTSIGNAL = BM_OUTPUTVALUE
ENDIF
;ENDFOLD (BACKUPMANAGER PLC)
;FOLD USER PLC
;Make your modifications here
SWITCH armState
CASE #waiting ; the arm is waiting for a command
IF $FLAG[flagConnected] == FALSE THEN ;If there is no connection, initialise EKI
Ret = EKI_Init (channelName[])
EKI_Check (Ret, #NOTIFY, channelName[])
IF (Ret.MSG_NO == 0) THEN ; If init was successful, open a channel
Ret = EKI_Open (channelName[])
EKI_Check (Ret, #NOTIFY, channelName[])
IF Ret.MSG_NO <> 0 THEN ; if failed to open channel post error msg
MsgNotify("Failed to open connection with error no: %1", "error", Ret.MSG_NO)
ENDIF
ELSE ; if failed to intialite ret post error msg and clear ret
MsgNotify("Initialisation failed with error no: %1", "error", Ret.MSG_NO)
Ret = EKI_Clear(channelName[])
ENDIF
ENDIF
IF (Ret.MSG_NO == 0) AND (Ret.Connected) THEN ;If a channel has been opened successfully
IF $flag[flagDataReceived] == TRUE THEN ; if data received
Ret = EKI_GetBool (channelName[], "Server/Simulation/@On", isSimulation) ;Get simulation mode bool
Ret = EKI_GetString (channelName[], "Server/Command/@Name", _command[]) ;Get command name to run
armState = #executing
IF isSimulation THEN ; if a simulatoin command, post a message, get the time and set the timer
MsgNotifyText("Simulation Command received from server: %1", "egg", 0, _command[])
Ret = EKI_GetInt (channelName[], "Server/Simulation/@Time", simulationTime)
$TIMER[simulationTimerIndex] = 0 ;reset and start timer for simulated action
$TIMER_STOP[simulationTimerIndex] = FALSE
ELSE
MsgNotifyText("Command received from server: %1", "egg", 0, _command[])
IF (StrComp("openGripper", _command[], #NOT_CASE_SENS)) THEN ; set command
mainProgCommand = #openGripper
ENDIF
IF (StrComp("closeGripper", _command[], #NOT_CASE_SENS)) THEN ; set command
mainProgCommand = #closeGripper
ENDIF
ENDIF
$FLAG[flagDataReceived] = FALSE ; clear data received flag
ENDIF
ENDIF
CASE #executing
MsgNotify("armState changed to executing")
IF (isSimulation) AND ($TIMER[simulationTimerIndex] > simulationTime) THEN
$TIMER_STOP[simulationTimerIndex] = TRUE
isSimulation = FALSE
simulationTime = 0
armState = #done
ENDIF
CASE #done
MsgNotify("armState changed to done")
mainProgCommand = #idle ; Reset to idle
; Return "done" message
Ret = EKI_SetString (channelName[], "Robot/@Status", "done")
Ret = EKI_Send(channelName[], "Robot")
EKI_Check (Ret, #NOTIFY, channelName[])
IF Ret.MSG_NO <> 0 THEN
MsgNotify("Failed to send response to server with error no: %1", "error", Ret.MSG_NO)
ENDIF
; Close the channel and clear the connection
Ret = EKI_Close(channelName[])
Ret = EKI_Clear(channelName[])
; Reset to waiting to start cycle again
armState = #waiting
DEFAULT
MsgNotify("ESPS0001: armState incorrectly assigned")
ENDSWITCH
;ENDFOLD (USER PLC)
ENDLOOP
;FOLD ;%{H}
;FOLD
END
;ENDFOLD
DEF RESET_OUT ( )
INT N
MsgLoop(" ")
IF REFLECT_PROG_NR == 1 THEN
FOR N = 0 TO PGNO_LENGTH - 1
$OUT[PGNO_FBIT_REFL + N] = FALSE
ENDFOR
ENDIF
IF (PGNO_REQ>0) THEN
$OUT[PGNO_REQ]=FALSE
ELSE
IF (PGNO_REQ<0) THEN
$OUT[-PGNO_REQ]=TRUE
ENDIF
ENDIF
END
;ENDFOLD (USER SUBROUTINE)
;ENDFOLD
Display More