Skip to content

1. 传感器简介

模型清单

可使用下列名称或 ID 在 ThinkLink 中搜索对应模型。

模型类型名称id_name平台模型 ID
RPC[CZ580 GET] paracz580_get_2210698886806983938053
RPC[CZ580 SET] paracz580_set_22106103495861979320325
TemplateCZ58098890586718736390
Thing Model[CZ580]cz580_2210698662809595809797
Thing Model[CZ-22106-CZ580资产] 区域聚合cz580_asset_22106119677174411063305
Parameter Thing Model[CZ580-PARA]cz580_para_22106103496386170851335

CZ580 是上海传振电子科技有限公司生产的一款 转速变送器,基于激光感应反光条原理进行非接触式转速测量,可输出 4-20mARS485(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进制)项目描述数据类型说明
0IN1 转速值UShort经过感应点数、倍率值处理后的转速
1IN1 显示小数位UShort只读,写无效
5~6IN1 转速值ULong未处理转速 = 输入频率 × 60
100IN1 测量速度选择UShort0:高速,1:中速,2:低速
101IN1 显示小数位UShort范围 0~3
102IN1 每转感应点数UShort范围 1~9999
103IN1 倍率小数位UShort范围 0~6
104IN1 倍率值UShort范围 1~65535
2048~2049IN1 转速值float处理后的转速值
2052~2053IN1 转速值float未处理转速值 = 输入频率 × 60
7166通信参数允许修改寄存器Short写入 0xCCAA 使能修改通信参数
7167RS485 地址Short范围 1~247
7168RS485 波特率Short0~6,对应 2400~115200
7169RS485 数据格式Short范围 0~3

支持的 Modbus 功能码:

  • 03H、04H:读参数
  • 06H、10H:修改参数

6. EdgeBus 模型

6.1 EB 配置参数

主要配置参数如下:

  • name: "CZ580"
  • port: 22
  • version: "0x86"
  • dataType: "0x06"
  • upPeriodIndex: 70
  • Modbus 默认串口参数:
    • BaudRate: 9600
    • StopBits: 1
    • DataBits: 8
    • Checkbit: NONE
  • BzType: 22106
  • BzVersion: 11
  • SwVersion: 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~20492052~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 6ratio,uint16BE
  • index 8INI1Speed1,floatBE
  • index 12INI1RawSpeed1,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_38pwron_delaypwron_delaymsuint16le上电延时
app_70period_upperiod_upsuint32LE上传周期
app_74period_readperiod_readsuint32LE采集周期
app_110cov_INI1Speed1cov_INI1Speed1floatBE转速变化阈值
app_150addr_modbusaddr_modbusuint8Modbus 地址

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 转速采集


补充说明

  1. 厂家默认 Modbus 参数为:
    • 地址:1
    • 波特率:9600
    • 数据位:8
    • 校验:无校验
      这些参数可通过上位机工具修改。
  2. 若需要修改 RS485 通信参数,需先向寄存器 7166 写入 0xCCAA 使能,再写入地址、波特率、数据格式等参数。
  3. 厂家文档给出了 Modbus 报文示例:
    • 读转速:01 03 00 00 00 01 84 0A
    • 写每圈感应点数:01 10 00 66 00 01 02 00 0C AF 93