[
    {
        "id": "ac8b94998f202ccc",
        "type": "inject",
        "z": "232303c9388ec6c8",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 180,
        "wires": [
            [
                "b6f58983a1e7ec0f"
            ]
        ]
    },
    {
        "id": "b6f58983a1e7ec0f",
        "type": "function",
        "z": "232303c9388ec6c8",
        "name": "Create Table",
        "func": "msg.topic= \"CREATE TABLE Drives (id SERIAL PRIMARY KEY, device_id VARCHAR(50) NOT NULL, timestamp TIMESTAMP NOT NULL, velocity FLOAT, position FLOAT, torque float, status VARCHAR(20));\"\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 590,
        "y": 180,
        "wires": [
            [
                "1003db5a1c09d6b3"
            ]
        ]
    },
    {
        "id": "7c6ef22ecbe2e936",
        "type": "debug",
        "z": "232303c9388ec6c8",
        "name": "debug 5",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1040,
        "y": 180,
        "wires": []
    },
    {
        "id": "362d5f1ceae52fe5",
        "type": "inject",
        "z": "232303c9388ec6c8",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 260,
        "wires": [
            [
                "238abd3bc5551224"
            ]
        ]
    },
    {
        "id": "c828234259461e1e",
        "type": "function",
        "z": "232303c9388ec6c8",
        "name": "Insert",
        "func": "msg.topic = \"INSERT INTO Drives (device_id, timestamp, velocity, position, torque, status) VALUES \";\n\nfor (var i = 0; i < 998; i++) {\n    var temp = msg.payload.value[i];\n    msg.topic += \"('HCS01', NOW(), RAND() * 1000, RAND() * 1000, \"+msg.payload.value[i]+\", 'OK'),\";\n}\nmsg.topic += \"('HCS01', NOW(), RAND() * 1000, RAND() * 1000, \" + msg.payload.value[998] +\", 'OK')\";\nmsg.topic += \";\";\n\nreturn msg;\n",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 770,
        "y": 260,
        "wires": [
            [
                "0f8902ced974fdce"
            ]
        ]
    },
    {
        "id": "257171a85af204e3",
        "type": "debug",
        "z": "232303c9388ec6c8",
        "name": "debug 6",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1180,
        "y": 260,
        "wires": []
    },
    {
        "id": "8ff9457d4fdd0477",
        "type": "inject",
        "z": "232303c9388ec6c8",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 360,
        "wires": [
            [
                "a3c61379f725cbb4"
            ]
        ]
    },
    {
        "id": "a3c61379f725cbb4",
        "type": "function",
        "z": "232303c9388ec6c8",
        "name": "SelectAll",
        "func": "msg.topic= \"SELECT *From Drives;\"\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 580,
        "y": 360,
        "wires": [
            [
                "43a1ba381e4748d0"
            ]
        ]
    },
    {
        "id": "b13af437c9427c60",
        "type": "debug",
        "z": "232303c9388ec6c8",
        "name": "debug 7",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1040,
        "y": 360,
        "wires": []
    },
    {
        "id": "1003db5a1c09d6b3",
        "type": "mysql",
        "z": "232303c9388ec6c8",
        "mydb": "03a85ce256ca9d57",
        "name": "",
        "x": 820,
        "y": 180,
        "wires": [
            [
                "7c6ef22ecbe2e936"
            ]
        ]
    },
    {
        "id": "0f8902ced974fdce",
        "type": "mysql",
        "z": "232303c9388ec6c8",
        "mydb": "03a85ce256ca9d57",
        "name": "",
        "x": 960,
        "y": 260,
        "wires": [
            [
                "257171a85af204e3"
            ]
        ]
    },
    {
        "id": "43a1ba381e4748d0",
        "type": "mysql",
        "z": "232303c9388ec6c8",
        "mydb": "03a85ce256ca9d57",
        "name": "",
        "x": 820,
        "y": 360,
        "wires": [
            [
                "b13af437c9427c60"
            ]
        ]
    },
    {
        "id": "238abd3bc5551224",
        "type": "ctrlx-datalayer-request",
        "z": "232303c9388ec6c8",
        "device": "3dc5f1c90b176451",
        "method": "READ",
        "path": "plc/app/Application/sym/PLC_PRG/torque",
        "payloadFormat": "value_type",
        "name": "Read Datalayer",
        "pendingWarnLevel": "",
        "pendingErrorLevel": "",
        "x": 460,
        "y": 260,
        "wires": [
            [
                "c828234259461e1e"
            ]
        ]
    },
    {
        "id": "03a85ce256ca9d57",
        "type": "MySQLdatabase",
        "name": "MySQL Server",
        "host": "10.195.70.29",
        "port": "3306",
        "db": "db1",
        "tz": "",
        "charset": "UTF8"
    },
    {
        "id": "3dc5f1c90b176451",
        "type": "ctrlx-config",
        "name": "[fe80::260:34ff:fe08:322]",
        "hostname": "127.0.0.1",
        "debug": true
    }
]