Prototype Solar Mini Grid Layout (1st Implementation)

Pay Notebook Creator: Roy Hyunjin Han250
Set Container: Numerical CPU with TINY Memory for 10 Minutes 0


Inspire a community of professionals skilled in spatiotemporal analysis for community health and safety.


Prototype an algorithm that places miscellaneous equipment.


Roy Hyunjin Han


A solar mini grid has additional equipment that is required for it to function properly.


20171110-1415 - 20171110-1515: 60 minutes


  1. Draft algorithm.
  2. Prototype tool.


20171110-1415 - 20171110-1445: 30 minutes

We will let the user specify the necessary parameters.

Each customer has an associated daily demand in kWh/day. We need to keep track of which customers are associated with each battery, then we can sum the daily demand for that battery.

+ Estimate the daily demand in kWh/day for each battery

We should probably represent a customer as a class and store the various computations as members of the Customer class. Estimating the number of solar panels to satisfy the daily demand should be simple division. But the complication arises in not having enough poles on which to put the solar panels.

+ Estimate the number of solar panels needed to satisfy the daily demand for each battery

To find the poles closest to a battery, we can use a kd-tree.

+ Place a solar panel on poles closest to a battery

Given that all shapely calculations are done in Euclidean distance, we should probably convert all coordinates to UTM using the utm package.

In [9]:
# Review how to use kd-tree
import numpy as np
from scipy.spatial import KDTree

xys = np.array([
    (0, 0),
    (0, 1),
    (1, 0),
    (1, 1),
tree = KDTree(xys)
indices = tree.query_ball_point((0, 0), 1)
array([[0, 0],
       [0, 1],
       [1, 0]])
In [12]:
distances, indices = tree.query((0, 0), k=2)
array([[0, 0],
       [0, 1]])

Adding power meters to certain poles should be easy. I think we should define a class called Pole to represent all the features of the pole.

+ Add a power meter to a pole for each service drop
+ Add a power meter to a pole for each street lamp pole

We should probably place the street lamps before we place the equipment.

+ Place a wireless internet source at each battery

We can also define a Battery class.

I think we are only putting wireless internet routers on existing poles and batteries.

  • Maximum distance between wireless internet source and wireless internet pole
  • Maximum distance between wireless internet poles
  • Maximum distance between wireless internet node and solar panel pole

I think this is kind of like the disjoint polygon placement problem, but it is actually not, since we are only placing routers on existing poles.

The question is which poles will receive a wireless internet router? The goal is to connect each solar panel pole power meter to a wireless internet source or wireless internet pole, so we should probably start at the solar panel poles. This seems to be a graph shortest path problem, where the source node is the battery and the target node is the solar panel and the possible nodes are the existing poles.

+ Minimize the number of wireless internet poles
+ Minimize the distance from a solar panel to a wireless internet source or wireless internet pole


In [13]:
class Customer(object):
    id = 'abc123'
    demand_in_kwh_per_day = 0
    x = 0
    y = 0
    longitude = 0
    latitude = 0
In [15]:
class Pole(object):
    id = 'abc123'
    type_id = 'A'
    customers = []
    has_solar_panel = False
    has_street_lamp = False
    has_wireless_internet = False
    has_corner_angle = False
    x = 0
    y = 0
    longitude = 0
    latitude = 0
In [17]:
class Battery(object):
    id = 'abc123'
    type_id = 'A'
    x = 0
    y = 0
    longitude = 0
    latitude = 0
+ Define class: Customer
+ Define class: Pole
+ Define class: Battery