From 9557e18fd10f2f5e839568a6ee304429ff04f55d Mon Sep 17 00:00:00 2001 From: dmy Date: Tue, 3 Mar 2026 10:39:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E9=9B=B7=E7=94=B5?= =?UTF-8?q?=E6=B5=81=E5=AF=86=E5=BA=A6=E8=AE=A1=E7=AE=97=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E5=B9=B6=E4=BF=AE=E5=A4=8D=E5=8D=95=E4=BD=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正雷暴日判断条件从等于改为小于等于,并添加中间范围判断 修复日志中电流单位显示错误(kV改为kA) 初始化时根据雷暴日自动计算地闪密度 --- core.py | 4 ++-- main.py | 2 +- webui/src/components/ParameterForm.vue | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core.py b/core.py index a012a85..7aeda86 100644 --- a/core.py +++ b/core.py @@ -215,10 +215,10 @@ def thunder_density(i, td, ip_a, ip_b): # 雷电流幅值密度函数 ) return r else: - if td == 20: + if td <= 20: r = -(10 ** (-i / 44)) * math.log(10) * (-1 / 44) # 雷暴日20d return r - if td == 40: + if td <= 40 and 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 2dc286a..114500b 100644 --- a/main.py +++ b/main.py @@ -290,7 +290,7 @@ def run_egm(para: Parameter) -> dict: ** 0.5 ) if distance > rc: - logger.info(f"电流为{i_bar}kV时,暴露弧已经完全被屏蔽") + logger.info(f"电流为{i_bar}kA时,暴露弧已经完全被屏蔽") exposed_curve_shielded = True break animate.pause() diff --git a/webui/src/components/ParameterForm.vue b/webui/src/components/ParameterForm.vue index 82e98e8..c8d28b6 100644 --- a/webui/src/components/ParameterForm.vue +++ b/webui/src/components/ParameterForm.vue @@ -668,6 +668,11 @@ declare global { // 注册全局日志接收函数,供后端实时调用 onMounted(() => { + // 程序启动时,根据雷暴日初始化地闪密度 + if (params.parameter.td > 0 && params.advance.ng < 0) { + params.advance.ng = Math.round(0.023 * Math.pow(params.parameter.td, 1.3) * 100) / 100 + } + // 实时日志推送 window.addLogFromBackend = (log: { level: string; time: string; message: string }) => { logRef.value?.addLog(log.level as any, log.message)