dlt645
v1.0.1
Published
dlt645响应解析
Downloads
14
Readme
dlt645协议响应解析
Usage
ES Module
import DLT645 from 'dlt645'
let result=DLT645('68 60 64 02 09 22 04 68 91 0a 33 32 34 35 47 56 33 33 33 33 97 16')
// {
// data: ['68','60','64','02','09','22','04','68','91','0a','33','33','33','33','56','47','97','16'],
// id: ['04', '22', '09', '02', '64', '60'],
// no: '0422-09026460',
// valid: true,
// fulfill: true,
// req_success: true,
// len: 10,
// ctrl_bcd: '10010001',
// type: '读数据应答帧',
// res_desc: '电压数据块(V)',
// res_val: 231.4,
// }
//字符串转数组
DLT645.parseArray('68910a333234')//['68', '91', '0a', '33', '32', '34']
//16进制相加
DLT645.sum_hex(['68', '91', '0a', '33', '32', '34'])//412
Browser
<script src="./node_modules/dlt645/index.js">
DLT645('68 60 64 02 09 22 04 68 91 0a 33 32 34 35 47 56 33 33 33 33 97 16')
可解析的数据类型
'00000000': '(当前)组合有功总电能'
'00010000': '(当前)正向有功总电能'
'00020000': '(当前)反向有功总电能'
'00030000': '(当前)组合无功1总电能'
'00040000': '(当前)组合无功2总电能'
'00050000': '(当前)第一象限无功总电能'
'00060000': '(当前)第二象限无功总电能'
'00070000': '(当前)第三象限无功总电能'
'00080000': '(当前)第四象限无功总电能'
'02010100': 'A相电压'
'02010200': 'B相电压'
'02010300': 'C相电压'
'0201ff00': '电压数据块'
'02020100': 'A相电流'
'02020200': 'B相电流'
'02020300': 'C相电流'
'0202ff00': '电流数据块'
'02030000': '瞬时有功功率'
'02030100': '瞬时A相有功功率'
'02030200': '瞬时B相有功功率'
'02030300': '瞬时C相有功功率'
'02040000': '瞬时无功功率'
'02040100': '瞬时A相总无功功率'
'02040200': '瞬时B相总无功功率'
'02040300': '瞬时C相总无功功率'
'02050000': '瞬时视在功率'
'02050100': 'A相视在功率'
'02050200': 'B相视在功率'
'02050300': 'C相视在功率'
'02060000': '总功率因数'
'02060100': 'A相功率因数'
'02060200': 'B相功率因数'
'02060300': 'C相功率因数'