概述
THE OPENPLC PROJECT | openplcproject.comAn open source alternative to automation
https://www.openplcproject.com/
OpenPLC是个开源的PLC,主要包括三部分
- PLC运行时。 用于支持PLC程序的运行。在不同的操作系统或硬件平台下是不一样的。
- Editor 编辑器。 用于编辑业务逻辑,类似于西门子博途的功能,当然没人家复杂啦。
- HMI Builder 人机接口设计。 名为SCADA BR,用于进行监控。
目前PLC运行时支持以下平台:
我们在树莓派4B平台上进行测试。
在树莓派上安装运行时
具体命令可以参见官方网站OPENPLC ON RASPBERRY PI | openplcproject.com
git clone https://github.com/thiagoralves/OpenPLC_v3.git
cd OpenPLC_v3
./install.sh rpi
树莓派的操作系统选择上,官方推荐使用Raspberry Pi OS,我试用了一下Raspberry Pi OS Lite,感觉有些问题,键盘布局不一样,所以就用的ubuntu for raspberry。
安装和运行是非常简单的。打开http://192.168.1.1:8080/ 就可以看到运行时的后台啦,当然IP需要换成实际的IP。
用户名 openplc , 密码openplc
在Hardware里面切换到Raspberry Pi。
此时会有一个编译的过程。我的系统上报了一个错误,无法找到 WiringPi.h 这个头文件,查看openplc的安装脚本,background_installer.sh,有apt install wiringpi,在安装过程中是有安装的,但在ubuntu上这个库只包含可执行程序,不包含用于开发的头文件和静态库。
在RaspberryPi OS中应该是用apt install wiringpi可以安装全部可执行程序+头文件。
解决办法就是自行编译wiringpi。
wiringpi这个库的代码位于: https://github.com/WiringPi/WiringPi/tree/final_official_2.50
wiringpi的编译和安装是比较简单的,直接./build就可以。详细可以参考以下地址
http://wiringpi.com/
编辑器
我下载的windows版的,直接下载使用就可以了。
helloworld程序参见这个页面 最下面的链接 https://www.openplcproject.com/runtime/raspberry-pi/
helloworld找开后是这个样子。
程序的作用是有一个button控制一个灯, 如果按button超过2秒,灯就会亮。
button绑定的是 %IX0.0 ,对应的是树莓派GPIO第3条腿。
lamp绑定的是%QX0.0 ,对应的是树莓派GPIO第8口。
生成.ts文件,再在树莓派的后台里上传,再点击Start PLC即可运行此程序(我这里点过了显示的是Stop)。
注意不要上传错误,如果上传错误的.st文件,可能会产生下面的问题
error: ‘LogMessage’ was not declared in this scope
LogMessage(GetFbVar(LEVEL),(char*)GetFbVar(MSG, .body),GetFbVar(MSG, .len));
^~~~~~~~~~
HMI Builder
这个模块名为ScadaBR ,是用JAVA写的网页后台。
官方提供了一个VirtualBox的虚拟机镜像,可以下载后直接使用。
也可以自行安装。
git clone https://github.com/thiagoralves/ScadaBR_Installer.git
cd ScadaBR_Installer
./install_scadabr.sh
虚拟机按要求运行后,用浏览器打开http://192.168.1.100:8080/ScadaBR/
用户名admin 密码 admin
点击界面第6个图标,打开数据源。 点击右侧的编辑按钮,进入编辑
填入name,Host的IP(树莓派的IP),AddPoint,增加一个点。
点击AddPoint出现的如下所示,进行相关设置后点击磁盘标志即可保存此点。
记得点击左侧的Status,Enable这个点。否则默认是禁用状态。
在首页可以查看所添加的点的实时值。
这些值跟modscan看到的值是一致的。
ScadaBR状态图
ScadaBR还可以生成状态图,根据点的值不同而显示不同的图片。
具体的过程可以参考
在树莓派上使用openPLC
|SCADA| OpenPLC + Raspberry Pi + ScadaBR: Part 1 – Out of My Element
几个可能有用的链接:
How to find hardware configuration in OpenPLC Editor - OpenPLC Forumhttps://openplc.discussion.community/post/how-to-find-hardware-configuration-in-openplc-editor-11871121?pid=1327547514&highlight=logmessage
Control Engineering | Free PLC programming software for educationControl Engineering - With the pandemic measures and schools transitioning to remote education professors looking for ways to get students hands-on experience usinghttps://www.controleng.com/articles/free-plc-programming-software-for-education/
|SCADA| OpenPLC + Raspberry Pi + ScadaBR: Part 1 – Out of My ElementSeeing as we're all currently living through a pandemic and can't really go anywhere or do anything in our free time, I figured I'd may as well look into something I've been interested in for a while: SCADA. More specifically, getting some hands-on experience with SCADA using some free, opensource software and hardware I mostly…https://0ut0fmyelement.wordpress.com/2020/03/20/scada-openplc-raspberry-pi-scadabr-part-1/
最后
以上就是简单睫毛膏为你收集整理的OpenPLC试用总结在树莓派上安装运行时编辑器HMI Builder ScadaBR状态图的全部内容,希望文章能够帮你解决OpenPLC试用总结在树莓派上安装运行时编辑器HMI Builder ScadaBR状态图所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复