|
| 1 | +""" |
| 2 | +Bifacial Modeling - modelchain |
| 3 | +============================== |
| 4 | +
|
| 5 | +Example of bifacial modeling using pvfactors and ModelChain |
| 6 | +""" |
| 7 | + |
| 8 | +# %% |
| 9 | +# This example shows how to complete a bifacial modeling example using the |
| 10 | +# :py:class:`pvlib.modelchain.ModelChain` with the |
| 11 | +# :py:func:`pvlib.bifacial.pvfactors.pvfactors_timeseries` function |
| 12 | +# to transpose GHI data to both front and rear Plane of Array (POA) irradiance. |
| 13 | +# |
| 14 | +# Unfortunately ``ModelChain`` does not yet support bifacial simulation |
| 15 | +# directly so we have to do the bifacial irradiance simulation ourselves. |
| 16 | +# Once the combined front + rear irradiance is known, we can pass that |
| 17 | +# to ``ModelChain`` and proceed as usual. |
| 18 | +# |
| 19 | +# Future versions of pvlib may make it easier to do bifacial modeling |
| 20 | +# with ``ModelChain``. |
| 21 | + |
| 22 | +import pandas as pd |
| 23 | +from pvlib import pvsystem |
| 24 | +from pvlib import location |
| 25 | +from pvlib import modelchain |
| 26 | +from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS as PARAMS |
| 27 | +from pvlib.bifacial.pvfactors import pvfactors_timeseries |
| 28 | +import warnings |
| 29 | + |
| 30 | +# supressing shapely warnings that occur on import of pvfactors |
| 31 | +warnings.filterwarnings(action='ignore', module='pvfactors') |
| 32 | + |
| 33 | +# create site location and times characteristics |
| 34 | +lat, lon = 36.084, -79.817 |
| 35 | +tz = 'Etc/GMT+5' |
| 36 | +times = pd.date_range('2021-06-21', '2021-6-22', freq='1T', tz=tz) |
| 37 | + |
| 38 | +# create site system characteristics |
| 39 | +axis_tilt = 0 |
| 40 | +axis_azimuth = 180 |
| 41 | +gcr = 0.35 |
| 42 | +max_angle = 60 |
| 43 | +pvrow_height = 3 |
| 44 | +pvrow_width = 4 |
| 45 | +albedo = 0.2 |
| 46 | +bifaciality = 0.75 |
| 47 | + |
| 48 | +# load temperature parameters and module/inverter specifications |
| 49 | +temp_model_parameters = PARAMS['sapm']['open_rack_glass_glass'] |
| 50 | +cec_modules = pvsystem.retrieve_sam('CECMod') |
| 51 | +cec_module = cec_modules['Trina_Solar_TSM_300DEG5C_07_II_'] |
| 52 | +cec_inverters = pvsystem.retrieve_sam('cecinverter') |
| 53 | +cec_inverter = cec_inverters['ABB__MICRO_0_25_I_OUTD_US_208__208V_'] |
| 54 | + |
| 55 | +# create a location for site, and get solar position and clearsky data |
| 56 | +site_location = location.Location(lat, lon, tz=tz, name='Greensboro, NC') |
| 57 | +solar_position = site_location.get_solarposition(times) |
| 58 | +cs = site_location.get_clearsky(times) |
| 59 | + |
| 60 | +# load solar position and tracker orientation for use in pvsystem object |
| 61 | +sat_mount = pvsystem.SingleAxisTrackerMount(axis_tilt=axis_tilt, |
| 62 | + axis_azimuth=axis_azimuth, |
| 63 | + max_angle=max_angle, |
| 64 | + backtrack=True, |
| 65 | + gcr=gcr) |
| 66 | + |
| 67 | +# created for use in pvfactors timeseries |
| 68 | +orientation = sat_mount.get_orientation(solar_position['apparent_zenith'], |
| 69 | + solar_position['azimuth']) |
| 70 | + |
| 71 | +# get rear and front side irradiance from pvfactors transposition engine |
| 72 | +# explicity simulate on pvarray with 3 rows, with sensor placed in middle row |
| 73 | +# users may select different values depending on needs |
| 74 | +irrad = pvfactors_timeseries(solar_position['azimuth'], |
| 75 | + solar_position['apparent_zenith'], |
| 76 | + orientation['surface_azimuth'], |
| 77 | + orientation['surface_tilt'], |
| 78 | + axis_azimuth, |
| 79 | + times, |
| 80 | + cs['dni'], |
| 81 | + cs['dhi'], |
| 82 | + gcr, |
| 83 | + pvrow_height, |
| 84 | + pvrow_width, |
| 85 | + albedo, |
| 86 | + n_pvrows=3, |
| 87 | + index_observed_pvrow=1 |
| 88 | + ) |
| 89 | + |
| 90 | +# turn into pandas DataFrame |
| 91 | +irrad = pd.concat(irrad, axis=1) |
| 92 | + |
| 93 | +# create bifacial effective irradiance using aoi-corrected timeseries values |
| 94 | +irrad['effective_irradiance'] = ( |
| 95 | + irrad['total_abs_front'] + (irrad['total_abs_back'] * bifaciality) |
| 96 | +) |
| 97 | + |
| 98 | +# %% |
| 99 | +# With effective irradiance, we can pass data to ModelChain for |
| 100 | +# bifacial simulation. |
| 101 | + |
| 102 | +# dc arrays |
| 103 | +array = pvsystem.Array(mount=sat_mount, |
| 104 | + module_parameters=cec_module, |
| 105 | + temperature_model_parameters=temp_model_parameters) |
| 106 | + |
| 107 | +# create system object |
| 108 | +system = pvsystem.PVSystem(arrays=[array], |
| 109 | + inverter_parameters=cec_inverter) |
| 110 | + |
| 111 | +# ModelChain requires the parameter aoi_loss to have a value. pvfactors |
| 112 | +# applies surface reflection models in the calculation of front and back |
| 113 | +# irradiance, so assign aoi_model='no_loss' to avoid double counting |
| 114 | +# reflections. |
| 115 | +mc_bifi = modelchain.ModelChain(system, site_location, aoi_model='no_loss') |
| 116 | +mc_bifi.run_model_from_effective_irradiance(irrad) |
| 117 | + |
| 118 | +# plot results |
| 119 | +mc_bifi.results.ac.plot(title='Bifacial Simulation on June Solstice', |
| 120 | + ylabel='AC Power') |
0 commit comments