node-red-nodes/function/PID/pidcontrol.html

57 lines
2.7 KiB
HTML

<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 <code>msg.payload</code> 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 <code>msg.setpoint</code>. 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>