diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index dbc56269..259b7694 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -8,7 +8,7 @@ template: | $CONTRIBUTORS categories: - - title: 'Features' + - title: 'New Features' labels: - 'feature' - 'enhancement' @@ -17,5 +17,8 @@ categories: - 'fix' - 'bugfix' - 'bug' + - title: 'Under the hood refactoring ⚙' + labels: + - 'refactoring' name-template: 'v$NEXT_PATCH_VERSION 🌈' tag-template: 'v$NEXT_PATCH_VERSION' diff --git a/.travis.yml b/.travis.yml index c46c12fc..9fafabb5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,81 +1,53 @@ -# Don't use language: python; this gives us an unnecessary virtualenv -language: c - +language: python env: global: - - ARCHETYPAL_INTEGRATION=True ENERGYPLUS_VERSION=9.2.0 ENERGYPLUS_SHA=921312fa1d ENERGYPLUS_INSTALL_VERSION=9-2-0 MINICONDA_VERSION=latest - + - ARCHETYPAL_INTEGRATION=True ENERGYPLUS_VERSION=9.2.0 ENERGYPLUS_SHA=921312fa1d + ENERGYPLUS_INSTALL_VERSION=9-2-0 MINICONDA_VERSION=latest addons: apt: packages: - - wine - - libgfortran3 - + - wine + - libgfortran3 jobs: include: - - os: linux - env: TRAVIS_PYTHON_VERSION=3.7 - - os: osx - env: TRAVIS_PYTHON_VERSION=3.7 - + - name: Python 3.8 on Xenial Linux + python: 3.8 # this works for Linux but is ignored on macOS or Windows + script: py.test --cov=archetypal --verbose tests/ + after_success: + - coverage report -m + - coveralls + - name: Python 3.8 on macOS + os: osx + osx_image: xcode11.2 + language: objective-c + script: py.test --cov=archetypal --verbose tests/ + - name: "Python 3.8 on Windows" + os: windows # Windows 10.0.17134 N/A Build 17134 + language: shell # 'language: python' is an error on Travis CI Windows + script: py.test --cov=archetypal --verbose tests/ + - stage: deploy + script: echo "Deploying to PyPi and GitHub releases ..." + deploy: + - provider: pypi + user: __token__ + password: + secure: cVK75OF2LPDNdPuocxRmuWu4XUgdd81kNo5u/zah7XQf0oKW3TqgVSRhp06XYdQlnCSJZMfe8VJuHoBoCETTDdXFYZMIe6OBlSZeg1xclOtg+Wf4s4zkQ7gMSdzlUKJn9zkINUo7NwRn8Q0GGZCvldJvODzR0xDTcmbeVpeG3WHV8GNosYD7xWNscGBYrF3xVB0euLOHkPyJuFlxzpEhW2XFE7bdMk1/4gwOtfUcCgivpok4dWpgITVEdxRhcBI+ea9NDgpKlJfYHdRX9bBTSFoy8qLEQyvGeNG5cFXW3p+XwsPOKVPnEZv1e2nSYk3Od+sNa+45jte5PNkI43FcIdGaZJadUGck5SUQB9dCWFyLHMQgCtJg4fFLfWBHW5xrfxgOWMK5nqn93qbqOJbLrlw52eNimepfb0FksUpgdkLErkSWGvM5vOSK20Vb4nySjht6PJO88VSUixBd7cdGsioz8X0a69WfVVQhIdYlrjO2N0EGXXi3wh4QTp5VywZue3/cVvC5ainjFq8wuLiBg+LLCObwjj++Qp0OKr9Iw00942HpWhWKEZfpuepMowet8KVCE5SYh5lpKXtZv3+YNrkVy6jfzdZiw4QvMs3VAuQxCdNvILI7h/ktXntwdMT2CIUTKbQrX2uvuSuiwUgo6yRWX+5TkmRVCULpz4qE0lY= + on: + distributions: sdist bdist_wheel + repo: samuelduchesne/archetypal + branch: master + tags: true before_install: - # download EnergyPlus - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then EXT=dmg; PLATFORM=Darwin; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then EXT=sh; PLATFORM=Linux; fi - - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then EXT=exe; PLATFORM=Windows; fi - - 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 - - curl -SLO $ENERGYPLUS_DOWNLOAD_URL - # download extras - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ATTCHBASE=97; ATTCHNUM=8230; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ATTCHBASE=98; ATTCHNUM=8232; fi - - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then ATTCHBASE=86; ATTCHNUM=8231; fi - - EXTRAS_DOWNLOAD_URL=http://energyplus.helpserve.com/Knowledgebase/Article/GetAttachment/$ATTCHBASE/$ATTCHNUM - - curl -SL $EXTRAS_DOWNLOAD_URL -o $ATTCHNUM.zip - # install EnergyPlus - - if [ "$TRAVIS_OS_NAME" == "linux" ]; then - sudo chmod +x $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT; - echo "y\r" | sudo ./$ENERGYPLUS_DOWNLOAD_FILENAME.$EXT; - sudo tar zxvf $ATTCHNUM.zip -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; fi - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then - curl -SLO https://raw.githubusercontent.com/NREL/EnergyPlus/3cf5e1c8e6944e8a7760b80078c6945073cc8364/cmake/qtifw/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.zip -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; fi - - if [ "$TRAVIS_OS_NAME" == "windows" ]; then - sudo chmod +x $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT; - echo "y\r" | sudo ./$ENERGYPLUS_DOWNLOAD_FILENAME.$EXT; fi - # remove install files - - sudo rm $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT - - sudo rm $ATTCHNUM.zip - - # Install python for Linux and macOS - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then MINICONDA_OS=Linux; else MINICONDA_OS=MacOSX; fi - - wget https://repo.anaconda.com/miniconda/Miniconda3-$MINICONDA_VERSION-$MINICONDA_OS-x86_64.sh -O miniconda.sh - - bash miniconda.sh -b -p "$HOME"/miniconda - - source "$HOME"/miniconda/etc/profile.d/conda.sh - - # create and activate environment - - conda config --set always_yes yes --set changeps1 no - - conda update -q conda; - # Useful for debugging any issues with conda - - conda info -a - # new env - - conda env update -q -n test-env python=$TRAVIS_PYTHON_VERSION -f environment.yml - - conda activate test-env - -# Main script +- source install_energyplus.sh +- wget https://raw.githubusercontent.com/trichter/conda4travis/latest/conda4travis.sh -O conda4travis.sh +- source conda4travis.sh +- conda config --set always_yes yes --set changeps1 no +- conda update -q conda +- conda info -a +- conda env update -q -n test-env python=$TRAVIS_PYTHON_VERSION -f environment.yml +- conda activate test-env +- python --version install: - - pip install --upgrade setuptools - - pip install --upgrade pip - - pip install .[dev] -script: - - py.test --cov=archetypal --verbose tests/ -after_success: - - coverage report -m - - coveralls +- pip install --upgrade pip +- pip install --upgrade setuptools +- pip install .[dev] \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 4c742a5c..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,83 +0,0 @@ -build: false -environment: - matrix: - - PYTHON: "C:\\Python37" - PYTHONVERSION: 3.7 - PLATFORM: "Windows" - ARCHITECTURE: "i386" - MINICONDA: "C:\\Miniconda37" - ENERGYPLUS_VERSION: "9.2.0" - ENERGYPLUS_INSTALL_VERSION: "9-2-0" - ENERGYPLUS_SHA: "921312fa1d" - EXT: "exe" - - PYTHON: "C:\\Python37-x64" - PYTHONVERSION: 3.7 - PLATFORM: "Windows" - ARCHITECTURE: "x86_64" - MINICONDA: "C:\\Miniconda37-x64" - ENERGYPLUS_VERSION: "9.2.0" - ENERGYPLUS_INSTALL_VERSION: "9-2-0" - ENERGYPLUS_SHA: "921312fa1d" - EXT: "exe" -install: - # set up Miniconda test environment - - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" - - conda config --set always_yes yes --set changeps1 no - - conda info -a - - conda update -q conda - - activate - - "conda create -n test-env python=%PYTHONVERSION% pytest" - - "activate test-env" - - - ECHO "Filesystem root:" - - ps: "ls \"C:/\"" - - - ECHO "Installed SDKs:" - - ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\"" - - # install EnergyPlus - - cmd: SET ENERGYPLUS_DOWNLOAD_BASE_URL=https://github.com/NREL/EnergyPlus/releases/download/v%ENERGYPLUS_VERSION% - - cmd: SET ENERGYPLUS_DOWNLOAD_FILENAME=EnergyPlus-%ENERGYPLUS_VERSION%-%ENERGYPLUS_SHA%-%PLATFORM%-%ARCHITECTURE%.%EXT% - - cmd: SET ENERGYPLUS_DOWNLOAD_URL=%ENERGYPLUS_DOWNLOAD_BASE_URL%/%ENERGYPLUS_DOWNLOAD_FILENAME% - - - cmd: ECHO Downloading EnergyPlus at... - - cmd: ECHO %ENERGYPLUS_DOWNLOAD_URL% - - cmd: curl -SLO %ENERGYPLUS_DOWNLOAD_URL% - - # getting install script for silent install - - cmd: SET INSTALLSCRIPT_URL=https://raw.githubusercontent.com/NREL/EnergyPlus/3cf5e1c8e6944e8a7760b80078c6945073cc8364/cmake/qtifw/install_script.qs - - cmd: "curl -SLO %INSTALLSCRIPT_URL%" - - cmd: "%ENERGYPLUS_DOWNLOAD_FILENAME% --verbose --script install_script.qs" - - # Install additional material - - ECHO Installing additional files... - - SET ATTCHBASE=86 - - SET ATTCHNUM=8231 - - SET EXTRAS_DOWNLOAD_URL="http://energyplus.helpserve.com/Knowledgebase/Article/GetAttachment/%ATTCHBASE%/%ATTCHNUM%" - - - ECHO Installing older conversion files from... - - ECHO %EXTRAS_DOWNLOAD_URL% - - curl -SL %EXTRAS_DOWNLOAD_URL% -o %ATTCHNUM%.zip - - - ECHO Listing all files in current directory - - ps: ls - - - SET DEST=C:\EnergyPlusV%ENERGYPLUS_INSTALL_VERSION%\PreProcess\IDFVersionUpdater - - ECHO Extracting and Copying files to... - - ECHO %DEST% - - ps: $env:ATTCHNUM = 8231 - - ps: $env:DEST = "C:\EnergyPlusV$env:ENERGYPLUS_INSTALL_VERSION\PreProcess\IDFVersionUpdater" - - ps: "Expand-Archive -Path C:\\projects\\archetypal\\$env:ATTCHNUM.zip -DestinationPath $env:DEST -Force" - - DEL /s "%ATTCHNUM%.zip" - - - ECHO Succesfully installed EnergyPlus and conversion files - - - ECHO %PYTHON% - - # Install dependencies that often crash on Windows using conda - - conda install shapely - - # install archetypal - - "pip install .[dev]" -test_script: - - cmd: pytest --cov=archetypal --verbose tests/ \ No newline at end of file diff --git a/archetypal/template/building_template.py b/archetypal/template/building_template.py index bc220b5e..4a6e7afe 100644 --- a/archetypal/template/building_template.py +++ b/archetypal/template/building_template.py @@ -46,6 +46,7 @@ def __init__( Windows=None, Lifespan=60, PartitionRatio=0.35, + DefaultWindowToWallRatio=0.4, **kwargs ): """Initialize a :class:`BuildingTemplate` object with the following @@ -63,8 +64,11 @@ def __init__( Lifespan (float): The projected lifespan of the building template in years. Used in various calculations such as embodied energy. PartitionRatio (float): The number of lineal meters of partitions - (Floor to ceiling) present in average in the building floor - plan by m2. + (Floor to ceiling) present in average in the building floor plan + by m2. + DefaultWindowToWallRatio (float): The default Window to Wall Ratio + (WWR) for this template (same for all orientations). Number + between 0 and 1. **kwargs: other optional keywords passed to other constructors. """ super(BuildingTemplate, self).__init__(**kwargs) @@ -75,6 +79,7 @@ def __init__( self.Perimeter = Perimeter self.Structure = Structure self.Windows = Windows + self.DefaultWindowToWallRatio = DefaultWindowToWallRatio def __hash__(self): return hash((self.__class__.__name__, self.Name, self.DataSource)) diff --git a/archetypal/template/umi_base.py b/archetypal/template/umi_base.py index 454b61fb..22e25e9f 100644 --- a/archetypal/template/umi_base.py +++ b/archetypal/template/umi_base.py @@ -111,7 +111,7 @@ def __init__( self.sql = sql self.Category = Category self.Comments = Comments - if DataSource is "": + if DataSource == "": try: self.DataSource = self.idf.building_name(use_idfname=True) except: diff --git a/docs/conf.py b/docs/conf.py index c429383d..8bb5235d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -211,8 +211,8 @@ def setup(app): "eppy": ("https://eppy.readthedocs.io/en/latest/", None), "numpy": ("https://docs.scipy.org/doc/numpy/", None), "networkx": ( - "https://networkx.github.io/documentation/stable" "/index" ".html", - "https://networkx.github.io/objects.inv", + "https://networkx.github.io/documentation/stable/index.html", + "https://networkx.github.io/documentation/stable/objects.inv", ), "umidocs": ("https://umidocs.readthedocs.io/en/latest/", None), } diff --git a/docs/converter_bui.rst b/docs/converter_bui.rst index 79e75da3..b0092a4e 100644 --- a/docs/converter_bui.rst +++ b/docs/converter_bui.rst @@ -91,56 +91,57 @@ respectively. 4. `OPTIONS`: There are different options to the `convert` command. The first 3 manage the requested output files. Users can chose to return a combination of flags - - if ``-i`` is added, the path to the modified IDF file is returned in the console, and the modified - IDF file is returned in the output folder. If ``-t`` is added, the path to the T3D file (converted from the IDF file) is returned. - If ``-d`` is added, the DCK file (TRNSYS input file) is returned in the output folder, and the path to this DCK file is returned in the console. + - if ``-i`` is added, the path to the modified IDF file is returned in the console, and the modified IDF file is + returned in the output folder. If ``-t`` is added, the path to the T3D file (converted from the IDF file) is + returned. If ``-d`` is added, the DCK file (TRNSYS input file) is returned in the output folder, and the path to + this DCK file is returned in the console. .. code-block:: python - archetypal convert -i -t -d "/Users/Documents/NECB 2011 - Warehouse.idf" "/Users/Documents/WIP" + archetypal convert -i -t -d "/Users/Documents/NECB 2011 - Warehouse.idf" "/Users/Documents/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw" "/Users/Documents/WIP" - ``--window_lib`` is the path of the window library (W74-lib.dat). This library must be in the same format as the - Berkeley Lab library used by default in TRNBuild. If nothing is passed, the "W74-lib.dat" file available in the - package "ressources" folder will be used. + Berkeley Lab library used by default in TRNBuild. If nothing is passed, the "W74-lib.dat" file available in the + package "ressources" folder will be used. .. code-block:: python - archetypal convert --window-lib "/Users/Documents/W74-lib.dat" "/Users/Documents/NECB 2011 - Warehouse.idf" "/Users/Documents/WIP" + archetypal convert --window-lib "/Users/Documents/W74-lib.dat" "/Users/Documents/NECB 2011 - Warehouse.idf" "/Users/Documents/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw" "/Users/Documents/WIP" - ``--trnsidf_exe`` is the path of the trnsidf.exe executable. Usually located in the TRNSYS18 folder under - "Building/trnsIDF/trnsidf.exe". - If nothing is passed, the following path will be used : "C:TRNSYS18\\Building\\trnsIDF\\trnsidf.exe". + "Building/trnsIDF/trnsidf.exe". + If nothing is passed, the following path will be used : "C:TRNSYS18\\Building\\trnsIDF\\trnsidf.exe". .. code-block:: python - archetypal convert --trnsidf-exe "C:TRNSYS18\\Building\\trnsIDF\\trnsidf.exe" "/Users/Documents/NECB 2011 - Warehouse.idf" "/Users/Documents/WIP" + archetypal convert --trnsidf-exe "C:TRNSYS18\\Building\\trnsIDF\\trnsidf.exe" "/Users/Documents/NECB 2011 - Warehouse.idf" "/Users/Documents/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw" "/Users/Documents/WIP" - ``--template`` is the path of the .d18 template file (usually in the same directory as the `trnsidf.exe` executable). - If nothing is passed, the following path will be used : "C:TRNSYS18\\Building\\trnsIDF\\NewFileTemplate.d18". + If nothing is passed, the following path will be used : "C:TRNSYS18\\Building\\trnsIDF\\NewFileTemplate.d18". .. code-block:: python - archetypal convert --template "C:TRNSYS18\\Building\\trnsIDF\\NewFileTemplate.d18" "/Users/Documents/NECB 2011 - Warehouse.idf" "/Users/Documents/WIP" + archetypal convert --template "C:TRNSYS18\\Building\\trnsIDF\\NewFileTemplate.d18" "/Users/Documents/NECB 2011 - Warehouse.idf" "/Users/Documents/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw" "/Users/Documents/WIP" - ``--log_clear_names`` if added, do not print log of "clear_names" (equivalence between old and new names) in - the console. + the console. .. code-block:: python - archetypal convert --log-clear-names "/Users/Documents/NECB 2011 - Warehouse.idf" "/Users/Documents/WIP" + archetypal convert --log-clear-names "/Users/Documents/NECB 2011 - Warehouse.idf" "/Users/Documents/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw" "/Users/Documents/WIP" - ``--window`` specifies the window properties . - If nothing is passed, the following values will be used : 2.2 0.65 0.8 0.05 0.15 8.17 + If nothing is passed, the following values will be used : 2.2 0.65 0.8 0.05 0.15 8.17 .. code-block:: python - archetypal convert --window 2.2 0.65 0.8 0.05 0.15 8.17 "/Users/Documents/NECB 2011 - Warehouse.idf" "/Users/Documents/WIP" + archetypal convert --window 2.2 0.65 0.8 0.05 0.15 8.17 "/Users/Documents/NECB 2011 - Warehouse.idf" "/Users/Documents/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw" "/Users/Documents/WIP" - ``--ordered`` sorts the idf object names .. code-block:: python - archetypal convert --ordered "/Users/Documents/NECB 2011 - Warehouse.idf" "/Users/Documents/WIP" + archetypal convert --ordered "/Users/Documents/NECB 2011 - Warehouse.idf" "/Users/Documents/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw" "/Users/Documents/WIP" - If ``--nonum`` is added, do not renumber surfaces in BUI. If ``--batchjob`` or ``-N`` is added, does BatchJob Modus when running trnsidf.exe. ``--geofloor`` must be followed by a float between 0 and 1, and generates GEOSURF values for distributing direct solar radiation where `geo_floor` % is directed to the floor, @@ -149,7 +150,7 @@ Users can chose to return a combination of flags .. code-block:: python - archetypal convert --nonum -N --geofloor 0.6 --refarea --volume --capacitance "/Users/Documents/NECB 2011 - Warehouse.idf" "/Users/Documents/WIP" + archetypal convert --nonum -N --geofloor 0.6 --refarea --volume --capacitance "/Users/Documents/NECB 2011 - Warehouse.idf" "/Users/Documents/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw" "/Users/Documents/WIP" - ``-h`` Shows the "help" message @@ -158,8 +159,8 @@ Users can chose to return a combination of flags archetypal convert -h .. [#] Archetype: building model representing a type of building based on its geometry, thermal properties and its - usage. Usually used to create urban building model by assigning different archetypes to represent at best the building - stock we want to model. + usage. Usually used to create urban building model by assigning different archetypes to represent at best the + building stock we want to model. Equivalence between idf object names when converting a file ........................................................... diff --git a/docs/install.rst b/docs/install.rst index a5fcbd7f..c1217273 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -150,6 +150,9 @@ in case). You should see something like this: Install EnergyPlus & Conversion Programs ........................................ +Note: To follow this procedure, git must be installed beforehand with default installation parameters. +See https://git-scm.com/downloads to download git. + EnergyPlus is a prerequisite of archetypal. It must be installed beforehand. Moreover, archetypal contains routines that may download IDF components that are coded in earlier versions of EnergyPlus (e.g., 7.1). For this reason, users should also download the `supplementary conversion programs`_. diff --git a/install_energyplus.sh b/install_energyplus.sh new file mode 100644 index 00000000..8b36e1a8 --- /dev/null +++ b/install_energyplus.sh @@ -0,0 +1,89 @@ +# Check if EnergyPlus env variables exist already. If not use these defaults +if [[ -z "${ENERGYPLUS_VERSION}" ]]; then + ENERGYPLUS_VERSION=9.2.0 +fi +if [[ -z "${ENERGYPLUS_SHA}" ]]; then + ENERGYPLUS_SHA=921312fa1d +fi +if [[ -z "${ENERGYPLUS_INSTALL_VERSION}" ]]; then + ENERGYPLUS_INSTALL_VERSION=9-2-0 +fi +if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + EXT=dmg + PLATFORM=Darwin +fi +if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + EXT="sh" + PLATFORM=Linux +fi +if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then + EXT=zip + PLATFORM=Windows +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 -SL -C - "$ENERGYPLUS_DOWNLOAD_URL" -o "$ENERGYPLUS_DOWNLOAD_FILENAME".$EXT + +# Extra downloads +if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + ATTCHBASE=97 + ATTCHNUM=8230 +fi +if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + ATTCHBASE=98 + ATTCHNUM=8232 +fi +if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then + ATTCHBASE=86 + ATTCHNUM=8231 +fi +EXTRAS_DOWNLOAD_URL=http://energyplus.helpserve.com/Knowledgebase/Article/GetAttachment/$ATTCHBASE/$ATTCHNUM +curl -SL -C - $EXTRAS_DOWNLOAD_URL -o $ATTCHNUM.zip + +# Install EnergyPlus and Extra Downloads +if [ "$TRAVIS_OS_NAME" == "linux" ]; then + sudo chmod +x "$ENERGYPLUS_DOWNLOAD_FILENAME".$EXT + printf "y\r" | sudo ./"$ENERGYPLUS_DOWNLOAD_FILENAME".$EXT + sudo tar zxvf $ATTCHNUM.zip -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.zip +fi +if [ "$TRAVIS_OS_NAME" == "osx" ]; 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.zip -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.zip +fi +if [ "$TRAVIS_OS_NAME" == "windows" ]; 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.zip -DestinationPath "$DEST" -Force + # cleanup + rm -v $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT + rm -v $ATTCHNUM.zip + 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