# Implementation of a Cross-Layer Sensing Medium-Access Control Scheme
## 3 Cross-Layer CS-MAC Design
### Compressive Complex Requests during Wireless Transmission  
The requests from multiple nodes are converted to modulated complex signals via constellation mapping. After matched filtering at the receiver, within each symbol duration, the observed signals at each antenna of the destination is the combination of complex signals multiplied by the channel coefficient vector. The observed signals, namely the compressive complex requests signal vector, at the \(k^{th}\) antennas at the destination, can be written as  
\[y_{k}=\sum_{i=1}^{N}(h_{k,1}\cdot x_{i})+n_{k} \tag{2}\]  
Figure 1: The cross-layer compressed sensing medium-access control (CL CS-MAC) scheme with asynchronous and random requests. where \(x_{i}\) is a complex request signal of the active sensor node \(i\). If \(x_{i}\) is 0, the node does not request for the channel access. Notation \(h_{k,i}\) is the channel coefficient vector from sensor node \(i\) to the \(k^{th}\) antenna of the destinations, which is obtained from the training sequence. \(n_{k}\) is the measurement noise. The measurement matrix should be chosen so that it maintains minimum coherence with the basis of the sparse signal. When the channel coefficients from the sensor nodes to the \(M\) antennas are random and independent, the RIP is satisfied [17]. Therefore, the channel matrix can be considered as the measurement matrix. In time slot \(n\) during one time frame, a measurement matrix \(\mathbf{H}\in\mathbf{R}^{M\times N}\) is determined by the channel condition. Then, the overall compressive complex requests signal at the receiver is given by  
\[\mathbf{y}=\mathbf{H}\cdot\mathbf{x}+\mathbf{n} \tag{3}\]  
where \(\mathbf{y}=\left[y_{1},y_{2},\ldots,y_{M}\right]^{\mathsf{T}}\mathbf{x}=\left[x_{1}, x_{2},\ldots,x_{N}\right]^{\mathsf{T}}\), \(\mathbf{n}=\left[n_{1},n_{2},\ldots,n_{M}\right]^{\mathsf{T}}\), and \(\mathbf{H}\) is the channel matrix, denoted as \(\mathbf{H}=\left[ \begin{array}{cccc}h_{1,1}&h_{1,2}&\ldots&h_{1,N}\\ h_{2,1}&h_{2,2}&\ldots&h_{2,N}\\ \vdots&\vdots&\ddots&\vdots\\ h_{\text{M},1}&h_{\text{M},2}&\ldots&h_{\text{M},N}\end{array} \right]\). Equation (2) indicates that the destination obtains N \(\times\) M observations during one symbol duration. To obtain the measurement matrix, training sequence is used to estimate the channel condition. Sensor nodes send the training sequence \(\mathbf{x}_{0}\) to destination. The destination gets the measurement matrix based on the received sequence \(\mathbf{y}_{0}\):  
\[\mathbf{y}_{0}=\mathbf{H}\cdot\mathbf{x}_{0}. \tag{4}\]  
To calculate the elements in the measurement matrix, let us consider an example system consisting of four sensor nodes and a destination with two antennas. The transmission can be described as  
\[\mathbf{y}_{2\times 1}=\mathbf{H}_{2\times 4}\cdot\mathbf{x}_{4\times 1} \tag{5}\]  
and the measurement matrix can be defined as  
\[\mathbf{H}_{2\times 4}=\left[ \begin{array}{cccc}h_{11}&h_{12}&h_{13}&h_{14}\\ h_{21}&h_{22}&h_{23}&h_{24}\end{array} \right] \tag{6}\]  
We adopt a training sequence of 00, 01, 11, and 10 to calculate the elements in \(\mathbf{H}_{2\times 4}\). The training sequence is sent from different sensor nodes in different time slots, which is also known to the destination. In a QPSK modulation scenario, the training sequence of 00, 01, 11, and 10 is modulated to \(x_{1}=\left(-\frac{\sqrt{2}}{2},\;-\frac{i\sqrt{2}}{2}\right)\), \(x_{2}=\left(-\frac{\sqrt{2}}{2},\frac{i\sqrt{2}}{2}\right)\), \(x_{3}=\left(\frac{\sqrt{2}}{2},\frac{i\sqrt{2}}{2}\right)\), and \(x_{4}=\left(\frac{\sqrt{2}}{2},\;-\frac{i\sqrt{2}}{2}\right)\), which form the vector \(\mathbf{x}_{4\times 1}\). The first node sends \(x_{1}\) to the destination, and the received signal at two different antennas are described as \(y_{11}\) and \(y_{12}\), respectively. The elements in the first column of the measurement matrix can be calculated by \(h_{11}=\frac{y_{11}}{x_{1}}\) and \(h_{21}=\frac{y_{12}}{x_{1}}\).