Hello!
I was told to do a job in Node-red as my thesis. This is my first time using the program, so I don't understand anything about it. I made a thread, but it doesn't want to work. I don't understand where the error is. I will be very grateful for your help)
Here is my JSON stream:
[{"id":"c303b4e99409c666","type":"ui_dropdown","z":"cb59f7c8f4c017c7","name":"","label":" Cabling","tooltip":"","place":"Select option","group":"346f3afd.14dd56","order":1,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"open ","value":1,"type":"num"},{"label":"close","value":"0","type":"str"}],"payload":"","topic":"topic2","topicType":"str","className":"","x":180,"y":140,"wires":[["e657941b9716b9c3"]]},{"id":"836735bc82967e2e","type":"ui_form","z":"cb59f7c8f4c017c7","name":"","label":"Selection of cable section","group":"346f3afd.14dd56","order":3,"width":0,"height":0,"options":[{"label":"Pн","value":"Pн","type":"number","required":true,"rows":null},{"label":"Uн","value":"Uн","type":"number","required":true,"rows":null},{"label":"cosf","value":"cosf","type":"number","required":true,"rows":null},{"label":"kpd","value":"kpd","type":"number","required":true,"rows":null}],"formValue":{"Pн":"","Uн":"","cosf":"","kpd":""},"payload":"","submit":"submit","cancel":"cancel","topic":"topic1","topicType":"str","splitLayout":"","className":"","x":130,"y":80,"wires":[["e657941b9716b9c3"]]},{"id":"b58f4ef85dcba712","type":"ui_text","z":"cb59f7c8f4c017c7","group":"346f3afd.14dd56","order":4,"width":0,"height":0,"name":"","label":"Аluminum:","format":"{{msg.payload.result1}}","layout":"col-center","className":"","x":670,"y":120,"wires":[]},{"id":"9084d92b3c8f6ca7","type":"function","z":"cb59f7c8f4c017c7","name":"","func":"const Pн = msg.payload.topic1.Pн\nconst Uн = msg.payload.topic1.Uн;\nconst cosf = msg.payload.topic1.cosf;\nconst kpd = msg.payload.topic1.kpd;\n P = msg.payload.topic2.P;\n K = msg.payload.topic3.K;\n\nmsg.payload.result1 = Math.round((Pн*1000/(Math.sqrt(3) * Uн * cosf * kpd)));\n\nif (( msg.payload.result1<=22) && (P===1) && (K===2)) {\n \n msg.payload.result1 = 'АВВГ 1х2,5';\n} else if ((msg.payload.result1<=30) && (P===1) && (K===2)) {\n \n msg.payload.result1 = 'АВВГ 1х4';\n} else if ((msg.payload.result1<=37) && (P===1) && (K===2)) {\n \n msg.payload.result1 = 'АВВГ 1х6';\n} else if ((msg.payload.result1<=30) && (P===0) && (K===2)) {\n \n msg.payload.result1 = 'АВВГ 1х2,5';\n} else if ((msg.payload.result1<=39) && (P===0) && (K===2)) {\n \n msg.payload.result1 = 'АВВГ 1х4';\n} else if ((msg.payload.result1<=48) && (P===0) && (K===2)) {\n \n msg.payload.result1 = 'АВВГ 1х6';\n} else if ((msg.payload.result1<=21) && (P===1) && (K===3)) {\n \n msg.payload.result1 = 'АВВГ 3х2,5';\n} else if ((msg.payload.result1<=29) && (P===1) && (K===3)) {\n \n msg.payload.result1 = 'АВВГ 3х4';\n} else if ((msg.payload.result1<=37) && (P===1) && (K===3)) {\n \n msg.payload.result1 = 'АВВГ 3х6';\n} else if ((msg.payload.result1<=28) && (P===0) && (K===3)) {\n \n msg.payload.result1 = 'АВВГ 3х2,5';\n} else if ((msg.payload.result1<=37) && (P===0) && (K===3)) {\n \n msg.payload.result1 = 'АВВГ 3х4';\n} else if ((msg.payload.result1<=44) && (P===0) && (K===3)) {\n \n msg.payload.result1 = 'АВВГ 3х6';\n} else {\n msg.payload.result1 = 'not';\n \n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":220,"wires":[["b58f4ef85dcba712"]]},{"id":"e657941b9716b9c3","type":"join","z":"cb59f7c8f4c017c7","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":370,"y":220,"wires":[["9084d92b3c8f6ca7","11592e1215695baa"]]},{"id":"11592e1215695baa","type":"function","z":"cb59f7c8f4c017c7","name":"","func":"const Pн = msg.payload.topic1.Pн;\nconst Uн = msg.payload.topic1.Uн;\nconst cosf = msg.payload.topic1.cosf;\nconst kpd = msg.payload.topic1.kpd;\nP = msg.payload.topic2;\nK = msg.payload.topic3;\n\nmsg.payload.result = Math.round((Pн*1000/(Math.sqrt(3) * Uн * cosf * kpd)));\n\nif (( msg.payload.result1<=22) && (P===1) && (K===2)) {\n \n msg.payload.result1 = 'АВВГ 1х1,5';\n} else if ((msg.payload.result1<=30) && (P===1) && (K===2)) {\n \n msg.payload.result1 = 'АВВГ 1х2,5';\n} else if ((msg.payload.result1<=39) && (P===1) && (K===2)) {\n \n msg.payload.result1 = 'АВВГ 1х4';\n} else if ((msg.payload.result1<=30) && (P===0) && (K===2)) {\n \n msg.payload.result1 = 'АВВГ 1х1,5';\n} else if ((msg.payload.result1<=39) && (P===0) && (K===2)) {\n \n msg.payload.result1 = 'АВВГ 1х2,5';\n} else if ((msg.payload.result1<=50) && (P===0) && (K===2)) {\n \n msg.payload.result1 = 'АВВГ 1х4';\n} else if ((msg.payload.result1<=21) && (P===1) && (K===3)) {\n \n msg.payload.result1 = 'АВВГ 3х1,5';\n} else if ((msg.payload.result1<=27) && (P===1) && (K===3)) {\n \n msg.payload.result1 = 'АВВГ 3х2,5';\n} else if ((msg.payload.result1<=36) && (P===1) && (K===3)) {\n \n msg.payload.result1 = 'АВВГ 3х4';\n} else if ((msg.payload.result1<=27) && (P===0) && (K===3)) {\n \n msg.payload.result1 = 'АВВГ 3х1,5';\n} else if ((msg.payload.result1<=36) && (P===0) && (K===3)) {\n \n msg.payload.result1 = 'АВВГ 3х2,5';\n} else if ((msg.payload.result1<=47) && (P===0) && (K===3)) {\n \n msg.payload.result1 = 'АВВГ 3х4';\n} else {\n msg.payload.result1 = 'not';\n \n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":280,"wires":[["47acfee19968d659"]]},{"id":"47acfee19968d659","type":"ui_text","z":"cb59f7c8f4c017c7","group":"346f3afd.14dd56","order":5,"width":0,"height":0,"name":"","label":"Сopper :","format":"{{msg.payload.result2}}","layout":"col-center","className":"","x":660,"y":360,"wires":[]},{"id":"96580ce7f2507353","type":"ui_dropdown","z":"cb59f7c8f4c017c7","name":"","label":"Amount","tooltip":"","place":"Select option","group":"346f3afd.14dd56","order":2,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"one","value":"2","type":"str"},{"label":"many","value":"3","type":"str"}],"payload":"","topic":"topic3","topicType":"str","className":"","x":160,"y":220,"wires":[["e657941b9716b9c3"]]},{"id":"346f3afd.14dd56","type":"ui_group","name":"Default","tab":"445e350b.bd700c","order":1,"disp":true,"width":"6","collapse":false},{"id":"445e350b.bd700c","type":"ui_tab","name":"Home","icon":"dashboard","order":6,"disabled":false,"hidden":false}]