调整epanet工具目录结构;联通前端水质分析模块功能;新建 readme.md

This commit is contained in:
2026-01-30 15:24:56 +08:00
parent 9d7a9fb2fd
commit 9037bf317b
12 changed files with 128 additions and 69 deletions

View File

@@ -5,7 +5,10 @@ from math import pi, sqrt
import pytz
import app.services.simulation as simulation
from app.algorithms.api_ex.run_simulation import run_simulation_ex, from_clock_to_seconds_2
from app.algorithms.api_ex.run_simulation import (
run_simulation_ex,
from_clock_to_seconds_2,
)
from app.native.api.project import copy_project
from app.services.epanet.epanet import Output
from app.services.scheme_management import store_scheme_info
@@ -43,7 +46,7 @@ def burst_analysis(
modify_fixed_pump_pattern: dict[str, list] = None,
modify_variable_pump_pattern: dict[str, list] = None,
modify_valve_opening: dict[str, float] = None,
scheme_Name: str = None,
scheme_name: str = None,
) -> None:
"""
爆管模拟
@@ -55,7 +58,7 @@ def burst_analysis(
:param modify_fixed_pump_pattern: dict中包含多个水泵模式str为工频水泵的idlist为修改后的pattern
:param modify_variable_pump_pattern: dict中包含多个水泵模式str为变频水泵的idlist为修改后的pattern
:param modify_valve_opening: dict中包含多个阀门开启度str为阀门的idfloat为修改后的阀门开启度
:param scheme_Name: 方案名称
:param scheme_name: 方案名称
:return:
"""
scheme_detail: dict = {
@@ -169,19 +172,19 @@ def burst_analysis(
modify_fixed_pump_pattern=modify_fixed_pump_pattern,
modify_variable_pump_pattern=modify_variable_pump_pattern,
modify_valve_opening=modify_valve_opening,
scheme_Type="burst_Analysis",
scheme_Name=scheme_Name,
scheme_type="burst_analysis",
scheme_name=scheme_name,
)
# step 3. restore the base model status
# execute_undo(name) #有疑惑
if is_project_open(new_name):
close_project(new_name)
delete_project(new_name)
# return result
# 存储方案信息到 PG 数据库
store_scheme_info(
name=name,
scheme_name=scheme_Name,
scheme_type="burst_Analysis",
scheme_name=scheme_name,
scheme_type="burst_analysis",
username="admin",
scheme_start_time=modify_pattern_start_time,
scheme_detail=scheme_detail,
@@ -400,11 +403,11 @@ def flushing_analysis(
def contaminant_simulation(
name: str,
modify_pattern_start_time: str, # 模拟开始时间,格式为'2024-11-25T09:00:00+08:00'
modify_total_duration: int = 900, # 模拟总历时,秒
source: str = None, # 污染源节点ID
concentration: float = None, # 污染源浓度单位mg/L
modify_total_duration: int, # 模拟总历时,秒
source: str, # 污染源节点ID
concentration: float, # 污染源浓度单位mg/L
scheme_name: str = None,
source_pattern: str = None, # 污染源时间变化模式名称
scheme_Name: str = None,
) -> None:
"""
污染模拟
@@ -418,6 +421,12 @@ def contaminant_simulation(
:param scheme_Name: 方案名称
:return:
"""
scheme_detail: dict = {
"source": source,
"concentration": concentration,
"duration": modify_total_duration,
"pattern": source_pattern,
}
print(
datetime.now(pytz.timezone("Asia/Shanghai")).strftime("%Y-%m-%d %H:%M:%S")
+ " -- Start Analysis."
@@ -520,8 +529,8 @@ def contaminant_simulation(
simulation_type="extended",
modify_pattern_start_time=modify_pattern_start_time,
modify_total_duration=modify_total_duration,
scheme_Type="contaminant_Analysis",
scheme_Name=scheme_Name,
scheme_type="contaminant_analysis",
scheme_name=scheme_name,
)
# for i in range(1,operation_step):
@@ -529,7 +538,15 @@ def contaminant_simulation(
if is_project_open(new_name):
close_project(new_name)
delete_project(new_name)
# return result
# 存储方案信息到 PG 数据库
store_scheme_info(
name=name,
scheme_name=scheme_name,
scheme_type="contaminant_analysis",
username="admin",
scheme_start_time=modify_pattern_start_time,
scheme_detail=scheme_detail,
)
############################################################