锦方的个人网页

linux install OpenPLC

发布 · 约 236 字 · 预计 1 分钟

在 Linux 上构建 OpenPLC、选择驱动并安装 PLCopen Editor,记录运行时遇到的错误。

归档记录:本文最后更新于 2017 年,文中涉及的软件版本、配置或命令可能已随环境演进发生变化。

本文目录(共 14 节)

安装 #

1、使用apt-get安装数据包 #

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上的OpenPLC存储库 #

git clone https://github.com/thiagoralves/OpenPLC_v2.git

3、构建OpenPLC

cd OpenPLC_v2
./build.sh

OpenPLC需要一个驱动程序来控制物理或虚拟硬件 #

1) Blank 4) RaspberryPi 7) ESP8266 2) Modbus 5) UniPi 8) Arduino+RaspberryPi 3) Fischertechnik 6) Arduino 9) Simulink

因为有个树梅派所以我选择了9 #

安装PLCopen Editor #

下载编辑器[存档] #

需要安装依赖包 #

sudo apt-get install python-wxgtk3.0
sudo apt-get install pyro
sudo apt-get install python-numpy
sudo apt-get install python-nevow
sudo apt-get install python-matplotlib
sudo apt-get install python-lxml

安装上面列出的所有软件包后,在PLCopen Editor的解压文件夹内输入: #

python PLCOpenEditor.py

运行OpenPLC #

错误 #

module.js:340 throw err; ^ Error: Cannot find module '/home/jin/server.js' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:906:3

解决错误 #

原因是上面驱动程序的选择,由于我是使用电脑来运行plc所以要选择第一个空白驱动。进到OpenPLC_v2文件夹重新构建选择第一个空白驱动。 #

上传.st文件 #

sudo nodejs server.js

✉ 对本文有补充或勘误?欢迎就本文写信交流。