An Energy-Efficient Distributed Dynamic Bandwidth Allocation Algorithm for Passive Optical Access Networks

The rapid deployment of passive optical access networks (PONs) increases the global energy consumption of networking infrastructure. This paper focuses on the minimization of energy consumption in Ethernet PONs (EPONs). We present an energy-efficient, distributed dynamic bandwidth allocation (DBA) algorithm able to power off the transmitter and receiver of an optical network unit (ONU) when there is no upstream or downstream traffic. Our main contribution is combining the advantages of a distributed DBA (namely, a smaller packet delay compared to centralized DBAs, due to less time being needed to allocate the transmission slot) with energy saving features (that come at a price of longer delays due to the longer queue waiting times when transmitters are switched off). The proposed algorithm analyzes the queue size of the ONUs in order to switch them to doze/sleep mode when there is no upstream/downstream traffic in the network, respectively. Our results show that we minimized the ONU energy consumption across a wide range of network loads while keeping delay bounded.


Introduction
One of the bottlenecks in conventional wired broadband access networks is the bandwidth limitation of the copper medium. Ethernet passive optical networks (EPONs) are deployed to offer higher bandwidth than copper-based technologies in a cost-effective manner [1]. EPONs are composed of three main elements: (1) an optical line terminal (OLT), which is located at the central office and acts as a gateway between the access and core networks; (2) optical network units (ONUs), located at the customer side and connected to the home network; and (3) passive splitters and optical fibers connected in a tree topology with the OLT at the root and the ONUs at the leaves. Figure 1 illustrates the PON topology.
EPON uses time division multiplexing (TDM) as medium access control (MAC) for sharing the medium, following a point to multipoint connection model, and delivering data encapsulated in Ethernet packets. In the downstream channel, Ethernet frames are broadcast by the OLT to all the ONUs, while the upstream channel must be arbitrated to avoid collisions when ONUs send frames to the OLT.
The multi-point control protocol (MPCP) arbitrates the access to the upstream channel by exchanging control messages. MPCP uses GATE and REPORT messages to execute the scheduling planned with a dynamic bandwidth allocation (DBA) algorithm. In each cycle, the OLT sends GATE  Power shedding mode: the ONU maintains the transmitter and receiver continuously operational, while the non-essential functions and services in upper layers are powered off.  Doze mode: the ONU powers off its transmitter while keeping the receiver active. This allows the ONU to remain synchronized with the OLT. This mode uses less energy than the shedding mode but introduces delay (and jitter) in the transmission of packets that arrive during the periods in which the transmitter is switched off.  Sleep mode: transmitter and receiver are powered off at the ONU and no energy is consumed in this state. Delays and jitter are introduced in both the downstream and upstream traffic flows. Centralized DBAs are performed exclusively by the OLT, while in distributed DBAs, the ONUs play a role in the scheduling. Interleaved polling with adaptive cycle time (IPACT) [2] is one of the best examples of a centralized DBA. IPACT follows an interleaved polling scheme to schedule the transmissions from the ONUs. Dynamic distributed scheduling for EPON (DDSPON) [3] is an example of a distributed DBA, which extended from the simple algorithm of IPACT by carrying extra information on its control messages.
In recent years, optical networks have rapidly gained popularity in broadband access architectures; hence, the energy consumption of these networks has increased as well. Energy saving becomes even more important as access network technologies evolve into the next generation, with more users and higher data rates. Therefore, many researchers are developing mechanisms to reduce energy consumption in access networks [4].
Energy saving mechanisms in PONs can be applied on the OLT or ONU sides. The ONU-side energy saving challenge has received more attention in the scientific literature due to the high number of ONUs (usually, an OLT serves 32 to 64 or more ONUs), which implies a higher global consumption. Energy saving in the access network can be achieved at both the physical and medium-access control (MAC) layers [5,6]. In the physical layer, the approaches are related to new energy-efficient optical device architectures, while the MAC layer controls energy consumption by disabling the transmission or reception electronics in the OLT and ONUs during certain periods (based on the network traffic patterns and the channel idle time).
The International Telecommunications Union (ITU-T) has tackled the goal of minimizing the energy consumption of PON networks at the MAC layer in Recommendation G.45 [7], where three modes are proposed: • Power shedding mode: the ONU maintains the transmitter and receiver continuously operational, while the non-essential functions and services in upper layers are powered off. • Doze mode: the ONU powers off its transmitter while keeping the receiver active. This allows the ONU to remain synchronized with the OLT. This mode uses less energy than the shedding mode but introduces delay (and jitter) in the transmission of packets that arrive during the periods in which the transmitter is switched off. • Sleep mode: transmitter and receiver are powered off at the ONU and no energy is consumed in this state. Delays and jitter are introduced in both the downstream and upstream traffic flows.
In this work, we propose a novel dynamic energy-saving resource-management mechanism to reduce power consumption in a distributed DBA. The proposed algorithm evaluates the upstream and downstream traffic and decides when ONUs should be put in doze or sleep modes (we discard the power shedding mode, since it does not provide much power saving-the transmitter and the receiver are, by far, the elements that consume the most energy). Our algorithm takes DDSPON as a base, calculating the time slot, request (bandwidth requirement) and queue size of each ONU and its corresponding downstream queue size in the OLT, and we extended the DBA by analyzing the minimum requirement and the queue size of every ONU and OLT in order to choose the listening time windows (so the receiver can be switched off) and computed the doze/sleep modes for each ONU. This was performed by calculating a moving average method for the estimation of the queue sizes to decide when to put ONUs into doze/sleep modes. Our algorithm minimizes the ONU energy consumption across a wide range of network load values while keeping packet delay bounded. To the best of our knowledge, this is the first time an energy saving algorithm was applied to a distributed DBA.
The rest of paper is organized as follows. Section 2 describes the work done in this field by other authors. Section 3 proposes our novel energy-saving algorithm. Section 4 presents the simulation scenario and describes the results obtained from the performance evaluation. Section 5 discusses the results obtained and compares them with other works. Section 6 concludes the paper.

