一些小细节的修改。
This commit is contained in:
41
core.py
41
core.py
@@ -1,6 +1,5 @@
|
||||
import math
|
||||
import ezdxf
|
||||
import numba
|
||||
import numpy as np
|
||||
|
||||
gCAD = None
|
||||
@@ -47,9 +46,10 @@ class Draw:
|
||||
rg_rc_intersection = solve_circle_intersection(
|
||||
rg, rc, rg_x, rg_y, rc_x, rc_y
|
||||
)
|
||||
msp.add_line(
|
||||
(rc_x, rc_y), rg_rc_intersection, dxfattribs={"color": color}
|
||||
) # 圆和圆的交点
|
||||
if rg_rc_intersection:
|
||||
msp.add_line(
|
||||
(rc_x, rc_y), rg_rc_intersection, dxfattribs={"color": color}
|
||||
) # 圆和圆的交点
|
||||
# 计算圆交点
|
||||
|
||||
# msp.add_line((dgc, h_cav), circle_intersection) # 导线
|
||||
@@ -58,6 +58,10 @@ class Draw:
|
||||
doc = self._doc
|
||||
doc.saveas("egm.dxf")
|
||||
|
||||
def saveas(self, file_name):
|
||||
doc = self._doc
|
||||
doc.saveas(file_name)
|
||||
|
||||
|
||||
# 圆交点
|
||||
def solve_circle_intersection(
|
||||
@@ -69,8 +73,8 @@ def solve_circle_intersection(
|
||||
center_y2,
|
||||
):
|
||||
# 用牛顿法求解
|
||||
x = radius2 # 初始值
|
||||
y = radius2 # 初始值
|
||||
x = radius2 + center_x2 # 初始值
|
||||
y = radius2 + center_y2 # 初始值
|
||||
# TODO 考虑出现2个解的情况
|
||||
for bar in range(0, 10):
|
||||
A = [
|
||||
@@ -89,7 +93,7 @@ def solve_circle_intersection(
|
||||
return []
|
||||
|
||||
|
||||
# 圆与地面线交点
|
||||
# 圆与捕雷线交点
|
||||
def solve_circle_line_intersection(radius, rg, center_x, center_y):
|
||||
distance = distance_point_line(center_x, center_y, 0, rg, 0) # 捕雷线到暴露圆中点的距离
|
||||
if distance > radius:
|
||||
@@ -259,9 +263,10 @@ def bd_area(
|
||||
rc = rc_fun(i_curt, u_ph)
|
||||
rs = rs_fun(i_curt)
|
||||
rg = rg_fun(i_curt, rc_y, u_ph, typ=rg_type)
|
||||
theta_sample, d_theta = np.linspace(
|
||||
theta1, theta2, int((theta2 - theta1) / theta_fineness), retstep=True
|
||||
)
|
||||
theta_segments = int((theta2 - theta1) / theta_fineness)
|
||||
if theta_segments < 2:
|
||||
return 0
|
||||
theta_sample, d_theta = np.linspace(theta1, theta2, theta_segments, retstep=True)
|
||||
if len(theta_sample) < 2:
|
||||
return 0
|
||||
vec_calculus_bd = np.vectorize(calculus_bd)
|
||||
@@ -322,10 +327,10 @@ def tangent_line_k(line_x, line_y, center_x, center_y, radius, init_k=10.0):
|
||||
# 把k转化成相应的角度,从x开始,逆时针为正
|
||||
k_angle = []
|
||||
for kk in k_candidate:
|
||||
if kk is None:
|
||||
abc = 123
|
||||
tangent_line_k(line_x, line_y, center_x, center_y, radius)
|
||||
pass
|
||||
# if kk is None:
|
||||
# abc = 123
|
||||
# tangent_line_k(line_x, line_y, center_x, center_y, radius)
|
||||
# pass
|
||||
if kk >= 0:
|
||||
k_angle.append(math.atan(kk))
|
||||
if kk < 0:
|
||||
@@ -354,3 +359,11 @@ def circle_ground_surface_intersection(radius, center_x, center_y, ground_surfac
|
||||
r_x = x_series[equal_location][0]
|
||||
r_y = ground_surface(r_x)
|
||||
return r_x, r_y
|
||||
|
||||
|
||||
# u_ph是相电压
|
||||
# insulator_c_len绝缘子闪络距离
|
||||
def arc_possibility(rated_voltage, insulator_c_len): # 建弧率
|
||||
_e = rated_voltage / (3 ** 0.5) / insulator_c_len
|
||||
r = (4.5 * (_e ** 0.75) - 14) * 1e-2
|
||||
return r
|
||||
|
||||
Reference in New Issue
Block a user