@chvdapi/node-red-dlt645
Version:
a node communicate with DLT645-2007 electric energy meter
143 lines (134 loc) • 7.39 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('PN6400_DLT645',{
category: 'Chvdapi_Port',
color: '#a6bbcf',
defaults: {
name: {value:""},
useSelfAddress: {value: false},
selfDefAddress: {value: ""},
instruction: {value:"energy"},
serialport: {value:"",required:true},
baudRate: {value:"2400"}
},
inputs:1,
outputs:1,
icon: "file.png",
label: function() {
return this.name||"PN6400_DLT645";
},
oneditprepare: function () {
if (this.useSelfAddress) {
$('#node-selfDefAddress').show()
}
else {
$('#node-selfDefAddress').hide()
$('#node-input-useSelfAddress').prop('checked', false)
}
$('#node-input-useSelfAddress').change(function () {
if ($(this).is(':checked')) {
$('#node-selfDefAddress').show()
} else {
$('#node-selfDefAddress').hide()
}
})
$("#node-lookup-serial").click(function() {
$("#node-lookup-serial").addClass('disabled');
$.getJSON('serialports',function(data) {
$("#node-lookup-serial").removeClass('disabled');
var ports = data || [];
$("#node-input-serialport").autocomplete({
source:ports,
minLength:0,
close: function( event, ui ) {
$("#node-input-serialport").autocomplete( "destroy" );
}
}).autocomplete("search","");
});
});
}
});
</script>
<script type="text/html" data-template-name="PN6400_DLT645">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> name</label>
<input type="text" id="node-input-name" placeholder="PN6400_DLT645">
</div>
<div class="form-row">
<label for="node-input-serialport"><i class="fa fa-random"></i> <span data-i18n="serial.label.serialport"></span>serial port</label>
<input type="text" id="node-input-serialport" style="width:66%;" data-i18n="[placeholder]select the serialport">
<a id="node-lookup-serial" class="red-ui-button"><i id="node-lookup-serial-icon" class="fa fa-search"></i></a>
</div>
<div class="form-row" id="node-useSelfAddress">
<label for="node-input-useSelfAddress"><i class="fa fa-tag"></i> unicast</label>
<input type="checkbox" id="node-input-useSelfAddress" style="width:40px">
</div>
<div class="form-row" id="node-selfDefAddress">
<label for="node-input-selfDefAddress"><i class="fa fa-tag"></i> address</label>
<input type="text" id="node-input-selfDefAddress" placeholder="AAAAAAAAAAAA" style="width:180px">
</div>
<div class="form-row">
<label for="node-input-instruction"><i class="fa fa-tag"></i>instruction</label>
<select type="text" id="node-input-instruction" style="width:120px;">
<option value="energy">energy</option>
<option value="current">current</option>
<option value="voltage">voltage</option>
<option value="power">power</option>
<option value="factor">factor</option>
<option value="frequence">frequence</option>
<option value="reactivePower">reactivePower</option>
</select>
</div>
<div class="form-row">
<label for="node-input-baudRate"><i class="fa fa-tag"></i>baudRate</label>
<select type="text" id="node-input-baudRate" style="width:120px;">
<option value="1200">1200</option>
<option value="2400">2400</option>
<option value="4800">4800</option>
<option value="9600">9600</option>
</select>
</div>
</script>
<script type="text/html" data-help-name="PN6400_DLT645">
<p>A node that communicates with DLT645-2007 electric energy meter by ChvdaPi(www.chvda.com).</p>
<p>与支持DLT645-2007的电表通信,由畅维通达提供 @ChvdaPi(www.chvda.com).</p>
<p><strong>
Read energy, current, voltage, active power, factor, frequence or reactive power from energy meter.
</strong></p>
<p><strong>
从电表读取电量、电压、电流、有功功率、功率因数、频率值、无功功率。
</strong></p>
configure: </h4> <p>
<ul> <li>name: Description of the node</li></ul>
<ul> <li>serial port: Select a port from the list </li></ul>
<ul> <li>unicast: Defalut NOT chosen, the instruction will be broadcast to any energy meter on the 485 bus.
Usually adopted when the meter's address is unkown.If chosen, then the communication with the electric energy meter is over a specified address.
Usually adopted when multiple meters are connected on the same 485 bus.</li></ul> </p>
<ul> <li>address:Used when unicast, and must be 12 characters long.</li></ul>
<ul> <li>instruction: Select from voltage,current, energy,power, factor, frequence or reactive power.</li></ul>
<ul> <li>baudRate: Select from 1200,2400,4800,9600bps. When using IRED reader, usually 1200bps should be selected.</li></ul>
配置: </h4> <p>
<ul> <li>名称name: 介绍节点</li></ul>
<ul> <li>串口号serial port: 从下拉列表中选择一个 </li></ul>
<ul> <li>单播unicast: 默认不选中,指令会向485总线的电表广播,适合未知某台电表地址时使用。如果选中,就会使用指定的地址与电表通信。通常是在485总线上有多台电表并联时采用。</li></ul> </p>
<ul> <li>地址address:单播时使用,长度必须是12字符。</li></ul>
<ul> <li>指令instruction: 从电压、电流、电量、有功功率、功率因数、频率值、无功功率中选择一个。</li></ul>
<ul> <li>波特率baudRate: 从 1200,2400,4800,9600bps中选择一个。采用红外读表器时,通常选择1200bps。</li></ul>
Output in JSON : </h4> <p> <p>item : corresponding to what instruction selected.</p>
<ul> <li>energy: the total energy value</li></ul>
<ul> <li>current:the real-time current value </li></ul>
<ul> <li>voltage: the real-time voltage value </li></ul>
<ul> <li>power: the real-time active powervalue </li></ul>
<ul> <li>factor : the real-time factor value </li></ul>
<ul> <li>frequence : the real-time frequence value </li></ul> </p>
<ul> <li>reactive power : the real-time reactive power value </li></ul> </p>
<p> value : read from the energy meter. -1 for error.</p>
以JSON格式输出: </h4> <p> <p>项目 item : 对应前面所选的指令。</p>
<ul> <li>电量energy: 截至目前的总电量</li></ul>
<ul> <li>电流current:当前电流值 </li></ul>
<ul> <li>电压voltage: 当前电压值 </li></ul>
<ul> <li>功率power: 当前有功功率值 </li></ul>
<ul> <li>功率因数factor : 当前功率因数值 </li></ul>
<ul> <li>频率frequence : 当前频率值 </li></ul> </p>
<ul> <li>无功功率reactive power : 当前无功功率值 </li></ul> </p>
<p> 数值value :从电表读得的数值.-1 表示报错。</p>
</script>