diff --git a/resources/model/OpenStudio.idd b/resources/model/OpenStudio.idd index 3c3f6568f7..8fdc1d442e 100644 --- a/resources/model/OpenStudio.idd +++ b/resources/model/OpenStudio.idd @@ -11205,6 +11205,27 @@ OS:AirLoopHVAC:DedicatedOutdoorAirSystem, \type object-list \object-list AirPrimaryLoops +OS:AirLoopHVAC:ExhaustSystem, + \memo Defines a general exhaust system with a central exhaust fan drawing from one or more + \memo ZoneHVAC:ExhaustControl outlet nodes via an AirLoopHVAC:ZoneMixer. + \min-fields 4 + A1, \field Handle + \type handle + \required-field + A2, \field Name + \required-field + \note Name of the exhaust system + A3, \field Zone Mixer Name + \required-field + \type object-list + \note The name of the exhaust system AirLoopHVAC:ZoneMixer + \object-list ZoneMixers + A4; \field Fan Name + \required-field + \type object-list + \object-list FansSystemModel + \object-list FansComponentModel + OS:AirLoopHVAC:ReturnPlenum, \extensible:1 Just duplicate last field and comments (changing numbering, please) \min-fields 1 @@ -12894,7 +12915,6 @@ OS:AirTerminal:SingleDuct:ConstantVolume:NoReheat, \units m3/s \minimum 0 - OS:AirTerminal:SingleDuct:VAV:NoReheat, \min-fields 1 A1, \field Handle @@ -29152,7 +29172,6 @@ OS:ZoneHVAC:EquipmentList, \type object-list \object-list ScheduleNames - OS:ZoneVentilation:DesignFlowRate, A1, \field Handle \type handle @@ -29474,6 +29493,66 @@ OS:ZoneHVAC:Baseboard:Convective:Water, \required-field \object-list BaseboardHeatingCoil +OS:ZoneHVAC:ExhaustControl, + \memo Defines a controlled exhaust flow from a zone which finally feeds into + \memo one of AirLoopHVAC:ZoneMixer's inlets, which are part of an AirLoopHVAC:ExhaustSystem. + A1 , \field Handle + \type handle + \required-field + A2 , \field Name + \required-field + A3 , \field Availability Schedule Name + \note Availability schedule name for this exhaust system. Schedule value > 0 means it is available. + \note If this field is blank, the exhaust system is always available. If the attached + \note AirLoopHVAC:ExhaustSystem is off, then the flow will be zero. + \required-field + \type object-list + \object-list ScheduleNames + A4 , \field Inlet Node Name + \note Inlet node name for the exhaust. Must be a zone exhaust node. + \required-field + \type object-list + \object-list ConnectionNames + A5 , \field Outlet Node Name + \note Outlet node name for the exhaust + \required-field + \type object-list + \object-list ConnectionNames + N1 , \field Design Exhaust Flow Rate + \autosizable + \units m3/s + \minimum> 0 + \required-field + A6 , \field Flow Control Type + \note Control type of the zone exhaust flow + \type choice + \key Scheduled + \key FollowSupply + \required-field + A7 , \field Exhaust Flow Fraction Schedule Name + \note Schedule name of the exhaust flow fraction. Used only with Scheduled control type. + \note If this field is blank, the flow fraction is always 1.0. + \type object-list + \object-list ScheduleNames + A8 , \field Supply Node or NodeList Name + \note Used only with FollowSupply control type. + \type object-list + \object-list ConnectionNames + A9, \field Minimum Zone Temperature Limit Schedule Name + \note Schedule name of the Minimum Zone Temperature Limit in degree Celsius + \note If this field is blank, there is no limit. + \type object-list + \object-list ScheduleNames + A10, \field Minimum Exhaust Flow Fraction Schedule Name + \note Schedule name of the minimum exhaust flow fraction. + \note Applied when the zone temperature falls below the Minimum Zone Temperature Limit. + \type object-list + \object-list ScheduleNames + A11; \field Balanced Exhaust Fraction Schedule Name + \note Schedule name of the Balanced Exhaust Fraction. + \type object-list + \object-list ScheduleNames + OS:ZoneHVAC:HighTemperatureRadiant, A1, \field Handle \type handle diff --git a/src/energyplus/CMakeLists.txt b/src/energyplus/CMakeLists.txt index eaafa6c3fb..5055fe3229 100644 --- a/src/energyplus/CMakeLists.txt +++ b/src/energyplus/CMakeLists.txt @@ -18,6 +18,7 @@ set(${target_name}_src ForwardTranslator/ForwardTranslateAirflowNetwork.cpp ForwardTranslator/ForwardTranslateAirGap.cpp ForwardTranslator/ForwardTranslateAirLoopHVAC.cpp + ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp ForwardTranslator/ForwardTranslateAirLoopHVACOutdoorAirSystem.cpp ForwardTranslator/ForwardTranslateAirLoopHVACDedicatedOutdoorAirSystem.cpp ForwardTranslator/ForwardTranslateAirLoopHVACReturnPlenum.cpp @@ -444,6 +445,7 @@ set(${target_name}_src ForwardTranslator/ForwardTranslateZoneHVACEnergyRecoveryVentilator.cpp ForwardTranslator/ForwardTranslateZoneHVACEnergyRecoveryVentilatorController.cpp ForwardTranslator/ForwardTranslateZoneHVACEquipmentList.cpp + ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp ForwardTranslator/ForwardTranslateZoneHVACFourPipeFanCoil.cpp ForwardTranslator/ForwardTranslateZoneHVACHighTemperatureRadiant.cpp ForwardTranslator/ForwardTranslateZoneHVACIdealLoadsAirSystem.cpp @@ -674,6 +676,7 @@ set(${target_name}_test_src Test/AirTerminalSingleDuctVAVHeatAndCoolReheat_GTest.cpp Test/AirLoopHVAC_GTest.cpp + Test/AirLoopHVACExhaustSystem_GTest.cpp Test/AirLoopHVACDedicatedOutdoorAirSystem_GTest.cpp Test/PlantLoop_GTest.cpp @@ -840,6 +843,7 @@ set(${target_name}_test_src Test/WaterUseConnections_GTest.cpp Test/ZoneAirHeatBalanceAlgorithm_GTest.cpp Test/ZoneHVACBaseboardRadiantConvectiveWater_GTest.cpp + Test/ZoneHVACExhaustControl_GTest.cpp Test/ZoneHVACLowTemperatureRadiantElectric_GTest.cpp Test/ZoneHVACLowTempRadiantConstFlow_GTest.cpp Test/ZoneHVACLowTempRadiantVarFlow_GTest.cpp diff --git a/src/energyplus/ForwardTranslator.cpp b/src/energyplus/ForwardTranslator.cpp index 10432603e3..95cf8b0ecb 100644 --- a/src/energyplus/ForwardTranslator.cpp +++ b/src/energyplus/ForwardTranslator.cpp @@ -696,6 +696,11 @@ namespace energyplus { retVal = translateAirLoopHVAC(airLoopHVAC); break; } + case openstudio::IddObjectType::OS_AirLoopHVAC_ExhaustSystem: { + auto airLoopHVACExhaustSystem = modelObject.cast(); + retVal = translateAirLoopHVACExhaustSystem(airLoopHVACExhaustSystem); + break; + } case openstudio::IddObjectType::OS_AirLoopHVAC_ReturnPlenum: { auto airLoopHVACReturnPlenum = modelObject.cast(); retVal = translateAirLoopHVACReturnPlenum(airLoopHVACReturnPlenum); @@ -3204,6 +3209,11 @@ namespace energyplus { retVal = translateZoneHVACEquipmentList(mo); break; } + case openstudio::IddObjectType::OS_ZoneHVAC_ExhaustControl: { + auto mo = modelObject.cast(); + retVal = translateZoneHVACExhaustControl(mo); + break; + } case openstudio::IddObjectType::OS_ZoneHVAC_FourPipeFanCoil: { auto mo = modelObject.cast(); retVal = translateZoneHVACFourPipeFanCoil(mo); diff --git a/src/energyplus/ForwardTranslator.hpp b/src/energyplus/ForwardTranslator.hpp index b14c46dabe..9b85ad1753 100644 --- a/src/energyplus/ForwardTranslator.hpp +++ b/src/energyplus/ForwardTranslator.hpp @@ -54,6 +54,7 @@ namespace model { class AirflowNetworkOccupantVentilationControl; class AirGap; class AirLoopHVAC; + class AirLoopHVACExhaustSystem; class AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass; class AirLoopHVACUnitaryHeatPumpAirToAir; class AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed; @@ -481,6 +482,7 @@ namespace model { class ZoneHVACEnergyRecoveryVentilator; class ZoneHVACEnergyRecoveryVentilatorController; class ZoneHVACEquipmentList; + class ZoneHVACExhaustControl; class ZoneHVACFourPipeFanCoil; class ZoneHVACHighTemperatureRadiant; class ZoneHVACIdealLoadsAirSystem; @@ -652,6 +654,8 @@ namespace energyplus { boost::optional translateAirLoopHVAC(model::AirLoopHVAC& modelObject); + boost::optional translateAirLoopHVACExhaustSystem(model::AirLoopHVACExhaustSystem& modelObject); + boost::optional translateAirLoopHVACOutdoorAirSystem(model::AirLoopHVACOutdoorAirSystem& modelObject); boost::optional translateAirLoopHVACDedicatedOutdoorAirSystem(model::AirLoopHVACDedicatedOutdoorAirSystem& modelObject); @@ -1551,6 +1555,8 @@ namespace energyplus { boost::optional translateZoneHVACEquipmentList(model::ZoneHVACEquipmentList& modelObject); + boost::optional translateZoneHVACExhaustControl(model::ZoneHVACExhaustControl& modelObject); + boost::optional translateZoneHVACFourPipeFanCoil(model::ZoneHVACFourPipeFanCoil& modelObject); boost::optional translateZoneHVACHighTemperatureRadiant(model::ZoneHVACHighTemperatureRadiant& modelObject); diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp new file mode 100644 index 0000000000..abc92f6224 --- /dev/null +++ b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp @@ -0,0 +1,63 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2023, 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 "../ForwardTranslator.hpp" +#include "../../model/Model.hpp" +#include "../../model/AirLoopHVACExhaustSystem.hpp" +#include "../../model/AirLoopHVACExhaustSystem_Impl.hpp" +#include "../../model/HVACComponent.hpp" +#include "../../model/HVACComponent_Impl.hpp" + +#include +#include + +using namespace openstudio::model; + +namespace openstudio { + +namespace energyplus { + + boost::optional ForwardTranslator::translateAirLoopHVACExhaustSystem(model::AirLoopHVACExhaustSystem& modelObject) { + + // Instantiate an IdfObject of the class to store the values + IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::AirLoopHVAC_ExhaustSystem, modelObject); + + // Fan Object Type: Required String + // Fan Name: Required Object + HVACComponent fan = modelObject.fan(); + if (boost::optional wo_ = translateAndMapModelObject(fan)) { + idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanObjectType, wo_->iddObject().name()); + idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanName, wo_->nameString()); + } + + return idfObject; + } // End of translate function + +} // end namespace energyplus +} // end namespace openstudio diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp new file mode 100644 index 0000000000..4f353c5397 --- /dev/null +++ b/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp @@ -0,0 +1,123 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2023, 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 "../ForwardTranslator.hpp" +#include "../../model/Model.hpp" +#include "../../model/ZoneHVACExhaustControl.hpp" +#include "../../model/ZoneHVACExhaustControl_Impl.hpp" +#include "../../model/Schedule.hpp" +#include "../../model/Schedule_Impl.hpp" +#include "../../model/ThermalZone.hpp" +#include "../../model/ThermalZone_Impl.hpp" +#include "../../model/Node.hpp" +#include "../../model/Node_Impl.hpp" + +#include +#include + +using namespace openstudio::model; + +namespace openstudio { + +namespace energyplus { + + boost::optional ForwardTranslator::translateZoneHVACExhaustControl(model::ZoneHVACExhaustControl& modelObject) { + + // Instantiate an IdfObject of the class to store the values + IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::ZoneHVAC_ExhaustControl, modelObject); + + // Availability Schedule Name: Required Object + Schedule availabilitySchedule_ = modelObject.availabilitySchedule(); + if (boost::optional wo_ = translateAndMapModelObject(availabilitySchedule_)) { + idfObject.setString(ZoneHVAC_ExhaustControlFields::AvailabilityScheduleName, wo_->nameString()); + } + + // Zone Name: Required Object + if (boost::optional zone = modelObject.thermalZone()) { + if (boost::optional thermalZoneName = zone->name()) { + idfObject.setString(ZoneHVAC_ExhaustControlFields::ZoneName, thermalZoneName.get()); + } + } + + // InletNodeName + if (auto node = modelObject.inletNode()) { + idfObject.setString(ZoneHVAC_ExhaustControlFields::InletNodeName, node->name().get()); + } + + // OutletNodeName + if (auto node = modelObject.outletNode()) { + idfObject.setString(ZoneHVAC_ExhaustControlFields::OutletNodeName, node->name().get()); + } + + if (modelObject.isDesignExhaustFlowRateAutosized()) { + idfObject.setString(ZoneHVAC_ExhaustControlFields::DesignExhaustFlowRate, "Autosize"); + } else { + // Design Exhaust Flow Rate: boost::optional + if (boost::optional designExhaustFlowRate_ = modelObject.designExhaustFlowRate()) { + idfObject.setDouble(ZoneHVAC_ExhaustControlFields::DesignExhaustFlowRate, designExhaustFlowRate_.get()); + } + } + + // Flow Control Type: Optional String + const std::string flowControlType = modelObject.flowControlType(); + idfObject.setString(ZoneHVAC_ExhaustControlFields::FlowControlType, flowControlType); + + // Exhaust Flow Fraction Schedule Name: Optional Object + if (boost::optional exhaustFlowFractionSchedule_ = modelObject.exhaustFlowFractionSchedule()) { + if (boost::optional wo_ = translateAndMapModelObject(exhaustFlowFractionSchedule_.get())) { + idfObject.setString(ZoneHVAC_ExhaustControlFields::ExhaustFlowFractionScheduleName, wo_->nameString()); + } + } + + // Minimum Zone Temperature Limit Schedule Name: Optional Object + if (boost::optional minimumZoneTemperatureLimitSchedule_ = modelObject.minimumZoneTemperatureLimitSchedule()) { + if (boost::optional wo_ = translateAndMapModelObject(minimumZoneTemperatureLimitSchedule_.get())) { + idfObject.setString(ZoneHVAC_ExhaustControlFields::MinimumZoneTemperatureLimitScheduleName, wo_->nameString()); + } + } + + // Minimum Exhaust Flow Fraction Schedule Name: Optional Object + if (boost::optional minimumExhaustFlowFractionSchedule_ = modelObject.minimumExhaustFlowFractionSchedule()) { + if (boost::optional wo_ = translateAndMapModelObject(minimumExhaustFlowFractionSchedule_.get())) { + idfObject.setString(ZoneHVAC_ExhaustControlFields::MinimumExhaustFlowFractionScheduleName, wo_->nameString()); + } + } + + // Balanced Exhaust Fraction Schedule Name: Optional Object + if (boost::optional balancedExhaustFractionSchedule_ = modelObject.balancedExhaustFractionSchedule()) { + if (boost::optional wo_ = translateAndMapModelObject(balancedExhaustFractionSchedule_.get())) { + idfObject.setString(ZoneHVAC_ExhaustControlFields::BalancedExhaustFractionScheduleName, wo_->nameString()); + } + } + + return idfObject; + } // End of translate function + +} // end namespace energyplus +} // end namespace openstudio diff --git a/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp b/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp new file mode 100644 index 0000000000..1466de811a --- /dev/null +++ b/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp @@ -0,0 +1,72 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2023, 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 +#include "EnergyPlusFixture.hpp" + +#include "../ForwardTranslator.hpp" + +#include "../../model/AirLoopHVACExhaustSystem.hpp" +#include "../../model/AirLoopHVACExhaustSystem_Impl.hpp" +#include "../../model/FanSystemModel.hpp" +#include "../../model/FanSystemModel_Impl.hpp" + +#include "../../utilities/idf/Workspace.hpp" +#include "../../utilities/idf/IdfObject.hpp" +#include "../../utilities/idf/WorkspaceObject.hpp" +// E+ FieldEnums +#include +#include +#include + +using namespace openstudio::energyplus; +using namespace openstudio::model; +using namespace openstudio; + +TEST_F(EnergyPlusFixture, ForwardTranslator_AirLoopHVACExhaustSystem) { + + ForwardTranslator ft; + + Model m; + + AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m); + + airLoopHVACExhaustSystem.setName("My AirLoopHVACExhaustSystem"); + FanSystemModel fan(m); + EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan)); + + const Workspace w = ft.translateModel(m); + const auto idfObjs = w.getObjectsByType(IddObjectType::AirLoopHVAC_ExhaustSystem); + ASSERT_EQ(1u, idfObjs.size()); + + const auto& idfObject = idfObjs.front(); + EXPECT_EQ("", idfObject.getString(AirLoopHVAC_ExhaustSystemFields::ZoneMixerName).get()); + EXPECT_EQ("Fan:SystemModel", idfObject.getString(AirLoopHVAC_ExhaustSystemFields::FanObjectType).get()); + EXPECT_EQ(fan.nameString(), idfObject.getString(AirLoopHVAC_ExhaustSystemFields::FanName).get()); +} diff --git a/src/energyplus/Test/ZoneHVACExhaustControl_GTest.cpp b/src/energyplus/Test/ZoneHVACExhaustControl_GTest.cpp new file mode 100644 index 0000000000..39c40479fb --- /dev/null +++ b/src/energyplus/Test/ZoneHVACExhaustControl_GTest.cpp @@ -0,0 +1,95 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2023, 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 +#include "EnergyPlusFixture.hpp" + +#include "../ForwardTranslator.hpp" + +#include "../../model/ZoneHVACExhaustControl.hpp" +#include "../../model/ZoneHVACExhaustControl_Impl.hpp" +#include "../../model/Schedule.hpp" +#include "../../model/Schedule_Impl.hpp" +#include "../../model/ScheduleConstant.hpp" +#include "../../model/ScheduleConstant_Impl.hpp" + +#include "../../utilities/idf/Workspace.hpp" +#include "../../utilities/idf/IdfObject.hpp" +#include "../../utilities/idf/WorkspaceObject.hpp" +// E+ FieldEnums +#include +#include +#include + +using namespace openstudio::energyplus; +using namespace openstudio::model; +using namespace openstudio; + +TEST_F(EnergyPlusFixture, ForwardTranslator_ZoneHVACExhaustControl) { + + ForwardTranslator ft; + + Model m; + + ZoneHVACExhaustControl zoneHVACExhaustControl(m); + + zoneHVACExhaustControl.setName("My ZoneHVACExhaustControl"); + Schedule availabilitySchedule = m.alwaysOnDiscreteSchedule(); + EXPECT_TRUE(zoneHVACExhaustControl.setAvailabilitySchedule(availabilitySchedule)); + EXPECT_TRUE(zoneHVACExhaustControl.setDesignExhaustFlowRate(0.6)); + EXPECT_TRUE(zoneHVACExhaustControl.setFlowControlType("Scheduled")); + ScheduleConstant exhaustFlowFractionSchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setExhaustFlowFractionSchedule(exhaustFlowFractionSchedule)); + ScheduleConstant minimumZoneTemperatureLimitSchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setMinimumZoneTemperatureLimitSchedule(minimumZoneTemperatureLimitSchedule)); + ScheduleConstant minimumExhaustFlowFractionSchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setMinimumExhaustFlowFractionSchedule(minimumExhaustFlowFractionSchedule)); + ScheduleConstant balancedExhaustFractionSchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setBalancedExhaustFractionSchedule(balancedExhaustFractionSchedule)); + + const Workspace w = ft.translateModel(m); + const auto idfObjs = w.getObjectsByType(IddObjectType::ZoneHVAC_ExhaustControl); + ASSERT_EQ(1u, idfObjs.size()); + + const auto& idfObject = idfObjs.front(); + EXPECT_EQ(availabilitySchedule.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::AvailabilityScheduleName).get()); + EXPECT_EQ("", idfObject.getString(ZoneHVAC_ExhaustControlFields::ZoneName).get()); + EXPECT_EQ("", idfObject.getString(ZoneHVAC_ExhaustControlFields::InletNodeName).get()); + EXPECT_EQ("", idfObject.getString(ZoneHVAC_ExhaustControlFields::OutletNodeName).get()); + EXPECT_EQ(0.6, idfObject.getDouble(ZoneHVAC_ExhaustControlFields::DesignExhaustFlowRate).get()); + EXPECT_EQ("Scheduled", idfObject.getString(ZoneHVAC_ExhaustControlFields::FlowControlType).get()); + EXPECT_EQ(exhaustFlowFractionSchedule.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::ExhaustFlowFractionScheduleName).get()); + EXPECT_EQ("", idfObject.getString(ZoneHVAC_ExhaustControlFields::SupplyNodeorNodeListName).get()); + EXPECT_EQ(minimumZoneTemperatureLimitSchedule.nameString(), + idfObject.getString(ZoneHVAC_ExhaustControlFields::MinimumZoneTemperatureLimitScheduleName).get()); + EXPECT_EQ(minimumExhaustFlowFractionSchedule.nameString(), + idfObject.getString(ZoneHVAC_ExhaustControlFields::MinimumExhaustFlowFractionScheduleName).get()); + EXPECT_EQ(balancedExhaustFractionSchedule.nameString(), + idfObject.getString(ZoneHVAC_ExhaustControlFields::BalancedExhaustFractionScheduleName).get()); +} diff --git a/src/model/AirLoopHVACExhaustSystem.cpp b/src/model/AirLoopHVACExhaustSystem.cpp new file mode 100644 index 0000000000..fcf6629934 --- /dev/null +++ b/src/model/AirLoopHVACExhaustSystem.cpp @@ -0,0 +1,138 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2023, 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 "AirLoopHVACExhaustSystem.hpp" +#include "AirLoopHVACExhaustSystem_Impl.hpp" + +#include "Model.hpp" +#include "Model_Impl.hpp" +#include "HVACComponent.hpp" +#include "HVACComponent_Impl.hpp" +#include "FanSystemModel.hpp" +#include "FanSystemModel_Impl.hpp" + +#include "../utilities/core/Assert.hpp" +#include "../utilities/data/DataEnums.hpp" + +#include +#include + +namespace openstudio { +namespace model { + + namespace detail { + + AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) + : HVACComponent_Impl(idfObject, model, keepHandle) { + OS_ASSERT(idfObject.iddObject().type() == AirLoopHVACExhaustSystem::iddObjectType()); + } + + AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, + bool keepHandle) + : HVACComponent_Impl(other, model, keepHandle) { + OS_ASSERT(other.iddObject().type() == AirLoopHVACExhaustSystem::iddObjectType()); + } + + AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const AirLoopHVACExhaustSystem_Impl& other, Model_Impl* model, bool keepHandle) + : HVACComponent_Impl(other, model, keepHandle) {} + + const std::vector& AirLoopHVACExhaustSystem_Impl::outputVariableNames() const { + static std::vector result; + if (result.empty()) { + } + return result; + } + + IddObjectType AirLoopHVACExhaustSystem_Impl::iddObjectType() const { + return AirLoopHVACExhaustSystem::iddObjectType(); + } + + ComponentType AirLoopHVACExhaustSystem_Impl::componentType() const { + return ComponentType::None; + } + + std::vector AirLoopHVACExhaustSystem_Impl::coolingFuelTypes() const { + return {}; + } + + std::vector AirLoopHVACExhaustSystem_Impl::heatingFuelTypes() const { + return {}; + } + + std::vector AirLoopHVACExhaustSystem_Impl::appGHeatingFuelTypes() const { + return {}; + } + + HVACComponent AirLoopHVACExhaustSystem_Impl::fan() const { + boost::optional value = optionalFan(); + if (!value) { + LOG_AND_THROW(briefDescription() << " does not have a Fan attached."); + } + return value.get(); + } + + bool AirLoopHVACExhaustSystem_Impl::setFan(const HVACComponent& fan) { + const bool result = setPointer(OS_AirLoopHVAC_ExhaustSystemFields::FanName, fan.handle()); + return result; + } + + boost::optional AirLoopHVACExhaustSystem_Impl::optionalFan() const { + return getObject().getModelObjectTarget(OS_AirLoopHVAC_ExhaustSystemFields::FanName); + } + + } // namespace detail + + AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(const Model& model) : HVACComponent(AirLoopHVACExhaustSystem::iddObjectType(), model) { + OS_ASSERT(getImpl()); + + bool ok = true; + + FanSystemModel fan(model); + ok = setFan(fan); + OS_ASSERT(ok); + } + + IddObjectType AirLoopHVACExhaustSystem::iddObjectType() { + return {IddObjectType::OS_AirLoopHVAC_ExhaustSystem}; + } + + HVACComponent AirLoopHVACExhaustSystem::fan() const { + return getImpl()->fan(); + } + + bool AirLoopHVACExhaustSystem::setFan(const HVACComponent& fan) { + return getImpl()->setFan(fan); + } + + /// @cond + AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(std::shared_ptr impl) : HVACComponent(std::move(impl)) {} + /// @endcond + +} // namespace model +} // namespace openstudio diff --git a/src/model/AirLoopHVACExhaustSystem.hpp b/src/model/AirLoopHVACExhaustSystem.hpp new file mode 100644 index 0000000000..8f43021e19 --- /dev/null +++ b/src/model/AirLoopHVACExhaustSystem.hpp @@ -0,0 +1,107 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2023, 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_AIRLOOPHVACEXHAUSTSYSTEM_HPP +#define MODEL_AIRLOOPHVACEXHAUSTSYSTEM_HPP + +#include +#include "HVACComponent.hpp" + +namespace openstudio { +namespace model { + + class HVACComponent; + + namespace detail { + + class AirLoopHVACExhaustSystem_Impl; + + } // namespace detail + + /** AirLoopHVACExhaustSystem is a HVACComponent that wraps the OpenStudio IDD object 'OS:AirLoopHVAC:ExhaustSystem'. */ + class MODEL_API AirLoopHVACExhaustSystem : public HVACComponent + { + public: + /** @name Constructors and Destructors */ + //@{ + + explicit AirLoopHVACExhaustSystem(const Model& model); + + virtual ~AirLoopHVACExhaustSystem() = default; + // Default the copy and move operators because the virtual dtor is explicit + AirLoopHVACExhaustSystem(const AirLoopHVACExhaustSystem& other) = default; + AirLoopHVACExhaustSystem(AirLoopHVACExhaustSystem&& other) = default; + AirLoopHVACExhaustSystem& operator=(const AirLoopHVACExhaustSystem&) = default; + AirLoopHVACExhaustSystem& operator=(AirLoopHVACExhaustSystem&&) = default; + + //@} + + static IddObjectType iddObjectType(); + + /** @name Getters */ + //@{ + + HVACComponent fan() const; + + //@} + /** @name Setters */ + //@{ + + bool setFan(const HVACComponent& fan); + + //@} + /** @name Other */ + //@{ + + //@} + protected: + /// @cond + using ImplType = detail::AirLoopHVACExhaustSystem_Impl; + + explicit AirLoopHVACExhaustSystem(std::shared_ptr impl); + + friend class detail::AirLoopHVACExhaustSystem_Impl; + friend class Model; + friend class IdfObject; + friend class openstudio::detail::IdfObject_Impl; + /// @endcond + private: + REGISTER_LOGGER("openstudio.model.AirLoopHVACExhaustSystem"); + }; + + /** \relates AirLoopHVACExhaustSystem*/ + using OptionalAirLoopHVACExhaustSystem = boost::optional; + + /** \relates AirLoopHVACExhaustSystem*/ + using AirLoopHVACExhaustSystemVector = std::vector; + +} // namespace model +} // namespace openstudio + +#endif // MODEL_AIRLOOPHVACEXHAUSTSYSTEM_HPP diff --git a/src/model/AirLoopHVACExhaustSystem_Impl.hpp b/src/model/AirLoopHVACExhaustSystem_Impl.hpp new file mode 100644 index 0000000000..f9f92401ce --- /dev/null +++ b/src/model/AirLoopHVACExhaustSystem_Impl.hpp @@ -0,0 +1,100 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2023, 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_AIRLOOPHVACEXHAUSTSYSTEM_IMPL_HPP +#define MODEL_AIRLOOPHVACEXHAUSTSYSTEM_IMPL_HPP + +#include +#include "HVACComponent_Impl.hpp" + +namespace openstudio { +namespace model { + + class HVACComponent; + + namespace detail { + + /** AirLoopHVACExhaustSystem_Impl is a HVACComponent_Impl that is the implementation class for AirLoopHVACExhaustSystem.*/ + class MODEL_API AirLoopHVACExhaustSystem_Impl : public HVACComponent_Impl + { + public: + /** @name Constructors and Destructors */ + //@{ + + AirLoopHVACExhaustSystem_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle); + + AirLoopHVACExhaustSystem_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle); + + AirLoopHVACExhaustSystem_Impl(const AirLoopHVACExhaustSystem_Impl& other, Model_Impl* model, bool keepHandle); + + virtual ~AirLoopHVACExhaustSystem_Impl() = default; + + //@} + /** @name Virtual Methods */ + //@{ + + virtual const std::vector& outputVariableNames() const override; + + virtual IddObjectType iddObjectType() const override; + + virtual ComponentType componentType() const override; + virtual std::vector coolingFuelTypes() const override; + virtual std::vector heatingFuelTypes() const override; + virtual std::vector appGHeatingFuelTypes() const override; + + //@} + /** @name Getters */ + //@{ + + HVACComponent fan() const; + + //@} + /** @name Setters */ + //@{ + + bool setFan(const HVACComponent& fan); + + //@} + /** @name Other */ + //@{ + + //@} + protected: + private: + REGISTER_LOGGER("openstudio.model.AirLoopHVACExhaustSystem"); + + boost::optional optionalFan() const; + }; + + } // namespace detail + +} // namespace model +} // namespace openstudio + +#endif // MODEL_AIRLOOPHVACEXHAUSTSYSTEM_IMPL_HPP diff --git a/src/model/CMakeLists.txt b/src/model/CMakeLists.txt index 8477362fea..b95aeb8a15 100644 --- a/src/model/CMakeLists.txt +++ b/src/model/CMakeLists.txt @@ -133,6 +133,9 @@ set(${target_name}_src AirLoopHVAC.hpp AirLoopHVAC_Impl.hpp AirLoopHVAC.cpp + AirLoopHVACExhaustSystem.hpp + AirLoopHVACExhaustSystem_Impl.hpp + AirLoopHVACExhaustSystem.cpp AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.hpp AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass_Impl.hpp AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.cpp @@ -1774,6 +1777,9 @@ set(${target_name}_src ZoneHVACEquipmentList.hpp ZoneHVACEquipmentList_Impl.hpp ZoneHVACEquipmentList.cpp + ZoneHVACExhaustControl.hpp + ZoneHVACExhaustControl_Impl.hpp + ZoneHVACExhaustControl.cpp ZoneHVACFourPipeFanCoil.hpp ZoneHVACFourPipeFanCoil_Impl.hpp ZoneHVACFourPipeFanCoil.cpp @@ -1914,6 +1920,7 @@ set(${target_name}_test_src test/AirLoopHVACUnitarySystem_GTest.cpp test/AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass_GTest.cpp test/AirLoopHVAC_GTest.cpp + test/AirLoopHVACExhaustSystem_GTest.cpp test/AirTerminalDualDuctConstantVolume_GTest.cpp test/AirTerminalDualDuctVAV_GTest.cpp test/AirTerminalDualDuctVAVOutdoorAir_GTest.cpp @@ -2365,6 +2372,7 @@ set(${target_name}_test_src test/ZoneHVACEnergyRecoveryVentilator_GTest.cpp test/ZoneHVACEnergyRecoveryVentilatorController_GTest.cpp test/ZoneHVACEquipmentList_GTest.cpp + test/ZoneHVACExhaustControl_GTest.cpp test/ZoneHVACFourPipeFanCoil_GTest.cpp test/ZoneHVACHighTemperatureRadiant_GTest.cpp test/ZoneHVACLowTemperatureRadiantElectric_GTest.cpp diff --git a/src/model/ConcreteModelObjects.hpp b/src/model/ConcreteModelObjects.hpp index 9d36231578..f9ad2af7ae 100644 --- a/src/model/ConcreteModelObjects.hpp +++ b/src/model/ConcreteModelObjects.hpp @@ -34,6 +34,7 @@ #include "AirflowNetworkZoneExhaustFan.hpp" #include "AirGap.hpp" #include "AirLoopHVAC.hpp" +#include "AirLoopHVACExhaustSystem.hpp" #include "AirLoopHVACOutdoorAirSystem.hpp" #include "AirLoopHVACDedicatedOutdoorAirSystem.hpp" #include "AirLoopHVACUnitaryHeatPumpAirToAir.hpp" @@ -542,6 +543,7 @@ #include "ZoneHVACEnergyRecoveryVentilator.hpp" #include "ZoneHVACEnergyRecoveryVentilatorController.hpp" #include "ZoneHVACEquipmentList.hpp" +#include "ZoneHVACExhaustControl.hpp" #include "ZoneHVACFourPipeFanCoil.hpp" #include "ZoneHVACHighTemperatureRadiant.hpp" #include "ZoneHVACIdealLoadsAirSystem.hpp" @@ -588,6 +590,7 @@ #include "AirflowNetworkZoneExhaustFan_Impl.hpp" #include "AirGap_Impl.hpp" #include "AirLoopHVAC_Impl.hpp" +#include "AirLoopHVACExhaustSystem_Impl.hpp" #include "AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass_Impl.hpp" #include "AirLoopHVACUnitaryHeatPumpAirToAir_Impl.hpp" #include "AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed_Impl.hpp" @@ -1096,6 +1099,7 @@ #include "ZoneHVACEnergyRecoveryVentilator_Impl.hpp" #include "ZoneHVACEnergyRecoveryVentilatorController_Impl.hpp" #include "ZoneHVACEquipmentList_Impl.hpp" +#include "ZoneHVACExhaustControl_Impl.hpp" #include "ZoneHVACFourPipeFanCoil_Impl.hpp" #include "ZoneHVACHighTemperatureRadiant_Impl.hpp" #include "ZoneHVACIdealLoadsAirSystem_Impl.hpp" diff --git a/src/model/Model.cpp b/src/model/Model.cpp index 75d57bf3ea..3787d946a3 100644 --- a/src/model/Model.cpp +++ b/src/model/Model.cpp @@ -2254,9 +2254,9 @@ namespace model { if (!openstudio::equal(inputResult, outputResult, tol)) { LOG_FREE(logLevel, "openstudio.model.Model", "The " << attributeName << " values determined for " << object.briefDescription() - << " using input and output data differ by a (relative) error " << "greater than " << tol - << ". The value calculated from input data was " << inputResult << ", whereas the value calculated from output data was " - << outputResult << "."); + << " using input and output data differ by a (relative) error " + << "greater than " << tol << ". The value calculated from input data was " << inputResult + << ", whereas the value calculated from output data was " << outputResult << "."); return false; } return true; @@ -3899,6 +3899,7 @@ namespace model { REGISTER_CONSTRUCTOR(AirflowNetworkZoneExhaustFan); REGISTER_CONSTRUCTOR(AirGap); REGISTER_CONSTRUCTOR(AirLoopHVAC); + REGISTER_CONSTRUCTOR(AirLoopHVACExhaustSystem); REGISTER_CONSTRUCTOR(AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass); REGISTER_CONSTRUCTOR(AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed); REGISTER_CONSTRUCTOR(AirLoopHVACUnitaryHeatPumpAirToAir); @@ -4410,6 +4411,7 @@ namespace model { REGISTER_CONSTRUCTOR(ZoneControlHumidistat); REGISTER_CONSTRUCTOR(ZoneControlThermostatStagedDualSetpoint); REGISTER_CONSTRUCTOR(ZoneHVACEquipmentList); + REGISTER_CONSTRUCTOR(ZoneHVACExhaustControl); REGISTER_CONSTRUCTOR(ZoneHVACBaseboardConvectiveElectric); REGISTER_CONSTRUCTOR(ZoneHVACBaseboardConvectiveWater); REGISTER_CONSTRUCTOR(ZoneHVACBaseboardRadiantConvectiveElectric); @@ -4473,6 +4475,7 @@ namespace model { REGISTER_COPYCONSTRUCTORS(AirflowNetworkZoneExhaustFan); REGISTER_COPYCONSTRUCTORS(AirGap); REGISTER_COPYCONSTRUCTORS(AirLoopHVAC); + REGISTER_COPYCONSTRUCTORS(AirLoopHVACExhaustSystem); REGISTER_COPYCONSTRUCTORS(AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass); REGISTER_COPYCONSTRUCTORS(AirLoopHVACUnitaryHeatPumpAirToAir); REGISTER_COPYCONSTRUCTORS(AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed); @@ -4984,6 +4987,7 @@ namespace model { REGISTER_COPYCONSTRUCTORS(ZoneControlHumidistat); REGISTER_COPYCONSTRUCTORS(ZoneControlThermostatStagedDualSetpoint); REGISTER_COPYCONSTRUCTORS(ZoneHVACEquipmentList); + REGISTER_COPYCONSTRUCTORS(ZoneHVACExhaustControl); REGISTER_COPYCONSTRUCTORS(ZoneHVACBaseboardConvectiveElectric); REGISTER_COPYCONSTRUCTORS(ZoneHVACBaseboardConvectiveWater); REGISTER_COPYCONSTRUCTORS(ZoneHVACBaseboardRadiantConvectiveElectric); diff --git a/src/model/ModelStraightComponent.i b/src/model/ModelStraightComponent.i index 3c835ccead..0efd094fc7 100644 --- a/src/model/ModelStraightComponent.i +++ b/src/model/ModelStraightComponent.i @@ -97,6 +97,7 @@ namespace openstudio { %template(GFunctionVector) std::vector; MODELOBJECT_TEMPLATES(AirConditionerVariableRefrigerantFlow); +MODELOBJECT_TEMPLATES(AirLoopHVACExhaustSystem); MODELOBJECT_TEMPLATES(AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass); MODELOBJECT_TEMPLATES(AirLoopHVACUnitaryHeatPumpAirToAir); MODELOBJECT_TEMPLATES(AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed); @@ -186,6 +187,7 @@ MODELOBJECT_TEMPLATES(ThermalStorageIceDetailed); MODELOBJECT_TEMPLATES(WaterUseConnections); SWIG_MODELOBJECT(AirConditionerVariableRefrigerantFlow,1); +SWIG_MODELOBJECT(AirLoopHVACExhaustSystem,1); SWIG_MODELOBJECT(AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass,1); SWIG_MODELOBJECT(AirLoopHVACUnitaryHeatPumpAirToAir,1); SWIG_MODELOBJECT(AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed,1); diff --git a/src/model/ModelZoneHVAC.i b/src/model/ModelZoneHVAC.i index aa727fd6b0..fa9c3f3ad1 100644 --- a/src/model/ModelZoneHVAC.i +++ b/src/model/ModelZoneHVAC.i @@ -54,6 +54,7 @@ MODELOBJECT_TEMPLATES(ZoneHVACCoolingPanelRadiantConvectiveWater); MODELOBJECT_TEMPLATES(ZoneHVACDehumidifierDX); MODELOBJECT_TEMPLATES(ZoneHVACEnergyRecoveryVentilator); MODELOBJECT_TEMPLATES(ZoneHVACEnergyRecoveryVentilatorController); +MODELOBJECT_TEMPLATES(ZoneHVACExhaustControl); MODELOBJECT_TEMPLATES(ZoneHVACFourPipeFanCoil); MODELOBJECT_TEMPLATES(ZoneHVACHighTemperatureRadiant); MODELOBJECT_TEMPLATES(ZoneHVACIdealLoadsAirSystem); @@ -79,6 +80,7 @@ SWIG_MODELOBJECT(ZoneHVACCoolingPanelRadiantConvectiveWater,1); SWIG_MODELOBJECT(ZoneHVACDehumidifierDX,1); SWIG_MODELOBJECT(ZoneHVACEnergyRecoveryVentilator,1); SWIG_MODELOBJECT(ZoneHVACEnergyRecoveryVentilatorController,1); +SWIG_MODELOBJECT(ZoneHVACExhaustControl,1); SWIG_MODELOBJECT(ZoneHVACFourPipeFanCoil,1); SWIG_MODELOBJECT(ZoneHVACHighTemperatureRadiant,1); SWIG_MODELOBJECT(ZoneHVACIdealLoadsAirSystem,1); diff --git a/src/model/ScheduleTypeRegistry.cpp b/src/model/ScheduleTypeRegistry.cpp index a24cbe7b57..77a94a7da6 100644 --- a/src/model/ScheduleTypeRegistry.cpp +++ b/src/model/ScheduleTypeRegistry.cpp @@ -558,6 +558,12 @@ namespace model { {"ZoneHVACUnitVentilator", "Maximum Outdoor Air Fraction or Temperature", "maximumOutdoorAirFractionorTemperatureSchedule", true, "", OptionalDouble(), OptionalDouble()}, {"ZoneHVACUnitVentilator", "Supply Air Fan Operating Mode", "supplyAirFanOperatingModeSchedule", false, "ControlMode", 0.0, 1.0}, + {"ZoneHVACExhaustControl", "Availability", "availabilitySchedule", false, "Availability", 0.0, 1.0}, + {"ZoneHVACExhaustControl", "Exhaust Flow Fraction", "exhaustFlowFractionSchedule", true, "", 0.0, 1.0}, + {"ZoneHVACExhaustControl", "Minimum Zone Temperature Limit", "minimumZoneTemperatureLimitSchedule", true, "Temperature", OptionalDouble(), + OptionalDouble()}, + {"ZoneHVACExhaustControl", "Minimum Exhaust Flow Fraction", "minimumExhaustFlowFractionSchedule", true, "", 0.0, 1.0}, + {"ZoneHVACExhaustControl", "Balanced Exhaust Fraction", "balancedExhaustFractionSchedule", true, "", 0.0, 1.0}, {"ZoneMixing", "Zone Mixing", "schedule", true, "Dimensionless", 0.0, 1.0}, {"ZoneMixing", "Delta Temperature", "deltaTemperatureSchedule", true, "DeltaTemperature", OptionalDouble(), OptionalDouble()}, {"ZoneMixing", "Minimum Receiving Temperature", "minimumReceivingTemperatureSchedule", true, "Temperature", OptionalDouble(), OptionalDouble()}, diff --git a/src/model/ZoneHVACExhaustControl.cpp b/src/model/ZoneHVACExhaustControl.cpp new file mode 100644 index 0000000000..d1686a7053 --- /dev/null +++ b/src/model/ZoneHVACExhaustControl.cpp @@ -0,0 +1,419 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2023, 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 "ZoneHVACExhaustControl.hpp" +#include "ZoneHVACExhaustControl_Impl.hpp" + +#include "Model.hpp" +#include "Model_Impl.hpp" +#include "Schedule.hpp" +#include "Schedule_Impl.hpp" +#include "ThermalZone.hpp" +#include "ThermalZone_Impl.hpp" +#include "ScheduleTypeLimits.hpp" +#include "ScheduleTypeRegistry.hpp" + +#include "../utilities/core/Assert.hpp" +#include "../utilities/data/DataEnums.hpp" + +#include +#include +#include + +namespace openstudio { +namespace model { + + namespace detail { + + ZoneHVACExhaustControl_Impl::ZoneHVACExhaustControl_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) + : ZoneHVACComponent_Impl(idfObject, model, keepHandle) { + OS_ASSERT(idfObject.iddObject().type() == ZoneHVACExhaustControl::iddObjectType()); + } + + ZoneHVACExhaustControl_Impl::ZoneHVACExhaustControl_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, + bool keepHandle) + : ZoneHVACComponent_Impl(other, model, keepHandle) { + OS_ASSERT(other.iddObject().type() == ZoneHVACExhaustControl::iddObjectType()); + } + + ZoneHVACExhaustControl_Impl::ZoneHVACExhaustControl_Impl(const ZoneHVACExhaustControl_Impl& other, Model_Impl* model, bool keepHandle) + : ZoneHVACComponent_Impl(other, model, keepHandle) {} + + const std::vector& ZoneHVACExhaustControl_Impl::outputVariableNames() const { + static std::vector result; + if (result.empty()) { + } + return result; + } + + IddObjectType ZoneHVACExhaustControl_Impl::iddObjectType() const { + return ZoneHVACExhaustControl::iddObjectType(); + } + + std::vector ZoneHVACExhaustControl_Impl::getScheduleTypeKeys(const Schedule& schedule) const { + // TODO: Check schedule display names. + std::vector result; + const UnsignedVector fieldIndices = getSourceIndices(schedule.handle()); + if (std::find(fieldIndices.cbegin(), fieldIndices.cend(), OS_ZoneHVAC_ExhaustControlFields::AvailabilityScheduleName) != fieldIndices.cend()) { + result.emplace_back("ZoneHVACExhaustControl", "Availability"); + } + if (std::find(fieldIndices.cbegin(), fieldIndices.cend(), OS_ZoneHVAC_ExhaustControlFields::ExhaustFlowFractionScheduleName) + != fieldIndices.cend()) { + result.emplace_back("ZoneHVACExhaustControl", "Exhaust Flow Fraction"); + } + if (std::find(fieldIndices.cbegin(), fieldIndices.cend(), OS_ZoneHVAC_ExhaustControlFields::MinimumZoneTemperatureLimitScheduleName) + != fieldIndices.cend()) { + result.emplace_back("ZoneHVACExhaustControl", "Minimum Zone Temperature Limit"); + } + if (std::find(fieldIndices.cbegin(), fieldIndices.cend(), OS_ZoneHVAC_ExhaustControlFields::MinimumExhaustFlowFractionScheduleName) + != fieldIndices.cend()) { + result.emplace_back("ZoneHVACExhaustControl", "Minimum Exhaust Flow Fraction"); + } + if (std::find(fieldIndices.cbegin(), fieldIndices.cend(), OS_ZoneHVAC_ExhaustControlFields::BalancedExhaustFractionScheduleName) + != fieldIndices.cend()) { + result.emplace_back("ZoneHVACExhaustControl", "Balanced Exhaust Fraction"); + } + return result; + } + + unsigned ZoneHVACExhaustControl_Impl::inletPort() const { + return OS_ZoneHVAC_ExhaustControlFields::InletNodeName; + } + + unsigned ZoneHVACExhaustControl_Impl::outletPort() const { + return OS_ZoneHVAC_ExhaustControlFields::OutletNodeName; + } + + ComponentType ZoneHVACExhaustControl_Impl::componentType() const { + return ComponentType::None; + } + + std::vector ZoneHVACExhaustControl_Impl::coolingFuelTypes() const { + return {}; + } + + std::vector ZoneHVACExhaustControl_Impl::heatingFuelTypes() const { + return {}; + } + + std::vector ZoneHVACExhaustControl_Impl::appGHeatingFuelTypes() const { + return {}; + } + + Schedule ZoneHVACExhaustControl_Impl::availabilitySchedule() const { + boost::optional value = optionalAvailabilitySchedule(); + if (!value) { + LOG_AND_THROW(briefDescription() << " does not have an Availability Schedule attached."); + } + return value.get(); + } + + boost::optional ZoneHVACExhaustControl_Impl::thermalZone() const { + auto thisObject = this->getObject(); + std::vector thermalZones = this->model().getConcreteModelObjects(); + for (const auto& thermalZone : thermalZones) { + std::vector equipment = thermalZone.equipment(); + + if (std::find(equipment.begin(), equipment.end(), thisObject) != equipment.end()) { + return thermalZone; + } + } + return boost::none; + } + + boost::optional ZoneHVACExhaustControl_Impl::designExhaustFlowRate() const { + return getDouble(OS_ZoneHVAC_ExhaustControlFields::DesignExhaustFlowRate, true); + } + + bool ZoneHVACExhaustControl_Impl::isDesignExhaustFlowRateAutosized() const { + bool result = false; + boost::optional value = getString(OS_ZoneHVAC_ExhaustControlFields::DesignExhaustFlowRate, true); + if (value) { + result = openstudio::istringEqual(value.get(), "autosize"); + } + return result; + } + + boost::optional ZoneHVACExhaustControl_Impl::autosizedDesignExhaustFlowRate() { + return getAutosizedValue("TODO_CHECK_SQL Design Exhaust Flow Rate", "m3/s"); + } + + std::string ZoneHVACExhaustControl_Impl::flowControlType() const { + boost::optional value = getString(OS_ZoneHVAC_ExhaustControlFields::FlowControlType, true); + OS_ASSERT(value); + return value.get(); + } + + boost::optional ZoneHVACExhaustControl_Impl::exhaustFlowFractionSchedule() const { + return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::ExhaustFlowFractionScheduleName); + } + + boost::optional ZoneHVACExhaustControl_Impl::minimumZoneTemperatureLimitSchedule() const { + return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::MinimumZoneTemperatureLimitScheduleName); + } + + boost::optional ZoneHVACExhaustControl_Impl::minimumExhaustFlowFractionSchedule() const { + return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::MinimumExhaustFlowFractionScheduleName); + } + + boost::optional ZoneHVACExhaustControl_Impl::balancedExhaustFractionSchedule() const { + return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::BalancedExhaustFractionScheduleName); + } + + bool ZoneHVACExhaustControl_Impl::setAvailabilitySchedule(Schedule& schedule) { + const bool result = setSchedule(OS_ZoneHVAC_ExhaustControlFields::AvailabilityScheduleName, "ZoneHVACExhaustControl", "Availability", schedule); + return result; + } + + bool ZoneHVACExhaustControl_Impl::addToThermalZone(ThermalZone& thermalZone) { + Model m = this->model(); + + if (thermalZone.model() != m) { + return false; + } + + if (thermalZone.isPlenum()) { + return false; + } + + removeFromThermalZone(); + + thermalZone.setUseIdealAirLoads(false); + + thermalZone.addEquipment(this->getObject()); + + return true; + } + + void ZoneHVACExhaustControl_Impl::removeFromThermalZone() { + if (boost::optional thermalZone = this->thermalZone()) { + thermalZone->removeEquipment(this->getObject()); + } + } + + bool ZoneHVACExhaustControl_Impl::setDesignExhaustFlowRate(double designExhaustFlowRate) { + const bool result = setDouble(OS_ZoneHVAC_ExhaustControlFields::DesignExhaustFlowRate, designExhaustFlowRate); + return result; + } + + void ZoneHVACExhaustControl_Impl::autosizeDesignExhaustFlowRate() { + const bool result = setString(OS_ZoneHVAC_ExhaustControlFields::DesignExhaustFlowRate, "autosize"); + OS_ASSERT(result); + } + + bool ZoneHVACExhaustControl_Impl::setFlowControlType(const std::string& flowControlType) { + const bool result = setString(OS_ZoneHVAC_ExhaustControlFields::FlowControlType, flowControlType); + return result; + } + + bool ZoneHVACExhaustControl_Impl::setExhaustFlowFractionSchedule(Schedule& schedule) { + const bool result = + setSchedule(OS_ZoneHVAC_ExhaustControlFields::ExhaustFlowFractionScheduleName, "ZoneHVACExhaustControl", "Exhaust Flow Fraction", schedule); + return result; + } + + void ZoneHVACExhaustControl_Impl::resetExhaustFlowFractionSchedule() { + const bool result = setString(OS_ZoneHVAC_ExhaustControlFields::ExhaustFlowFractionScheduleName, ""); + OS_ASSERT(result); + } + + bool ZoneHVACExhaustControl_Impl::setMinimumZoneTemperatureLimitSchedule(Schedule& schedule) { + const bool result = setSchedule(OS_ZoneHVAC_ExhaustControlFields::MinimumZoneTemperatureLimitScheduleName, "ZoneHVACExhaustControl", + "Minimum Zone Temperature Limit", schedule); + return result; + } + + void ZoneHVACExhaustControl_Impl::resetMinimumZoneTemperatureLimitSchedule() { + const bool result = setString(OS_ZoneHVAC_ExhaustControlFields::MinimumZoneTemperatureLimitScheduleName, ""); + OS_ASSERT(result); + } + + bool ZoneHVACExhaustControl_Impl::setMinimumExhaustFlowFractionSchedule(Schedule& schedule) { + const bool result = setSchedule(OS_ZoneHVAC_ExhaustControlFields::MinimumExhaustFlowFractionScheduleName, "ZoneHVACExhaustControl", + "Minimum Exhaust Flow Fraction", schedule); + return result; + } + + void ZoneHVACExhaustControl_Impl::resetMinimumExhaustFlowFractionSchedule() { + const bool result = setString(OS_ZoneHVAC_ExhaustControlFields::MinimumExhaustFlowFractionScheduleName, ""); + OS_ASSERT(result); + } + + bool ZoneHVACExhaustControl_Impl::setBalancedExhaustFractionSchedule(Schedule& schedule) { + const bool result = setSchedule(OS_ZoneHVAC_ExhaustControlFields::BalancedExhaustFractionScheduleName, "ZoneHVACExhaustControl", + "Balanced Exhaust Fraction", schedule); + return result; + } + + void ZoneHVACExhaustControl_Impl::resetBalancedExhaustFractionSchedule() { + const bool result = setString(OS_ZoneHVAC_ExhaustControlFields::BalancedExhaustFractionScheduleName, ""); + OS_ASSERT(result); + } + + void ZoneHVACExhaustControl_Impl::autosize() { + autosizeDesignExhaustFlowRate(); + } + + void ZoneHVACExhaustControl_Impl::applySizingValues() { + if (boost::optional val_ = autosizedDesignExhaustFlowRate()) { + setDesignExhaustFlowRate(*val_); + } + } + + boost::optional ZoneHVACExhaustControl_Impl::optionalAvailabilitySchedule() const { + return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::AvailabilityScheduleName); + } + + } // namespace detail + + ZoneHVACExhaustControl::ZoneHVACExhaustControl(const Model& model) : ZoneHVACComponent(ZoneHVACExhaustControl::iddObjectType(), model) { + OS_ASSERT(getImpl()); + + bool ok = true; + + auto alwaysOn = model.alwaysOnDiscreteSchedule(); + ok = setAvailabilitySchedule(alwaysOn); + OS_ASSERT(ok); + + autosizeDesignExhaustFlowRate(); + + ok = setFlowControlType("Scheduled"); + OS_ASSERT(ok); + } + + IddObjectType ZoneHVACExhaustControl::iddObjectType() { + return {IddObjectType::OS_ZoneHVAC_ExhaustControl}; + } + + std::vector ZoneHVACExhaustControl::flowControlTypeValues() { + return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ZoneHVAC_ExhaustControlFields::FlowControlType); + } + + Schedule ZoneHVACExhaustControl::availabilitySchedule() const { + return getImpl()->availabilitySchedule(); + } + + boost::optional ZoneHVACExhaustControl::thermalZone() const { + return getImpl()->thermalZone(); + } + + boost::optional ZoneHVACExhaustControl::designExhaustFlowRate() const { + return getImpl()->designExhaustFlowRate(); + } + + bool ZoneHVACExhaustControl::isDesignExhaustFlowRateAutosized() const { + return getImpl()->isDesignExhaustFlowRateAutosized(); + } + + boost::optional ZoneHVACExhaustControl::autosizedDesignExhaustFlowRate() { + return getImpl()->autosizedDesignExhaustFlowRate(); + } + + std::string ZoneHVACExhaustControl::flowControlType() const { + return getImpl()->flowControlType(); + } + + boost::optional ZoneHVACExhaustControl::exhaustFlowFractionSchedule() const { + return getImpl()->exhaustFlowFractionSchedule(); + } + + boost::optional ZoneHVACExhaustControl::minimumZoneTemperatureLimitSchedule() const { + return getImpl()->minimumZoneTemperatureLimitSchedule(); + } + + boost::optional ZoneHVACExhaustControl::minimumExhaustFlowFractionSchedule() const { + return getImpl()->minimumExhaustFlowFractionSchedule(); + } + + boost::optional ZoneHVACExhaustControl::balancedExhaustFractionSchedule() const { + return getImpl()->balancedExhaustFractionSchedule(); + } + + bool ZoneHVACExhaustControl::setAvailabilitySchedule(Schedule& schedule) { + return getImpl()->setAvailabilitySchedule(schedule); + } + + bool ZoneHVACExhaustControl::addToThermalZone(ThermalZone& thermalZone) { + return getImpl()->addToThermalZone(thermalZone); + } + + void ZoneHVACExhaustControl::removeFromThermalZone() { + getImpl()->removeFromThermalZone(); + } + + bool ZoneHVACExhaustControl::setDesignExhaustFlowRate(double designExhaustFlowRate) { + return getImpl()->setDesignExhaustFlowRate(designExhaustFlowRate); + } + + void ZoneHVACExhaustControl::autosizeDesignExhaustFlowRate() { + getImpl()->autosizeDesignExhaustFlowRate(); + } + + bool ZoneHVACExhaustControl::setFlowControlType(const std::string& flowControlType) { + return getImpl()->setFlowControlType(flowControlType); + } + + bool ZoneHVACExhaustControl::setExhaustFlowFractionSchedule(Schedule& schedule) { + return getImpl()->setExhaustFlowFractionSchedule(schedule); + } + + void ZoneHVACExhaustControl::resetExhaustFlowFractionSchedule() { + getImpl()->resetExhaustFlowFractionSchedule(); + } + + bool ZoneHVACExhaustControl::setMinimumZoneTemperatureLimitSchedule(Schedule& schedule) { + return getImpl()->setMinimumZoneTemperatureLimitSchedule(schedule); + } + + void ZoneHVACExhaustControl::resetMinimumZoneTemperatureLimitSchedule() { + getImpl()->resetMinimumZoneTemperatureLimitSchedule(); + } + + bool ZoneHVACExhaustControl::setMinimumExhaustFlowFractionSchedule(Schedule& schedule) { + return getImpl()->setMinimumExhaustFlowFractionSchedule(schedule); + } + + void ZoneHVACExhaustControl::resetMinimumExhaustFlowFractionSchedule() { + getImpl()->resetMinimumExhaustFlowFractionSchedule(); + } + + bool ZoneHVACExhaustControl::setBalancedExhaustFractionSchedule(Schedule& schedule) { + return getImpl()->setBalancedExhaustFractionSchedule(schedule); + } + + void ZoneHVACExhaustControl::resetBalancedExhaustFractionSchedule() { + getImpl()->resetBalancedExhaustFractionSchedule(); + } + + /// @cond + ZoneHVACExhaustControl::ZoneHVACExhaustControl(std::shared_ptr impl) : ZoneHVACComponent(std::move(impl)) {} + /// @endcond + +} // namespace model +} // namespace openstudio diff --git a/src/model/ZoneHVACExhaustControl.hpp b/src/model/ZoneHVACExhaustControl.hpp new file mode 100644 index 0000000000..b7b1401cdd --- /dev/null +++ b/src/model/ZoneHVACExhaustControl.hpp @@ -0,0 +1,154 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2023, 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_ZONEHVACEXHAUSTCONTROL_HPP +#define MODEL_ZONEHVACEXHAUSTCONTROL_HPP + +#include +#include "ZoneHVACComponent.hpp" + +namespace openstudio { + +namespace model { + + class Schedule; + + namespace detail { + + class ZoneHVACExhaustControl_Impl; + + } // namespace detail + + /** ZoneHVACExhaustControl is a ZoneHVACComponent that wraps the OpenStudio IDD object 'OS:ZoneHVAC:ExhaustControl'. */ + class MODEL_API ZoneHVACExhaustControl : public ZoneHVACComponent + { + public: + /** @name Constructors and Destructors */ + //@{ + + explicit ZoneHVACExhaustControl(const Model& model); + + virtual ~ZoneHVACExhaustControl() = default; + // Default the copy and move operators because the virtual dtor is explicit + ZoneHVACExhaustControl(const ZoneHVACExhaustControl& other) = default; + ZoneHVACExhaustControl(ZoneHVACExhaustControl&& other) = default; + ZoneHVACExhaustControl& operator=(const ZoneHVACExhaustControl&) = default; + ZoneHVACExhaustControl& operator=(ZoneHVACExhaustControl&&) = default; + + //@} + + static IddObjectType iddObjectType(); + + static std::vector flowControlTypeValues(); + + /** @name Getters */ + //@{ + + Schedule availabilitySchedule() const; + + boost::optional thermalZone() const override; + + boost::optional designExhaustFlowRate() const; + + bool isDesignExhaustFlowRateAutosized() const; + + boost::optional autosizedDesignExhaustFlowRate(); + + std::string flowControlType() const; + + boost::optional exhaustFlowFractionSchedule() const; + + boost::optional minimumZoneTemperatureLimitSchedule() const; + + boost::optional minimumExhaustFlowFractionSchedule() const; + + boost::optional balancedExhaustFractionSchedule() const; + + //@} + /** @name Setters */ + //@{ + + bool setAvailabilitySchedule(Schedule& schedule); + + bool addToThermalZone(ThermalZone& thermalZone); + + void removeFromThermalZone(); + + bool setDesignExhaustFlowRate(double designExhaustFlowRate); + + void autosizeDesignExhaustFlowRate(); + + bool setFlowControlType(const std::string& flowControlType); + + bool setExhaustFlowFractionSchedule(Schedule& schedule); + + void resetExhaustFlowFractionSchedule(); + + bool setMinimumZoneTemperatureLimitSchedule(Schedule& schedule); + + void resetMinimumZoneTemperatureLimitSchedule(); + + bool setMinimumExhaustFlowFractionSchedule(Schedule& schedule); + + void resetMinimumExhaustFlowFractionSchedule(); + + bool setBalancedExhaustFractionSchedule(Schedule& schedule); + + void resetBalancedExhaustFractionSchedule(); + + //@} + /** @name Other */ + //@{ + + //@} + protected: + /// @cond + using ImplType = detail::ZoneHVACExhaustControl_Impl; + + explicit ZoneHVACExhaustControl(std::shared_ptr impl); + + friend class detail::ZoneHVACExhaustControl_Impl; + friend class Model; + friend class IdfObject; + friend class openstudio::detail::IdfObject_Impl; + /// @endcond + private: + REGISTER_LOGGER("openstudio.model.ZoneHVACExhaustControl"); + }; + + /** \relates ZoneHVACExhaustControl*/ + using OptionalZoneHVACExhaustControl = boost::optional; + + /** \relates ZoneHVACExhaustControl*/ + using ZoneHVACExhaustControlVector = std::vector; + +} // namespace model +} // namespace openstudio + +#endif // MODEL_ZONEHVACEXHAUSTCONTROL_HPP diff --git a/src/model/ZoneHVACExhaustControl_Impl.hpp b/src/model/ZoneHVACExhaustControl_Impl.hpp new file mode 100644 index 0000000000..5a3dcbe4c4 --- /dev/null +++ b/src/model/ZoneHVACExhaustControl_Impl.hpp @@ -0,0 +1,154 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2023, 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_ZONEHVACEXHAUSTCONTROL_IMPL_HPP +#define MODEL_ZONEHVACEXHAUSTCONTROL_IMPL_HPP + +#include +#include "ZoneHVACComponent_Impl.hpp" + +namespace openstudio { +namespace model { + + class Schedule; + + namespace detail { + + /** ZoneHVACExhaustControl_Impl is a ZoneHVACComponent_Impl that is the implementation class for ZoneHVACExhaustControl.*/ + class MODEL_API ZoneHVACExhaustControl_Impl : public ZoneHVACComponent_Impl + { + public: + /** @name Constructors and Destructors */ + //@{ + + ZoneHVACExhaustControl_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle); + + ZoneHVACExhaustControl_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle); + + ZoneHVACExhaustControl_Impl(const ZoneHVACExhaustControl_Impl& other, Model_Impl* model, bool keepHandle); + + virtual ~ZoneHVACExhaustControl_Impl() = default; + + //@} + /** @name Virtual Methods */ + //@{ + + virtual const std::vector& outputVariableNames() const override; + + virtual IddObjectType iddObjectType() const override; + + virtual std::vector getScheduleTypeKeys(const Schedule& schedule) const override; + + virtual unsigned inletPort() const override; + + virtual unsigned outletPort() const override; + + virtual void autosize() override; + + virtual void applySizingValues() override; + + virtual ComponentType componentType() const override; + virtual std::vector coolingFuelTypes() const override; + virtual std::vector heatingFuelTypes() const override; + virtual std::vector appGHeatingFuelTypes() const override; + + //@} + /** @name Getters */ + //@{ + + Schedule availabilitySchedule() const; + + boost::optional thermalZone() const override; + + boost::optional designExhaustFlowRate() const; + + bool isDesignExhaustFlowRateAutosized() const; + + boost::optional autosizedDesignExhaustFlowRate(); + + std::string flowControlType() const; + + boost::optional exhaustFlowFractionSchedule() const; + + boost::optional minimumZoneTemperatureLimitSchedule() const; + + boost::optional minimumExhaustFlowFractionSchedule() const; + + boost::optional balancedExhaustFractionSchedule() const; + + //@} + /** @name Setters */ + //@{ + + bool setAvailabilitySchedule(Schedule& schedule); + + bool addToThermalZone(ThermalZone& thermalZone) override; + + void removeFromThermalZone() override; + + bool setDesignExhaustFlowRate(double designExhaustFlowRate); + + void autosizeDesignExhaustFlowRate(); + + bool setFlowControlType(const std::string& flowControlType); + + bool setExhaustFlowFractionSchedule(Schedule& schedule); + + void resetExhaustFlowFractionSchedule(); + + bool setMinimumZoneTemperatureLimitSchedule(Schedule& schedule); + + void resetMinimumZoneTemperatureLimitSchedule(); + + bool setMinimumExhaustFlowFractionSchedule(Schedule& schedule); + + void resetMinimumExhaustFlowFractionSchedule(); + + bool setBalancedExhaustFractionSchedule(Schedule& schedule); + + void resetBalancedExhaustFractionSchedule(); + + //@} + /** @name Other */ + //@{ + + //@} + protected: + private: + REGISTER_LOGGER("openstudio.model.ZoneHVACExhaustControl"); + + boost::optional optionalAvailabilitySchedule() const; + }; + + } // namespace detail + +} // namespace model +} // namespace openstudio + +#endif // MODEL_ZONEHVACEXHAUSTCONTROL_IMPL_HPP diff --git a/src/model/test/AirLoopHVACExhaustSystem_GTest.cpp b/src/model/test/AirLoopHVACExhaustSystem_GTest.cpp new file mode 100644 index 0000000000..a913ed302c --- /dev/null +++ b/src/model/test/AirLoopHVACExhaustSystem_GTest.cpp @@ -0,0 +1,61 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2023, 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 "ModelFixture.hpp" + +#include "../AirLoopHVACExhaustSystem.hpp" +#include "../AirLoopHVACExhaustSystem_Impl.hpp" +#include "../FanSystemModel.hpp" +#include "../FanSystemModel_Impl.hpp" + +using namespace openstudio; +using namespace openstudio::model; + +TEST_F(ModelFixture, AirLoopHVACExhaustSystem_GettersSetters) { + Model m; + + AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m); + + airLoopHVACExhaustSystem.setName("My AirLoopHVACExhaustSystem"); + + // Fan Name: Required Object + FanSystemModel fan(m); + EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan)); + EXPECT_EQ(fan, airLoopHVACExhaustSystem.fan()); +} +TEST_F(ModelFixture, AirLoopHVACExhaustSystem_HeatCoolFuelTypes) { + Model m; + + AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m); + + EXPECT_EQ(ComponentType(ComponentType::Both), airLoopHVACExhaustSystem.componentType()); + testFuelTypeEquality({FuelType::Electricity}, airLoopHVACExhaustSystem.coolingFuelTypes()); + testFuelTypeEquality({FuelType::Electricity, FuelType::Propane}, airLoopHVACExhaustSystem.heatingFuelTypes()); + testAppGFuelTypeEquality({AppGFuelType::Fuel, AppGFuelType::HeatPump}, airLoopHVACExhaustSystem.appGHeatingFuelTypes()); +} diff --git a/src/model/test/ZoneHVACExhaustControl_GTest.cpp b/src/model/test/ZoneHVACExhaustControl_GTest.cpp new file mode 100644 index 0000000000..07e11da5be --- /dev/null +++ b/src/model/test/ZoneHVACExhaustControl_GTest.cpp @@ -0,0 +1,108 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2023, 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 "ModelFixture.hpp" + +#include "../ZoneHVACExhaustControl.hpp" +#include "../ZoneHVACExhaustControl_Impl.hpp" +#include "../Schedule.hpp" +#include "../Schedule_Impl.hpp" +#include "../ScheduleConstant.hpp" +#include "../ScheduleConstant_Impl.hpp" + +using namespace openstudio; +using namespace openstudio::model; + +TEST_F(ModelFixture, ZoneHVACExhaustControl_GettersSetters) { + Model m; + + ZoneHVACExhaustControl zoneHVACExhaustControl(m); + + zoneHVACExhaustControl.setName("My ZoneHVACExhaustControl"); + + // Availability Schedule Name: Required Object + Schedule availabilitySchedule = m.alwaysOnDiscreteSchedule(); + EXPECT_TRUE(zoneHVACExhaustControl.setAvailabilitySchedule(availabilitySchedule)); + EXPECT_EQ(availabilitySchedule, zoneHVACExhaustControl.availabilitySchedule()); + + // Design Exhaust Flow Rate: Required Double + // Autosize + zoneHVACExhaustControl.autosizeDesignExhaustFlowRate(); + EXPECT_TRUE(zoneHVACExhaustControl.isDesignExhaustFlowRateAutosized()); + // Set + EXPECT_TRUE(zoneHVACExhaustControl.setDesignExhaustFlowRate(0.7)); + ASSERT_TRUE(zoneHVACExhaustControl.designExhaustFlowRate()); + EXPECT_EQ(0.7, zoneHVACExhaustControl.designExhaustFlowRate().get()); + // Bad Value + EXPECT_FALSE(zoneHVACExhaustControl.setDesignExhaustFlowRate(-10.0)); + ASSERT_TRUE(zoneHVACExhaustControl.designExhaustFlowRate()); + EXPECT_EQ(0.7, zoneHVACExhaustControl.designExhaustFlowRate().get()); + EXPECT_FALSE(zoneHVACExhaustControl.isDesignExhaustFlowRateAutosized()); + + // Flow Control Type: Required String + EXPECT_TRUE(zoneHVACExhaustControl.setFlowControlType("Scheduled")); + EXPECT_EQ("Scheduled", zoneHVACExhaustControl.flowControlType()); + // Bad Value + EXPECT_FALSE(zoneHVACExhaustControl.setFlowControlType("BADENUM")); + EXPECT_EQ("Scheduled", zoneHVACExhaustControl.flowControlType()); + + // Exhaust Flow Fraction Schedule Name: Optional Object + ScheduleConstant exhaustFlowFractionSchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setExhaustFlowFractionSchedule(exhaustFlowFractionSchedule)); + ASSERT_TRUE(zoneHVACExhaustControl.exhaustFlowFractionSchedule()); + EXPECT_EQ(exhaustFlowFractionSchedule, zoneHVACExhaustControl.exhaustFlowFractionSchedule().get()); + + // Minimum Zone Temperature Limit Schedule Name: Optional Object + ScheduleConstant minimumZoneTemperatureLimitSchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setMinimumZoneTemperatureLimitSchedule(minimumZoneTemperatureLimitSchedule)); + ASSERT_TRUE(zoneHVACExhaustControl.minimumZoneTemperatureLimitSchedule()); + EXPECT_EQ(minimumZoneTemperatureLimitSchedule, zoneHVACExhaustControl.minimumZoneTemperatureLimitSchedule().get()); + + // Minimum Exhaust Flow Fraction Schedule Name: Optional Object + ScheduleConstant minimumExhaustFlowFractionSchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setMinimumExhaustFlowFractionSchedule(minimumExhaustFlowFractionSchedule)); + ASSERT_TRUE(zoneHVACExhaustControl.minimumExhaustFlowFractionSchedule()); + EXPECT_EQ(minimumExhaustFlowFractionSchedule, zoneHVACExhaustControl.minimumExhaustFlowFractionSchedule().get()); + + // Balanced Exhaust Fraction Schedule Name: Optional Object + ScheduleConstant balancedExhaustFractionSchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setBalancedExhaustFractionSchedule(balancedExhaustFractionSchedule)); + ASSERT_TRUE(zoneHVACExhaustControl.balancedExhaustFractionSchedule()); + EXPECT_EQ(balancedExhaustFractionSchedule, zoneHVACExhaustControl.balancedExhaustFractionSchedule().get()); +} +TEST_F(ModelFixture, ZoneHVACExhaustControl_HeatCoolFuelTypes) { + Model m; + + ZoneHVACExhaustControl zoneHVACExhaustControl(m); + + EXPECT_EQ(ComponentType(ComponentType::Both), zoneHVACExhaustControl.componentType()); + testFuelTypeEquality({FuelType::Electricity}, zoneHVACExhaustControl.coolingFuelTypes()); + testFuelTypeEquality({FuelType::Electricity, FuelType::Propane}, zoneHVACExhaustControl.heatingFuelTypes()); + testAppGFuelTypeEquality({AppGFuelType::Fuel, AppGFuelType::HeatPump}, zoneHVACExhaustControl.appGHeatingFuelTypes()); +}