考虑了电压的影响
This commit is contained in:
19
core.py
19
core.py
@@ -115,6 +115,7 @@ def intersection_angle(dgc, h_gav, h_cav, i_curt, u_ph): # 暴露弧的角度
|
||||
rc, rg, dgc, h_cav
|
||||
) # 暴露圆和补雷线的交点
|
||||
np_circle_intersection = np.array(circle_intersection)
|
||||
# TODO to be removed
|
||||
if not circle_intersection:
|
||||
abc = 123
|
||||
theta2_line = np_circle_intersection - np.array([dgc, h_cav])
|
||||
@@ -122,10 +123,6 @@ def intersection_angle(dgc, h_gav, h_cav, i_curt, u_ph): # 暴露弧的角度
|
||||
np_circle_line_intersection = np.array(circle_line_intersection)
|
||||
theta1_line = np_circle_line_intersection - np.array([dgc, h_cav])
|
||||
theta1 = math.atan(theta1_line[1] / theta1_line[0])
|
||||
# 考虑雷电入射角度,所以theta1可以小于0,即计算从侧面击中的雷
|
||||
# if theta1 < 0:
|
||||
# # print(f"θ_1角度为负数{theta1:.4f},人为设置为0")
|
||||
# theta1 = 0
|
||||
return np.array([theta1, theta2])
|
||||
|
||||
|
||||
@@ -134,13 +131,14 @@ def distance_point_line(point_x, point_y, line_x, line_y, k):
|
||||
return d
|
||||
|
||||
|
||||
def fun_calculus_pw(theta, max_w):
|
||||
def func_calculus_pw(theta, max_w):
|
||||
w_fineness = 0.01
|
||||
r_pw = 0
|
||||
# TODO to be removed
|
||||
if int(max_w / w_fineness) < 0:
|
||||
abc = 123
|
||||
pass
|
||||
w_samples, d_w = np.linspace(0, max_w, int(max_w / w_fineness) + 1, retstep=True)
|
||||
w_samples, d_w = np.linspace(0, max_w, int(max_w / w_fineness), retstep=True)
|
||||
for cal_w in w_samples[:-1]:
|
||||
r_pw += (
|
||||
(
|
||||
@@ -164,7 +162,7 @@ def calculus_bd(theta, rc, rs, rg, dgc, h_cav, h_gav): # 对θ进行积分
|
||||
if d_to_rs < rs: # 相交
|
||||
# 要用过直线上一点到暴露弧的切线
|
||||
new_k = tangent_line_k(line_x, line_y, 0, h_gav, rs, init_k=k)
|
||||
|
||||
# TODO to be removed
|
||||
if not new_k:
|
||||
a = 12
|
||||
tangent_line_k(line_x, line_y, 0, h_gav, rs, init_k=k)
|
||||
@@ -172,9 +170,11 @@ def calculus_bd(theta, rc, rs, rg, dgc, h_cav, h_gav): # 对θ进行积分
|
||||
max_w = math.atan(new_k) # 用于保护弧相切的角度
|
||||
elif new_k < 0:
|
||||
max_w = math.atan(new_k) + math.pi
|
||||
# TODO to be removed
|
||||
if max_w < 0:
|
||||
abc = 123
|
||||
tangent_line_k(line_x, line_y, 0, h_gav, rs, init_k=k)
|
||||
# TODO to be removed
|
||||
global gCount
|
||||
gCount += 1
|
||||
if gCount % 100 == 0:
|
||||
@@ -189,6 +189,7 @@ def calculus_bd(theta, rc, rs, rg, dgc, h_cav, h_gav): # 对θ进行积分
|
||||
pass
|
||||
else:
|
||||
max_w = theta + math.pi / 2 # 入射角
|
||||
# TODO to be removed
|
||||
if gCount % 200 == 0:
|
||||
# # intersection_angle(dgc, h_gav, h_cav, i_curt, u_ph)
|
||||
# gMSP.add_circle((0, h_gav), rs)
|
||||
@@ -200,7 +201,7 @@ def calculus_bd(theta, rc, rs, rg, dgc, h_cav, h_gav): # 对θ进行积分
|
||||
# )
|
||||
# gCAD.save()
|
||||
pass
|
||||
r = rc / math.cos(theta) * fun_calculus_pw(theta, max_w)
|
||||
r = rc / math.cos(theta) * func_calculus_pw(theta, max_w)
|
||||
return r
|
||||
|
||||
|
||||
@@ -212,7 +213,7 @@ def bd_area(i_curt, u_ph, dgc, h_gav, h_cav): # 暴露弧的投影面积
|
||||
rg = rg_fun(i_curt, h_cav)
|
||||
r_bd = 0
|
||||
theta_sample, d_theta = np.linspace(
|
||||
theta1, theta2, int((theta2 - theta1) / theta_fineness) + 1, retstep=True
|
||||
theta1, theta2, int((theta2 - theta1) / theta_fineness), retstep=True
|
||||
)
|
||||
for calculus_theta in theta_sample[:-1]:
|
||||
r_bd += (
|
||||
|
||||
Reference in New Issue
Block a user