1 Introduction

Wireless technologies are used more and more often to improve the efficiency of industrial machines; predictive maintenance and control applications rely on data extracted in real time from sensors deployed in locations often hard to reach with cables [1, 2]. Wireless solutions offer a greater degree of flexibility.

We propose a novel Medium Access Control (MAC) protocol for intra-machine wireless sensor networks: OCDMA (Orthogonal Chirp Division Multiple Access), specifically conceived for use at THz frequencies.

We consider a scenario where wireless devices with sensors (denoted as tags or nodes hereafter) are deployed over an industrial machine, like a robot in a manufacturing plant or a large conveyor belt; tags are connected to a central unit (the Programmable Logic Controller, PLC) through Gateways (GW), responsible for data collection.

In many cases, machines are split into sections that are physically separated by metal shields; from the radio propagation viewpoint, they can be considered isolated. We focus here on one single section, whose typical volume is in the order of few cubic meters. One GW is responsible for collecting data from a huge number of tags distributed within its section; all GWs are connected to the PLC via a wired bus. While tags need to be small, cable-free and cheap, GWs can be more complex and are connected to the electrical grid.

We consider both the cases where tags are on fixed and moving components: in the former, they are in known position; in the latter, they move within a limited range, as it happens when tags are deployed on sheaves, pistons or similar mechanical parts.

From the communication network viewpoint, this scenario is very challenging [3, 4]. Each tag, especially for applications of predictive maintenance, can generate data rates larger than 1 Mbit/s; for instance, anomalous vibrations can be detected through samples of acceleration taken at minimum frequencies of 10 kHz. Moreover, tag density is expected to skyrocket in the next years [5], thus leading to values of network throughput that can be as large as tens of Gbit/s. Additionally, control loops set very stringent requirements on communication latency (in the order of 0.1 ms [6]); finally, reliability and tag miniaturization are fundamental. These requirements cannot be fulfilled by current wireless technologies [7,8,9,10]; they would be more easily met by using higher frequencies, where larger bandwidths are available. It is envisioned that 6G networks will possibly use the frequency band from 0.1 to 10 THz. It offers bandwidths of several GHz [11, 12], which permit ultra-high data rates, very low latency, while tag miniaturization will benefit from the small wavelengths.

In this paper, our proposed protocol is compared to two benchmarks, accounting for advantages and drawbacks of the THz band. We mathematically derive the success probability, network throughput and latency as a function of several system parameters.

The paper is organized as follows. The next section underlines a number of aspects differentiating this paper from previous works in the literature. Section 3 introduces the system model. Then, in Section 4 we present our proposed OCDMA scheme, and the benchmarks. Section 5 describes the performance metrics, while results are discussed in Section 6 and conclusions are drawn in Section 7.

2 Contribution Beyond the State of the Art

Let us compare the contribution of this paper to the available scientific literature, from the viewpoint of the scenario, the physical (PHY) and MAC layers.

2.1 Scenario

Most applications envisaged for THz communications belong to two classes: (i) at the nano-scale, due to the use of non-directional antennas at both link ends, transmission ranges are in the order of few centimeters; (ii) at the macro-scale, where highly directive antennas are used both at the transmitter and receiver side, making it possible to reach much larger distances [12].

We assume tags have only one radiating element for the sake of device simplicity, while the GWs can have many of them, generating highly directive beams. This asymmetry, while introducing issues to be solved at protocol level, determines transmission ranges that may reach few meters, which are compatible with the scenario investigated. Therefore, with respect to the two usual categories of applications for THz communications mentioned above, our case is intermediate.

2.2 PHY

Many works propose physical layer solutions to cope with the frequency selective nature of the THz channel. Traditional multi-carrier schemes, like Orthogonal Frequency Division Multiplexing, do not seem to be suitable for THz frequencies, due to the disruptive effect of phase noise [13,14,15,16]. In 2016, Xing Ouyang and Jian Zhao have set the basis for Orthogonal Chirp Division Multiplexing (OCDM), where chirps of common duration sweep over a shared band thanks to their mutual orthogonality [17]. The benefits of OCDM have been exploited for different application domains: underwater [18, 19], radar [20, 21], video-broadcasting [22], power lines [23, 24]. Other contributions have addressed the complexity of the receiver [25, 26] or applied Multiple-Input Multiple-Output to OCDM [27,28,29]. In 2017, an extension of [17] demonstrated that OCDM is suitable for power-limited applications [30], like the one we are considering in this paper. OCDM also outperforms LoRa [31], a successful system using orthogonal chirps.

In this paper, we assume OCDM waveforms are used, as described in [17], in combination with Frequency Division Multiplexing (FDM); a hybrid OCDM-FDM system is then envisaged at the PHY layer.

2.3 MAC

With THz frequencies, even at short distances propagation delays can be larger or in the same order of magnitude as packet lengths. For instance, a 100-byte packet can be transmitted in 0.8 ns with a bit rate of 1 Tbit/s, while the propagation delay at a distance of 1 m is 3.3 ns. This has a deep impact on protocol efficiency. Nevertheless, few papers have addressed protocol aspects of THz communications so far in the literature. Our proposed solution is based on the transmission of chirps belonging to an alphabet of orthogonal waveforms. Orthogonality allows the introduction of a spread spectrum transmission technique where multiple tags transmit simultaneously using the same band. This reduces the impact of the propagation delays on protocol efficiency, since packets have longer duration.

Current works in literature propose either centralized or distributed MAC solutions for THz communications [12, 32].

The former approach is largely investigated for nano-scale networks (see, e.g., [33]), where the use of Time Division Multiple Access (TDMA) is widely explored [34, 35]. An angular-division MAC solution for ad hoc networks is presented in [36]; two separate antenna systems are used for different protocol phases. This generates the well-known asymmetry-in-gain problem, which results in deafness and collisions. The work in [37] proposes to use directional antennas to divide the space in angular sectors, where a 3-ways handshake MAC protocol in each sector allows to achieve synchronization between the central entity and devices before data transmission. Similar approaches are followed in other works dealing with millimeter wave (MMW) communications (see, e.g., [38, 39]). A centralized protocol is also proposed in [40], where polling is used; however, the impact of propagation delays on the MAC performance is not considered in this paper.

Other works dealing with CSMA-based protocols assume nodes are equipped with multiple radios: a THz transceiver for data transmission and one working at lower frequencies for neighbor discovery. This approach results in very large delays for the second phase. As an example, both [41, 42] use a 2.4 GHz radio to estimate neighbors position, while the THz radio is used with directional antennas to transfer data in the dominant multi-path direction. Additionally, the work in [43] enriches the dual-band exploitation for distributed MAC protocols at THz frequencies with Multiple-Input Multiple-Output (MIMO) and power-control techniques. Additional improvements to CSMA-based protocols, considering directional antennas but keeping the deafness problem under control, is proposed in [38, 44,45,46] for MMW communications. However, the authors of above papers do not account for propagation delays, even though it is well known that they dramatically affect CSMA [47].

In this work, we overcome the drawbacks of the above mentioned papers, by assuming a unique transceiver, with a single antenna system. Moreover, to avoid the inefficiencies of CSMA we choose a centralized approach; we propose OCDMA, a MAC solution that exploit OCDM-FDM waveforms at PHY layer. It is compared to simple centralized and distributed MAC protocols, previously analyzed in [48]. Our mathematical description accounts, differently from many of the papers above mentioned, for the impact of propagation delays. More importantly, our proposed protocol is specifically designed to reduce such impact.

3 System Description

3.1 Reference Scenario

As mentioned already, we focus on one single machine section, whose typical volume is in the order of few cubic meters. One GW is responsible for collecting data from the N tags distributed within the section, whose geometry can be very different depending on the type of machine. For the sake of simplicity, our reference scenario is modeled via a 3D sphere of radius R and volume \(V=\frac{4}{3} \pi \, R^3\), having the GW in its center; tags are randomly and uniformly deployed inside the sphere.

3.2 System Model

