目录

38.901 §7.1 坐标系详解:三段旋转、极化基角 ψ 的原理与 Sionna 源码对照

Sionna 源码
#Sionna#38.901#坐标系#旋转矩阵#天线方向图#极化

本文以 **3GPP TR 38.901 g10 草案 §7.1「Coordinate system」**为纲,讲清楚三件事:

  1. 为什么需要两套坐标系——方向图和角度参数为什么必须定义在天线自己的坐标系(LCS)里;
  2. 三段旋转(bearing α → downtilt β → slant γ)到底怎么构造——式 7.1-2/4/5 的矩阵从哪来、为什么是这个顺序;
  3. 极化基旋转角 ψ 的物理意义——式 7.1-9~15 在解决什么问题,为什么场分量变换是基矢量变换的转置。

所有公式按 g10 原文编号(7.1-1 ~ 7.1-26),并与 Sionna 1.x 的 channel_coefficients.py、 antenna.py 逐条对照到行号;文末给出可运行的数值验证脚本,证明”TR 闭合公式 = Sionna 矩阵实现”。

前置阅读:姊妹篇 《38.901 §7.5 十二步信道生成完全指南》 与 《38.901 §7.7 链路级信道模型(CDL/TDL)》 分别讲系统级与链路级模型的生成流程。本文补上它们共同依赖的几何地基—— §7.5 的 Step 11 方向图矩阵、§7.7 的 CDL 空间滤波,全都建立在 §7.1 的坐标变换之上。

一、一图总览:§7.1 在整条链路中的位置

 信道模型表(§7.5/§7.7)          §7.1 坐标系                天线模型(§7.3)
┌──────────────────┐   ┌──────────────────────────┐   ┌──────────────────┐
│ zod/aod/zoa/aoa  │   │ GCS ←──R(α,β,γ)──→ LCS  │   │ F'(θ',φ') 方向图 │
│ (全局视角的射线角)│──►│ 式7.1-2/4/5 旋转矩阵     │──►│ 极化基 (θ̂',φ̂')  │
└──────────────────┘   │ 式7.1-7/8 角度映射        │   │ 阵元位置 y'-z' 面│
                       │ 式7.1-11/15 场分量+ψ      │   └──────────────────┘
                       └──────────────────────────┘
        Sionna: _gcs_to_lcs / _compute_psi / _l2g_response
                → _step_11_field_matrix 组装成方向图矩阵

一句话概括 §7.1:把”全局看到的一条射线方向 (θ, φ)“翻译成”天线自己坐标系里的 (θ′, φ′)”, 再把天线在该方向上的极化响应旋转回全局基 (θ̂, φ̂)。前者由旋转矩阵 R 完成,后者由角 ψ 完成。

二、为什么需要两套坐标系

方向图天生属于 LCS

天线方向图是在暗室里测出来的:转台带着天线转,探头不动。测量结果自然是”天线相对 射线方向的函数”——即定义在以天线自身为参考的局部坐标系(Local Coordinate System, LCS) 上的 F′(θ′,φ′)F'(\theta',\varphi')。而信道模型(§7.4~§7.7)里的出发角/到达角 (zod/aod/zoa/aoa)是在**全局坐标系(Global Coordinate System, GCS)**里给出的。

于是 §7.1 式 7.1-1 陈述的是一个物理事实,而不是定义:

F(θ,φ)  =  F′(θ′,φ′)(7.1-1)F(\theta,\varphi) \;=\; F'(\theta',\varphi') \tag{7.1-1}

同一条射线,在 GCS 里看是 (θ,φ)(\theta,\varphi),在 LCS 里看是 (θ′,φ′)(\theta',\varphi'); 场的形状不随观察者坐标系改变,改变的只是角度坐标。§7.1 的全部工作就是求这个 坐标变换 (θ,φ)→(θ′,φ′)(\theta,\varphi)\to(\theta',\varphi'),以及极化基矢量的变换。

两套坐标系的轴怎么摆

TR 规定(§7.1.1/§7.1.2):

坐标系原点轴方向
GCS场景参考点zz 垂直向上,x/yx/y 水平
LCS天线面板的相位中心x′x' 指向主瓣法线(boresight);面板阵元布在 y′–z′y'\text{–}z' 平面

注意两个容易记错的约定:

  • boresight 在 LCS 球坐标里是 (θ′=90∘, φ′=0∘)(\theta'=90^\circ,\ \varphi'=0^\circ),即 +x′+x' 方向, 不是 +z′+z'。§7.3 的方向图公式(垂直切面 ϕ=0\phi=0、水平切面 θ=90∘\theta=90^\circ 最大) 就是按这个约定写的。
  • 垂直极化 V 沿 z′z'、水平极化 H 沿 y′y',面板法线是 x′x'。

Sionna 与此完全一致:AntennaPanel 把阵元放在 x′=0x'=0 的平面上(antenna.py L225-231,行向 −z′-z'、列向 +y′+y',单位是波长):

ant_pos[i + j * num_rows] = [0,
                             j * horizontal_spacing,
                             -i * vertical_spacing]

L233-237 把面板中心平移到原点;dual 极化时 L240-241 把第二组极化复制在同一批格点上。

