Compare commits
2 Commits
3539dae3a1
...
c2f68e81db
Author | SHA1 | Date |
---|---|---|
Yinyin Liu | c2f68e81db | |
Yinyin Liu | ba8c3e845e |
|
@ -2332,7 +2332,7 @@
|
||||||
"type": "function",
|
"type": "function",
|
||||||
"z": "58aeeaac02a3a4c7",
|
"z": "58aeeaac02a3a4c7",
|
||||||
"name": "get_total_number_of_limb_strings",
|
"name": "get_total_number_of_limb_strings",
|
||||||
"func": "let total_num_limb_string=0;\nlimb_string_list = msg.payload.limb_string_list;\nmain_switch_state_list = msg.payload.main_switch_state;\nbattery_health = [];\nif (limb_string_list == null){\n msg.payload.battery_health = \"BMS connection lost!\";\n msg.payload.num_limb_string = -1\n return msg;\n}\n\nfor (let i = 0; i < limb_string_list.length; i++) {\n num_limb_string = limb_string_list[i][1][0];\n \n if(num_limb_string>1){\n total_num_limb_string = -1;//if there are more than 1 limb string in a battery, should give alarm to stop use this battery\n battery_health.push(\"Battery \"+(i+2)+\" has more than 1 limb string!\");\n }\n \n if(num_limb_string<=1){\n total_num_limb_string+=num_limb_string;\n battery_health.push(\"Battery \"+(i+2)+\" has \" + num_limb_string+ \" limb strings.\");\n }\n}\nmsg.payload.num_limb_string = total_num_limb_string;\nmsg.payload.battery_health = battery_health;\n\nreturn msg;",
|
"func": "let total_num_limb_string=0;\nlimb_string_list = msg.payload.limb_string_list;\nmain_switch_state_list = msg.payload.main_switch_state;\nbattery_health = [];\nflag = 1;\nif (limb_string_list == null){\n msg.payload.battery_health = \"BMS connection lost!\";\n msg.payload.num_limb_string = -1\n return msg;\n}\n\nfor (let i = 0; i < limb_string_list.length; i++) {\n num_limb_string = limb_string_list[i][1][0];\n \n if(num_limb_string>1){\n flag = -1;\n }\n \n if(num_limb_string<=1){\n total_num_limb_string+=num_limb_string;\n }\n \n battery_health.push(\"Battery \"+(i+2)+\" has \" + num_limb_string+ \" limb strings.\");\n}\n\nconst updateNumLimbString = (total, flag) => flag === 1 ? total : -1;\nmsg.payload.num_limb_string = updateNumLimbString(total_num_limb_string, flag);\nmsg.payload.battery_health = battery_health;\n\nreturn msg;",
|
||||||
"outputs": 1,
|
"outputs": 1,
|
||||||
"timeout": 0,
|
"timeout": 0,
|
||||||
"noerr": 0,
|
"noerr": 0,
|
||||||
|
@ -2604,7 +2604,7 @@
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"t": "set",
|
"t": "set",
|
||||||
"p": "payload",
|
"p": "payload.controller_info",
|
||||||
"pt": "msg",
|
"pt": "msg",
|
||||||
"to": "Please replace battery first!",
|
"to": "Please replace battery first!",
|
||||||
"tot": "str"
|
"tot": "str"
|
||||||
|
|
Loading…
Reference in New Issue