Hi,
I have a little problem.
I have made a sub file that, when certain events occur, writes a few lines to a txt file. It works great.
Now, I want to make the robot to do it so I can access it remotely, or even better, write the file to a remote PC.
The access it remotely version: Just share the C:\KRC\Roboter\UserFiles folder on the network and remote PCs will see it if usedwith the KukaUser credentials. It works great.
The other version, however, is not.
So, all of our cells have a SCADA PC connected to them, and that'd be great to have these txt files to just spawn instantly there.
The method in theory is this:
Using CWRITE I make a mount, file handling from opening to closing, then unmount.
If I use the Administrator credentials in the KRL_mount command, and FOPEN in method "a", it works like charm.
However, if I use any other credentials that are not Administrators but still have read/write privileges to the folder I want to use, my access is denied with error number -2. If I use method "r", the read part of the function works, but neither the remove nor the writing will not in "a" method. The reason to not use Admin user is becasue by company policy, every user that has Admin rights have to change their password monthly, and we have over 100 Kuka robots to change these khash password on.
So this must be a privilege issue. What makes it more complicated is that if I minimize HMI on SmartPad and use Windows Explorer to write and delete files in the SCADA PCs shared folder, it also works as expected. So only the KRL_FOPEN does not work.
Robot is running KSS 8.6.6.296; KR50 R2100.
Here's part of my test code:
;FOLD Mount test
ON_ERROR_PROCEED
CWRITE($FCT_CALL, _OPSTATE, _MODE, "krl_fclose_all", -1)
IF _OPSTATE.MSG_NO == 0 THEN
MsgNotify("KRL_FCLOSE_ALL succeeded", "Close")
ELSE
MsgNotify("KRL_FCLOSE_ALL error %1", "Close",_OPSTATE.MSG_NO)
ENDIF
ON_ERROR_PROCEED
CWRITE($FCT_CALL, _OPSTATE, _MODE, "krl_mount", "/Log", "//[scada_pc_ip]/disk_d", "Administrator", "[khashPW]")
ON_ERROR_PROCEED
;CWRITE($FCT_CALL, _OPSTATE, _MODE, "krl_mount", "/Log", "//[scada_pc_ip]/disk_d", "User1", "[khashPW]")
ON_ERROR_PROCEED
;CWRITE($FCT_CALL, _OPSTATE, _MODE, "krl_mount", "/Log", "//[scada_pc_ip]/disk_d", "User2", "[khashPW]")
IF _OPSTATE.MSG_NO == 0 THEN
MsgNotify("KRL Mount succeeded", "Mount")
ELSE
MsgNotify("KRL_Mount error %1", "Mount",_OPSTATE.MSG_NO)
ENDIF
ON_ERROR_PROCEED
CWRITE($FCT_CALL, _OPSTATE, _MODE, "krl_fopen", "/Log/Log/Test.txt", "a", counter)
IF _OPSTATE.MSG_NO == 0 THEN
MsgNotify("KRL_Opem succeeded", "Open")
ELSE
MsgNotify("KRL_Open error %1", "Open",_OPSTATE.MSG_NO)
ENDIF
ON_ERROR_PROCEED
CWRITE($FCT_CALL, _OPSTATE, _MODE, "krl_fwriteln", counter, "testtartalom")
IF _OPSTATE.MSG_NO == 0 THEN
MsgNotify("KRL_Write succeeded", "Write")
ELSE
MsgNotify("KRL_Write error %1", "Write",_OPSTATE.MSG_NO)
ENDIF
ON_ERROR_PROCEED
CWRITE($FCT_CALL, _OPSTATE, _MODE, "krl_fclose", counter)
IF _OPSTATE.MSG_NO == 0 THEN
MsgNotify("KRL Close succeeded", "Fclose")
ELSE
MsgNotify("KRL CLose error %1", "Close",_OPSTATE.MSG_NO)
ENDIF
ON_ERROR_PROCEED
;CWRITE($FCT_CALL, _OPSTATE, _MODE, "krl_remove", "/Log/Log/Test.txt")
;MsgNotify("KRL_REMOVE error %1", "Open",_OPSTATE.MSG_NO)
ON_ERROR_PROCEED
CWRITE($FCT_CALL, _OPSTATE, _MODE, "krl_unmount", "/Log")
IF _OPSTATE.MSG_NO == 0 THEN
MsgNotify("KRL_unmount succeeded", "Mount")
ELSE
MsgNotify("KRL_unmount error %1", "Mount",_OPSTATE.MSG_NO)
ENDIF
;ENDFOLD
Display More