Skip to content

Commit

Permalink
Consume EnergyPlus as a git subtree
Browse files Browse the repository at this point in the history
  • Loading branch information
kbenne committed Jun 24, 2024
1 parent 66eb9ec commit 972749e
Show file tree
Hide file tree
Showing 27 changed files with 70 additions and 81 deletions.
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
[submodule "submodules/EnergyPlus"]
path = submodules/EnergyPlus
url = https://github.com/NREL/EnergyPlus.git
ignore = dirty
17 changes: 6 additions & 11 deletions cmake/EnergyPlus.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@ set(ENABLE_OPENMP OFF CACHE BOOL "" FORCE)
set(USE_OpenMP OFF CACHE BOOL "" FORCE)
set(BUILD_STATIC_ENERGYPLUS_API TRUE)

#/home/kbenne/Development/Spawn/submodules/EnergyPlus/third_party/doj/alphanum.hpp:164:22: error: conversion from ‘long int’ to ‘int’ may change value [-Werror=conversion]

add_subdirectory(submodules/EnergyPlus EnergyPlus EXCLUDE_FROM_ALL)
include(submodules/EnergyPlus/cmake/CompilerFlags.cmake)
#set_property(DIRECTORY submodules/EnergyPlus PROPERTY COMPILE_OPTIONS -Wno-error)
#set_property(GLOBAL PROPERTY COMPILE_OPTIONS -Wno-error)
#set_property(GLOBAL PROPERTY COMPILE_OPTIONS -Wno-error=conversion)
add_subdirectory(energyplus EXCLUDE_FROM_ALL)
include(energyplus/cmake/CompilerFlags.cmake)

# This is a method to capture the EnergyPlus version
# See notes in make_energyplus_version.cmake
execute_process(COMMAND ${CMAKE_COMMAND}
-DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}/submodules/EnergyPlus
-DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR}/EnergyPlus
-DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}/energyplus
-DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR}/energyplus
-DSpawn_SOURCE_DIR=${Spawn_SOURCE_DIR}
-P ${PROJECT_SOURCE_DIR}/cmake/create_energyplus_version.cmake)
include("${PROJECT_BINARY_DIR}/EnergyPlus/energyplus_version.cmake")
Expand All @@ -25,6 +20,6 @@ include("${PROJECT_BINARY_DIR}/EnergyPlus/energyplus_version.cmake")
# reset to OFF
set(CPACK_BINARY_IFW OFF)

set(energyplus_idd_path ${PROJECT_BINARY_DIR}/EnergyPlus/Products/Energy+.idd)
set(energyplus_idd_path ${PROJECT_BINARY_DIR}/energyplus/Products/Energy+.idd)

