8000 Add scale_voltage_current_power to ModelChain.pvwatts_dc by cwhanse · Pull Request #1138 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

Add scale_voltage_current_power to ModelChain.pvwatts_dc #1138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 21, 2021
Prev Previous commit
Next Next commit
improve scale function, fix multiple string test
  • Loading branch information
cwhanse committed Jan 21, 2021
commit fb04b7e3cafddb0d272d373b48172f2681f55dcb
9 changes: 4 additions & 5 deletions pvlib/pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -2651,11 +2651,10 @@ def scale_voltage_current_power(data, voltage=1, current=1):
voltage_keys = ['v_mp', 'v_oc']
current_keys = ['i_mp', 'i_x', 'i_xx', 'i_sc']
power_keys = ['p_mp']
data = data.copy()
data.filter(voltage_keys, axis=1) * voltage
data.filter(current_keys, axis=1) * current
data.filter(power_keys, axis=1) * voltage * current
return data
voltage_df = data.filter(voltage_keys, axis=1) * voltage
current_df = data.filter(current_keys, axis=1) * current
power_df = data.filter(power_keys, axis=1) * voltage * current
return pd.concat([voltage_df, current_df, power_df], axis=1)


def pvwatts_dc(g_poa_effective, temp_cell, pdc0, gamma_pdc, temp_ref=25.):
Expand Down
4 changes: 2 additions & 2 deletions pvlib/tests/test_modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1188,13 +1188,13 @@ def test_pvwatts_dc_multiple_strings(pvwatts_dc_pvwatts_ac_system, location,
aoi_model='no_loss', spectral_model='no_loss')
mc1.run_model(weather)
assert m.call_count == 1
system.modules_per_string = 2
system.arrays[0].modules_per_string = 2
mc2 = ModelChain(system, location,
aoi_model='no_loss', spectral_model='no_loss')
mc2.run_model(weather)
assert isinstance(mc2.results.ac, (pd.Series, pd.DataFrame))
assert not mc2.results.ac.empty
assert np.isclose(mc2.results.dc / mc1.results.dc, 2.0)
assert np.all(np.isclose(mc2.results.dc / mc1.results.dc, 2.0))


def acdc(mc):
Expand Down
0