三、球坐标约定与单位矢量(式 7.1-6、7.1-13/14)

GCS 中一条射线方向的单位矢量按标准球坐标展开(式 7.1-6):

(xyz)=(sin⁡θcos⁡φsin⁡θsin⁡φcos⁡θ)(7.1-6)\begin{pmatrix} x\\ y\\ z \end{pmatrix} =\begin{pmatrix} \sin\theta\cos\varphi\\ \sin\theta\sin\varphi\\ \cos\theta \end{pmatrix} \tag{7.1-6}

其中 θ\theta 是天顶角(从 +z+z 量起),φ\varphi 是方位角(从 +x+x 量起)。 切向基矢量(式 7.1-13/14):

θ^=(cos⁡θcos⁡φ, cos⁡θsin⁡φ, −sin⁡θ)(7.1-13)\hat{\boldsymbol\theta}=(\cos\theta\cos\varphi,\ \cos\theta\sin\varphi,\ -\sin\theta) \tag{7.1-13} φ^=(−sin⁡φ, cos⁡φ, 0)(7.1-14)\hat{\boldsymbol\varphi}=(-\sin\varphi,\ \cos\varphi,\ 0) \tag{7.1-14}

球坐标角与切向基矢量 (θ̂, φ̂) 示意

TR 原图(Figure 7.1.1)——笛卡尔坐标系中的球坐标角 (θ,φ)(\theta,\varphi) 与球坐标单位矢量: r^\hat r 为给定方向,θ^\hat\theta、φ^\hat\varphi 为切向基矢量:

TR 38.901 Figure 7.1.1:笛卡尔坐标系中的球坐标角与球坐标单位矢量

这三个矢量构成右手正交基 (ρ^,θ^,φ^)(\hat\rho,\hat\theta,\hat\varphi),θ^\hat\theta 指向 θ\theta 增大方向 (“往下”),φ^\hat\varphi 指向 φ\varphi 增大方向(绕 zz 逆时针)。

Sionna 对照:_unit_sphere_vector (L333-340)逐字对应式 7.1-6。它在代码里被三处复用: ① 多普勒相位 _step_11_doppler L652 用 r^⋅v⃗\hat r\cdot\vec v;② 阵元相位 _step_11_array_offsets L688-689 用 r^⋅dˉ\hat r\cdot\bar d;③ 下文所有角度映射的第一步。 Sionna 不需要显式构造 θ^/φ^\hat\theta/\hat\varphi——它用 ψ 角把基变换压缩成 2×2 旋转(见后文)。

四、§7.1.3 核心:三段内蕴旋转 R = Rz(α)·Ry(β)·Rx(γ)

三个角的命名与旋转顺序(先纠正一个常见误传)

g10 草案 §7.1.3 定义天线面板朝向用三个欧拉角,按 TR 原文的希腊字母命名:

角TR 名称绕哪根轴转物理含义
α\alphabearingGCS 的 zz 轴水平指向:把 boresight 转到目标方位
β\betadowntilt第一次旋转后的 y′y' 轴下倾:把 boresight 往水平面下压
γ\gammaslant第二次旋转后的 x′′x'' 轴(=boresight)绕视线滚转:倾斜整个面板(含极化轴)

旋转顺序是内蕴旋转 z→y′→x′′z \to y' \to x'':每一步都绕”已经转过的新轴”。 (网上不少资料把 bearing 记作 β、downtilt 记作 α,与 TR 原文相反;本文以 g10 原文 Symbol 字体定义与公式解码结果为准。Sionna 的 orientations[..., 0/1/2] 顺序与 TR 一致, 见下文行号对照。)

三段内蕴旋转:Rz(α) → Ry′(β) → Rx″(γ)

TR 原图(Figure 7.1.3-1)——灰色为 GCS,蓝色为旋转后的 LCS;红弧为 bearing α (绕 zz)、绿弧为 downtilt β(绕 y′y')、蓝弧为 slant γ(绕 x′′x'')。 带点轴(x˙\dot{x}、x¨\ddot{x} 等)标记各步旋转后的中间坐标轴,其中 x¨,x˙\ddot{x},\dot{x} 重合于 boresight——slant 绕自身轴旋转,不改变指向:

TR 38.901 Figure 7.1.3-1:以 3 次旋转将 LCS(蓝)相对 GCS(灰)定向

为什么顺序必须是 bearing → downtilt → slant?反过来想就明白了:

  • 先 bearing:在水平面内选一个竖直平面,boresight 落进这个平面;
  • 再 downtilt:在这个竖直平面内把 boresight 压低——此时绕的是”水平且垂直于 boresight”的 y′y' 轴,所以无论方位角是多少,“下倾”的物理含义都正确;
  • 最后 slant:绕 boresight 自身滚转,只影响极化轴的指向,不改变 boresight 方向。

如果先 downtilt 再 bearing,“下倾”就会变成”绕固定 yy 轴倾”,目标方位一变倾角方向就错。 这正是内蕴旋转的意义:每一步都在天线自己的当前参考系里操作。

复合矩阵(式 7.1-2 / 7.1-4)

三个基本旋转矩阵(右手系,绕轴正向逆时针为正):

Rz(α)=(cos⁡α−sin⁡α0sin⁡αcos⁡α0001),Ry(β)=(cos⁡β0sin⁡β010−sin⁡β0cos⁡β),Rx(γ)=(1000cos⁡γ−sin⁡γ0sin⁡γcos⁡γ)R_z(\alpha)=\begin{pmatrix}\cos\alpha&-\sin\alpha&0\\ \sin\alpha&\cos\alpha&0\\ 0&0&1\end{pmatrix},\quad R_y(\beta)=\begin{pmatrix}\cos\beta&0&\sin\beta\\ 0&1&0\\ -\sin\beta&0&\cos\beta\end{pmatrix},\quad R_x(\gamma)=\begin{pmatrix}1&0&0\\ 0&\cos\gamma&-\sin\gamma\\ 0&\sin\gamma&\cos\gamma\end{pmatrix}

式 7.1-2 给出复合:

R  =  Rz(α)⋅Ry(β)⋅Rx(γ)(7.1-2)R \;=\; R_z(\alpha)\cdot R_y(\beta)\cdot R_x(\gamma) \tag{7.1-2}

乘开的显式形式即式 7.1-4:

R=(cos⁡αcos⁡βcos⁡αsin⁡βsin⁡γ−sin⁡αcos⁡γcos⁡αsin⁡βcos⁡γ+sin⁡αsin⁡γsin⁡αcos⁡βsin⁡αsin⁡βsin⁡γ+cos⁡αcos⁡γsin⁡αsin⁡βcos⁡γ−cos⁡αsin⁡γ−sin⁡βcos⁡βsin⁡γcos⁡βcos⁡γ)(7.1-4)R=\begin{pmatrix} \cos\alpha\cos\beta & \cos\alpha\sin\beta\sin\gamma-\sin\alpha\cos\gamma & \cos\alpha\sin\beta\cos\gamma+\sin\alpha\sin\gamma\\ \sin\alpha\cos\beta & \sin\alpha\sin\beta\sin\gamma+\cos\alpha\cos\gamma & \sin\alpha\sin\beta\cos\gamma-\cos\alpha\sin\gamma\\ -\sin\beta & \cos\beta\sin\gamma & \cos\beta\cos\gamma \end{pmatrix} \tag{7.1-4}

逆矩阵就是转置(旋转矩阵正交,式 7.1-5):

R−1=RT(7.1-5)R^{-1}=R^{\mathsf T} \tag{7.1-5}

Sionna 对照:_forward_rotation_matrix 就是式 7.1-4 的逐元素硬编码。L351 的 a, b, c = orientations[..., 0], orientations[..., 1], orientations[..., 2] 即 a=αa=\alpha(bearing)、b=βb=\beta(downtilt)、c=γc=\gamma(slant)——与 TR 命名一致。 逐行核对:row_1(L353-360)= 7.1-4 第一行;row_2(L362-369)= 第二行; row_3(L371-378)[-sin b, cos b·sin c, cos b·cos c] = 第三行。 反向矩阵 _reverse_rotation_matrix L407 一行 rot_mat.mT 即式 7.1-5。

一个必须知道的坑:TR 正文与公式的方向矛盾

§7.1.3 的散文描述前后打架(g10 原文段落 511 与 528):

  • 段落 511 称”forward rotation matrix RR 将 GCS 中的点映射到 LCS”;
  • 段落 528 又称”forward RR 将 LCS 的单位矢量变换到 GCS”。

但看公式就清楚了:式 7.1-7/8(GCS→LCS 的角度映射)实际用的是 RTR^{\mathsf T}(即式 7.1-5), 而式 7.1-9 的基矢量变换把 LCS 基用 RR 映回 GCS。公式是自洽的,文字是混乱的。

Sionna 与公式一致,不与文字一致:

  • _rot_pos (L394-395,R⋅pR\cdot p):把 LCS 的点旋到 GCS(用于阵元位置,见 §7.1.2);
  • _gcs_to_lcs (L428-429,RT⋅ρ^R^{\mathsf T}\cdot\hat\rho):GCS→LCS 用转置。

记忆口诀:forward RR = “LCS → GCS”(把天线系的东西放回全局系), 读 TR 文字时把它自动纠正过来即可。

五、角度映射:GCS (θ, φ) → LCS (θ′, φ′)(式 7.1-7/8)

TR 原图(Figure 7.1.3-2)——同一射线在 GCS(灰)中为 (θ,φ)(\theta,\varphi)、 在 LCS(蓝)中为 (θ′,φ′)(\theta',\varphi');黄色虚线为投影辅助线:

TR 38.901 Figure 7.1.3-2:GCS 与 LCS 中的球坐标与单位矢量定义

原理

把式 7.1-6 的 ρ^\hat\rho 用 RTR^{\mathsf T} 旋转得到 LCS 中的单位矢量 ρ^′=(x′,y′,z′)\hat\rho'=(x',y',z'),再按球坐标定义反解:

θ′=arccos⁡(z′),φ′=arg⁡(x′+j y′)\theta' = \arccos(z'),\qquad \varphi' = \arg(x' + \mathrm j\,y')

