@@ -1115,17 +1115,17 @@ def i_from_v(resistance_shunt, resistance_series, nNsVth, voltage,
11151115 return I .real
11161116
11171117
1118- def snlinverter (inverter , Vmp , Pmp ):
1118+ def snlinverter (inverter , v_dc , p_dc ):
11191119 '''
11201120 Converts DC power and voltage to AC power using
11211121 Sandia's Grid-Connected PV Inverter model.
11221122
1123- Determine the AC power output of an inverter given the DC voltage, DC
1123+ Determines the AC power output of an inverter given the DC voltage, DC
11241124 power, and appropriate Sandia Grid-Connected Photovoltaic Inverter
1125- Model parameters. The output, ACPower , is clipped at the maximum power
1125+ Model parameters. The output, ac_power , is clipped at the maximum power
11261126 output, and gives a negative power during low-input power conditions,
11271127 but does NOT account for maximum power point tracking voltage windows
1128- nor maximum current or voltage limits on the inverter.
1128+ nor maximum current or voltage limits on the inverter.
11291129
11301130 Parameters
11311131 ----------
@@ -1165,22 +1165,22 @@ def snlinverter(inverter, Vmp, Pmp):
11651165 maintain circuitry required to sense PV array voltage (W)
11661166 ====== ============================================================
11671167
1168- Vdc : float or DataFrame
1168+ v_dc : float or Series
11691169 DC voltages, in volts, which are provided as input to the inverter.
11701170 Vdc must be >= 0.
1171- Pdc : float or DataFrame
1171+ p_dc : float or Series
11721172 A scalar or DataFrame of DC powers, in watts, which are provided
11731173 as input to the inverter. Pdc must be >= 0.
11741174
11751175 Returns
11761176 -------
1177- ACPower : float or DataFrame
1177+ ac_power : float or Series
11781178 Modeled AC power output given the input
1179- DC voltage, Vdc, and input DC power, Pdc. When ACPower would be
1179+ DC voltage, Vdc, and input DC power, Pdc. When ac_power would be
11801180 greater than Pac0, it is set to Pac0 to represent inverter
1181- "clipping". When ACPower would be less than Ps0 (startup power
1182- required), then ACPower is set to -1*abs(Pnt) to represent nightly
1183- power losses. ACPower is not adjusted for maximum power point
1181+ "clipping". When ac_power would be less than Ps0 (startup power
1182+ required), then ac_power is set to -1*abs(Pnt) to represent nightly
1183+ power losses. ac_power is not adjusted for maximum power point
11841184 tracking (MPPT) voltage windows or maximum current limits of the
11851185 inverter.
11861186
@@ -1207,11 +1207,18 @@ def snlinverter(inverter, Vmp, Pmp):
12071207 C3 = inverter ['C3' ]
12081208 Pnt = inverter ['Pnt' ]
12091209
1210- A = Pdco * ((1 + C1 * ((Vmp - Vdco ))))
1211- B = Pso * ((1 + C2 * ((Vmp - Vdco ))))
1212- C = C0 * ((1 + C3 * ((Vmp - Vdco ))))
1213- ACPower = ((Paco / (A - B )) - C * ((A - B )))* ((Pmp - B )) + C * ((Pmp - B ) ** 2 )
1214- ACPower [ACPower > Paco ] = Paco
1215- ACPower [ACPower < Pso ] = - 1.0 * abs (Pnt )
1210+ A = Pdco * (1 + C1 * (v_dc - Vdco ))
1211+ B = Pso * (1 + C2 * (v_dc - Vdco ))
1212+ C = C0 * (1 + C3 * (v_dc - Vdco ))
1213+
1214+ # ensures that function works with scalar or Series input
1215+ p_dc = pd .Series (p_dc )
1216+
1217+ ac_power = ( Paco / (A - B ) - C * (A - B ) ) * (p_dc - B ) + C * ((p_dc - B )** 2 )
1218+ ac_power [ac_power > Paco ] = Paco
1219+ ac_power [ac_power < Pso ] = - 1.0 * abs (Pnt )
1220+
1221+ if len (ac_power ) == 1 :
1222+ ac_power = ac_power .ix [0 ]
12161223
1217- return ACPower
1224+ return ac_power
0 commit comments