为 emitter_demand 添加新的 pattern,使用新的 pattern 模拟管道冲洗
This commit is contained in:
@@ -348,16 +348,39 @@ def flushing_analysis(
|
|||||||
options = get_option(new_name)
|
options = get_option(new_name)
|
||||||
units = options["UNITS"]
|
units = options["UNITS"]
|
||||||
# step 2. set the emitter coefficient of drainage node or add flush flow to the drainage node
|
# step 2. set the emitter coefficient of drainage node or add flush flow to the drainage node
|
||||||
|
# 新建 pattern
|
||||||
|
time_option = get_time(new_name)
|
||||||
|
hydraulic_step = time_option["HYDRAULIC TIMESTEP"]
|
||||||
|
secs = from_clock_to_seconds_2(hydraulic_step)
|
||||||
|
cs_pattern = ChangeSet()
|
||||||
|
pt = {}
|
||||||
|
factors = []
|
||||||
|
tmp_duration = modify_total_duration
|
||||||
|
while tmp_duration > 0:
|
||||||
|
factors.append(1.0)
|
||||||
|
tmp_duration = tmp_duration - secs
|
||||||
|
pt["id"] = "flushing_pt"
|
||||||
|
pt["factors"] = factors
|
||||||
|
cs_pattern.append(pt)
|
||||||
|
add_pattern(new_name, cs_pattern)
|
||||||
|
# 为 emitter_demand 添加新的 pattern
|
||||||
emitter_demand = get_demand(new_name, drainage_node_ID)
|
emitter_demand = get_demand(new_name, drainage_node_ID)
|
||||||
cs = ChangeSet()
|
cs = ChangeSet()
|
||||||
if flushing_flow > 0:
|
if flushing_flow > 0:
|
||||||
for r in emitter_demand["demands"]:
|
if units == "LPS":
|
||||||
if units == "LPS":
|
emitter_demand["demands"].append(
|
||||||
r["demand"] += flushing_flow / 3.6
|
{
|
||||||
elif units == "CMH":
|
"demand": flushing_flow / 3.6,
|
||||||
r["demand"] += flushing_flow
|
"pattern": "flushing_pt",
|
||||||
cs.append(emitter_demand)
|
"category": None,
|
||||||
set_demand(new_name, cs)
|
}
|
||||||
|
)
|
||||||
|
elif units == "CMH":
|
||||||
|
emitter_demand["demands"].append(
|
||||||
|
{"demand": flushing_flow, "pattern": "flushing_pt", "category": None}
|
||||||
|
)
|
||||||
|
cs.append(emitter_demand)
|
||||||
|
set_demand(new_name, cs)
|
||||||
else:
|
else:
|
||||||
pipes = get_node_links(new_name, drainage_node_ID)
|
pipes = get_node_links(new_name, drainage_node_ID)
|
||||||
flush_diameter = 50
|
flush_diameter = 50
|
||||||
|
|||||||
Reference in New Issue
Block a user