Builder¶
pyconvexity.solvers.pypsa.builder
¶
Network building functionality for PyPSA solver integration.
Simplified to always use MultiIndex format for consistent multi-period optimization.
NetworkBuilder
¶
Builds PyPSA networks from database data.
Simplified to always create MultiIndex snapshots for consistent multi-period optimization, even for single-year models.
build_network(conn, scenario_id: Optional[int] = None, progress_callback: Optional[Callable[[int, str], None]] = None, include_unmet_loads: bool = True) -> pypsa.Network
¶
Build complete PyPSA network from database (single network per database).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conn
|
Database connection |
required | |
scenario_id
|
Optional[int]
|
Optional scenario ID |
None
|
progress_callback
|
Optional[Callable[[int, str], None]]
|
Optional progress callback |
None
|
include_unmet_loads
|
bool
|
Whether to include unmet load components (default: True) |
True
|
Returns:
| Type | Description |
|---|---|
Network
|
Configured PyPSA Network object |
load_network_data(conn, scenario_id: Optional[int] = None) -> Dict[str, Any]
¶
Load network data as structured dictionary without building PyPSA network (single network per database).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conn
|
Database connection |
required | |
scenario_id
|
Optional[int]
|
Optional scenario ID |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dictionary with all network data |