-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Martinez shading factor #2070
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
Martinez shading factor #2070
Changes from 192 commits
c87885c
4fc6cd8
2a72f33
d6e8067
13a56d4
f012aae
6dd9a3b
e8743db
6030774
6276382
509699f
5ff8fd8
04126e0
607a246
240b551
997def6
7912055
f068e3e
a5f4a85
a854e27
2d82375
5f24721
049a8cc
a3185df
b9f1a76
f7d1d80
1880f6a
d9f242a
379ca95
62e99ad
4f584ea
238d123
98a254d
4616175
33ffd28
8526bc6
bde3656
51e3750
35738a4
8d679c3
4a907c1
234288d
fb0e5d1
aa4b6e8
18b2187
4163a72
1ebf8ea
de2144f
6aa43f0
c34a2f6
6b9f478
c3a9569
4bb02ab
78c481e
0ce0d68
74b4215
909cc23
e3e73f6
cbb0b04
96b61a8
d2b9291
7ec4d64
bbc6115
39a3ba9
a3ccf3e
e5fffca
457d4b4
f11858e
f321cc1
0ab3720
e6da6e8
4ce1655
60b7e2e
2d23cb2
78a451c
28128f6
f4acf39
104d185
894ff9f
f147881
4d11294
69c76cf
758f5e7
6882dfa
4ef4567
574a1a2
efac0b3
3a726b8
300b912
497a62e
2a34f43
c1b3978
db8edd6
d65e64d
51a2dfa
9038097
5652801
31affba
80ab494
facde21
5a807b7
25a0f19
8bdd469
a2e8be7
9f1fa97
37ab496
6303583
e785292
9b98d9e
3726e4d
4e7e36f
59465c8
9fa2bb4
1be1d3e
0d521ee
f01bd6f
28f8bb4
6d1755e
60030ca
6dcb517
55b89bc
fd4eded
b640c24
ba15ab1
beee0f1
56a4f46
7a57310
adf6dcc
ec717a9
a357c11
de46cc0
1d5a9e6
cdb50ba
d697e76
bc8598e
6153c46
bc79bb8
74e1e44
76eb1ca
6db8f7c
8db5e55
b4d255b
5e0677c
2e52cf9
847ae5c
19734dc
da32fd3
cc7ce5d
15ec5c4
610fd97
d6430bb
161f828
bccd3da
0f2fb31
48be1c8
6f2ed39
9d5c918
c54020a
6116c64
b20b9cc
9b84ed5
b20c535
820ffbf
46df544
d3343a5
d7a5cad
6e030aa
b0b4e7c
dee5d49
14fe993
94c2d23
e70090f
69e6771
dc4fbc0
b071ba4
5cd4f9b
192a039
91862f5
c444639
48a9004
e4076f7
9da4834
6ef91b8
37d4ca0
329fe23
cf9acec
8180654
874c0a4
46cedd8
954b05f
00f1eff
ec3931f
8ed87b6
da0b75d
95769bf
8841020
9483fda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,276 @@ | ||
| """ | ||
| Modelling shading losses in modules with bypass diodes | ||
| ====================================================== | ||
| """ | ||
|
|
||
| # %% | ||
| # This example illustrates how to use the model proposed by Martinez et al. | ||
| # [1]_. The model proposes a power output losses factor by adjusting | ||
| # the incident direct and circumsolar beam irradiance fraction of a PV module | ||
| # based on the number of shaded *blocks*. A *block* is defined as a group of | ||
| # cells protected by a bypass diode. More information on *blocks* can be found | ||
| # in the original paper [1]_ and in the | ||
| # :py:func:`pvlib.shading.direct_martinez` documentation. | ||
| # | ||
| # The following key functions are used in this example: | ||
| # | ||
| # 1. :py:func:`pvlib.shading.direct_martinez` to calculate the power output | ||
| # losses fraction due to shading. | ||
| # 2. :py:func:`pvlib.shading.shaded_fraction1d` to calculate the fraction of | ||
| # shaded surface and consequently the number of shaded *blocks* due to | ||
| # row-to-row shading. | ||
| # 3. :py:func:`pvlib.tracking.singleaxis` to calculate the rotation angle of | ||
| # the trackers. | ||
| # | ||
| # .. sectionauthor:: Echedey Luis <echelual (at) gmail.com> | ||
| # | ||
| # Problem description | ||
| # ------------------- | ||
| # Let's consider a PV system with the following characteristics: | ||
| # | ||
| # - Two north-south single-axis trackers, each one having 6 modules. | ||
| # - The rows have the same true-tracking tilt angles. True tracking | ||
| # is chosen in this example, so shading is significant. | ||
| # - Terrain slope is 7 degrees downward to the east. | ||
| # - Rows' axes are horizontal. | ||
|
echedey-ls marked this conversation as resolved.
Outdated
|
||
| # - The modules are comprised of multiple cells. We will compare these cases: | ||
| # - modules with one bypass diode | ||
| # - modules with three bypass diodes | ||
| # - half-cut cell modules with three bypass diodes on portrait and landscape | ||
|
echedey-ls marked this conversation as resolved.
Outdated
|
||
| # | ||
| # Setting up the system | ||
| # ---------------------- | ||
| # Let's start by defining the system characteristics, location and the time | ||
| # range for the analysis. | ||
|
|
||
| import pvlib | ||
| import pandas as pd | ||
| import numpy as np | ||
| import matplotlib.pyplot as plt | ||
| from matplotlib.dates import ConciseDateFormatter | ||
|
|
||
| pitch = 4 # meters | ||
| width = 1.5 # meters | ||
| gcr = width / pitch # ground coverage ratio | ||
| N_modules_per_row = 6 | ||
| axis_azimuth = 180 # N-S axis | ||
| axis_tilt = 0 # flat because the axis is perpendicular to the slope | ||
| cross_axis_tilt = -7 # 7 degrees downward to the east | ||
|
|
||
| latitude, longitude = 40.2712, -3.7277 | ||
| locus = pvlib.location.Location( | ||
| latitude, | ||
| longitude, | ||
| tz="Europe/Madrid", | ||
| altitude=pvlib.location.lookup_altitude(latitude, longitude), | ||
| ) | ||
|
|
||
| times = pd.date_range("2001-04-11T04", "2001-04-11T20", freq="10min") | ||
|
|
||
| # %% | ||
| # True-tracking algorithm and shaded fraction | ||
| # ------------------------------------------- | ||
| # Since this model is about row-to-row shading, we will use the true-tracking | ||
| # algorithm to calculate the trackers rotation. Back-tracking reduces the | ||
| # shading between rows, but since this example is about shading, we will not | ||
| # use it. | ||
|
echedey-ls marked this conversation as resolved.
Outdated
|
||
| # | ||
| # Then, the next step is to calculate the fraction of shaded surface. This is | ||
| # done using :py:func:`pvlib.shading.shaded_fraction1d`. Using this function is | ||
| # straightforward with the variables we already have defined. | ||
| # Then, we can calculate the number of shaded blocks by rounding up the shaded | ||
| # fraction by the number of blocks along the shaded length. | ||
|
|
||
| # Calculate solar position to get single-axis tracker rotation and irradiance | ||
| solar_pos = locus.get_solarposition(times) | ||
| solar_apparent_zenith, solar_azimuth = ( | ||
| solar_pos["apparent_zenith"], | ||
| solar_pos["azimuth"], | ||
| ) # unpack for better readability | ||
|
|
||
| tracking_result = pvlib.tracking.singleaxis( | ||
| apparent_zenith=solar_apparent_zenith, | ||
| apparent_azimuth=solar_azimuth, | ||
| axis_tilt=axis_tilt, | ||
| axis_azimuth=axis_azimuth, | ||
| max_angle=(-90 + cross_axis_tilt, 90 + cross_axis_tilt), # (min, max) | ||
| backtrack=False, | ||
| gcr=gcr, | ||
| cross_axis_tilt=cross_axis_tilt, | ||
| ) | ||
|
|
||
| tracker_theta, aoi, surface_tilt, surface_azimuth = ( | ||
| tracking_result["tracker_theta"], | ||
| tracking_result["aoi"], | ||
| tracking_result["surface_tilt"], | ||
| tracking_result["surface_azimuth"], | ||
| ) # unpack for better readability | ||
|
|
||
| # Calculate the shade fraction | ||
| shaded_fraction = pvlib.shading.shaded_fraction1d( | ||
| solar_apparent_zenith, | ||
| solar_azimuth, | ||
| axis_azimuth, | ||
| axis_tilt=axis_tilt, | ||
| shaded_row_rotation=tracker_theta, | ||
| shading_row_rotation=tracker_theta, | ||
| collector_width=width, | ||
| pitch=pitch, | ||
| cross_axis_slope=cross_axis_tilt, | ||
| ) | ||
|
|
||
| # %% | ||
| # Number of shaded blocks | ||
| # ----------------------- | ||
| # The number of shaded blocks depends on the module configuration and number | ||
| # of bypass diodes. For example, | ||
| # modules with one bypass diode will behave like one block. | ||
| # On the other hand, modules with three bypass diodes will have three blocks, | ||
| # except for the half-cut cell modules, which will have six blocks; 2x3 blocks | ||
| # where the two rows are along the longest side of the module. | ||
| # We can argue that the dimensions of the system change when you switch from | ||
| # portrait to landscape, but for this example, we will consider it the same. | ||
| # | ||
| # The number of shaded blocks is calculated by rounding up the shaded fraction | ||
| # by the number of blocks along the shaded length. So let's define the number | ||
| # of blocks for each module configuration: | ||
| # | ||
| # - 1 bypass diode: 1 block | ||
| # - 3 bypass diodes: 3 blocks in landscape; 1 in portrait | ||
| # - 3 bypass diodes half-cut cells: | ||
| # - 2 blocks in portrait | ||
| # - 3 blocks in landscape | ||
| # | ||
| # .. figure:: ../../_images/PV_module_layout_cesardd.jpg | ||
| # :align: center | ||
| # :width: 75% | ||
| # :alt: Normal and half-cut cells module layouts | ||
| # | ||
| # Left: common module layout. Right: half-cut cells module layout. | ||
| # Each module has three bypass diodes. On the left, they connect cell | ||
| # columns 1-2, 2-3 & 3-4. On the right, they connect cell columns 1-2, 3-4 & | ||
| # 5-6. | ||
| # *Source: César Domínguez. CC BY-SA 4.0, Wikimedia Commons* | ||
| # | ||
| # In the image above, each orange U-shaped string section is a block. | ||
| # By symmetry, the yellow inverted-U's of the subcircuit are also blocks. | ||
| # For this reason, the half-cut cell modules have 6 blocks in total: two along | ||
| # the longest side and three along the shortest side. | ||
|
|
||
| blocks_per_module = { | ||
| "1 bypass diode": 1, | ||
| "3 bypass diodes": 3, | ||
| "3 bypass diodes half-cut, portrait": 2, | ||
| "3 bypass diodes half-cut, landscape": 3, | ||
| } | ||
|
|
||
| # Calculate the number of shaded blocks during the day | ||
| shaded_blocks_per_module = { | ||
| k: np.ceil(blocks_N * shaded_fraction) | ||
| for k, blocks_N in blocks_per_module.items() | ||
| } | ||
|
|
||
| # %% | ||
| # Plane of array irradiance example data | ||
| # -------------------------------------- | ||
| # To calculate the power output losses due to shading, we need the plane of | ||
| # array irradiance. For this example, we will use synthetic data: | ||
|
|
||
| clearsky = locus.get_clearsky( | ||
| times, solar_position=solar_pos, model="ineichen" | ||
| ) | ||
| dhi, dni = ( | ||
| clearsky["dhi"], | ||
| clearsky["dni"], | ||
| ) | ||
| dni_extra = pvlib.irradiance.get_extra_radiation(times) | ||
| airmass = pvlib.atmosphere.get_relative_airmass(solar_apparent_zenith) | ||
| sky_diffuse = pvlib.irradiance.perez_driesse( | ||
| surface_tilt, surface_azimuth, dhi, dni, | ||
| solar_apparent_zenith, solar_azimuth, dni_extra, airmass, | ||
| ) # fmt: skip | ||
| poa_components = pvlib.irradiance.poa_components( | ||
| aoi, dni, sky_diffuse, poa_ground_diffuse=0 | ||
|
echedey-ls marked this conversation as resolved.
Outdated
|
||
| ) # ignore ground diffuse for brevity | ||
| poa_global, poa_direct = ( | ||
| poa_components["poa_global"], | ||
| poa_components["poa_direct"], | ||
| ) | ||
|
|
||
| # %% | ||
| # Results | ||
| # ------- | ||
| # Now that we have the number of shaded blocks for each module configuration, | ||
| # we can apply the model and estimate the power loss due to shading. | ||
| # | ||
| # Note that this model is not linear with the shaded blocks ratio, so there is | ||
| # a difference between applying it to just a module or a whole row. | ||
|
|
||
| shade_losses_per_module = { | ||
| k: pvlib.shading.direct_martinez( | ||
| poa_global=poa_global, | ||
| poa_direct=poa_direct, | ||
| shaded_fraction=shaded_fraction, | ||
| shaded_blocks=module_shaded_blocks, | ||
| total_blocks=blocks_per_module[k], | ||
| ) | ||
| for k, module_shaded_blocks in shaded_blocks_per_module.items() | ||
| } | ||
|
|
||
| shade_losses_per_row = { | ||
| k: pvlib.shading.direct_martinez( | ||
| poa_global=poa_global, | ||
| poa_direct=poa_direct, | ||
| shaded_fraction=shaded_fraction, | ||
| shaded_blocks=module_shaded_blocks * N_modules_per_row, | ||
| total_blocks=blocks_per_module[k] * N_modules_per_row, | ||
| ) | ||
| for k, module_shaded_blocks in shaded_blocks_per_module.items() | ||
| } | ||
|
|
||
| # %% | ||
| # Plotting the results | ||
| # ^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True) | ||
| fig.suptitle("Martinez power losses due to shading") | ||
| for k, shade_losses in shade_losses_per_module.items(): | ||
| linestyle = "--" if k == "3 bypass diodes half-cut, landscape" else "-" | ||
| ax1.plot(times, shade_losses, label=k, linestyle=linestyle) | ||
| ax1.legend(loc="upper center") | ||
| ax1.grid() | ||
| ax1.set_xlabel("Time") | ||
| ax1.xaxis.set_major_formatter( | ||
| ConciseDateFormatter("%H:%M", tz="Europe/Madrid") | ||
| ) | ||
| ax1.set_ylabel(r"$P_{out}$ losses") | ||
| ax1.set_title("Per module") | ||
|
|
||
| for k, shade_losses in shade_losses_per_row.items(): | ||
| linestyle = "--" if k == "3 bypass diodes half-cut, landscape" else "-" | ||
| ax2.plot(times, shade_losses, label=k, linestyle=linestyle) | ||
| ax2.legend(loc="upper center") | ||
| ax2.grid() | ||
| ax2.set_xlabel("Time") | ||
| ax2.xaxis.set_major_formatter( | ||
| ConciseDateFormatter("%H:%M", tz="Europe/Madrid") | ||
| ) | ||
| ax2.set_ylabel(r"$P_{out}$ losses") | ||
| ax2.set_title("Per row") | ||
| fig.tight_layout() | ||
| fig.show() | ||
|
Comment on lines
+205
to
+257
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess the code plotting the figure could be hidden (or collapsed) to make the example more compact
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer leaving it as is, so in case of doubt it can be consulted without digging into the repo files. If I knew how to collapse it I would do it, but I think that's impossible. In any case, I see both pros and cons regarding that suggestion, so feedback is more than welcome @AdamRJensen @kandersolar. |
||
|
|
||
| # %% | ||
| # Note how the half-cut cell module in portrait performs better than the | ||
| # normal module with three bypass diodes. This is because the number of shaded | ||
| # blocks is less along the shaded length is higher in the half-cut module. | ||
| # This is the reason why half-cut cell modules are preferred in portrait | ||
| # orientation. | ||
|
|
||
| # %% | ||
| # References | ||
| # ---------- | ||
| # .. [1] F. Martínez-Moreno, J. Muñoz, and E. Lorenzo, 'Experimental model | ||
| # to estimate shading losses on PV arrays', Solar Energy Materials and | ||
| # Solar Cells, vol. 94, no. 12, pp. 2298-2303, Dec. 2010, | ||
| # :doi:`10.1016/j.solmat.2010.07.029`. | ||
Uh oh!
There was an error while loading. Please reload this page.