node-red-contrib-self-healing
Version:
SHEN: Self-healing extensions for Node-RED.
92 lines (89 loc) • 2.87 kB
HTML
<script type="text/javascript">
RED.nodes.registerType("kalman-noise-filter", {
category: "SHEN",
color: "#74b9ff",
defaults: {
r: { value: 0.01, required: true, validate: RED.validators.number() },
q: { value: 3, required: true, validate: RED.validators.number() },
},
inputs: 1,
outputs: 1,
icon: "status.svg",
label: function () {
return this.name || "kalman-filter";
},
});
</script>
<script type="text/html" data-template-name="kalman-noise-filter">
<div class="form-row">
<label for="node-input-r">
<i class="icon-tag"></i> R (Process Noise)
</label>
<input type="text" id="node-input-r" placeholder="0.01" />
</div>
<div class="form-row">
<label for="node-input-q">
<i class="icon-tag"></i> Q (Measurement Noise)
</label>
<input type="text" id="node-input-q" placeholder="3" />
</div>
</script>
<script type="text/html" data-help-name="kalman-noise-filter">
<p>Apply a Kalman Noise Filter to numerical message payloads</p>
<p>
It uses previous and current measurements and statistics to predict the next
value.
</p>
<p>
It assumes that the data is mostly constant, and that the noise is Gaussian.
</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>
payload <span class="property-type">number | array<number></span>
</dt>
<dd>the data you want to filter</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>
payload <span class="property-type">number | array<number></span>
</dt>
<dd>filtered data</dd>
</dl>
<h3>Details</h3>
<p>
This node takes the inputs given to it either as a number or an array of
numbers and runs them through a thing called a Kalman filter. It is a
statistical predictor that is used to reduce the effect of random noise on
measurements.
</p>
<p>
It is assumed that the system is unidimensional, in a more or less constant
state, and subjected to both internal noise and measurement noise (both
gaussian). Therefore it is configurable in two parameters:
</p>
<ul>
<li>
Process Noise (R): noise that is internal to the system. e.g. human body
temperature, it might not be exactly 37C all the time, but a bit above or
below it.
</li>
<li>Measurement Noise (Q): the noise introduced by the measurement.</li>
</ul>
<p>
The node itself functions in a simple way. It is initialized with its own
filter, and sequentially runs the successive values through it, returning
the estimations.
</p>
<h3>References</h3>
<ul>
<li>
<a href="https://en.wikipedia.org/wiki/Kalman_filter">Kalman filter</a> on
Wikipedia
</li>
<li>
<a href="https://github.com/wouterbulten/kalmanjs">Implementation used</a>
</li>
</ul>
</script>