src/lib/energy-engine
Engine layers
LLM → optimization engine → hard constraints → safety layer → controller. The LLM never directly controls physical assets.
- 1. llm.reason
- 2. forecasting.buildForecastBundle
- 3. optimization.optimize
- 4. safety.applyHardConstraints
- 5. safety.evaluateSafety
- 6. safety.clearForControl
- 7. control.dispatchCommands
LLM tools (read/propose)
- get_site_state — Read the latest meters, assets and tariff context.
- get_forecast — Fetch load/PV/price forecasts (not generated by the LLM).
- run_optimizer — Start the mathematical optimizer. Returns a plan, not an actuator command.
- explain_plan — Translate a plan into operator language.
- estimate_roi — Illustrative ROI from peak delta and tariff.
- draft_operator_message — Draft an approval message. Sends nothing to hardware.
Deliberately absent tools
These names do not exist in the catalogue.
write_setpoint · modbus_write · ocpp_remote_start · bacnet_write_property · relay_close
Example · advice mode
Pipeline on a sample cold store
Illustrative. Does not actuate hardware. Commands stay empty while safety does not allow in advice mode.