Skip to content

Commit b7a4cb3

Browse files
Merge branch 'Kempe_Standoff' into main
2 parents 01ac935 + 19e0f6f commit b7a4cb3

26 files changed

+18801
-8937
lines changed
+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
name: Build distribution 📦
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Set up Python
13+
uses: actions/setup-python@v4
14+
with:
15+
python-version: "3.x"
16+
- name: Install pypa/build
17+
run: >-
18+
python3 -m
19+
pip install
20+
build
21+
--user
22+
- name: Build a binary wheel and a source tarball
23+
run: python3 -m build
24+
- name: Store the distribution packages
25+
uses: actions/upload-artifact@v3
26+
with:
27+
name: python-package-distributions
28+
path: dist/
29+
30+
publish-to-pypi:
31+
name: >-
32+
Publish Python 🐍 distribution 📦 to PyPI
33+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
34+
needs:
35+
- build
36+
runs-on: ubuntu-latest
37+
environment:
38+
name: pypi
39+
url: https://pypi.org/p/pvdeg
40+
permissions:
41+
id-token: write # IMPORTANT: mandatory for trusted publishing
42+
43+
steps:
44+
- name: Download all the dists
45+
uses: actions/download-artifact@v3
46+
with:
47+
name: python-package-distributions
48+
path: dist/
49+
- name: Publish distribution 📦 to PyPI
50+
uses: pypa/gh-action-pypi-publish@release/v1
51+
52+
github-release:
53+
name: >-
54+
Sign the Python 🐍 distribution 📦 with Sigstore
55+
and upload them to GitHub Release
56+
needs:
57+
- publish-to-pypi
58+
runs-on: ubuntu-latest
59+
60+
permissions:
61+
contents: write # IMPORTANT: mandatory for making GitHub Releases
62+
id-token: write # IMPORTANT: mandatory for sigstore
63+
64+
steps:
65+
- name: Download all the dists
66+
uses: actions/download-artifact@v3
67+
with:
68+
name: python-package-distributions
69+
path: dist/
70+
- name: Sign the dists with Sigstore
71+
uses: sigstore/gh-action-sigstore-python@v1.2.3
72+
with:
73+
inputs: >-
74+
./dist/*.tar.gz
75+
./dist/*.whl
76+
- name: Create GitHub Release
77+
env:
78+
GITHUB_TOKEN: ${{ github.token }}
79+
run: >-
80+
gh release create
81+
'${{ github.ref_name }}'
82+
--repo '${{ github.repository }}'
83+
--notes ""
84+
- name: Upload artifact signatures to GitHub Release
85+
env:
86+
GITHUB_TOKEN: ${{ github.token }}
87+
# Upload to GitHub Release using the `gh` CLI.
88+
# `dist/` contains the built packages, and the
89+
# sigstore-produced signatures and certificates.
90+
run: >-
91+
gh release upload
92+
'${{ github.ref_name }}' dist/**
93+
--repo '${{ github.repository }}'
94+
95+
publish-to-testpypi:
96+
name: Publish Python 🐍 distribution 📦 to TestPyPI
97+
needs:
98+
- build
99+
runs-on: ubuntu-latest
100+
101+
environment:
102+
name: testpypi
103+
url: https://test.pypi.org/p/pvdeg
104+
105+
permissions:
106+
id-token: write # IMPORTANT: mandatory for trusted publishing
107+
108+
steps:
109+
- name: Download all the dists
110+
uses: actions/download-artifact@v3
111+
with:
112+
name: python-package-distributions
113+
path: dist/
114+
- name: Publish distribution 📦 to TestPyPI
115+
uses: pypa/gh-action-pypi-publish@release/v1
116+
with:
117+
repository-url: https://test.pypi.org/legacy/

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v3.2.0
5+
rev: v4.5.0
66
hooks:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer

pvdeg/data/psm3.csv

+8,763-8,763
Large diffs are not rendered by default.

pvdeg/data/xeff_demo.csv

+8,763
Large diffs are not rendered by default.

pvdeg/data/xeff_demo.xlsx

1.92 MB
Binary file not shown.

pvdeg/fatigue.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def solder_fatigue(
107107
b=0.33,
108108
C1=405.6,
109109
Q=0.12,
110+
wind_factor=None,
110111
):
111112
"""
112113
Get the Thermomechanical Fatigue of flat plate photovoltaic module solder joints.
@@ -127,6 +128,13 @@ def solder_fatigue(
127128
Must contain dni, dhi, ghi, temp_air, windspeed, and datetime index
128129
meta : dict
129130
site location meta-data
131+
wind_factor : float, optional
132+
Wind speed correction exponent to account for different wind speed measurement heights
133+
between weather database (e.g. NSRDB) and the tempeature model (e.g. SAPM)
134+
The NSRDB provides calculations at 2 m (i.e module height) but SAPM uses a 10 m height.
135+
It is recommended that a power-law relationship between height and wind speed of 0.33
136+
be used. This results in a wind speed that is 1.7 times higher. It is acknowledged that
137+
this can vary significantly.
130138
time_range : timestamp series, optional
131139
Local time of specific site by the hour year-month-day hr:min:sec
132140
(Example) 2002-01-01 01:00:00
@@ -169,7 +177,9 @@ def solder_fatigue(
169177
time_range = weather_df.index
170178

171179
if temp_cell is None:
172-
temp_cell = temperature.cell(weather_df, meta)
180+
temp_cell = temperature.cell(
181+
weather_df=weather_df, meta=meta, wind_factor=wind_factor
182+
)
173183

174184
temp_amplitude, temp_max_avg = _avg_daily_temp_change(time_range, temp_cell)
175185

pvdeg/humidity.py

+13-9
Original file line numberDiff line numberDiff line change
@@ -657,13 +657,13 @@ def module(
657657
azimuth=180,
658658
sky_model="isotropic",
659659
temp_model="sapm",
660-
mount_type="open_rack_glass_glass",
660+
conf="open_rack_glass_glass",
661661
WVTRo=7970633554,
662662
EaWVTR=55.0255,
663663
So=1.81390702,
664664
l=0.5,
665665
Eas=16.729,
666-
wind_speed_factor=1,
666+
wind_factor=0.33,
667667
):
668668
"""Calculate the Relative Humidity of solar module backsheet from timeseries data.
669669
@@ -702,9 +702,13 @@ def module(
702702
Eas : float
703703
Encapsulant solubility activation energy in [kJ/mol]
704704
Eas = 16.729(kJ/mol) is the suggested value for EVA.
705-
wind_speed_factor : float, optional
706-
Wind speed correction factor to account for different wind speed measurement heights
705+
wind_factor : float, optional
706+
Wind speed correction exponent to account for different wind speed measurement heights
707707
between weather database (e.g. NSRDB) and the tempeature model (e.g. SAPM)
708+
The NSRDB provides calculations at 2 m (i.e module height) but SAPM uses a 10 m height.
709+
It is recommended that a power-law relationship between height and wind speed of 0.33
710+
be used. This results in a wind speed that is 1.7 times higher. It is acknowledged that
711+
this can vary significantly.
708712
709713
Returns
710714
--------
@@ -714,7 +718,7 @@ def module(
714718

715719
# solar_position = spectral.solar_position(weather_df, meta)
716720
# poa = spectral.poa_irradiance(weather_df, meta, solar_position, tilt, azimuth, sky_model)
717-
# temp_module = temperature.module(weather_df, poa, temp_model, mount_type, wind_speed_factor)
721+
# temp_module = temperature.module(weather_df, poa, temp_model, mount_type, wind_factor)
718722

719723
poa = spectral.poa_irradiance(
720724
weather_df=weather_df,
@@ -729,8 +733,8 @@ def module(
729733
meta,
730734
poa=poa,
731735
temp_model=temp_model,
732-
conf=mount_type,
733-
wind_speed_factor=wind_speed_factor,
736+
conf=conf,
737+
wind_factor=wind_factor,
734738
)
735739

736740
rh_surface_outside = surface_outside(
@@ -790,7 +794,7 @@ def module(
790794
# So=1.81390702,
791795
# l=0.5,
792796
# Eas=16.729,
793-
# wind_speed_factor=1
797+
# wind_factor=1
794798
# ):
795799

796800
# """Run the relative humidity calculation for a set of project points."""
@@ -861,7 +865,7 @@ def module(
861865
# So,
862866
# l,
863867
# Eas,
864-
# wind_speed_factor
868+
# wind_factor
865869
# )
866870
# future_to_point[future] = gid
867871

pvdeg/spectral.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def solar_position(weather_df, meta):
4242

4343

4444
def poa_irradiance(
45-
weather_df, meta, sol_position=None, tilt=None, azimuth=180, sky_model="isotropic"
45+
weather_df, meta, sol_position=None, tilt=None, azimuth=None, sky_model="isotropic"
4646
):
4747
"""
4848
Calculate plane-of-array (POA) irradiance using pvlib based on weather data from the
@@ -60,7 +60,7 @@ def poa_irradiance(
6060
The tilt angle of the PV panels in degrees, if None, the latitude of the
6161
location is used.
6262
azimuth : float, optional
63-
The azimuth angle of the PV panels in degrees, 180 by default - facing south.
63+
The azimuth angle of the PV panels in degrees. Equatorial facing by default.
6464
sky_model : str, optional
6565
The pvlib sky model to use, 'isotropic' by default.
6666
@@ -74,6 +74,11 @@ def poa_irradiance(
7474
# TODO: change for handling HSAT tracking passed or requested
7575
if tilt is None:
7676
tilt = float(meta["latitude"])
77+
if azimuth is None: # Sets the default orientation to equator facing.
78+
if float(meta["latitude"]) < 0:
79+
azimuth = 0
80+
else:
81+
azimuth = 180
7782

7883
if sol_position is None:
7984
sol_position = solar_position(weather_df, meta)

0 commit comments

Comments
 (0)