You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support list of weather input for ModelChain with a single-array PVSystem (#1157)
* Add tests covering singleton input to ModelChain entry points
Covers passing a length-one list of weather DataFrames to each of
- `ModelChain.run_model()`
- `ModelChain.run_model_from_poa()`
- `ModelChain.run_model_from_effective_irradiance()`
When the PVSystem being modeled has only one Array. In this case
the output stored in each field of `ModelChain.results` should be
a length-one tuple.
* Support tuple input to PVSystem.get_ac for single-array systems
Allow p_dc and v_dc to be length-1 tuples even when the system has
only one Array. This helps keep the API consistent so that if the
dc power methods are called with `unwrap=False` their output can be
passed directly to `PVSystem.get_ac()`.
* Add ModelChain._assign_result() method
This method is responsible for ensuring that per-array results match
the type of ModelChain.weather. This is an issue when
ModelChain.system has only one Array, but ModelChain.weather is a
tuple of length 1. In this case we want the results attributes to also
be length-1 tuples for the sake of consistency and to ensure that
calculations down-stream can proceed without needing to worry about
mixed types (e.g. total_irrad is a Series, but weather is a tuple).
* Clean up whitespace in test_modelchain.py
Accidentally under-indented a whole test:
test_run_model_from_poa_singleton_weather_single_array()
* Support singleton weather input for ModelChain with spectral loss
Add tests for spectral_model != 'no_loss' and aoi_model != 'no_loss'
when calling ModelChain.run_model([weather]) on a system with 1 Array.
Handles the type of ModelChain.weather correctly in
ModelChain.first_solar_spectral_loss() by using _tuple_from_dfs() to
get 'precipitable_water'.
Still needs support for constant spectral loss
* PVSystem.first_solar_spectral_loss() validates `pw` param against
Extends `PVSystem.first_solar_spectral_loss()` to treat `pw` as a
per-Array or system wide parameter.
* Use itertools.starmap in in PVSystem.first_solar_spectral_loss()
A bit cleaner than using a generator expression.
* Refactor: replace _assign_result() with ModelChainResult.__setattr__
Add a configuration step in ModelChain._assign_weather() that
sets a flag on the ModelChain.results to indicate whether non-tuples
assigned to per-array fields should be wrapped in length-1 tuples.
This is accomplished by a custom __setattr__ methon on
ModelChainResult. The setter checks whether the attribute is a
per-array attribute and coerces it if the _singleton_tuples flag
is set.
* Add float to the type for ModelChainResult.aoi_modifier
Covers the case where the aoi_model is 'no_loss'.
* Tidy up ModelChainResult
Re-order fields and comments. Add docstring to _result_type()
method.
0 commit comments