We assume the GW is equipped with a number \(N_a\) of radiating elements, while tags have one omni-directional antenna. Therefore, the GW can generate an antenna beam with solid angle \(\theta =2 \; arcsin (2/N_\mathrm{a})\) radiants. The resulting maximum antenna gain, G, can be assessed as [49]:

$$\begin{aligned} G=\frac{41000}{\left( \theta \; \frac{360}{2 \pi }\right) ^2} \; \end{aligned}$$

For the sake of simplicity we assume the radiation pattern is ideal, with gain G inside the angle \(\theta\), and zero outside.

The total number of antenna beams in the sphere is \(N_\mathrm{{b}} = \frac{2}{\left( 1 - cos \left( \frac{\theta }{2}\right) \right) }\); in the j-th beam of volume \(V_{\theta }=\frac{2}{3} \pi R^3 (1-cos(\theta /2))\), a number of \(n_{\theta _j}\) tags are deployed. Owing to the statistical distribution of tags in the sphere, \(n_{\theta _j}\) is binomially distributed with parameters N and \(p=\frac{V_{\theta }}{V}=\frac{1}{2} (1 - cos (\theta /2))\). Therefore, the probability mass function (p.m.f.) of the number of tags in the j-th beam is given by: \(\mathcal {B}_{n_{{\theta }_j}}(N,p) =\left( \begin{array}{cc}{N}\\ {n_{{\theta }_j}}\end{array}\right) p^{n_{{\theta }_j}} (1-p)^{N-n_{{\theta }_j}}\), and its average value in the following will be denoted as \(\overline{n_{\theta _j}}=\sum _{j=0}^{N} n_{\theta _j} \mathcal {B}_{n_{{\theta }_j}}(N,p)=N \, \cdot p\).

The GW will sweep the beams in order to communicate with all tags, according to a time division approach. Not necessarily all \(N_\mathrm{{b}}\) beams will be swept. Let us denote as \(n_b\) the number of beams to be swept.

We consider the following two scenarios: (i) Static: tags are in fixed positions, and the GW knows a priori their locations; so, it will only sweep the subset of \(n_b=n_\mathrm{{b_s}} \le N_\mathrm{{b}}\) beams illuminating at least one tag; (ii) Quasi-Static: tags are on moving components and can perform small movements; and the GW does not know exactly where they are. Therefore it has to sweep all \(N_\mathrm{b}\) beams: \(n_b=N_b\). We assume a tag may move within a set of K adjacent beams.

3.3 Channel Model

Precise characterization of the radio channel for such an environment, with many metallic components, is a complex task; it is out of the scope of this paper, as we focus on the MAC layer. For the sake of simplicity, we consider the THz channel model proposed in [50, 51]. The path-loss, \(L_\mathrm{tot}\), is given by:

$$\begin{aligned} L_\mathrm{tot} (d,f) = \left( \frac{4 \pi f d}{c} \right) ^2 \, e^{k(f) d} \, L_\mathrm{ref} \end{aligned}$$

where \(\left( \frac{4 \pi f d}{c}\right) ^2\) is the spreading loss, d is the total path length, f the frequency of the wave, and c is the speed of light. The term \(e^{k(f) d}\) represents the molecular absorption attenuation, and k(f) is the medium absorption coefficient, given by \(k(f)=\sum _{i,g} k_{i,g}(f)\), where \(k_{i,g}\) stands for the individual absorption coefficient for the isotopologue i of gas g [50]. Indeed, each gas has different resonating isotopologue within the THz band. The values of \(k_{i,g}\) have been computed using the HITRAN (HIgh resolution TRANsmission molecular absorption) database [52], considering a humidity level of 10%. Finally, \(L_\mathrm{ref}\) represents the surface reflection loss: in Line-of-Sight (LOS) conditions, \(L_\mathrm{ref}^\mathrm{{(LOS)}}=1\), while in Non-LOS (NLOS), \(L_\mathrm{{ref}}\) will be equal to [40, 51]:

$$\begin{aligned} L_\mathrm{{ref}}^\mathrm{(NLOS)} =e^{4 \frac{cos(\phi _\mathrm{i}/2)}{\sqrt{n_\mathrm{r}^2 - 1}}} \end{aligned}$$

where we are assuming the surface is smooth,Footnote 1\(\phi _\mathrm{i}\) is the angle of the incidence wave, and \(n_\mathrm{r}\) is the refractive index.

As usual, the propagation delay, \(\tau _p\), can be computed as a function of the link distance d: \(\tau _p=d/c\). We denote as \(\alpha _p\) the propagation delay normalized to the data packet duration. The larger is \(\alpha _p\), the more the protocol efficiency is impacted by propagation delays.

3.4 Signal-to-Noise Ratio

The transmission system we envisage includes a FDM component, both with OCDMA and the two benchmark protocols described later. In particular, the overall bandwidth B used by the system, is split into M sub-bands of width \({\varDelta } f\), where the channel is assumed to be flat (i.e., the molecular absorption parameter k(f) is constant) [50]. Each sub-band is centered around the carrier frequency \(f_k= f_c - \frac{B}{2} + \left( k-\frac{1}{2}\right) {\varDelta } f\), with \(k=\{1,..,M\}\), being \(f_c\) the central frequency of the overall band. A (data or control) packet is fragmented over the M sub-bands after serial-to-parallel conversion. The system bit rate, \(R_\mathrm{b}\), will be given by \(R_\mathrm{b}=M \cdot R_\mathrm{b_0}\), where \(R_\mathrm{b_0}\) is the bit rate on each sub-band.

The Signal-to-Noise Ratio (SNR) for the i-th tag at distance \(d_i\) from the GW on any of the sub-bands, \(\gamma (d_i)\), is given by:

$$\begin{aligned} \gamma (d_i)=\frac{P_0 (d_i)}{P_n(d_i)} \end{aligned}$$

The expression of the received signal power \(P_0 (d_i)\) can be written as:

$$\begin{aligned} P_0(d_i) = S_0 \, \eta _\mathrm{t} \, G_\mathrm{t} \, \eta _\mathrm{r} \, G_\mathrm{r} \int _{{\varDelta } f} \left( \frac{c}{4 \pi f d_i}\right) ^2 \frac{e^{-k(f)d_i}}{L_\mathrm{ref}} df \end{aligned}$$

In particular, \(S_0\) is the single-sided power spectral density of the transmitted signal and it is assumed to be flat in the bandwidth \({\varDelta } f\) (a reasonable assumption for chirps [31]), i.e., \(S_0 = P_t/{\varDelta } f\), where \(P_t\) is the transmit power; \(G_\mathrm{t}\) and \(G_\mathrm{r}\) are the transmit and receive antenna gains and \(\eta _\mathrm{t}\) and \(\eta _\mathrm{r}\) are the transmit and receive antenna efficiencies, respectively. In our scenario, tags have unitary antenna gain, while for the GW Eq. (1) holds.

The noise power \(P_n(d_i)\) is frequency dependent. Indeed, molecular absorption does not only affect the properties of the channel in terms of attenuation; it also introduces noise [50]. In particular, the total noise temperature of the system, \(T_\mathrm{{noise}}\), is given by \(T_\mathrm{{noise}}=T_\mathrm{{sys}}+T_\mathrm{{mol}}\) where \(T_\mathrm{{sys}}\) is the system electronic noise temperature, which for graphene-based electronic devices can be considered negligible (i.e., the noise figure is unitary), due to the very low noise factors in nanomaterials [53]; \(T_\mathrm{{mol}}\) is the equivalent noise temperature due to molecular absorption, given by \(T_0 \, \left( 1- e^{-k(f) d}\right)\), where \(T_0=290\) K is the reference temperature. Therefore, the noise power on any of the sub-bands is:

$$\begin{aligned} P_n(d_i) = k_B \, \int _{{\varDelta } f} T_\mathrm{{noise}} \, df = k_B T_0 \int _{{\varDelta } f} \left( 1- e^{-k(f) d_i}\right) \, df \end{aligned}$$

where \(k_B=1.38 \cdot 10^{-23}\) J/K is the Boltzmann’s constant. This results in:

