D1 · Lesson 9 · Capstone
A solar and battery microgrid serving a steady load, the day's energy balance, how much the battery must carry through the night, simulating the battery hour by hour, and finding out whether a given battery can keep the lights on day after day
An island, a remote village or a field hospital runs on its own microgrid: solar panels, a battery and a diesel generator as backup. The question its designer must answer is simple to state: will this system keep the lights on through the night, every night, without burning diesel? It depends on how much energy the panels make, how much the load uses, how much the battery can hold, and the losses each time energy goes in and out. This capstone pulls together the energy thinking of lessons 7 and 8 and checks it with an hour-by-hour simulation.
- A microgrid's solar output (a half-sine from 6:00 to 18:00 peaking at ) and a steady load L.
- Where solar exceeds the load, the surplus charges the battery; where it falls short, the battery covers the gap.
- The readouts give the day's energies: whether the panels make enough in total, and how much the battery must carry from evening to morning.
Predict
A 15 kW load runs all day from solar peaking at 60 kW and a 200 kWh battery with 95% efficiency each way. The panels make about 460 kWh a day against 360 kWh of load. Can the 200 kWh battery keep the lights on every night?
The energy balance is fine, but timing isn't. Solar falls below 15 kW at about 17:00 and doesn't exceed it again until about 7:00, so the battery must supply about 14 hours × 15 kW = 210 kWh, or 221 kWh at its terminals after discharge losses, more than its 200 kWh. The simulation below shows it running dry just before dawn, about 2 kWh short.
Name it
Energy balance
Over a day, solar energy must at least cover the load plus the losses on the energy that passes through the battery. For a half-sine solar profile peaking at , daily energy is kWh (12 hours with an average of of the peak). A load L draws 24L kWh.
Battery size
The battery must carry the load through the hours when solar is below it. If those hours add up to T and the discharge efficiency is , the battery needs at least of usable energy, plus margin for cloudy days. A battery that fills by midday wastes (curtails) the rest of the surplus.
Sustainable cycling
A daily cycle repeats only if the battery ends the day with at least the charge it started with. The simulation below checks that, together with any unmet energy (which the diesel must supply) and curtailed surplus.
Worked example
How long must the battery carry the load in the predict question, and what usable capacity does that need?
Show the solution
- When solar meets the load. Solar equals the 15 kW load when that is, when the sine is 0.25: and again at t = 17.03 h.
- Hours on the battery. From 17:00 to 7:00 is about 14 h.
- Usable capacity.
- Check in the sim. A 300 kWh battery starting each midnight at 110 kWh covers the whole day and ends at 185 kWh. The 200 kWh battery fills by midday and ends every day at 97.7 kWh, which isn't enough for the next night.
Answer the battery carries the load for about 14 hours, which needs about 221 kWh of usable capacity.
Worked example
The microgrid's 60 kW peak of half-sine solar against a steady 15 kW load: what are the daily solar energy and the daily load?
Show the solution
- Daily solar energy.
- Daily load.
- Surplus. There's a 98 kWh surplus on a clear day, before battery losses take their share of the energy that passes through storage.
Answer the panels make 458 kWh a day, and the load uses 360 kWh.
Worked example
On a cloudy day the panels make 30% of their clear-day output. How much must the diesel generator supply, and how much fuel does it burn at 0.3 L/kWh?
Show the solution
- Cloudy-day solar.
- Diesel energy. Against 360 kWh of load: more if the battery starts the day low.
- Fuel.
- Sizing. A few cloudy days a month set the fuel budget, which is why microgrids size the battery and the diesel together.
Answer the diesel must supply 222.5 kWh and burns about 67 L.
Check
Write simulate_day: run the microgrid's battery hour by hour.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Solar output follows a half-sine from 6:00 to 18:00 peaking at 60 kW. How much energy does it make in a day?
Write units the way you normally would: 1.5 kWh, 1500 Wh and 0.0015 MWh are the same answer.
Check
A 15 kW load must run from the battery for 12 hours with discharge efficiency 0.95. What usable capacity does the battery need?
Write units the way you normally would: 1.5 kWh, 1500 Wh and 0.0015 MWh are the same answer.
Check
Ignoring timing, what solar peak (half-sine, 6:00 to 18:00) makes enough energy for a 20 kW constant load if all of the load's energy passes through a battery of round-trip efficiency 0.85?
Write units the way you normally would: 1.5 kW, 1500 W and 0.0015 MW are the same answer.
Check
A microgrid's solar follows a half-sine peaking at 60 kW over 12 hours; the load is a steady 10 kW.
(a)
What is the daily solar energy?
Write units the way you normally would: 1.5 kWh, 1500 Wh and 0.0015 MWh are the same answer.
(b)
What surplus or shortfall (negative) is there over the day, before battery losses?
Check
The microgrid's 15 kW load must be carried by the battery for 12 hours each night, with 95% discharge efficiency.
(a)
What usable capacity does that need?
Write units the way you normally would: 1.5 kWh, 1500 Wh and 0.0015 MWh are the same answer.
(b)
What nameplate capacity, if only 80% may be used?
Explain why
Why can a microgrid run short at night even when its panels make more energy than the load uses each day?
The daily energy balance only says the panels produce enough in total; it says nothing about when. Solar arrives in the middle of the day, while the load continues through the evening and night, so the energy for those hours must be stored, and a battery can only shift as much as it can hold. If the battery fills by midday, the rest of the surplus is curtailed and wasted, and if its capacity is smaller than the night's energy need plus losses, it runs dry before sunrise no matter how much surplus there was. Sizing a microgrid means matching the battery to the longest stretch the load must be carried, then checking that the cycle repeats.
Practice
Keep practicing
7 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.