Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Smart Grid

How to Compile

Create a new folder named obj when compile the program for first time.


We used clang++ to compile our program, however, you can change it in the Makefile as you wish. Since our program utilized some features of c++11, the compiler must support c++11 to compile the program.


To run this program, execute the command below in root folder of the project.

./smart_grid inputs/ inputs/nodes.pos inputs/grids.wrapper

Structure of Program

This picture demostrates the structure of our program. Detailed explanation of the picture is in the blockquote below.

The filled arrow represents the ownership between classes, from owner to the class owned by the owner. Owning a class means that it's responsible for managing the life cycles of its objects. The hollow arrow represents the inheritance between classes, from child to parent.

The idea of this design is to seperate the fixed information from the data that we may need to change. All equipments in the smart grid is like a database storing all the static informations, and we query it only when we need to.

To achieve this, we abstract the vertices and edges from what it really is by defining a pointer pointing to its corresponding equipment instead of storing all the equipment's informations in it, causing unnecessary copys. For example, a vertex which is actually a resident will contain a pointer pointing to its corresponding resident object instead of making its own copy of the equipment's informations.

The beauty of this design is that when we have mutiple instances of a equipment, we can construct different vertices/edges referecing exactly the same equipment without the need to copy all the repetitive informations.

Some Useful Tools

Drawing the Graph

I wrote a web app on JS Bin to draw graphs of grids. To draw using this tool, just upload the file outputs/graph.json and the result will show up instantly.

The file outputs/graph.json is generated by the function Graph::OutputJSON() using a third party library.

Easier Code Navigation

To make navigating codes more efficiently, we use ctags to generate the tag file. Use Vim or some other editors supporting ctags to utilize the power of it.


No description, website, or topics provided.






No releases published


No packages published