Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Santosh Philip committed Oct 19, 2024
2 parents f181461 + ce5e9cd commit 3b3a79b
Show file tree
Hide file tree
Showing 37 changed files with 217,982 additions and 306 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#!/bin/bash
function version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
# Check if EnergyPlus env variables exist already. If not use these defaults
if [[ -z "${ENERGYPLUS_VERSION}" ]]; then
export ENERGYPLUS_VERSION=9.2.0
fi
if [[ -z "${ENERGYPLUS_SHA}" ]]; then
export ENERGYPLUS_SHA=921312fa1d
fi
if [[ -z "${ENERGYPLUS_INSTALL_VERSION}" ]]; then
export ENERGYPLUS_INSTALL_VERSION=9-2-0
fi

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if version_gt $ENERGYPLUS_VERSION 9.3.0; then
export EXT="sh"
export PLATFORM=Linux-Ubuntu18.04
else
export EXT="sh"
export PLATFORM=Linux
fi
export ATTCHBASE=67022360382
export ATTCHNUM="multipletransitionidfversionupdater-lin.tar.gz"
elif [[ "$OSTYPE" == "darwin"* ]]; then
if version_gt $ENERGYPLUS_VERSION 9.3.0; then
export EXT=dmg
export PLATFORM=Darwin-macOS10.15
else
export EXT=dmg
export PLATFORM=Darwin
fi
export ATTCHBASE=67022360547
export ATTCHNUM="idfversionupdater-macos-v8.4.0.zip"
elif [[ "$OSTYPE" == "win"* || "$OSTYPE" == "msys"* ]]; then
export EXT=zip
export PLATFORM=Windows
export ATTCHBASE=67022360088
export ATTCHNUM="multipletransitionidfversionupdater-win.zip"
fi
# Download EnergyPlus executable
ENERGYPLUS_DOWNLOAD_BASE_URL=https://github.com/NREL/EnergyPlus/releases/download/v$ENERGYPLUS_VERSION
ENERGYPLUS_DOWNLOAD_FILENAME=EnergyPlus-$ENERGYPLUS_VERSION-$ENERGYPLUS_SHA-$PLATFORM-x86_64
ENERGYPLUS_DOWNLOAD_URL=$ENERGYPLUS_DOWNLOAD_BASE_URL/$ENERGYPLUS_DOWNLOAD_FILENAME.$EXT
echo "$ENERGYPLUS_DOWNLOAD_URL"
curl --fail -SL -C - "$ENERGYPLUS_DOWNLOAD_URL" -o "$ENERGYPLUS_DOWNLOAD_FILENAME".$EXT

# Extra downloads
EXTRAS_DOWNLOAD_URL=https://energyplushelp.freshdesk.com/helpdesk/attachments/$ATTCHBASE
curl --fail -SL -C - $EXTRAS_DOWNLOAD_URL -o $ATTCHNUM

