solar position data

This commit is contained in:
Lucas Tan 2025-03-30 16:39:57 +08:00
parent 7405149f55
commit 3132d3e568
2 changed files with 33 additions and 4 deletions

View File

@ -6,6 +6,8 @@ from ladybug_geometry.geometry3d.pointvector import Point3D, Vector3D
from ladybug_geometry.geometry3d.plane import Plane
from ladybug_geometry.geometry3d.polyface import Polyface3D
import pvlib
from Utilities.Processes import calculate_no_of_panels
logger = logging.getLogger(__name__)
@ -111,3 +113,27 @@ def create_panels(coordinates, c):
panels.append(panel)
return panels
def get_solar_data(c):
logger.info(
f"Getting solar position data for {c['simulation_date_time']['start']} to {c['simulation_date_time']['end']}"
)
"""
Function to get solar position from PVLib
"""
latitude = c["environment"]["location"]["latitude"]
longitude = c["environment"]["location"]["longitude"]
tz = c["simulation_date_time"]["tz"]
times = pd.date_range(
c["simulation_date_time"]["start"],
c["simulation_date_time"]["end"],
freq="15min",
tz=tz,
)
# Get solar position data using PVLib
solar_positions = pvlib.solarposition.get_solarposition(times, latitude, longitude)
return solar_positions

View File

@ -3,6 +3,10 @@ array:
spacing: 1 # spacing between adjacent panel rows in m
edge_setback: 1.8 # distance from the edge of the roof to the array
simulation_date_time:
start: 2025-03-30 00:00 # start date and time in ISO 8601 format
end: 2025-03-30 23:45 # end date and time in ISO 8601 format
tz: Asia/Kuala_Lumpur # timezone for the simulation
environment:
roof:
dimensions:
@ -11,10 +15,9 @@ environment:
width: 125
albedo: 0.8 # % of light reflected from the surface
tilt: 0 # degrees from horizontal
location:
latitude: 3.1186108758412945
longitude: 101.57639813680093
location:
latitude: 3.1186108758412945
longitude: 101.57639813680093
panel:
peak_power: 710 # in Wp