## 3 Simulation Framework
### Modules
#### 3.2.1 Hybrid User Terminal (HUT)  
The HUT module is implemented as a Graphical User Interface (GUI) application written in C++ language, developed using the Qt framework [46], which ensures portability across different operating systems. Overall, the HUT architecture is presented in Figure 3.  
The HUT consists of two main components:  
* An AI module (AIM);
* GUI, Control and Channel Switching Logic (GCS). The functionalities integrated within the AI module will be described in detail alongside the channel simulation description in Section 4. These functionalities primarily involve the decision-making process that takes several samples of the measured SNR sequence for a given channel and tries to predict the optimal MODCOD that should be used in the following timeslot. This algorithm is developed to keep the transmission error rate under a certain margin while providing the highest possible spectral efficiency, hence enabling the fastest data transmission rate without errors under the given channel conditions. Based on the predicted MODCOD, the maximal number of frames that can be transmitted over each channel in the following timeslot is calculated. This value is used by the GCS on the HUT side to select the best channel for frame transmission. In the simulation environment, this channel is called the Active channel. Since MODCOD, used for channel switching, is predicted based on earlier SNR values, it should be compared to the actual MODCOD calculated using the channel model in the Channel module block. The GCS is a component of the HUT Module responsible for configuring all modules, supervising communication, and managing data frame routing. This component consists of the following software submodules: GUI Parser, File Parser, Data Transmitter, Data Receiver, and Control Message Parser. The GUI Parser is responsible for generating GUI control elements and processing user-defined configuration parameters through the corresponding control inputs. Once a configuration is received, it is forwarded to the Control Message Parser submodule, which generates control message commands from configuration parameters. Besides the configuration of a simulation framework, the GUI Parser also load files containing user data. Once loaded, this file is sent to the File Parser submodule. Here, user data are divided into code words whose number depends on the used MODCOD, as shown in Figure 4. These data represent a payload that is transferred inside the Data message frame, as shown in Figure 2.  
Figure 3: The architecture of the HUT module. MODCOD that is used for current data transmission is provided by the AI module. Since different channels have different characteristics and instantaneous conditions, different sets of MODCOD parameters are provided for each channel. The MODCOD file for each channel contains R rows, representing R timeslots. The File Parser submodule generates a data structure for each channel that contains information for each R timeslot. Each element of this structure contains N substructures, representing the data messages that should be sent during a single timeslot if the corresponding channel is selected. The value of N, as well as the data message transmission period within a single timeslot, is determined based on the MODCOD and the preconfigured bandwidth for each channel. Once these structures are generated, they are forwarded to the Data Transmitter submodule. A key function of this submodule is to determine which channel should be active in the given timeslot. The selection algorithm is triggered periodically at the end of each timeslot, and the active channel is chosen with a goal of maximizing the number of frames that can be transmitted in the given timeslot. In addition to selecting the active channel, the Data Transmitter submodule formats data from the channel data structure and transmits them over the selected active channel using the UDP transport protocol. These data are sent to the T/R module.