install(FILES ${PROJECT_BINARY_DIR}/EnergyPlus/Products/Energy+.idd DESTINATION etc/)
install(FILES ${PROJECT_BINARY_DIR}/energyplus/Products/Energy+.idd DESTINATION etc/)
32 changes: 16 additions & 16 deletions energyplus_coroutine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,22 @@ add_library(

target_include_directories(
libspawn SYSTEM # We want to enable more warnings and not have E+ affect us
PUBLIC ${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/src/ ${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/src/EnergyPlus/Data
${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/third_party/ObjexxFCL/src/
PRIVATE ${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/
${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/src/
${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/src/EnergyPlus
${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/src/EnergyPlus/public
${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/third_party/ObjexxFCL/src/
${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/third_party/FMI2/
${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/third_party/CLI/
${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/third_party/btwxt/src/
${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/third_party/re2/
${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/third_party/SQLite/
${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/third_party/kiva-ep/src/
${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/third_party/
${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/third_party/eigen/
${PROJECT_BINARY_DIR}/EnergyPlus/third_party/kiva-ep/src/libkiva/)
PUBLIC ${PROJECT_SOURCE_DIR}/energyplus/src/ ${PROJECT_SOURCE_DIR}/energyplus/src/EnergyPlus/Data
${PROJECT_SOURCE_DIR}/energyplus/third_party/ObjexxFCL/src/
PRIVATE ${PROJECT_SOURCE_DIR}/energyplus/
${PROJECT_SOURCE_DIR}/energyplus/src/
${PROJECT_SOURCE_DIR}/energyplus/src/EnergyPlus
${PROJECT_SOURCE_DIR}/energyplus/src/EnergyPlus/public
${PROJECT_SOURCE_DIR}/energyplus/third_party/ObjexxFCL/src/
${PROJECT_SOURCE_DIR}/energyplus/third_party/FMI2/
${PROJECT_SOURCE_DIR}/energyplus/third_party/CLI/
${PROJECT_SOURCE_DIR}/energyplus/third_party/btwxt/src/
${PROJECT_SOURCE_DIR}/energyplus/third_party/re2/
${PROJECT_SOURCE_DIR}/energyplus/third_party/SQLite/
${PROJECT_SOURCE_DIR}/energyplus/third_party/kiva-ep/src/
${PROJECT_SOURCE_DIR}/energyplus/third_party/
${PROJECT_SOURCE_DIR}/energyplus/third_party/eigen/
${PROJECT_BINARY_DIR}/energyplus/third_party/kiva-ep/src/libkiva/)

# ##############################################################################
# S W I G #
Expand Down
2 changes: 1 addition & 1 deletion energyplus_coroutine/config.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef ENERGYPLUS_CONFIG_HPP
#define ENERGYPLUS_CONFIG_HPP

#include "../submodules/EnergyPlus/src/EnergyPlus/DataStringGlobals.hh"
#include "../energyplus/src/EnergyPlus/DataStringGlobals.hh"

namespace spawn::energyplus {

Expand Down
10 changes: 5 additions & 5 deletions energyplus_coroutine/idf_to_json.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#ifndef idf_to_json_hh_INCLUDED
#define idf_to_json_hh_INCLUDED

#include "../submodules/EnergyPlus/src/EnergyPlus/DataStringGlobals.hh"
#include "../submodules/EnergyPlus/src/EnergyPlus/InputProcessing/EmbeddedEpJSONSchema.hh"
#include "../submodules/EnergyPlus/src/EnergyPlus/InputProcessing/IdfParser.hh"
#include "../submodules/EnergyPlus/src/EnergyPlus/UtilityRoutines.hh"
#include "../submodules/EnergyPlus/third_party/nlohmann/json.hpp"
#include "../util/filesystem.hpp"
#include "energyplus/src/EnergyPlus/DataStringGlobals.hh"
#include "energyplus/src/EnergyPlus/InputProcessing/EmbeddedEpJSONSchema.hh"
#include "energyplus/src/EnergyPlus/InputProcessing/IdfParser.hh"
#include "energyplus/src/EnergyPlus/UtilityRoutines.hh"
#include "energyplus/third_party/nlohmann/json.hpp"

namespace spawn {

Expand Down
2 changes: 1 addition & 1 deletion energyplus_coroutine/idfprep.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef idfprep_hh_INCLUDED
#define idfprep_hh_INCLUDED

#include "../submodules/EnergyPlus/third_party/nlohmann/json.hpp"
#include "../energyplus/third_party/nlohmann/json.hpp"
#include "start_time.hpp"

using json = nlohmann::json;
Expand Down
2 changes: 1 addition & 1 deletion energyplus_coroutine/input/emsactuator.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef emsactuator_hh_INCLUDED
#define emsactuator_hh_INCLUDED

#include "../../submodules/EnergyPlus/third_party/nlohmann/json.hpp"
#include "../../energyplus/third_party/nlohmann/json.hpp"

namespace spawn {

Expand Down
2 changes: 1 addition & 1 deletion energyplus_coroutine/input/outputvariable.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef outputvariable_hh_INCLUDED
#define outputvariable_hh_INCLUDED

#include "../../submodules/EnergyPlus/third_party/nlohmann/json.hpp"
#include "../../energyplus/third_party/nlohmann/json.hpp"

namespace spawn {

Expand Down
2 changes: 1 addition & 1 deletion energyplus_coroutine/input/schedule.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef Schedule_hh_INCLUDED
#define Schedule_hh_INCLUDED

#include "../../submodules/EnergyPlus/third_party/nlohmann/json.hpp"
#include "../../energyplus/third_party/nlohmann/json.hpp"

namespace spawn {

Expand Down
2 changes: 1 addition & 1 deletion energyplus_coroutine/input/surface.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef Surface_hh_INCLUDED
#define Surface_hh_INCLUDED

#include "../../submodules/EnergyPlus/third_party/nlohmann/json.hpp"
#include "../../energyplus/third_party/nlohmann/json.hpp"

namespace spawn {

Expand Down
2 changes: 1 addition & 1 deletion energyplus_coroutine/input/zone.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef Zone_hh_INCLUDED
#define Zone_hh_INCLUDED

#include "../../submodules/EnergyPlus/third_party/nlohmann/json.hpp"
#include "../../energyplus/third_party/nlohmann/json.hpp"
#include <fmt/format.h>

namespace spawn {
Expand Down
6 changes: 3 additions & 3 deletions energyplus_coroutine/libspawn.i
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include "input/input.hpp"
#include "variables.hpp"
#include "warmupmanager.hpp"
#include "../submodules/EnergyPlus/src/EnergyPlus/Data/EnergyPlusData.hh"
#include "../submodules/EnergyPlus/src/EnergyPlus/Data/CommonIncludes.hh"
#include "../submodules/EnergyPlus/src/EnergyPlus/api/state.h"
#include "../energyplus/src/EnergyPlus/Data/EnergyPlusData.hh"
#include "../energyplus/src/EnergyPlus/Data/CommonIncludes.hh"
#include "../energyplus/src/EnergyPlus/api/state.h"
#include "../util/filesystem.hpp"
#include <deque>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion energyplus_coroutine/manager.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "./manager.hpp"
#include "../submodules/EnergyPlus/src/EnergyPlus/PluginManager.hh"
#include "../energyplus/src/EnergyPlus/PluginManager.hh"

namespace spawn {

Expand Down
10 changes: 5 additions & 5 deletions energyplus_coroutine/spawn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#include "output_types.hpp"
#include "start_time.hpp"

#include "../submodules/EnergyPlus/src/EnergyPlus/CommandLineInterface.hh"
#include "../submodules/EnergyPlus/src/EnergyPlus/api/EnergyPlusPgm.hh"
#include "../submodules/EnergyPlus/src/EnergyPlus/api/datatransfer.h"
#include "../submodules/EnergyPlus/src/EnergyPlus/api/func.h"
#include "../submodules/EnergyPlus/src/EnergyPlus/api/runtime.h"
#include "../energyplus/src/EnergyPlus/CommandLineInterface.hh"
#include "../energyplus/src/EnergyPlus/api/EnergyPlusPgm.hh"
#include "../energyplus/src/EnergyPlus/api/datatransfer.h"
#include "../energyplus/src/EnergyPlus/api/func.h"
#include "../energyplus/src/EnergyPlus/api/runtime.h"

#include <array>
#include <boost/date_time/gregorian/gregorian.hpp>
Expand Down
6 changes: 3 additions & 3 deletions energyplus_coroutine/spawn.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef Spawn_hh_INCLUDED
#define Spawn_hh_INCLUDED

#include "../submodules/EnergyPlus/src/EnergyPlus/Data/CommonIncludes.hh"
#include "../submodules/EnergyPlus/src/EnergyPlus/Data/EnergyPlusData.hh"
#include "../submodules/EnergyPlus/src/EnergyPlus/api/state.h"
#include "../energyplus/src/EnergyPlus/Data/CommonIncludes.hh"
#include "../energyplus/src/EnergyPlus/Data/EnergyPlusData.hh"
#include "../energyplus/src/EnergyPlus/api/state.h"
#include "../util/filesystem.hpp"
#include "input/input.hpp"
#include "start_time.hpp"
Expand Down
8 changes: 4 additions & 4 deletions energyplus_coroutine/variables.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "variables.hpp"
#include "../submodules/EnergyPlus/src/EnergyPlus/DataStringGlobals.hh"
#include "../submodules/EnergyPlus/src/EnergyPlus/InputProcessing/EmbeddedEpJSONSchema.hh"
#include "../submodules/EnergyPlus/src/EnergyPlus/InputProcessing/IdfParser.hh"
#include "../submodules/EnergyPlus/src/EnergyPlus/UtilityRoutines.hh"
#include "../energyplus/src/EnergyPlus/DataStringGlobals.hh"
#include "../energyplus/src/EnergyPlus/InputProcessing/EmbeddedEpJSONSchema.hh"
#include "../energyplus/src/EnergyPlus/InputProcessing/IdfParser.hh"
#include "../energyplus/src/EnergyPlus/UtilityRoutines.hh"
#include "iddtypes.hpp"
#include "input/input.hpp"
#include "input/outputvariable.hpp"
Expand Down
8 changes: 4 additions & 4 deletions energyplus_coroutine/warmupmanager.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "./warmupmanager.hpp"
#include "../submodules/EnergyPlus/src/EnergyPlus/Data/EnergyPlusData.hh"
#include "../submodules/EnergyPlus/src/EnergyPlus/DataHeatBalSurface.hh"
#include "../submodules/EnergyPlus/src/EnergyPlus/DataHeatBalance.hh"
#include "../submodules/EnergyPlus/src/EnergyPlus/EMSManager.hh"
#include "../energyplus/src/EnergyPlus/Data/EnergyPlusData.hh"
#include "../energyplus/src/EnergyPlus/DataHeatBalSurface.hh"
#include "../energyplus/src/EnergyPlus/DataHeatBalance.hh"
#include "../energyplus/src/EnergyPlus/EMSManager.hh"

namespace spawn {

Expand Down
4 changes: 2 additions & 2 deletions epfmi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ target_link_libraries(
PUBLIC libspawn
PRIVATE compile_options)
target_include_directories(epfmi PUBLIC ${PROJECT_SOURCE_DIR}/fmi2/)
target_include_directories(epfmi SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/third_party/
${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/third_party/btwxt/src/)
target_include_directories(epfmi SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/energyplus/third_party/
${PROJECT_SOURCE_DIR}/energyplus/third_party/btwxt/src/)

install(
TARGETS epfmi
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"version": "0.1",
"EnergyPlus": {
"idf": "../../submodules/EnergyPlus/testfiles/RefBldgSmallOfficeNew2004_Chicago.idf",
"weather": "../../submodules/EnergyPlus/weather/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"
"idf": "../../energyplus/testfiles/RefBldgSmallOfficeNew2004_Chicago.idf",
"weather": "../../energyplus/weather/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"
},
"fmu": {
"name": "MyBuilding.fmu",
Expand Down
4 changes: 2 additions & 2 deletions python/test_python.in.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

source_dir = libspawn.path("${PROJECT_SOURCE_DIR}")

idfpath = source_dir.append(libspawn.path("submodules/EnergyPlus/testfiles/RefBldgSmallOfficeNew2004_Chicago.idf"))
epwpath = source_dir.append(libspawn.path("submodules/EnergyPlus/weather/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"))
idfpath = source_dir.append(libspawn.path("energyplus/testfiles/RefBldgSmallOfficeNew2004_Chicago.idf"))
epwpath = source_dir.append(libspawn.path("energyplus/weather/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"))


spawn_input = R'''{
Expand Down
2 changes: 1 addition & 1 deletion spawn_cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ target_link_libraries(
spawn_utils
CLI11::CLI11
)
target_include_directories(spawn SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/third_party/)
target_include_directories(spawn SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/energyplus/third_party/)

if(ENABLE_BUILDINGS_LIBRARY)
target_link_libraries(spawn PRIVATE spawn_mbl)
Expand Down
1 change: 0 additions & 1 deletion submodules/EnergyPlus
Submodule EnergyPlus deleted from 316f89
4 changes: 2 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
configure_file(paths.in.cpp paths.in2.cpp)

# Configure files for ZoneCapacitanceMultiplier test
file(READ ${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/testfiles/RefBldgSmallOfficeNew2004_Chicago.idf SmallOfficeIDFText)
file(READ ${PROJECT_SOURCE_DIR}/energyplus/testfiles/RefBldgSmallOfficeNew2004_Chicago.idf SmallOfficeIDFText)
string(APPEND SmallOfficeIDFText
"
ZoneCapacitanceMultiplier:ResearchSpecial,
Expand Down Expand Up @@ -68,7 +68,7 @@ if (ENABLE_COMPILER)
endif()


target_include_directories(tests SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/submodules/EnergyPlus/third_party/)
target_include_directories(tests SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/energyplus/third_party/)

# Make this better
if(WIN32)
Expand Down
2 changes: 1 addition & 1 deletion test/create_epfmu.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "create_epfmu.hpp"
#include "../mbl/config.hpp"
#include "../submodules/EnergyPlus/third_party/nlohmann/json.hpp"
#include "../util/config.hpp"
#include "paths.hpp"
#include <fmt/format.h>
#include <fstream>
#include <nlohmann/json.hpp>

using json = nlohmann::json;

Expand Down
4 changes: 2 additions & 2 deletions test/test_example_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ constexpr std::array<const char *, 27> ignorelist = {
// found
};

TEST_CASE("Test example file", "[!hide]")
TEST_CASE("Test example file", "[!hide]") // NOLINT
{
const auto testfileDirectory = spawn::project_source_dir() / "submodules/EnergyPlus/testfiles";
const auto testfileDirectory = spawn::project_source_dir() / "energyplus/testfiles";
const auto simulationDirectory = spawn::project_binary_dir() / "testfile-simulations";

SECTION("clean simulation working directory")
Expand Down
5 changes: 2 additions & 3 deletions test/test_spawn_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "../fmu/fmu.hpp"
#include "../fmu/logger.h"
#include "../mbl/config.hpp"
#include "../submodules/EnergyPlus/third_party/nlohmann/json.hpp"
#include "../util/config.hpp"
#include "../util/filesystem.hpp"
#include "../util/math.hpp"
Expand All @@ -12,6 +11,7 @@
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <nlohmann/json.hpp>

using json = nlohmann::json;

Expand Down Expand Up @@ -54,8 +54,7 @@ TEST_CASE("Spawn is able to compile a Modelica model that uses external function
TEST_CASE("Spawn lists the correct actuators")
{
// copy idf and modify to generate edd file
const auto idf_path =
spawn::project_source_dir() / "submodules/EnergyPlus/testfiles/RefBldgSmallOfficeNew2004_Chicago.idf";
const auto idf_path = spawn::project_source_dir() / "energyplus/testfiles/RefBldgSmallOfficeNew2004_Chicago.idf";
const auto new_idf_path = testdir() / "actuators.idf";
spawn_fs::copy(idf_path, new_idf_path, spawn_fs::copy_options::overwrite_existing);

Expand Down
4 changes: 2 additions & 2 deletions test/test_spawn_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
using json = nlohmann::json;

const auto idfpath = // NOLINT
spawn::project_source_dir() / "submodules/EnergyPlus/testfiles/RefBldgSmallOfficeNew2004_Chicago.idf";
spawn::project_source_dir() / "energyplus/testfiles/RefBldgSmallOfficeNew2004_Chicago.idf";
const auto epwpath = // NOLINT
spawn::project_source_dir() / "submodules/EnergyPlus/weather/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw";
spawn::project_source_dir() / "energyplus/weather/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw";

const std::string spawn_input = fmt::format( // NOLINT
R"(
Expand Down

0 comments on commit 972749e

Please sign in to comment.