# Flow Sensing-Based Congestion Detection for D2D Streaming on a 5G gNB
## 3 System Model
### Detecting Traffic Flow Rates  
This section introduces a traffic flow rate detecting function, TFRDF, to detect the congestion due to high traffic flow rates in the DUE buffer cache, and to mitigate the imbalance due to underflow or overflow between DUE and CUE pairs and DUE and DUE pairs. The TFRDF detects whether the traffic flows are cached with a fixed or variable size in D2D streaming procedure, and whether the burst rate of the traffic flows is long or short. Generally, short traffic flows and burst rates reduce congestion owing to neighboring resource interference, while long traffic flows and bursts do not. The proposed TFRDF detects the flow rates and traffic rates for D2D pairs to reduce congestion due to resource interference, and it has an important function in sensing whether the burst rate of the traffic flows is short or long between DUE and CUE pairs and DUE and DUE pairs. The congestion flow rate is decided by detecting inconsistencies of link rates between DUE and CUE pairs and DUE and DUE pairs, and it senses the rate imbalance of D2D pairs. Figure 2 shows the TFRDF structure for D2D pairs. Now, let us calculate the flow rates (\(x\)) for D2D streaming. Let \(S(x)\), \(R(x)\) and \(DUE_{buffer}(x)\) denote the source rate, caching assign rate, and encoding and decoding flows in the buffer cache between DUEs and DUEs, respectively. The following notations are also used:  
* TFRDF(x) is the flow rate for D2D streaming. * \(S(x)\) is the size of the \(x^{th}\) flow rate. * \(Burst(x)\) is the burst rate caching from the buffer cache for \(DUE_{buffer}(x)\). * \(B(t)\) is the burst time received from any DUEs during an arbitrary time stamp \(t\). * \(C(x-t)\) is the occupied capacity of cache. Figure 1: Cellular link and D2D link in 5 GC. Let us suppose that the throughput of a D2D streaming increases if no flow error is caused by imbalance. However, in an actual 5G-based wireless mobile channel, the throughput also depends on flow rate, delay, routing failure, and link error in the buffer cache for \(DUE_{buffer}(x)\). Therefore, when the flow rates from the buffer cache for \(DUE_{buffer}(x)\) are forwarded, \(TFRDF(x)\) is defined as the following. \[DUE_{encoding}(x) =\left\{DUE_{encoding}(x-1)+s(x)\right\}-Burst(x) \tag{1}\] \[DUE_{decoding}(x) =\left\{DUE_{decoding}(x-1)+B(t)\right\}-C(x-t)\] (2) \[TFRDF(x) =\frac{\sum\limits_{i\in x}\left\{DUE_{decoding}(x-1)-DUE_{encoding }(x)\right\}}{\sum\left\{Burst(x)+B(t)\right\}}\times\mu \tag{3}\]  
where \(t\) is the \(DUE_{buffer}(x)\)-to-\(DUE_{buffer}(x)\) latency during the streaming for a flow rate. \(C(x-t)\) is the cache capacity occupied to the buffer cache, and \(\mu\) (\(0\leq\mu\leq 1\)) is the fuzzy value (FV) for a rate adjustment. Next, we define the latency after the detection of flow loss. The latency related to the encoding and decoding rates is measured using the transmitted flow rate during an arbitrary time interval. The following equations show the flow delay caused by the encoding rate and decoding rates in the buffer cache. \[DUE_{buffer}(x+t)=\sum_{k=x+1}^{x=t}\left\{BURST(x)-DUE_{buffer}(x)\right\}+ TFRDF(x) \tag{4}\]  
If the encoding rate is fixed, the packet loss for flow rates decreases. However, if the encoding rate for flow rates is not fixed or is variable, it suffers from the flow error since the flow rate is mismatched. The flow error owing to overflow or underflow can degrade the QoS for D2D streaming. The decoding rate is restricted by the buffer cache size of \(DUE_{buffer}(x)\), which is frequently restricted in flow rate and size. Therefore, the detection operation to prevent the flow error due to overflow or underflow can be represented by the following Equation (5):  
\[\sum_{k=x+1}^{x=t}BURST(x)\leq\left\{E_{r}(k)+D_{r}(k)+TFRDF(x)\right\} \tag{5}\]  
where \(E_{r}(k)\) is the encoding rate for an arbitrary flow rate, and \(D_{r}(k)\) is the decoding rate. Figure 2: TFRDF structure. If \(Burrst(x)\) in Equation (5) is very large, overflow is expected due to the encoding rate.