Skip to content

Commit

Permalink
Merge branch 'master' of github.com:oemof/feedinlib
Browse files Browse the repository at this point in the history
  • Loading branch information
uvchik committed Oct 2, 2015
2 parents 829d8ba + 1616b02 commit 94463f3
Showing 1 changed file with 16 additions and 113 deletions.
129 changes: 16 additions & 113 deletions feedinlib/powerplants.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, model=models.Photovoltaic([]), **attributes):
Defaults to an instance of :class:`feedinlib.models.Photovoltaic`
with no requirements on the attributes needed to calculate the
feedin.
\**attributes : hash
**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
Expand Down Expand Up @@ -60,127 +60,30 @@ def feedin_as_list(self, **kwargs):

def feedin(self, **kwargs):
r"""
Unless you override the default model, the following attributes are
required:
blablab...
Calculates the amount of energy fed in by this powerplant into the
energy system.
Should you opt to override the default model, the model parameter
is expected to have a property called 'required' containing a list
of parameters required for the model to calculate the feed.
Calculating the powerplants feed then calls into the model with the
given parameters.
This method delegates the actual computation to the :meth:`feedin`
method of this objects :attr:`model` while giving you the opportunity
to override some of the inputs used to calculate the feedin.
Parameters
----------
var1 : array_like
Array_like means all those objects -- lists, nested lists, etc. --
that can be converted to an array. We can also refer to
variables like `var1`.
var2 : int
The type above can either refer to an actual Python type
(e.g. ``int``), or describe the type of the variable in more
detail, e.g. ``(N,) ndarray`` or ``array_like``.
Long_variable_name : {'hi', 'ho'}, optional
Choices in brackets, default first when optional.
main_dt : dictionary
Main dictionary as described below [41]_
prob : pulp.lp-problem
LP-Problem-Variable, which contains the linear problem [42]_
**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
-------
type
Explanation of anonymous return value of type ``type``.
describe : type
Explanation of return value named `describe`.
out : type
Explanation of `out`.
Other Parameters
----------------
only_seldom_used_keywords : type
Explanation
common_parameters_listed_above : type
Explanation
Timesteps [t] : main_dt['timesteps']
np-array with the timesteps according to the timeseries
Regions [r] : main_dt['energy_system']['regions']
See: solph.extenddc [4]_
Electric demand : main_dt['timeseries']['demand'][r]['lele'][t]
r = region, t = timesteps
main_dt['energy_system'] : dict-branch with lists of components
Definition of the 'energy_system' see: :py:mod:`solph.extenddc`
main_dt['lp'] : dict-branch with all lp-variables
Definition of lp-variables see: :py:mod:`solph.lp_definition`
Raises
------
BadException
Because you shouldn't have done that.
See Also
--------
otherfunc : relationship (optional)
newfunc : Relationship (optional), which could be fairly long, in which
case the line wraps here.
thirdfunc, fourthfunc, fifthfunc
solph.main_model.create_model_equations : Blubber
Notes
-----
Notes about the implementation algorithm (if needed).
This can have multiple paragraphs.
You may include some math:
.. math:: X(e^{j\omega } ) = x(n)e^{ - j\omega n}
feedin : Pandas dataframe
The feedin provided by this poweplant as a time series represented
by a :py:class:`pandas.DataFrame`.
And even use a greek symbol like :math:`omega` inline.
References
----------
Cite the relevant literature, e.g. [43]_. You may also cite these
references in the notes section above.
.. [41] Link to the description of the main_dt for solph.
.. [42] `PuLP <https://code.google.com/p/pulp-or/>`_, PuLP Docu.
.. [43] O. McNoleg, "The integration of GIS, remote sensing,
expert systems and adaptive co-kriging for environmental habitat
modelling of the Highland Haggis using object-oriented, fuzzy-logic
and neural-network techniques," Computers & Geosciences, vol. 22,
pp. 585-588, 1996.
Examples
--------
These are written in doctest format, and should illustrate how to
use the function.
>>> a=[1,2,3]
>>> print([x + 3 for x in a])
[4, 5, 6]
>>> print("a\nb")
a
b
.. code:: python
#!/usr/bin/python
# -*- coding: utf-8
def pg_db():
local_dict = {
'ip': 'localhost_or_ip',
'port': '5432',
'db': 'name_of_db',
'user': 'username',
'password': 'password'}
return local_dict
"""
# TODO: add docstring documenting the attribute overriding behaviour
# of this function.
# TODO: Document semantics of special keyword arguments.
combined = {k: getattr(self, k) for k in self.model.required}
combined.update(kwargs)
if kwargs.get('number', None) is not None:
Expand Down

0 comments on commit 94463f3

Please sign in to comment.