## 4 Case Study
### TOOCC Perspective  
In order to simulate the current scenario, TOOCC needs to configure it. This tool allows the same scenario to be modeled in different ways, reconfiguring the interaction between the previously-presented systems, in a rather automatic process. In this case, the simulation will integrate the IDeS and PLCMAS systems, with two agents, namely an NM agent (network operator) and an FM agent (Load 15). Figure 5 illustrates the interaction between the four different systems and demonstrates how the concepts of the ontologies presented in Section 3.3 are shared between the systems. The communications shown in this figure represent specific interactions between some of the most relevant agents, which are accomplished by a direct use of the considered ontologies. It shows that the initialization of the NM's scheduling requires the reception of the forecasts from all grid loads/FMs. The forecasts of each load include information on the consumption, production, characteristics and state of the facility's resources (e.g., sockets, lights, PV generation, etc.). The scenario considers one FM per consumer of the considered microgrid, which is responsible, in this stage, to send the specific consumption and generation forecasts to the NM. FM gets its forecasts by interacting with the IDeS system, which is responsible for executing the forecast algorithm, based on the history of its consumption and power production. Figure 4: Simulated house composition. Figure 6 illustrates the forecasts of energy, relative to consumption and distributed production (solar and wind) for the whole microgrid, for the following day. As can be observed, the production peak occurs between 10 a.m. and 6 p.m., where the highest incidence of sunlight is verified, reaching the value of approximately 585 kW. During the night periods, production comes from wind generators. Comparing 1 a.m. and 10 p.m., for instance, it is possible to verify a great difference in the production of energy, due to changes in the state of the wind. As for consumption, between 10 a.m. and 10 p.m. there is a high energy consumption. Since the microgrid is relative to a university campus, this consumption corresponds to the period of classes. The peak consumption is around 11 p.m., reaching about 518 kW. This happens because there is a transition of classes between morning and afternoon, which sums more consumption. The classes of the night have less students, which explains the smaller consumption. As soon as the FM agent receives all the forecasts, it sends them to TOOCC, which in turn routes them to NM. At this point, the simulation already meets the necessary conditions to carry out the next step, that is to obtain the energy scheduling of the microgrid for the next day. The next step is to start the scheduling of the energy by the NM agent. For this purpose, the NM uses the Energy Resources Management (ERM) [71] system, provided by IDeS, which executes in three stages: scheduling day-ahead, hour-ahead and real-time. The first stage is for the network operator to perform the energy management for the next day, taking into account forecasts of all loads. The second phase (our-ahead scheduling) is analogous to the previous phase, but it uses up-to-date forecasts, with one hour of delay of the desired moment, guaranteeing a smaller error. The third phase, corresponding to the real-time scheduling, is the same process, but for the next five minutes. This three-phase approach allows the network operator to have a forecast of how  
Figure 5: Simplified sequence diagram of TOOCC’s interaction with external systems. ERM, Energy Resources Management system. the power consumption will be across the network, and the DG available to meet the demand for the next day. As the DG comes from volatile sources, it is important that the NM can adjust itself over time, using up-to-date forecasts, as the estimated value tends to be closer to reality. In this way, energy wastage is avoided, as well as power supply failure.