mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
49 lines
2.2 KiB
HTML
49 lines
2.2 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/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>
|