$$\begin{aligned} \gamma (d_i) =\frac{S_0 \, G \, \eta _\mathrm{t} \, \eta _\mathrm{r} \, \int _{{\varDelta } f} \left( \frac{c}{4 \pi f d_i}\right) ^2 \frac{e^{-k(f)d_i}}{L_\mathrm{{ref}}} df}{k_B T_0 \; \int _{{\varDelta } f} \left( 1-e^{-k(f)d_i}\right) \, df} \end{aligned}$$

Since we assume that, over each sub-band, k(f) is constant, the SNR can be finally reformulated as:

$$\begin{aligned} \gamma (d_i,f_k) = \frac{S_0 \, G \, \eta _\mathrm{t} \, \eta _\mathrm{r} \, \left( \frac{c}{4 \pi f_k d_i}\right) ^2 \frac{e^{-k(f_k)d_i}}{ L_\mathrm{ref}}}{k_B \, T_0 \, \left( 1-e^{-k(f_k)d_i}\right) } \; \end{aligned}$$

4 OCDMA and Benchmarks

4.1 Waveforms

As already mentioned, at the PHY layer we refer to OCDM as it was introduced in [17]: chirps assigned to different concurrent transmitters are designed to be orthogonal; thus (on each sub-band), they can be transmitted at the same time over the same bandwidth, as in spread spectrum communications. We denote as T the chirp duration.

If C is the number of orthogonal chirps, for a given and generic bandwidth \(B_\mathrm{c}\), the i-th chirp, with \(i=0,1,..,C - 1\), has the following expression:

$$\begin{aligned} \psi _i(t) = e^{j\frac{\pi }{4}} e^{-j\pi \frac{C}{T^2} \left( t - i \frac{T}{C}\right) ^2}, \quad 0 \le t < T \end{aligned}$$

where \(j = \sqrt{-1}\). Equation 9 shows that the orthogonality between the chirps is achieved when any pair of consecutive chirps is time shifted by \(\frac{T}{C}\) and when all of them have a chirp rate of \(-\frac{C}{T^2}\); the minus sign indicates that the frequency sweep within T happens in a decreasing fashion. Figure 1 shows the time-frequency representation of the frequency deviation (with respect to the carrier) performed by an analogue OCDM signal. It is worth mentioning that C chirps are not transmitted in \(2 \cdot B_\mathrm{c}\), as one could argue by looking at Fig. 1, because the discrete OCDM signal may be wrapped in the frequency band of width \(B_\mathrm{c}\) with a proper exploitation of the aliasing coming from the sampling theorem. We assume the latter case hereafter.

Fig. 1
figure 1

Time-frequency representation of the frequency deviation (with respect to the carrier) performed by an analogue OCDM signal

The fundamental property of OCDM signals is that the number of orthogonal chirps is

$$\begin{aligned} C = B_\mathrm{c} \cdot T \; \end{aligned}$$

Assuming chirps are modulated through a binary phase shift (zero or \(\pi\)), the bit rate on each sub-band will be equal to:

$$\begin{aligned} R_\mathrm{b_0}=\frac{1}{T} = \frac{B_\mathrm{c}}{C} \end{aligned}$$

In this paper the bandwidth \(B_\mathrm{c}\) will be set equal to \({\varDelta } f\), therefore \(B=B_\mathrm{c} \, M={\varDelta } f \, M\) and

$$\begin{aligned} R_\mathrm{b}=M \cdot R_\mathrm{b_0}= M \cdot \frac{{\varDelta } f}{C} =\frac{B}{C} \; . \end{aligned}$$

With OCDMA, we will properly set C in order to eliminate interference when multiple nodes compete for channel access; they will transmit simultaneously using orthogonal chirps. The larger is the value of C, the longer are the chirps and the packet duration; therefore, \(\alpha _p\) is smaller and the protocol efficiency is higher. In our scenario, downlink packets are transmitted in interference-free conditions by one individual node (the GW); so, C is set to one. As a result, the downlink bit rate is equal to B, and the packet duration will be inversely proportional to B. In the uplink, tags have to share access to the medium; at least C orthogonal chirps have to be used if an equal number of tags are permitted to transmit simultaneously. The uplink bit rate is \(\frac{B}{C}\) and the packet duration will be proportional to \(\frac{C}{B}\).

In the case of benchmark protocols, the spread spectrum approach implemented in OCDMA is not used and therefore \(C=1\) in all transmissions.

4.2 Time Division

Time is organized into subsequent frames of duration \(T_\mathrm{{frame}}\). During each of them, all N tags try to transmit their data once. Frames are divided into sub-frames, each dedicated to the exploration of the volume illuminated by one beam. Indeed, during each frame the GW sweeps the \(n_\mathrm{{b}}\) beams, remaining in the j-th direction (with \(j=\{1,..,n_\mathrm{{b}}\}\)) for a time \(T_\mathrm{{beam}_j}\) (sub-frame duration). Accounting for the time needed to switch from one beam to the next one, denoted as \(\tau _\mathrm{s}\), we have \(T_\mathrm{{frame}}= \sum _{j=1}^{n_\mathrm{{b}}} \left( T_\mathrm{{beam}_j} + \tau _\mathrm{s}\right)\).

During the j-th sub-frame, first a beacon packet is sent by the GW in downlink, including information about protocol parameters, then an uplink data transmission phase takes place, of duration \(T_{\mathrm{tx}_j}\). We can write:

$$\begin{aligned} T_\mathrm{{frame}}= & {} \sum \limits _{j=1}^{n_\mathrm{{b}}} \, \left( T_{\mathrm{beam}_j} + \tau _\mathrm{s}\right) = \sum \limits _{j=1}^{n_\mathrm{{b}}} \, \left( T_\mathrm{bea}+\tau _\mathrm{p}(R) + T_{\mathrm{tx}_j}+ \tau _\mathrm{s} \right) \nonumber \\= & {} n_\mathrm{{b}} (T_\mathrm{bea}+\tau _\mathrm{p}(R)+ \tau _\mathrm{s}) + \sum \limits _{j=1}^{n_\mathrm{{b}}} T_{\mathrm{tx}_j} \end{aligned}$$

where \(T_\mathrm{{bea}}=\frac{L_\mathrm{{bea}}}{R_\mathrm{b}}\) is the transmission time of the beacon packet, including \(L_\mathrm{{bea}}\) bits. We fix a guard time between the end of the beacon transmission and the beginning of \(T_{\mathrm{tx}_j}\), equal to the maximum propagation delay \(\tau _\mathrm{p}(R)=R/c\).

4.3 OCDMA Protocol

Let us distinguish between the Static and Quasi-Static scenario. In the former case, the GW assignes a different orthogonal chirp to each tag (whose number \(n_{\theta _j}\) is known); so, \(C=n_{\theta _j}\). In the latter, since the GW does not know how many tags are really present in each beam, the worst case is considered, that is C is set equal to the maximum number of tags in the beam, given by \(N_{\theta _j}=\sum _{u=1}^{K} n_{\theta _{j_u}}\), where \(n_{\theta _{j_u}}\) is the number of tags in beam \(j_u\) if tags were still. \(N_{\theta _j}\) is binomially distributed with parameters N and \(K \, p\), that is \(\mathcal {B}_{N_{{\theta }_j}}(N,K \, p)\), while its average value in the following will be denoted as \(\overline{N_{\theta _j}}=\sum _{j=1}^{N} N_{\theta _j} \mathcal {B}_{N_{{\theta }_j}}(N,K \, p)= N \, K \, p\).

Fig. 2
figure 2

The access to the channel for a generic sub-frame, considering a beam with two tags, using OCDMA protocol in the Static scenario

In this way, all tags can communicate using the same time-frequency resource toward the GW, which will receive the orthogonal chirps and will separate them using parallel correlators.

As can be seen in Fig. 2, the data transmission phase in OCDMA starts with a Clear To Send (CTS) packet sent in broadcast by the GW and received by all tags in the beam; they will reply sending their own DATA packet (overlapped in time), after which a cumulative acknowledgment (ACK) is sent by the GW, to notify the successful transmission or not.

