2015-04-23 15:31:08 +02:00
|
|
|
|
2021-03-13 15:25:45 +01:00
|
|
|
<script type="text/html" data-template-name="PID control">
|
2015-04-23 15:31:08 +02:00
|
|
|
<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>
|