Step 1 of 3
The request
Energy dispatch simulator for a commercial microgrid
Read the full request
Build GridShift, an interactive energy dispatch simulator for a commercial microgrid. Seed three named synthetic days, each with 96 quarter-hour demand and solar forecasts and time-of-use prices. Combine a scenario panel, stacked dispatch chart, battery charge timeline and transparent cost breakdown. Users adjust capacity, initial charge, charge/discharge power, reserve percentage and price threshold. Deterministic policy: solar serves demand first, surplus solar charges the battery subject to capacity and charging power, expensive intervals discharge the battery into unmet demand subject to reserve and discharge power, and the grid covers the rest. Do not export battery energy or charge it from the grid. Convert kW to kWh using 0.25 hours, assume 100% efficiency and explain this simplification. Reject negative or nonfinite values and initial charge outside reserve-to-capacity bounds. Expose interval arithmetic, save two named scenarios, compare grid import, peak grid kW and energy cost, and export 96 CSV rows. Use a precise midnight-and-cyan engineering aesthetic. Deliver a directly previewable root index.html using self-contained HTML/CSS/JavaScript, synthetic data clearly labelled, English copy and no remote assets, external APIs or credentials. Include accessible labelled controls, keyboard focus, useful empty/error states, local persistence and Reset demo. Provide a README and executable Node built-in tests for the domain logic. Verify the real main user journey in a browser at mobile and desktop widths before delivery. Before delivery, exercise each acceptance criterion with recorded, observable results. For persistence, save a distinctive value, reload the actual page and observe the restored UI. Keep domain calculations separate enough for tests to import the production functions.
The journey
- Read the requestTurned it into a list of things it would have to prove before calling the work done.
- Did the workPlanned the pieces, built them and checked the result as it went.
- Delivered4 files handed over.
The result
- index.html13.6 KB
- README.md1.4 KB
- server.js430 B
- test/gridshift.test.js1.2 KB