Statnett-LLM: Talk2PowerSystem
Democratizing power system analytics
Presentation Agenda
CIM Background
CIM Background
CIM Examples (1)
CIM Examples (2)
Electrical diagram vs RDF instance diagram (EDF). Gray blobs: connectivity nodes; blue dots: terminals
CIM Examples (3)
Electrical diagram vs conceptual RDF instance diagram (CIM Primer by EPRI)
Statnett
Relevant Graphwise Capabilities
Graphwise Demonstrators
TEKG Advanced Validation
Even Statnett EIC record has a mistake: GS1 GLN instead of VAT
TEKG Maps and Charts
Due to OpenStreetMap integration we can show detailed plant outline and in some cases even the individual generation units
CIM Demo
objects:
AccumulatorReset:
descr: This command reset the counter value to zero
inherits: ControlInterface
label: AccumulatorReset
props:
accumulatorReset.AccumulatorValue: {}
type: cim:AccumulatorReset
ControlInterface:
descr: Abstract superclass of Control
inherits: IdentifiedObjectInterface
kind: abstract
search: {nested: true}
props:
control.PowerSystemResource: {}
properties:
accumulatorReset.AccumulatorValue:
descr: The accumulator value that is reset by the command
inverseOf: accumulatorValue.AccumulatorReset
kind: object
label: AccumulatorValue
max: 1
min: 1
range: AccumulatorValue
rdfProp: cim:AccumulatorReset.AccumulatorValue
control.PowerSystemResource:
descr: 'The controller outputs used to...'
inverseOf: powerSystemResource.Controls
kind: object
label: PowerSystemResource
max: inf
min: 0
range: PowerSystemResourceInterface
rdfProp: cim:Control.PowerSystemResource
AccumulatorReset:
ISA: ControlInterface
accumulatorReset_AccumulatorValue: AccumulatorValue
ControlInterface:
ISA: IdentifiedObjectInterface
control_PowerSystemResource: [PowerSystemResourceInterface]
CIM GraphQL Querying
Much simpler than SPARQL; if we shorten prop names becomes more natural and easier for LLM
query psrWithLocationPointsAndVoltage {
aCLineSegment(where: { powerSystemResource_Location: {} }) {
identifiedObject_name
identifiedObject_description
powerSystemResource_Location {
location_PositionPoints(orderBy: { positionPoint_sequenceNumber: ASC }) {
positionPoint_xPosition
positionPoint_yPosition
positionPoint_sequenceNumber
}
}
conductingEquipment_BaseVoltage {
baseVoltage_nominalVoltage
}
}
substation(where: { powerSystemResource_Location: {} }) {
identifiedObject_name
powerSystemResource_Location {
location_PositionPoints {
positionPoint_xPosition
positionPoint_yPosition
}
}
}
}
query psrWithLocationPointsAndVoltage {
aCLineSegment(where: { location: {} }) {
name
description
location {
positionPoints(orderBy: { sequenceNumber: ASC }) {
xPosition
yPosition
sequenceNumber
}
}
baseVoltage {
nominalVoltage
}
}
substation(where: { location: {} }) {
name
location {
positionPoints {
xPosition
yPosition
}
}
}
}
CIM LLM Querying and Code Gen
import json
import folium
# open JSON file
with open('locations-result.json', 'r') as file:
locations_data = json.load(file)
# Initialize a map
map = folium.Map(location=[63, 13], zoom_start=5)
# Process and plot AC line segments
for line in locations_data["data"]["aCLineSegment"]:
points = line["powerSystemResource_Location"]["location_PositionPoints"]
voltage = line["conductingEquipment_BaseVoltage"]["baseVoltage_nominalVoltage"]
tooltip = f'{line["identifiedObject_name"]}: {line["identifiedObject_description"]}'
color = 'blue' if voltage <= 300 else 'red'
folium.PolyLine(
[(float(p["positionPoint_yPosition"]), float(p["positionPoint_xPosition"]))
for p in points],
color=color,
tooltip=tooltip).add_to(map)
# Process and plot substations
for sub in locations_data["data"]["substation"]:
point = sub["powerSystemResource_Location"]["location_PositionPoints"][0]
tooltip = sub["identifiedObject_name"]
folium.Marker(
location=[float(point["positionPoint_yPosition"]), float(point["positionPoint_xPosition"])],
icon=folium.Icon(color='green', icon='bolt', prefix='fa'),
# icon_size=(10, 10), icon_color='green': causes no bubble, so the marker appears off-point
tooltip=tooltip).add_to(map)
# Save the map to an HTML file
map.save('locations-show.html')
Talk2PowerSystem Project Overview
Project Stats and Work Breakdown
Project Requirements
Project Tasks
Key Project Approaches
Reasoning Helps LLM
Query is very complex, hard to generate
Add reasoning (OWL-RL-optimized)
Query becomes much simpler
PREFIX cim: <http://iec.ch/TC57/2013/CIM-schema-cim16#>
PREFIX sesame: <http://www.openrdf.org/schema/sesame#>
select ?sub1Name ?lineName ?sub2Name {
{select distinct * {
values ?sub1Name {"ARENDAL"}
?sub1 a cim:Substation;
cim:IdentifiedObject.name ?sub1Name;
(cim:EquipmentContainer.Equipments|cim:Substation.VoltageLevels|
cim:VoltageLevel.Bays)+ / # equipment in ?sub1
cim:ConductingEquipment.Terminals / cim:Terminal.ConnectivityNode /
cim:ConnectivityNode.Terminals / cim:Terminal.ConductingEquipment /
cim:Equipment.EquipmentContainer ?line. # part of ?line
?line a cim:Line; cim:IdentifiedObject.name ?lineName}}
{select distinct * {
?sub2 a cim:Substation;
cim:IdentifiedObject.name ?sub2Name;
(cim:EquipmentContainer.Equipments|cim:Substation.VoltageLevels|
cim:VoltageLevel.Bays)+ / # equipment in ?sub2
cim:ConductingEquipment.Terminals / cim:Terminal.ConnectivityNode /
cim:ConnectivityNode.Terminals / cim:Terminal.ConductingEquipment /
cim:Equipment.EquipmentContainer ?line}}
filter(?sub1 != ?sub2)
}
PREFIX cimex: <https://rawgit2.com/statnett/Talk2PowerSystem/main/demo1/cimex/>
PREFIX cim: <http://iec.ch/TC57/2013/CIM-schema-cim16#>
PREFIX sesame: <http://www.openrdf.org/schema/sesame#>
select ?sub1Name ?lineName ?sub2Name {
values ?sub1Name {"ARENDAL"}
?sub1 a cim:Substation; cim:IdentifiedObject.name ?sub1Name;
cimex:connectedThroughPart ?line.
?line a cim:Line; cim:IdentifiedObject.name ?lineName.
?sub2 a cim:Substation; cim:IdentifiedObject.name ?sub2Name;
cimex:connectedThroughPart ?line.
filter(?sub1 != ?sub2)
}
NLQ Approaches
NLQ Research
Zotero bibliography "Ontotext LLM":
Comprehensive research on these topics, especially KGQA datasets.
Ongoing project task to keep abreast of research.
KGQA Datasets
Key question: how to gather a diverse and large enough Competency Question dataset that can be used for both training (fine tuning) and evaluation.
Approach:
CrunchQA Example
LLM-Based Analytics
Open LLM on Premise
Reducing Hallucinations
SPARQL and GraphQL
Data Spaces, Writing Research Proposals
Communication, Dissemination, Exploitation
Important activities to ensure the impact and sustainability of the development efforts:
THANK YOU FOR YOUR TIME!
THANK YOU FOR YOUR TIME!