-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpid.html
104 lines (100 loc) · 4.82 KB
/
pid.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
<!--
Copyright 2016 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="PIDLoop">
<div class="form-row">
<label for="node-input-Kp"><i class="fa fa-tasks"></i> Gain</label>
<input type="text" id="node-input-Kp" placeholder="Kp">
</div>
<div class="form-row">
<label for="node-input-Ki"><i class="fa fa-tasks"></i> Ti</label>
<input type="text" id="node-input-Ki" placeholder="Ki">
</div>
<div class="form-row">
<label for="node-input-deadBand"><i class="fa fa-tasks"></i> Dead Band ±</label>
<input type="text" id="node-input-deadBand" placeholder="1">
</div>
<div class="form-row">
<label for="node-input-recalcTime"><i class="fa fa-tasks"></i> Recalculation time</label>
<input type="text" id="node-input-recalcTime" placeholder="5">
</div>
<div class="form-row">
<label for="node-input-setPointTopic"><i class="fa fa-tasks"></i> Setpoint Topic</label>
<input type="text" id="node-input-setPointTopic" placeholder="thermostat/1">
</div>
<div class="form-row">
<label for="node-input-fireTopic"><i class="fa fa-tasks"></i> Fire Topic</label>
<input type="text" id="node-input-fireTopic" placeholder="fire/1">
</div>
<div class="form-row">
<label for="node-input-fixedTopic"><i class="fa fa-tasks"></i> Fixed Topic</label>
<input type="text" id="node-input-fixedTopic" placeholder="fixed/1">
</div>
<div class="form-row">
<label for="node-input-fixedValue"><i class="fa fa-tasks"></i> Fixed Value</label>
<input type="text" id="node-input-fixedValue" placeholder="1">
</div>
<div class="form-row">
<label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label>
<input type="text" id="node-input-topic" placeholder="Topic">
</div>
<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="Name">
</div>
</script>
<script type="text/x-red" data-help-name="PIDLoop">
<p>A PID control loop node.</p>
<p>The first output is to the heating element, the second is for the
cooling element.</p>
<p>The node accepts 4 types of input disinguished by the <i>msg.topic</i></p>
<ul>
<li>Set Point - when a message has a topic matching the <i>Set Point Topic</i>
in the configuration, it's payload will be taken as the new set point. This
expects the payload to be a floating point number</li>
<li>Fire - when a message has a topic matching the <i>Fire Topic</i>
in the configuration, it's payload should be false/true or 0/1. When a false/0
value is passed this will cause the node to output 0 values to both hot &
cold outputs and then block all further outputs until a true/1 value is received
on the with the <i>Fire Topic</i>. If the Fire state remains false for more than
15mins then all internal state (apart from the set point) will be cleared.</li>
<li>Fixed - Messages sent with the <i>Fixed Topic</i> are interpreted in 2 ways.
If the payload is a number then this value will be used to set fixed value. If
payload is a boolen then this will be used to enable or disable fixed mode.
</li>
<li>All other messages will be interpreted as temperature input values and
expect the msg.payload to be a floating point temperature value.</li>
</ul>
</script>
<script type="text/javascript">
RED.nodes.registerType('PIDLoop',{
category:"Control_Loop",
defaults: {
Kp: {value: 1, required: true, validate: RED.validators.number()},
Ki: {value: 1, required: true, validate: RED.validators.number()},
Kd: {value: 1, required: true, validate: RED.validators.number()},
recalcTime: {value: 5, required: true, validate: RED.validators.number()},
setPointTopic: {value: "thermostat/1", required: true},
fireTopic: {value: "fire/1", required: true},
fixedTopic: {value: "fixed/1", required: true},
fixedValue: {value: 0, required: true, validate: RED.validators.number()},
deadBand: {value: 1, required: true, validate: RED.validators.number()}
},
color: "#2F7ACD",
inputs: 1,
outputs: 2,
icon: 'default',
label: function() { // sets the default label contents
return this.name||"PIDLoop";
}
});
</script>