【无标题】

# 导入所需的库
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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值