- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.1k
          Extend infinite_sheds to optionally use haydavies transposition
          #1668
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
2be782c
              2c87a38
              595788d
              cdad691
              dd9bcc4
              2484931
              8891c31
              d518362
              d829ad7
              41b1189
              defba31
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -7,8 +7,7 @@ | |
| from pvlib.tools import cosd, sind, tand | ||
| from pvlib.bifacial import utils | ||
| from pvlib.shading import masking_angle | ||
| from pvlib.irradiance import beam_component, aoi | ||
|  | ||
| from pvlib.irradiance import beam_component, aoi, haydavies | ||
|  | ||
| def _vf_ground_sky_integ(surface_tilt, surface_azimuth, gcr, height, | ||
| pitch, max_rows=10, npoints=100): | ||
|  | @@ -401,7 +400,8 @@ def _shaded_fraction(solar_zenith, solar_azimuth, surface_tilt, | |
|  | ||
| def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith, | ||
| solar_azimuth, gcr, height, pitch, ghi, dhi, dni, | ||
| albedo, iam=1.0, npoints=100): | ||
| albedo, dni_extra=None, model='isotropic', iam=1.0, | ||
|         
                  kandersolar marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| npoints=100): | ||
| r""" | ||
| Calculate plane-of-array (POA) irradiance on one side of a row of modules. | ||
|  | ||
|  | @@ -457,6 +457,13 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith, | |
| albedo : numeric | ||
| Surface albedo. [unitless] | ||
|  | ||
| dni_extra : numeric, optional | ||
| Extraterrestrial direct normal irradiance. Required when | ||
| ``model='haydavies'``. [W/m2] | ||
|  | ||
| model : str, default 'isotropic' | ||
| Irradiance model - can be one of 'isotropic' or 'haydavies'. | ||
|  | ||
| iam : numeric, default 1.0 | ||
| Incidence angle modifier, the fraction of direct irradiance incident | ||
| on the surface that is not reflected away. [unitless] | ||
|  | @@ -495,6 +502,27 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith, | |
| -------- | ||
| get_irradiance | ||
| """ | ||
| if model == 'haydavies': | ||
| if dni_extra is None: | ||
| raise ValueError(f'must supply dni_extra for {model} model') | ||
| # Call haydavies first time within the horizontal plane - to subtract | ||
| # circumsolar_horizontal from DHI | ||
| sky_diffuse_comps_horizontal = haydavies(0, 180, dhi, dni, dni_extra, | ||
| solar_zenith, solar_azimuth, | ||
| return_components=True) | ||
| circumsolar_horizontal = sky_diffuse_comps_horizontal['circumsolar'] | ||
|  | ||
| # Call haydavies a second time where circumsolar_normal is facing | ||
| # directly towards sun, and can be added to DNI | ||
| sky_diffuse_comps_normal = haydavies(solar_zenith, solar_azimuth, dhi, | ||
| dni, dni_extra, solar_zenith, | ||
| solar_azimuth, | ||
| return_components=True) | ||
| circumsolar_normal = sky_diffuse_comps_normal['circumsolar'] | ||
|  | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that instead of calling haydavies twice, you should just calculate the anisotropy index here and use the relevant cosines of angles/projection ratios. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My 2 cents: maybe it's a bit unthrifty to call  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know what the future holds. I do know that in the past and again very recently I have found the functions in pvlib irradiance not suitable for my purposes in a similar way to this example. Each offers a little bundle of calculations, but sometimes I just need them bundled differently. | ||
| dhi = dhi - circumsolar_horizontal | ||
| dni = dni + circumsolar_normal | ||
|  | ||
| # Calculate some geometric quantities | ||
| # rows to consider in front and behind current row | ||
| # ensures that view factors to the sky are computed to within 5 degrees | ||
|  | @@ -580,8 +608,8 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith, | |
|  | ||
| def get_irradiance(surface_tilt, surface_azimuth, solar_zenith, solar_azimuth, | ||
| gcr, height, pitch, ghi, dhi, dni, | ||
| albedo, iam_front=1.0, iam_back=1.0, | ||
| bifaciality=0.8, shade_factor=-0.02, | ||
| albedo, dni_extra=None, model='isotropic', iam_front=1.0, | ||
| iam_back=1.0, bifaciality=0.8, shade_factor=-0.02, | ||
| transmission_factor=0, npoints=100): | ||
| """ | ||
| Get front and rear irradiance using the infinite sheds model. | ||
|  | @@ -643,6 +671,13 @@ def get_irradiance(surface_tilt, surface_azimuth, solar_zenith, solar_azimuth, | |
| albedo : numeric | ||
| Surface albedo. [unitless] | ||
|  | ||
| dni_extra : numeric, optional | ||
| Extraterrestrial direct normal irradiance. Required when | ||
| ``model='haydavies'``. [W/m2] | ||
|  | ||
| model : str, default 'isotropic' | ||
| Irradiance model - can be one of 'isotropic' or 'haydavies'. | ||
|  | ||
| iam_front : numeric, default 1.0 | ||
| Incidence angle modifier, the fraction of direct irradiance incident | ||
| on the front surface that is not reflected away. [unitless] | ||
|  | @@ -720,13 +755,15 @@ def get_irradiance(surface_tilt, surface_azimuth, solar_zenith, solar_azimuth, | |
| surface_tilt=surface_tilt, surface_azimuth=surface_azimuth, | ||
| solar_zenith=solar_zenith, solar_azimuth=solar_azimuth, | ||
| gcr=gcr, height=height, pitch=pitch, ghi=ghi, dhi=dhi, dni=dni, | ||
| albedo=albedo, iam=iam_front, npoints=npoints) | ||
| albedo=albedo, dni_extra=dni_extra, model=model, iam=iam_front, | ||
| npoints=npoints) | ||
| # back side POA irradiance | ||
| irrad_back = get_irradiance_poa( | ||
| surface_tilt=backside_tilt, surface_azimuth=backside_sysaz, | ||
| solar_zenith=solar_zenith, solar_azimuth=solar_azimuth, | ||
| gcr=gcr, height=height, pitch=pitch, ghi=ghi, dhi=dhi, dni=dni, | ||
| albedo=albedo, iam=iam_back, npoints=npoints) | ||
| albedo=albedo, dni_extra=dni_extra, model=model, iam=iam_back, | ||
| npoints=npoints) | ||
|  | ||
| colmap_front = { | ||
| 'poa_global': 'poa_front', | ||
|  | ||
Uh oh!
There was an error while loading. Please reload this page.