From 355fb2d689c375f7b8efdcf3afb5f5f4d1286301 Mon Sep 17 00:00:00 2001 From: dmy Date: Tue, 3 Mar 2026 14:54:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=B9=E8=BF=9B=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E5=B1=95=E7=A4=BA=E5=92=8C=E9=9B=B7=E7=94=B5?= =?UTF-8?q?=E5=AF=86=E5=BA=A6=E8=AE=A1=E7=AE=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化雷电密度计算条件判断,移除冗余条件 改进前端结果展示格式,显示各导线跳闸率 移除雷暴日输入框的禁用状态 更新电压离散化份数的工具提示说明 --- core.py | 2 +- main.py | 2 +- webui/src/components/ParameterForm.vue | 38 ++++++++++++++++---------- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/core.py b/core.py index 66a88c7..23726c1 100644 --- a/core.py +++ b/core.py @@ -218,7 +218,7 @@ def thunder_density(i, td, ip_a, ip_b): # 雷电流幅值密度函数 if td <= 20: r = -(10 ** (-i / 44)) * math.log(10) * (-1 / 44) # 雷暴日20d return r - if td <= 40 and td>20: + if td>20: r = -(10 ** (-i / 88)) * math.log(10) * (-1 / 88) # 雷暴日40d return r raise Exception("检查雷电参数!") diff --git a/main.py b/main.py index 2706c04..d400f30 100644 --- a/main.py +++ b/main.py @@ -150,7 +150,7 @@ def run_egm(para: Parameter) -> dict: / math.pi ) # 挂点处保护角 logger.info(f"挂点处保护角{shield_angle_at_avg_height:.3f}°") - logger.debug(f"最低相防护标识{rg_type}") + logger.debug(f"最低相防护标识{rg_type}。(g表示地面,c表示下导线)") rated_voltage = para.rated_voltage for u_bar in range(voltage_n): # 计算不同工作电压下的跳闸率 if para.ac_or_dc=="AC": diff --git a/webui/src/components/ParameterForm.vue b/webui/src/components/ParameterForm.vue index 561c271..c769f2b 100644 --- a/webui/src/components/ParameterForm.vue +++ b/webui/src/components/ParameterForm.vue @@ -105,7 +105,6 @@ v-model="params.parameter.td" type="number" label="雷暴日 (d)" - :disable="isTdDisabled" > 一年中雷暴天数,用于计算地闪密度 @@ -244,7 +243,7 @@ type="number" label="计算时电压分成多少份" > - 将电压波形离散化的份数,影响计算精度 + 将电压波形离散化的份数,即将交流电压在一个周期内的不同值进行计算。
@@ -331,7 +330,16 @@
-
{{ result }}
+
+
跳闸率:{{ result.tripping_rate }}
+
+ 各导线跳闸率: + + 导线{{ index + 1 }}: {{ rate.toFixed(4) }} 次/(100km·a) + +
+
{{ result.message }}
+
@@ -374,7 +382,7 @@ const defaultParams: AllParameters = { const params = reactive(JSON.parse(JSON.stringify(defaultParams))) const calculating = ref(false) -const result = ref(null) +const result = ref<{ tripping_rate: string; n_sf_phases: number[]; message: string } | null>(null) const error = ref(null) const logRef = ref | null>(null) const fileInput = ref(null) @@ -486,14 +494,11 @@ const calculate = async () => { logRef.value?.addLog('info', '开始 EGM 计算(开发模式)...') logRef.value?.addLog('info', '参数: 额定电压=750kV, 雷暴日=20d, 海拔=1000m') logRef.value?.addLog('info', '计算完成') - result.value = JSON.stringify({ - success: true, - message: '计算完成(开发模式)', - data: { - tripping_rate: '0.0581 次/(100km·a)', - parameters: params - } - }, null, 2) + result.value = { + tripping_rate: '0.0581 次/(100km·a)', + n_sf_phases: [0.0421, 0.0581, 0.0392], + message: '计算完成' + } calculating.value = false } } catch (e: any) { @@ -724,8 +729,13 @@ onMounted(() => { // 接收计算结果 window.receiveResult = (res: { success: boolean; message: string; data?: any; error?: string }) => { calculating.value = false - if (res.success) { - result.value = JSON.stringify(res, null, 2) + if (res.success && res.data) { + result.value = { + tripping_rate: res.data.tripping_rate || '', + n_sf_phases: res.data.n_sf_phases || [], + message: res.message || '计算完成' + } + logRef.value?.addLog('info', '计算完成') } else { error.value = res.error || res.message }