@@ -3,4 +3,80 @@ title: Code overview
33linkTitle : Code Overview
44description : Overview of the code's architecture
55weight : 20
6- ---
6+ ---
7+
8+ ## Conda environment setup
9+
10+ All of the required dependencies can be installed as a conda environment using
11+ the ` environment.yaml ` file in the repository. More instructions can be found
12+ in the [ README] ( https://github.com/radioglaciology/uhd_radar/tree/main?tab=readme-ov-file#configuring-your-environment )
13+ file.
14+
15+ ## Startup scripts
16+
17+ The X series devices require some initial network configuration. For convenience,
18+ a [ startup script] ( https://github.com/radioglaciology/uhd_radar/blob/main/x310_startup.sh )
19+ is provided to automate this setup. You may need to tweak this file to your setup.
20+
21+ ## Runner scripts
22+
23+ The basic steps required to run the radar are:
24+
25+ 1 . Build the C++ code
26+ 2 . Generate a chirp file to transmit based on your configuration
27+ 3 . Run the compiled radar code
28+ 4 . Move the collected data to an appropriate location
29+
30+ The main interface for running the radar code is through ` run.py ` , a Python
31+ script designed to automate the above process. This script is run as follows:
32+
33+ ```
34+ python run.py config/my_radar_configuration.yaml
35+ ```
36+
37+ At the end of the data collection, data will be saved with the current date
38+ to a location specified in the [ YAML config file] ( /docs/radar/sdr-interface/config ) .
39+
40+ Generally, three files are saved:
41+
42+ * ` YYYYMMDD_hhmmss_rx_samps.bin ` - This is a binary file containing the raw
43+ samples recorded the SDR. Note that this file is not interpretable unless you
44+ also have the config file used.
45+ * ` YYYYMMDD_hhmmss_config.yaml ` - This is the YAML config file passed to ` run.py ` .
46+ It defines all parameters of the data collection, allowing for the ` rx_samps.bin `
47+ file to be interpreted and processed.
48+ * ` YYYYMMDD_hhmmss_uhd_stdout.log ` - This is a text file containing the output
49+ of running the radar code. This is helpful for debugging and also contains a log
50+ of any errors encountered, which may be required to reconstruct the timing of
51+ each recording.
52+
53+ More details on the files stored and how these can be re-processed into a Zarr
54+ file are on the [ file formats] ( /docs/radar/postprocessing/files/ ) page.
55+
56+ Note that there are also settings available to break ` rx_samps.bin ` into multiple
57+ files as needed.
58+
59+ ## SDR interface code
60+
61+ For performance reasons, the code directly interfacing with the SDR is written
62+ in C++. This code is all located in the ` sdr/ ` directory of the repository.
63+
64+ The main radar code is contained in ` main.cpp ` (with some SDR setup code located
65+ in ` rf_settings.cpp ` ). The radar code runs in two threads, as shown in the
66+ figure below.
67+
68+
69+ {{% imgproc code_diagram Fit 500x1200%}}
70+ General architecture of the ORCA code
71+ {{% /imgproc %}}
72+
73+ One thread is responsible for scheduling
74+ [ timed commands] ( https://kb.ettus.com/Synchronizing_USRP_Events_Using_Timed_Commands_in_UHD )
75+ that are enqueued into FIFO queues within the SDR's FPGA.
76+
77+ The other thead is responsible for pulling received samples from the SDR and
78+ writing them to a file on the host computer.
79+
80+ For a more complete overview, please refer to our paper:
81+
82+ {{% readfile "/docs/tgrs_citation.md" %}}
0 commit comments