Closed StephanLeschke closed 6 years ago
please, use the OPC UA IIoT Inject
The OPC UA IIoT Node is for event-based injects and 0 or false is not possible for events for now. It is a signal to use the default (value) of the IIoT Node node like 0 or false or whatever.
I retested with node v8.11.4 and the problem was gone. So it seems to be related to node v10.
I used the manual inject just for the minimal reproduction.
The intended application is a modbus to OPC-UA gateway (similar to your SDM630 example).
In the application the payload is coming from the modbus read node and I am using the OPC UA IIoT Node to set the namespace information. I do not want to hide this in a function node like in your example.
Here is another example which is closer to the code of my application:
[ { "id": "c9b04afe.8458b", "type": "tab", "label": "OPC-Server", "disabled": false, "info": "" }, { "id": "e62720b3.9a2498", "type": "tab", "label": "Modbus2OPC", "disabled": false, "info": "" }, { "id": "f86f6dfa.5d5ff", "type": "OPCUA-IIoT-Connector", "z": "", "discoveryUrl": "", "endpoint": "opc.tcp://localhost:55388/", "keepSessionAlive": true, "loginEnabled": false, "securityPolicy": "None", "securityMode": "NONE", "name": "LOCAL SERVER", "showErrors": false, "publicCertificateFile": "", "privateKeyFile": "", "defaultSecureTokenLifetime": "", "endpointMustExist": true, "autoSelectRightEndpoint": true, "strategyMaxRetry": "", "strategyInitialDelay": "", "strategyMaxDelay": "", "strategyRandomisationFactor": "", "requestedSessionTimeout": "" }, { "id": "40ce404d.94b018", "type": "modbus-client", "z": "", "name": "Modbus Server", "clienttype": "tcp", "bufferCommands": true, "stateLogEnabled": false, "tcpHost": "127.0.0.1", "tcpPort": "502", "tcpType": "DEFAULT", "serialPort": "/dev/ttyUSB", "serialType": "RTU-BUFFERD", "serialBaudrate": "9600", "serialDatabits": "8", "serialStopbits": "1", "serialParity": "none", "serialConnectionDelay": "100", "unit_id": 1, "commandDelay": 1, "clientTimeout": 1000, "reconnectTimeout": 2000 }, { "id": "20874e14.2319ea", "type": "OPCUA-IIoT-Server", "z": "c9b04afe.8458b", "port": "55388", "endpoint": "", "acceptExternalCommands": true, "maxAllowedSessionNumber": "", "maxConnectionsPerEndpoint": "", "maxAllowedSubscriptionNumber": "", "alternateHostname": "", "name": "OPC-Server", "showStatusActivities": false, "showErrors": false, "asoDemo": false, "allowAnonymous": true, "isAuditing": false, "serverDiscovery": true, "users": [], "xmlsets": [], "publicCertificateFile": "", "privateCertificateFile": "", "maxNodesPerRead": 1000, "maxNodesPerBrowse": 2000, "x": 610, "y": 100, "wires": [ [] ] }, { "id": "28f2aed3.622ed2", "type": "OPCUA-IIoT-Server-ASO", "z": "c9b04afe.8458b", "nodeId": "ns=1;s=Mains", "browsename": "Mains", "displayname": "Mains", "objecttype": "FolderType", "datatype": "", "value": "", "referenceNodeId": "ns=0;i=85", "referencetype": "Organizes", "name": "Mains", "x": 330, "y": 100, "wires": [ [ "20874e14.2319ea" ] ] }, { "id": "4a8753da.11bb6c", "type": "OPCUA-IIoT-Inject", "z": "c9b04afe.8458b", "injectType": "inject", "payload": "0", "payloadType": "num", "topic": "", "repeat": "", "crontab": "", "once": true, "startDelay": "1", "name": "After 1 sec", "addressSpaceItems": [], "x": 170, "y": 100, "wires": [ [ "28f2aed3.622ed2" ] ] }, { "id": "9e6fff36.b2e288", "type": "OPCUA-IIoT-Server-ASO", "z": "c9b04afe.8458b", "nodeId": "ns=1;s=Mains.ApparentPower", "browsename": "ApparentPower", "displayname": "ApparentPower", "objecttype": "BaseDataVariableType", "datatype": "UInt16", "value": "0", "referenceNodeId": "ns=1;s=Mains", "referencetype": "Organizes", "name": "Mains.ApparentPower", "x": 380, "y": 180, "wires": [ [ "20874e14.2319ea" ] ] }, { "id": "41d43e56.cc3a58", "type": "OPCUA-IIoT-Server-ASO", "z": "c9b04afe.8458b", "nodeId": "ns=1;s=Mains.RealPower", "browsename": "RealPower", "displayname": "RealPower", "objecttype": "BaseDataVariableType", "datatype": "Int16", "value": "0", "referenceNodeId": "ns=1;s=Mains", "referencetype": "Organizes", "name": "Mains.RealPower", "x": 370, "y": 220, "wires": [ [ "20874e14.2319ea" ] ] }, { "id": "cce12bea.5bc6c8", "type": "OPCUA-IIoT-Server-ASO", "z": "c9b04afe.8458b", "nodeId": "ns=1;s=Mains.PowerFactor", "browsename": "PowerFactor", "displayname": "PowerFactor", "objecttype": "BaseDataVariableType", "datatype": "Float", "value": "0", "referenceNodeId": "ns=1;s=Mains", "referencetype": "Organizes", "name": "Mains.PowerFactor", "x": 370, "y": 260, "wires": [ [ "20874e14.2319ea" ] ] }, { "id": "59743432.65fc3c", "type": "OPCUA-IIoT-Inject", "z": "c9b04afe.8458b", "injectType": "inject", "payload": "0", "payloadType": "num", "topic": "", "repeat": "", "crontab": "", "once": true, "startDelay": "3", "name": "After 3 sec", "addressSpaceItems": [], "x": 170, "y": 180, "wires": [ [ "9e6fff36.b2e288", "41d43e56.cc3a58", "cce12bea.5bc6c8" ] ] }, { "id": "5a3cc2c6.ecd1dc", "type": "modbus-read", "z": "e62720b3.9a2498", "name": "Read Registers 100 - 102", "topic": "", "showStatusActivities": false, "logIOActivities": false, "showErrors": false, "unitid": "", "dataType": "HoldingRegister", "adr": "100", "quantity": "3", "rate": "1", "rateUnit": "s", "delayOnStart": false, "startDelayTime": "", "server": "40ce404d.94b018", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "x": 150, "y": 80, "wires": [ [ "3b62bee7.18e15a" ], [] ] }, { "id": "3b62bee7.18e15a", "type": "split", "z": "e62720b3.9a2498", "name": "Register Separation", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "x": 400, "y": 80, "wires": [ [ "1f9ae96b.48c117" ] ] }, { "id": "1f9ae96b.48c117", "type": "switch", "z": "e62720b3.9a2498", "name": "Register Selection", "property": "parts.index", "propertyType": "msg", "rules": [ { "t": "eq", "v": "0", "vt": "num" }, { "t": "eq", "v": "1", "vt": "num" }, { "t": "eq", "v": "2", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 3, "x": 630, "y": 80, "wires": [ [ "550edc9f.787bf4" ], [ "153abedc.2604b9" ], [ "fb97df5.b8ac0a" ] ] }, { "id": "e5a379e.9fb4108", "type": "OPCUA-IIoT-Write", "z": "e62720b3.9a2498", "connector": "f86f6dfa.5d5ff", "name": "", "justValue": true, "showStatusActivities": false, "showErrors": false, "x": 1170, "y": 80, "wires": [ [] ] }, { "id": "550edc9f.787bf4", "type": "OPCUA-IIoT-Node", "z": "e62720b3.9a2498", "injectType": "write", "nodeId": "ns=1;s=Mains.ApparentPower", "datatype": "UInt16", "value": "", "name": "Mains.ApparentPower", "topic": "", "showErrors": false, "x": 920, "y": 80, "wires": [ [ "e5a379e.9fb4108" ] ] }, { "id": "153abedc.2604b9", "type": "OPCUA-IIoT-Node", "z": "e62720b3.9a2498", "injectType": "write", "nodeId": "ns=1;s=Mains.RealPower", "datatype": "Int16", "value": "", "name": "Mains.RealPower", "topic": "", "showErrors": false, "x": 910, "y": 140, "wires": [ [ "e5a379e.9fb4108" ] ] }, { "id": "fb97df5.b8ac0a", "type": "OPCUA-IIoT-Node", "z": "e62720b3.9a2498", "injectType": "write", "nodeId": "ns=1;s=Mains.PowerFactor", "datatype": "UInt16", "value": "", "name": "Mains.PowerFactor", "topic": "", "showErrors": false, "x": 910, "y": 200, "wires": [ [ "e5a379e.9fb4108" ] ] } ]
I am currently dismissing the idea of implementing this in node-red and do it in node.js directly as the performance is really bad.
I need to convert about 80 modbus registers into 150 OPC values and CPU load on a Raspberry is already above 100% with only half of the project finished.
Is the browser for Node-RED running on the same machine or is it a PI as backend and external PC to browse Node-RED?
The PI is the backend running node-red and the browser is running on desktop PC.
The flow is much to complicated too.
should look like that
I have seen this in your SDM630 example. My intention was to have the individual OPC items visible. But I can give it a try before moving completely away from a graphical implementation.
Problem
( ) unexpected behavior => please visit the Wiki before
Current behavior OPCUA-IIoT-Node is converting payload 0 into NaN for DataTypes Int16 and Float.
Expected behavior OPCUA-IIoT-Node should convert payload 0 into 0 for DataTypes Int16 and Float.
Minimal reproduction of the problem with instructions
[ { "id": "5a7c7ca5.692454", "type": "tab", "label": "Flow 1", "disabled": false, "info": "" }, { "id": "4d638f37.d1835", "type": "OPCUA-IIoT-Write", "z": "5a7c7ca5.692454", "connector": "549a820b.e0748c", "name": "", "justValue": true, "showStatusActivities": true, "showErrors": true, "x": 730, "y": 400, "wires": [ [] ] }, { "id": "f5884afc.ade848", "type": "OPCUA-IIoT-Node", "z": "5a7c7ca5.692454", "injectType": "write", "nodeId": "ns=1;s=Mains.RealPower", "datatype": "Int16", "value": "", "name": "Mains.RealPower", "topic": "", "showErrors": false, "x": 330, "y": 460, "wires": [ [ "4d638f37.d1835", "fbb8721b.079a5" ] ] }, { "id": "5ee2bfc4.736e1", "type": "OPCUA-IIoT-Node", "z": "5a7c7ca5.692454", "injectType": "write", "nodeId": "ns=1;s=Mains.PowerFactor", "datatype": "Float", "value": "", "name": "Mains.PowerFactor", "topic": "", "showErrors": false, "x": 330, "y": 520, "wires": [ [ "4d638f37.d1835", "fbb8721b.079a5" ] ] }, { "id": "fbb8721b.079a5", "type": "debug", "z": "5a7c7ca5.692454", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "x": 730, "y": 520, "wires": [] }, { "id": "18f4c9f.ce35036", "type": "OPCUA-IIoT-Node", "z": "5a7c7ca5.692454", "injectType": "write", "nodeId": "ns=1;s=Mains.ApparentPower", "datatype": "UInt16", "value": "", "name": "Mains.ApparentPower", "topic": "", "showErrors": false, "x": 340, "y": 400, "wires": [ [ "4d638f37.d1835", "fbb8721b.079a5" ] ] }, { "id": "69cddfe0.382ce", "type": "OPCUA-IIoT-Inject", "z": "5a7c7ca5.692454", "injectType": "write", "payload": "0", "payloadType": "num", "topic": "", "repeat": "", "crontab": "", "once": false, "startDelay": "", "name": "", "addressSpaceItems": [], "x": 130, "y": 460, "wires": [ [ "f5884afc.ade848" ] ] }, { "id": "a2b46880.7b4398", "type": "OPCUA-IIoT-Inject", "z": "5a7c7ca5.692454", "injectType": "write", "payload": "0", "payloadType": "num", "topic": "", "repeat": "", "crontab": "", "once": false, "startDelay": "", "name": "", "addressSpaceItems": [], "x": 130, "y": 520, "wires": [ [ "5ee2bfc4.736e1" ] ] }, { "id": "756d5abe.a7ffa4", "type": "OPCUA-IIoT-Inject", "z": "5a7c7ca5.692454", "injectType": "write", "payload": "0", "payloadType": "num", "topic": "", "repeat": "", "crontab": "", "once": false, "startDelay": "", "name": "", "addressSpaceItems": [], "x": 130, "y": 400, "wires": [ [ "18f4c9f.ce35036" ] ] }, { "id": "e1660d2e.01c43", "type": "inject", "z": "5a7c7ca5.692454", "name": "After 1 Second", "topic": "", "payload": "0", "payloadType": "num", "repeat": "", "crontab": "", "once": true, "onceDelay": "2", "x": 120, "y": 80, "wires": [ [ "265a5ccf.d780d4" ] ] }, { "id": "265a5ccf.d780d4", "type": "OPCUA-IIoT-Server-ASO", "z": "5a7c7ca5.692454", "nodeId": "ns=1;s=Mains", "browsename": "Mains", "displayname": "Mains", "objecttype": "FolderType", "datatype": "", "value": "", "referenceNodeId": "ns=0;i=85", "referencetype": "Organizes", "name": "Folder Mains", "x": 310, "y": 80, "wires": [ [ "c5438852.6b00f8" ] ] }, { "id": "75565307.0275fc", "type": "comment", "z": "5a7c7ca5.692454", "name": "Insert folders into name space", "info": "", "x": 360, "y": 40, "wires": [] }, { "id": "874f8859.f28218", "type": "inject", "z": "5a7c7ca5.692454", "name": "After 3 Seconds", "topic": "", "payload": "0", "payloadType": "num", "repeat": "", "crontab": "", "once": true, "onceDelay": "3", "x": 120, "y": 180, "wires": [ [ "a39b8177.f7a46", "af05d47b.351218", "79659bd5.87ced4" ] ] }, { "id": "a39b8177.f7a46", "type": "OPCUA-IIoT-Server-ASO", "z": "5a7c7ca5.692454", "nodeId": "ns=1;s=Mains.ApparentPower", "browsename": "ApparentPower", "displayname": "ApparentPower", "objecttype": "BaseDataVariableType", "datatype": "UInt16", "value": "0", "referenceNodeId": "ns=1;s=Mains", "referencetype": "HasComponent", "name": "Mains.ApparentPower", "x": 340, "y": 180, "wires": [ [ "c5438852.6b00f8" ] ] }, { "id": "79659bd5.87ced4", "type": "OPCUA-IIoT-Server-ASO", "z": "5a7c7ca5.692454", "nodeId": "ns=1;s=Mains.PowerFactor", "browsename": "PowerFactor", "displayname": "PowerFactor", "objecttype": "BaseDataVariableType", "datatype": "Float", "value": "0", "referenceNodeId": "ns=1;s=Mains", "referencetype": "HasComponent", "name": "Mains.PowerFactor", "x": 330, "y": 300, "wires": [ [ "c5438852.6b00f8" ] ] }, { "id": "af05d47b.351218", "type": "OPCUA-IIoT-Server-ASO", "z": "5a7c7ca5.692454", "nodeId": "ns=1;s=Mains.RealPower", "browsename": "RealPower", "displayname": "RealPower", "objecttype": "BaseDataVariableType", "datatype": "Int16", "value": "0", "referenceNodeId": "ns=1;s=Mains", "referencetype": "HasComponent", "name": "Mains.RealPower", "x": 330, "y": 240, "wires": [ [ "c5438852.6b00f8" ] ] }, { "id": "55496495.aedbbc", "type": "comment", "z": "5a7c7ca5.692454", "name": "Insert variables into name space", "info": "", "x": 370, "y": 140, "wires": [] }, { "id": "c5438852.6b00f8", "type": "OPCUA-IIoT-Server", "z": "5a7c7ca5.692454", "port": "55388", "endpoint": "", "acceptExternalCommands": true, "maxAllowedSessionNumber": "", "maxConnectionsPerEndpoint": "", "maxAllowedSubscriptionNumber": "", "alternateHostname": "", "name": "OPC-Server", "showStatusActivities": true, "showErrors": true, "asoDemo": false, "allowAnonymous": true, "isAuditing": false, "serverDiscovery": true, "users": [], "xmlsets": [], "publicCertificateFile": "", "privateCertificateFile": "", "maxNodesPerRead": "", "maxNodesPerBrowse": "", "x": 730, "y": 80, "wires": [ [] ] }, { "id": "549a820b.e0748c", "type": "OPCUA-IIoT-Connector", "z": "", "discoveryUrl": "", "endpoint": "opc.tcp://RevPi3746:55388/UA/NodeREDIIoTServer", "keepSessionAlive": true, "loginEnabled": false, "securityPolicy": "None", "securityMode": "NONE", "name": "LOCAL SERVER", "showErrors": true, "publicCertificateFile": "", "privateKeyFile": "", "defaultSecureTokenLifetime": "", "endpointMustExist": false, "autoSelectRightEndpoint": true, "strategyMaxRetry": "", "strategyInitialDelay": "", "strategyMaxDelay": "", "strategyRandomisationFactor": "", "requestedSessionTimeout": "" } ]
Your Environment
( X) I am using just the Node-RED package and got node-opcua installed with it
( ) I have installed node-opcua global from source (using git clone)
( ) I have installed node-opcua as a global package (using npm i -g)
Device :
( ) macOS: v
( ) Linux: v
( ) Windows: v
(X ) Raspbian: Stretch 4.9.76-rt60-v7+
( ) Other:
Description of the connecting OPC UA system:
node-red-contrib-iiot-opcua version: `` 2.7.1
Node: (min. 8.x)
node --version
= v10.9.0