Simulating a battery charging cycle for PV-modules

Hi there,
I have a time series including the power consumption of a househould and the power generated by some photovoltaic panels at the same time. I would like to simulate the charging/discharging cycle for a battery for this system (and find optimal parameters like capacity).
I tried with moving aggregation, but have not found a concept how to take the limited capacity of the battery into account.
Any ideas to approach this are welcome


May I assume that you have both power consumption and pv production in same time slice.
The the formulas that I would try are quite straight forward:

  • Calculate the total consumption
    (pv - consumption)

  • Now you need a column with the moving aggregation for the actual battery capacity (we need the value of the last time slice), let’s call it cap_shift.

  • The battery consumption is either
    cap_shift - total consumption in case the cap_shift > total consumption
    cap_shift (the battery is empty after the cycle)

  • The new battery capacity is cap_shift - battery consumption
    The capacity should of course be capped at max battery capacity.

  • External supply calculates to total consumption - battery consumption

This model does not correctly consider feeding the power grid.


thanks for your response. Agree, the math is straight forward, yet I still search for an elegant implementation of the battery capping (to max capacity as well as zero loading). I came up with this workflow, which gives me the desired results, but it “just looks much too complicated” and it is slow, because of the use of the table read/write nodes in the loop.

sure, there is a much easier way to do it, I just cant see it… :thinking:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.