## 4 System Architecture
### Sensing the Environment  
As already mentioned, all PGDINs are connected to the DDS bus, which is their standard way of communication. Each PDGIN has a knowledge base obtained from harmonising the semantic data model of CIM and IEC 61850. The characterisation of each knowledge base is an OWL profile (_i.e._, a subset of the harmonised semantic data model between CIM and IEC 61850) and an electric model that is CIM/IEC 61850 compliant. Hence, a profile is the information that they own _a priori_ (in a Kantian sense) of the world around. Since the knowledge in this profile also determines the valid vocabulary for each PDGIN, the knowledge base defines the information that may be exchanged in their communication acts. Further, when the PDGINs _discover_ or _infer_ new knowledge, it is stored as RDF entities in their knowledge base, allowing in this way sharing this newly _created_ information easily.  
As discussed above, the electric system is strictly hierarchical but PGDINs do not necessarily follow this hierarchy, since there are some operations that may request the collaboration of non-_sibling_ PGDINs. In order to capture these requirements, we have defined a semantic data model characterising the logical layers of the architecture. As shown in Figure 4, we have extended the CIM ontology to represent the GridAgent. This novel concept allows us to identify groups of PGDINs in each layer depending on their function or geographical situation (_i.e._, belonging to a certain area), farther from their topological relationship within the grid hierarchy (which is still crucial, as we will see). Thus, the PGDINs can infer from their knowledge base which PGDINs are _virtually_ connected to it. Please note that the DDS bus already connects them all, but this fact does not imply that a PGDIN knows all existing peers due to scalability and performance problems that might appear in big power networks.  
If a PGDIN wants to know which other intelligent agents are controlling assets connected to its asset, it can follow the semantic data model describing the architecture-layers and its electric model (the harmonised data model and, thus, CIM compliant [23]). CIM-compliant electric models allow identifying a particular topology that defines the connectivity between power systems resources in an electric network. This topology is basically based on three CIM classes:  
* Terminal: An electrical connection point to a piece of conducting equipment. Terminals are connected at physical connection points called _connectivity nodes_.
* ConnectivityNode: Connectivity nodes are points where terminals of conducting equipment are connected together with zero impedance.
* ConductingEquipment: The parts of the power system that are designed to carry current or that are conductively connected therewith. ConductingEquipment is contained within an EquipmentContainer, which may be a primary substation, a voltage level or a bay within a primary substation.  
Figure 5 portraits the relationship between these classes. Observe that since the terminal class is related to the measurement class, it is also used to define points of connectivity (_i.e._, related measurement in the electric network such as power flows, currents and voltages). In this way, the PGDIN has annotated in its knowledge base the information on the asset or assets it controls. For instance, it may find (by means of SPARQL queries upon its \"RDF-DB\" in Figure 1[16]) to whom is that asset connected. Subsequently, having inferred the URI of the connecting asset, it may ask in the DDS bus who is the one in charge of that asset. The response will be stored similarly as an RDF rule so this operation does not need to be repeated in the future. In summary, this novel semantic description allows PGDINs to work independently of their location (Figure 4) and discover other peers they need to interact with (Figure 5).  
Figure 4: Set of classes that characterise the relation between ENERGOS-Layers and GridAgent/PDGIN.