59 lines
2.0 KiB
Markdown
59 lines
2.0 KiB
Markdown
# SolFuse
|
|
|
|
SolFuse is a privacy-preserving federation layer for hybrid microgrids.
|
|
It coordinates solar, wind, and thermal storage sites through summarized signals, incremental plan deltas, and auditable governance instead of raw data exchange.
|
|
|
|
## What It Provides
|
|
|
|
- Canonical protocol primitives for local optimization, shared signals, dual variables, and plan deltas
|
|
- A SQLite-backed graph-of-contracts registry for adapter versioning and schema conformance
|
|
- An ADMM-lite solver for federated dispatch planning
|
|
- Signed message envelopes and DID-style identities for short-lived trust
|
|
- Audit logging and privacy-budget accounting
|
|
- Delta-sync journaling for islanded/offline operation
|
|
|
|
## Package Layout
|
|
|
|
- `solfuse.models`: protocol objects and canonical payload schemas
|
|
- `solfuse.identity`: identity generation, signing, and verification
|
|
- `solfuse.registry`: adapter registry and schema conformance checks
|
|
- `solfuse.solver`: federated consensus solver
|
|
- `solfuse.delta_sync`: incremental plan journal and replay helpers
|
|
- `solfuse.governance`: audit log and privacy budget ledger
|
|
- `solfuse.transport`: canonical envelope serialization and TLS context helpers
|
|
- `solfuse.cli`: small demo entry point
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
python3 -m pip install -e .[dev]
|
|
pytest
|
|
solfuse demo
|
|
```
|
|
|
|
## Minimal Example
|
|
|
|
```python
|
|
from solfuse.models import LocalProblem
|
|
from solfuse.solver import ADMMLiteSolver
|
|
|
|
solver = ADMMLiteSolver(rho=1.0, tolerance=1e-6, max_iterations=100)
|
|
result = solver.solve([
|
|
LocalProblem(site_id="solar-a", preferred_dispatch=[4.0, 4.5], quadratic_weight=2.0),
|
|
LocalProblem(site_id="storage-b", preferred_dispatch=[1.0, 1.5], quadratic_weight=1.5),
|
|
])
|
|
|
|
print(result.consensus)
|
|
```
|
|
|
|
## Governance Model
|
|
|
|
Each message can be wrapped in a signed envelope, recorded in the audit ledger, and charged against a privacy budget.
|
|
Contract adapters are versioned and validated against JSON Schema so controllers can be swapped without changing the federation core.
|
|
|
|
## Testing And Build
|
|
|
|
- `bash test.sh`
|
|
- `pytest`
|
|
- `python3 -m build`
|