feat: 添加交流/直流标识支持
在参数模型中添加ac_or_dc字段,支持从配置文件中读取交流或直流标识,并在前端界面根据电压等级自动判断显示
This commit is contained in:
1
core.py
1
core.py
@@ -25,6 +25,7 @@ class Parameter:
|
||||
ng: float # 地闪密度 次/(每平方公里·每年)
|
||||
Ip_a: float # 概率密度曲线系数a
|
||||
Ip_b: float # 概率密度曲线系数b
|
||||
ac_or_dc: str # 交流或直流标识,"AC" 或 "DC",默认 "AC"
|
||||
|
||||
|
||||
para = Parameter()
|
||||
|
||||
1
main.py
1
main.py
@@ -50,6 +50,7 @@ def read_parameter(toml_file_path):
|
||||
para.h_arm = toml_parameter["h_arm"]
|
||||
para.altitude = toml_parameter["altitude"]
|
||||
para.rated_voltage = toml_parameter["rated_voltage"]
|
||||
para.ac_or_dc = toml_parameter.get("ac_or_dc", "AC") # 交流或直流标识,默认AC
|
||||
toml_advance = toml_dict["advance"]
|
||||
para.ng = toml_advance["ng"] # 地闪密度
|
||||
para.Ip_a = toml_advance["Ip_a"] # 概率密度曲线系数a
|
||||
|
||||
@@ -32,6 +32,15 @@
|
||||
label="额定电压等级 (kV)"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<q-input
|
||||
:model-value="currentType"
|
||||
label="电流类型"
|
||||
readonly
|
||||
>
|
||||
<q-tooltip>交流(AC)或直流(DC),由电压等级自动判断</q-tooltip>
|
||||
</q-input>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<q-input
|
||||
v-model="params.parameter.h_c_sag"
|
||||
@@ -308,7 +317,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import { ref, reactive, computed } from 'vue'
|
||||
import type { AllParameters } from '@/types'
|
||||
import LogComponent from './Log.vue'
|
||||
|
||||
@@ -316,6 +325,7 @@ import LogComponent from './Log.vue'
|
||||
const defaultParams: AllParameters = {
|
||||
parameter: {
|
||||
rated_voltage: '500kV',
|
||||
ac_or_dc: 'AC',
|
||||
h_c_sag: 14.43,
|
||||
h_g_sag: 11.67,
|
||||
insulator_c_len: 7.02,
|
||||
@@ -349,6 +359,11 @@ const voltageOptions = [
|
||||
'±500kV', '±660kV', '±800kV', '±1100kV'
|
||||
]
|
||||
|
||||
// 根据电压等级自动判断交流/直流
|
||||
const currentType = computed(() => {
|
||||
return params.parameter.rated_voltage.includes('±') ? 'DC' : 'AC'
|
||||
})
|
||||
|
||||
// 数组操作函数(最多3条导线,即数组最多4个元素:1地线+3导线)
|
||||
// 两个数组同步增减
|
||||
const addHArm = () => {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
export interface Parameter {
|
||||
// 基本参数
|
||||
rated_voltage: string // 额定电压等级 (kV)
|
||||
ac_or_dc: string // 交流或直流标识,"AC" 或 "DC"
|
||||
h_c_sag: number // 导线弧垂 (m)
|
||||
h_g_sag: number // 地线弧垂 (m)
|
||||
insulator_c_len: number // 导线串子绝缘长度 (m)
|
||||
|
||||
Reference in New Issue
Block a user