一、开发环境
board:BeagleBoard-X15开发板
kernel:linux 4.9.69-ti-rt-r85
filesystem:ubuntu 16.04
OpenPLC:v2
二、安装
之前已经做过OpenPLC的项目,但是后来因为一些事搁置了,现在需要给同事搭个openPLC开发环境,特此记录下。
openPLC官网:http://www.openplcproject.com/
1.选择硬件平台
我的项目方案是bb-x15当openPLC server端,因此这里选择 Linux(soft PLC)。
1)安装有关的packets(基于Debian的filesystem,ubuntu是基于debian的)**全部都要保证成功装上**
sudo apt-get update
sudo apt-get install build-essential pkg-config bison flex
sudo apt-get install autoconf automake libtool make nodejs git
2)从github clone OpenPLC
git clone https://github.com/thiagoralves/OpenPLC_v2.git
3)进入OpenPLC_v2文件夹然后构建
cd OpenPLC_v2
./build.sh
4)最后,当你被询问选择一个I/O驱动当openPLC的client
The OpenPLC needs a driver to be able to control physical or virtual hardware.
Please select the driver you would like to use:
1) Blank 4) RaspberryPi 7) ESP8266
2) Modbus 5) UniPi 8) Arduino+RaspberryPi
3) Fischertechnik 6) Arduino 9) Simulink
#?
如果有合适的直接选你想要的就行,我项目中使用的是公司自己生产的IO板子,所以我选择1)Blank 检查是否安装成功就行。
三、运行OpenPLC
sudo nodejs server.js
打开浏览器输入 http://localhost:8080.
就能看到OpenPLC的Server界面如下,就可以加载PLC控制程序了
四、安装PLC编辑器PLCOpen Editor
PLCOpen Editor就是用来写PLC程序用的,支持5种编程语言 :Ladder Logic (LD), Function Block Diagram (FBD), Instruction List (IL), Structured Text (ST), and Sequential Function Chart (SFC),最后都会生成st语言的执行文件
Linux下载地址:
https://github.com/thiagoralves/OpenPLC_Files/blob/master/Software/PLCopen%20Editor%20v1.2%20-%20Linux.zip?raw=true
1)安装依赖
sudo apt-get install python-wxgtk3.0 pyro python-numpy python-nevow python-matplotlib python-lxml
2)运行
python PLCOpenEditor.py
这里还有个Hello_World.st可以下载:
https://docs.google.com/uc?export=download&confirm=no_antivirus&id=0BwyThwktWLAla1pFWVl2ZjgxdTQ