# Install EnergyPlus and Extra Downloads
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo chmod +x "$ENERGYPLUS_DOWNLOAD_FILENAME".$EXT
printf "y\r" | sudo ./"$ENERGYPLUS_DOWNLOAD_FILENAME".$EXT
sudo tar zxvf $ATTCHNUM -C /usr/local/EnergyPlus-"$ENERGYPLUS_INSTALL_VERSION"/PreProcess/IDFVersionUpdater
sudo chmod -R a+rwx /usr/local/EnergyPlus-"$ENERGYPLUS_INSTALL_VERSION"/PreProcess/IDFVersionUpdater
sudo chmod -R a+rwx /usr/local/EnergyPlus-"$ENERGYPLUS_INSTALL_VERSION"/ExampleFiles
# cleanup
sudo rm "$ENERGYPLUS_DOWNLOAD_FILENAME".$EXT
sudo rm $ATTCHNUM
elif [[ "$OSTYPE" == "darwin"* ]]; then
# getting custom install script https://github.com/NREL/EnergyPlus/pull/7615
curl -SL -C - https://raw.githubusercontent.com/jmarrec/EnergyPlus/40afb275f66201db5305f54df6c070d0b0cb4fc3/cmake/qtifw/install_script.qs -o install_script.qs
sudo hdiutil attach "$ENERGYPLUS_DOWNLOAD_FILENAME".$EXT
sudo /Volumes/"$ENERGYPLUS_DOWNLOAD_FILENAME"/"$ENERGYPLUS_DOWNLOAD_FILENAME".app/Contents/MacOS/"$ENERGYPLUS_DOWNLOAD_FILENAME" --verbose --script install_script.qs
sudo tar zxvf $ATTCHNUM -C /Applications/EnergyPlus-"$ENERGYPLUS_INSTALL_VERSION"/PreProcess
sudo chmod -R a+rwx /Applications/EnergyPlus-"$ENERGYPLUS_INSTALL_VERSION"/PreProcess/IDFVersionUpdater
sudo chmod -R a+rwx /Applications/EnergyPlus-"$ENERGYPLUS_INSTALL_VERSION"/ExampleFiles
# cleanup
sudo rm install_script.qs
sudo rm "$ENERGYPLUS_DOWNLOAD_FILENAME".$EXT
sudo rm $ATTCHNUM
elif [[ "$OSTYPE" == "win"* || "$OSTYPE" == "msys"* ]]; then
# On windows, we are simply extracting the zip file to c:\\
echo "Extracting and Copying files to... C:\\"
powershell Expand-Archive -Path $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT -DestinationPath C:\\
powershell Rename-Item -Path c:\\$ENERGYPLUS_DOWNLOAD_FILENAME -NewName EnergyPlusV"$ENERGYPLUS_INSTALL_VERSION"
# extract extra downloads to destination
DEST=C:\\EnergyPlusV"$ENERGYPLUS_INSTALL_VERSION"\\PreProcess\\IDFVersionUpdater
echo "Extracting and Copying files to... $DEST"
powershell Expand-Archive -Path $ATTCHNUM -DestinationPath "$DEST" -Force
# cleanup
rm -v $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT
rm -v $ATTCHNUM
IDD=C:\\EnergyPlusV"$ENERGYPLUS_INSTALL_VERSION"\\Energy+.idd
if [ -f "$IDD" ]; then
echo "$IDD" exists
else
echo "$IDD" does not exist
travis_terminate 1
fi
fi
62 changes: 62 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: eppy package

on:
push:
branches: ["master", "develop" ,]
inputs:
energyplus-version:
description: 'EnergyPlus major.minor.patch version'
required: true
default: 9.2.0
energyplus-sha:
description: 'EnergyPlus version SHA'
required: true
default: 921312fa1d
energyplus-install:
description: 'EnergyPlus major-minor-patch version'
default: 9-2-0
required: true


jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", ]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest==7.1.3
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- run: echo Installing EnergyPlusV${{ inputs.energyplus-version }}...
shell: bash
- run: echo "${{ github.action_path }}" >> $GITHUB_PATH
shell: bash
- run: bash .github/workflows/install.sh
shell: bash
env:
ENERGYPLUS_VERSION: ${{ inputs.energyplus-version }}
ENERGYPLUS_SHA: ${{ inputs.energyplus-sha }}
ENERGYPLUS_INSTALL_VERSION: ${{ inputs.energyplus-install }}

- name: Test with pytest
env:
ENERGYPLUS_VERSION: 9.2.0
ENERGYPLUS_SHA: ${{ inputs.energyplus-sha }}
ENERGYPLUS_INSTALL_VERSION: 9-2-0
EPPY_INTEGRATION: TRUE
run: |
pytest
81 changes: 81 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,87 @@ History
Changes
~~~~~~~

release r0.5.66
~~~~~~~~~~~~~~~

Date: Sat Oct 19 05:35:47 2024 -0700
--------------------------------------

fixed issue #444
````````````````

:Problem: Extensible fields not expanding automatically in IDD for WINDOWSHADINGCONTROL
:Solution: fixed how Extensible fields were identified

eppy was using the presence of an integer in the extensible field to identify it as extensible. Some non-extensible fields have integers in them. Now eppy identifies the Extensible field by key-words such as begin-extensible

