## 3 MG-Based BTS Operation
### Processing and Energy Management Systems
#### 3.4.2 Energy Management System
Thus, an appropriate discharge current can be selected considering the characteristics indicated by the manufacturer. The remaining loads in the BTS are fed from the grid and the PV system. * State 4 or Island State: in this state, the BTS works in island mode without drawing power from the grid. This state is used when the production of PV system is sufficient to power the whole BTS, supported by the discharge of the battery within the appropriate discharge range. * State 5 or Cloud State: this state is used to avoid unnecessary changes of state produced by the drop of PV power occasionally caused by a cloud, while protecting the BESS by keeping it within proper discharge ranges. If the PV power falls abruptly and the BTS is working in State 4 or Island State, the non-critical loads are disconnected, and the average PV production of the last few minutes is continuously checked. If this average PV power generation continues to decrease in the following minutes and the PV production does not recover, the system returns to a grid-supported state. Once the operational states have been introduced, the proposed finite state machine (FSM) representing the behavior of this EMS is described. Three levels of priority are established, in the state transition:  
1. Very High Priority: In the event of a grid outage, the state is immediately changed from any state to State 0 or Back-up State. When the outage is over, the FSM enters State 1 or Transition State. 2. High Priority: If there is a change from the off-peak tariff period to the peak tariff period or vice versa, there is a transition from any state to State 1 or Transition State. 3. Normal Priority: Common EMS operation with grid available and operating within one of the working periods. The transitions in this mode are described in the following table. To gain an insight into the proposed EMS, a state diagram flowchart describing the operation of the FSM in Normal Priority is shown in Figure 12. To reduce the clutter, the Very High Priority and High Priority transitions are not depicted because they follow basic rules. The green color shows the states that are used in both PT period and OT period, whereas the orange color shows the states that are used only in PT periods. Finally, the yellow color shows the back-up state that is used whenever there is a grid outage. Once the different transitions have been described, it is possible to analyze the BTS operation modes with the implemented strategy. When a Very High Priority event occurs, i.e., the grid outage, the system automatically enters the Back-up State. In this state, the non-critical loads are disconnected, and the entire \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{**State**} & \multicolumn{3}{c}{**Switch**} & \multirow{2}{*}{**Non-Critical**} & \multicolumn{2}{c}{**Transition (Normal Priority)**} \\ \cline{2-4}  & **1** & **2** & **3** & **Loads** & **Condition** & **State** \\ \hline
2 & OFF & ON & ON & ON & & \\ \hline
3 & ON & OFF & ON & ON & \(\textit{PV}>TH_{PV}^{+}\ ||\ SOC<SOC_{min}\) & 1 \\ \hline
4 & ON & ON & OFF & ON & \(\textit{SOC}<SOC_{min}\) & 1 \\ \cline{5-5}  & & & & & \(\textit{PV}<TH_{PV}^{-}\) & 5 \\ \hline
5 & ON & ON & OFF & OFF & \(\textit{PV}>TH_{PV}\) & 4 \\ \cline{5-5}  & & & & \(\overline{\textit{PV}>TH_{PV}}\) & \(\textit{|SOC}<SOC_{min}\) & 1 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Finite state machine transitions in normal priority. Figure 12: EMS State Diagram showing all states and all Normal Priority transitions. system is powered by the BESS and, if available, by the PV power. This state is maintained until the grid is operative again. The next condition to be checked is the High Priority event, which occurs twice a day: once when shifting from the PT period to the OT period and the other when changing from the OT period to the PT period. In this case, the EMS operating mode changes completely, as described below in the normal priority operate mode.