16 lines
554 B
Python
16 lines
554 B
Python
from typing import Dict, Any
|
|
from ..models import LocalProblem
|
|
|
|
|
|
class DERAdapter:
|
|
"""Tiny adapter converting LocalProblem into a DER-shared representation."""
|
|
def to_shared(self, lp: LocalProblem) -> Dict[str, Any]:
|
|
return {
|
|
"type": "DER",
|
|
"neighborhood_id": getattr(lp, "neighborhood_id", None),
|
|
"demand_kw": getattr(lp, "demand_kw", 0.0),
|
|
"pv_kw": getattr(lp, "pv_kw", 0.0),
|
|
"storage_kwh": getattr(lp, "storage_kwh", 0.0),
|
|
"evs": getattr(lp, "evs", 0),
|
|
}
|