From 510daf05169a7aa0163dc49458e2a199202fe36c Mon Sep 17 00:00:00 2001 From: n3040 Date: Sat, 5 Feb 2022 23:23:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E7=89=88=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=92=8C=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- article-第一版论文的参数.toml | 18 +++++++++ article.toml | 23 +++++++++++ parameter_test.py | 75 +++++++++++++++++++++++++++++++++++ 3 files changed, 116 insertions(+) create mode 100644 article-第一版论文的参数.toml create mode 100644 article.toml create mode 100644 parameter_test.py diff --git a/article-第一版论文的参数.toml b/article-第一版论文的参数.toml new file mode 100644 index 0000000..0b8a289 --- /dev/null +++ b/article-第一版论文的参数.toml @@ -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 #计算时电压分成多少份 diff --git a/article.toml b/article.toml new file mode 100644 index 0000000..f2a94e5 --- /dev/null +++ b/article.toml @@ -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 diff --git a/parameter_test.py b/parameter_test.py new file mode 100644 index 0000000..a793f52 --- /dev/null +++ b/parameter_test.py @@ -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横担")