[{"id":"7d38c99a.c55db8","type":"ui_template","z":"69370bfa.d956d4","group":"daa8e254.3e36c","name":"Two dimension array table","order":1,"width":"24","height":"16","format":"\n\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\t\n \t\t\n\t\t\t\n \t\t\n \t\n
Start TimeStop TimeStart CounterStop CounterRunning TimeQuantity ProducedThroughputStop due to the machine ?Stop descriptionVolontary stop ?Number of RejectsUnintentional Stop TimeVolontary Stop TimeComments
{{item}}
\n\n\n\n\n","storeOutMessages":false,"fwdInMessages":true,"templateScope":"local","x":330,"y":1060,"wires":[["483ce6ce.eeb5c8","8b28323a.c3e71","108b8bb9.aa0294"]]},{"id":"e3ec5c6c.08d7e","type":"function","z":"69370bfa.d956d4","name":"Follow-Up Table Update","func":"var arr = flow.get('arr')||[];\nvar machine_status = flow.get('machine_status')||0;\nvar machine_current_count = flow.get('machine_current_count')||0;\n\n\nvar date = new Date();\n// Hours part from the timestamp\nvar hours = date.getHours();\n// Minutes part from the timestamp\nvar minutes = \"0\" + date.getMinutes();\n// Seconds part from the timestamp\nvar seconds = \"0\" + date.getSeconds();\nvar seconds2 = seconds+10;\n\n// Will display time in 10:30:23 format\nvar formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);\n\nif (msg.topic === \"D12\") //Start\n{\n if(arr.length !== 0) //If it's the first machine start, no calculation of machine stop time\n {\n var time1=arr[arr.length - 1][1].split(\":\");\n var time2=formattedTime.split(\":\");\n var duration=(parseInt(time2[2])+parseInt(time2[1])*60+parseInt(time2[0])*3600)-(parseInt(time1[2])+parseInt(time1[1])*60+parseInt(time1[0])*3600);\n var stop_time=Math.floor(duration/ 3600)+ ':' + Math.floor((duration % 3600) / 60)+ ':' + Math.floor(duration % 3600) % 60;\n arr[arr.length - 1]=[arr[arr.length - 1][0],arr[arr.length - 1][1],arr[arr.length - 1][2],arr[arr.length - 1][3],arr[arr.length - 1][4],arr[arr.length - 1][5],arr[arr.length - 1][6],arr[arr.length - 1][7],arr[arr.length - 1][8],arr[arr.length - 1][9],arr[arr.length - 1][10],stop_time,arr[arr.length - 1][12],arr[arr.length - 1][13]];\n }\n arr.push([formattedTime,\"-\",machine_current_count,\"-\",\"-\",\"-\",\"-\",\"-\",\"-\",\"-\",\"-\",\"-\",\"-\",\"-\"]);\n}\nelse if (msg.topic === \"D11\") //Stop\n{\n var time1=arr[arr.length - 1][0].split(\":\");\n var time2=formattedTime.split(\":\");\n var duration=(parseInt(time2[2])+parseInt(time2[1])*60+parseInt(time2[0])*3600)-(parseInt(time1[2])+parseInt(time1[1])*60+parseInt(time1[0])*3600);\n var running_time=Math.floor(duration/ 3600)+ ':' + Math.floor((duration % 3600) / 60)+ ':' + Math.floor(duration % 3600) % 60;\n var qty = machine_current_count-arr[arr.length - 1][2];\n var throughput = Math.round((qty/duration)*3600);\n //Edit the last line of the array with new calculated values from above, and pre-filled cells from machine start\n arr[arr.length - 1]=[arr[arr.length - 1][0],formattedTime,arr[arr.length - 1][2],machine_current_count,running_time,qty,throughput,\"Yes\",\"-\",\"No\",0,\"-\",\"-\",\"-\"];\n}\n\nmsg.payload = arr;\nflow.set('arr',arr);\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":80,"wires":[["4c97c995.861ea8"]]},{"id":"cc995d1.e8373a","type":"function","z":"69370bfa.d956d4","name":"Clear Follow-Up","func":"var arr = flow.get('arr')||[];\n//var qty = flow.get('qty')||0;\n\nif (msg.payload === \"Yes\")\n{\n flow.set('arr',[]);\n flow.set('machine_start_time',0);\n flow.set('machine_stop_time',0);\n flow.set('machine_running',0);\n flow.set('machine_stopped',0);\n flow.set('machine_stop_nb',0);\n flow.set('machine_current_count',0);\n flow.set('machine_status',0);\n flow.set('machine_count',0);\n flow.set('run_start',0);\n flow.set('machine_cutter',0);\n flow.set('run_qty',24000);\n flow.set('run',\"Test Run\");\n flow.set('filename',0);\n flow.set('buffer', 0);\n flow.set('total', 0);\n flow.set('machine_total_running_time',0);\n msg.payload=[];\n return msg;\n}","outputs":1,"noerr":0,"x":420,"y":880,"wires":[["4c97c995.861ea8","f7df1cef.add69","b8229f06.5bd44","83fb5c7a.6acd","d4bfac6e.2d42e","a8442851.d1a7c8","e4031470.4b4ed8"]]},{"id":"4c97c995.861ea8","type":"template","z":"69370bfa.d956d4","name":"CSS","field":"style","fieldType":"msg","format":"html","syntax":"mustache","template":"table.IMTTable {\n font-family: \"Arial Black\", Gadget, sans-serif;\n border: 2px solid #000000;\n background-color: #EDB583;\n width: 100%;\n height: 200px;\n text-align: center;\n border-collapse: collapse;\n}\ntable.IMTTable td, table.IMTTable th {\n border: 1px solid #4A4A4A;\n padding: 3px 3px;\n}\ntable.IMTTable tbody td {\n font-size: 13px;\n color: #000000;\n}\ntable.IMTTable tr:nth-child(even) {\n background: #C4C4C4;\n}\ntable.IMTTable thead {\n background: #ED7900;\n background: -moz-linear-gradient(top, #f19a40 0%, #ee8619 66%, #ED7900 100%);\n background: -webkit-linear-gradient(top, #f19a40 0%, #ee8619 66%, #ED7900 100%);\n background: linear-gradient(to bottom, #f19a40 0%, #ee8619 66%, #ED7900 100%);\n border-bottom: 3px solid #000000;\n}\ntable.IMTTable thead th {\n font-size: 15px;\n font-weight: bold;\n color: #E6E6E6;\n text-align: center;\n border-left: 3px solid #000000;\n}\ntable.IMTTable thead th:first-child {\n border-left: none;\n}\n\ntable.IMTTable tfoot td {\n font-size: 12px;\n}","output":"str","x":130,"y":1060,"wires":[["7d38c99a.c55db8"]]},{"id":"1b67ba9d.51afc5","type":"ui_text_input","z":"69370bfa.d956d4","name":"Start Time","label":"","group":"bfff7fb3.91e91","order":2,"width":"18","height":"1","passthru":true,"mode":"text","delay":300,"topic":"Start Time","x":730,"y":1140,"wires":[["ab1acfb5.17f7"]]},{"id":"58f00113.3dbf","type":"ui_text_input","z":"69370bfa.d956d4","name":"Stop Time","label":"","group":"bfff7fb3.91e91","order":4,"width":"18","height":"1","passthru":true,"mode":"text","delay":300,"topic":"Stop Time","x":720,"y":1180,"wires":[["ab1acfb5.17f7"]]},{"id":"47d65dcd.661be4","type":"ui_text_input","z":"69370bfa.d956d4","name":"Start Counter","label":"","group":"bfff7fb3.91e91","order":6,"width":"18","height":"1","passthru":true,"mode":"number","delay":"50","topic":"Start Counter","x":730,"y":1220,"wires":[["ab1acfb5.17f7"]]},{"id":"840847e8.c82fe8","type":"ui_text_input","z":"69370bfa.d956d4","name":"Stop Counter","label":"","group":"bfff7fb3.91e91","order":8,"width":"18","height":"1","passthru":true,"mode":"number","delay":"50","topic":"Stop Counter","x":730,"y":1260,"wires":[["ab1acfb5.17f7"]]},{"id":"f433ca9.96beb38","type":"ui_text_input","z":"69370bfa.d956d4","name":"Running Time","label":"","group":"bfff7fb3.91e91","order":10,"width":"18","height":"1","passthru":true,"mode":"text","delay":300,"topic":"Running Time","x":740,"y":1300,"wires":[["ab1acfb5.17f7"]]},{"id":"cab57184.fadcf","type":"ui_text_input","z":"69370bfa.d956d4","name":"Quantity Produced","label":"","group":"bfff7fb3.91e91","order":12,"width":"18","height":"1","passthru":true,"mode":"number","delay":300,"topic":"Quantity Produced","x":750,"y":1340,"wires":[["ab1acfb5.17f7"]]},{"id":"483ce6ce.eeb5c8","type":"function","z":"69370bfa.d956d4","name":"","func":"if (msg.topic!=\"D12\" && msg.topic!=\"D11\" && msg.topic!=\"Clear\" && msg.topic!=\"Save\")\n{\nvar id = {};\nid.topic=\"Index\";\nid.enabled=true;\nvar arr = flow.get('arr')||[];\nfor (var i = 0; i < arr.length; i++)\n{\n if (arr[i][0]=== msg.payload[0])\n id.payload = i;\n }\n\n\nvar m1 = {};\nm1.payload=msg.payload[0];\nvar m2 = {};\nm2.payload=msg.payload[1];\nvar m3 = {};\nm3.payload=msg.payload[2];\nvar m4 = {};\nm4.payload=msg.payload[3];\nvar m5 = {};\nm5.payload=msg.payload[4];\nvar m6 = {};\nm6.payload=msg.payload[5];\nvar m7 = {};\nm7.payload=msg.payload[6];\nvar m8 = {};\nm8.payload=msg.payload[7];\nvar m9 = {};\nm9.payload=msg.payload[8];\nvar m10 = {};\nm10.payload=msg.payload[9];\nvar m11 = {};\nm11.payload=msg.payload[10];\nvar m12 = {};\nm12.topic=\"Unintentional Stop Time\";\nm12.time=msg.payload[11];\nvar m13 = {};\nm13.topic=\"Volontary Stop Time\";\nm13.time=msg.payload[12];\nvar m14 = {};\nm14.payload=msg.payload[13];\n\nreturn [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,id];\n}","outputs":15,"noerr":0,"x":190,"y":1380,"wires":[["3684bbda.650474"],["756b2905.1eb848"],["43f34ed7.be75b"],["de117945.36e1a8"],["940b67a4.e582e8"],["f6dbcf41.10eb"],["c3e83cde.c3ed2"],["2514e80a.e5ecc8"],["3d479e9d.1e3b72"],[],["48853be7.e77d94"],["80809cda.83427"],["1d579bef.1de8e4"],["df10d7f7.d6d2b8"],["ab1acfb5.17f7","514232b2.195a8c"]]},{"id":"15a9c75f.e43809","type":"ui_button","z":"69370bfa.d956d4","name":"Save","group":"bfff7fb3.91e91","order":29,"width":0,"height":0,"passthru":false,"label":"Save Change","color":"","bgcolor":"","icon":"","payload":"Ok","payloadType":"str","topic":"Save","x":710,"y":1700,"wires":[["ab1acfb5.17f7","e4031470.4b4ed8"]]},{"id":"ab1acfb5.17f7","type":"join","z":"69370bfa.d956d4","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"1","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":970,"y":1780,"wires":[["f63ddf4.017552"]]},{"id":"f63ddf4.017552","type":"switch","z":"69370bfa.d956d4","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"Save","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1110,"y":1780,"wires":[["3c4f9ac2.53c476"]]},{"id":"2d8ecb06.06f9e4","type":"ui_text_input","z":"69370bfa.d956d4","name":"Throughput","label":"","group":"bfff7fb3.91e91","order":14,"width":"18","height":"1","passthru":true,"mode":"number","delay":300,"topic":"Throughput","x":730,"y":1380,"wires":[["ab1acfb5.17f7"]]},{"id":"dbce0d86.bccca","type":"ui_text_input","z":"69370bfa.d956d4","name":"Description","label":"","group":"bfff7fb3.91e91","order":18,"width":"18","height":"1","passthru":true,"mode":"text","delay":300,"topic":"Description","x":730,"y":1460,"wires":[["ab1acfb5.17f7"]]},{"id":"d7ce195f.eb4b18","type":"ui_text_input","z":"69370bfa.d956d4","name":"Rejects Number","label":"","group":"bfff7fb3.91e91","order":22,"width":"18","height":"1","passthru":true,"mode":"number","delay":"50","topic":"Rejects Number","x":740,"y":1540,"wires":[["ab1acfb5.17f7"]]},{"id":"ccb60f0.4111df","type":"ui_text_input","z":"69370bfa.d956d4","name":"Comments","label":"","group":"bfff7fb3.91e91","order":28,"width":"18","height":"1","passthru":true,"mode":"text","delay":300,"topic":"Comments","x":730,"y":1660,"wires":[["ab1acfb5.17f7"]]},{"id":"63f7d84f.477188","type":"ui_text","z":"69370bfa.d956d4","group":"bfff7fb3.91e91","order":1,"width":"6","height":"1","name":"","label":"Start Time","format":"{{msg.payload}}","layout":"row-spread","x":990,"y":1140,"wires":[]},{"id":"da5a14af.e470e8","type":"ui_text","z":"69370bfa.d956d4","group":"bfff7fb3.91e91","order":3,"width":"6","height":"1","name":"","label":"Stop Time","format":"{{msg.payload}}","layout":"row-spread","x":980,"y":1180,"wires":[]},{"id":"7b9e47d0.13e458","type":"ui_text","z":"69370bfa.d956d4","group":"bfff7fb3.91e91","order":5,"width":"6","height":"1","name":"","label":"Start Counter","format":"{{msg.payload}}","layout":"row-spread","x":990,"y":1220,"wires":[]},{"id":"89633479.486cc8","type":"ui_text","z":"69370bfa.d956d4","group":"bfff7fb3.91e91","order":7,"width":"6","height":"1","name":"","label":"Stop Counter","format":"{{msg.payload}}","layout":"row-spread","x":990,"y":1260,"wires":[]},{"id":"bb8434ce.aee248","type":"ui_text","z":"69370bfa.d956d4","group":"bfff7fb3.91e91","order":9,"width":"6","height":"1","name":"","label":"Running Time","format":"{{msg.payload}}","layout":"row-spread","x":1000,"y":1300,"wires":[]},{"id":"f7650d88.e13b7","type":"ui_text","z":"69370bfa.d956d4","group":"bfff7fb3.91e91","order":11,"width":"6","height":"1","name":"","label":"Quantity Produced","format":"{{msg.payload}}","layout":"row-spread","x":1010,"y":1340,"wires":[]},{"id":"1d0f7db9.511182","type":"ui_text","z":"69370bfa.d956d4","group":"bfff7fb3.91e91","order":13,"width":"6","height":"1","name":"","label":"Throughput","format":"{{msg.payload}}","layout":"row-spread","x":990,"y":1380,"wires":[]},{"id":"c10bb2c4.a6ffe","type":"ui_text","z":"69370bfa.d956d4","group":"bfff7fb3.91e91","order":15,"width":"6","height":"1","name":"","label":"Machine Stop","format":"{{msg.payload}}","layout":"row-spread","x":1000,"y":1420,"wires":[]},{"id":"4fd593a3.069c0c","type":"ui_text","z":"69370bfa.d956d4","group":"bfff7fb3.91e91","order":17,"width":"6","height":"1","name":"","label":"Description","format":"{{msg.payload}}","layout":"row-spread","x":990,"y":1460,"wires":[]},{"id":"d95daf38.c7634","type":"ui_text","z":"69370bfa.d956d4","group":"bfff7fb3.91e91","order":19,"width":"6","height":"1","name":"","label":"Volontary Stop","format":"{{msg.payload}}","layout":"row-spread","x":1000,"y":1500,"wires":[]},{"id":"614e9e77.c76d5","type":"ui_text","z":"69370bfa.d956d4","group":"bfff7fb3.91e91","order":21,"width":"6","height":"1","name":"","label":"Rejects Number","format":"{{msg.payload}}","layout":"row-spread","x":1000,"y":1540,"wires":[]},{"id":"f478b49f.602d08","type":"ui_text","z":"69370bfa.d956d4","group":"bfff7fb3.91e91","order":23,"width":"6","height":"1","name":"","label":"Unintentional Stop Time","format":"{{msg.payload}}","layout":"row-spread","x":1030,"y":1580,"wires":[]},{"id":"ca9c836f.826f8","type":"ui_text","z":"69370bfa.d956d4","group":"bfff7fb3.91e91","order":25,"width":"6","height":"1","name":"","label":"Volontary Stop Time","format":"{{msg.payload}}","layout":"row-spread","x":1020,"y":1620,"wires":[]},{"id":"8cf24bd1.2665f8","type":"ui_text","z":"69370bfa.d956d4","group":"bfff7fb3.91e91","order":27,"width":"6","height":"1","name":"","label":"Comments","format":"{{msg.payload}}","layout":"row-spread","x":990,"y":1660,"wires":[]},{"id":"983afa06.17ab68","type":"change","z":"69370bfa.d956d4","name":"","rules":[{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":1820,"wires":[["15a9c75f.e43809"]]},{"id":"aa9ce1b5.9b966","type":"csv","z":"69370bfa.d956d4","name":"","sep":",","hdrin":false,"hdrout":true,"multi":"one","ret":"\\n","temp":"Start Time, Stop Time, Start Counter, Stop Counter, Running Time, Quantity Produced, Throughput, Stop due to the machine, Stop description, Volontary Stop, Number of Rejects, Unintentional Stop Time, Volontary Stop Time, Comments, Save","skip":"0","x":1210,"y":1060,"wires":[["97d9522c.f28c3"]]},{"id":"ae6b2d3f.e16fe","type":"function","z":"69370bfa.d956d4","name":"Follow-Up Array Modification Save","func":"var arr = flow.get('arr')||[];\nvar i=msg.payload[\"Index\"];\narr[i][0]=msg.payload[\"Start Time\"];\narr[i][1]=msg.payload[\"Stop Time\"];\narr[i][2]=msg.payload[\"Start Counter\"];\narr[i][3]=msg.payload[\"Stop Counter\"];\narr[i][4]=msg.payload[\"Running Time\"];\narr[i][5]=msg.payload[\"Quantity Produced\"];\narr[i][6]=msg.payload.Throughput;\narr[i][7]=msg.payload[\"Machine Stop\"]\narr[i][8]=msg.payload.Description;\narr[i][9]=msg.payload[\"Volontary Stop\"];\narr[i][10]=msg.payload[\"Rejects Number\"];\narr[i][11]=msg.payload[\"Unintentional Stop Time\"];\narr[i][12]=msg.payload[\"Volontary Stop Time\"];\narr[i][13]=msg.payload.Comments;\nflow.set('arr',arr);\nmsg.payload=arr;\nreturn msg;","outputs":1,"noerr":0,"x":1560,"y":1780,"wires":[["4c97c995.861ea8"]]},{"id":"b86dfca0.5c183","type":"ui_button","z":"69370bfa.d956d4","name":"Clear","group":"405b6b69.551d34","order":29,"width":0,"height":0,"passthru":false,"label":"Clear Follow-Up & Reset","color":"","bgcolor":"","icon":"","payload":"Are you sure you want to clear and reset all the data?","payloadType":"str","topic":"Clear","x":130,"y":1140,"wires":[["31e5dcd.8ed5a24"]]},{"id":"31e5dcd.8ed5a24","type":"ui_toast","z":"69370bfa.d956d4","position":"dialog","displayTime":"3","highlight":"","outputs":1,"ok":"Yes","cancel":"Cancel","topic":"","name":"Confirm","x":280,"y":1140,"wires":[["cc995d1.e8373a"]]},{"id":"6f57ff7.7d2ab","type":"IoT2000-gpio-din","z":"69370bfa.d956d4","name":"Start - D12","pin":"12","updateInterval":"10","x":80,"y":60,"wires":[["81f4e70a.d420b8","46c91e30.c15ff"]]},{"id":"5e483400.39696c","type":"IoT2000-gpio-din","z":"69370bfa.d956d4","name":"Stop - D11","pin":"11","updateInterval":"10","x":80,"y":100,"wires":[["46c91e30.c15ff","81f4e70a.d420b8"]]},{"id":"a3efc12e.d9dd8","type":"IoT2000-gpio-din","z":"69370bfa.d956d4","name":"Cutter- D10","pin":"10","updateInterval":"10","x":90,"y":140,"wires":[["df127b1c.828408","81f4e70a.d420b8"]]},{"id":"46c91e30.c15ff","type":"function","z":"69370bfa.d956d4","name":"Machine Status Managment","func":"var machine_status = flow.get('machine_status')||0;\nvar run_start = flow.get('run_start')||0;\nvar machine_start_time = flow.get('machine_start_time')||0;\nvar machine_stop_time = flow.get('machine_stop_time')||0;\nvar machine_stop_nb = flow.get('machine_stop_nb')||0;\nvar machine_running = flow.get('machine_running')||0;\nvar machine_stopped = flow.get('machine_stopped')||0;\nvar machine_count = flow.get('machine_count')||0;\nvar machine_total_running_time = flow.get('machine_total_running_time')||0;\nvar dateNow = new Date().getTime();\n\nif (msg.topic === \"D12\" && msg.payload === 1 && machine_status===0)\n{\n flow.set(\"machine_status\",1);\n flow.set('machine_start_time',dateNow);\n msg.payload=1;\n msg.machine_stop_nb=machine_stop_nb;\n if (machine_running !== 0)\n {\n var timedif =((dateNow-machine_stop_time)/1000);\n machine_total_running_time+=timedif;\n machine_stopped+=timedif;\n flow.set('machine_stopped',machine_stopped);\n flow.set('machine_count',dateNow);\n flow.set('machine_total_running_time',machine_total_running_time);\n }\n else\n {\n var now = new Date();\n run_start = now.toLocaleTimeString().substring(0,8);\n flow.set(\"run_start\",run_start);\n var run = flow.get('run')||0;\n var Run_Date = new Date().toString();\n flow.set('filename',\"/home/root/IoTFolder/FAT/\"+run +\"_\"+ now.toLocaleDateString().replace('/','-')+\"_\"+run_start+\".csv\");\n }\n msg.run_start=run_start;\n return msg;\n}\nelse if (msg.topic === \"D11\" && msg.payload === 1 && machine_status===1)\n{\n if (machine_running !== 0)\n {\n machine_running+=((dateNow-machine_count)/1000); \n }\n else\n {\n machine_running+=((dateNow-run_start)/1000);\n }\n machine_running+=((dateNow-machine_count)/1000);\n flow.set(\"machine_status\",0);\n flow.set('machine_stop_time',dateNow);\n flow.set('machine_stop_nb',++machine_stop_nb);\n flow.set('machine_count',dateNow);\n flow.set('machine_running',machine_running);\n msg.payload=0;\n msg.machine_stop_nb=machine_stop_nb;\n msg.run_start=run_start;\n return msg;\n}","outputs":1,"noerr":0,"x":360,"y":80,"wires":[["e3ec5c6c.08d7e","6ba78bb5.2fb234","2f31b800.f9c958","fcb9d76c.557068"]]},{"id":"df127b1c.828408","type":"function","z":"69370bfa.d956d4","name":"Cycle Managment","func":"var machine_status = flow.get(\"machine_status\")||0;\n\nif (machine_status === 1)\n{\n return msg;\n}\nelse if (machine_status === 0)\n{\n return 0;\n}","outputs":1,"noerr":0,"x":330,"y":140,"wires":[["f1dac4d0.11ff78"]]},{"id":"f1dac4d0.11ff78","type":"function","z":"69370bfa.d956d4","name":"Throughput & Output Calculation","func":"var machine_count = flow.get('machine_count')||0;\nvar machine_start = flow.get('machine_start')||0;\nvar machine_start_time = flow.get('machine_start_time')||0;\nvar machine_stop_time = flow.get('machine_stop_time')||0;\nvar machine_current_count = flow.get('machine_current_count')||0;\nvar machine_stop_nb = flow.get('machine_stop_nb')||0;\nvar machine_cutter = flow.get('machine_cutter')||0;\nvar run_qty = flow.get('run_qty')||24000;\nvar machine_total_running_time = flow.get('machine_total_running_time')||0;\nvar machine_running = flow.get('machine_running')||0;\n\nvar dateNow = new Date().getTime();\n\nif (msg.payload === 1)\n{\n if (machine_count === 0)\n {\n //msg.payload = Math.round((3600/((dateNow - machine_start)/1000))*8*machine_cutter); If camera is reseting the cutter count\n msg.payload = Math.round((3600/((dateNow - machine_start_time)/1000))*8);\n machine_total_running_time+=((dateNow - machine_start_time)/1000);\n machine_running+=((dateNow-machine_start_time)/1000);\n }\n else\n {\n //msg.payload = ((dateNow - machine_count)/1000)/8*3600;\n //msg.payload = Math.round((3600/((dateNow - machine_count)/1000))*8*machine_cutter); If camera is reseting the cutter count\n msg.payload = Math.round((3600/((dateNow - machine_count)/1000))*8);\n machine_total_running_time+=((dateNow - machine_count)/1000);\n machine_running+=((dateNow-machine_count)/1000);\n }\n //machine_current_count+=8*machine_cutter; If camera is reseting the cutter count\n machine_current_count+=8;\n flow.set('machine_count',dateNow);\n flow.set('machine_current_count',machine_current_count);\n flow.set('machine_cutter',0);\n flow.set('machine_total_running_time',machine_total_running_time);\n flow.set('machine_running',machine_running);\n msg.machine_current_count=machine_current_count;\n msg.machine_stop_nb=machine_stop_nb;\n msg.remaining=run_qty-machine_current_count;\n msg.run_throughput=Math.round((machine_current_count/machine_total_running_time)*3600);\n msg.current_run_time=Math.floor((dateNow-machine_start_time)/1000);\n return msg;\n}\n\n \n ","outputs":1,"noerr":0,"x":660,"y":140,"wires":[["43049fdb.2f173","496341cd.7d00e","c990393f.641438","ffd83bc2.c10b38","25381582.fc602a","e5687ee9.e54da","a9441608.246e18","f0d74b83.157308"]]},{"id":"a3d31983.c3eb58","type":"comment","z":"69370bfa.d956d4","name":"INPUTS","info":"","x":80,"y":20,"wires":[]},{"id":"e9bec7e.d721438","type":"comment","z":"69370bfa.d956d4","name":"FUNCTIONS","info":"","x":630,"y":20,"wires":[]},{"id":"3a05c92f.60cf16","type":"comment","z":"69370bfa.d956d4","name":"PERFORMANCE DASHBOARD","info":"","x":1270,"y":20,"wires":[]},{"id":"5e117693.f35a48","type":"comment","z":"69370bfa.d956d4","name":"Group 1","info":"","x":1200,"y":60,"wires":[]},{"id":"6ba78bb5.2fb234","type":"ui_switch","z":"69370bfa.d956d4","name":"","label":"Machine Status","group":"9f653648.7e6658","order":2,"width":"4","height":"1","passthru":false,"decouple":"true","topic":"","style":"","onvalue":"1","onvalueType":"num","onicon":"fa-play","oncolor":"green","offvalue":"0","offvalueType":"num","officon":"fa-stop","offcolor":"red","x":1220,"y":100,"wires":[[]]},{"id":"c990393f.641438","type":"function","z":"69370bfa.d956d4","name":"Last 10min rolling average","func":"//Function to define the average of all payload values coming-in over the specified time_range\nconst time_range = 10 * 60 * 1000; //Time_range in milliseconds\nlet buffer = flow.get('buffer') || [];\t//Reload the buffer\nlet total = flow.get('total') || 0;\t\t//Reload the latest average value so far\nlet now = new Date();\t\t\t\t\t\t//Assign the current time to the now variable\nlet value = Number(msg.payload);\t\t\t//Assign the incoming payload to the value variable\n//Remove any samples that are too old from the buffer array\nwhile (buffer[0] && buffer[0].timestamp < now - time_range)\n{\n //Remove oldest sample from array and total\n total -= buffer[0].value;\n buffer.shift();\n}\n//Add the new sample to the end of the \nbuffer.push({timestamp: now, value: value});\ntotal += value;\n\nflow.set('buffer', buffer);\nflow.set('total', total);\nmsg.payload = Math.floor(total/buffer.length);\nmsg.topic = 'RollingAverage';\nreturn msg;","outputs":1,"noerr":0,"x":940,"y":280,"wires":[["535257a5.7a67e8","dffc71fb.970c"]]},{"id":"43049fdb.2f173","type":"ui_gauge","z":"69370bfa.d956d4","name":"","group":"9f653648.7e6658","order":3,"width":"8","height":"4","gtype":"gage","title":"Instant Throughput","label":"uph","format":"{{value}}","min":0,"max":"4750","colors":["#f30f0f","#e6e600","#00b500"],"seg1":"","seg2":"","x":1230,"y":140,"wires":[]},{"id":"f0217957.7fae88","type":"function","z":"69370bfa.d956d4","name":"Zero Injector","func":"// Injects zeros while the machine is stopped\n//let interval = 10 * 1000; // interval at which to inject\n//let timerId = context.get(\"timerId\") || 0;\nvar machine_status = flow.get(\"machine_status\")||0;\nvar machine_stop_time = flow.get('machine_stop_time')||0;\nvar seconds;\n\nif (machine_status === 0 && Math.round(machine_stop_time/1000)>=20)\n{\n msg.payload=0;\n return msg;\n}","outputs":1,"noerr":0,"x":310,"y":280,"wires":[["c990393f.641438","43049fdb.2f173","8cc05def.a19c3"]]},{"id":"7115b356.5a2f0c","type":"inject","z":"69370bfa.d956d4","name":"20s Timestamp","topic":"","payload":"0","payloadType":"num","repeat":"20","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":280,"wires":[["f0217957.7fae88"]]},{"id":"535257a5.7a67e8","type":"ui_chart","z":"69370bfa.d956d4","name":"","group":"9f653648.7e6658","order":6,"width":"8","height":"4","label":"Last 10min Rolling Average","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"bezier","nodata":"","dot":false,"ymin":"0","ymax":"","removeOlder":"10","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#ff7f0e","#2d2c9c","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":1260,"y":260,"wires":[[],[]]},{"id":"dffc71fb.970c","type":"ui_text","z":"69370bfa.d956d4","group":"9f653648.7e6658","order":7,"width":"8","height":"1","name":"Last 10min Rolling Average","label":"","format":"{{msg.payload}} uph","layout":"row-center","x":1260,"y":300,"wires":[]},{"id":"ffd83bc2.c10b38","type":"ui_chart","z":"69370bfa.d956d4","name":"","group":"6b0c3e1c.426de","order":1,"width":"8","height":"4","label":"Run Throughput","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"step","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"8","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#ff7f0e","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":1220,"y":460,"wires":[[],[]]},{"id":"67e93a7d.e18384","type":"ui_chart","z":"69370bfa.d956d4","name":"Run Machine Availability","group":"6b0c3e1c.426de","order":5,"width":"8","height":"3","label":"Run Machine Availability","chartType":"pie","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#f30f0f","#00b500","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":1250,"y":580,"wires":[[],[]]},{"id":"9b7401b7.b440c","type":"inject","z":"69370bfa.d956d4","name":"Graph Reset","topic":"","payload":"[]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":320,"wires":[["67e93a7d.e18384","ffd83bc2.c10b38","535257a5.7a67e8"]]},{"id":"c01e9af8.dfea68","type":"ui_text","z":"69370bfa.d956d4","group":"6b0c3e1c.426de","order":6,"width":"8","height":"1","name":"Run Machine Availability","label":"","format":"{{msg.payload}} %","layout":"row-center","x":1250,"y":620,"wires":[]},{"id":"496341cd.7d00e","type":"ui_text","z":"69370bfa.d956d4","group":"9f653648.7e6658","order":4,"width":"8","height":"1","name":"Produced Quantity","label":"Produced Quantity","format":"{{msg.machine_current_count}} antenna","layout":"row-spread","x":1230,"y":180,"wires":[]},{"id":"f0d74b83.157308","type":"function","z":"69370bfa.d956d4","name":"Run Machine Performance","func":"var machine_running = flow.get('machine_running')||0;\nvar machine_stopped = flow.get('machine_stopped')||0;\nvar machine_stop_nb = flow.get('machine_stop_nb')||0;\n\nvar out1={topic:'Stop time', payload:machine_stopped};\nvar out2={topic:'Running time', payload:machine_running};\nvar out3={topic:'Run Availability',payload:Math.floor((machine_running)/(machine_running+machine_stopped)*100)}; \nvar out4={topic:'MTTR',payload:(machine_stop_nb === 0 || isNaN(machine_stop_nb))? 0 : machine_stopped/machine_stop_nb};\nvar out5={topic:'MTBR',payload:(machine_stop_nb === 0 || isNaN(machine_stop_nb))? 0 : machine_running/machine_stop_nb};\n\nreturn [out1,out2,out3,out4,out5];","outputs":5,"noerr":0,"x":700,"y":760,"wires":[["67e93a7d.e18384","c98e9347.52dc1"],["67e93a7d.e18384","23f48d9e.fa0402"],["c01e9af8.dfea68"],["c8615afd.3f6658"],["fa6d81a3.a67b3"]]},{"id":"d6688757.94ec38","type":"ui_text","z":"69370bfa.d956d4","group":"6b0c3e1c.426de","order":9,"width":"4","height":"1","name":"Run MTTR","label":"Run MTTR","format":"{{msg.text}}","layout":"row-spread","x":1210,"y":780,"wires":[]},{"id":"553e5881.59be68","type":"ui_text","z":"69370bfa.d956d4","group":"6b0c3e1c.426de","order":10,"width":"4","height":"1","name":"Run MTBR","label":"Run MTBR","format":"{{msg.text}}","layout":"row-spread","x":1210,"y":820,"wires":[]},{"id":"c8615afd.3f6658","type":"function","z":"69370bfa.d956d4","name":"Hours/Minutes/Seconds","func":"var numhours = Math.floor(msg.payload/ 3600);\nvar numminutes = Math.floor((msg.payload % 3600) / 60);\nvar numseconds = Math.floor(msg.payload % 3600) % 60;\n\nif(msg.payload >=3600)\n{\nmsg.text = numhours + \"h \" + numminutes + \"m \" + numseconds + \"s\"; \n}\nelse if(msg.payload >=60)\n{\nmsg.text = numminutes + \"m \" + numseconds + \"s\"; \n}\nelse\n{\nmsg.text = numseconds + \"s\";\n}\nreturn msg;","outputs":1,"noerr":0,"x":990,"y":780,"wires":[["d6688757.94ec38"]]},{"id":"fa6d81a3.a67b3","type":"function","z":"69370bfa.d956d4","name":"Hours/Minutes/Seconds","func":"var numhours = Math.floor(msg.payload/ 3600);\nvar numminutes = Math.floor((msg.payload % 3600) / 60);\nvar numseconds = Math.floor(msg.payload % 3600) % 60;\n\nif(msg.payload >=3600)\n{\nmsg.text = numhours + \"h \" + numminutes + \"m \" + numseconds + \"s\"; \n}\nelse if(msg.payload >=60)\n{\nmsg.text = numminutes + \"m \" + numseconds + \"s\"; \n}\nelse\n{\nmsg.text = numseconds + \"s\";\n}\nreturn msg;","outputs":1,"noerr":0,"x":990,"y":820,"wires":[["553e5881.59be68"]]},{"id":"2f31b800.f9c958","type":"ui_text","z":"69370bfa.d956d4","group":"6b0c3e1c.426de","order":4,"width":"4","height":"1","name":"Run Number of Stop","label":"Number of Stop","format":"{{msg.machine_stop_nb}}","layout":"row-spread","x":1240,"y":540,"wires":[]},{"id":"2a11ec00.5f9304","type":"comment","z":"69370bfa.d956d4","name":"Group 2","info":"","x":1200,"y":420,"wires":[]},{"id":"c07d10b5.09fa6","type":"ui_text","z":"69370bfa.d956d4","group":"6b0c3e1c.426de","order":7,"width":"4","height":"1","name":"Run Running Time","label":"Run Running Time","format":"{{msg.text}}","layout":"row-spread","x":1230,"y":700,"wires":[]},{"id":"e79bcfd.0bb963","type":"ui_text","z":"69370bfa.d956d4","group":"6b0c3e1c.426de","order":8,"width":"4","height":"1","name":"Run Stopped Time","label":"Run Stopped Time","format":"{{msg.text}}","layout":"row-spread","x":1230,"y":740,"wires":[]},{"id":"23f48d9e.fa0402","type":"function","z":"69370bfa.d956d4","name":"Hours/Minutes/Seconds","func":"var numhours = Math.floor(msg.payload/ 3600);\nvar numminutes = Math.floor((msg.payload % 3600) / 60);\nvar numseconds = Math.floor(msg.payload % 3600) % 60;\n\nif(msg.payload >=3600)\n{\nmsg.text = numhours + \"h \" + numminutes + \"m \" + numseconds + \"s\"; \n}\nelse if(msg.payload >=60)\n{\nmsg.text = numminutes + \"m \" + numseconds + \"s\"; \n}\nelse\n{\nmsg.text = numseconds + \"s\";\n}\nreturn msg;","outputs":1,"noerr":0,"x":990,"y":700,"wires":[["c07d10b5.09fa6"]]},{"id":"c98e9347.52dc1","type":"function","z":"69370bfa.d956d4","name":"Hours/Minutes/Seconds","func":"var numhours = Math.floor(msg.payload/ 3600);\nvar numminutes = Math.floor((msg.payload % 3600) / 60);\nvar numseconds = Math.floor(msg.payload % 3600) % 60;\n\nif(msg.payload >=3600)\n{\nmsg.text = numhours + \"h \" + numminutes + \"m \" + numseconds + \"s\"; \n}\nelse if(msg.payload >=60)\n{\nmsg.text = numminutes + \"m \" + numseconds + \"s\"; \n}\nelse\n{\nmsg.text = numseconds + \"s\";\n}\nreturn msg;","outputs":1,"noerr":0,"x":990,"y":740,"wires":[["e79bcfd.0bb963"]]},{"id":"3b047940.82a1e6","type":"comment","z":"69370bfa.d956d4","name":"FOLLOW_UP DASHBOARD","info":"","x":200,"y":1020,"wires":[]},{"id":"b8229f06.5bd44","type":"ui_dropdown","z":"69370bfa.d956d4","name":"Run Selection","label":"","place":"Select Run Number, otherwise it is a Test Run","group":"405b6b69.551d34","order":1,"width":"24","height":"1","passthru":true,"options":[{"label":"","value":"Run 1","type":"str"},{"label":"","value":"Run 2","type":"str"},{"label":"","value":"Run 3","type":"str"},{"label":"","value":"Run 4","type":"str"},{"label":"","value":"Run 5","type":"str"},{"label":"","value":"Run 6","type":"str"},{"label":"","value":"Run 7","type":"str"},{"label":"","value":"Test Run","type":"str"}],"payload":"","topic":"","x":160,"y":1100,"wires":[["9f3342a6.1fa0e"]]},{"id":"9f3342a6.1fa0e","type":"function","z":"69370bfa.d956d4","name":"Run Selection","func":"var run_qty = flow.get('run_qty')||24000;\nvar run = flow.get('run')||0;\nvar today = new Date();\nvar dd = today.getDate();\nvar mm = today.getMonth() + 1; //January is 0!\n\nvar yyyy = today.getFullYear();\nif (dd < 10) {\n dd = '0' + dd;\n} \nif (mm < 10) {\n mm = '0' + mm;\n} \nvar today = dd + '/' + mm + '/' + yyyy;\n\nif (msg.payload == \"Run 1\"){\n msg.duration=4;\n msg.layout=24;\n msg.uph=4120;\n msg.nbsheet=Math.ceil((msg.duration*msg.uph)/msg.layout);\n msg.nbantenna=msg.layout*msg.nbsheet;\n msg.avail=95;\n msg.yield=99.5;\n msg.perf=95;\n }\nelse if (msg.payload == \"Run 2\"){\n msg.duration=2;\n msg.layout=24;\n msg.uph=3260;\n msg.nbsheet=Math.ceil((msg.duration*msg.uph)/msg.layout);\n msg.nbantenna=msg.layout*msg.nbsheet;\n msg.avail=95;\n msg.yield=99.5;\n msg.perf=95;\n}\nelse if (msg.payload == \"Run 3\"){\n msg.duration=2;\n msg.layout=24;\n msg.uph=4100;\n msg.nbsheet=Math.ceil((msg.duration*msg.uph)/msg.layout);\n msg.nbantenna=msg.layout*msg.nbsheet;\n msg.avail=95;\n msg.yield=99.5;\n msg.perf=95;\n}\nelse if (msg.payload == \"Run 4\"){\n msg.duration=4;\n msg.layout=24;\n msg.uph=1410;\n msg.nbsheet=Math.ceil((msg.duration*msg.uph)/msg.layout);\n msg.nbantenna=msg.layout*msg.nbsheet;\n msg.avail=95;\n msg.yield=99.5;\n msg.perf=95;\n}\nelse if (msg.payload == \"Run 5\"){\n msg.duration=2;\n msg.layout=48;\n msg.uph=1440;\n msg.nbsheet=Math.ceil((msg.duration*msg.uph)/msg.layout);\n msg.nbantenna=msg.layout*msg.nbsheet;\n msg.avail=95;\n msg.yield=99.5;\n msg.perf=95;\n}\nelse if (msg.payload == \"Run 6\"){\n msg.duration=2;\n msg.layout=48;\n msg.uph=3030;\n msg.nbsheet=Math.ceil((msg.duration*msg.uph)/msg.layout);\n msg.nbantenna=msg.layout*msg.nbsheet;\n msg.avail=95;\n msg.yield=99.5;\n msg.perf=95;\n}\nelse if (msg.payload == \"Run 7\"){\n msg.duration=2;\n msg.layout=72;\n msg.uph=2400;\n msg.nbsheet=Math.ceil((msg.duration*msg.uph)/msg.layout);\n msg.nbantenna=msg.layout*msg.nbsheet;\n msg.avail=95;\n msg.yield=99.5;\n msg.perf=95;\n}\nelse if (msg.payload == \"Test Run\"){\n msg.duration=\"\";\n msg.layout=\"\";\n msg.uph=\"\";\n msg.nbsheet=\"\";\n msg.nbantenna=24000;\n msg.avail=\"\";\n msg.yield=\"\";\n msg.perf=\"\";\n}\nflow.set(\"run_qty\",msg.nbantenna);\nflow.set(\"run\",msg.payload);\nmsg.date=today;\nreturn msg;","outputs":1,"noerr":0,"x":1520,"y":340,"wires":[["297ff41d.b2f42c","96f66641.de2138","79911f8c.b8134","c171ec5c.6c528","b1f70612.7d5bf8","fcbeb118.7407c","fea3e967.d64df8","b82c06.4a3263f8","3a9e2989.d08996","81c41f78.424ba","84b52080.59e0f","8a46f11e.e5522","6636b00f.ccace"]]},{"id":"297ff41d.b2f42c","type":"ui_text","z":"69370bfa.d956d4","group":"840a4c18.cf374","order":3,"width":"8","height":"1","name":"","label":"Equipment","format":"CSC-ALS-I4000-GTO","layout":"row-spread","x":1730,"y":140,"wires":[]},{"id":"96f66641.de2138","type":"ui_text","z":"69370bfa.d956d4","group":"840a4c18.cf374","order":1,"width":"4","height":"1","name":"","label":"Supplier","format":"GSIT","layout":"row-spread","x":1720,"y":100,"wires":[]},{"id":"79911f8c.b8134","type":"ui_text","z":"69370bfa.d956d4","group":"840a4c18.cf374","order":4,"width":"8","height":"1","name":"","label":"Serial Number","format":"CSC-I-2F-0-1710-10","layout":"row-spread","x":1740,"y":180,"wires":[]},{"id":"c171ec5c.6c528","type":"ui_text","z":"69370bfa.d956d4","group":"840a4c18.cf374","order":2,"width":"4","height":"1","name":"","label":"Date","format":"{{msg.date}}","layout":"row-spread","x":1710,"y":220,"wires":[]},{"id":"b1f70612.7d5bf8","type":"ui_text","z":"69370bfa.d956d4","group":"840a4c18.cf374","order":6,"width":"8","height":"1","name":"","label":"Duration","format":"{{msg.duration}}h","layout":"row-spread","x":1720,"y":260,"wires":[]},{"id":"fcbeb118.7407c","type":"ui_text","z":"69370bfa.d956d4","group":"840a4c18.cf374","order":7,"width":"8","height":"1","name":"","label":"Layout","format":"{{msg.layout}}Up","layout":"row-spread","x":1710,"y":300,"wires":[]},{"id":"fea3e967.d64df8","type":"ui_text","z":"69370bfa.d956d4","group":"840a4c18.cf374","order":8,"width":"8","height":"1","name":"","label":"Sheet Quantity","format":"{{msg.nbsheet}}","layout":"row-spread","x":1740,"y":340,"wires":[]},{"id":"b82c06.4a3263f8","type":"ui_text","z":"69370bfa.d956d4","group":"840a4c18.cf374","order":9,"width":"8","height":"1","name":"","label":"Antenna Quantity","format":"{{msg.nbantenna}}","layout":"row-spread","x":1750,"y":380,"wires":[]},{"id":"3a9e2989.d08996","type":"ui_text","z":"69370bfa.d956d4","group":"840a4c18.cf374","order":10,"width":"8","height":"1","name":"","label":"Throughput","format":"{{msg.uph}}uph","layout":"row-spread","x":1730,"y":420,"wires":[]},{"id":"81c41f78.424ba","type":"ui_text","z":"69370bfa.d956d4","group":"840a4c18.cf374","order":11,"width":"8","height":"1","name":"","label":"Availability","format":"{{msg.avail}}%","layout":"row-spread","x":1730,"y":460,"wires":[]},{"id":"84b52080.59e0f","type":"ui_text","z":"69370bfa.d956d4","group":"840a4c18.cf374","order":12,"width":"8","height":"1","name":"","label":"Yield","format":"{{msg.yield}}%","layout":"row-spread","x":1710,"y":500,"wires":[]},{"id":"8a46f11e.e5522","type":"ui_text","z":"69370bfa.d956d4","group":"840a4c18.cf374","order":13,"width":"8","height":"1","name":"","label":"Performance Factor","format":"{{msg.perf}}%","layout":"row-spread","x":1760,"y":540,"wires":[]},{"id":"a03c3d90.b10e3","type":"comment","z":"69370bfa.d956d4","name":"FOLLOW_UP EDITOR","info":"","x":700,"y":1020,"wires":[]},{"id":"6119b4f2.2d1d8c","type":"comment","z":"69370bfa.d956d4","name":"SD-CARD CSV SAVE","info":"","x":1280,"y":1020,"wires":[]},{"id":"6d03f952.71f3e8","type":"comment","z":"69370bfa.d956d4","name":"RUN Selector","info":"","x":1570,"y":60,"wires":[]},{"id":"85c7cf94.fcf28","type":"ui_dropdown","z":"69370bfa.d956d4","name":"Machine Stop Yes/No","label":"","place":"","group":"bfff7fb3.91e91","order":16,"width":"18","height":"1","passthru":true,"options":[{"label":"","value":"Yes","type":"str"},{"label":"","value":"No","type":"str"}],"payload":"","topic":"Machine Stop","x":760,"y":1420,"wires":[["ba95bc05.498","c088f426.0e4c08","7993a4f9.98c95c","ab1acfb5.17f7"]]},{"id":"6636b00f.ccace","type":"ui_text","z":"69370bfa.d956d4","group":"840a4c18.cf374","order":5,"width":"8","height":"1","name":"","label":"Run Number","format":"{{msg.payload}}","layout":"row-spread","x":1730,"y":580,"wires":[]},{"id":"fcb9d76c.557068","type":"ui_text","z":"69370bfa.d956d4","group":"9f653648.7e6658","order":1,"width":"4","height":"1","name":"Run start","label":"Run Start","format":"{{msg.run_start}}","layout":"row-spread","x":1200,"y":340,"wires":[]},{"id":"25381582.fc602a","type":"ui_text","z":"69370bfa.d956d4","group":"9f653648.7e6658","order":5,"width":"8","height":"1","name":"Remaining Quantity","label":"Remaining Quantity","format":"{{msg.remaining}} antenna","layout":"row-spread","x":1230,"y":220,"wires":[]},{"id":"8b28323a.c3e71","type":"function","z":"69370bfa.d956d4","name":"Save Check","func":"if(msg.topic ===\"D11\" || msg.topic ===\"D12\" || msg.topic ===\"Save\")\nreturn msg;","outputs":1,"noerr":0,"x":810,"y":1060,"wires":[["aa9ce1b5.9b966"]]},{"id":"f7df1cef.add69","type":"change","z":"69370bfa.d956d4","name":"Clear Graphs","rules":[{"t":"set","p":"payload","pt":"msg","to":"[]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":150,"y":420,"wires":[["535257a5.7a67e8","ffd83bc2.c10b38","67e93a7d.e18384"]]},{"id":"ba95bc05.498","type":"function","z":"69370bfa.d956d4","name":"Machine Stop Type Control","func":"if(msg.payload=== \"Yes\")\n{\n msg.payload=\"No\";\n msg.enabled=false;\n return msg;\n}\nelse if (msg.payload=== \"No\")\n{\n msg.payload=\"Yes\";\n msg.enabled=false;\n return msg;\n}\n","outputs":1,"noerr":0,"x":1380,"y":1340,"wires":[["47adf663.b24b28"]]},{"id":"c088f426.0e4c08","type":"function","z":"69370bfa.d956d4","name":"Unintentional Stop Time","func":"var time1 = flow.get('time1')||\"-\";\nvar time2 = flow.get('time2')||\"-\";\n\nif(msg.payload=== \"Yes\")\n{\n msg.payload=time1;\n msg.topic=\"Unintentional Stop Time\";\n msg.enabled=true;\n return msg;\n}\nelse if (msg.payload=== \"No\")\n{\n msg.payload=time2;\n msg.topic=\"Unintentional Stop Time\";\n msg.enabled=false;\n return msg;\n}\n","outputs":1,"noerr":0,"x":1370,"y":1420,"wires":[["108b8bb9.aa0294","831c67c2.04e378"]]},{"id":"7993a4f9.98c95c","type":"function","z":"69370bfa.d956d4","name":"Volontary Stop Time","func":"var time1 = flow.get('time1')||\"-\";\nvar time2 = flow.get('time2')||\"-\";\n\nif(msg.payload=== \"Yes\")\n{\n msg.payload=time2;\n msg.topic=\"Volontary Stop Time\";\n msg.enabled=false;\n return msg;\n}\nelse if (msg.payload=== \"No\")\n{\n msg.payload=time1;\n msg.topic=\"Volontary Stop Time\";\n msg.enabled=true;\n return msg;\n}\n","outputs":1,"noerr":0,"x":1360,"y":1380,"wires":[["926bfa08.06baa8"]]},{"id":"18abecd8.ba6803","type":"ui_text_input","z":"69370bfa.d956d4","name":"Volontary Stop","label":"","group":"bfff7fb3.91e91","order":20,"width":"18","height":"1","passthru":true,"mode":"text","delay":300,"topic":"Volontary Stop","x":740,"y":1500,"wires":[["ab1acfb5.17f7"]]},{"id":"76fae975.865a18","type":"ui_text_input","z":"69370bfa.d956d4","name":"Unintentional Stop Time","label":"","group":"bfff7fb3.91e91","order":24,"width":"18","height":"1","passthru":true,"mode":"text","delay":300,"topic":"Unintentional Stop Time","x":770,"y":1580,"wires":[["ab1acfb5.17f7"]]},{"id":"8f7039b7.e35e88","type":"ui_text_input","z":"69370bfa.d956d4","name":"Volontary Stop Time","label":"","group":"bfff7fb3.91e91","order":26,"width":"18","height":"1","passthru":true,"mode":"text","delay":300,"topic":"Volontary Stop Time","x":760,"y":1620,"wires":[["ab1acfb5.17f7"]]},{"id":"2514e80a.e5ecc8","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":450,"y":1420,"wires":[["85c7cf94.fcf28"]]},{"id":"3c4f9ac2.53c476","type":"change","z":"69370bfa.d956d4","name":"","rules":[{"t":"delete","p":"enabled","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1290,"y":1780,"wires":[["ae6b2d3f.e16fe"]]},{"id":"83fb5c7a.6acd","type":"change","z":"69370bfa.d956d4","name":"Clear","rules":[{"t":"set","p":"payload","pt":"msg","to":"Test Run","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1490,"y":380,"wires":[["9f3342a6.1fa0e"]]},{"id":"d4bfac6e.2d42e","type":"change","z":"69370bfa.d956d4","name":"Clear - Empty String","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":180,"y":460,"wires":[["496341cd.7d00e","2f31b800.f9c958","dffc71fb.970c","fcb9d76c.557068","25381582.fc602a","c01e9af8.dfea68","c07d10b5.09fa6","e79bcfd.0bb963","d6688757.94ec38","553e5881.59be68","e5687ee9.e54da","b7fab041.e7c8b"]]},{"id":"a8442851.d1a7c8","type":"change","z":"69370bfa.d956d4","name":"Clear - 0","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":140,"y":380,"wires":[["43049fdb.2f173","6ba78bb5.2fb234"]]},{"id":"81f4e70a.d420b8","type":"debug","z":"69370bfa.d956d4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":310,"y":180,"wires":[]},{"id":"108b8bb9.aa0294","type":"debug","z":"69370bfa.d956d4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":570,"y":960,"wires":[]},{"id":"e4031470.4b4ed8","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":370,"y":1820,"wires":[["591b5627.7e5b58","983afa06.17ab68"]]},{"id":"591b5627.7e5b58","type":"change","z":"69370bfa.d956d4","name":"Clear Value","rules":[{"t":"set","p":"payload","pt":"msg","to":"null","tot":"num"},{"t":"delete","p":"topic","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":1780,"wires":[["1b67ba9d.51afc5","58f00113.3dbf","47d65dcd.661be4","840847e8.c82fe8","f433ca9.96beb38","cab57184.fadcf","2d8ecb06.06f9e4","dbce0d86.bccca","18abecd8.ba6803","d7ce195f.eb4b18","76fae975.865a18","8f7039b7.e35e88","ccb60f0.4111df","85c7cf94.fcf28"]]},{"id":"3684bbda.650474","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":450,"y":1140,"wires":[["1b67ba9d.51afc5"]]},{"id":"756b2905.1eb848","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":450,"y":1180,"wires":[["58f00113.3dbf"]]},{"id":"43f34ed7.be75b","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":450,"y":1220,"wires":[["47d65dcd.661be4"]]},{"id":"de117945.36e1a8","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":450,"y":1260,"wires":[["840847e8.c82fe8"]]},{"id":"940b67a4.e582e8","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":450,"y":1300,"wires":[["f433ca9.96beb38"]]},{"id":"f6dbcf41.10eb","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":450,"y":1340,"wires":[["cab57184.fadcf"]]},{"id":"c3e83cde.c3ed2","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":450,"y":1380,"wires":[["2d8ecb06.06f9e4"]]},{"id":"3d479e9d.1e3b72","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":450,"y":1460,"wires":[["dbce0d86.bccca"]]},{"id":"48853be7.e77d94","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":450,"y":1540,"wires":[["d7ce195f.eb4b18"]]},{"id":"df10d7f7.d6d2b8","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":450,"y":1660,"wires":[["ccb60f0.4111df"]]},{"id":"514232b2.195a8c","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":450,"y":1700,"wires":[["15a9c75f.e43809"]]},{"id":"df8c30db.c7731","type":"comment","z":"69370bfa.d956d4","name":"Clear Editor After Save or Reset","info":"","x":430,"y":1740,"wires":[]},{"id":"5d2cb239.f327dc","type":"comment","z":"69370bfa.d956d4","name":"Save Edited Values","info":"","x":1010,"y":1740,"wires":[]},{"id":"30d4082e.66d818","type":"comment","z":"69370bfa.d956d4","name":"Machine Stop Time & Time Control Functions","info":"","x":1430,"y":1300,"wires":[]},{"id":"80809cda.83427","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":450,"y":1580,"wires":[["108b8bb9.aa0294","10e9789c.b5ed77"]]},{"id":"1d579bef.1de8e4","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":450,"y":1620,"wires":[["10e9789c.b5ed77"]]},{"id":"47adf663.b24b28","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":450,"y":1500,"wires":[["18abecd8.ba6803"]]},{"id":"aad8e8fd.825b18","type":"file","z":"69370bfa.d956d4","name":"","filename":"","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1590,"y":1060,"wires":[[]]},{"id":"97d9522c.f28c3","type":"change","z":"69370bfa.d956d4","name":"Filename","rules":[{"t":"set","p":"filename","pt":"msg","to":"filename","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":1400,"y":1060,"wires":[["aad8e8fd.825b18"]]},{"id":"831c67c2.04e378","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1610,"y":1420,"wires":[["76fae975.865a18"]]},{"id":"926bfa08.06baa8","type":"delay","z":"69370bfa.d956d4","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1610,"y":1380,"wires":[["8f7039b7.e35e88"]]},{"id":"10e9789c.b5ed77","type":"function","z":"69370bfa.d956d4","name":"Stop Time Type Record","func":"var time1 = flow.get('time1')||\"-\";\nvar time2 = flow.get('time2')||\"-\";\n//Record the stop time in a context variable\nif (msg.topic===\"Unintentional Stop Time\")\n{\n flow.set('time1',msg.time);\n}\nif (msg.topic===\"Volontary Stop Time\")\n{\n flow.set('time2',msg.time);\n}\n","outputs":1,"noerr":0,"x":1566,"y":1584,"wires":[[]]},{"id":"8cc05def.a19c3","type":"change","z":"69370bfa.d956d4","name":"D10 - Zero Injector","rules":[{"t":"set","p":"topic","pt":"msg","to":"D10","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":420,"wires":[["ffd83bc2.c10b38"]]},{"id":"e5687ee9.e54da","type":"ui_text","z":"69370bfa.d956d4","group":"6b0c3e1c.426de","order":2,"width":"8","height":"1","name":"Run Throughput","label":"Run Throughput","format":"{{msg.run_throughput}} uph","layout":"row-spread","x":1220,"y":500,"wires":[]},{"id":"b597c6fc.603be8","type":"inject","z":"69370bfa.d956d4","name":"Manual Start","topic":"D12","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":200,"wires":[["46c91e30.c15ff"]]},{"id":"fed4b6e3.1732c8","type":"inject","z":"69370bfa.d956d4","name":"Manual Stop","topic":"D11","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":240,"wires":[["46c91e30.c15ff"]]},{"id":"b7fab041.e7c8b","type":"ui_text","z":"69370bfa.d956d4","group":"6b0c3e1c.426de","order":3,"width":"4","height":"1","name":"Time since last start","label":"Time since last start","format":"{{msg.text}}","layout":"row-spread","x":1240,"y":660,"wires":[]},{"id":"a9441608.246e18","type":"function","z":"69370bfa.d956d4","name":"Hours/Minutes/Seconds","func":"var numhours = Math.floor(msg.current_run_time/ 3600);\nvar numminutes = Math.floor((msg.current_run_time % 3600) / 60);\nvar numseconds = Math.floor(msg.current_run_time % 3600) % 60;\n\nif(msg.current_run_time >=3600)\n{\nmsg.text = numhours + \"h \" + numminutes + \"m \" + numseconds + \"s\"; \n}\nelse if(msg.current_run_time >=60)\n{\nmsg.text = numminutes + \"m \" + numseconds + \"s\"; \n}\nelse\n{\nmsg.text = numseconds + \"s\";\n}\nreturn msg;","outputs":1,"noerr":0,"x":990,"y":660,"wires":[["b7fab041.e7c8b"]]},{"id":"daa8e254.3e36c","type":"ui_group","z":"","name":"Run Follow-Up Data","tab":"867263f5.f9a37","order":3,"disp":true,"width":"24","collapse":true},{"id":"bfff7fb3.91e91","type":"ui_group","z":"","name":"Follow-Up Editor","tab":"867263f5.f9a37","order":2,"disp":true,"width":"24","collapse":true},{"id":"405b6b69.551d34","type":"ui_group","z":"","name":"Run Selection & Reset","tab":"867263f5.f9a37","order":1,"disp":true,"width":"24","collapse":true},{"id":"9f653648.7e6658","type":"ui_group","z":"","name":"Instant Data, Output & Stops","tab":"c3ee83e7.5c322","order":1,"disp":true,"width":"8","collapse":true},{"id":"6b0c3e1c.426de","type":"ui_group","z":"","name":"Run Overview","tab":"c3ee83e7.5c322","order":3,"disp":true,"width":"8","collapse":true},{"id":"840a4c18.cf374","type":"ui_group","z":"","name":"Targets","tab":"c3ee83e7.5c322","order":3,"disp":true,"width":"8","collapse":true},{"id":"867263f5.f9a37","type":"ui_tab","z":"","name":"Run Follow-Up","icon":"fa-list-alt","order":1},{"id":"c3ee83e7.5c322","type":"ui_tab","z":"","name":"Run Performance Indicators","icon":"fa-tachometer","order":2}]