Note that it is essential that the GW receives synchronized data from tags, to exploit orthogonality for the sake of interference cancellation. We will not take the consequence of lack of synchronization into account; however, we include a synchronization phase in the protocol, to assess its impact on network throughput.

4.3.1 Static Scenario

To ensure synchronization of all data packets at the GW, tags have to start transmitting at proper instants, depending on their distance from the GW (a mechanism known in radio networks as timing advance). To achieve this, after the reception of the CTS each tag i will wait for an interval of time, \({\varDelta }_\mathrm{i}\), before starting transmitting its data. \({\varDelta }_\mathrm{i}\) is set by each node in order to have the same amount of time between the end of the transmission of the CTS from the GW and the beginning of the reception of the data packets at the GW again. This time duration will be denoted as D (see Fig. 2), and will be set equal to: \(D= 2\cdot \tau _\mathrm{p}(R)\), to account for the worst case scenario (a tag at maximum distance R from the GW). Therefore, each tag i will set its waiting time according to: \({\varDelta }_\mathrm{i} = D-2\cdot \tau _\mathrm{p}(d_\mathrm{i})\). Indeed, in the case of Static scenario, where the GW knows the exact position of tags, we can assume the value of \({\varDelta }_\mathrm{i}\), for tag i, is determined by the GW and included in the payload of the CTS. As a result, the uplink data transmission phase for beam j in the Static scenario, is given by:

$$\begin{aligned} T_{\mathrm{tx}_j}= & {} T_{\mathrm{tx}}(n_{\theta _j}) =T_\mathrm{{cts}}+D+T_\mathrm{{data}}(n_{\theta _j}) +T_\mathrm{{ack}}+\tau _\mathrm{p}(R)\nonumber \\= & {} T_\mathrm{{cts}}+ T_\mathrm{{data}}(n_{\theta _j})+T_\mathrm{{ack}}+3 \, \tau _\mathrm{p}(R) \end{aligned}$$

where \(T_\mathrm{{cts}}\), \(T_\mathrm{{ack}}\) and \(T_\mathrm{{data}}\) represent the duration of CTS, ACK and DATA packets, respectively. They can be computed accounting for the number of bits they include, \(L_\mathrm{{cts}}\), \(L_\mathrm{{ack}}\) and \(L_\mathrm{{data}}\) respectively, and the bit rate that differs for downlink (CTS and ACK) and uplink (DATA) packets, as explained before. Therefore, \(T_\mathrm{{data}}\) will depend on the number of tags in beam j, according to: \(T_\mathrm{{data}}(n_{\theta _j})={L_\mathrm{data} \cdot n_{\theta _j}}/{B}\), having set \(C=n_{\theta _j}\).

4.3.2 Quasi-Static Scenario

In this case, the GW does not know exact tag positions, needed to compute \({\varDelta }_\mathrm{i}\) for each tag; therefore, a synchronization phase is required, before the data transmission phase described above can start. This additional time interval, whose duration will be denoted as \(T_\mathrm{sync_j}\), will unfortunately affect OCDMA performance.

The synchronization phase will be based on two-way handshake with all tags: the GW will transmit a very short packet in broadcast (Request For Synchronization, RFS), made of \(L_\mathrm{rfs}\) bits, and tags will reply with an ACK message one after the other avoiding collisions, through a proper schedule. Each tag is assigned a slot of duration \(2 \cdot \tau _\mathrm{p}(R) + T_\mathrm{ack}\). The slot size is such that, regardless of the distance from the GW, the ACK will be received in the assigned slot without collisions. Each tag replies after reception of the RFS, with a suitable and personalized delay; the i-th tag (\(i=1\), 2, \(\dots\)) will wait \((2 \cdot \tau _\mathrm{p}(R)+T_\mathrm{ack}) \cdot (i-1)\) seconds before transmitting. The only information needed for them is when it is their turn to reply, and this is included in the RFS packet. The synchronization phase is exemplified in Fig. 3; its duration is equal to \(T_\mathrm{sync_j} = T_\mathrm{rfs} + (2 \cdot \tau _\mathrm{p}(R) + T_\mathrm{ack}) \cdot N_{\theta _j}\).

At the end of such phase, the GW will be able to compute the propagation delay for each tag from the measured round-trip time, and determine \({\varDelta }_\mathrm{i}\).

Fig. 3
figure 3

Synchronization phase in the Quasi-Static scenario

Therefore, in the case of Quasi-Static scenario, we have:

$$\begin{aligned} T_{\mathrm{tx}_j}= & {} T_{\mathrm{tx}}(N_{\theta _j}) = T_\mathrm{sync_j}+T_\mathrm{{cts}}+D+T_\mathrm{{data}}(N_{\theta _j}) +T_\mathrm{{ack}} +\tau _\mathrm{p}(R) \nonumber \\= & {} T_\mathrm{rfs}+N_{\theta _j} \cdot (2 \tau _\mathrm{p} (R)+T_\mathrm{ack})+T_\mathrm{{cts}} + T_\mathrm{{data}}(N_{\theta _j})+T_\mathrm{{ack}}+3 \, \tau _\mathrm{p}(R) \end{aligned}$$

where \(T_\mathrm{{rfs}}\) is the time spent to transmit the RFS packet, given by \(L_\mathrm{rfs}/R_\mathrm{b}\). In this case, \(T_\mathrm{{data}}\) now depends on the total number of potential tags per beam. Therefore, we have: \(T_\mathrm{{data}}(N_{\theta _j})=\frac{L_\mathrm{data} \cdot N_{\theta _j}}{B}\), having set \(C=N_{\theta _j}\).

4.4 First Benchmark: Polling

As a first benchmark, we consider a centralized protocol, based on polling. In this case, after the beacon transmission the time axis is split into slots. The GW interrogates one by one all tags in \(V_{{\theta }}\) and the data exchange takes place in the dedicated slot.

Within each slot we have (i) CTS packet from the GW to the tag, to notify it is ready to receive data; (ii) DATA transmission from the tag to the GW; and (iii) ACK from the GW to the tag. As soon as a tag has been polled, it will go back to sleep until the subsequent frame will start. Therefore, the data transmission phase of the j-th sub-frame is composed of different slots, of duration:

$$\begin{aligned} T_\mathrm{{slot}_i}= T_\mathrm{{slot}}(d_i)=T_\mathrm{{cts}}+T_\mathrm{{data}}+T_\mathrm{{ack}}+3 \, \tau _\mathrm{p}(d_i) \end{aligned}$$

where \(T_\mathrm{{cts}}\), \(T_\mathrm{{data}}\) and \(T_\mathrm{{ack}}\) are the transmission times of CTS, DATA and ACK packets, respectively, computed as for OCDMA. \(\tau _\mathrm{p}(d_i)\) is the propagation delay for the polled tag i; thus, every slot has a different duration, depending on its distance from the GW.

In the Static scenario, we have:

$$\begin{aligned} T_{\mathrm{tx}_j} = \sum \limits _{i=1}^{n_{\theta _j}} T_{\mathrm{slot}_i} \; \end{aligned}$$

In the Quasi-Static case,

$$\begin{aligned} T_{\mathrm{tx}_j} = \sum \limits _{i=1}^{N_{\theta _j}} T_{\mathrm{slot}_i} \; \end{aligned}$$

4.5 Second Benchmark: Randomized Aloha

We consider as a second benchmark a simple contention-based protocol, inspired to Aloha. The data transmission phase is composed of an interval of time, of duration \(T_{\mathrm{CW}_j}\), during which tags in the volume \(V_{{\theta }}\) can transmit their data to the GW. Each tag at the beginning of the data transmission phase generates a random waiting time, uniformly distributed between zero and \(T_{\mathrm{CW}_j}\), after which it transmits. Being the packet success probability strongly affected by the duration \(T_{\mathrm{CW}_j}\) and the number of tags competing for the channel, we study the performance of this protocol by varying \(T_{\mathrm{CW}_j}\); we set it equal to \(T_\mathrm{CW}\) for all j. At the end of transmission each tag will wait for an ACK from the GW.

