📋 サンプルフロー(クリックで展開)
参照元:NodeREDエディター内サンプルフロー
[
{
"id": "1780d8815c9004cf",
"type": "tab",
"label": "filter",
"disabled": false,
"info": "",
"env": []
},
{
"id": "9573fa4b057fe7b2",
"type": "comment",
"z": "1780d8815c9004cf",
"name": "1 Report all changes",
"info": "フィルタノードに3つのメッセージ(1、2、2)が送信された場合、最初のメッセージ(1と2)はそれぞれ順に通過します。最後のメッセージ(2)は、前回のメッセージ送信以降に変更が確認されなかったため、フィルタリングされます。",
"x": 210,
"y": 80,
"wires": []
},
{
"id": "5adf6b757e2a7bb2",
"type": "rbe",
"z": "1780d8815c9004cf",
"name": "Only report changes",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"septopics": true,
"property": "payload",
"topi": "topic",
"x": 500,
"y": 140,
"wires": [["6682a9e8826ad09b"]]
},
{
"id": "f60dc26f8d634312",
"type": "inject",
"z": "1780d8815c9004cf",
"name": "[1,2,2]",
"props": [{"p": "payload"}],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[1,2,2]",
"payloadType": "json",
"x": 210,
"y": 140,
"wires": [["5b2b61bb112b23e7"]]
},
{
"id": "6682a9e8826ad09b",
"type": "debug",
"z": "1780d8815c9004cf",
"name": "Print changes",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 700,
"y": 140,
"wires": []
},
{
"id": "5b2b61bb112b23e7",
"type": "split",
"z": "1780d8815c9004cf",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 330,
"y": 140,
"wires": [["5adf6b757e2a7bb2"]]
},
{
"id": "79e041e499ad21e9",
"type": "comment",
"z": "1780d8815c9004cf",
"name": "2 Report changes, ignore the initial value",
"info": "初期値がセンティネル値として使用され、その後の変更が転送される。",
"x": 280,
"y": 260,
"wires": []
},
{
"id": "d5c20441fc01294b",
"type": "rbe",
"z": "1780d8815c9004cf",
"name": "Ignore first, report changes",
"func": "rbei",
"gap": "",
"start": "",
"inout": "out",
"septopics": true,
"property": "payload",
"topi": "topic",
"x": 520,
"y": 320,
"wires": [["c5845cc63c81f81d"]]
},
{
"id": "eef24d9b8c3f98c7",
"type": "inject",
"z": "1780d8815c9004cf",
"name": "[1,2,2]",
"props": [{"p": "payload"}],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[1,2,2]",
"payloadType": "json",
"x": 210,
"y": 320,
"wires": [["9e8e79801228c3bb"]]
},
{
"id": "c5845cc63c81f81d",
"type": "debug",
"z": "1780d8815c9004cf",
"name": "Print changes",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 740,
"y": 320,
"wires": []
},
{
"id": "9e8e79801228c3bb",
"type": "split",
"z": "1780d8815c9004cf",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 330,
"y": 320,
"wires": [["d5c20441fc01294b"]]
},
{
"id": "c6ddaefee2877538",
"type": "comment",
"z": "1780d8815c9004cf",
"name": "3 Report changes larger than 50% (Deadband)",
"info": "50%以上の変化のみを報告するデッドバンドモード",
"x": 300,
"y": 440,
"wires": []
},
{
"id": "af9390a840a0b28a",
"type": "rbe",
"z": "1780d8815c9004cf",
"name": "Deadband 50%",
"func": "deadbandEq",
"gap": "50%",
"start": "",
"inout": "out",
"septopics": true,
"property": "payload",
"topi": "topic",
"x": 500,
"y": 500,
"wires": [["f76f04bfb73ad8db"]]
},
{
"id": "2a28d48e44fd6450",
"type": "inject",
"z": "1780d8815c9004cf",
"name": "[1,2,2,1]",
"props": [{"p": "payload"}],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[1,2,2,1]",
"payloadType": "json",
"x": 210,
"y": 500,
"wires": [["9155ade283e76ab6"]]
},
{
"id": "f76f04bfb73ad8db",
"type": "debug",
"z": "1780d8815c9004cf",
"name": "Print changes",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 700,
"y": 500,
"wires": []
},
{
"id": "9155ade283e76ab6",
"type": "split",
"z": "1780d8815c9004cf",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 330,
"y": 500,
"wires": [["af9390a840a0b28a"]]
},
{
"id": "9867760eef458ee6",
"type": "comment",
"z": "1780d8815c9004cf",
"name": "4 Report only specific value (Narrowband)",
"info": "特定の値(2)のみを報告するナローバンドモード",
"x": 290,
"y": 620,
"wires": []
},
{
"id": "6b70bed3e7360f58",
"type": "rbe",
"z": "1780d8815c9004cf",
"name": "Only send 2's (±1)",
"func": "narrowbandEq",
"gap": "1",
"start": "2",
"inout": "out",
"septopics": false,
"property": "payload",
"topi": "topic",
"x": 510,
"y": 680,
"wires": [["5f02aa2b43499ca8"]]
},
{
"id": "a5b05fcbe6fdf53e",
"type": "inject",
"z": "1780d8815c9004cf",
"name": "[1,2,2,3,4]",
"props": [{"p": "payload"}],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[1,2,2,3,4]",
"payloadType": "json",
"x": 210,
"y": 680,
"wires": [["e58f98ecb220d7f3"]]
},
{
"id": "5f02aa2b43499ca8",
"type": "debug",
"z": "1780d8815c9004cf",
"name": "Print values",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"x": 710,
"y": 680,
"wires": []
},
{
"id": "e58f98ecb220d7f3",
"type": "split",
"z": "1780d8815c9004cf",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 330,
"y": 680,
"wires": [["6b70bed3e7360f58"]]
}
]
モード: 値が変化した時にのみブロック(rbe)
プロパティ: msg.payload
トピックごとに比較: ✓
入力: 1 → 2 → 2
出力: 1 → 2(最後の2は前回と同じなのでブロック)
モード: 初期値を無視、変化時のみ(rbei)
プロパティ: msg.payload
入力: 1 → 2 → 2
出力: 2(最初の1は無視、最後の2は前回と同じ)
モード: デッドバンド(deadband)
値の範囲: 50%
比較: 値が範囲外に出た時に送信
入力: 1 → 2 → 2 → 1
1→2: 100%変化(50%超)→ 通過
2→2: 0%変化 → ブロック
2→1: 50%変化(境界)→ 通過
出力: 1 → 2 → 1
モード: ナローバンド(narrowband)
初期値(中心): 2
値の範囲: 1
入力: 1, 2, 2, 3, 4
1: 範囲内(2±1=1〜3) → 通過
2: 範囲内 → 通過
2: 範囲内 → 通過
3: 範囲内 → 通過
4: 範囲外 → ブロック
出力: 1, 2, 2, 3
温度センサー(0.1度単位で変動)
↓
Filterノード(デッドバンド: 0.5度)
↓
0.5度以上の変化のみデータベースに保存
↓
ストレージ容量の大幅削減
複数の機械(マシンA, B, C)からの振動データ
↓
Filterノード(トピック別、デッドバンド10%)
↓
各機械で10%以上の変動があればアラート
↓
予防保全システムへ連携