全局坐标系

网络层级对象在全局坐标系中的位置由它的纬度、经度和高度描述。纬度说明该对象相对于赤道偏北或偏南的程度:正纬度位于北半球,负纬度位于南半球。经度说明该对象相对于本初子午线偏东或偏西的程度:正经度(最大到 +180°)位于东半球,负经度(最小到 -180°)位于西半球。高度是该对象在由纬度和经度值所确定的位置正上方的海拔高度,以高于海平面的米数计量。

图 188:全局坐标系

全局坐标系

对于坐标系以度或角秒为单位的子网,以及包含在这种子网内的节点,这些对象与位置相关的属性保存的是全局位置坐标。例如,在顶层子网内,节点的“x position”属性就是它的经度,“y position”属性就是它的纬度,“altitude”属性就是以米为单位的高度。

无论节点位于哪个子网中,都可以在仿真期间用内核过程 op_ima_obj_pos_get() 获取它的全局位置。如果一个节点的所有父网都是固定子网,那么固定节点返回的取值不会随时间改变。对于移动节点和卫星节点,返回的取值反映该节点在仿真中该时刻的位置。

图 189:确定全局位置坐标的进程模型状态执行器片段

/* This process just received the self interrupt that signals */
/* it to re-point the antenna at the mobile base station.     */
/* Obtain the (possibly) new coordinates of the base station. */
/* Note that only the latitude, longitude and altitude coords */
/* are of interest. The geocentric (x,y,z) coordinates are    */
/* not used.                                                  */
op_ima_obj_pos_get (base_station_objid, &lat, &lon, &alt, &tmp_dbl, &tmp_dbl,
	&tmp_dbl);
/* Set the pointing attributes of the antenna module. */
op_ima_obj_attr_set (antenna_mod_objid, “target latitude”, lat);
op_ima_obj_attr_set (antenna_mod_objid, “target longitude”, lon);
op_ima_obj_attr_set (antenna_mod_objid, “target altitude”, alt);
/* Schedule the next re-pointing timer. */
op_intrpt_schedule_self (op_sim_time () + REPOINT_TIMEOUT, REPOINT_TIMER);