In this case, for both the Static and Quasi-Static scenarios we have:

$$\begin{aligned} T_\mathrm{{tx}_j} = T_\mathrm{CW} \; . \end{aligned}$$

Note that in this case the frame duration does not depend on the position of tags.

5 Performance Metrics

We will now derive mathematically the performance of OCDMA and the benchmarks in terms of network throughput and latency. This requires the computation of the packet success probability.

5.1 Bit Error Rate

We first need an expression for the Bit Error Rate, BER; for both OCDMA and the two benchmark protocols, since we modulate the chirps as binary antipodal waveforms, over the kth sub-band we have:

$$\begin{aligned} BER(d_i,f_k) = \frac{1}{2} \, erfc \left( \sqrt{\gamma (d_i,f_k)}\right) \end{aligned}$$

where erfc is the complementary error function.

5.2 Packet Success Probability

The packet success probability, \(p_\mathrm{s}\), for tag i at distance \(d_i\) from the GW and belonging to beam j, is given by:

$$\begin{aligned} p_\mathrm{s} (d_i,n_{\theta _j}) = p_\mathrm{phy}(d_i) \cdot p_\mathrm{mac} (n_{{\theta }_j}) \end{aligned}$$

The probability \(p_\mathrm{phy}(d_i)\) accounts for PHY layer aspects; to compute it, we average over LOS and NLOS conditions, having probability \(p_{LOS}\) and \(1-p_{LOS}\), respectively. In the two cases we set \(L_\mathrm{{ref}}\) as mentioned in Section 3.3.

Assuming independent events, \(p_\mathrm{phy}(d_i)\) is computed as the product of the success probabilities at PHY layer of each independent packet transmitted to realize communication between tag i and the GW. Let us define \(p_\mathrm{p}(d,L)\) as the probability that a generic packet of L bits at distance d is correctly decoded at the receiver side (whether tag or GW). In the case of OCDMA, packet success implies successful transmissions of the beacon, the CTS and the data packets:

$$\begin{aligned} p_\mathrm{phy} (d_i) = p_\mathrm{p}(d_i,L_\mathrm{bea}) \cdot p_\mathrm{p}(d_i,L_\mathrm{cts}) \cdot p_\mathrm{p}(d_i,L_\mathrm{data}) \end{aligned}$$

The same holds for the first benchmark protocol, since the sequence of packets to be transmitted is the same. Finally, in the case of the second benchmark, packet success implies successful transmissions of the beacon and the data packet:

$$\begin{aligned} p_\mathrm{phy} (d_i) = p_\mathrm{p}\left( d_i,L_\mathrm{bea}\right) \cdot p_\mathrm{p}\left( d_i,L_\mathrm{data}\right) \end{aligned}$$

Without loss of generality, we assume absence of Forward Error Correction (FEC); the packet is correctly received if all bits are correct. Indeed, we assume that each transmission is characterized by a time-flat channel [54]; thereby, the use of FEC techniques is not favorable because adjacent bits experience correlated errors. Therefore:

$$\begin{aligned} p_\mathrm{p}(d,L) = \prod \limits _{k=1}^{M} \, \left( 1- BER (d, f_k)\right) ^{L/M} \end{aligned}$$

The probability \(p_\mathrm{mac} (n_{{\theta }_j})\) depends on the MAC protocol, and it is equal to one for contention-free protocols like OCDMA and Polling, while it depends on the number of tags in beam j, \(n_{{\theta }_j}\), for Aloha. In particular, in the latter case \(p_\mathrm{mac}(n_{{\theta }_j})\) represents the probability that there are no collisions in the beam j, when \(n_{{\theta }_j}\) tags are competing for the channel. It can be computed as the probability that a packet of duration \(T_\mathrm{{data}}\) generated in a random instant within \(T_{\mathrm{CW}}\) does not collide (partially or completely) with a packet or an acknowledgement generated by any other tag within the same beam; therefore:

$$\begin{aligned} p_\mathrm{mac}(n_{{\theta }_j})=\left( 1-\frac{T_\mathrm{{data}}+T_\mathrm{{ack}}+2 \tau _{p}(R)}{T_{\mathrm{CW}}}\right) ^{2\, (n_{{\theta }_j}-1)} \end{aligned}$$

where for the propagation delay we consider the worst case.

As long as the SNR at distance \(d_i\) for each frequency \(f_k\) is computed, the set of equations above determine the packet success probability. It depends on many parameters, including the number of antenna beams swept by the GW, through \(n_{\theta _{j}}\).

5.3 Network Throughput Definition

Let us denote as \(\mathbf{d}=\{d_1, .. , d_\mathrm{N}\}\) the vector of tag distances, and as \({\mathbf{n}_{\theta }}=\{n_{\theta _1},..,n_{\theta _{n_\mathrm{b}}}\}\) the vector of the number of tags deployed in each beam; then, network throughput, S, can be defined as:

$$\begin{aligned} S(n_\mathrm{b},\mathbf{d},{ {\mathbf{n}}_{\theta }} )= \frac{\sum _{j=1}^{n_\mathrm{b}} \, \sum _{i=1}^{n_{\theta _j}} \, L_\mathrm{{pay}} \, p_{s}(d_i,n_{\theta _j})}{T_\mathrm{{frame}}(n_\mathrm{b},\mathbf{d},{{\mathbf{n}}_{\theta }})} \end{aligned}$$

where \(L_\mathrm{{pay}}\) is the number of bits of data payload, assuming that all tags are transmitting the same number of bits in each frame. Note that in case no tags are present in a beam, no throughput is gathered (i.e., \(p_{s}(d_i,n_{\theta _j})\) is set equal to zero when \(n_{\theta _j}=0\)). In the definition above, \(T_\mathrm{{frame}}\) is computed as shown in expression (13), where \(T_{\mathrm{tx}_j}\) depends on the scenario and protocol considered; in general terms, \(T_\mathrm{{frame}}\) depends on the number of beams swept, the number of tags in each beam, and their positions.

Therefore, we are interested in the average network throughput, \(\overline{S}\), averaged among all tags, given by:

$$\begin{aligned} \overline{S}= \mathbb {E}_{n_\mathrm{b},\mathbf{d},{ \mathbf{n}_{\theta }}} \left\{ \frac{ \sum _{j=1}^{n_\mathrm{b}} \, \sum _{i=1}^{n_{\theta _j}} L_\mathrm{{pay}} \, p_{s}(d_i,n_{\theta _j})}{T_\mathrm{{frame}}(n_\mathrm{b},\mathbf{d},{\mathbf{n}_{\theta }})} \right\} \end{aligned}$$

where \(\mathbb {E}_x\{g(x)\}\triangleq \overline{g(x)}\) is the average value of the function g(x), w.r.t. the statistics of the random variable x. In particular, we will have:

$$\begin{aligned} \mathbb {E}_{{d_i}} \{g(d_i)\} \triangleq \overline{g(d_i)} = \int _{d_i} g(d_i) \, f(d_i) \, dd_i \end{aligned}$$

where \(f(d_i)\) is the probability density function (pdf) of tag distances, given by \(f(d_i)= \frac{3 \, d_i^2}{R^3}\). Finally, \(F(d_1,..,d_{N})\) will be the joint pdf of tag distances, given by (thanks to the independence of tag positions):

$$\begin{aligned} F(d_1,..,d_{N}) =\prod \limits _{l=1}^{N} \frac{3 \, d_l^2}{R^3}. \end{aligned}$$

As will be shown in the rest of this section, the above defined average network throughput is very complex to be numerically evaluated; in order to reduce the computational time, we will mainly focus on an approximated formula, \(\hat{S}\), obtained as the ratio between the average values (averaged over the statistics of \(n_\mathrm{b}\), \(\mathbf{d},{ \mathbf{n}_{\theta }}\)) of the numerator and denominator of Eq. (27). An example of comparison between approximated and exact formulas is reported in Section 6. We provide below the formulation of \(\overline{S}\) and \(\hat{S}\) for OCDMA and for the two benchmark protocols.

