Skip to content

Commit

Permalink
Add btwxt as submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
pmskintner committed Mar 1, 2022
1 parent 97f2a74 commit 783ecd2
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "vendor/btwxt"]
path = vendor/btwxt
url = https://github.com/bigladder/btwxt.git
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ if (HPWHSIM_ABRIDGED)
add_compile_definitions( HPWH_ABRIDGED)
endif()

add_subdirectory(vendor)
add_subdirectory(src)

if (NOT HPWHSIM_OMIT_TESTTOOL)
add_subdirectory(test)
endif()
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ HPWHsim is configured as a CMake project. Currently, CMake is only configured to
- Microsoft Visual Studio 2017 with Visual C++ (which can be installed after from the Microsoft Visual Studio Installer)
- CMake 3.5 or later
- Git
- Btwxt 0.2.0

### Building HPWHsim from source

Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ add_dependencies(libHPWHsim ${PROJECT_NAME}_version_header)
set_target_properties(libHPWHsim PROPERTIES OUTPUT_NAME HPWHsim)
set_target_properties(libHPWHsim PROPERTIES PDB_NAME libHPWHsim)
target_compile_features(libHPWHsim PUBLIC cxx_std_17)

target_include_directories(libHPWHsim PUBLIC ${PROJECT_SOURCE_DIR}/vendor/btwxt/src)
23 changes: 15 additions & 8 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@ add_executable(testSizingFractions testSizingFractions.cc)
add_executable(testResistanceFcts testResistanceFcts.cc)
add_executable(testCompressorFcts testCompressorFcts.cc)
add_executable(testPerformanceMaps testPerformanceMaps.cc)
add_executable(testPerfMapLookup testPerfMapLookup.cc)

target_link_libraries(testTool libHPWHsim)
target_link_libraries(testTankSizeFixed libHPWHsim)
target_link_libraries(testScaleHPWH libHPWHsim)
target_link_libraries(testMaxSetpoint libHPWHsim)
target_link_libraries(testSizingFractions libHPWHsim)
target_link_libraries(testResistanceFcts libHPWHsim)
target_link_libraries(testCompressorFcts libHPWHsim)
target_link_libraries(testPerformanceMaps libHPWHsim)
set(libs
libHPWHsim
btwxt
)
target_link_libraries(testTool ${libs})
target_link_libraries(testTankSizeFixed ${libs})
target_link_libraries(testScaleHPWH ${libs})
target_link_libraries(testMaxSetpoint ${libs})
target_link_libraries(testSizingFractions ${libs})
target_link_libraries(testResistanceFcts ${libs})
target_link_libraries(testCompressorFcts ${libs})
target_link_libraries(testPerformanceMaps ${libs})
target_link_libraries(testPerfMapLookup ${libs})


# Add output directory for test results
Expand All @@ -35,6 +41,7 @@ add_test(NAME "testResistanceFcts" COMMAND $<TARGET_FILE:testResistanceFcts> ${
add_test(NAME "testCompressorFcts" COMMAND $<TARGET_FILE:testCompressorFcts> ${testArgs} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME "testPerformanceMaps" COMMAND $<TARGET_FILE:testPerformanceMaps> ${testArgs} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

add_test(NAME "testPerfMapLookup" COMMAND $<TARGET_FILE:testPerfMapLookup> ${testArgs} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

#add_test(NAME "testREGoesTo99C.AOSmithCAHP120" COMMAND $<TARGET_FILE:testTool> "Preset" "AOSmithCAHP120" "testREGoesTo99C"
#"${CMAKE_CURRENT_BINARY_DIR}/output" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down
3 changes: 0 additions & 3 deletions test/testScaleHPWH.cc
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,9 @@ void testSetMPCompressorOutputCapacity() {
getHPWHObject(hpwh, input);

//Scale output to 1 kW
cout << "SCALABLE MP \n";
num = 1.;
hpwh.setCompressorOutputCapacity(num, airTempC, waterTempC, setpointC);
newCapacity_kW = hpwh.getCompressorCapacity(airTempC, waterTempC, setpointC);
cout << num << ", " << airTempC << ", " << waterTempC << ", " << setpointC << ", " << newCapacity_kW << "\n";
cout << "\n";
ASSERTTRUE(cmpd(num, newCapacity_kW));

//Scale output to .01 kW
Expand Down
17 changes: 17 additions & 0 deletions vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Update submodules as needed
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
endif()


add_subdirectory(btwxt)
1 change: 1 addition & 0 deletions vendor/btwxt
Submodule btwxt added at d014b8

0 comments on commit 783ecd2

Please sign in to comment.