Traffic - OscarMCY/bluesky GitHub Wiki
In BlueSky, the Traffic object is a global singleton (only one instance exists) that contains all of the data related to the actual simulation of the traffic. This data can be aircraft-related (e.g., aircraft positions, velocities, etc.), but can also include other simulated aspects affecting the aircraft such as weather (a wind model, turbulence) or aircraft performance models.
在BlueSky中,交通对象是一个全局性的单子(只存在一个实例),包含所有与交通实际模拟有关的数据。这些数据可以是与飞机有关的(如飞机位置、速度等),但也可以包括影响飞机的其他模拟方面,如天气(风模型、湍流)或飞机性能模型。
The Traffic object offers a number of methods to help with managing all aircraft at once. However, inside the object the various parameters are represented by numpy vectors that contain the value of that parameter for all existing aircraft. This enables the use of fast numpy vector calculations wherever these traffic parameters are used. (To find out more about this, look here.)
交通对象提供了许多方法来帮助一次管理所有飞机。然而,在对象内部,各种参数是由包含所有现有飞机的参数值的numpy向量表示的。这使得在使用这些流量参数的地方可以使用快速的numpy向量计算。(要了解更多这方面的信息,请看这里)。
The number of aircraft that exist in the simulation at any given time is represented in the Traffic object by the variable ntraf
. In the simulation each aircraft has a unique identifier which is shown in the aircraft label on the radar screen (and which can be used to send commands to the aircraft). For an aircraft with identifier AC123
, the index of this aircraft in all parameter vectors can be found using the Traffic object member function id2idx("AC123")
.
在任何时候,模拟中存在的飞机的数量在交通对象中由变量ntraf表示。在模拟中,每架飞机都有一个唯一的标识符,显示在雷达屏幕上的飞机标签中(可以用来向飞机发送命令)。对于标识符为AC123的飞机,该飞机在所有参数向量中的索引可以通过交通对象的成员函数id2idx("AC123")找到。
The Traffic object is accessible as a top-level import from the bluesky package:
交通对象可作为顶层导入从 bluesky 包中访问。
from bluesky import traf
# Get number of aircraft
num_ac = traf.ntraf
# Get the index of the aircraft with identifier KL204 and print its latitude
idx = traf.id2idx("KL204")
print(traf.lat[idx])
...
Part of the Traffic object are also system simulations like the Airborne Separation Assurance System (ASAS, in traf.asas
), the autopilot (in traf.ap
) and the flight management system (FMS, in traf.ap.route
and traf.actwp
for the active waypoint data).
交通对象的一部分也是系统模拟,如机载分离保证系统(ASAS,在traf.asas中)、自动驾驶仪(在traf.ap中)和飞行管理系统(FMS,在traf.ap.route和traf.actwp中的主动航点数据)。
The variables are available as part of the traffic object:
这些变量可作为交通对象的一部分。
Basic aircraft information
Name | Unit | Description |
---|---|---|
id | string | Aircraft identifier / callsign |
type | string | Aircraft type |
Aircraft location and orientation
Name | Unit | Description |
---|---|---|
lat | deg | Aircraft latitude |
lon | deg | Aircraft longitude |
alt | m | Aircraft altitude |
hdg | deg | Aircraft heading |
trk | deg | Aircraft track angle |
distflown | m | Aircraft distance flown |
Aircraft velocities
Name | Unit | Description |
---|---|---|
tas | m/s | Aircraft true airspeed |
gs | m/s | Aircraft ground speed |
gsnorth | m/s | Aircraft ground speed north component |
gseast | m/s | Aircraft ground speed east component |
cas | m/s | Aircraft calibrated airspeed |
M | - | Aircraft mach number |
vs | m/s | Aircraft vertical speed |
Atmospheric properties per aircraft
Name | Unit | Description |
---|---|---|
p | N/m^2 | Air pressure |
rho | kg/m^3 | Air density |
Temp | K | Air temperature |
dtemp | K | Delta-t for non-ISA conditions |
Aircraft autopilot settings
Name | Unit | Description |
---|---|---|
selspd | m/s or - | Aircraft selected speed (CAS or Mach) |
selalt | m | Aircraft selected altitude |
selvs | m/s | Aircraft selected vertical speed |
Aircraft navigation settings
Name | Unit | Description |
---|---|---|
swlnav | boolean | Lateral navigation (LNAV) guidance mode is on/off |
swvnav | boolean | Vertical navigation (VNAV) guidance is on/off |
swvnavspd | boolean | Vertical navigation speed guidance is on/off |
Child objects The traffic object has several child objects with specific functionality: