@@ -1550,23 +1550,23 @@ def singlediode(photocurrent, saturation_current, resistance_series,
1550
1550
1551
1551
Parameters
1552
1552
----------
1553
- photocurrent : float or Series
1553
+ photocurrent : numeric
1554
1554
Light-generated current (photocurrent) in amperes under desired
1555
1555
IV curve conditions. Often abbreviated ``I_L``.
1556
1556
1557
- saturation_current : float or Series
1557
+ saturation_current : numeric
1558
1558
Diode saturation current in amperes under desired IV curve
1559
1559
conditions. Often abbreviated ``I_0``.
1560
1560
1561
- resistance_series : float or Series
1561
+ resistance_series : numeric
1562
1562
Series resistance in ohms under desired IV curve conditions.
1563
1563
Often abbreviated ``Rs``.
1564
1564
1565
- resistance_shunt : float or Series
1565
+ resistance_shunt : numeric
1566
1566
Shunt resistance in ohms under desired IV curve conditions.
1567
1567
Often abbreviated ``Rsh``.
1568
1568
1569
- nNsVth : float or Series
1569
+ nNsVth : numeric
1570
1570
The product of three components. 1) The usual diode ideal factor
1571
1571
(n), 2) the number of cells in series (Ns), and 3) the cell
1572
1572
thermal voltage under the desired IV curve conditions (Vth). The
@@ -1581,22 +1581,29 @@ def singlediode(photocurrent, saturation_current, resistance_series,
1581
1581
1582
1582
Returns
1583
1583
-------
1584
- If photocurrent is a Series and ivcurve_pnts is None, a DataFrame
1585
- with the columns described below. All columns have the same number
1586
- of rows as the largest input DataFrame.
1587
-
1588
- If photocurrent is a scalar or ivcurve_pnts is not None, an
1589
- OrderedDict with the following keys.
1590
-
1591
- * i_sc - short circuit current in amperes.
1592
- * v_oc - open circuit voltage in volts.
1593
- * i_mp - current at maximum power point in amperes.
1594
- * v_mp - voltage at maximum power point in volts.
1595
- * p_mp - power at maximum power point in watts.
1596
- * i_x - current, in amperes, at ``v = 0.5*v_oc``.
1597
- * i_xx - current, in amperes, at ``V = 0.5*(v_oc+v_mp)``.
1598
- * i - None or iv curve current.
1599
- * v - None or iv curve voltage.
1584
+ OrderedDict or DataFrame
1585
+
1586
+ The returned dict-like object always contains the keys/columns:
1587
+
1588
+ * i_sc - short circuit current in amperes.
1589
+ * v_oc - open circuit voltage in volts.
1590
+ * i_mp - current at maximum power point in amperes.
1591
+ * v_mp - voltage at maximum power point in volts.
1592
+ * p_mp - power at maximum power point in watts.
1593
+ * i_x - current, in amperes, at ``v = 0.5*v_oc``.
1594
+ * i_xx - current, in amperes, at ``V = 0.5*(v_oc+v_mp)``.
1595
+
1596
+ If ivcurve_pnts is greater than 0, the output dictionary will also
1597
+ include the keys:
1598
+
1599
+ * i - IV curve current in amperes.
1600
+ * v - IV curve voltage in volts.
1601
+
1602
+ The output will be an OrderedDict if photocurrent is a scalar,
1603
+ array, or ivcurve_pnts is not None.
1604
+
1605
+ The output will be a DataFrame if photocurrent is a Series and
1606
+ ivcurve_pnts is None.
1600
1607
1601
1608
Notes
1602
1609
-----
@@ -1650,27 +1657,24 @@ def singlediode(photocurrent, saturation_current, resistance_series,
1650
1657
i_xx = i_from_v (resistance_shunt , resistance_series , nNsVth ,
1651
1658
0.5 * (v_oc + v_mp ), saturation_current , photocurrent )
1652
1659
1653
- # create ivcurve
1654
- if ivcurve_pnts :
1655
- ivcurve_v = (np .asarray (v_oc )[..., np .newaxis ] *
1656
- np .linspace (0 , 1 , ivcurve_pnts ))
1657
- ivcurve_i = i_from_v (
1658
- resistance_shunt , resistance_series , nNsVth , ivcurve_v .T ,
1659
- saturation_current , photocurrent ).T
1660
- else :
1661
- ivcurve_v = None
1662
- ivcurve_i = None
1663
-
1664
1660
out = OrderedDict ()
1665
1661
out ['i_sc' ] = i_sc
1666
- out ['i_mp' ] = i_mp
1667
1662
out ['v_oc' ] = v_oc
1663
+ out ['i_mp' ] = i_mp
1668
1664
out ['v_mp' ] = v_mp
1669
1665
out ['p_mp' ] = p_mp
1670
1666
out ['i_x' ] = i_x
1671
1667
out ['i_xx' ] = i_xx
1672
- out ['i' ] = ivcurve_i
1673
- out ['v' ] = ivcurve_v
1668
+
1669
+ # create ivcurve
1670
+ if ivcurve_pnts :
1671
+ ivcurve_v = (np .asarray (v_oc )[..., np .newaxis ] *
1672
+ np .linspace (0 , 1 , ivcurve_pnts ))
1673
+ ivcurve_i = i_from_v (
1674
+ resistance_shunt , resistance_series , nNsVth , ivcurve_v .T ,
1675
+ saturation_current , photocurrent ).T
1676
+ out ['v' ] = ivcurve_v
1677
+ out ['i' ] = ivcurve_i
1674
1678
1675
1679
if isinstance (photocurrent , pd .Series ) and not ivcurve_pnts :
1676
1680
out = pd .DataFrame (out , index = photocurrent .index )
0 commit comments