The science
Solar output follows a daytime sine bell (P = Ppeak·sin1.3) reduced by cloud cover. A wind turbine extracts P = ½ρACpv³ (ρ=1.2 kg/m³, rotor 100 m, Cp=0.45) between cut-in 3 m/s and cut-out 25 m/s, capped at its 3.5 MW rating. No turbine can beat the Betz limit Cp=16/27≈0.593; the page finds it numerically by maximising 4a(1−a)² over the induction factor a.
Dispatch each 5 minutes: wind+solar serve demand first; surplus charges the battery (92% one-way efficiency, power limit = capacity/4 per hour) and what does not fit is curtailed; deficits are covered by the battery, then gas (0.45 t CO2/MWh). The day is run twice so the battery starts from its end-of-day state. Energy balance (demand = renewables used + battery + gas) is checked every frame.
Simplifications: one synthetic day, a made-up wind pattern, no grid losses, no cost, no seasonal change; real systems need a multi-day storage and interconnection analysis.