State of the Art
Much research effort has been devoted to enabling sleep mode in ONUs. The main challenges of this approach are the slow transition from active mode to sleep mode and the time needed during the wake-up process (as ONU transceivers and their associated supporting functions need a non-negligible time to power on). In this scenario, energy consumption will be highly dependent on the traffic arrival rate and traffic pattern during a sleep time, which will itself be modified by the additional queuing time (thus increasing the average delay and introducing delay variation-jitter). The definition of the Tx and Rx queue thresholds to trigger the change between the active/doze/sleep modes is a key issue, as an appropriate definition can lead to performance improvements in terms of delay.
A new type of energy-efficient mechanism based on EPON is proposed in [8]. The algorithm is based on the ONU sleep control and on simultaneously balancing the downlink traffic at the OLT and the uplink traffic at the ONUs in order to reduce energy consumption and maintain the quality of service of end users in terms of delay. The OLT distributes the uplink time slot to the ONUs via the standard GATE messages. Each ONU then sends uplink data during its corresponding time slot and so changes its state to sleep during the time slot assigned to other ONUs. In [9], the authors proposed a downstream traffic scheduling at the OLT and a sleep control scheme at the ONUs. The scheme enables ONUs to be aware of the downstream traffic scheduling and state of the queue at the ONU in order to switch into sleep state in the case of zero downstream data traffic for a certain scheduling cycle. Khotimsky, Zhang, Yuan, et al. [10] presented a parametric extension of a DBA for unifying power saving in PON networks. In this scheme, the ONUs periodically switch off their transmitters and receivers based on the cyclic sleep mode and execute bidirectional handshakes in doze mode. Hossienabadi and Ansari [11] moved one step further by eliminating the handshake process in the sleep mode, thus increasing the number of sleep cycles and improving energy efficiency at slower bit rates. The proposal avoids frequent changes in the ONU energy modes by periodically putting the ONU in doze mode. The delay performance worsens linearly when sleep time increases. In [12], the authors proposed a DBA with an energy efficient MAC control scheme to put ONU into: 1) doze mode at the beginning of the polling cycle to receive the GATE message; and 2) sleep mode based on the queued data through a REPORT message when upstream and downstream data transmissions are completed.
A dynamic energy-efficient DBA-based on the use of the sleep mode was presented in [13]. It is applicable to legacy ONUs with large sleep overheads (L-ONUs) and next generation ONUs with small sleep overheads (NG-ONUs). The authors claimed that the scheme can meet strict QoS requirements for L-ONUs, as it can quit sleep mode on the arrival of high-priority traffic. For NG-ONUs, the authors introduced a sleep-period prediction scheme and a minimum sleep time to maintain the bounded delay and reduce frequent mode switching.
Herreria-Alonso, Rodriguez-Perez, Fernandez-Veiga, et al. [14] proposed dynamic sleep schemes to keep an ONU in the sleep mode for one or more than one DBA cycles. The power consumption of the ONU during the transition time is almost the same as the active state. Finally, Valcarenghi, Luca, Maluge, et al. [15] proposed a combination of upstream and downstream schemes that split the DBA cycle into four slots: (1) data, (2) control, (3) sleep, and (4) wake-up. During the data time slot, OLT and ONU transmit downstream and upstream traffic, respectively. During the control slot, OLT and ONU exchange GATE and REPORT messages. During the sleep cycle, the ONU might enter doze or sleep modes for a duration specified by DBA. Finally, the ONU transitions to active mode during the wake-up slot. To obtain optimal energy saving in this framework, long DBA cycle times should be considered (in the range of 7.5 ms to 15 ms), causing an increase in upstream delay.
De Andrade, Gutierrez and Sallent [3] developed dynamic distributed scheduling for EPON (DDSPON), a distributed DBA algorithm. Its main contributions are: (1) distribution of the DBA computation among the ONUs, which can update their bandwidth requests directly without intervention of the OLT; and (2) on-line servicing of bandwidth requests as they arrive at the OLT, thus enabling shorter delays than a centralized scheme (where the OLT must wait for the arrival of the requests from each ONU before deciding the bandwidth allocation for the next cycle). This algorithm enables ONU to be responsible for changing its status, sleep and doze duration calculation. The ONUs architecture are enhanced by adding the sleep and doze controller components. DDSPON also introduces an important novelty: fairness in bandwidth allocation, i.e., this guarantees a certain percentage of the available bandwidth for each ONU by introducing a weight factor. DDSPON extends the simple algorithm of IPACT by adding extra information in the GATE messages. This extra information includes the weight vector that enables ONUs to schedule transmission window sizes. The bandwidth allocation calculation is performed by each active ONU, so the ONUs can proportionally schedule their transmission window sizes by themselves, based on their current queue requirements and those reported by the other ONUs. Thanks to the weight vector, each ONU obtains an overview of the load of the other ONUs and fairness can be ensured. As reported in [16], DDSPON reduces the delay by 20% with respect to the IPACT/centralized DBAs for higher network loads. It also shows a smaller queue size compared to IPACT. DDSPON is reported as a good alternative to centralized DBAs schemes, especially at higher network loads. In addition, it is shown that DDSPON fairly distributes the bandwidth among ONUs when the traffic rates are variable.
Finally, Hwang, Nikoukar, Su, et al [17] and Dutta and Das et al [18] propose two ONU-initiated energy saving mechanisms. The ONU-initiated scheme is a decentralized mechanism in which ONUs are responsible for requesting to enter the Tx/TRx (transmitter-receiver) modes. In [17], the ONU calculates the transmitter sleep duration based on the current state and maximum boundary delay requirements and sends it to the OLT. Then, the OLT decides the type of energy saving mode (doze or sleep) and its duration. The authors also proposed a Sleep manager and a Green DBA and TRx controller to manage the energy saving mechanism. Dutta and Das [18] presented a new protocol that exploits different low power modes and uses traffic prediction. Our proposal can be considered as an OLT-initiated scheme (OLT controls the Tx/TRx energy saving modes), but the difference with other mechanism is that we applied a decentralized DBA.

