Skip to content

Commit bce5cbd

Browse files
committed
Merge branch 'single_axis_tracking' into Kempe-Edge-Seals
2 parents 7753910 + 0e2aef7 commit bce5cbd

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

pvdeg/spectral.py

+70
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,66 @@ def solar_position(weather_df: pd.DataFrame, meta: dict) -> pd.DataFrame:
6565
],
6666
)
6767
def poa_irradiance(
68+
weather_df: pd.DataFrame,
69+
meta: dict,
70+
module_mount="fixed",
71+
sol_position=None,
72+
**kwargs_irradiance,
73+
) -> pd.DataFrame:
74+
"""
75+
Calculate plane-of-array (POA) irradiance using pvlib based on weather data from the
76+
National Solar Radiation Database (NSRDB) for a given location (gid).
77+
78+
Parameters
79+
----------
80+
weather_df : pd.DataFrame
81+
The file path to the NSRDB file.
82+
meta : dict
83+
The geographical location ID in the NSRDB file.
84+
module_mount: string
85+
Module mounting configuration. Can either be `fixed` for fixed tilt systems or
86+
`1_axis` for single-axis tracker systems.
87+
sol_position : pd.DataFrame, optional
88+
pvlib.solarposition.get_solarposition Dataframe. If none is given, it will be calculated.
89+
kwargs_irradiance : dict
90+
Contains kwarg arguments for the poa model based on mounting configuration. See
91+
`poa_irradiance_fixed` or `poa_irradiance_tracker` for details.
92+
93+
Returns
94+
-------
95+
poa : pandas.DataFrame
96+
Contains keys/columns 'poa_global', 'poa_direct', 'poa_diffuse',
97+
'poa_sky_diffuse', 'poa_ground_diffuse'. [W/m2]
98+
"""
99+
100+
if sol_position is None:
101+
sol_position = solar_position(weather_df, meta)
102+
103+
if module_mount == "fixed":
104+
poa = poa_irradiance_fixed(weather_df, meta, sol_position, **kwargs_irradiance)
105+
elif module_mount == "1_axis":
106+
poa = poa_irradiance_tracker(
107+
weather_df, meta, sol_position, **kwargs_irradiance
108+
)
109+
else:
110+
raise NotImplementedError(
111+
f"The input module_mount '{module_mount}' is not implemented"
112+
)
113+
114+
return poa
115+
116+
117+
@geospatial_quick_shape(
118+
1,
119+
[
120+
"poa_global",
121+
"poa_direct",
122+
"poa_diffuse",
123+
"poa_sky_diffuse",
124+
"poa_ground_diffuse",
125+
],
126+
)
127+
def poa_irradiance_fixed(
68128
weather_df: pd.DataFrame,
69129
meta: dict,
70130
sol_position=None,
@@ -137,6 +197,16 @@ def poa_irradiance(
137197
return poa
138198

139199

200+
@geospatial_quick_shape(
201+
1,
202+
[
203+
"poa_global",
204+
"poa_direct",
205+
"poa_diffuse",
206+
"poa_sky_diffuse",
207+
"poa_ground_diffuse",
208+
],
209+
)
140210
def poa_irradiance_tracker(
141211
weather_df: pd.DataFrame,
142212
meta: dict,

0 commit comments

Comments
 (0)