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 TESP Demonstrations and Examples.

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