Thanks for correcting my errors, I am quite beginner in node red.
and also this is for MSSQL flow:
[
{
"id": "8581bb2eddc223e0",
"type": "debug",
"z": "7499127a37bbb386",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 710,
"y": 360,
"wires": []
},
{
"id": "15ad3f2d55f43235",
"type": "debug",
"z": "7499127a37bbb386",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 490,
"y": 460,
"wires": []
},
{
"id": "784a2cbd114ec957",
"type": "modbus-read",
"z": "7499127a37bbb386",
"name": "BMU1",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "1",
"dataType": "HoldingRegister",
"adr": "8192",
"quantity": "32",
"rate": "2",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "d631304d.f42a4",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 270,
"y": 420,
"wires": [
[
"25950c90bcc18c12"
],
[
"15ad3f2d55f43235",
"17a27f265c597d87"
]
]
},
{
"id": "f0e1f0a1c7ce0ea0",
"type": "MSSQL",
"z": "7499127a37bbb386",
"mssqlCN": "491533d6adb397ad",
"name": "",
"outField": "payload",
"returnType": "1",
"throwErrors": 1,
"query": "INSERT INTO BMU1 \r\n (TimeStamp, Cell_V1, Cell_V2, Cell_V3, Cell_V4,Cell_V5,\r\n Cell_V6, Cell_V7, Cell_V8, Cell_V9, Cell_V10, Cell_V11,\r\n Cell_V12, Cell_V13, Cell_V14, Cell_V15, Cell_V16,Cell_T1,\r\n Cell_T2, Cell_T3, Cell_T4, Cell_T5, Cell_T6, Cell_T7, Cell_T8) \r\nVALUES\r\n (@ts, @v1, @v2, @v3,@v4,@v5,@v6,@v7,@v8,@v9,@v10,@v11,@v12,@v13\r\n ,@v14,@v15,@v16,@t1,@t2,@t3,@t4,@t5,@t6,@t7,@t8)\r\n",
"modeOpt": "queryMode",
"modeOptType": "query",
"queryOpt": "payload",
"queryOptType": "editor",
"paramsOpt": "",
"paramsOptType": "editor",
"rows": "rows",
"rowsType": "msg",
"params": [
{
"output": false,
"name": "ts",
"type": "DateTime",
"valueType": "datetime",
"value": "0",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "v1",
"type": "Float",
"valueType": "msg",
"value": "payload[0]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "v2",
"type": "Float",
"valueType": "msg",
"value": "payload[1]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "v3",
"type": "Float",
"valueType": "msg",
"value": "payload[2]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "v4",
"type": "Float",
"valueType": "msg",
"value": "payload[3]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "v5",
"type": "Float",
"valueType": "msg",
"value": "payload[4]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "v6",
"type": "Float",
"valueType": "msg",
"value": "payload[5]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "v7",
"type": "Float",
"valueType": "msg",
"value": "payload[6]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "v8",
"type": "Float",
"valueType": "msg",
"value": "payload[7]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "v9",
"type": "Float",
"valueType": "msg",
"value": "payload[8]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "v10",
"type": "Float",
"valueType": "msg",
"value": "payload[9]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "v11",
"type": "Float",
"valueType": "msg",
"value": "payload[10]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "v12",
"type": "Float",
"valueType": "msg",
"value": "payload[11]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "v13",
"type": "Float",
"valueType": "msg",
"value": "payload[12]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "v14",
"type": "Float",
"valueType": "msg",
"value": "payload[13]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "v15",
"type": "Float",
"valueType": "msg",
"value": "payload[14]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "v16",
"type": "Float",
"valueType": "msg",
"value": "payload[15]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "t1",
"type": "Float",
"valueType": "msg",
"value": "payload[24]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "t2",
"type": "Float",
"valueType": "msg",
"value": "payload[25]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "t3",
"type": "Float",
"valueType": "msg",
"value": "payload[26]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "t4",
"type": "Float",
"valueType": "msg",
"value": "payload[27]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "t5",
"type": "Float",
"valueType": "msg",
"value": "payload[28]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "t6",
"type": "Float",
"valueType": "msg",
"value": "payload[29]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "t7",
"type": "Float",
"valueType": "msg",
"value": "payload[30]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
},
{
"output": false,
"name": "t8",
"type": "Float",
"valueType": "msg",
"value": "payload[31]",
"options": {
"nullable": true,
"primary": false,
"identity": false,
"readOnly": false
}
}
],
"x": 720,
"y": 440,
"wires": [
[
"fe1e48b0765f1132"
]
]
},
{
"id": "fe1e48b0765f1132",
"type": "debug",
"z": "7499127a37bbb386",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 910,
"y": 440,
"wires": []
},
{
"id": "cbe8b20156a7b261",
"type": "debug",
"z": "7499127a37bbb386",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "Node 2",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 710,
"y": 500,
"wires": []
},
{
"id": "17a27f265c597d87",
"type": "buffer-parser",
"z": "7499127a37bbb386",
"name": "",
"data": "payload.data",
"dataType": "msg",
"specification": "spec",
"specificationType": "ui",
"items": [
{
"type": "int16be",
"name": "Array[32] of 16bits",
"offset": 0,
"length": 32,
"offsetbit": 2,
"scale": "1",
"mask": ""
}
],
"swap1": "",
"swap2": "",
"swap3": "",
"swap1Type": "swap",
"swap2Type": "swap",
"swap3Type": "swap",
"msgProperty": "payload",
"msgPropertyType": "",
"resultType": "value",
"resultTypeType": "output",
"multipleResult": true,
"fanOutMultipleResult": false,
"setTopic": true,
"outputs": 1,
"x": 490,
"y": 420,
"wires": [
[
"cbe8b20156a7b261"
]
]
},
{
"id": "25950c90bcc18c12",
"type": "function",
"z": "7499127a37bbb386",
"name": "Data scaling",
"func": "//msg.topic = \"Varible 1\";\n//msg.payload = msg.payload[0];\n//return msg;\n\nfor (var i = 0; i < 32; i++) {\n if (i == 16 ){\n break;\n }\n msg.payload[i] = msg.payload[i]/1000;\n \n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 490,
"y": 380,
"wires": [
[
"8581bb2eddc223e0",
"f0e1f0a1c7ce0ea0",
"774e16f0ca869b43"
]
]
},
{
"id": "774e16f0ca869b43",
"type": "function",
"z": "7499127a37bbb386",
"name": "Set global variable",
"func": "\nglobal.set(\"Module_1\",msg.payload);\n\n\nreturn msg",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 730,
"y": 400,
"wires": [
[
"1148af20c92f4dc1"
]
]
},
{
"id": "1148af20c92f4dc1",
"type": "debug",
"z": "7499127a37bbb386",
"name": "Show function output",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 940,
"y": 400,
"wires": []
},
{
"id": "daf86ff46323c853",
"type": "comment",
"z": "7499127a37bbb386",
"name": "Module 1",
"info": "",
"x": 300,
"y": 380,
"wires": []
},
{
"id": "d631304d.f42a4",
"type": "modbus-client",
"name": "BMS",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"tcpHost": "192.168.0.21",
"tcpPort": "502",
"tcpType": "DEFAULT",
"serialPort": "/dev/ttyUSB",
"serialType": "RTU-BUFFERD",
"serialBaudrate": "9600",
"serialDatabits": "8",
"serialStopbits": "1",
"serialParity": "none",
"serialConnectionDelay": "100",
"serialAsciiResponseStartDelimiter": "",
"unit_id": "1",
"commandDelay": "1",
"clientTimeout": "1000",
"reconnectOnTimeout": true,
"reconnectTimeout": "2000",
"parallelUnitIdsAllowed": true
},
{
"id": "491533d6adb397ad",
"type": "MSSQL-CN",
"name": "",
"server": "localhost",
"port": "",
"encyption": false,
"trustServerCertificate": false,
"database": "MAXBESS_1",
"useUTC": false,
"connectTimeout": "",
"requestTimeout": "",
"cancelTimeout": "",
"pool": "",
"parseJSON": false,
"enableArithAbort": true
}
]