Introduction
This section presents our energy saving algorithm, including the extended control frames, functionalities, and operational schemes of the OLT and ONUs. Our energy saving mechanism minimizes power consumption by switching the ONUs from active mode to sleep or doze mode. Transitions are decided by the OLT, which maintains the grant information (bandwidth request and allocated transmission time) and calculates the transmission the window size of each ONU. In addition, every ONU calculates its own bandwidth request by monitoring its queue size and the amount of traffic received from the end user. This process is completed via the exchange of control frames (REPORT and GATE messages) between the OLT and ONUs. Based on the information conveyed on the control frames and the size of the queues, the OLT can decide whether to keep the ONU in active mode or switch it to sleep or doze modes. An example of sleep and doze operation of the ONU is shown in Figure 2, where ONU1 and ONU2 are put into doze and sleep mode for the duration specified by the OLT, respectively (see Section 3.2 for more detail). addition, every ONU calculates its own bandwidth request by monitoring its queue size and the amount of traffic received from the end user. This process is completed via the exchange of control frames (REPORT and GATE messages) between the OLT and ONUs. Based on the information conveyed on the control frames and the size of the queues, the OLT can decide whether to keep the ONU in active mode or switch it to sleep or doze modes. An example of sleep and doze operation of the ONU is shown in Figure 2, where ONU1 and ONU2 are put into doze and sleep mode for the duration specified by the OLT, respectively (see Section 3.2 for more detail).
In step A of Figure 2, ONU1 starts to transmit user data and a REPORT message at its scheduled transmission time and then, at step B, ONU1 goes into doze mode for a time specified by OLT, because there are no data to transmit upstream. In the next cycle, at step C, ONU1 wakes up and transmits user data and a REPORT message. In step D, ONU2 goes to sleep mode when there are no upstream and downstream transmissions. In step E, ONU2 sleeps for the duration specified by the OLT for n cycles (sleep cycles depend on the maximum sleep cycle of the ONU and the amount of traffic in both directions). In step F, when the sleep cycle has elapsed, ONU2 wakes up at the end of the sleep cycle in order to receive and transmit user data, as well as GATE and REPORT messages.

A Distributed Energy-aware DBA
We now address an important aspect of our proposed algorithm: the calculation of the sleep and doze duration at the ONUs. For this purpose, it is necessary to divide the procedure into two phases that separate the activities executed in the OLT from other actions performed in the ONUs.
As discussed earlier, the energy saving algorithm monitors the upstream queue of an ONU and the OLT downstream queue for the same ONU. The ONU queue sizes are shared with the OLT in order to calculate the sleep cycle through the predicted value of the queues obtained with a moving average technique. Figure 3 illustrates the upstream and downstream queues of the ONU and the OLT. The doze and sleep cycles will vary depending on the queue sizes at ONU and OLT:  Doze mode: if the upstream queue size in the ONU is smaller than the requested upstream transmission length, the queue will empty and thus, the ONU enters in power-saving mode after transmitting the data and REPORT message. The transmitter of the ONU is turned off for the duration specified by the OLT and the receiver remains on.  Sleep mode: if the queue size in ONU and OLT are both smaller than the requested upstream transmission length and downstream transmission length, respectively, then both queues will In step A of Figure 2, ONU1 starts to transmit user data and a REPORT message at its scheduled transmission time and then, at step B, ONU1 goes into doze mode for a time specified by OLT, because there are no data to transmit upstream. In the next cycle, at step C, ONU1 wakes up and transmits user data and a REPORT message. In step D, ONU2 goes to sleep mode when there are no upstream and downstream transmissions. In step E, ONU2 sleeps for the duration specified by the OLT for n cycles (sleep cycles depend on the maximum sleep cycle of the ONU and the amount of traffic in both directions). In step F, when the sleep cycle has elapsed, ONU2 wakes up at the end of the sleep cycle in order to receive and transmit user data, as well as GATE and REPORT messages.

A Distributed Energy-Aware DBA
We now address an important aspect of our proposed algorithm: the calculation of the sleep and doze duration at the ONUs. For this purpose, it is necessary to divide the procedure into two phases that separate the activities executed in the OLT from other actions performed in the ONUs.
As discussed earlier, the energy saving algorithm monitors the upstream queue of an ONU and the OLT downstream queue for the same ONU. The ONU queue sizes are shared with the OLT in order to calculate the sleep cycle through the predicted value of the queues obtained with a moving average technique. Figure 3 illustrates the upstream and downstream queues of the ONU and the OLT. The doze and sleep cycles will vary depending on the queue sizes at ONU and OLT: • Doze mode: if the upstream queue size in the ONU is smaller than the requested upstream transmission length, the queue will empty and thus, the ONU enters in power-saving mode after transmitting the data and REPORT message. The transmitter of the ONU is turned off for the duration specified by the OLT and the receiver remains on.
• Sleep mode: if the queue size in ONU and OLT are both smaller than the requested upstream transmission length and downstream transmission length, respectively, then both queues will empty and thus, the ONU enters sleep mode (power-saving mode). Both the receiver and the transmitter of the ONU are turned off for the duration specified by the OLT.
Sustainability 2020, 12, 2264 6 of 20 empty and thus, the ONU enters sleep mode (power-saving mode). Both the receiver and the transmitter of the ONU are turned off for the duration specified by the OLT. If both the upstream and downstream queues are larger than the requested upstream transmission length and downstream transmission length at the ONU and OLT, respectively, the ONU will have to remain completely active and cannot enter power-saving mode.
The first phase of the algorithm defines the actions to be executed in the OLT. Figure 4 shows the flow chart of the DBA algorithm performed at the OLT. On reception of the REPORT message from ONUi, the OLT analyzes the information in the REPORT message. The information includes: ONUi weight Φi (n), request Ri (n) and the current size of the queue QUPi (n). The OLT then computes: 1) the moving average of the ONU's queue size Qm−UPi (n) to predict the state of the queue in the next cycle; 2) the moving average of the request Rmi (n); 3) the moving average of the OLT's queue size Qm−DSi (n) for ONUi to predict the state of the queue; and 4) the moving average of the downstream transmission length DTmi (n) for ONUi. The moving average of the upstream and downstream queue size in the ONU and OLT at time n are calculated as follows: where α is the weight of the moving average; Qm−UPi (n-1) is the last value of the moving average of the upstream queue size; QUPi (n) is the current state of the upstream queue (instantaneous queue size) of ONUi; Qm−DSi (n-1) is the last value of the moving average of the downstream queue; and QDSi (n) the current state value of the downstream queue of the OLT. Finally, the moving average of the request and downstream transmission length at time n are calculated as follows: where Rmi (n-1) and Ri (n) are the moving average of the request series and the current value of the request of ONUi, respectively, and DTmi (n-1) and DTi (n) are the moving average of the downstream transmission length at time (n-1) and the current value of downstream transmission length sent by the OLT, respectively. Note that the traffic sent in the downstream and upstream channels is independent.
The OLT then compares the predicted value of the upstream queue (the moving average of the queue) of the ONU with the request received from the same ONU. If the predicted ONU queue size is larger than the request, the power saving for the next cycle will be zero (ONU remains active) because there will still be some packets in the queue to be sent to the OLT. The DBA then computes the next start time and length (slot allocation) for the ONU and updates the weight vector for the next collection cycle. The OLT then compares the moving average of the downstream queue size of the If both the upstream and downstream queues are larger than the requested upstream transmission length and downstream transmission length at the ONU and OLT, respectively, the ONU will have to remain completely active and cannot enter power-saving mode.
The first phase of the algorithm defines the actions to be executed in the OLT. Figure 4 shows the flow chart of the DBA algorithm performed at the OLT. On reception of the REPORT message from ONU i , the OLT analyzes the information in the REPORT message. The information includes: ONU i weight Φ i (n), request R i (n) and the current size of the queue Q UPi (n). The OLT then computes: 1) the moving average of the ONU's queue size Q m−UPi (n) to predict the state of the queue in the next cycle; 2) the moving average of the request R mi (n); 3) the moving average of the OLT's queue size Q m−DSi (n) for ONU i to predict the state of the queue; and 4) the moving average of the downstream transmission length DT mi (n) for ONU i . The moving average of the upstream and downstream queue size in the ONU and OLT at time n are calculated as follows: where α is the weight of the moving average; Q m−UPi (n − 1) is the last value of the moving average of the upstream queue size; Q UPi (n) is the current state of the upstream queue (instantaneous queue size) of ONU i ; Q m−DSi (n − 1) is the last value of the moving average of the downstream queue; and Q DSi (n) the current state value of the downstream queue of the OLT. Finally, the moving average of the request and downstream transmission length at time n are calculated as follows: where R mi (n − 1) and R i (n) are the moving average of the request series and the current value of the request of ONU i , respectively, and DT mi (n − 1) and DT i (n) are the moving average of the downstream transmission length at time (n-1) and the current value of downstream transmission length sent by the OLT, respectively. Note that the traffic sent in the downstream and upstream channels is independent.
Sustainability 2020, 12, 2264 7 of 20 5) to maximize the sleep cycle. Otherwise, the value of DUP and DDS will vary in the interval [0, 1] and will be calculated based on the queue length to adjust the sleep cycle. The sleep cycle may vary from 0 (no power saving) to Tmax−sc, the maximum sleep cycle, whose value is determined by the physical layer in order to maintain the link synchronized, with a maximum value of 50 ms set by the ITU-T standard (2 ms ≤ Tmax−sc ≤ 50 ms). For larger values of Tmax−sc, ONUs can stay in sleep mode for longer periods and therefore increase energy saving. Tmax is the maximum cycle time, i.e., the maximum period that an ONU can transmit its traffic through the upstream channel.

