Deprecated Build Procedures

These procedures are no longer used at PNNL, but they may still be informative for others.

Building on Windows (DEPRECATED)

This procedure builds all components from scratch. It was last used in December 2019.

If you’ve already built GridLAB-D on your machine, please take note of the specific GitHub branch requirements for TESP:

  • feature/1173 for GridLAB-D

  • develop for FNCS

  • fncs-v8.3.0 for EnergyPlus

The Windows build procedure is very similar to that for Linux and Mac OSX, using MSYS2 tools that you’ll execute from a MSYS2 command window. However, some further adjustments are necessary as described below.

When you finish the build, try Using Docker and the autotest.py script.

Install Python Packages and Java

Download and install the 64-bit Miniconda installer, for Python 3.7 or later, from https://conda.io/miniconda.html. Install to c:Miniconda3, for easier use with MSYS2.

Then from a command prompt:

conda update conda
# tesp_support, including verification of PYPOWER dependency
pip install tesp_support --upgrade
opf

Download and install the Java Development Kit (11.0.5 suggested) from Oracle.

  • for MSYS2, install to a folder without spaces, such as c:Javajdk-11.0.5

  • the Oracle javapath doesn’t work for MSYS2, and it doesn’t find javac in Windows

  • c:Javajdk-11.0.5bin should be added to your path

Set Up the Build Environment and Code Repositories

These instructions are based on https://github.com/gridlab-d/gridlab-d/blob/develop/BuildingGridlabdOnWindowsWithMsys2.docx For TESP, we’re going to build with FNCS and HELICS, but not MATLAB or MySQL.

  • Install a 64-bit version of MSYS2 from https://www.msys2.org. Accept all of the defaults.

  • Start the MSYS2 environment from the Start Menu shortcut for “MSYS2 MSYS”

pacman -Syuu
  • Enter y to continue

  • When directed after a series of warnings, close the MSYS2 by clicking on the Close Window icon

  • Restart the MSYS2 environment from the Start Menu shortcut for “MSYS2 MSYS”

pacman -Su
pacman -S --needed base-devel mingw-w64-x86_64-toolchain
pacman -S --needed mingw-w64-x86_64-xerces-c
pacman -S --needed mingw-w64-x86_64-dlfcn
pacman -S --needed mingw-w64-x86_64-cmake
pacman -S --needed git jsoncpp
pacman -S --needed mingw64/mingw-w64-x86_64-zeromq
  • Exit MSYS2 and restart from a different Start Menu shortcut for MSYS2 MinGW 64-bit

  • You may wish to create a desktop shortcut for the 64-bit environment, as you will use it often

cd /c/
mkdir src
cd src
git config --global user.name "Your Name"
git config --global user.email "YourEmailAddress@YourDomain.com"
git clone -b feature/1173 https://github.com/gridlab-d/gridlab-d.git
git clone -b develop https://github.com/FNCS/fncs.git
git clone -b master https://github.com/GMLC-TDC/HELICS-src.git
git clone -b fncs-v8.3.0 https://github.com/FNCS/EnergyPlus.git
git clone -b develop https://github.com/pnnl/tesp.git

We’re going to build everything to /usr/local in the MSYS2 environment. If you accepted the installation defaults, this corresponds to c:msys64usrlocal in the Windows environment. The Windows PATH should be updated accordingly, and we’ll also need a GLPATH environment variable. This is done in the Windows Settings tool, choosing “Edit the system environment variables” or “Edit environment variables for your account” from the Settings search field.

  • append c:\msys64\usr\local\bin to PATH

  • append c:\msys64\usr\local\lib to PATH

  • create a new environment variable GLPATH

  • append c:\msys64\usr\local\bin to GLPATH

  • append c:\msys64\usr\local\lib\gridlabd to GLPATH

  • append c:\msys64\usr\local\share\gridlabd to GLPATH

Verify the correct paths to Java and Python for your installation, either by examining the PATH variable from a Windows (not MSYS) command prompt, or by using the Windows Settings tool. Insert the following to .bash_profile in your MSYS2 environment, substituting your own paths to Java and Python.

