Home - POSOCO/grid_graph GitHub Wiki

Introduction

This project tries to create a graph database of grid elements in the Important Grid Elements Excel sheet maintained by WRLDC.

Using the csv files and cql (Cypher Query Language) files we load the data into the graph database. Once the data is loaded, we can query the data about the elements.

The advantage of using a graph database is that it is a schema less database, hence it is comparatively easy to change or modify the data schema. On the other hand the graph database we are using doesn't have sophisticated constraints compared to traditional relational databases. Hence we need to be careful while creating/modifying nodes and relationships in the graph database.

The major advantage of using a graph database is that querying is more easy and more performant when the links between nodes is more and frequently queried since the joins are hard-stored in the database.

The next step would be to parse the topology dump file from SCADA and create the graph database.

How this Database was created

  • Using the csv files and cql (Cypher Query Language) files we load the data into the graph database. Once the data is loaded, we can query the data about the elements.

Neo4j Browser Screen

Example of querying all the lines from the database. Note the length of the query

MATCH (owner1:Owner)<-[:OWNED_BY]-(ss1:Substation)<-[:LOCATED_IN]-(bus1:Bus)<-[:CONNECTED_TO]-(l:Line)-[:CONNECTED_TO]->(bus2:Bus)-[:LOCATED_IN]->(ss2:Substation)-[:OWNED_BY]->(owner2:Owner), (l_owner:Owner)<-[:OWNED_BY]-(l), (bus1)-[:HAS]->(volt:Voltage{name: '765 kV'}), (bus2)-[:HAS]->(volt) 
WHERE ss1.name<ss2.name
with l, bus1, bus2, ss1.name as ss1_name,ss2.name as ss2_name, collect(distinct owner1.name) as owner1_names, collect(distinct owner2.name) as owner2_names, collect(distinct l_owner.name) as l_owner_names, collect(distinct volt.name) as voltage_levels
OPTIONAL MATCH (bus1)<-[:CONNECTED_TO]-(lr1:LineReactor)-[:CONNECTED_TO]->(l), (bus2)<-[:CONNECTED_TO]-(lr2:LineReactor)-[:CONNECTED_TO]->(l)
return ss1_name,owner1_names,ss2_name,owner2_names,l.id,l_owner_names,voltage_levels, l.sil, l.km, l.conductor_type, l.no_load_mvar, (case when lr1 IS NULL then NULL else lr1.mvar end) as end1_lr_mvar, (case when lr1 IS NULL then NULL else lr1.sw end) as end1_lr_sw, (case when lr2 IS NULL then NULL else lr2.mvar end) as end2_lr_mvar, (case when lr2 IS NULL then NULL else lr2.sw end) as end2_lr_sw order by ss1_name, ss2_name, l.id
;

Line Fetch Query

Bus Reactors and ICTs queries

Bus Reactors Query

ICTs Query

Database Schema

Grid Elements DB Schema

Grid Elements DB Schema

Creating websites using the api of the neo4j server

Neo4j database gives a REST api end point which can be used for querying cql commands. This feature can be used to create a server that can serve user interfaces like the following. The page shown below helps us to search and filter lines in the Neo4j database using the REST api endpoint.

Lines Browsing Page

Feel free to read other pages of this wiki. Links are on the top right side panel. ✨ 😄 ✨