feedinlib package¶
Submodules¶
feedinlib.models module¶
@author: oemof development group
-
class
feedinlib.models.
Base
(**kwargs)[source]¶ Bases:
abc.ABC
The base class of feedinlib models.
Parameters: required (list of strings, optional) – Containing the names of the required parameters to use the model. -
required
¶ The (names of the) parameters this model requires in order to calculate the feedin.
As this is an abstract property, you have to override it in a subclass so that the model can be instantiated. This forces implementors to make the required parameters for a model explicit, even if they are empty, and gives them a good place to document them.
By default, this property is settable and its value can be specified via and argument on construction. If you want to keep this functionality, simply delegate all calls to the superclass.
-
-
class
feedinlib.models.
PvlibBased
(**kwargs)[source]¶ Bases:
feedinlib.models.Base
Model to determine the output of a photovoltaik module
The calculation is based on the library pvlib. [1]
Parameters: (list of strings, optional) (PvlibBased.required) – List of required parameters of the model Notes
For more information about the photovoltaic model check the documentation of the pvlib library.
https://readthedocs.org/projects/pvlib-python/
References
[1] pvlib on github Examples
>>> from feedinlib import models >>> pv_model = models.PvlibBased()
See also
-
angle_of_incidence
(data, **kwargs)[source]¶ Determine the angle of incidence using the pvlib aoi funktion. [4]
Parameters: - data (pandas.DataFrame) – Containing the timeseries of the azimuth and zenith angle
- tilt (float) – Tilt angle of the pv module (horizontal=0°).
- azimuth (float) – Azimuth angle of the pv module (south=180°).
Returns: Angle of incidence in degrees.
Return type: pandas.Series
See also
References
[4] pvlib angle of incidence.
-
feedin
(**kwargs)[source]¶ Feedin time series for the given pv module.
In contrast to
turbine_power_output
it returns just the feedin series instead of the whole DataFrame.Parameters: see – turbine_power_output
Returns: A time series of the power output for the given pv module. Return type: pandas.Series
-
fetch_module_data
(lib='sandia-modules', **kwargs)[source]¶ Fetch the module data from the Sandia Module library
The file is saved in the ~/.oemof folder and loaded from there to save time and to make it possible to work if the server is down.
Parameters: module_name (string) – Name of a pv module from the sam.nrel database [9]. Returns: The necessary module data for the selected module to use the pvlib sapm pv model. [8] Return type: dictionary Examples
>>> from feedinlib import models >>> pvmodel = models.PvlibBased() >>> name = 'Yingli_YL210__2008__E__' >>> print(pvmodel.fetch_module_data(module_name=name).Area) 1.7
See also
-
get_pv_power_output
(**kwargs)[source]¶ Output of the given pv module. For the theoretical background see the pvlib documentation [11].
Parameters: weather (feedinlib.weather.FeedinWeather object) – Instance of the feedinlib weather object (see class FeedinWeather
for more details)Notes
See
method required
for all required parameters of this model.Returns: The DataFrame contains the following new columns: p_pv_norm, p_pv_norm_area and all timeseries calculated before. Return type: pandas.DataFrame References
[11] pvlib documentation. [12] module library. See also
-
global_in_plane_irradiation
(data, **kwargs)[source]¶ Determine the global irradiaton on the tilted surface.
This method determines the global irradiation in plane knowing the direct and diffuse irradiation, the incident angle and the orientation of the surface. The method uses the pvlib.irradiance.globalinplane function [5] and some other functions of the pvlib.atmosphere [6] and the pvlib.solarposition [2] module to provide the input parameters for the globalinplane function.
Parameters: - data (pandas.DataFrame) – Containing the time index of the location and columns with the following timeseries: (dirhi, dhi, zenith, azimuth, aoi)
- tilt (float) – Tilt angle of the pv module (horizontal=0°).
- azimuth (float) – Azimuth angle of the pv module (south=180°).
- albedo (float) – Albedo factor around the module
Returns: The DataFrame contains the following new columns: poa_global, poa_diffuse, poa_direct
Return type: pandas.DataFrame
References
[5] pvlib globalinplane. [6] pvlib atmosphere. See also
solarposition_hourly_mean()
,solarposition()
,angle_of_incidenc()
-
pv_module_output
(data, **kwargs)[source]¶ Determine the output of pv-system.
Using the pvlib.pvsystem.sapm function of the pvlib [8].
Parameters: - module_name (string) – Name of a pv module from the sam.nrel database [9].
- data (pandas.DataFrame) – Containing the time index of the location and columns with the following timeseries: (temp_air [K], v_wind, poa_global, poa_diffuse, poa_direct, airmass, aoi)
- method (string, optional) – Method to calulate the position of the sun according to the methods provided by the pvlib function (default: ‘ephemeris’) ‘pvlib.solarposition.get_solarposition’. [10]
Returns: The DataFrame contains the following new columns: p_pv_norm, p_pv_norm_area
Return type: pandas.DataFrame
References
[8] (1, 2) pvlib pv-system. [9] (1, 2) module library. [10] pvlib get_solarposition. See also
-
required
¶ The parameters this model requires to calculate a feedin.
In this feedin model the required parameters are:
Modul_name: (string) - name of a pv module from the sam.nrel database [12] Tilt: (float) - tilt angle of the pv module (horizontal=0°) Azimuth: (float) - azimuth angle of the pv module (south=180°) Albedo: (float) - albedo factor arround the module
-
solarposition
(location, data, **kwargs)[source]¶ Determine the position of the sun unsing the time of the time index.
Parameters: - location (pvlib.location.Location) – A pvlib location object containing the longitude, latitude and the timezone of the location
- data (pandas.DataFrame) – Containing the timeseries of the weather data and the time index of the location.
- method (string, optional) – Method to calulate the position of the sun according to the methods provided by the pvlib function (default: ‘ephemeris’) ‘pvlib.solarposition.get_solarposition’. [2]
Returns: The DataFrame contains the following new columns: azimuth, zenith, elevation
Return type: pandas.DataFrame
Notes
This method is not used in favour to solarposition_hourly_mean.
Examples
>>> import pvlib >>> import pandas as pd >>> from feedinlib import models >>> loc = pvlib.location.Location(52, 13, 'Europe/Berlin') >>> pvmodel = models.PvlibBased() >>> data = pd.DataFrame(index=pd.date_range(pd.datetime(2010, 1, 1, 0), ... periods=8760, freq='H', tz=loc.tz)) >>> elevation = pvmodel.solarposition(loc, data).elevation >>> print(round(elevation[12], 3)) 14.968
See also
solarposition_hourly_mean()
- calculates the position of the sun as an hourly mean.
-
solarposition_hourly_mean
(location, data, **kwargs)[source]¶ Determine the position of the sun as an hourly mean of all angles above the horizon.
Parameters: - location (pvlib.location.Location) – A pvlib location object containing the longitude, latitude and the timezone of the location
- data (pandas.DataFrame) – Containing the time index of the location.
- method (string, optional) – Method to calulate the position of the sun according to the methods provided by the pvlib function (default: ‘ephemeris’) ‘pvlib.solarposition.get_solarposition’. [2]
- freq (string, optional) – The time interval to create the hourly mean (default: ‘5Min’).
- pandas.DataFrame – The DataFrame contains the following new columns: azimuth, zenith, elevation
Notes
Combining hourly values for irradiation with discrete values for the position of the sun can lead to unrealistic results. Using hourly values for the position minimizes these errors.
References
[2] (1, 2, 3) pvlib solarposition. See also
solarposition()
- calculates the position of the sun at a given time
-
-
class
feedinlib.models.
SimpleWindTurbine
(**kwargs)[source]¶ Bases:
feedinlib.models.Base
Model to determine the output of a wind turbine
Parameters: required (list of strings) – Containing the names of the required parameters to use the model. Examples
>>> from feedinlib import models >>> required_ls = ['h_hub', 'd_rotor', 'wind_conv_type', 'data_height'] >>> wind_model = models.SimpleWindTurbine(required=required_ls)
See also
-
required
¶ The parameters this model requires to calculate a feedin.
In this feedin model the required parameters are:
H_hub: (float) - Height of the hub of the wind turbine D_rotor: (float) - ‘Diameter of the rotor [m]’, Wind_conv_type: (string) - Name of the wind converter type. Use self.get_wind_pp_types() to see a list of all possible wind converters.
-
feedinlib.powerplants module¶
@author: oemof developing group
Classes in this module correspond to specific types of powerplants.
Powerplant objects act as data holders for the attributes making up a powerplants specification. These objects should only contain little logic. Computing the actual feedin provided by a powerplant is done using it’s model attribute.`
-
class
feedinlib.powerplants.
Base
(**attributes)[source]¶ Bases:
abc.ABC
The base class of feedinlib powerplants.
The most prominent shared functionality between powerplants is the fact that they instantiate their model class upon construction, in order to get a unique model instance for each powerplant instance.
Parameters: - model (A model class or an instance of one) –
If a class (or in general, any instance of
type
) is provided, it is used to create the model instance encapsulating the actual mathematical model used to calculate the feedin provided by this powerplant.In any other case, the provided object is used directly. Note though, that a reference to this powerplant is saved in the provided object, so sharing model instances between two powerplant objects is not a good idea, as the second powerplant will overwrite the reference the reference to the first.
The non-class version is only provided for users who need the extra flexibility of controlling model instantiation and who know what they are doing. In general, you’ll want to provide a class for this parameter or just go with the default for the specific subclass you are using.
- **attributes –
The remaining attributes providing the technical specification of the powerplant. They will be added as regular attributes to this object, with keys as attribute names and initialized to the corresponding values.
An error is raised if the attributes required by the given model are not contained in this hash.
Raises: AttributeError
– in case the attribute listed in the given model’s required attribute are not present in the attributes parameter.See also
feedinlib.models
- for and explanation of the model needed to actually calculate the feedin.
-
feedin
(**kwargs)[source]¶ Calculates the amount of energy fed in by this powerplant into the energy system.
This method delegates the actual computation to the
feedin()
method of this objectsmodel
while giving you the opportunity to override some of the inputs used to calculate the feedin.Parameters: **kwargs – Keyword arguments. If not specified, all the paramters needed to calculate the feedin are taken from this object. If any keyword argument is present whose key matches one of the parameters needed to calculate the feedin, it takes precedence over a matching attribute of this object. Returns: feedin – The feedin provided by this poweplant as a time series represented by a pandas.DataFrame
.Return type: Pandas dataframe
- model (A model class or an instance of one) –
-
class
feedinlib.powerplants.
Photovoltaic
(model=<class 'feedinlib.models.PvlibBased'>, **attributes)[source]¶ Bases:
feedinlib.powerplants.Base
Photovoltaic objects correspond to powerplants using solar power to generate electricity.
Parameters: - model – Used as the model parameter for
Base
. Defaults tofeedinlib.models.PvlibBased
. - **attributes (see
Base
) –
- model – Used as the model parameter for
-
class
feedinlib.powerplants.
WindPowerPlant
(model=<class 'feedinlib.models.SimpleWindTurbine'>, **attributes)[source]¶ Bases:
feedinlib.powerplants.Base
WindPowerPlant objects correspond to powerplants using wind power to generate electricity.
Parameters: - model – Used as the model argument for
Base
. Defaults tofeedinlib.models.SimpleWindTurbine
. - **attributes (See
Base
) –
See also
feedinlib.models
- for and explanation of the model needed to actually calculate the feedin.
- model – Used as the model argument for
feedinlib.weather¶
Created on Fri Oct 9 16:01:02 2015
@author: uwe
-
class
feedinlib.weather.
FeedinWeather
(**kwargs)[source]¶ Bases:
object
Class, containing all meta informations regarding the weather data set.
Parameters: - data (pandas.DataFrame, optional) – Containing the time series of the different parameters as columns
- timezone (string, optional) – Containing the name of the time zone using the naming of the IANA (Internet Assigned Numbers Authority) time zone database [40]
- longitude (float, optional) – Longitude of the location of the weather data
- latitude (float, optional) – Latitude of the location of the weather data
- geometry (shapely.geometry object) – polygon or point representing the zone of the weather data
- data_height (dictionary, optional) – Containing the heights of the weather measurements or weather model in meters with the keys of the data parameter
- name (string) – Name of the weather data object
Notes
Depending on the used feedin modell some of the optional parameters might be mandatory.
References
[40] IANA time zone database. -
read_feedinlib_csv
(filename, overwrite=True)[source]¶ Reading a csv-file with a header containg the meta data of the time series.
The header has to contain the time zone and has to end with a blank line. To add data of the data_height dictionary there should be space between the parameter name and the key name (e.g. # data_height v_wind: 10). Further more any number of parameters can be added.
The file should have the following form:
# timezone= # name: NAME # longitude: xx.xxx # latitude: yy.yyy # timezone: Continent/City # data_height temp_air: zz # data_height v_wind: vv ,temp_air,v_wind,..... 2010-01-01 00:00:00+01:00,267.599,5.32697,... 2010-01-01 01:00:00+01:00,267.596,5.46199,.... ....
Parameters: - filename (string) – The filename with the full path and the suffix of the file.
- overwrite (boolean) – If False the only class attributes of NoneType will be overwritten with the data of the csv file. If True all class attributes will be overwriten with the data of the csv-file.
Raises: FileNotFoundError
– If the file defined by filename can not be found.