### Quick Start for Developers Source: https://github.com/nrel/pvdegradationtools/blob/main/CONTRIBUTING.md Steps to set up a development environment, install the project in editable mode, and configure pre-commit hooks. ```bash # 1. Fork and clone git clone https://github.com/YOUR-USERNAME/PVDegradationTools.git cd PVDegradationTools # 2. Create environment (choose venv or conda) python -m venv pvdeg-dev source pvdeg-dev/bin/activate # Windows: pvdeg-dev\Scripts\activate # 3. Install in editable mode with all dependencies pip install -e .[all] # 4. Install pre-commit hooks pre-commit install # 5. (Optional, required for HPC) Register Jupyter kernel python -m ipykernel install --user --name=pvdeg-dev ``` -------------------------------- ### Start Jupyter Notebook Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/tutorials/index.rst Command to start a Jupyter notebook server. ```bash jupyter notebook ``` -------------------------------- ### Install via Conda Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/user_guide/installation.rst Install the PV Degradation Tools using Conda from the conda-forge channel. ```bash conda install -c conda-forge cartopy ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/user_guide/installation.rst Installs pre-commit hooks for automated code quality checks. ```bash pre-commit install ``` -------------------------------- ### Editable Install with All Dependencies Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/user_guide/installation.rst Installs PVDeg in editable mode with all optional dependencies. ```bash pip install -e .[all] ``` -------------------------------- ### Install with optional dependencies (All) Source: https://github.com/nrel/pvdegradationtools/blob/main/README.md Installs PVDeg with all optional dependencies. ```bash pip install pvdeg[all] ``` -------------------------------- ### Quick Install Source: https://github.com/nrel/pvdegradationtools/blob/main/README.md Installs the PVDeg package using pip. ```bash pip install pvdeg ``` -------------------------------- ### Optional Dependencies Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/user_guide/installation.rst Installs PVDeg with a specified optional dependency group. ```bash pip install pvdeg[group_name] ``` -------------------------------- ### Install with optional dependencies (Docs) Source: https://github.com/nrel/pvdegradationtools/blob/main/README.md Installs PVDeg with Sphinx documentation tools. ```bash pip install pvdeg[docs] ``` -------------------------------- ### Clone Repository Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/user_guide/installation.rst Clones the PVDegradationTools repository from GitHub. ```bash git clone https://github.com/YOUR-USERNAME/PVDegradationTools.git cd PVDegradationTools ``` -------------------------------- ### Clone Repository and Start Jupyter Source: https://github.com/nrel/pvdegradationtools/blob/main/README.md Instructions for cloning the PVDeg repository and starting a Jupyter Notebook server. ```bash git clone https://github.com/NatLabRockies/PVDegradationTools.git cd PVDegradationTools jupyter notebook ``` -------------------------------- ### Install documentation dependencies Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/user_guide/contributing.rst Command to install dependencies required for building documentation. ```bash pip install -e .[docs] ``` -------------------------------- ### Calculate Installation Standoff - Level 2 Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/10_workshop_demos/01_astm_live_demo.ipynb This code snippet calculates the minimum installation distance with an additional parameter `T98`. ```python standoff = pvdeg.standards.standoff(weather_df=weather_df, meta=meta, T98=70) ``` -------------------------------- ### Install with optional dependencies (Test) Source: https://github.com/nrel/pvdegradationtools/blob/main/README.md Installs PVDeg with testing and validation tools. ```bash pip install pvdeg[test] ``` -------------------------------- ### Print Minimum Installation Distance (Level 1) Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/10_workshop_demos/01_astm_live_demo.ipynb This code snippet prints the calculated minimum installation distance. ```python print("Minimum installation distance:", standoff["x"]) ``` -------------------------------- ### Install pvdeg into the new environment Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/README.md Command to install the pvdeg package into an activated virtual environment using pip. ```bash python -m pip install pvdeg ``` -------------------------------- ### Install pvdeg Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/04_geospatial/08_module_standoff_iec63126.ipynb Install the pvdeg library if running on Google Colab. ```bash # if running on google colab, uncomment the next line and execute this cell to install the dependencies # and prevent "ModuleNotFoundError" in later cells: #!pip install pvdeg ``` -------------------------------- ### Calculate Installation Standoff - Level 1 Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/10_workshop_demos/01_astm_live_demo.ipynb This code snippet calculates the minimum installation distance using the `calc_standoff` function with default parameters. ```python standoff = pvdeg.standards.standoff(weather_df=weather_df, meta=meta) ``` -------------------------------- ### Install pvdeg Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/tools/Tools - Module Standoff for IEC TS 63126.ipynb Installs the pvdeg library if running on Google Colab. ```python # if running on google colab, uncomment the next line and execute this cell to install the dependencies #!pip install pvdeg ``` -------------------------------- ### Developer Installation Source: https://github.com/nrel/pvdegradationtools/blob/main/README.md Clones the repository and installs PVDeg in editable mode with all optional dependencies. ```bash git clone https://github.com/NatLabRockies/PVDegradationTools.git cd PVDegradationTools pip install -e .[all] ``` -------------------------------- ### Install with optional dependencies (Books) Source: https://github.com/nrel/pvdegradationtools/blob/main/README.md Installs PVDeg with Jupyter Book publishing tools. ```bash pip install pvdeg[books] ``` -------------------------------- ### Output Folder Setup Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/tools/Tools - Edge Seal Oxygen Ingress.ipynb Sets up the output directory for results and handles potential errors if the directory already exists. ```python # This sets up an a variable with the output folder information. output_folder = os.path.join( os.path.dirname(os.path.dirname(os.getcwd())), "TEMP", "results" ) try: os.makedirs(output_folder) print(f"Created directory: {output_folder}") except OSError as error: print(error) ``` -------------------------------- ### Example of Module Temperature Calculation with Default Values Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/01_basics/01_basics_humidity_design.ipynb An example demonstrating the use of the `temperature.module` function with all default values. This function returns a datetime-indexed series matching the weather file's index. ```python temp_mod ``` -------------------------------- ### Create and Activate venv Environment Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/user_guide/installation.rst Creates and activates a virtual environment named 'pvdeg-dev' using venv. ```bash python -m venv pvdeg-dev source pvdeg-dev/bin/activate # On Windows: pvdeg-dev\Scripts\activate ``` -------------------------------- ### Install with optional dependencies (PySAM) Source: https://github.com/nrel/pvdegradationtools/blob/main/README.md Installs PVDeg with PySAM support for system modeling. ```bash pip install pvdeg[sam] ``` -------------------------------- ### Run Test Suite Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/user_guide/installation.rst Runs the PVDeg test suite using pytest. ```bash pytest pvdeg ``` -------------------------------- ### Install pvdeg Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/10_workshop_demos/01_astm_live_demo.ipynb If running on Google Colab, uncomment the next line and execute this cell to install the dependencies and prevent "ModuleNotFoundError" in later cells. ```python # if running on google colab, uncomment the next line and execute this cell to install the dependencies and prevent "ModuleNotFoundError" in later cells: #!pip install pvdeg ``` -------------------------------- ### Example Material Parameter Dictionary Structure Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/user_guide/materials.rst Illustrates the general structure of the dictionary returned when accessing material parameters. ```Python { "name": string, "alias": string, "contributor": string, "source": string, "Fickian": bool, "Ead": numeric, "Do": numeric, "Eas": numeric, "So": numeric, "Eap": numeric, "Po": numeric } ``` -------------------------------- ### Example JSON Output Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/tools/Tools - Degradation.ipynb This code snippet shows how to format JSON output for degradation data. ```python print(json.dumps(kwarg_variables, skipkeys = True, indent = 0 ).replace("{\" + "\n", "{").replace('"' + "\n", "").replace(': {" , ":" + "\n" + "{").replace('},' + "\n", '},' +"\n" +"\n")) ``` -------------------------------- ### Get Meteorological Data from Coordinates Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/tools/Tools - Degradation.ipynb Commented-out example showing how to get meteorological data from coordinates for different global locations. ```python # This routine will get a meteorological dataset from anywhere in the world where it is available # weather_id = (24.7136, 46.6753) #Riyadh, Saudi Arabia # weather_id = (35.6754, 139.65) #Tokyo, Japan # weather_id = (-43.52646, 172.62165) #Christchurch, New Zealand ``` -------------------------------- ### Clone Repository and Navigate Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/tutorials/index.rst Steps to clone the PVDeg repository and navigate to the tutorial directory. ```bash git clone https://github.com/NREL/PVDegradationTools.git cd PVDegradationTools ``` -------------------------------- ### NSRDB - HSDS on Kestrel - Fetch Weather Data Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/01_basics/04_weather_database_access.ipynb Example code to fetch weather data from NSRDB using HSDS on Kestrel. This section is for Kestrel HPC users and requires specific setup. ```python # Get weather data weather_db = "NSRDB" # Latitude and Longitude weather_id = (33.448376, -112.074036) # weather_id = 1933572 weather_arg = { "satellite": "GOES", "names": 2021, "NREL_HPC": True, "attributes": [ "air_temperature", "wind_speed", "dhi", "ghi", "dni", "relative_humidity", ], } # Uncomment the following when working on NREL Kestrel # weather_df, meta = pvdeg.weather.get(weather_db, weather_id, **weather_arg) # res = pvdeg.standards.standoff(weather_df=weather_df, meta=meta, tilt=None, azimuth=180, sky_model='isotropic', temp_model='sapm', # conf_0='insulated_back_glass_polymer', conf_inf='open_rack_glass_polymer', T98=70, x_0=6.5, wind_factor=0.33) # print(pvdeg.standards.interpret_standoff(res)) # print(meta) ``` -------------------------------- ### Initial Defect State and Timestep Setup Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/02_degradation/04_letid_outdoor_scenario.ipynb Initializes defect state percentages (nA_0, nB_0, nC_0), retrieves kinetic parameters, and sets up the DataFrame for tracking defect states and lifetime across timesteps. ```python nA_0 = 100 nB_0 = 0 nC_0 = 0 mechanism_params = utilities.get_kinetics("D037") timesteps[["NA", "NB", "NC", "tau"]] = ( np.nan ) # create columns for defect state percentages and lifetime, fill with NaNs for now, to fill iteratively below timesteps.loc[0, ["NA", "NB", "NC"]] = ( nA_0, nB_0, nC_0, # assign first timestep defect state percentages ) timesteps.loc[0, "tau"] = letid.tau_now( tau_0, tau_deg, nB_0 ) # calculate tau for the first timestep ``` -------------------------------- ### Get weather data for a specific location (New Mexico) Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/10_workshop_demos/02_duramat_live_demo.ipynb Retrieves weather data for a specific latitude and longitude in New Mexico for the year 2022, including various attributes. This is used for the relative humidity example. ```python # State bar of new mexico: (35.16482, -106.58979) weather_db = "NSRDB" weather_id = (35.16482, -106.58979) # NREL (39.741931, -105.169891) weather_arg = { "satellite": "Americas", "names": 2022, "NREL_HPC": True, "attributes": [ "air_temperature", "wind_speed", "dhi", "ghi", "dni", "relative_humidity", ], } weather_df, meta = pvdeg.weather.get( weather_db, weather_id, geospatial=False, **weather_arg ) ``` -------------------------------- ### Verify Installation Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/user_guide/installation.rst Verifies if the pvdeg package is installed in the current environment. ```bash pip list | grep pvdeg ``` -------------------------------- ### Import Libraries Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/04_scenario/01_scenario_temperature.ipynb Imports the necessary pvdeg library and os module. ```python import pvdeg import os ``` -------------------------------- ### Set up the PV system in pvlib Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/02_degradation/04_letid_outdoor_scenario.ipynb Configures a pvlib PVSystem object with location, module, inverter, and temperature model parameters. ```python # set up system in pvlib lat = meta["latitude"] lon = meta["longitude"] tz = meta["tz"] elevation = meta["altitude"] surface_tilt = lat # fixed, latitude tilt surface_azimuth = 180 # south-facing location = Location(lat, lon, tz, elevation, "Golden, CO, USA") system = PVSystem( surface_tilt=surface_tilt, surface_azimuth=surface_azimuth, module_parameters=cec_module, inverter_parameters=cec_inverter, temperature_model_parameters=temperature_model_parameters, ) ``` -------------------------------- ### Create and run the pvlib ModelChain Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/02_degradation/04_letid_outdoor_scenario.ipynb Initializes and runs a pvlib ModelChain to simulate the PV system's performance. ```python # create and run pvlib modelchain mc = ModelChain(system, location, aoi_model="physical") mc.run_model(weather) ``` -------------------------------- ### Geospatial Analysis Setup Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/06_advanced/05_pvgis_distributed.ipynb Sets up a geospatial analysis function (e.g., calculating effective standoff height) using a template derived from the weather dataset. ```python func = pvdeg.standards.standoff template = pvdeg.geospatial.auto_template(func=func, ds_gids=geo_weather) ``` -------------------------------- ### Import necessary libraries and load parameters Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/02_degradation/04_letid_outdoor_scenario.ipynb Imports required pvlib modules and loads specific temperature model parameters for an open-rack glass/polymer configuration. ```python from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS from pvlib.location import Location from pvlib.pvsystem import PVSystem from pvlib.modelchain import ModelChain cec_inverters = pvlib.pvsystem.retrieve_sam("cecinverter") cec_inverter = cec_inverters["ABB__ULTRA_750_TL_OUTD_1_US_690_x_y_z__690V_"] temperature_model_parameters = TEMPERATURE_MODEL_PARAMETERS["sapm"]["open_rack_glass_polymer"] ``` -------------------------------- ### Run Scenario Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/04_scenario/01_scenario_temperature.ipynb Executes the defined scenario pipeline. ```python scene_temp.run() scene_temp ``` -------------------------------- ### Install Dependencies Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/01_basics/03_spectral_degradation.ipynb Installs the pvdeg library if running on Google Colab. ```python # if running on google colab, uncomment the next line and execute this cell to install the dependencies and prevent "ModuleNotFoundError" in later cells: # !pip install pvdeg ``` -------------------------------- ### Extract and Plot Results Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/04_scenario/01_scenario_temperature.ipynb Demonstrates how to extract and plot results from the scenario, including specifying time ranges. ```python import datetime t0 = datetime.datetime(1970, 1, 1, 0, 0) tf = datetime.datetime(1970, 1, 1, 23, 59) # Get the first function result dynamically function_ids = [key[1] for key in scene_temp.results.keys() if key[0] == "function"] if function_ids: temp_df = scene_temp.extract( ("function", function_ids[0]), tmy=True, start_time=t0, end_time=tf ) display(temp_df) else: print("No function results found") # Get the first function result dynamically for plotting function_ids = [key[1] for key in scene_temp.results.keys() if key[0] == "function"] if function_ids: scene_temp.plot( ("function", function_ids[0]), tmy=True, start_time=t0, end_time=tf, title="single day cell temperature", ) else: print("No function results found") ``` -------------------------------- ### Example JSON Output Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/tools/Tools - Degradation.ipynb This is an example of the JSON output that can be generated by the degradation tools. ```json { "DataEntryPerson": "Jada Swailes", "DateEntered": "4/14/2023", "DOI": "10.1016/j.solmat.2011.02.013", "SourceTitle": "An Arrhenius approach to estimating organic photovoltaic module weathering acceleration factors", "Authors": "Olivier Haillant, David Dumbleton, Allen Zielnik" } ``` -------------------------------- ### Example JSON Output Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/tools/Tools - Degradation.ipynb This is an example of the JSON output that can be generated by the degradation tools. ```json { "DataEntryPerson": "Weston Wall", "DateEntered": "4/17/2023", "SourceTitle": "PV CONNECTORS, BOTTLENECK OF 40 YEARS LIFETIME MODULES?", "Authors": "Xuanji Yu , Ben Huang, Ruirui Lv, Jean-Nicolas Jaubert , Tao Xu, Guangchun Zhang", "KeyWords": "Connectors, Polymer sealing failure, metal pin corrosion, 40 year reliability", "Material": "Connectors", "Degradation": "Wet insulation resistance < 400Mohm", "EquationType": "Arrhenius_Connector", "Equation": "R_D=R_{0,T} \cdot e^ {\left( \frac {-E_{a,T}}{R\cdot T_K } \right)}+R_{0,H}\cdot RH^n\cdot e^{ \left( \frac{-E_{a,H}}{R\cdot T_K } \right) }+R_{0,P}\cdot G^P\cdot e^{ \left( \frac {-E_{a,P}}{R\cdot T_K } \right) }", "R_D": {}, "R_0,T": {}, "E_a,T": {}, "R_0,H": {}, "n": {}, "E_a,H": {}, "R_0,P": {}, "p": {}, "E_a,P": {} } ``` -------------------------------- ### View in browser Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/user_guide/contributing.rst Instruction on how to view the built documentation. ```bash # Open docs/build/html/index.html ``` -------------------------------- ### Install Dependencies Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/02_degradation/06_vant_hoff_degradation_model.ipynb Install the pvdeg library if running on Google Colab. ```python # if running on google colab, uncomment the next line and execute this cell to install the dependencies and prevent "ModuleNotFoundError" in later cells: # pip install pvdeg ``` -------------------------------- ### Example JSON Data Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/tools/Tools - Degradation.ipynb This snippet shows an example of JSON data used for degradation modeling. ```json { "R_0": { "value": 845000000, "units": "% / h" }, "E_a": { "value": 33.472, "units": "kJ / mol" }, "E": { "value": 0.04 } } ``` ```json { "DataEntryPerson": "Weston Wall", "DOI": "10.1002/.pip1173", "SourceTitle": "Life Prediction for CIGS Solar Modules", "Authors": "D.J. Coyle, H.A. Blaydes, R.S. Northey, J.E. Pickett, K.R. Nagarkar, R.A. Zhao, and J.O. Gardner", "Reference": "Coyle, D. J., et al. (2011). 'Life prediction for CIGS solar modules part 2: degradation kinetics, accelerated testing, and encapsulant effects.' Progress in Photovoltaics: Research and Applications.", "KeyWords": "Temperature, humidity, CIGS, Moisture ingress, thin film", "Material": "CIGS", "Degradation": "CIGS_Efficiency, ITO_ECA1", "EquationType": "Arrhenius_BET5", "Equation": "R_D=R_0\\cdot e^{ \\left( \\frac{-E_a}{R\\cdot T_K } \\right) } \\cdot \\left( \\frac{RH}{1-RH+E} \\right)", "R_D": { "units": "% / h" }, "R_0": { "value": 73000000000000, "units": "% / h" }, "E_a": { "value": 67.3624, "units": "kJ / mol" }, "E": { "value": 0.04 } } ``` ```json { "DataEntryPerson": "Weston Wall", "DOI": "10.1002/.pip1174", "SourceTitle": "Life Prediction for CIGS Solar Modules", "Authors": "D.J. Coyle, H.A. Blaydes, R.S. Northey, J.E. Pickett, K.R. Nagarkar, R.A. Zhao, and J.O. Gardner", "Reference": "Coyle, D. J., et al. (2011). 'Life prediction for CIGS solar modules part 2: degradation kinetics, accelerated testing, and encapsulant effects.' Progress in Photovoltaics: Research and Applications.", "KeyWords": "Temperature, humidity, CIGS, Moisture ingress, thin film", "Material": "CIGS", "Degradation": "CIGS_Efficiency, AZO", "EquationType": "Arrhenius_BET6", "Equation": "R_D=R_0\\cdot e^{ \\left( \\frac{-E_a}{R\\cdot T_K } \\right) } \\cdot \\left( \\frac{RH}{1-RH+E} \\right)", "R_D": { "units": "% / h" }, "R_0": { "value": 1.1e+17, "units": "% / h" }, "E_a": { "value": 78.6592, "units": "kJ / mol" }, "E": { "value": 0.04 } } ``` -------------------------------- ### Initialize Scenario Object Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/04_scenario/01_scenario_temperature.ipynb Initializes a pvdeg Scenario object with a name, API key, and email. ```python scene_temp = pvdeg.Scenario( name="temperature and degradation", api_key="DEMO_KEY", email="user@mail.com", ) ``` -------------------------------- ### Set up PVlib model Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/02_degradation/04_letid_outdoor_scenario.ipynb Selects a specific module from the CEC modules dataset. ```python cec_modules = cec_modules.T cec_module = cec_modules["LG_Electronics_Inc__LG235N8K_G4"] ``` -------------------------------- ### Degradation Data Example 3 Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/tools/Tools - Degradation.ipynb Example of degradation data for Bisphenol-A polycarbonate (PC) with Hydrolysis degradation. ```json { "DataEntryPerson": "Jada Swailes", "DateEntered": "3/21/2023", "DOI": "10.1016/j.polymdegradstab.2013.04.001", "SourceTitle": "Pickett Coyle Hydrolysis Kinetics of condensation polymers under humidity aging conditions.pdf", "Authors": "James E. Pickett, Dennis J. Coyle", "KeyWords": "PC, humidity, hydrothermal, polycarbonate, polyarylate, aryl ester, aromatic polyester, hydrolysis", "Material": "Bisphenol-A polycarbonate (PC)", "Degradation": "Hydrolysis", "Comments": "RH is a fraction between 0 and 1. Data from Table 5. The paper provided variability for a 95% confidence interval which was divided by 2 to get the standard deviation.", "EquationType": "arrhenius", "Equation": "t_{fail}=R_0\cdot \frac {e^{ \left( \frac{E_a}{R\cdot T_K } \right) }}{RH^2}", "t_fail": { "units": "days" }, "R_0": { "value": 65200000000.0, "units": "days" }, "ln(R_0)": { "value": 24.9, "stdev": 1.6, "units": "ln(days)" } ``` -------------------------------- ### Degradation Data Example 2 Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/tools/Tools - Degradation.ipynb Example of degradation data for Flexible Frontsheet, Frontsheet Coatings with SPQEWT degradation. ```json { "DataEntryPerson": "Weston Wall", "DOI": "10.1109/PVSC45281.2020.9300357", "SourceTitle": "Highly Accelerated UV Stress Testing for Transparent Flexible Frontsheets", "Authors": "Michael D Kempe, Peter Hacke, Joshua Morse, Michael Owen-Bellini, Derek Holsapple, Trevor Lockman, Samantha Hoang, David Okawa, Tamir Lance, Hoi Hong Ng", "Reference": "Kempe, M. D., et al. (2020). Highly Accelerated UV Stress Testing for Transparent Flexible Frontsheets. 2020 47th IEEE Photovoltaic Specialists Conference (PVSC).", "KeyWords": "humidity, irradiance, frontsheet, transmittance", "Material": "Flexible Frontsheet, Frontsheet Coatings", "Degradation": "SPQEWT", "EquationType": "arrhenius", "Equation": "R_D=R_0\cdot RH^n\cdot G_{340}^P\cdot e^{ \left( \frac{-E_a}{R\cdot T_K } \right) }", "R_D": { "units": "%/h" }, "R_0": { "units": "%/h" }, "E_a": { "value": 30.7, "stdev": 23.5, "units": "kJ/mol" }, "p": { "value": 0.53, "stdev": 0.22 } } ``` -------------------------------- ### Execute all tutorial notebooks Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/user_guide/contributing.rst Command to execute all tutorial Jupyter notebooks using nbconvert (use with caution). ```bash jupyter nbconvert --to notebook --execute --inplace "tutorials/**/*.ipynb" ``` -------------------------------- ### Degradation Data Example 1 Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/tools/Tools - Degradation.ipynb Example of degradation data for Flexible Frontsheet, Frontsheet Coatings with yellowness_index degradation. ```json { "Flexible Frontsheet, Frontsheet Coatings": "yellowness_index", "Degradation": "yellowness_index", "EquationType": "arrhenius", "Equation": "R_D=R_0\cdot RH^n\cdot G_{340}^P\cdot e^{ \left( \frac{-E_a}{R\cdot T_K } \right) }", "R_D": { "units": "%/h" }, "R_0": { "units": "%/h" }, "E_a": { "value": 40.4, "stdev": 22.5, "units": "kJ/mol" }, "p": { "value": 0.5, "stdev": 0.25 } } ``` -------------------------------- ### Compare manual and humidity templates Source: https://github.com/nrel/pvdegradationtools/blob/main/tests/sandbox.ipynb Compares the manually created template with the humidity template. ```python pvdeg.utilities.compare_datasets(manual_template, humidity_template) ``` -------------------------------- ### Create a Copy of a Scenario Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/04_scenario/01_scenario_temperature.ipynb This code snippet shows how to load a scenario from a JSON file, effectively creating a copy that can be further manipulated or analyzed. It includes handling potential credential issues and missing data by calculating it. ```python from pathlib import Path parent_dir = Path(pvdeg.PVDEG_DIR).parent new_path = parent_dir / "tutorials" / "data" / "temperature_and_degradation.json" copy = pvdeg.scenario.Scenario.load_json( file_path=str(new_path), email="user@mail.com", api_key="DEMO_KEY", ) copy ``` -------------------------------- ### Loading Scenario with Credentials and Running Source: https://github.com/nrel/pvdegradationtools/blob/main/tests/sandbox.ipynb Loads a Scenario from a JSON file with email and API key, then runs the scenario and retrieves results. ```python Scenario.addLocation = mocker_addLocation a = Scenario.load_json( file_path=os.path.join(TEST_DATA_DIR, "test-scenario.json"), email=EMAIL, api_key=API_KEY, ) a.run() res_df = a.results["test-module"]["GLUSE"] ``` -------------------------------- ### Create and activate a new environment with venv Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/README.md Instructions for creating and activating a new virtual environment using Python's venv module on Mac/Linux. ```bash python -m venv pvdeg . pvdeg/bin/activate ``` -------------------------------- ### Get weather data Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/tools/Tools - Degradation.ipynb This code snippet shows how to get weather data for a specific location using the `pvdeg.weather.get_anywhere` function. ```python # Fairbanks, Alaska # weather_id = (64.84031, -147.73836) # Reykjavik, Iceland # weather_id = (65.14037, -21.91633) weather_id = (33.4152, -111.8315) # Mesa, Arizona # Somewhere else you are interested in. # weather_id = (0,0) weather_df, meta = pvdeg.weather.get_anywhere(id=weather_id) print(meta) # display(weather_df) ``` -------------------------------- ### Set up PVSystem and Location Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/02_degradation/03_letid_outdoor.ipynb Configures the Location and PVSystem objects in pvlib using metadata and selected module/inverter parameters. ```python # set up system in pvlib lat = meta["latitude"] lon = meta["longitude"] tz = meta["tz"] elevation = meta["altitude"] surface_tilt = lat # fixed, latitude tilt surface_azimuth = 180 # south-facing location = Location(lat, lon, tz, elevation, "Golden, CO, USA") system = PVSystem( surface_tilt=surface_tilt, surface_azimuth=surface_azimuth, module_parameters=cec_module, inverter_parameters=cec_inverter, temperature_model_parameters=temperature_model_parameters, ) ``` -------------------------------- ### Initialize Dask Client Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/06_advanced/05_pvgis_distributed.ipynb Initializes a Dask client for parallel processing and prints the dashboard link. ```python workers = 4 cluster = LocalCluster( n_workers=workers, processes=True, ) client = Client(cluster) print(client.dashboard_link) ``` -------------------------------- ### Create and run ModelChain Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/02_degradation/03_letid_outdoor.ipynb Initializes and runs the pvlib ModelChain with the configured system and location. ```python # create and run pvlib modelchain mc = ModelChain(system, location, aoi_model="physical") mc.run_model(weather) ``` -------------------------------- ### Register Custom iPykernel Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/tutorials/index.rst Command to register a custom iPykernel for running notebooks on NREL HPC (Kestrel). ```bash python -m ipykernel install --user --name=pvdeg-env ``` -------------------------------- ### Explicit Auto-templating Example Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/user_guide/geospatial.rst This example explicitly calls geospatial.auto_template to generate a template, which is then passed to geospatial.analysis. The implicit approach is generally preferred. ```Python edge_seal_template = pvdeg.geospatial.auto_template( func=pvdeg.design.edge_seal_width, ds_gids=geo_weather ) geo_res = pvdeg.geospatial.analysis( weather_ds = geo_weather, meta_df = geo_meta, func = pvdeg.design.edge_seal_width, template = edge_seal_template, ) ``` -------------------------------- ### Create and activate a new environment with conda Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/README.md Instructions for creating and activating a new virtual environment using conda. ```bash conda create -n pvdeg conda activate pvdeg ``` -------------------------------- ### Implicit Auto-templating Example Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/user_guide/geospatial.rst This example shows how to use auto-templating implicitly by calling geospatial.analysis on a function that supports it. No template is explicitly provided. ```Python geo_res = pvdeg.geospatial.analysis( weather_ds = geo_weather, meta_df = geo_meta, func = pvdeg.design.edge_seal_width, ) ``` -------------------------------- ### Example JSON Output Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/tools/Tools - Degradation.ipynb This is an example of the JSON output generated by the degradation tools, showing degradation parameters like activation energy and pre-exponential factor. ```json { "E_a": { "value": 92, "stdev": 4.8, "units": "kJ/mol" }, "n": { "value": 2, "stdev": 0, "units": "NA" } } ``` -------------------------------- ### Example docstring for calculate_degradation function Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/user_guide/contributing.rst An example demonstrating the use of Google-style docstrings (numpydoc format) for a Python function, including parameters and return types. ```python def calculate_degradation(temp, humidity, irradiance): """ Calculate degradation rate based on environmental conditions. Parameters ---------- temp : float or array-like Temperature in degrees Celsius. humidity : float or array-like Relative humidity as percentage (0-100). irradiance : float or array-like Irradiance in W/m². Returns ------- ``` -------------------------------- ### Example JSON entry for database contribution Source: https://github.com/nrel/pvdegradationtools/blob/main/docs/source/user_guide/contributing.rst An example of a structured JSON entry for material property data, including value, units, conditions, uncertainty, and reference. ```json { "material": "EVA", "property": "activation_energy", "value": 0.87, "units": "eV", "conditions": { "temperature_range": "60-85 C", "test_method": "Arrhenius analysis", "sample_thickness": "0.46 mm" }, "uncertainty": 0.05, "reference": { "authors": "Smith et al.", "title": "Degradation study of EVA encapsulants", "journal": "Solar Energy Materials", "year": 2020, "doi": "10.1016/j.solmat.2020.xxxxx" } } ``` -------------------------------- ### Dump Scenario Results Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/04_scenario/01_scenario_temperature.ipynb Saves the scenario results to a file. ```python scene_temp.dump() ``` -------------------------------- ### Initialize Dask Client and Load API Credentials Source: https://github.com/nrel/pvdegradationtools/blob/main/tutorials/05_advanced/04_nsrdb_distributed_api.ipynb Loads API credentials from a .env file, sets up a local Dask cluster, and initializes a Dask client. This is crucial for distributed API calls. ```python load_dotenv() ### REPLACE WITH YOUR API KEY AND EMAIL ### api_key = "DEMO_KEY" email = "user@mail.com" ########################################### workers = 4 cluster = LocalCluster( n_workers=workers, processes=True, ) client = Client(cluster) print("Daskboard link") print(client.dashboard_link) ```