Hi,
I found few in stuffs on the performance of the application.
Looks like, my CPU RAM is increasing over a Period of Time,
The RAM increases as below
- With 5sec Trigger using Inject node [ with nearly 250kb of data into the system as an Object.]
- 36MB is getting consumed in 6Hrs time,
- With 200ms Trigger using Inject node
- 96MB is getting consumed in 2Hrs time, [ Without any data]
- Approx. 100MB of RAM getting consumed at every hour [ With Data of 250kb]
By this every 100MB getting consumed at every one hour, my system is reaching its max. RAM of 1GB in 6 to 8hrs.
Looks like the, this 200ms eating-up all my RAM,
Herewith I have attaching my OPC UA Nodes for Codesys read and write nodes for your kind reference,
After moving these variables to Global, I am using these variables to start, process my operation. To check the status of these Global variables, I am using Inject node at every 200ms interval. I am starting my auto-cycle sequence using Inject Nodes.
- Is there any best to write this Nodes?
- Instead of Inject node, is there any other node I Can use instead of Inject as a starting Point of my Sequence ?
[{"id":"6009735745a81216","type":"group","z":"b09d706d370f621d","g":"dd93ce4ec751e275","name":"Subscribing To Codesys OPC UA Server","style":{"stroke":"#000000","fill":"#ffffbf","fill-opacity":"0.5","label":true,"color":"#000000"},"nodes":["3f97e8b62903c8ae","4892a65b297ee0c6","5b7d6d79112c89f0","59360722fd783fea","227a97f6e6c106f4","4ee0cbf5e46ebc32","e96247e573fb1509","54c54a7838312a98","c915a4f220618cd8","dea10b8c3c246880","daed9bc4e45112ca"],"x":74,"y":259,"w":1492,"h":322},{"id":"3f97e8b62903c8ae","type":"inject","z":"b09d706d370f621d","g":"6009735745a81216","name":"GO","props":[],"repeat":"0.2","crontab":"","once":true,"onceDelay":"","topic":"","x":170,"y":400,"wires":[["4892a65b297ee0c6"]]},{"id":"4892a65b297ee0c6","type":"template","z":"b09d706d370f621d","g":"6009735745a81216","name":"OPC Read Configuration","field":"payload","fieldType":"msg","format":"text","syntax":"plain","template":"ns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_FHS1_BC_Start_Scan,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_FHS.s_plc_FHS1_Scanned_BC,String\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_PROG_Running,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_Cask_AT_FHS1_Set,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_FHS.b_NR_FHS1_BC_Start_Scan,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_Cask_AT_FHS1_test,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_FHS1_BC_Data_Ready,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_FHS1_Read_InProgress,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.Line_PLC_Comm_Ok,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_result_read_Ack_to_NR,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_FHS1_Control_Mode,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_FHS1_BC_Start_Scan_Set,Boolean","output":"str","x":350,"y":480,"wires":[["5b7d6d79112c89f0"]]},{"id":"5b7d6d79112c89f0","type":"csv","z":"b09d706d370f621d","g":"6009735745a81216","name":"Convert CSV Config To JSON","sep":",","hdrin":"","hdrout":"none","multi":"mult","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":590,"y":380,"wires":[["59360722fd783fea","c915a4f220618cd8"]]},{"id":"59360722fd783fea","type":"function","z":"b09d706d370f621d","g":"6009735745a81216","name":"Construct OPC msg Data","func":"// @ts-nocheck\n//Copy msg to Config, as msg is required for the OPC Client\nvar config = {};\nconfig = msg;\n\n//Perform a loop through the config data\n//For each iteration, set topic to column 1 & datatype to column 2\n\nfor (i=0;i<config.payload.length;i++) {\n msg = {};\n msg.topic = config.payload[i].col1;\n msg.datatype = config.payload[i].col2;\n msg.browseName = msg.topic.split(\".\").slice(-1).join(\".\");\n\n //Send the message now, inside the loop\n node.send(msg);\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":930,"y":340,"wires":[["4ee0cbf5e46ebc32","daed9bc4e45112ca"]]},{"id":"227a97f6e6c106f4","type":"debug","z":"b09d706d370f621d","g":"6009735745a81216","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":990,"y":540,"wires":[]},{"id":"4ee0cbf5e46ebc32","type":"debug","z":"b09d706d370f621d","g":"6009735745a81216","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1170,"y":340,"wires":[]},{"id":"e96247e573fb1509","type":"function","z":"b09d706d370f621d","g":"6009735745a81216","name":"PLC global variable assigment Function","func":"global.get(\"b_PLC_FHS1_BC_Start_Scan\") || false;\nglobal.get(\"s_plc_FHS1_Scanned_BC\") || null;\nglobal.get(\"b_PLC_PROG_Running\") || false;\nglobal.get(\"b_PLC_Cask_AT_FHS1_Set\") || false;\nglobal.get(\"b_NR_FHS1_BC_Start_Scan\") || false;\nglobal.get(\"b_PLC_Cask_AT_FHS1_test\") || false;\nglobal.get(\"b_PLC_FHS1_BC_Data_Ready\") || false;\nglobal.get(\"b_PLC_FHS1_Read_InProgress\") || false;\nglobal.get(\"Line_PLC_Comm_Ok\") || false;\nglobal.get(\"b_result_read_Ack_to_NR\") || false;\nglobal.get(\"b_FHS1_Control_Mode\") || false;\nglobal.get(\"b_PLC_FHS1_BC_Start_Scan_Set\") || false;\n\n\n//b_PLC_FHS1_BC_Start_Scan\nif (msg.topic == \"ns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_FHS1_BC_Start_Scan\") {\n global.set(\"b_PLC_FHS1_BC_Start_Scan\", msg.payload)\n}\n// s_plc_FHS1_Scanned_BC <- s_plc_FHS1_Scanned_BC\nif (msg.topic == \"ns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_FHS.s_plc_FHS1_Scanned_BC\") {\n global.set(\"s_plc_FHS1_Scanned_BC\", msg.payload)\n}\n\n//b_PLC_PROG_Running\nif (msg.topic == \"ns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_PROG_Running\") {\n global.set(\"b_PLC_PROG_Running\", msg.payload)\n}\n\n//b_PLC_Cask_AT_FHS1\nif (msg.topic == \"ns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_Cask_AT_FHS1_Set\") {\n global.set(\"b_PLC_Cask_AT_FHS1_Set\", msg.payload)\n}\n\n//b_NR_FHS1_BC_Start_Scan\nif (msg.topic == \"ns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_FHS.b_NR_FHS1_BC_Start_Scan\") {\n global.set(\"b_NR_FHS1_BC_Start_Scan\", msg.payload)\n}\n\n//b_PLC_Cask_AT_FHS1 test\nif (msg.topic == \"ns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_Cask_AT_FHS1_test\") {\n global.set(\"b_PLC_Cask_AT_FHS1_test\", msg.payload)\n}\n\n//b_PLC_FHS1_BC_Data_Ready\nif (msg.topic == \"ns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_FHS1_BC_Data_Ready\") {\n global.set(\"b_PLC_FHS1_BC_Data_Ready\", msg.payload)\n}\n\n//b_PLC_FHS1_Read_InProgress\nif (msg.topic == \"ns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_FHS1_Read_InProgress\") {\n global.set(\"b_PLC_FHS1_Read_InProgress\", msg.payload)\n}\n\n//Line_PLC_Comm_Ok\nif (msg.topic == \"ns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.Line_PLC_Comm_Ok\") {\n global.set(\"Line_PLC_Comm_Ok\", msg.payload)\n}\n\n//b_result_read_Ack_to_NR\nif (msg.topic == \"ns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_result_read_Ack_to_NR\") {\n global.set(\"b_result_read_Ack_to_NR\", msg.payload)\n}\n\n//b_FHS1_Control_Mode\nif (msg.topic == \"ns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_FHS1_Control_Mode\") {\n global.set(\"b_FHS1_Control_Mode\", msg.payload)\n}\n\n//b_PLC_FHS1_BC_Start_Scan_Set\nif (msg.topic == \"ns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_FHS1_BC_Start_Scan_Set\") {\n global.set(\"b_PLC_FHS1_BC_Start_Scan_Set\", msg.payload)\n}\nreturn msg; ","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1200,"y":460,"wires":[["54c54a7838312a98"]]},{"id":"54c54a7838312a98","type":"debug","z":"b09d706d370f621d","g":"6009735745a81216","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1450,"y":540,"wires":[]},{"id":"c915a4f220618cd8","type":"debug","z":"b09d706d370f621d","g":"6009735745a81216","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":300,"wires":[]},{"id":"dea10b8c3c246880","type":"template","z":"b09d706d370f621d","d":true,"g":"6009735745a81216","name":"OPC Read Configuration","field":"payload","fieldType":"msg","format":"text","syntax":"mustache","template":"ns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_FHS1_PROG_Running,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_NR_FHS1_NOT_Valid_BC,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_NR_FHS1_Valid_BC,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_FHS1_BC_Start_Scan,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_FHS1_Scanning_TimeOut,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_PLC_PROG_Running,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.POU_FHS1.s_plc_FHS1_Scanned_BC,String\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_WSI_EC_Complete,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_WSI_EC_Ready_To_Weight,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_WSI_FC_Complete,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_PLC.b_WSI_FC_Ready_To_Weight,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.POU_WS.float_EC_Net_Cal,Float\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.POU_WS.b_EC_Zeroing_Switch,Boolean\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.POU_WS.float_FC_Net_Cal,Float\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.POU_WS.b_FC_Zeroing_Switch,Boolean","output":"str","x":350,"y":320,"wires":[[]]},{"id":"daed9bc4e45112ca","type":"OpcUa-Client","z":"b09d706d370f621d","g":"6009735745a81216","endpoint":"a422c767cac035f8","action":"subscribe","deadbandtype":"a","deadbandvalue":1,"time":"1","timeUnit":"s","certificate":"n","localfile":"","localkeyfile":"","securitymode":"None","securitypolicy":"None","folderName4PKI":"","name":"","x":820,"y":460,"wires":[["e96247e573fb1509","227a97f6e6c106f4"]]},{"id":"a422c767cac035f8","type":"OpcUa-Endpoint","endpoint":"opc.tcp://192.168.1.100:4840","secpol":"None","secmode":"None","login":false}]
[{"id":"5500d04e2011801f","type":"group","z":"b09d706d370f621d","g":"dd93ce4ec751e275","name":"Writing To Codesys OPC UA Server","style":{"stroke":"#000000","fill":"#e3f3d3","fill-opacity":"0.5","label":true,"color":"#000000"},"nodes":["ea7228ac928e5f67","7f891af9821bc208","1af59b05fdae9400","deed1989fed5bd90","65a9cbd31a0a792d","914a3533c88b3743","7ba3ec7987e11bad","c99d2e0301a3eef2","f4f7cd2175462ef6","4321dd9a661397d1","a6cab4af8eede9ac"],"x":74,"y":619,"w":1292,"h":262},{"id":"ea7228ac928e5f67","type":"inject","z":"b09d706d370f621d","g":"5500d04e2011801f","name":"GO","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"0.2","crontab":"","once":true,"onceDelay":"","topic":"","payload":"","payloadType":"date","x":170,"y":700,"wires":[["7f891af9821bc208"]]},{"id":"7f891af9821bc208","type":"template","z":"b09d706d370f621d","g":"5500d04e2011801f","name":"OPC Write Configuration","field":"payload","fieldType":"msg","format":"text","syntax":"mustache","template":"ns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_FHS.b_NR_FHS1_NOT_Valid_BC,Boolean,b_NR_FHS1_NOT_Valid_BC\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_FHS.b_NR_FHS1_Valid_BC,Boolean,b_NR_FHS1_Valid_BC\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_FHS.int_FHS1_EM01_State,Float,int_FHS1_EM01_State\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_FHS.int_FHS1_EM02_State,Float,int_FHS1_EM02_State\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_FHS.int_counter_SCANNED_CASKS,Float,counter_SCANNED_CASKS\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_FHS.int_counter_VALID,Float,counter_VALID\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_FHS.int_counter_NOT_VALID,Float,counter_NOT_VALID\nns=4;s=|var|CODESYS Control for Raspberry Pi MC SL.Application.GVL_FHS.b_NR_HeartBeat,Boolean,b_NR_HeartBeat","output":"str","x":390,"y":660,"wires":[["1af59b05fdae9400"]]},{"id":"1af59b05fdae9400","type":"csv","z":"b09d706d370f621d","g":"5500d04e2011801f","name":"Convert CSV Config To JSON","sep":",","hdrin":"","hdrout":"none","multi":"mult","ret":"\\n","temp":"","skip":"0","strings":false,"include_empty_strings":"","include_null_values":"","x":650,"y":660,"wires":[["914a3533c88b3743"]]},{"id":"deed1989fed5bd90","type":"function","z":"b09d706d370f621d","g":"5500d04e2011801f","name":"Initialise Value Data","func":"for (i=0;i<msg.payload.length;i++){\n global.set(msg.payload[i].col3,null)\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1250,"y":660,"wires":[[]]},{"id":"65a9cbd31a0a792d","type":"inject","z":"b09d706d370f621d","g":"5500d04e2011801f","name":"INIT","props":[{"p":"init","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":true,"onceDelay":"","topic":"","x":170,"y":660,"wires":[["7f891af9821bc208"]]},{"id":"914a3533c88b3743","type":"switch","z":"b09d706d370f621d","g":"5500d04e2011801f","name":"Initialising?","property":"init","propertyType":"msg","rules":[{"t":"nnull"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":950,"y":660,"wires":[["deed1989fed5bd90"],["7ba3ec7987e11bad"]]},{"id":"7ba3ec7987e11bad","type":"function","z":"b09d706d370f621d","g":"5500d04e2011801f","name":"Construct OPC msg Data","func":"//Copy msg to Config, as msg is required for the OPC Client\nvar config = {};\nconfig = msg;\n\n//Perform a loop through the config data\n//For each iteration, set topic to column 1 & datatype to column 2\nfor (i=0;i<config.payload.length;i++){\n msg = {};\n msg.topic = config.payload[i].col1;\n msg.datatype = config.payload[i].col2;\n msg.payload = global.get(config.payload[i].col3)\n msg.browseName = msg.topic.split(\".\").slice(-1).join(\".\");\n\n //Send the message now, inside the loop\n node.send(msg);\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":670,"y":740,"wires":[["c99d2e0301a3eef2"]]},{"id":"c99d2e0301a3eef2","type":"switch","z":"b09d706d370f621d","g":"5500d04e2011801f","name":"Block Null Values","property":"payload","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":970,"y":740,"wires":[["f4f7cd2175462ef6","4321dd9a661397d1"]]},{"id":"f4f7cd2175462ef6","type":"debug","z":"b09d706d370f621d","g":"5500d04e2011801f","name":"opc ua client","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1230,"y":740,"wires":[]},{"id":"4321dd9a661397d1","type":"OpcUa-Client","z":"b09d706d370f621d","g":"5500d04e2011801f","endpoint":"a422c767cac035f8","action":"write","deadbandtype":"a","deadbandvalue":1,"time":10,"timeUnit":"s","certificate":"n","localfile":"","localkeyfile":"","securitymode":"None","securitypolicy":"None","folderName4PKI":"","name":"","x":1000,"y":840,"wires":[["a6cab4af8eede9ac"]]},{"id":"a6cab4af8eede9ac","type":"debug","z":"b09d706d370f621d","g":"5500d04e2011801f","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1230,"y":840,"wires":[]},{"id":"a422c767cac035f8","type":"OpcUa-Endpoint","endpoint":"opc.tcp://192.168.1.100:4840","secpol":"None","secmode":"None","login":false}]
My hardware has four Core,
- What could be the permissible Limt of the Average CPU load for the 4 core Raspberry PI? now it's varying between 3.65 to 8 and sometime up to 15.
- How can I bring this Average CPU Load under the permissible value?
Best Regards,
Mani