KRC4 配置附加程序随 SmartHMI 自动启动

在 KRC4 的 Windows 平台可以运行单独的 windows 程序,通常做法可以将程序的快捷方式扔到 “启动” 目录里达到自动运行的目的。不过这样程序启动时,SmartHMI 还没有完成启动,所以这种方式不是很理想。

通过观察 SmartHMI 的启动方式,是通过自动运行 StartKRC.exe 从而启动 SmartHMI 的,配置文件是 StartKRC.exe.config 这个 XML 文件。

StartKRC

<configuration>
   <kukaroboter.startkrc>
      <applications>
         <application internal="ClearRamDisk" conditions="NoKrcRunning"/>
         <application filename="VxWin\UploadRTOS.exe" arguments="-faststart &quot;-config &apos;%INSTALLATIONDIR%\ROBOTER\Config\System\%ENVPATH%\VxWin\VxWin.config&apos; -file &apos;%INSTALLATIONDIR%\ROBOTER\Config\System\Common\VxWin\faststart.cfg&apos; -vmf &apos;%INSTALLATIONDIR%\VXWIN\Vmf.bin&apos; -os &apos;%INSTALLATIONDIR%\ROBOTER\vxworks.bin&apos; -startvmfos&quot;" conditions="NoKrcRunning" waitAfterStart="2"/>
         <application filename="VxWin\UploadRTOS.exe" arguments="-config &quot;&apos;%INSTALLATIONDIR%\ROBOTER\Config\System\%ENVPATH%\VxWin\VxWin.config&apos; -vmf &apos;%INSTALLATIONDIR%\VXWIN\Vmf.bin&apos;&quot; &quot;%INSTALLATIONDIR%\ROBOTER\vxworks.bin&quot;" conditions="NoKrcRunning" waitAfterStart="5"/>
         <application filename="SmartHmi\SmartHMI.exe" waitType="WaitForKrcReady" timeOut="120" mainWindowId="SmartHMI"/>
         <application filename="VxWin\UploadRTOS.exe" arguments="-faststart -once -nosleep -nowait" creationFlags="NoWindow" conditions="HmiRunning"/>
         <application filename="Services\WorkVisualServiceHost\WorkVisualServiceHost.exe" servicename="WorkVisualServiceHost" />
         <application filename="Services\scheduler\KUKASchedulerService.exe" servicename="KUKA Scheduler Service"/>
         <application filename="VxWin\UploadRTOS.exe" arguments="-x -nowait" onStart="None" onStop="Run" waitType="WaitForExit" timeOut="10"/>
      </applications>
      <behaviour timeOut="60" waitForPowerOk="0"/>
      <trayiconvisibility trayIcon="true"/>
      <diagnosis application="%INSTALLATIONDIR%\Util\KRCDiag\KRCDiag.exe" active="true"/>
   </kukaroboter.startkrc>
</configuration>

观察第7行,等待类型 “WaitForKrcReady” 含义可以猜测就是等待KRC启动完成后启动 SmartHMI.exe 。

我们可以仿效启动自己的程序,例如,欲自动启动程序 C:\KUKAVarProxy 6.3.101\KUKAVarProxy.exe ,那么我们可以在第7行后面再加一行,这样来写

<configuration>
   <kukaroboter.startkrc>
      <applications>
         <application internal="ClearRamDisk" conditions="NoKrcRunning"/>
         <application filename="VxWin\UploadRTOS.exe" arguments="-faststart &quot;-config &apos;%INSTALLATIONDIR%\ROBOTER\Config\System\%ENVPATH%\VxWin\VxWin.config&apos; -file &apos;%INSTALLATIONDIR%\ROBOTER\Config\System\Common\VxWin\faststart.cfg&apos; -vmf &apos;%INSTALLATIONDIR%\VXWIN\Vmf.bin&apos; -os &apos;%INSTALLATIONDIR%\ROBOTER\vxworks.bin&apos; -startvmfos&quot;" conditions="NoKrcRunning" waitAfterStart="2"/>
         <application filename="VxWin\UploadRTOS.exe" arguments="-config &quot;&apos;%INSTALLATIONDIR%\ROBOTER\Config\System\%ENVPATH%\VxWin\VxWin.config&apos; -vmf &apos;%INSTALLATIONDIR%\VXWIN\Vmf.bin&apos;&quot; &quot;%INSTALLATIONDIR%\ROBOTER\vxworks.bin&quot;" conditions="NoKrcRunning" waitAfterStart="5"/>
         <application filename="SmartHmi\SmartHMI.exe" waitType="WaitForKrcReady" timeOut="120" mainWindowId="SmartHMI"/>
         <application filename="C:\KUKAVarProxy 6.3.101\KUKAVarProxy.exe" waitType="WaitForKrcReady" timeOut="120" mainWindowId="KUKAVarProxy 6.3.101"/>
         <application filename="VxWin\UploadRTOS.exe" arguments="-faststart -once -nosleep -nowait" creationFlags="NoWindow" conditions="HmiRunning"/>
         <application filename="Services\WorkVisualServiceHost\WorkVisualServiceHost.exe" servicename="WorkVisualServiceHost" />
         <application filename="Services\scheduler\KUKASchedulerService.exe" servicename="KUKA Scheduler Service"/>
         <application filename="VxWin\UploadRTOS.exe" arguments="-x -nowait" onStart="None" onStop="Run" waitType="WaitForExit" timeOut="10"/>
      </applications>
      <behaviour timeOut="60" waitForPowerOk="0"/>
      <trayiconvisibility trayIcon="true"/>
      <diagnosis application="%INSTALLATIONDIR%\Util\KRCDiag\KRCDiag.exe" active="true"/>
   </kukaroboter.startkrc>
</configuration>

实际测试结果,可以实现KUKAVarProxy.exe 自动随SmartHMI一起启动,而且停止 KRC后,还可以随SmartHMI一起关闭。

SMARTHMI_APP_RUN附:Windows批处理延时启动脚本

@echo off
FOR /L %%a IN ( 70,-1,0 ) DO (
 echo Port: 7000
 echo Starting ... 
 echo %%a
 ping 127.0.0.1 -n 2 > nul
 cls
)
start /MIN KUKAVarProxy.exe

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.