Skip to content

Commit

Permalink
PySAM 3.0.0 Release (#106)
Browse files Browse the repository at this point in the history
* files for pysam 2.2.4

* update build_manylinux.sh

* update tests and conda build

* update SAM_api files

* closes #89 certifi certificates in fetchresource

* fixes #94

* start v 2.3.0

* fix #69

* changes from 2021.12.2 release

* add VersionChanges.rst

* add version_differ.py

* add more release info

* update version_differ.py doc str

* correct version_differ.py with PySSC

* add python 3.10

* fix getting env variables during build and remove pandas dependency

* fix test_ResouceTools.py

* switch to manylinux2010 for Python 3.10 support
  • Loading branch information
dguittet authored Jan 5, 2022
1 parent 1e786db commit 504ae05
Show file tree
Hide file tree
Showing 115 changed files with 30,220 additions and 17,920 deletions.
5 changes: 3 additions & 2 deletions Examples/FetchResourceFileExample.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@authors: skoeb, cpaulgilman
'''

import os
import PySAM.ResourceTools as tools # MOVE BACK TO FILES FOLDER
import PySAM.Windpower as wp
import PySAM.Singleowner as so
Expand All @@ -21,8 +22,8 @@
import geocoder

# replace with key and email address from https://developer.nrel.gov/signup/
sam_api_key = ''
sam_email = ''
sam_api_key = os.environ.get('NREL_API_KEY')
sam_email = os.environ.get('NREL_API_EMAIL')
geocode_api_key = '' # optional, may be required for geocoder

# --- Location Coordinates ---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"metadata": {},
"outputs": [],
"source": [
"Workingfolder = 'NRELBifacialPVHsatExample'"
"Workingfolder = '.'"
]
},
{
Expand Down
12 changes: 12 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Release Notes

## Version 3.0.0, Dec 23, 2021 ~ SAM 2021.12.02, SSC Version 267
* __Warning: Significant changes to Battery and UtilityRate5 Modules, including redefinition of some variables.__
Please see [SSC Release Notes](https://nrel.github.io/ssc/doc/releasenotes.html) for description of functionality and
variable changes, and please see "Version Changes" section in [PySAM Documentation](https://nrel-pysam.readthedocs.io/)
for full list of variable changes.
* Fix FetchResourceFiles's InsecureRequestWarning (#89); html error messages (#94); verbosity (#96)
* Fix SAM_CSV_to_solar_data function missing information (#98)
* Fix URDBv7_to_ElectricityRates error for certain demand structures (#99)
* Add Python 3.10 Support (#104)
* New Example for Selecting Modules and Inverter from the SAM Library (#103)
* [SAM Release updates for Version 2020.12.02](https://nrel.github.io/SAM/doc/releasenotes.html)

## Version 2.2.4, Aug 20, 2021 ~ SAM 2020.11.29, Revision 2, SSC Version 259
* Fix bug in Battery LMO/LTO life model
* Fix a few cost defaults for PV PPA-model configuration
Expand Down
4 changes: 2 additions & 2 deletions build_conda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ export DIST_DIR
yes | conda install conda-build
yes | conda activate base
conda update -n base -c defaults conda
for PYTHONVER in 3.6 3.7 3.8 3.9
for PYTHONVER in 3.6 3.7 3.8 3.9 3.10
do
conda-build stubs --output-folder=$DIST_DIR --python=$PYTHONVER || exit
conda build purge
done

for PYTHONVER in 3.6 3.7 3.8 3.9
for PYTHONVER in 3.6 3.7 3.8 3.9 3.10
do
export PYTHONVER
conda-build conda --output-folder=$DIST_DIR --python=$PYTHONVER --prefix-length=0 || exit
Expand Down
2 changes: 1 addition & 1 deletion build_manylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ cmake ${SAMNTDIR}/api -DCMAKE_BUILD_TYPE=Release -DSAMAPI_EXPORT=1 -DSAM_SKIP_AU
make -j 6

cd $PYSAMDIR
for PYTHONENV in cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39
for PYTHONENV in cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310
do
yes | /opt/python/$PYTHONENV/bin/pip install -r tests/requirements.txt
yes | /opt/python/$PYTHONENV/bin/pip uninstall NREL-PySAM NREL-PySAM-stubs
Expand Down
8 changes: 5 additions & 3 deletions build_unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ source $(conda info --base)/etc/profile.d/conda.sh
rm -rf build
rm -rf dist/*

for PYTHONENV in pysam_build_3.6 pysam_build_3.7 pysam_build_3.8 pysam_build_3.9
for PYTHONENV in pysam_build_3.6 pysam_build_3.7 pysam_build_3.8 pysam_build_3.9 pysam_build_3.10
do
conda activate $PYTHONENV
yes | pip install -r tests/requirements.txt
Expand All @@ -39,15 +39,17 @@ done
mypy stubs/stubs || exit
python stubs/setup.py bdist_wheel

twine upload $PYSAMDIR/dist/*stubs*.whl

yes | $PYSAMDIR/build_conda.sh || exit

#
# Building for Manylinux1
#

cd ..
docker pull quay.io/pypa/manylinux1_x86_64
docker run --rm -v $(pwd):/io quay.io/pypa/manylinux1_x86_64 /io/pysam/build_manylinux.sh
docker pull quay.io/pypa/manylinux2010_x86_64
docker run --rm -dit -v $(pwd):/io quay.io/pypa/manylinux2010_x86_64 /bin/bash
rename -s linux manylinux1 $PYSAMDIR/dist/*-linux_*

docker pull continuumio/anaconda
Expand Down
2 changes: 1 addition & 1 deletion build_win.bat
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cd %PYSAMDIR%
echo y | rmdir build /s
echo y | del dist/*

FOR %%i IN (pysam_build_3.6 pysam_build_3.7, pysam_build_3.8 pysam_build_3.9) DO (
FOR %%i IN (pysam_build_3.6 pysam_build_3.7, pysam_build_3.8 pysam_build_3.9 pysam_build_3.10) DO (
call deactivate
call activate %%i
echo y | pip install -r tests/requirements.txt
Expand Down
288 changes: 162 additions & 126 deletions docs/Configs.rst

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions docs/Import.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ There will be a JSON file generated by SAM for each of these modules: *pvwatts7*
The order of the modules can be found in (:doc:`Configs`). The `from_existing` function (see :doc:`Initialization`) allows
different modules to share the same underlying data.
::

import json
import PySAM.Pvwattsv7 as PVWatts
import PySAM.Grid as Grid
Expand All @@ -36,12 +37,14 @@ different modules to share the same underlying data.

The json files exported from the SAM GUI are then collected in order.
::

dir = "/Users/dguittet/SAM-Dev/PySAM Json/"
file_names = ["untitled_pvwattsv7", "untitled_grid", "untitled_utilityrate5", "untitled_cashloan"]
modules = [pv, grid, ur, cl]

Then read the data from the json into the models.
::

for f, m in zip(file_names, modules):
with open(dir + f + ".json", 'r') as file:
data = json.load(file)
Expand All @@ -62,11 +65,13 @@ Example (Continued)
^^^^^^^^^^^^^^^^^^^
Here we continue our example.
::

for m in modules:
m.execute()

We can then print out some of the data. The variable and group names are found in the :doc:`Models`.
::

print('ac_annual: ', pv.Outputs.ac_annual)
print('ur_ec_tou_mat: ', ur.ElectricityRates.ur_ec_tou_mat)
print('cl.Outputs.npv: ', cl.Outputs.npv)
Expand Down
Loading

0 comments on commit 504ae05

Please sign in to comment.