Engineering · Simulator 083
An off-grid home runs on solar panels and a battery. The sun shines at midday, but people use the most power in the morning and evening. Change the panel size, battery capacity and power limit, efficiency and weather, then watch the battery fill and empty, and count the hours when the lights go out.
Every few minutes the model compares solar generation G and load L:
G > L: charge with min(G − L, P_max, room left); the rest is spilled
G < L: discharge min(L − G, P_max, energy stored); anything still missing is unmet demand
The state of charge (SOC) is the energy stored as a share of capacity. Charging and discharging each lose a little energy: with round-trip efficiency η, each 1 kWh put in returns only η kWh (the model applies √η each way).
Two limits matter. Capacity (kWh) decides how much midday sun can be carried into the night. The power rating (kW) of the battery and inverter decides how fast it can deliver: a full battery still cannot meet a 1.3 kW evening peak through a 1 kW inverter.
The solar output is a half-sine from 6:00 to 18:00 with the chosen peak; "Mixed weather" scales each day by 100%, 35%, 80%, 25%, 100%, 60% and 90%. The load has a small base, a morning peak and a larger evening peak, scaled to the daily total.
Idealized profiles, no grid connection, no battery ageing or temperature effects, and no limit on how deeply the battery may be discharged. Real systems usually keep a reserve and use forecasts.
Panels with a 1.3 kW peak make about 9.9 kWh/day, and the home uses 10 kWh/day, so energy almost balances. Over three sunny days everything is served, but over a week some demand goes unmet. Why?
Much of the evening and night load must pass through the battery, and every kWh stored loses 10% on the round trip. So the usable energy is less than the 9.9 kWh generated, and the battery drains a little each day: after a week the SOC has fallen from 50% to about 14% and about 2.6% of demand is unmet. Try solar peak 1.3 kW for 3 days, then 7.