def test_physical_scalar(): aoi = -45. iam = _iam.physical(aoi, 1.526, 0.002, 4) expected = 0.98797788 assert_allclose(iam, expected, equal_nan=True) aoi = np.nan iam = _iam.physical(aoi, 1.526, 0.002, 4) expected = np.nan assert_allclose(iam, expected, equal_nan=True)
def test_physical(): aoi = np.array( [-90., -67.5, -45., -22.5, 0., 22.5, 45., 67.5, 90., np.nan]) expected = np.array([ 0, 0.8893998, 0.98797788, 0.99926198, 1, 0.99926198, 0.98797788, 0.8893998, 0, np.nan ]) iam = _iam.physical(aoi, 1.526, 0.002, 4) assert_allclose(iam, expected, equal_nan=True) # GitHub issue 397 aoi = pd.Series(aoi) iam = _iam.physical(aoi, 1.526, 0.002, 4) expected = pd.Series(expected) assert_series_equal(iam, expected)
# The IAM model used to generate the figures in [1]_ uses Snell's, Fresnel's, # and Beer's laws to determine the fraction of light transmitted through the # air-glass interface as a function of AOI. # The function :py:func:`pvlib.iam.physical` implements this model, except it # also includes an exponential term to model attenuation in the glazing layer. # To be faithful to Marion's implementation, we will disable this extinction # term by setting the attenuation coefficient ``K`` parameter to zero. # For more details on this IAM model, see [2]_. # # Marion generated diffuse irradiance modifiers for two cases: a standard # uncoated glass with index of refraction n=1.526 and a glass with # anti-reflective (AR) coating with n=1.3. # Comparing the IAM model across AOI recreates Figure 3 in [1]_: aoi = np.arange(0, 91) iam_no_coating = physical(aoi, n=1.526, K=0) iam_ar_coating = physical(aoi, n=1.3, K=0) plt.plot(aoi, iam_ar_coating, c='b', label='$F_b$, AR coated, n=1.3') plt.plot(aoi, iam_no_coating, c='r', label='$F_b$, uncoated, n=1.526') plt.xlabel(r'Angle-of-Incidence, AOI $(\degree)$') plt.ylabel('Diffuse Incidence Angle Modifier') plt.legend() plt.ylim([0, 1.2]) plt.grid() # %% # Diffuse sky, ground, and horizon IAM # ------------------------------------ # # Now that we have an AOI model, we use :py:func:`pvlib.iam.marion_diffuse`