This code specifically handles the management of battery systems, In a renewable energy context (Storage Batteries). Here's a breakdown of its main components and functionalities: Overview
The flow dynamically adjusts the grid setpoint and discharge currents based on the state of charge (SOC) of a battery at specific times throughout the day. It also includes notification mechanisms for different stages of battery maintenance. Key Components
Inject Nodes:
These nodes (like Battery Maintenance and Fail Safe Grid Setpoint) trigger actions at specific times or intervals. They send messages that can initiate the process of adjusting grid setpoints.
Change Nodes:
These nodes (9c8d5dd92d377ae7 and de417502891bb773) set flow context variables for SOC and grid setpoint based on incoming messages.
Function Node (b0aca53a40cf4053):
This is the core logic that calculates the grid setpoint based on the current SOC and the time of day. It defines rules for what the grid setpoint should be during various times (20:00, 21:00, 22:00, and 23:00) depending on the SOC levels.
Delay Nodes:
These introduce delays for certain messages, allowing notifications to be sent after a specified period (e.g., after maintenance starts or specific SOC thresholds are reached).
Notification Nodes (pushover):
These send notifications (like Battery Maintenance Start, Finished, and other maintenance updates) to users, providing real-time updates on the battery's status.
Switch Nodes:
These direct the flow based on specific conditions, such as whether the payload matches a certain value (e.g., checking if the grid setpoint is -6000 or -3000).
Victron Nodes:
These nodes (victron-output-ess, victron-input-battery, etc.) interact with Victron Energy's systems, allowing for the reading and writing of battery settings and values.
Functionality Summary
The flow begins by injecting values into the system (like current SOC).
Depending on the SOC and time, it determines the appropriate grid setpoint and DVCC settings.
Notifications are sent out at various points in the process to keep users informed of status changes.
The flow is designed to respond dynamically, adjusting the grid settings to optimize battery usage and efficiency.
Conclusion
Overall, this code is a sophisticated automation setup for managing battery operations, ensuring efficient energy use, and keeping users informed of maintenance activities.
UPDATED CODE AS OF 16/10/2024:
Full Comparison of the Original and Updated Code:
Aspect Original Code Updated Code Initialization Initializes soc, currentTime, gridsetpoint, and dvcc. Same initialization as the original. Output Object Initializes the output object to store gridsetpoint and dvcc. Same initialization as the original. 20:00 to 20:59 Checks SOC only at 20:00: Continuous checking from 20:00 to 20:59: - If SOC ≥ 41%, sets gridsetpoint to -1800. - If SOC > 40%, sets gridsetpoint to -1800. - If SOC ≤ 40%, sets gridsetpoint to -50. - If SOC ≤ 40%, sets gridsetpoint to -50. 21:00 Specific check only at 21:00: Specific check at 21:00, but also continues checking from 21:01 to 21:59. - If SOC ≥ 50%, sets gridsetpoint to -3000. - If SOC ≥ 50%, sets gridsetpoint to -3000. - If SOC = 40%, sets gridsetpoint to -50. - If SOC = 40%, sets gridsetpoint to -50. - If SOC < 40%, sets gridsetpoint to -50. - If SOC < 40%, sets gridsetpoint to -50. 21:01 to 21:59 No continuous checking; only checks at 21:00. Continuous checking from 21:01 to 21:59: - If SOC ≥ 50%, sets gridsetpoint to -3000. - If SOC ≥ 50%, sets gridsetpoint to -3000. - If SOC = 40%, sets gridsetpoint to -50. - If SOC < 40%, sets gridsetpoint to -50. 22:00 to 22:29 Checks only at 22:00: Continuous checking from 22:00 to 22:29: - If SOC ≥ 40%, sets gridsetpoint to -6000. - If SOC > 40%, sets gridsetpoint to -6000. - If SOC ≤ 40%, sets gridsetpoint to -50. - If SOC ≤ 40%, sets gridsetpoint to -50. 22:30 Not explicitly defined. At exactly 22:30, checks if SOC is 40% or above: If SOC ≥ 40%, sets gridsetpoint to -6900. 22:30 to 22:59 Not explicitly defined. Continuous checking from 22:30 to 22:59: If SOC ≤ 38%, resets gridsetpoint to -50. Resets to -50 at 22:59. 23:00 At exactly 23:00, resets gridsetpoint to -50 and sets dvcc to -1. Same logic as the original code. Output Preparation Prepares messages based on output values. Same message preparation as the original code. Return Messages Returns messages or null if empty. Same return logic as the original code.
Summary of Changes:
Continuous Checks:
The updated code implements continuous checking for SOC across specified time frames, allowing for real-time adjustments.
Specifically, it checks continuously from 20:00 to 20:59, from 21:01 to 21:59, and from 22:00 to 22:29, providing more dynamic control.
Granular SOC Logic:
The updated version has more granular conditions for setting the gridsetpoint, ensuring that it accurately reflects the SOC at all relevant times.
New Logic for 22:30:
The updated code includes a new condition at 22:30, setting the gridsetpoint to -6900 if the SOC is 40% or above, which was not present in the original.
Overall Responsiveness:
The updated code enhances the system's responsiveness to changes in SOC, ensuring that the gridsetpoint is adjusted in real time based on continuous monitoring.
This detailed comparison highlights how the updated code improves upon the original by incorporating continuous monitoring and more detailed SOC checks, leading to better control and responsiveness.