diff --git a/CMakeLists.txt b/CMakeLists.txt index c0deb4b4f8d..c9684700943 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -409,7 +409,7 @@ if(BUILD_QT) if(APPLE) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/Qt-prefix/src/Qt-install") if( Qt5Static ) - set(QT_CONFIGURE_COMMAND "-v -release -opensource -qt-pcre -qt-harfbuzz -static -openssl -no-pch -no-ssse3 -qt-sql-sqlite -plugin-sql-sqlite -skip enginio -no-compile-examples -nomake examples -nomake tests -nomake tools -skip qtmultimedia -confirm-license -prefix ${CMAKE_BINARY_DIR}/Qt-prefix/src/Qt-static-install") + set(QT_CONFIGURE_COMMAND "-v -release -opensource -qt-pcre -qt-harfbuzz -static -openssl-linked -I${OPENSSL_INCLUDE_DIR} OPENSSL_LIBS=\\\"${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY}\\\" -no-pch -no-ssse3 -qt-sql-sqlite -plugin-sql-sqlite -skip enginio -no-compile-examples -nomake examples -nomake tests -nomake tools -skip qtmultimedia -confirm-license -prefix ${CMAKE_BINARY_DIR}/Qt-prefix/src/Qt-static-install") else() message(WARNING "Shared Apple Qt build untested") set(QT_CONFIGURE_COMMAND "-v -release -opensource -qt-pcre -qt-harfbuzz -shared -openssl -no-pch -no-ssse3 -qt-sql-sqlite -plugin-sql-sqlite -skip enginio -no-compile-examples -nomake examples -nomake tests -nomake tools -skip qtmultimedia -confirm-license -prefix ${CMAKE_BINARY_DIR}/Qt-prefix/src/Qt-install") diff --git a/openstudiocore/CMakeLists.txt b/openstudiocore/CMakeLists.txt index a8acdb2ac5d..539511a4fb6 100644 --- a/openstudiocore/CMakeLists.txt +++ b/openstudiocore/CMakeLists.txt @@ -602,11 +602,10 @@ endif() # openstudio gems -# to update the openstudio gems, you must first update the gems specified in the \dependencies\ruby\Gemfile file -# next, build the openstudio-gems target of the OpenStudio super-build project (CMakeLists.txt one directory above this) +# build and release openstudio gems at https://github.com/NREL/OpenStudio-gems # upload the openstudio-gems-DATE.tar.gz to the dependencies location on s3, then update the MD5sum and url below -set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio-gems-20190225.tar.gz") -set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "bf6d28d85aa2daf4b05282790d706a16") +set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio-gems-20190307.tar.gz") +set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "1a00d0ee45731c0cce4ca7b73a438005") set(OPENSTUDIO_GEMS_ZIP_LOCAL_PATH "${CMAKE_BINARY_DIR}/${OPENSTUDIO_GEMS_ZIP_FILENAME}") if(EXISTS "${OPENSTUDIO_GEMS_ZIP_LOCAL_PATH}") @@ -1323,7 +1322,9 @@ add_subdirectory(resources) add_subdirectory(ruby) -add_subdirectory(sketchup_plugin) +if(BUILD_OS_APP) + add_subdirectory(sketchup_plugin) +endif() foreach(D ${project_directories}) add_subdirectory(src/${D}) @@ -1689,6 +1690,7 @@ endif() install(FILES "${CMAKE_BINARY_DIR}/openstudio-gems/Gemfile" DESTINATION ./Ruby/ COMPONENT "RubyAPI" ) install(FILES "${CMAKE_BINARY_DIR}/openstudio-gems/Gemfile.lock" DESTINATION ./Ruby/ COMPONENT "RubyAPI" ) +install(FILES "${CMAKE_BINARY_DIR}/openstudio-gems/openstudio-gems.gemspec" DESTINATION ./Ruby/ COMPONENT "RubyAPI" ) get_filename_component(ENERGYPLUS_DIR "${ENERGYPLUS_EXE}" DIRECTORY) file(GLOB ENERGYPLUS_FILES "${ENERGYPLUS_DIR}/energyplus*") @@ -1747,11 +1749,6 @@ endif() include(CPack) include(CPackIFW) -cpack_add_component(SketchUpPlugin - DISPLAY_NAME "SketchUp Plugin" - DESCRIPTION "SketchUp Plugin" -) - cpack_add_component(CLI DISPLAY_NAME "Command Line Interface" DESCRIPTION "Command Line Interface" @@ -1762,26 +1759,6 @@ cpack_add_component(RubyAPI DESCRIPTION "Ruby API" ) -cpack_add_component(CSharpAPI - DISPLAY_NAME "C# API" - DESCRIPTION "C# API" -) - -cpack_add_component(PAT - DISPLAY_NAME "Parametric Analysis Tool" - DESCRIPTION "Parametric Analysis Tool" -) - -cpack_add_component(OpenStudioApp - DISPLAY_NAME "OpenStudio Application" - DESCRIPTION "OpenStudio Application" -) - -cpack_add_component(DView - DISPLAY_NAME "DView" - DESCRIPTION "DView Application for viewing results" -) - cpack_add_component(EnergyPlus DISPLAY_NAME "EnergyPlus" DESCRIPTION "Minimal EnergyPlus installation" @@ -1792,17 +1769,6 @@ cpack_add_component(Radiance DESCRIPTION "Full Radiance installation" ) -cpack_add_component(Resources - DISPLAY_NAME "Application Resources" - DESCRIPTION "Resource Files used by the OpenStudio Application and SketchUp Plugin" -) - -cpack_ifw_configure_component(SketchUpPlugin - DEPENDS Resources - SCRIPT sketchup_plugin/install_operations.qs - REQUIRES_ADMIN_RIGHTS -) - cpack_ifw_configure_component(CLI SCRIPT src/cli/install_operations.qs REQUIRES_ADMIN_RIGHTS @@ -1812,42 +1778,87 @@ cpack_ifw_configure_component(RubyAPI REQUIRES_ADMIN_RIGHTS ) -cpack_ifw_configure_component(CSharpAPI +cpack_ifw_configure_component(EnergyPlus REQUIRES_ADMIN_RIGHTS ) -cpack_ifw_configure_component(PAT - DEPENDS CLI RubyAPI - SCRIPT pat/install_operations.qs +cpack_ifw_configure_component(Radiance REQUIRES_ADMIN_RIGHTS ) -cpack_ifw_configure_component(OpenStudioApp - DEPENDS Resources CLI - SCRIPT src/openstudio_app/install_operations.qs +cpack_ifw_configure_component(Unspecified + SCRIPT src/install_utility/install_operations.qs REQUIRES_ADMIN_RIGHTS ) -cpack_ifw_configure_component(DView - REQUIRES_ADMIN_RIGHTS -) +if(BUILD_CSHARP_BINDINGS) + cpack_add_component(CSharpAPI + DISPLAY_NAME "C# API" + DESCRIPTION "C# API" + ) -cpack_ifw_configure_component(EnergyPlus - REQUIRES_ADMIN_RIGHTS -) + cpack_ifw_configure_component(CSharpAPI + REQUIRES_ADMIN_RIGHTS + ) +endif() -cpack_ifw_configure_component(Radiance - REQUIRES_ADMIN_RIGHTS -) +if(BUILD_OS_APP) + + cpack_add_component(Resources + DISPLAY_NAME "Application Resources" + DESCRIPTION "Resource Files used by the OpenStudio Application and SketchUp Plugin" + ) + + cpack_add_component(SketchUpPlugin + DISPLAY_NAME "SketchUp Plugin" + DESCRIPTION "SketchUp Plugin" + ) -cpack_ifw_configure_component(Resources - REQUIRES_ADMIN_RIGHTS -) + cpack_add_component(OpenStudioApp + DISPLAY_NAME "OpenStudio Application" + DESCRIPTION "OpenStudio Application" + ) -cpack_ifw_configure_component(Unspecified - SCRIPT src/install_utility/install_operations.qs - REQUIRES_ADMIN_RIGHTS -) + cpack_ifw_configure_component(Resources + REQUIRES_ADMIN_RIGHTS + ) + + cpack_ifw_configure_component(SketchUpPlugin + DEPENDS Resources + SCRIPT sketchup_plugin/install_operations.qs + REQUIRES_ADMIN_RIGHTS + ) + + cpack_ifw_configure_component(OpenStudioApp + DEPENDS Resources CLI + SCRIPT src/openstudio_app/install_operations.qs + REQUIRES_ADMIN_RIGHTS + ) +endif() + +if(BUILD_PAT) + cpack_add_component(PAT + DISPLAY_NAME "Parametric Analysis Tool" + DESCRIPTION "Parametric Analysis Tool" + ) + + cpack_ifw_configure_component(PAT + DEPENDS CLI RubyAPI + SCRIPT pat/install_operations.qs + REQUIRES_ADMIN_RIGHTS + ) +endif() + +if(BUILD_DVIEW) + cpack_add_component(DView + DISPLAY_NAME "DView" + DESCRIPTION "DView Application for viewing results" + ) + + cpack_ifw_configure_component(DView + REQUIRES_ADMIN_RIGHTS + ) +endif() if( BUILD_NUGET_PACKAGE ) configure_file( OpenStudio.nuspec.in OpenStudio.nuspec ) diff --git a/openstudiocore/resources/model/OpenStudio.idd b/openstudiocore/resources/model/OpenStudio.idd index 4ff5991b0f5..6b0610aa8e3 100644 --- a/openstudiocore/resources/model/OpenStudio.idd +++ b/openstudiocore/resources/model/OpenStudio.idd @@ -2025,7 +2025,7 @@ OS:BuildingUnit, \default Residential OS:DefaultConstructionSet, - \min-fields 11 + \min-fields 12 A1, \field Handle \type handle \required-field @@ -2057,7 +2057,10 @@ OS:DefaultConstructionSet, A10, \field Building Shading Construction Name \type object-list \object-list ConstructionNames - A11; \field Site Shading Construction Name + A11, \field Site Shading Construction Name + \type object-list + \object-list ConstructionNames + A12; \field Adiabatic Surface Construction Name \type object-list \object-list ConstructionNames diff --git a/openstudiocore/src/cli/CMakeLists.txt b/openstudiocore/src/cli/CMakeLists.txt index 20fa535511d..787ac4952f0 100644 --- a/openstudiocore/src/cli/CMakeLists.txt +++ b/openstudiocore/src/cli/CMakeLists.txt @@ -277,6 +277,13 @@ target_link_libraries(openstudio openstudio_radiance_static ) +if (APPLE) + target_link_libraries(openstudio + ${OPENSSL_CRYPTO_LIBRARY} + ${OPENSSL_SSL_LIBRARY} + ) +endif() + if (UNIX AND NOT APPLE) target_link_libraries(openstudio ${RUBY_STATIC_LIBRARY} "dl" "crypt" "ssl") target_link_libraries(openstudio "icui18n" "icuuc" "gmp") diff --git a/openstudiocore/src/energyplus/ForwardTranslator.cpp b/openstudiocore/src/energyplus/ForwardTranslator.cpp index 4cfbddb716b..93e66e8a041 100644 --- a/openstudiocore/src/energyplus/ForwardTranslator.cpp +++ b/openstudiocore/src/energyplus/ForwardTranslator.cpp @@ -266,10 +266,10 @@ Workspace ForwardTranslator::translateModelPrivate( model::Model & model, bool f } } - // Energyplus only allows single zone input for ITE object. If space type is assigned in OS, + // Energyplus only allows single zone input for ITE object. If space type is assigned in OS, // will translate to multiple ITE objects assigned to each zone under the same space type. // then delete the one that pointed to a spacetype. - // By doing this, we can solve the potential problem that if this load is applied to a space type, + // By doing this, we can solve the potential problem that if this load is applied to a space type, // the load gets copied to each space of the space type, which may cause conflict of supply air node. std::vector iTEAirCooledEquipments = model.getConcreteModelObjects(); for (ElectricEquipmentITEAirCooled iTequipment : iTEAirCooledEquipments) { @@ -3000,41 +3000,44 @@ boost::optional ForwardTranslator::translateAndMapModelObject(ModelOb // no-op break; } - case openstudio::IddObjectType::OS_UtilityCost_Charge_Block: - { - LOG(Warn, "OS_UtilityCost_Charge_Block is not currently translated"); - break; - } - case openstudio::IddObjectType::OS_UtilityCost_Charge_Simple: - { - LOG(Warn, "OS_UtilityCost_Charge_Simple is not currently translated"); - break; - } - case openstudio::IddObjectType::OS_UtilityCost_Computation: - { - LOG(Warn, "OS_UtilityCost_Computation is not currently translated"); - break; - } - case openstudio::IddObjectType::OS_UtilityCost_Qualify: - { - LOG(Warn, "OS_UtilityCost_Qualify is not currently translated"); - break; - } - case openstudio::IddObjectType::OS_UtilityCost_Ratchet: - { - LOG(Warn, "OS_UtilityCost_Ratchet is not currently translated"); - break; - } - case openstudio::IddObjectType::OS_UtilityCost_Tariff: - { - LOG(Warn, "OS_UtilityCost_Tariff is not currently translated"); - break; - } - case openstudio::IddObjectType::OS_UtilityCost_Variable: - { - LOG(Warn, "OS_UtilityCost_Variable is not currently translated"); - break; - } + + // TODO: once UtilityCost objects are wrapped + //case openstudio::IddObjectType::OS_UtilityCost_Charge_Block: + //{ + //LOG(Warn, "OS_UtilityCost_Charge_Block is not currently translated"); + //break; + //} + //case openstudio::IddObjectType::OS_UtilityCost_Charge_Simple: + //{ + //LOG(Warn, "OS_UtilityCost_Charge_Simple is not currently translated"); + //break; + //} + //case openstudio::IddObjectType::OS_UtilityCost_Computation: + //{ + //LOG(Warn, "OS_UtilityCost_Computation is not currently translated"); + //break; + //} + //case openstudio::IddObjectType::OS_UtilityCost_Qualify: + //{ + //LOG(Warn, "OS_UtilityCost_Qualify is not currently translated"); + //break; + //} + //case openstudio::IddObjectType::OS_UtilityCost_Ratchet: + //{ + //LOG(Warn, "OS_UtilityCost_Ratchet is not currently translated"); + //break; + //} + //case openstudio::IddObjectType::OS_UtilityCost_Tariff: + //{ + //LOG(Warn, "OS_UtilityCost_Tariff is not currently translated"); + //break; + //} + //case openstudio::IddObjectType::OS_UtilityCost_Variable: + //{ + //LOG(Warn, "OS_UtilityCost_Variable is not currently translated"); + //break; + //} + case openstudio::IddObjectType::OS_Version : { model::Version version = modelObject.cast(); @@ -3389,13 +3392,14 @@ std::vector ForwardTranslator::iddObjectsToTranslateInitializer() result.push_back(IddObjectType::OS_Foundation_Kiva); result.push_back(IddObjectType::OS_Foundation_Kiva_Settings); - result.push_back(IddObjectType::OS_UtilityCost_Charge_Block); - result.push_back(IddObjectType::OS_UtilityCost_Charge_Simple); - result.push_back(IddObjectType::OS_UtilityCost_Computation); - result.push_back(IddObjectType::OS_UtilityCost_Qualify); - result.push_back(IddObjectType::OS_UtilityCost_Ratchet); - result.push_back(IddObjectType::OS_UtilityCost_Tariff); - result.push_back(IddObjectType::OS_UtilityCost_Variable); + // TODO: once UtilityCost objects are wrapped + // result.push_back(IddObjectType::OS_UtilityCost_Charge_Block); + // result.push_back(IddObjectType::OS_UtilityCost_Charge_Simple); + // result.push_back(IddObjectType::OS_UtilityCost_Computation); + // result.push_back(IddObjectType::OS_UtilityCost_Qualify); + // result.push_back(IddObjectType::OS_UtilityCost_Ratchet); + // result.push_back(IddObjectType::OS_UtilityCost_Tariff); + // result.push_back(IddObjectType::OS_UtilityCost_Variable); result.push_back(IddObjectType::OS_WeatherFile); result.push_back(IddObjectType::OS_WeatherProperty_SkyTemperature); diff --git a/openstudiocore/src/energyplus/ReverseTranslator.cpp b/openstudiocore/src/energyplus/ReverseTranslator.cpp index 22d20f77df9..a7279f877b6 100644 --- a/openstudiocore/src/energyplus/ReverseTranslator.cpp +++ b/openstudiocore/src/energyplus/ReverseTranslator.cpp @@ -929,14 +929,37 @@ boost::optional ReverseTranslator::translateAndMapWorkspaceObject(c modelObject = translateTimestep(workspaceObject); break; } - case openstudio::IddObjectType::UtilityCost_Charge_Simple : - { - break; // no-op - } - case openstudio::IddObjectType::UtilityCost_Qualify : - { - break; // no-op - } + + // TODO: once UtilityCost objects are wrapped (and ReverseTranslated) + //case openstudio::IddObjectType::OS_UtilityCost_Charge_Block: + //{ + //break; // no-op + //} + //case openstudio::IddObjectType::UtilityCost_Charge_Simple : + //{ + //break; // no-op + //} + //case openstudio::IddObjectType::UtilityCost_Computation : + //{ + //break; // no-op + //} + //case openstudio::IddObjectType::UtilityCost_Qualify : + //{ + //break; // no-op + //} + //case openstudio::IddObjectType::UtilityCost_Ratchet : + //{ + //break; // no-op + //} + //case openstudio::IddObjectType::UtilityCost_Tariff : + //{ + //break; // no-op + //} + //case openstudio::IddObjectType::UtilityCost_Variable : + //{ + //break; // no-op + //} + case openstudio::IddObjectType::Version : { modelObject = translateVersion(workspaceObject ); diff --git a/openstudiocore/src/model/CMakeLists.txt b/openstudiocore/src/model/CMakeLists.txt index cca9d03a7b0..8f0dda90c20 100644 --- a/openstudiocore/src/model/CMakeLists.txt +++ b/openstudiocore/src/model/CMakeLists.txt @@ -1441,27 +1441,30 @@ set(${target_name}_src UtilityBill.hpp UtilityBill_Impl.hpp UtilityBill.cpp - UtilityCost_Charge_Block.hpp - UtilityCost_Charge_Block_Impl.hpp - UtilityCost_Charge_Block.cpp - UtilityCost_Charge_Simple.hpp - UtilityCost_Charge_Simple_Impl.hpp - UtilityCost_Charge_Simple.cpp - UtilityCost_Computation.hpp - UtilityCost_Computation_Impl.hpp - UtilityCost_Computation.cpp - UtilityCost_Qualify.hpp - UtilityCost_Qualify_Impl.hpp - UtilityCost_Qualify.cpp - UtilityCost_Ratchet.hpp - UtilityCost_Ratchet_Impl.hpp - UtilityCost_Ratchet.cpp - UtilityCost_Tariff.hpp - UtilityCost_Tariff_Impl.hpp - UtilityCost_Tariff.cpp - UtilityCost_Variable.hpp - UtilityCost_Variable_Impl.hpp - UtilityCost_Variable.cpp + + # TODO: once UtilityCost objects are wrapped + # UtilityCost_Charge_Block.hpp + # UtilityCost_Charge_Block_Impl.hpp + # UtilityCost_Charge_Block.cpp + # UtilityCost_Charge_Simple.hpp + # UtilityCost_Charge_Simple_Impl.hpp + # UtilityCost_Charge_Simple.cpp + # UtilityCost_Computation.hpp + # UtilityCost_Computation_Impl.hpp + # UtilityCost_Computation.cpp + # UtilityCost_Qualify.hpp + # UtilityCost_Qualify_Impl.hpp + # UtilityCost_Qualify.cpp + # UtilityCost_Ratchet.hpp + # UtilityCost_Ratchet_Impl.hpp + # UtilityCost_Ratchet.cpp + # UtilityCost_Tariff.hpp + # UtilityCost_Tariff_Impl.hpp + # UtilityCost_Tariff.cpp + # UtilityCost_Variable.hpp + # UtilityCost_Variable_Impl.hpp + # UtilityCost_Variable.cpp + WaterHeaterMixed.hpp WaterHeaterMixed_Impl.hpp WaterHeaterMixed.cpp diff --git a/openstudiocore/src/model/ConcreteModelObjects.hpp b/openstudiocore/src/model/ConcreteModelObjects.hpp index db7f9a44dcc..ffc3c914d3a 100644 --- a/openstudiocore/src/model/ConcreteModelObjects.hpp +++ b/openstudiocore/src/model/ConcreteModelObjects.hpp @@ -451,13 +451,16 @@ #include "Timestep.hpp" #include "UtilityBill.hpp" #include "UnitarySystemPerformanceMultispeed.hpp" -#include "UtilityCost_Charge_Block.hpp" -#include "UtilityCost_Charge_Simple.hpp" -#include "UtilityCost_Computation.hpp" -#include "UtilityCost_Qualify.hpp" -#include "UtilityCost_Ratchet.hpp" -#include "UtilityCost_Tariff.hpp" -#include "UtilityCost_Variable.hpp" + +// TODO: once UtilityCost objects are wrapped +// #include "UtilityCost_Charge_Block.hpp" +// #include "UtilityCost_Charge_Simple.hpp" +// #include "UtilityCost_Computation.hpp" +// #include "UtilityCost_Qualify.hpp" +// #include "UtilityCost_Ratchet.hpp" +// #include "UtilityCost_Tariff.hpp" +// #include "UtilityCost_Variable.hpp" + #include "Version.hpp" #include "WaterHeaterMixed.hpp" #include "WaterHeaterHeatPump.hpp" @@ -924,13 +927,16 @@ #include "Timestep_Impl.hpp" #include "UnitarySystemPerformanceMultispeed_Impl.hpp" #include "UtilityBill_Impl.hpp" -#include "UtilityCost_Charge_Block_Impl.hpp" -#include "UtilityCost_Charge_Simple_Impl.hpp" -#include "UtilityCost_Computation_Impl.hpp" -#include "UtilityCost_Qualify_Impl.hpp" -#include "UtilityCost_Ratchet_Impl.hpp" -#include "UtilityCost_Tariff_Impl.hpp" -#include "UtilityCost_Variable_Impl.hpp" + +// TODO: once UtilityCost objects are wrapped +// #include "UtilityCost_Charge_Block_Impl.hpp" +// #include "UtilityCost_Charge_Simple_Impl.hpp" +// #include "UtilityCost_Computation_Impl.hpp" +// #include "UtilityCost_Qualify_Impl.hpp" +// #include "UtilityCost_Ratchet_Impl.hpp" +// #include "UtilityCost_Tariff_Impl.hpp" +// #include "UtilityCost_Variable_Impl.hpp" + #include "Version_Impl.hpp" #include "WaterHeaterMixed_Impl.hpp" #include "WaterHeaterHeatPump_Impl.hpp" diff --git a/openstudiocore/src/model/DefaultConstructionSet.cpp b/openstudiocore/src/model/DefaultConstructionSet.cpp index 11ae91c9d1c..149b3eb9ba5 100644 --- a/openstudiocore/src/model/DefaultConstructionSet.cpp +++ b/openstudiocore/src/model/DefaultConstructionSet.cpp @@ -250,8 +250,11 @@ namespace detail { defaultSurfaceConstructions = this->defaultGroundContactSurfaceConstructions(); }else if (istringEqual("Surface", outsideBoundaryCondition)){ defaultSurfaceConstructions = this->defaultInteriorSurfaceConstructions(); + } else if (istringEqual("Adiabatic", outsideBoundaryCondition)) { + // Adiabatic is special - doesn't has multiple choices by orientation - so return directly + result = this->adiabaticSurfaceConstruction(); + return result; }else{ - //Adiabatic //GroundFCfactorMethod //OtherSideCoefficients //OtherSideConditionsModel @@ -696,6 +699,48 @@ namespace detail { return true; } + + // Adiabatic Surface Construction Methods + boost::optional DefaultConstructionSet_Impl::adiabaticSurfaceConstruction() const + { + return getObject().getModelObjectTarget(OS_DefaultConstructionSetFields::AdiabaticSurfaceConstructionName); + } + + bool DefaultConstructionSet_Impl::setAdiabaticSurfaceConstruction(const ConstructionBase& construction) + { + return setPointer(OS_DefaultConstructionSetFields::AdiabaticSurfaceConstructionName, construction.handle()); + } + + void DefaultConstructionSet_Impl::resetAdiabaticSurfaceConstruction() + { + setString(OS_DefaultConstructionSetFields::AdiabaticSurfaceConstructionName, ""); + } + + boost::optional DefaultConstructionSet_Impl::adiabaticSurfaceConstructionAsModelObject() const { + OptionalModelObject result; + OptionalConstructionBase intermediate = adiabaticSurfaceConstruction(); + if (intermediate) { + result = *intermediate; + } + return result; + } + + bool DefaultConstructionSet_Impl::setAdiabaticSurfaceConstructionAsModelObject(const boost::optional& modelObject) { + if (modelObject) { + OptionalConstructionBase intermediate = modelObject->optionalCast(); + if (intermediate) { + return setAdiabaticSurfaceConstruction(*intermediate); + } + else { + return false; + } + } + else { + resetAdiabaticSurfaceConstruction(); + } + return true; + } + } // detail DefaultConstructionSet::DefaultConstructionSet(const Model& model) @@ -825,6 +870,18 @@ void DefaultConstructionSet::merge(const DefaultConstructionSet& other){ getImpl()->merge(other); } +boost::optional DefaultConstructionSet::adiabaticSurfaceConstruction() const{ + return getImpl()->adiabaticSurfaceConstruction(); +} + +bool DefaultConstructionSet::setAdiabaticSurfaceConstruction(const ConstructionBase& construction){ + return getImpl()->setAdiabaticSurfaceConstruction(construction); +} + +void DefaultConstructionSet::resetAdiabaticSurfaceConstruction(){ + getImpl()->resetAdiabaticSurfaceConstruction(); +} + /// @cond DefaultConstructionSet::DefaultConstructionSet(std::shared_ptr impl) : ResourceObject(std::move(impl)) diff --git a/openstudiocore/src/model/DefaultConstructionSet.hpp b/openstudiocore/src/model/DefaultConstructionSet.hpp index 4253a8f7b68..834e19b8ad2 100644 --- a/openstudiocore/src/model/DefaultConstructionSet.hpp +++ b/openstudiocore/src/model/DefaultConstructionSet.hpp @@ -85,6 +85,8 @@ class MODEL_API DefaultConstructionSet : public ResourceObject { boost::optional siteShadingConstruction() const; + boost::optional adiabaticSurfaceConstruction() const; + //@} /** @name Setters */ //@{ @@ -125,6 +127,10 @@ class MODEL_API DefaultConstructionSet : public ResourceObject { void resetSiteShadingConstruction(); + bool setAdiabaticSurfaceConstruction(const ConstructionBase& construction); + + void resetAdiabaticSurfaceConstruction(); + //@} /// Returns the default construction for this planar surface if available. diff --git a/openstudiocore/src/model/DefaultConstructionSet_Impl.hpp b/openstudiocore/src/model/DefaultConstructionSet_Impl.hpp index 3cc97896761..f1138ca62da 100644 --- a/openstudiocore/src/model/DefaultConstructionSet_Impl.hpp +++ b/openstudiocore/src/model/DefaultConstructionSet_Impl.hpp @@ -47,16 +47,6 @@ namespace detail { /** DefaultConstructionSet_Impl is a ResourceObject_Impl that is the implementation class for DefaultConstructionSet.*/ class MODEL_API DefaultConstructionSet_Impl : public ResourceObject_Impl { - - - - - - - - - - public: /** @name Constructors and Destructors */ //@{ @@ -100,6 +90,8 @@ namespace detail { boost::optional siteShadingConstruction() const; + boost::optional adiabaticSurfaceConstruction() const; + //@} /** @name Setters */ //@{ @@ -140,6 +132,10 @@ namespace detail { void resetSiteShadingConstruction(); + bool setAdiabaticSurfaceConstruction(const ConstructionBase& construction); + + void resetAdiabaticSurfaceConstruction(); + //@} /// Returns the default construction for this planar surface if available. @@ -161,6 +157,7 @@ namespace detail { boost::optional spaceShadingConstructionAsModelObject() const; boost::optional buildingShadingConstructionAsModelObject() const; boost::optional siteShadingConstructionAsModelObject() const; + boost::optional adiabaticSurfaceConstructionAsModelObject() const; bool setDefaultExteriorSurfaceConstructionsAsModelObject(const boost::optional& modelObject); bool setDefaultInteriorSurfaceConstructionsAsModelObject(const boost::optional& modelObject); @@ -171,6 +168,7 @@ namespace detail { bool setSpaceShadingConstructionAsModelObject(const boost::optional& modelObject); bool setBuildingShadingConstructionAsModelObject(const boost::optional& modelObject); bool setSiteShadingConstructionAsModelObject(const boost::optional& modelObject); + bool setAdiabaticSurfaceConstructionAsModelObject(const boost::optional& modelObject); }; diff --git a/openstudiocore/src/model/Model.cpp b/openstudiocore/src/model/Model.cpp index def1bf88b4d..963fd4b1cb0 100644 --- a/openstudiocore/src/model/Model.cpp +++ b/openstudiocore/src/model/Model.cpp @@ -3016,13 +3016,16 @@ detail::Model_Impl::ModelObjectCreator::ModelObjectCreator() { REGISTER_CONSTRUCTOR(Timestep); REGISTER_CONSTRUCTOR(UnitarySystemPerformanceMultispeed); REGISTER_CONSTRUCTOR(UtilityBill); - REGISTER_CONSTRUCTOR(UtilityCost_Charge_Block); - REGISTER_CONSTRUCTOR(UtilityCost_Charge_Simple); - REGISTER_CONSTRUCTOR(UtilityCost_Computation); - REGISTER_CONSTRUCTOR(UtilityCost_Qualify); - REGISTER_CONSTRUCTOR(UtilityCost_Ratchet); - REGISTER_CONSTRUCTOR(UtilityCost_Tariff); - REGISTER_CONSTRUCTOR(UtilityCost_Variable); + + // TODO: once UtilityCost objects are wrapped + // REGISTER_CONSTRUCTOR(UtilityCost_Charge_Block); + // REGISTER_CONSTRUCTOR(UtilityCost_Charge_Simple); + // REGISTER_CONSTRUCTOR(UtilityCost_Computation); + // REGISTER_CONSTRUCTOR(UtilityCost_Qualify); + // REGISTER_CONSTRUCTOR(UtilityCost_Ratchet); + // REGISTER_CONSTRUCTOR(UtilityCost_Tariff); + // REGISTER_CONSTRUCTOR(UtilityCost_Variable); + REGISTER_CONSTRUCTOR(Version); REGISTER_CONSTRUCTOR(WaterHeaterMixed); REGISTER_CONSTRUCTOR(WaterHeaterHeatPump); @@ -3497,13 +3500,16 @@ detail::Model_Impl::ModelObjectCreator::ModelObjectCreator() { REGISTER_COPYCONSTRUCTORS(Timestep); REGISTER_COPYCONSTRUCTORS(UnitarySystemPerformanceMultispeed); REGISTER_COPYCONSTRUCTORS(UtilityBill); - REGISTER_COPYCONSTRUCTORS(UtilityCost_Charge_Block); - REGISTER_COPYCONSTRUCTORS(UtilityCost_Charge_Simple); - REGISTER_COPYCONSTRUCTORS(UtilityCost_Computation); - REGISTER_COPYCONSTRUCTORS(UtilityCost_Qualify); - REGISTER_COPYCONSTRUCTORS(UtilityCost_Ratchet); - REGISTER_COPYCONSTRUCTORS(UtilityCost_Tariff); - REGISTER_COPYCONSTRUCTORS(UtilityCost_Variable); + + // TODO: once UtilityCost objects are wrapped + // REGISTER_COPYCONSTRUCTORS(UtilityCost_Charge_Block); + // REGISTER_COPYCONSTRUCTORS(UtilityCost_Charge_Simple); + // REGISTER_COPYCONSTRUCTORS(UtilityCost_Computation); + // REGISTER_COPYCONSTRUCTORS(UtilityCost_Qualify); + // REGISTER_COPYCONSTRUCTORS(UtilityCost_Ratchet); + // REGISTER_COPYCONSTRUCTORS(UtilityCost_Tariff); + // REGISTER_COPYCONSTRUCTORS(UtilityCost_Variable); + REGISTER_COPYCONSTRUCTORS(Version); REGISTER_COPYCONSTRUCTORS(WaterHeaterMixed); REGISTER_COPYCONSTRUCTORS(WaterHeaterHeatPump); diff --git a/openstudiocore/src/model/Surface.cpp b/openstudiocore/src/model/Surface.cpp index 0c13edabded..db991bef576 100644 --- a/openstudiocore/src/model/Surface.cpp +++ b/openstudiocore/src/model/Surface.cpp @@ -473,9 +473,18 @@ namespace detail { if (istringEqual("Adiabatic", outsideBoundaryCondition)){ // remove all subsurfaces + int n_subsurfaces = 0; for (auto subSurface : subSurfaces()){ subSurface.remove(); + ++n_subsurfaces; } + if (n_subsurfaces > 0) { + // Note JM 2019-03-05: Warn user, it's not obvious that this is happening and they might try to access again + // one of these subsurfaces which are now disconnected objects + LOG(Warn, "Setting the Outside Boundary Condition for Surface '" << this->nameString() + << "' to 'Adiabatic', removed " << n_subsurfaces << " SubSurfaces."); + } + } }else if(adjacentSurface){ // restore the adjacent surface if set boundary condition fails diff --git a/openstudiocore/src/model/UtilityCost_Charge_Block.cpp b/openstudiocore/src/model/UtilityCost_Charge_Block.cpp deleted file mode 100644 index 34dd2373b7c..00000000000 --- a/openstudiocore/src/model/UtilityCost_Charge_Block.cpp +++ /dev/null @@ -1,305 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#include "UtilityCost_Charge_Block.hpp" -#include "UtilityCost_Charge_Block_Impl.hpp" - -#include "Model_Impl.hpp" - -#include "../utilities/idf/IdfExtensibleGroup.hpp" -#include -#include - -#include "../utilities/core/Assert.hpp" - -#include - -namespace openstudio { -namespace model { -namespace detail { - -UtilityCost_Charge_Block_Impl::UtilityCost_Charge_Block_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) - : ParentObject_Impl(idfObject, model, keepHandle) -{ - OS_ASSERT(idfObject.iddObject().type() == UtilityCost_Charge_Block::iddObjectType()); -} - -UtilityCost_Charge_Block_Impl::UtilityCost_Charge_Block_Impl(const openstudio::detail::WorkspaceObject_Impl& other, - Model_Impl* model, - bool keepHandle) - : ParentObject_Impl(other,model,keepHandle) -{ - OS_ASSERT(other.iddObject().type() == UtilityCost_Charge_Block::iddObjectType()); -} - -UtilityCost_Charge_Block_Impl::UtilityCost_Charge_Block_Impl(const UtilityCost_Charge_Block_Impl& other,Model_Impl* model,bool keepHandle) - : ParentObject_Impl(other,model,keepHandle) -{ -} - -OptionalString UtilityCost_Charge_Block_Impl::tariffName() const -{ - return getString(OS_UtilityCost_Charge_BlockFields::TariffName); -} - -bool UtilityCost_Charge_Block_Impl::setTariffName(const std::string& str) -{ - return setString(OS_UtilityCost_Charge_BlockFields::TariffName,str);; -} - -OptionalString UtilityCost_Charge_Block_Impl::sourceVariable() const -{ - return getString(OS_UtilityCost_Charge_BlockFields::SourceVariable); -} - -bool UtilityCost_Charge_Block_Impl::setSourceVariable(const std::string& str) -{ - return setString(OS_UtilityCost_Charge_BlockFields::SourceVariable,str);; -} - -OptionalString UtilityCost_Charge_Block_Impl::season() const -{ - return getString(OS_UtilityCost_Charge_BlockFields::Season); -} - -bool UtilityCost_Charge_Block_Impl::setSeason(const std::string& str) -{ - return setString(OS_UtilityCost_Charge_BlockFields::Season,str);; -} - -OptionalString UtilityCost_Charge_Block_Impl::categoryVariableName() const -{ - return getString(OS_UtilityCost_Charge_BlockFields::CategoryVariableName); -} - -bool UtilityCost_Charge_Block_Impl::setCategoryVariableName(const std::string& str) -{ - return setString(OS_UtilityCost_Charge_BlockFields::CategoryVariableName,str);; -} - -OptionalString UtilityCost_Charge_Block_Impl::remainingIntoVariable() const -{ - return getString(OS_UtilityCost_Charge_BlockFields::RemainingIntoVariable); -} - -bool UtilityCost_Charge_Block_Impl::setRemainingIntoVariable(const std::string& str) -{ - return setString(OS_UtilityCost_Charge_BlockFields::RemainingIntoVariable,str);; -} - -boost::optional UtilityCost_Charge_Block_Impl::blockSizeValueOrVariableName(unsigned index) const { - IdfExtensibleGroup eg = getExtensibleGroup(index); - if (!eg.empty()) { - return eg.getString(OS_UtilityCost_Charge_BlockExtensibleFields::BlockSizeValueorVariableName,true); - } - return boost::none; -} - -bool UtilityCost_Charge_Block_Impl::setBlockSizeValueOrVariableName(unsigned index, const std::string& str) { - IdfExtensibleGroup eg = getExtensibleGroup(index); - if (!eg.empty()) { - return eg.setString(OS_UtilityCost_Charge_BlockExtensibleFields::BlockSizeValueorVariableName,str); - } - else { - StringVector values(2u); - values[OS_UtilityCost_Charge_BlockExtensibleFields::BlockSizeValueorVariableName] = str; - return !insertExtensibleGroup(index,values).empty(); - } - OS_ASSERT(false); - return false; -} - -boost::optional UtilityCost_Charge_Block_Impl::blockCostPerUnitValueOrVariableName(unsigned index) const { - IdfExtensibleGroup eg = getExtensibleGroup(index); - if (!eg.empty()) { - return eg.getString(OS_UtilityCost_Charge_BlockExtensibleFields::BlockCostperUnitValueorVariableName,true); - } - return boost::none; -} - -bool UtilityCost_Charge_Block_Impl::setBlockCostPerUnitValueOrVariableName(unsigned index, const std::string& str) { - IdfExtensibleGroup eg = getExtensibleGroup(index); - if (!eg.empty()) { - return eg.setString(OS_UtilityCost_Charge_BlockExtensibleFields::BlockCostperUnitValueorVariableName,str); - } - else { - StringVector values(2u); - values[OS_UtilityCost_Charge_BlockExtensibleFields::BlockCostperUnitValueorVariableName] = str; - return !insertExtensibleGroup(index,values).empty(); - } - OS_ASSERT(false); - return false; -} - -unsigned UtilityCost_Charge_Block_Impl::numBlocks() const { - return numExtensibleGroups(); -} - -unsigned UtilityCost_Charge_Block_Impl::maxNumBlocks() const { - return maxExtensibleGroups().get(); -} - -// return the parent object in the hierarchy -boost::optional UtilityCost_Charge_Block_Impl::parent() const -{ - return boost::optional(); -} - -// set the parent, child may have to call methods on the parent -bool UtilityCost_Charge_Block_Impl::setParent(ParentObject& newParent) -{ - //if (newParent.optionalCast() && (newParent.model() == model())) { - // return true; - //} - return false; -} - -// return any children objects in the hierarchy -std::vector UtilityCost_Charge_Block_Impl::children() const -{ - std::vector result; - return result; -} - -std::vector UtilityCost_Charge_Block_Impl::allowableChildTypes() const { - IddObjectTypeVector result; - return result; -} - -// Get all output variable names that could be associated with this object. -const std::vector& UtilityCost_Charge_Block_Impl::outputVariableNames() const -{ - static std::vector result; - return result; -} - -} // detail - -// constructor -UtilityCost_Charge_Block::UtilityCost_Charge_Block(const Model& model) - : ParentObject(UtilityCost_Charge_Block::iddObjectType(),model) -{ - OS_ASSERT(getImpl()); -} - -// constructor -UtilityCost_Charge_Block::UtilityCost_Charge_Block(std::shared_ptr impl) - : ParentObject(std::move(impl)) -{} - -OptionalString UtilityCost_Charge_Block::tariffName() const -{ - return getImpl()->tariffName(); -} - -bool UtilityCost_Charge_Block::setTariffName(const std::string& str) -{ - return getImpl()->setTariffName(str); -} - -OptionalString UtilityCost_Charge_Block::sourceVariable() const -{ - return getImpl()->sourceVariable(); -} - -bool UtilityCost_Charge_Block::setSourceVariable(const std::string& str) -{ - return getImpl()->setSourceVariable(str); -} - -OptionalString UtilityCost_Charge_Block::season() const -{ - return getImpl()->season(); -} - -bool UtilityCost_Charge_Block::setSeason(const std::string& str) -{ - return getImpl()->setSeason(str); -} - -OptionalString UtilityCost_Charge_Block::categoryVariableName() const -{ - return getImpl()->categoryVariableName(); -} - -bool UtilityCost_Charge_Block::setCategoryVariableName(const std::string& str) -{ - return getImpl()->setCategoryVariableName(str); -} - -OptionalString UtilityCost_Charge_Block::remainingIntoVariable() const -{ - return getImpl()->remainingIntoVariable(); -} - -bool UtilityCost_Charge_Block::setRemainingIntoVariable(const std::string& str) -{ - return getImpl()->setRemainingIntoVariable(str); -} - -boost::optional UtilityCost_Charge_Block::blockSizeValueOrVariableName( - unsigned index) const -{ - return getImpl()->blockSizeValueOrVariableName(index); -} - -bool UtilityCost_Charge_Block::setBlockSizeValueOrVariableName( - unsigned index, const std::string& str) -{ - return getImpl()->setBlockSizeValueOrVariableName(index,str); -} - -boost::optional UtilityCost_Charge_Block::blockCostPerUnitValueOrVariableName( - unsigned index) const -{ - return getImpl()->blockCostPerUnitValueOrVariableName(index); -} - -bool UtilityCost_Charge_Block::setBlockCostPerUnitValueOrVariableName( - unsigned index, const std::string& str) -{ - return getImpl()->setBlockCostPerUnitValueOrVariableName(index,str); -} - -unsigned UtilityCost_Charge_Block::numBlocks() const { - return getImpl()->numBlocks(); -} - -unsigned UtilityCost_Charge_Block::maxNumBlocks() const { - return getImpl()->maxNumBlocks(); -} - -IddObjectType UtilityCost_Charge_Block::iddObjectType() -{ - IddObjectType result(IddObjectType::OS_UtilityCost_Charge_Block); - return result; -} - -} // model -} // openstudio diff --git a/openstudiocore/src/model/UtilityCost_Charge_Block.hpp b/openstudiocore/src/model/UtilityCost_Charge_Block.hpp deleted file mode 100644 index 0678ac75916..00000000000 --- a/openstudiocore/src/model/UtilityCost_Charge_Block.hpp +++ /dev/null @@ -1,144 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#ifndef MODEL_UTILITYCOST_CHARGE_BLOCK_HPP -#define MODEL_UTILITYCOST_CHARGE_BLOCK_HPP - -#include "ModelAPI.hpp" -#include "ParentObject.hpp" -#include "../utilities/core/Optional.hpp" - -namespace openstudio{ -namespace model{ - -namespace detail{ - class UtilityCost_Charge_Block_Impl; -} - -/** UtilityCost_Charge_Block derives from ParentObject and is an interface to the OpenStudio IDD object named "OS:UtilityCost:Charge:Block". - * - * UtilityCost_Charge_Block is used to compute energy and demand charges that are structured in blocks of charges. - * It may also be used for taxes, surcharges and any other charges that occur on a utility bill but those are more commonly simple flat charges - * so UtilityCost_Charge_Simple is more commonly used for those functions. As many UtilityCost_Charge_Block objects as needed may be defined for - * a single tariff and they will be added together. Blocks are a structure used by almost all utilities for calculating energy and demand charges - * and they allow the utility to charge more or less per unit of energy or demand if more units are used. - */ -class MODEL_API UtilityCost_Charge_Block : public ParentObject{ - -public: - - /** @name Constructors and Destructors */ - //@{ - - /// Constructs a new UtilityCost_Charge_Block object in the model. - explicit UtilityCost_Charge_Block(const Model& model); - - virtual ~UtilityCost_Charge_Block() {} - - //@} - /** @name Getters */ - //@{ - - boost::optional tariffName() const; - - boost::optional sourceVariable() const; - - boost::optional season() const; - - boost::optional categoryVariableName() const; - - boost::optional remainingIntoVariable() const; - - /** Get the block size value or variable name at index. Indexing starts at 0. */ - boost::optional blockSizeValueOrVariableName(unsigned index) const; - - /** Get the cost per unit for block at index. Indexing starts at 0. */ - boost::optional blockCostPerUnitValueOrVariableName(unsigned index) const; - - //@} - /** @name Setters */ - //@{ - - bool setTariffName(const std::string& tariffName); - - bool setSourceVariable(const std::string& sourceVariable); - - bool setSeason(const std::string& season); - - bool setCategoryVariableName(const std::string& categoryVariableName); - - bool setRemainingIntoVariable(const std::string& remainingIntoVariable); - - /** Set the block size value or variable name at index. Indexing starts at 0. */ - bool setBlockSizeValueOrVariableName(unsigned index, const std::string& blockSizeValueOrVariableName); - - /** Set the cost per unit for block at index. Indexing starts at 0. */ - bool setBlockCostPerUnitValueOrVariableName(unsigned index, const std::string& blockCostPerUnitValueOrVariableName); - - //@} - - /// Returns the IddObjectType. - static IddObjectType iddObjectType(); - - /// Returns the number of blocks for which data is specified, e.g. the number of extensible fields. - unsigned numBlocks() const; - - /// Returns the maximum number of blocks for which data may be specified, e.g. the maximum number of extensible fields. - unsigned maxNumBlocks() const; - -protected: - - /// @cond - - typedef detail::UtilityCost_Charge_Block_Impl ImplType; - - friend class Model; - friend class IdfObject; - - // constructor - explicit UtilityCost_Charge_Block(std::shared_ptr impl); - -private: - - REGISTER_LOGGER("openstudio.model.UtilityCost_Charge_Block"); - - /// @endcond - -}; - -/** \relates UtilityCost_Charge_Block */ -typedef boost::optional OptionalUtilityCost_Charge_Block; - -/** \relates UtilityCost_Charge_Block */ -typedef std::vector UtilityCost_Charge_BlockVector; - -} // model -} // openstudio - -#endif // MODEL_UTILITYCOST_CHARGE_BLOCK_HPP diff --git a/openstudiocore/src/model/UtilityCost_Charge_Block_Impl.hpp b/openstudiocore/src/model/UtilityCost_Charge_Block_Impl.hpp deleted file mode 100644 index 3eeb5966201..00000000000 --- a/openstudiocore/src/model/UtilityCost_Charge_Block_Impl.hpp +++ /dev/null @@ -1,110 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#ifndef MODEL_UTILITYCOST_CHARGE_BLOCK_IMPL_HPP -#define MODEL_UTILITYCOST_CHARGE_BLOCK_IMPL_HPP - -#include "ParentObject_Impl.hpp" -#include "UtilityCost_Charge_Block.hpp" -#include "../utilities/core/Optional.hpp" - -namespace openstudio { -namespace model { -namespace detail { - -class MODEL_API UtilityCost_Charge_Block_Impl : public ParentObject_Impl{ - -public: - // constructor - UtilityCost_Charge_Block_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle); - - // construct from workspace - UtilityCost_Charge_Block_Impl(const openstudio::detail::WorkspaceObject_Impl& other, - Model_Impl* model, - bool keepHandle); - - // clone copy constructor - UtilityCost_Charge_Block_Impl(const UtilityCost_Charge_Block_Impl& other,Model_Impl* model,bool keepHandle); - - // virtual destructor - virtual ~UtilityCost_Charge_Block_Impl(){} - - OptionalString tariffName() const; - bool setTariffName(const std::string& str); - - OptionalString sourceVariable() const; - bool setSourceVariable(const std::string& str); - - OptionalString season() const; - bool setSeason(const std::string& str); - - OptionalString categoryVariableName() const; - bool setCategoryVariableName(const std::string& str); - - OptionalString remainingIntoVariable() const; - bool setRemainingIntoVariable(const std::string& str); - - /** Get the block size value or variable name at index. Indexing starts at 0. */ - boost::optional blockSizeValueOrVariableName(unsigned index) const; - bool setBlockSizeValueOrVariableName(unsigned index, const std::string& str); - - /** Get the cost per unit for block at index. Indexing starts at 0. */ - boost::optional blockCostPerUnitValueOrVariableName(unsigned index) const; - bool setBlockCostPerUnitValueOrVariableName(unsigned index, const std::string& str); - - unsigned numBlocks() const; - unsigned maxNumBlocks() const; - - // return the parent object in the hierarchy - virtual boost::optional parent() const override; - - // set the parent, child may have to call methods on the parent - virtual bool setParent(ParentObject& newParent) override; - - // return any children objects in the hierarchy - virtual std::vector children() const override; - - /// get a vector of allowable children types - virtual std::vector allowableChildTypes() const override; - - // Get all output variable names that could be associated with this object. - virtual const std::vector& outputVariableNames() const override; - - virtual IddObjectType iddObjectType() const override {return UtilityCost_Charge_Block::iddObjectType();} - -private: - REGISTER_LOGGER("openstudio.model.UtilityCost_Charge_Block"); - -}; - -} // detail -} // model -} // openstudio - -#endif // MODEL_UTILITYCOST_CHARGE_BLOCK_IMPL_HPP diff --git a/openstudiocore/src/model/UtilityCost_Charge_Simple.cpp b/openstudiocore/src/model/UtilityCost_Charge_Simple.cpp deleted file mode 100644 index 9ef0c9fdbc5..00000000000 --- a/openstudiocore/src/model/UtilityCost_Charge_Simple.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#include "UtilityCost_Charge_Simple.hpp" -#include "UtilityCost_Charge_Simple_Impl.hpp" - -#include "Model_Impl.hpp" - -#include -#include - -#include "../utilities/core/Assert.hpp" - -#include - -namespace openstudio { -namespace model { -namespace detail { - -UtilityCost_Charge_Simple_Impl::UtilityCost_Charge_Simple_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) - : ParentObject_Impl(idfObject, model, keepHandle) -{ - OS_ASSERT(idfObject.iddObject().type() == UtilityCost_Charge_Simple::iddObjectType()); -} - -UtilityCost_Charge_Simple_Impl::UtilityCost_Charge_Simple_Impl(const openstudio::detail::WorkspaceObject_Impl& other, - Model_Impl* model, - bool keepHandle) - : ParentObject_Impl(other,model,keepHandle) -{ - OS_ASSERT(other.iddObject().type() == UtilityCost_Charge_Simple::iddObjectType()); -} - -UtilityCost_Charge_Simple_Impl::UtilityCost_Charge_Simple_Impl(const UtilityCost_Charge_Simple_Impl& other,Model_Impl* model,bool keepHandle) - : ParentObject_Impl(other,model,keepHandle) -{ -} - -OptionalString UtilityCost_Charge_Simple_Impl::tariffName() const -{ - return getString(OS_UtilityCost_Charge_SimpleFields::TariffName); -} - -bool UtilityCost_Charge_Simple_Impl::setTariffName(const std::string& str) -{ - return setString(OS_UtilityCost_Charge_SimpleFields::TariffName,str);; -} - -OptionalString UtilityCost_Charge_Simple_Impl::sourceVariable() const -{ - return getString(OS_UtilityCost_Charge_SimpleFields::SourceVariable); -} - -bool UtilityCost_Charge_Simple_Impl::setSourceVariable(const std::string& str) -{ - return setString(OS_UtilityCost_Charge_SimpleFields::SourceVariable,str);; -} - -OptionalString UtilityCost_Charge_Simple_Impl::season() const -{ - return getString(OS_UtilityCost_Charge_SimpleFields::Season); -} - -bool UtilityCost_Charge_Simple_Impl::setSeason(const std::string& str) -{ - return setString(OS_UtilityCost_Charge_SimpleFields::Season,str);; -} - -OptionalString UtilityCost_Charge_Simple_Impl::categoryVariableName() const -{ - return getString(OS_UtilityCost_Charge_SimpleFields::CategoryVariableName); -} - -bool UtilityCost_Charge_Simple_Impl::setCategoryVariableName(const std::string& str) -{ - return setString(OS_UtilityCost_Charge_SimpleFields::CategoryVariableName,str);; -} - -OptionalString UtilityCost_Charge_Simple_Impl::costPerUnitValueOrVariableName() const -{ - return getString(OS_UtilityCost_Charge_SimpleFields::CostperUnitValueorVariableName); -} - -bool UtilityCost_Charge_Simple_Impl::setCostPerUnitValueOrVariableName(const std::string& str) -{ - return setString(OS_UtilityCost_Charge_SimpleFields::CostperUnitValueorVariableName,str);; -} - -// return the parent object in the hierarchy -boost::optional UtilityCost_Charge_Simple_Impl::parent() const -{ - return boost::optional(); -} - -// set the parent, child may have to call methods on the parent -bool UtilityCost_Charge_Simple_Impl::setParent(ParentObject& newParent) -{ - //if (newParent.optionalCast() && (newParent.model() == model())) { - // return true; - //} - return false; -} - -// return any children objects in the hierarchy -std::vector UtilityCost_Charge_Simple_Impl::children() const -{ - std::vector result; - return result; -} - -std::vector UtilityCost_Charge_Simple_Impl::allowableChildTypes() const { - IddObjectTypeVector result; - return result; -} - -// Get all output variable names that could be associated with this object. -const std::vector& UtilityCost_Charge_Simple_Impl::outputVariableNames() const -{ - static std::vector result; - return result; -} - -} // detail - -/// constructor -UtilityCost_Charge_Simple::UtilityCost_Charge_Simple(const Model& model) - : ParentObject(UtilityCost_Charge_Simple::iddObjectType(),model) -{ - OS_ASSERT(getImpl()); -} - -// constructor -UtilityCost_Charge_Simple::UtilityCost_Charge_Simple(std::shared_ptr impl) - : ParentObject(std::move(impl)) -{} - -OptionalString UtilityCost_Charge_Simple::tariffName() const -{ - return getImpl()->tariffName(); -} - -bool UtilityCost_Charge_Simple::setTariffName(const std::string& str) -{ - return getImpl()->setTariffName(str); -} - -OptionalString UtilityCost_Charge_Simple::sourceVariable() const -{ - return getImpl()->sourceVariable(); -} - -bool UtilityCost_Charge_Simple::setSourceVariable(const std::string& str) -{ - return getImpl()->setSourceVariable(str); -} - -OptionalString UtilityCost_Charge_Simple::season() const -{ - return getImpl()->season(); -} - -bool UtilityCost_Charge_Simple::setSeason(const std::string& str) -{ - return getImpl()->setSeason(str); -} - -OptionalString UtilityCost_Charge_Simple::categoryVariableName() const -{ - return getImpl()->categoryVariableName(); -} - -bool UtilityCost_Charge_Simple::setCategoryVariableName(const std::string& str) -{ - return getImpl()->setCategoryVariableName(str); -} - -OptionalString UtilityCost_Charge_Simple::costPerUnitValueOrVariableName() const -{ - return getImpl()->costPerUnitValueOrVariableName(); -} - -bool UtilityCost_Charge_Simple::setCostPerUnitValueOrVariableName(const std::string& str) -{ - return getImpl()->setCostPerUnitValueOrVariableName(str); -} - -IddObjectType UtilityCost_Charge_Simple::iddObjectType() -{ - IddObjectType result(IddObjectType::OS_UtilityCost_Charge_Simple); - return result; -} - -} // model -} // openstudio diff --git a/openstudiocore/src/model/UtilityCost_Charge_Simple.hpp b/openstudiocore/src/model/UtilityCost_Charge_Simple.hpp deleted file mode 100644 index 5e5838deb47..00000000000 --- a/openstudiocore/src/model/UtilityCost_Charge_Simple.hpp +++ /dev/null @@ -1,121 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#ifndef MODEL_UTILITYCOST_CHARGE_SIMPLE_HPP -#define MODEL_UTILITYCOST_CHARGE_SIMPLE_HPP - -#include "ModelAPI.hpp" -#include "ParentObject.hpp" -#include "../utilities/core/Optional.hpp" - -namespace openstudio{ -namespace model{ - -namespace detail{ - class UtilityCost_Charge_Simple_Impl; -} - -/** UtilityCost_Charge_Simple derives from ParentObject and is an interface to the OpenStudio IDD object named "OS:UtilityCost:Charge:Simple". - * - * UtilityCost_Charge_Simple is used to compute flat charges such as taxes and fees related to a utility bill. - */ -class MODEL_API UtilityCost_Charge_Simple : public ParentObject{ - -public: - - /** @name Constructors and Destructors */ - //@{ - - /// Constructs a new UtilityCost_Charge_Simple object in the model. - explicit UtilityCost_Charge_Simple(const Model& model); - - virtual ~UtilityCost_Charge_Simple() {} - - //@} - /** @name Getters */ - //@{ - - boost::optional tariffName() const; - - boost::optional sourceVariable() const; - - boost::optional season() const; - - boost::optional categoryVariableName() const; - - boost::optional costPerUnitValueOrVariableName() const; - - //@} - /** @name Setters */ - //@{ - - bool setTariffName(const std::string& tariffName); - - bool setSourceVariable(const std::string& sourceVariable); - - bool setSeason(const std::string& season); - - bool setCategoryVariableName(const std::string& categoryVariableName); - - bool setCostPerUnitValueOrVariableName(const std::string& costPerUnitValueOrVariableName); - - //@} - - /// Returns the IddObjectType. - static IddObjectType iddObjectType(); - -protected: - - /// @cond - - typedef detail::UtilityCost_Charge_Simple_Impl ImplType; - - friend class Model; - friend class IdfObject; - - // constructor - explicit UtilityCost_Charge_Simple(std::shared_ptr impl); - -private: - REGISTER_LOGGER("openstudio.model.UtilityCost_Charge_Simple"); - - /// @endcond - -}; - -/** \relates UtilityCost_Charge_Simple */ -typedef boost::optional OptionalUtilityCost_Charge_Simple; - -/** \relates UtilityCost_Charge_Simple */ -typedef std::vector UtilityCost_Charge_SimpleVector; - -} // model -} // openstudio - -#endif // MODEL_UTILITYCOST_CHARGE_SIMPLE_HPP diff --git a/openstudiocore/src/model/UtilityCost_Charge_Simple_Impl.hpp b/openstudiocore/src/model/UtilityCost_Charge_Simple_Impl.hpp deleted file mode 100644 index 0837bacf934..00000000000 --- a/openstudiocore/src/model/UtilityCost_Charge_Simple_Impl.hpp +++ /dev/null @@ -1,99 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#ifndef MODEL_UTILITYCOST_CHARGE_SIMPLE_IMPL_HPP -#define MODEL_UTILITYCOST_CHARGE_SIMPLE_IMPL_HPP - -#include "ParentObject_Impl.hpp" -#include "UtilityCost_Charge_Simple.hpp" -#include "../utilities/core/Optional.hpp" - -namespace openstudio { -namespace model { -namespace detail { - -class MODEL_API UtilityCost_Charge_Simple_Impl : public ParentObject_Impl{ - -public: - // constructor - UtilityCost_Charge_Simple_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle); - - // construct from workspace - UtilityCost_Charge_Simple_Impl(const openstudio::detail::WorkspaceObject_Impl& other, - Model_Impl* model, - bool keepHandle); - - // clone copy constructor - UtilityCost_Charge_Simple_Impl(const UtilityCost_Charge_Simple_Impl& other,Model_Impl* model,bool keepHandle); - - // virtual destructor - virtual ~UtilityCost_Charge_Simple_Impl(){} - - OptionalString tariffName() const; - bool setTariffName(const std::string& str); - - OptionalString sourceVariable() const; - bool setSourceVariable(const std::string& str); - - OptionalString season() const; - bool setSeason(const std::string& str); - - OptionalString categoryVariableName() const; - bool setCategoryVariableName(const std::string& str); - - OptionalString costPerUnitValueOrVariableName() const; - bool setCostPerUnitValueOrVariableName(const std::string& str); - - // return the parent object in the hierarchy - virtual boost::optional parent() const override; - - // set the parent, child may have to call methods on the parent - virtual bool setParent(ParentObject& newParent) override; - - // return any children objects in the hierarchy - virtual std::vector children() const override; - - /// get a vector of allowable children types - virtual std::vector allowableChildTypes() const override; - - // Get all output variable names that could be associated with this object. - virtual const std::vector& outputVariableNames() const override; - - virtual IddObjectType iddObjectType() const override {return UtilityCost_Charge_Simple::iddObjectType();} - -private: - REGISTER_LOGGER("openstudio.model.UtilityCost_Charge_Simple"); - -}; - -} // detail -} // model -} // openstudio - -#endif // MODEL_UTILITYCOST_CHARGE_SIMPLE_IMPL_HPP diff --git a/openstudiocore/src/model/UtilityCost_Computation.cpp b/openstudiocore/src/model/UtilityCost_Computation.cpp deleted file mode 100644 index 13d49534302..00000000000 --- a/openstudiocore/src/model/UtilityCost_Computation.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#include "UtilityCost_Computation.hpp" -#include "UtilityCost_Computation_Impl.hpp" - -#include "Model_Impl.hpp" - -#include "../utilities/idf/IdfExtensibleGroup.hpp" -#include -#include - -#include "../utilities/core/Assert.hpp" - -#include - -namespace openstudio { -namespace model { -namespace detail { - -UtilityCost_Computation_Impl::UtilityCost_Computation_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) - : ParentObject_Impl(idfObject, model, keepHandle) -{ - OS_ASSERT(idfObject.iddObject().type() == UtilityCost_Computation::iddObjectType()); -} - -UtilityCost_Computation_Impl::UtilityCost_Computation_Impl(const openstudio::detail::WorkspaceObject_Impl& other, - Model_Impl* model, - bool keepHandle) - : ParentObject_Impl(other,model,keepHandle) -{ - OS_ASSERT(other.iddObject().type() == UtilityCost_Computation::iddObjectType()); -} - -UtilityCost_Computation_Impl::UtilityCost_Computation_Impl(const UtilityCost_Computation_Impl& other,Model_Impl* model,bool keepHandle) - : ParentObject_Impl(other,model,keepHandle) -{ -} - -OptionalString UtilityCost_Computation_Impl::tariffName() const -{ - return getString(OS_UtilityCost_ComputationFields::TariffName); -} - -bool UtilityCost_Computation_Impl::setTariffName(const std::string& str) -{ - return setString(OS_UtilityCost_ComputationFields::TariffName,str);; -} - -boost::optional UtilityCost_Computation_Impl::computeStep(unsigned index) const { - IdfExtensibleGroup eg = getExtensibleGroup(index); - if (!eg.empty()) { - return eg.getString(OS_UtilityCost_ComputationExtensibleFields::ComputeStep,true); - } - return boost::none; -} - -bool UtilityCost_Computation_Impl::setComputeStep(unsigned index, const std::string& str) { - IdfExtensibleGroup eg = getExtensibleGroup(index); - if (!eg.empty()) { - return eg.setString(OS_UtilityCost_ComputationExtensibleFields::ComputeStep,str); - } - else { - StringVector values(1u,str); - return !insertExtensibleGroup(index,values).empty(); - } - OS_ASSERT(false); - return false; -} - -// return the parent object in the hierarchy -boost::optional UtilityCost_Computation_Impl::parent() const -{ - return boost::optional(); -} - -// set the parent, child may have to call methods on the parent -bool UtilityCost_Computation_Impl::setParent(ParentObject& newParent) -{ - //if (newParent.optionalCast() && (newParent.model() == model())) { - // return true; - //} - return false; -} - -// return any children objects in the hierarchy -std::vector UtilityCost_Computation_Impl::children() const -{ - std::vector result; - return result; -} - -std::vector UtilityCost_Computation_Impl::allowableChildTypes() const { - IddObjectTypeVector result; - return result; -} - -// Get all output variable names that could be associated with this object. -const std::vector& UtilityCost_Computation_Impl::outputVariableNames() const -{ - static std::vector result; - return result; -} - -unsigned UtilityCost_Computation_Impl::numComputeSteps() const { - return numExtensibleGroups(); -} -unsigned UtilityCost_Computation_Impl::maxComputeSteps() const { - return maxExtensibleGroups().get(); -} - -} // detail - -/// constructor -UtilityCost_Computation::UtilityCost_Computation(const Model& model) - : ParentObject(UtilityCost_Computation::iddObjectType(),model) -{ - OS_ASSERT(getImpl()); -} - -// constructor -UtilityCost_Computation::UtilityCost_Computation(std::shared_ptr impl) - : ParentObject(std::move(impl)) -{} - -OptionalString UtilityCost_Computation::tariffName() const -{ - return getImpl()->tariffName(); -} - -bool UtilityCost_Computation::setTariffName(const std::string& str) -{ - return getImpl()->setTariffName(str); -} - -boost::optional UtilityCost_Computation::computeStep(unsigned index) const { - return getImpl()->computeStep(index); -} -bool UtilityCost_Computation::setComputeStep(unsigned index, const std::string& str) { - return getImpl()->setComputeStep(index,str); -} - -unsigned UtilityCost_Computation::numComputeSteps() const { - return getImpl()->numComputeSteps(); -} -unsigned UtilityCost_Computation::maxComputeSteps() const { - return getImpl()->maxComputeSteps(); -} - -IddObjectType UtilityCost_Computation::iddObjectType() -{ - IddObjectType result(IddObjectType::OS_UtilityCost_Computation); - return result; -} - -} // model -} // openstudio diff --git a/openstudiocore/src/model/UtilityCost_Computation.hpp b/openstudiocore/src/model/UtilityCost_Computation.hpp deleted file mode 100644 index fa7bd5cd668..00000000000 --- a/openstudiocore/src/model/UtilityCost_Computation.hpp +++ /dev/null @@ -1,119 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#ifndef MODEL_UTILITYCOST_COMPUTATION_HPP -#define MODEL_UTILITYCOST_COMPUTATION_HPP - -#include "ModelAPI.hpp" -#include "ParentObject.hpp" -#include "../utilities/core/Optional.hpp" - -namespace openstudio{ -namespace model{ - -namespace detail{ - class UtilityCost_Computation_Impl; -} - -/** UtilityCost_Computation derives from ParentObject and is an interface to the OpenStudio IDD object named "OS:UtilityCost:Computation". - * - * UtilityCost_Computation lists a series of computations that are used to perform the bill calculation. - * This object is only used for complex tariffs that cannot be modeled any other way. - */ -class MODEL_API UtilityCost_Computation : public ParentObject{ - - public: - - /** @name Constructors and Destructors */ - //@{ - - /// Constructs a new UtilityCost_Computation object in the model. - explicit UtilityCost_Computation(const Model& model); - - virtual ~UtilityCost_Computation() {} - - //@} - /** @name Getters */ - //@{ - - boost::optional tariffName() const; - - /** Get compute step at index. Index starts at 0. */ - boost::optional computeStep(unsigned index) const; - - //@} - /** @name Setters */ - //@{ - - bool setTariffName(const std::string& tariffName); - - /** Set compute step at index. Index starts at 0. */ - bool setComputeStep(unsigned index, const std::string& computeStep); - - //@} - - /// Returns the IddObjectType. - static IddObjectType iddObjectType(); - - /// Returns the number of compute steps specified, e.g. the number of extensible fields. - unsigned numComputeSteps() const; - - /// Returns the maximum number of compute steps that may be specified, e.g. the maximum number of extensible fields. - unsigned maxComputeSteps() const; - - protected: - - /// @cond - - typedef detail::UtilityCost_Computation_Impl ImplType; - - friend class Model; - friend class IdfObject; - - // constructor - explicit UtilityCost_Computation(std::shared_ptr impl); - -private: - - REGISTER_LOGGER("openstudio.model.UtilityCost_Computation"); - - /// @endcond - -}; - -/** \relates UtilityCost_Computation */ -typedef boost::optional OptionalUtilityCost_Computation; - -/** \relates UtilityCost_Computation */ -typedef std::vector UtilityCost_ComputationVector; - -} // model -} // openstudio - -#endif // MODEL_UTILITYCOST_COMPUTATION_HPP diff --git a/openstudiocore/src/model/UtilityCost_Computation_Impl.hpp b/openstudiocore/src/model/UtilityCost_Computation_Impl.hpp deleted file mode 100644 index d42d38a0732..00000000000 --- a/openstudiocore/src/model/UtilityCost_Computation_Impl.hpp +++ /dev/null @@ -1,94 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#ifndef MODEL_UTILITYCOST_COMPUTATION_IMPL_HPP -#define MODEL_UTILITYCOST_COMPUTATION_IMPL_HPP - -#include "ParentObject_Impl.hpp" -#include "UtilityCost_Computation.hpp" -#include "../utilities/core/Optional.hpp" - -namespace openstudio { -namespace model { -namespace detail { - -class MODEL_API UtilityCost_Computation_Impl : public ParentObject_Impl{ - -public: - // constructor - UtilityCost_Computation_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle); - - // construct from workspace - UtilityCost_Computation_Impl(const openstudio::detail::WorkspaceObject_Impl& other, - Model_Impl* model, - bool keepHandle); - - // clone copy constructor - UtilityCost_Computation_Impl(const UtilityCost_Computation_Impl& other,Model_Impl* model,bool keepHandle); - - // virtual destructor - virtual ~UtilityCost_Computation_Impl(){} - - OptionalString tariffName() const; - bool setTariffName(const std::string& str); - - /** Compute step index. Index starts at 0. */ - boost::optional computeStep(unsigned index) const; - bool setComputeStep(unsigned index, const std::string& str); - - // return the parent object in the hierarchy - virtual boost::optional parent() const override; - - // set the parent, child may have to call methods on the parent - virtual bool setParent(ParentObject& newParent) override; - - // return any children objects in the hierarchy - virtual std::vector children() const override; - - /// get a vector of allowable children types - virtual std::vector allowableChildTypes() const override; - - // Get all output variable names that could be associated with this object. - virtual const std::vector& outputVariableNames() const override; - - virtual IddObjectType iddObjectType() const override {return UtilityCost_Computation::iddObjectType();} - - unsigned numComputeSteps() const; - unsigned maxComputeSteps() const; - -private: - REGISTER_LOGGER("openstudio.model.UtilityCost_Computation"); - -}; - -} // detail -} // model -} // openstudio - -#endif // MODEL_UTILITYCOST_COMPUTATION_IMPL_HPP diff --git a/openstudiocore/src/model/UtilityCost_Qualify.cpp b/openstudiocore/src/model/UtilityCost_Qualify.cpp deleted file mode 100644 index d4321457f43..00000000000 --- a/openstudiocore/src/model/UtilityCost_Qualify.cpp +++ /dev/null @@ -1,260 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#include "UtilityCost_Qualify.hpp" -#include "UtilityCost_Qualify_Impl.hpp" - -#include "Model_Impl.hpp" - -#include -#include - -#include "../utilities/core/Assert.hpp" - -#include - -namespace openstudio { -namespace model { -namespace detail { - -UtilityCost_Qualify_Impl::UtilityCost_Qualify_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) - : ParentObject_Impl(idfObject, model, keepHandle) -{ - OS_ASSERT(idfObject.iddObject().type() == UtilityCost_Qualify::iddObjectType()); -} - -UtilityCost_Qualify_Impl::UtilityCost_Qualify_Impl(const openstudio::detail::WorkspaceObject_Impl& other, - Model_Impl* model, - bool keepHandle) - : ParentObject_Impl(other,model,keepHandle) -{ - OS_ASSERT(other.iddObject().type() == UtilityCost_Qualify::iddObjectType()); -} - -UtilityCost_Qualify_Impl::UtilityCost_Qualify_Impl(const UtilityCost_Qualify_Impl& other,Model_Impl* model,bool keepHandle) - : ParentObject_Impl(other,model,keepHandle) -{ -} - -OptionalInt UtilityCost_Qualify_Impl::numberOfMonths() const -{ - return getInt(OS_UtilityCost_QualifyFields::NumberofMonths); -} - -bool UtilityCost_Qualify_Impl::setNumberOfMonths(int num) -{ - return setInt(OS_UtilityCost_QualifyFields::NumberofMonths,num);; -} - -OptionalString UtilityCost_Qualify_Impl::tariffName() const -{ - return getString(OS_UtilityCost_QualifyFields::TariffName); -} - -bool UtilityCost_Qualify_Impl::setTariffName(const std::string& str) -{ - return setString(OS_UtilityCost_QualifyFields::TariffName,str);; -} - -OptionalString UtilityCost_Qualify_Impl::variableName() const -{ - return getString(OS_UtilityCost_QualifyFields::VariableName); -} - -bool UtilityCost_Qualify_Impl::setVariableName(const std::string& str) -{ - return setString(OS_UtilityCost_QualifyFields::VariableName,str);; -} - -OptionalString UtilityCost_Qualify_Impl::qualifyType() const -{ - return getString(OS_UtilityCost_QualifyFields::QualifyType); -} - -bool UtilityCost_Qualify_Impl::setQualifyType(const std::string& str) -{ - return setString(OS_UtilityCost_QualifyFields::QualifyType,str);; -} - -OptionalString UtilityCost_Qualify_Impl::thresholdValueOrVariableName() const -{ - return getString(OS_UtilityCost_QualifyFields::ThresholdValueorVariableName); -} - -bool UtilityCost_Qualify_Impl::setThresholdValueOrVariableName(const std::string& str) -{ - return setString(OS_UtilityCost_QualifyFields::ThresholdValueorVariableName,str);; -} - -OptionalString UtilityCost_Qualify_Impl::season() const -{ - return getString(OS_UtilityCost_QualifyFields::Season); -} - -bool UtilityCost_Qualify_Impl::setSeason(const std::string& str) -{ - return setString(OS_UtilityCost_QualifyFields::Season,str);; -} - -OptionalString UtilityCost_Qualify_Impl::thresholdTest() const -{ - return getString(OS_UtilityCost_QualifyFields::ThresholdTest); -} - -bool UtilityCost_Qualify_Impl::setThresholdTest(const std::string& str) -{ - return setString(OS_UtilityCost_QualifyFields::ThresholdTest,str);; -} - -// return the parent object in the hierarchy -boost::optional UtilityCost_Qualify_Impl::parent() const -{ - return boost::optional(); -} - -// set the parent, child may have to call methods on the parent -bool UtilityCost_Qualify_Impl::setParent(ParentObject& newParent) -{ - //if (newParent.optionalCast() && (newParent.model() == model())) { - // return true; - //} - return false; -} - -// return any children objects in the hierarchy -std::vector UtilityCost_Qualify_Impl::children() const -{ - std::vector result; - return result; -} - -std::vector UtilityCost_Qualify_Impl::allowableChildTypes() const { - IddObjectTypeVector result; - return result; -} - -// Get all output variable names that could be associated with this object. -const std::vector& UtilityCost_Qualify_Impl::outputVariableNames() const -{ - static std::vector result; - return result; -} - -} // detail - -/// constructor -UtilityCost_Qualify::UtilityCost_Qualify(const Model& model) - : ParentObject(UtilityCost_Qualify::iddObjectType(),model) -{ - OS_ASSERT(getImpl()); -} - -// constructor -UtilityCost_Qualify::UtilityCost_Qualify(std::shared_ptr impl) - : ParentObject(std::move(impl)) -{} - -OptionalInt UtilityCost_Qualify::numberOfMonths() const -{ - return getImpl()->numberOfMonths(); -} - -bool UtilityCost_Qualify::setNumberOfMonths(int num) -{ - return getImpl()->setNumberOfMonths(num); -} - -OptionalString UtilityCost_Qualify::tariffName() const -{ - return getImpl()->tariffName(); -} - -bool UtilityCost_Qualify::setTariffName(const std::string& str) -{ - return getImpl()->setTariffName(str); -} - -OptionalString UtilityCost_Qualify::variableName() const -{ - return getImpl()->variableName(); -} - -bool UtilityCost_Qualify::setVariableName(const std::string& str) -{ - return getImpl()->setVariableName(str); -} - -OptionalString UtilityCost_Qualify::qualifyType() const -{ - return getImpl()->qualifyType(); -} - -bool UtilityCost_Qualify::setQualifyType(const std::string& str) -{ - return getImpl()->setQualifyType(str); -} - -OptionalString UtilityCost_Qualify::thresholdValueOrVariableName() const -{ - return getImpl()->thresholdValueOrVariableName(); -} - -bool UtilityCost_Qualify::setThresholdValueOrVariableName(const std::string& str) -{ - return getImpl()->setThresholdValueOrVariableName(str); -} - -OptionalString UtilityCost_Qualify::season() const -{ - return getImpl()->season(); -} - -bool UtilityCost_Qualify::setSeason(const std::string& str) -{ - return getImpl()->setSeason(str); -} - -OptionalString UtilityCost_Qualify::thresholdTest() const -{ - return getImpl()->thresholdTest(); -} - -bool UtilityCost_Qualify::setThresholdTest(const std::string& str) -{ - return getImpl()->setThresholdTest(str); -} - -IddObjectType UtilityCost_Qualify::iddObjectType() -{ - IddObjectType result(IddObjectType::OS_UtilityCost_Qualify); - return result; -} - -} // model -} // openstudio diff --git a/openstudiocore/src/model/UtilityCost_Qualify.hpp b/openstudiocore/src/model/UtilityCost_Qualify.hpp deleted file mode 100644 index d135d13fb1d..00000000000 --- a/openstudiocore/src/model/UtilityCost_Qualify.hpp +++ /dev/null @@ -1,130 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#ifndef MODEL_UTILITYCOST_QUALIFY_HPP -#define MODEL_UTILITYCOST_QUALIFY_HPP - -#include "ModelAPI.hpp" -#include "ParentObject.hpp" -#include "../utilities/core/Optional.hpp" - -namespace openstudio{ -namespace model{ - -namespace detail{ - class UtilityCost_Qualify_Impl; -} - -/** UtilityCost_Qualify derives from ParentObject and is an interface to the OpenStudio IDD object named "OS:UtilityCost:Qualify". - * - * UtilityCost_Qualify specifies demand and energy use requirements for buildings to qualify for individual UtilityCost_Tariff. - * This is commonly used for utilities which separate customers into groups such as "low demand", "medium demand", and "high demand". - */ -class MODEL_API UtilityCost_Qualify : public ParentObject{ - -public: - - /** @name Constructors and Destructors */ - //@{ - - /// Constructs a new UtilityCost_Qualify object in the model. - explicit UtilityCost_Qualify(const Model& model); - - virtual ~UtilityCost_Qualify() {} - - //@} - /** @name Getters */ - //@{ - - boost::optional tariffName() const; - - boost::optional variableName() const; - - boost::optional qualifyType() const; - - boost::optional thresholdValueOrVariableName() const; - - boost::optional season() const; - - boost::optional thresholdTest() const; - - boost::optional numberOfMonths() const; - - //@} - /** @name Setters */ - //@{ - - bool setTariffName(const std::string& tariffName); - - bool setVariableName(const std::string& variableName); - - bool setQualifyType(const std::string& qualifyType); - - bool setThresholdValueOrVariableName(const std::string& thresholdValueOrVariableName); - - bool setSeason(const std::string& season); - - bool setThresholdTest(const std::string& thresholdTest); - - bool setNumberOfMonths(int numberOfMonths); - - //@} - - /// Returns the IddObjectType. - static IddObjectType iddObjectType(); - -protected: - - /// @cond - - typedef detail::UtilityCost_Qualify_Impl ImplType; - - friend class Model; - friend class IdfObject; - - // constructor - explicit UtilityCost_Qualify(std::shared_ptr impl); - -private: - REGISTER_LOGGER("openstudio.model.UtilityCost_Qualify"); - - /// @endcond - -}; - -/** \relates UtilityCost_Qualify */ -typedef boost::optional OptionalUtilityCost_Qualify; - -/** \relates UtilityCost_Qualify */ -typedef std::vector UtilityCost_QualifyVector; - -} // model -} // openstudio - -#endif // MODEL_UTILITYCOST_QUALIFY_HPP diff --git a/openstudiocore/src/model/UtilityCost_Qualify_Impl.hpp b/openstudiocore/src/model/UtilityCost_Qualify_Impl.hpp deleted file mode 100644 index e4fac18084e..00000000000 --- a/openstudiocore/src/model/UtilityCost_Qualify_Impl.hpp +++ /dev/null @@ -1,105 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#ifndef MODEL_UTILITYCOST_QUALIFY_IMPL_HPP -#define MODEL_UTILITYCOST_QUALIFY_IMPL_HPP - -#include "ParentObject_Impl.hpp" -#include "UtilityCost_Qualify.hpp" -#include "../utilities/core/Optional.hpp" - -namespace openstudio { -namespace model { -namespace detail { - -class MODEL_API UtilityCost_Qualify_Impl : public ParentObject_Impl{ - -public: - // constructor - UtilityCost_Qualify_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle); - - // construct from workspace - UtilityCost_Qualify_Impl(const openstudio::detail::WorkspaceObject_Impl& other, - Model_Impl* model, - bool keepHandle); - - // clone copy constructor - UtilityCost_Qualify_Impl(const UtilityCost_Qualify_Impl& other,Model_Impl* model,bool keepHandle); - - // virtual destructor - virtual ~UtilityCost_Qualify_Impl(){} - - OptionalString tariffName() const; - bool setTariffName(const std::string& str); - - OptionalString variableName() const; - bool setVariableName(const std::string& str); - - OptionalString qualifyType() const; - bool setQualifyType(const std::string& str); - - OptionalString thresholdValueOrVariableName() const; - bool setThresholdValueOrVariableName(const std::string& str); - - OptionalString season() const; - bool setSeason(const std::string& str); - - OptionalString thresholdTest() const; - bool setThresholdTest(const std::string& str); - - OptionalInt numberOfMonths() const; - bool setNumberOfMonths(int num); - - // return the parent object in the hierarchy - virtual boost::optional parent() const override; - - // set the parent, child may have to call methods on the parent - virtual bool setParent(ParentObject& newParent) override; - - // return any children objects in the hierarchy - virtual std::vector children() const override; - - /// get a vector of allowable children types - virtual std::vector allowableChildTypes() const override; - - // Get all output variable names that could be associated with this object. - virtual const std::vector& outputVariableNames() const override; - - virtual IddObjectType iddObjectType() const override {return UtilityCost_Qualify::iddObjectType();} - -private: - REGISTER_LOGGER("openstudio.model.UtilityCost_Qualify"); - -}; - -} // detail -} // model -} // openstudio - -#endif // MODEL_UTILITYCOST_QUALIFY_IMPL_HPP diff --git a/openstudiocore/src/model/UtilityCost_Ratchet.cpp b/openstudiocore/src/model/UtilityCost_Ratchet.cpp deleted file mode 100644 index f94820c69af..00000000000 --- a/openstudiocore/src/model/UtilityCost_Ratchet.cpp +++ /dev/null @@ -1,260 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#include "UtilityCost_Ratchet.hpp" -#include "UtilityCost_Ratchet_Impl.hpp" - -#include "Model_Impl.hpp" - -#include -#include - -#include "../utilities/core/Assert.hpp" - -#include - -namespace openstudio { -namespace model { -namespace detail { - -UtilityCost_Ratchet_Impl::UtilityCost_Ratchet_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) - : ParentObject_Impl(idfObject, model, keepHandle) -{ - OS_ASSERT(idfObject.iddObject().type() == UtilityCost_Ratchet::iddObjectType()); -} - -UtilityCost_Ratchet_Impl::UtilityCost_Ratchet_Impl(const openstudio::detail::WorkspaceObject_Impl& other, - Model_Impl* model, - bool keepHandle) - : ParentObject_Impl(other,model,keepHandle) -{ - OS_ASSERT(other.iddObject().type() == UtilityCost_Ratchet::iddObjectType()); -} - -UtilityCost_Ratchet_Impl::UtilityCost_Ratchet_Impl(const UtilityCost_Ratchet_Impl& other,Model_Impl* model,bool keepHandle) - : ParentObject_Impl(other,model,keepHandle) -{ -} - -OptionalString UtilityCost_Ratchet_Impl::tariffName() const -{ - return getString(OS_UtilityCost_RatchetFields::TariffName); -} - -bool UtilityCost_Ratchet_Impl::setTariffName(const std::string& str) -{ - return setString(OS_UtilityCost_RatchetFields::TariffName,str);; -} - -OptionalString UtilityCost_Ratchet_Impl::baselineSourceVariable() const -{ - return getString(OS_UtilityCost_RatchetFields::BaselineSourceVariable); -} - -bool UtilityCost_Ratchet_Impl::setBaselineSourceVariable(const std::string& str) -{ - return setString(OS_UtilityCost_RatchetFields::BaselineSourceVariable,str);; -} - -OptionalString UtilityCost_Ratchet_Impl::adjustmentSourceVariable() const -{ - return getString(OS_UtilityCost_RatchetFields::AdjustmentSourceVariable); -} - -bool UtilityCost_Ratchet_Impl::setAdjustmentSourceVariable(const std::string& str) -{ - return setString(OS_UtilityCost_RatchetFields::AdjustmentSourceVariable,str);; -} - -OptionalString UtilityCost_Ratchet_Impl::seasonFrom() const -{ - return getString(OS_UtilityCost_RatchetFields::SeasonFrom); -} - -bool UtilityCost_Ratchet_Impl::setSeasonFrom(const std::string& str) -{ - return setString(OS_UtilityCost_RatchetFields::SeasonFrom,str);; -} - -OptionalString UtilityCost_Ratchet_Impl::seasonTo() const -{ - return getString(OS_UtilityCost_RatchetFields::SeasonTo); -} - -bool UtilityCost_Ratchet_Impl::setSeasonTo(const std::string& str) -{ - return setString(OS_UtilityCost_RatchetFields::SeasonTo,str);; -} - -OptionalString UtilityCost_Ratchet_Impl::multiplierValueOrVariableName() const -{ - return getString(OS_UtilityCost_RatchetFields::MultiplierValueorVariableName); -} - -bool UtilityCost_Ratchet_Impl::setMultiplierValueOrVariableName(const std::string& str) -{ - return setString(OS_UtilityCost_RatchetFields::MultiplierValueorVariableName,str);; -} - -OptionalString UtilityCost_Ratchet_Impl::offsetValueOrVariableName() const -{ - return getString(OS_UtilityCost_RatchetFields::OffsetValueorVariableName); -} - -bool UtilityCost_Ratchet_Impl::setOffsetValueOrVariableName(const std::string& str) -{ - return setString(OS_UtilityCost_RatchetFields::OffsetValueorVariableName,str);; -} - -// return the parent object in the hierarchy -boost::optional UtilityCost_Ratchet_Impl::parent() const -{ - return boost::optional(); -} - -// set the parent, child may have to call methods on the parent -bool UtilityCost_Ratchet_Impl::setParent(ParentObject& newParent) -{ - //if (newParent.optionalCast() && (newParent.model() == model())) { - // return true; - //} - return false; -} - -// return any children objects in the hierarchy -std::vector UtilityCost_Ratchet_Impl::children() const -{ - std::vector result; - return result; -} - -std::vector UtilityCost_Ratchet_Impl::allowableChildTypes() const { - IddObjectTypeVector result; - return result; -} - -// Get all output variable names that could be associated with this object. -const std::vector& UtilityCost_Ratchet_Impl::outputVariableNames() const -{ - static std::vector result; - return result; -} - -} // detail - -/// constructor -UtilityCost_Ratchet::UtilityCost_Ratchet(const Model& model) - : ParentObject(UtilityCost_Ratchet::iddObjectType(),model) -{ - OS_ASSERT(getImpl()); -} - -// constructor -UtilityCost_Ratchet::UtilityCost_Ratchet(std::shared_ptr impl) - : ParentObject(std::move(impl)) -{} - -OptionalString UtilityCost_Ratchet::tariffName() const -{ - return getImpl()->tariffName(); -} - -bool UtilityCost_Ratchet::setTariffName(const std::string& str) -{ - return getImpl()->setTariffName(str); -} - -OptionalString UtilityCost_Ratchet::baselineSourceVariable() const -{ - return getImpl()->baselineSourceVariable(); -} - -bool UtilityCost_Ratchet::setBaselineSourceVariable(const std::string& str) -{ - return getImpl()->setBaselineSourceVariable(str); -} - -OptionalString UtilityCost_Ratchet::adjustmentSourceVariable() const -{ - return getImpl()->adjustmentSourceVariable(); -} - -bool UtilityCost_Ratchet::setAdjustmentSourceVariable(const std::string& str) -{ - return getImpl()->setAdjustmentSourceVariable(str); -} - -OptionalString UtilityCost_Ratchet::seasonFrom() const -{ - return getImpl()->seasonFrom(); -} - -bool UtilityCost_Ratchet::setSeasonFrom(const std::string& str) -{ - return getImpl()->setSeasonFrom(str); -} - -OptionalString UtilityCost_Ratchet::seasonTo() const -{ - return getImpl()->seasonTo(); -} - -bool UtilityCost_Ratchet::setSeasonTo(const std::string& str) -{ - return getImpl()->setSeasonTo(str); -} - -OptionalString UtilityCost_Ratchet::multiplierValueOrVariableName() const -{ - return getImpl()->multiplierValueOrVariableName(); -} - -bool UtilityCost_Ratchet::setMultiplierValueOrVariableName(const std::string& str) -{ - return getImpl()->setMultiplierValueOrVariableName(str); -} - -OptionalString UtilityCost_Ratchet::offsetValueOrVariableName() const -{ - return getImpl()->offsetValueOrVariableName(); -} - -bool UtilityCost_Ratchet::setOffsetValueOrVariableName(const std::string& str) -{ - return getImpl()->setOffsetValueOrVariableName(str); -} - -IddObjectType UtilityCost_Ratchet::iddObjectType() -{ - IddObjectType result(IddObjectType::OS_UtilityCost_Ratchet); - return result; -} - -} // model -} // openstudio diff --git a/openstudiocore/src/model/UtilityCost_Ratchet.hpp b/openstudiocore/src/model/UtilityCost_Ratchet.hpp deleted file mode 100644 index 40f243f1b5c..00000000000 --- a/openstudiocore/src/model/UtilityCost_Ratchet.hpp +++ /dev/null @@ -1,132 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#ifndef MODEL_UTILITYCOST_RATCHET_HPP -#define MODEL_UTILITYCOST_RATCHET_HPP - -#include "ModelAPI.hpp" -#include "ParentObject.hpp" -#include "../utilities/core/Optional.hpp" - -namespace openstudio{ -namespace model{ - -namespace detail{ - class UtilityCost_Ratchet_Impl; -} - -/** UtilityCost_Ratchet derives from ParentObject and is an interface to the OpenStudio IDD object named "OS:UtilityCost:Ratchet". - * - * UtilityCost_Ratchet allows the modeling of tariffs that include some type of seasonal ratcheting. - * Ratchets are most common when used with electric demand charges. - */ -class MODEL_API UtilityCost_Ratchet : public ParentObject{ - -public: - - /** @name Constructors and Destructors */ - //@{ - - /// Constructs a new UtilityCost_Ratchet object in the model. - explicit UtilityCost_Ratchet(const Model& model); - - virtual ~UtilityCost_Ratchet() {} - - - //@} - /** @name Getters */ - //@{ - - boost::optional tariffName() const; - - boost::optional baselineSourceVariable() const; - - boost::optional adjustmentSourceVariable() const; - - boost::optional seasonFrom() const; - - boost::optional seasonTo() const; - - boost::optional multiplierValueOrVariableName() const; - - boost::optional offsetValueOrVariableName() const; - - //@} - /** @name Setters */ - //@{ - - bool setTariffName(const std::string& tariffName); - - bool setBaselineSourceVariable(const std::string& baselineSourceVariable); - - bool setAdjustmentSourceVariable(const std::string& adjustmentSourceVariable); - - bool setSeasonFrom(const std::string& seasonFrom); - - bool setSeasonTo(const std::string& seasonTo); - - bool setMultiplierValueOrVariableName(const std::string& multiplierValueOrVariableName); - - bool setOffsetValueOrVariableName(const std::string& offsetValueOrVariableName); - - //@} - - /// Returns the IddObjectType. - static IddObjectType iddObjectType(); - -protected: - - /// @cond - - typedef detail::UtilityCost_Ratchet_Impl ImplType; - - friend class Model; - friend class IdfObject; - - // constructor - explicit UtilityCost_Ratchet(std::shared_ptr impl); - -private: - - REGISTER_LOGGER("openstudio.model.UtilityCost_Ratchet"); - - /// @endcond - -}; - -/** \relates UtilityCost_Ratchet */ -typedef boost::optional OptionalUtilityCost_Ratchet; - -/** \relates UtilityCost_Ratchet */ -typedef std::vector UtilityCost_RatchetVector; - -} // model -} // openstudio - -#endif // MODEL_UTILITYCOST_RATCHET_HPP diff --git a/openstudiocore/src/model/UtilityCost_Ratchet_Impl.hpp b/openstudiocore/src/model/UtilityCost_Ratchet_Impl.hpp deleted file mode 100644 index 5049e0e44d1..00000000000 --- a/openstudiocore/src/model/UtilityCost_Ratchet_Impl.hpp +++ /dev/null @@ -1,105 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#ifndef MODEL_UTILITYCOST_RATCHET_IMPL_HPP -#define MODEL_UTILITYCOST_RATCHET_IMPL_HPP - -#include "ParentObject_Impl.hpp" -#include "UtilityCost_Ratchet.hpp" -#include "../utilities/core/Optional.hpp" - -namespace openstudio { -namespace model { -namespace detail { - -class MODEL_API UtilityCost_Ratchet_Impl : public ParentObject_Impl{ - - public: - // constructor - UtilityCost_Ratchet_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle); - - // construct from workspace - UtilityCost_Ratchet_Impl(const openstudio::detail::WorkspaceObject_Impl& other, - Model_Impl* model, - bool keepHandle); - - // clone copy constructor - UtilityCost_Ratchet_Impl(const UtilityCost_Ratchet_Impl& other,Model_Impl* model,bool keepHandle); - - // virtual destructor - virtual ~UtilityCost_Ratchet_Impl(){} - - OptionalString tariffName() const; - bool setTariffName(const std::string& str); - - OptionalString baselineSourceVariable() const; - bool setBaselineSourceVariable(const std::string& str); - - OptionalString adjustmentSourceVariable() const; - bool setAdjustmentSourceVariable(const std::string& str); - - OptionalString seasonFrom() const; - bool setSeasonFrom(const std::string& str); - - OptionalString seasonTo() const; - bool setSeasonTo(const std::string& str); - - OptionalString multiplierValueOrVariableName() const; - bool setMultiplierValueOrVariableName(const std::string& str); - - OptionalString offsetValueOrVariableName() const; - bool setOffsetValueOrVariableName(const std::string& str); - - // return the parent object in the hierarchy - virtual boost::optional parent() const override; - - // set the parent, child may have to call methods on the parent - virtual bool setParent(ParentObject& newParent) override; - - // return any children objects in the hierarchy - virtual std::vector children() const override; - - /// get a vector of allowable children types - virtual std::vector allowableChildTypes() const override; - - // Get all output variable names that could be associated with this object. - virtual const std::vector& outputVariableNames() const override; - - virtual IddObjectType iddObjectType() const override {return UtilityCost_Ratchet::iddObjectType();} - -private: - REGISTER_LOGGER("openstudio.model.UtilityCost_Ratchet"); - -}; - -} // detail -} // model -} // openstudio - -#endif // MODEL_UTILITYCOST_RATCHET_IMPL_HPP diff --git a/openstudiocore/src/model/UtilityCost_Tariff.cpp b/openstudiocore/src/model/UtilityCost_Tariff.cpp deleted file mode 100644 index 3c52009f4df..00000000000 --- a/openstudiocore/src/model/UtilityCost_Tariff.cpp +++ /dev/null @@ -1,400 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#include "UtilityCost_Tariff.hpp" -#include "UtilityCost_Tariff_Impl.hpp" - -#include "Model_Impl.hpp" - -#include -#include - -#include "../utilities/core/Assert.hpp" - -#include - -namespace openstudio { -namespace model { -namespace detail { - -UtilityCost_Tariff_Impl::UtilityCost_Tariff_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) - : ParentObject_Impl(idfObject, model, keepHandle) -{ - OS_ASSERT(idfObject.iddObject().type() == UtilityCost_Tariff::iddObjectType()); -} - -UtilityCost_Tariff_Impl::UtilityCost_Tariff_Impl(const openstudio::detail::WorkspaceObject_Impl& other, - Model_Impl* model, - bool keepHandle) - : ParentObject_Impl(other,model,keepHandle) -{ - OS_ASSERT(other.iddObject().type() == UtilityCost_Tariff::iddObjectType()); -} - -UtilityCost_Tariff_Impl::UtilityCost_Tariff_Impl(const UtilityCost_Tariff_Impl& other,Model_Impl* model,bool keepHandle) - : ParentObject_Impl(other,model,keepHandle) -{ -} - -OptionalDouble UtilityCost_Tariff_Impl::energyConversionFactor() const -{ - return getDouble(OS_UtilityCost_TariffFields::EnergyConversionFactor); -} - -bool UtilityCost_Tariff_Impl::setEnergyConversionFactor(double num) -{ - return setDouble(OS_UtilityCost_TariffFields::EnergyConversionFactor,num);; -} - -OptionalDouble UtilityCost_Tariff_Impl::demandConversionFactor() const -{ - return getDouble(OS_UtilityCost_TariffFields::DemandConversionFactor); -} - -bool UtilityCost_Tariff_Impl::setDemandConversionFactor(double num) -{ - return setDouble(OS_UtilityCost_TariffFields::DemandConversionFactor,num);; -} - -OptionalString UtilityCost_Tariff_Impl::outputMeterName() const -{ - return getString(OS_UtilityCost_TariffFields::OutputMeterName); -} - -bool UtilityCost_Tariff_Impl::setOutputMeterName(const std::string& str) -{ - return setString(OS_UtilityCost_TariffFields::OutputMeterName,str);; -} - -OptionalString UtilityCost_Tariff_Impl::conversionFactorChoice() const -{ - return getString(OS_UtilityCost_TariffFields::ConversionFactorChoice); -} - -bool UtilityCost_Tariff_Impl::setConversionFactorChoice(const std::string& str) -{ - return setString(OS_UtilityCost_TariffFields::ConversionFactorChoice,str);; -} - -OptionalString UtilityCost_Tariff_Impl::timeOfUsePeriodScheduleName() const -{ - return getString(OS_UtilityCost_TariffFields::TimeofUsePeriodScheduleName); -} - -bool UtilityCost_Tariff_Impl::setTimeOfUsePeriodScheduleName(const std::string& str) -{ - return setString(OS_UtilityCost_TariffFields::TimeofUsePeriodScheduleName,str);; -} - -OptionalString UtilityCost_Tariff_Impl::seasonScheduleName() const -{ - return getString(OS_UtilityCost_TariffFields::SeasonScheduleName); -} - -bool UtilityCost_Tariff_Impl::setSeasonScheduleName(const std::string& str) -{ - return setString(OS_UtilityCost_TariffFields::SeasonScheduleName,str);; -} - -OptionalString UtilityCost_Tariff_Impl::monthScheduleName() const -{ - return getString(OS_UtilityCost_TariffFields::MonthScheduleName); -} - -bool UtilityCost_Tariff_Impl::setMonthScheduleName(const std::string& str) -{ - return setString(OS_UtilityCost_TariffFields::MonthScheduleName,str);; -} - -OptionalString UtilityCost_Tariff_Impl::demandWindowLength() const -{ - return getString(OS_UtilityCost_TariffFields::DemandWindowLength); -} - -bool UtilityCost_Tariff_Impl::setDemandWindowLength(const std::string& str) -{ - return setString(OS_UtilityCost_TariffFields::DemandWindowLength,str);; -} - -OptionalString UtilityCost_Tariff_Impl::monthlyChargeOrVariableName() const -{ - return getString(OS_UtilityCost_TariffFields::MonthlyChargeorVariableName); -} - -bool UtilityCost_Tariff_Impl::setMonthlyChargeOrVariableName(const std::string& str) -{ - return setString(OS_UtilityCost_TariffFields::MonthlyChargeorVariableName,str);; -} - -OptionalString UtilityCost_Tariff_Impl::minimumMonthlyChargeOrVariableName() const -{ - return getString(OS_UtilityCost_TariffFields::MinimumMonthlyChargeorVariableName); -} - -bool UtilityCost_Tariff_Impl::setMinimumMonthlyChargeOrVariableName(const std::string& str) -{ - return setString(OS_UtilityCost_TariffFields::MinimumMonthlyChargeorVariableName,str);; -} - -OptionalString UtilityCost_Tariff_Impl::realTimePricingChargeScheduleName() const -{ - return getString(OS_UtilityCost_TariffFields::RealTimePricingChargeScheduleName); -} - -bool UtilityCost_Tariff_Impl::setRealTimePricingChargeScheduleName(const std::string& str) -{ - return setString(OS_UtilityCost_TariffFields::RealTimePricingChargeScheduleName,str);; -} - -OptionalString UtilityCost_Tariff_Impl::customerBaselineLoadScheduleName() const -{ - return getString(OS_UtilityCost_TariffFields::CustomerBaselineLoadScheduleName); -} - -bool UtilityCost_Tariff_Impl::setCustomerBaselineLoadScheduleName(const std::string& str) -{ - return setString(OS_UtilityCost_TariffFields::CustomerBaselineLoadScheduleName,str);; -} - -OptionalString UtilityCost_Tariff_Impl::groupName() const -{ - return getString(OS_UtilityCost_TariffFields::GroupName); -} - -bool UtilityCost_Tariff_Impl::setGroupName(const std::string& str) -{ - return setString(OS_UtilityCost_TariffFields::GroupName,str);; -} - -OptionalString UtilityCost_Tariff_Impl::buyOrSell() const -{ - return getString(OS_UtilityCost_TariffFields::BuyOrSell); -} - -bool UtilityCost_Tariff_Impl::setBuyOrSell(const std::string& str) -{ - return setString(OS_UtilityCost_TariffFields::BuyOrSell,str);; -} - -// return the parent object in the hierarchy -boost::optional UtilityCost_Tariff_Impl::parent() const -{ - return boost::optional(); -} - -// set the parent, child may have to call methods on the parent -bool UtilityCost_Tariff_Impl::setParent(ParentObject& newParent) -{ - //if (newParent.optionalCast() && (newParent.model() == model())) { - // return true; - //} - return false; -} - -// return any children objects in the hierarchy -std::vector UtilityCost_Tariff_Impl::children() const -{ - std::vector result; - return result; -} - -std::vector UtilityCost_Tariff_Impl::allowableChildTypes() const { - IddObjectTypeVector result; - return result; -} - -// Get all output variable names that could be associated with this object. -const std::vector& UtilityCost_Tariff_Impl::outputVariableNames() const -{ - static std::vector result; - return result; -} - -} // detail - -/// constructor -UtilityCost_Tariff::UtilityCost_Tariff(const Model& model) - : ParentObject(UtilityCost_Tariff::iddObjectType(),model) -{ - OS_ASSERT(getImpl()); -} - -// constructor -UtilityCost_Tariff::UtilityCost_Tariff(std::shared_ptr impl) - : ParentObject(std::move(impl)) -{} - -OptionalDouble UtilityCost_Tariff::energyConversionFactor() const -{ - return getImpl()->energyConversionFactor(); -} - -bool UtilityCost_Tariff::setEnergyConversionFactor(double num) -{ - return getImpl()->setEnergyConversionFactor(num); -} - -OptionalDouble UtilityCost_Tariff::demandConversionFactor() const -{ - return getImpl()->demandConversionFactor(); -} - -bool UtilityCost_Tariff::setDemandConversionFactor(double num) -{ - return getImpl()->setDemandConversionFactor(num); -} - -OptionalString UtilityCost_Tariff::outputMeterName() const -{ - return getImpl()->outputMeterName(); -} - -bool UtilityCost_Tariff::setOutputMeterName(const std::string& str) -{ - return getImpl()->setOutputMeterName(str); -} - -OptionalString UtilityCost_Tariff::conversionFactorChoice() const -{ - return getImpl()->conversionFactorChoice(); -} - -bool UtilityCost_Tariff::setConversionFactorChoice(const std::string& str) -{ - return getImpl()->setConversionFactorChoice(str); -} - -OptionalString UtilityCost_Tariff::timeOfUsePeriodScheduleName() const -{ - return getImpl()->timeOfUsePeriodScheduleName(); -} - -bool UtilityCost_Tariff::setTimeOfUsePeriodScheduleName(const std::string& str) -{ - return getImpl()->setTimeOfUsePeriodScheduleName(str); -} - -OptionalString UtilityCost_Tariff::seasonScheduleName() const -{ - return getImpl()->seasonScheduleName(); -} - -bool UtilityCost_Tariff::setSeasonScheduleName(const std::string& str) -{ - return getImpl()->setSeasonScheduleName(str); -} - -OptionalString UtilityCost_Tariff::monthScheduleName() const -{ - return getImpl()->monthScheduleName(); -} - -bool UtilityCost_Tariff::setMonthScheduleName(const std::string& str) -{ - return getImpl()->setMonthScheduleName(str); -} - -OptionalString UtilityCost_Tariff::demandWindowLength() const -{ - return getImpl()->demandWindowLength(); -} - -bool UtilityCost_Tariff::setDemandWindowLength(const std::string& str) -{ - return getImpl()->setDemandWindowLength(str); -} - -OptionalString UtilityCost_Tariff::monthlyChargeOrVariableName() const -{ - return getImpl()->monthlyChargeOrVariableName(); -} - -bool UtilityCost_Tariff::setMonthlyChargeOrVariableName(const std::string& str) -{ - return getImpl()->setMonthlyChargeOrVariableName(str); -} - -OptionalString UtilityCost_Tariff::minimumMonthlyChargeOrVariableName() const -{ - return getImpl()->minimumMonthlyChargeOrVariableName(); -} - -bool UtilityCost_Tariff::setMinimumMonthlyChargeOrVariableName(const std::string& str) -{ - return getImpl()->setMinimumMonthlyChargeOrVariableName(str); -} - -OptionalString UtilityCost_Tariff::realTimePricingChargeScheduleName() const -{ - return getImpl()->realTimePricingChargeScheduleName(); -} - -bool UtilityCost_Tariff::setRealTimePricingChargeScheduleName(const std::string& str) -{ - return getImpl()->setRealTimePricingChargeScheduleName(str); -} - -OptionalString UtilityCost_Tariff::customerBaselineLoadScheduleName() const -{ - return getImpl()->customerBaselineLoadScheduleName(); -} - -bool UtilityCost_Tariff::setCustomerBaselineLoadScheduleName(const std::string& str) -{ - return getImpl()->setCustomerBaselineLoadScheduleName(str); -} - -OptionalString UtilityCost_Tariff::groupName() const -{ - return getImpl()->groupName(); -} - -bool UtilityCost_Tariff::setGroupName(const std::string& str) -{ - return getImpl()->setGroupName(str); -} - -OptionalString UtilityCost_Tariff::buyOrSell() const -{ - return getImpl()->buyOrSell(); -} - -bool UtilityCost_Tariff::setBuyOrSell(const std::string& str) -{ - return getImpl()->setBuyOrSell(str); -} - -IddObjectType UtilityCost_Tariff::iddObjectType() -{ - IddObjectType result(IddObjectType::OS_UtilityCost_Tariff); - return result; -} - -} // model -} // openstudio diff --git a/openstudiocore/src/model/UtilityCost_Tariff.hpp b/openstudiocore/src/model/UtilityCost_Tariff.hpp deleted file mode 100644 index 62c69bba71d..00000000000 --- a/openstudiocore/src/model/UtilityCost_Tariff.hpp +++ /dev/null @@ -1,157 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#ifndef MODEL_UTILITYCOST_TARIFF_HPP -#define MODEL_UTILITYCOST_TARIFF_HPP - -#include "ModelAPI.hpp" -#include "ParentObject.hpp" -#include "../utilities/core/Optional.hpp" - -namespace openstudio{ -namespace model{ - -namespace detail{ - class UtilityCost_Tariff_Impl; -} - -/** UtilityCost_Tariff derives from ParentObject and is an interface to the OpenStudio IDD object named "OS:UtilityCost:Tariff". - * - * UtilityCost_Tariff allows the modeling of utilities tariffs. - */ -class MODEL_API UtilityCost_Tariff : public ParentObject{ - -public: - - /** @name Constructors and Destructors */ - //@{ - - /// Constructs a new UtilityCost_Ratchet object in the model. - explicit UtilityCost_Tariff(const Model& model); - - virtual ~UtilityCost_Tariff() {} - - //@} - /** @name Getters */ - //@{ - - boost::optional energyConversionFactor() const; - - boost::optional demandConversionFactor() const; - - boost::optional outputMeterName() const; - - boost::optional conversionFactorChoice() const; - - boost::optional timeOfUsePeriodScheduleName() const; - - boost::optional seasonScheduleName() const; - - boost::optional monthScheduleName() const; - - boost::optional demandWindowLength() const; - - boost::optional monthlyChargeOrVariableName() const; - - boost::optional minimumMonthlyChargeOrVariableName() const; - - boost::optional realTimePricingChargeScheduleName() const; - - boost::optional customerBaselineLoadScheduleName() const; - - boost::optional groupName() const; - - boost::optional buyOrSell() const; - - //@} - /** @name Setters */ - //@{ - - bool setEnergyConversionFactor(double energyConversionFactor); - - bool setDemandConversionFactor(double demandConversionFactor); - - bool setOutputMeterName(const std::string& outputMeterName); - - bool setConversionFactorChoice(const std::string& conversionFactorChoice); - - bool setTimeOfUsePeriodScheduleName(const std::string& timeOfUsePeriodScheduleName); - - bool setSeasonScheduleName(const std::string& seasonScheduleName); - - bool setMonthScheduleName(const std::string& monthScheduleName); - - bool setDemandWindowLength(const std::string& demandWindowLength); - - bool setMonthlyChargeOrVariableName(const std::string& monthlyChargeOrVariableName); - - bool setMinimumMonthlyChargeOrVariableName(const std::string& minimumMonthlyChargeOrVariableName); - - bool setRealTimePricingChargeScheduleName(const std::string& realTimePricingChargeScheduleName); - - bool setCustomerBaselineLoadScheduleName(const std::string& customerBaselineLoadScheduleName); - - bool setGroupName(const std::string& groupName); - - bool setBuyOrSell(const std::string& buyOrSell); - - //@} - - /// Returns the IddObjectType. - static IddObjectType iddObjectType(); - -protected: - - /// @cond - typedef detail::UtilityCost_Tariff_Impl ImplType; - - friend class Model; - friend class IdfObject; - - // constructor - explicit UtilityCost_Tariff(std::shared_ptr impl); - -private: - - REGISTER_LOGGER("openstudio.model.UtilityCost_Tariff"); - - /// @endcond - -}; - -/** \relates UtilityCost_Tariff */ -typedef boost::optional OptionalUtilityCost_Tariff; - -/** \relates UtilityCost_Tariff */ -typedef std::vector UtilityCost_TariffVector; - -} // model -} // openstudio - -#endif // MODEL_UTILITYCOST_TARIFF_HPP diff --git a/openstudiocore/src/model/UtilityCost_Tariff_Impl.hpp b/openstudiocore/src/model/UtilityCost_Tariff_Impl.hpp deleted file mode 100644 index eae05b03541..00000000000 --- a/openstudiocore/src/model/UtilityCost_Tariff_Impl.hpp +++ /dev/null @@ -1,126 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#ifndef MODEL_UTILITYCOST_TARIFF_IMPL_HPP -#define MODEL_UTILITYCOST_TARIFF_IMPL_HPP - -#include "ParentObject_Impl.hpp" -#include "UtilityCost_Tariff.hpp" -#include "../utilities/core/Optional.hpp" - -namespace openstudio { -namespace model { -namespace detail { - -class MODEL_API UtilityCost_Tariff_Impl : public ParentObject_Impl{ - - public: - // constructor - UtilityCost_Tariff_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle); - - // construct from workspace - UtilityCost_Tariff_Impl(const openstudio::detail::WorkspaceObject_Impl& other, - Model_Impl* model, - bool keepHandle); - - // clone copy constructor - UtilityCost_Tariff_Impl(const UtilityCost_Tariff_Impl& other,Model_Impl* model,bool keepHandle); - - // virtual destructor - virtual ~UtilityCost_Tariff_Impl(){} - - boost::optional energyConversionFactor() const; - bool setEnergyConversionFactor(double num); - - boost::optional demandConversionFactor() const; - bool setDemandConversionFactor(double num); - - OptionalString outputMeterName() const; - bool setOutputMeterName(const std::string& str); - - OptionalString conversionFactorChoice() const; - bool setConversionFactorChoice(const std::string& str); - - OptionalString timeOfUsePeriodScheduleName() const; - bool setTimeOfUsePeriodScheduleName(const std::string& str); - - OptionalString seasonScheduleName() const; - bool setSeasonScheduleName(const std::string& str); - - OptionalString monthScheduleName() const; - bool setMonthScheduleName(const std::string& str); - - OptionalString demandWindowLength() const; - bool setDemandWindowLength(const std::string& str); - - OptionalString monthlyChargeOrVariableName() const; - bool setMonthlyChargeOrVariableName(const std::string& str); - - OptionalString minimumMonthlyChargeOrVariableName() const; - bool setMinimumMonthlyChargeOrVariableName(const std::string& str); - - OptionalString realTimePricingChargeScheduleName() const; - bool setRealTimePricingChargeScheduleName(const std::string& str); - - OptionalString customerBaselineLoadScheduleName() const; - bool setCustomerBaselineLoadScheduleName(const std::string& str); - - OptionalString groupName() const; - bool setGroupName(const std::string& str); - - OptionalString buyOrSell() const; - bool setBuyOrSell(const std::string& str); - - // return the parent object in the hierarchy - virtual boost::optional parent() const override; - - // set the parent, child may have to call methods on the parent - virtual bool setParent(ParentObject& newParent) override; - - // return any children objects in the hierarchy - virtual std::vector children() const override; - - /// get a vector of allowable children types - virtual std::vector allowableChildTypes() const override; - - // Get all output variable names that could be associated with this object. - virtual const std::vector& outputVariableNames() const override; - - virtual IddObjectType iddObjectType() const override {return UtilityCost_Tariff::iddObjectType();} - -private: - REGISTER_LOGGER("openstudio.model.UtilityCost_Tariff"); - -}; - -} // detail -} // model -} // openstudio - -#endif // MODEL_UTILITYCOST_TARIFF_IMPL_HPP diff --git a/openstudiocore/src/model/UtilityCost_Variable.cpp b/openstudiocore/src/model/UtilityCost_Variable.cpp deleted file mode 100644 index 772785d5b60..00000000000 --- a/openstudiocore/src/model/UtilityCost_Variable.cpp +++ /dev/null @@ -1,400 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#include "UtilityCost_Variable.hpp" -#include "UtilityCost_Variable_Impl.hpp" - -#include "Model_Impl.hpp" - -#include -#include - -#include "../utilities/core/Assert.hpp" - -#include - -namespace openstudio { -namespace model { -namespace detail { - -UtilityCost_Variable_Impl::UtilityCost_Variable_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) - : ParentObject_Impl(idfObject, model, keepHandle) -{ - OS_ASSERT(idfObject.iddObject().type() == UtilityCost_Variable::iddObjectType()); -} - -UtilityCost_Variable_Impl::UtilityCost_Variable_Impl(const openstudio::detail::WorkspaceObject_Impl& other, - Model_Impl* model, - bool keepHandle) - : ParentObject_Impl(other,model,keepHandle) -{ - OS_ASSERT(other.iddObject().type() == UtilityCost_Variable::iddObjectType()); -} - -UtilityCost_Variable_Impl::UtilityCost_Variable_Impl(const UtilityCost_Variable_Impl& other,Model_Impl* model,bool keepHandle) - : ParentObject_Impl(other,model,keepHandle) -{ -} - -OptionalDouble UtilityCost_Variable_Impl::januaryValue() const -{ - return getDouble(OS_UtilityCost_VariableFields::JanuaryValue); -} - -bool UtilityCost_Variable_Impl::setJanuaryValue(double num) -{ - return setDouble(OS_UtilityCost_VariableFields::JanuaryValue,num);; -} - -OptionalDouble UtilityCost_Variable_Impl::februaryValue() const -{ - return getDouble(OS_UtilityCost_VariableFields::FebruaryValue); -} - -bool UtilityCost_Variable_Impl::setFebruaryValue(double num) -{ - return setDouble(OS_UtilityCost_VariableFields::FebruaryValue,num);; -} - -OptionalDouble UtilityCost_Variable_Impl::marchValue() const -{ - return getDouble(OS_UtilityCost_VariableFields::MarchValue); -} - -bool UtilityCost_Variable_Impl::setMarchValue(double num) -{ - return setDouble(OS_UtilityCost_VariableFields::MarchValue,num);; -} - -OptionalDouble UtilityCost_Variable_Impl::aprilValue() const -{ - return getDouble(OS_UtilityCost_VariableFields::AprilValue); -} - -bool UtilityCost_Variable_Impl::setAprilValue(double num) -{ - return setDouble(OS_UtilityCost_VariableFields::AprilValue,num);; -} - -OptionalDouble UtilityCost_Variable_Impl::mayValue() const -{ - return getDouble(OS_UtilityCost_VariableFields::MayValue); -} - -bool UtilityCost_Variable_Impl::setMayValue(double num) -{ - return setDouble(OS_UtilityCost_VariableFields::MayValue,num);; -} - -OptionalDouble UtilityCost_Variable_Impl::juneValue() const -{ - return getDouble(OS_UtilityCost_VariableFields::JuneValue); -} - -bool UtilityCost_Variable_Impl::setJuneValue(double num) -{ - return setDouble(OS_UtilityCost_VariableFields::JuneValue,num);; -} - -OptionalDouble UtilityCost_Variable_Impl::julyValue() const -{ - return getDouble(OS_UtilityCost_VariableFields::JulyValue); -} - -bool UtilityCost_Variable_Impl::setJulyValue(double num) -{ - return setDouble(OS_UtilityCost_VariableFields::JulyValue,num);; -} - -OptionalDouble UtilityCost_Variable_Impl::augustValue() const -{ - return getDouble(OS_UtilityCost_VariableFields::AugustValue); -} - -bool UtilityCost_Variable_Impl::setAugustValue(double num) -{ - return setDouble(OS_UtilityCost_VariableFields::AugustValue,num);; -} - -OptionalDouble UtilityCost_Variable_Impl::septemberValue() const -{ - return getDouble(OS_UtilityCost_VariableFields::SeptemberValue); -} - -bool UtilityCost_Variable_Impl::setSeptemberValue(double num) -{ - return setDouble(OS_UtilityCost_VariableFields::SeptemberValue,num);; -} - -OptionalDouble UtilityCost_Variable_Impl::octoberValue() const -{ - return getDouble(OS_UtilityCost_VariableFields::OctoberValue); -} - -bool UtilityCost_Variable_Impl::setOctoberValue(double num) -{ - return setDouble(OS_UtilityCost_VariableFields::OctoberValue,num);; -} - -OptionalDouble UtilityCost_Variable_Impl::novemberValue() const -{ - return getDouble(OS_UtilityCost_VariableFields::NovemberValue); -} - -bool UtilityCost_Variable_Impl::setNovemberValue(double num) -{ - return setDouble(OS_UtilityCost_VariableFields::NovemberValue,num);; -} - -OptionalDouble UtilityCost_Variable_Impl::decemberValue() const -{ - return getDouble(OS_UtilityCost_VariableFields::DecemberValue); -} - -bool UtilityCost_Variable_Impl::setDecemberValue(double num) -{ - return setDouble(OS_UtilityCost_VariableFields::DecemberValue,num);; -} - -OptionalString UtilityCost_Variable_Impl::tariffName() const -{ - return getString(OS_UtilityCost_VariableFields::TariffName); -} - -bool UtilityCost_Variable_Impl::setTariffName(const std::string& str) -{ - return setString(OS_UtilityCost_VariableFields::TariffName,str);; -} - -OptionalString UtilityCost_Variable_Impl::variableType() const -{ - return getString(OS_UtilityCost_VariableFields::VariableType); -} - -bool UtilityCost_Variable_Impl::setVariableType(const std::string& str) -{ - return setString(OS_UtilityCost_VariableFields::VariableType,str);; -} - -// return the parent object in the hierarchy -boost::optional UtilityCost_Variable_Impl::parent() const -{ - return boost::optional(); -} - -// set the parent, child may have to call methods on the parent -bool UtilityCost_Variable_Impl::setParent(ParentObject& newParent) -{ - //if (newParent.optionalCast() && (newParent.model() == model())) { - // return true; - //} - return false; -} - -// return any children objects in the hierarchy -std::vector UtilityCost_Variable_Impl::children() const -{ - std::vector result; - return result; -} - -std::vector UtilityCost_Variable_Impl::allowableChildTypes() const { - IddObjectTypeVector result; - return result; -} - -// Get all output variable names that could be associated with this object. -const std::vector& UtilityCost_Variable_Impl::outputVariableNames() const -{ - static std::vector result; - return result; -} - -} // detail - -/// constructor -UtilityCost_Variable::UtilityCost_Variable(const Model& model) - : ParentObject(UtilityCost_Variable::iddObjectType(),model) -{ - OS_ASSERT(getImpl()); -} - -// constructor -UtilityCost_Variable::UtilityCost_Variable(std::shared_ptr impl) - : ParentObject(std::move(impl)) -{} - -OptionalDouble UtilityCost_Variable::januaryValue() const -{ - return getImpl()->januaryValue(); -} - -bool UtilityCost_Variable::setJanuaryValue(double num) -{ - return getImpl()->setJanuaryValue(num); -} - -OptionalDouble UtilityCost_Variable::februaryValue() const -{ - return getImpl()->februaryValue(); -} - -bool UtilityCost_Variable::setFebruaryValue(double num) -{ - return getImpl()->setFebruaryValue(num); -} - -OptionalDouble UtilityCost_Variable::marchValue() const -{ - return getImpl()->marchValue(); -} - -bool UtilityCost_Variable::setMarchValue(double num) -{ - return getImpl()->setMarchValue(num); -} - -OptionalDouble UtilityCost_Variable::aprilValue() const -{ - return getImpl()->aprilValue(); -} - -bool UtilityCost_Variable::setAprilValue(double num) -{ - return getImpl()->setAprilValue(num); -} - -OptionalDouble UtilityCost_Variable::mayValue() const -{ - return getImpl()->mayValue(); -} - -bool UtilityCost_Variable::setMayValue(double num) -{ - return getImpl()->setMayValue(num); -} - -OptionalDouble UtilityCost_Variable::juneValue() const -{ - return getImpl()->juneValue(); -} - -bool UtilityCost_Variable::setJuneValue(double num) -{ - return getImpl()->setJuneValue(num); -} - -OptionalDouble UtilityCost_Variable::julyValue() const -{ - return getImpl()->julyValue(); -} - -bool UtilityCost_Variable::setJulyValue(double num) -{ - return getImpl()->setJulyValue(num); -} - -OptionalDouble UtilityCost_Variable::augustValue() const -{ - return getImpl()->augustValue(); -} - -bool UtilityCost_Variable::setAugustValue(double num) -{ - return getImpl()->setAugustValue(num); -} - -OptionalDouble UtilityCost_Variable::septemberValue() const -{ - return getImpl()->septemberValue(); -} - -bool UtilityCost_Variable::setSeptemberValue(double num) -{ - return getImpl()->setSeptemberValue(num); -} - -OptionalDouble UtilityCost_Variable::octoberValue() const -{ - return getImpl()->octoberValue(); -} - -bool UtilityCost_Variable::setOctoberValue(double num) -{ - return getImpl()->setOctoberValue(num); -} - -OptionalDouble UtilityCost_Variable::novemberValue() const -{ - return getImpl()->novemberValue(); -} - -bool UtilityCost_Variable::setNovemberValue(double num) -{ - return getImpl()->setNovemberValue(num); -} - -OptionalDouble UtilityCost_Variable::decemberValue() const -{ - return getImpl()->decemberValue(); -} - -bool UtilityCost_Variable::setDecemberValue(double num) -{ - return getImpl()->setDecemberValue(num); -} - -OptionalString UtilityCost_Variable::tariffName() const -{ - return getImpl()->tariffName(); -} - -bool UtilityCost_Variable::setTariffName(const std::string& str) -{ - return getImpl()->setTariffName(str); -} - -OptionalString UtilityCost_Variable::variableType() const -{ - return getImpl()->variableType(); -} - -bool UtilityCost_Variable::setVariableType(const std::string& str) -{ - return getImpl()->setVariableType(str); -} - -IddObjectType UtilityCost_Variable::iddObjectType() -{ - IddObjectType result(IddObjectType::OS_UtilityCost_Variable); - return result; -} - -} // model -} // openstudio diff --git a/openstudiocore/src/model/UtilityCost_Variable.hpp b/openstudiocore/src/model/UtilityCost_Variable.hpp deleted file mode 100644 index f4bf6c359b3..00000000000 --- a/openstudiocore/src/model/UtilityCost_Variable.hpp +++ /dev/null @@ -1,159 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#ifndef MODEL_UTILITYCOST_VARIABLE_HPP -#define MODEL_UTILITYCOST_VARIABLE_HPP - -#include "ModelAPI.hpp" -#include "ParentObject.hpp" -#include "../utilities/core/Optional.hpp" - -namespace openstudio{ -namespace model{ - -namespace detail{ - class UtilityCost_Variable_Impl; -} - -/** UtilityCost_Variable derives from ParentObject and is an interface to the OpenStudio IDD object named "OS:UtilityCost:Variable". - * - * UtilityCost_Variable allows for the direct entry of monthly values into a variable. - */ -class MODEL_API UtilityCost_Variable : public ParentObject{ - -public: - - /** @name Constructors and Destructors */ - //@{ - - /// Constructs a new UtilityCost_Variable object in the model. - explicit UtilityCost_Variable(const Model& model); - - virtual ~UtilityCost_Variable() {} - - - //@} - /** @name Getters */ - //@{ - - boost::optional januaryValue() const; - - boost::optional februaryValue() const; - - boost::optional marchValue() const; - - boost::optional aprilValue() const; - - boost::optional mayValue() const; - - boost::optional juneValue() const; - - boost::optional julyValue() const; - - boost::optional augustValue() const; - - boost::optional septemberValue() const; - - boost::optional octoberValue() const; - - boost::optional novemberValue() const; - - boost::optional decemberValue() const; - - boost::optional tariffName() const; - - boost::optional variableType() const; - - //@} - /** @name Setters */ - //@{ - - bool setJanuaryValue(double januaryValue); - - bool setFebruaryValue(double februaryValue); - - bool setMarchValue(double marchValue); - - bool setAprilValue(double aprilValue); - - bool setMayValue(double mayValue); - - bool setJuneValue(double juneValue); - - bool setJulyValue(double julyValue); - - bool setAugustValue(double augustValue); - - bool setSeptemberValue(double septemberValue); - - bool setOctoberValue(double octoberValue); - - bool setNovemberValue(double novemberValue); - - bool setDecemberValue(double decemberValue); - - bool setTariffName(const std::string& tariffName); - - bool setVariableType(const std::string& variableType); - - //@} - - /// Returns the IddObjectType. - static IddObjectType iddObjectType(); - -protected: - - /// @cond - - typedef detail::UtilityCost_Variable_Impl ImplType; - - friend class Model; - friend class IdfObject; - - // constructor - explicit UtilityCost_Variable(std::shared_ptr impl); - -private: - - REGISTER_LOGGER("openstudio.model.UtilityCost_Variable"); - - /// @endcond - -}; - -/** \relates UtilityCost_Variable */ -typedef boost::optional OptionalUtilityCost_Variable; - -/** \relates UtilityCost_Variable */ -typedef std::vector UtilityCost_VariableVector; - -} // model -} // openstudio - -#endif // MODEL_UTILITYCOST_VARIABLE_HPP diff --git a/openstudiocore/src/model/UtilityCost_Variable_Impl.hpp b/openstudiocore/src/model/UtilityCost_Variable_Impl.hpp deleted file mode 100644 index 04ef9d5c169..00000000000 --- a/openstudiocore/src/model/UtilityCost_Variable_Impl.hpp +++ /dev/null @@ -1,126 +0,0 @@ -/*********************************************************************************************************************** -* OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -* following conditions are met: -* -* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following -* disclaimer. -* -* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided with the distribution. -* -* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products -* derived from this software without specific prior written permission from the respective party. -* -* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works -* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior -* written permission from Alliance for Sustainable Energy, LLC. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED -* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***********************************************************************************************************************/ - -#ifndef MODEL_UTILITYCOST_VARIABLE_IMPL_HPP -#define MODEL_UTILITYCOST_VARIABLE_IMPL_HPP - -#include "ParentObject_Impl.hpp" -#include "UtilityCost_Variable.hpp" -#include "../utilities/core/Optional.hpp" - -namespace openstudio { -namespace model { -namespace detail { - -class MODEL_API UtilityCost_Variable_Impl : public ParentObject_Impl{ - - public: - // constructor - UtilityCost_Variable_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle); - - // construct from workspace - UtilityCost_Variable_Impl(const openstudio::detail::WorkspaceObject_Impl& other, - Model_Impl* model, - bool keepHandle); - - // clone copy constructor - UtilityCost_Variable_Impl(const UtilityCost_Variable_Impl& other,Model_Impl* model,bool keepHandle); - - // virtual destructor - virtual ~UtilityCost_Variable_Impl(){} - - boost::optional januaryValue() const; - bool setJanuaryValue(double num); - - boost::optional februaryValue() const; - bool setFebruaryValue(double num); - - boost::optional marchValue() const; - bool setMarchValue(double num); - - boost::optional aprilValue() const; - bool setAprilValue(double num); - - boost::optional mayValue() const; - bool setMayValue(double num); - - boost::optional juneValue() const; - bool setJuneValue(double num); - - boost::optional julyValue() const; - bool setJulyValue(double num); - - boost::optional augustValue() const; - bool setAugustValue(double num); - - boost::optional septemberValue() const; - bool setSeptemberValue(double num); - - boost::optional octoberValue() const; - bool setOctoberValue(double num); - - boost::optional novemberValue() const; - bool setNovemberValue(double num); - - boost::optional decemberValue() const; - bool setDecemberValue(double num); - - OptionalString tariffName() const; - bool setTariffName(const std::string& str); - - OptionalString variableType() const; - bool setVariableType(const std::string& str); - - // return the parent object in the hierarchy - virtual boost::optional parent() const override; - - // set the parent, child may have to call methods on the parent - virtual bool setParent(ParentObject& newParent) override; - - // return any children objects in the hierarchy - virtual std::vector children() const override; - - /// get a vector of allowable children types - virtual std::vector allowableChildTypes() const override; - - // Get all output variable names that could be associated with this object. - virtual const std::vector& outputVariableNames() const override; - - virtual IddObjectType iddObjectType() const override {return UtilityCost_Variable::iddObjectType();} - -private: - REGISTER_LOGGER("openstudio.model.UtilityCost_Variable"); - -}; - -} // detail -} // model -} // openstudio - -#endif // MODEL_UTILITYCOST_VARIABLE_IMPL_HPP diff --git a/openstudiocore/src/model/mainpage.hpp b/openstudiocore/src/model/mainpage.hpp index 57851ddd0ef..7d582025e9a 100644 --- a/openstudiocore/src/model/mainpage.hpp +++ b/openstudiocore/src/model/mainpage.hpp @@ -130,8 +130,8 @@ namespace model { * * \subsection economics_classes Economics * - * This subsection of the model is not fully developed. Classes like ComponentCost_LineItem, - * and UtilityCost_Tariff are available, but we expect to do a full refactor of this area of + * This subsection of the model is not fully developed. Classes like ComponentCost_LineItem + * are available, but we expect to do a full refactor of this area of * the model as time allows. * * \subsection standards_classes Standards @@ -920,15 +920,6 @@ namespace model { *
  • LifeCycleCost_Parameters (ParentObject) *
  • ComponentCost_Adjustments (ParentObject) *
  • ComponentCost_Reference (ParentObject) - *
  • UtilityCost_Tariff (ParentObject) - *
      - *
    • UtilityCost_Qualify (ParentObject) - *
    • UtilityCost_Charge_Simple (ParentObject) - *
    • UtilityCost_Charge_Block (ParentObject) - *
    • UtilityCost_Ratchet (ParentObject) - *
    • UtilityCost_Variable (ParentObject) - *
    • UtilityCost_Computation (ParentObject) - *
    * * * Special Cases that can be Parented by many \link ModelObject ModelObjects \endlink diff --git a/openstudiocore/src/model/test/DefaultConstructionSet_GTest.cpp b/openstudiocore/src/model/test/DefaultConstructionSet_GTest.cpp index 6209ccf8c6c..e034d00e3e3 100644 --- a/openstudiocore/src/model/test/DefaultConstructionSet_GTest.cpp +++ b/openstudiocore/src/model/test/DefaultConstructionSet_GTest.cpp @@ -126,6 +126,13 @@ TEST_F(ModelFixture, DefaultConstructionSet) EXPECT_EQ(construction.handle(), defaultConstructionSet.siteShadingConstruction()->handle()); defaultConstructionSet.resetSiteShadingConstruction(); EXPECT_FALSE(defaultConstructionSet.siteShadingConstruction()); + + EXPECT_FALSE(defaultConstructionSet.adiabaticSurfaceConstruction()); + EXPECT_TRUE(defaultConstructionSet.setAdiabaticSurfaceConstruction(construction)); + ASSERT_TRUE(defaultConstructionSet.adiabaticSurfaceConstruction()); + EXPECT_EQ(construction.handle(), defaultConstructionSet.adiabaticSurfaceConstruction()->handle()); + defaultConstructionSet.resetAdiabaticSurfaceConstruction(); + EXPECT_FALSE(defaultConstructionSet.adiabaticSurfaceConstruction()); } TEST_F(ModelFixture, DefaultConstructionSet_ExteriorSurfaces) @@ -478,6 +485,33 @@ TEST_F(ModelFixture, DefaultConstructionSet_ShadingSurface) EXPECT_FALSE(defaultConstructionSet.getDefaultConstruction(surface)); } +TEST_F(ModelFixture, DefaultConstructionSet_AdiabaticSurface) +{ + Model model; + + Point3dVector points; + points.push_back(Point3d(0,1,0)); + points.push_back(Point3d(0,0,0)); + points.push_back(Point3d(1,0,0)); + Space space(model); + Surface surface(points, model); + surface.setSpace(space); + EXPECT_TRUE(surface.setOutsideBoundaryCondition("Adiabatic")); + + DefaultConstructionSet defaultConstructionSet(model); + Construction construction(model); + + EXPECT_FALSE(defaultConstructionSet.adiabaticSurfaceConstruction()); + EXPECT_FALSE(defaultConstructionSet.getDefaultConstruction(surface)); + EXPECT_TRUE(defaultConstructionSet.setAdiabaticSurfaceConstruction(construction)); + ASSERT_TRUE(defaultConstructionSet.adiabaticSurfaceConstruction()); + EXPECT_EQ(construction.handle(), defaultConstructionSet.adiabaticSurfaceConstruction()->handle()); + ASSERT_TRUE(defaultConstructionSet.getDefaultConstruction(surface)); + EXPECT_EQ(construction.handle(), defaultConstructionSet.getDefaultConstruction(surface)->handle()); + defaultConstructionSet.resetAdiabaticSurfaceConstruction(); + EXPECT_FALSE(defaultConstructionSet.getDefaultConstruction(surface)); +} + TEST_F(ModelFixture, DefaultConstructionSet_Clone) { diff --git a/openstudiocore/src/openstudio_lib/DefaultConstructionSetInspectorView.cpp b/openstudiocore/src/openstudio_lib/DefaultConstructionSetInspectorView.cpp index 981f972b9e6..9dbf67fafec 100644 --- a/openstudiocore/src/openstudio_lib/DefaultConstructionSetInspectorView.cpp +++ b/openstudiocore/src/openstudio_lib/DefaultConstructionSetInspectorView.cpp @@ -949,6 +949,53 @@ void SiteShadingVC::onDrop(const OSItemId& itemId) } } + +// AdiabaticSurfaceVC + +void AdiabaticSurfaceVC::onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle) +{ + if (index == OS_DefaultConstructionSetFields::AdiabaticSurfaceConstructionName){ + emit itemIds(makeVector()); + } +} + +std::vector AdiabaticSurfaceVC::makeVector() +{ + std::vector result; + if (m_modelObject){ + model::DefaultConstructionSet defaultConstructionSet = m_modelObject->cast(); + boost::optional constructionBase = defaultConstructionSet.adiabaticSurfaceConstruction(); + if (constructionBase){ + result.push_back(modelObjectToItemId(*constructionBase, false)); + } + } + return result; +} + +void AdiabaticSurfaceVC::onRemoveItem(OSItem* item) +{ + if (m_modelObject){ + model::DefaultConstructionSet defaultConstructionSet = m_modelObject->cast(); + defaultConstructionSet.resetAdiabaticSurfaceConstruction(); + } +} + +void AdiabaticSurfaceVC::onReplaceItem(OSItem * currentItem, const OSItemId& replacementItemId) +{ + onDrop(replacementItemId); +} + +void AdiabaticSurfaceVC::onDrop(const OSItemId& itemId) +{ + if (m_modelObject){ + model::DefaultConstructionSet defaultConstructionSet = m_modelObject->cast(); + boost::optional constructionBase = this->addToModel(itemId); + if (constructionBase){ + defaultConstructionSet.setAdiabaticSurfaceConstruction(*constructionBase); + } + } +} + DefaultConstructionSetInspectorView::DefaultConstructionSetInspectorView(const model::Model& model, QWidget * parent) : ModelObjectInspectorView(model, true, parent), @@ -978,6 +1025,7 @@ DefaultConstructionSetInspectorView::DefaultConstructionSetInspectorView(const m m_spaceShadingDZ(nullptr), m_buildingShadingDZ(nullptr), m_siteShadingDZ(nullptr), + m_adiabaticSurfaceDZ(nullptr), m_exteriorWallConstructionVC(nullptr), m_exteriorFloorConstructionVC(nullptr), @@ -1003,6 +1051,7 @@ DefaultConstructionSetInspectorView::DefaultConstructionSetInspectorView(const m m_spaceShadingVC(nullptr), m_buildingShadingVC(nullptr), m_siteShadingVC(nullptr), + m_adiabaticSurfaceVC(nullptr), m_vectorControllers(std::vector()), m_dropZones(std::vector()) @@ -1419,7 +1468,18 @@ DefaultConstructionSetInspectorView::DefaultConstructionSetInspectorView(const m gridLayout->addWidget(label,row,leftCol); gridLayout->addWidget(m_interiorPartitionsDZ,row+1,leftCol); - OS_ASSERT(m_vectorControllers.size() == 24); + label = new QLabel(); + label->setText("Adiabatic Surfaces"); + label->setObjectName("H2"); + //label->setContentsMargins(padding,0,padding,0); + m_adiabaticSurfaceVC = new AdiabaticSurfaceVC(); + m_vectorControllers.push_back(m_adiabaticSurfaceVC); + m_adiabaticSurfaceDZ = new OSDropZone(m_adiabaticSurfaceVC); + m_dropZones.push_back(m_adiabaticSurfaceDZ); + gridLayout->addWidget(label, row, middleCol); + gridLayout->addWidget(m_adiabaticSurfaceDZ, row+1, middleCol); + + OS_ASSERT(m_vectorControllers.size() == 25); configDropZones(); @@ -1615,6 +1675,9 @@ void DefaultConstructionSetInspectorView::attach(openstudio::model::DefaultConst m_siteShadingVC->attach(defaultConstructionSet); m_siteShadingVC->reportItems(); + m_adiabaticSurfaceVC->attach(defaultConstructionSet); + m_adiabaticSurfaceVC->reportItems(); + m_defaultConstructionSet = defaultConstructionSet; // m_nameEdit->bind(defaultConstructionSet, "name"); diff --git a/openstudiocore/src/openstudio_lib/DefaultConstructionSetInspectorView.hpp b/openstudiocore/src/openstudio_lib/DefaultConstructionSetInspectorView.hpp index 94f151a56c8..a99199bf999 100644 --- a/openstudiocore/src/openstudio_lib/DefaultConstructionSetInspectorView.hpp +++ b/openstudiocore/src/openstudio_lib/DefaultConstructionSetInspectorView.hpp @@ -266,6 +266,21 @@ class SiteShadingVC : public ModelObjectVectorController virtual void onDrop(const OSItemId& itemId) override; }; +class AdiabaticSurfaceVC : public ModelObjectVectorController +{ + Q_OBJECT + +public: + virtual ~AdiabaticSurfaceVC() {} + +protected: + virtual void onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle) override; + virtual std::vector makeVector() override; + virtual void onRemoveItem(OSItem* item) override; + virtual void onReplaceItem(OSItem * currentItem, const OSItemId& replacementItemId) override; + virtual void onDrop(const OSItemId& itemId) override; +}; + class DefaultConstructionSetInspectorView : public ModelObjectInspectorView { Q_OBJECT @@ -311,6 +326,7 @@ class DefaultConstructionSetInspectorView : public ModelObjectInspectorView OSDropZone * m_spaceShadingDZ; OSDropZone * m_buildingShadingDZ; OSDropZone * m_siteShadingDZ; + OSDropZone * m_adiabaticSurfaceDZ; WallConstructionVC * m_exteriorWallConstructionVC; FloorConstructionVC * m_exteriorFloorConstructionVC; @@ -336,6 +352,7 @@ class DefaultConstructionSetInspectorView : public ModelObjectInspectorView SpaceShadingVC * m_spaceShadingVC; BuildingShadingVC * m_buildingShadingVC; SiteShadingVC * m_siteShadingVC; + AdiabaticSurfaceVC * m_adiabaticSurfaceVC; std::vector m_vectorControllers; std::vector m_dropZones; diff --git a/openstudiocore/src/sdd/ForwardTranslator.cpp b/openstudiocore/src/sdd/ForwardTranslator.cpp index b62191d52ce..babeb45afe9 100644 --- a/openstudiocore/src/sdd/ForwardTranslator.cpp +++ b/openstudiocore/src/sdd/ForwardTranslator.cpp @@ -121,13 +121,16 @@ #include "../model/DesignDay.hpp" #include "../model/WeatherFileConditionType.hpp" #include "../model/WeatherFileDays.hpp" -#include "../model/UtilityCost_Charge_Block.hpp" -#include "../model/UtilityCost_Charge_Simple.hpp" -#include "../model/UtilityCost_Computation.hpp" -#include "../model/UtilityCost_Qualify.hpp" -#include "../model/UtilityCost_Ratchet.hpp" -#include "../model/UtilityCost_Tariff.hpp" -#include "../model/UtilityCost_Variable.hpp" + +// TODO: once UtilityCost objects are wrapped +// #include "../model/UtilityCost_Charge_Block.hpp" +// #include "../model/UtilityCost_Charge_Simple.hpp" +// #include "../model/UtilityCost_Computation.hpp" +// #include "../model/UtilityCost_Qualify.hpp" +// #include "../model/UtilityCost_Ratchet.hpp" +// #include "../model/UtilityCost_Tariff.hpp" +// #include "../model/UtilityCost_Variable.hpp" + #include "../model/ProgramControl.hpp" #include "../model/RadianceParameters.hpp" #include "../model/ShadowCalculation.hpp" @@ -553,13 +556,6 @@ namespace sdd { m_ignoreTypes.push_back(model::TableMultiVariableLookup::iddObjectType()); m_ignoreTypes.push_back(model::Timestep::iddObjectType()); m_ignoreTypes.push_back(model::UtilityBill::iddObjectType()); - m_ignoreTypes.push_back(model::UtilityCost_Charge_Block::iddObjectType()); - m_ignoreTypes.push_back(model::UtilityCost_Charge_Simple::iddObjectType()); - m_ignoreTypes.push_back(model::UtilityCost_Computation::iddObjectType()); - m_ignoreTypes.push_back(model::UtilityCost_Qualify::iddObjectType()); - m_ignoreTypes.push_back(model::UtilityCost_Ratchet::iddObjectType()); - m_ignoreTypes.push_back(model::UtilityCost_Tariff::iddObjectType()); - m_ignoreTypes.push_back(model::UtilityCost_Variable::iddObjectType()); m_ignoreTypes.push_back(model::Version::iddObjectType()); m_ignoreTypes.push_back(model::WeatherFile::iddObjectType()); m_ignoreTypes.push_back(model::WeatherFileConditionType::iddObjectType()); @@ -570,6 +566,15 @@ namespace sdd { m_ignoreTypes.push_back(model::ZoneCapacitanceMultiplierResearchSpecial::iddObjectType()); m_ignoreTypes.push_back(model::ZoneHVACEquipmentList::iddObjectType()); + // TODO: once UtilityCost objects are wrapped + //m_ignoreTypes.push_back(model::UtilityCost_Charge_Block::iddObjectType()); + //m_ignoreTypes.push_back(model::UtilityCost_Charge_Simple::iddObjectType()); + //m_ignoreTypes.push_back(model::UtilityCost_Computation::iddObjectType()); + //m_ignoreTypes.push_back(model::UtilityCost_Qualify::iddObjectType()); + //m_ignoreTypes.push_back(model::UtilityCost_Ratchet::iddObjectType()); + //m_ignoreTypes.push_back(model::UtilityCost_Tariff::iddObjectType()); + //m_ignoreTypes.push_back(model::UtilityCost_Variable::iddObjectType()); + return doc; } diff --git a/openstudiocore/src/utilities/core/PathHelpers.cpp b/openstudiocore/src/utilities/core/PathHelpers.cpp index 41726376669..c7693ce29e0 100644 --- a/openstudiocore/src/utilities/core/PathHelpers.cpp +++ b/openstudiocore/src/utilities/core/PathHelpers.cpp @@ -109,11 +109,7 @@ path setFileExtension(const path& p, { path result(p); path wext = toPath(ext); - std::string pext = openstudio::filesystem::extension(p); - if (!pext.empty()) { - // remove '.' from pext - pext = std::string(++pext.begin(),pext.end()); - } + std::string pext = getFileExtension(p); if (!pext.empty()) { if (pext != wext.string()) { if (warnOnMismatch) { diff --git a/openstudiocore/src/utilities/idd/IddObject.cpp b/openstudiocore/src/utilities/idd/IddObject.cpp index dc05cecd327..b25c1134b9b 100644 --- a/openstudiocore/src/utilities/idd/IddObject.cpp +++ b/openstudiocore/src/utilities/idd/IddObject.cpp @@ -307,6 +307,12 @@ namespace detail { std::vector result; if (OptionalUnsigned index = nameFieldIndex()) { result = m_fields[*index].properties().references; + // To ensure uniqueness of name within a given class, we add a fake reference by class + // https://github.com/NREL/OpenStudio/issues/3079 + //if (result.empty()) { + std::string ref = name(); + result.push_back(ref + "UniqueNames"); + //} } return result; } diff --git a/openstudiocore/src/utilities/idd/Test/IddObject_GTest.cpp b/openstudiocore/src/utilities/idd/Test/IddObject_GTest.cpp index f0dd5dab1fe..f1caefdd95a 100644 --- a/openstudiocore/src/utilities/idd/Test/IddObject_GTest.cpp +++ b/openstudiocore/src/utilities/idd/Test/IddObject_GTest.cpp @@ -159,3 +159,28 @@ TEST_F(IddFixture,IddObject_nameField) { ASSERT_TRUE(i); ASSERT_EQ(0u,i.get()); } + + +// E+ no longer allows non-unique names, so we need to check that we enforce a strict naming policy +// To do so, we we attribute a \reference to all objects that aren't part of a reference group +// cf: https://github.com/NREL/OpenStudio/issues/3079 +TEST_F(IddFixture, IddObject_uniqueNames) { + + std::vector fts = { + IddFileType(IddFileType::OpenStudio), + IddFileType(IddFileType::EnergyPlus) + }; + + for (const auto& ft: fts) { + std::vector objects = IddFactory::instance().getObjects(ft); + for (const auto& obj: objects) { + if (obj.hasNameField()) { + std::stringstream ss; + for (const auto& s: obj.references()) { + ss << s << ","; + } + EXPECT_GE(obj.references().size(), 1) << "Failed for " << obj.name() << ", it has the following references: " << ss.str(); + } + } + } +} diff --git a/openstudiocore/src/utilities/idf/IdfFile.cpp b/openstudiocore/src/utilities/idf/IdfFile.cpp index 653c1a1d6b9..56b1c7614e2 100644 --- a/openstudiocore/src/utilities/idf/IdfFile.cpp +++ b/openstudiocore/src/utilities/idf/IdfFile.cpp @@ -381,9 +381,21 @@ OptionalIdfFile IdfFile::load(const path& p, path wp(p); if (iddFileType == IddFileType::OpenStudio) { + // can be Model or Component + std::string ext = getFileExtension(p); + if (! ( openstudio::istringEqual(ext, "osm") || + openstudio::istringEqual(ext, "osc")) ) { + LOG_FREE(Warn,"openstudio.setFileExtension","Path p, '" << toString(p) + << "', has an unexpected file extension. Was expecting 'osm' or 'osc'."); + } + + // This isn't issuing warnings because we pass false (we have to, since it can be either osm or osc) + // hence why we do check above wp = completePathToFile(wp,path(),modelFileExtension(),false); - if (wp.empty()) { wp = completePathToFile(wp,path(),componentFileExtension(),false); } + if (wp.empty()) { + wp = completePathToFile(wp,path(),componentFileExtension(),false); + } } else { wp = completePathToFile(wp,path(),"idf",true); @@ -612,9 +624,6 @@ bool IdfFile::m_load(std::istream& is, ProgressBar* progressBar, bool versionOnl else{ bool foundEndLine(false); - - // a valid Idf object to parse - ++objectNum; firstBlock = false; bool isVersion = false; @@ -670,16 +679,22 @@ bool IdfFile::m_load(std::istream& is, ProgressBar* progressBar, bool versionOnl } // construct the object - if (!versionOnly || isVersion) { + if (foundEndLine && (!versionOnly || isVersion)) { OptionalIdfObject object = IdfObject::load(text,*iddObject); if (!object) { LOG(Error,"Unable to construct IdfObject from text: " << std::endl << text << std::endl << "Throwing this object out and parsing the remainder of the file."); continue; + } else { + // a valid Idf object to parse + if (object->iddObject().type() != IddObjectType::Catchall) { + ++objectNum; + } + + // put it in the object list + addObject(*object); } - // put it in the object list - addObject(*object); } if (versionOnly && isVersion) { @@ -689,7 +704,13 @@ bool IdfFile::m_load(std::istream& is, ProgressBar* progressBar, bool versionOnl } } - return true; + // If we sucessfully parsed at least one object, we return true, otherwise false + if (objectNum > 0) { + return true; + } else { + LOG(Error, "Could not parse a single valid object in file."); + return false; + } } IddFileAndFactoryWrapper IdfFile::iddFileAndFactoryWrapper() const { diff --git a/openstudiocore/src/utilities/idf/Test/IdfFile_GTest.cpp b/openstudiocore/src/utilities/idf/Test/IdfFile_GTest.cpp index c7fe7e103cb..48c5d2bc90f 100644 --- a/openstudiocore/src/utilities/idf/Test/IdfFile_GTest.cpp +++ b/openstudiocore/src/utilities/idf/Test/IdfFile_GTest.cpp @@ -86,11 +86,7 @@ TEST_F(IdfFixture, IdfFile_BasicTests_LoadedFile) } TEST_F(IdfFixture, IdfFile_Header) { - std::stringstream ss; - OptionalIdfFile oFile = IdfFile::load(ss,IddFileType(IddFileType::EnergyPlus)); - ss.clear(); - ASSERT_TRUE(oFile); - IdfFile file = *oFile; + IdfFile file(IddFileType::EnergyPlus); std::string header = "! A one-line header. "; file.setHeader(header); EXPECT_EQ(header,file.header()); @@ -98,6 +94,7 @@ TEST_F(IdfFixture, IdfFile_Header) { header = "Not actually a header, should get ! pre-pended."; file.setHeader(header); EXPECT_NE(header,file.header()); + std::stringstream ss; ss << "! " << header; EXPECT_EQ(ss.str(),file.header()); diff --git a/openstudiocore/src/utilities/idf/Test/Workspace_GTest.cpp b/openstudiocore/src/utilities/idf/Test/Workspace_GTest.cpp index 746c7f15d95..ce2bb01cd1c 100644 --- a/openstudiocore/src/utilities/idf/Test/Workspace_GTest.cpp +++ b/openstudiocore/src/utilities/idf/Test/Workspace_GTest.cpp @@ -2157,3 +2157,23 @@ TEST_F(IdfFixture, Workspace_GetObjectsByNameUUID) EXPECT_EQ(1u, ws.getObjectsByName("{af63d539-6e16-4fd1-a10e-dafe3793373b}", true).size()); EXPECT_EQ(1u, ws.getObjectsByName("{af63d539-6e16-4fd1-a10e-dafe3793373b}", false).size()); } + +TEST_F(IdfFixture, Workspace_DuplicateObjectName) { + Workspace ws(StrictnessLevel::Draft, IddFileType::EnergyPlus); + + OptionalIddObject zoneGroupIdd = IddFactory::instance().getObject(IddObjectType::ZoneGroup); + ASSERT_TRUE(zoneGroupIdd); + ASSERT_EQ(1u, zoneGroupIdd->references().size()); + EXPECT_EQ("ZoneGroupUniqueNames", zoneGroupIdd->references()[0]); + + boost::optional zoneGroup1 = ws.addObject(IdfObject(IddObjectType::ZoneGroup)); + OS_ASSERT(zoneGroup1); + EXPECT_TRUE(zoneGroup1->setName("Zone Group")); + EXPECT_EQ("Zone Group", zoneGroup1->nameString()); + + boost::optional zoneGroup2 = ws.addObject(IdfObject(IddObjectType::ZoneGroup)); + OS_ASSERT(zoneGroup2); + EXPECT_TRUE(zoneGroup2->setName("Zone Group")); + EXPECT_EQ("Zone Group", zoneGroup1->nameString()); + EXPECT_EQ("Zone Group 1", zoneGroup2->nameString()); +}