更新5.0

This commit is contained in:
Kimdiego2098
2024-01-21 15:38:31 +08:00
parent d792172779
commit 12eb56809d
2455 changed files with 109699 additions and 184407 deletions

9
.gitignore vendored
View File

@@ -362,7 +362,10 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
/framework/*pro*
/framework/*Pro*
/src/*Pro*/
/src/*Pro*
/src/*pro*
/src/*pro*/
/src/ThingsGateway.Web.Entry/.config/
/doc/.*

15
doc/README.md Normal file
View File

@@ -0,0 +1,15 @@
文档基于 [https://www.docusaurus.io/](https://www.docusaurus.io/) 构建。
### 本地运行
```bash
npm install
npm run start
```
### 发布部署
```bash
npm run build
```

57
doc/docs/1.mdx Normal file
View File

@@ -0,0 +1,57 @@
---
id: 1
title: 版权说明
---
:::tip 公告
注意以下常见版权问题:
- 社区版本不得去除可视页面的ThingsGateway Logo
- 不得将程序集单独包装售卖,申请专利,开发竞品
:::
## 使用前必要阅读
ThingsGateway 由作者Diego及其他贡献者开发所有版权归作者Diego所有程序集源代码在遵循 Apache License 2.0 的开源协议以及**附加协议**下,可**免费**供其他开发者二次开发或(商业)使用。
### 个人使用须知:
- 不得将程序集用作违法犯罪活动。
- 不得将程序集单独包装售卖,申请专利等。
- 不得擦除程序集所有有关作者的信息。
**以上内容必须全部符合,个人使用授权才成立。**
### 二次开发须知:
- 不得将程序集用作违法犯罪活动。
- 不得将程序集单独包装售卖,申请专利等。
- 不得擦除程序集所有有关作者的信息。
- 二次开发完成后的作品必须附带源作品所有作者信息包括但不限于作者名、Gitee、Github 地址等。
**以上内容必须全部符合,二次开发授权才成立。**
### 盈利性(商业)用途使用须知:
- 不得将程序集用作违法犯罪活动。
- 不得将程序集单独包装售卖,申请专利等。
- **不得擦除程序集所有有关作者的信息,并必须于用户可见界面(如关于)中提名。**
**以上内容必须全部符合,商业使用授权才成立。**
## ThingsGatewayPro 商用许可
ThingsGatewayPro 软件框架与 ThingsGateway 一致另包含其他定制插件。所有版权归作者Diego所有。
ThingsGatewayPro 不公开开源。
# 免责申明
**在使用 ThingsGateway 之前请进行缜密的测试。在使用期间,由本程序集造成或间接造成的所有损失,均自己承担,与本程序集无关。**

45
doc/docs/100.mdx Normal file
View File

@@ -0,0 +1,45 @@
---
id: 100
title: 驱动调试
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::tip `配置须知`
变量地址的格式可从浮动提示中查看,如需要详细说明,可查看对应的插件章节
:::
## 一、说明
**ThingsGateway** 网关程序中包含了调试页面,也单独提供跨平台的桌面端调试软件
<img src={require("@site/static/img/docs/驱动调试.png").default} />
下面举例说明Modbus驱动的调试流程
## 二、Modbus调试流程
选择需要的驱动,进入页面后,新建通道
<img src={require("@site/static/img/docs/驱动调试1.png").default} />
<img src={require("@site/static/img/docs/驱动调试2.png").default} />
2、 查看变量寄存器地址的填写格式
<img src={require("@site/static/img/docs/驱动调试3.png").default} />
3、 打开模拟软件,点击读取
<img src={require("@site/static/img/docs/驱动调试4.png").default} />
可以看到交互的报文以及读取结果
## 三、网关中的调试页面
<img src={require("@site/static/img/docs/驱动调试5.png").default} />
操作与桌面软件一样

28
doc/docs/1000.mdx Normal file
View File

@@ -0,0 +1,28 @@
---
id: 1000
title: 赞助项目
---
## 赞助ThingsGateway项目
> 您的支持就是我不懈努力的动力。<br></br>如果对您有帮助请⭐Star关注或扫码捐赠感谢支持开源
### 赞助途径
![](/img/pay.png)
### 赞助名单(以下排名只按照赞助时间顺序)
|序号|名称|金额|
|-----------|--------------|-----------------|
|1| 绢| 10¥|
|2| 小蚂蚁 |500+¥|
|3| *伟 |18.8¥|
|4| *碟 |20¥|
|5| *长 |6.66¥|
|6| 小黄鸭 |38.8¥|
|7| *交 |50¥|
|8| *洋 |200¥+50¥|
|9| *元 |20¥|
|10| 冬日暖阳 |66.66¥|

95
doc/docs/1001.mdx Normal file
View File

@@ -0,0 +1,95 @@
---
id: 1001
title: Pro版
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::tip 公告
注意以下常见版权问题:
- 社区版本不得去除可视页面的ThingsGateway Logo
- ThingsGatewayPro授权后可去除Logo但Pro插件不开放源代码
- 任何版本不得将程序集单独包装售卖,申请专利,开发竞品
:::
## 一、说明
ThingsGatewayPro是ThingsGateway的加强版本**基础功能与ThingsGateway一致并添加一些额外功能插件**
同时ThingsGatewayPro提供企业定制服务及必要的远程协助,具体收费可以咨询**作者Diego联系方式QQ2248356998**
## 二、授权
** ThingsGatewayPro分为个人授权与企业授权区别在于授权归属**
ThingsGatewayPro授权不开放源代码**Pro版本基础代码和开源版本相同**
授权后获得证书凭据(图片形式)
### 2.1 个人授权
- **授权归属于购买者个人所有**
- 价格 998¥
### 2.2 企业授权
- **授权归属于企业所有,仅企业主体享有授权**
- 价格 1998¥
## 三、插件差异
|序号| 插件名称 | 说明 |
|----| ---------------| --------------------------|
|1| Vigor | 丰炜串口/TCP通信插件支持VS系列|
|2| Fins Tcp/Udp | 欧姆龙Fins通信插件支持CJ系列、CV系列、CS系列、NX系列等,一般欧姆龙带网口的都支持FINS|
|3| ABCIP Tcp | 罗克韦尔CIP通信插件支持17561769系列等|
|4| SECS | SECS半导体协议|
|5| 三菱MC QnA3E_Binary | MC 3E帧 二进制 |
|6| USB扫码枪 | USB扫码枪(键盘输入式),键盘钩子获取的方式目前只有windows版本|
|7| URF_R330 读卡器 | dll目前只有windows版本|
|8| 精伦idr 210 读卡器 | dll目前只有windows版本|
|9| 明泰URF_R330 读卡器 | dll目前只有windows版本|
|10| 新中新DKQ-A16D 读卡器 | dll目前只有windows版本|
## 四、插件开发计划
|序号| 插件名称 | 说明 |
|----| ---------------| --------------------------|
|1| 双机热备 | 网关双机冗余|
|2| 远程更新 | 远程更新软件|
## 五、授权名单
|序号| 被授权主体 | 说明 | 时间 |
|----| ---------------| --------------------------|-------------------|
|1| 成都**创新科技有限公司 | | 2023-4-21|
|2| 超级士兵 | | 2023-5-18|
|3| SunnyUI | | 2023-7-13|
|4| 俞智峰 | | 2023-7-13|
|5| 西安***物联网科技有限公司 | | 2023-7-15|
|6| 深圳市***自动化技术有限公司 | | 2023-7-16|
|7| 西安***信息技术有限责任公司 | | 2023-9-4|
|8| 北京****网络科技发展有限公司 | | 2023-9-26|
|9| 长沙**软件科技有限公司 | | 2023-10-16|
|10| 航科**科技有限公司 | | 2023-10-30|
|11| 福建**包装有限公司 | | 2023-11-17|
|12| 内蒙古**科技有限公司 | | 2023-11-26|
|13| 佛山**自动化科技有限公司 | | 2023-11-27|
|14| Z | | 2023-12-03|
## 六、购买途径
**购买前请先联系作者Diego**。联系QQ2248356998。
![](/img/pay.png)

24
doc/docs/1002.mdx Normal file
View File

@@ -0,0 +1,24 @@
---
id: 1002
title: 联系我们
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
**ThingsGateway团队**成立1年来一直致力于工业物联网关解决方案。我们的初衷是使设备接入更简单为用户打造提高效率的产品。
可以通过以下方式找到我们:
### 技术支持
QQ群605534569
QQ2248356998
### 咨询、合作
手机15622119120 林工
微信15622119120

37
doc/docs/101.mdx Normal file
View File

@@ -0,0 +1,37 @@
---
id: 101
title: 插件管理
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::tip `配置须知`
更改设备/变量/插件等,需要重启后台(右上角重启后台按钮)
:::
## 一、说明
**ThingsGateway** 网关核心代码都由插件完成,主程序只负责调度执行
插件支持热重载,可由外部上传到网关中
## 二、上传插件
<img src={require("@site/static/img/docs/上传插件.png").default} />
## 二、手动重载插件
<img src={require("@site/static/img/docs/重载插件.png").default} />
可由顶部按钮或者插件管理页面按钮执行手动重载
:::tip 提示
插件重新检测文件后,运行态的插件不会发送任何改变,如果立即生效,请按右上角的重启后台按钮
:::

39
doc/docs/102.mdx Normal file
View File

@@ -0,0 +1,39 @@
---
id: 102
title: 通道
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::tip `配置须知`
更改设备/变量/插件等,需要重启后台(右上角重启后台按钮)
:::
## 一、说明
**ThingsGateway** 网关通道其实是一个实际的串口/TCP/UDP链路或者是线程池中的一个任务
## 二、添加通道/修改通道
<img src={require("@site/static/img/docs/添加通道.png").default} />
## 三、通道配置项
| 属性| 说明 |
| --- | --- |
| 名称 | 通道名称|
| 通道类型 | 选择 TcpClient/TcpService/SerialPortClient/UdpSession/Other |
| 使能 | 是否启用此通道 |
| 调试日志 | 初始运行时,是否启用调试日志,可在运行状态界面中再次启用/停用 |
| 远程地址 | 对于TcpClient/UdpSession 作为客户端有效, 填入服务端的Url信息比如192.168.0.1:502 |
| 本地地址 | 对于TcpClient/TcpService/UdpSession 有效,作为本机的绑定地址,可选择填入,为空时是随机绑定端口 |
| COM口 | 对于SerialPortClient有效串口名称 |
| 波特率 | 对于SerialPortClient有效串口波特率 |
| 数据位 | 对于SerialPortClient有效串口数据位 |
| 校验位 | 对于SerialPortClient有效串口校验位 |
| 停止位 | 对于SerialPortClient有效串口停止位 |
| 启用Dtr | 对于SerialPortClient有效串口DtrEnable |
| 启用Rts | 对于SerialPortClient有效串口RtsEnable |

46
doc/docs/103.mdx Normal file
View File

@@ -0,0 +1,46 @@
---
id: 103
title: 设备
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::tip `配置须知`
更改设备/变量/插件等,需要重启后台(右上角重启后台按钮)
:::
## 一、说明
**ThingsGateway** 网关设备对应每个实际采集设备/上传业务
## 二、添加设备/修改设备
<img src={require("@site/static/img/docs/添加设备.png").default} />
## 三、设备属性配置项
| 属性| 说明 |
| --- | --- |
|名称| 设备名称|
|描述| 当前设备描述 |
|默认执行间隔| 执行间隔,对于采集设备,这个属性是默认的采集间隔,对于业务设备,这个属性是循环线程的等待间隔时间 |
|设备使能| 启动/停用采集设备 |
|通道| 选择对应的通道 |
|插件| 选择对应的插件 |
|是否冗余| 启动/停用设备冗余 |
|冗余设备| 备用设备选择,当此设备离线时,会在适当的时间切换到备用设备,注意备用设备初始时不会有实际通讯线程创建,链接的变量也不会生效 |
|备用字段| 存储自定义信息 |
## 四、插件属性配置项
对于不同的插件,插件属性项也不相同,查看对应插件章节中的详细说明。
比如ModbusMaster
<img src={require("@site/static/img/docs/插件属性.png").default} />

130
doc/docs/104.mdx Normal file
View File

@@ -0,0 +1,130 @@
---
id: 104
title: 变量
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::tip `配置须知`
更改设备/变量/插件等,需要重启后台(右上角重启后台按钮)
:::
## 一、说明
**ThingsGateway** 网关变量对应每个寄存器点位
## 二、添加变量/修改变量
### 变量基础属性配置项
<img src={require("@site/static/img/docs/添加变量.png").default} />
|属性名称| 属性描述| 备注|
|-----------|--------------|-----------------|
|名称| 当前变量名称,全局唯一(变量)| |
|描述| 当前变量描述 ||
|单位| 变量值单位 ||
|读写权限| 读写/只写/只读 ||
|使能| 启用/停用变量 ||
|远程写入| 对于变量的写入使能配置 ||
|设备| 当前采集设备选择的设备,通过级联选择器选择对应设备名称设置 ||
|变量地址| PLC寄存器/OPC ITEMID等 |对于不同插件的设备,变量地址配置不相同,查看对应的插件说明|
|执行间隔| 读取时间间隔/执行特殊方法读取的间隔 ||
|特殊方法| 某些插件特有的方法 |对于不同的插件,特殊方法配置不相同,查看对应的插件说明|
|数据类型| 对应的数据类型 |注意除了特殊驱动一般不应该选择object|
|读取表达式| 动态解析的表达式 ,原始值的代码为raw|示例:``raw*10+3`` 结果原始值raw为8,输出实时值83 。具体可查看 [ExpressionEvaluator WiKi](https://github.com/codingseb/ExpressionEvaluator)|
|写入表达式| 动态解析的表达式,在写入值时转化,原始值的代码为raw|示例:``raw/10`` 结果写入值为230时会下发23到PLC 。具体可查看 [ExpressionEvaluator WiKi](https://github.com/codingseb/ExpressionEvaluator)|
|备用字段| 存储自定义信息 |
:::tip `表达式特别说明`
网关还支持表达式的动态传入,除了raw表示该变量读取的原始值外,还支持其他变量的值传入表达式
举例:
```csharp
//新建testInt1,testInt2两个变量
//在testInt1的读取表达式中定义
raw*testInt2+3
//原始值raw为8,testInt2为100输出实时值803
```
:::
:::tip `变量地址通用说明`
通用格式,不区分大小写
4字节转换格式
DATA=ABCD;
举例:
DATA=ABCD; ,代表大端格式,其中
ABCD=>Big-Endian;
BADC=>Big-Endian Byte Swap;
CDAB=>Little-Endian Byte Swap;
DCBA=>Little-Endian
字符串长度:
LEN=1;
BCD格式
BCD=C8421;其中有C8421;C5421;C2421;C3;Gray
字符格式:
encoding=UTF8;其中有UTF8;ASCII;Default;Unicode
数组长度:
arraylen=2;
:::
### 报警属性配置项
<img src={require("@site/static/img/docs/添加变量1.png").default} />
:::tip `说明`
报警属性中定义变量产生报警的规则所需的配置
:::
|属性名称| 属性描述| 备注|
|-----------|--------------|-----------------|
|报警使能| 启用对应报警功能| |
|报警限值| 超限时产生报警,布尔量为固定 ||
|报警文本| 对应显示的报警文本 ||
|报警约束| 动态解析的表达式 ,原始值的代码为raw计算值为true时才能产生报警 ||
### 业务属性配置项
<img src={require("@site/static/img/docs/添加变量2.png").default} />
:::tip `说明`
上传属性中定义变量关联的上传设备所需的配置
对于不同的插件,插件属性项也不相同,查看对应插件章节中的详细说明。
:::

34
doc/docs/105.mdx Normal file
View File

@@ -0,0 +1,34 @@
---
id: 105
title: 网关状态
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
## 一、说明
**ThingsGateway**
运行状态页面,可查看采集/业务设备的运行状态,调试日志等信息
实时数据页面,可查看变量实时信息
实时报警页面,可查看变量实时报警
硬件信息页面可查看服务器CPU信息等
## 二、图示
<img src={require("@site/static/img/docs/运行状态详情.png").default} />
<img src={require("@site/static/img/docs/实时数据详情.png").default} />
<img src={require("@site/static/img/docs/实时报警详情.png").default} />
<img src={require("@site/static/img/docs/硬件信息详情.png").default} />

26
doc/docs/106.mdx Normal file
View File

@@ -0,0 +1,26 @@
---
id: 106
title: 网关日志
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
## 一、说明
**ThingsGateway**
后台日志记录 有关采集/业务上传的全部网关后台日志
RPC日志记录 全部反写RPC日志
## 二、图示
<img src={require("@site/static/img/docs/RPC日志详情.png").default} />
<img src={require("@site/static/img/docs/后台日志详情.png").default} />

63
doc/docs/2.mdx Normal file
View File

@@ -0,0 +1,63 @@
---
id: 2
title: 产品介绍
---
## 产品介绍
**ThingsGateway** 是c#开发的一款边缘采集网关,核心分为四大部分,贯穿一个 工业设备数据点 从采集到上传的全周期
### 通道
通道实际上相当于一个实际的通讯链路比如一个串口一个TCP连接等在**ThingsGateway**中,
通道也会作为线程池中的一个任务,对于同一个通道中的不同设备,采集/业务方法是顺序进行的。
### 🔥插件
ThingsGateway中的采集方法或者上传方法等都由插件完成主程序只负责调度执行。
对于不同的采集协议或者业务需求,可以通过开发插件完成自定义的业务操作。
### 设备
建立设备,必须指定通道以及插件,也可以说设备其实是插件的配置。
同时对于采集设备、业务设备,会有些许差别。
采集设备:采集数据入网关/写入数据到现场
业务设备:上传数据到第三方/第三方RPC反写
### 变量
变量,用于配置采集设备的具体点位详情,以及对应业务设备中的配置项
## 产品特性
### 可视化操作
通过web浏览器配置调试验证整个流程
### 🔥脚本支持
灵活的数据转换脚本以及数据上传自定义实体脚本,可适配各大云平台的物模型
### 🔥自定义插件支持
通过开发插件完成自定义的业务操作。
### 🔥性能
测试100w变量点位500ms-1000ms全部采集完成稳定连续采集占用CPU资源、内存资源低
### 断线缓存
支持断线缓存,恢复后自动上传
### 🔥完整可商用的边缘网关
完善的配置权限操作日志功能等还有OPCWeb Api,Mqtt,Kafka,时序库,变量报警等更多功能等待你发现

69
doc/docs/200.mdx Normal file
View File

@@ -0,0 +1,69 @@
---
id: 200
title: ModbusMatser
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
## 一、说明
ModbusMatser作为主站主动采集Modbus从站协议的设备
插件支持modbusTcp/modbusRtu格式报文
通讯链路支持 TcpClient/TcpService(DTU)/串口/Udp
## 二、插件属性配置项
<img src={require("@site/static/img/docs/ModbusMaster.png").default} />
| 属性 | 说明 | 备注|
| ---------------| --------------------------| ---|
| Modbus协议类型 | modbusTcp/modbusRtu格式报文 | |
| 默认站号 | 默认的mudbus站号id | **变量可单独配置站号** |
| 无交互2min时断开连接 | 没有发送/收到消息 2分钟后断开连接 | 仅适用于TcpService链路DTU模式|
| 读写超时时间 | 读写超时时间 | 3000|
| 连接超时时间 | 建立通讯链路的超时时间 | 3000|
| 发送延时时间 | 在发送请求前的延时时间 | 0|
| 组包缓存超时 | 返回分包时的分包间隔超时时间 | 1000 |
| 默认解析顺序 | 4个字节以上的数据解析可设置为ABCD/BADC/CDBA/DCBA,默认ABCD , **变量可单独配置**|ABCDBig-Endian<br></br>BADCBig-Endian Byte Swap<br></br>CDABLittle-Endian Byte Swap<br></br>DCBALittle-Endian |
| 最大打包长度 | 打包长度最大限值是125 | 100 |
| 离线重试间隔 | 设备检测到离线时,重新连接的间隔时间(秒) | 30 |
| 失败重试次数 | 读取失败时重试n次后判定变量为离线 | 3 |
| 最大并发数量 | ModbusTcp格式报文特有ModbusTcp可并发采集 | 1 |
## 三、变量地址配置项
- 1、基本地址
Modbus PLC寄存器
| 地址 | 功能码 | 说明 |
| ---------------| --------------|--------------------------|
| 4xxxxx | 03 | 读取03功能码 |
| 3xxxxx | 04 | 读取04功能码 |
| 1xxxxx | 02 | 读取02功能码 |
| 0xxxxx | 01 | 读取01功能码 |
- 2、站号(可选)
当需要指定站号地址时可使用,举例:
| 地址 | 说明 |
| ---------------| --------------------------|
| s=2;10001 | 读取02功能码 ,设备地址为2 |
| s=11;40001 | 读取03功能码 ,设备地址为11 |
- 3、写入功能码(可选)
当需要指定16/15功能码时可使用举例
| 地址 | 说明 |
| ---------------| --------------------------|
| w=15;10001 | 读取02功能码 ,写入15功能码 |
| w=16;40001 | 读取03功能码 ,写入16功能码 |

58
doc/docs/201.mdx Normal file
View File

@@ -0,0 +1,58 @@
---
id: 201
title: ModbusSlave
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
## 一、说明
ModbusSlave作为从站响应主站的采集报文
插件支持modbusTcp/modbusRtu格式报文
通讯链路支持 TcpClient/TcpService(DTU)/串口/Udp
## 二、插件属性配置项
<img src={require("@site/static/img/docs/ModbusSlave.png").default} />
| 属性 | 说明 | 备注|
| ---------------| --------------------------| ---|
| Modbus协议类型 | modbusTcp/modbusRtu格式报文 | |
| 默认站号 | 默认的mudbus站号id | **变量可单独配置站号** |
| 默认解析顺序 | 4个字节以上的数据解析可设置为ABCD/BADC/CDBA/DCBA,默认ABCD , **变量可单独配置**|ABCDBig-Endian<br></br>BADCBig-Endian Byte Swap<br></br>CDABLittle-Endian Byte Swap<br></br>DCBALittle-Endian |
| 无交互2min时断开连接 | 没有发送/收到消息 2分钟后断开连接 | 仅适用于TcpService链路|
| 组包缓存超时 | 分包时的分包间隔超时时间 | 1000 |
| 多站点 | 是否区分不同的站号的数据 | true|
| 允许写入 | 写入权限使能 | Flase |
| 立即写入内存 | 外部写入时,是否立即写入内存池 | Flase |
## 三、变量业务属性
### 1、从站地址
- 1、基本地址
Modbus PLC寄存器
| 地址 | 功能码 | 说明 |
| ---------------| --------------|--------------------------|
| 4xxxxx | 03 | 读取03功能码 |
| 3xxxxx | 04 | 读取04功能码 |
| 1xxxxx | 02 | 读取02功能码 |
| 0xxxxx | 01 | 读取01功能码 |
- 2、站号(可选)
当需要指定站号地址时可使用,举例:
| 地址 | 说明 |
| ---------------| --------------------------|
| s=2;10001 | 读取02功能码 ,设备地址为2 |
| s=11;40001 | 读取03功能码 ,设备地址为11 |

62
doc/docs/202.mdx Normal file
View File

@@ -0,0 +1,62 @@
---
id: 202
title: Dlt645Master
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
## 一、说明
Dlt645Master作为主站主动采集Dlt645协议的设备
插件支持Dlt645-2007格式报文
通讯链路支持 TcpClient/TcpService(DTU)/串口/Udp
## 二、插件属性配置项
<img src={require("@site/static/img/docs/Dlt645Master.png").default} />
| 属性 | 说明 | 备注|
| ---------------| --------------------------| ---|
| 无交互2min时断开连接 | 没有发送/收到消息 2分钟后断开连接 | 仅适用于TcpService链路DTU模式|
| 读写超时时间 | 读写超时时间 | 3000|
| 连接超时时间 | 建立通讯链路的超时时间 | 3000|
| 发送延时时间 | 在发送请求前的延时时间 | 0|
| 组包缓存超时 | 返回分包时的分包间隔超时时间 | 1000 |
| 默认解析顺序 | 4个字节以上的数据解析可设置为ABCD/BADC/CDBA/DCBA,默认ABCD , **变量可单独配置**|ABCDBig-Endian<br></br>BADCBig-Endian Byte Swap<br></br>CDABLittle-Endian Byte Swap<br></br>DCBALittle-Endian |
| 默认地址 | 电表地址12个字符 | |
| 密码 | 协议写入所需密码 | Flase |
| 操作员代码 | 协议写入所需操作员代码 | Flase |
| 前导符报文头 | 设为true时发送请求将添加4个0xFE到报文头部 | Flase |
| 离线重试间隔 | 设备检测到离线时,重新连接的间隔时间(秒) | 30 |
| 失败重试次数 | 读取失败时重试n次后判定变量为离线 | 3 |
## 三、变量地址配置项
- 1、基本地址
| 地址 | 说明 |
| ---------------| --------------------------|
| 02010100 | 读取02010100(A相电压) |
参考DLT2007协议文档数据标识可在插件源码中找到附件
- 2、站号(可选)
当需要指定站号地址时可使用,举例:
| 地址 | 说明 |
| ---------------| --------------------------|
| s=111111111111;02010100 | 读取02010100 ,设备地址为111111111111 |
:::tip `说明`
注意DLT645协议中所有的变量都支持String
:::

51
doc/docs/203.mdx Normal file
View File

@@ -0,0 +1,51 @@
---
id: 203
title: SiemensS7Master
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
## 一、说明
SiemensS7Master作为主站主动采集西门子S7协议的设备
插件支持S7格式报文支持S7-200;S7200-SMART;S7-300;S7-400;S7-1200;S7-1500;
通讯链路支持 TcpClient/Udp(通常不存在)
## 二、插件属性配置项
<img src={require("@site/static/img/docs/SiemensS7Master.png").default} />
| 属性 | 说明 | 备注|
| ---------------| --------------------------| ---|
| S7类型 | S200;S200SMART;S300;S400;S1200;S1500; | |
| 机架号 | 机架号 | 0|
| 槽位号 | 槽位号 | 0|
| LocalTSAP | 查看西门子localTsap说明网关中一般不需要再设置 | 0 |
| 读写超时时间 | 读写超时时间 | 3000|
| 连接超时时间 | 建立通讯链路的超时时间 | 3000|
| 发送延时时间 | 在发送请求前的延时时间 | 0|
| 组包缓存超时 | 返回分包时的分包间隔超时时间 | 1000 |
| 默认解析顺序 | 4个字节以上的数据解析可设置为ABCD/BADC/CDBA/DCBA,默认ABCD , **变量可单独配置**|ABCDBig-Endian<br></br>BADCBig-Endian Byte Swap<br></br>CDABLittle-Endian Byte Swap<br></br>DCBALittle-Endian |
| 离线重试间隔 | 设备检测到离线时,重新连接的间隔时间(秒) | 30 |
| 失败重试次数 | 读取失败时重试n次后判定变量为离线 | 3 |
## 三、变量地址配置项
- 1、基本地址
| 地址 | 说明 |
| ---------------| --------------------------|
| Txxxxx | Timer寄存器,例如T100/T100.1 |
| Cxxxxx | Counter寄存器,例如C100/C100.1 |
| AIxxxxx | AI寄存器,例如AI100/AI100.1 |
| AQxxxxx | AQ寄存器,例如AQ100/AQ100.1 |
| Ixxxxx | I寄存器,例如I100/I100.1 |
| Qxxxxx | Q寄存器,例如Q100/Q100.1 |
| Mxxxxx | M寄存器,例如M100/M100.1 |
| DBxxxxx | DB寄存器,例如DB100.1/DB100.1.1 |

51
doc/docs/204.mdx Normal file
View File

@@ -0,0 +1,51 @@
---
id: 204
title: OpcDaMaster
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::tip `OPCDA驱动注意`
使用OPCDA插件时需安装[OPC核心库](https://gitee.com/diego2098/ThingsGateway/attach_files)
:::
:::tip `提示`
可以通过调试页面,导出/导入OPC节点到网关
:::
## 一、说明
OpcDaMaster作为主站主动采集OPCDA协议的设备
插件支持远程OPCDA但需要配置DCOM相关知识请自行查阅资料
通道只支持 Other 类型
## 二、插件属性配置项
<img src={require("@site/static/img/docs/OpcDaMaster.png").default} />
| 属性 | 说明 | 备注|
| ---------------| --------------------------| ---|
| IP | 连接IP | localhost|
| Opc名称 | OPC名称可识别ProgID或CLSID | Kepware.KEPServerEX.V6|
| 激活订阅 | 是否采用OPC订阅方式读取变量 | True|
| 检查重连频率 | 每隔设定时间获取一次服务器状态,并尝试重新连接(min) |10|
| 死区 | OPC死区 | 0|
| 最大组大小 | 每隔设定大小分一个OPCGroup | 500|
| 更新频率 | 订阅更新频率或者连读频率 (ms) | 1000 |
| 离线重试间隔 | 设备检测到离线时,重新连接的间隔时间(秒) ,只适用于非订阅模式 | 30 |
| 失败重试次数 | 读取失败时重试n次后判定变量为离线 ,只适用于非订阅模式 | 3 |
## 三、变量地址配置项
- 变量地址即为 OPC ItemID

53
doc/docs/205.mdx Normal file
View File

@@ -0,0 +1,53 @@
---
id: 205
title: OpcUaMaster
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::tip `提示`
可以通过调试页面,导出/导入OPC节点到网关
:::
## 一、说明
插件支持OPCUA扩展类型自定义类型等等最终体现为json格式
通道只支持 Other 类型
## 二、插件属性配置项
<img src={require("@site/static/img/docs/OpcUaMaster.png").default} />
| 属性 | 说明 | 备注|
| ---------------| --------------------------| ---|
| OPCURL | OPCUA URL | opc.tcp://127.0.0.1:49320|
| 登录账号 | 为空时采用匿名方式登录 | |
| 登录密码 | | |
| 检查域 | 是否检查域 | Flase|
| 安全策略 | 是否安全认证/证书方式登录 | True|
| 使用SourceTime | 是否采用服务端的变量时间 | True|
| 加载服务端数据类型 | 是否加载服务端的数据类型对应OPCUA自定义类型必须为true | True|
| 激活订阅 | 是否采用OPC订阅方式读取变量 | True|
| 更新频率 | 订阅更新频率或者连读频率 | 1000 |
| 死区 | OPC死区 | 0|
| 最大组大小 | 每隔设定大小分一个OPCGroup | 500|
| 心跳频率 | |3000|
| 离线重试间隔 | 设备检测到离线时,重新连接的间隔时间(秒) ,只适用于非订阅模式 | 30 |
| 失败重试次数 | 读取失败时重试n次后判定变量为离线 ,只适用于非订阅模式 | 3 |
## 三、变量地址配置项
- 变量地址即为 OPC NodeId
## 四、证书说明
证书可以在软件目录\OPCUAClientCertificate下查看或者导出/复制
<img src={require("@site/static/img/docs/OpcUaMaster1.png").default} />

24
doc/docs/206.mdx Normal file
View File

@@ -0,0 +1,24 @@
---
id: 206
title: VariableExpression
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
## 一、说明
VariableExpression不与工业设备交互实际上是一个不依赖采集的表达式脚本计算方法
如果不填写变量表达式,变量值会自增
有关变量表达式的说明,请查看[变量表达式](./104.mdx#变量基础属性配置项)
## 二、插件属性配置项
## 三、变量地址配置项

141
doc/docs/3.mdx Normal file
View File

@@ -0,0 +1,141 @@
---
id: 3
title: 入门指南
slug: /
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::tip 提示
如果你的开发机不是**Windows**系统在解决方案中可能存在一些vs生成事件脚本(目录拷贝等不支持),会提示编译失败,请删除.csproj文件中的对应事件手动拷贝插件类库
:::
## 一、说明
**ThingsGateway** 基于NET6、7、8,默认开发IDE为VS2022(**17.8版本以上**),安装VS时需勾选ASP.NET类别.
<img src={require("@site/static/img/docs/vs2022install.png").default} />
## 二、下载源码
[最新版本](https://gitee.com/diego2098/ThingsGateway)
## 三、编译运行
下面我们将以vs2022作为示例
:::tip 提示
**注意需要编译解决方案,因为插件与主体没有引用关系**
:::
1、 vs2022打开解决方案编译解决方案
<img src={require("@site/static/img/docs/生成解决方案.png").default} />
2、 设置ThingsGateway.Web.Entry为启动项目开始调试或开始执行
<img src={require("@site/static/img/docs/设置启动项目.png").default} />
<img src={require("@site/static/img/docs/开始执行.png").default} />
3、 启动后会显示登录界面
<img src={require("@site/static/img/docs/login.png").default} />
恭喜你体验了软件的启动第一步!
:::tip 提示
测试环境下,账密会自动填充为超级管理员账号,默认账户:**superAdmin**,密码:**111111**
:::
## 四、建立一个完整的流程
下面举例说明 采集ModbusTcp设备中的寄存器通过MqttServer发布 的具体流程
### 1、建立通道
<img src={require("@site/static/img/docs/通道配置.png").default} />
<img src={require("@site/static/img/docs/通道配置1.png").default} />
<img src={require("@site/static/img/docs/通道配置2.png").default} />
### 2、建立采集设备
<img src={require("@site/static/img/docs/采集设备.png").default} />
<img src={require("@site/static/img/docs/采集设备1.png").default} />
<img src={require("@site/static/img/docs/采集设备2.png").default} />
### 3、建立业务设备
<img src={require("@site/static/img/docs/业务设备.png").default} />
<img src={require("@site/static/img/docs/业务设备1.png").default} />
<img src={require("@site/static/img/docs/业务设备2.png").default} />
### 4、建立变量
<img src={require("@site/static/img/docs/变量.png").default} />
<img src={require("@site/static/img/docs/变量1.png").default} />
### 5、验证
经过以上的配置已经可以从127.0.0.1:502的模拟Modbus设备中采集到PLC地址(400001)并通过网关的mqttServer服务发布
。下面来验证一下
首先先启动模拟的modbusSlave软件
<img src={require("@site/static/img/docs/modbus模拟软件.png").default} />
然后重启一下网关后台线程,注意这个意思并不是重新启动软件,
而是**重新加载网关的组态配置到运行态中**,通过**网页顶部的重启按钮**进行操作
<img src={require("@site/static/img/docs/重启后台.png").default} />
跳转到网关的运行状态查看
<img src={require("@site/static/img/docs/运行状态.png").default} />
<img src={require("@site/static/img/docs/运行状态1.png").default} />
<img src={require("@site/static/img/docs/运行状态2.png").default} />
<img src={require("@site/static/img/docs/运行状态3.png").default} />
开启调试日志的话可以看到每次交互的modbus报文以及结果状态
采集的数据点位值与相关信息跳转到实时数据页面
<img src={require("@site/static/img/docs/实时数据.png").default} />
可以看到值与采集时间等等的变化注意这里的页面实时值变化是1s的间隔时间如果配置了采集间隔小于1s页面刷新不及时是正常的不影响业务上传
MqttServer的日志也可以在运行状态中看到
<img src={require("@site/static/img/docs/运行状态4.png").default} />
这里我们启动一个常用的mqtt调试客户端Mqttx
<img src={require("@site/static/img/docs/mqttx.png").default} />
连接成功后,添加对应的主题订阅,这里我们使用通配符+,适用主题名称的设备名称区间
<img src={require("@site/static/img/docs/mqttx1.png").default} />
<img src={require("@site/static/img/docs/mqttx2.png").default} />
恭喜你成功体验了Modbus设备的采集到MqttServer发布全流程
## 五、详细说明
:::tip 提示
在查看案例前,请先查看**关于网关的基础内容**
:::
- [文档](https://diego2098.gitee.io/thingsgateway-docs)
- [博客](https://www.cnblogs.com/ThingsGateway/collections/1104)
- [视频](https://space.bilibili.com/88105259/channel/series)

255
doc/docs/301.mdx Normal file
View File

@@ -0,0 +1,255 @@
---
id: 301
title: MqttClient
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::tip `提示`
通过自定义脚本可快速适配业务模型比如各大云平台的Iot物模型
脚本的示例请查看**常见问题**
:::
## 一、说明
MqttClient通过Tcp/WebSocket的方式发布内容到Broker(Server),可以定时/变化发布数据
通道只支持 Other
## 二、插件属性配置项
<img src={require("@site/static/img/docs/MqttClient.png").default} />
| 属性 | 说明 | 备注|
| ---------------| --------------------------| ---|
| IP | ServerIP,为空时指任意IP | |
| 端口 | 连接端口 | 1883|
| 是否WebSocket连接 | 是否WebSocket连接 | False |
| WebSocketUrl | WebSocketUrl | ws://127.0.0.1:8083/mqtt |
| 账号 | 账号 | |
| 密码 | 密码 | |
| 连接Id | 连接Id | |
| 连接超时时间 | 连接超时时间 | |
| 允许Rpc写入 | 是否允许写入变量 | |
| Rpc写入Topic | 写入变量的主题 | 实际的写入主题为固定通配 {ThingsGateway/+/[填入值]} ,其中RpcWrite为该属性填入内容+通配符是不固定GUID值每次执行写入时会在不同的主题中返回返回结果主题会在主题后添加Response , 也就是{ThingsGateway/+/[填入值]/Response} |
| 数据请求Topic | 该主题接受到任何消息都会发布全部信息到对应的变量/设备/报警主题中 | |
| 设备是否列表 | 设备是否列表上传false时每个设备实体都会单独发布注意性能需求默认为true | |
| 变量是否列表 | 变量是否列表上传false时每个变量实体都会单独发布注意性能需求默认为true | |
| 报警是否列表 | 报警是否列表上传false时每个报警实体都会单独发布注意性能需求默认为true | |
| 设备Topic | 设备实体的发布主题 ,使用${key}作为匹配项key必须是上传实体中的属性 | |
| 变量Topic | 变量实体的发布主题 ,使用${key}作为匹配项key必须是上传实体中的属性 | |
| 报警Topic | 报警实体的发布主题 ,使用${key}作为匹配项key必须是上传实体中的属性 | |
| 设备实体脚本 | 脚本返回新的实体列表,动态类中需继承**IDynamicModel**,传入列表为**DeviceData**,查看以下具体属性 | 编辑页面中,可通过检查按钮验证脚本,脚本示例请查看**常见问题** |
| 变量实体脚本 | 脚本返回新的实体列表,动态类中需继承**IDynamicModel**,传入列表为**VariableData**,查看以下具体属性 | 编辑页面中,可通过检查按钮验证脚本,脚本示例请查看**常见问题** |
| 报警实体脚本 | 脚本返回新的实体列表,动态类中需继承**IDynamicModel**,传入列表为**AlarmVariable**,查看以下具体属性 | 编辑页面中,可通过检查按钮验证脚本,脚本示例请查看**常见问题** |
| 是否选择全部变量 | 是否选择全部变量true时不需要单个变量添加业务属性 | |
| 是否间隔执行 | 是否选择全部变量true间隔上传False变化检测上传 | |
| 间隔执行时间 | 间隔执行时间 | |
| 启用缓存 | 是否启用缓存 | |
| 上传列表最大数量 | 每一次上传的列表最大数量 | |
| 内存队列最大数量 | 内存队列的最大数量,超出或失败时转入文件缓存,根据数据量设定适当值 | |
### 脚本接口
```
public interface IDynamicModel
{
IEnumerable<dynamic> GetList(IEnumerable<dynamic> datas);
}
```
### DeviceData
```
/// <summary>
/// 设备业务变化数据
/// </summary>
public class DeviceData
{
/// <inheritdoc cref="PrimaryIdEntity.Id"/>
public long Id { get; set; }
/// <inheritdoc cref="Device.Name"/>
public string Name { get; set; }
/// <inheritdoc cref="DeviceRunTime.ActiveTime"/>
public DateTime ActiveTime { get; set; }
/// <inheritdoc cref="DeviceRunTime.DeviceStatus"/>
public DeviceStatusEnum DeviceStatus { get; set; }
/// <inheritdoc cref="DeviceRunTime.LastErrorMessage"/>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string LastErrorMessage { get; set; }
/// <inheritdoc cref="Device.Remark1"/>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Remark1 { get; set; }
/// <inheritdoc cref="Device.Remark2"/>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Remark2 { get; set; }
/// <inheritdoc cref="Device.Remark3"/>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Remark3 { get; set; }
/// <inheritdoc cref="Device.Remark4"/>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Remark4 { get; set; }
/// <inheritdoc cref="Device.Remark5"/>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Remark5 { get; set; }
}
```
### VariableData
```
/// <summary>
/// 变量业务变化数据
/// </summary>
public class VariableData
{
/// <inheritdoc cref="PrimaryIdEntity.Id"/>
public long Id { get; set; }
/// <inheritdoc cref="Variable.Name"/>
public string Name { get; set; }
/// <inheritdoc cref="VariableRunTime.DeviceName"/>
public string DeviceName { get; set; }
/// <inheritdoc cref="VariableRunTime.Value"/>
public object Value { get; set; }
/// <inheritdoc cref="VariableRunTime.ChangeTime"/>
public DateTime ChangeTime { get; set; }
/// <inheritdoc cref="VariableRunTime.CollectTime"/>
public DateTime CollectTime { get; set; }
/// <inheritdoc cref="VariableRunTime.IsOnline"/>
public bool IsOnline { get; set; }
/// <inheritdoc cref="VariableRunTime.LastErrorMessage"/>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string? LastErrorMessage { get; set; }
/// <inheritdoc cref="Device.Remark1"/>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Remark1 { get; set; }
/// <inheritdoc cref="Device.Remark2"/>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Remark2 { get; set; }
/// <inheritdoc cref="Device.Remark3"/>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Remark3 { get; set; }
/// <inheritdoc cref="Device.Remark4"/>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Remark4 { get; set; }
/// <inheritdoc cref="Device.Remark5"/>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Remark5 { get; set; }
}
```
### AlarmVariable
```
/// <summary>
/// 报警变量
/// </summary>
public class AlarmVariable
{
/// <inheritdoc cref="Variable.Name"/>
[SugarColumn(ColumnDescription = "变量名称", IsNullable = false)]
public string Name { get; set; }
/// <inheritdoc cref="Variable.Description"/>
[SugarColumn(ColumnDescription = "描述", IsNullable = true)]
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string? Description { get; set; }
/// <inheritdoc cref="VariableRunTime.DeviceName"/>
[SugarColumn(ColumnDescription = "设备名称", IsNullable = true)]
public string DeviceName { get; set; }
/// <inheritdoc cref="Variable.RegisterAddress"/>
[SugarColumn(ColumnDescription = "变量地址")]
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string RegisterAddress { get; set; }
/// <inheritdoc cref="Variable.DataType"/>
[SugarColumn(ColumnDescription = "数据类型", ColumnDataType = "varchar(100)")]
public DataTypeEnum DataType { get; set; }
/// <inheritdoc cref="VariableRunTime.AlarmCode"/>
[SugarColumn(ColumnDescription = "报警值", IsNullable = false)]
public string AlarmCode { get; set; }
/// <inheritdoc cref="VariableRunTime.AlarmLimit"/>
[SugarColumn(ColumnDescription = "报警限值", IsNullable = false)]
public string AlarmLimit { get; set; }
/// <inheritdoc cref="VariableRunTime.AlarmText"/>
[SugarColumn(ColumnDescription = "报警文本", IsNullable = true)]
public string? AlarmText { get; set; }
/// <inheritdoc cref="VariableRunTime.AlarmTime"/>
[SugarColumn(ColumnDescription = "报警时间", IsNullable = false)]
public DateTime AlarmTime { get; set; }
/// <inheritdoc cref="VariableRunTime.EventTime"/>
public DateTime EventTime { get; set; }
/// <summary>
/// 报警类型
/// </summary>
public AlarmTypeEnum? AlarmType { get; set; }
/// <summary>
/// 事件类型
/// </summary>
public EventTypeEnum EventType { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Remark1 { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Remark2 { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Remark3 { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Remark4 { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Remark5 { get; set; }
}
```
## 三、变量业务属性
### 允许写入
单独配置变量是否允许写入

70
doc/docs/302.mdx Normal file
View File

@@ -0,0 +1,70 @@
---
id: 302
title: MqttServer
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::tip `提示`
通过自定义脚本,可快速适配业务模型
脚本的示例请查看**常见问题**
:::
:::tip `权限注意`
Server的连接权限除了Id前缀限制外账号密码同样要求在网关后台创建的所有账号密码都可以登录MqttServer
:::
## 一、说明
MqttServer支持Tcp/webSocket方式接入可以定时/变化发布数据支持Rpc写入
通道只支持 Other
## 二、插件属性配置项
<img src={require("@site/static/img/docs/MqttServer.png").default} />
| 属性 | 说明 | 备注|
| ---------------| --------------------------| ---|
| IP | ServerIP,为空时指任意IP | |
| 端口 | Tcp绑定端口 | 1883|
| WebSocket端口 | WebSocket绑定端口 | 8083固定/mqtt路由 |
| 允许连接的ID(前缀) | 允许连接的ID(前缀) |ClientId必须以这个属性开头 |
| 允许Rpc写入 | 是否允许写入变量 | |
| Rpc写入Topic | 写入变量的主题 | 实际的写入主题为固定通配 {ThingsGateway/+/[填入值]} ,其中RpcWrite为该属性填入内容+通配符是不固定GUID值每次执行写入时会在不同的主题中返回返回结果主题会在主题后添加Response , 也就是{ThingsGateway/+/[填入值]/Response} |
| 设备是否列表 | 设备是否列表上传false时每个设备实体都会单独发布注意性能需求默认为true | |
| 变量是否列表 | 变量是否列表上传false时每个变量实体都会单独发布注意性能需求默认为true | |
| 报警是否列表 | 报警是否列表上传false时每个报警实体都会单独发布注意性能需求默认为true | |
| 设备Topic | 设备实体的发布主题 ,使用${key}作为匹配项key必须是上传实体中的属性 | |
| 变量Topic | 变量实体的发布主题 ,使用${key}作为匹配项key必须是上传实体中的属性 | |
| 报警Topic | 报警实体的发布主题 ,使用${key}作为匹配项key必须是上传实体中的属性 | |
| 设备实体脚本 | 脚本返回新的实体列表,动态类中需继承**IDynamicModel**,传入列表为**DeviceData**,查看以下具体属性 | 编辑页面中,可通过检查按钮验证脚本,脚本示例请查看**常见问题** |
| 变量实体脚本 | 脚本返回新的实体列表,动态类中需继承**IDynamicModel**,传入列表为**VariableData**,查看以下具体属性 | 编辑页面中,可通过检查按钮验证脚本,脚本示例请查看**常见问题** |
| 报警实体脚本 | 脚本返回新的实体列表,动态类中需继承**IDynamicModel**,传入列表为**AlarmVariable**,查看以下具体属性 | 编辑页面中,可通过检查按钮验证脚本,脚本示例请查看**常见问题** |
| 是否选择全部变量 | 是否选择全部变量true时不需要单个变量添加业务属性 | |
| 是否间隔执行 | 是否选择全部变量true间隔上传False变化检测上传 | |
| 间隔执行时间 | 间隔执行时间 | |
| 启用缓存 | 是否启用缓存 | |
| 上传列表最大数量 | 每一次上传的列表最大数量 | |
| 内存队列最大数量 | 内存队列的最大数量,超出或失败时转入文件缓存,根据数据量设定适当值 | |
### 脚本与实体
查看MqttClient页面[脚本接口](./301.mdx#脚本接口)
## 三、变量业务属性
### 允许写入
单独配置变量是否允许写入

58
doc/docs/303.mdx Normal file
View File

@@ -0,0 +1,58 @@
---
id: 303
title: RabbitMQProducer
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::tip `提示`
通过自定义脚本,可快速适配业务模型
脚本的示例请查看**常见问题**
:::
## 一、说明
RabbitMQProducer适配RabbitMQ协议主动发布内容到服务端可以定时/变化发布数据
通道只支持 Other
## 二、插件属性配置项
<img src={require("@site/static/img/docs/RabbitMQProducer.png").default} />
| 属性 | 说明 | 备注|
| ---------------| --------------------------| ---|
| IP | ServerIP,为空时指任意IP | |
| 端口 | 连接端口 | |
| 账号 | 账号 | |
| 密码 | 密码 | |
| 是否声明队列 | 初始化时是否自动创建队列 | |
| 虚拟Host | / | |
| 交换机名称 | 交换机名称 | |
| 设备是否列表 | 设备是否列表上传false时每个设备实体都会单独发布注意性能需求默认为true | |
| 变量是否列表 | 变量是否列表上传false时每个变量实体都会单独发布注意性能需求默认为true | |
| 报警是否列表 | 报警是否列表上传false时每个报警实体都会单独发布注意性能需求默认为true | |
| 设备Topic | 设备实体的发布主题 ,使用${key}作为匹配项key必须是上传实体中的属性 | |
| 变量Topic | 变量实体的发布主题 ,使用${key}作为匹配项key必须是上传实体中的属性 | |
| 报警Topic | 报警实体的发布主题 ,使用${key}作为匹配项key必须是上传实体中的属性 | |
| 设备实体脚本 | 脚本返回新的实体列表,动态类中需继承**IDynamicModel**,传入列表为**DeviceData**,查看以下具体属性 | 编辑页面中,可通过检查按钮验证脚本,脚本示例请查看**常见问题** |
| 变量实体脚本 | 脚本返回新的实体列表,动态类中需继承**IDynamicModel**,传入列表为**VariableData**,查看以下具体属性 | 编辑页面中,可通过检查按钮验证脚本,脚本示例请查看**常见问题** |
| 报警实体脚本 | 脚本返回新的实体列表,动态类中需继承**IDynamicModel**,传入列表为**AlarmVariable**,查看以下具体属性 | 编辑页面中,可通过检查按钮验证脚本,脚本示例请查看**常见问题** |
| 是否选择全部变量 | 是否选择全部变量true时不需要单个变量添加业务属性 | |
| 是否间隔执行 | 是否选择全部变量true间隔上传False变化检测上传 | |
| 间隔执行时间 | 间隔执行时间 | |
| 启用缓存 | 是否启用缓存 | |
| 上传列表最大数量 | 每一次上传的列表最大数量 | |
| 内存队列最大数量 | 内存队列的最大数量,超出或失败时转入文件缓存,根据数据量设定适当值 | |
### 脚本与实体
查看MqttClient页面[脚本接口](./301.mdx#脚本接口)

77
doc/docs/304.mdx Normal file
View File

@@ -0,0 +1,77 @@
---
id: 304
title: KafkaProducer
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::tip `提示`
通过自定义脚本,可快速适配业务模型
脚本的示例请查看**常见问题**
:::
:::tip `须知`
插件使用**librdkafka**,注意按需安装c库
On Mac OSX, install librdkafka with homebrew:
```
$ brew install librdkafka
```
On Debian and Ubuntu, install librdkafka from the Confluent APT repositories, see instructions here and then install librdkafka:
```
$ apt install librdkafka-dev
```
On RedHat, CentOS, Fedora, install librdkafka from the Confluent YUM repositories, instructions here and then install librdkafka:
```
$ yum install librdkafka-devel
```
For other platforms, follow the source building instructions below.
:::
## 一、说明
KafkaProducer适配Kafka协议主动发布内容到服务端可以定时/变化发布数据
通道只支持 Other
## 二、插件属性配置项
<img src={require("@site/static/img/docs/KafkaProducer.png").default} />
| 属性 | 说明 | 备注|
| ---------------| --------------------------| ---|
| 服务地址 | 服务地址 | 127.0.0.1:9092|
| 发布超时时间 | 发布超时时间 |5000 |
| 用户名 | 用户名 | |
| 密码 | 密码 | |
| SecurityProtocol | SecurityProtocol | |
| SaslMechanism | SaslMechanism | |
| 设备是否列表 | 设备是否列表上传false时每个设备实体都会单独发布注意性能需求默认为true | |
| 变量是否列表 | 变量是否列表上传false时每个变量实体都会单独发布注意性能需求默认为true | |
| 报警是否列表 | 报警是否列表上传false时每个报警实体都会单独发布注意性能需求默认为true | |
| 设备Topic | 设备实体的发布主题 ,使用${key}作为匹配项key必须是上传实体中的属性 | |
| 变量Topic | 变量实体的发布主题 ,使用${key}作为匹配项key必须是上传实体中的属性 | |
| 报警Topic | 报警实体的发布主题 ,使用${key}作为匹配项key必须是上传实体中的属性 | |
| 设备实体脚本 | 脚本返回新的实体列表,动态类中需继承**IDynamicModel**,传入列表为**DeviceData**,查看以下具体属性 | 编辑页面中,可通过检查按钮验证脚本,脚本示例请查看**常见问题** |
| 变量实体脚本 | 脚本返回新的实体列表,动态类中需继承**IDynamicModel**,传入列表为**VariableData**,查看以下具体属性 | 编辑页面中,可通过检查按钮验证脚本,脚本示例请查看**常见问题** |
| 报警实体脚本 | 脚本返回新的实体列表,动态类中需继承**IDynamicModel**,传入列表为**AlarmVariable**,查看以下具体属性 | 编辑页面中,可通过检查按钮验证脚本,脚本示例请查看**常见问题** |
| 是否选择全部变量 | 是否选择全部变量true时不需要单个变量添加业务属性 | |
| 是否间隔执行 | 是否选择全部变量true间隔上传False变化检测上传 | |
| 间隔执行时间 | 间隔执行时间 | |
| 启用缓存 | 是否启用缓存 | |
| 上传列表最大数量 | 每一次上传的列表最大数量 | |
| 内存队列最大数量 | 内存队列的最大数量,超出或失败时转入文件缓存,根据数据量设定适当值 | |
### 脚本与实体
查看MqttClient页面[脚本接口](./301.mdx#脚本接口)

34
doc/docs/305.mdx Normal file
View File

@@ -0,0 +1,34 @@
---
id: 305
title: TDengineDBProducer
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
## 一、说明
TDengineDBProducer适配TDengineDB时序数据库可以定时/变化存储变量数据
通道只支持 Other
## 二、插件属性配置项
<img src={require("@site/static/img/docs/TDengineDBProducer.png").default} />
| 属性 | 说明 | 备注|
| ---------------| --------------------------| ---|
| 链接字符串 | 链接字符串 | Host=localhost;Port=6030;Username=root;Password=taosdata;Database=test|
| 是否选择全部变量 | 是否选择全部变量true时不需要单个变量添加业务属性 | |
| 是否间隔执行 | 是否选择全部变量true间隔上传False变化检测上传 | |
| 间隔执行时间 | 间隔执行时间 | |
| 启用缓存 | 是否启用缓存 | |
| 上传列表最大数量 | 每一次上传的列表最大数量 | |
| 内存队列最大数量 | 内存队列的最大数量,超出或失败时转入文件缓存,根据数据量设定适当值 | |

34
doc/docs/306.mdx Normal file
View File

@@ -0,0 +1,34 @@
---
id: 306
title: QuestDBProducer
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
## 一、说明
QuestDBProducer适配QuestDB时序数据库可以定时/变化存储变量数据
通道只支持 Other
## 二、插件属性配置项
<img src={require("@site/static/img/docs/QuestDBProducer.png").default} />
| 属性 | 说明 | 备注|
| ---------------| --------------------------| ---|
| 链接字符串 | 链接字符串 | host=localhost;port=8812;username=admin;password=quest;database=qdb;ServerCompatibilityMode=NoTypeLoading;|
| 是否选择全部变量 | 是否选择全部变量true时不需要单个变量添加业务属性 | |
| 是否间隔执行 | 是否选择全部变量true间隔上传False变化检测上传 | |
| 间隔执行时间 | 间隔执行时间 | |
| 启用缓存 | 是否启用缓存 | |
| 上传列表最大数量 | 每一次上传的列表最大数量 | |
| 内存队列最大数量 | 内存队列的最大数量,超出或失败时转入文件缓存,根据数据量设定适当值 | |

38
doc/docs/307.mdx Normal file
View File

@@ -0,0 +1,38 @@
---
id: 307
title: SqlDBProducer
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
## 一、说明
SqlDBProducer适配关系数据库可以定时/变化存储变量数据,也可以实时更新数据到实时表
通道只支持 Other
## 二、插件属性配置项
<img src={require("@site/static/img/docs/SqlDBProducer.png").default} />
| 属性 | 说明 | 备注|
| ---------------| --------------------------| ---|
| 是否实时表 | 开启实时更新数据功能 | |
| 是否历史表 | 开始历史存储功能 |true |
| 实时表名称 | 实时表名称 | |
| 数据库类型 | 数据库类型 | |
| 链接字符串 | 链接字符串 | server=.;uid=sa;pwd=111111;database=test;|
| 是否选择全部变量 | 是否选择全部变量true时不需要单个变量添加业务属性 | |
| 是否间隔执行 | 是否选择全部变量true间隔上传False变化检测上传 | |
| 间隔执行时间 | 间隔执行时间 | |
| 启用缓存 | 是否启用缓存 | |
| 上传列表最大数量 | 每一次上传的列表最大数量 | |
| 内存队列最大数量 | 内存队列的最大数量,超出或失败时转入文件缓存,根据数据量设定适当值 | |

32
doc/docs/308.mdx Normal file
View File

@@ -0,0 +1,32 @@
---
id: 308
title: SqlHisAlarm
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
## 一、说明
SqlHisAlarm适配关系数据库可以变化存储变量报警数据
通道只支持 Other
## 二、插件属性配置项
<img src={require("@site/static/img/docs/SqlHisAlarm.png").default} />
| 属性 | 说明 | 备注|
| ---------------| --------------------------| ---|
| 数据库类型 | 数据库类型 | |
| 链接字符串 | 链接字符串 | server=.;uid=sa;pwd=111111;database=test;|
| 启用缓存 | 是否启用缓存 | |
| 上传列表最大数量 | 每一次上传的列表最大数量 | |
| 内存队列最大数量 | 内存队列的最大数量,超出或失败时转入文件缓存,根据数据量设定适当值 | |

53
doc/docs/309.mdx Normal file
View File

@@ -0,0 +1,53 @@
---
id: 309
title: OpcUaServer
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::tip `权限注意`
如果开启安全策略在网关后台创建的所有账号密码都可以登录OpcUaServer
如果不开启安全策略,则可以匿名登录
:::
## 一、说明
OpcUaServer支持外部OpcUa客户端读写
通道只支持 Other
## 二、插件属性配置项
<img src={require("@site/static/img/docs/OpcUaServer.png").default} />
| 属性 | 说明 | 备注|
| ---------------| --------------------------| ---|
| 是否选择全部变量 | 是否选择全部变量true时不需要单个变量添加业务属性 | |
| 服务地址 | Url ,以分号分割,可设置多个 | opc.tcp://127.0.0.1:49321 |
| SubjectName | 证书内容 | |
| 安全策略 | 启用后将不接受使用匿名登录的客户端,并且可以写入变量 | |
| 自动接受不受信任的证书 | 自动获取客户端证书并接受 | True |
## 三、变量业务属性
### 数据类型
同变量管理数据类型Enum
## 四、证书说明
证书可以在软件目录\OPCUAServerCertificate下查看或者导出/复制
<img src={require("@site/static/img/docs/OpcUaServer1.png").default} />

31
doc/docs/400.mdx Normal file
View File

@@ -0,0 +1,31 @@
---
id: 400
title: 发布
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
## 一、编译解决方案
<img src={require("@site/static/img/docs/发布.png").default} />
选择Release , 点击解决方案全编译(或者编译plugin文件夹)
## 二、发布版本
<img src={require("@site/static/img/docs/发布1.png").default} />
按需选择发布版本(图中为linux-64 net6)
## 三、复制插件文件夹
:::tip `提示`
如果你的开发机是**Windows**系统,这一步不再需求进行,发布时通过脚本已经自动复制到发布文件夹
:::
<img src={require("@site/static/img/docs/发布2.png").default} />

37
doc/docs/401.mdx Normal file
View File

@@ -0,0 +1,37 @@
---
id: 401
title: Windows部署
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::tip `提示`
如果需要Runtime依赖部署需要安装ASP.NET Core Runtime如果是独立发布部署则不需要安装Runtime
下载链接:https://dotnet.microsoft.com/zh-cn/download/dotnet
:::
遵循windows service服务安装/启动/停止方式 https://docs.microsoft.com/zh-cn/windows-server/administration/windows-commands/sc-create
提供懒人bat脚本文件管理员身份运行**WindowsServiceCreate.bat**
<img src={require("@site/static/img/docs/Windows服务.png").default} />
运行脚本后可以在windows服务中找到**ThingsGateway**
<img src={require("@site/static/img/docs/Windows服务1.png").default} />
如需删除服务,运行**WindowsServiceDelete.bat**

195
doc/docs/402.mdx Normal file
View File

@@ -0,0 +1,195 @@
---
id: 402
title: IIS部署
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::caution 注意
1、必须启用IIS WebSocket协议
2、禁用IIS回收
:::
:::tip `提示`
如果需要Runtime依赖部署需要安装ASP.NET Core Runtime如果是独立发布部署则不需要安装Runtime
下载链接:https://dotnet.microsoft.com/zh-cn/download/dotnet
:::
:::tip 精简发布文件
如果需要精简发布后的文件,也就是删除不必要的文件夹,可以编辑 Web 项目的 `.csproj` 并添加 `<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>`,如:
```cs showLineNumbers {3}
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
</PropertyGroup>
```
若无需生成 `.pdb` 文件,可以继续添加:
```cs showLineNumbers {2-3}
<PropertyGroup>
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
```
:::
## 服务器环境配置
### 第一步
安装.NET Core 运行时捆绑包:[点击下载](https://dotnet.microsoft.com/permalink/dotnetcore-current-windows-runtime-bundle-installer)
### 第二步(命令)
```bash showLineNumbers
net stop was /y
```
### 第三步(命令)
```bash showLineNumbers
net start w3svc
```
### 第四步(命令)
```bash showLineNumbers
set ASPNETCORE_ENVIRONMENT=Production
```
## 部署到 IIS
### 添加新网站
<img src={require("@site/static/img/furion/ds1.png").default} />
### 配置网站信息
<img src={require("@site/static/img/furion/ds2.png").default} />
### 34.1.3.3 配置应用程序池
<img src={require("@site/static/img/furion/ds3.png").default} />
### 34.1.3.4 设置为 `非托管`
<img src={require("@site/static/img/furion/ds4.png").default} />
### 34.1.3.5 重启网站
只需重启网站或应用程序池即可。
## 34.1.4 常见问题
### 34.1.4.1 405 状态码,不支持 `PUTDELETE` 请求
默认情况下,`IIS`拒绝 `PUT`和 `DELETE` 请求,原因为 `IIS` 默认注册了一个名为 `WebDAVModule` 的自定义 `HttpModule` 导致的。
解决该问题,只需要在 `web.config` 移除即可:
```xml {2-6}
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="webDAVModule"/>
</modules>
</system.webServer>
</configuration>
```
微软官方文档:[https://docs.microsoft.com/zh-cn/troubleshoot/developer/webapps/iis/health-diagnostic-performance/http-error-405-website](https://docs.microsoft.com/zh-cn/troubleshoot/developer/webapps/iis/health-diagnostic-performance/http-error-405-website)
<img src={require("@site/static/img/furion/iis5.png").default} />
### 34.1.4.2 `WebSocket`/ `SignalR` 连接报错
如果项目部署在 `IIS` 中出现 `WebSoket`/`SignalR` 不能连接或连接失败等问题,请确保 `IIS` 服务中的 `WebSocket 协议` 是勾选状态
<img src={require("@site/static/img/furion/iis2.png").default} />
### 34.1.4.3 部署之后缺失 `api-ms-win.xxxx.dll` 问题
有时候将发布文件发布到服务器后,出现丢失 `api.ms-win.xxxx.dll` 文件,这时只需要重新发布并选择服务器特定的架构即可。
<img src={require("@site/static/img/furion/iis4.jpg").default} />
<img src={require("@site/static/img/furion/iis3.png").default} />
## 34.1.5 `IIS` 回收问题和配置
通过 `IIS` 部署 `.NET Core` 应用程序,如果启动了系统日志,就会发现经常出现 `Application is shutting down...` 的日志,代表 `IIS` 回收了应用程序池。
对于一个长期在线的网站来说,这是非常不合理的,所以我们可以通过以下配置让 `IIS` 进行长时间不访问便回收的机制。
---
配置步骤如下:
1. 打开 `IIS` 并点击左侧树根节点(计算机名称)并点击右侧的 `Configuration Editor`(配置编辑器)
<img src={require("@site/static/img/furion/iis6.png").default} />
2. 在 `Section`(节)选择 `system.applicationHost/applicationPools` 并设置 `startMode` 为 `AlwaysRunning`,之后点击 `Apply` 保存。
<img src={require("@site/static/img/furion/iis7.png").default} />
3. 点击左侧树根节点(计算机名称)下的 `Application Pools` 并点击最右侧的 `Set Appliation Pool Defaults...`(设置应用程序池默认配置...
<img src={require("@site/static/img/furion/iis8.png").default} />
4. 设置 `Idle Time-out (minutes)`(闲置超时(分钟)为 `0`
<img src={require("@site/static/img/furion/iis9.png").default} />
这样即可解决 `IIS` 回收问题。
## 34.1.6 卷影(无占用)复制发布替换
正常情况下如果我们代码重新发布后替换 `IIS` 中的文件,这时候会出现文件占用无法进行替换,过去运维人员都是先停止站点后替换再启动。但我们也可以配置 `web.config` 文件启用卷影复制模式实现类似**热更新**操作,如:
```xml showLineNumbers {12-18}
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- To customize the asp.net core module uncomment and edit the following section.
For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
<system.webServer>
<handlers>
<remove name="aspNetCore"/>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModulev2" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout">
<handlerSettings>
<handlerSetting name="experimentalEnableShadowCopy" value="true" />
<handlerSetting name="shadowCopyDirectory" value="../ShadowCopyDirectory/" />
<!-- Only enable handler logging if you encounter issues-->
<!--<handlerSetting name="debugFile" value=".\logs\aspnetcore-debug.log" />-->
<!--<handlerSetting name="debugLevel" value="FILE,TRACE" />-->
</handlerSettings>
</aspNetCore>
</system.webServer>
</configuration>
```
关于卷影复制更多知识可查看以下文档:
- [https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-net-6-preview-3/#shadow-copying-in-iis](https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-net-6-preview-3/#shadow-copying-in-iis)
- [https://learn.microsoft.com/zh-cn/dotnet/framework/app-domains/shadow-copy-assemblies](https://learn.microsoft.com/zh-cn/dotnet/framework/app-domains/shadow-copy-assemblies)

122
doc/docs/403.mdx Normal file
View File

@@ -0,0 +1,122 @@
---
id: 403
title: Docker部署
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
:::important 特别注意
验证码使用SkiaSharp如果是在 linux 服务下运行则需要安装 libfontconfig1如 ubuntu 的安装命令
```
apt-get update
apt-get -y install libfontconfig1
```
如果是采用 docker 模式运行,则需要在 dockerfile 中添加如下配置,该命令适用于 debian 和 ubuntu 的 docker
```
RUN apt-get update && apt-get -y install libfontconfig1
```
:::
:::tip `提示`
如果需要Runtime依赖部署需要安装ASP.NET Core Runtime如果是独立发布部署则不需要安装Runtime
下载链接:https://dotnet.microsoft.com/zh-cn/download/dotnet
:::
:::tip 精简发布文件
如果需要精简发布后的文件,也就是删除不必要的文件夹,可以编辑 Web 项目的 `.csproj` 并添加 `<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>`,如:
```cs showLineNumbers {3}
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
</PropertyGroup>
```
若无需生成 `.pdb` 文件,可以继续添加:
```cs showLineNumbers {2-3}
<PropertyGroup>
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
```
:::
## 34.2.1 关于 `Docker` 部署
在 `Docker` 中部署网站有两种方式:
- `发布后构建`:此方式是先发布网站后在再构建镜像,这样可以减少不必要的构建层,而且还能缩减镜像大小。**(推荐)**
- `编译+构建+发布`:也就是说在 `Dockerfile` 中配置网站从构建到发布的完整过程,此方式会速度慢,而且会产生冗余层,增加镜像大小。
## 34.2.2 两种方式构建
### 34.2.2.1 发布后构建
- 👉 编写 `Dockerfile`
```
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
COPY . /app
WORKDIR /app
EXPOSE 80
#linux安装
RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ sid main contrib non-free" > /etc/apt/sources.list
RUN apt-get update && apt-get -y install libfontconfig1
ENTRYPOINT ["dotnet", "ThingsGateway.Web.Server.dll","--urls","http://*:7200"]
```
- 👉 将 `Dockerfile` 文件拷贝到发布根目录
将编写好的 `Dockerfile` 文件(注意 `D` 大写)拷贝到发布网站的根目录下。
:::tip `提示`
git仓库中已经包含 `Dockerfile` 文件
:::
- 👉 构建 `Docker` 镜像
在网站发布后的路径根目录下(必须含 `Dockerfile`)打开 `CMD/PowerShell` 只需构建命令:
```bash showLineNumbers
docker build -t 网站名称:网站版本号 .
```
:::important 特别注意
后端的 `.` 不能省略
:::
- 👉 启动镜像
```bash showLineNumbers
docker run --name 容器名称 -p 5000:80 --restart=always -d 网站名称:网站版本号
```
:::caution `.NET8` 中 `80` 端口问题
在使用 `.NET8`,默认的端口由原来的 `80` 端口变成了 `8080`。[查看相关说明](https://learn.microsoft.com/zh-cn/dotnet/core/compatibility/containers/8.0/aspnet-port)
:::
- 👉 在 `Dockerfile` 所在路径构建
接下来的步骤和上述步骤一致,不再重复编写。

55
doc/docs/404.mdx Normal file
View File

@@ -0,0 +1,55 @@
---
id: 404
title: Linux服务部署
---
:::important 特别注意
验证码使用SkiaSharp如果是在 linux 服务下运行则需要安装 libfontconfig1如 ubuntu 的安装命令
```
apt-get update
apt-get -y install libfontconfig1
```
如果是采用 docker 模式运行,则需要在 dockerfile 中添加如下配置,该命令适用于 debian 和 ubuntu 的 docker
```
RUN apt-get update && apt-get -y install libfontconfig1
```
:::
### PM2守护
详细安装请自行查找资料
查阅详细官方文档 https://pm2.keymetrics.io/docs/usage/quick-start/
下面介绍一下常用指令
- 安装pm2
```
npm install pm2@latest -g
```
- 启用应用程序
```
pm2 start pm2-linux.json
```
- 停止应用程序
```
pm2 stop pm2-linux.json
```
- 自动启动
```
pm2-startup
pm2 save
```
### linux服务
自行查询相关资料 **NetCore/Linux/Systemd**

10
doc/docs/501.mdx Normal file
View File

@@ -0,0 +1,10 @@
---
id: 501
title: 常见问题
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';

117
doc/docs/502.mdx Normal file
View File

@@ -0,0 +1,117 @@
---
id: 502
title: 脚本常见问题
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
## 一、脚本示例
```
//变量脚本动态设置传输实体的Demo
//只传输变量名称,变量值,变量在线状态,变量值改变时间
public class DemoScript:IDynamicModel
{
public IEnumerable<dynamic> GetList(IEnumerable<dynamic> datas)
{
List<DemoData> demoDatas = new List<DemoData>();
foreach (var data in datas)
{
DemoData demoData = new DemoData();
demoData.Value = data.Value;
demoData.Name = data.Name;
demoData.IsOnline = data.IsOnline;
demoData.ChangeTime = data.ChangeTime;
demoDatas.Add(demoData);
}
return demoDatas;
}
}
public class DemoData
{
public string Name { get; set; }
public bool IsOnline { get; set; }
public object Value { get; set; }
public DateTime ChangeTime { get; set; }
}
```
## 二、适配阿里云物模型脚本
对应文档:[阿里云设备属性上报](https://help.aliyun.com/zh/iot/user-guide/data-formats?spm=a2c4g.11186623.0.i17#section-jrb-lrl-b2b)
### 变量脚本
```
//一个适配阿里云IOT的变量脚本demo
public class AliYunIotScript:IDynamicModel
{
public IEnumerable<dynamic> GetList(IEnumerable<dynamic> datas)
{
List<AliYunIot> aliYunIots = new();
// 对输入列表进行分组,根据 Remark1属性分组
var groups = datas.Where(a => !string.IsNullOrEmpty(a.Remark1)).GroupBy(a => a.Remark1);
// 遍历每一个分组
foreach (var item in groups)
{
var requestId = Yitter.IdGenerator.YitIdHelper.NextId();
var iotId = item.Key; //Remark1自定义为设备Id
var productKey = item.FirstOrDefault(a => !string.IsNullOrEmpty(a.Remark2))?.Remark2;//Remark2自定义为产品Id
var deviceName = item.FirstOrDefault(a => !string.IsNullOrEmpty(a.Remark3))?.Remark3;//Remark3自定义为设备名称
AliYunIot aliYunIot = new();
aliYunIot.iotId = iotId;
aliYunIot.requestId = requestId.ToString();
aliYunIot.deviceName = deviceName;
aliYunIot.productKey = productKey;
// 遍历分组内的每一个元素
foreach (var varItem in item)
{
// 设置采集时间,并转换为 Unix 时间戳
// 设置值
var data = new Property() { value = varItem.Value, time = new DateTimeOffset(varItem.CollectTime).ToUnixTimeSeconds() };
// 以 变量名称 作为键,将新对象添加到分组的 属性 中
aliYunIot.items.Add(varItem.Name, data);
}
aliYunIots.Add(aliYunIot);
}
return aliYunIots;
}
}
public class AliYunIot
{
public string iotId { get; set; }
public string requestId { get; set; }
public string productKey { get; set; }
public string deviceName { get; set; }
public Dictionary<string, Property> items { get; set; } = new();
}
public class Property
{
public object value { get; set; }
public long time { get; set; }
}
```
### 传输主题
变量Topic 填入 `/${productKey}/${deviceName}/thing/event/property/post`

9
doc/docs/601.mdx Normal file
View File

@@ -0,0 +1,9 @@
---
id: 601
title: 采集插件开发
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';

9
doc/docs/602.mdx Normal file
View File

@@ -0,0 +1,9 @@
---
id: 602
title: 业务插件开发
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';

80
doc/docs/upgrade.mdx Normal file
View File

@@ -0,0 +1,80 @@
---
id: upgrade
title: 更新日志
---
import useBaseUrl from "@docusaurus/useBaseUrl";
import Tag from "@site/src/components/Tag.js";
import Highlight from '@site/src/components/Highlight.js';
## v5.0.0.0
> 2024-2-17
**更新描述:**
此版本是大版本更新。可能会产生很多不兼容部分,所以升级之前请做好备份。
如果需要从5.0前升级,请按以下操作进行
1、导出旧版本的excel配置文件包括采集设备、上传设备、变量等
2、5.0框架中,只建立一个对应插件的设备/变量这一步是因为插件是按需导出的需要建立对应插件才会导出相应的sheet建好后导出excel
3、参照5.0版本的excel内容把旧版本的配置内容移到新版本excel文件中
4、导入已修改好的5.0版本excel配置文件
**更新详情:**
- &nbsp;<Tag>调整</Tag> 重构采集驱动底层,网关缓存
- &nbsp;<Tag>调整</Tag> 重构网关权限管理框架
- &nbsp;<Tag>调整</Tag> 重构网关线程管理器
- &nbsp;<Tag>调整</Tag> 重构网关断线续传功能
- &nbsp;<Tag>调整</Tag> 重构脚本支持方便对应各大云平台的iot格式
- &nbsp;<Tag>调整</Tag> 调整网关UI外观风格
## v3.0.0.25
- &nbsp;<Tag>调整</Tag> 删除S7插件中的DstTSAP属性,用插槽号与机架号代替,更直观
- &nbsp;<Tag>调整</Tag> OPCUAServer插件 url属性支持多个url以逗号分割
## v3.0.0.19
- &nbsp;<Tag>新增</Tag> 添加TDengineDB时序库上传插件
- &nbsp;<Tag>新增</Tag> 添加QuestDB时序库上传插件
- &nbsp;<Tag>新增</Tag> 添加DLT645采集插件
- &nbsp;<Tag>新增</Tag> 添加调试软件
## v1.7.0
- &nbsp;<Tag>优化</Tag> OPCUAClient支持动态类型
## v1.2.0
- &nbsp;<Tag>新增</Tag> 添加OPCUAServer插件
##
## v1.1.0
- &nbsp;<Tag>新增</Tag> 添加OPCDAClient采集插件
- &nbsp;<Tag>新增</Tag> 添加OPCUAClient采集插件
- &nbsp;<Tag>新增</Tag> 串口基础框架
##
## v1.0.0
- &nbsp;<Tag>新增</Tag> 初始发布
##

View File

@@ -1,10 +1,11 @@
module.exports = {
title: "thingsgateway",
tagline: "物联网",
url: "https://diego2098.gitee.io",
baseUrl: "/thingsgateway-docs/",
title: "thingsgateway",
tagline: "物联网",
url: "https://diego2098.gitee.io",
baseUrl: "/thingsgateway-docs/",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
onBrokenMarkdownLinks: "throw",
favicon: "img/favicon.ico",
projectName: "ThingsGateway",
scripts: [],
@@ -29,24 +30,19 @@ module.exports = {
additionalLanguages: ["powershell", "csharp", "sql"],
},
navbar: {
title: "ThingsGateway",
logo: {
alt: "ThingsGateway Logo",
src: "img/ThingsGatewayLogo.png",
title: "ThingsGateway",
logo: {
alt: "ThingsGateway Logo",
src: "img/ThingsGatewayLogo.png",
},
hideOnScroll: true,
items: [
{
to: "docs",
activeBasePath: "docs",
label: "文档",
position: "left",
},
{
label: "更新日志",
position: "left",
to: "docs/upgrade"
},
{
label: "源码",
position: "right",
@@ -65,6 +61,16 @@ module.exports = {
},
],
},
// {
// label: "博客",
// position: "right",
// href: "https://www.cnblogs.com/ThingsGateway/collections/1104",
// },
{
label: "视频",
position: "right",
href: "https://space.bilibili.com/88105259/channel/series",
},
{
label: "社区",
position: "right",
@@ -121,17 +127,18 @@ module.exports = {
docs: {
sidebarPath: require.resolve("./sidebars.js"),
editUrl:
"https://gitee.com/diego2098/ThingsGateway/tree/master/handbook/",
"https://gitee.com/diego2098/ThingsGateway/tree/master/doc/",
showLastUpdateTime: true,
showLastUpdateAuthor: true,
sidebarCollapsible: true,
sidebarCollapsed: true,
// sidebarCollapsible: true,
},
// blog: {
// showReadingTime: true,
// editUrl:
// "https://gitee.com/diego2098/ThingsGateway/tree/master/handbook/",
// "https://gitee.com/diego2098/ThingsGateway/tree/master/doc/",
// },
theme: {
customCss: require.resolve("./src/css/custom.css"),
@@ -145,7 +152,7 @@ module.exports = {
"@easyops-cn/docusaurus-search-local",
{
hashed: true,
language: ["en", "zh"],
language: ["zh","en"],
highlightSearchTermsOnTargetPage: true,
explicitSearchResultPath: true,
},

22684
doc/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "thingsgateway",
"version": "v2.0",
"version": "v5.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
@@ -14,8 +14,8 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "^2.3.1",
"@docusaurus/preset-classic": "^2.3.1",
"@docusaurus/core": "^2.4.3",
"@docusaurus/preset-classic": "^2.4.3",
"@easyops-cn/docusaurus-search-local": "^0.33.5",
"@mdx-js/react": "^1.6.22",
"@svgr/webpack": "^6.5.1",
@@ -41,7 +41,7 @@
]
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^2.3.1",
"@docusaurus/module-type-aliases": "^2.4.3",
"react-iconfont-cli": "^2.0.2"
},
"engines": {

266
doc/sidebars.js Normal file
View File

@@ -0,0 +1,266 @@
module.exports = {
docs: [
{
type: "doc",
id: "upgrade",
label: "更新日志"
},
{
type: "doc",
id: "1",
label: "版权说明"
},
{
type: "doc",
id: "2",
label: "产品介绍"
},
{
type: "doc",
id: "3",
label: "入门指南"
},
{
type: "doc",
id: "100",
label: "驱动调试"
},
{
type: "category",
label: "基础手册",
items: [
{
type: "category",
label: "网关配置",
items: [
{
type: "doc",
id: "101",
label: "插件管理"
},
{
type: "doc",
id: "102",
label: "通道管理"
},
{
type: "doc",
id: "103",
label: "设备"
},
{
type: "doc",
id: "104",
label: "变量"
},
]
},
{
type: "doc",
id: "105",
label: "网关状态查看"
},
{
type: "doc",
id: "106",
label: "网关日志"
},
]
},
{
type: "category",
label: "采集插件手册",
items: [
{
type: "doc",
id: "200",
label: "ModbusMaster"
},
{
type: "doc",
id: "202",
label: "Dlt645Master"
},
{
type: "doc",
id: "203",
label: "SiemensS7Master"
},
{
type: "doc",
id: "204",
label: "OpcDaMaster"
},
{
type: "doc",
id: "205",
label: "OpcUaMaster"
},
{
type: "doc",
id: "206",
label: "VariableExpression"
}
]
},
{
type: "category",
label: "业务插件手册",
items: [
{
type: "doc",
id: "201",
label: "ModbusSlave"
},
{
type: "doc",
id: "301",
label: "MqttClient"
},
{
type: "doc",
id: "302",
label: "MqttServer"
},
{
type: "doc",
id: "303",
label: "RabbitMQProducer"
},
{
type: "doc",
id: "304",
label: "KafkaProducer"
},
{
type: "doc",
id: "305",
label: "TDengineDBProducer"
},
{
type: "doc",
id: "306",
label: "QuestDBProducer"
},
{
type: "doc",
id: "307",
label: "SqlDBProducer"
},
{
type: "doc",
id: "308",
label: "SqlHisAlarm"
},
{
type: "doc",
id: "309",
label: "OpcUaServer"
},
]
},
// {
// type: "category",
// label: "Pro插件手册",
// items: [
// ]
// },
{
type: "category",
label: "部署",
items: [
{
type: "doc",
id: "400",
label: "编译发布"
},
{
type: "doc",
id: "401",
label: "windows服务部署"
},
{
type: "doc",
id: "402",
label: "iis部署"
},
{
type: "doc",
id: "403",
label: "docker部署"
},
{
type: "doc",
id: "404",
label: "linux服务部署"
}
]
},
{
type: "category",
label: "常见问题",
items: [
{
type: "doc",
id: "501",
label: "常见问题"
},
{
type: "doc",
id: "502",
label: "脚本常见问题"
},
]
},
{
type: "category",
label: "插件开发",
items: [
{
type: "doc",
id: "601",
label: "采集插件"
},
{
type: "doc",
id: "602",
label: "业务插件"
},
]
},
{
type: "category",
label: "技术支持/合作",
items: [
{
type: "doc",
id: "1002",
label: "联系我们"
},
{
type: "doc",
id: "1000",
label: "赞助项目"
},
{
type: "doc",
id: "1001",
label: "Pro版"
},
]
},
]
};

View File

@@ -42,13 +42,15 @@ export default function (props) {
bgColor: "#38e550",
},
Demo: {
推荐: {
bgColor: "#38e550",
},
DEMO: {
bgColor: "#38e550",
},
Pro版: {
bgColor: "#23AAF2",
},
}
};
return (
<label

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -23,7 +23,7 @@
.ThingsGateway-banner-description {
margin: 24px 0;
font-size: 2.2em;
font-size: 2.5em;
font-weight: 700;
line-height: 1.25;
background-image: linear-gradient(81deg, #8759ff, #3fc4fe, #42ffac);

View File

@@ -18,13 +18,13 @@ function Home() {
const context = useDocusaurusContext();
const { siteConfig = {} } = context;
React.useEffect(() => {}, []);
React.useEffect(() => { }, []);
return (
<Layout
title={`ThingsGateway说明文档。 ${siteConfig.title}`}
description="ThingsGateway说明文档"
>
<Layout
title={`ThingsGateway说明文档。 ${siteConfig.title}`}
description="ThingsGateway说明文档"
>
<Banner />
<Gitee />
</Layout>
@@ -32,25 +32,32 @@ function Home() {
}
function Banner() {
const { colorMode, setLightTheme, setDarkTheme } = useColorMode();
const isDarkTheme = colorMode === "dark";
return (
<div className="ThingsGateway-banner">
<div className={"ThingsGateway-banner" + (isDarkTheme ? " dark" : "")}>
<div className="ThingsGateway-banner-container">
<div className="ThingsGateway-banner-item">
<div className="ThingsGateway-banner-project">
ThingsGateway{" "}
<span
style={{ fontSize: 14, fontWeight: "normal", color: "#8759ff" }}
></span>
<span style={{ fontSize: 20, fontWeight: "Blod", color: "#FFFFFF" }}>
ThingsGateway
</span>
</div>
<div style={{ color: "#82aaff", position: "relative", fontSize: 14 }}>
基于NetCore的跨平台物联网关
</div>
<div className="ThingsGateway-banner-description">
<div className={"ThingsGateway-banner-description"+ (isDarkTheme ? " dark" : "")}>
不只是心血来潮更是持之以恒
</div>
<ul className="ThingsGateway-banner-spec">
<li> Apache-2.0 宽松开源协议商业免费授权</li>
<li>支持 .NET/6/7+</li>
<li>
底层驱动库 支持 .NET Framework 4.5及以上.NET Standard2.0及以上
</li>
<li>网关 支持 .NET 6/7/8</li>
<li>极速上手极简使用</li>
</ul>
<div className="ThingsGateway-support-platform">受支持平台</div>
<div className="ThingsGateway-support-icons">
@@ -74,13 +81,13 @@ function Banner() {
</span>
</div>
<div className="ThingsGateway-get-start-btn">
<Link className="ThingsGateway-get-start" to={useBaseUrl("docs")}>
<Link className="ThingsGateway-get-start" to={useBaseUrl("docs/")}>
入门指南
<span className="ThingsGateway-version">v2.0.0</span>
<span className="ThingsGateway-version">v5.0</span>
</Link>
</div>
</div>
</div>
</div>
);
@@ -107,7 +114,7 @@ function Gitee() {
className={"ThingsGateway-log-jiao" + (isDarkTheme ? " dark" : "")}
></div>
<div className="ThingsGateway-log-number">
<div style={{ color: "#723cff" }}>400 +</div>
<div style={{ color: "#723cff" }}>600 +</div>
<span className={isDarkTheme ? " dark" : ""}>Stars</span>
</div>
</div>
@@ -119,7 +126,7 @@ function Gitee() {
className={"ThingsGateway-log-jiao" + (isDarkTheme ? " dark" : "")}
></div>
<div className="ThingsGateway-log-number">
<div style={{ color: "#3fbbfe" }}>100 +</div>
<div style={{ color: "#3fbbfe" }}>150 +</div>
<span className={isDarkTheme ? " dark" : ""}>Forks</span>
</div>
</div>

View File

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 965 B

After

Width:  |  Height:  |  Size: 965 B

View File

Before

Width:  |  Height:  |  Size: 627 B

After

Width:  |  Height:  |  Size: 627 B

View File

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

BIN
doc/static/img/docs/Dlt645Master.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

BIN
doc/static/img/docs/KafkaProducer.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

BIN
doc/static/img/docs/ModbusMaster.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

BIN
doc/static/img/docs/ModbusSlave.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

BIN
doc/static/img/docs/MqttClient.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

BIN
doc/static/img/docs/MqttServer.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Some files were not shown because too many files have changed in this diff Show More