@@ -35,6 +35,15 @@ class PVSystem(object):
35
35
See the :py:class:`LocalizedPVSystem` class for an object model that
36
36
describes an installed PV system.
37
37
38
+ The class supports basic system topologies consisting of:
39
+
40
+ * `N` total modules arranged in series
41
+ (`series_modules=N`, `parallel_modules=1`).
42
+ * `M` total modules arranged in parallel
43
+ (`series_modules=1`, `parallel_modules=M`).
44
+ * `NxM` total modules arranged in `M` strings of `N` modules each
45
+ (`series_modules=N`, `parallel_modules=M`).
46
+
38
47
The class is complementary to the module-level functions.
39
48
40
49
The attributes should generally be things that don't change about
@@ -69,6 +78,12 @@ class PVSystem(object):
69
78
module_parameters : None, dict or Series
70
79
Module parameters as defined by the SAPM, CEC, or other.
71
80
81
+ series_modules: int or float
82
+ See system topology discussion above.
83
+
84
+ parallel_modules: int or float
85
+ See system topology discussion above.
86
+
72
87
inverter : None, string
73
88
The model name of the inverters.
74
89
May be used to look up the inverter_parameters dictionary
@@ -95,7 +110,7 @@ def __init__(self,
95
110
surface_tilt = 0 , surface_azimuth = 180 ,
96
111
albedo = None , surface_type = None ,
97
112
module = None , module_parameters = None ,
98
- series_modules = None , parallel_modules = None ,
113
+ series_modules = 1 , parallel_modules = 1 ,
99
114
inverter = None , inverter_parameters = None ,
100
115
racking_model = 'open_rack_cell_glassback' ,
101
116
** kwargs ):
@@ -363,6 +378,27 @@ def snlinverter(self, v_dc, p_dc):
363
378
"""
364
379
return snlinverter (self .inverter_parameters , v_dc , p_dc )
365
380
381
+ def scale_voltage_current_power (self , data ):
382
+ """
383
+ Scales the voltage, current, and power of the DataFrames
384
+ returned by :py:func:`singlediode` and :py:func:`sapm`
385
+ by `self.series_modules` and `self.parallel_modules`.
386
+
387
+ Parameters
388
+ ----------
389
+ data: DataFrame
390
+ Must contain columns `'v_mp', 'v_oc', 'i_mp' ,'i_x', 'i_xx',
391
+ 'i_sc', 'p_mp'`.
392
+
393
+ Returns
394
+ -------
395
+ scaled_data: DataFrame
396
+ A scaled copy of the input data.
397
+ """
398
+
399
+ return scale_voltage_current_power (data , voltage = self .series_modules ,
400
+ current = self .parallel_modules )
401
+
366
402
def localize (self , location = None , latitude = None , longitude = None ,
367
403
** kwargs ):
368
404
"""Creates a LocalizedPVSystem object using this object
@@ -1668,3 +1704,37 @@ def snlinverter(inverter, v_dc, p_dc):
1668
1704
ac_power = ac_power .ix [0 ]
1669
1705
1670
1706
return ac_power
1707
+
1708
+
1709
+ def scale_voltage_current_power (data , voltage = 1 , current = 1 ):
1710
+ """
1711
+ Scales the voltage, current, and power of the DataFrames
1712
+ returned by :py:func:`singlediode` and :py:func:`sapm`.
1713
+
1714
+ Parameters
1715
+ ----------
1716
+ data: DataFrame
1717
+ Must contain columns `'v_mp', 'v_oc', 'i_mp' ,'i_x', 'i_xx',
1718
+ 'i_sc', 'p_mp'`.
1719
+ voltage: numeric
1720
+ The amount by which to multiply the voltages.
1721
+ current: numeric
1722
+ The amount by which to multiply the currents.
1723
+
1724
+ Returns
1725
+ -------
1726
+ scaled_data: DataFrame
1727
+ A scaled copy of the input data.
1728
+ `'p_mp'` is scaled by `voltage * current`.
1729
+ """
1730
+
1731
+ # as written, only works with a DataFrame
1732
+ # could make it work with a dict, but it would be more verbose
1733
+ data = data .copy ()
1734
+ voltages = ['v_mp' , 'v_oc' ]
1735
+ currents = ['i_mp' ,'i_x' , 'i_xx' , 'i_sc' ]
1736
+ data [voltages ] *= voltage
1737
+ data [currents ] *= current
1738
+ data ['p_mp' ] *= voltage * current
1739
+
1740
+ return data
0 commit comments