@ifp-software/node-red-contrib-oee-ai-connector
Version:
Easily connect your production machines to oee.ai – The Industry 4.0 solution for OEE optimization.
104 lines (102 loc) • 4.22 kB
HTML
<!-- Node configuration -->
<script type="text/javascript">
// Using an extra scope here to avoid collision with names declared inside other
// nodes' directly injected `<script>` elements.
{
let nodeConfig = {
category: "network",
color: "#6cbcef",
defaults: {
name: { value: "" },
interval: {
value: "30",
required: true,
validate: (val) => ["30", "60"].includes(val)
}
},
inputs: 1,
outputs: 6,
icon: "font-awesome/fa-compress",
paletteLabel: "oee.ai SICK TDC Connector",
label: function () {
return this.name || "oee.ai SICK TDC Connector";
},
};
RED.nodes.registerType("oee-ai-sick-tdc-connector", nodeConfig);
}
</script>
<!-- Edit template -->
<script type="text/html" data-template-name="oee-ai-sick-tdc-connector">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"/>
</div>
<div class="form-row">
<label for="node-input-interval"><i class="fa fa-server"></i> Interval</label>
<select id="node-input-interval">
<option value="30">30 seconds</option>
<option value="60">60 seconds</option>
</select>
</div>
</script>
<!-- Help text -->
<script type="text/html" data-help-name="oee-ai-sick-tdc-connector">
<p>Preprocess SICK TDC gateway data for use with the oee.ai connector node.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">string</span></dt>
<dd>
The payload <em>must</em> be a string representing a JSON object. This JSON
object is expected to hold the properties <code>Value</code> and
<code>DioName</code>.
</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>count <span class="property-type">number</span></dt>
<dd>
The value aggregated during the last 30- or 60-second interval for the
corresponding SICK TDC input.
</dd>
<dt>from <span class="property-type">timestamp</span></dt>
<dd>The start of the last aggregation timeframe.</dd>
<dt>to <span class="property-type">timestamp</span></dt>
<dd>The end of the last aggregation timeframe.</dd>
</dl>
<h3>Details</h3>
<p>
This node aggregates received SICK TDC gateway data among 30- or 60-second
intervals (depending on the setting of <em>Interval</em>) and converts it to a
format understood by the oee.ai connector node.
</p>
<p>
The node provides one input expecting SICK TDC digital I/O data as sent by the
gateway device via WebSocket. As such, this node does <em>not</em> take care of
the connection to the gateway itself. Instead, the data sent by the TDC device
must be made available to this node via the <code>msg.payload</code> property.
This can, for example, be accomplished by routing the output of a
<em>WebSocket in</em> node (available on Node-RED by default) to the input of this
node. The WebSocket URL to receive the expected digital I/O data from could look like
this: <code>ws://192.168.0.100:32869/ws/tdce/dio/states</code>. The correct IP
address and port for the WebSocket connection can be obtained from the configuration
of the SICK TDC device. Note that you have to be connected to the device's
network for a WebSocket connection to be established.
</p>
<p>
The node provides four outputs corresponding to the first four digital inputs
provided by a SICK TDC gateway. On each output, a <code>msg</code> object holding the
properties <code>count</code>, <code>from</code> and <code>to</code> (as required
by the oee.ai connector node) is sent every 30 or 60 seconds (depending on this
node's configuration). If no data is received for a specific SICK TDC input
in a 30- or 60-second interval, <code>msg.count</code> is set to 0 for the
according output for that timeframe.
</p>
<h3>References</h3>
<ul>
<li>
<a href="https://gitlab.com/ifp-software/node-red-contrib-oee-ai-connector">
GitLab
</a> – this node's repository
</li>
</ul>
</script>