Skip to content

Commit

Permalink
Merge branch 'Kempe_Standoff' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-springer authored Jan 31, 2024
2 parents 01ac935 + 19e0f6f commit b7a4cb3
Show file tree
Hide file tree
Showing 26 changed files with 18,801 additions and 8,937 deletions.
117 changes: 117 additions & 0 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI

on: push

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pvdeg
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v1.2.3
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
needs:
- build
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/pvdeg

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand Down
17,526 changes: 8,763 additions & 8,763 deletions pvdeg/data/psm3.csv

Large diffs are not rendered by default.

8,763 changes: 8,763 additions & 0 deletions pvdeg/data/xeff_demo.csv

Large diffs are not rendered by default.

Binary file added pvdeg/data/xeff_demo.xlsx
Binary file not shown.
12 changes: 11 additions & 1 deletion pvdeg/fatigue.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def solder_fatigue(
b=0.33,
C1=405.6,
Q=0.12,
wind_factor=None,
):
"""
Get the Thermomechanical Fatigue of flat plate photovoltaic module solder joints.
Expand All @@ -127,6 +128,13 @@ def solder_fatigue(
Must contain dni, dhi, ghi, temp_air, windspeed, and datetime index
meta : dict
site location meta-data
wind_factor : float, optional
Wind speed correction exponent to account for different wind speed measurement heights
between weather database (e.g. NSRDB) and the tempeature model (e.g. SAPM)
The NSRDB provides calculations at 2 m (i.e module height) but SAPM uses a 10 m height.
It is recommended that a power-law relationship between height and wind speed of 0.33
be used. This results in a wind speed that is 1.7 times higher. It is acknowledged that
this can vary significantly.
time_range : timestamp series, optional
Local time of specific site by the hour year-month-day hr:min:sec
(Example) 2002-01-01 01:00:00
Expand Down Expand Up @@ -169,7 +177,9 @@ def solder_fatigue(
time_range = weather_df.index

if temp_cell is None:
temp_cell = temperature.cell(weather_df, meta)
temp_cell = temperature.cell(
weather_df=weather_df, meta=meta, wind_factor=wind_factor
)

temp_amplitude, temp_max_avg = _avg_daily_temp_change(time_range, temp_cell)

Expand Down
22 changes: 13 additions & 9 deletions pvdeg/humidity.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,13 +657,13 @@ def module(
azimuth=180,
sky_model="isotropic",
temp_model="sapm",
mount_type="open_rack_glass_glass",
conf="open_rack_glass_glass",
WVTRo=7970633554,
EaWVTR=55.0255,
So=1.81390702,
l=0.5,
Eas=16.729,
wind_speed_factor=1,
wind_factor=0.33,
):
"""Calculate the Relative Humidity of solar module backsheet from timeseries data.
Expand Down Expand Up @@ -702,9 +702,13 @@ def module(
Eas : float
Encapsulant solubility activation energy in [kJ/mol]
Eas = 16.729(kJ/mol) is the suggested value for EVA.
wind_speed_factor : float, optional
Wind speed correction factor to account for different wind speed measurement heights
wind_factor : float, optional
Wind speed correction exponent to account for different wind speed measurement heights
between weather database (e.g. NSRDB) and the tempeature model (e.g. SAPM)
The NSRDB provides calculations at 2 m (i.e module height) but SAPM uses a 10 m height.
It is recommended that a power-law relationship between height and wind speed of 0.33
be used. This results in a wind speed that is 1.7 times higher. It is acknowledged that
this can vary significantly.
Returns
--------
Expand All @@ -714,7 +718,7 @@ def module(

# solar_position = spectral.solar_position(weather_df, meta)
# poa = spectral.poa_irradiance(weather_df, meta, solar_position, tilt, azimuth, sky_model)
# temp_module = temperature.module(weather_df, poa, temp_model, mount_type, wind_speed_factor)
# temp_module = temperature.module(weather_df, poa, temp_model, mount_type, wind_factor)

poa = spectral.poa_irradiance(
weather_df=weather_df,
Expand All @@ -729,8 +733,8 @@ def module(
meta,
poa=poa,
temp_model=temp_model,
conf=mount_type,
wind_speed_factor=wind_speed_factor,
conf=conf,
wind_factor=wind_factor,
)

rh_surface_outside = surface_outside(
Expand Down Expand Up @@ -790,7 +794,7 @@ def module(
# So=1.81390702,
# l=0.5,
# Eas=16.729,
# wind_speed_factor=1
# wind_factor=1
# ):

# """Run the relative humidity calculation for a set of project points."""
Expand Down Expand Up @@ -861,7 +865,7 @@ def module(
# So,
# l,
# Eas,
# wind_speed_factor
# wind_factor
# )
# future_to_point[future] = gid

Expand Down
9 changes: 7 additions & 2 deletions pvdeg/spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def solar_position(weather_df, meta):


def poa_irradiance(
weather_df, meta, sol_position=None, tilt=None, azimuth=180, sky_model="isotropic"
weather_df, meta, sol_position=None, tilt=None, azimuth=None, sky_model="isotropic"
):
"""
Calculate plane-of-array (POA) irradiance using pvlib based on weather data from the
Expand All @@ -60,7 +60,7 @@ def poa_irradiance(
The tilt angle of the PV panels in degrees, if None, the latitude of the
location is used.
azimuth : float, optional
The azimuth angle of the PV panels in degrees, 180 by default - facing south.
The azimuth angle of the PV panels in degrees. Equatorial facing by default.
sky_model : str, optional
The pvlib sky model to use, 'isotropic' by default.
Expand All @@ -74,6 +74,11 @@ def poa_irradiance(
# TODO: change for handling HSAT tracking passed or requested
if tilt is None:
tilt = float(meta["latitude"])
if azimuth is None: # Sets the default orientation to equator facing.
if float(meta["latitude"]) < 0:
azimuth = 0
else:
azimuth = 180

if sol_position is None:
sol_position = solar_position(weather_df, meta)
Expand Down
Loading

0 comments on commit b7a4cb3

Please sign in to comment.