把 RTR^{\mathsf T} 的列点乘 ρ^\hat\rho、代入三角恒等式 cos⁡αcos⁡φ+sin⁡αsin⁡φ=cos⁡(φ−α)\cos\alpha\cos\varphi+\sin\alpha\sin\varphi=\cos(\varphi-\alpha) 整理, 就得到 TR 的闭合公式。式 7.1-7(天顶角):

θ′=arccos⁡(cos⁡βcos⁡γcos⁡θ+sin⁡θ[sin⁡βcos⁡γcos⁡(φ−α)−sin⁡γsin⁡(φ−α)])(7.1-7)\theta'=\arccos\Big(\cos\beta\cos\gamma\cos\theta +\sin\theta\big[\sin\beta\cos\gamma\cos(\varphi-\alpha)-\sin\gamma\sin(\varphi-\alpha)\big]\Big) \tag{7.1-7}

式 7.1-8(方位角):

φ′=arg⁡(cos⁡βsin⁡θcos⁡(φ−α)−sin⁡βcos⁡θ⏟x′+j[cos⁡βsin⁡γcos⁡θ+sin⁡θsin⁡βsin⁡γcos⁡(φ−α)+sin⁡θcos⁡γsin⁡(φ−α)]⏟y′)(7.1-8)\varphi'=\arg\Big(\underbrace{\cos\beta\sin\theta\cos(\varphi-\alpha)-\sin\beta\cos\theta}_{x'} +\mathrm j\underbrace{\big[\cos\beta\sin\gamma\cos\theta+\sin\theta\sin\beta\sin\gamma\cos(\varphi-\alpha)+\sin\theta\cos\gamma\sin(\varphi-\alpha)\big]}_{y'}\Big) \tag{7.1-8}

(原文在 arg⁡\arg 内除以 sin⁡θ\sin\theta 归一化,不改变辐角,故可省略。)

Sionna 的实现:矩阵法,而非闭合公式

_gcs_to_lcs 没有展开 7.1-7/8 的三角式,而是走”矩阵乘法 + 分量提取”的等价路线:

rho_hat = self._unit_sphere_vector(theta, phi)      # L427: 式 7.1-6
rot_inv = self._reverse_rotation_matrix(orientations) # L428: 式 7.1-5
rot_rho = torch.matmul(rot_inv, rho_hat)            # L429: ρ̂' = Rᵀρ̂
z = torch.matmul(v1, rot_rho)                       # L435: 取 z' 分量 (v1=[0,0,1])
theta_prime = torch.acos(z)                         # L437: θ'=arccos(z')
phi_prime = torch.angle(torch.matmul(v2, rot_rho))  # L438: φ'=arg(x'+j·y')

两个预分配常量(L198-200、L206-208)是点积提取技巧: _v1_const = [0, 0, 1] 点乘取 z′z'; _v2_const = [1, j, 0] 点乘得 x′+jy′x' + \mathrm j y',再 torch.angle 取辐角。 (注册为 buffer 是为了 CUDA graph 兼容,见源码注释。)

数值上”闭合公式 vs Sionna 矩阵法”的偏差在 10−1410^{-14} 量级(浮点噪声), 见文末验证脚本 case2。

六、极化基旋转角 ψ:式 7.1-9 ~ 7.1-15

为什么角度映射还不够

方向图变换 F(θ,φ)=F′(θ′,φ′)F(\theta,\varphi)=F'(\theta',\varphi') 只解决了标量幅度。但场是横波矢量:

E⃗=Eθθ^+Eφφ^=Eθ′θ′^+Eφ′φ′^\vec E = E_\theta\hat{\boldsymbol\theta} + E_\varphi\hat{\boldsymbol\varphi} = E'_\theta\hat{\boldsymbol\theta'} + E'_\varphi\hat{\boldsymbol\varphi'}

(θ′^,φ′^)(\hat{\boldsymbol\theta'},\hat{\boldsymbol\varphi'}) 是 LCS 球坐标基旋回 GCS 后的结果, 它与 (θ^,φ^)(\hat{\boldsymbol\theta},\hat{\boldsymbol\varphi}) 同处”垂直于射线的平面”内, 但在这个平面里转了一个角度——这个角度就是 ψ\psi。

沿射线方向 ρ̂ 观察:GCS 基 (θ̂,φ̂) 与 LCS 基 (θ̂′,φ̂′) 的夹角 ψ

TR 原图(Figure 7.1.3-3)——由于 LCS 相对 GCS 的机械朝向,球坐标基矢量在垂直于射线的平面内旋转了角度 ψ\psi:

TR 38.901 Figure 7.1.3-3:球坐标基矢量因 LCS 朝向而旋转 ψ 角

不修正 ψ 会怎样?极化失配。例如 BS 下倾 10° 时,主瓣方向上两套基恰好对齐(ψ=0), 但偏离主瓣的射线两套基不再平行——水平/垂直极化的能量会按 ψ\psi 互相泄漏。

基变换矩阵(式 7.1-9/10)与场变换(式 7.1-11)

两套正交基同处一个平面,必有一个公共旋转角 ψ\psi:

