"""
The pv module contains custom methods for PV applications.
"""
import pandas as pd
from pecos.metrics import time_integral
import logging
logger = logging.getLogger(__name__)
[docs]def insolation(G, tfilter=None):
"""
Compute insolation defined as:
:math:`H=\int{Gdt}`
where
:math:`G` is irradiance and
:math:`dt` is the time step between observations.
The time integral is computed using the trapezoidal rule.
Results are given in [irradiance units]*seconds.
Parameters
-----------
G : pandas DataFrame
Irradiance time series
tfilter : pandas Series, optional
Time filter containing boolean values for each time index
Returns
-------
pandas Series
Insolation
"""
H = time_integral(G, tfilter=tfilter)
return H
[docs]def energy(P, tfilter=None):
"""
Convert energy defined as:
:math:`E=\int{Pdt}`
where
:math:`P` is power and
:math:`dt` is the time step between observations.
The time integral is computed using the trapezoidal rule.
Results are given in [power units]*seconds.
Parameters
-----------
P : pandas DataFrame
Power time series
tfilter : pandas Series, optional
Time filter containing boolean values for each time index
Returns
-------
pandas Series
Energy
"""
E = time_integral(P, tfilter=tfilter)
return E
[docs]def normalized_current(I, G_poa, I_sco, G_ref=1000):
"""
Compute normalized current defined as:
:math:`NI = \dfrac{\dfrac{I}{I_{sco}}}{\dfrac{G_{poa}}{G_{ref}}}`
where
:math:`I` is current,
:math:`I_{sco}` is the short circuit current at STC conditions,
:math:`G_{poa}` is the plane-of-array irradiance, and
:math:`G_{ref}` is the reference irradiance.
Parameters
-----------
I : pandas Series or float
Current
G_poa : pandas Series or float
Plane of array irradiance
I_sco : float
Short circuit current at STC conditions
G_ref : float, optional
Reference irradiance, default = 1000
Returns
-------
pandas Series or float
Normalized current in a pandas Series (if I or G_poa are Series) or
float (if I and G_poa are floats)
"""
N = I/I_sco
D = G_poa/G_ref
NI = N/D
return NI
[docs]def normalized_efficiency(P, G_poa, P_ref, G_ref=1000):
"""
Compute normalized efficiency defined as:
:math:`NE = \dfrac{\dfrac{P}{P_{ref}}}{\dfrac{G_{poa}}{G_{ref}}}`
where
:math:`P` is the observed power (AC or DC),
:math:`P_{ref}` is the DC power rating at STC conditions,
:math:`G_{poa}` is the plane-of-array irradiance, and
:math:`G_{ref}` is the reference irradiance.
Parameters
-----------
P : pandas Series or float
Power (AC or DC)
G_poa : pandas Series or float
Plane of array irradiance
P_ref : float
DC power rating at STC conditions
G_ref : float, optional
Reference irradiance, default = 1000
Returns
-------
pandas Series or float
Normalized efficiency in a pandas Series (if P or G_poa are Series) or
float (if P and G_poa are floats)
"""
Yf = P/P_ref
Yr = G_poa/G_ref
NE = Yf/Yr
return NE
[docs]def energy_yield(E, P_ref):
"""
Compute energy yield is defined as:
:math:`EY=\dfrac{E}{P_{ref}}`
where
:math:`E` is the observed energy from a PV system and
:math:`P_{ref}` is the DC power rating of the system at STC conditions.
Parameters
-----------
E : pandas Series or float
Observed energy
P_ref : float
DC power rating at STC conditions
Returns
---------
pandas Series or float
Energy yield
"""
EY = E/P_ref
return EY
[docs]def clearness_index(H_dn, H_ea):
"""
Compute clearness index defined as:
:math:`Kt=\dfrac{H_{dn}}{H_{ea}}`
where
:math:`H_{dn}` is the direct-normal insolation (kWh/m2)
:math:`H_{ea}` is the extraterrestrial insolation (kWh/m2)
over the same time frame.
Extraterrestrial irradiation can be computed using ``pvlib.irradiance.extraradiation``.
Irradiation can be converted to insolation using ``pecos.pv.insolation``.
Parameters
-----------
H_dn : pandas Series or float
Direct normal insolation
H_ea : pandas Series or float
Extraterrestrial insolation
Returns
-------
pandas Series or float
Clearness index in a pandas Series (if H_dn or H_ea are Series) or
float (if H_dn and H_ea are floats)
"""
Kt = H_dn/H_ea
return Kt