Commit 6f626cd8 authored by Bognár, Á.'s avatar Bognár, Á.
Browse files

Added pointgrid_over_pvmodule()

which is a wrapper function to create sensor points over each cell of a pv module.
parent c9538edd
......@@ -516,3 +516,31 @@ def pointgrid_over_surface(surface, d=5, edges=True, sp_offset=0.01):
row_index=[0], col_index=[0], original_poly=poly, sp_offset=sp_offset,
sp_pos_round=3)
return sp
def pointgrid_over_pvmodule(surface, n_row=10, n_col=6, sp_offset=0.01):
"""Wrapper function to create sensot points over each cell of a pv module.
Inputs: surface: IDF urface (via geomeppy), n_row: number of cell-rows in
the PV module n_col: number of cell-columns in the PV module
sp_offset: offset of sensorpoints from the surface in m. Returns a dict:
{'surf_name':surface name, 'sensor_points':list of sensor points,
'ri':row_index, 'ci':col_index, 'sp_ori':list of normal vectors}."""
# make poly from idf (daypym)
poly = IDFsurf_to_poly(surface=surface)
# translate poly to the x-y plane (geomeppy)
poly_trans = align_face(poly).order_points('upperleftcorner')
# make the poly 2D (geomeppy)
poly_trans_2d = poly_trans.project_to_2D()
# make a 2d bbox of the translated surface on the xy pane (geomeppy)
poly_trans_bbox_2d = poly_trans.bounding_box.project_to_2D()
# make a 2D test grid on the x-y plane (daypym)
test_grid = grid_2d_pvmodule(n_row=n_row, n_col=n_col,
bbox_2d=poly_trans_bbox_2d)
# makes a list of points, that are inside the 2D poly (daypym)
pip = gridpoints_in_poly_2d(grid_2d=test_grid, poly_2d=poly_trans_2d)
# row and column index information
ri, ci = pos_in_module(n_row=n_row, n_col=n_col, test_grid_transp=test_grid)
# sensor point data dict (daypym)
sp = create_sensor_points(surf_name=surface['Name'], points_in_poly_2d=pip,
row_index=ri, col_index=ci, original_poly=poly, sp_offset=sp_offset,
sp_pos_round=3)
return sp
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment