## 5 Use-Case: Energy Imbalance Billing at the Primary Substation
### Historical Load Energy Imbalance Billing  
Performing energy imbalance billing based on historical data (say last month's load balancing) requires using a different path than in the previous case. This is because the distributed object cache will most likely not be able to store measurement events for so long (definitively not if we open the window to, for instance, six months). Therefore, in this case the PriST PGDIN will not make use of the CEP/ESP: it will directly _contact_ the corresponding underlying PGDINs. Contrary to the ESP/CSP-based approach of the previous case, this alternative involves much more components of the PGDIN. According to the CIM protocol [18], the querying entity (_i.e._, the PriST PGDIN) must create and deliver a cim:MeterReadings message, which includes 0 to infinite number of cim:MeterReading and a 0 to infinite amount of cim:ReadingType entities. This message structure may combine readings from one or more meters, each one with its own quality value. Now, the problem is how to send this message exactly to the PGDINs that can reply with the information required (_i.e._, the PGDINs controlling the meters under this PriST). This challenge presents the same nature as the so-called _federation problem_ in distributed systems [16]. That is, the receiving PGDINswill eventually have to re-send the query only to a number of (again, underlying) PGDINs, before they are able to answer. In the proposed system, the query federation problem is addressed semantically, as we have advanced in Section 4.3. Based on the description of the world it owns (according to the ontology profile kept in the knowledge base), the PriST PGDIN infers the assets connected to it, and asks for their respective managing SecST PGDINs. In this sense, the connectivity among PGDINs _emerges_ from the semantic information inferred from the knowledge base and the expressiveness about the grid it has. Once the receivers of the query are clear, the PriST PGDIN subscribes to the corresponding data sources to retrieve the load curve of the required energy imbalance billing time window. Subsequently, the involved SecST PGDINs perform the internal SPARQL query detailed in Listing 2, to locally retrieve the load consumption for that window (local consumption is stored in the RDF repository). ``` SELECT?intRead?val?rdnUnit?rdnMulti?qualityWHERE{?metRdnsam:MeterReading;mr:MeterReading.IntervalBlocks?intBlock;mr:MeterReading.MeterAsset?metAsset;mr:MeterReading.valuesInterval?valInt.?valInt.?valIntam:DateTimeInterval;mr:DateTimeInterval.m:DateTimeInterval.beginDate?beginDate;?metAssetmr:IdentifiedObject.mRID?uri?intBlockam:IntervalBlock;mr:IntervalBlock.IntervalReadings?intRead;mr:IntervalBlock.ReadingType?rdnType;mr:MeasurementValue.timestamp?tms.?rdntypemr:ReadingType.kind?rdnKind;mr:ReadingType.multiplier?rdnMulti;mr:ReadingType.unit?rdnUnit. 7 intReadrdf:typemr:IntervalReading;mr:IntervalReading.value?val;mr:IntervalReading.ReadingQualities?rq. 7 rqmr:ReadingQuality.quality?quality.FILTERregex(?rdnKind,\"demand\"). FILTERregex(?uri,\"M123342343\"). FILTER(?beginDate>= \"2010-01-01T00:00:00\"



this use-case, the comparison is trivial, but the built-in reasoner and the rule engine allow for much more complicated operations. ## 6 Conclusions

The evolution of the classic power grid network has forced a shift in the dominating electric paradigm. Smart grids demand novel technologies to answer new urgent needs, such as dealing with bidirectional information flows, modelling the electric domain, or replacing the centralised static intelligence by a decentralised approach. Based on the CIM specification (a common language for describing all the assets and management terms of the electric grid) defined and maintained by the IEC, the UML model can be converted into a semantic OWL representation, opening the way to exploiting the use of semantic web technologies.