第二版参数和代码

This commit is contained in:
n3040 2022-02-05 23:23:58 +08:00
parent 4c4c0e036b
commit 510daf0516
3 changed files with 116 additions and 0 deletions

View File

@ -0,0 +1,18 @@
title = "绕击跳闸率计算文件"
[parameter]
rated_voltage=750 #额定电压等级
h_c_sag = 14.43 # 导线弧垂
h_g_sag = 11.67 # 地线弧垂
h_whole = 100 # 杆塔全高
insulator_c_len = 6.8 # 导线串子绝缘长度
string_c_len = 9.2 # 导线串长
string_g_len = 0.5 # 地线串长
h_arm = [100,80] # 导、地线挂点垂直距离
gc_x = [17.9,17] # 导、地线水平坐标,计算的是中相
ground_angels = [0] # 地面倾角,向下为正,单位°
altitude = 1000 # 海拔,单位米
max_i = 200 # 最大尝试电流单位kA
td=20#雷暴日
[optional]
voltage_n=3 #计算时电压分成多少份

23
article.toml Normal file
View File

@ -0,0 +1,23 @@
title = "绕击跳闸率计算文件"
[parameter]
rated_voltage = 750 # 额定电压等级
h_c_sag = 14.43 # 导线弧垂
h_g_sag = 11.67 # 地线弧垂
insulator_c_len = 7.0 # 导线串子绝缘长度
string_c_len = 9.2 # 导线串长
string_g_len = 0.5 # 地线串长
h_arm = [100, 80] # 导、地线挂点垂直距离,计算的是中相
gc_x = [17.9, 17] # 导、地线水平坐标,计算的是中相
ground_angels = [0] # 地面倾角,向下为正,单位°
altitude = 1500 # 海拔,单位米
td = 20 # 雷暴日
[advance]
# ng=29.6 #地闪密度 !!注意!! 如果地闪密度大于0则不会通过雷暴日计算地闪密度。填-1则忽略该项数据。
# Ip_a=19.896 #概率密度曲线系数a !!注意!! 如果该值大于0则不会通过雷暴日计算雷电流概率。填-1则忽略该项数据。
# Ip_b=3.012 #概率密度曲线系数b !!注意!! 如果该值大于0则不会通过雷暴日计算雷电流概率。填-1则忽略该项数据。
ng = -1 # 地闪密度 !!注意!! 如果地闪密度大于0则不会通过雷暴日计算地闪密度。填-1则忽略该项数据。
Ip_a = -1 # 概率密度曲线系数a !!注意!! 如果该值大于0则不会通过雷暴日计算雷电流概率。填-1则忽略该项数据。
Ip_b = -1 # 概率密度曲线系数b !!注意!! 如果该值大于0则不会通过雷暴日计算雷电流概率。填-1则忽略该项数据。
[optional]
voltage_n = 3 # 计算时电压分成多少份
max_i = 200 # 最大尝试电流单位kA

75
parameter_test.py Normal file
View File

@ -0,0 +1,75 @@
import datetime
import pymongo
from easyprocess import EasyProcess
import numpy as np
import re
if __name__ == "__main__":
result = {}
utc_now = datetime.datetime.utcnow()
print(f"当前utc时间{utc_now}")
client = pymongo.MongoClient(
"mongodb+srv://dmy:uqXLtjkJRKzWYnSpK8jF@cluster0.x0ged.mongodb.net/db?retryWrites=true&w=majority"
)
db = client["db"]
result_collection = db["result_collection"]
with open("article_parameter.toml", encoding="utf-8") as toml_file:
toml_string = toml_file.read()
for altitude in np.arange(1500, 4000, 500):
for height in np.arange(100, 160, 10):
for ground_arm_length in np.arange(17, 25, 0.01):
replaced_toml_string = toml_string
replaced_toml_string = replaced_toml_string.replace(
"ARM", f"{ground_arm_length:.3f}"
)
replaced_toml_string = replaced_toml_string.replace(
"HEIGHT", str(height)
)
replaced_toml_string = replaced_toml_string.replace(
"MID", str(height - 20)
)
replaced_toml_string = replaced_toml_string.replace(
"ALTITUDE", str(altitude)
)
with open(
"abc_parameter.toml", "w", encoding="utf-8"
) as parameter_toml_file:
parameter_toml_file.write(replaced_toml_string)
print(f"计算{altitude}m海拔{height}m全塔高,{ground_arm_length:.3f}m横担长的跳闸率")
console_output = (
EasyProcess(
[
"python",
"d:/code/EGM/main.py",
"d:/code/EGM/abc_parameter.toml",
]
)
.call()
.stderr
)
tripout_rate = re.findall("不同相跳闸率是\[(.*)\]", console_output)[0]
print(f"跳闸率是{tripout_rate}")
if float(tripout_rate) < 0.14:
print(f"最短地线横担是{ground_arm_length:.3f}m")
if altitude not in result:
result[altitude] = {}
if height not in result[altitude]:
result[altitude][height] = {}
result[altitude][height] = ground_arm_length
record_id = result_collection.insert_one(
{
"cate": "最短地线横担长度",
"utc_time": utc_now,
"altitude": float(altitude),
"height": float(height),
"地线横担长度": float(ground_arm_length),
"跳闸率": tripout_rate,
}
)
print(f"id{record_id}")
break
for altitude in np.arange(1500, 4000, 500):
for height in np.arange(100, 160, 10):
ground_arm_length = result[altitude][height]
print(f"{altitude}m海拔{height}m全塔高,需要最短{ground_arm_length:.3f}m横担")