After receiving a suggestion from a member, that was later deleted, to look at a condition statement, I followed a more detailed approach to diverting excess solar energy once my batteries got to either Absorption or Float state. These batteries are VRLA and their charging voltage under either of the two mentioned states varies by battery temperature. (Battery temperature adjustment is not applicable for lithium batteries).
A timer is added for evaluating the algorithm, presently set at 2 seconds. A Solid State Relay is able to handle these changes, whereas a Contactor with electromagnetic properties can suffer from contact degradation.
The purpose was to minimise draw from the batteries and as a consequence will extent battery life.
I am only part way through learning Javascript, so in essence a novice beginner, but in spite of myself I managed to get this Function node to work.
I will need to monitor the heat dissipation of the SRR with a temperature data logger but I do not expect an issue. Certainly the 25A SSR on my 3 group coffee boiler which cycles at 135 cycles per minute under the PID controller did not show heat dissipation issues.
[{
"id": "09f193279e87f963",
"type": "tab",
"label": "Absorption Relay Trigger",
"disabled": false,
"info": "",
"env": []
},
{
"id": "efd24cb7f2dcf7de",
"type": "victron-input-solarcharger",
"z": "09f193279e87f963",
"service": "com.victronenergy.solarcharger/288",
"path": "/State",
"serviceObj": {
"service": "com.victronenergy.solarcharger/288",
"name": "Solar Trina Panel",
"communityTag": "solarcharger"
},
"pathObj": {
"path": "/State",
"type": "enum",
"name": "Charge state",
"enum": {
"0": "Off",
"2": "Fault",
"3": "Bulk",
"4": "Absorption",
"5": "Float",
"6": "Storage",
"7": "Equalize",
"245": "Off",
"247": "Equalize",
"252": "External Control"
}
},
"name": "TR C/State",
"onlyChanges": false,
"roundValues": "no",
"rateLimit": "2",
"outputs": 1,
"conditionalMode": false,
"outputTrue": "true",
"outputFalse": "false",
"debounce": "2000",
"x": 80,
"y": 40,
"wires": [
[
"3aa4465902983b86"
]
]
},
{
"id": "54c771e5b3a741de",
"type": "victron-output-relay",
"z": "09f193279e87f963",
"service": "com.victronenergy.system/0",
"path": "/Relay/1/State",
"serviceObj": {
"service": "com.victronenergy.system/0",
"name": "Venus device"
},
"pathObj": {
"path": "/Relay/1/State",
"type": "enum",
"name": "Venus relay 2 state",
"enum": {
"0": "Open",
"1": "Closed"
},
"mode": "both"
},
"initial": 0,
"name": "GX Relay2",
"onlyChanges": false,
"roundValues": "no",
"rateLimit": 0,
"outputs": 0,
"conditionalMode": false,
"condition1Operator": ">",
"condition2Enabled": false,
"condition2Service": "",
"condition2Path": "",
"condition2Operator": ">",
"logicOperator": "AND",
"outputTrue": "true",
"outputFalse": "false",
"outputOnChange": false,
"debounce": 2000,
"x": 730,
"y": 380,
"wires": []
},
{
"id": "4d2ad28c3b4486d4",
"type": "debug",
"z": "09f193279e87f963",
"name": "AbsVoltTemp debug",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 620,
"y": 180,
"wires": []
},
{
"id": "3fc571a974b7f7c7",
"type": "victron-input-battery",
"z": "09f193279e87f963",
"service": "com.victronenergy.battery/279",
"path": "/Dc/0/Temperature",
"serviceObj": {
"service": "com.victronenergy.battery/279",
"name": "Shunt Yuasa 533ah",
"communityTag": "battery"
},
"pathObj": {
"path": "/Dc/0/Temperature",
"type": "float",
"name": "Battery temperature (°C)"
},
"name": "Shunt Temp",
"onlyChanges": false,
"roundValues": "no",
"rateLimit": "2",
"outputs": 1,
"conditionalMode": false,
"outputTrue": "true",
"outputFalse": "false",
"debounce": "2000",
"x": 90,
"y": 220,
"wires": [
[
"d70b09f208325fe6",
"55e013630bfba5e2"
]
]
},
{
"id": "55e013630bfba5e2",
"type": "change",
"z": "09f193279e87f963",
"name": " Absorption Voltage Temp Adj.",
"rules": [
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "35",
"fromt": "num",
"to": "56.952",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "34",
"fromt": "num",
"to": "57.0168",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "33",
"fromt": "num",
"to": "57.0816",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "32",
"fromt": "num",
"to": "57.1464",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "31",
"fromt": "num",
"to": "57.2112",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "30",
"fromt": "num",
"to": "57.276",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "29",
"fromt": "num",
"to": "57.3408",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "28",
"fromt": "num",
"to": "57.4056",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "27",
"fromt": "num",
"to": "57.4704",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "26",
"fromt": "num",
"to": "57.5352",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "25",
"fromt": "num",
"to": "57.6",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "24",
"fromt": "num",
"to": "57.6648",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "23",
"fromt": "num",
"to": "57.7296",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "22",
"fromt": "num",
"to": "57.7944",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "21",
"fromt": "num",
"to": "57.8592",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "20",
"fromt": "num",
"to": "57.924",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "19",
"fromt": "num",
"to": "57.9888",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "18",
"fromt": "num",
"to": "58.0536",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "17",
"fromt": "num",
"to": "58.1184",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "16",
"fromt": "num",
"to": "58.1832",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "15",
"fromt": "num",
"to": "58.248",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "14",
"fromt": "num",
"to": "58.3128",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "13",
"fromt": "num",
"to": "58.3776",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "12",
"fromt": "num",
"to": "58.4424",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "11",
"fromt": "num",
"to": "58.5072",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "10",
"fromt": "num",
"to": "58.572",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "9",
"fromt": "num",
"to": "58.6368",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "8",
"fromt": "num",
"to": "58.7016",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "7",
"fromt": "num",
"to": "58.7664",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "6",
"fromt": "num",
"to": "58.8312",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "5",
"fromt": "num",
"to": "58.896",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "4",
"fromt": "num",
"to": "58.9608",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "3",
"fromt": "num",
"to": "59.0256",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "2",
"fromt": "num",
"to": "59.0904",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "1",
"fromt": "num",
"to": "59.1552",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "0",
"fromt": "num",
"to": "59.22",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 350,
"y": 160,
"wires": [
[
"4d2ad28c3b4486d4",
"77507bf9233a26cf"
]
]
},
{
"id": "c75b1c5af0d8310e",
"type": "function",
"z": "09f193279e87f963",
"name": "4 input condition Function",
"func": "'use Strict';\nlet state = flow.get('state') || 0;\nlet voltage = flow.get('voltage') || 0;\nlet abstempvolt = flow.get('abstempvolt') || 0;\nlet floattempvolt = flow.get('floattempvolt') || 0;\nlet controla = voltage - (abstempvolt - 0.2);\nlet controlb = voltage - (floattempvolt - 0.2); \n \nif (state === 4 && controla > 0) {\n msg.payload = 1;\n} \nelse\nif (state === 5 && controlb > 0) {\n msg.payload = 1;\n}\nelse {\n msg.payload = 0;\n}\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 490,
"y": 380,
"wires": [
[
"7feaad870781d4f9",
"54c771e5b3a741de"
]
]
},
{
"id": "d70b09f208325fe6",
"type": "change",
"z": "09f193279e87f963",
"name": "Float Voltage Temp Adjustment",
"rules": [
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "35",
"fromt": "num",
"to": "54.522",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "34",
"fromt": "num",
"to": "54.6168",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "33",
"fromt": "num",
"to": "54.6816",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "32",
"fromt": "num",
"to": "54.7464",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "31",
"fromt": "num",
"to": "54.8112",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "30",
"fromt": "num",
"to": "54.876",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "29",
"fromt": "num",
"to": "54.9408",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "28",
"fromt": "num",
"to": "55.0056",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "27",
"fromt": "num",
"to": "55.0704",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "26",
"fromt": "num",
"to": "55.1352",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "25",
"fromt": "num",
"to": "55.2",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "24",
"fromt": "num",
"to": "55.2648",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "23",
"fromt": "num",
"to": "55.3296",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "22",
"fromt": "num",
"to": "55.3944",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "21",
"fromt": "num",
"to": "55.4592",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "20",
"fromt": "num",
"to": "55.524",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "19",
"fromt": "num",
"to": "55.5888",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "18",
"fromt": "num",
"to": "55.6536",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "17",
"fromt": "num",
"to": "55.7184",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "16",
"fromt": "num",
"to": "55.7832",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "15",
"fromt": "num",
"to": "55.848",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "14",
"fromt": "num",
"to": "55.9128",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "13",
"fromt": "num",
"to": "55.9776",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "12",
"fromt": "num",
"to": "56.0424",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "11",
"fromt": "num",
"to": "56.1072",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "10",
"fromt": "num",
"to": "56.172",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "9",
"fromt": "num",
"to": "56.2368",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "8",
"fromt": "num",
"to": "56.3016",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "7",
"fromt": "num",
"to": "56.3664",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "6",
"fromt": "num",
"to": "56.4312",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "5",
"fromt": "num",
"to": "56.496",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "4",
"fromt": "num",
"to": "56.5608",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "3",
"fromt": "num",
"to": "56.6256",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "2",
"fromt": "num",
"to": "56.6904",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "1",
"fromt": "num",
"to": "56.7552",
"tot": "num"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "0",
"fromt": "num",
"to": "56.82",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 350,
"y": 280,
"wires": [
[
"23db4689d782af3b",
"f79a71a1d299254b"
]
]
},
{
"id": "23db4689d782af3b",
"type": "debug",
"z": "09f193279e87f963",
"name": "FloatVoltAdj debug",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 610,
"y": 300,
"wires": []
},
{
"id": "7feaad870781d4f9",
"type": "debug",
"z": "09f193279e87f963",
"name": "debug 5",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 760,
"y": 460,
"wires": []
},
{
"id": "bf5ed7c5332d9077",
"type": "victron-input-battery",
"z": "09f193279e87f963",
"service": "com.victronenergy.battery/279",
"path": "/Dc/0/Voltage",
"serviceObj": {
"service": "com.victronenergy.battery/279",
"name": "Shunt Yuasa 533ah",
"communityTag": "battery"
},
"pathObj": {
"path": "/Dc/0/Voltage",
"type": "float",
"name": "Battery voltage (V)"
},
"name": "Shunt Volts",
"onlyChanges": false,
"roundValues": "2",
"rateLimit": "2",
"outputs": 1,
"conditionalMode": false,
"outputTrue": "true",
"outputFalse": "false",
"debounce": "2000",
"x": 90,
"y": 100,
"wires": [
[
"06c01ca8695077a8"
]
]
},
{
"id": "3aa4465902983b86",
"type": "change",
"z": "09f193279e87f963",
"name": "",
"rules": [
{
"t": "set",
"p": "state",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 270,
"y": 40,
"wires": [
[]
]
},
{
"id": "06c01ca8695077a8",
"type": "change",
"z": "09f193279e87f963",
"name": "set flow.voltage",
"rules": [
{
"t": "set",
"p": "voltage",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 280,
"y": 100,
"wires": [
[]
]
},
{
"id": "77507bf9233a26cf",
"type": "change",
"z": "09f193279e87f963",
"name": "",
"rules": [
{
"t": "set",
"p": "abstempvolt",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 620,
"y": 140,
"wires": [
[]
]
},
{
"id": "f79a71a1d299254b",
"type": "change",
"z": "09f193279e87f963",
"name": "",
"rules": [
{
"t": "set",
"p": "floattempvolt",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 620,
"y": 260,
"wires": [
[]
]
},
{
"id": "54826942e1266cfb",
"type": "inject",
"z": "09f193279e87f963",
"name": "Timer set to seconds (2)",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "2",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 230,
"y": 380,
"wires": [
[
"c75b1c5af0d8310e"
]
]
},
{
"id": "76cbb305dfa7ee68",
"type": "victron-virtual",
"z": "09f193279e87f963",
"name": "Davis Vantage Pro 2",
"outputs": 1,
"device": "meteo",
"default_values": true,
"acload_nrofphases": 1,
"enable_s2support": false,
"battery_capacity": 25,
"include_battery_temperature": false,
"battery_voltage_preset": "24",
"battery_voltage_custom": 24,
"generator_type": "ac",
"generator_nrofphases": 1,
"include_engine_hours": false,
"include_starter_voltage": false,
"include_history_energy": false,
"grid_nrofphases": 1,
"include_motor_temp": false,
"include_controller_temp": false,
"include_coolant_temp": false,
"include_motor_rpm": true,
"include_motor_direction": true,
"position": 0,
"pvinverter_nrofphases": 1,
"switch_1_type": 1,
"switch_1_min": 0,
"switch_1_max": "",
"switch_1_initial": 0,
"switch_1_label": "",
"switch_1_unit": "",
"switch_1_step": 1,
"switch_1_customname": "",
"switch_1_group": "",
"switch_1_include_measurement": false,
"switch_1_rgb_color_wheel": false,
"switch_1_cct_wheel": false,
"switch_1_rgb_white_dimmer": false,
"fluid_type": 0,
"include_tank_battery": false,
"include_tank_temperature": false,
"tank_battery_voltage": 3.3,
"tank_capacity": 0.2,
"temperature_type": 2,
"include_humidity": false,
"include_pressure": false,
"include_temp_battery": false,
"temp_battery_voltage": 3.3,
"x": 160,
"y": 480,
"wires": [
[]
]
},
{
"id": "7d2bfbbfb33a986c",
"type": "global-config",
"env": [],
"modules": {
"@victronenergy/node-red-contrib-victron": "1.6.63"
}
}
]
Dashboard view of Relay and other data.pdf (314.6 KB)
I have attached a dashboard screenshot, the flow and the function node script.
Thank you to all who replied