(θ^′φ^′)=(θ^′⋅θ^θ^′⋅φ^φ^′⋅θ^φ^′⋅φ^)(θ^φ^)(7.1-9)\begin{pmatrix}\hat{\boldsymbol\theta}'\\ \hat{\boldsymbol\varphi}'\end{pmatrix} =\begin{pmatrix}\hat{\boldsymbol\theta}'\cdot\hat{\boldsymbol\theta} & \hat{\boldsymbol\theta}'\cdot\hat{\boldsymbol\varphi}\\ \hat{\boldsymbol\varphi}'\cdot\hat{\boldsymbol\theta} & \hat{\boldsymbol\varphi}'\cdot\hat{\boldsymbol\varphi}\end{pmatrix} \begin{pmatrix}\hat{\boldsymbol\theta}\\ \hat{\boldsymbol\varphi}\end{pmatrix} \tag{7.1-9}

四个点积由同一角 ψ\psi 决定(保持定向的正交阵):

(θ^′⋅θ^θ^′⋅φ^φ^′⋅θ^φ^′⋅φ^)=(cos⁡ψsin⁡ψ−sin⁡ψcos⁡ψ)(7.1-10)\begin{pmatrix}\hat{\boldsymbol\theta}'\cdot\hat{\boldsymbol\theta} & \hat{\boldsymbol\theta}'\cdot\hat{\boldsymbol\varphi}\\ \hat{\boldsymbol\varphi}'\cdot\hat{\boldsymbol\theta} & \hat{\boldsymbol\varphi}'\cdot\hat{\boldsymbol\varphi}\end{pmatrix} =\begin{pmatrix}\cos\psi & \sin\psi\\ -\sin\psi & \cos\psi\end{pmatrix} \tag{7.1-10}

场分量是同一矢量在不同基下的坐标,变换矩阵是基变换的转置(式 7.1-11):

(EθEφ)=(cos⁡ψ−sin⁡ψsin⁡ψcos⁡ψ)(Eθ′Eφ′)(7.1-11)\begin{pmatrix}E_\theta\\ E_\varphi\end{pmatrix} =\begin{pmatrix}\cos\psi & -\sin\psi\\ \sin\psi & \cos\psi\end{pmatrix} \begin{pmatrix}E'_\theta\\ E'_\varphi\end{pmatrix} \tag{7.1-11}

推导一行即可看清转置从哪来: Eθ=E⃗⋅θ^=Eθ′(θ^′⋅θ^)+Eφ′(φ^′⋅θ^)=Eθ′cos⁡ψ−Eφ′sin⁡ψE_\theta=\vec E\cdot\hat{\boldsymbol\theta} =E'_\theta(\hat{\boldsymbol\theta}'\cdot\hat{\boldsymbol\theta}) +E'_\varphi(\hat{\boldsymbol\varphi}'\cdot\hat{\boldsymbol\theta}) =E'_\theta\cos\psi-E'_\varphi\sin\psi。

ψ\psi 的定义式(式 7.1-12):

ψ=arg⁡(θ^′⋅θ^+j θ^′⋅φ^)(7.1-12)\psi = \arg\big(\hat{\boldsymbol\theta}'\cdot\hat{\boldsymbol\theta} + \mathrm j\,\hat{\boldsymbol\theta}'\cdot\hat{\boldsymbol\varphi}\big) \tag{7.1-12}

即 cos⁡ψ=θ^′⋅θ^\cos\psi=\hat{\boldsymbol\theta}'\cdot\hat{\boldsymbol\theta}、sin⁡ψ=θ^′⋅φ^\sin\psi=\hat{\boldsymbol\theta}'\cdot\hat{\boldsymbol\varphi}(式 7.1-16/17 的点积展开)。

闭合公式(式 7.1-15)与 _compute_psi 逐行对照

把 θ^′=R θ^LCS′\hat{\boldsymbol\theta}'=R\,\hat{\boldsymbol\theta}'_{\text{LCS}}(LCS 基按 7.1-13/14 在 primed 角下取值) 代入点积并化简,得 TR 式 7.1-15:

ψ=arg⁡(sin⁡γcos⁡θsin⁡(φ−α)+cos⁡γ[cos⁡βsin⁡θ−sin⁡βcos⁡θcos⁡(φ−α)]⏟real+j[sin⁡γcos⁡(φ−α)+sin⁡βcos⁡γsin⁡(φ−α)]⏟imag)(7.1-15)\psi=\arg\Big(\underbrace{\sin\gamma\cos\theta\sin(\varphi-\alpha)+\cos\gamma\big[\cos\beta\sin\theta-\sin\beta\cos\theta\cos(\varphi-\alpha)\big]}_{\text{real}} +\mathrm j\underbrace{\big[\sin\gamma\cos(\varphi-\alpha)+\sin\beta\cos\gamma\sin(\varphi-\alpha)\big]}_{\text{imag}}\Big) \tag{7.1-15}

Sionna 对照:_compute_psi 与式 7.1-15 逐字符一致: L458-460 a, b, c = orientations[..., 0/1/2](α/β/γ); L461-464 real = sin(c)·cosθ·sin(φ−a) + cos(c)·(cos(b)·sinθ − sin(b)·cosθ·cos(φ−a)); L465 imag = sin(c)·cos(φ−a) + sin(b)·cos(c)·sin(φ−a); L466 psi = torch.angle(torch.complex(real, imag))。