Calculate the ONU s and OLT s moving average of queues (Qm-UPi (n)), and (Qm-DSi (n)), and request (Rmi(n)) and Downstream transmisssion (DTm(n))
Compares the Qm-UPi (n) with Rmi (n) and Qm-DSi (n) with DTmi (n) The OLT then compares the predicted value of the upstream queue (the moving average of the queue) of the ONU with the request received from the same ONU. If the predicted ONU queue size is larger than the request, the power saving for the next cycle will be zero (ONU remains active) because there will still be some packets in the queue to be sent to the OLT. The DBA then computes the next start time and length (slot allocation) for the ONU and updates the weight vector for the next collection cycle. The OLT then compares the moving average of the downstream queue size of the OLT with the downstream transmission length of the same queue. The OLT performs the same process as described above and if the queue size is larger than the downstream transmission length, the ONU cannot enter in sleep mode, and thus both the transmitter and receiver of the ONU must remain active. If the ONU queue size is smaller than the request and the queue size of the OLT is smaller than the downstream transmission length, then the ONU can enter doze or sleep mode. Depending on the queue sizes, the OLT will put the ONU into sleep or doze mode. For the zero (empty) queue size, the OLT calculates T-low-power (the time we can stay in one of the low power modes) for upstream and downstream as follows:

Yes
where the factor D UP is defined as the ratio between the moving average of the queue size and the moving average of the request, and D DS is the ratio between the moving average of the queue size and the moving average of the downstream transmission length (see Equation 6). By definition 0 < D UP , D DS ≤ 1, and these two factors can be used to adjust the sleep cycle between the minimum and maximum sleep cycle values. If the queue is empty, the value of D UP and D DS will be set to 1 (Equation 5) to maximize the sleep cycle. Otherwise, the value of D UP and D DS will vary in the interval [0, 1] and will be calculated based on the queue length to adjust the sleep cycle. The sleep cycle may vary from 0 (no power saving) to T max−sc , the maximum sleep cycle, whose value is determined by the physical layer in order to maintain the link synchronized, with a maximum value of 50 ms set by the ITU-T standard (2 ms ≤ T max−sc ≤ 50 ms). For larger values of T max−sc , ONUs can stay in sleep mode for longer periods and therefore increase energy saving. T max is the maximum cycle time, i.e., the maximum period that an ONU can transmit its traffic through the upstream channel. Likewise, for queue sizes larger than zero, the value of factors D UP and D DS are computed based on the moving average of the queue size of the ONU and its instantaneous request, and the moving average of the queue size of the OLT and its instantaneous downstream transmission length (see Equation 6). For each ONU i , we can then evaluate the power saving by computing T-low-power UP and T-low-power DS based on D UP and D DS and T max−sc (Equations (7) and (8)).
In the case of power saving, by comparing the ONU and OLT queues, the OLT should select the minimum value of T-low-power UP/DS and assign the minimum sleep time to put the ONU in doze or sleep mode. T The algorithm is designed to choose the minimum value of both cycles for a specific ONU. Although this can waste energy that could potentially be saved, it also minimizes the impact on network delay. Therefore, the minimum value is selected to ensure a good trade-off between energy and delay even when the sleep cycle in doze mode is longer than the sleep mode.
As a final step for the first phase, once the T-low-power for upstream and downstream is calculated, the OLT creates a GATE message with the required information and sends it to the ONU.
The second phase of the algorithm is related to the actions that must be executed in the ONUs. Figure 5 shows the flow chart of the DBA algorithm executed at the ONUs. In each cycle, the ONU extracts the information from the GATE message fields and monitors the accumulated traffic in the queue. The GATE information includes transmission start time, granted period of transmission, weight vector, sleep and doze start time, and sleep and doze duration.
The weight is calculated from the vector ( → Φ) that is carried by the GATE messages (i.e., Φ 1 , Φ 2 , Φ 3 . . . Φ N where N is the number of ONU's) [3]. With the weight vector, each ONU knows the current state of the bandwidth assignment and thus each ONU can calculate its own required transmission window size for the next transmission cycle. Such a parameter is a proportional weight, set up according to the guaranteed bandwidth for each ONU. The maximum transmission window size for the next cycle is calculated as follows: where W i (n + 1) is the transmission window size for the next allocation cycle of ONU i , Φ i conf is the initial weight value for ONU i , Φ j (n) is the remaining weight value in cycle n of the remaining ONUs, and W max is the maximum transmission window size of all ONUs.
In the next step, ONU i calculates the next requested transmission size R i (n + 1) by comparing the next transmission window size with the current queue size of the ONU i , and choosing the minimum Sustainability 2020, 12, 2264 9 of 20 value between both values. The advantage of this approach is that the ONU can allocate the right time slot size and avoid over-granting.
The new weight Φ i (n + 1) of ONU i for updating the weight vector for the next cycle is then computed as follows: Finally, the ONU analyzes the sleep start time and doze start time of the GATE message to check if there is a non-zero value assigned to these fields. If a non-zero value is found in any of the fields, the ONU enters into sleep or doze mode for a duration specified in the sleep duration or doze duration fields and awakes at the end of that period.
In the case of power saving, by comparing the ONU and OLT queues, the OLT should select the minimum value of T-low-powerUP/DS and assign the minimum sleep time to put the ONU in doze or sleep mode.
The algorithm is designed to choose the minimum value of both cycles for a specific ONU. Although this can waste energy that could potentially be saved, it also minimizes the impact on network delay. Therefore, the minimum value is selected to ensure a good trade-off between energy and delay even when the sleep cycle in doze mode is longer than the sleep mode.
As a final step for the first phase, once the T-low-power for upstream and downstream is calculated, the OLT creates a GATE message with the required information and sends it to the ONU.
The second phase of the algorithm is related to the actions that must be executed in the ONUs. Figure 5 shows the flow chart of the DBA algorithm executed at the ONUs. In each cycle, the ONU extracts the information from the GATE message fields and monitors the accumulated traffic in the queue. The GATE information includes transmission start time, granted period of transmission, weight vector, sleep and doze start time, and sleep and doze duration. The REPORT message generated by the ONU i includes (1) the next requested transmission size R i (n + 1); (2) the new weight for the next cycle Φ i (n + 1); and (3) its instantaneous queue size (current state of the queue) Q i (n).
The scheduling process was executed without the need to wait until all the reports arrive from the ONUs to the OLT, as is the case with on-line DBAs. In addition, by collecting the weight vector, each ONU is able to obtain a global view of the state of the load of other ONUs.
To perform the doze or sleep mode in the ONUs, we propose that for each ONU i Algorithm 1 is implemented in the OLT, which summarizes the description above.

Extension of the MPCP Control Frames
Our algorithm requires an extension of the MPCP control frames, because some extra information must be carried. Apart from the weight vector ( Φ ⃗⃗⃗ ) introduced by the DDSPON algorithm, we add extra information for the current state of the queue (instantaneous queue size) Qi (n) = QUP i (n) in the REPORT message, in order to enable each ONU to calculate its own weight based on the traffic received from the users and the traffic in the queue. This additional information must be sent to the OLT, so it can compute the next ONU sleep or doze time and evaluate the amount of energy that can be saved. Figure 6 shows the extension of the REPORT message in the DDSPON algorithm for the energy saving mechanism. It is also necessary to extend the GATE messages with four extra fields carrying the sleep start and doze start times, and sleep duration and doze duration, as shown in Figure 7. Sleep and doze

Extension of the MPCP Control Frames
Our algorithm requires an extension of the MPCP control frames, because some extra information must be carried. Apart from the weight vector ( → Φ) introduced by the DDSPON algorithm, we add extra information for the current state of the queue (instantaneous queue size) Q i (n) = Q UP i (n) in the REPORT message, in order to enable each ONU to calculate its own weight based on the traffic received from the users and the traffic in the queue. This additional information must be sent to the OLT, so it can compute the next ONU sleep or doze time and evaluate the amount of energy that can be saved. Figure 6 shows the extension of the REPORT message in the DDSPON algorithm for the energy saving mechanism.

Extension of the MPCP Control Frames
Our algorithm requires an extension of the MPCP control frames, because some extra information must be carried. Apart from the weight vector ( Φ ⃗⃗⃗ ) introduced by the DDSPON algorithm, we add extra information for the current state of the queue (instantaneous queue size) Qi (n) = QUP i (n) in the REPORT message, in order to enable each ONU to calculate its own weight based on the traffic received from the users and the traffic in the queue. This additional information must be sent to the OLT, so it can compute the next ONU sleep or doze time and evaluate the amount of energy that can be saved. Figure 6 shows the extension of the REPORT message in the DDSPON algorithm for the energy saving mechanism. It is also necessary to extend the GATE messages with four extra fields carrying the sleep start and doze start times, and sleep duration and doze duration, as shown in Figure 7. Sleep and doze start times tell ONUs when to power off the receiver and transmitter (sleep mode) or only the transmitter (doze mode), respectively. Sleep and doze durations specify the period that the receiver It is also necessary to extend the GATE messages with four extra fields carrying the sleep start and doze start times, and sleep duration and doze duration, as shown in Figure 7. Sleep and doze start times tell ONUs when to power off the receiver and transmitter (sleep mode) or only the transmitter (doze mode), respectively. Sleep and doze durations specify the period that the receiver and transmitter (in sleep mode), or only the transmitter (in doze mode), must be switched off-and when to awaken the ONU when the sleep or doze cycle elapses. The GATE message also includes the weight vector (for the next cycle), start time, and timeslot allocation. The start time indicates the data transmission start time, and timeslot allocation indicates the duration of the data transmission.

Power Saving State Diagram at ONUs
The power saving state diagram in Figure 8 shows the transitions of the ONU state between sleep and active modes. The state diagram is composed of four states: 1. All-awake is an active mode, in which the transmitter and receiver of an ONU remain on (TRx-ON). This is a state of normal operation, without power saving. 2. All-sleep is a sleep mode, in which the transmitter and receiver of an ONU are turned off (TRx-OFF). 3. Transmitter-sleep is a doze mode, in which the transmitter of an ONU is turned off (Tx-OFF), and the receiver remains on. 4. Receiver-sleep, in which the receiver of an ONU is turned off (Rx-OFF) and the transmitter remains on. Figure 8 presents the operation of each power-saving function by describing which ONU element, transmitter (Tx) and receiver (Rx), can be switched off. Let us suppose that the ONU is in the doze mode, so we can describe an example of the transitions from this state:  The transition from transmitter-sleep to other states is triggered by the arrival of the GATE message to the ONU through the downstream channel, when the Rx is on and Tx is off. Thus, the ONU can receive control and data frames from the OLT, but it cannot transmit any frames in the upstream channel. The state will be changed depending the values of T-low-powerUP and T-low-powerDS.

 The ONU transmitter and receiver can be put into sleep mode for any values of T-low-powerUP
and T-low-powerDS and will wake when the values of the T-low-powerUP and T-low-powerDS = 0.
The ONU goes to all-sleep state if T-low-powerUP and T-low-powerDS are greater than zero and both are greater than Tmax.  The transition from transmitter-sleep to receiver-sleep will be changed when T-low-powerUP = 0 and T-low-powerDS > 0 and T-low-powerDS > Tmax. In this state, the receiver will be OFF, because there are no data to transmit in the downstream channel.  Finally, both transmitter and receiver of the ONU are awake (Tx and Rx are active) when the value of T-low-powerUP and T-low-powerDS is less than Tmax and the local time of the ONU is equal to the transmission start time (start-time, Tst). In this state, the ONU receives and transmits control and data frames.

Power Saving State Diagram at ONUs
The power saving state diagram in Figure 8 shows the transitions of the ONU state between sleep and active modes. The state diagram is composed of four states:

1.
All-awake is an active mode, in which the transmitter and receiver of an ONU remain on (TRx-ON). This is a state of normal operation, without power saving.

2.
All-sleep is a sleep mode, in which the transmitter and receiver of an ONU are turned off (TRx-OFF).

3.
Transmitter-sleep is a doze mode, in which the transmitter of an ONU is turned off (Tx-OFF), and the receiver remains on. 4.
Receiver-sleep, in which the receiver of an ONU is turned off (Rx-OFF) and the transmitter remains on. Figure 8 presents the operation of each power-saving function by describing which ONU element, transmitter (Tx) and receiver (Rx), can be switched off. Let us suppose that the ONU is in the doze mode, so we can describe an example of the transitions from this state:

•
The transition from transmitter-sleep to other states is triggered by the arrival of the GATE message to the ONU through the downstream channel, when the Rx is on and Tx is off. Thus, the ONU can receive control and data frames from the OLT, but it cannot transmit any frames in the upstream channel. The state will be changed depending the values of T-low-power UP and T-low-power DS .

•
The ONU transmitter and receiver can be put into sleep mode for any values of T-low-power UP and T-low-power DS and will wake when the values of the T-low-power UP and T-low-power DS = 0.
The ONU goes to all-sleep state if T-low-power UP and T-low-power DS are greater than zero and both are greater than T max .

•
The transition from transmitter-sleep to receiver-sleep will be changed when T-low-power UP = 0 and T-low-power DS > 0 and T-low-power DS > T max . In this state, the receiver will be OFF, because there are no data to transmit in the downstream channel. • Finally, both transmitter and receiver of the ONU are awake (Tx and Rx are active) when the value of T-low-power UP and T-low-power DS is less than T max and the local time of the ONU is equal to the transmission start time (start-time, T st ). In this state, the ONU receives and transmits control and data frames.

Description of the Validation Scenario
In this section, we evaluate the performance of the proposed power saving algorithm over DDSPON in comparison with the plain DDSPON version in terms of power consumption and average packet delay. To evaluate the proposed algorithm, we ran extensive simulations with OPNET Modeler. The goal is to show that our scheme can reduce the power consumption of the PON network while guaranteeing the QoS requirement of real-time services. Following [19], our criterion was to set a maximum delay in the access network bounded to 10 ms (between ONUs and OLT).
The power consumption of an ONU in active mode is 5.052 watts; 3.85 watts in doze mode; and 0.75 watt in sleep mode-following the values used in [12] and [20]. Two scenarios are considered: in the first, sources generate a constant traffic and the packet length is 1518 bytes; while in the second scenario, the traffic is self-similar [21] with a Hurst parameter of H = 0.7 and packet sizes are uniformly distributed from 64 to 1518 bytes. We assume that the capacity of the queue in each ONU and OLT is infinite. Table 1 lists the network and protocol parameters used in our simulations.
The initial weight value for each ONU is set as Φi conf = 1/N = 1/16, i.e., the bandwidth is initially shared equally among ONUs. Note that during the operation of DDSPON, when an ONU is inactive (no packets to send) or in a sleep mode, its bandwidth allocation is shared among the active ONUs.
The simulations were performed with asymmetric loads in the upstream and downstream channel. Each ONU sends 54 Mbits/s of upstream traffic and receives downstream traffic of 50 Mbits/s. Upstream and downstream sources are independent. All the graphs show the average values and 95% confidence intervals.

Description of the Validation Scenario
In this section, we evaluate the performance of the proposed power saving algorithm over DDSPON in comparison with the plain DDSPON version in terms of power consumption and average packet delay. To evaluate the proposed algorithm, we ran extensive simulations with OPNET Modeler. The goal is to show that our scheme can reduce the power consumption of the PON network while guaranteeing the QoS requirement of real-time services. Following [19], our criterion was to set a maximum delay in the access network bounded to 10 ms (between ONUs and OLT).
The power consumption of an ONU in active mode is 5.052 watts; 3.85 watts in doze mode; and 0.75 watt in sleep mode-following the values used in [12] and [20]. Two scenarios are considered: in the first, sources generate a constant traffic and the packet length is 1518 bytes; while in the second scenario, the traffic is self-similar [21] with a Hurst parameter of H = 0.7 and packet sizes are uniformly distributed from 64 to 1518 bytes. We assume that the capacity of the queue in each ONU and OLT is infinite. Table 1 lists the network and protocol parameters used in our simulations. The initial weight value for each ONU is set as Φ i conf = 1/N = 1/16, i.e., the bandwidth is initially shared equally among ONUs. Note that during the operation of DDSPON, when an ONU is inactive (no packets to send) or in a sleep mode, its bandwidth allocation is shared among the active ONUs. The simulations were performed with asymmetric loads in the upstream and downstream channel. Each ONU sends 54 Mbits/s of upstream traffic and receives downstream traffic of 50 Mbits/s. Upstream and downstream sources are independent. All the graphs show the average values and 95% confidence intervals.
The evaluation compares the total energy consumed by the power-saving algorithm and the energy consumed by the plain DDSPON during the simulation. The energy consumed by an ONU, E ONU−PSi , is calculated as the sum of the energy consumption in each of the states, during each cycle (energy consumption in active, doze, and sleep mode).
where P i−doze , P i−sleep , and P i−active represent the power consumption of an ONU i in doze, sleep, and active modes, respectively. Variables T i−active , T i−doze and T i−sleep represent the time spent by ONU i in each state. The synchronization time for changing from sleep mode to active mode is 0.125 ms and for changing from doze mode to active mode it is 760 ns, as assumed in [12]. Parameter n is the total number of cycles that an ONU can handle during the simulation. The percentage of energy saving η is calculated as follows: where E ONU−PSi is the energy consumed by the power saving mechanism, and E ONU−NPSi is the energy consumed by the non-power-saving scenario (i.e., the energy consumed when the active mode is used 100% of the time).

Tuning of the Moving Average Parameter
We first analyzed the influence of the weight α of the moving average used in several estimations (the instantaneous queue size Q m−UPi (n) of ONU i and its request R mi (n), and the instantaneous queue size Q m−DSi (n) of the OLT and its downstream transmission length DT mi (n)). To find an optimum value of α for the power saving algorithm, we vary the value of the weight and run different numbers of simulations under different weight values (α = 0.3, 0.6, and 0.9) for both upstream and downstream scheduling. In this set of simulations, we assumed that the traffic input in the upstream direction from each ONU was set to 54 Mbps and 50 Mbps from OLT (the highest traffic for the OLT is chosen to evaluate the network in the worst case in term of delay). Constant traffic (CBR) is selected as input traffic source and the sleep cycle is set to 10 ms.
The comparison between both the moving average of the instantaneous queue and the request of the ONUs in the upstream direction and the moving average of the instantaneous queue and downstream transmission length of the OLT in the downstream direction shows that for a higher weight value of the moving average (α = 0.9) our proposal performs better than the lower weight value (α = 0.3) in terms of power saving and delay. Higher weight shows a shorter queue, and packets consequently experience less delay. In addition, by comparing Q m−UPi (n) with R mi (n), and Q m−DSi (n) with DT mi (n), we observe that there are more matching points (representing the occurrence of sleep cycle in the power saving algorithm) between Q m−UP and R m , and Q m−DS and DT m , respectively, for α = 0.9 than for 0.6 or 0.3. As discussed earlier, when Q m−UP i (n) ≤ R mi (n)/Q m−DS i (n) ≤ DT mi (n) we can save power. Therefore, α = 0.9 performs better than the other two α values in terms of power saving and delay (further results and analysis is available in [22]) and this is the value used in the following experiments.

Evaluation of Power Saving with CBR Traffic
We now show the simulation results for Scenario 1, where the sources generate constant traffic (CBR). Figure 9 shows the average power consumption and packet delay for the sleep cycle (sleep and doze mode) of the ONU compared to the active mode of the same ONU (an ONU with Tx and Rx always ON) in function of the sleep cycle and for an offered load of 50 Mbps in the downstream direction. value (α = 0.3) in terms of power saving and delay. Higher weight shows a shorter queue, and packets consequently experience less delay. In addition, by comparing Qm−UPi (n) with Rmi (n), and Qm−DSi (n) with DTmi (n), we observe that there are more matching points (representing the occurrence of sleep cycle in the power saving algorithm) between Qm−UP and Rm, and Qm−DS and DTm, respectively, for α = 0.9 than for 0.6 or 0.3. As discussed earlier, when − ( ) ≤ ( )/ − ( ) ≤ ( ) we can save power. Therefore, α = 0.9 performs better than the other two α values in terms of power saving and delay (further results and analysis is available in [22]) and this is the value used in the following experiments.

Evaluation of Power Saving with CBR Traffic
We now show the simulation results for Scenario 1, where the sources generate constant traffic (CBR). Figure 9 shows the average power consumption and packet delay for the sleep cycle (sleep and doze mode) of the ONU compared to the active mode of the same ONU (an ONU with Tx and Rx always ON) in function of the sleep cycle and for an offered load of 50 Mbps in the downstream direction.  Figure 10 illustrates the cumulative distribution of delay and energy consumption in upstream and downstream directions for both power saving and non-power saving scenarios in order to find the optimal value of the sleep cycle for the power-saving scenario algorithm. Based on the obtained results from energy consumption and packet delay in upstream and downstream directions, we consider a sleep cycle of 5 ms as an optimal value, following the criterion of ensuring that 100% of packets suffer a delay below 10 ms to satisfy the QoS requirements [19].  Figure 10 illustrates the cumulative distribution of delay and energy consumption in upstream and downstream directions for both power saving and non-power saving scenarios in order to find the optimal value of the sleep cycle for the power-saving scenario algorithm. Based on the obtained results from energy consumption and packet delay in upstream and downstream directions, we consider a sleep cycle of 5 ms as an optimal value, following the criterion of ensuring that 100% of packets suffer a delay below 10 ms to satisfy the QoS requirements [19].  Table 2 illustrates the percentage of energy saving ηCBR for both the power saving and non-power saving (case of sleep cycle = 0) mechanisms as a function of the maximum sleep cycle, where the downstream load is 50 Mbps and the upstream load is 54 Mbps. The most outstanding result in terms of power saving is obtained with a sleep cycle of 50 ms, but as we discussed in the CDF results, a sleep cycle of 5 ms was selected to fulfill the QoS requirements.   Table 2 illustrates the percentage of energy saving η CBR for both the power saving and non-power saving (case of sleep cycle = 0) mechanisms as a function of the maximum sleep cycle, where the downstream load is 50 Mbps and the upstream load is 54 Mbps. The most outstanding result in terms of power saving is obtained with a sleep cycle of 50 ms, but as we discussed in the CDF results, a sleep cycle of 5 ms was selected to fulfill the QoS requirements.

Evaluation with Self-Similar Traffic
We now show the simulation results with self-similar sources. As shown in Figure 11, similarly to the CBR scenario, the average energy consumption with self-similar traffic decreases by increasing the sleep cycle time, while the average packet delay increases. Compared to the non-power saving situation, the energy consumption was reduced by half for the sleep cycle of 2 ms and by 80% for the sleep cycle of 3 ms to 50 ms. The energy consumption reduced from 1.97 to 0.78 watts x second with an average packet delay between 2.9 ms and 55 ms. The self-similar traffic scenario shows slightly better power saving results for different sleep cycles and less packet delay compared to the CBR traffic results. We now show the simulation results with self-similar sources. As shown in Figure 11, similarly to the CBR scenario, the average energy consumption with self-similar traffic decreases by increasing the sleep cycle time, while the average packet delay increases. Compared to the non-power saving situation, the energy consumption was reduced by half for the sleep cycle of 2 ms and by 80% for the sleep cycle of 3 ms to 50 ms. The energy consumption reduced from 1.97 to 0.78 watts x second with an average packet delay between 2.9 ms and 55 ms. The self-similar traffic scenario shows slightly better power saving results for different sleep cycles and less packet delay compared to the CBR traffic results. To find an optimum value of the sleep cycle in the proposed algorithm, the cumulative distribution delay in upstream and downstream directions, and energy consumption for both power saving and non-power saving scenarios are shown in Figure 12. The optimal sleep cycle (in terms of ensuring a network access delay below 10 ms) with a self-similar traffic source was again 5 ms. For sleep cycle values of more than 5 ms, the worst packet delay increases dramatically over 20 ms, violating the QoS criterion. To find an optimum value of the sleep cycle in the proposed algorithm, the cumulative distribution delay in upstream and downstream directions, and energy consumption for both power saving and non-power saving scenarios are shown in Figure 12. The optimal sleep cycle (in terms of ensuring a network access delay below 10 ms) with a self-similar traffic source was again 5 ms. For sleep cycle values of more than 5 ms, the worst packet delay increases dramatically over 20 ms, violating the QoS criterion.  Table 3 illustrates ηSelf−similar, the percentage of energy saving with self-similar traffic, as a function of the maximum sleep cycle. The power saving mechanism shows more than 50% energy saving when the sleep cycle is 2 ms and around 80% for sleep cycles from 3 to 50 ms.   Table 3 illustrates η Self−similar , the percentage of energy saving with self-similar traffic, as a function of the maximum sleep cycle. The power saving mechanism shows more than 50% energy saving when the sleep cycle is 2 ms and around 80% for sleep cycles from 3 to 50 ms. Table 3. Percentage of energy saving (η self−similar ) for both power-saving and non-power saving scenarios as a function of the maximum sleep cycle-self-similar source.

Discussion
The performance of the system in both scenarios (CBR and self-similar) shows a similar behaviour in terms of power saving and delay. The maximum percentage of power savings achieved with CBR traffic for a sleep cycle is 78.97%, whereas for self-similar traffic, it is 80.49%. The reason for this difference is probably the packet size distribution: the packet size of the CBR source is 1518 bytes (the maximum size of Ethernet frames) while the self-similar generates frames with between 64 to 1518 bytes, which reduces queue size and packet transmission delay at both OLT and ONUs.
In comparison with other proposals for power saving algorithms ( [9][10][11]14,15,20] and [23]), our algorithm achieved a good trade-off between energy and delay. The power savings achieved in [9][10][11]14,15] and [20] are less than 70% and in [23] it is 84.7%, while [9][10][11]14,15] and [20] show less power savings with acceptable packet delay (mainly with network loads of 80% and above, where packet delay increases from under 10 ms to 100 ms), and Wong, Mueller, Dias, et al. [23] presented work that is similar to ours in the sense of power saving. Although their energy saving shows more power saving than our proposed algorithm at the price of more delay, it did not satisfy our QoS condition (delay limited to 10 ms in the access network).
However, our distributed DBA algorithm meets the end-to-end QoS criteria and improves power saving in the entire system, but there is a room for improvement of the algorithm to reduce delay in exchange of power saving and enhance it in the sleep cycles more than 3 ms up to 90%.
We can conclude that our distributed DBA algorithm was able to maintain a good trade-off between networks load, packet delay and queue size, especially at higher network loads, and it is comparable or better than previous proposals.

