optimpv.Diodefits package
Submodules
optimpv.Diodefits.DiodeAgent module
Provides general functionality for Agent objects for non ideal diode simulations
- class optimpv.Diodefits.DiodeAgent.DiodeAgent(params, X, y, T=300, exp_format='light', metric='mse', loss='linear', threshold=100, minimize=True, yerr=None, weight=None, tracking_metric=None, tracking_loss=None, tracking_exp_format=None, tracking_X=None, tracking_y=None, tracking_weight=None, name='diode', use_pvlib=False, **kwargs)[source]
Bases:
BaseAgent
Agent object for non ideal diode simulations with the following formula: J = Jph - J0*[exp(-(V-J*R_series)/(n*Vt*)) - 1] - (V - J*R_series)/R_shunt see optimpv.Diodefits.DiodeModel.py for more details
- Parameters:
params (list of Fitparam() objects) – List of Fitparam() objects.
X (array-like) – 1-D or 2-D array containing the voltage (1st column) and if specified the Gfrac (2nd column) values.
y (array-like) – 1-D array containing the current values.
T (float, optional) – Temperature in K, by default 300.
exp_format (str or list of str, optional) – Format of the experimental data, by default ‘light’.
metric (str or list of str, optional) – Metric to evaluate the model, see optimpv.general.calc_metric for options, by default ‘mse’.
loss (str or list of str, optional) – Loss function to use, see optimpv.general.loss_function for options, by default ‘linear’.
threshold (int or list of int, optional) – Threshold value for the loss function used when doing multi-objective optimization, by default 100.
minimize (bool or list of bool, optional) – If True then minimize the loss function, if False then maximize the loss function (note that if running a fit minize should be True), by default True.
yerr (array-like or list of array-like, optional) – Errors in the current values, by default None.
weight (array-like or list of array-like, optional) – Weights used for fitting if weight is None and yerr is not None, then weight = 1/yerr**2, by default None.
tracking_metric (str or list of str, optional) – Additional metrics to track and report in run_Ax output, by default None.
tracking_loss (str or list of str, optional) – Loss functions to apply to tracking metrics, by default None.
tracking_exp_format (str or list of str, optional) – Experimental formats for tracking metrics, by default None.
tracking_X (array-like or list of array-like, optional) – X values for tracking metrics, by default None.
tracking_y (array-like or list of array-like, optional) – y values for tracking metrics, by default None.
tracking_weight (array-like or list of array-like, optional) – Weights for tracking metrics, by default None.
name (str, optional) – Name of the agent, by default ‘diode’.
use_pvlib (bool, optional) – If True then use the pvlib library to calculate the diode equation, by default False.
**kwargs (dict) – Additional keyword arguments.
optimpv.Diodefits.DiodeModel module
Diode Model
- optimpv.Diodefits.DiodeModel.NonIdealDiode_dark(V, J0, n, R_series, R_shunt, T=300)[source]
Solve non ideal diode equation for dark current
J = J0*[exp(-(V-J*R_series)/(n*Vt*)) - 1] + (V - J*R_series)/R_shunt
Based on the beautiful work of:
Adelmo Ortiz-Conde and Francisco J Garcı́a Sánchez and Juan Muci Solid-State Electronics 44 (2000) 1861-1864, https://doi.org/10.1016/S0038-1101(00)00132-5 see equation (4)-(5)
- Parameters:
V (1-D sequence of floats) – Array containing the voltages.
J0 (float) – Dark Saturation Current.
n (float) – Ideality factor.
R_series (float) – Series resistance.
R_shunt (float) – Shunt resistance.
T (float, optional) – Absolute temperature , by default 300
- Returns:
Array containing the currents.
- Return type:
1-D sequence of floats
- optimpv.Diodefits.DiodeModel.NonIdealDiode_light(V, J0, n, R_series, R_shunt, Jph, T=300)[source]
Solve non ideal diode equation for light current
J = Jph - J0*[exp(-(V-J*R_series)/(n*Vt*)) - 1] - (V - J*R_series)/R_shunt
Based on the beautiful work of:
Amit Jain and Avinashi Kapoor Solar Energy Materials & Solar Cells 81 (2004) 269-277, https://doi.org/10.1016/j.solmat.2003.11.018 see equation (1)-(2)
- Parameters:
V (1-D sequence of floats) – Array containing the voltages.
J0 (float) – Dark Saturation Current.
n (float) – Ideality factor.
R_series (float) – Series resistance.
R_shunt (float) – Shunt resistance.
Jph (float) – Photocurrent.
T (float, optional) – Absolute temperature , by default 300
- Returns:
Array containing the currents.
- Return type:
1-D sequence of floats