_l2g_response 实现式 7.1-11:L487-488 构造 [[cosψ, −sinψ], [sinψ, cosψ]],L490 左乘 2×12\times1 的 (Eθ′,Eφ′)T(E'_\theta, E'_\varphi)^{\mathsf T}。函数名 “l2g” = local-to-global,即 LCS 场分量 → GCS。

七、特例:只有下倾(α = γ = 0)与水平切面

TR 原图(Figure 7.1.4)——LCS 只绕 GCS 的 yy 轴机械下倾 β\beta 时的角度与单位矢量定义(左); 垂直于射线平面内基矢量的旋转 ψ\psi(右):

TR 38.901 Figure 7.1.4:仅有下倾角时的角度与单位矢量定义

工程上最常见的场景是 BS 只有 downtilt。式 7.1-7/8/15 分别退化为 TR 给出的:

θ′=arccos⁡(cos⁡φsin⁡θsin⁡β+cos⁡θcos⁡β)(7.1-18)\theta'=\arccos(\cos\varphi\sin\theta\sin\beta+\cos\theta\cos\beta) \tag{7.1-18} φ′=arg⁡(cos⁡φsin⁡θcos⁡β−cos⁡θsin⁡β+jsin⁡φsin⁡θ)(7.1-19)\varphi'=\arg\big(\cos\varphi\sin\theta\cos\beta-\cos\theta\sin\beta+\mathrm j\sin\varphi\sin\theta\big) \tag{7.1-19} ψ=arg⁡(sin⁡θcos⁡β−cos⁡φcos⁡θsin⁡β+j sin⁡φsin⁡β)(7.1-23)\psi=\arg\big(\sin\theta\cos\beta-\cos\varphi\cos\theta\sin\beta+\mathrm j\,\sin\varphi\sin\beta\big) \tag{7.1-23}

boresight 自检:下倾 β 后,主瓣在 GCS 里位于 (θ=90∘+β, φ=0)(\theta=90^\circ+\beta,\ \varphi=0)。 代入 7.1-18:θ′=arccos⁡(sin⁡θsin⁡β+cos⁡θcos⁡β)=arccos⁡cos⁡(θ−β)=90∘\theta'=\arccos(\sin\theta\sin\beta+\cos\theta\cos\beta)=\arccos\cos(\theta-\beta)=90^\circ ✓; 7.1-19:φ′=arg⁡(sin⁡θcos⁡β)=0\varphi'=\arg(\sin\theta\cos\beta)=0 ✓;7.1-23: ψ=arg⁡(cos⁡2β+sin⁡2β)=0\psi=\arg(\cos^2\beta+\sin^2\beta)=0 ✓——主瓣上极化基不旋转,符合直觉。

再取水平切面 θ=90∘\theta=90^\circ(式 7.1-24/25/26):

θ′=arccos⁡(cos⁡φsin⁡β)(7.1-24)\theta'=\arccos(\cos\varphi\sin\beta) \tag{7.1-24} φ′=arg⁡(cos⁡φcos⁡β+jsin⁡φ)(7.1-25)\varphi'=\arg(\cos\varphi\cos\beta+\mathrm j\sin\varphi) \tag{7.1-25} ψ=arg⁡(cos⁡β+jsin⁡φsin⁡β)(7.1-26)\psi=\arg(\cos\beta+\mathrm j\sin\varphi\sin\beta) \tag{7.1-26}

β=10∘\beta=10^\circ 时的数值(与 Sionna 一致,见验证脚本 case5):

φ\varphiθ′\theta'φ′\varphi'ψ\psi
0∘0^\circ80.00∘80.00^\circ0∘0^\circ0∘0^\circ
30∘30^\circ81.35∘81.35^\circ30.38∘30.38^\circ5.04∘5.04^\circ
90∘90^\circ90.00∘90.00^\circ90.00∘90.00^\circ10.00∘10.00^\circ

第三行很有意思:沿 +y+y 方向看(垂直于下倾平面),下倾 β 让极化基恰好整体转了 β—— 绕 y′y' 轴的旋转在那个方向上表现为”视线平面内的纯滚转”。

八、第二个坑:机械 slant γ ≠ 极化 slant ζ

TR 里有两个”slant”,完全不同,Sionna 代码里也分属两个文件:

机械 slant γ\gamma(§7.1.3)极化 slant ζ\zeta(§7.3)
作用对象整个面板(含 boresight 轴)绕自身滚转单个阵元内电场在 θ^′/φ^′\hat\theta'/\hat\varphi' 基上的分解角
进入公式式 7.1-4/7/8/15式 7.3-4/5:fθ′=acos⁡ζ, fφ′=asin⁡ζf_{\theta'}=a\cos\zeta,\ f_{\varphi'}=a\sin\zeta
Sionna 位置orientations[..., 2](L351)AntennaElement.field L84-85

