# 导入所需的库
import math # 导入数学库
import pandas as pd # 导入Pandas库
# 多波束换能器系统参数以及海域中心点处的海水深度
open_corners = 120 # 开角(度)
slope = 1.5 # 坡度(度)
center_sea_depths = 70 # 海域中心点处的海水深度(米)
# 测线距中心点处的距离列表
distances = [-800, -600, -400, -200, 0, 200, 400, 600, 800]
# 存储计算结果的列表
sea_depths = [] # 存储海水深度
coverage_widths = [] # 存储覆盖宽度
overlap_rates = [] # 存储与前一条测线的重叠率
# 将开角和坡度的角度转换为弧度
def convert_to_radians(degrees):
radians = math.radians(degrees)
return radians
# 计算开角和坡度的弧度值
open_corners_rad = convert_to_radians(open_corners)
slope_rad = convert_to_radians(slope)
# 计算每个测线的海水深度、覆盖宽度和与前一条测线的重叠率
for distance in distances:
# 计算每个测线的海水深度
def calculate_sea_depth(distance, center_sea_depths, slope_rad):
sea_depth = center_sea_depths - distance * math.tan(slope_rad)
return sea_depth
sea_depth = calculate_sea_depth(distance, center_sea_depths, slope_rad)
sea_depths.append(sea_depth)
# 计算每个测线的覆盖宽度
def calculate_coverage_width(sea_depth, open_corners_rad, slope):
coverage_width = sea_depth * (
math.sin(open_corners_rad / 2) / math.sin(math.radians(90 + slope - open_corners / 2)) + math.sin(
open_corners_rad / 2) / math.sin(math.radians(90 - slope - open_corners / 2)))
return coverage_width
coverage_width = calculate_coverage_width(sea_depth, open_corners_rad, slope)
coverage_widths.append(coverage_width)
# 计算每个测线与前一条测线的重叠率
if distances.index(distance) == 0:
overlap_rate = 0 # 设定第一条测线没有重叠
else:
overlap_rate = (coverage_widths[-1] - abs(distances[-1] - distances[-2])) / coverage_widths[-1] * 100
overlap_rates.append(abs(overlap_rate))
# 创建DataFrame并保存为Excel文件
data = {
"测线距中心点处的距离/m": distances,
"海水深度/m": sea_depths,
"覆盖宽度/m": coverage_widths,
"与前一条测线的重叠率/%": overlap_rates
}
df = pd.DataFrame(data)
dt = df.T
dt.to_excel(r'D:\360MoveData\Users\Lenovo\Desktop\result1.xlsx')
print(dt)
【无标题】
最新推荐文章于 2025-01-18 16:36:04 发布