get clearsky and solar position data
This commit is contained in:
parent
0a4d980f4f
commit
a086431c46
@ -12,6 +12,15 @@ from Utilities.Processes import (
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def get_location(c):
|
||||
location = pvlib.location.Location(
|
||||
latitude=c["environment"]["location"]["latitude"],
|
||||
longitude=c["environment"]["location"]["longitude"],
|
||||
tz=c["simulation_date_time"]["tz"],
|
||||
)
|
||||
|
||||
return location
|
||||
|
||||
|
||||
def define_grid_layout(c):
|
||||
# get number of panels required
|
||||
@ -36,14 +45,14 @@ def define_grid_layout(c):
|
||||
max__panels_per_row = np.floor(
|
||||
(
|
||||
c["environment"]["roof"]["dimensions"]["width"]
|
||||
- 2 * c["array"]["edge_setback"]
|
||||
- (2 * c["array"]["edge_setback"] + c["panel"]["dimensions"]["width"])
|
||||
)
|
||||
/ c["panel"]["dimensions"]["width"]
|
||||
)
|
||||
max_number_of_rows = np.floor(
|
||||
(
|
||||
c["environment"]["roof"]["dimensions"]["length"]
|
||||
- 2 * c["array"]["edge_setback"]
|
||||
- (2 * c["array"]["edge_setback"] + c["panel"]["dimensions"]["length"])
|
||||
)
|
||||
/ pitch
|
||||
)
|
||||
@ -77,7 +86,7 @@ def define_grid_layout(c):
|
||||
if counter < no_of_panels:
|
||||
x.append(i * c["panel"]["dimensions"]["width"])
|
||||
y.append(
|
||||
j * (c["panel"]["dimensions"]["thickness"] + c["array"]["spacing"])
|
||||
j * pitch
|
||||
)
|
||||
z.append(0)
|
||||
counter += 1
|
||||
@ -101,28 +110,21 @@ def get_solar_data(c):
|
||||
"""
|
||||
Function to get solar position from PVLib
|
||||
"""
|
||||
latitude = c["environment"]["location"]["latitude"]
|
||||
longitude = c["environment"]["location"]["longitude"]
|
||||
tz = c["simulation_date_time"]["tz"]
|
||||
location = get_location(c)
|
||||
|
||||
times = pd.date_range(
|
||||
c["simulation_date_time"]["start"],
|
||||
c["simulation_date_time"]["end"],
|
||||
freq="15min",
|
||||
tz=tz,
|
||||
tz=location.tz,
|
||||
)
|
||||
|
||||
# Get solar position data using PVLib
|
||||
solar_positions = pvlib.solarposition.get_solarposition(times, latitude, longitude)
|
||||
solar_positions = location.get_solarposition(times)
|
||||
clearsky_data = location.get_clearsky(times)
|
||||
|
||||
return solar_positions
|
||||
return solar_positions, clearsky_data
|
||||
|
||||
|
||||
def calculate_shading(c, coordinates, solar_positions):
|
||||
# calculate shading row by row
|
||||
logger.info("Calculating shading for each row of panels")
|
||||
row_coordinates = np.unique(coordinates["y"])
|
||||
for row in row_coordinates:
|
||||
# get number of panels in row for width of row
|
||||
panels_in_row = coordinates[coordinates["y"] == row].shape[0]
|
||||
row_width = panels_in_row * c["panel"]["dimensions"]["width"]
|
||||
|
@ -3,7 +3,7 @@ array:
|
||||
spacing: 1.5 # spacing between adjacent panel rows in m
|
||||
edge_setback: 1.8 # distance from the edge of the roof to the array
|
||||
front_face_azimuth: 90 # 90=east, 180=south, 270=west
|
||||
tilt: 90
|
||||
tilt: 90 # just 0 and 90 are supported for now
|
||||
slope: 0 # degrees from horizontal (+ve means shaded row is higher than the row in front)
|
||||
|
||||
simulation_date_time:
|
||||
|
Loading…
x
Reference in New Issue
Block a user