±45° 交叉极化(Massive MIMO 标配)用的是极化 slant ζ\zeta,不是 γ: PanelArray L428-435 中 polarization_type="cross" 时两组阵元的 slant 取 −π/4-\pi/4 与 +π/4+\pi/4; "VH" 取 00 与 π/2\pi/2;单极化 "V"/"H" 见 L421-427。 BS 面板的机械 slant 通常保持 γ=0\gamma=0。

九、Sionna 调用链:§7.1 的三块积木如何拼成方向图矩阵

_step_11_field_matrix 是 §7.5 Step 11 的方向图矩阵入口,它把本文全部公式串成一条流水线:

zod, aod (GCS, 来自射线表)
   │  L766: _gcs_to_lcs(tx_orientations, zod, aod)      ← 式 7.1-7/8
   ▼
zod′, aod′ (LCS)
   │  L781-786: tx_array.ant_pol1.field(zod′, aod′)     ← §7.3 方向图 + 极化 slant
   ▼
(E′θ, E′φ) (LCS 基下的阵元响应)
   │  L788-789: _l2g_response(f′, tx_orientations, zod, aod)  ← 式 7.1-11/15
   ▼
(Eθ, Eφ) (GCS 基) ── L803-835 与随机相位/XPR 矩阵 h_phase 相乘、按极化组装 ──► h_field

RX 侧对称:L777 _gcs_to_lcs、L784-785 field、L789/L801 _l2g_response。 dual 极化分支在 L791-801。

阵元位置(式 7.1-4 的另一用途): _step_11_get_tx_antenna_positions L511 / _step_11_get_rx_antenna_positions L536 调用 _rot_pos(R⋅dˉLCSR\cdot\bar d_{\text{LCS}}),把 LCS 阵元坐标旋到 GCS, 供式 7.5-22 的阵元相位使用。

默认朝向与单位换算

  • cdl.py L234-235/L240-241:BS 默认 bs_orientation=[0,0,0](boresight 朝 GCS +x+x), UT 默认 ut_orientation=[π,0,0]——bearing α=180°,即 UT 的 boresight 朝 −x-x, 与 BS 相对。L644-659 按上下行把 bs/ut 分别填进 tx/rx_orientations。
  • utils.py: deg_2_rad(L509)、rad_2_deg(L533)、wrap_angle_0_360(L557)。 TR 表格全是度,Sionna 接口全是弧度,跨文档对照时先换算。

十、可运行的数值验证

以下脚本用纯 numpy 实现式 7.1-4/7/8/15 闭合公式,再调用 Sionna 私有方法对拍 (私有方法仅用于验证,生产代码不要依赖)。在装有 Sionna 1.x 的环境直接运行:

import numpy as np
import torch
from sionna.phy.channel.tr38901.channel_coefficients import ChannelCoefficientsGenerator
from sionna.phy.channel.tr38901 import PanelArray

d2r = np.pi / 180

def R_forward(alpha, beta, gamma):
    """式 7.1-4"""
    ca, cb, cg = np.cos(alpha), np.cos(beta), np.cos(gamma)
    sa, sb, sg = np.sin(alpha), np.sin(beta), np.sin(gamma)
    return np.array([
        [ca*cb, ca*sb*sg - sa*cg, ca*sb*cg + sa*sg],
        [sa*cb, sa*sb*sg + ca*cg, sa*sb*cg - ca*sg],
        [-sb,   cb*sg,            cb*cg]])

def gcs_to_lcs(theta, phi, alpha, beta, gamma):
    """式 7.1-7/8 闭合公式"""
    z = (np.cos(beta)*np.cos(gamma)*np.cos(theta)
         + np.sin(theta)*(np.sin(beta)*np.cos(gamma)*np.cos(phi-alpha)
                          - np.sin(gamma)*np.sin(phi-alpha)))
    tp = np.arccos(np.clip(z, -1, 1))
    re = np.cos(beta)*np.sin(theta)*np.cos(phi-alpha) - np.sin(beta)*np.cos(theta)
    im = (np.cos(beta)*np.sin(gamma)*np.cos(theta)
          + np.sin(theta)*np.sin(beta)*np.sin(gamma)*np.cos(phi-alpha)
          + np.sin(theta)*np.cos(gamma)*np.sin(phi-alpha))
    return tp, np.angle(re + 1j*im)

def psi(theta, phi, alpha, beta, gamma):
    """式 7.1-15"""
    re = (np.sin(gamma)*np.cos(theta)*np.sin(phi-alpha)
          + np.cos(gamma)*(np.cos(beta)*np.sin(theta)
                           - np.sin(beta)*np.cos(theta)*np.cos(phi-alpha)))
    im = np.sin(gamma)*np.cos(phi-alpha) + np.sin(beta)*np.cos(gamma)*np.sin(phi-alpha)
    return np.angle(re + 1j*im)

# 构造 generator(double 精度便于对拍到 1e-14)
arr = PanelArray(num_rows_per_panel=1, num_cols_per_panel=1,
                 polarization="dual", polarization_type="cross",
                 antenna_pattern="38.901", carrier_frequency=3.5e9)
gen = ChannelCoefficientsGenerator(carrier_frequency=3.5e9, tx_array=arr,
                                   rx_array=arr, subclustering=False,
                                   precision="double")
