在5G中,PSS(Primary Synchronization Signal) 主同步信号和SSS(Secondary Synchronization Signal)辅同步信号是用于物理层的信号,用于小区的搜索。
PSS
跟据协议38.211 7.4.2.2章节,PSS是3条长度为127的m序列,分别对应 N I D ( 2 ) N^{(2)}{ID} NID(2)等于0,1,2。序列由 d P S S ( n ) d{PSS}(n) dPSS(n)表示,生成公式如下:
C参考代码如下:
c
#define LEN_SEQ_PSS 127
typedef bool bit;
void init_pss_seq() {
int8_t seq_d_pss[3][LEN_SEQ_PSS];
bit seq_x[LEN_SEQ_PSS] = { 0 };
bit sub_seq_x[7] = {0, 1, 1, 0, 1, 1, 1};
for (uint i = 0; i < 7; i++) {
seq_x[i] = sub_seq_x[i];
}
for (uint i = 0; i < LEN_SEQ_PSS - 7; i++) {
seq_x[i + 7] = (seq_x[i + 4] + seq_x[i]) & 0x01;
}
for (uint i = 0; i < LEN_SEQ_PSS; i++) {
// 对应3个m序列
uint m0 = (i + 43 * 0) % 127;
uint m1 = (i + 43 * 1) % 127;
uint m2 = (i + 43 * 2) % 127;
seq_d_pss[0][i] = 1 - 2 * seq_x[m0];
seq_d_pss[1][i] = 1 - 2 * seq_x[m1];
seq_d_pss[2][i] = 1 - 2 * seq_x[m2];
}
}
SSS
跟据协议38.211 7.4.2.3章节,SSS也是长度为127的m序列,并且与 N I D ( 1 ) N^{(1)}{ID} NID(1)和 N I D ( 2 ) N^{(2)}{ID} NID(2)有关。SSS总共有1008条序列,其中每一条PSS序列对应336条SSS序列,两者相组合共同确定1008个PCI(Physical Cell Identity)。序列由 d S S S ( n ) d_{SSS}(n) dSSS(n)表示,生成公式如下:
C参考代码如下:
c
#define LEN_SEQ_SSS 127
typedef bool bit;
void init_sss_seq(uint n_id1,
uint n_id2) {
uint m0 = 15 * (n_id1 / 112) + 5 * n_id2;
uint m1 = n_id1 % 112;
bit seq_x0[LEN_SEQ_SSS] = { 0 };
bit seq_x1[LEN_SEQ_SSS] = { 0 };
seq_x0[0] = 1;
seq_x1[0] = 1;
for (uint i = 0; i < LEN_SEQ_SSS - 7; i ++) {
seq_x0[i + 7] = (seq_x0[i + 4] + seq_x0[i]) & 0x01;
seq_x1[i + 7] = (seq_x_[i + 1] + seq_x1[i]) & 0x01;
}
int8_t seq_d_sss[LEN_SEQ_SSS];
for (uint i = 0; i < LEN_SEQ_SSS; i ++) {
seq_d_sss[i] = (1 - 2 * seq_x0[(i + m0) % LEN_SEQ_SSS]) *
(1 - 2 * seq_x1[(i + m1) % LEN_SEQ_SSS]);
}
}