PATH="/c/Java/jdk-11.0.5/bin:${PATH}"
PATH="/c/Users/Tom/Miniconda3:${PATH}"
PATH="/c/Users/Tom/Miniconda3/Scripts:${PATH}"
PATH="/c/Users/Tom/Miniconda3/Library/mingw-w64/bin:${PATH}"
PATH="/c/Users/Tom/Miniconda3/Library/usr/bin:${PATH}"
PATH="/c/Users/Tom/Miniconda3/Library/bin:${PATH}"

The next time you open MSYS2, verify the preceeding as follows:

java -version
javac -version
python --version
python3 --version

Build EnergyPlus

Install the archived version 8.3 from https://github.com/NREL/EnergyPlus/releases/tag/v8.3.0 We need this for some critical support files that aren’t part of the FNCS-EnergyPlus build process. Copy the following from c:\EnergyPlusV8-3-0 to c:\msys64\usr\local\bin:

  • Energy+.idd

  • PostProcess\ReadVarsESO.exe

From the MSYS2 terminal:

cd /c/src/energyplus
mkdir build
cd build
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=/usr/local ..
make
make install

The Makefiles put energyplus.exe and its DLL into /usr/local. You have to manually copy the following build products from /usr/local to /usr/local/bin:

  • energyplus.exe

  • energyplusapi.dll

Build eplus_agent

From the MSYS2 terminal

cd /c/src/tesp/src/energyplus
cp Makefile.win Makefile
cp config.h.win config.h
make
make install

Build ns3 with HELICS

cd /c/src
git clone https://gitlab.com/nsnam/ns-3-dev.git
cd ns-3-dev
git clone https://github.com/GMLC-TDC/helics-ns3 contrib/helics
./waf configure --check-cxx-compiler=g++ --with-helics=/usr/local --disable-werror --enable-examples --enable-tests
./waf build

Building on Mac OS X (DEPRECATED)

This procedure builds all components from scratch. It was last used in December 2019.

If you’ve already built GridLAB-D on your machine, please take note of the specific GitHub branch requirements for TESP:

  • feature/1173 for GridLAB-D

  • develop for FNCS

  • fncs-v8.3.0 for EnergyPlus

The Mac OS X build procedure is very similar to that for Linux, and should be executed from the Terminal. For consistency among platforms, this procedure uses gcc rather than clang. It’s also assumed that Homebrew has been installed.

It may also be necessary to disable system integrity protection (SIP), in order to modify contents under /usr. Workarounds to set the LD_LIBRARY_PATH and DYLD_LIBRARY_PATH environment variables have not been tested successfully.

When you finish the build, try Using Docker and the autotest.py script.

Build GridLAB-D

Follow these directions:

http://gridlab-d.shoutwiki.com/wiki/Mac_OSX/Setup

Install Python Packages, Java, updated GCC

# install Python 3.7+ from Conda
# tesp_support, including verification of PYPOWER dependency
pip install tesp_support
opf

brew install gcc-9

# also need Java, Cmake, autoconf, libtool

Checkout PNNL repositories from github

mkdir ~/src
cd ~/src
git config --global (specify user.name, user.email, color.ui)
git clone -b develop https://github.com/FNCS/fncs.git
git clone -b feature/1173 https://github.com/gridlab-d/gridlab-d.git
git clone -b fncs-v8.3.0 https://github.com/FNCS/EnergyPlus.git
git clone -b develop https://github.com/pnnl/tesp.git
git clone -b master https://github.com/GMLC-TDC/HELICS-src

FNCS with Prerequisites (installed to /usr/local)

Your Java version may have removed javah. If that’s the case, use javac -h instead.

brew install zeromq
brew install czmq

