1. 传感器简介
模型清单
可使用下列名称或 ID 在 ThinkLink 中搜索对应模型。
| 模型类型 | 名称 | id_name | 平台模型 ID |
|---|---|---|---|
| RPC | [CZ580 GET] para | cz580_get_22106 | 98886806983938053 |
| RPC | [CZ580 SET] para | cz580_set_22106 | 103495861979320325 |
| Template | CZ580 | 98890586718736390 | |
| Thing Model | [CZ580] | cz580_22106 | 98662809595809797 |
| Thing Model | [CZ-22106-CZ580资产] 区域聚合 | cz580_asset_22106 | 119677174411063305 |
| Parameter Thing Model | [CZ580-PARA] | cz580_para_22106 | 103496386170851335 |
CZ580 是上海传振电子科技有限公司生产的一款 转速变送器,基于激光感应反光条原理进行非接触式转速测量,可输出 4-20mA 或 RS485(Modbus-RTU) 信号,适用于各类旋转机械的转速检测。设备测量范围为 0~10000 转/分,适合低转速场景,也可用于零转速检测。
本次对接方案中,设备型号为 CZ580,业务代码为 22106,模板名称为 CZ580。
2. 产品特点
根据厂家资料,CZ580 具备以下特点:
- 输出信号强
- 抗干扰能力强
- 非接触测量
- 工作范围宽,可测低转速
- 可在烟雾、油气、水雾等恶劣环境中使用
3. 适用范围
CZ580 可广泛应用于以下场景:
- 电力行业大型旋转机械转速测量
- 冶金行业旋转设备转速监控
- 石化行业压缩机、电机、风机、泵等设备测速
- 造纸行业大型旋转机械测速
- 工件加工转速监控
- 钢管涂装转速监控
- 齿轮转速测量
4. 采集器信息
4.1 硬件信息
本方案采集设备采用 KC21。
- 设备型号:KC21
- 接口:RS-485
- 供电方式:220V/12V 供电
4.2 接线信息
电源与通讯接口
CZ580 的 RS485 输出接线定义如下:
- 红线:9-30Vdc
- 绿色:GND
- 黄线:RS485-A
- 蓝线:RS485-B
传感器接口
本方案中,CZ580 自带 RS485 输出接口,直接接入 KC21 的 RS485 接口即可。
传感器本体供电范围为 9-30Vdc。
5. 数据采集
本方案中,通过 Modbus 读取以下寄存器:
- 102:每转感应点数
- 2048~2049:处理后的转速值,float,高位在前
- 2052~2053:未处理转速值,float,高位在前
其中,平台侧约定:
- 上传周期参数地址:70
- 采集周期参数地址:74
并要求 采集周期小于上传周期。
5.1 寄存器定义
根据厂家 Modbus 寄存器表,主要寄存器定义如下:
| 地址(10进制) | 项目描述 | 数据类型 | 说明 |
|---|---|---|---|
| 0 | IN1 转速值 | UShort | 经过感应点数、倍率值处理后的转速 |
| 1 | IN1 显示小数位 | UShort | 只读,写无效 |
| 5~6 | IN1 转速值 | ULong | 未处理转速 = 输入频率 × 60 |
| 100 | IN1 测量速度选择 | UShort | 0:高速,1:中速,2:低速 |
| 101 | IN1 显示小数位 | UShort | 范围 0~3 |
| 102 | IN1 每转感应点数 | UShort | 范围 1~9999 |
| 103 | IN1 倍率小数位 | UShort | 范围 0~6 |
| 104 | IN1 倍率值 | UShort | 范围 1~65535 |
| 2048~2049 | IN1 转速值 | float | 处理后的转速值 |
| 2052~2053 | IN1 转速值 | float | 未处理转速值 = 输入频率 × 60 |
| 7166 | 通信参数允许修改寄存器 | Short | 写入 0xCCAA 使能修改通信参数 |
| 7167 | RS485 地址 | Short | 范围 1~247 |
| 7168 | RS485 波特率 | Short | 0~6,对应 2400~115200 |
| 7169 | RS485 数据格式 | Short | 范围 0~3 |
支持的 Modbus 功能码:
- 03H、04H:读参数
- 06H、10H:修改参数
6. EdgeBus 模型
6.1 EB 配置参数
主要配置参数如下:
name: "CZ580"port: 22version: "0x86"dataType: "0x06"upPeriodIndex: 70- Modbus 默认串口参数:
BaudRate: 9600StopBits: 1DataBits: 8Checkbit: NONE
BzType: 22106BzVersion: 11SwVersion: 31
6.2 EB 代码
typescript
import {Buffer} from "buffer";
import {buildOtaFile} from "@EBSDK/run";
import {LoraUpEvent} from "@EBSDK/EBCompiler/all_variable";
import {EBModel} from "@EBSDK/EBCompiler/EBModel/EBModel";
import {EventInfoItem} from "@EBSDK/EBCompiler/plugins/EBHelper";
import type {UserConfUPItem} from "@EBSDK/EBCompiler/plugins/EBHelper";
import {CheckbitEnum, getOtaConfig, HwTypeEnum} from "@EBSDK/otaConfig";
////////////////////////////////////////////////////////////////////////////////////////
const eventInfo:UserConfUPItem[]=[
{
name:"CZ580",port:22, version:"0x86",dataType:"0x06",upPeriodIndex:70,
quInfo:[
{
protocol:"modbus",code:"0x03", periodIndex:74,//addr:"0x01",
indexAPP:150, indexCMD:0, copySize:1,isLast:false,//period:"900s",payIndex:3,ackAddrIndex:0,
listVal:[
{ start: "102", end: "102"},
]
},
{
protocol:"modbus",code:"0x03", periodIndex:74,//addr:"0x01",
indexAPP:150, indexCMD:0, copySize:1,isLast:false,//period:"900s",payIndex:3,ackAddrIndex:0,
listVal:[
{ start: "2048", end: "2049",covType:"FloatBE",covAppIndex:110}, //
{ start: "2052", end: "2053" ,covType:"FloatBE",covAppIndex:114}
]
}
]
}
]
let otaConfig = getOtaConfig({
SwVersion:31,
BaudRate: 9600,
StopBits: 1,
DataBits: 8,
Checkbit: CheckbitEnum.NONE,
Battery: true,
ConfirmDuty: 60,
BzType: 22106,
BzVersion: 11
})
const MODBUS_TT = (ebModel: EBModel) => {
for (let i=0; i<eventInfo.length; i++){
let event=new EventInfoItem(eventInfo[i]);
event.upEventSetup()
event.eventInstall()
}
return JSON.stringify(ebModel, null, 2)
}
buildOtaFile(import.meta.url, otaConfig, MODBUS_TT)6.3 说明
当前 EB 逻辑说明:
- EdgeBus 通过 Port 22 上报业务数据。
- 先读取寄存器 102,获取“每转感应点数”。
- 再读取寄存器 2048~2049 和 2052~2053,分别获取“处理后的转速值”和“未处理原始转速值”。
- 上传周期与采集周期分离:
70为上报周期74为采集周期
- Modbus 地址由 APP 参数中的
150管理。 - 浮点寄存器采用 FloatBE / IEEE754 高位在前。
7. 物模型
7.1 物模型基本信息
数据物模型
- 名称:
[CZ580] - id Name:
cz580_22106
参数物模型
- 名称:
[CZ580-PARA] - id Name:
cz580_para_22106
7.2 上行帧结构
数据上行帧结构如下:
typescript
let frameInfo={
port:22, dataLen:16,rssi:true,battery:4,
tagList:[{ index:0, tag:0x86 }, { index:1, tag:0x06 }]
}字段定义如下:
index 6:ratio,uint16BEindex 8:INI1Speed1,floatBEindex 12:INI1RawSpeed1,floatBE
7.3 物模型脚本
7.3.1 数据物模型脚本
typescript
let port=msg?.userdata?.port || null;
if(port!=22) return null
let frameInfo={
port:22, dataLen:16,rssi:true,battery:4,
tagList:[{ index:0, tag:0x86 }, { index:1, tag:0x06 }]
}
let appInfo = [
{ name: "ratio", field_name: "ratio", unit:"", index: 6, type: "uint16BE",decimal:1},
{ name: "INI1Speed1", field_name: "INI1Speed1", unit:"", index: 8, type: "floatBE",decimal:1},
{ name: "INI1RawSpeed1", field_name: "INI1RawSpeed1", unit:"", index: 12, type: "floatBE",decimal:1},
]
let payParser=new PayloadParser({
device:device,
msg:msg,
frameInfo:frameInfo,
appInfo:appInfo,
})
let tdata= payParser.telemetry()
return {
telemetry_data: tdata,
server_attrs: null,
shared_attrs: null
}7.3.2 参数物模型脚本
typescript
let port=msg?.userdata?.port || null;
const rpcName="cz580_set_para_22106"
let paraInfo= {
app_38: { name: "pwron_delay", field_name: "pwron_delay", unit: "ms", index: 38, type: "uint16le" },
app_70: {name: "period_up", field_name: "period_up", unit: "s", type: "uint32LE"},
app_74: {name: "period_read", field_name: "period_read", unit: "s", type: "uint32LE"},
app_110: {name: "cov_INI1Speed1", field_name: "cov_INI1Speed1", unit: "", type: "floatBE",decimal:1},
app_150: {name: "addr_modbus", field_name: "addr_modbus", unit: "", type: "uint8"}
}
if (port!==214) {
let checkData=Utils.paraCheck(rpcName,device.server_attrs,device.shared_attrs)
return {
server_attrs: checkData.sdata,
action:checkData.action,
}
}
let pdata=(new PayloadParser({
device:device,
msg:msg,
paraInfo:paraDef,
})).paras()
let checkData= Utils.paraCheck(rpcName,pdata)
return {
telemetry_data: pdata,
server_attrs: checkData.sdata,
shared_attrs: pdata,
action: checkData.action,
}8. 第三方平台数据订阅
8.1 MQTT Topic
/v32/{Organization Account}/tkl/up/telemetry/{eui}
8.2 上报示例数据
根据本模板的物模型字段,整理后的示例数据如下:
json
{
"eui": "6353012af10a9331",
"active_time": "2026-02-05T08:35:48.000Z",
"thingModelId": "22106",
"thingModelIdName": "cz580_22106",
"telemetry_data": {
"snr": 13.5,
"rssi": -51,
"battery": 3.37,
"ratio": 1,
"INI1Speed1": 3000.0,
"INI1RawSpeed1": 3000.0
}
}说明:
thingModelId实际应以平台生成值为准,这里用业务代码22106作示例。thingModelIdName对应数据物模型cz580_22106。ratio对应设备采集的每转感应点相关参数。INI1Speed1为处理后的转速值。INI1RawSpeed1为未处理原始转速值。
9. RPC
9.1 RPC 名称
配置参数 RPC
- 名称:
[CZ580 SET] para - id Name:
cz580_set_para_22106
读取参数 RPC
- 名称:
[CZ580 GET] para - id Name:
cz580_get_22106
9.2 参数定义
| 参数地址 | 名称 | field_name | 单位 | 类型 | 说明 |
|---|---|---|---|---|---|
| app_38 | pwron_delay | pwron_delay | ms | uint16le | 上电延时 |
| app_70 | period_up | period_up | s | uint32LE | 上传周期 |
| app_74 | period_read | period_read | s | uint32LE | 采集周期 |
| app_110 | cov_INI1Speed1 | cov_INI1Speed1 | floatBE | 转速变化阈值 | |
| app_150 | addr_modbus | addr_modbus | uint8 | Modbus 地址 |
9.3 RPC 代码
配置参数 RPC
typescript
let classMode = (device && device.shared_attrs && device.shared_attrs.class_mode) || "ClassA";
let intervalms = classMode === "ClassA" ? 0 : 2000;
const rpcName="cz580_22106_set"
let paraDef= {
app_38: { name: "pwron_delay", field_name: "pwron_delay", unit: "ms", index: 38, type: "uint16le" },
app_70: {name: "period_up", field_name: "period_up", unit: "s", type: "uint32LE"},
app_74: {name: "period_read", field_name: "period_read", unit: "s", type: "uint32LE"},
app_110: {name: "cov_INI1Speed1", field_name: "cov_INI1Speed1", unit: "", type: "floatBE",decimal:1},
app_150: {name: "addr_modbus", field_name: "addr_modbus", unit: "", type: "uint8"}
}
let frames=RPCHelper.buildFrame({
paraDef:paraDef,
params:params});
let redoBuffer=RPCHelper.redo()
let dnBuffer=Buffer.alloc(frames.writeBuffer.length+frames.readBuffer.length);
frames.writeBuffer.copy(dnBuffer,0)
frames.readBuffer.copy(dnBuffer,frames.writeBuffer.length)
logger.info("set para")
let msgQue=Utils.makeParaSetMSG({
device:device,
classMode:classMode,
rpcName:rpcName,
params:params,
paraDownBuffer:dnBuffer,
extraAppBuffer:redoBuffer
})
if (msgQue.length==0) return null
return msgQue读取参数 RPC
typescript
let classMode = (device && device.shared_attrs && device.shared_attrs.class_mode) || "ClassA";
let sleepMs = classMode === "ClassA" ? 500 : 5000;
let paraDef= {
app_38: { name: "pwron_delay", field_name: "pwron_delay", unit: "ms", index: 38, type: "uint16le" },
app_70: {name: "periodUP", field_name: "periodUP", unit: "s", type: "uint32LE"},
app_74: {name: "periodRead", field_name: "periodRead", unit: "s", type: "uint32LE"},
app_110: {name: "cov_INI1Speed1", field_name: "cov_INI1Speed1", unit: "℃", type: "floatBE",decimal:1},
app_150: {name: "addr", field_name: "addr", unit: "", type: "uint8"},
}
let frames=RPCHelper.buildFrame({
paraDef:paraDef,
params:params});
let msg=RPCHelper.makeMSG({
msgType:Utils.msgType.paras,
device:device,
dnBuffer:frames.readBuffer,
sleepTime:sleepMs,
})
return [msg]10. 模板选择
在 ThinkLink 平台中搜索模板:
CZ580
或按业务类型查找:
22106 / 转速变送器 / RS485 Modbus 转速采集
补充说明
- 厂家默认 Modbus 参数为:
- 地址:1
- 波特率:9600
- 数据位:8
- 校验:无校验
这些参数可通过上位机工具修改。
- 若需要修改 RS485 通信参数,需先向寄存器 7166 写入
0xCCAA使能,再写入地址、波特率、数据格式等参数。 - 厂家文档给出了 Modbus 报文示例:
- 读转速:
01 03 00 00 00 01 84 0A - 写每圈感应点数:
01 10 00 66 00 01 02 00 0C AF 93
- 读转速: