锦方的个人网页 · 如果有一天你突然想起了我


linux install OpenPLC

目录

安装

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
### [下载编辑器](http://www.openplcproject.com/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