Support calculate_demand_to_network
This commit is contained in:
@@ -142,7 +142,7 @@ from .s32_region_util import get_nodes_in_boundary, get_nodes_in_region, calcula
|
||||
|
||||
from .s32_region import get_region_schema, get_region, set_region, add_region, delete_region
|
||||
|
||||
from .s32_water_distribution import calculate_demand_to_nodes, calculate_demand_to_region
|
||||
from .s32_water_distribution import calculate_demand_to_nodes, calculate_demand_to_region, calculate_demand_to_network
|
||||
|
||||
from .s33_district_metering_area import PARTITION_TYPE_RB, PARTITION_TYPE_KWAY
|
||||
from .s33_district_metering_area import calculate_district_metering_area
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from .database import ChangeSet
|
||||
from .s0_base import is_junction
|
||||
from .s0_base import is_junction, get_nodes
|
||||
from .s9_demands import get_demand
|
||||
from .s32_region_util import Topology, get_nodes_in_region
|
||||
from .batch_exe import execute_batch_command
|
||||
@@ -43,6 +43,11 @@ def calculate_demand_to_region(name: str, demand: float, region: str) -> dict[st
|
||||
return calculate_demand_to_nodes(name, demand, nodes)
|
||||
|
||||
|
||||
def calculate_demand_to_network(name: str, demand: float) -> dict[str, float]:
|
||||
nodes = get_nodes(name)
|
||||
return calculate_demand_to_nodes(name, demand, nodes)
|
||||
|
||||
|
||||
def distribute_demand_to_nodes(name: str, demand: float, nodes: list[str], type: str = DISTRIBUTION_TYPE_ADD) -> ChangeSet:
|
||||
if len(nodes) == 0 or demand == 0.0:
|
||||
return ChangeSet()
|
||||
|
||||
Reference in New Issue
Block a user