TUDelft-CNS-ATM / bluesky

The open source air traffic simulator
GNU General Public License v3.0
365 stars 244 forks source link

why speed is not unchanged?(importing BlueSky as a python package) #452

Closed dfz-cauc-2020 closed 1 year ago

dfz-cauc-2020 commented 1 year ago

I initialized a plane named AC1 with 250 m/s speed.But it is ...

myplot

jooste commented 1 year ago

Hi @dfz-cauc-2020, this is probably a performance limit!

ProfHoekstra commented 1 year ago

What are the commands you used? Did you specify CAS in knots? Or is the graph maybe in knots?

Another thing to look at is the aircraft performance. The speeds are limited by this to both a minimum and maximum speed.

Best regards, Jacco Hoekstra

From: dfz-cauc-2020 @.> Sent: maandag 13 februari 2023 08:58 To: TUDelft-CNS-ATM/bluesky @.> Cc: Subscribed @.***> Subject: [TUDelft-CNS-ATM/bluesky] why speed is not unchanged?(importing BlueSky as a python package) (Issue #452)

I initialized a plane named AC1 with 250 m/s speed.But it is ...

[myplot]https://urldefense.com/v3/__https:/user-images.githubusercontent.com/84360925/218401691-aeb47996-4125-484a-bcf6-d06ef5049075.png__;!!PAKc-5URQlI!8f-st1aDpHfBmyrt9dcd1w1Up4uWOKtzV1QTmwyy7FeNMQRW6G3tgqYT4VyRlUK3rMH4zyk_HT5EI0-ID3mDI17TsechuA$

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/TUDelft-CNS-ATM/bluesky/issues/452__;!!PAKc-5URQlI!8f-st1aDpHfBmyrt9dcd1w1Up4uWOKtzV1QTmwyy7FeNMQRW6G3tgqYT4VyRlUK3rMH4zyk_HT5EI0-ID3mDI16ybAVsyg$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ABWT2BC6WKFAG6NMMXLYSQLWXHSRFANCNFSM6AAAAAAUZ5VG7I__;!!PAKc-5URQlI!8f-st1aDpHfBmyrt9dcd1w1Up4uWOKtzV1QTmwyy7FeNMQRW6G3tgqYT4VyRlUK3rMH4zyk_HT5EI0-ID3mDI14EX4ohzQ$. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

dfz-cauc-2020 commented 1 year ago

Dear professor Hoekstra: Thanks a lot. I do not think that I set a limit. I initialized altitude and speed with ‘m’ and ‘mps’. My code is as follows: 屏幕截图 2023-02-20 103418 Yours sincerely, Dong Fangzheng

import bluesky as bs from bluesky.simulation import ScreenIO import matplotlib.pyplot as plt import numpy as np from tqdm import trange

class ScreenDummy(ScreenIO): """ Dummy class for the screen. Inherits from ScreenIO to make sure all the necessary methods are there. This class is there to reimplement the echo method so that console messages are printed. """

def __init__(self, verbose=True):
    """Initilising the dummy screen

    Args:
        verbose (bool, optional): If BlueSky messages should be displayed. Defaults to False.
    """

    super().__init__()
    self.verbose = verbose

def echo(self, text="", flags=0):
    """Just print echo messages"""

    if self.verbose:
        print("BlueSky console:", text)

start = [52.07, -0.619361, 140, 8000, 250]# LAT,LON,HDG,ALT(m),SPD(m/s) bs.init(mode="sim", detached=True) bs.scr = ScreenDummy() ac = {} bs.traf.cre( acid="AC1", actype="B737", aclat=start[0], aclon=start[1], achdg=start[2], acalt=start[3], acspd=start[4], ) bs.stack.stack(f"LNAV AC1 ON; VNAV AC1 ON;ALT AC1 {start[3]*3.2808399};DT 1; FF;") for i in trange(1000): bs.sim.step() if i == 0: ac[bs.traf.id[0]] = [[ bs.sim.simt, bs.traf.lat[0], bs.traf.lon[0], bs.traf.alt[0], bs.traf.gs[0], # 真空速TAS 地速GS 校正空速CAS bs.traf.hdg[0], # 航向 bs.traf.vs[0] ]] else: ac[bs.traf.id[0]].append( [ bs.sim.simt, bs.traf.lat[0], bs.traf.lon[0], bs.traf.alt[0], bs.traf.gs[0], # 真空速TAS 地速GS 校正空速CAS bs.traf.hdg[0], # 航向 bs.traf.vs[0] ] )

print(ac.keys()) b = np.array(ac["AC1"]) plt.subplot(6, 1, 1) plt.plot(np.array(ac["AC1"])[:, 0], np.array(ac["AC1"])[:, 1], label="AC1") plt.xlabel("ts") plt.ylabel("lat") plt.legend() plt.subplot(6, 1, 2) plt.plot(np.array(ac["AC1"])[:, 0], np.array(ac["AC1"])[:, 2], label="AC1") plt.xlabel("ts") plt.ylabel("lon") plt.legend() plt.subplot(6, 1, 3) plt.plot(np.array(ac["AC1"])[:, 0], np.array(ac["AC1"])[:, 3], label="AC1") plt.xlabel("ts") plt.ylabel("alt") plt.legend() plt.subplot(6, 1, 4) plt.plot(np.array(ac["AC1"])[:, 0], np.array(ac["AC1"])[:, 4], label="AC1") plt.xlabel("ts") plt.ylabel("spd") plt.legend() plt.subplot(6, 1, 5) plt.plot(np.array(ac["AC1"])[:, 0], np.array(ac["AC1"])[:, 5], label="AC1") plt.xlabel("ts") plt.ylabel("hdg") plt.legend() plt.subplot(6, 1, 6) plt.plot(np.array(ac["AC1"])[:, 0], np.array(ac["AC1"])[:, 6], label="AC1") plt.xlabel("ts") plt.ylabel("roc") plt.legend() plt.show()

您使用了哪些命令?您是否以节为单位指定 CAS?或者图表可能是结? 另一件要看的事情是飞机性能。速度受此限制为最小和最大速度。 此致敬意 雅科·霍克斯特拉 来自: dfz-cauc-2020 @.> 发送时间:曼达格 13 二月 2023 08:58 收件人:TUDelft-CNS-ATM/bluesky @.> 抄送:已订阅 @.> 主题:[TUDelft-CNS-ATM/bluesky] 为什么速度没有变化?(将 BlueSky 作为 python 包导入)(问题 #452) 我初始化了一架名为AC1的飞机,速度为250米/秒。但它是... [我的情节]<https://urldefense.com/v3/https:/user-images.githubusercontent.com/84360925/218401691-aeb47996-4125-484a-bcf6-d06ef5049075.png;!!PAKc-5URQlI!8f-st1aDpHfBmyrt9dcd1w1Up4uWOKtzV1QTmwyy7FeNMQRW6G3tgqYT4VyRlUK3rMH4zyk_HT5EI0-ID3mDI17TsechuA$> — 直接回复此电子邮件,在 GitHub<https://urldefense.com/v3/https:/github.com/TUDelft-CNS-ATM/bluesky/issues/452;!!PAKc-5URQlI!8f-st1aDpHfBmyrt9dcd1w1Up4uWOKtzV1QTmwyy7FeNMQRW6G3tgqYT4VyRlUK3rMH4zyk_HT5EI0-ID3mDI16ybAVsyg$> 上查看,或取消订阅<https://urldefense.com/v3/https:/github.com/notifications/unsubscribe-auth/ABWT2BC6WKFAG6NMMXLYSQLWXHSRFANCNFSM6AAAAAAUZ5VG7I;!!PAKc-5URQlI!8f-st1aDpHfBmyrt9dcd1w1Up4uWOKtzV1QTmwyy7FeNMQRW6G3tgqYT4VyRlUK3rMH4zyk_HT5EI0-ID3mDI14EX4ohzQ>美元。 您收到此消息是因为您订阅了此线程。消息 ID:@*.**@*.***>>

jooste commented 1 year ago

Hi @dfz-cauc-2020, it most likely is a performance limit. This is not something you set, but a characteristic of the aircraft model you select.

dfz-cauc-2020 commented 1 year ago

thanks, it seems normal when I reduce the initial speed setting. I am sure that the unit of "bs.traf.gs" is meters per second, while when the initial speed setting is 160 the corresponding unchanged ground speed is 234 m/s. At the moment, I don't see the unit of the initial speed setting.

Hi @dfz-cauc-2020, it most likely is a performance limit. This is not something you set, but a characteristic of the aircraft model you select.

jooste commented 1 year ago

Internally BlueSky uses SI units in all its calculations. However, because imperial units and nautical miles are common in aviation, all stack commands expect these. Note that these are converted to SI before being passed on to the underlying functions.