redistribute the demands
This commit is contained in:
@@ -91,3 +91,14 @@ def distribute_demand_to_nodes(name: str, demand: float, nodes: list[str], type:
|
|||||||
def distribute_demand_to_region(name: str, demand: float, region: str, type: str = DISTRIBUTION_TYPE_ADD) -> ChangeSet:
|
def distribute_demand_to_region(name: str, demand: float, region: str, type: str = DISTRIBUTION_TYPE_ADD) -> ChangeSet:
|
||||||
nodes = get_nodes_in_region(name, region)
|
nodes = get_nodes_in_region(name, region)
|
||||||
return distribute_demand_to_nodes(name, demand, nodes, type)
|
return distribute_demand_to_nodes(name, demand, nodes, type)
|
||||||
|
|
||||||
|
def get_total_base_demand(name:str,region:str)->float:
|
||||||
|
nodes = get_nodes_in_region(name, region)
|
||||||
|
t_demands=0.0
|
||||||
|
for node in nodes:
|
||||||
|
if not is_junction(name, node):
|
||||||
|
continue
|
||||||
|
ds = get_demand(name, node)['demands']
|
||||||
|
t_demands= t_demands+ds[0]['demand']
|
||||||
|
|
||||||
|
return t_demands
|
||||||
@@ -2,6 +2,7 @@ from tjnetwork import *
|
|||||||
from get_realValue import *
|
from get_realValue import *
|
||||||
from get_hist_data import *
|
from get_hist_data import *
|
||||||
import datetime
|
import datetime
|
||||||
|
from api.s36_wda_cal import *
|
||||||
|
|
||||||
|
|
||||||
ids=['2498','3854','3853','2510','2514','4780','4854']
|
ids=['2498','3854','3853','2510','2514','4780','4854']
|
||||||
@@ -54,7 +55,12 @@ def get_l_tank_leve()->float:
|
|||||||
|
|
||||||
# test interface
|
# test interface
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if get_current_data()==True:
|
# if get_current_data()==True:
|
||||||
tQ=get_current_total_Q()
|
# tQ=get_current_total_Q()
|
||||||
print(f"the current tQ is {tQ}\n")
|
# print(f"the current tQ is {tQ}\n")
|
||||||
data=get_hist_data(ids,conver_beingtime_to_ucttime('2024-04-10 15:05:00'),conver_beingtime_to_ucttime('2024-04-10 15:10:00'))
|
# data=get_hist_data(ids,conver_beingtime_to_ucttime('2024-04-10 15:05:00'),conver_beingtime_to_ucttime('2024-04-10 15:10:00'))
|
||||||
|
open_project("beibeizone")
|
||||||
|
regions=get_all_service_area_ids("beibeizone")
|
||||||
|
for region in regions:
|
||||||
|
t_basedmds=api.s36_wda_cal.get_total_base_demand("beibeizone",region)
|
||||||
|
print(f"{region}:{t_basedmds}")
|
||||||
@@ -2,4 +2,7 @@ from tjnetwork import *
|
|||||||
from get_current_status import *
|
from get_current_status import *
|
||||||
|
|
||||||
def run_simulation(cur_datetime:str=None)->str:
|
def run_simulation(cur_datetime:str=None)->str:
|
||||||
|
|
||||||
|
open_project('beibei_skeleton')
|
||||||
|
|
||||||
return
|
return
|
||||||
Reference in New Issue
Block a user