Let rbe node compare to previous input OR output

closes #192 and #193
Also update info and test.
This commit is contained in:
Dave Conway-Jones
2016-03-21 00:01:50 +00:00
parent 2ed8e5a306
commit c3a8a4088d
6 changed files with 52 additions and 8 deletions

View File

@@ -25,7 +25,11 @@
</div>
<div class="form-row" id="node-bandgap">
<label for="node-input-gap">&nbsp;</label>
<input type="text" id="node-input-gap" data-i18n="[placeholder]rbe.placeholder.bandgap" style="width:71%;">
<input type="text" id="node-input-gap" data-i18n="[placeholder]rbe.placeholder.bandgap" style="width:70px;">
<select type="text" id="node-input-inout" style="width:55%;">
<option value="out" data-i18n="rbe.opts.out"></option>
<option value="in" data-i18n="rbe.opts.in"></option>
</select>
</div>
<div class="form-row" id="node-startvalue">
<label for="node-input-start"><i class="fa fa-thumb-tack"/> <span data-i18n="rbe.label.start"></span></label>
@@ -43,11 +47,14 @@
different to the previous one - <b>rbe</b> mode. This works on numbers, strings, and simple objects.</p>
<p>Or it can block until the value changes by a specified amount - <b>deadband</b> mode.</p>
<p>In deadband mode the incoming payload must contain a parseable <i>number</i> and is
output only if greater than + or - the <i>band gap</i> away from the previous output.</p>
output only if greater than + or - the <i>band gap</i> away from a previous value.</p>
<p>Deadband also supports % - only sends if the input differs by more than x% of the original value.</p>
<p>It can also ignore outlier values - <b>narrowband</b> mode.</p>
<p>In narrowband mode the incoming payload is blocked if it is more than + or - the band gap
away from the previous value. Useful for ignoring outliers from a faulty sensor for example.</p>
<p>Both Deadband and Narrowband allow comparison against either the <i>previous valid output value</i>, thus
ignoring any values out of range; or the <i>previous input value</i>, which resets the set point, thus allowing
gradual drift (deadband), or a step change (narrowband).</p>
<p><b>Note:</b> This works on a per <code>msg.topic</code> basis. This means that a single rbe node can
handle multiple topics at the same time.</p>
</script>
@@ -60,7 +67,8 @@
name: {value:""},
func: {value:"rbe"},
gap: {value:"",validate:RED.validators.regex(/^(\d*[.]*\d*|)(%|)$/)},
start: {value:""}
start: {value:""},
inout: {value:"out"}
},
inputs:1,
outputs:1,
@@ -73,6 +81,9 @@
},
oneditprepare: function() {
//$( "#node-input-gap" ).spinner({min:0});
if ($("#node-input-inout").val() === null) {
$("#node-input-inout").val("out");
}
$("#node-input-func").on("change",function() {
if ($("#node-input-func").val() === "rbe") {
$("#node-bandgap").hide();