### Install Example Files Source: https://github.com/natlabrockies/openstudio/blob/develop/resources/CMakeLists.txt Installs the 'Examples' directory to a specified destination as part of the 'CLI' component. ```cmake install(DIRECTORY "Examples" DESTINATION . COMPONENT "CLI") ``` -------------------------------- ### Install C# Files Source: https://github.com/natlabrockies/openstudio/blob/develop/csharp/CMakeLists.txt Installs C# related files from the 'examples' directory to the CSharp/ destination. It includes specific file patterns to match. ```cmake install(DIRECTORY "examples" DESTINATION "CSharp/" COMPONENT "CSharpAPI" FILES_MATCHING PATTERN "*.cs" PATTERN "*.csproj" PATTERN "*.sln" PATTERN "*.resx" PATTERN "*.settings" PATTERN "*.docx" ) ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/cmake/CMakeLists.txt Initializes CMake version and sets the project name. This is a standard starting point for any CMake project. ```cmake cmake_minimum_required(VERSION 2.8.11) set(target_name Test) project(${target_name}) ``` -------------------------------- ### Install Executable Source: https://github.com/natlabrockies/openstudio/blob/develop/src/install_utility/CMakeLists.txt Specifies that the install_utility target should be installed into the 'bin' directory. This defines where the built executable will be placed after installation. ```cmake install(TARGETS install_utility DESTINATION bin) ``` -------------------------------- ### Copy Example Files Source: https://github.com/natlabrockies/openstudio/blob/develop/resources/CMakeLists.txt Copies the 'Examples' directory to the current destination for testing purposes. ```cmake file(COPY "Examples" DESTINATION .) ``` -------------------------------- ### Install OpenStudio Python Bindings Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/ReleaseNotes/OpenStudio_Release_Notes_3_2_0.20210504.md Install the OpenStudio Python bindings using pip. Ensure Python 3 and pip are installed. ```bash pip install openstudio==3.2.0 ``` -------------------------------- ### Install OpenStudio Python Bindings Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/ReleaseNotes/ReleaseNotes_template.md Install the OpenStudio Python bindings using pip. Ensure Python 3 and pip are installed. ```bash pip install openstudio==@VERSION@ ``` -------------------------------- ### Install FetchRubyMinGW CMake Script Source: https://github.com/natlabrockies/openstudio/blob/develop/CMakeLists.txt Installs the `FetchRubyMinGW.cmake` script into the CMake package directory. ```cmake install( FILES "${CMAKE_CURRENT_SOURCE_DIR}/FetchRubyMinGW.cmake" DESTINATION lib/cmake/openstudio/ ) ``` -------------------------------- ### Install OpenStudio Python Bindings Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/ReleaseNotes/OpenStudio_Release_Notes_3_11_0_20260116.md Install the OpenStudio SDK version 3.11.0 using pip. Ensure Python 3 and pip are installed. ```bash pip install openstudio==3.11.0 ``` -------------------------------- ### Install OpenStudio Python Bindings Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/ReleaseNotes/OpenStudio_Release_Notes_3_10_0_20250618.md Install the OpenStudio SDK version 3.10.0 using pip. Ensure Python 3 and pip are installed. ```bash pip install openstudio==3.10.0 ``` -------------------------------- ### Install OpenStudio NuGet Package Source: https://github.com/natlabrockies/openstudio/blob/develop/csharp/nuget_test/README.md Installs the OpenStudio NuGet package into the current directory from a specified source. ```bash nuget.exe install OpenStudio -Version 3.2.0 -Source C:\Users\Administrator\source\ ``` -------------------------------- ### Build and Install Boost 1.47.0 on RHEL 5 Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/wiki/(v1.4.0 and older) Configuring OpenStudio Build Environments.md Downloads, builds, and installs Boost version 1.47.0 on RHEL 5. Installs to /usr/local. ```bash wget http://downloads.sourceforge.net/project/boost/boost/1.47.0/boost_1_47.0.tar.gz tar -xzf boost_1_47.0.tar.gz rm boost_1_47.0.tar.gz cd boost_1_47.0 ./bootstrap.sh ./b2 sudo ./b2 install --prefix=/usr/local cd .. rm -rf boost_1_47.0 ``` -------------------------------- ### Configure Installer for Windows Source: https://github.com/natlabrockies/openstudio/blob/develop/CMakeLists.txt Sets the installation directory and enables the IFW (Install Framework) package format for Windows builds, disabling NSIS. ```cmake if(WIN32) set(CPACK_PACKAGE_INSTALL_DIRECTORY "openstudio-${OpenStudio_VERSION}") set(CPACK_IFW_TARGET_DIRECTORY "C:/${CPACK_PACKAGE_INSTALL_DIRECTORY}") set(CPACK_BINARY_IFW ON CACHE BOOL "Enable to build IFW packages") set(CPACK_BINARY_NSIS OFF CACHE BOOL "Enable to build NSIS packages") endif() ``` -------------------------------- ### Install Qt 4.8.6 on Linux Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/wiki/(v1.4.0 and older) Configuring OpenStudio Build Environments.md Downloads, configures, builds, and installs Qt 4.8.6. Includes steps to modify Makefiles if build fails. ```bash wget http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz tar -xzf qt-everywhere-opensource-src-4.8.6.tar.gz rm qt-everywhere-opensource-src-4.8.6.tar.gz cd qt-everywhere-opensource-src-4.8.6 ./configure -debug-and-release -opensource -qt-sql-sqlite -plugin-sql-sqlite -no-qt3support -nomake examples -nomake demos -nomake docs -confirm-license gmake #Go through the Makefiles in the 3rd party directory and remove the -Werror compiler flags if build failed (This step may need to be repeated) #find src/3rdparty/webkit/ -type f -name Makefile -exec sed -i 's/-Werror //g' {} \; #find src/3rdparty/webkit/ -type f -name Makefile.* -exec sed -i 's/-Werror //g' {} \; #gmake sudo gmake install cd .. rm -rf qt-everywhere-opensource-src-4.8.6 ``` -------------------------------- ### Install Linux Dependencies Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/wiki/(v1.4.0 and older) Configuring OpenStudio Build Environments.md Installs necessary command-line tools, development libraries, and CMake for building OpenStudio on Linux. ```bash sudo apt-get install dpkg-dev git cmake-curses-gui libqt4-dev libboost-all-dev libxt-dev ``` -------------------------------- ### Install EnergyPlus Schema and Executables Source: https://github.com/natlabrockies/openstudio/blob/develop/CMakeLists.txt Installs the EnergyPlus schema, executables, and libraries. This snippet handles the core installation of EnergyPlus components. ```cmake string(REPLACE ".idd" ".schema.epJSON" ENERGYPLUS_EPJSON_SCHEMA ${ENERGYPLUS_IDD}) install(FILES "${ENERGYPLUS_EPJSON_SCHEMA}" DESTINATION ./EnergyPlus/ COMPONENT EnergyPlus) install(PROGRAMS ${ENERGYPLUS_FILES} DESTINATION ./EnergyPlus/ COMPONENT EnergyPlus) install(PROGRAMS ${ENERGYPLUS_LIB_FILES} DESTINATION ./EnergyPlus/ COMPONENT EnergyPlus) install(PROGRAMS "${EXPAND_OBJECTS}" DESTINATION ./EnergyPlus/ COMPONENT EnergyPlus) install(DIRECTORY "${ENERGYPLUS_DIR}/python_lib" DESTINATION ./EnergyPlus/ COMPONENT EnergyPlus) install(DIRECTORY "${ENERGYPLUS_DIR}/pyenergyplus" DESTINATION ./EnergyPlus/ COMPONENT EnergyPlus) ``` -------------------------------- ### Install PAT Application Directory Source: https://github.com/natlabrockies/openstudio/blob/develop/pat/CMakeLists.txt Installs the PAT application directory to the destination. The installation path differs between macOS and Windows. ```cmake if( APPLE ) install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/OpenStudio-PAT/tmp/ParametricAnalysisTool.app" DESTINATION . USE_SOURCE_PERMISSIONS COMPONENT PAT ) else() install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/OpenStudio-PAT/tmp/pat" DESTINATION . USE_SOURCE_PERMISSIONS COMPONENT PAT ) endif() #TODO figure out what the package structure is like on windows and install that ``` -------------------------------- ### Install Latest Official OpenStudio SDK Source: https://github.com/natlabrockies/openstudio/wiki/OpenStudio-SDK-Python-Binding-Version-Compatibility-Matrix Installs the most recent stable version of the OpenStudio SDK from PyPi. ```bash pip install openstudio ``` -------------------------------- ### Doxygen Page Example Source: https://github.com/natlabrockies/openstudio/wiki/Cpp-Coding-Standards For specific pages within a sub-project, use a page.hpp file starting with a \page command. The reference tag can then be used to link to this page. ```c++ /** \page idd_page OpenStudio Idd ``` -------------------------------- ### Include Python Setup Source: https://github.com/natlabrockies/openstudio/blob/develop/CMakeLists.txt Includes the Python setup script if Python bindings are being built. ```cmake if(BUILD_PYTHON_BINDINGS) include(python/SetupPython.cmake) endif() ``` -------------------------------- ### Install OpenStudio Ruby Target and Files Source: https://github.com/natlabrockies/openstudio/blob/develop/ruby/module/CMakeLists.txt Installs the 'openstudio_rb' target, 'openstudio.rb' file, and the 'openstudio/' directory to the 'Ruby' destination. ```cmake install(TARGETS openstudio_rb EXPORT openstudio DESTINATION Ruby COMPONENT "RubyAPI" ) install(FILES openstudio.rb DESTINATION Ruby COMPONENT "RubyAPI") install(DIRECTORY openstudio DESTINATION Ruby COMPONENT "RubyAPI") ``` -------------------------------- ### Install EnergyPlus Files Source: https://github.com/natlabrockies/openstudio/blob/develop/CMakeLists.txt Installs the EnergyPlus IDD file to the EnergyPlus component directory. ```cmake file(GLOB ENERGYPLUS_FILES "${ENERGYPLUS_DIR}/energyplus*") file(GLOB ENERGYPLUS_LIB_FILES "${ENERGYPLUS_DIR}/libenergyplus*") file(GLOB EXPAND_OBJECTS "${ENERGYPLUS_DIR}/ExpandObjects*") install(FILES "${ENERGYPLUS_IDD}" DESTINATION ./EnergyPlus/ COMPONENT EnergyPlus) ``` -------------------------------- ### Install OpenStudio Python Bindings Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/ReleaseNotes/OpenStudio_Release_Notes_3_5_0_20221110.md Installs the OpenStudio Python bindings version 3.5.0 using pip. Ensure Python 3 and pip are installed. ```bash pip install openstudio==3.5.0 ``` -------------------------------- ### Install Radiance Directory Source: https://github.com/natlabrockies/openstudio/blob/develop/CMakeLists.txt Installs the Radiance directory, with different destination paths for Windows and other platforms. ```cmake if(WIN32) install(DIRECTORY "${PROJECT_BINARY_DIR}/${RADIANCE_PATH}/" DESTINATION ./Radiance/ COMPONENT Radiance USE_SOURCE_PERMISSIONS) else() string(REPLACE "-Redhat" "-Linux" RADIANCE_PATH ${RADIANCE_PATH}) install(DIRECTORY "${PROJECT_BINARY_DIR}/${RADIANCE_PATH}/usr/local/radiance/" DESTINATION ./Radiance/ COMPONENT Radiance USE_SOURCE_PERMISSIONS) endif() ``` -------------------------------- ### Install CMake 3.0.0 on Linux Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/wiki/(v1.4.0 and older) Configuring OpenStudio Build Environments.md Downloads, configures, builds, and installs CMake 3.0.0. ```bash wget http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz tar -xzf cmake-3.0.0.tar.gz rm cmake-3.0.0.tar.gz cd cmake-3.0.0 ./configure gmake sudo gmake install cd .. rm -rf cmake-3.0.0 ``` -------------------------------- ### Install Development Tools on RHEL 5 Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/wiki/(v1.4.0 and older) Configuring OpenStudio Build Environments.md Installs essential development tools for RHEL 5 (x86 and x64). ```bash sudo yum groupinstall development-libs development-tools sudo yum remove boost-devel ``` -------------------------------- ### Install Ruby 2.5 on Ubuntu 16.04 Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/wiki/Configuring-OpenStudio-SDK-Build-Environments-(3.0.0-or-greater).md Installs Ruby version 2.5 and its development headers using a PPA. ```shell sudo apt-add-repository ppa:brightbox/ruby-ng sudo apt-get update sudo apt-get install ruby2.5 ruby2.5-dev ``` -------------------------------- ### Install Former Official OpenStudio SDK Version Source: https://github.com/natlabrockies/openstudio/wiki/OpenStudio-SDK-Python-Binding-Version-Compatibility-Matrix Installs a specific, older official version of the OpenStudio SDK from PyPi. ```bash pip install openstudio==3.3.0 ``` -------------------------------- ### Install Python Files Source: https://github.com/natlabrockies/openstudio/blob/develop/python/module/CMakeLists.txt Installs the main OpenStudio Python file to the Python component directory. ```cmake install(FILES "openstudio.py" DESTINATION Python COMPONENT "Python") ``` -------------------------------- ### Modelica Example Workflow Input File Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/ReleaseNotes/OpenStudio_Release_Notes_3_11_0_20260116.md This is the input file for a compact Modelica example workflow. It is bundled with the end-user distribution. ```json { "name": "compact_modelica", "description": "A compact example workflow that uses Modelica.", "steps": [ { "type": "runModelicaMeasures", "arguments": { "measures": [ { "name": "SetModelicaZones", "path": "measures/SetModelicaZones" } ] } } ] } ``` -------------------------------- ### Install PCRE and SWIG on macOS Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/wiki/(v1.4.0 and older) Configuring OpenStudio Build Environments.md Installs the PCRE library and SWIG, which are prerequisites for building on macOS. ```bash curl -LO ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz tar -xzf pcre-8.35.tar.gz rm pcre-8.35.tar.gz cd pcre-8.35 ./configure make sudo make install cd .. rm -rf pcre-8.35 curl -LO http://developer.nrel.gov/downloads/buildings/openstudio/src/swig-3.0.2.tar.gz tar -xzf swig-3.0.2.tar.gz rm swig-3.0.2.tar.gz cd swig-3.0.2 ./configure make sudo make install cd .. rm -rf swig-3.0.2 ``` -------------------------------- ### Build OpenStudio with Installer Package on macOS Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/wiki/Configuring-OpenStudio-SDK-Build-Environments-(3.0.0-or-greater).md Clones the OpenStudio repository and builds it, creating an installer package using CMake and Make. ```shell git clone https://github.com/NREL/OpenStudio cd OpenStudio mkdir build cd build cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 -DBUILD_TESTING=ON -DBUILD_PACKAGE=ON -DCMAKE_BUILD_TYPE=Release -DCPACK_BINARY_DEB=OFF -DCPACK_BINARY_IFW=ON -DCPACK_BINARY_NSIS=OFF -DCPACK_BINARY_RPM=OFF -DCPACK_BINARY_STGZ=OFF -DCPACK_BINARY_TBZ2=OFF -DCPACK_BINARY_TGZ=ON -DCPACK_BINARY_TXZ=OFF -DCPACK_BINARY_TZ=OFF ../ make -j package ``` -------------------------------- ### Install OpenStudio Python Bindings from Test Channel Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/ReleaseNotes/OpenStudio_Release_Notes_3_7_0_20231117.md Install development versions of OpenStudio Python bindings from the TestPyPI repository. This is useful for testing upcoming features. ```bash pip install --index-url https://test.pypi.org/simple/ openstudio==3.7.0 ``` -------------------------------- ### Install OpenStudio CLI for PAT on Apple Source: https://github.com/natlabrockies/openstudio/blob/develop/src/cli/CMakeLists.txt Installs the OpenStudio executable into the ParametricAnalysisTool.app bundle on Apple platforms when BUILD_PAT is enabled. ```cmake if( BUILD_PAT ) if( APPLE ) install(TARGETS openstudio DESTINATION ParametricAnalysisTool.app/Contents/Resources/OpenStudio/bin/ COMPONENT PAT ) endif() endif() ``` -------------------------------- ### Install Generated C# DLL Source: https://github.com/natlabrockies/openstudio/blob/develop/csharp/CMakeLists.txt Installs the generated OpenStudio.dll to the CSharp/openstudio/ destination, as part of the CSharpAPI component. ```cmake install(FILES "${OPENSTUDIO_CSHARP_DLL}" DESTINATION CSharp/openstudio/ COMPONENT "CSharpAPI") ``` -------------------------------- ### Install OpenJDK for Linux Source: https://github.com/natlabrockies/openstudio/wiki/Building-Additional-Language-Bindings Installs the OpenJDK 7 Java Development Kit on Debian-based Linux systems using apt-get. ```sh sudo apt-get install openjdk-7-jdk ``` -------------------------------- ### Install PAT Components on macOS Source: https://github.com/natlabrockies/openstudio/blob/develop/CMakeLists.txt Installs EnergyPlus and Radiance components into the Parametric Analysis Tool (PAT) application bundle on macOS, conditional on BUILD_PAT being enabled. ```cmake if(BUILD_PAT AND APPLE) install(FILES "${ENERGYPLUS_IDD}" DESTINATION ./ParametricAnalysisTool.app/Contents/Resources/EnergyPlus/ COMPONENT PAT) install(PROGRAMS ${ENERGYPLUS_FILES} DESTINATION ./ParametricAnalysisTool.app/Contents/Resources/EnergyPlus/ COMPONENT PAT) install(PROGRAMS ${ENERGYPLUS_LIB_FILES} DESTINATION ./ParametricAnalysisTool.app/Contents/Resources/EnergyPlus/ COMPONENT PAT) install(PROGRAMS "${EXPAND_OBJECTS}" DESTINATION ./ParametricAnalysisTool.app/Contents/Resources/EnergyPlus/ COMPONENT PAT) install(PROGRAMS "${ENERGYPLUS_DIR}/libgfortran.5.dylib" DESTINATION ./ParametricAnalysisTool.app/Contents/Resources/EnergyPlus/ COMPONENT PAT) if (NOT ARCH MATCHES arm64) install(PROGRAMS "${ENERGYPLUS_DIR}/libquadmath.0.dylib" DESTINATION ./ParametricAnalysisTool.app/Contents/Resources/EnergyPlus/ COMPONENT PAT) endif() install(DIRECTORY "${PROJECT_BINARY_DIR}/${RADIANCE_PATH}/usr/local/radiance/" DESTINATION ./ParametricAnalysisTool.app/Contents/Resources/Radiance/ COMPONENT PAT USE_SOURCE_PERMISSIONS) endif() ``` -------------------------------- ### Install CMake from Source on Linux Source: https://github.com/natlabrockies/openstudio/wiki/Configuring-OpenStudio-Build-Environments-(2.9.X-LTS) Downloads, compiles, and installs CMake version 3.7.1 from source. This is necessary if a suitable version is not available through package managers. ```bash wget https://cmake.org/files/v3.7/cmake-3.7.1.tar.gz tar -xzf cmake-3.7.1.tar.gz cd cmake-3.7.1/ ./configure make sudo make install ``` -------------------------------- ### Install Development Tools and Libraries on Fedora 19 Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/wiki/(v1.4.0 and older) Configuring OpenStudio Build Environments.md Installs essential development tools and libraries for Fedora 19 (x86 and x64). ```bash sudo yum groupinstall development-libs development-tools sudo yum install gcc-c++ cmake swig patch qt-devel qtwebkit-devel ruby ruby-devel graphviz sudo yum remove boost-devel ``` -------------------------------- ### Example Implementation of getScheduleTypeKeys Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/wiki/Schedules-in-the-Model-API-and-the-ScheduleTypeRegistry.md An example showing how to implement the getScheduleTypeKeys method in a concrete model object. It checks field indices to determine the correct ScheduleTypeKey. ```cpp std::vector ZoneVentilationWindandStackOpenArea_Impl::getScheduleTypeKeys(const Schedule& schedule) const { std::vector result; UnsignedVector fieldIndices = getSourceIndices(schedule.handle()); UnsignedVector::const_iterator b(fieldIndices.begin()), e(fieldIndices.end()); if (std::find(b,e,OS_ZoneVentilation_WindandStackOpenAreaFields::OpeningAreaFractionScheduleName) != e) { result.push_back(ScheduleTypeKey("ZoneVentilationWindandStackOpenArea","Opening Area Fraction Schedule")); } // if another field .... return result; ``` -------------------------------- ### Install Ruby Gem Files Source: https://github.com/natlabrockies/openstudio/blob/develop/CMakeLists.txt Installs the Gemfile, Gemfile.lock, and gemspec file for the Ruby API component if the CLI build is enabled. ```cmake if (BUILD_CLI) install(FILES "${PROJECT_BINARY_DIR}/openstudio-gems/Gemfile" DESTINATION ./Ruby/ COMPONENT "RubyAPI") install(FILES "${PROJECT_BINARY_DIR}/openstudio-gems/Gemfile.lock" DESTINATION ./Ruby/ COMPONENT "RubyAPI") install(FILES "${PROJECT_BINARY_DIR}/openstudio-gems/openstudio-gems.gemspec" DESTINATION ./Ruby/ COMPONENT "RubyAPI" ) endif() ``` -------------------------------- ### Install OpenStudio Shared Library and Headers Source: https://github.com/natlabrockies/openstudio/blob/develop/src/lib/CMakeLists.txt Installs the OpenStudio shared library and its associated header files. This ensures the library and its API are available for use by other projects. ```cmake install(TARGETS openstudiolib EXPORT openstudio DESTINATION ${LIB_DESTINATION_DIR} COMPONENT "CLI" # CLI is no longer self-contained, it needs it INCLUDES DESTINATION include include/openstudio ) install(DIRECTORY "${PROJECT_SOURCE_DIR}/src/" "${PROJECT_BINARY_DIR}/src/" DESTINATION include/openstudio COMPONENT "CPPAPI" FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" PATTERN "*.hxx" PATTERN "*.i" ) ``` -------------------------------- ### Install Specific OpenStudio SDK from TestPyPi Source: https://github.com/natlabrockies/openstudio/wiki/OpenStudio-SDK-Python-Binding-Version-Compatibility-Matrix Installs a specific version of the OpenStudio SDK from the TestPyPi repository, often used for pre-releases or development builds. ```bash pip install -i https://test.pypi.org/simple/ openstudio==3.4.0rc2 ``` -------------------------------- ### Build Installer Packages with CMake Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/Building and Testing OpenStudio.md Builds and creates binary installer packages for OpenStudio using the 'package' target after CMake configuration. Assumes a Release build configuration. ```bash cmake --build . --config Release --target package ``` -------------------------------- ### Define root and model directories Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/python/Check_FuelType_Methods.ipynb Sets up the root directory and the model directory based on the project structure. Assumes a specific parent directory layout. ```python ROOT_DIR = Path(".").absolute().parent.parent MODEL_DIR = ROOT_DIR / "src" / "model" ``` -------------------------------- ### Install Conan Package Manager Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/Building and Testing OpenStudio.md Installs the Conan package manager using pip. Ensure Python is installed first. ```shell pip install conan ``` -------------------------------- ### Configure Setup Script Source: https://github.com/natlabrockies/openstudio/blob/develop/python/module/CMakeLists.txt Configures the setup.py file for the Python package using variables. ```cmake configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.py ${PYTHON_PACKAGE_FOLDER}/setup.py @ONLY) ``` -------------------------------- ### Install Qt 4.8.6 on macOS 10.8 Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/wiki/(v1.4.0 and older) Configuring OpenStudio Build Environments.md Downloads, configures, builds, and installs Qt 4.8.6 for macOS 10.8, targeting specific SDKs and architectures. Appends Qt bin directory to PATH. ```bash curl -LO http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz tar -xzf qt-everywhere-opensource-src-4.8.6.tar.gz rm qt-everywhere-opensource-src-4.8.6.tar.gz cd qt-everywhere-opensource-src-4.8.6 ./configure -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -debug-and-release -opensource -arch x86 -arch x86_64 -qt-sql-sqlite -plugin-sql-sqlite -nomake examples -nomake demos -nomake docs -no-qt3support -confirm-license make -j2 sudo make install cd .. rm -rf qt-everywhere-opensource-src-4.8.6 echo 'export PATH=$PATH:/usr/local/Trolltech/Qt-4.8.6/bin' >> ~/.bash_profile ``` -------------------------------- ### Install Qt 4.8.6 on OS X Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/wiki/(v1.4.0 and older) Configuring OpenStudio Build Environments.md Downloads, configures, builds, and installs Qt version 4.8.6 with support for SQLite, both debug and release builds, and specified architectures for OS X 10.8 SDK. ```bash curl -LO http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz tar -xzf qt-everywhere-opensource-src-4.8.6.tar.gz rm qt-everywhere-opensource-src-4.8.6.tar.gz cd qt-everywhere-opensource-src-4.8.6 ./configure -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -debug-and-release -opensource -openssl -arch x86 -arch x86_64 -qt-sql-sqlite -plugin-sql-sqlite -nomake examples -nomake demos -nomake docs -no-phonon -no-phonon-backend -no-qt3support -confirm-license make -j2 sudo make install cd .. rm -rf qt-everywhere-opensource-src-4.8.6 echo 'export PATH=$PATH:/usr/local/Trolltech/Qt-4.8.6/bin' >> ~/.bash_profile ``` -------------------------------- ### Install Graphviz on Windows Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/wiki/Configuring-OpenStudio-SDK-Build-Environments-(3.0.0-or-greater).md Provides the download link for Graphviz v2.38, used for building documentation. ```shell http://www.graphviz.org/pub/graphviz/stable/windows/graphviz-2.38.msi ``` -------------------------------- ### Install Ruby 1.8.7 and Rubygems on RHEL 5 Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/wiki/(v1.4.0 and older) Configuring OpenStudio Build Environments.md Installs Ruby version 1.8.7 and Rubygems 2.0.4 on RHEL 5. This replaces existing Ruby installations. ```bash sudo yum remove ruby ruby-devel wget http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p374.tar.gz tar -xzf ruby-1.8.7-p374.tar.gz rm ruby-1.8.7-p374.tar.gz cd ruby-1.8.7-p374 ./configure make sudo make install cd .. rm -rf ruby-1.8.7-p374 wget http://production.cf.rubygems.org/rubygems/rubygems-2.0.4.tgz tar -xzf rubygems-2.0.4.tgz rm rubygems-2.0.4.tgz cd rubygems-2.0.4 sudo ruby setup.rb cd .. rm -rf rubygems-2.0.4 gem install rake ``` -------------------------------- ### Custom Target for Pip Install Source: https://github.com/natlabrockies/openstudio/blob/develop/python/engine/CMakeLists.txt Creates a custom target 'pip_install' that depends on the pip installation stamp file. This target ensures pip installation runs when needed. ```cmake add_custom_target( pip_install DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pip_install_done.stamp" ) ``` -------------------------------- ### Define Executable and Link Libraries Source: https://github.com/natlabrockies/openstudio/blob/develop/src/install_utility/CMakeLists.txt Defines the install_utility executable and links it with the Boost library. This is a fundamental step in setting up the build target. ```cmake add_executable(install_utility main.cpp) target_link_libraries(install_utility boost::boost # boost::boost_filesystem ) ``` -------------------------------- ### Install OpenStudio CLI Source: https://github.com/natlabrockies/openstudio/blob/develop/src/cli/CMakeLists.txt Installs the OpenStudio executable target as part of the 'CLI' component. ```cmake install(TARGETS openstudio EXPORT openstudio COMPONENT "CLI") ``` -------------------------------- ### Build Ruby 2.0.0-p645 for Windows 64-bit Source: https://github.com/natlabrockies/openstudio/wiki/Special-Ruby-Builds This script prepares a Ruby 2.0.0-p645 installation on Windows 64-bit by removing unnecessary files, installing bundler, and creating a zip archive. ```bash cd /C/Ruby200-x64/ rm -rf doc share unins000.* lib/libx64-msvcrt-ruby200-static.a cd bin gem install bundler --no-rdoc --no-ri cd .. rm -rf lib/ruby/gems/2.0.0/cache/* mkdir ruby-2.0.0-aws-win64 cp -r bin include lib ruby-2.0.0-aws-win64/ ``` -------------------------------- ### Build PAT 2.0 Ruby 2.0.0-p648 for Windows Source: https://github.com/natlabrockies/openstudio/wiki/Special-Ruby-Builds Prepares a PAT 2.0 Ruby 2.0.0-p648 installation on Windows by updating RubyGems, installing bundler, and creating a zip archive. ```bash gem update --system gem install bundler --no-rdoc --no-ri rm -rf doc share unins000.* lib/libmsvcrt-ruby200-static.a lib/libmsvcrt-ruby200.dll.a cd bin cd .. rm -rf lib/ruby/gems/2.0.0/cache/* lib/ruby/gems/2.0.0/doc/* mkdir ruby-2.0.0-p648-windows cp -r bin include lib ruby-2.0.0-p648-windows/ ``` -------------------------------- ### Build Ruby 2.0.0-p645 for Windows 32-bit Source: https://github.com/natlabrockies/openstudio/wiki/Special-Ruby-Builds This script prepares a Ruby 2.0.0-p645 installation on Windows 32-bit by removing unnecessary files, installing bundler, and creating a zip archive. ```bash cd /C/Ruby200/ rm -rf doc share unins000.* lib/libmsvcrt-ruby200-static.a cd bin gem install bundler --no-rdoc --no-ri cd .. rm -rf lib/ruby/gems/2.0.0/cache/* mkdir ruby-2.0.0-aws-win32 cp -r bin include lib ruby-2.0.0-aws-win32/ ``` -------------------------------- ### Install Linux Specific Python Libraries Source: https://github.com/natlabrockies/openstudio/blob/develop/CMakeLists.txt Installs Python libraries for EnergyPlus on Linux systems. ```cmake elseif(UNIX) file(GLOB ENERGYPLUS_PYTHON_LIBS "${ENERGYPLUS_DIR}/libpython*") foreach(python_lib IN LISTS ENERGYPLUS_PYTHON_LIBS) install(PROGRAMS "${python_lib}" DESTINATION ./EnergyPlus/ COMPONENT EnergyPlus) endforeach() endif() ``` -------------------------------- ### OpenStudio HVAC Component Connection Example Source: https://github.com/natlabrockies/openstudio/wiki/OpenStudio-HVAC-Connections Illustrates OpenStudio's use of OS:Connection objects to link component ports, including a node as an intermediary component. ```OpenStudio OS:Coil:Heating:Gas, {363b7008-0a0d-4fe7-9db3-68a79a48bff9}, !- Handle Coil Heating Gas 1, !- Name {3f88ddae-e2a9-41a1-a71b-ecde6608231c}, !- Availability Schedule Name 0.8, !- Gas Burner Efficiency AutoSize, !- Nominal Capacity {W} {dccdd7bc-d226-4808-9efa-90bdc10b94eb}, !- Air Inlet Port, port "5" {f449861e-566d-4029-8f94-75a3714fe22c}, !- Air Outlet Port, port "6" , !- Temperature Setpoint Node Name 0, !- Parasitic Electric Load {W} , !- Part Load Fraction Correlation Curve Name 0; !- Parasitic Gas Load {W} OS:Connection, {f449861e-566d-4029-8f94-75a3714fe22c}, !- Handle {7be3c785-24a5-42c4-b3d4-0e7066304acb}, !- Name {363b7008-0a0d-4fe7-9db3-68a79a48bff9}, !- Source Object 6, !- Outlet Port {048330b6-77f4-4087-b2f3-e0f09c368faf}, !- Target Object 2; !- Inlet Port OS:Node, {048330b6-77f4-4087-b2f3-e0f09c368faf}, !- Handle Node 20, !- Name {f449861e-566d-4029-8f94-75a3714fe22c}, !- Inlet Port, port "2" {ec2a011e-f6aa-4857-a70b-e23706f580ea}; !- Outlet Port, port "3" OS:Connection, {ec2a011e-f6aa-4857-a70b-e23706f580ea}, !- Handle {de2173c8-53af-4352-a30d-fc5a67f36184}, !- Name {048330b6-77f4-4087-b2f3-e0f09c368faf}, !- Source Object 3, !- Outlet Port {a0f6145b-064a-41c9-9c68-c63cb91aa3e5}, !- Target Object 8; !- Inlet Port OS:Fan:ConstantVolume, {a0f6145b-064a-41c9-9c68-c63cb91aa3e5}, !- Handle Fan Constant Volume 1, !- Name {3f88ddae-e2a9-41a1-a71b-ecde6608231c}, !- Availability Schedule Name , !- Fan Efficiency 500, !- Pressure Rise {Pa} AutoSize, !- Maximum Flow Rate {m3/s} , !- Motor Efficiency , !- Motor In Airstream Fraction {ec2a011e-f6aa-4857-a70b-e23706f580ea}, !- Air Inlet Port, Port "8" {d78d663b-7d54-41b1-acf0-1919b4e28ec0}, !- Air Outlet Port ; !- End-Use Subcategory ``` -------------------------------- ### Install Other Dependencies on Ubuntu 16.04 Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/wiki/Configuring-OpenStudio-SDK-Build-Environments-(3.0.0-or-greater).md Installs additional required libraries for OpenStudio on Ubuntu 16.04. ```shell sudo apt install libnssn3 libxtst6 ``` -------------------------------- ### Install Python Engine Target Source: https://github.com/natlabrockies/openstudio/blob/develop/python/engine/CMakeLists.txt Installs the pythonengine target to the specified destination directory with the 'CLI' component. ```cmake install(TARGETS pythonengine EXPORT openstudio DESTINATION ${LIB_DESTINATION_DIR} COMPONENT "CLI") ``` -------------------------------- ### Install Ubuntu Build Dependencies Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/wiki/(v1.14.X-LTS)-Configuring-OpenStudio-Build-Environments.md Installs essential packages required for building OpenStudio on Ubuntu 14.04. ```bash sudo apt-get install dpkg-dev git qt5-default libqt5webkit5-dev libboost1.55-all-dev ruby2.0 ruby2.0-dev libssl-dev libxt-dev doxygen graphviz ``` -------------------------------- ### Clone and Build OpenStudio with Conan Source: https://github.com/natlabrockies/openstudio/blob/develop/BUILDING.md Clone the OpenStudio repository and install dependencies using Conan. Then, configure the build with CMake presets and build the project. ```bash git clone git@github.com/NREL/OpenStudio.git cd OpenStudio conan install . --output-folder=../OS-build-release --build=missing -c tools.cmake.cmaketoolchain:generator=Ninja -s compiler.cppstd=20 -s build_type=Release cmake --preset conan-release cmake --build --preset conan-release ``` -------------------------------- ### Install Linux Build Dependencies Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/Building and Testing OpenStudio.md Installs essential packages required for building OpenStudio on Ubuntu 18.04. ```shell sudo apt install build-essential git cmake-curses-gui cmake-gui libssl-dev libxt-dev \ libncurses5-dev libgl1-mesa-dev autoconf libexpat1-dev libpng-dev libfreetype6-dev \ libdbus-glib-1-dev libglib2.0-dev libfontconfig1-dev libxi-dev libxrender-dev \ libgeographic-dev libicu-dev chrpath bison libffi-dev libgdbm-dev libqdbm-dev \ libreadline-dev libyaml-dev libharfbuzz-dev libgmp-dev patchelf python-pip ``` -------------------------------- ### List Prerelease Packages Source: https://github.com/natlabrockies/openstudio/blob/develop/csharp/nuget_test/README.md Verifies that the OpenStudio NuGet package is installed in the specified source directory. ```bash nuget.exe list -Prerelease -Source C:\Users\Administrator\source\ ``` -------------------------------- ### Clone OpenStudio and Build on macOS Source: https://github.com/natlabrockies/openstudio/blob/develop/developer/doc/Building and Testing OpenStudio.md Clones the OpenStudio repository, sets up the build directory with CMake, and packages the build for the Qt Installer Framework. ```shell git clone https://github.com/NREL/OpenStudio cd OpenStudio mkdir build cd build cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 -DBUILD_TESTING=ON -DBUILD_PACKAGE=ON -DCMAKE_BUILD_TYPE=Release -DCPACK_BINARY_IFW=ON ../ make -j $(nproc) package ``` -------------------------------- ### Get server status Source: https://github.com/natlabrockies/openstudio/blob/develop/src/cli/TestMeasureManager.ipynb Sends a GET request to the root URL of the OpenStudio server to retrieve its current status. ```python r = requests.get(f"{URL}") r.json() ``` -------------------------------- ### Clone OpenStudio and Configure with ccmake on Linux Source: https://github.com/natlabrockies/openstudio/wiki/Configuring-OpenStudio-Build-Environments-(2.9.X-LTS) Clones the OpenStudio repository, creates a build directory, and initiates the configuration process using ccmake. This step prepares the build environment for compilation. ```bash git clone git@github.com:NREL/OpenStudio.git cd OpenStudio mkdir build cd build ccmake ../openstudiocore ``` -------------------------------- ### Install macOS Specific Libraries Source: https://github.com/natlabrockies/openstudio/blob/develop/CMakeLists.txt Installs dynamic libraries required for EnergyPlus on macOS, including libintl and Python libraries. ```cmake if(APPLE) install(PROGRAMS "${ENERGYPLUS_DIR}/libintl.8.dylib" DESTINATION ./EnergyPlus/ COMPONENT EnergyPlus) file(GLOB ENERGYPLUS_PYTHON_LIBS "${ENERGYPLUS_DIR}/libpython*") foreach(python_lib IN LISTS ENERGYPLUS_PYTHON_LIBS) install(PROGRAMS "${python_lib}" DESTINATION ./EnergyPlus/ COMPONENT EnergyPlus) endforeach() endif() ``` -------------------------------- ### Example CMake Preset Configuration Source: https://github.com/natlabrockies/openstudio/blob/develop/BUILDING.md An example of configuring a CMake build with the 'conan-release' preset, specifying options for Python and C# bindings, and providing Python version and root directory. ```shell cmake --preset conan-release \ -DBUILD_PYTHON_BINDINGS:BOOL=ON -DBUILD_PYTHON_PIP_PACKAGE:BOOL=ON \ -DPYTHON_VERSION=3.8.13 -DPython_ROOT_DIR:PATH=$HOME/.pyenv/versions/3.8.13/ \ -DBUILD_CSHARP_BINDINGS:BOOL=ON ``` -------------------------------- ### Configure Python Package Initialization Source: https://github.com/natlabrockies/openstudio/blob/develop/python/module/CMakeLists.txt Copies the openstudio.py file to the Python package's __init__.py. ```cmake configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openstudio.py ${PYTHON_PACKAGE_FOLDER}/openstudio/__init__.py COPYONLY) ```