free5GRAN  V1.0
phy.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 Telecom Paris
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15  */
16 
17 #ifndef FREE5GRAN_PHY_H
18 #define FREE5GRAN_PHY_H
19 
20 
21 #include <vector>
22 #include <chrono>
23 #include "../rf/rf.h"
24 #include "../../lib/variables/common_structures/common_structures.h"
25 #include "../../lib/asn1c/nr_rrc/BCCH-DL-SCH-Message.h"
26 
27 class phy {
28 
29 
30 private:
33  double ssb_period;
34  int fft_size;
37  std::vector<std::complex<float>> frame_data;
42  std::chrono::time_point<std::chrono::high_resolution_clock> time_first_pss;
43  std::vector<std::complex<float>> buff;
44  BCCH_DL_SCH_Message_t* sib1=0;
46 
47 public:
48  phy(rf *rf_dev, double ssb_period, int fft_size, int scs, free5GRAN::band band_obj);
49  void reconfigure(int fft_size);
50  phy();
51 
52  /*
53  * Try to find a cell. Execute time domain synchronization. PSS and SSS correlation. Compute received power
54  */
55  int cell_synchronization(float &received_power);
56 
57  /*
58  * Re-synchronize with cell. Fine frequency synchronization. Resource element de-mapper (TS 38.211 7.3.3.3). Channel estimation & equalization
59  */
60  int extract_pbch();
61 
62  void search_pdcch(bool &validated);
63 
64  void print_cell_info();
65 
66  void parse_dci_1_0_si_rnti(int *dci_bits, int freq_domain_ra_size, free5GRAN::dci_1_0_si_rnti &dci);
67 
68  void print_dci_info();
69 
70  void extract_pdsch();
71 
72  BCCH_DL_SCH_Message_t* getSib();
73 
74  void print_sib1();
75 
76  int getSIB1RV();
77 
78 };
79 
80 
81 #endif
std::vector< std::complex< float > > buff
Definition: phy.h:43
BCCH_DL_SCH_Message_t * sib1
Definition: phy.h:44
void parse_dci_1_0_si_rnti(int *dci_bits, int freq_domain_ra_size, free5GRAN::dci_1_0_si_rnti &dci)
Definition: phy.cpp:861
int scs
Definition: phy.h:32
int is_extended_cp
Definition: phy.h:32
int pci
Definition: phy.h:32
void search_pdcch(bool &validated)
Definition: phy.cpp:515
std::vector< std::complex< float > > frame_data
Definition: phy.h:37
Definition: phy.h:27
double ssb_period
Definition: phy.h:33
int i_b_ssb
Definition: phy.h:32
int num_slots_per_frame
Definition: phy.h:32
void print_cell_info()
Definition: phy.cpp:476
int fft_size
Definition: phy.h:34
void extract_pdsch()
Definition: phy.cpp:894
int extract_pbch()
Definition: phy.cpp:188
free5GRAN::ss_power_indicator ss_pwr
Definition: phy.h:45
bool cell_confirmed
Definition: phy.h:35
float freq_offset
Definition: phy.h:36
void print_dci_info()
Definition: phy.cpp:841
std::chrono::time_point< std::chrono::high_resolution_clock > time_first_pss
Definition: phy.h:42
BCCH_DL_SCH_Message_t * getSib()
Definition: phy.cpp:1095
int common_cp_length
Definition: phy.h:32
int index_first_pss
Definition: phy.h:32
free5GRAN::mib mib_object
Definition: phy.h:38
int getSIB1RV()
Definition: phy.cpp:1103
int mu
Definition: phy.h:32
int n_id_1
Definition: phy.h:32
int * mib_bits
Definition: phy.h:32
int n_id_2
Definition: phy.h:32
int frame_size
Definition: phy.h:32
free5GRAN::pdcch_t0ss_monitoring_occasions pdcch_ss_mon_occ
Definition: phy.h:41
float max_snr
Definition: phy.h:36
free5GRAN::band band_object
Definition: phy.h:39
rf * rf_device
Definition: phy.h:31
free5GRAN::dci_1_0_si_rnti dci_1_0_si_rnti
Definition: phy.h:40
int l_max
Definition: phy.h:32
int i_ssb
Definition: phy.h:32
bool crc_validated
Definition: phy.h:35
int cell_synchronization(float &received_power)
Definition: phy.cpp:60
void print_sib1()
Definition: phy.cpp:1099
phy()
Definition: phy.cpp:472
void reconfigure(int fft_size)
Definition: phy.cpp:511
int n_size_bwp
Definition: phy.h:32
Definition: rf.h:29