## 3 Proposed Quality of Service Routing Protocol (QoSRP) in UWSNs
### Underwater Acoustic Channel Detection (UWCD) Algorithm
}^{m}\bigl{|} \mathcal{C}_{g(\iota)}\mathcal{S}_{\mathcal{L}(\iota)}+\boldsymbol{n}_{\sigma (\iota)}\bigr{|}^{2}\in\,\mathcal{H}_{1} \tag{4}\]  
in which \(m\), \(\mathcal{C}_{g(\iota)}\), \(\boldsymbol{n}_{\mathit{oise}(\iota)}\) are the time-bandwidth product, the channel gain between \(\mathcal{PU}\) and \(\mathcal{SU}\), and noise in the \(\iota^{\prime\ell\delta}\) time slot, respectively. The received energy at each \(\mathcal{SU}_{\iota}\) is compared to the predefined detection threshold \((\sigma)\) to reach a decision about the presence or absence of \(\mathcal{PU}_{\lambda^{\prime}}\). In locally sensing mechanism each \(\mathcal{SU}\) decides whether the \(\iota\)th channel is available (\(\tau_{\mathrm{off}}\)) or occupied (\(\tau_{\mathrm{on}}\)) by using a predefined threshold in the network. Thus, the hypothesis at each secondary user is saying that the \(\mathcal{PU}\) is active only if the received signal energy is greater than the defined limit and idle when it is less than the defined threshold value, which can be numerically indicated as:  
\[\mathcal{T}_{\mathrm{En\mathcal{D}}}(\mathcal{SU}_{\iota})_{\mathcal{S}_{ \mathcal{L}}}=\left[\mathcal{H}_{0}\in\mathrm{E}\mathcal{S}_{\mathcal{L}}> \sigma\left|\mathcal{H}_{1}\in\mathrm{E}\mathcal{S}_{\mathcal{L}}<\sigma \right]\in\tau_{\mathrm{s}} \tag{5}\]  
subject to:  
\[\mathcal{T}_{\mathrm{En\mathcal{D}}}(\mathcal{SU}_{\iota})_{\mathcal{S}_{ \mathcal{L}}}=\ \tau_{\mathrm{on}}|\tau_{\mathrm{off}}\in\mathcal{C}_{\iota}\subseteq \mathcal{C}_{n} \tag{5a}\]  
\[\mathcal{H}_{1}(\mathcal{C}_{i})\in\mathcal{C}_{n}=1(\tau_{\mathrm{on}}) \tag{5b}\]  
\[\mathcal{H}_{0}(\mathcal{C}_{i})\in\mathcal{C}_{n}=0(\tau_{\mathrm{off}}) \tag{5c}\]  
\[\mathcal{PU}_{\lambda^{\prime}}(\mathcal{C}_{i})\in\mathcal{C}_{n}\
eq\tau_{ \mathrm{on}} \tag{5d}\]  
\[\mathcal{C}_{i}\in\mathcal{H}_{1}\bigl{|}\mathcal{H}_{0}\ \leq 1 \tag{5e}\]  
\[\mathcal{SU}_{\iota}(\mathcal{C}_{i})\in\mathcal{C}_{n}(\mathcal{R}_{\iota})= \tau-\tau_{\mathrm{s}} \tag{5f}\]  
\[\mathcal{SU}_{\iota}\
otin\mathcal{C}_{i}(\mathcal{R}_{\iota})=\tau \tag{5g}\]  
\[\mathcal{SU}_{\iota}(\mathcal{C}_{i})_{\mathit{busy}}\in\mathcal{C}_{n}( \mathcal{R}_{\iota})\
eq\tau_{\mathrm{s}} \tag{5h}\]  
in which \(\sigma\) is the threshold value of energy is used to compare is the local spectrum sensing decision of a \(\mathcal{SU}_{\iota}\), \(\mathcal{H}_{1}\) denotes the \(\iota\)th channel is not available because of the \(\mathcal{PU}_{\iota}\) activity with probability \(\rho(\rho_{\mathcal{U}_{\iota}})\) in the sensing time \(\tau_{\mathrm{s}}\) is constraint by Equation (5a). Equations (5b) and (5c) constraints guarantee that the \(\mathcal{PU}\) is active and inactive for a particular channel \(\mathcal{C}_{i}\) in a time interval in the network. Equation (5d) constraints state that a channel belongs to the \(\mathcal{PU}_{\lambda^{\prime}}\) is available to \(\mathcal{SU}_{\iota}\) for the time \(\tau_{\mathrm{s}}\), while the constraints in Equation (5e) satisfy the statement specified in Equation (5d). Constraints in Equation (5f) verify that the \(\mathcal{SU}_{\iota}\) senses a channel \(\mathcal{C}_{i}\) in the region \(\mathcal{R}_{\iota}\) and holds the channel for a specific time once it is found free in the network. Constraints in Equation (5f) explain that the \(\mathcal{SU}_{\iota}\) must not hold the channel for the entire time since the \(\mathcal{PU}_{\lambda^{\prime}}\) can reclaim the channel any time in the network. Constraints in Equation (5h) state that the \(\mathcal{SU}_{\iota}\) senses a channel \(\mathcal{C}_{i}\) in a region \(\mathcal{R}_{\iota}\) and will not be sensed the same channel immediately once it is found busy in the network. On the other hand, \(\mathcal{H}_{0}\) illustrates that the \(\iota\)th spectrum is available with probability \(\rho_{\iota\mathit{dead}}\), i.e., \(\rho_{(\mathcal{PU}_{\iota})}+\rho_{\iota\mathit{dead}}=1\) in the sensing time \(\tau_{\mathrm{s}}\).