5.4 OCDMA Protocol

In the Static scenario we can account for the fact that we sweep only beams with at least one tag, that is \(n_\mathrm{b}=n_\mathrm{b_s}\), where \(n_\mathrm{{b_s}}\) is binomially distributed, \(\mathcal {B}_{n_\mathrm{b_S}}(N_\mathrm{b},\chi )\), with \(\chi\) being the probability that a beam has at least one tag given by \(\chi =\sum _{n_{\theta _j}=1}^{N} \mathcal {B}_{n_{{\theta }_j}}(N,p)\), and having average value, \(\overline{n_\mathrm{b_s}}= \sum _{n_\mathrm{b_s}=1}^{N_\mathrm{b}} n_\mathrm{b_s} \mathcal {B}_{n_\mathrm{b_S}}(N_\mathrm{b},\chi )\). It is worth noting that in this case, \(T_\mathrm{{frame}}\) does not depend on tag distances, and the success probability \(p_{s}\) does not depend on the number of tags per beam. Therefore, Eq. (30) holds, where \(\overline{p_\mathrm{phy}}\) is computed as in Eq. (28) by replacing \(p_\mathrm{phy}(d_i)\) given by Eq. (22) to \(g(d_i)\).

$$\begin{aligned} \overline{S}= & {} \mathbb {E}_{n_\mathrm{b_s},d_i,{ \mathbf{n}_{\theta }}} \left\{ \frac{ \sum _{j=1}^{n_\mathrm{b_s}} \, \sum _{i=1}^{n_{\theta _j}} \, L_\mathrm{{pay}} \, p_\mathrm{phy}(d_i)}{T_\mathrm{{frame}}(n_\mathrm{b_s},{ \mathbf{n}_{\theta }})}\right\} \nonumber \\= & {} L_\mathrm{pay} \cdot \sum \limits _{n_\mathrm{b_s}=1}^{N_\mathrm{b}} \; \sum \limits _{n_{\theta _j}=1}^{N} \; \frac{ n_\mathrm{b_s} \, n_{\theta _j} \int _{d_i} \, p_\mathrm{phy}(d_i) \; f (d_i) \; dd_i}{n_\mathrm{{b_s}} (T_\mathrm{bea}+\tau _\mathrm{p}(R)+\tau _\mathrm{s}) + \sum _{j=1}^{n_\mathrm{b_s}} T_{\mathrm{tx}} (n_{\theta _j})} \cdot \mathcal {B}_{n_\mathrm{b_s}}(N_\mathrm{b},\chi ) \cdot \mathcal {B}_{n_{\theta _j}}(N,p)/\chi \nonumber \\= & {} L_\mathrm{pay} \; \overline{p_\mathrm{phy}} \, \sum \limits _{n_\mathrm{b_s}=1}^{N_\mathrm{b}} \; \sum \limits _{n_{\theta _j}=1}^{N} \; \frac{ n_\mathrm{b_s} \, n_{\theta _j} \, \mathcal {B}_{n_\mathrm{b_s}}(N_\mathrm{b},\chi ) \cdot \mathcal {B}_{n_{\theta _j}}(N,p)/\chi }{n_\mathrm{{b_s}} (T_\mathrm{bea}+\tau _\mathrm{p}(R)+\tau _\mathrm{s}) + \sum _{j=1}^{n_\mathrm{b_s}} T_{\mathrm{tx}} (n_{\theta _j})} \end{aligned}$$

We then approximate Eq. (30) as (31):

$$\begin{aligned} \hat{S}= & {} \frac{N \; L_\mathrm{pay} \; \overline{p_\mathrm{phy}}}{\mathbb {E}_{n_\mathrm{b_s},\mathbf {n_{\theta }}}\{n_\mathrm{{b_s}} \; (T_\mathrm{bea} +\tau _\mathrm{p}(R) +\tau _\mathrm{s} )+ \sum _{j=1}^{n_\mathrm{b_s}} T_\mathrm{{tx}}(n_{\theta _j})\}} \nonumber \\= & {} \frac{N \; L_\mathrm{pay} \; \overline{p_\mathrm{phy}}}{\overline{n_\mathrm{{b_s}}} \; (T_\mathrm{bea} +\tau _\mathrm{p}(R) +\tau _\mathrm{s} + \overline{T_\mathrm{{tx}}})} \end{aligned}$$

where \(\overline{T_\mathrm{{tx}}}\) is given by:

$$\begin{aligned} \overline{T_\mathrm{{tx}}} =\sum \limits _{n_{\theta _j}=1}^{N} T_\mathrm{{tx}}(n_{\theta _j}) \, \mathcal {B}_{n_{{\theta }_j}}(N,p)/\chi \; \end{aligned}$$

and \(T_\mathrm{{tx}} (n_{\theta _j})\) is computed as in Eq. (14). Note that in the approximated expression of throughput we have introduced N as it is equal to \(\overline{n_\mathrm{b_s}} \cdot \overline{n_{\theta _\mathrm{j}}}\).

In the case of Quasi-Static scenario we have to sweep all beams, that is \(n_\mathrm{b}=N_\mathrm{b}\) and it is deterministic; in addition \(T_\mathrm{{frame}}\) depends on \({\mathbf{N}_{\theta }}=\{N_{\theta _1},..,N_{\theta _{N_\mathrm{b}}}\}\). Following the same approach of the Static case, it is possible to write the exact expression of the throughput as follows:

$$\begin{aligned} \overline{S}= & {} \mathbb {E}_{{d_i},{ \mathbf{n}_{\theta }}} \left\{ \frac{ \sum _{j=1}^{N_\mathrm{b}} \, \sum _{i=1}^{N_{\theta _j}/K} \, L_\mathrm{{pay}} \, p_\mathrm{phy}(d_i)}{T_\mathrm{{frame}}({\mathbf{n}_{\theta }})}\right\} \nonumber \\= & {} N_\mathrm{b} \, L_\mathrm{pay} \; \overline{p_\mathrm{phy}} \, \sum \limits _{N_{\theta _j}=0}^{N} \; \frac{ (N_{\theta _j}/K) \cdot \; \mathcal {B}_{N_{\theta _j}}(N,K\, p)}{N_\mathrm{{b}} (T_\mathrm{bea}+\tau _\mathrm{p}(R)+\tau _\mathrm{s}) + \sum _{j=1}^{N_\mathrm{b}} T_{\mathrm{tx}} (N_{\theta _j})} \end{aligned}$$

The approximated formula becomes:

$$\begin{aligned} \hat{S} = \frac{N \; L_\mathrm{pay} \; \overline{p_\mathrm{phy}}}{N_\mathrm{{b}}(T_\mathrm{bea} +\tau _\mathrm{p}(R) +\tau _\mathrm{s} + \overline{T_\mathrm{{tx}}})} \end{aligned}$$

where we set \(N_\mathrm{b} \; \overline{N_{\theta _j}} = N_\mathrm{b} \; K \; \overline{n_{\theta _j}} = N \, K\) and \(\overline{T_\mathrm{{tx}}}\) is given by:

$$\begin{aligned} \overline{T_\mathrm{{tx}}} =\sum \limits _{N_{\theta _j}=0}^{N} T_\mathrm{{tx}}(N_{\theta _j}) \, \mathcal {B}_{N_{{\theta }_j}}(N,K \,p) \; \end{aligned}$$

where \(T_\mathrm{{tx}} (N_{\theta _j})\) is given by Eq. (15).

5.5 First Benchmark: Polling

Following the same approach, in the Static scenario the exact throughput expression is shown in Eq. (36), while the corresponding approximated formula is given by Eq. (37):