T = lambda x: torch.tensor(x, dtype=torch.double)

# case1: BS downtilt 10° —— boresight 自检
alpha, beta, gamma = 0.0, 10*d2r, 0.0
b = R_forward(alpha, beta, gamma) @ np.array([1.0, 0.0, 0.0])  # LCS +x' 旋到 GCS
th_b, ph_b = np.arccos(b[2]), np.angle(b[0] + 1j*b[1])         # → (100°, 0°)
tp, pp = gcs_to_lcs(th_b, ph_b, alpha, beta, gamma)            # → (90°, 0°) ✓
print(f"boresight GCS=({th_b/d2r:.1f},{ph_b/d2r:.1f}) -> LCS=({tp/d2r:.1f},{pp/d2r:.1f})")
print(f"psi(boresight) = {psi(th_b, ph_b, alpha, beta, gamma)/d2r:.4f}°")   # 0

# case2: 三轴全非零,闭合公式 vs Sionna 矩阵法
alpha, beta, gamma = 30*d2r, -15*d2r, 45*d2r
orient = T([[alpha, beta, gamma]])
th, ph = T([[60*d2r]]), T([[20*d2r]])
tp, pp = gcs_to_lcs(60*d2r, 20*d2r, alpha, beta, gamma)
t_s, p_s = gen._gcs_to_lcs(orient, th, ph)
psi_c, psi_s = psi(60*d2r, 20*d2r, alpha, beta, gamma), gen._compute_psi(orient, th, ph).item()
print(f"dTheta'={abs(tp-t_s.item()):.1e} dPhi'={abs(pp-p_s.item()):.1e} dPsi={abs(psi_c-psi_s):.1e}")
# → 均在 1e-14 量级(浮点噪声);psi = 49.576°, (cosψ, sinψ) = (0.6484, 0.7613)

# case3: 7.1-11 场变换 —— f'=(1,0) 应映射为 (cosψ, sinψ)
f_s = gen._l2g_response(T([[[1.0, 0.0]]]), orient, th, ph).numpy().reshape(2)
print(f"l2g: {f_s} vs closed-form: [{np.cos(psi_c):.6f}, {np.sin(psi_c):.6f}]")

典型输出:

boresight GCS=(100.0,0.0) -> LCS=(90.0,0.0)
psi(boresight) = 0.0000°
dTheta'=0.0e+00 dPhi'=1.6e-15 dPsi=0.0e+00
l2g: [0.64844085 0.76126504] vs closed-form: [0.648441, 0.761265]

十一、公式 ↔ Sionna 总对照表

TR 公式内容Sionna 实现位置
7.1-1F(θ,φ)=F′(θ′,φ′)F(\theta,\varphi)=F'(\theta',\varphi')_step_11_field_matrix 流水线L726-840
7.1-2/4R=Rz(α)Ry(β)Rx(γ)R=R_z(\alpha)R_y(\beta)R_x(\gamma) 及展开_forward_rotation_matrixL343-381
7.1-5R−1=RTR^{-1}=R^{\mathsf T}_reverse_rotation_matrixL397-408
7.1-6球坐标单位矢量_unit_sphere_vectorL322-341
7.1-7/8GCS→LCS 角度映射_gcs_to_lcs(矩阵法等价实现)L410-442
7.1-9/10极化基点变换矩阵隐含于 _l2g_response 转置结构L469-491
7.1-11场分量 LCS→GCS_l2g_responseL469-491
7.1-12~15ψ 定义与闭合式_compute_psiL444-467
7.1-16~23下倾特例通用实现覆盖(α=γ=0)同上
7.1-24~26水平切面特例通用实现覆盖(θ=90°)同上
§7.1.2阵元位置 LCS→GCS_rot_pos + _step_11_get_tx/rx_antenna_positionsL383-395 / L493-541
§7.3-4/5极化 slant 分解AntennaElement.fieldantenna.py L75-86
§7.1.2面板几何 y′–z′AntennaPanel.__init__antenna.py L225-243
±45°cross 极化 slantPanelArray.__init__antenna.py L421-435

十二、小结

  • §7.1 的全部使命:方向图属于 LCS,射线角来自 GCS,中间靠 R(α,β,γ) 架桥; 标量幅度用式 7.1-7/8 换角度,矢量极化用式 7.1-11/15 换基。
  • 三段旋转是内蕴 z→y′→x′′z\to y'\to x'':bearing 选平面、downtilt 压俯角、slant 滚极化; TR 命名 α=bearing、β=downtilt、γ=slant,Sionna orientations 顺序与之相同。
  • 两个坑:① TR 正文对 forward R 方向的描述自相矛盾,以公式和 Sionna 为准 (forward R = LCS→GCS);② ±45° 是 §7.3 的极化 slant,不是 §7.1.3 的机械 slant γ。
  • Sionna 用”矩阵乘法 + 分量提取”实现 7.1-7/8,用 2×2 旋转阵实现 7.1-11, 与 TR 闭合公式数值一致(1e-14 量级),全部集中在 channel_coefficients.py L322-541 这 220 行内。

参考资料

评论

评论加载中…

    ← 返回首页