-
-
Notifications
You must be signed in to change notification settings - Fork 105
/
modbus-server.html
131 lines (122 loc) · 5.6 KB
/
modbus-server.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<!--
Copyright (c) since the year 2016 Klaus Landsdorf (http://plus4nodered.com/)
All rights reserved.
node-red-contrib-modbus - The BSD 3-Clause License
@author <a href="mailto:klaus.landsdorf@bianco-royal.de">Klaus Landsdorf</a> (Bianco Royal)
-->
<script type="text/javascript">
RED.nodes.registerType('modbus-server', {
category: 'modbus',
color: '#E9967A',
defaults: {
name: {value: ''},
logEnabled: {value: false},
hostname: {value: '0.0.0.0'},
serverPort: {value: 10502, required: true, validate: RED.validators.number()},
responseDelay: {value: 100, required: true, validate: RED.validators.number()},
delayUnit: {
value: 'ms', required: true, validate: function (v) {
return 'ms' == v || 's' == v || 'm' == v || 'h' == v
}
},
coilsBufferSize: {value: 10000, validate: RED.validators.number()},
holdingBufferSize: {value: 10000, validate: RED.validators.number()},
inputBufferSize: {value: 10000, validate: RED.validators.number()},
discreteBufferSize: {value: 10000, validate: RED.validators.number()},
showErrors: {value: false}
},
inputs: 1,
outputs: 5,
align: "right",
icon: 'modbus.png',
paletteLabel: 'Modbus-Server',
label: function () {
return this.name || 'Modbus Server'
}
})
</script>
<script type="text/x-red" data-template-name="modbus-server">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-hostname"><i class="icon-tag"></i> <span data-i18n="modbus-contrib.label.hostname"></span></label>
<input type="text" id="node-input-hostname" placeholder="0.0.0.0 (IPv4) or :: (IPv6)">
</div>
<div class="form-row">
<label for="node-input-serverPort"><i class="icon-tag"></i> <span data-i18n="modbus-contrib.label.port"></span></label>
<input type="text" id="node-input-serverPort" placeholder="2000 to 65536">
</div>
<!-- <div class="form-row">
<label for="node-input-responseDelay"><i class="icon-tag"></i> <span data-i18n="modbus-contrib.label.responseDelay"></span></label>
<input type="text" id="node-input-responseDelay" placeholder="100" style="max-width:120px">
<select id="node-input-delayUnit" style="max-width:160px">
<option value="ms">millisecond(s)</option>
<option value="s">second(s)</option>
<option value="m">minute(s)</option>
<option value="h">hour(s)</option>
</select>
</div> -->
<div class="form-row">
<label for="node-input-coilsBufferSize"><i class="icon-tag"></i> <span data-i18n="modbus-contrib.label.coils"></span></label>
<input type="text" id="node-input-coilsBufferSize" placeholder="1024">
</div>
<div class="form-row">
<label for="node-input-holdingBufferSize"><i class="icon-tag"></i> <span data-i18n="modbus-contrib.label.holdings"></span></label>
<input type="text" id="node-input-holdingBufferSize" placeholder="1024">
</div>
<div class="form-row">
<label for="node-input-inputBufferSize"><i class="icon-tag"></i> <span data-i18n="modbus-contrib.label.inputs"></span></label>
<input type="text" id="node-input-inputBufferSize" placeholder="1024">
</div>
<div class="form-row">
<label for="node-input-discreteBufferSize"><i class="icon-tag"></i> <span data-i18n="modbus-contrib.label.discretes"></span></label>
<input type="text" id="node-input-discreteBufferSize" placeholder="1024">
</div>
<hr>
<div class="form-row">
<label style="min-width:190px" for="node-input-showErrors"><i class="fa fa-th"></i> <span
data-i18n="modbus-contrib.label.showErrors"></span></label>
<input type="checkbox" id="node-input-showErrors" style="max-width:30px">
</div>
<div class="form-row">
<label style="min-width:190px" for="node-input-logEnabled"><i class="fa fa-th"></i> <span data-i18n="modbus-contrib.label.logEnabled"></span></label>
<input type="checkbox" id="node-input-logEnabled" style="max-width:30px">
</div>
</script>
<script type="text/x-red" data-help-name="modbus-server">
<p>Node to provide a Modbus TCP server based on node-modbus (jsmodbus) for testing.</p>
<p>On injecting the server sends the Buffers to the separate outputs</p>
<p>You can use the Modbus write nodes (FC) to write data to the server buffers.</p>
<p>You can use the Modbus read nodes (FC) to read data from the server buffers.</p>
<p>Output 1: holding Buffer, type, msg</p>
<p>Output 2: coils Buffer, type, msg</p>
<p>Output 3: input Buffer, type, msg</p>
<p>Output 4: discrete Buffer, type, msg</p>
<br>
<p>Input:
On injecting a special payload, you can write directly to any register.
This should only be used if you want to simulate a Modbus client.
<code>
msg.payload = {
'value': msg.payload,
'register': 'holding',
'address': 1 ,
'disableMsgOutput' : 0
};
return msg;
</code>
</p>
<p>The value could also be a list of UInt8 numbers and they will be written to the buffer.</p>
<p>
Valid registers are:
<ul>
<li>holding
<li>coils
<li>input
<li>discrete
</ul>
Set disableMsgOutput if you want to disable the Server outputs when injecting.
</p>
</script>