$$\begin{aligned} \overline{S}= & {} \mathbb {E}_{n_\mathrm{b_s},\mathbf{d},{ \mathbf{n}_{\theta }}} \left\{ \frac{ \sum _{j=1}^{n_\mathrm{b_s}} \, \sum _{i=1}^{n_{\theta _j}} \, L_\mathrm{{pay}} \, p_\mathrm{phy}(d_i)}{T_\mathrm{{frame}}(n_\mathrm{b_s},{ \mathbf{d}},{ \mathbf{n}_{\theta }})}\right\} \nonumber \\= & {} \sum \limits _{n_\mathrm{b_s}=1}^{N_\mathrm{b}} \; \; \sum \limits _{n_{\theta _j}=1}^{N} \; \left[ \underset{d_1 .. d_N}{\idotsint } \frac{ n_\mathrm{b_s} \, n_{\theta _j} \, L_\mathrm{pay} \; p_\mathrm{phy}(d_i) \; F(d_1, .. , d_N)}{n_\mathrm{{b_s}} (T_\mathrm{bea}+\tau _\mathrm{p}(R) + \tau _\mathrm{s}) + \sum _{j=1}^{n_\mathrm{b_s}} \sum _{i=1}^{n_{\theta _j}} T_{\mathrm{slot}} (d_i)} \; dd_1 \, .. \, dd_N \; \right] \nonumber \\&\cdot \mathcal {B}_{n_\mathrm{b_S}}(N_\mathrm{b},\chi ) \; \mathcal {B}_{n_{\theta _j}}(N,p)/\chi \end{aligned}$$
$$\begin{aligned} \hat{S}= & {} \frac{N \; L_\mathrm{pay} \; \overline{p_\mathrm{phy}}}{\mathbb {E}_{n_\mathrm{b_s}}\{n_\mathrm{{b_s}} \; (T_\mathrm{bea} +\tau _\mathrm{p}(R)+\tau _\mathrm{s})\} + \mathbb {E}_{n_\mathrm{b_s},\mathbf{d},{\mathbf{n}_{\theta }}} \left\{ \sum _{j=1}^{n_\mathrm{b_s}} \sum _{i=1}^{n_{\theta _j}} T_\mathrm{{slot}}(d_i)\right\} } \nonumber \\= & {} \frac{N \; L_\mathrm{pay} \; \overline{p_\mathrm{phy}}}{\overline{n_\mathrm{{b_s}}} \; (T_\mathrm{bea} +\tau _\mathrm{p}(R)+\tau _\mathrm{s})+ N \cdot \overline{T_\mathrm{{slot}}}} \end{aligned}$$

The second addendum at the denominator of Eq. (37) is obtained as follows:

$$\begin{aligned} N \cdot \overline{T_\mathrm{{slot}}}= & {} \sum \limits _{n_\mathrm{b_s}=1}^{N_\mathrm{b}} \sum \limits _{n_{\theta _j}=1}^{N} \left( \underset{d_1 .. d_{N}}{\idotsint } \sum \limits _{j=1}^{n_\mathrm{b_s}} \sum \limits _{i=1}^{n_{\theta _j}} T_\mathrm{{slot}}(d_i) \, F(d_1, .. , d_{N}) \; dd_1 \, .. \, dd_{N} \; \right) \mathcal {B}_{n_\mathrm{b_S}}(N_\mathrm{b},\chi ) \; \mathcal {B}_{n_{\theta _j}}(N,p)/\chi \nonumber \\= & {} \sum \limits _{n_\mathrm{b_s}=1}^{N_\mathrm{b}} \sum \limits _{n_{\theta _j}=1}^{N} \sum \limits _{j=1}^{n_\mathrm{b_s}} \sum \limits _{i=1}^{n_{\theta _j}} \left( \int _{d_i} T_\mathrm{{slot}}(d_i) \, f(d_i) \, dd_i \, \right) \mathcal {B}_{n_\mathrm{b_S}}(N_\mathrm{b},\chi ) \; \mathcal {B}_{n_{\theta _j}}(N,p)/\chi \nonumber \\= & {} \sum \limits _{n_\mathrm{b_s}=1}^{N_\mathrm{b}} \sum \limits _{n_{\theta _j}=1}^{N} n_\mathrm{b_s} n_{\theta _j} \left( \int _{d_i} T_\mathrm{{slot}}(d_i) \, f(d_i) \, dd_i \, \right) \mathcal {B}_{n_\mathrm{b_S}}(N_\mathrm{b},\chi ) \; \mathcal {B}_{n_{\theta _j}}(N,p)/\chi \end{aligned}$$

where wet set \(N=\overline{n_\mathrm{{b_s}}}\; \overline{n_{\theta _j}} / \chi\) and \(\overline{T_\mathrm{{slot}}}\) is given by Eq. (28) by replacing \(g(d_i)\) to \(T_{\mathrm{slot}}(d_i)\) given by Eq. (16).

In the case of Quasi-Static scenario, being \(n_\mathrm{b}=N_\mathrm{b}\), the following exact expression of the throughput comes:

$$\begin{aligned} \overline{S}= & {} \mathbb {E}_{\mathbf{d},{ \mathbf{n}_{\theta }}} \left\{ \frac{ \sum _{j=1}^{N_\mathrm{b}} \, \sum _{i=1}^{N_{\theta _j}/K} \, L_\mathrm{{pay}} \, p_\mathrm{phy}(d_i)}{T_\mathrm{{frame}}(\mathbf{d})}\right\} \nonumber \\= & {} N_\mathrm{b} \sum \limits _{N_{\theta _j}=0}^{N} \; \left[ \underset{d_1 .. d_{K \cdot N}}{\idotsint } \frac{ (N_{\theta _j}/K) \cdot \, L_\mathrm{pay} \; p_\mathrm{phy}(d_i) \; F(d_1, .. , d_{K \cdot N})}{N_\mathrm{{b}} (T_\mathrm{bea}+\tau _\mathrm{p}(R) + \tau _\mathrm{p}) + \sum _{j=1}^{N_\mathrm{b}} \sum _{i=1}^{N_{\theta _j}} T_{\mathrm{slot}} (d_i)} \; dd_1 \, .. \, dd_{K \cdot N} \; \right] \nonumber \\&\cdot \mathcal {B}_{N_{\theta _j}}(N,K \, p) \end{aligned}$$

and the approximated formula is given by:

$$\begin{aligned} \hat{S} = \frac{N \; L_\mathrm{pay} \; \overline{p_\mathrm{phy}}}{N_\mathrm{{b}}(T_\mathrm{bea} +\tau _\mathrm{p}(R)+\tau _\mathrm{s})+ N \; K \; \overline{T_\mathrm{{slot}}}} \end{aligned}$$

where it again holds \(N_\mathrm{b} \; \overline{N_{\theta _j}} = N \, K\).

5.6 Second Benchmark: Randomized Aloha

In this case we have to consider the MAC level packet success probability, where the number of contending tags varies in the two scenarios. For the sake of conciseness, we just report here the approximated formula, obtained by following the same approach presented for the Polling case.

In the Static scenario we have:

$$\begin{aligned} \hat{S} = \frac{N \; L_\mathrm{pay} \; \overline{p_\mathrm{phy}} \; \overline{p_\mathrm{mac}}}{\overline{n_\mathrm{b_s}} (T_\mathrm{bea} + \tau _p(R) +\tau _\mathrm{s} + T_\mathrm{CW})} \end{aligned}$$

where \(\overline{p_\mathrm{mac} }\) is given by:

$$\begin{aligned} \overline{p_\mathrm{mac }} =\sum \limits _{n_{\theta _j}=1}^{N} p_\mathrm{mac}(n_{\theta _j}) \, \mathcal {B}_{n_{{\theta }_j}}(N,p) / \chi \end{aligned}$$

In the Quasi-Static scenario we have:

$$\begin{aligned} \hat{S}= \frac{N \; L_\mathrm{pay} \; \overline{p_\mathrm{phy}} \; \overline{p_\mathrm{mac}}}{N_\mathrm{b}\;(T_\mathrm{bea}+\tau _p(R) +\tau _\mathrm{s}+ T_\mathrm{CW})} \end{aligned}$$

where \(\overline{p_\mathrm{mac}}\) has the following expression:

