Skip to content

update _modelchain_ac_model for multi array inverters #109

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

Closed
wholmgren opened this issue Feb 1, 2021 · 3 comments · Fixed by #124
Closed

update _modelchain_ac_model for multi array inverters #109

wholmgren opened this issue Feb 1, 2021 · 3 comments · Fixed by #124
Labels

Comments

@wholmgren
Copy link
Member

pvlib/pvlib-python#1147 and pvlib/pvlib-python#1150 changed the object oriented api for the new multi-array inverter functions. Now you just pass "sandia" or "pvwatts" and the objects determine which function they should call. So SPI needs to update PVWattsInverterParameters._modelchain_ac_model and SandiaInverterParameters._modelchain_ac_model. The change is available in v0.9.0-alpha.2

@alorenzo175 alorenzo175 added the api label Feb 3, 2021
@alorenzo175
Copy link
Contributor

We'll need to wait for pvlib/pvlib-python#1157 otherwise we'll have to adjust the logic below to not return a list if num_arrays == 1

if weather_granularity == models.WeatherGranularityEnum.system:
data_id = data_id_by_schema_path["/"]
df = _get_data(job_id, data_id, si)
for i in range(num_inverters):
num_arrays = len(job.definition.system_definition.inverters[i].arrays)
yield [df.copy()] * num_arrays
elif weather_granularity == models.WeatherGranularityEnum.inverter:
for i in range(num_inverters):
num_arrays = len(job.definition.system_definition.inverters[i].arrays)
data_id = data_id_by_schema_path[f"/inverters/{i}"]
df = _get_data(job_id, data_id, si)
yield [df] * num_arrays
elif weather_granularity == models.WeatherGranularityEnum.array:
for i in range(num_inverters):
num_arrays = len(job.definition.system_definition.inverters[i].arrays)
data_ids = [
data_id_by_schema_path[f"/inverters/{i}/arrays/{j}"]
for j in range(num_arrays)
]
yield [_get_data(job_id, data_id, si) for data_id in data_ids]
else:
raise ValueError(f"Unknown weather granularity {weather_granularity}")

@wholmgren
Copy link
Member Author

Merged that PR. Do you want an alpha-3 now?

@alorenzo175
Copy link
Contributor

I think there is still the issue raised in #119. I'll try and track it down and raise in pvlib

alorenzo175 added a commit to alorenzo175/solarperformanceinsight that referenced this issue Feb 5, 2021
a4 because pvlib/pvlib-python#1162 is required
along with a tbd issue for computing from effective irradiance

closes SolarPerformanceInsight#119 closes SolarPerformanceInsight#109

also adds real tests of the pvlib modelchain to catch errors there
alorenzo175 added a commit that referenced this issue Feb 8, 2021
* update for pvlib 0.9.0a4

a4 because pvlib/pvlib-python#1162 is required
along with a tbd issue for computing from effective irradiance

closes #119 closes #109

also adds real tests of the pvlib modelchain to catch errors there

* mypy

* test more modelchain configurations

* fix when missing poa global or solar position for from_effective_irr

* make sure poa_global is NaN not None

* use pvlib 0.9.0a4

* comment update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants