1 Star 0 Fork 59

netgod / neuron

forked from EMQX / neuron 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
LGPL-3.0

Neuron

GitHub Release Slack Discord Twitter YouTube

English | 简体中文

Neuron 是一个工业物联网(IIoT)边缘工业协议网关软件,用于现代大数据技术,以发挥工业 4.0 的力量。它支持对多种工业协议的一站式访问,并将其转换为标准 MQTT 协议以访问工业物联网平台。

Neuron 2.0 版本对 1.x 版本中的部分非必要功能进行了精简,重点聚焦在工业协议的数据采集和转发功能上,以期为工业物联网平台建设提供更加高效灵活的一站式协议接入与管理。

产品目标和功能

Neuron 的设计目标是专注于工业物联网的数据采集、转发和汇聚:通过将来自繁杂多样工业设备的、不同协议类型的数据转换为统一标准的物联网 MQTT 消息,从而实现这些独立设备的互联互通,更好地融入工业物联网的大系统之中,进行远程的直接控制和信息获取。

我们希望 Neuron 既可以在低端嵌入式 Linux 设备中运行,也可以运行在有较大内存的 Linux 主机中,以支持大规模的连接设备和海量的数据点位。因此 Neuron 的设计需要能够有极少的内存占用和极低的 CPU 占用,同时具有良好的可伸缩性,可满足不同运行资源条件下的需求。

Neuron 的主要功能和特性如下:

  • 插件化的南向设备驱动和北向应用;
  • 内置有轻量级的 Web Server,可以通过浏览器来配置和控制、监听设备;
  • 可替换的 MQTT 客户端,可以通过 MQTT 接口来控制和读写设备;
  • 支持同时连接大量不同协议的工业设备;
  • 和 EMQ 的其他产品高度融合,包括 EMQ X、NanoMQ、eKuiper(由 EMQ 发起,现归属于 LF Edge 基金会维护运营) 等;
  • 支持 Neuron 运行期更新设备驱动。

功能的完整列表,请参阅应用和驱动使用介绍

获取更多信息,请访问官网

架构设计

现代的 CPU 大都已经是多核心的了,即便是用在嵌入式系统中比较低端的 ARM 和 Risc-V 架构的 CPU,也都拥有多核心的芯片。因此我们需要能够充分利用这些多核心 CPU ,也就是说,Neuron 需要具有非常好的多核多线程性能。为此,我们使用了 NNG 这个基础消息库,这是一个多线程的 IO 处理和消息处理的异步并发库,能够充分利用 CPU 的多个核心。

我们采用了星型总线这一组织形式:有一个消息路由中心,该消息路由基于 NNG 提供高效率的消息转发。消息的发送和接收是线程间通讯,使用共享 Buffer 和智能指针,没有任何的内存拷贝,具有非常高的效率。围绕着这个路由中心,是各个具体功能的节点,由 Adapter 和 Plugin 组成。这些节点既可以是内置固有的,如轻量级的 Web Server;也可以是动态增加的,如各种设备驱动、MQTT 客户端、eKuiper 接口等。这样的设计隔离了各个设备驱动和北向应用的功能模块之间的耦合,另外采用订阅-发布机制来实现数据流的分发和聚合,使得 Neuron 有着极大的灵活性。用户可以根据现场的工作情况动态增加和减少设备驱动的节点,具有良好的可配置性。另外,当运行 Neuron 的硬件 CPU 性能好、核心多、内存大时,Neuron 能支持更多的设备驱动节点、海量的数据点位、更大的数据吞吐量、更低的响应时间,具有良好的系统可伸缩性。

Neuron 采用了插件机制来支持变化多端的用户功能需求,用户可以根据应用场景的功能需求动态的加载不同功能的插件,得到有不同功能的节点。当设备驱动有 Bug 需要修复,或者有新的功能需要升级时,可以通过动态更新插件来解决问题,升级新功能。每个节点的运行是独立的,当升级一个节点的插件时,不会影响其他节点的运行,Neuron 也不需要重新启动。

Neuron的总体架构概览如下图所示:

arch-overview

Neuron的总线拓扑结构和数据流的分散/汇聚如下图所示:

neuron-bus-topo

neuron-dataflow

Neuron的层次结构图如下图所示:

neuron-layers

安装

安装依赖

Install Required Dependencies

编译

$ git clone -- recursive https://github.com/emqx/neuron
$ cd neuron
$ mkdir build && cd build
$ cmake .. && make

快速开始

$ cd build
$ ./neuron

单元测试

运行所有单元测试

$ cd build
$ ctest --output-on-failure

功能测试

运行所有功能测试

mosquitto -v &
pip3 install -r ft/requirements.txt
python3 -m robot -P ft/ --variable neuron_api:http -d ft/http_reports ft

压力测试

目录ft/data/persistence/下存放有用于压力测试的数据集。

可运行以下命令进行压力测试

# 安装依赖
pip3 install -r ft/requirements.txt

# 使用http接口在数据集total-10k上进行测试
python3 -m robot -P ft/ --variable neuron_api:http --variable dataset:total-10k -d ft/http-total-10k ft/pressure.test
# 使用http接口在数据集total-50k上进行测试
python3 -m robot -P ft/ --variable neuron_api:http --variable dataset:total-50k -d ft/http-total-50k ft/pressure.test

# 如果使用mqtt接口则需要MQTT服务器,此例为mosquitto
mosquitto -v &

# 使用mqtt接口在数据集simple-1k上进行测试
python3 -m robot -P ft/ --variable neuron_api:mqtt --variable dataset:simple-1k -d ft/mqtt-simple-1k ft/pressure.test

社区

您可通过以下途径与 Neuron 社区及开发者联系。

GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.

简介

Neuron 是一个工业物联网(IIoT)边缘工业协议网关软件,用于现代大数据技术,以发挥工业 4.0 的力量。它支持对多种工业协议的一站式访问,并将其转换为标准 MQTT 协议以访问工业物联网平台。 展开 收起
C
LGPL-3.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C
1
https://gitee.com/netgod/neuron.git
git@gitee.com:netgod/neuron.git
netgod
neuron
neuron
main

搜索帮助

53164aa7 5694891 3bd8fe86 5694891