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