本文使用webmin启动远程工控机中的EPICS IOC,受控设备使用PI公司的六轴台以及相应的控制器C-887:
1)控制器C-887
2) 六轴台:
3)在工控机上安装用于与C-887控制器进行通信的EPICS IOC程序,安装结束后,进入启动目录(EPICS IOC代码位于Github上GitHub - epics-motor/motorPIGCS2: EPICS asyn motor drivers for PI GCS2 controllers):
[root@localhost iocC887]# ls
envPaths Makefile PI_GCS2.substitutions start.sh st.cmd
编辑st.cmd,设置C-887控制器的IP地址,用于连接控制器:
#!../../bin/linux-x86_64/C887
#- You may have to change C887 to something else
#- everywhere it appears in this file
< envPaths
cd "${TOP}"
## Register all support components
dbLoadDatabase "dbd/C887.dbd"
C887_registerRecordDeviceDriver pdbbase
drvAsynIPPortConfigure("C867_ETH","192.168.3.220:23",0,0,0)
# Turn on asyn trace
asynSetTraceMask("C867_ETH",0,3)
asynSetTraceIOMask("C867_ETH",0,1)
# PI_GCS2_CreateController(portName, asynPort, numAxes, priority, stackSize, movingPollingRate, idlePollingRate)
PI_GCS2_CreateController("C867", "C867_ETH",6, 0,0, 100, 1000)
cd "${TOP}/iocBoot/${IOC}"
dbLoadTemplate("PI_GCS2.substitutions")
iocInit
编辑一个start.sh的shell脚本,内容如下:
#!/bin/bash
cd /usr/local/EPICS/program/motorHexpod-C887/iocBoot/iocC887
../../bin/linux-x86_64/C887 st.cmd
在/root目录下,创建三个文件其内容如下所示:
C887-Check-EPICS-Server.sh:用于查看IOC是否已经启动
[root@localhost ~]# cat C887-Check-EPICS-Server.sh
#!/bin/bash
screen -ls | grep "\.C887\b"
if [ $? -eq 0 ];then
echo "C887 Server is already running now!"
else
echo "C887 Server is not running!"
fi
C887-Start-EPICS-Server.sh:用于启动EPICS IOC
[root@localhost ~]# cat C887-Start-EPICS-Server.sh
#!/bin/bash
source /etc/profile.d/epics.sh
echo "Start C887 EPICS server, waiting ..."
screen -ls | grep "\.C887\b"
if [ $? -eq 0 ];then
echo "C887 server is already running now!"
else
cd /usr/local/EPICS/program/motorHexpod-C887/iocBoot/iocC887/
screen -dmS C887 ./start.sh
ret=$?
sleep 5
if [ $ret -eq 0 ];then
echo "Start C887 Server successfully"
exit 0
else
echo "Failed to Start C887 Server"
exit 1
fi
fi
echo "Start finished!"
C887-Stop-EPICS-Server.sh:用于结束EPICS IOC
[root@localhost ~]# cat C887-Stop-EPICS-Server.sh
#!/bin/bash
screen -ls | grep "\.C887\b"
if [ $? -ne 0 ];then
echo "C887 Server is not running now!"
exit 1
fi
echo "Stop C887 EPICS Server ..."
kill $(screen -ls | grep "C887" | cut -d "." -f1)
sleep 5
echo "C887 EPICS Server already stopped"
安装Webmin,并且启动,用局域网中其它计算机的浏览器进行初始登录,登录名为root,密码为安装系统时为root设置的密码:
登录后进入Tools->Custom Commonds创建三个用户自定义命令:
创建结束后,用户界面如下:
通过点击以上三个按钮,进行测试:
1、点击View C-887 EPICS Server:
2、点击Start C-887 EPICS Server:
客户端也正常显示了:
3、点击View C-887 EPICS Server:
4、点击Stop C-887 EPICS Server:
客户端连接也都断开了: