feat: 改进计算结果展示和雷电密度计算逻辑
优化雷电密度计算条件判断,移除冗余条件 改进前端结果展示格式,显示各导线跳闸率 移除雷暴日输入框的禁用状态 更新电压离散化份数的工具提示说明
This commit is contained in:
2
core.py
2
core.py
@@ -218,7 +218,7 @@ def thunder_density(i, td, ip_a, ip_b): # 雷电流幅值密度函数
|
|||||||
if td <= 20:
|
if td <= 20:
|
||||||
r = -(10 ** (-i / 44)) * math.log(10) * (-1 / 44) # 雷暴日20d
|
r = -(10 ** (-i / 44)) * math.log(10) * (-1 / 44) # 雷暴日20d
|
||||||
return r
|
return r
|
||||||
if td <= 40 and td>20:
|
if td>20:
|
||||||
r = -(10 ** (-i / 88)) * math.log(10) * (-1 / 88) # 雷暴日40d
|
r = -(10 ** (-i / 88)) * math.log(10) * (-1 / 88) # 雷暴日40d
|
||||||
return r
|
return r
|
||||||
raise Exception("检查雷电参数!")
|
raise Exception("检查雷电参数!")
|
||||||
|
|||||||
2
main.py
2
main.py
@@ -150,7 +150,7 @@ def run_egm(para: Parameter) -> dict:
|
|||||||
/ math.pi
|
/ math.pi
|
||||||
) # 挂点处保护角
|
) # 挂点处保护角
|
||||||
logger.info(f"挂点处保护角{shield_angle_at_avg_height:.3f}°")
|
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
|
rated_voltage = para.rated_voltage
|
||||||
for u_bar in range(voltage_n): # 计算不同工作电压下的跳闸率
|
for u_bar in range(voltage_n): # 计算不同工作电压下的跳闸率
|
||||||
if para.ac_or_dc=="AC":
|
if para.ac_or_dc=="AC":
|
||||||
|
|||||||
@@ -105,7 +105,6 @@
|
|||||||
v-model="params.parameter.td"
|
v-model="params.parameter.td"
|
||||||
type="number"
|
type="number"
|
||||||
label="雷暴日 (d)"
|
label="雷暴日 (d)"
|
||||||
:disable="isTdDisabled"
|
|
||||||
>
|
>
|
||||||
<q-tooltip>一年中雷暴天数,用于计算地闪密度</q-tooltip>
|
<q-tooltip>一年中雷暴天数,用于计算地闪密度</q-tooltip>
|
||||||
</q-input>
|
</q-input>
|
||||||
@@ -244,7 +243,7 @@
|
|||||||
type="number"
|
type="number"
|
||||||
label="计算时电压分成多少份"
|
label="计算时电压分成多少份"
|
||||||
>
|
>
|
||||||
<q-tooltip>将电压波形离散化的份数,影响计算精度</q-tooltip>
|
<q-tooltip>将电压波形离散化的份数,即将交流电压在一个周期内的不同值进行计算。</q-tooltip>
|
||||||
</q-input>
|
</q-input>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
@@ -331,7 +330,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<pre class="text-caption bg-white q-pa-md rounded">{{ result }}</pre>
|
<div class="text-body1">
|
||||||
|
<div class="q-mb-sm"><strong>跳闸率:</strong>{{ result.tripping_rate }}</div>
|
||||||
|
<div v-if="result.n_sf_phases && result.n_sf_phases.length > 0" class="q-mb-sm">
|
||||||
|
<strong>各导线跳闸率:</strong>
|
||||||
|
<span v-for="(rate, index) in result.n_sf_phases" :key="index" class="q-mr-md">
|
||||||
|
导线{{ index + 1 }}: {{ rate.toFixed(4) }} 次/(100km·a)
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-green-800 q-mt-md">{{ result.message }}</div>
|
||||||
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
@@ -374,7 +382,7 @@ const defaultParams: AllParameters = {
|
|||||||
|
|
||||||
const params = reactive<AllParameters>(JSON.parse(JSON.stringify(defaultParams)))
|
const params = reactive<AllParameters>(JSON.parse(JSON.stringify(defaultParams)))
|
||||||
const calculating = ref(false)
|
const calculating = ref(false)
|
||||||
const result = ref<string | null>(null)
|
const result = ref<{ tripping_rate: string; n_sf_phases: number[]; message: string } | null>(null)
|
||||||
const error = ref<string | null>(null)
|
const error = ref<string | null>(null)
|
||||||
const logRef = ref<InstanceType<typeof LogComponent> | null>(null)
|
const logRef = ref<InstanceType<typeof LogComponent> | null>(null)
|
||||||
const fileInput = ref<HTMLInputElement | null>(null)
|
const fileInput = ref<HTMLInputElement | null>(null)
|
||||||
@@ -486,14 +494,11 @@ const calculate = async () => {
|
|||||||
logRef.value?.addLog('info', '开始 EGM 计算(开发模式)...')
|
logRef.value?.addLog('info', '开始 EGM 计算(开发模式)...')
|
||||||
logRef.value?.addLog('info', '参数: 额定电压=750kV, 雷暴日=20d, 海拔=1000m')
|
logRef.value?.addLog('info', '参数: 额定电压=750kV, 雷暴日=20d, 海拔=1000m')
|
||||||
logRef.value?.addLog('info', '计算完成')
|
logRef.value?.addLog('info', '计算完成')
|
||||||
result.value = JSON.stringify({
|
result.value = {
|
||||||
success: true,
|
|
||||||
message: '计算完成(开发模式)',
|
|
||||||
data: {
|
|
||||||
tripping_rate: '0.0581 次/(100km·a)',
|
tripping_rate: '0.0581 次/(100km·a)',
|
||||||
parameters: params
|
n_sf_phases: [0.0421, 0.0581, 0.0392],
|
||||||
|
message: '计算完成'
|
||||||
}
|
}
|
||||||
}, null, 2)
|
|
||||||
calculating.value = false
|
calculating.value = false
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
@@ -724,8 +729,13 @@ onMounted(() => {
|
|||||||
// 接收计算结果
|
// 接收计算结果
|
||||||
window.receiveResult = (res: { success: boolean; message: string; data?: any; error?: string }) => {
|
window.receiveResult = (res: { success: boolean; message: string; data?: any; error?: string }) => {
|
||||||
calculating.value = false
|
calculating.value = false
|
||||||
if (res.success) {
|
if (res.success && res.data) {
|
||||||
result.value = JSON.stringify(res, null, 2)
|
result.value = {
|
||||||
|
tripping_rate: res.data.tripping_rate || '',
|
||||||
|
n_sf_phases: res.data.n_sf_phases || [],
|
||||||
|
message: res.message || '计算完成'
|
||||||
|
}
|
||||||
|
logRef.value?.addLog('info', '计算完成')
|
||||||
} else {
|
} else {
|
||||||
error.value = res.error || res.message
|
error.value = res.error || res.message
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user