@@ -1115,17 +1115,17 @@ def i_from_v(resistance_shunt, resistance_series, nNsVth, voltage,
1115
1115
return I .real
1116
1116
1117
1117
1118
- def snlinverter (inverter , Vmp , Pmp ):
1118
+ def snlinverter (inverter , v_dc , p_dc ):
1119
1119
'''
1120
1120
Converts DC power and voltage to AC power using
1121
1121
Sandia's Grid-Connected PV Inverter model.
1122
1122
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
1124
1124
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
1126
1126
output, and gives a negative power during low-input power conditions,
1127
1127
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.
1129
1129
1130
1130
Parameters
1131
1131
----------
@@ -1165,22 +1165,22 @@ def snlinverter(inverter, Vmp, Pmp):
1165
1165
maintain circuitry required to sense PV array voltage (W)
1166
1166
====== ============================================================
1167
1167
1168
- Vdc : float or DataFrame
1168
+ v_dc : float or Series
1169
1169
DC voltages, in volts, which are provided as input to the inverter.
1170
1170
Vdc must be >= 0.
1171
- Pdc : float or DataFrame
1171
+ p_dc : float or Series
1172
1172
A scalar or DataFrame of DC powers, in watts, which are provided
1173
1173
as input to the inverter. Pdc must be >= 0.
1174
1174
1175
1175
Returns
1176
1176
-------
1177
- ACPower : float or DataFrame
1177
+ ac_power : float or Series
1178
1178
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
1180
1180
greater than Pac0, it is set to Pac0 to represent inverter
1181
- "clipping". When ACPower would be less
8000
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
1184
1184
tracking (MPPT) voltage windows or maximum current limits of the
1185
1185
inverter.
1186
1186
@@ -1207,11 +1207,18 @@ def snlinverter(inverter, Vmp, Pmp):
1207
1207
C3 = inverter ['C3' ]
1208
1208
Pnt = inverter ['Pnt' ]
1209
1209
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 ]
1216
1223
1217
- return ACPower
1224
+ return ac_power
0 commit comments