From e73a4e8ef1afbb1ffa8464a461f5b2089e6f1110 Mon Sep 17 00:00:00 2001 From: Chirag3841 Date: Thu, 11 Dec 2025 21:26:52 +0530 Subject: [PATCH 1/4] Add examples for run_model_from_poa and run_model_from_effective_irradiance --- pvlib/modelchain.py | 88 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index 09e4434e84..4db4140141 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -1713,6 +1713,50 @@ def run_model_from_poa(self, data): of Arrays in the PVSystem. ValueError If the DataFrames in `data` have different indexes. + Examples + -------- + Single-array system: + + >>> import pandas as pd + >>> from pvlib.pvsystem import PVSystem + >>> from pvlib.location import Location + >>> from pvlib.modelchain import ModelChain + >>> + >>> system = PVSystem(module_parameters={'pdc0': 300}) + >>> location = Location(35, -110) + >>> mc = ModelChain(system, location) + >>> + >>> poa = pd.DataFrame({ + ... 'poa_global': [900, 850], + ... 'poa_direct': [600, 560], + ... 'poa_diffuse': [300, 290], + ... }, + ... index=pd.date_range("2021-06-01", periods=2, freq="H")) + >>> + >>> mc.run_model_from_poa(poa) + + + Multi-array system: + + >>> array1 = Array(tilt=30, azimuth=180) + >>> array2 = Array(tilt=10, azimuth=90) + >>> system = PVSystem(arrays=[array1, array2], + ... module_parameters={'pdc0': 300}) + >>> mc = ModelChain(system, location) + >>> poa1 = pd.DataFrame({ + ... 'poa_global': [900, 880], + ... 'poa_direct': [600, 580], + ... 'poa_diffuse': [300, 300], + ... }, + ... index=pd.date_range("2021-06-01", periods=2, freq="H")) + >>> poa2 = pd.DataFrame({ + ... 'poa_global': [700, 720], + ... 'poa_direct': [400, 420], + ... 'poa_diffuse': [300, 300], + ... }, + ... index=poa1.index) + >>> mc.run_model_from_poa([poa1, poa2]) + Notes ----- @@ -1798,6 +1842,50 @@ def run_model_from_effective_irradiance(self, data): of Arrays in the PVSystem. ValueError If the DataFrames in `data` have different indexes. + Examples + -------- + Single-array system: + + >>> import pandas as pd + >>> from pvlib.pvsystem import PVSystem + >>> from pvlib.location import Location + >>> from pvlib.modelchain import ModelChain + >>> + >>> system = PVSystem(module_parameters={'pdc0': 300}) + >>> location = Location(35, -110) + >>> mc = ModelChain(system, location) + >>> + >>> eff = pd.DataFrame({ + ... 'effective_irradiance': [900, 920], + ... 'temp_air': [25, 24], + ... 'wind_speed': [2.0, 1.5], + ... }, + ... index=pd.date_range("2021-06-01", periods=2, freq="H")) + >>> + >>> mc.run_model_from_effective_irradiance(eff) + + + Multi-array system: + + >>> array1 = Array(tilt=30, azimuth=180) + >>> array2 = Array(tilt=10, azimuth=90) + >>> system = PVSystem(arrays=[array1, array2], + ... module_parameters={'pdc0': 300}) + >>> mc = ModelChain(system, location) + >>> eff1 = pd.DataFrame({ + ... 'effective_irradiance': [900, 920], + ... 'temp_air': [25, 24], + ... 'wind_speed': [2.0, 1.5], + ... }, + ... index=pd.date_range("2021-06-01", periods=2, freq="H")) + >>> eff2 = pd.DataFrame({ + ... 'effective_irradiance': [600, 630], + ... 'temp_air': [26, 25], + ... 'wind_speed': [1.8, 1.2], + ... }, + ... index=eff1.index) + >>> mc.run_model_from_effective_irradiance([eff1, eff2]) + Notes ----- From b0aaaa18c6d68df1b4a832b0fb083549a2687a47 Mon Sep 17 00:00:00 2001 From: Chirag3841 <160767827+Chirag3841@users.noreply.github.com> Date: Thu, 11 Dec 2025 23:37:37 +0530 Subject: [PATCH 2/4] Update pvlib/modelchain.py Co-authored-by: Cliff Hansen --- pvlib/modelchain.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index 4db4140141..53ea00803f 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -1842,7 +1842,8 @@ def run_model_from_effective_irradiance(self, data): of Arrays in the PVSystem. ValueError If the DataFrames in `data` have different indexes. - Examples + + Examples -------- Single-array system: From 94a7864d54da1e09d83a002b0d8252e864cdedb4 Mon Sep 17 00:00:00 2001 From: Chirag3841 Date: Fri, 12 Dec 2025 10:16:15 +0530 Subject: [PATCH 3/4] Fix lint errors (W291 trailing whitespace) --- pvlib/modelchain.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index 53ea00803f..0f5b0b9d69 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -1842,7 +1842,6 @@ def run_model_from_effective_irradiance(self, data): of Arrays in the PVSystem. ValueError If the DataFrames in `data` have different indexes. - Examples -------- Single-array system: @@ -1867,7 +1866,7 @@ def run_model_from_effective_irradiance(self, data): Multi-array system: - + >>> array1 = Array(tilt=30, azimuth=180) >>> array2 = Array(tilt=10, azimuth=90) >>> system = PVSystem(arrays=[array1, array2], From 8e54b17b7b8e03243c65a76c043db1428ec1e956 Mon Sep 17 00:00:00 2001 From: Chirag3841 Date: Fri, 12 Dec 2025 10:44:02 +0530 Subject: [PATCH 4/4] Fix lint errors (W291/W293) in modelchain.py --- pvlib/modelchain.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index 0f5b0b9d69..25ca2fd5d8 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -1730,7 +1730,7 @@ def run_model_from_poa(self, data): ... 'poa_global': [900, 850], ... 'poa_direct': [600, 560], ... 'poa_diffuse': [300, 290], - ... }, + ... }, ... index=pd.date_range("2021-06-01", periods=2, freq="H")) >>> >>> mc.run_model_from_poa(poa) @@ -1845,7 +1845,6 @@ def run_model_from_effective_irradiance(self, data): Examples -------- Single-array system: - >>> import pandas as pd >>> from pvlib.pvsystem import PVSystem >>> from pvlib.location import Location @@ -1866,7 +1865,6 @@ def run_model_from_effective_irradiance(self, data): Multi-array system: - >>> array1 = Array(tilt=30, azimuth=180) >>> array2 = Array(tilt=10, azimuth=90) >>> system = PVSystem(arrays=[array1, array2],