## 5 Hierarchical Control Development
### Energy Management System Design
A place can represent as one of the following options: a tandem boost PV array and boost PEC (\(APV1M\)-\(APV4M\)), a DC-DC full bridge PEC and the electronic load (\(EC\)) or six LED luminaries (\(LED\)), ESSs battery charger PEC (\(BAT1C\)-\(BAT2C\)), also primary bus and secondary bus are considered (\(BUSP\), \(BUISS\)) places, but they are not able to store power more than one period of time. A transition represents the enable signal of a PEC, since Petri net point of view, an active transition allows the power flow (\(T0\)-\(T17\)). An arc is the medium through power flows, it also indicates the direction of the flow. A token represents a power unit (\(W\), kW, etc.). The places \(APV1M\)-\(APVM4\) are connected to the respective bus through two trajectories arc and transition. One transition is activated if boost converter operates with feedback state controller in closed loop, voltage regulation mode. The other transition is turned on when this kind of PEC operates in MPPT mode. Figure 12: EMS stages block diagram. CC receives and quantifies the following measurements: PV arrays power output, the three linked to primary bus (_PV1-PV3_) and for the PV array related to secondary bus, _PV4_. Generally, if \(i=1,2,3,4\) then _PVi_ is any of the PV arrays. If \(PVi=0\) the PV array is not working because is not connected or damaged. If \(PV1=1\), low power is harvested form PV array, enough to set the bus, but not a lot of loads can be supplied. At \(PVi=2\), there is power enough to supply all the loads in the building and inject power to mains. If \(PVi=3\) there is surplus power harvested, tasks before mentioned can be done also a ESS batteries charge sequence is possible. This quantification is process in CC in binary form using two digits. In a similar way, ESS batteries SoC is associated with parameters \(BAT1\), for ESS in primary bus and, \(BAT2\) is relaed to secondary bus. In general way, if \(i=1,2\) then \(BATi\) is any of the ESS batteries. Now, if \(BATi=0\) ESS is not working for one of the following reasons: ESS is not connected or ESS is damaged. If \(BAT=1\), SoC is low and is not possible to keep the the bus regulated with some loads. When \(BAT1=2\), SoC is at medium level is possible to supply loads and perform a charge sequence for an EV. If \(BAT=3\), SoC level value is high, then, all the loads into the building can be supplied, perform charge sequence for EV or inject power to mains. Again, \(BATi\) value es represented with two binary digits. Mains has two point of connection to DCMG, one through primary bus, \(GRD1\), and the other via secondary bus, \(GRD2\). Again, to assert in general way, \(i=1,2\), then \(GRDi\) is any of mains voltage measurements. The quantification associated to these parameters is: if \(GRDi=0\) there is not voltage in mains, else, if \(GRDi=1\), there is voltage in point connection with mains. At this time, \(GRDi\) is a binary number with two possible values. All the paramemters before mentioned are concatenated to build the DCMG state vector. Depending on the state vector information, the needed transitions are activated to  
Figure 13: DCMG multibus multi-voltage Petri net scheme. move to a more convenient state in the corresponding FMSs to reach a new source condition or load condition or maintain the current state.