PV: P = η_PV · PR · A · G(t), η_PV = 0.20, PR = 0.85
G(t) = 1000 W/m² · sin(π(t-6)/12) for 6 h < t < 18 h,
reduced by (1 - 0.75·cloud)
Wind: P = ½ ρ A C_p v³, ρ = 1.2 kg/m³, C_p = 0.40
zero below 3 m/s and above 25 m/s, capped at the 12 m/s power
Battery: charge η = 0.90, discharge η = 0.90, power limit C/2
Balance each step:
E_gen + E_import = E_load + ΔE_batt + E_loss + E_curtailed
Each time step the surplus (generation minus load) charges the battery, any energy that does not fit is curtailed (wasted); a deficit is first covered by the battery and the remainder is imported from the grid. Every joule is booked into exactly one ledger line, so the residual shown above stays at rounding level (1e-12 kWh) - this is the conservation-of-energy check. A second check integrates a clear-sky day and compares the solar energy with the closed form η·PR·A·(1 kW/m²)·24/π h.
Honest simplifications. Irradiance is an idealised half-sine with a flat cloud factor; wind is a smooth synthetic wave around the mean, not measured data; the turbine uses a constant C_p and no wake, air-density or inverter effects; the battery has fixed efficiencies, no ageing, temperature or voltage model; the grid is an infinite import source and there is no frequency or voltage dynamics. It is a teaching energy-balance model, not a design tool.