Skip to content

[DRAFT] Add more spectral responses #2038

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

Closed
wants to merge 11 commits into from

Conversation

echedey-ls
Copy link
Contributor

@echedey-ls echedey-ls commented May 6, 2024

  • Closes Spectral response of other materials #2037
  • I am familiar with the contributing guidelines
  • Tests added
  • Updates entries in docs/sphinx/source/reference for API changes.
  • Adds description and name entries in the appropriate "what's new" file in docs/sphinx/source/whatsnew for all changes. Includes link to the GitHub Issue with :issue:`num` or this Pull Request with :pull:`num`. Includes contributor name and/or GitHub username (link with :ghuser:`user`).
  • New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary.
  • Pull request is nearly complete and ready for detailed review.
  • Maintainer: Appropriate GitHub Labels (including remote-data) and Milestone are assigned to the Pull Request and linked Issue.

Addresses the addition of more spectral responses, discussed both in #1963 and #2037. The data source is the duramat files linked by @adriesse.

Still draft before the general approach is discussed, but opened as a possible solution.

Dirty code with data analysis

# %%
import pvlib
import h5py
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

from pathlib import Path

keys = [
    "Canadian_270_poly",
    "Canadian_275_mono",
    "Itek_360_mono",
    "Jinko_260_poly",
    "LG_320_mono",
    "LG_400_mono",
    "Mission_300_mono",
    "Panasonic_325_hit",
    "Qcells_280_poly",
    "Qcells_300_mono",
    "Solaria_400_mono",
    "Trina_260_poly",
]

sr_dataset_path = Path(pvlib.__path__[0]).joinpath(
    "data", "Duramat_spectral_responses.nc"
)
datafile = h5py.File(sr_dataset_path, "r")

keys_grouped = {
    "polysi": [
        "Canadian_270_poly",
        "Jinko_260_poly",
        "Qcells_280_poly",
        "Trina_260_poly",
    ],
    "monosi": [
        "Canadian_275_mono",
        "Itek_360_mono",
        "LG_320_mono",
        "LG_400_mono",
        "Mission_300_mono",
        "Qcells_300_mono",
        "Solaria_400_mono",
    ],
    "hit": ["Panasonic_325_hit"],
}

grouped_srs = {}

# ncells = pd.Series(index=datafile.keys())

for cell_type, module_list in keys_grouped.items():
    wavelength = pd.DataFrame()
    sr = pd.DataFrame()
    print(cell_type)
    for module_name in module_list:
        mod = datafile[module_name]
        wavelength[module_name] = mod["wavelength"]
        sr[module_name] = mod["sr"]
        plt.plot(wavelength[module_name], sr[module_name], label=module_name)
        # ncells[module_list] = mod["qe"].shape[0]

    # print("Std Wv")
    # print(wavelength.std())
    # print("Mean SR")
    # print("Stdev SR")
    sr_std = sr.std(axis=1)
    grouped_srs[cell_type] = sr.mean(axis=1).to_numpy()
    plt.plot(
        wavelength[module_name],
        grouped_srs[cell_type],
        label="Mean",
        c="k",
        linestyle="--",
    )
    # print(sr_std)
    # print("Max std:", sr_std.max())
    # print("Max percent std:", (sr_std / grouped_srs[cell_type]).max())
    plt.grid()
    plt.legend()
    plt.show()
    # plt.savefig(f"duramat_sr_agg_{cell_type}.png")
    plt.cla()
    plt.clf()

# print("ncells")
# print(ncells.unique())

# %%
data_df = pd.DataFrame(index=wavelength.to_numpy().transpose()[0], data=grouped_srs)
data_df.index.name = "wavelength"
# %%
data_df.to_csv("duramat_spectral_responses.csv")

@AdamRJensen AdamRJensen added enhancement GSoC Contributions related to Google Summer of Code. labels May 24, 2024
@echedey-ls echedey-ls marked this pull request as ready for review May 30, 2024 17:38
@echedey-ls echedey-ls marked this pull request as draft June 16, 2024 00:09
@AdamRJensen
Copy link
Member

At the last GSoC meeting we had a group discussion on whether this PR should be merged. There was an general consensus that because there's nothing 'standard' about these curves, or any information that suggests that they are good generic representations of their specific technology, then it does not seem to fit within pvlib.

@echedey-ls echedey-ls deleted the duramat-eqe-dataset branch July 7, 2024 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement GSoC Contributions related to Google Summer of Code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spectral response of other materials
2 participants