OpenSCADA系统添加自定义模块
前言
OpenSCADA作为一个开源的Scada系统,本文基于此系统来添加一个子模块,例子中准备添加一个支持61850协议的模块(名称为SP61850)。
OpenScada内置支持如下的子系统
- “Data Bases”
- “Communication Interfaces, Transports”
- “Protocols of the communication interfaces”
- “Data Sources and Data Acquisition”
- “Archives(Histories) (of messages and values)”
- “User Interfaces (GUI, TUI, WebGUI, speach, signal …)”
- “Additional modules”
我们所要添加的子模块隶属于如上的"Additional modules",即"special"子系统。
步骤
$ cd openscada-0.8.0.5/src/moduls/special
$ cp -r =Tmpl= SP61850; cd SP61850
$ rm -f configure.in
编辑"module.cpp"文件 2.1 module info 改为如下:
//!!! Module's meta-information. Change for your module.
//*************************************************
//* Modul info! *
#define MOD_ID "SP61850"
#define MOD_NAME _("Special 61850 model")
#define MOD_TYPE SSPC_ID
#define VER_TYPE SSPC_VER
#define SUB_TYPE "LIB"
#define MOD_VER "0.0.1"
#define AUTHORS _("Carey Chow")
#define DESCRIPTION _("Special subsystem 61850 module.")
#define LICENSE "MyLicense"
//*************************************************
2.2 全文搜索替换 Tmpl –> SP61850 2.3 注释掉模板中无效的地方
//!!! Place here your code for internal objects initialize.
//> Reg functions
//reg( new MathAcos() );
//reg( new MathAsin() );
编辑"module.h"文件 3.1 全文搜索替换 Tmpl –> SP61850 3.2 添加变量和函数定义
//Attributes
int m_fnc;
void list( vector<string> &ls ) { chldList(m_fnc,ls); }
AutoHD<TFunction> at( const string &id ) { return chldAt(m_fnc,id); }
编辑 “Makefile.am” 文件全文搜索替换 Tmpl –> SP61850 5.
编辑 openscada-0.8.0.5/configure.in 全局配置文件,添加sp61850模块的编译项在 SystemTests 模块 AX_MOD_EN(SystemTests,[disable build module Special.SystemTests],disable,[],[AC_MSG_RESULT(Build module: Special.SystemTests) AC_CONFIG_FILES(src/moduls/special/SystemTests/Makefile) SpecSub_mod="${SpecSub_mod}SystemTests “]) 后面添加 SP61850 模块 AX_MOD_EN(SP61850,[disable build module Special.SP61850],disable,[],[AC_MSG_RESULT(Build module: Special.SP61850) AC_CONFIG_FILES(src/moduls/special/SP61850/Makefile) SpecSub_mod="${SpecSub_mod}SP61850 “]) 6.
重新 configure,并编译我们新建立的模块
$ autoreconf -if
#### 有可能需要安装 autoreconf 工具 sudo apt-get install autoconf libtool
$ ./configure --enable-SP61850
$ make
$ sudo make install
重新启动openscada系统,在special子系统下面就会找到我们的model(SP61850)
$ openscada
加入讨论
新评论 — 条评论保存在本站自托管服务里,无需注册登录,填个昵称就能留言;不依赖任何第三方 Cookie 或账号。请尽量说点有用的 :)