Skip to content

Set negative values of AOI loss to 0 rather than np.nan #338

Closed

Description

@cwhanse

The current AOI loss models set negative values to np.nan, rather than zero. When np.nans are propagated to the effective irradiance model, the beam irradiance (and the effective irradiance) becomes np.nan rather than 0. As a consequence, pvlib cannot compute effective irradiance when AOI>90, i.e., when the sun is behind the array plane. In this circumstance there's still diffuse irradiance on the array plane.

I think it would be better to implement the AOI loss models as

f(AOI) = model value if AOI<90
f(AOI) = 0 otherwise.

Activity

  1. jkfm commented on Jun 13, 2017

    @jkfm
    Contributor

    Thanks Cliff for opening an issue! It refers to my question in the google group.

    If I find time in the next couple of days, and if there is consent on the issue, I will start working on a pull request.

  2. cwhanse commented on Jun 13, 2017

    @cwhanse
    MemberAuthor
  3. wholmgren commented on Jun 13, 2017

    @wholmgren
    Member

    I can see arguments for nans or 0s. I think nan could be the right result because maybe it doesn't make sense to talk about an AOI modifier when the sun is behind the array plane. In a similar fashion, pvlib's relative airmass function returns nan when the zenith angle is greater than 90.

    On the other hand, I can think of at least a few of my results where I've failed to account for these nans, so that's a good indicator that something should change.

    One thing is for certain: ModelChain fails to account for the nans in its effective_irradiance calculation and that should be fixed as soon as possible.

  4. added this to the 0.5.0 milestone on Jun 13, 2017
  5. adriesse commented on Jun 13, 2017

    @adriesse
    Member

    I am in favour of having having all the iam functions return a value of zero or greater for any angle, except maybe an angle that is nan.

    It appears that currently the comments for physicaliam don't correspond to the code, and furthermore, each of the three available iam models has slightly different constraints.

  6. wholmgren commented on Jun 14, 2017

    @wholmgren
    Member

    The code below should allow you to monkey patch your modelchain objects until we get this fixed:

    import types
    def effective_irradiance_model_corrected(self):
        fd = self.system.module_parameters.get('FD', 1.)
        self.effective_irradiance = self.spectral_modifier * (
            self.total_irrad['poa_direct']*self.aoi_modifier.fillna(0) +
            fd*self.total_irrad['poa_diffuse'])
        return self
    
    mc = ModelChain(system, location, **your_normal_kwargs)
    mc.effective_irradiance_model = types.MethodType(effective_irradiance_model_corrected, mc)
    mc.run_model(times, weather=weather)  # as if nothing has changed

    AC power without the patch:

    download-8

    and with the patch:

    download-10

  7. jkfm commented on Jun 14, 2017

    @jkfm
    Contributor

    Thanks for the fix, @wholmgren. I forked the project and changed the functions for myself though (see PR).

  8. wholmgren commented on Aug 1, 2017

    @wholmgren
    Member

    closed by #339

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions