How evcc-io/optimizer works
Optimizer is an HTTP service that turns home-energy forecasts, tariffs, grid limits, and battery requirements into a cost-aware schedule. The main flow is request validation and configuration, MILP construction, solving, and returning schedule data and limit violations. The README also documents battery charging goals, soft constraints, and tie-breaking peak strategies. The optimizer and app excerpts are partial; the domain-model links reflect documented capabilities, while runtime links are limited to evidenced calls.
Main entry points: app.py API and request handling · optimizer.py MILP formulation · client.gen.go Go HTTP client · client.go Example CLI
Components 15
HTTP API
- API and request handling
src/optimizer/app.py - Forecast and request
- Runtime settings
src/optimizer/settings.py - Schedule and violations
src/optimizer/optimizer.py
Optimization Model
- Optimizer
src/optimizer/optimizer.py - MILP formulation
src/optimizer/optimizer.py - Cost and revenue
src/optimizer/optimizer.py - Battery limits and goals
src/optimizer/optimizer.py - Grid limits and penalties
src/optimizer/optimizer.py - Charging strategies
src/optimizer/optimizer.py
Solver Runtime
- PuLP interface
- CBC solver
Clients
- Go HTTP client
client/client.gen.go - Example CLI
cmd/client.go
Other components
- Energy manager
Connections 16
- Energy manager → API and request handling: submits request
- API and request handling → Forecast and request: parses JSON
- API and request handling → Runtime settings: reads settings
- API and request handling → Optimizer: configures and solves
- Optimizer → MILP formulation: builds model
- MILP formulation → Cost and revenue: encodes objective
- MILP formulation → Battery limits and goals: encodes constraints
- MILP formulation → Grid limits and penalties: encodes constraints
- MILP formulation → Charging strategies: encodes preferences
- Optimizer → PuLP interface: solves via
- PuLP interface → CBC solver: invokes solver
- Optimizer → Schedule and violations: extracts results
- API and request handling → Schedule and violations: returns JSON
- Energy manager → Example CLI: runs example
- Example CLI → Go HTTP client: calls client
- Go HTTP client → API and request handling: sends HTTP