power_mismatch_deline docstring: the rear-to-total RMAD conversion has an extra bifaciality factor

オープン 初心者向け
#2,929 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@echedey-ls がすでに取り組んでいます。

2026年11月1日 から。

  • #2930 @echedey-ls による — オープン

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
documentation

調査の方向性

pvlib/bifacial/loss_models.py の 118-132 行目にある pvlib.bifacial.power_mismatch_deline の docstring の Notes セクションを編集し、issue の導出が示すとおりに RMAD 変換式から余分な bifaciality factor を削除してください。関数のコードには影響しません。issue 内の再現スニペットで修正後の式を検証し、その後ドキュメントをビルドして数式が正しくレンダリングされるか確認してください。

索引モデルが issue の本文から書いたものです。

説明

bug documentation

Describe the bug
The Notes of pvlib.bifacial.power_mismatch_deline convert the RMAD of the rear irradiance to the RMAD of the total irradiance with one bifaciality factor too many. The docstring says

$$RMAD(k \cdot X + c) = RMAD(X) \cdot k \frac{k \bar{X}}{k \bar{X} + c} = RMAD(X) \cdot \frac{k}{1 + \frac{c}{k \bar{X}}}$$

and so

$$RMAD_{total} = RMAD_{rear} \frac{\phi_{Bifi}}{1 + \frac{G_{front}}{\phi_{Bifi} \bar{G}_{rear}}}$$

RMAD doesn't change with scale, though. For $Y = kX + c$, each $|Y_i - Y_j| = k |X_i - X_j|$ and $\bar{Y} = k\bar{X} + c$, so

$$RMAD(k \cdot X + c) = \frac{k \sum_i \sum_j |X_i - X_j|}{n^2 (k \bar{X} + c)} = RMAD(X) \cdot \frac{k \bar{X}}{k \bar{X} + c} = \frac{RMAD(X)}{1 + \frac{c}{k \bar{X}}}$$

which gives

$$RMAD_{total} = \frac{RMAD_{rear}}{1 + \frac{G_{front}}{\phi_{Bifi} \bar{G}_{rear}}}$$

Following the docstring understates the total RMAD by the factor $\phi_{Bifi}$, about 30 % for a bifaciality of 0.7, and so the mismatch loss as well. The function's code isn't affected: it takes the total RMAD as given. Only the formula in the Notes is.

To Reproduce

import numpy as np

rng = np.random.default_rng(0)
g_rear = rng.uniform(80, 160, 72)  # W/m2, one value per cell
g_front = 900.0                    # W/m2, uniform front
phi = 0.7                          # bifaciality
g_total = g_front + phi * g_rear   # Eq. (2) of Deline et al. (2020)


def rmad(x):
    x = np.asarray(x, dtype=float)
    return np.abs(x[:, None] - x[None, :]).sum() / (x.size**2 * x.mean())


rmad_rear = rmad(g_rear)
print(rmad(g_total))                                            # 0.0193862763
print(rmad_rear / (1 + g_front / (phi * g_rear.mean())))        # 0.0193862763
print(rmad_rear * phi / (1 + g_front / (phi * g_rear.mean())))  # 0.0135703934, the docstring's form

Expected behavior
The Notes would read $RMAD(k \cdot X + c) = RMAD(X) \cdot \frac{k \bar{X}}{k \bar{X} + c} = \frac{RMAD(X)}{1 + \frac{c}{k \bar{X}}}$, and $RMAD_{total} = \frac{RMAD_{rear}}{1 + \frac{G_{front}}{\phi_{Bifi} \bar{G}_{rear}}}$. The text is in pvlib/bifacial/loss_models.py, lines 118–132 on main today.

Versions:

  • pvlib.__version__: 0.16.1 (the same text is on main)
  • pandas.__version__: 3.0.6
  • python: 3.12.15
主要言語
Python
スター
1.7k
フォーク
1.2k
平均マージ
3日 10時間
マージ済み PR(30日)
12

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pvlib/pvlib-python のほかの issue

pvlib/pvlib-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。