# Synchronizing TSN Devices via 802.1 AS over 5G Networks
## 4 Simulation Setup for TSN Synchronization over 5G Scenarios
### Simulation Scenarios
#### 4.2.2 Simulation Scenario 2  
This scenario is similar to scenario 1 in terms of the TSN network layout but differs in the layout of the 5G network. The 5G network now has two gNodeBs. The TSN device 2 is mobile and moves along a predefined path at a constant speed. This results in a handover between the gNBs, and while the handover is taking place, the synchronization process is affected due to the variation in the propagation delay. This simulation scenario is shown in Figure 2b.  
Both simulation scenarios are run for 500 s. Time synchronization occurs in 1 s intervals, and the propagation delay measurement interval is also set to 1 s. TSN device 1, TSN Switch, and TSN device 2 synchronize to the TSN Master, and the local device's clock times of the master clock and the slave clocks, immediately before and after synchronization, are logged. In addition, propagation delay, residence time, and all four timestamps required for propagation delay measurement are also logged. Since these timestamps are used to calculate the link delay, they can be used to measure uplink and downlink delay, the delay variations, and the difference between uplink and downlink delay in the 5G network.  
The major simulation parameters are shown in Table 2. Simulation scenario 2 is an extension of simulation scenario 1--therefore, the same parameters as in simulation scenario 1 are applied as well as additional mobility and handover specific parameters.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline  & **TSN Network Parameter \({}^{*}\)** & **Value** & **5G Network Parameter \({}^{*}\)** & **Value** \\ \hline \multirow{8}{*}{**Centralized**} & Ethernet Bitrate & 1 Gbps & AMC \({}^{1}\) Type & NRAmc \\  & Oscillator Type & Constant Drift Oscillator & Target BLER \({}^{2}\) & 0.01 \\  & Oscillator Drift Rate & Uniform (0 ppm, 100 ppm) & BLER Shift & 5 \\  & Local/Destination UDP Ports & 3000 & Mac Cell ID/Master ID & 0 \\  & Sync Initial Offset & 1 s & NR Mac Cell ID/NR Master ID & 1 \\  & & Sync/PDelay Interval & 1 s & \\  & & Tick Length & 1 pico-second & \\ \hline \multirow{8}{*}{**Centralized**} & Mobility Type & Rectangle Mobility & CQI Feedback Period & 40 ms \\  & Constraint Area & (150 m, 450 m)–(750 m, 450 m) & Uplink/downlink & True \\  & & Starting & & & \\  & Position & (0, 0) i.e., (150 m, 450 m) & & Dynamic Cell \\  & & Position & & Association \\  & & Speed & 2 m/second & Enable Handover & True \\ \hline \hline \end{tabular}  
* TSN/5G parameters not mentioned in table are set to the default values as specified in their OMNeT++ model.  
\end{table}
Table 2: Simulation parameters.  
Figure 2: (**a**) Simulation scenario 1: TSN device 2 synchronizes with TSN Master via TSN Switch; (**b**) Simulation scenario 2: extension of scenario 1; handover between gNodeB1 and gNodeB2.  
Both simulation setups are intentionally kept simple, as they will provide the baseline for how the time synchronization performs if there is not any background traffic or when the wireless channels are not saturated. But as the next sections will show, even with the simplest scenarios, the TSN time synchronization through the 5G network using UDP/IP encapsulation does not perform well; simulating more complex scenarios only reduces the time synchronization accuracy.