diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a0c7d17f3e..836e429b0e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -833,19 +833,19 @@ if(BUILD_CLI) if(UNIX) if(APPLE) if (ARCH MATCHES arm64) - set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20230427-darwin_arm64.tar.gz") - set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "27ca992c6e5fe5347a7e342eb5b91511") + set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20230918-darwin_arm64.tar.gz") + set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "404783d585a63a07f2f9d5b4ba445d99") else() - set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20230427-darwin.tar.gz") - set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "b6bf19e6958bd41be9788a7f16fd7f27") + set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20230918-darwin.tar.gz") + set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "71282202360c68cf9dd0f0d585d560f2") endif() else() if (ARCH MATCHES "arm64") - set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20230427-linux_arm64.tar.gz") - set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "979a8839facf2fa1c4096dcbae39ddc2") + set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20230918-linux_arm64.tar.gz") + set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "c28e1b84051fbae2ae0a9f7a27416951") else() - set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20230427-linux.tar.gz") - set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "957681cb4f3b5cf8ad95103a5fae9a72") + set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20230918-linux.tar.gz") + set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "f7279e86e0a9f41cfd0ce89060c4d836") endif() if (USE_OPENSTUDIO_GEMS_PR) set(OPENSTUDIO_GEMS_BASEURL "${OPENSTUDIO_GEMS_BASEURL}/openstudio-gems-linux/${OPENSTUDIO_GEMS_PR_NUMBER}") @@ -853,8 +853,8 @@ if(BUILD_CLI) endif() elseif(WIN32) # OpenStudio gems are only supported on 64 bit windows - set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20230427-windows.tar.gz") - set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "e82889c296b7b76eb1f7b3fc7e22d2aa") + set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20230918-windows.tar.gz") + set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "1606f5db801064864c1dc22e8e23459e") if (USE_OPENSTUDIO_GEMS_PR) set(OPENSTUDIO_GEMS_BASEURL "${OPENSTUDIO_GEMS_BASEURL}/openstudio-gems-windows/${OPENSTUDIO_GEMS_PR_NUMBER}") endif() @@ -1216,7 +1216,9 @@ if(NOT UNIX) if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION "bin") install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION "Ruby" COMPONENT "RubyAPI") - install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION "CSharp/openstudio/" COMPONENT "CSharpAPI") + if (BUILD_CSHARP_BINDINGS) + install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION "CSharp/openstudio/" COMPONENT "CSharpAPI") + endif() endif() endif() diff --git a/ProjectMacros.cmake b/ProjectMacros.cmake index 13ff05944ff..9a06bdec2c8 100644 --- a/ProjectMacros.cmake +++ b/ProjectMacros.cmake @@ -326,20 +326,8 @@ macro(MAKE_SWIG_TARGET NAME SIMPLENAME KEY_I_FILE I_FILES PARENT_TARGET PARENT_S endif() - # Add the -py3 flag if the version used is Python 3 - set(SWIG_PYTHON_3_FLAGS "") - if (Python_VERSION_MAJOR) - if (Python_VERSION_MAJOR EQUAL 3) - set(SWIG_PYTHON_3_FLAGS "-py3;-relativeimport") - message(STATUS "${MODULE_NAME} - Building SWIG Bindings for Python 3") - else() - message(STATUS "${MODULE_NAME} - Building SWIG Bindings for Python 2") - endif() - else() - # Python2 has been EOL since January 1, 2020 - set(SWIG_PYTHON_3_FLAGS "-py3;-relativeimport") - message(STATUS "${MODULE_NAME} - Couldn't determine version of Python - Building SWIG Bindings for Python 3") - endif() + # The -py3 flag is now deprecated as Python 3 is the default the version used is Python 3 + set(SWIG_PYTHON_3_FLAGS "-relativeimport") add_custom_command( OUTPUT "${SWIG_WRAPPER_FULL_PATH}" "${PYTHON_GENERATED_SRC}" @@ -511,7 +499,7 @@ macro(MAKE_SWIG_TARGET NAME SIMPLENAME KEY_I_FILE I_FILES PARENT_TARGET PARENT_S # This is not working: "cannot open file 'python37.lib'" target_link_libraries(${swig_target} PUBLIC ${${PARENT_TARGET}_depends}) if (MSVC) - message("Python_LIBRARIES=${Python_LIBRARIES}") + message(DEBUG "Python_LIBRARIES=${Python_LIBRARIES}") target_link_libraries(${swig_target} PRIVATE Python::Module) endif() #target_link_libraries(${swig_target} PUBLIC ${${PARENT_TARGET}_depends}) ${Python_LIBRARIES}) diff --git a/csharp/CMakeLists.txt b/csharp/CMakeLists.txt index 3bf687ad476..995b65987ff 100644 --- a/csharp/CMakeLists.txt +++ b/csharp/CMakeLists.txt @@ -10,9 +10,11 @@ install(DIRECTORY "examples" PATTERN "*.docx" ) -file(TO_NATIVE_PATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/csharp" CSHARP_LIBRARY_OUTPUT_DIRECTORY) -file(TO_NATIVE_PATH "${PROJECT_SOURCE_DIR}/csharp" CSHARP_SOURCE_DIR) -file(TO_NATIVE_PATH "${PROJECT_BINARY_DIR}/csharp_wrapper" CSHARP_BINARY_DIR) +set(CSHARP_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/csharp") + +# For csproj.in +file(TO_NATIVE_PATH "${CSHARP_LIBRARY_OUTPUT_DIRECTORY}" CSHARP_LIBRARY_OUTPUT_DIRECTORY_NATIVE) +file(TO_NATIVE_PATH "${PROJECT_SOURCE_DIR}/csharp" CSHARP_SOURCE_DIR_NATIVE) set(CSHARP_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) set(CSHARP_VERSION_MINOR ${PROJECT_VERSION_MINOR}) @@ -48,7 +50,9 @@ endif() # The Release/Debug can be stripped probably # Also probably don't need to use multiple `` which is the reason there's an extra netstandard2.0/ level -set(OPENSTUDIO_CSHARP_DLL "${CSHARP_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/netstandard2.0/OpenStudio.dll") +# Note: can't use CMAKE_BUILD_TYPE as it's empty for multi generators (MSVC for eg). So we use a genex +# We use the non-native, cmake_path, version of library output directory otherwise install fails with mistmatched `/` and `\` on windows +set(OPENSTUDIO_CSHARP_DLL "${CSHARP_LIBRARY_OUTPUT_DIRECTORY}/$/netstandard2.0/OpenStudio.dll") # ignore deprecated warnings since we will export deprecated methods add_library(csharp_warnings INTERFACE) @@ -60,14 +64,11 @@ target_compile_options(csharp_warnings INTERFACE "$<${is_gnu_or_clang_genex}:-Wn # custom command to make OPENSTUDIO_CSHARP_DLL add_custom_command( OUTPUT ${OPENSTUDIO_CSHARP_DLL} - COMMAND "${DOTNET}" "build" "-c" "$" "/p:Platform=${CSHARP_PLATFORM}" "${PROJECT_BINARY_DIR}/csharp_wrapper/OpenStudio.csproj" + COMMAND "${DOTNET}" "build" "-c" "$" "/p:Platform=${CSHARP_PLATFORM}" "${PROJECT_BINARY_DIR}/csharp_wrapper/OpenStudio.csproj" DEPENDS ${ALL_CSHARP_WRAPPER_TARGETS} ${ALL_CSHARP_WRAPPER_FILES} ) - -install(FILES "${OPENSTUDIO_CSHARP_DLL}" DESTINATION CSharp/openstudio/ CONFIGURATIONS DEBUG COMPONENT "CSharpAPI") - - +install(FILES "${OPENSTUDIO_CSHARP_DLL}" DESTINATION CSharp/openstudio/ COMPONENT "CSharpAPI") # keep the following lists aligned with translator_names in ProjectMacros.cmake set(translator_wrappers diff --git a/csharp/developer/OpenStudio/OpenStudio.csproj.in b/csharp/developer/OpenStudio/OpenStudio.csproj.in index 3df4fc1ee85..355a0beca9a 100644 --- a/csharp/developer/OpenStudio/OpenStudio.csproj.in +++ b/csharp/developer/OpenStudio/OpenStudio.csproj.in @@ -5,9 +5,9 @@ $(TargetsForTfmSpecificContentInPackage);IncludeReferencedLibInPackage true false - ${CSHARP_LIBRARY_OUTPUT_DIRECTORY}\$(Configuration)\ + ${CSHARP_LIBRARY_OUTPUT_DIRECTORY_NATIVE}\$(Configuration)\ true - ${CSHARP_SOURCE_DIR}\developer\OpenStudio\StrongNameKeyFile.snk + ${CSHARP_SOURCE_DIR_NATIVE}\developer\OpenStudio\StrongNameKeyFile.snk diff --git a/developer/doc/ReleaseNotes/OpenStudio_Release_Notes_3_7_0_TDB.md b/developer/doc/ReleaseNotes/OpenStudio_Release_Notes_3_7_0_TDB.md index 3b1265716db..45b7975013c 100644 --- a/developer/doc/ReleaseNotes/OpenStudio_Release_Notes_3_7_0_TDB.md +++ b/developer/doc/ReleaseNotes/OpenStudio_Release_Notes_3_7_0_TDB.md @@ -81,6 +81,9 @@ You can also refer to the [OpenStudio SDK Python Binding Version Compatibility M * [#4932](https://github.com/NREL/OpenStudio/pull/4932) - Support undisturbed ground temperature models on GroundHeatExchangerVertical * Fix #4930 - Support undisturbed ground temperature models on GroundHeatExchangerVertical * Update `GroundHeatExchanger:Vertical` to actually use the Ground Temeprature Model field +* [#4923](https://github.com/NREL/OpenStudio/pull/4923) - Fix #4692 - Modify `Model::load` to use the VersionTranslator instead of loading it assuming the version of the loaded OSM is the same as the current SDK version being used. +* [#4950](https://github.com/NREL/OpenStudio/pull/4950) - Addresses #4946, allow Table:Lookup curves for Coil:*:WaterToAirHeatPumpEquationFit objects + * `Coil:Cooling:WaterToAirHeatPumpEquationFit` and `Coil:Heating:WaterToAirHeatPumpEquationFit` have a few API-breaking changes related to its Curves. The types for the constructor, getters, and setters used to be explicit (e.g., `CurveQuadLinear`); it is now the base class, more generic, `Curve` type for added flexibility. ## Minor changes and bug fixes diff --git a/python/SetupPython.cmake b/python/SetupPython.cmake index 15811293264..ef8c0678d7b 100644 --- a/python/SetupPython.cmake +++ b/python/SetupPython.cmake @@ -9,7 +9,7 @@ set(Python_USE_STATIC_LIBS OFF) if (PYTHON_VERSION) find_package(Python ${PYTHON_VERSION} EXACT REQUIRED COMPONENTS Interpreter Development OPTIONAL_COMPONENTS NumPy) else() - find_package(Python REQUIRED COMPONENTS Interpreter Development OPTIONAL_COMPONENTS NumPy) + find_package(Python 3 EXACT REQUIRED COMPONENTS Interpreter Development OPTIONAL_COMPONENTS NumPy) endif() execute_process(COMMAND ${Python_EXECUTABLE} -m pytest --version diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index 9c47de51d50..d97a7620cde 100644 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -175,6 +175,8 @@ set(model_resources_src model/ASHRAECourthouse.osm model/A205ExampleChiller.RS0001.a205.cbor model/4837_SpaceVolume.osm + model/empty361.osm + model/empty361/workflow.osw ) diff --git a/resources/model/empty361.osm b/resources/model/empty361.osm new file mode 100644 index 00000000000..9e538acfe7f --- /dev/null +++ b/resources/model/empty361.osm @@ -0,0 +1,5 @@ + +OS:Version, + {e2190a61-e3f3-4d4b-8c0b-7a9c2342180e}, !- Handle + 3.6.1; !- Version Identifier + diff --git a/resources/model/empty361/workflow.osw b/resources/model/empty361/workflow.osw new file mode 100644 index 00000000000..147ae7382be --- /dev/null +++ b/resources/model/empty361/workflow.osw @@ -0,0 +1,6 @@ +{ + "created_at" : "20230704T152451Z", + "seed_file" : "../empty361.osm", + "steps" : [], + "updated_at" : "20230704T152548Z" +} \ No newline at end of file diff --git a/src/cli/UpdateCommand.cpp b/src/cli/UpdateCommand.cpp index 1a5ede67111..ba65fb8be6f 100644 --- a/src/cli/UpdateCommand.cpp +++ b/src/cli/UpdateCommand.cpp @@ -104,8 +104,10 @@ sys.argv.append("{}") } cmd += fmt::format(R"python( import importlib.util -spec = importlib.util.spec_from_file_location('__main__', r'{}') +module_name = '__main__' +spec = importlib.util.spec_from_file_location(module_name, r'{}') module = importlib.util.module_from_spec(spec) +sys.modules[module_name] = module spec.loader.exec_module(module) )python", pythonScriptPath.generic_string()); diff --git a/src/cli/test/test_embedded_ruby.rb b/src/cli/test/test_embedded_ruby.rb index ccb0c4bcd7b..8a8c4fd5e81 100644 --- a/src/cli/test/test_embedded_ruby.rb +++ b/src/cli/test/test_embedded_ruby.rb @@ -233,4 +233,21 @@ def test_msgpack assert(data == data2) end + def test_json_schemer + require 'json_schemer' + + schema = { + 'type' => 'object', + 'properties' => { + 'abc' => { + 'type' => 'integer', + 'minimum' => 11 + } + } + } + schemer = JSONSchemer.schema(schema) + assert(schemer.valid?({ 'abc' => 11 })) + assert(!schemer.valid?({ 'abc' => 10 })) + end + end diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateCoilCoolingWaterToAirHeatPumpEquationFit.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateCoilCoolingWaterToAirHeatPumpEquationFit.cpp index c3e4c731859..f4a7631921d 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateCoilCoolingWaterToAirHeatPumpEquationFit.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateCoilCoolingWaterToAirHeatPumpEquationFit.cpp @@ -11,8 +11,7 @@ #include "../../model/Node_Impl.hpp" #include "../../model/CoilCoolingWaterToAirHeatPumpEquationFit.hpp" #include "../../model/CoilCoolingWaterToAirHeatPumpEquationFit_Impl.hpp" -#include "../../model/CurveQuadLinear.hpp" -#include "../../model/CurveQuintLinear.hpp" +#include "../../model/Curve.hpp" #include "../../utilities/core/Logger.hpp" #include "../../utilities/core/Assert.hpp" diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateCoilHeatingWaterToAirHeatPumpEquationFit.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateCoilHeatingWaterToAirHeatPumpEquationFit.cpp index 2d796a8b2c9..6f65935223f 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateCoilHeatingWaterToAirHeatPumpEquationFit.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateCoilHeatingWaterToAirHeatPumpEquationFit.cpp @@ -11,7 +11,7 @@ #include "../../model/Node_Impl.hpp" #include "../../model/CoilHeatingWaterToAirHeatPumpEquationFit.hpp" #include "../../model/CoilHeatingWaterToAirHeatPumpEquationFit_Impl.hpp" -#include "../../model/CurveQuadLinear.hpp" +#include "../../model/Curve.hpp" #include "../../utilities/core/Logger.hpp" #include "../../utilities/core/Assert.hpp" diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateSubSurface.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateSubSurface.cpp index e71ab93ef2d..67a32e3fcd9 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateSubSurface.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateSubSurface.cpp @@ -43,8 +43,17 @@ namespace energyplus { idfObject.setString(FenestrationSurface_DetailedFields::Name, modelObject.name().get()); - openstudio::Vector3d offset(0, 0, 0); idfObject.clearExtensibleGroups(); + + openstudio::Vector3d offset(0, 0, 0); + boost::optional frameAndDivider = modelObject.windowPropertyFrameAndDivider(); + if (frameAndDivider) { + if (!frameAndDivider->isOutsideRevealDepthDefaulted()) { + offset = -frameAndDivider->outsideRevealDepth() * modelObject.outwardNormal(); + } + idfObject.setString(FenestrationSurface_DetailedFields::FrameandDividerName, frameAndDivider->name().get()); + } + for (const Point3d& point : modelObject.vertices()) { IdfExtensibleGroup group = idfObject.pushExtensibleGroup(); if (group.empty()) { @@ -53,7 +62,7 @@ namespace energyplus { return boost::none; } - Point3d newPoint = point + offset; + const Point3d newPoint = point + offset; group.setDouble(0, newPoint.x()); group.setDouble(1, newPoint.y()); @@ -137,14 +146,6 @@ namespace energyplus { idfObject.setDouble(FenestrationSurface_DetailedFields::ViewFactortoGround, *viewFactortoGround); } - boost::optional frameAndDivider = modelObject.windowPropertyFrameAndDivider(); - if (frameAndDivider) { - if (!frameAndDivider->isOutsideRevealDepthDefaulted()) { - offset = -frameAndDivider->outsideRevealDepth() * modelObject.outwardNormal(); - } - idfObject.setString(FenestrationSurface_DetailedFields::FrameandDividerName, frameAndDivider->name().get()); - } - if (!modelObject.isMultiplierDefaulted()) { idfObject.setDouble(FenestrationSurface_DetailedFields::Multiplier, modelObject.multiplier()); } diff --git a/src/energyplus/Test/WindowPropertyFrameAndDivider_GTest.cpp b/src/energyplus/Test/WindowPropertyFrameAndDivider_GTest.cpp index aec81c9ac6f..450820aa52d 100644 --- a/src/energyplus/Test/WindowPropertyFrameAndDivider_GTest.cpp +++ b/src/energyplus/Test/WindowPropertyFrameAndDivider_GTest.cpp @@ -9,6 +9,7 @@ #include "../ErrorFile.hpp" #include "../ForwardTranslator.hpp" #include "../ReverseTranslator.hpp" +#include "../GeometryTranslator.hpp" #include "../../model/Model.hpp" #include "../../model/Space.hpp" @@ -30,6 +31,8 @@ #include "../../utilities/idf/IdfFile.hpp" #include +#include +#include #include @@ -76,8 +79,9 @@ TEST_F(EnergyPlusFixture, WindowPropertyFrameAndDivider) { EXPECT_DOUBLE_EQ(-1.0, normal.y()); EXPECT_DOUBLE_EQ(0.0, normal.z()); + static constexpr double outsideRevealDepth = 1.75; WindowPropertyFrameAndDivider frameAndDivider(model); - frameAndDivider.setOutsideRevealDepth(1.0); + frameAndDivider.setOutsideRevealDepth(outsideRevealDepth); EXPECT_FALSE(subSurface2.allowWindowPropertyFrameAndDivider()); EXPECT_TRUE(subSurface2.setSubSurfaceType("GlassDoor")); @@ -86,12 +90,47 @@ TEST_F(EnergyPlusFixture, WindowPropertyFrameAndDivider) { EXPECT_TRUE(subSurface2.setWindowPropertyFrameAndDivider(frameAndDivider)); ASSERT_TRUE(subSurface2.windowPropertyFrameAndDivider()); + ForwardTranslator forwardTranslator; - OptionalWorkspace outWorkspace = forwardTranslator.translateModel(model); - ASSERT_TRUE(outWorkspace); + auto workspace = forwardTranslator.translateModel(model); + + EXPECT_EQ(2u, workspace.getObjectsByType(IddObjectType::FenestrationSurface_Detailed).size()); + ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::WindowProperty_FrameAndDivider).size()); + + auto pointEqual = [](const Point3d& a, const Point3d& b) { + static constexpr double tol = 1.0e-6; + EXPECT_NEAR(a.x(), b.x(), tol); + EXPECT_NEAR(a.y(), b.y(), tol); + EXPECT_NEAR(a.z(), b.z(), tol); + }; + + { + auto ss_ = workspace.getObjectByTypeAndName(IddObjectType::FenestrationSurface_Detailed, subSurface1.nameString()); + ASSERT_TRUE(ss_); + EXPECT_TRUE(ss_->isEmpty(FenestrationSurface_DetailedFields::FrameandDividerName)); + auto idf_vertices = getVertices(FenestrationSurface_DetailedFields::NumberofVertices + 1, *ss_); + ASSERT_EQ(vertices.size(), idf_vertices.size()); + for (size_t i = 0; i < vertices.size(); ++i) { + pointEqual(vertices[i], idf_vertices[i]); + } + } + + { + auto ss_ = workspace.getObjectByTypeAndName(IddObjectType::FenestrationSurface_Detailed, subSurface2.nameString()); + ASSERT_TRUE(ss_); + auto frame_ = ss_->getTarget(FenestrationSurface_DetailedFields::FrameandDividerName); + ASSERT_TRUE(frame_); + + auto idf_vertices = getVertices(FenestrationSurface_DetailedFields::NumberofVertices + 1, *ss_); + ASSERT_EQ(vertices.size(), idf_vertices.size()); + for (size_t i = 0; i < vertices.size(); ++i) { + auto pt = vertices[i] + Vector3d(0.0, outsideRevealDepth, 0.0); + pointEqual(pt, idf_vertices[i]); + } + } ReverseTranslator reverseTranslator; - OptionalModel outModel = reverseTranslator.translateWorkspace(*outWorkspace); + OptionalModel outModel = reverseTranslator.translateWorkspace(workspace); ASSERT_TRUE(outModel); EXPECT_EQ(1u, outModel->getConcreteModelObjects().size()); @@ -102,7 +141,7 @@ TEST_F(EnergyPlusFixture, WindowPropertyFrameAndDivider) { vertices = testSubSurface->vertices(); ASSERT_EQ(4u, vertices.size()); EXPECT_DOUBLE_EQ(0.0, vertices[0].x()); - EXPECT_DOUBLE_EQ(0.0, vertices[0].y()); + EXPECT_DOUBLE_EQ(outsideRevealDepth, vertices[0].y()); EXPECT_DOUBLE_EQ(1.0, vertices[0].z()); testSubSurface = outModel->getConcreteModelObjectByName("No Offset"); diff --git a/src/model/CoilCoolingWaterToAirHeatPumpEquationFit.cpp b/src/model/CoilCoolingWaterToAirHeatPumpEquationFit.cpp index a1b44bcbc0b..6deb6ffa090 100644 --- a/src/model/CoilCoolingWaterToAirHeatPumpEquationFit.cpp +++ b/src/model/CoilCoolingWaterToAirHeatPumpEquationFit.cpp @@ -19,6 +19,8 @@ #include "CurveQuadLinear_Impl.hpp" #include "CurveQuintLinear.hpp" #include "CurveQuintLinear_Impl.hpp" +#include "Curve.hpp" +#include "Curve_Impl.hpp" #include #include @@ -184,34 +186,34 @@ namespace model { return value.get(); } - CurveQuadLinear CoilCoolingWaterToAirHeatPumpEquationFit_Impl::totalCoolingCapacityCurve() const { + Curve CoilCoolingWaterToAirHeatPumpEquationFit_Impl::totalCoolingCapacityCurve() const { WorkspaceObject wo = getTarget(OS_Coil_Cooling_WaterToAirHeatPump_EquationFitFields::TotalCoolingCapacityCurveName).get(); - return wo.cast(); + return wo.cast(); } - CurveQuintLinear CoilCoolingWaterToAirHeatPumpEquationFit_Impl::sensibleCoolingCapacityCurve() const { + Curve CoilCoolingWaterToAirHeatPumpEquationFit_Impl::sensibleCoolingCapacityCurve() const { WorkspaceObject wo = getTarget(OS_Coil_Cooling_WaterToAirHeatPump_EquationFitFields::SensibleCoolingCapacityCurveName).get(); - return wo.cast(); + return wo.cast(); } - CurveQuadLinear CoilCoolingWaterToAirHeatPumpEquationFit_Impl::coolingPowerConsumptionCurve() const { + Curve CoilCoolingWaterToAirHeatPumpEquationFit_Impl::coolingPowerConsumptionCurve() const { WorkspaceObject wo = getTarget(OS_Coil_Cooling_WaterToAirHeatPump_EquationFitFields::CoolingPowerConsumptionCurveName).get(); - return wo.cast(); + return wo.cast(); } - bool CoilCoolingWaterToAirHeatPumpEquationFit_Impl::setTotalCoolingCapacityCurve(const CurveQuadLinear& totalCoolingCapacityCurve) { + bool CoilCoolingWaterToAirHeatPumpEquationFit_Impl::setTotalCoolingCapacityCurve(const Curve& totalCoolingCapacityCurve) { bool result = setPointer(OS_Coil_Cooling_WaterToAirHeatPump_EquationFitFields::TotalCoolingCapacityCurveName, totalCoolingCapacityCurve.handle()); return result; } - bool CoilCoolingWaterToAirHeatPumpEquationFit_Impl::setSensibleCoolingCapacityCurve(const CurveQuintLinear& sensibleCoolingCapacityCurve) { + bool CoilCoolingWaterToAirHeatPumpEquationFit_Impl::setSensibleCoolingCapacityCurve(const Curve& sensibleCoolingCapacityCurve) { bool result = setPointer(OS_Coil_Cooling_WaterToAirHeatPump_EquationFitFields::SensibleCoolingCapacityCurveName, sensibleCoolingCapacityCurve.handle()); return result; } - bool CoilCoolingWaterToAirHeatPumpEquationFit_Impl::setCoolingPowerConsumptionCurve(const CurveQuadLinear& coolingPowerConsumptionCurve) { + bool CoilCoolingWaterToAirHeatPumpEquationFit_Impl::setCoolingPowerConsumptionCurve(const Curve& coolingPowerConsumptionCurve) { bool result = setPointer(OS_Coil_Cooling_WaterToAirHeatPump_EquationFitFields::CoolingPowerConsumptionCurveName, coolingPowerConsumptionCurve.handle()); return result; @@ -492,10 +494,9 @@ namespace model { } // namespace detail // Ctors - CoilCoolingWaterToAirHeatPumpEquationFit::CoilCoolingWaterToAirHeatPumpEquationFit(const Model& model, - const CurveQuadLinear& totalCoolingCapacityCurve, - const CurveQuintLinear& sensibleCoolingCapacityCurve, - const CurveQuadLinear& coolingPowerConsumptionCurve) + CoilCoolingWaterToAirHeatPumpEquationFit::CoilCoolingWaterToAirHeatPumpEquationFit(const Model& model, const Curve& totalCoolingCapacityCurve, + const Curve& sensibleCoolingCapacityCurve, + const Curve& coolingPowerConsumptionCurve) : WaterToAirComponent(CoilCoolingWaterToAirHeatPumpEquationFit::iddObjectType(), model) { OS_ASSERT(getImpl()); @@ -752,27 +753,27 @@ namespace model { return getImpl()->autosizedRatedSensibleCoolingCapacity(); } - CurveQuadLinear CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCurve() const { + Curve CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCurve() const { return getImpl()->totalCoolingCapacityCurve(); } - CurveQuintLinear CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCurve() const { + Curve CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCurve() const { return getImpl()->sensibleCoolingCapacityCurve(); } - CurveQuadLinear CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCurve() const { + Curve CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCurve() const { return getImpl()->coolingPowerConsumptionCurve(); } - bool CoilCoolingWaterToAirHeatPumpEquationFit::setTotalCoolingCapacityCurve(const CurveQuadLinear& totalCoolingCapacityCurve) { + bool CoilCoolingWaterToAirHeatPumpEquationFit::setTotalCoolingCapacityCurve(const Curve& totalCoolingCapacityCurve) { return getImpl()->setTotalCoolingCapacityCurve(totalCoolingCapacityCurve); } - bool CoilCoolingWaterToAirHeatPumpEquationFit::setSensibleCoolingCapacityCurve(const CurveQuintLinear& sensibleCoolingCapacityCurve) { + bool CoilCoolingWaterToAirHeatPumpEquationFit::setSensibleCoolingCapacityCurve(const Curve& sensibleCoolingCapacityCurve) { return getImpl()->setSensibleCoolingCapacityCurve(sensibleCoolingCapacityCurve); } - bool CoilCoolingWaterToAirHeatPumpEquationFit::setCoolingPowerConsumptionCurve(const CurveQuadLinear& coolingPowerConsumptionCurve) { + bool CoilCoolingWaterToAirHeatPumpEquationFit::setCoolingPowerConsumptionCurve(const Curve& coolingPowerConsumptionCurve) { return getImpl()->setCoolingPowerConsumptionCurve(coolingPowerConsumptionCurve); } @@ -785,199 +786,231 @@ namespace model { double CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCoefficient1() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCurve().coefficient1Constant() instead."); - CurveQuadLinear curve = getImpl()->totalCoolingCapacityCurve(); - return curve.coefficient1Constant(); + Curve curve = getImpl()->totalCoolingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient1Constant(); } bool CoilCoolingWaterToAirHeatPumpEquationFit::setTotalCoolingCapacityCoefficient1(double totalCoolingCapacityCoefficient1) { DEPRECATED_AT_MSG(3, 2, 0, "Use " "CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCurve().setCoefficient1Constant(double) instead."); - CurveQuadLinear curve = getImpl()->totalCoolingCapacityCurve(); - return curve.setCoefficient1Constant(totalCoolingCapacityCoefficient1); + Curve curve = getImpl()->totalCoolingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient1Constant(totalCoolingCapacityCoefficient1); } double CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCoefficient2() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCurve().coefficient2w() instead."); - CurveQuadLinear curve = getImpl()->totalCoolingCapacityCurve(); - return curve.coefficient2w(); + Curve curve = getImpl()->totalCoolingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient2w(); } bool CoilCoolingWaterToAirHeatPumpEquationFit::setTotalCoolingCapacityCoefficient2(double totalCoolingCapacityCoefficient2) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCurve().setCoefficient2w(double) instead."); - CurveQuadLinear curve = getImpl()->totalCoolingCapacityCurve(); - return curve.setCoefficient2w(totalCoolingCapacityCoefficient2); + Curve curve = getImpl()->totalCoolingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient2w(totalCoolingCapacityCoefficient2); } double CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCoefficient3() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCurve().coefficient3x() instead."); - CurveQuadLinear curve = getImpl()->totalCoolingCapacityCurve(); - return curve.coefficient3x(); + Curve curve = getImpl()->totalCoolingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient3x(); } bool CoilCoolingWaterToAirHeatPumpEquationFit::setTotalCoolingCapacityCoefficient3(double totalCoolingCapacityCoefficient3) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCurve().setCoefficient3x(double) instead."); - CurveQuadLinear curve = getImpl()->totalCoolingCapacityCurve(); - return curve.setCoefficient3x(totalCoolingCapacityCoefficient3); + Curve curve = getImpl()->totalCoolingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient3x(totalCoolingCapacityCoefficient3); } double CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCoefficient4() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCurve().coefficient4y() instead."); - CurveQuadLinear curve = getImpl()->totalCoolingCapacityCurve(); - return curve.coefficient4y(); + Curve curve = getImpl()->totalCoolingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient4y(); } bool CoilCoolingWaterToAirHeatPumpEquationFit::setTotalCoolingCapacityCoefficient4(double totalCoolingCapacityCoefficient4) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCurve().setCoefficient4y(double) instead."); - CurveQuadLinear curve = getImpl()->totalCoolingCapacityCurve(); - return curve.setCoefficient4y(totalCoolingCapacityCoefficient4); + Curve curve = getImpl()->totalCoolingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient4y(totalCoolingCapacityCoefficient4); } double CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCoefficient5() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCurve().coefficient5z() instead."); - CurveQuadLinear curve = getImpl()->totalCoolingCapacityCurve(); - return curve.coefficient5z(); + Curve curve = getImpl()->totalCoolingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient5z(); } bool CoilCoolingWaterToAirHeatPumpEquationFit::setTotalCoolingCapacityCoefficient5(double totalCoolingCapacityCoefficient5) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::totalCoolingCapacityCurve().setCoefficient5z(double) instead."); - CurveQuadLinear curve = getImpl()->totalCoolingCapacityCurve(); - return curve.setCoefficient5z(totalCoolingCapacityCoefficient5); + Curve curve = getImpl()->totalCoolingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient5z(totalCoolingCapacityCoefficient5); } double CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCoefficient1() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCurve().coefficient1Constant() instead."); - CurveQuintLinear curve = getImpl()->sensibleCoolingCapacityCurve(); - return curve.coefficient1Constant(); + Curve curve = getImpl()->sensibleCoolingCapacityCurve(); + boost::optional curveQuintLinear = curve.optionalCast(); + return curveQuintLinear->coefficient1Constant(); } bool CoilCoolingWaterToAirHeatPumpEquationFit::setSensibleCoolingCapacityCoefficient1(double sensibleCoolingCapacityCoefficient1) { DEPRECATED_AT_MSG(3, 2, 0, "Use " "CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCurve().setCoefficient1Constant(double) instead."); - CurveQuintLinear curve = getImpl()->sensibleCoolingCapacityCurve(); - return curve.setCoefficient1Constant(sensibleCoolingCapacityCoefficient1); + Curve curve = getImpl()->sensibleCoolingCapacityCurve(); + boost::optional curveQuintLinear = curve.optionalCast(); + return curveQuintLinear->setCoefficient1Constant(sensibleCoolingCapacityCoefficient1); } double CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCoefficient2() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCurve().coefficient2v() instead."); - CurveQuintLinear curve = getImpl()->sensibleCoolingCapacityCurve(); - return curve.coefficient2v(); + Curve curve = getImpl()->sensibleCoolingCapacityCurve(); + boost::optional curveQuintLinear = curve.optionalCast(); + return curveQuintLinear->coefficient2v(); } bool CoilCoolingWaterToAirHeatPumpEquationFit::setSensibleCoolingCapacityCoefficient2(double sensibleCoolingCapacityCoefficient2) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCurve().setCoefficient2v(double) instead."); - CurveQuintLinear curve = getImpl()->sensibleCoolingCapacityCurve(); - return curve.setCoefficient2v(sensibleCoolingCapacityCoefficient2); + Curve curve = getImpl()->sensibleCoolingCapacityCurve(); + boost::optional curveQuintLinear = curve.optionalCast(); + return curveQuintLinear->setCoefficient2v(sensibleCoolingCapacityCoefficient2); } double CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCoefficient3() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCurve().coefficient3w() instead."); - CurveQuintLinear curve = getImpl()->sensibleCoolingCapacityCurve(); - return curve.coefficient3w(); + Curve curve = getImpl()->sensibleCoolingCapacityCurve(); + boost::optional curveQuintLinear = curve.optionalCast(); + return curveQuintLinear->coefficient3w(); } bool CoilCoolingWaterToAirHeatPumpEquationFit::setSensibleCoolingCapacityCoefficient3(double sensibleCoolingCapacityCoefficient3) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCurve().setCoefficient3w(double) instead."); - CurveQuintLinear curve = getImpl()->sensibleCoolingCapacityCurve(); - return curve.setCoefficient3w(sensibleCoolingCapacityCoefficient3); + Curve curve = getImpl()->sensibleCoolingCapacityCurve(); + boost::optional curveQuintLinear = curve.optionalCast(); + return curveQuintLinear->setCoefficient3w(sensibleCoolingCapacityCoefficient3); } double CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCoefficient4() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCurve().coefficient4x() instead."); - CurveQuintLinear curve = getImpl()->sensibleCoolingCapacityCurve(); - return curve.coefficient4x(); + Curve curve = getImpl()->sensibleCoolingCapacityCurve(); + boost::optional curveQuintLinear = curve.optionalCast(); + return curveQuintLinear->coefficient4x(); } bool CoilCoolingWaterToAirHeatPumpEquationFit::setSensibleCoolingCapacityCoefficient4(double sensibleCoolingCapacityCoefficient4) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCurve().setCoefficient4x(double) instead."); - CurveQuintLinear curve = getImpl()->sensibleCoolingCapacityCurve(); - return curve.setCoefficient4x(sensibleCoolingCapacityCoefficient4); + Curve curve = getImpl()->sensibleCoolingCapacityCurve(); + boost::optional curveQuintLinear = curve.optionalCast(); + return curveQuintLinear->setCoefficient4x(sensibleCoolingCapacityCoefficient4); } double CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCoefficient5() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCurve().coefficient5y() instead."); - CurveQuintLinear curve = getImpl()->sensibleCoolingCapacityCurve(); - return curve.coefficient5y(); + Curve curve = getImpl()->sensibleCoolingCapacityCurve(); + boost::optional curveQuintLinear = curve.optionalCast(); + return curveQuintLinear->coefficient5y(); } bool CoilCoolingWaterToAirHeatPumpEquationFit::setSensibleCoolingCapacityCoefficient5(double sensibleCoolingCapacityCoefficient5) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCurve().setCoefficient5y(double) instead."); - CurveQuintLinear curve = getImpl()->sensibleCoolingCapacityCurve(); - return curve.setCoefficient5y(sensibleCoolingCapacityCoefficient5); + Curve curve = getImpl()->sensibleCoolingCapacityCurve(); + boost::optional curveQuintLinear = curve.optionalCast(); + return curveQuintLinear->setCoefficient5y(sensibleCoolingCapacityCoefficient5); } double CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCoefficient6() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCurve().coefficient6z() instead."); - CurveQuintLinear curve = getImpl()->sensibleCoolingCapacityCurve(); - return curve.coefficient6z(); + Curve curve = getImpl()->sensibleCoolingCapacityCurve(); + boost::optional curveQuintLinear = curve.optionalCast(); + return curveQuintLinear->coefficient6z(); } bool CoilCoolingWaterToAirHeatPumpEquationFit::setSensibleCoolingCapacityCoefficient6(double sensibleCoolingCapacityCoefficient6) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::sensibleCoolingCapacityCurve().setCoefficient6z(double) instead."); - CurveQuintLinear curve = getImpl()->sensibleCoolingCapacityCurve(); - return curve.setCoefficient6z(sensibleCoolingCapacityCoefficient6); + Curve curve = getImpl()->sensibleCoolingCapacityCurve(); + boost::optional curveQuintLinear = curve.optionalCast(); + return curveQuintLinear->setCoefficient6z(sensibleCoolingCapacityCoefficient6); } double CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCoefficient1() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCurve().coefficient1Constant() instead."); - CurveQuadLinear curve = getImpl()->coolingPowerConsumptionCurve(); - return curve.coefficient1Constant(); + Curve curve = getImpl()->coolingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient1Constant(); } bool CoilCoolingWaterToAirHeatPumpEquationFit::setCoolingPowerConsumptionCoefficient1(double coolingPowerConsumptionCoefficient1) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCurve().setCoefficient1Constant(double) instead."); - CurveQuadLinear curve = getImpl()->coolingPowerConsumptionCurve(); - return curve.setCoefficient1Constant(coolingPowerConsumptionCoefficient1); + Curve curve = getImpl()->coolingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient1Constant(coolingPowerConsumptionCoefficient1); } double CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCoefficient2() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCurve().coefficient2w() instead."); - CurveQuadLinear curve = getImpl()->coolingPowerConsumptionCurve(); - return curve.coefficient2w(); + Curve curve = getImpl()->coolingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient2w(); } bool CoilCoolingWaterToAirHeatPumpEquationFit::setCoolingPowerConsumptionCoefficient2(double coolingPowerConsumptionCoefficient2) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCurve().setCoefficient2w(double) instead."); - CurveQuadLinear curve = getImpl()->coolingPowerConsumptionCurve(); - return curve.setCoefficient2w(coolingPowerConsumptionCoefficient2); + Curve curve = getImpl()->coolingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient2w(coolingPowerConsumptionCoefficient2); } double CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCoefficient3() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCurve().coefficient3x() instead."); - CurveQuadLinear curve = getImpl()->coolingPowerConsumptionCurve(); - return curve.coefficient3x(); + Curve curve = getImpl()->coolingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient3x(); } bool CoilCoolingWaterToAirHeatPumpEquationFit::setCoolingPowerConsumptionCoefficient3(double coolingPowerConsumptionCoefficient3) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCurve().setCoefficient3x(double) instead."); - CurveQuadLinear curve = getImpl()->coolingPowerConsumptionCurve(); - return curve.setCoefficient3x(coolingPowerConsumptionCoefficient3); + Curve curve = getImpl()->coolingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient3x(coolingPowerConsumptionCoefficient3); } double CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCoefficient4() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCurve().coefficient4y() instead."); - CurveQuadLinear curve = getImpl()->coolingPowerConsumptionCurve(); - return curve.coefficient4y(); + Curve curve = getImpl()->coolingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient4y(); } bool CoilCoolingWaterToAirHeatPumpEquationFit::setCoolingPowerConsumptionCoefficient4(double coolingPowerConsumptionCoefficient4) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCurve().setCoefficient4y(double) instead."); - CurveQuadLinear curve = getImpl()->coolingPowerConsumptionCurve(); - return curve.setCoefficient4y(coolingPowerConsumptionCoefficient4); + Curve curve = getImpl()->coolingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient4y(coolingPowerConsumptionCoefficient4); } double CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCoefficient5() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCurve().coefficient5z() instead."); - CurveQuadLinear curve = getImpl()->coolingPowerConsumptionCurve(); - return curve.coefficient5z(); + Curve curve = getImpl()->coolingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient5z(); } bool CoilCoolingWaterToAirHeatPumpEquationFit::setCoolingPowerConsumptionCoefficient5(double coolingPowerConsumptionCoefficient5) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilCoolingWaterToAirHeatPumpEquationFit::coolingPowerConsumptionCurve().setCoefficient5z(double) instead."); - CurveQuadLinear curve = getImpl()->coolingPowerConsumptionCurve(); - return curve.setCoefficient5z(coolingPowerConsumptionCoefficient5); + Curve curve = getImpl()->coolingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient5z(coolingPowerConsumptionCoefficient5); } /// @endcond diff --git a/src/model/CoilCoolingWaterToAirHeatPumpEquationFit.hpp b/src/model/CoilCoolingWaterToAirHeatPumpEquationFit.hpp index b28146696d6..2b28bfdbbe9 100644 --- a/src/model/CoilCoolingWaterToAirHeatPumpEquationFit.hpp +++ b/src/model/CoilCoolingWaterToAirHeatPumpEquationFit.hpp @@ -15,8 +15,7 @@ namespace openstudio { namespace model { - class CurveQuadLinear; - class CurveQuintLinear; + class Curve; namespace detail { class CoilCoolingWaterToAirHeatPumpEquationFit_Impl; @@ -29,9 +28,8 @@ namespace model { /** @name Constructors and Destructors */ /** Constructs a new CoilCoolingWaterToAirHeatPumpEquationFit with required curve objects */ - CoilCoolingWaterToAirHeatPumpEquationFit(const Model& model, const CurveQuadLinear& totalCoolingCapacityCurve, - const CurveQuintLinear& sensibleCoolingCapacityCurve, - const CurveQuadLinear& coolingPowerConsumptionCurve); + CoilCoolingWaterToAirHeatPumpEquationFit(const Model& model, const Curve& totalCoolingCapacityCurve, const Curve& sensibleCoolingCapacityCurve, + const Curve& coolingPowerConsumptionCurve); /** Constructs a new CoilCoolingWaterToAirHeatPumpEquationFit object and places it inside the model. The coil is fully initialized with all companion objects. */ CoilCoolingWaterToAirHeatPumpEquationFit(const Model& model); @@ -81,7 +79,7 @@ namespace model { double ratedEnteringAirWetBulbTemperature() const; - CurveQuadLinear totalCoolingCapacityCurve() const; + Curve totalCoolingCapacityCurve() const; OS_DEPRECATED(3, 2, 0) double totalCoolingCapacityCoefficient1() const; OS_DEPRECATED(3, 2, 0) double totalCoolingCapacityCoefficient2() const; @@ -89,7 +87,7 @@ namespace model { OS_DEPRECATED(3, 2, 0) double totalCoolingCapacityCoefficient4() const; OS_DEPRECATED(3, 2, 0) double totalCoolingCapacityCoefficient5() const; - CurveQuintLinear sensibleCoolingCapacityCurve() const; + Curve sensibleCoolingCapacityCurve() const; OS_DEPRECATED(3, 2, 0) double sensibleCoolingCapacityCoefficient1() const; OS_DEPRECATED(3, 2, 0) double sensibleCoolingCapacityCoefficient2() const; @@ -98,7 +96,7 @@ namespace model { OS_DEPRECATED(3, 2, 0) double sensibleCoolingCapacityCoefficient5() const; OS_DEPRECATED(3, 2, 0) double sensibleCoolingCapacityCoefficient6() const; - CurveQuadLinear coolingPowerConsumptionCurve() const; + Curve coolingPowerConsumptionCurve() const; OS_DEPRECATED(3, 2, 0) double coolingPowerConsumptionCoefficient1() const; OS_DEPRECATED(3, 2, 0) double coolingPowerConsumptionCoefficient2() const; @@ -148,7 +146,7 @@ namespace model { bool setRatedEnteringAirWetBulbTemperature(double ratedEnteringAirWetBulbTemperature); - bool setTotalCoolingCapacityCurve(const CurveQuadLinear& totalCoolingCapacityCurve); + bool setTotalCoolingCapacityCurve(const Curve& totalCoolingCapacityCurve); OS_DEPRECATED(3, 2, 0) bool setTotalCoolingCapacityCoefficient1(double totalCoolingCapacityCoefficient1); OS_DEPRECATED(3, 2, 0) bool setTotalCoolingCapacityCoefficient2(double totalCoolingCapacityCoefficient2); @@ -156,7 +154,7 @@ namespace model { OS_DEPRECATED(3, 2, 0) bool setTotalCoolingCapacityCoefficient4(double totalCoolingCapacityCoefficient4); OS_DEPRECATED(3, 2, 0) bool setTotalCoolingCapacityCoefficient5(double totalCoolingCapacityCoefficient5); - bool setSensibleCoolingCapacityCurve(const CurveQuintLinear& sensibleCoolingCapacityCurve); + bool setSensibleCoolingCapacityCurve(const Curve& sensibleCoolingCapacityCurve); OS_DEPRECATED(3, 2, 0) bool setSensibleCoolingCapacityCoefficient1(double sensibleCoolingCapacityCoefficient1); OS_DEPRECATED(3, 2, 0) bool setSensibleCoolingCapacityCoefficient2(double sensibleCoolingCapacityCoefficient2); @@ -165,7 +163,7 @@ namespace model { OS_DEPRECATED(3, 2, 0) bool setSensibleCoolingCapacityCoefficient5(double sensibleCoolingCapacityCoefficient5); OS_DEPRECATED(3, 2, 0) bool setSensibleCoolingCapacityCoefficient6(double sensibleCoolingCapacityCoefficient6); - bool setCoolingPowerConsumptionCurve(const CurveQuadLinear& coolingPowerConsumptionCurve); + bool setCoolingPowerConsumptionCurve(const Curve& coolingPowerConsumptionCurve); OS_DEPRECATED(3, 2, 0) bool setCoolingPowerConsumptionCoefficient1(double coolingPowerConsumptionCoefficient1); OS_DEPRECATED(3, 2, 0) bool setCoolingPowerConsumptionCoefficient2(double coolingPowerConsumptionCoefficient2); diff --git a/src/model/CoilCoolingWaterToAirHeatPumpEquationFit_Impl.hpp b/src/model/CoilCoolingWaterToAirHeatPumpEquationFit_Impl.hpp index 85d53ebbe76..4798c3dba4e 100644 --- a/src/model/CoilCoolingWaterToAirHeatPumpEquationFit_Impl.hpp +++ b/src/model/CoilCoolingWaterToAirHeatPumpEquationFit_Impl.hpp @@ -12,8 +12,7 @@ namespace openstudio { namespace model { - class CurveQuadLinear; - class CurveQuintLinear; + class Curve; namespace detail { @@ -98,11 +97,11 @@ namespace model { double ratedEnteringAirWetBulbTemperature() const; - CurveQuadLinear totalCoolingCapacityCurve() const; + Curve totalCoolingCapacityCurve() const; - CurveQuintLinear sensibleCoolingCapacityCurve() const; + Curve sensibleCoolingCapacityCurve() const; - CurveQuadLinear coolingPowerConsumptionCurve() const; + Curve coolingPowerConsumptionCurve() const; double nominalTimeforCondensateRemovaltoBegin() const; @@ -160,11 +159,11 @@ namespace model { bool setRatedEnteringAirWetBulbTemperature(double ratedEnteringAirWetBulbTemperature); - bool setTotalCoolingCapacityCurve(const CurveQuadLinear& totalCoolingCapacityCurve); + bool setTotalCoolingCapacityCurve(const Curve& totalCoolingCapacityCurve); - bool setSensibleCoolingCapacityCurve(const CurveQuintLinear& sensibleCoolingCapacityCurve); + bool setSensibleCoolingCapacityCurve(const Curve& sensibleCoolingCapacityCurve); - bool setCoolingPowerConsumptionCurve(const CurveQuadLinear& coolingPowerConsumptionCurve); + bool setCoolingPowerConsumptionCurve(const Curve& coolingPowerConsumptionCurve); bool setNominalTimeforCondensateRemovaltoBegin(double nominalTimeforCondensateRemovaltoBegin); diff --git a/src/model/CoilHeatingWaterToAirHeatPumpEquationFit.cpp b/src/model/CoilHeatingWaterToAirHeatPumpEquationFit.cpp index 4ab5cb074cf..32d008473e8 100644 --- a/src/model/CoilHeatingWaterToAirHeatPumpEquationFit.cpp +++ b/src/model/CoilHeatingWaterToAirHeatPumpEquationFit.cpp @@ -16,6 +16,8 @@ #include "Model.hpp" #include "CurveQuadLinear.hpp" #include "CurveQuadLinear_Impl.hpp" +#include "Curve.hpp" +#include "Curve_Impl.hpp" #include #include @@ -304,22 +306,22 @@ namespace model { return boost::none; } - CurveQuadLinear CoilHeatingWaterToAirHeatPumpEquationFit_Impl::heatingCapacityCurve() const { + Curve CoilHeatingWaterToAirHeatPumpEquationFit_Impl::heatingCapacityCurve() const { WorkspaceObject wo = getTarget(OS_Coil_Heating_WaterToAirHeatPump_EquationFitFields::HeatingCapacityCurveName).get(); - return wo.cast(); + return wo.cast(); } - bool CoilHeatingWaterToAirHeatPumpEquationFit_Impl::setHeatingCapacityCurve(const CurveQuadLinear& heatingCapacityCurve) { + bool CoilHeatingWaterToAirHeatPumpEquationFit_Impl::setHeatingCapacityCurve(const Curve& heatingCapacityCurve) { bool result = setPointer(OS_Coil_Heating_WaterToAirHeatPump_EquationFitFields::HeatingCapacityCurveName, heatingCapacityCurve.handle()); return result; } - CurveQuadLinear CoilHeatingWaterToAirHeatPumpEquationFit_Impl::heatingPowerConsumptionCurve() const { + Curve CoilHeatingWaterToAirHeatPumpEquationFit_Impl::heatingPowerConsumptionCurve() const { WorkspaceObject wo = getTarget(OS_Coil_Heating_WaterToAirHeatPump_EquationFitFields::HeatingPowerConsumptionCurveName).get(); - return wo.cast(); + return wo.cast(); } - bool CoilHeatingWaterToAirHeatPumpEquationFit_Impl::setHeatingPowerConsumptionCurve(const CurveQuadLinear& heatingPowerConsumptionCurve) { + bool CoilHeatingWaterToAirHeatPumpEquationFit_Impl::setHeatingPowerConsumptionCurve(const Curve& heatingPowerConsumptionCurve) { bool result = setPointer(OS_Coil_Heating_WaterToAirHeatPump_EquationFitFields::HeatingPowerConsumptionCurveName, heatingPowerConsumptionCurve.handle()); return result; @@ -397,8 +399,8 @@ namespace model { } // namespace detail // create a new CoilHeatingWaterToAirHeatPumpEquationFit object in the model's workspace - CoilHeatingWaterToAirHeatPumpEquationFit::CoilHeatingWaterToAirHeatPumpEquationFit(const Model& model, const CurveQuadLinear& heatingCapacityCurve, - const CurveQuadLinear& heatingPowerConsumptionCurve) + CoilHeatingWaterToAirHeatPumpEquationFit::CoilHeatingWaterToAirHeatPumpEquationFit(const Model& model, const Curve& heatingCapacityCurve, + const Curve& heatingPowerConsumptionCurve) : WaterToAirComponent(CoilHeatingWaterToAirHeatPumpEquationFit::iddObjectType(), model) { OS_ASSERT(getImpl()); @@ -596,19 +598,19 @@ namespace model { return getImpl()->autosizedRatedHeatingCapacity(); } - CurveQuadLinear CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCurve() const { + Curve CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCurve() const { return getImpl()->heatingCapacityCurve(); } - bool CoilHeatingWaterToAirHeatPumpEquationFit::setHeatingCapacityCurve(const CurveQuadLinear& heatingCapacityCurve) { + bool CoilHeatingWaterToAirHeatPumpEquationFit::setHeatingCapacityCurve(const Curve& heatingCapacityCurve) { return getImpl()->setHeatingCapacityCurve(heatingCapacityCurve); } - CurveQuadLinear CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCurve() const { + Curve CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCurve() const { return getImpl()->heatingPowerConsumptionCurve(); } - bool CoilHeatingWaterToAirHeatPumpEquationFit::setHeatingPowerConsumptionCurve(const CurveQuadLinear& heatingPowerConsumptionCurve) { + bool CoilHeatingWaterToAirHeatPumpEquationFit::setHeatingPowerConsumptionCurve(const Curve& heatingPowerConsumptionCurve) { return getImpl()->setHeatingPowerConsumptionCurve(heatingPowerConsumptionCurve); } @@ -620,124 +622,144 @@ namespace model { // DEPRECATED double CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCoefficient1() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCurve().coefficient1Constant() instead."); - CurveQuadLinear curve = getImpl()->heatingCapacityCurve(); - return curve.coefficient1Constant(); + Curve curve = getImpl()->heatingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient1Constant(); } bool CoilHeatingWaterToAirHeatPumpEquationFit::setHeatingCapacityCoefficient1(double heatingCapacityCoefficient1) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCurve().setCoefficient1Constant(double) instead."); - CurveQuadLinear curve = getImpl()->heatingCapacityCurve(); - return curve.setCoefficient1Constant(heatingCapacityCoefficient1); + Curve curve = getImpl()->heatingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient1Constant(heatingCapacityCoefficient1); } double CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCoefficient2() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCurve().coefficient2w() instead."); - CurveQuadLinear curve = getImpl()->heatingCapacityCurve(); - return curve.coefficient2w(); + Curve curve = getImpl()->heatingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient2w(); } bool CoilHeatingWaterToAirHeatPumpEquationFit::setHeatingCapacityCoefficient2(double heatingCapacityCoefficient2) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCurve().setCoefficient2w(double) instead."); - CurveQuadLinear curve = getImpl()->heatingCapacityCurve(); - return curve.setCoefficient2w(heatingCapacityCoefficient2); + Curve curve = getImpl()->heatingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient2w(heatingCapacityCoefficient2); } double CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCoefficient3() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCurve().coefficient3x() instead."); - CurveQuadLinear curve = getImpl()->heatingCapacityCurve(); - return curve.coefficient3x(); + Curve curve = getImpl()->heatingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient3x(); } bool CoilHeatingWaterToAirHeatPumpEquationFit::setHeatingCapacityCoefficient3(double heatingCapacityCoefficient3) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCurve().setCoefficient3x(double) instead."); - CurveQuadLinear curve = getImpl()->heatingCapacityCurve(); - return curve.setCoefficient3x(heatingCapacityCoefficient3); + Curve curve = getImpl()->heatingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient3x(heatingCapacityCoefficient3); } double CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCoefficient4() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCurve().coefficient4y() instead."); - CurveQuadLinear curve = getImpl()->heatingCapacityCurve(); - return curve.coefficient4y(); + Curve curve = getImpl()->heatingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient4y(); } bool CoilHeatingWaterToAirHeatPumpEquationFit::setHeatingCapacityCoefficient4(double heatingCapacityCoefficient4) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCurve().setCoefficient4y(double) instead."); - CurveQuadLinear curve = getImpl()->heatingCapacityCurve(); - return curve.setCoefficient4y(heatingCapacityCoefficient4); + Curve curve = getImpl()->heatingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient4y(heatingCapacityCoefficient4); } double CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCoefficient5() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCurve().coefficient5z() instead."); - CurveQuadLinear curve = getImpl()->heatingCapacityCurve(); - return curve.coefficient5z(); + Curve curve = getImpl()->heatingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient5z(); } bool CoilHeatingWaterToAirHeatPumpEquationFit::setHeatingCapacityCoefficient5(double heatingCapacityCoefficient5) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingCapacityCurve().setCoefficient5z(double) instead."); - CurveQuadLinear curve = getImpl()->heatingCapacityCurve(); - return curve.setCoefficient5z(heatingCapacityCoefficient5); + Curve curve = getImpl()->heatingCapacityCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient5z(heatingCapacityCoefficient5); } double CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCoefficient1() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCurve().coefficient1Constant() instead."); - CurveQuadLinear curve = getImpl()->heatingPowerConsumptionCurve(); - return curve.coefficient1Constant(); + Curve curve = getImpl()->heatingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient1Constant(); } bool CoilHeatingWaterToAirHeatPumpEquationFit::setHeatingPowerConsumptionCoefficient1(double heatingPowerConsumptionCoefficient1) { DEPRECATED_AT_MSG(3, 2, 0, "Use " "CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCurve().setCoefficient1Constant(double) instead."); - CurveQuadLinear curve = getImpl()->heatingPowerConsumptionCurve(); - return curve.setCoefficient1Constant(heatingPowerConsumptionCoefficient1); + Curve curve = getImpl()->heatingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient1Constant(heatingPowerConsumptionCoefficient1); } double CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCoefficient2() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCurve().coefficient2w() instead."); - CurveQuadLinear curve = getImpl()->heatingPowerConsumptionCurve(); - return curve.coefficient2w(); + Curve curve = getImpl()->heatingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient2w(); } bool CoilHeatingWaterToAirHeatPumpEquationFit::setHeatingPowerConsumptionCoefficient2(double heatingPowerConsumptionCoefficient2) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCurve().setCoefficient2w(double) instead."); - CurveQuadLinear curve = getImpl()->heatingPowerConsumptionCurve(); - return curve.setCoefficient2w(heatingPowerConsumptionCoefficient2); + Curve curve = getImpl()->heatingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient2w(heatingPowerConsumptionCoefficient2); } double CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCoefficient3() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCurve().coefficient3x() instead."); - CurveQuadLinear curve = getImpl()->heatingPowerConsumptionCurve(); - return curve.coefficient3x(); + Curve curve = getImpl()->heatingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient3x(); } bool CoilHeatingWaterToAirHeatPumpEquationFit::setHeatingPowerConsumptionCoefficient3(double heatingPowerConsumptionCoefficient3) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCurve().setCoefficient3x(double) instead."); - CurveQuadLinear curve = getImpl()->heatingPowerConsumptionCurve(); - return curve.setCoefficient3x(heatingPowerConsumptionCoefficient3); + Curve curve = getImpl()->heatingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient3x(heatingPowerConsumptionCoefficient3); } double CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCoefficient4() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCurve().coefficient4y() instead."); - CurveQuadLinear curve = getImpl()->heatingPowerConsumptionCurve(); - return curve.coefficient4y(); + Curve curve = getImpl()->heatingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient4y(); } bool CoilHeatingWaterToAirHeatPumpEquationFit::setHeatingPowerConsumptionCoefficient4(double heatingPowerConsumptionCoefficient4) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCurve().setCoefficient4y(double) instead."); - CurveQuadLinear curve = getImpl()->heatingPowerConsumptionCurve(); - return curve.setCoefficient4y(heatingPowerConsumptionCoefficient4); + Curve curve = getImpl()->heatingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient4y(heatingPowerConsumptionCoefficient4); } double CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCoefficient5() const { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCurve().coefficient5z() instead."); - CurveQuadLinear curve = getImpl()->heatingPowerConsumptionCurve(); - return curve.coefficient5z(); + Curve curve = getImpl()->heatingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->coefficient5z(); } bool CoilHeatingWaterToAirHeatPumpEquationFit::setHeatingPowerConsumptionCoefficient5(double heatingPowerConsumptionCoefficient5) { DEPRECATED_AT_MSG(3, 2, 0, "Use CoilHeatingWaterToAirHeatPumpEquationFit::heatingPowerConsumptionCurve().setCoefficient5z(double) instead."); - CurveQuadLinear curve = getImpl()->heatingPowerConsumptionCurve(); - return curve.setCoefficient5z(heatingPowerConsumptionCoefficient5); + Curve curve = getImpl()->heatingPowerConsumptionCurve(); + boost::optional curveQuadLinear = curve.optionalCast(); + return curveQuadLinear->setCoefficient5z(heatingPowerConsumptionCoefficient5); } /// @endcond diff --git a/src/model/CoilHeatingWaterToAirHeatPumpEquationFit.hpp b/src/model/CoilHeatingWaterToAirHeatPumpEquationFit.hpp index 2b497d34190..294a86e7ab4 100644 --- a/src/model/CoilHeatingWaterToAirHeatPumpEquationFit.hpp +++ b/src/model/CoilHeatingWaterToAirHeatPumpEquationFit.hpp @@ -15,7 +15,7 @@ namespace openstudio { namespace model { - class CurveQuadLinear; + class Curve; namespace detail { @@ -31,8 +31,7 @@ namespace model { //@{ /** Constructs a new CoilCoolingWaterToAirHeatPumpEquationFit with required curve objects */ - CoilHeatingWaterToAirHeatPumpEquationFit(const Model& model, const CurveQuadLinear& heatingCapacityCurve, - const CurveQuadLinear& heatingPowerConsumptionCurve); + CoilHeatingWaterToAirHeatPumpEquationFit(const Model& model, const Curve& heatingCapacityCurve, const Curve& heatingPowerConsumptionCurve); CoilHeatingWaterToAirHeatPumpEquationFit(const Model& model); @@ -78,7 +77,7 @@ namespace model { double ratioofRatedHeatingCapacitytoRatedCoolingCapacity() const; - CurveQuadLinear heatingCapacityCurve() const; + Curve heatingCapacityCurve() const; OS_DEPRECATED(3, 2, 0) double heatingCapacityCoefficient1() const; OS_DEPRECATED(3, 2, 0) double heatingCapacityCoefficient2() const; @@ -86,7 +85,7 @@ namespace model { OS_DEPRECATED(3, 2, 0) double heatingCapacityCoefficient4() const; OS_DEPRECATED(3, 2, 0) double heatingCapacityCoefficient5() const; - CurveQuadLinear heatingPowerConsumptionCurve() const; + Curve heatingPowerConsumptionCurve() const; OS_DEPRECATED(3, 2, 0) double heatingPowerConsumptionCoefficient1() const; OS_DEPRECATED(3, 2, 0) double heatingPowerConsumptionCoefficient2() const; @@ -132,7 +131,7 @@ namespace model { bool setRatioofRatedHeatingCapacitytoRatedCoolingCapacity(double ratioofRatedHeatingCapacitytoRatedCoolingCapacity); - bool setHeatingCapacityCurve(const CurveQuadLinear& heatingCapacityCurve); + bool setHeatingCapacityCurve(const Curve& heatingCapacityCurve); OS_DEPRECATED(3, 2, 0) bool setHeatingCapacityCoefficient1(double heatingCapacityCoefficient1); OS_DEPRECATED(3, 2, 0) bool setHeatingCapacityCoefficient2(double heatingCapacityCoefficient2); @@ -140,7 +139,7 @@ namespace model { OS_DEPRECATED(3, 2, 0) bool setHeatingCapacityCoefficient4(double heatingCapacityCoefficient4); OS_DEPRECATED(3, 2, 0) bool setHeatingCapacityCoefficient5(double heatingCapacityCoefficient5); - bool setHeatingPowerConsumptionCurve(const CurveQuadLinear& heatingPowerConsumptionCurve); + bool setHeatingPowerConsumptionCurve(const Curve& heatingPowerConsumptionCurve); OS_DEPRECATED(3, 2, 0) bool setHeatingPowerConsumptionCoefficient1(double heatingPowerConsumptionCoefficient1); OS_DEPRECATED(3, 2, 0) bool setHeatingPowerConsumptionCoefficient2(double heatingPowerConsumptionCoefficient2); diff --git a/src/model/CoilHeatingWaterToAirHeatPumpEquationFit_Impl.hpp b/src/model/CoilHeatingWaterToAirHeatPumpEquationFit_Impl.hpp index e3a9eaf65ca..61907e51730 100644 --- a/src/model/CoilHeatingWaterToAirHeatPumpEquationFit_Impl.hpp +++ b/src/model/CoilHeatingWaterToAirHeatPumpEquationFit_Impl.hpp @@ -12,7 +12,7 @@ namespace openstudio { namespace model { - class CurveQuadLinear; + class Curve; namespace detail { @@ -87,9 +87,9 @@ namespace model { double ratioofRatedHeatingCapacitytoRatedCoolingCapacity() const; - CurveQuadLinear heatingCapacityCurve() const; + Curve heatingCapacityCurve() const; - CurveQuadLinear heatingPowerConsumptionCurve() const; + Curve heatingPowerConsumptionCurve() const; boost::optional autosizedRatedAirFlowRate() const; @@ -139,9 +139,9 @@ namespace model { bool setRatioofRatedHeatingCapacitytoRatedCoolingCapacity(double ratioofRatedHeatingCapacitytoRatedCoolingCapacity); - bool setHeatingCapacityCurve(const CurveQuadLinear& heatingCapacityCurve); + bool setHeatingCapacityCurve(const Curve& heatingCapacityCurve); - bool setHeatingPowerConsumptionCurve(const CurveQuadLinear& heatingPowerConsumptionCurve); + bool setHeatingPowerConsumptionCurve(const Curve& heatingPowerConsumptionCurve); //@} /** @name Other */ diff --git a/src/model/Model.cpp b/src/model/Model.cpp index 06dbe153e22..18caded3bf1 100644 --- a/src/model/Model.cpp +++ b/src/model/Model.cpp @@ -21,8 +21,11 @@ #include #include +#include "../osversion/VersionTranslator.hpp" + #include "../utilities/core/Assert.hpp" #include "../utilities/core/ContainersMove.hpp" +#include "../utilities/core/Filesystem.hpp" #include "../utilities/core/PathHelpers.hpp" #include "../utilities/idd/IddEnums.hpp" @@ -1840,27 +1843,26 @@ namespace model { } boost::optional Model::load(const path& osmPath) { - OptionalModel result; - OptionalIdfFile oIdfFile = IdfFile::load(osmPath, IddFileType::OpenStudio); - if (oIdfFile) { - try { - result = Model(*oIdfFile); - } catch (...) { - } - } - if (result) { - // Load the workflow.osw in the model's companion folder - path workflowJSONPath = getCompanionFolder(osmPath) / toPath("workflow.osw"); - if (exists(workflowJSONPath)) { - boost::optional workflowJSON = WorkflowJSON::load(workflowJSONPath); - if (workflowJSON) { - result->setWorkflowJSON(*workflowJSON); - } + if (!openstudio::filesystem::is_regular_file(osmPath)) { + LOG(Warn, "Path is not a valid file: " << osmPath); + return boost::none; + } + openstudio::osversion::VersionTranslator vt; + boost::optional model_ = vt.loadModel(osmPath); + if (!model_) { + LOG(Warn, "Failed to load model at " << osmPath); + return boost::none; + } + // Load the workflow.osw in the model's companion folder + const openstudio::path workflowJSONPath = getCompanionFolder(osmPath) / toPath("workflow.osw"); + if (exists(workflowJSONPath)) { + if (boost::optional workflowJSON_ = WorkflowJSON::load(workflowJSONPath)) { + model_->setWorkflowJSON(*workflowJSON_); } } - return result; + return model_; } boost::optional Model::load(const path& osmPath, const path& workflowJSONPath) { diff --git a/src/model/ScheduleRuleset.cpp b/src/model/ScheduleRuleset.cpp index 65038263b18..f36dd7d0ed8 100644 --- a/src/model/ScheduleRuleset.cpp +++ b/src/model/ScheduleRuleset.cpp @@ -372,7 +372,7 @@ namespace model { boost::optional existingWinterDDSchedule; if (!this->isWinterDesignDayScheduleDefaulted()) { - ScheduleDay existingWinterDDSchedule = this->winterDesignDaySchedule(); + existingWinterDDSchedule = this->winterDesignDaySchedule(); } ModelObject clone = schedule.clone(); bool result = setPointer(OS_Schedule_RulesetFields::WinterDesignDayScheduleName, clone.handle()); diff --git a/src/model/ScheduleTypeRegistry.cpp b/src/model/ScheduleTypeRegistry.cpp index 6c4d4db784c..13c1ccba746 100644 --- a/src/model/ScheduleTypeRegistry.cpp +++ b/src/model/ScheduleTypeRegistry.cpp @@ -491,9 +491,9 @@ namespace model { OptionalDouble()}, {"ZoneHVACLowTempRadiantConstFlow", "Availability", "availabilitySchedule", false, "Availability", 0.0, 1.0}, {"ZoneHVACLowTempRadiantConstFlow", "Pump Flow Rate", "pumpFlowRateSchedule", false, "Availability", 0.0, 1.0}, - {"ZoneHVACLowTempRadiantConstFlow", "Changeover Delay Time Period", "changeoverDelayTimePeriodSchedule", false, "Availability", 0.0, 1.0}, + {"ZoneHVACLowTempRadiantConstFlow", "Changeover Delay Time Period", "changeoverDelayTimePeriodSchedule", false, "", 0.0, OptionalDouble()}, {"ZoneHVACLowTempRadiantVarFlow", "Availability", "availabilitySchedule", false, "Availability", 0.0, 1.0}, - {"ZoneHVACLowTempRadiantVarFlow", "Changeover Delay Time Period", "changeoverDelayTimePeriodSchedule", false, "Availability", 0.0, 1.0}, + {"ZoneHVACLowTempRadiantVarFlow", "Changeover Delay Time Period", "changeoverDelayTimePeriodSchedule", false, "", 0.0, OptionalDouble()}, {"ZoneHVACPackagedTerminalAirConditioner", "Availability", "availabilitySchedule", false, "Availability", 0.0, 1.0}, {"ZoneHVACPackagedTerminalAirConditioner", "Supply Air Fan Operating Mode", "supplyAirFanOperatingModeSchedule", false, "ControlMode", 0.0, 1.0}, diff --git a/src/model/test/Model_GTest.cpp b/src/model/test/Model_GTest.cpp index 8ad9498582f..b000740e612 100644 --- a/src/model/test/Model_GTest.cpp +++ b/src/model/test/Model_GTest.cpp @@ -129,16 +129,18 @@ #include "../ExternalInterface.hpp" #include "../ExternalInterface_Impl.hpp" -#include "../../utilities/sql/SqlFile.hpp" +#include "../../utilities/core/PathHelpers.hpp" #include "../../utilities/data/TimeSeries.hpp" #include "../../utilities/idf/IdfFile.hpp" #include "../../utilities/idf/Workspace.hpp" #include "../../utilities/idf/WorkspaceObject.hpp" #include "../../utilities/idf/ValidityReport.hpp" +#include "../../utilities/sql/SqlFile.hpp" #include "../../osversion/VersionTranslator.hpp" #include +#include #include @@ -1160,3 +1162,28 @@ TEST_F(ModelFixture, UniqueModelObjectCachedGetters) { EXPECT_TRUE(m.getOptionalUniqueModelObject()); EXPECT_EQ(++i, m.getModelObjects().size()); } + +TEST_F(ModelFixture, Model_load) { + + openstudio::path modelPath = resourcesPath() / "model" / toPath("empty361.osm"); + ASSERT_TRUE(openstudio::filesystem::exists(modelPath)); + + const openstudio::path workflowJSONPath = getCompanionFolder(modelPath) / toPath("workflow.osw"); + ASSERT_TRUE(openstudio::filesystem::exists(workflowJSONPath)); + + // Check that the versionObject is indeed translated to the current version + boost::optional model_ = Model::load(modelPath); + ASSERT_TRUE(model_); + auto versionObject_ = model_->versionObject(); + ASSERT_TRUE(versionObject_); + EXPECT_EQ(openStudioVersion(), versionObject_->getString(1).get()); + + // Check that the workflowJSON in the companion folder is correctly loaded + auto workflowJSON = model_->workflowJSON(); + auto p_ = workflowJSON.oswPath(); + ASSERT_TRUE(p_); + EXPECT_EQ(workflowJSONPath, *p_); + + ASSERT_TRUE(workflowJSON.seedFile()); + EXPECT_EQ(workflowJSON.seedFile().get(), openstudio::toPath("../empty361.osm")); +} diff --git a/src/model/test/TableLookup_GTest.cpp b/src/model/test/TableLookup_GTest.cpp index 0711d2c9fbd..4156343639d 100644 --- a/src/model/test/TableLookup_GTest.cpp +++ b/src/model/test/TableLookup_GTest.cpp @@ -15,6 +15,14 @@ #include "../ModelObjectList_Impl.hpp" #include "../BoilerHotWater.hpp" #include "../BoilerHotWater_Impl.hpp" +#include "../CoilCoolingWaterToAirHeatPumpEquationFit.hpp" +#include "../CoilCoolingWaterToAirHeatPumpEquationFit_Impl.hpp" +#include "../CoilHeatingWaterToAirHeatPumpEquationFit.hpp" +#include "../CoilHeatingWaterToAirHeatPumpEquationFit_Impl.hpp" +#include "../CurveQuadLinear.hpp" +#include "../CurveQuadLinear_Impl.hpp" +#include "../CurveQuintLinear.hpp" +#include "../CurveQuintLinear_Impl.hpp" using namespace openstudio; using namespace openstudio::model; @@ -263,3 +271,125 @@ TEST_F(ModelFixture, TableLookup_Remove) { EXPECT_EQ(independentVariable1, tableLookup2.independentVariables().front()); } } + +TEST_F(ModelFixture, TableLookup_CoilWaterToAirHeatPumpEquationFit) { + // Test for #4946 - WaterToAirHeatPumpEquationFit curves do not support Table:Lookup + + Model m; + + // test ctor 1 + { + // ctor maintains backward compatibility + CoilCoolingWaterToAirHeatPumpEquationFit cc(m); + ASSERT_TRUE(cc.totalCoolingCapacityCurve().optionalCast()); + ASSERT_TRUE(cc.sensibleCoolingCapacityCurve().optionalCast()); + ASSERT_TRUE(cc.coolingPowerConsumptionCurve().optionalCast()); + + CoilHeatingWaterToAirHeatPumpEquationFit ch(m); + ASSERT_TRUE(ch.heatingCapacityCurve().optionalCast()); + ASSERT_TRUE(ch.heatingPowerConsumptionCurve().optionalCast()); + } + + // test ctor 2 + { + // ctor maintains backward compatibility + CurveQuadLinear tccc(m); + CurveQuintLinear sccc(m); + CurveQuadLinear cpcc(m); + CoilCoolingWaterToAirHeatPumpEquationFit cc(m, tccc, sccc, cpcc); + ASSERT_TRUE(cc.totalCoolingCapacityCurve().optionalCast()); + EXPECT_EQ(tccc, cc.totalCoolingCapacityCurve()); + ASSERT_TRUE(cc.sensibleCoolingCapacityCurve().optionalCast()); + EXPECT_EQ(sccc, cc.sensibleCoolingCapacityCurve()); + ASSERT_TRUE(cc.coolingPowerConsumptionCurve().optionalCast()); + EXPECT_EQ(cpcc, cc.coolingPowerConsumptionCurve()); + + CurveQuadLinear hcc(m); + CurveQuadLinear hpcc(m); + CoilHeatingWaterToAirHeatPumpEquationFit ch(m, hcc, hpcc); + ASSERT_TRUE(ch.heatingCapacityCurve().optionalCast()); + EXPECT_EQ(hcc, ch.heatingCapacityCurve()); + ASSERT_TRUE(ch.heatingPowerConsumptionCurve().optionalCast()); + EXPECT_EQ(hpcc, ch.heatingPowerConsumptionCurve()); + } + + { + // ctor can now handle table lookup curves + TableLookup tl1(m); + TableLookup tl2(m); + TableLookup tl3(m); + CoilCoolingWaterToAirHeatPumpEquationFit cc(m, tl1, tl2, tl3); + ASSERT_TRUE(cc.totalCoolingCapacityCurve().optionalCast()); + EXPECT_EQ(tl1, cc.totalCoolingCapacityCurve()); + ASSERT_TRUE(cc.sensibleCoolingCapacityCurve().optionalCast()); + EXPECT_EQ(tl2, cc.sensibleCoolingCapacityCurve()); + ASSERT_TRUE(cc.coolingPowerConsumptionCurve().optionalCast()); + EXPECT_EQ(tl3, cc.coolingPowerConsumptionCurve()); + + TableLookup tl4(m); + TableLookup tl5(m); + CoilHeatingWaterToAirHeatPumpEquationFit ch(m, tl4, tl5); + ASSERT_TRUE(ch.heatingCapacityCurve().optionalCast()); + EXPECT_EQ(tl4, ch.heatingCapacityCurve()); + ASSERT_TRUE(ch.heatingPowerConsumptionCurve().optionalCast()); + EXPECT_EQ(tl5, ch.heatingPowerConsumptionCurve()); + } + + // test new setter/getter + { + CoilCoolingWaterToAirHeatPumpEquationFit cc(m); + CoilHeatingWaterToAirHeatPumpEquationFit ch(m); + + // setter maintains backward compatibility + CurveQuadLinear cql1(m); + EXPECT_TRUE(cc.setTotalCoolingCapacityCurve(cql1)); + ASSERT_TRUE(cc.totalCoolingCapacityCurve().optionalCast()); + EXPECT_EQ(cql1, cc.totalCoolingCapacityCurve()); + + CurveQuintLinear cql2(m); + EXPECT_TRUE(cc.setSensibleCoolingCapacityCurve(cql2)); + ASSERT_TRUE(cc.sensibleCoolingCapacityCurve().optionalCast()); + EXPECT_EQ(cql2, cc.sensibleCoolingCapacityCurve()); + + CurveQuadLinear cql3(m); + EXPECT_TRUE(cc.setCoolingPowerConsumptionCurve(cql3)); + ASSERT_TRUE(cc.coolingPowerConsumptionCurve().optionalCast()); + EXPECT_EQ(cql3, cc.coolingPowerConsumptionCurve()); + + CurveQuadLinear cql4(m); + EXPECT_TRUE(ch.setHeatingCapacityCurve(cql4)); + ASSERT_TRUE(ch.heatingCapacityCurve().optionalCast()); + EXPECT_EQ(cql4, ch.heatingCapacityCurve()); + + CurveQuadLinear cql5(m); + EXPECT_TRUE(ch.setHeatingPowerConsumptionCurve(cql5)); + ASSERT_TRUE(ch.heatingPowerConsumptionCurve().optionalCast()); + EXPECT_EQ(cql5, ch.heatingPowerConsumptionCurve()); + + // setter can now handle table lookup curves + TableLookup tbl1(m); + EXPECT_TRUE(cc.setTotalCoolingCapacityCurve(tbl1)); + ASSERT_TRUE(cc.totalCoolingCapacityCurve().optionalCast()); + EXPECT_EQ(tbl1, cc.totalCoolingCapacityCurve()); + + TableLookup tbl2(m); + EXPECT_TRUE(cc.setSensibleCoolingCapacityCurve(tbl2)); + ASSERT_TRUE(cc.sensibleCoolingCapacityCurve().optionalCast()); + EXPECT_EQ(tbl2, cc.sensibleCoolingCapacityCurve()); + + TableLookup tbl3(m); + EXPECT_TRUE(cc.setCoolingPowerConsumptionCurve(tbl3)); + ASSERT_TRUE(cc.coolingPowerConsumptionCurve().optionalCast()); + EXPECT_EQ(tbl3, cc.coolingPowerConsumptionCurve()); + + TableLookup tbl4(m); + EXPECT_TRUE(ch.setHeatingCapacityCurve(tbl4)); + ASSERT_TRUE(ch.heatingCapacityCurve().optionalCast()); + EXPECT_EQ(tbl4, ch.heatingCapacityCurve()); + + TableLookup tbl5(m); + EXPECT_TRUE(ch.setHeatingPowerConsumptionCurve(tbl5)); + ASSERT_TRUE(ch.heatingPowerConsumptionCurve().optionalCast()); + EXPECT_EQ(tbl5, ch.heatingPowerConsumptionCurve()); + } +} diff --git a/src/sdd/MapHVAC.cpp b/src/sdd/MapHVAC.cpp index 37c410a0c1d..2604701be6a 100644 --- a/src/sdd/MapHVAC.cpp +++ b/src/sdd/MapHVAC.cpp @@ -2220,14 +2220,16 @@ namespace sdd { coil.setRatedHeatingCoefficientofPerformance(1.0 / _htPumpEIR.get()); } - model::CurveQuadLinear heatingCapacityCurve = coil.heatingCapacityCurve(); + model::Curve _heatingCapacityCurve = coil.heatingCapacityCurve(); + model::CurveQuadLinear heatingCapacityCurve = _heatingCapacityCurve.cast(); heatingCapacityCurve.setCoefficient1Constant(-1.361311959); heatingCapacityCurve.setCoefficient2w(-2.471798046); heatingCapacityCurve.setCoefficient3x(4.173164514); heatingCapacityCurve.setCoefficient4y(0.640757401); heatingCapacityCurve.setCoefficient5z(0.0); - model::CurveQuadLinear heatingPowerConsumptionCurve = coil.heatingPowerConsumptionCurve(); + model::Curve _heatingPowerConsumptionCurve = coil.heatingPowerConsumptionCurve(); + model::CurveQuadLinear heatingPowerConsumptionCurve = _heatingPowerConsumptionCurve.cast(); heatingPowerConsumptionCurve.setCoefficient1Constant(-2.176941116); heatingPowerConsumptionCurve.setCoefficient2w(0.832114286); heatingPowerConsumptionCurve.setCoefficient3x(1.570743399); @@ -3022,14 +3024,16 @@ namespace sdd { coil.setRatedCoolingCoefficientofPerformance(1.0 / _dxEIR.get()); } - model::CurveQuadLinear totalCoolingCapacityCurve = coil.totalCoolingCapacityCurve(); + model::Curve _totalCoolingCapacityCurve = coil.totalCoolingCapacityCurve(); + model::CurveQuadLinear totalCoolingCapacityCurve = _totalCoolingCapacityCurve.cast(); totalCoolingCapacityCurve.setCoefficient1Constant(-9.149069561); totalCoolingCapacityCurve.setCoefficient2w(10.87814026); totalCoolingCapacityCurve.setCoefficient3x(-1.718780157); totalCoolingCapacityCurve.setCoefficient4y(0.746414818); totalCoolingCapacityCurve.setCoefficient5z(0.0); - model::CurveQuintLinear sensibleCoolingCapacityCurve = coil.sensibleCoolingCapacityCurve(); + model::Curve _sensibleCoolingCapacityCurve = coil.sensibleCoolingCapacityCurve(); + model::CurveQuintLinear sensibleCoolingCapacityCurve = _sensibleCoolingCapacityCurve.cast(); sensibleCoolingCapacityCurve.setCoefficient1Constant(-5.462690012); sensibleCoolingCapacityCurve.setCoefficient2v(17.95968138); sensibleCoolingCapacityCurve.setCoefficient3w(-11.87818402); @@ -3037,7 +3041,8 @@ namespace sdd { sensibleCoolingCapacityCurve.setCoefficient5y(0.767285761); sensibleCoolingCapacityCurve.setCoefficient6z(0.0); - model::CurveQuadLinear coolingPowerConsumptionCurve = coil.coolingPowerConsumptionCurve(); + model::Curve _coolingPowerConsumptionCurve = coil.coolingPowerConsumptionCurve(); + model::CurveQuadLinear coolingPowerConsumptionCurve = _coolingPowerConsumptionCurve.cast(); coolingPowerConsumptionCurve.setCoefficient1Constant(-3.20456384); coolingPowerConsumptionCurve.setCoefficient2w(-0.976409399); coolingPowerConsumptionCurve.setCoefficient3x(3.97892546); diff --git a/src/utilities/core/CommonInclude.i b/src/utilities/core/CommonInclude.i index 022db8f576f..2a28296ad26 100644 --- a/src/utilities/core/CommonInclude.i +++ b/src/utilities/core/CommonInclude.i @@ -66,7 +66,7 @@ // and nested classes and "nothing known about " // also ignoring #509, shadowed method. Its a red herring for all of our cases //#pragma SWIG nowarn=401,362,365,366,368,378,503,801,312 -#pragma SWIG nowarn=362,365,366,368,378,503,801,312,509,401 +#pragma SWIG nowarn=362,365,366,368,378,503,801,312,509,401,516 // Todo: Remove this one after other swig warnings have been cleared up #pragma SWIG nowarn=315 diff --git a/src/utilities/core/FilesystemHelpers.cpp b/src/utilities/core/FilesystemHelpers.cpp index 38dabf95a46..a7ec714dc7a 100644 --- a/src/utilities/core/FilesystemHelpers.cpp +++ b/src/utilities/core/FilesystemHelpers.cpp @@ -137,16 +137,14 @@ namespace filesystem { } openstudio::path create_temporary_directory(const openstudio::path& basename) { - // making this count static/atomic so that we reduce the chance of collisions - // on each run of the binary. This is threadsafe, with the atomic - static std::atomic count = 0; - constexpr unsigned int allowed_attempts = 1000; - const auto base_temp_dir = openstudio::filesystem::temp_directory_path(); - // std::filesystem::unique_path doesn't exist, if moving to std::filesystem, use emoveBraces(createUUID) + // std::filesystem::unique_path doesn't exist, if moving to std::filesystem, use removeBraces(createUUID()) auto upath = boost::filesystem::unique_path(); const auto temp_dir = base_temp_dir / fmt::format("{}-{}-{}-", basename.string(), upath.string(), std::time(nullptr)); + // unique_path is supposed to be unique already... + unsigned int count = 0; + constexpr unsigned int allowed_attempts = 1000; while (count < allowed_attempts) { // concat number to path basename, without adding a new path element auto full_pathname = temp_dir; diff --git a/src/utilities/core/csharp/LanguageSpecific.i b/src/utilities/core/csharp/LanguageSpecific.i index 0a1ec1cf90d..20d7b16f470 100644 --- a/src/utilities/core/csharp/LanguageSpecific.i +++ b/src/utilities/core/csharp/LanguageSpecific.i @@ -5,7 +5,7 @@ // Not implemented for this target: %include %include -%rename(Path) openstudio::path; // For consistancy with other class names and to avoid conflicts +%rename(Path) openstudio::path; // For consistency with other class names and to avoid conflicts %rename(ZeroException) Exception; %rename(ReportingFrequencyEnum) ReportingFrequency; %ignore openstudio::SqlFile::dataDictionary(); diff --git a/src/utilities/core/jsoncpp.i b/src/utilities/core/jsoncpp.i index fb71b0bcca1..4ebf7aa1c51 100644 --- a/src/utilities/core/jsoncpp.i +++ b/src/utilities/core/jsoncpp.i @@ -2,7 +2,9 @@ #define JSONCPP_I #if defined SWIGCSHARP -%ignore openstudio::*::toJSON() const; + // ignores toJSON/fromJSON globally + %rename("$ignore", regextarget=1, fullname=1) "openstudio::.*::toJSON$"; + %rename("$ignore", regextarget=1, fullname=1) "openstudio::.*::fromJSON$"; #else %{ #include diff --git a/src/utilities/filetypes/Filetypes.i b/src/utilities/filetypes/Filetypes.i index 5f6c561d053..ada9cbd2de8 100644 --- a/src/utilities/filetypes/Filetypes.i +++ b/src/utilities/filetypes/Filetypes.i @@ -18,9 +18,12 @@ %ignore openstudio::WorkflowStepValue::WorkflowStepValue(std::string const&, char const*); %ignore openstudio::MeasureStep::setArgument(std::string const&, char const*); - // Ignore Json::Value return type + // Ignore Json::Value return type (toJSON / fromJSON are globally ignored already) %ignore openstudio::StandardsJSON::getPrimaryKey; + %ignore openstudio::CustomOutputAdapter::CustomOutputAdapter; + %ignore openstudio::CustomOutputAdapter::optionsJSON; + #endif diff --git a/src/utilities/geometry/Geometry.i b/src/utilities/geometry/Geometry.i index 9a1d18f693a..bcbdf86ab06 100644 --- a/src/utilities/geometry/Geometry.i +++ b/src/utilities/geometry/Geometry.i @@ -169,6 +169,14 @@ } } +%extend openstudio::Surface3d { + std::string __str__() const { + std::ostringstream os; + os << *self; + return os.str(); + } +} + %extend openstudio::Transformation { std::string __str__() const { diff --git a/src/utilities/geometry/Plane.hpp b/src/utilities/geometry/Plane.hpp index 8166c2e6887..64e95c4ed80 100644 --- a/src/utilities/geometry/Plane.hpp +++ b/src/utilities/geometry/Plane.hpp @@ -33,12 +33,12 @@ class UTILITIES_API Plane /// throws openstudio::Exception if cannot compute plane for these points. Plane(const std::vector& points); - // Copy and move operators are implicitly declared (Rule of 1) + // Copy and move operators are implicitly declared (Rule of 1), but we want the copy ctor for SWIG so we have to define all of them // There's no need to check if the length of the normal is zero since we never allow another plane to not satisfy this condition - // Plane(const Plane& other) = default; - // Plane(Plane&& other) = default; - // Plane& operator=(const Plane&) = default; - // Plane& operator=(Plane&&) = default; + Plane(const Plane& other) = default; + Plane(Plane&& other) noexcept = default; + Plane& operator=(const Plane&) = default; + Plane& operator=(Plane&&) noexcept = default; // ~Plane() noexcept = default; /// get the outward normal of this plane diff --git a/src/utilities/geometry/Point3d.hpp b/src/utilities/geometry/Point3d.hpp index 46f0cfe6094..7bd1a0dcc68 100644 --- a/src/utilities/geometry/Point3d.hpp +++ b/src/utilities/geometry/Point3d.hpp @@ -27,11 +27,11 @@ class UTILITIES_API Point3d /// constructor with x, y, z Point3d(double x, double y, double z); - // Copy and move operators are implicitly declared - // Point3d(const Point3d& other) = default; - // Point3d(Point3d&& other) = default; - // Point3d& operator=(const Point3d&) = default; - // Point3d& operator=(Point3d&&) = default; + // Copy and move operators are implicitly declared, but we want the copy ctor for SWIG so we have to define all of them + Point3d(const Point3d& other) = default; + Point3d(Point3d&& other) noexcept = default; + Point3d& operator=(const Point3d&) = default; + Point3d& operator=(Point3d&&) noexcept = default; // ~Point3d() noexcept = default; /// get x diff --git a/src/utilities/geometry/Polygon3d.hpp b/src/utilities/geometry/Polygon3d.hpp index fdabe3f2d30..d85c9729abb 100644 --- a/src/utilities/geometry/Polygon3d.hpp +++ b/src/utilities/geometry/Polygon3d.hpp @@ -27,11 +27,11 @@ class UTILITIES_API Polygon3d // Constructs a polygon with an outer path and one or more inner paths Polygon3d(const Point3dVector& outerPath, const Point3dVectorVector& innerPaths); - // Copy and move operators are implicitly declared (Rule of 1) - // Polygon3d(const Polygon3d& other) = default; - // Polygon3d(Polygon3d&& other) = default; - // Polygon3d& operator=(const Polygon3d&) = default; - // Polygon3d& operator=(Polygon3d&&) = default; + // Copy and move operators are implicitly declared (Rule of 1), but we want the copy ctor for SWIG so we have to define all of them + Polygon3d(const Polygon3d& other) = default; + Polygon3d(Polygon3d&& other) noexcept = default; + Polygon3d& operator=(const Polygon3d&) = default; + Polygon3d& operator=(Polygon3d&&) noexcept = default; // ~Polygon3d() noexcept = default; // Assigns an outer path for the polygon diff --git a/src/utilities/geometry/Polyhedron.cpp b/src/utilities/geometry/Polyhedron.cpp index bdf3293b574..71fb420ab5b 100644 --- a/src/utilities/geometry/Polyhedron.cpp +++ b/src/utilities/geometry/Polyhedron.cpp @@ -104,8 +104,8 @@ Vector3d Surface3dEdge::asVector() const { } std::ostream& operator<<(std::ostream& os, const Surface3dEdge& edge) { - os << "Surface3dEdge: start=" << edge.start() << ", end=" << edge.end() << ", count=" << edge.count() - << ", firstSurface=" << edge.firstSurfaceName(); + os << "Surface3dEdge: start=" << edge.start() << ", end=" << edge.end() << ", count=" << edge.count() << ", firstSurface='" + << edge.firstSurfaceName() << "'"; return os; } @@ -118,10 +118,23 @@ Surface3d::Surface3d(std::vector t_vertices, std::string t_name, size_t itnext = std::begin(vertices); } - edges.emplace_back(*it, *itnext, t_name, t_surfNum); + edges.emplace_back(*it, *itnext, name, surfNum); } } +std::ostream& operator<<(std::ostream& os, const Surface3d& surface3d) { + os << "Surface3d "; + if (!surface3d.name.empty()) { + os << "'" << surface3d.name << "' "; + } + os << "= [\n"; + for (const auto& pt : surface3d.vertices) { + os << " " << pt << ",\n"; + } + os << "]"; + return os; +} + bool Surface3d::operator<(const Surface3d& rhs) const { return this->name < rhs.name; } @@ -492,4 +505,8 @@ double Polyhedron::calcDivergenceTheoremVolume() const { return volume; } +std::vector Polyhedron::surface3ds() const { + return m_surfaces; +} + } // namespace openstudio diff --git a/src/utilities/geometry/Polyhedron.hpp b/src/utilities/geometry/Polyhedron.hpp index fa8baf738d9..df93c8ae26e 100644 --- a/src/utilities/geometry/Polyhedron.hpp +++ b/src/utilities/geometry/Polyhedron.hpp @@ -138,6 +138,8 @@ class UTILITIES_API Polyhedron * proportion of conflicted edges / total number of edges */ std::vector findSurfacesWithIncorrectOrientation() const; + std::vector surface3ds() const; + protected: void performEdgeMatching(); void resetEdgeMatching(); @@ -164,6 +166,7 @@ using PolyhedronVector = std::vector; /// ostream operator UTILITIES_API std::ostream& operator<<(std::ostream& os, const Surface3dEdge& edge); +UTILITIES_API std::ostream& operator<<(std::ostream& os, const Surface3d& surface3d); } // namespace openstudio diff --git a/src/utilities/geometry/Transformation.hpp b/src/utilities/geometry/Transformation.hpp index b336d1168c5..9f1e82f6f9e 100644 --- a/src/utilities/geometry/Transformation.hpp +++ b/src/utilities/geometry/Transformation.hpp @@ -35,11 +35,11 @@ class UTILITIES_API Transformation /// constructor from storage, asserts vector is size 16 Transformation(const Vector& vector); - // Copy and move operators are implicitly declared (Rule of 1) - // Transformation(const Transformation& other) = default; - // Transformation(Transformation&& other) = default; - // Transformation& operator=(const Transformation&) = default; - // Transformation& operator=(Transformation&&) = default; + // Copy and move operators are implicitly declared (Rule of 1), but we want the copy ctor for SWIG so we have to define all of them + Transformation(const Transformation& other) = default; + Transformation(Transformation&& other) noexcept = default; + Transformation& operator=(const Transformation&) = default; + Transformation& operator=(Transformation&&) noexcept = default; // ~Transformation() noexcept = default; /// rotation about origin defined by axis and angle (radians) diff --git a/src/utilities/geometry/Vector3d.hpp b/src/utilities/geometry/Vector3d.hpp index b036f01dfbc..f85b0d447cb 100644 --- a/src/utilities/geometry/Vector3d.hpp +++ b/src/utilities/geometry/Vector3d.hpp @@ -24,11 +24,11 @@ class UTILITIES_API Vector3d /// constructor with x, y, z Vector3d(double x, double y, double z); - // Copy and move operators are implicitly declared (Rule of 1) - // Vector3d(const Vector3d& other) = default; - // Vector3d(Vector3d&& other) = default; - // Vector3d& operator=(const Vector3d&) = default; - // Vector3d& operator=(Vector3d&&) = default; + // Copy and move operators are implicitly declared (Rule of 1), but we want the copy ctor for SWIG so we have to define all of them + Vector3d(const Vector3d& other) = default; + Vector3d(Vector3d&& other) noexcept = default; + Vector3d& operator=(const Vector3d&) = default; + Vector3d& operator=(Vector3d&&) noexcept = default; // ~Vector3d() noexcept = default; /// get x diff --git a/src/utilities/mainpage.hpp b/src/utilities/mainpage.hpp index ba54b26221c..6f5a547f9b1 100644 --- a/src/utilities/mainpage.hpp +++ b/src/utilities/mainpage.hpp @@ -55,10 +55,13 @@ namespace openstudio { * * \section data_sec Data * - * Structures for storing data such as \link Vector.hpp vectors\endlink, - * \link Matrix.hpp matrices\endlink, and \link TimeSeries time series\endlink. The Attribute - * class is used for reporting measures in particular; class EndUses and the enumeration classes in - * DataEnums.hpp are also of interest. + * Structures for storing data such as \link Vector vectors\endlink, + * \link Matrix matrices\endlink, and \link TimeSeries time series\endlink. The Attribute + * class provides a way for storing data additional values attached to objects, + * and is useful for reporting measures in particular. EndUses and associated enumeration + * classes EndUseType, EndUseCategoryType, and EndUseFuelType are helpful to break out energy use in reporting. + * FuelType, AppGFuelType, and ComponentType are useful to determine fuel and component sources + * for standards code. These and other enumerations are listed in DataEnums.hpp. * * \section filetypes_sec Filetypes *