## 3 Experimental and Simulation Setup
### Simulation Setup
#### 3.2.1 Network Architecture and Implementation  
Simulation was conducted to evaluate the energy consumption performance at the 5G Next-Generation Node Base (gNB) within a 5G non-standalone (NSA) deployment [42]. The network architecture was based on a scenario featuring a single 5G NR gNB. The gNB was co-deployed with a 4G Evolved Packet Core (EPC) network and the User Equipment (UE) was configured with multi-connectivity between a co-deployed LTE evolved Node Base (eNB) and the 5G NR gNB. In the simulation, the distance parameter, denoted as \"dist\", was varied within the range of 30 m, 50 m, 70 m, and 80 m in order to analyze its influence on gNB energy consumption under diverse communication ranges. The simulation employed the User Datagram Protocol (UDP) as the transport protocol to transmit the messages generated by the OBU. UDP was chosen for its lightweight and connectionless nature, which aligns with the requirements of edge computing scenarios. To model the energy consumption, we adapted a base station power consumption model based on Physical (PHY) states (see Figure 4), considering the absence of the RRC_INAACTIVE state in the Radio Resource Control (RRC) state machine implemented in the ns3 mmWave module. The PHY states (IDLE, RX_CTRL, RX_DATA, and TX) were used to emulate the power consumption behavior over the RRC states of an eNB/gNB. The net energy consumption of the base station was expressed as P(Ps\(\times\)ts), where Ps and ts respectively represent the power consumption and time taken in a specific PHY state (IDLE, RX_CTRL, RX_DATA, TX), as shown in (1):  
\[E_{\text{total}}=\sum_{S\in\mathbb{S}}\left(P_{S}\times t_{S}\right), \tag{1}\]  
where:  
* \(E_{\text{total}}\) represents the total energy consumption
* \(\mathbb{S}\) represents the PHY states: IDLE, RX_CTRL, RX_DATA, and TX
* \(P_{S}\) represents the power consumption of each PHY state \(S\)
* \(t_{S}\) represents the dwell time of each PHY state \(S\).  
The implementation in NS-3 leveraged the ns3-mmWave [42] and 5G-LENA [43] modules, which integrate the MAC, PHY, and RLC layers per 3 GPP specifications. The mmWave simulation utilized an Energy Source Model and a Device Energy Model. The mmWaveSpectrumPhy object within the mmWaveEnbNetDevice provided a trace source for PHY state changes, and the device energy model utilized a trace sink to  
Figure 4: Energy model.  
consumption based on the PHY state power values. The NR module originated as a divergence from the NS-3 mmWave simulation tool, initially developed by New York University (NYU) and the University of Padova [42]. The mmWave simulation model incorporates essential LTE features from the NS-3 LTE module (LENA) [43], entirely crafted at the Centre Tecnologic de Telecomunicacions Catalunya (CTTC). The mmWave module is inherited from the NS-3 LTE module (LENA), making both the mmWave and NR modules heavily influenced by the LTE module's previous design. Specifically, both modules reuse higher protocol components (Radio Link Control (RLC), Packet Data Convergence Protocol (PDCP), Radio Resource Control (RRC), Non-Access Stratum (NAS)) and the Evolved Packet Core (EPC) from LTE. This simulation framework allowed us to analyze the energy consumption patterns of the RSU at varying communication distances, providing insights into the efficiency of the 5G network under different scenarios.