修复rg计算公式的错误。

This commit is contained in:
facat 2021-09-13 02:06:51 +08:00
parent ef60e1474b
commit 0acd9d617c
1 changed files with 8 additions and 8 deletions

16
main.py
View File

@ -96,7 +96,7 @@ def rc_fun(i, u_ph):
def rg_fun(i_curt, h_cav):
if h_cav < 40:
rg = (3.6 + 1.7 ** math.log(43 - h_cav)) ** 0.65
rg = (3.6 + 1.7 ** math.log(43 - h_cav)) * (i_curt ** 0.65)
else:
rg = 5.5 * (i_curt ** 0.65)
return rg
@ -223,7 +223,7 @@ def tangent_line_k(line_x, line_y, center_x, center_y, radius, init_k=10.0):
# TODO:需要检验k值不存在的情况
k_candidate = [-100, 100]
if abs(center_y - line_y) < 1e-4 and abs(line_x - center_x - radius) < 1e-4:
if abs(center_y - line_y) < 1 and abs(line_x - center_x - radius) < 1:
# k不存在
k_candidate = [99999999, 99999999]
else:
@ -247,9 +247,9 @@ def tangent_line_k(line_x, line_y, center_x, center_y, radius, init_k=10.0):
break
d_k = -fk / d_fk
k += d_k
if abs(d_k) < 1e-4:
if abs(d_k) < 1e-3:
dd = distance_point_line(center_x, center_y, line_x, line_y, k)
if abs(dd - radius) < 1e-5:
if abs(dd - radius) < 1:
k_candidate[ind] = k
break
# 把k转化成相应的角度从x开始逆时针为正
@ -257,7 +257,7 @@ def tangent_line_k(line_x, line_y, center_x, center_y, radius, init_k=10.0):
for kk in k_candidate:
if kk == None:
abc = 123
tangent_line_k(line_x, line_y, center_x, center_y, radius)
# tangent_line_k(line_x, line_y, center_x, center_y, radius)
pass
if kk >= 0:
k_angle.append(math.atan(kk))
@ -270,13 +270,13 @@ def tangent_line_k(line_x, line_y, center_x, center_y, radius, init_k=10.0):
def egm():
for u_bar in range(1):
u_ph = math.sqrt(2) * 750 * math.cos(2 * math.pi / 6 * 0) / 1.732 # 运行相电压
h_gav = 30
h_gav = 140
h_cav = h_gav - 9.5 - 2.7 - 5 # 导线对地平均高
dgc = -2.9 # 导地线水平距离
dgc = 2.9 # 导地线水平距离
# 迭代法计算最大电流
i_max = 0
_min_i = 20 # 尝试的最小电流
_max_i = 300 # 尝试的最大电流
_max_i = 200 # 尝试的最大电流
for i_bar in np.linspace(_min_i, _max_i, int((_max_i - _min_i) / 0.1)): # 雷电流
print(f"尝试计算电流为{i_bar:.2f}")
rs = rs_fun(i_bar)