adam-6017-tcp/ip
this is pre-flow for connect adam-6017 via Ethernet "rj45 cable " to laptop or to pi . communication via tcp/ip protocol
[{"id":"bcca5ceacd1ffd16","type":"modbus-read","z":"87712ed95b63779a","name":"","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"showWarnings":true,"unitid":"1","dataType":"HoldingRegister","adr":"16","quantity":"20","rate":"1","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"e93ff165.6c49b8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":390,"y":980,"wires":[["d762a75bae776975","d4362d2e89978877","9e16bf0f200466a3","b278116aa37a4c57","b7441ceed73b3893","e979bad19611a39d","703a1b971de655e3"],[]]},{"id":"d762a75bae776975","type":"modbus-response","z":"87712ed95b63779a","name":"","registerShowMax":20,"x":630,"y":940,"wires":[]},{"id":"d4362d2e89978877","type":"debug","z":"87712ed95b63779a","name":"debug 20","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":650,"y":1000,"wires":[]},{"id":"9e16bf0f200466a3","type":"function","z":"87712ed95b63779a","name":"function adress 2^¨16","func":"var msg0 = { payload: (msg.payload[0] << 16) + msg.payload[1] }\nreturn msg0;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":435,"y":1080,"wires":[["6c023cbcc05b1e0f"]],"l":false},{"id":"6c023cbcc05b1e0f","type":"toFloat","z":"87712ed95b63779a","name":"","toFixed":"","x":560,"y":1080,"wires":[["4a5198f62ef87db3"]]},{"id":"4a5198f62ef87db3","type":"function","z":"87712ed95b63779a","name":"function adress 1","func":"msg.payload = parseFloat(msg.payload.toFixed(3));\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":695,"y":1080,"wires":[["16b3cc9ec5e4ef79"]],"l":false},{"id":"16b3cc9ec5e4ef79","type":"debug","z":"87712ed95b63779a","name":"convert 32","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":880,"y":1080,"wires":[]},{"id":"b278116aa37a4c57","type":"function","z":"87712ed95b63779a","name":"array 2 data [0-20mA]","func":"// write 0 at 0-20mA - and 4 in range of 4-20mA with this furmila 65535/16 .\n\nvar maxRange = 20;\nvar minRange = 0;\n\n\n// 1mA is 3276.75 . in this case 20mA is 65535 decimal\n// range = 65535 / (20 -0 )\nvar range = 65535 / (20 - minRange);\n\nmsg.payload = ((msg.payload[2] / range) + minRange).toFixed(3);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":1160,"wires":[["443fb798e7e0446f"]]},{"id":"443fb798e7e0446f","type":"debug","z":"87712ed95b63779a","name":"DATA","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":650,"y":1160,"wires":[]},{"id":"b7441ceed73b3893","type":"function","z":"87712ed95b63779a","name":"array 2 data [4-20mA]","func":"// write 0 at 0-20mA - and 4 in range of 4-20mA with this furmila 65535/16 .\n\nvar maxRange = 20 ;\nvar minRange = 4;\n\n\n// 1mA is 3276.75 . in this case 20mA is 65535 decimal\n// range = 65535 / (20 -0 )\nvar range = 65535 / (20 - minRange);\n\nmsg.payload = ((msg.payload[2] / range)+minRange).toFixed(3);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":1200,"wires":[["4376848a6fb23780"]]},{"id":"4376848a6fb23780","type":"debug","z":"87712ed95b63779a","name":"DATA","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":710,"y":1200,"wires":[]},{"id":"e979bad19611a39d","type":"function","z":"87712ed95b63779a","name":"array 3 data [4-20mA]","func":"// write 0 at 0-20mA - and 4 in range of 4-20mA with this furmila 65535/16 .\n\nvar maxRange = 20 ;\nvar minRange = 4;\n\n\n// 1mA is 3276.75 . in this case 20mA is 65535 decimal\n// range = 65535 / (20 -0 )\nvar range = 65535 / (20 - minRange);\n\nmsg.payload = ((msg.payload[3] / range)+minRange).toFixed(3);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":1260,"wires":[["e625f25c1821bba2"]]},{"id":"e625f25c1821bba2","type":"debug","z":"87712ed95b63779a","name":"DATA","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":690,"y":1260,"wires":[]},{"id":"cc5568b8aff6ddb6","type":"function","z":"87712ed95b63779a","name":"array 4 data [0-5V]","func":"// write 0 at 0-20mA - and 4 in range of 4-20mA with this furmila 65535/16 .\n\nvar maxRange = 500 ;\nvar minRange = 0;\n\n\n// 1mA is 3276.75 . in this case 20mA is 65535 decimal\n// range = 65535 / (20 - 0 )\nvar range = 65535 / (maxRange - minRange);\n\nmsg.payload = ((msg.payload[4] / range)+minRange).toFixed(3);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":470,"y":1320,"wires":[["749eec093289823d"]]},{"id":"749eec093289823d","type":"debug","z":"87712ed95b63779a","name":"DATA","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":690,"y":1320,"wires":[]},{"id":"37fb9206114a9a9a","type":"function","z":"87712ed95b63779a","name":"array 5 data [4-20mA]","func":"// write 0 at 0-20mA - and 4 in range of 4-20mA with this furmila 65535/16 .\n\nvar maxRange = 20 ;\nvar minRange = 4;\n\n\n// 1mA is 3276.75 . in this case 20mA is 65535 decimal\n// range = 65535 / (20 -0 )\nvar range = 65535 / (20 - minRange);\n\nmsg.payload = ((msg.payload[5] / range)+minRange).toFixed(3);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":1380,"wires":[["7530afc5ce763fe5"]]},{"id":"7530afc5ce763fe5","type":"debug","z":"87712ed95b63779a","name":"DATA","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":690,"y":1380,"wires":[]},{"id":"9ebb089a9e587143","type":"function","z":"87712ed95b63779a","name":"array 6 data [4-20mA]","func":"// write 0 at 0-20mA - and 4 in range of 4-20mA with this furmila 65535/16 .\n\nvar maxRange = 20 ;\nvar minRange = 4;\n\n\n// 1mA is 3276.75 . in this case 20mA is 65535 decimal\n// range = 65535 / (20 -0 )\nvar range = 65535 / (20 - minRange);\n\nmsg.payload = ((msg.payload[6] / range)+minRange).toFixed(3);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":1440,"wires":[["17f2d774315182b4"]]},{"id":"17f2d774315182b4","type":"debug","z":"87712ed95b63779a","name":"DATA","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":690,"y":1440,"wires":[]},{"id":"6ba9bdfeab843ca6","type":"function","z":"87712ed95b63779a","name":"array 7 data [4-20mA]","func":"// write 0 at 0-20mA - and 4 in range of 4-20mA with this furmila 65535/16 .\n\nvar maxRange = 20 ;\nvar minRange = 4;\n\n\n// 1mA is 3276.75 . in this case 20mA is 65535 decimal\n// range = 65535 / (20 -0 )\nvar range = 65535 / (20 - minRange);\n\nmsg.payload = ((msg.payload[7] / range)+minRange).toFixed(3);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":1500,"wires":[["23363e69eb71c007"]]},{"id":"23363e69eb71c007","type":"debug","z":"87712ed95b63779a","name":"DATA","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":690,"y":1500,"wires":[]},{"id":"c782f8572375ebf3","type":"link in","z":"87712ed95b63779a","name":"link in 12","links":["703a1b971de655e3"],"x":285,"y":1380,"wires":[["cc5568b8aff6ddb6","37fb9206114a9a9a","9ebb089a9e587143","6ba9bdfeab843ca6","2739c5fb2ce13a8f"]]},{"id":"703a1b971de655e3","type":"link out","z":"87712ed95b63779a","name":"link out 16","mode":"link","links":["c782f8572375ebf3"],"x":575,"y":900,"wires":[]},{"id":"c3dad820e73f865d","type":"modbus-write","z":"87712ed95b63779a","name":"","showStatusActivities":false,"showErrors":false,"showWarnings":true,"unitid":"","dataType":"MCoils","adr":"16","quantity":"2","server":"e93ff165.6c49b8","emptyMsgOnFail":false,"keepMsgProperties":false,"delayOnStart":false,"startDelayTime":"","x":540,"y":1600,"wires":[["26729cf4e1824315"],[]]},{"id":"85ca93dd1ff4fcde","type":"inject","z":"87712ed95b63779a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":310,"y":1600,"wires":[["c3dad820e73f865d"]]},{"id":"2739c5fb2ce13a8f","type":"function","z":"87712ed95b63779a","name":"array 7 data [4-20mA]","func":"// write 0 at 0-20mA - and 4 in range of 4-20mA with this furmila 65535/16 .\n\nvar maxRange = 20 ;\nvar minRange = 4;\n\n\n// 1mA is 3276.75 . in this case 20mA is 65535 decimal\n// range = 65535 / (20 -0 )\nvar range = 65535 / (20 - minRange);\n\nmsg.payload = ((msg.payload[17] / range)+minRange).toFixed(3);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":1540,"wires":[["9e488bae0493c15c"]]},{"id":"9e488bae0493c15c","type":"debug","z":"87712ed95b63779a","name":"debug 24","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":780,"y":1540,"wires":[]},{"id":"27a5ed051fe0ef70","type":"modbus-read","z":"87712ed95b63779a","name":"","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"showWarnings":true,"unitid":"1","dataType":"Coil","adr":"16","quantity":"2","rate":"1","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"e93ff165.6c49b8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":410,"y":1720,"wires":[["6093a2b23de73aa4","60d47e2bc8f5e30f","23e10a8e20237b20"],[]]},{"id":"60d47e2bc8f5e30f","type":"modbus-response","z":"87712ed95b63779a","name":"","registerShowMax":"20","x":670,"y":1700,"wires":[]},{"id":"4fca4dc47866dca6","type":"debug","z":"87712ed95b63779a","name":"debug DO","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":750,"y":1780,"wires":[]},{"id":"6093a2b23de73aa4","type":"function","z":"87712ed95b63779a","name":"array DO data ","func":"\nmsg.payload = msg.payload[0];\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":1780,"wires":[["4fca4dc47866dca6"]]},{"id":"23e10a8e20237b20","type":"function","z":"87712ed95b63779a","name":"array DO1 data ","func":"\nmsg.payload = msg.payload[1];\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":600,"y":1820,"wires":[["199f41d6ce63194a"]]},{"id":"199f41d6ce63194a","type":"debug","z":"87712ed95b63779a","name":"debug DO1","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":830,"y":1820,"wires":[]},{"id":"26729cf4e1824315","type":"debug","z":"87712ed95b63779a","name":"debug 23","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":780,"y":1640,"wires":[]},{"id":"5bfd7e6ca8cc421e","type":"inject","z":"87712ed95b63779a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":310,"y":1640,"wires":[["c3dad820e73f865d"]]},{"id":"e93ff165.6c49b8","type":"modbus-client","name":"Modbus Client","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"failureLogEnabled":false,"tcpHost":"192.168.1.7","tcpPort":"502","tcpType":"TCP-RTU-BUFFERED","serialPort":"/dev/ttyUSB0","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"None","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"","unit_id":1,"commandDelay":1,"clientTimeout":1000,"reconnectOnTimeout":false,"reconnectTimeout":2000,"parallelUnitIdsAllowed":false}]