Exemple #1
0
    def calcparams_pvsyst(self, effective_irradiance, temp_cell):
        """
        Use the :py:func:`pvsystem.calcparams_pvsyst` function, the input
        parameters and ``self.module_parameters`` to calculate the
        module currents and resistances.

        Parameters
        ----------
        effective_irradiance : numeric
            The irradiance (W/m2) that is converted to photocurrent.

        temp_cell : float or Series
            The average cell temperature of cells within a module in C.

        Returns
        -------
        See pvsystem.calcparams_pvsyst for details
        """

        kwargs = _build_kwargs([
            'gamma_ref', 'mu_gamma', 'I_L_ref', 'I_o_ref', 'R_sh_ref',
            'R_sh_0', 'R_sh_exp', 'R_s', 'alpha_sc', 'EgRef', 'irrad_ref',
            'temp_ref', 'cells_in_series'
        ], self.module_parameters)

        return pvsystem.calcparams_pvsyst(effective_irradiance, temp_cell,
                                          **kwargs)
Exemple #2
0
    def pvsyst_celltemp(self, poa_global, temp_air, wind_speed=1.0):
        """
        Uses :py:func:`pvsystem.pvsyst_celltemp` to calculate module
        temperatures based on ``self.racking_model`` and the input parameters.

        Parameters
        ----------
        See pvsystem.pvsyst_celltemp for details

        Returns
        -------
        See pvsystem.pvsyst_celltemp for details
        """

        kwargs = _build_kwargs(['eta_m', 'alpha_absorption'],
                               self.module_parameters)
        kwargs.update(
            _build_kwargs(['u_c', 'u_v'], self.temperature_model_parameters))

        return pvlib.temperature.pvsyst_cell(poa_global, temp_air, wind_speed,
                                             **kwargs)
Exemple #3
0
    def pvsyst_celltemp(self, poa_flatplate_static, temp_air, wind_speed=1.0):
        """
        Uses :py:func:`pvsystem.pvsyst_celltemp` to calculate module
        temperatures based on ``self.racking_model`` and the input parameters.

        Parameters
        ----------
        See pvsystem.pvsyst_celltemp for details

        Returns
        -------
        See pvsystem.pvsyst_celltemp for details
        """

        kwargs = _build_kwargs(['eta_m', 'alpha_absorption'],
                               self.module_parameters)

        return pvlib.pvsystem.pvsyst_celltemp(poa_flatplate_static,
                                              temp_air,
                                              wind_speed,
                                              model_params=self.racking_model,
                                              **kwargs)
    def prepare_inputs(self, weather):
        """
        Prepare the solar position, irradiance, and weather inputs to
        the model.

        Parameters
        ----------
        weather : DataFrame
            Column names must be ``'dni'``, ``'ghi'``, ``'dhi'``,
            ``'wind_speed'``, ``'temp_air'``. All irradiance components
            are required. Air temperature of 20 C and wind speed
            of 0 m/s will be added to the DataFrame if not provided.

        Notes
        -----
        Assigns attributes: ``solar_position``, ``airmass``,
        ``total_irrad``, ``aoi``

        See also
        --------
        ModelChain.complete_irradiance
        """

        if not {'ghi', 'dni', 'dhi'} <= set(weather.columns):
            raise ValueError(
                "Uncompleted irradiance data set. Please check your input "
                "data.\nData set needs to have 'dni', 'dhi' and 'ghi'.\n"
                "Detected data: {0}".format(list(weather.columns)))

        self.weather = weather

        self.times = self.weather.index
        try:
            kwargs = _build_kwargs(['pressure', 'temp_air'], weather)
            kwargs['temperature'] = kwargs.pop('temp_air')
        except KeyError:
            pass

        self.solar_position = self.location.get_solarposition(
            self.weather.index, method=self.solar_position_method, **kwargs)

        self.airmass = self.location.get_airmass(
            solar_position=self.solar_position, model=self.airmass_model)

        # PVSystem.get_irradiance and SingleAxisTracker.get_irradiance
        # and PVSystem.get_aoi and SingleAxisTracker.get_aoi
        # have different method signatures. Use partial to handle
        # the differences.
        if isinstance(self.system, SingleAxisTracker):
            self.tracking = self.system.singleaxis(
                self.solar_position['apparent_zenith'],
                self.solar_position['azimuth'])
            self.tracking['surface_tilt'] = (
                self.tracking['surface_tilt'].fillna(self.system.axis_tilt))
            self.tracking['surface_azimuth'] = (
                self.tracking['surface_azimuth'].fillna(
                    self.system.axis_azimuth))
            self.aoi = self.tracking['aoi']
            get_irradiance = partial(self.system.get_irradiance,
                                     self.tracking['surface_tilt'],
                                     self.tracking['surface_azimuth'],
                                     self.solar_position['apparent_zenith'],
                                     self.solar_position['azimuth'])
        else:
            self.aoi = self.system.get_aoi(
                self.solar_position['apparent_zenith'],
                self.solar_position['azimuth'])
            get_irradiance = partial(self.system.get_irradiance,
                                     self.solar_position['apparent_zenith'],
                                     self.solar_position['azimuth'])

        self.total_irrad = get_irradiance(
            self.weather['dni'],
            self.weather['ghi'],
            self.weather['dhi'],
            airmass=self.airmass['airmass_relative'],
            model=self.transposition_model)

        if self.weather.get('wind_speed') is None:
            self.weather['wind_speed'] = 0
        if self.weather.get('temp_air') is None:
            self.weather['temp_air'] = 20
        return self
def test_build_kwargs(keys, input_dict, expected):
    kwargs = tools._build_kwargs(keys, input_dict)
    assert kwargs == expected
Exemple #6
0
def test_build_kwargs(keys, input_dict, expected):
    kwargs = tools._build_kwargs(keys, input_dict)
    assert kwargs == expected