Date: Sat Oct 19 05:16:43 2024 -0700
--------------------------------------

fixed issue #445
````````````````

:Problem: pytest running on old IDD version 8.0.0
:Solution: pytest now running on version 9.4.0

Date: Fri Nov 10 15:40:03 2023 -0800
--------------------------------------

fixed issue #428
````````````````

:Problem: need CI for eppy
:Solution: Use github actions for CI

Date: Thu Jun 29 19:16:41 2023 -0700
--------------------------------------

fixed issue #422
````````````````

:Problem: readthedocs.org needs a .readthedocs.yaml
:Solution: added a .readthedocs.yaml file

2022-12-23
----------

Fixed issue #411
````````````````

:Problem: eppy run functions does not throw an exception if weather file is missing
:Solution: eppy run function throws Exception "EnergyPlusRunError" with message saying weather file missing


2022-12-08
----------

fixed issue #409
````````````````

:Problem: eppy.newidf(version=None) does not work correctly
:Solution:

There are starting conditions here:

1. IDD is already set
- if IDD has been set, it should use that IDD
2. IDD has not been set
- if eppy.newidf(version=None), it should throw an exception
- if eppy.newidf(version=some_version), it shoule use that some_version of IDD

2022-12-07
----------

fixed issue #410
````````````````

:Problem: need a IDF.resetidd() function during testing
:Solution: IDF.resetidd() will reset all related idd values

modified: eppy/modeleditor.py
modified: tests/test_runner.py


release r0.5.63
~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
19 changes: 15 additions & 4 deletions eppy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,41 @@

__author__ = """Santosh Philip"""
__email__ = "[email protected]"
__version__ = "0.5.63"
__version__ = "0.5.66"


from io import StringIO
import eppy
from eppy import modeleditor
from eppy.modeleditor import IDF


def newidf(version=None):
"""open a new idf file
easy way to open a new idf file for particular version. Works only id Energyplus of that version is installed.
easy way to open a new idf file for particular version. Works only if Energyplus of that version is installed.
- newidf(version=None) or newidf() will workif the IDD has already been set
- newidf(version=some_version) will work
- if some_version matches the IDD already set
- OR if no IDD has been set
Parameters
----------
version: string
version of the new file you want to create. Will work only if this version of Energyplus has been installed.
version of the new file you want to create. Will work only if this version of Energyplus has been installed OR if it matches the IDD already set.
Returns
-------
idf
file of type eppy.modelmake.IDF
""" # noqa: E501
import eppy.easyopen as easyopen

if not version:
version = "8.9"
return IDF(StringIO(""))
# return easyopen.easyopen(StringIO(""))

import eppy.easyopen as easyopen

idfstring = " Version,{};".format(str(version))
Expand Down
2 changes: 1 addition & 1 deletion eppy/iddcurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
from __future__ import print_function
from __future__ import unicode_literals

import eppy.iddv800 as iddcurrent
import eppy.iddv940 as iddcurrent

# import iddv7 as iddcurrent
10 changes: 8 additions & 2 deletions eppy/iddgaps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2012, 2022 Santosh Philip
# Copyright (c) 2012, 2022, 2024 Santosh Philip
# =======================================================================
# Distributed under the MIT License.
# (See accompanying file LICENSE or copy at
Expand Down Expand Up @@ -72,7 +72,13 @@ def repeatingfieldsnames(fields, int_replace=None):
"""get the names of the repeating fields"""
if not int_replace:
int_replace = "%s"
fnames = [field["field"][0] for field in fields]
i = 0
for i, field in enumerate(fields):
if "begin-extensible" in field:
break
# goto where extensible fields begin
# below we get fname for after that
fnames = [field["field"][0] for field in fields[i:]]
fnames = [bunchhelpers.onlylegalchar(fname) for fname in fnames]
fnames = [fname for fname in fnames if bunchhelpers.intinlist(fname.split())]
fnames = [(bunchhelpers.replaceint(fname, int_replace), None) for fname in fnames]
Expand Down
Loading

0 comments on commit 3b3a79b

Please sign in to comment.