无线网络

Posted by tianhaoo on July 25, 2021 本文阅读量

python

# 传输速率取决于带宽,发送者的功率,期望到达的距离
def get_rate(B, power, distance):
    P_mw = math.pow(10, power / 10)  # mW
    N0_mw_MHz = math.pow(10, N0 / 10)  # mW/MHz
    path_loss = 10 * salpha * math.log(distance, 10) + C_path_loss  # dB
    channel_variance = math.pow(10, -0.1 * path_loss)
    sigma = math.sqrt((2 / (4 - math.pi)) * math.sqrt(channel_variance))
    h = sigma / (distance * distance)
    c = B * 1000 * math.log(1 + (P_mw * h) / (B) * N0_mw_MHz), 2)  # bit/ms
    return c  # bit/ms