Microgrid dispatch calculator

A simple rule-based hourly dispatch for one week: solar first, then battery, then generator. It is not an optimiser.

Illustrative inputs. The load is invented (a small clinic, school and pump site). Solar is pvlib output for Greensboro, NC typical-year weather, scaled by your array size. The generator defaults come from the fuel-curve example in HOMER's manual, not from a measured diesel set. Use whole numbers or decimals; write 10000, not 10,000.
Start from:

Site and week

Battery

Generator

Defaults: 50 kW set, 8.48 L/h at 25 kW and 15.3 L/h at rated output (HOMER Pro 3.16 manual, slope page). That gives a slope of 0.273 and an intercept of 1.65 L/h, which we derived.

Battery (kWh)Renewable fractionGenerator hoursStartsDiesel (L)Unmet load (kWh)Unmet, no generator (kWh)Stored at end (kWh)

Method: 168 hourly steps from Monday 00:00. Solar serves load first; surplus charges the battery and the rest is curtailed. A deficit is met by the battery. If the battery cannot cover it all, the generator starts, serves the deficit at no less than its minimum load, and any extra output charges the battery if there is room. Renewable fraction is 1 minus generator kWh divided by load served, so generator kWh used to charge the battery count as non-renewable. Hourly steps hide short peaks, start-up surges and ramp limits. It is a teaching aid, not a design.