feat: 优化回路数计算逻辑,提升报表准确性
This commit is contained in:
10
gui.py
10
gui.py
@@ -781,8 +781,12 @@ def index():
|
||||
total_length_m = sum(d["length"] for d in res["eval"]["details"])
|
||||
total_length_km = total_length_m / 1000
|
||||
|
||||
# 获取回路数 (通过统计从升压站发出的连接)
|
||||
n_circuits = sum(1 for d in res["eval"]["details"] if d["source"] == "substation" or d["target"] == "substation")
|
||||
|
||||
row_dict = {
|
||||
"name": name_display,
|
||||
"n_circuits": n_circuits,
|
||||
"cost_wan": f"{res['cost'] / 10000:.2f}",
|
||||
"loss_kw": f"{res['loss']:.2f}",
|
||||
"total_length": f"{total_length_km:.2f}",
|
||||
@@ -938,6 +942,12 @@ def index():
|
||||
"required": True,
|
||||
"align": "left",
|
||||
},
|
||||
{
|
||||
"name": "n_circuits",
|
||||
"label": "回路数",
|
||||
"field": "n_circuits",
|
||||
"sortable": True,
|
||||
},
|
||||
{
|
||||
"name": "cost_wan",
|
||||
"label": "总投资 (万元)",
|
||||
|
||||
Reference in New Issue
Block a user