cd ../fncs
autoreconf -isf
./configure --with-zmq=/usr/local --with-czmq=/usr/local 'CPP=gcc-9 -E' 'CXXPP=g++-9 -E' 'CC=gcc-9' 'CXX=g++-9' 'CXXFLAGS=-w -O2 -mmacosx-version-min=10.12' 'CFLAGS=-w -O2 -mmacosx-version-min=10.12'
make
sudo make install

cd java
mkdir build
cd build
cmake -DCMAKE_C_COMPILER="gcc-9" -DCMAKE_CXX_COMPILER="g++-9" ..
make
# copy jar and jni library to  tesp/examples/loadshed/java

HELICS (installed to /usr/local, build with gcc9)

To build HELICS:

cd ~/src/HELICS-src
rm -r build
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX="/usr/local" -DBUILD_PYTHON_INTERFACE=ON -DBUILD_JAVA_INTERFACE=ON -DBUILD_SHARED_LIBS=ON -DJAVA_AWT_INCLUDE_PATH=NotNeeded -DHELICS_DISABLE_BOOST=ON -DCMAKE_C_COMPILER=/usr/local/bin/gcc-9 -DCMAKE_CXX_COMPILER=/usr/local/bin/g++-9 ../
make clean
make -j 4
sudo make install

To test HELICS:

helics_player --version
helics_recorder --version
ipython
import helics
helics.helicsGetVersion()
quit

Add this to .bash_profile

export PYTHONPATH=/usr/local/python:$PYTHONPATH

GridLAB-D with Prerequisites (installed to /usr/local)

If you encounter build errors with GridLAB-D, please try adding -std=c++14 to CXXFLAGS.

brew install xerces-c

cd ~/src/gridlab-d
autoreconf -isf

./configure --with-fncs=/usr/local --with-helics=/usr/local --enable-silent-rules 'CPP=gcc-9 -E' 'CXXPP=g++-9 -E' 'CC=gcc-9' 'CXX=g++-9' 'CXXFLAGS=-O2 -w -std=c++14' 'CFLAGS=-O2 -w' LDFLAGS='-w'

sudo make
sudo make install
# TODO - set the GLPATH?
gridlabd --validate

ns-3 with HELICS

# consider -g flags on CXX, C and LD if debugging
cd ~/src
git clone https://gitlab.com/nsnam/ns-3-dev.git
cd ns-3-dev
git clone https://github.com/GMLC-TDC/helics-ns3 contrib/helics
./waf configure --with-helics=/usr/local --disable-werror --enable-examples --enable-tests 'CPP=gcc-9 -E' 'CXXPP=g++-9 -E' 'CC=gcc-9' 'CXX=g++-9' 'CXXFLAGS=-w -std=c++14' 'CFLAGS=-w' LDFLAGS='-w'
./waf build

EnergyPlus with Prerequisites (installed to /usr/local)

cd ~/src/EnergyPlus
mkdir build
cd build
cmake -DCMAKE_C_COMPILER="gcc-9" -DCMAKE_CXX_COMPILER="g++-9" ..
make

# Before installing, we need components of the public version, including but not limited
#   to the critical Energy+.idd file
# The compatible public version is at https://github.com/NREL/EnergyPlus/releases/tag/v8.3.0
# That public version should be installed to /usr/local/EnergyPlus-8-3-0 before going further

sudo make install

# Similar to the experience with Linux and Windows, this installation step wrongly puts
#  the build products in /usr/local instead of /usr/local/bin and /usr/local/lib
#  the following commands will copy FNCS-compatible EnergyPlus over the public version
cd /usr/local
cp energyplus-8.3.0 bin
cp libenergyplusapi.8.3.0.dylib lib

# if ReadVarsESO not found at the end of a simulation, try this
/usr/local/EnergyPlus-8-3-0$ sudo ln -s PostProcess/ReadVarsESO ReadVarsESO

Build eplus_agent

cd ~/src/tesp/src/energyplus
# the following steps are also in go.sh
autoheader
aclocal
automake --add-missing
# edit configure.ac to use g++-9 on Mac
autoconf
./configure --prefix=/usr/local --with-zmq=/usr/local --with-czmq=/usr/local
make
sudo make install