$$\begin{aligned} \overline{p_\mathrm{mac}}= & {} \frac{1}{K} \sum \limits _{n_\mathrm{c_1}=1}^{N} \sum \limits _{n_\mathrm{c_2}=1}^{N-n_\mathrm{c_1}} \, ... \, \sum \limits _{n_\mathrm{c_K}=1}^{N-\sum _{u=1}^{K-1} n_\mathrm{c_u}} \left( \sum \limits _{u=1}^{K} p_\mathrm{mac}(n_\mathrm{c_u})\right) \cdot \frac{\mathcal {B}_{n_{\mathrm{c}_1}}(N,K\, p)}{\chi _{n_{\mathrm{c}_1}}} \cdot \frac{\mathcal {B}_{n_{\mathrm{c}_2}}(N-n_{\mathrm{c}_1},K\, p)}{{\chi _{n_{\mathrm{c}_2}}} } \, ... \, \nonumber \\&\cdot \frac{\mathcal {B}_{n_{\mathrm{c}_K}}\left( N-\sum _{u=1}^{K-1} n_\mathrm{c_u},K \, p\right) }{\chi _{n_{\mathrm{c}_K}}} \end{aligned}$$

In Eq. (44) we average \(p_\mathrm{mac}\) over the K beams of a cluster and we denote as \(n_\mathrm{c_u}\) the number of tags competing for the channel in beam u of the cluster; this variable is binomially distributed with parameter \(K \, p\) and assumes a maximum value that depends on the number of tags present in the other beams of the same cluster (the number of tags in the beams of a cluster is not uncorrelated). Finally, the normalization factor is given by: \(\chi _{n_{\mathrm{c}_1}}=\sum _{n_{\mathrm{c}_1}=1}^{N} \mathcal {B}_{n_{\mathrm{c}_1}}(N,K\cdot p)\) and the other values of \(\chi\) are set similarly.

5.7 Latency

Latency is defined in this context as the time needed by the GW to gather data from all the tags in the network; therefore, it coincides with the frame duration, \(T_\mathrm{{frame}}\), derived in Section 4.

6 Results

In this section, we present and discuss the numerical evaluations for the closed-form expressions of network throughput and latency. System parameters, if not otherwise specified, are set as in Table 1. It is worth mentioning that all parameters, such as the transmit power or the bandwidth, have been set in order to obtain \(\gamma (d_i=R) \ge \gamma _\mathrm{min}\), where \(\gamma _\mathrm{min}\) is the minimum SNR level to be guaranteed at the receiver-end.

Table 1 Parameter settings
Table 2 Success probability, \(p_\mathrm{s}\), as a function of \(N_\mathrm{a}\) for the different protocols and Static scenario

We start the analysis by discussing the success probability, \(p_\mathrm{s}\), as a function of \(N_\mathrm{a}\) (see Table 2). As expected, Aloha is the worst protocol, due to collisions. This is particularly true when \(N_\mathrm{a}\) is small, because the volumes illuminated by beams are larger and more tags compete for access. However, especially for low values of \(N_\mathrm{a}\), the performance is mainly affected by noise, owing to a small antenna gain at the GW. The table allows to derive the minimum number of antennas, \(N_\mathrm{{a_{min}}}\), to be installed at the GW, given the reliability requirement. For example, if the industrial application requires \(p_\mathrm{s} \ge 0.98\), \(N_\mathrm{{a_{min}}}\simeq 10\) for OCDMA and Polling is sufficient, while many more antennas should be deployed in the case of the Aloha protocol.

Table 3 Comparing \(\overline{S}\) with \(\hat{S}\) for \(N=4\) and Static Scenario. All values are given in [Gbit/s].

We now analyze the behavior of throughput by changing different system parameters. Approximated formulas are used, to reduce computational time (precise formulas require weeks to run, in case \(N>50\)). To demonstrate the negligible impact of the approximation, Table 3 reports some comparisons: a very good match has been observed, as the error is confined in all cases to less than 5 percent.

Figures 4 and 5 report \(\hat{S}\) and latency as a function of N, when setting \(N_\mathrm{a}=10\), respectively. As can be noted, the network throughput of OCDMA outperforms the benchmark solutions in all cases for the Static scenario; the advantage increases with the tag density. For N larger than 200, OCDMA provides throughput higher by at least 25 percent with respect to Polling; such increment is significantly larger than the approximation margin introduced by our formulas.

Fig. 4
figure 4

\(\hat{S}\) [Gbit/s] versus N for the two scenarios

Fig. 5
figure 5

Latency, \(T_\mathrm{frame} [\mu s]\) versus N for the two scenarios

In general, for the Static scenario, it could be shown that OCDMA outperforms Polling when the average number of tags per beam, \(\overline{n_{\theta _j}}\), is larger than one. This is because, if only one tag is present in a beam, the transmission phase duration for the two protocols will be almost the same. In contrast, for larger number of tags per beam, \(T_\mathrm{frame}\) for Polling will be larger, due to the need to poll multiple tags, while in OCDMA it will remain limited since all tags will transmit at the same time. Since \(\overline{n_{\theta _j}}=\frac{N}{2}\left( 1-cos\left( \frac{\theta }{2}\right) \right) \simeq \frac{2 \, N}{N_\mathrm{a}^2}\), it is larger than one as long as \(N>\frac{N_\mathrm{a}^2}{2}\) for the Static scenario; since Figs. 4 and 5 refer to \(N_a=10\), this applies as long as N is larger than 50, as confirmed by the curves.

However, in the Quasi-Static case Polling is the best solution, due to the need of implementing the synchronization phase in OCDMA not present in Polling. As expected, Aloha is the worst protocol, due to its contention-based nature.

For what concerns the latency, as expected, it slightly increases with N. We can also observe that Aloha is the best protocol, thanks to the absence of control packets to be sent, together with the fact that \(T_\mathrm{{CW}}\) in this case can be properly optimized (at the cost of collisions). As for the comparison between OCDMA and Polling, we can observe the same trend commented for the network throughput: for Static and dense networks OCDMA works better than Polling. Finally, it is worth noting that in all cases latency is maintained below 10 \(\mu s\), that is suitable for many industrial control applications.

Fig. 6
figure 6

\(\hat{S}\) versus \(N_\mathrm{a}\) for the Static scenario

We conclude by reporting \(\hat{S}\) as a function of \(N_\mathrm{a}\) in Fig. 6, for \(N=100\) and considering the Static scenario. In the case of Aloha \(\hat{S}\) increases with \(N_\mathrm{a}\), thanks to the improvement of both, PHY and MAC losses. Indeed, by increasing \(N_\mathrm{a}\), the antenna gain gets larger and the beam volume decreases, making the average number of tags per beam lower (i.e., less collisions in Aloha). In contrast, in the case of OCDMA and Polling, \(\hat{S}\) slightly decreases by getting \(N_\mathrm{a}\) larger, due to the growing of \(\overline{n_\mathrm{{b_S}}}\) (at the denominator of \(\hat{S}\)). An horizontal floor is reached for large values of \(N_\mathrm{a}\). The figure also shows the impact of the propagation delay \(\tau _\mathrm{p}\): the throughput is also reported for an ideal case where it is negligible (i.e., \(\tau _\mathrm{p}=0\)). A notable worsening can be observed when considering the true values of \(\tau _\mathrm{p}\). This proves our claim that MAC protocols at THz communications need to be investigated accounting for propagation delays.

7 Conclusions

This paper offers three degrees of novelty: (i) the analysis of the intra-machine scenario using THz frequencies, which is an intermediate case between existing nano-scale and macro-scale applications of THz communications (see Section 2); (ii) the proposal of OCDMA, a MAC protocol specifically designed for this relevant scenario; (iii) the inclusion of propagation delays in the design and performance assessment of the MAC protocol.

Our proposed OCDMA solution is compared to Polling and Aloha based schemes, taken as benchmarks. We mathematically derived expressions for the packet success probability, the network throughput, and the latency.

As discussed in the last section, OCDMA provides advantages as long as the number of nodes in the machine is large and when the GW knows tags position, so that synchronization among them can be achieved without additional protocol phases. As a rule of thumb, the advantage of OCDMA in the Static case is evident when the number of nodes under the control of the GW is larger than \(N_a^2/2\).