## 3 Toocc
### Simulation and Interoperability  
In order to allow interoperability between the multi-agent tools presented in Section 3.1, ontologies are used in the simulation phase, enabling them to speak the same language and to understand the same concepts and terms, preventing different interpretations of the same information. The use of ontologies also facilitates the execution of scenarios, especially in those that use different tools. Within this work, we can find two types of ontologies. The first type is conceptual ontologies, which are the basis for communication between systems. These ontologies allow the description of the vocabulary that will be shared between the systems, from measures (e.g., energy ontology, temperature ontology, etc. ), to more complex concepts such as load flexibility in DR (e.g., load flexibility ontology) and power management (e.g., scheduling, optimization and forecasting ontology). Although TOOCC uses these ontologies to establish communication with other systems, they are developed independently of the TOOCC and are already publicly available in [69]. The second type of ontology is related to the procedural part of the systems (application ontology), and it is used in the system's registration phase to describe the way the systems work, namely by the description of its services and possible communications, detailing inputs and outputs. Currently, for TOOCC to be able to communicate with a new system, it is necessary that it uses the mentioned ontologies in its communications. First, the new system must be able to communicate with the TOOCC's application ontology to be incorporated into the system. Through this ontology, the TOOCC is able to automatically generate the necessary structures for the configuration of the new system simulation. Subsequently, the new system should also incorporate the conceptual ontologies in order to be understood by TOOCC. For this purpose, the system can internally use the same ontologies or make the appropriate mapping from the ontologies to its own model. In the future, to help the integration of external systems, the development of a library is intended that allows the automatic conversion of the data structures in the respective ontologies. Moreover, using the semantic model instead of converting to classes/structures makes it possible to change the model without the need to reprogram code, which can be an advantage to adapt the model by the external systems' developers. During the simulation, the external systems will be constantly sending messages that must be interpreted by TOOCC. These messages may signal a request to run another system (already configured in the simulation preparation phase) or the arrival of the results of an earlier request. For this purpose, the tool has a message server that is constantly listening to new messages, and when a new message arrives at the system, it is in charge of triggering the event (behavior) that will treat it. This event, through analysis of the simulation configuration, knows the next steps of the simulation and, if necessary, generates new events in order to follow the simulation. Figure 2 presents the TOOCC multi-agent perspective. The agents are organized hierarchically, and each one contributes to the resolution of part of the problem, by sharing vocabulary resulting from the combination of several ontologies, as illustrated in the figure. TOOCC contains the following agent types:  
* TOOCC agent: This is the main agent of TOOCC and is responsible for launching and managing the GUI component. In addition, when the user initiates the simulation, this agent creates new agents, intended to execute each scenario. This agent is unique in the system, and the user will always interact with it. * Scenario agent: This is used to manage the scenario for which it was created. This agent verifies that the systems, to which it needs to connect, are alive, and if they are, it sends the necessary input data to their execution and orders the start of simulation. Several scenario agents can be executed at the same time.