1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00
node-red-nodes/function/PID/pidcontrol.html
2015-04-23 14:31:08 +01:00

72 lines
3.3 KiB
HTML

<!--
Copyright 2015 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="PID control">
<div class="form-row">
<label for="node-input-target" style="width:120px;"><i class="fa fa-dot-circle-o"></i> Set Point</label>
<input type="text" id="node-input-target" placeholder="target value" style="width:60%;">
</div>
<div class="form-row">
<label for="node-input-kp" style="width:120px;"><font size=+1>K<sub>proportional</sub></font></label>
<input type="text" id="node-input-kp" placeholder="proportional gain constant - Kp" style="width:60%;">
</div>
<div class="form-row">
<label for="node-input-ki" style="width:120px;"><font size=+1>K<sub>integral</sub></font></label>
<input type="text" id="node-input-ki" placeholder="integral gain constant - Ki" style="width:60%;">
</div>
<div class="form-row">
<label for="node-input-kd" style="width:120px;"><font size=+1>K<sub>differential</sub></font></label>
<input type="text" id="node-input-kd" placeholder="differential gain constant - Kd" style="width:60%;">
</div>
<div class="form-row">
<label for="node-input-name" style="width:120px;"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name" style="width:60%;">
</div>
<div class="form-tips"><b>Tip:</b> This node ONLY works on numbers<br>
The damping factors are typically in the range 0 - 1.<br></div>
</script>
<script type="text/x-red" data-help-name="PID control">
<p>A PID controller node.</p>
<p>This node ONLY expects a numeric <b>msg.payload</b> containing the current reading.
It will output the correction that needs to be applied in order to move to the preset <i>set point</i> value.</p>
<p>See <a href="https://en.wikipedia.org/wiki/PID_controller" target="_new">Wikipedia</a> for more details.</p>
<p>The <i>set point</i> may be overridden by <b>msg.setpoint</b>. If you do so the edit box value can be used as the initial value.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('PID control',{
color:"#d6ba48",
category: 'function',
defaults: {
name: {value:""},
target: {value:"",validate:RED.validators.regex(/^(\d*|)$/)},
kp: {value:"",required:true,validate:RED.validators.number()},
ki: {value:"",required:true,validate:RED.validators.number()},
kd: {value:"",required:true,validate:RED.validators.number()}
},
inputs:1,
outputs:1,
icon: "function.png",
label: function() {
return this.name||"PID";
},
labelStyle: function() {
return this.name?"node_label_italic":"";
}
});
</script>