Conclusions
We presented a novel energy saving DBA algorithm to improve energy efficiency in EPON networks. Our proposal is based on the DDSPON distributed DBA, which is enhanced by incorporating doze and sleep modes to reduce the energy consumption by the ONUs.
In our study, the ONUs were switched to doze and sleep mode when T-low-power UP or T-low-power DS , or both, were greater than the maximum transmission time (T max ). This happens by comparing the queue size and the requested transmission length of the ONU with the queue size and downstream transmission traffic of the OLT. Doze and sleep modes ensure energy saving for both low-and high-load cases. Both modes increase the delay, but our results demonstrate that the average delay values can remain below 10 ms in both upstream and downstream direction, which is within an acceptable range to support the QoS requirements for the access networks. The GATE message is extended to signal the doze/sleep mode and the time that the ONUs must wake to transmit the data, while the REPORT message is extended to transport the status of the queue and ONU requests.
Our simulation-based results indicate that the proposed power saving algorithm outperforms the plain DDSPON algorithm and other proposals found in the literature in terms of energy saving. Energy efficiency in doze and sleep mode is improved by more than 78% on average for each ONU with respect to DDSPON, which is comparable to or better than other proposals. We can conclude that our algorithm finds a good trade-off between energy saving and delay. To the best of our knowledge, this is the first work that combined a distributed DBA with an energy saving algorithm.
Our current work focuses on refining the algorithm, testing it in more complex traffic conditions, and adding it to an SDN-based management plane such as the one developed in [24,25], together with the one proposed in [26], in order to obtain an integrated SDN control plane for PON networks in scenarios such as 5G backhaul.
Author Contributions: H.K. was the main contributor of the algorithm and created the first draft of the manuscript. D.R., S.S. and J.R.P. refined the algorithm, contributed to and edited the manuscript. All authors have read and agreed to the published version of the manuscript.