From 67da59ebdc8da4c45af184961e2794da7b311932 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Tue, 14 Jan 2025 14:42:32 -0700 Subject: [PATCH 01/17] Add ZoneHVAC:ExhaustControl and AirLoopHVAC:ExhaustSystem objects to idd. --- resources/model/OpenStudio.idd | 87 +++++++++++++++++++++++++++++++++- 1 file changed, 86 insertions(+), 1 deletion(-) diff --git a/resources/model/OpenStudio.idd b/resources/model/OpenStudio.idd index 29f7d7f557..9e9f64b183 100644 --- a/resources/model/OpenStudio.idd +++ b/resources/model/OpenStudio.idd @@ -11203,6 +11203,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 @@ -29146,7 +29167,6 @@ OS:ZoneHVAC:EquipmentList, \type object-list \object-list ScheduleNames - OS:ZoneVentilation:DesignFlowRate, A1, \field Handle \type handle @@ -29468,6 +29488,71 @@ 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 Zone Name + \required-field + \note Zone the exhaust inlet node is part of + \type object-list + \object-list ThermalZoneNames + A5 , \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 + A6 , \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 + A7 , \field Flow Control Type + \note Control type of the zone exhaust flow + \type choice + \key Scheduled + \key FollowSupply + \required-field + A8 , \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 + A9 , \field Supply Node or NodeList Name + \note Used only with FollowSupply control type. + \type object-list + \object-list ConnectionNames + A10, \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 + A11, \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 + A12; \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 From 61aeb1d11693b7792e204472e5dbe11da8b4900f Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Wed, 15 Jan 2025 13:43:12 -0700 Subject: [PATCH 02/17] Generate and add source files. --- resources/model/OpenStudio.idd | 1 - ...rwardTranslateAirLoopHVACExhaustSystem.cpp | 89 ++++ ...ForwardTranslateZoneHVACExhaustControl.cpp | 148 ++++++ .../Test/AirLoopHVACExhaustSystem_GTest.cpp | 83 +++ .../Test/ZoneHVACExhaustControl_GTest.cpp | 115 ++++ src/model/AirloopHVACExhaustSystem.cpp | 177 +++++++ src/model/AirloopHVACExhaustSystem.hpp | 117 ++++ src/model/AirloopHVACExhaustSystem_Impl.hpp | 121 +++++ src/model/ScheduleTypeRegistry.cpp | 5 + src/model/ZoneHVACExhaustControl.cpp | 501 ++++++++++++++++++ src/model/ZoneHVACExhaustControl.hpp | 192 +++++++ src/model/ZoneHVACExhaustControl_Impl.hpp | 201 +++++++ .../test/AirloopHVACExhaustSystem_GTest.cpp | 76 +++ .../test/ZoneHVACExhaustControl_GTest.cpp | 140 +++++ 14 files changed, 1965 insertions(+), 1 deletion(-) create mode 100644 src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp create mode 100644 src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp create mode 100644 src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp create mode 100644 src/energyplus/Test/ZoneHVACExhaustControl_GTest.cpp create mode 100644 src/model/AirloopHVACExhaustSystem.cpp create mode 100644 src/model/AirloopHVACExhaustSystem.hpp create mode 100644 src/model/AirloopHVACExhaustSystem_Impl.hpp create mode 100644 src/model/ZoneHVACExhaustControl.cpp create mode 100644 src/model/ZoneHVACExhaustControl.hpp create mode 100644 src/model/ZoneHVACExhaustControl_Impl.hpp create mode 100644 src/model/test/AirloopHVACExhaustSystem_GTest.cpp create mode 100644 src/model/test/ZoneHVACExhaustControl_GTest.cpp diff --git a/resources/model/OpenStudio.idd b/resources/model/OpenStudio.idd index 9e9f64b183..07ac3354e4 100644 --- a/resources/model/OpenStudio.idd +++ b/resources/model/OpenStudio.idd @@ -12912,7 +12912,6 @@ OS:AirTerminal:SingleDuct:ConstantVolume:NoReheat, \units m3/s \minimum 0 - OS:AirTerminal:SingleDuct:VAV:NoReheat, \min-fields 1 A1, \field Handle diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp new file mode 100644 index 0000000000..b07e31e01b --- /dev/null +++ b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp @@ -0,0 +1,89 @@ +/*********************************************************************************************************************** +* 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" + +// TODO: Check the following class names against object getters and setters. +#include "../../model/ZoneMixers.hpp" +#include "../../model/ZoneMixers_Impl.hpp" + +#include "../../model/FansSystemModel.hpp" +#include "../../model/FansSystemModel_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); + // If it doesn't have a name, or if you aren't sure you are going to want to return it + // IdfObject idfObject(openstudio::IddObjectType::AirLoopHVAC_ExhaustSystem); + // m_idfObjects.push_back(idfObject); + + // TODO: Note JM 2018-10-17 + // You are responsible for implementing any additional logic based on choice fields, etc. + // The ForwardTranslator generator script is meant to facilitate your work, not get you 100% of the way + + // TODO: If you keep createRegisterAndNameIdfObject above, you don't need this. + // But in some cases, you'll want to handle failure without pushing to the map + // Name + idfObject.setName(modelObject.nameString()); + + // Zone Mixer Name: Required Object + ZoneMixers zoneMixer = modelObject.zoneMixer(); + if (boost::optional wo_ = translateAndMapModelObject(zoneMixer)) { + idfObject.setString(AirLoopHVAC_ExhaustSystemFields::ZoneMixerName, wo_->nameString()); + } + + // Fan Object Type: Required String + const std::string fanObjectType = modelObject.fanObjectType(); + idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanObjectType, fanObjectType); + + + // Fan Name: Required Object + FansSystemModel fan = modelObject.fan(); + if (boost::optional wo_ = translateAndMapModelObject(fan)) { + 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..bab0ce5706 --- /dev/null +++ b/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp @@ -0,0 +1,148 @@ +/*********************************************************************************************************************** +* 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" + +// TODO: Check the following class names against object getters and setters. +#include "../../model/Schedule.hpp" +#include "../../model/Schedule_Impl.hpp" + +#include "../../model/Zone.hpp" +#include "../../model/Zone_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); + // If it doesn't have a name, or if you aren't sure you are going to want to return it + // IdfObject idfObject(openstudio::IddObjectType::ZoneHVAC_ExhaustControl); + // m_idfObjects.push_back(idfObject); + + // TODO: Note JM 2018-10-17 + // You are responsible for implementing any additional logic based on choice fields, etc. + // The ForwardTranslator generator script is meant to facilitate your work, not get you 100% of the way + + // TODO: If you keep createRegisterAndNameIdfObject above, you don't need this. + // But in some cases, you'll want to handle failure without pushing to the map + // Name + idfObject.setName(modelObject.nameString()); + + // Availability Schedule Name: Optional Object + if (boost::optional availabilitySchedule_ = modelObject.availabilitySchedule()) { + if (boost::optional wo_ = translateAndMapModelObject(availabilitySchedule_.get())) { + idfObject.setString(ZoneHVAC_ExhaustControlFields::AvailabilityScheduleName, wo_->nameString()); + } + } + + // Zone Name: Required Object + Zone zone = modelObject.zone(); + if (boost::optional wo_ = translateAndMapModelObject(zone)) { + idfObject.setString(ZoneHVAC_ExhaustControlFields::ZoneName, wo_->nameString()); + } + + // Inlet Node Name: Required Node + Node inletNodeName = modelObject.inletNodeName(); + if (boost::optional wo_ = translateAndMapModelObject(inletNodeName)) { + idfObject.setString(ZoneHVAC_ExhaustControlFields::InletNodeName, wo_->nameString()); + } + + // Outlet Node Name: Required Node + Node outletNodeName = modelObject.outletNodeName(); + if (boost::optional wo_ = translateAndMapModelObject(outletNodeName)) { + idfObject.setString(ZoneHVAC_ExhaustControlFields::OutletNodeName, wo_->nameString()); + } + + 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()); + } + } + + // Supply Node or NodeList Name: Optional Node + Node supplyNodeorNodeListName = modelObject.supplyNodeorNodeListName(); + if (boost::optional wo_ = translateAndMapModelObject(supplyNodeorNodeListName)) { + idfObject.setString(ZoneHVAC_ExhaustControlFields::SupplyNodeorNodeListName, 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..b0f0eba25d --- /dev/null +++ b/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp @@ -0,0 +1,83 @@ +/*********************************************************************************************************************** +* 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 "../ReverseTranslator.hpp" + +#include "../../model/AirLoopHVACExhaustSystem.hpp" +#include "../../model/AirLoopHVACExhaustSystem_Impl.hpp" +// TODO: Check the following class names against object getters and setters. +#include "../../model/ZoneMixers.hpp" +#include "../../model/ZoneMixers_Impl.hpp" +#include "../../model/FansSystemModel.hpp" +#include "../../model/FansSystemModel_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; + // TODO: Check regular Ctor arguments + AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m); + // TODO: Or if a UniqueModelObject (and make sure _Impl is included) + // AirLoopHVACExhaustSystem airLoopHVACExhaustSystem = m.getUniqueModelObject(); + + airLoopHVACExhaustSystem.setName("My AirLoopHVACExhaustSystem"); + ZoneMixers zoneMixer(m); + EXPECT_TRUE(airLoopHVACExhaustSystem.setZoneMixer(zoneMixer)); + EXPECT_TRUE(airLoopHVACExhaustSystem.setFanObjectType("Fan:SystemModel")); + FansSystemModel fan(m); + EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan)); + + + // TODO: you're responsible for creating all other objects needed so this object actually gets ForwardTranslated + + 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(zoneMixer.nameString(), 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..09c843aad0 --- /dev/null +++ b/src/energyplus/Test/ZoneHVACExhaustControl_GTest.cpp @@ -0,0 +1,115 @@ +/*********************************************************************************************************************** +* 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 "../ReverseTranslator.hpp" + +#include "../../model/ZoneHVACExhaustControl.hpp" +#include "../../model/ZoneHVACExhaustControl_Impl.hpp" +// TODO: Check the following class names against object getters and setters. +#include "../../model/Schedule.hpp" +#include "../../model/Schedule_Impl.hpp" +#include "../../model/Zone.hpp" +#include "../../model/Zone_Impl.hpp" +#include "../../model/Schedule.hpp" +#include "../../model/Schedule_Impl.hpp" +#include "../../model/Schedule.hpp" +#include "../../model/Schedule_Impl.hpp" +#include "../../model/Schedule.hpp" +#include "../../model/Schedule_Impl.hpp" +#include "../../model/Schedule.hpp" +#include "../../model/Schedule_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; + // TODO: Check regular Ctor arguments + ZoneHVACExhaustControl zoneHVACExhaustControl(m); + // TODO: Or if a UniqueModelObject (and make sure _Impl is included) + // ZoneHVACExhaustControl zoneHVACExhaustControl = m.getUniqueModelObject(); + + zoneHVACExhaustControl.setName("My ZoneHVACExhaustControl"); + boost::optional availabilitySchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setAvailabilitySchedule(availabilitySchedule)); + Zone zone(m); + EXPECT_TRUE(zoneHVACExhaustControl.setZone(zone)); + Node inletNodeName(m); + EXPECT_TRUE(zoneHVACExhaustControl.setInletNodeName(inletNodeName)); + Node outletNodeName(m); + EXPECT_TRUE(zoneHVACExhaustControl.setOutletNodeName(outletNodeName)); + // Autosize + // zoneHVACExhaustControl.autosizeDesignExhaustFlowRate(); + EXPECT_TRUE(zoneHVACExhaustControl.setDesignExhaustFlowRate(0.6)); + EXPECT_TRUE(zoneHVACExhaustControl.setFlowControlType("Scheduled")); + boost::optional exhaustFlowFractionSchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setExhaustFlowFractionSchedule(exhaustFlowFractionSchedule)); + Node supplyNodeorNodeListName(m); + EXPECT_TRUE(zoneHVACExhaustControl.setSupplyNodeorNodeListName(supplyNodeorNodeListName)); + boost::optional minimumZoneTemperatureLimitSchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setMinimumZoneTemperatureLimitSchedule(minimumZoneTemperatureLimitSchedule)); + boost::optional minimumExhaustFlowFractionSchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setMinimumExhaustFlowFractionSchedule(minimumExhaustFlowFractionSchedule)); + boost::optional balancedExhaustFractionSchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setBalancedExhaustFractionSchedule(balancedExhaustFractionSchedule)); + + + // TODO: you're responsible for creating all other objects needed so this object actually gets ForwardTranslated + + 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(zone.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::ZoneName).get()); + EXPECT_EQ(inletNodeName.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::InletNodeName).get()); + EXPECT_EQ(outletNodeName.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::OutletNodeName).get()); + // EXPECT_EQ("Autosize", idfObject.getString(ZoneHVAC_ExhaustControlFields::DesignExhaustFlowRate).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(supplyNodeorNodeListName.nameString(), 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..55aa93bba5 --- /dev/null +++ b/src/model/AirloopHVACExhaustSystem.cpp @@ -0,0 +1,177 @@ +/*********************************************************************************************************************** +* 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" + +// TODO: Check the following class names against object getters and setters. +#include "ZoneMixers.hpp" +#include "ZoneMixers_Impl.hpp" +#include "FansSystemModel.hpp" +#include "FansSystemModel_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) + : StraightComponent_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) + : StraightComponent_Impl(other, model, keepHandle) { + OS_ASSERT(other.iddObject().type() == AirloopHVACExhaustSystem::iddObjectType()); + } + + AirloopHVACExhaustSystem_Impl::AirloopHVACExhaustSystem_Impl(const AirloopHVACExhaustSystem_Impl& other, + Model_Impl* model, bool keepHandle) + : StraightComponent_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 { + // TODO + return ComponentType::None; + } + + std::vector AirloopHVACExhaustSystem_Impl::coolingFuelTypes() const { + // TODO + return {}; + } + + std::vector AirloopHVACExhaustSystem_Impl::heatingFuelTypes() const { + // TODO + return {}; + } + + std::vector AirloopHVACExhaustSystem_Impl::appGHeatingFuelTypes() const { + + // TODO + return {}; + } + + ZoneMixers AirloopHVACExhaustSystem_Impl::zoneMixer() const { + boost::optional value = optionalZoneMixer(); + if (!value) { + LOG_AND_THROW(briefDescription() << " does not have an Zone Mixer attached."); + } + return value.get(); + } + + FansSystemModel AirloopHVACExhaustSystem_Impl::fan() const { + boost::optional value = optionalFan(); + if (!value) { + LOG_AND_THROW(briefDescription() << " does not have an Fan attached."); + } + return value.get(); + } + + bool AirloopHVACExhaustSystem_Impl::setZoneMixer(const ZoneMixers& zoneMixers) { + const bool result = setPointer(OS_AirLoopHVAC_ExhaustSystemFields::ZoneMixerName, zoneMixers.handle()); + return result; + } + + bool AirloopHVACExhaustSystem_Impl::setFan(const FansSystemModel& fansSystemModel) { + const bool result = setPointer(OS_AirLoopHVAC_ExhaustSystemFields::FanName, fansSystemModel.handle()); + return result; + } + + boost::optional AirloopHVACExhaustSystem_Impl::optionalZoneMixer() const { + return getObject().getModelObjectTarget(OS_AirLoopHVAC_ExhaustSystemFields::ZoneMixerName); + } + + boost::optional AirloopHVACExhaustSystem_Impl::optionalFan() const { + return getObject().getModelObjectTarget(OS_AirLoopHVAC_ExhaustSystemFields::FanName); + } + + } // namespace detail + + AirloopHVACExhaustSystem::AirloopHVACExhaustSystem(const Model& model) + : StraightComponent(AirloopHVACExhaustSystem::iddObjectType(), model) { + OS_ASSERT(getImpl()); + + // TODO: consider adding (overloaded or not) explicit ctors taking required objects as argument + + // TODO: Appropriately handle the following required object-list fields. + // OS_AirLoopHVAC_ExhaustSystemFields::ZoneMixerName + // OS_AirLoopHVAC_ExhaustSystemFields::FanName + bool ok = true; + // ok = setZoneMixer(); + OS_ASSERT(ok); + // ok = setFan(); + OS_ASSERT(ok); + } + + IddObjectType AirloopHVACExhaustSystem::iddObjectType() { + return {IddObjectType::OS_AirLoopHVAC_ExhaustSystem}; + } + + ZoneMixers AirloopHVACExhaustSystem::zoneMixer() const { + return getImpl()->zoneMixer(); + } + + FansSystemModel AirloopHVACExhaustSystem::fan() const { + return getImpl()->fan(); + } + + bool AirloopHVACExhaustSystem::setZoneMixer(const ZoneMixers& zoneMixers) { + return getImpl()->setZoneMixer(zoneMixers); + } + + bool AirloopHVACExhaustSystem::setFan(const FansSystemModel& fansSystemModel) { + return getImpl()->setFan(fansSystemModel); + } + + /// @cond + AirloopHVACExhaustSystem::AirloopHVACExhaustSystem( + std::shared_ptr impl) + : StraightComponent(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..d2924ac76b --- /dev/null +++ b/src/model/AirloopHVACExhaustSystem.hpp @@ -0,0 +1,117 @@ +/*********************************************************************************************************************** +* 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 "StraightComponent.hpp" + +namespace openstudio { +namespace model { + + // TODO: Check the following class names against object getters and setters. + class ZoneMixers; + class FansSystemModel; + + namespace detail { + + class AirloopHVACExhaustSystem_Impl; + + } // namespace detail + + /** AirloopHVACExhaustSystem is a StraightComponent that wraps the OpenStudio IDD object 'OS:AirLoopHVAC:ExhaustSystem'. */ + class MODEL_API AirloopHVACExhaustSystem : public StraightComponent + { + 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 */ + //@{ + + // TODO: Check return type. From object lists, some candidates are: ZoneMixers. + ZoneMixers zoneMixer() const; + + // TODO: Check return type. From object lists, some candidates are: FansSystemModel, FansComponentModel. + FansSystemModel fan() const; + + //@} + /** @name Setters */ + //@{ + + // TODO: Check argument type. From object lists, some candidates are: ZoneMixers. + bool setZoneMixer(const ZoneMixers& zoneMixers); + + // TODO: Check argument type. From object lists, some candidates are: FansSystemModel, FansComponentModel. + bool setFan(const FansSystemModel& fansSystemModel); + + //@} + /** @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..1c65087941 --- /dev/null +++ b/src/model/AirloopHVACExhaustSystem_Impl.hpp @@ -0,0 +1,121 @@ +/*********************************************************************************************************************** +* 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 "StraightComponent_Impl.hpp" + +namespace openstudio { +namespace model { + + // TODO: Check the following class names against object getters and setters. + class ZoneMixers; + class FansSystemModel; + + namespace detail { + + /** AirloopHVACExhaustSystem_Impl is a StraightComponent_Impl that is the implementation class for AirloopHVACExhaustSystem.*/ + class MODEL_API AirloopHVACExhaustSystem_Impl : public StraightComponent_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 */ + //@{ + + // TODO: Check return type. From object lists, some candidates are: ZoneMixers. + ZoneMixers zoneMixer() const; + + // TODO: Check return type. From object lists, some candidates are: FansSystemModel, FansComponentModel. + FansSystemModel fan() const; + + //@} + /** @name Setters */ + //@{ + + // TODO: Check argument type. From object lists, some candidates are: ZoneMixers. + bool setZoneMixer(const ZoneMixers& zoneMixers); + + // TODO: Check argument type. From object lists, some candidates are: FansSystemModel, FansComponentModel. + bool setFan(const FansSystemModel& fansSystemModel); + + //@} + /** @name Other */ + //@{ + + //@} + protected: + private: + REGISTER_LOGGER("openstudio.model.AirloopHVACExhaustSystem"); + + // TODO: Check the return types of these methods. + // Optional getters for use by methods like children() so can remove() if the constructor fails. + // There are other ways for the public versions of these getters to fail--perhaps all required + // objects should be returned as boost::optionals + boost::optional optionalZoneMixer() const; + boost::optional optionalFan() const; + }; + + } // namespace detail + +} // namespace model +} // namespace openstudio + +#endif // MODEL_AIRLOOPHVACEXHAUSTSYSTEM_IMPL_HPP diff --git a/src/model/ScheduleTypeRegistry.cpp b/src/model/ScheduleTypeRegistry.cpp index a24cbe7b57..3a2603a81b 100644 --- a/src/model/ScheduleTypeRegistry.cpp +++ b/src/model/ScheduleTypeRegistry.cpp @@ -558,6 +558,11 @@ 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..0b97b2f5d9 --- /dev/null +++ b/src/model/ZoneHVACExhaustControl.cpp @@ -0,0 +1,501 @@ +/*********************************************************************************************************************** +* 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" + +// TODO: Check the following class names against object getters and setters. +#include "Schedule.hpp" +#include "Schedule_Impl.hpp" +#include "ThermalZone.hpp" +#include "ThermalZone_Impl.hpp" +#include "Connection.hpp" +#include "Connection_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; + } + + ComponentType ZoneHVACExhaustControl_Impl::componentType() const { + // TODO + return ComponentType::None; + } + + std::vector ZoneHVACExhaustControl_Impl::coolingFuelTypes() const { + // TODO + return {}; + } + + std::vector ZoneHVACExhaustControl_Impl::heatingFuelTypes() const { + // TODO + return {}; + } + + std::vector ZoneHVACExhaustControl_Impl::appGHeatingFuelTypes() const { + + // TODO + 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(); + } + + ThermalZone ZoneHVACExhaustControl_Impl::zone() const { + boost::optional value = optionalZone(); + if (!value) { + LOG_AND_THROW(briefDescription() << " does not have an Zone attached."); + } + return value.get(); + } + + Connection ZoneHVACExhaustControl_Impl::inletNode() const { + boost::optional value = optionalInletNode(); + if (!value) { + LOG_AND_THROW(briefDescription() << " does not have an Inlet Node attached."); + } + return value.get(); + } + + Connection ZoneHVACExhaustControl_Impl::outletNode() const { + boost::optional value = optionalOutletNode(); + if (!value) { + LOG_AND_THROW(briefDescription() << " does not have an Outlet Node attached."); + } + return value.get(); + } + + 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::supplyNodeorNodeList() const { + return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::SupplyNodeorNodeListName ); + } + + 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::setZone(const ThermalZone& thermalZone) { + const bool result = setPointer(OS_ZoneHVAC_ExhaustControlFields::ZoneName, thermalZone.handle()); + return result; + } + + bool ZoneHVACExhaustControl_Impl::setInletNode(const Connection& connection) { + const bool result = setPointer(OS_ZoneHVAC_ExhaustControlFields::InletNodeName, connection.handle()); + return result; + } + + bool ZoneHVACExhaustControl_Impl::setOutletNode(const Connection& connection) { + const bool result = setPointer(OS_ZoneHVAC_ExhaustControlFields::OutletNodeName, connection.handle()); + return result; + } + + 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::setSupplyNodeorNodeList(const Connection& connection) { + const bool result = setPointer(OS_ZoneHVAC_ExhaustControlFields::SupplyNodeorNodeListName, connection.handle()); + return result; + } + + void ZoneHVACExhaustControl_Impl::resetSupplyNodeorNodeList() { + const bool result = setString(OS_ZoneHVAC_ExhaustControlFields::SupplyNodeorNodeListName, ""); + 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); + } + + boost::optional ZoneHVACExhaustControl_Impl::optionalZone() const { + return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::ZoneName); + } + + boost::optional ZoneHVACExhaustControl_Impl::optionalInletNode() const { + return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::InletNodeName); + } + + boost::optional ZoneHVACExhaustControl_Impl::optionalOutletNode() const { + return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::OutletNodeName); + } + + } // namespace detail + + ZoneHVACExhaustControl::ZoneHVACExhaustControl(const Model& model) + : ZoneHVACComponent(ZoneHVACExhaustControl::iddObjectType(), model) { + OS_ASSERT(getImpl()); + + // TODO: consider adding (overloaded or not) explicit ctors taking required objects as argument + + // TODO: Appropriately handle the following required object-list fields. + // OS_ZoneHVAC_ExhaustControlFields::AvailabilityScheduleName + // OS_ZoneHVAC_ExhaustControlFields::ZoneName + // OS_ZoneHVAC_ExhaustControlFields::InletNodeName + // OS_ZoneHVAC_ExhaustControlFields::OutletNodeName + bool ok = true; + // ok = setAvailabilitySchedule(); + OS_ASSERT(ok); + // ok = setZone(); + OS_ASSERT(ok); + // ok = setInletNode(); + OS_ASSERT(ok); + // ok = setOutletNode(); + OS_ASSERT(ok); + // ok = setDesignExhaustFlowRate(); + OS_ASSERT(ok); + // ok = setFlowControlType(); + 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(); + } + + ThermalZone ZoneHVACExhaustControl::zone() const { + return getImpl()->zone(); + } + + Connection ZoneHVACExhaustControl::inletNode() const { + return getImpl()->inletNode(); + } + + Connection ZoneHVACExhaustControl::outletNode() const { + return getImpl()->outletNode(); + } + + 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::supplyNodeorNodeList() const { + return getImpl()->supplyNodeorNodeList(); + } + + 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::setZone(const ThermalZone& thermalZone) { + return getImpl()->setZone(thermalZone); + } + + bool ZoneHVACExhaustControl::setInletNode(const Connection& connection) { + return getImpl()->setInletNode(connection); + } + + bool ZoneHVACExhaustControl::setOutletNode(const Connection& connection) { + return getImpl()->setOutletNode(connection); + } + + 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::setSupplyNodeorNodeList(const Connection& connection) { + return getImpl()->setSupplyNodeorNodeList(connection); + } + + void ZoneHVACExhaustControl::resetSupplyNodeorNodeList() { + getImpl()->resetSupplyNodeorNodeList(); + } + + 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..4a24056ed0 --- /dev/null +++ b/src/model/ZoneHVACExhaustControl.hpp @@ -0,0 +1,192 @@ +/*********************************************************************************************************************** +* 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 { + + // TODO: Check the following class names against object getters and setters. + class Schedule; + class ThermalZone; + class Connection; + + 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 */ + //@{ + + // TODO: Check return type. From object lists, some candidates are: Schedule. + Schedule availabilitySchedule() const; + + // TODO: Check return type. From object lists, some candidates are: ThermalZone. + ThermalZone zone() const; + + // TODO: Check return type. From object lists, some candidates are: Connection. + Connection inletNode() const; + + // TODO: Check return type. From object lists, some candidates are: Connection. + Connection outletNode() const; + + boost::optional designExhaustFlowRate() const; + + bool isDesignExhaustFlowRateAutosized() const; + + boost::optional autosizedDesignExhaustFlowRate(); + + std::string flowControlType() const; + + // TODO: Check return type. From object lists, some candidates are: Schedule. + boost::optional exhaustFlowFractionSchedule() const; + + // TODO: Check return type. From object lists, some candidates are: Connection. + boost::optional supplyNodeorNodeList() const; + + // TODO: Check return type. From object lists, some candidates are: Schedule. + boost::optional minimumZoneTemperatureLimitSchedule() const; + + // TODO: Check return type. From object lists, some candidates are: Schedule. + boost::optional minimumExhaustFlowFractionSchedule() const; + + // TODO: Check return type. From object lists, some candidates are: Schedule. + boost::optional balancedExhaustFractionSchedule() const; + + //@} + /** @name Setters */ + //@{ + + // TODO: Check argument type. From object lists, some candidates are: Schedule. + // Note Schedules are passed by reference, not const reference. + bool setAvailabilitySchedule(Schedule& schedule); + + // TODO: Check argument type. From object lists, some candidates are: ThermalZone. + bool setZone(const ThermalZone& thermalZone); + + // TODO: Check argument type. From object lists, some candidates are: Connection. + bool setInletNode(const Connection& connection); + + // TODO: Check argument type. From object lists, some candidates are: Connection. + bool setOutletNode(const Connection& connection); + + bool setDesignExhaustFlowRate(double designExhaustFlowRate); + + void autosizeDesignExhaustFlowRate(); + + bool setFlowControlType(const std::string& flowControlType); + + // TODO: Check argument type. From object lists, some candidates are: Schedule. + // Note Schedules are passed by reference, not const reference. + bool setExhaustFlowFractionSchedule(Schedule& schedule); + + void resetExhaustFlowFractionSchedule(); + + // TODO: Check argument type. From object lists, some candidates are: Connection. + bool setSupplyNodeorNodeList(const Connection& connection); + + void resetSupplyNodeorNodeList(); + + // TODO: Check argument type. From object lists, some candidates are: Schedule. + // Note Schedules are passed by reference, not const reference. + bool setMinimumZoneTemperatureLimitSchedule(Schedule& schedule); + + void resetMinimumZoneTemperatureLimitSchedule(); + + // TODO: Check argument type. From object lists, some candidates are: Schedule. + // Note Schedules are passed by reference, not const reference. + bool setMinimumExhaustFlowFractionSchedule(Schedule& schedule); + + void resetMinimumExhaustFlowFractionSchedule(); + + // TODO: Check argument type. From object lists, some candidates are: Schedule. + // Note Schedules are passed by reference, not const reference. + 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..6d2cae5689 --- /dev/null +++ b/src/model/ZoneHVACExhaustControl_Impl.hpp @@ -0,0 +1,201 @@ +/*********************************************************************************************************************** +* 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 { + + // TODO: Check the following class names against object getters and setters. + class Schedule; + class ThermalZone; + class Connection; + + 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 ComponentType componentType() const override; + virtual std::vector coolingFuelTypes() const override; + virtual std::vector heatingFuelTypes() const override; + virtual std::vector appGHeatingFuelTypes() const override; + + //@} + /** @name Getters */ + //@{ + + // TODO: Check return type. From object lists, some candidates are: Schedule. + Schedule availabilitySchedule() const; + + // TODO: Check return type. From object lists, some candidates are: ThermalZone. + ThermalZone zone() const; + + // TODO: Check return type. From object lists, some candidates are: Connection. + Connection inletNode() const; + + // TODO: Check return type. From object lists, some candidates are: Connection. + Connection outletNode() const; + + boost::optional designExhaustFlowRate() const; + + bool isDesignExhaustFlowRateAutosized() const; + + boost::optional autosizedDesignExhaustFlowRate(); + + std::string flowControlType() const; + + // TODO: Check return type. From object lists, some candidates are: Schedule. + boost::optional exhaustFlowFractionSchedule() const; + + // TODO: Check return type. From object lists, some candidates are: Connection. + boost::optional supplyNodeorNodeList() const; + + // TODO: Check return type. From object lists, some candidates are: Schedule. + boost::optional minimumZoneTemperatureLimitSchedule() const; + + // TODO: Check return type. From object lists, some candidates are: Schedule. + boost::optional minimumExhaustFlowFractionSchedule() const; + + // TODO: Check return type. From object lists, some candidates are: Schedule. + boost::optional balancedExhaustFractionSchedule() const; + + //@} + /** @name Setters */ + //@{ + + // TODO: Check argument type. From object lists, some candidates are: Schedule. + // Note Schedules are passed by reference, not const reference. + bool setAvailabilitySchedule(Schedule& schedule); + + // TODO: Check argument type. From object lists, some candidates are: ThermalZone. + bool setZone(const ThermalZone& thermalZone); + + // TODO: Check argument type. From object lists, some candidates are: Connection. + bool setInletNode(const Connection& connection); + + // TODO: Check argument type. From object lists, some candidates are: Connection. + bool setOutletNode(const Connection& connection); + + bool setDesignExhaustFlowRate(double designExhaustFlowRate); + + void autosizeDesignExhaustFlowRate(); + + bool setFlowControlType(const std::string& flowControlType); + + // TODO: Check argument type. From object lists, some candidates are: Schedule. + // Note Schedules are passed by reference, not const reference. + bool setExhaustFlowFractionSchedule(Schedule& schedule); + + void resetExhaustFlowFractionSchedule(); + + // TODO: Check argument type. From object lists, some candidates are: Connection. + bool setSupplyNodeorNodeList(const Connection& connection); + + void resetSupplyNodeorNodeList(); + + // TODO: Check argument type. From object lists, some candidates are: Schedule. + // Note Schedules are passed by reference, not const reference. + bool setMinimumZoneTemperatureLimitSchedule(Schedule& schedule); + + void resetMinimumZoneTemperatureLimitSchedule(); + + // TODO: Check argument type. From object lists, some candidates are: Schedule. + // Note Schedules are passed by reference, not const reference. + bool setMinimumExhaustFlowFractionSchedule(Schedule& schedule); + + void resetMinimumExhaustFlowFractionSchedule(); + + // TODO: Check argument type. From object lists, some candidates are: Schedule. + // Note Schedules are passed by reference, not const reference. + bool setBalancedExhaustFractionSchedule(Schedule& schedule); + + void resetBalancedExhaustFractionSchedule(); + + virtual void autosize() override; + + virtual void applySizingValues() override; + + //@} + /** @name Other */ + //@{ + + //@} + protected: + private: + REGISTER_LOGGER("openstudio.model.ZoneHVACExhaustControl"); + + // TODO: Check the return types of these methods. + // Optional getters for use by methods like children() so can remove() if the constructor fails. + // There are other ways for the public versions of these getters to fail--perhaps all required + // objects should be returned as boost::optionals + boost::optional optionalAvailabilitySchedule() const; + boost::optional optionalZone() const; + boost::optional optionalInletNode() const; + boost::optional optionalOutletNode() 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..1e3fb77c38 --- /dev/null +++ b/src/model/test/AirloopHVACExhaustSystem_GTest.cpp @@ -0,0 +1,76 @@ +/*********************************************************************************************************************** +* 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" + +// TODO: Check the following class names against object getters and setters. +#include "../ZoneMixers.hpp" +#include "../ZoneMixers_Impl.hpp" + +#include "../FansSystemModel.hpp" +#include "../FansSystemModel_Impl.hpp" + +using namespace openstudio; +using namespace openstudio::model; + +TEST_F(ModelFixture, AirloopHVACExhaustSystem_GettersSetters) { + Model m; + // TODO: Check regular Ctor arguments + AirloopHVACExhaustSystem airloopHVACExhaustSystem(m); + // TODO: Or if a UniqueModelObject (and make sure _Impl is included) + // AirloopHVACExhaustSystem airloopHVACExhaustSystem = m.getUniqueModelObject(); + + airloopHVACExhaustSystem.setName("My AirloopHVACExhaustSystem"); + + // Zone Mixer Name: Required Object + ZoneMixers zoneMixer(m); + EXPECT_TRUE(airloopHVACExhaustSystem.setZoneMixer(zoneMixer)); + EXPECT_EQ(zoneMixer, airloopHVACExhaustSystem.zoneMixer()); + + // Fan Name: Required Object + FansSystemModel fan(m); + EXPECT_TRUE(airloopHVACExhaustSystem.setFan(fan)); + EXPECT_EQ(fan, airloopHVACExhaustSystem.fan()); + +} +TEST_F(ModelFixture, AirloopHVACExhaustSystem_HeatCoolFuelTypes) { + Model m; + // TODO: Check regular Ctor arguments + AirloopHVACExhaustSystem airloopHVACExhaustSystem(m); + // TODO: Or if a UniqueModelObject (and make sure _Impl is included) + // AirloopHVACExhaustSystem airloopHVACExhaustSystem = m.getUniqueModelObject(); + + 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..102ddbfb0a --- /dev/null +++ b/src/model/test/ZoneHVACExhaustControl_GTest.cpp @@ -0,0 +1,140 @@ +/*********************************************************************************************************************** +* 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" + +// TODO: Check the following class names against object getters and setters. +#include "../Schedule.hpp" +#include "../Schedule_Impl.hpp" + +#include "../ThermalZone.hpp" +#include "../ThermalZone_Impl.hpp" + +#include "../Connection.hpp" +#include "../Connection_Impl.hpp" + +using namespace openstudio; +using namespace openstudio::model; + +TEST_F(ModelFixture, ZoneHVACExhaustControl_GettersSetters) { + Model m; + // TODO: Check regular Ctor arguments + ZoneHVACExhaustControl zoneHVACExhaustControl(m); + // TODO: Or if a UniqueModelObject (and make sure _Impl is included) + // ZoneHVACExhaustControl zoneHVACExhaustControl = m.getUniqueModelObject(); + + zoneHVACExhaustControl.setName("My ZoneHVACExhaustControl"); + + // Availability Schedule Name: Required Object + Schedule availabilitySchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setAvailabilitySchedule(availabilitySchedule)); + EXPECT_EQ(availabilitySchedule, zoneHVACExhaustControl.availabilitySchedule()); + + // Zone Name: Required Object + ThermalZone zone(m); + EXPECT_TRUE(zoneHVACExhaustControl.setZone(zone)); + EXPECT_EQ(zone, zoneHVACExhaustControl.zone()); + + // Inlet Node Name: Required Object + Connection inletNode(m); + EXPECT_TRUE(zoneHVACExhaustControl.setInletNode(inletNode)); + EXPECT_EQ(inletNode, zoneHVACExhaustControl.inletNode()); + + // Outlet Node Name: Required Object + Connection outletNode(m); + EXPECT_TRUE(zoneHVACExhaustControl.setOutletNode(outletNode)); + EXPECT_EQ(outletNode, zoneHVACExhaustControl.outletNode()); + + // 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 + boost::optional exhaustFlowFractionSchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setExhaustFlowFractionSchedule(exhaustFlowFractionSchedule)); + ASSERT_TRUE(zoneHVACExhaustControl.exhaustFlowFractionSchedule()); + EXPECT_EQ(exhaustFlowFractionSchedule, zoneHVACExhaustControl.exhaustFlowFractionSchedule().get()); + + // Supply Node or NodeList Name: Optional Object + boost::optional supplyNodeorNodeList(m); + EXPECT_TRUE(zoneHVACExhaustControl.setSupplyNodeorNodeList(supplyNodeorNodeList)); + ASSERT_TRUE(zoneHVACExhaustControl.supplyNodeorNodeList()); + EXPECT_EQ(supplyNodeorNodeList, zoneHVACExhaustControl.supplyNodeorNodeList().get()); + + // Minimum Zone Temperature Limit Schedule Name: Optional Object + boost::optional 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 + boost::optional minimumExhaustFlowFractionSchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setMinimumExhaustFlowFractionSchedule(minimumExhaustFlowFractionSchedule)); + ASSERT_TRUE(zoneHVACExhaustControl.minimumExhaustFlowFractionSchedule()); + EXPECT_EQ(minimumExhaustFlowFractionSchedule, zoneHVACExhaustControl.minimumExhaustFlowFractionSchedule().get()); + + // Balanced Exhaust Fraction Schedule Name: Optional Object + boost::optional balancedExhaustFractionSchedule(m); + EXPECT_TRUE(zoneHVACExhaustControl.setBalancedExhaustFractionSchedule(balancedExhaustFractionSchedule)); + ASSERT_TRUE(zoneHVACExhaustControl.balancedExhaustFractionSchedule()); + EXPECT_EQ(balancedExhaustFractionSchedule, zoneHVACExhaustControl.balancedExhaustFractionSchedule().get()); + +} +TEST_F(ModelFixture, ZoneHVACExhaustControl_HeatCoolFuelTypes) { + Model m; + // TODO: Check regular Ctor arguments + ZoneHVACExhaustControl zoneHVACExhaustControl(m); + // TODO: Or if a UniqueModelObject (and make sure _Impl is included) + // ZoneHVACExhaustControl zoneHVACExhaustControl = m.getUniqueModelObject(); + + 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()); +} From 27b50df66214b3e19dcfa7ef5536f71b7f4b6706 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Wed, 15 Jan 2025 13:52:46 -0700 Subject: [PATCH 03/17] Update other source files. --- src/energyplus/ForwardTranslator.cpp | 10 ++++++++++ src/energyplus/ForwardTranslator.hpp | 6 ++++++ src/model/CMakeLists.txt | 8 ++++++++ src/model/ConcreteModelObjects.hpp | 4 ++++ src/model/Model.cpp | 4 ++++ src/model/ModelStraightComponent.i | 2 ++ src/model/ModelZoneHVAC.i | 2 ++ 7 files changed, 36 insertions(+) diff --git a/src/energyplus/ForwardTranslator.cpp b/src/energyplus/ForwardTranslator.cpp index 10432603e3..59d751db0f 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_AirLoop_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/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..2890a4071c 100644 --- a/src/model/Model.cpp +++ b/src/model/Model.cpp @@ -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); From 5252e71b51957a76175ad2e4fc3003367318b0a6 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Wed, 15 Jan 2025 13:52:59 -0700 Subject: [PATCH 04/17] Formatting. --- ...rwardTranslateAirLoopHVACExhaustSystem.cpp | 7 +- ...ForwardTranslateZoneHVACExhaustControl.cpp | 23 +++-- .../Test/AirLoopHVACExhaustSystem_GTest.cpp | 7 +- .../Test/ZoneHVACExhaustControl_GTest.cpp | 21 ++--- src/model/AirloopHVACExhaustSystem.cpp | 20 ++--- src/model/AirloopHVACExhaustSystem_Impl.hpp | 16 ++-- src/model/Model.cpp | 6 +- src/model/ScheduleTypeRegistry.cpp | 5 +- src/model/ZoneHVACExhaustControl.cpp | 86 +++++++------------ src/model/ZoneHVACExhaustControl.hpp | 2 +- src/model/ZoneHVACExhaustControl_Impl.hpp | 28 +++--- .../test/AirloopHVACExhaustSystem_GTest.cpp | 1 - .../test/ZoneHVACExhaustControl_GTest.cpp | 1 - 13 files changed, 90 insertions(+), 133 deletions(-) diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp index b07e31e01b..2e4cbf28fe 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp @@ -48,7 +48,7 @@ namespace openstudio { namespace energyplus { - boost::optional ForwardTranslator::translateAirLoopHVACExhaustSystem( model::AirLoopHVACExhaustSystem& modelObject ) { + 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); @@ -67,7 +67,7 @@ namespace energyplus { // Zone Mixer Name: Required Object ZoneMixers zoneMixer = modelObject.zoneMixer(); - if (boost::optional wo_ = translateAndMapModelObject(zoneMixer)) { + if (boost::optional wo_ = translateAndMapModelObject(zoneMixer)) { idfObject.setString(AirLoopHVAC_ExhaustSystemFields::ZoneMixerName, wo_->nameString()); } @@ -75,10 +75,9 @@ namespace energyplus { const std::string fanObjectType = modelObject.fanObjectType(); idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanObjectType, fanObjectType); - // Fan Name: Required Object FansSystemModel fan = modelObject.fan(); - if (boost::optional wo_ = translateAndMapModelObject(fan)) { + if (boost::optional wo_ = translateAndMapModelObject(fan)) { idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanName, wo_->nameString()); } diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp index bab0ce5706..5d87ec0044 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp @@ -51,7 +51,7 @@ namespace openstudio { namespace energyplus { - boost::optional ForwardTranslator::translateZoneHVACExhaustControl( model::ZoneHVACExhaustControl& modelObject ) { + 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); @@ -70,26 +70,26 @@ namespace energyplus { // Availability Schedule Name: Optional Object if (boost::optional availabilitySchedule_ = modelObject.availabilitySchedule()) { - if (boost::optional wo_ = translateAndMapModelObject(availabilitySchedule_.get())) { + if (boost::optional wo_ = translateAndMapModelObject(availabilitySchedule_.get())) { idfObject.setString(ZoneHVAC_ExhaustControlFields::AvailabilityScheduleName, wo_->nameString()); } } // Zone Name: Required Object Zone zone = modelObject.zone(); - if (boost::optional wo_ = translateAndMapModelObject(zone)) { + if (boost::optional wo_ = translateAndMapModelObject(zone)) { idfObject.setString(ZoneHVAC_ExhaustControlFields::ZoneName, wo_->nameString()); } // Inlet Node Name: Required Node Node inletNodeName = modelObject.inletNodeName(); - if (boost::optional wo_ = translateAndMapModelObject(inletNodeName)) { + if (boost::optional wo_ = translateAndMapModelObject(inletNodeName)) { idfObject.setString(ZoneHVAC_ExhaustControlFields::InletNodeName, wo_->nameString()); } // Outlet Node Name: Required Node Node outletNodeName = modelObject.outletNodeName(); - if (boost::optional wo_ = translateAndMapModelObject(outletNodeName)) { + if (boost::optional wo_ = translateAndMapModelObject(outletNodeName)) { idfObject.setString(ZoneHVAC_ExhaustControlFields::OutletNodeName, wo_->nameString()); } @@ -100,43 +100,42 @@ namespace energyplus { 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())) { + if (boost::optional wo_ = translateAndMapModelObject(exhaustFlowFractionSchedule_.get())) { idfObject.setString(ZoneHVAC_ExhaustControlFields::ExhaustFlowFractionScheduleName, wo_->nameString()); } } // Supply Node or NodeList Name: Optional Node Node supplyNodeorNodeListName = modelObject.supplyNodeorNodeListName(); - if (boost::optional wo_ = translateAndMapModelObject(supplyNodeorNodeListName)) { + if (boost::optional wo_ = translateAndMapModelObject(supplyNodeorNodeListName)) { idfObject.setString(ZoneHVAC_ExhaustControlFields::SupplyNodeorNodeListName, wo_->nameString()); } // Minimum Zone Temperature Limit Schedule Name: Optional Object if (boost::optional minimumZoneTemperatureLimitSchedule_ = modelObject.minimumZoneTemperatureLimitSchedule()) { - if (boost::optional wo_ = translateAndMapModelObject(minimumZoneTemperatureLimitSchedule_.get())) { + 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())) { + 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())) { + if (boost::optional wo_ = translateAndMapModelObject(balancedExhaustFractionSchedule_.get())) { idfObject.setString(ZoneHVAC_ExhaustControlFields::BalancedExhaustFractionScheduleName, wo_->nameString()); } } diff --git a/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp b/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp index b0f0eba25d..8d59a183d6 100644 --- a/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp +++ b/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp @@ -69,7 +69,6 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_AirLoopHVACExhaustSystem) { FansSystemModel fan(m); EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan)); - // TODO: you're responsible for creating all other objects needed so this object actually gets ForwardTranslated const Workspace w = ft.translateModel(m); @@ -77,7 +76,7 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_AirLoopHVACExhaustSystem) { ASSERT_EQ(1u, idfObjs.size()); const auto& idfObject = idfObjs.front(); - EXPECT_EQ(zoneMixer.nameString(), 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()); - + EXPECT_EQ(zoneMixer.nameString(), 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 index 09c843aad0..15a0476a58 100644 --- a/src/energyplus/Test/ZoneHVACExhaustControl_GTest.cpp +++ b/src/energyplus/Test/ZoneHVACExhaustControl_GTest.cpp @@ -94,7 +94,6 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_ZoneHVACExhaustControl) { boost::optional balancedExhaustFractionSchedule(m); EXPECT_TRUE(zoneHVACExhaustControl.setBalancedExhaustFractionSchedule(balancedExhaustFractionSchedule)); - // TODO: you're responsible for creating all other objects needed so this object actually gets ForwardTranslated const Workspace w = ft.translateModel(m); @@ -102,14 +101,16 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_ZoneHVACExhaustControl) { ASSERT_EQ(1u, idfObjs.size()); const auto& idfObject = idfObjs.front(); - EXPECT_EQ(availabilitySchedule.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::AvailabilityScheduleName).get()); - EXPECT_EQ(zone.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::ZoneName).get()); - EXPECT_EQ(inletNodeName.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::InletNodeName).get()); - EXPECT_EQ(outletNodeName.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::OutletNodeName).get()); + EXPECT_EQ(availabilitySchedule.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::AvailabilityScheduleName).get()); + EXPECT_EQ(zone.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::ZoneName).get()); + EXPECT_EQ(inletNodeName.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::InletNodeName).get()); + EXPECT_EQ(outletNodeName.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::OutletNodeName).get()); // EXPECT_EQ("Autosize", idfObject.getString(ZoneHVAC_ExhaustControlFields::DesignExhaustFlowRate).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(supplyNodeorNodeListName.nameString(), 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()); - + EXPECT_EQ(supplyNodeorNodeListName.nameString(), 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 index 55aa93bba5..add1e1ad8a 100644 --- a/src/model/AirloopHVACExhaustSystem.cpp +++ b/src/model/AirloopHVACExhaustSystem.cpp @@ -47,25 +47,23 @@ namespace model { namespace detail { - AirloopHVACExhaustSystem_Impl::AirloopHVACExhaustSystem_Impl(const IdfObject& idfObject, - Model_Impl* model, bool keepHandle) + AirloopHVACExhaustSystem_Impl::AirloopHVACExhaustSystem_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) : StraightComponent_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) + AirloopHVACExhaustSystem_Impl::AirloopHVACExhaustSystem_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, + bool keepHandle) : StraightComponent_Impl(other, model, keepHandle) { OS_ASSERT(other.iddObject().type() == AirloopHVACExhaustSystem::iddObjectType()); } - AirloopHVACExhaustSystem_Impl::AirloopHVACExhaustSystem_Impl(const AirloopHVACExhaustSystem_Impl& other, - Model_Impl* model, bool keepHandle) - : StraightComponent_Impl(other, model, keepHandle) {} + AirloopHVACExhaustSystem_Impl::AirloopHVACExhaustSystem_Impl(const AirloopHVACExhaustSystem_Impl& other, Model_Impl* model, bool keepHandle) + : StraightComponent_Impl(other, model, keepHandle) {} const std::vector& AirloopHVACExhaustSystem_Impl::outputVariableNames() const { static std::vector result; - if (result.empty()){ + if (result.empty()) { } return result; } @@ -131,8 +129,7 @@ namespace model { } // namespace detail - AirloopHVACExhaustSystem::AirloopHVACExhaustSystem(const Model& model) - : StraightComponent(AirloopHVACExhaustSystem::iddObjectType(), model) { + AirloopHVACExhaustSystem::AirloopHVACExhaustSystem(const Model& model) : StraightComponent(AirloopHVACExhaustSystem::iddObjectType(), model) { OS_ASSERT(getImpl()); // TODO: consider adding (overloaded or not) explicit ctors taking required objects as argument @@ -168,8 +165,7 @@ namespace model { } /// @cond - AirloopHVACExhaustSystem::AirloopHVACExhaustSystem( - std::shared_ptr impl) + AirloopHVACExhaustSystem::AirloopHVACExhaustSystem(std::shared_ptr impl) : StraightComponent(std::move(impl)) {} /// @endcond diff --git a/src/model/AirloopHVACExhaustSystem_Impl.hpp b/src/model/AirloopHVACExhaustSystem_Impl.hpp index 1c65087941..1a2e162438 100644 --- a/src/model/AirloopHVACExhaustSystem_Impl.hpp +++ b/src/model/AirloopHVACExhaustSystem_Impl.hpp @@ -42,24 +42,18 @@ namespace model { namespace detail { - /** AirloopHVACExhaustSystem_Impl is a StraightComponent_Impl that is the implementation class for AirloopHVACExhaustSystem.*/ + /** AirloopHVACExhaustSystem_Impl is a StraightComponent_Impl that is the implementation class for AirloopHVACExhaustSystem.*/ class MODEL_API AirloopHVACExhaustSystem_Impl : public StraightComponent_Impl { public: /** @name Constructors and Destructors */ //@{ - AirloopHVACExhaustSystem_Impl(const IdfObject& idfObject, - Model_Impl* model, - bool keepHandle); + 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 openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle); - AirloopHVACExhaustSystem_Impl(const AirloopHVACExhaustSystem_Impl& other, - Model_Impl* model, - bool keepHandle); + AirloopHVACExhaustSystem_Impl(const AirloopHVACExhaustSystem_Impl& other, Model_Impl* model, bool keepHandle); virtual ~AirloopHVACExhaustSystem_Impl() = default; @@ -104,7 +98,7 @@ namespace model { protected: private: REGISTER_LOGGER("openstudio.model.AirloopHVACExhaustSystem"); - + // TODO: Check the return types of these methods. // Optional getters for use by methods like children() so can remove() if the constructor fails. // There are other ways for the public versions of these getters to fail--perhaps all required diff --git a/src/model/Model.cpp b/src/model/Model.cpp index 2890a4071c..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; diff --git a/src/model/ScheduleTypeRegistry.cpp b/src/model/ScheduleTypeRegistry.cpp index 3a2603a81b..77a94a7da6 100644 --- a/src/model/ScheduleTypeRegistry.cpp +++ b/src/model/ScheduleTypeRegistry.cpp @@ -560,9 +560,10 @@ namespace model { {"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 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}, + {"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 index 0b97b2f5d9..aeb62f70bc 100644 --- a/src/model/ZoneHVACExhaustControl.cpp +++ b/src/model/ZoneHVACExhaustControl.cpp @@ -52,25 +52,23 @@ namespace model { namespace detail { - ZoneHVACExhaustControl_Impl::ZoneHVACExhaustControl_Impl(const IdfObject& idfObject, - Model_Impl* model, bool keepHandle) + 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) + 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) {} + 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()){ + if (result.empty()) { } return result; } @@ -83,28 +81,22 @@ namespace model { // 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()) { + 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) + 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) + 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) + 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) + if (std::find(fieldIndices.cbegin(), fieldIndices.cend(), OS_ZoneHVAC_ExhaustControlFields::BalancedExhaustFractionScheduleName) != fieldIndices.cend()) { result.emplace_back("ZoneHVACExhaustControl", "Balanced Exhaust Fraction"); } @@ -165,7 +157,7 @@ namespace model { } boost::optional ZoneHVACExhaustControl_Impl::designExhaustFlowRate() const { - return getDouble(OS_ZoneHVAC_ExhaustControlFields::DesignExhaustFlowRate , true ); + return getDouble(OS_ZoneHVAC_ExhaustControlFields::DesignExhaustFlowRate, true); } bool ZoneHVACExhaustControl_Impl::isDesignExhaustFlowRateAutosized() const { @@ -177,7 +169,7 @@ namespace model { return result; } - boost::optional ZoneHVACExhaustControl_Impl::autosizedDesignExhaustFlowRate() { + boost::optional ZoneHVACExhaustControl_Impl::autosizedDesignExhaustFlowRate() { return getAutosizedValue("TODO_CHECK_SQL Design Exhaust Flow Rate", "m3/s"); } @@ -188,30 +180,27 @@ namespace model { } boost::optional ZoneHVACExhaustControl_Impl::exhaustFlowFractionSchedule() const { - return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::ExhaustFlowFractionScheduleName ); + return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::ExhaustFlowFractionScheduleName); } boost::optional ZoneHVACExhaustControl_Impl::supplyNodeorNodeList() const { - return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::SupplyNodeorNodeListName ); + return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::SupplyNodeorNodeListName); } boost::optional ZoneHVACExhaustControl_Impl::minimumZoneTemperatureLimitSchedule() const { - return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::MinimumZoneTemperatureLimitScheduleName ); + return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::MinimumZoneTemperatureLimitScheduleName); } boost::optional ZoneHVACExhaustControl_Impl::minimumExhaustFlowFractionSchedule() const { - return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::MinimumExhaustFlowFractionScheduleName ); + return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::MinimumExhaustFlowFractionScheduleName); } boost::optional ZoneHVACExhaustControl_Impl::balancedExhaustFractionSchedule() const { - return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::BalancedExhaustFractionScheduleName ); + return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::BalancedExhaustFractionScheduleName); } bool ZoneHVACExhaustControl_Impl::setAvailabilitySchedule(Schedule& schedule) { - const bool result = setSchedule(OS_ZoneHVAC_ExhaustControlFields::AvailabilityScheduleName, - "ZoneHVACExhaustControl", - "Availability", - schedule); + const bool result = setSchedule(OS_ZoneHVAC_ExhaustControlFields::AvailabilityScheduleName, "ZoneHVACExhaustControl", "Availability", schedule); return result; } @@ -246,10 +235,8 @@ namespace model { } bool ZoneHVACExhaustControl_Impl::setExhaustFlowFractionSchedule(Schedule& schedule) { - const bool result = setSchedule(OS_ZoneHVAC_ExhaustControlFields::ExhaustFlowFractionScheduleName, - "ZoneHVACExhaustControl", - "Exhaust Flow Fraction", - schedule); + const bool result = + setSchedule(OS_ZoneHVAC_ExhaustControlFields::ExhaustFlowFractionScheduleName, "ZoneHVACExhaustControl", "Exhaust Flow Fraction", schedule); return result; } @@ -269,10 +256,8 @@ namespace model { } bool ZoneHVACExhaustControl_Impl::setMinimumZoneTemperatureLimitSchedule(Schedule& schedule) { - const bool result = setSchedule(OS_ZoneHVAC_ExhaustControlFields::MinimumZoneTemperatureLimitScheduleName, - "ZoneHVACExhaustControl", - "Minimum Zone Temperature Limit", - schedule); + const bool result = setSchedule(OS_ZoneHVAC_ExhaustControlFields::MinimumZoneTemperatureLimitScheduleName, "ZoneHVACExhaustControl", + "Minimum Zone Temperature Limit", schedule); return result; } @@ -282,10 +267,8 @@ namespace model { } bool ZoneHVACExhaustControl_Impl::setMinimumExhaustFlowFractionSchedule(Schedule& schedule) { - const bool result = setSchedule(OS_ZoneHVAC_ExhaustControlFields::MinimumExhaustFlowFractionScheduleName, - "ZoneHVACExhaustControl", - "Minimum Exhaust Flow Fraction", - schedule); + const bool result = setSchedule(OS_ZoneHVAC_ExhaustControlFields::MinimumExhaustFlowFractionScheduleName, "ZoneHVACExhaustControl", + "Minimum Exhaust Flow Fraction", schedule); return result; } @@ -295,10 +278,8 @@ namespace model { } bool ZoneHVACExhaustControl_Impl::setBalancedExhaustFractionSchedule(Schedule& schedule) { - const bool result = setSchedule(OS_ZoneHVAC_ExhaustControlFields::BalancedExhaustFractionScheduleName, - "ZoneHVACExhaustControl", - "Balanced Exhaust Fraction", - schedule); + const bool result = setSchedule(OS_ZoneHVAC_ExhaustControlFields::BalancedExhaustFractionScheduleName, "ZoneHVACExhaustControl", + "Balanced Exhaust Fraction", schedule); return result; } @@ -315,7 +296,6 @@ namespace model { if (boost::optional val_ = autosizedDesignExhaustFlowRate()) { setDesignExhaustFlowRate(*val_)); } - } boost::optional ZoneHVACExhaustControl_Impl::optionalAvailabilitySchedule() const { @@ -336,8 +316,7 @@ namespace model { } // namespace detail - ZoneHVACExhaustControl::ZoneHVACExhaustControl(const Model& model) - : ZoneHVACComponent(ZoneHVACExhaustControl::iddObjectType(), model) { + ZoneHVACExhaustControl::ZoneHVACExhaustControl(const Model& model) : ZoneHVACComponent(ZoneHVACExhaustControl::iddObjectType(), model) { OS_ASSERT(getImpl()); // TODO: consider adding (overloaded or not) explicit ctors taking required objects as argument @@ -367,8 +346,7 @@ namespace model { } std::vector ZoneHVACExhaustControl::flowControlTypeValues() { - return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), - OS_ZoneHVAC_ExhaustControlFields::FlowControlType); + return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ZoneHVAC_ExhaustControlFields::FlowControlType); } Schedule ZoneHVACExhaustControl::availabilitySchedule() const { @@ -395,7 +373,7 @@ namespace model { return getImpl()->isDesignExhaustFlowRateAutosized(); } - boost::optional ZoneHVACExhaustControl::autosizedDesignExhaustFlowRate() { + boost::optional ZoneHVACExhaustControl::autosizedDesignExhaustFlowRate() { return getImpl()->autosizedDesignExhaustFlowRate(); } @@ -492,9 +470,7 @@ namespace model { } /// @cond - ZoneHVACExhaustControl::ZoneHVACExhaustControl( - std::shared_ptr impl) - : ZoneHVACComponent(std::move(impl)) {} + ZoneHVACExhaustControl::ZoneHVACExhaustControl(std::shared_ptr impl) : ZoneHVACComponent(std::move(impl)) {} /// @endcond } // namespace model diff --git a/src/model/ZoneHVACExhaustControl.hpp b/src/model/ZoneHVACExhaustControl.hpp index 4a24056ed0..0ebf9c42c5 100644 --- a/src/model/ZoneHVACExhaustControl.hpp +++ b/src/model/ZoneHVACExhaustControl.hpp @@ -89,7 +89,7 @@ namespace model { bool isDesignExhaustFlowRateAutosized() const; - boost::optional autosizedDesignExhaustFlowRate(); + boost::optional autosizedDesignExhaustFlowRate(); std::string flowControlType() const; diff --git a/src/model/ZoneHVACExhaustControl_Impl.hpp b/src/model/ZoneHVACExhaustControl_Impl.hpp index 6d2cae5689..0e3b2c8259 100644 --- a/src/model/ZoneHVACExhaustControl_Impl.hpp +++ b/src/model/ZoneHVACExhaustControl_Impl.hpp @@ -43,24 +43,18 @@ namespace model { namespace detail { - /** ZoneHVACExhaustControl_Impl is a ZoneHVACComponent_Impl that is the implementation class for ZoneHVACExhaustControl.*/ + /** 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 IdfObject& idfObject, Model_Impl* model, bool keepHandle); - ZoneHVACExhaustControl_Impl(const openstudio::detail::WorkspaceObject_Impl& other, - 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); + ZoneHVACExhaustControl_Impl(const ZoneHVACExhaustControl_Impl& other, Model_Impl* model, bool keepHandle); virtual ~ZoneHVACExhaustControl_Impl() = default; @@ -99,7 +93,7 @@ namespace model { bool isDesignExhaustFlowRateAutosized() const; - boost::optional autosizedDesignExhaustFlowRate(); + boost::optional autosizedDesignExhaustFlowRate(); std::string flowControlType() const; @@ -123,7 +117,7 @@ namespace model { //@{ // TODO: Check argument type. From object lists, some candidates are: Schedule. - // Note Schedules are passed by reference, not const reference. + // Note Schedules are passed by reference, not const reference. bool setAvailabilitySchedule(Schedule& schedule); // TODO: Check argument type. From object lists, some candidates are: ThermalZone. @@ -142,7 +136,7 @@ namespace model { bool setFlowControlType(const std::string& flowControlType); // TODO: Check argument type. From object lists, some candidates are: Schedule. - // Note Schedules are passed by reference, not const reference. + // Note Schedules are passed by reference, not const reference. bool setExhaustFlowFractionSchedule(Schedule& schedule); void resetExhaustFlowFractionSchedule(); @@ -153,19 +147,19 @@ namespace model { void resetSupplyNodeorNodeList(); // TODO: Check argument type. From object lists, some candidates are: Schedule. - // Note Schedules are passed by reference, not const reference. + // Note Schedules are passed by reference, not const reference. bool setMinimumZoneTemperatureLimitSchedule(Schedule& schedule); void resetMinimumZoneTemperatureLimitSchedule(); // TODO: Check argument type. From object lists, some candidates are: Schedule. - // Note Schedules are passed by reference, not const reference. + // Note Schedules are passed by reference, not const reference. bool setMinimumExhaustFlowFractionSchedule(Schedule& schedule); void resetMinimumExhaustFlowFractionSchedule(); // TODO: Check argument type. From object lists, some candidates are: Schedule. - // Note Schedules are passed by reference, not const reference. + // Note Schedules are passed by reference, not const reference. bool setBalancedExhaustFractionSchedule(Schedule& schedule); void resetBalancedExhaustFractionSchedule(); @@ -182,7 +176,7 @@ namespace model { protected: private: REGISTER_LOGGER("openstudio.model.ZoneHVACExhaustControl"); - + // TODO: Check the return types of these methods. // Optional getters for use by methods like children() so can remove() if the constructor fails. // There are other ways for the public versions of these getters to fail--perhaps all required diff --git a/src/model/test/AirloopHVACExhaustSystem_GTest.cpp b/src/model/test/AirloopHVACExhaustSystem_GTest.cpp index 1e3fb77c38..5205fe04a9 100644 --- a/src/model/test/AirloopHVACExhaustSystem_GTest.cpp +++ b/src/model/test/AirloopHVACExhaustSystem_GTest.cpp @@ -60,7 +60,6 @@ TEST_F(ModelFixture, AirloopHVACExhaustSystem_GettersSetters) { FansSystemModel fan(m); EXPECT_TRUE(airloopHVACExhaustSystem.setFan(fan)); EXPECT_EQ(fan, airloopHVACExhaustSystem.fan()); - } TEST_F(ModelFixture, AirloopHVACExhaustSystem_HeatCoolFuelTypes) { Model m; diff --git a/src/model/test/ZoneHVACExhaustControl_GTest.cpp b/src/model/test/ZoneHVACExhaustControl_GTest.cpp index 102ddbfb0a..4f22f2e8b3 100644 --- a/src/model/test/ZoneHVACExhaustControl_GTest.cpp +++ b/src/model/test/ZoneHVACExhaustControl_GTest.cpp @@ -124,7 +124,6 @@ TEST_F(ModelFixture, ZoneHVACExhaustControl_GettersSetters) { EXPECT_TRUE(zoneHVACExhaustControl.setBalancedExhaustFractionSchedule(balancedExhaustFractionSchedule)); ASSERT_TRUE(zoneHVACExhaustControl.balancedExhaustFractionSchedule()); EXPECT_EQ(balancedExhaustFractionSchedule, zoneHVACExhaustControl.balancedExhaustFractionSchedule().get()); - } TEST_F(ModelFixture, ZoneHVACExhaustControl_HeatCoolFuelTypes) { Model m; From e98a8553658b77532c6317a24dfd0f216f2b2fe1 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Wed, 15 Jan 2025 13:59:29 -0700 Subject: [PATCH 05/17] Case typo. --- ...rwardTranslateAirLoopHVACExhaustSystem.cpp | 7 +- .../Test/AirLoopHVACExhaustSystem_GTest.cpp | 7 +- src/model/AirloopHVACExhaustSystem.cpp | 74 ++++++++++--------- src/model/AirloopHVACExhaustSystem.hpp | 34 ++++----- src/model/AirloopHVACExhaustSystem_Impl.hpp | 22 ++++-- .../test/AirloopHVACExhaustSystem_GTest.cpp | 35 ++++----- 6 files changed, 96 insertions(+), 83 deletions(-) diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp index 2e4cbf28fe..b07e31e01b 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp @@ -48,7 +48,7 @@ namespace openstudio { namespace energyplus { - boost::optional ForwardTranslator::translateAirLoopHVACExhaustSystem(model::AirLoopHVACExhaustSystem& modelObject) { + 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); @@ -67,7 +67,7 @@ namespace energyplus { // Zone Mixer Name: Required Object ZoneMixers zoneMixer = modelObject.zoneMixer(); - if (boost::optional wo_ = translateAndMapModelObject(zoneMixer)) { + if (boost::optional wo_ = translateAndMapModelObject(zoneMixer)) { idfObject.setString(AirLoopHVAC_ExhaustSystemFields::ZoneMixerName, wo_->nameString()); } @@ -75,9 +75,10 @@ namespace energyplus { const std::string fanObjectType = modelObject.fanObjectType(); idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanObjectType, fanObjectType); + // Fan Name: Required Object FansSystemModel fan = modelObject.fan(); - if (boost::optional wo_ = translateAndMapModelObject(fan)) { + if (boost::optional wo_ = translateAndMapModelObject(fan)) { idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanName, wo_->nameString()); } diff --git a/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp b/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp index 8d59a183d6..b0f0eba25d 100644 --- a/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp +++ b/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp @@ -69,6 +69,7 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_AirLoopHVACExhaustSystem) { FansSystemModel fan(m); EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan)); + // TODO: you're responsible for creating all other objects needed so this object actually gets ForwardTranslated const Workspace w = ft.translateModel(m); @@ -76,7 +77,7 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_AirLoopHVACExhaustSystem) { ASSERT_EQ(1u, idfObjs.size()); const auto& idfObject = idfObjs.front(); - EXPECT_EQ(zoneMixer.nameString(), 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()); + EXPECT_EQ(zoneMixer.nameString(), 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/model/AirloopHVACExhaustSystem.cpp b/src/model/AirloopHVACExhaustSystem.cpp index add1e1ad8a..975b1f5ac5 100644 --- a/src/model/AirloopHVACExhaustSystem.cpp +++ b/src/model/AirloopHVACExhaustSystem.cpp @@ -27,8 +27,8 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***********************************************************************************************************************/ -#include "AirloopHVACExhaustSystem.hpp" -#include "AirloopHVACExhaustSystem_Impl.hpp" +#include "AirLoopHVACExhaustSystem.hpp" +#include "AirLoopHVACExhaustSystem_Impl.hpp" // TODO: Check the following class names against object getters and setters. #include "ZoneMixers.hpp" @@ -47,53 +47,55 @@ namespace model { namespace detail { - AirloopHVACExhaustSystem_Impl::AirloopHVACExhaustSystem_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) + AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const IdfObject& idfObject, + Model_Impl* model, bool keepHandle) : StraightComponent_Impl(idfObject, model, keepHandle) { - OS_ASSERT(idfObject.iddObject().type() == AirloopHVACExhaustSystem::iddObjectType()); + OS_ASSERT(idfObject.iddObject().type() == AirLoopHVACExhaustSystem::iddObjectType()); } - AirloopHVACExhaustSystem_Impl::AirloopHVACExhaustSystem_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, - bool keepHandle) + AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const openstudio::detail::WorkspaceObject_Impl& other, + Model_Impl* model, bool keepHandle) : StraightComponent_Impl(other, model, keepHandle) { - OS_ASSERT(other.iddObject().type() == AirloopHVACExhaustSystem::iddObjectType()); + OS_ASSERT(other.iddObject().type() == AirLoopHVACExhaustSystem::iddObjectType()); } - AirloopHVACExhaustSystem_Impl::AirloopHVACExhaustSystem_Impl(const AirloopHVACExhaustSystem_Impl& other, Model_Impl* model, bool keepHandle) - : StraightComponent_Impl(other, model, keepHandle) {} + AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const AirLoopHVACExhaustSystem_Impl& other, + Model_Impl* model, bool keepHandle) + : StraightComponent_Impl(other, model, keepHandle) {} - const std::vector& AirloopHVACExhaustSystem_Impl::outputVariableNames() const { + const std::vector& AirLoopHVACExhaustSystem_Impl::outputVariableNames() const { static std::vector result; - if (result.empty()) { + if (result.empty()){ } return result; } - IddObjectType AirloopHVACExhaustSystem_Impl::iddObjectType() const { - return AirloopHVACExhaustSystem::iddObjectType(); + IddObjectType AirLoopHVACExhaustSystem_Impl::iddObjectType() const { + return AirLoopHVACExhaustSystem::iddObjectType(); } - ComponentType AirloopHVACExhaustSystem_Impl::componentType() const { + ComponentType AirLoopHVACExhaustSystem_Impl::componentType() const { // TODO return ComponentType::None; } - std::vector AirloopHVACExhaustSystem_Impl::coolingFuelTypes() const { + std::vector AirLoopHVACExhaustSystem_Impl::coolingFuelTypes() const { // TODO return {}; } - std::vector AirloopHVACExhaustSystem_Impl::heatingFuelTypes() const { + std::vector AirLoopHVACExhaustSystem_Impl::heatingFuelTypes() const { // TODO return {}; } - std::vector AirloopHVACExhaustSystem_Impl::appGHeatingFuelTypes() const { + std::vector AirLoopHVACExhaustSystem_Impl::appGHeatingFuelTypes() const { // TODO return {}; } - ZoneMixers AirloopHVACExhaustSystem_Impl::zoneMixer() const { + ZoneMixers AirLoopHVACExhaustSystem_Impl::zoneMixer() const { boost::optional value = optionalZoneMixer(); if (!value) { LOG_AND_THROW(briefDescription() << " does not have an Zone Mixer attached."); @@ -101,7 +103,7 @@ namespace model { return value.get(); } - FansSystemModel AirloopHVACExhaustSystem_Impl::fan() const { + FansSystemModel AirLoopHVACExhaustSystem_Impl::fan() const { boost::optional value = optionalFan(); if (!value) { LOG_AND_THROW(briefDescription() << " does not have an Fan attached."); @@ -109,28 +111,29 @@ namespace model { return value.get(); } - bool AirloopHVACExhaustSystem_Impl::setZoneMixer(const ZoneMixers& zoneMixers) { + bool AirLoopHVACExhaustSystem_Impl::setZoneMixer(const ZoneMixers& zoneMixers) { const bool result = setPointer(OS_AirLoopHVAC_ExhaustSystemFields::ZoneMixerName, zoneMixers.handle()); return result; } - bool AirloopHVACExhaustSystem_Impl::setFan(const FansSystemModel& fansSystemModel) { + bool AirLoopHVACExhaustSystem_Impl::setFan(const FansSystemModel& fansSystemModel) { const bool result = setPointer(OS_AirLoopHVAC_ExhaustSystemFields::FanName, fansSystemModel.handle()); return result; } - boost::optional AirloopHVACExhaustSystem_Impl::optionalZoneMixer() const { + boost::optional AirLoopHVACExhaustSystem_Impl::optionalZoneMixer() const { return getObject().getModelObjectTarget(OS_AirLoopHVAC_ExhaustSystemFields::ZoneMixerName); } - boost::optional AirloopHVACExhaustSystem_Impl::optionalFan() const { + boost::optional AirLoopHVACExhaustSystem_Impl::optionalFan() const { return getObject().getModelObjectTarget(OS_AirLoopHVAC_ExhaustSystemFields::FanName); } } // namespace detail - AirloopHVACExhaustSystem::AirloopHVACExhaustSystem(const Model& model) : StraightComponent(AirloopHVACExhaustSystem::iddObjectType(), model) { - OS_ASSERT(getImpl()); + AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(const Model& model) + : StraightComponent(AirLoopHVACExhaustSystem::iddObjectType(), model) { + OS_ASSERT(getImpl()); // TODO: consider adding (overloaded or not) explicit ctors taking required objects as argument @@ -144,28 +147,29 @@ namespace model { OS_ASSERT(ok); } - IddObjectType AirloopHVACExhaustSystem::iddObjectType() { + IddObjectType AirLoopHVACExhaustSystem::iddObjectType() { return {IddObjectType::OS_AirLoopHVAC_ExhaustSystem}; } - ZoneMixers AirloopHVACExhaustSystem::zoneMixer() const { - return getImpl()->zoneMixer(); + ZoneMixers AirLoopHVACExhaustSystem::zoneMixer() const { + return getImpl()->zoneMixer(); } - FansSystemModel AirloopHVACExhaustSystem::fan() const { - return getImpl()->fan(); + FansSystemModel AirLoopHVACExhaustSystem::fan() const { + return getImpl()->fan(); } - bool AirloopHVACExhaustSystem::setZoneMixer(const ZoneMixers& zoneMixers) { - return getImpl()->setZoneMixer(zoneMixers); + bool AirLoopHVACExhaustSystem::setZoneMixer(const ZoneMixers& zoneMixers) { + return getImpl()->setZoneMixer(zoneMixers); } - bool AirloopHVACExhaustSystem::setFan(const FansSystemModel& fansSystemModel) { - return getImpl()->setFan(fansSystemModel); + bool AirLoopHVACExhaustSystem::setFan(const FansSystemModel& fansSystemModel) { + return getImpl()->setFan(fansSystemModel); } /// @cond - AirloopHVACExhaustSystem::AirloopHVACExhaustSystem(std::shared_ptr impl) + AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem( + std::shared_ptr impl) : StraightComponent(std::move(impl)) {} /// @endcond diff --git a/src/model/AirloopHVACExhaustSystem.hpp b/src/model/AirloopHVACExhaustSystem.hpp index d2924ac76b..6dfa8ba0ad 100644 --- a/src/model/AirloopHVACExhaustSystem.hpp +++ b/src/model/AirloopHVACExhaustSystem.hpp @@ -42,25 +42,25 @@ namespace model { namespace detail { - class AirloopHVACExhaustSystem_Impl; + class AirLoopHVACExhaustSystem_Impl; } // namespace detail - /** AirloopHVACExhaustSystem is a StraightComponent that wraps the OpenStudio IDD object 'OS:AirLoopHVAC:ExhaustSystem'. */ - class MODEL_API AirloopHVACExhaustSystem : public StraightComponent + /** AirLoopHVACExhaustSystem is a StraightComponent that wraps the OpenStudio IDD object 'OS:AirLoopHVAC:ExhaustSystem'. */ + class MODEL_API AirLoopHVACExhaustSystem : public StraightComponent { public: /** @name Constructors and Destructors */ //@{ - explicit AirloopHVACExhaustSystem(const Model& model); + explicit AirLoopHVACExhaustSystem(const Model& model); - virtual ~AirloopHVACExhaustSystem() = default; + 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; + AirLoopHVACExhaustSystem(const AirLoopHVACExhaustSystem& other) = default; + AirLoopHVACExhaustSystem(AirLoopHVACExhaustSystem&& other) = default; + AirLoopHVACExhaustSystem& operator=(const AirLoopHVACExhaustSystem&) = default; + AirLoopHVACExhaustSystem& operator=(AirLoopHVACExhaustSystem&&) = default; //@} @@ -92,24 +92,24 @@ namespace model { //@} protected: /// @cond - using ImplType = detail::AirloopHVACExhaustSystem_Impl; + using ImplType = detail::AirLoopHVACExhaustSystem_Impl; - explicit AirloopHVACExhaustSystem(std::shared_ptr impl); + explicit AirLoopHVACExhaustSystem(std::shared_ptr impl); - friend class detail::AirloopHVACExhaustSystem_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"); + REGISTER_LOGGER("openstudio.model.AirLoopHVACExhaustSystem"); }; - /** \relates AirloopHVACExhaustSystem*/ - using OptionalAirloopHVACExhaustSystem = boost::optional; + /** \relates AirLoopHVACExhaustSystem*/ + using OptionalAirLoopHVACExhaustSystem = boost::optional; - /** \relates AirloopHVACExhaustSystem*/ - using AirloopHVACExhaustSystemVector = std::vector; + /** \relates AirLoopHVACExhaustSystem*/ + using AirLoopHVACExhaustSystemVector = std::vector; } // namespace model } // namespace openstudio diff --git a/src/model/AirloopHVACExhaustSystem_Impl.hpp b/src/model/AirloopHVACExhaustSystem_Impl.hpp index 1a2e162438..ce4703a848 100644 --- a/src/model/AirloopHVACExhaustSystem_Impl.hpp +++ b/src/model/AirloopHVACExhaustSystem_Impl.hpp @@ -42,20 +42,26 @@ namespace model { namespace detail { - /** AirloopHVACExhaustSystem_Impl is a StraightComponent_Impl that is the implementation class for AirloopHVACExhaustSystem.*/ - class MODEL_API AirloopHVACExhaustSystem_Impl : public StraightComponent_Impl + /** AirLoopHVACExhaustSystem_Impl is a StraightComponent_Impl that is the implementation class for AirLoopHVACExhaustSystem.*/ + class MODEL_API AirLoopHVACExhaustSystem_Impl : public StraightComponent_Impl { public: /** @name Constructors and Destructors */ //@{ - AirloopHVACExhaustSystem_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle); + 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 openstudio::detail::WorkspaceObject_Impl& other, + Model_Impl* model, + bool keepHandle); - AirloopHVACExhaustSystem_Impl(const AirloopHVACExhaustSystem_Impl& other, Model_Impl* model, bool keepHandle); + AirLoopHVACExhaustSystem_Impl(const AirLoopHVACExhaustSystem_Impl& other, + Model_Impl* model, + bool keepHandle); - virtual ~AirloopHVACExhaustSystem_Impl() = default; + virtual ~AirLoopHVACExhaustSystem_Impl() = default; //@} /** @name Virtual Methods */ @@ -97,8 +103,8 @@ namespace model { //@} protected: private: - REGISTER_LOGGER("openstudio.model.AirloopHVACExhaustSystem"); - + REGISTER_LOGGER("openstudio.model.AirLoopHVACExhaustSystem"); + // TODO: Check the return types of these methods. // Optional getters for use by methods like children() so can remove() if the constructor fails. // There are other ways for the public versions of these getters to fail--perhaps all required diff --git a/src/model/test/AirloopHVACExhaustSystem_GTest.cpp b/src/model/test/AirloopHVACExhaustSystem_GTest.cpp index 5205fe04a9..575c58c755 100644 --- a/src/model/test/AirloopHVACExhaustSystem_GTest.cpp +++ b/src/model/test/AirloopHVACExhaustSystem_GTest.cpp @@ -29,8 +29,8 @@ #include "ModelFixture.hpp" -#include "../AirloopHVACExhaustSystem.hpp" -#include "../AirloopHVACExhaustSystem_Impl.hpp" +#include "../AirLoopHVACExhaustSystem.hpp" +#include "../AirLoopHVACExhaustSystem_Impl.hpp" // TODO: Check the following class names against object getters and setters. #include "../ZoneMixers.hpp" @@ -42,34 +42,35 @@ using namespace openstudio; using namespace openstudio::model; -TEST_F(ModelFixture, AirloopHVACExhaustSystem_GettersSetters) { +TEST_F(ModelFixture, AirLoopHVACExhaustSystem_GettersSetters) { Model m; // TODO: Check regular Ctor arguments - AirloopHVACExhaustSystem airloopHVACExhaustSystem(m); + AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m); // TODO: Or if a UniqueModelObject (and make sure _Impl is included) - // AirloopHVACExhaustSystem airloopHVACExhaustSystem = m.getUniqueModelObject(); + // AirLoopHVACExhaustSystem airLoopHVACExhaustSystem = m.getUniqueModelObject(); - airloopHVACExhaustSystem.setName("My AirloopHVACExhaustSystem"); + airLoopHVACExhaustSystem.setName("My AirLoopHVACExhaustSystem"); // Zone Mixer Name: Required Object ZoneMixers zoneMixer(m); - EXPECT_TRUE(airloopHVACExhaustSystem.setZoneMixer(zoneMixer)); - EXPECT_EQ(zoneMixer, airloopHVACExhaustSystem.zoneMixer()); + EXPECT_TRUE(airLoopHVACExhaustSystem.setZoneMixer(zoneMixer)); + EXPECT_EQ(zoneMixer, airLoopHVACExhaustSystem.zoneMixer()); // Fan Name: Required Object FansSystemModel fan(m); - EXPECT_TRUE(airloopHVACExhaustSystem.setFan(fan)); - EXPECT_EQ(fan, airloopHVACExhaustSystem.fan()); + EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan)); + EXPECT_EQ(fan, airLoopHVACExhaustSystem.fan()); + } -TEST_F(ModelFixture, AirloopHVACExhaustSystem_HeatCoolFuelTypes) { +TEST_F(ModelFixture, AirLoopHVACExhaustSystem_HeatCoolFuelTypes) { Model m; // TODO: Check regular Ctor arguments - AirloopHVACExhaustSystem airloopHVACExhaustSystem(m); + AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m); // TODO: Or if a UniqueModelObject (and make sure _Impl is included) - // AirloopHVACExhaustSystem airloopHVACExhaustSystem = m.getUniqueModelObject(); + // AirLoopHVACExhaustSystem airLoopHVACExhaustSystem = m.getUniqueModelObject(); - 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()); + 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()); } From 7401668089deb2fd175dfd6761f1916c9c5c924f Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Wed, 15 Jan 2025 14:01:09 -0700 Subject: [PATCH 06/17] Remove files. --- ...rwardTranslateAirLoopHVACExhaustSystem.cpp | 89 --------- .../Test/AirLoopHVACExhaustSystem_GTest.cpp | 83 -------- src/model/AirloopHVACExhaustSystem.cpp | 177 ------------------ src/model/AirloopHVACExhaustSystem.hpp | 117 ------------ src/model/AirloopHVACExhaustSystem_Impl.hpp | 121 ------------ .../test/AirloopHVACExhaustSystem_GTest.cpp | 76 -------- 6 files changed, 663 deletions(-) delete mode 100644 src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp delete mode 100644 src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp delete mode 100644 src/model/AirloopHVACExhaustSystem.cpp delete mode 100644 src/model/AirloopHVACExhaustSystem.hpp delete mode 100644 src/model/AirloopHVACExhaustSystem_Impl.hpp delete mode 100644 src/model/test/AirloopHVACExhaustSystem_GTest.cpp diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp deleted file mode 100644 index b07e31e01b..0000000000 --- a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/*********************************************************************************************************************** -* 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" - -// TODO: Check the following class names against object getters and setters. -#include "../../model/ZoneMixers.hpp" -#include "../../model/ZoneMixers_Impl.hpp" - -#include "../../model/FansSystemModel.hpp" -#include "../../model/FansSystemModel_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); - // If it doesn't have a name, or if you aren't sure you are going to want to return it - // IdfObject idfObject(openstudio::IddObjectType::AirLoopHVAC_ExhaustSystem); - // m_idfObjects.push_back(idfObject); - - // TODO: Note JM 2018-10-17 - // You are responsible for implementing any additional logic based on choice fields, etc. - // The ForwardTranslator generator script is meant to facilitate your work, not get you 100% of the way - - // TODO: If you keep createRegisterAndNameIdfObject above, you don't need this. - // But in some cases, you'll want to handle failure without pushing to the map - // Name - idfObject.setName(modelObject.nameString()); - - // Zone Mixer Name: Required Object - ZoneMixers zoneMixer = modelObject.zoneMixer(); - if (boost::optional wo_ = translateAndMapModelObject(zoneMixer)) { - idfObject.setString(AirLoopHVAC_ExhaustSystemFields::ZoneMixerName, wo_->nameString()); - } - - // Fan Object Type: Required String - const std::string fanObjectType = modelObject.fanObjectType(); - idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanObjectType, fanObjectType); - - - // Fan Name: Required Object - FansSystemModel fan = modelObject.fan(); - if (boost::optional wo_ = translateAndMapModelObject(fan)) { - idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanName, 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 deleted file mode 100644 index b0f0eba25d..0000000000 --- a/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/*********************************************************************************************************************** -* 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 "../ReverseTranslator.hpp" - -#include "../../model/AirLoopHVACExhaustSystem.hpp" -#include "../../model/AirLoopHVACExhaustSystem_Impl.hpp" -// TODO: Check the following class names against object getters and setters. -#include "../../model/ZoneMixers.hpp" -#include "../../model/ZoneMixers_Impl.hpp" -#include "../../model/FansSystemModel.hpp" -#include "../../model/FansSystemModel_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; - // TODO: Check regular Ctor arguments - AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m); - // TODO: Or if a UniqueModelObject (and make sure _Impl is included) - // AirLoopHVACExhaustSystem airLoopHVACExhaustSystem = m.getUniqueModelObject(); - - airLoopHVACExhaustSystem.setName("My AirLoopHVACExhaustSystem"); - ZoneMixers zoneMixer(m); - EXPECT_TRUE(airLoopHVACExhaustSystem.setZoneMixer(zoneMixer)); - EXPECT_TRUE(airLoopHVACExhaustSystem.setFanObjectType("Fan:SystemModel")); - FansSystemModel fan(m); - EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan)); - - - // TODO: you're responsible for creating all other objects needed so this object actually gets ForwardTranslated - - 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(zoneMixer.nameString(), 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/model/AirloopHVACExhaustSystem.cpp b/src/model/AirloopHVACExhaustSystem.cpp deleted file mode 100644 index 975b1f5ac5..0000000000 --- a/src/model/AirloopHVACExhaustSystem.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/*********************************************************************************************************************** -* 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" - -// TODO: Check the following class names against object getters and setters. -#include "ZoneMixers.hpp" -#include "ZoneMixers_Impl.hpp" -#include "FansSystemModel.hpp" -#include "FansSystemModel_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) - : StraightComponent_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) - : StraightComponent_Impl(other, model, keepHandle) { - OS_ASSERT(other.iddObject().type() == AirLoopHVACExhaustSystem::iddObjectType()); - } - - AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const AirLoopHVACExhaustSystem_Impl& other, - Model_Impl* model, bool keepHandle) - : StraightComponent_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 { - // TODO - return ComponentType::None; - } - - std::vector AirLoopHVACExhaustSystem_Impl::coolingFuelTypes() const { - // TODO - return {}; - } - - std::vector AirLoopHVACExhaustSystem_Impl::heatingFuelTypes() const { - // TODO - return {}; - } - - std::vector AirLoopHVACExhaustSystem_Impl::appGHeatingFuelTypes() const { - - // TODO - return {}; - } - - ZoneMixers AirLoopHVACExhaustSystem_Impl::zoneMixer() const { - boost::optional value = optionalZoneMixer(); - if (!value) { - LOG_AND_THROW(briefDescription() << " does not have an Zone Mixer attached."); - } - return value.get(); - } - - FansSystemModel AirLoopHVACExhaustSystem_Impl::fan() const { - boost::optional value = optionalFan(); - if (!value) { - LOG_AND_THROW(briefDescription() << " does not have an Fan attached."); - } - return value.get(); - } - - bool AirLoopHVACExhaustSystem_Impl::setZoneMixer(const ZoneMixers& zoneMixers) { - const bool result = setPointer(OS_AirLoopHVAC_ExhaustSystemFields::ZoneMixerName, zoneMixers.handle()); - return result; - } - - bool AirLoopHVACExhaustSystem_Impl::setFan(const FansSystemModel& fansSystemModel) { - const bool result = setPointer(OS_AirLoopHVAC_ExhaustSystemFields::FanName, fansSystemModel.handle()); - return result; - } - - boost::optional AirLoopHVACExhaustSystem_Impl::optionalZoneMixer() const { - return getObject().getModelObjectTarget(OS_AirLoopHVAC_ExhaustSystemFields::ZoneMixerName); - } - - boost::optional AirLoopHVACExhaustSystem_Impl::optionalFan() const { - return getObject().getModelObjectTarget(OS_AirLoopHVAC_ExhaustSystemFields::FanName); - } - - } // namespace detail - - AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(const Model& model) - : StraightComponent(AirLoopHVACExhaustSystem::iddObjectType(), model) { - OS_ASSERT(getImpl()); - - // TODO: consider adding (overloaded or not) explicit ctors taking required objects as argument - - // TODO: Appropriately handle the following required object-list fields. - // OS_AirLoopHVAC_ExhaustSystemFields::ZoneMixerName - // OS_AirLoopHVAC_ExhaustSystemFields::FanName - bool ok = true; - // ok = setZoneMixer(); - OS_ASSERT(ok); - // ok = setFan(); - OS_ASSERT(ok); - } - - IddObjectType AirLoopHVACExhaustSystem::iddObjectType() { - return {IddObjectType::OS_AirLoopHVAC_ExhaustSystem}; - } - - ZoneMixers AirLoopHVACExhaustSystem::zoneMixer() const { - return getImpl()->zoneMixer(); - } - - FansSystemModel AirLoopHVACExhaustSystem::fan() const { - return getImpl()->fan(); - } - - bool AirLoopHVACExhaustSystem::setZoneMixer(const ZoneMixers& zoneMixers) { - return getImpl()->setZoneMixer(zoneMixers); - } - - bool AirLoopHVACExhaustSystem::setFan(const FansSystemModel& fansSystemModel) { - return getImpl()->setFan(fansSystemModel); - } - - /// @cond - AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem( - std::shared_ptr impl) - : StraightComponent(std::move(impl)) {} - /// @endcond - -} // namespace model -} // namespace openstudio diff --git a/src/model/AirloopHVACExhaustSystem.hpp b/src/model/AirloopHVACExhaustSystem.hpp deleted file mode 100644 index 6dfa8ba0ad..0000000000 --- a/src/model/AirloopHVACExhaustSystem.hpp +++ /dev/null @@ -1,117 +0,0 @@ -/*********************************************************************************************************************** -* 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 "StraightComponent.hpp" - -namespace openstudio { -namespace model { - - // TODO: Check the following class names against object getters and setters. - class ZoneMixers; - class FansSystemModel; - - namespace detail { - - class AirLoopHVACExhaustSystem_Impl; - - } // namespace detail - - /** AirLoopHVACExhaustSystem is a StraightComponent that wraps the OpenStudio IDD object 'OS:AirLoopHVAC:ExhaustSystem'. */ - class MODEL_API AirLoopHVACExhaustSystem : public StraightComponent - { - 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 */ - //@{ - - // TODO: Check return type. From object lists, some candidates are: ZoneMixers. - ZoneMixers zoneMixer() const; - - // TODO: Check return type. From object lists, some candidates are: FansSystemModel, FansComponentModel. - FansSystemModel fan() const; - - //@} - /** @name Setters */ - //@{ - - // TODO: Check argument type. From object lists, some candidates are: ZoneMixers. - bool setZoneMixer(const ZoneMixers& zoneMixers); - - // TODO: Check argument type. From object lists, some candidates are: FansSystemModel, FansComponentModel. - bool setFan(const FansSystemModel& fansSystemModel); - - //@} - /** @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 deleted file mode 100644 index ce4703a848..0000000000 --- a/src/model/AirloopHVACExhaustSystem_Impl.hpp +++ /dev/null @@ -1,121 +0,0 @@ -/*********************************************************************************************************************** -* 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 "StraightComponent_Impl.hpp" - -namespace openstudio { -namespace model { - - // TODO: Check the following class names against object getters and setters. - class ZoneMixers; - class FansSystemModel; - - namespace detail { - - /** AirLoopHVACExhaustSystem_Impl is a StraightComponent_Impl that is the implementation class for AirLoopHVACExhaustSystem.*/ - class MODEL_API AirLoopHVACExhaustSystem_Impl : public StraightComponent_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 */ - //@{ - - // TODO: Check return type. From object lists, some candidates are: ZoneMixers. - ZoneMixers zoneMixer() const; - - // TODO: Check return type. From object lists, some candidates are: FansSystemModel, FansComponentModel. - FansSystemModel fan() const; - - //@} - /** @name Setters */ - //@{ - - // TODO: Check argument type. From object lists, some candidates are: ZoneMixers. - bool setZoneMixer(const ZoneMixers& zoneMixers); - - // TODO: Check argument type. From object lists, some candidates are: FansSystemModel, FansComponentModel. - bool setFan(const FansSystemModel& fansSystemModel); - - //@} - /** @name Other */ - //@{ - - //@} - protected: - private: - REGISTER_LOGGER("openstudio.model.AirLoopHVACExhaustSystem"); - - // TODO: Check the return types of these methods. - // Optional getters for use by methods like children() so can remove() if the constructor fails. - // There are other ways for the public versions of these getters to fail--perhaps all required - // objects should be returned as boost::optionals - boost::optional optionalZoneMixer() const; - boost::optional optionalFan() const; - }; - - } // namespace detail - -} // namespace model -} // namespace openstudio - -#endif // MODEL_AIRLOOPHVACEXHAUSTSYSTEM_IMPL_HPP diff --git a/src/model/test/AirloopHVACExhaustSystem_GTest.cpp b/src/model/test/AirloopHVACExhaustSystem_GTest.cpp deleted file mode 100644 index 575c58c755..0000000000 --- a/src/model/test/AirloopHVACExhaustSystem_GTest.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/*********************************************************************************************************************** -* 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" - -// TODO: Check the following class names against object getters and setters. -#include "../ZoneMixers.hpp" -#include "../ZoneMixers_Impl.hpp" - -#include "../FansSystemModel.hpp" -#include "../FansSystemModel_Impl.hpp" - -using namespace openstudio; -using namespace openstudio::model; - -TEST_F(ModelFixture, AirLoopHVACExhaustSystem_GettersSetters) { - Model m; - // TODO: Check regular Ctor arguments - AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m); - // TODO: Or if a UniqueModelObject (and make sure _Impl is included) - // AirLoopHVACExhaustSystem airLoopHVACExhaustSystem = m.getUniqueModelObject(); - - airLoopHVACExhaustSystem.setName("My AirLoopHVACExhaustSystem"); - - // Zone Mixer Name: Required Object - ZoneMixers zoneMixer(m); - EXPECT_TRUE(airLoopHVACExhaustSystem.setZoneMixer(zoneMixer)); - EXPECT_EQ(zoneMixer, airLoopHVACExhaustSystem.zoneMixer()); - - // Fan Name: Required Object - FansSystemModel fan(m); - EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan)); - EXPECT_EQ(fan, airLoopHVACExhaustSystem.fan()); - -} -TEST_F(ModelFixture, AirLoopHVACExhaustSystem_HeatCoolFuelTypes) { - Model m; - // TODO: Check regular Ctor arguments - AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m); - // TODO: Or if a UniqueModelObject (and make sure _Impl is included) - // AirLoopHVACExhaustSystem airLoopHVACExhaustSystem = m.getUniqueModelObject(); - - 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()); -} From c3474cb8be3838d24d172043c38a11d668e69ac3 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Wed, 15 Jan 2025 14:01:34 -0700 Subject: [PATCH 07/17] Fix case typo. --- ...rwardTranslateAirLoopHVACExhaustSystem.cpp | 89 +++++++++ .../Test/AirLoopHVACExhaustSystem_GTest.cpp | 83 ++++++++ src/model/AirLoopHVACExhaustSystem.cpp | 177 ++++++++++++++++++ src/model/AirLoopHVACExhaustSystem.hpp | 117 ++++++++++++ src/model/AirLoopHVACExhaustSystem_Impl.hpp | 121 ++++++++++++ .../test/AirLoopHVACExhaustSystem_GTest.cpp | 76 ++++++++ 6 files changed, 663 insertions(+) create mode 100644 src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp create mode 100644 src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp create mode 100644 src/model/AirLoopHVACExhaustSystem.cpp create mode 100644 src/model/AirLoopHVACExhaustSystem.hpp create mode 100644 src/model/AirLoopHVACExhaustSystem_Impl.hpp create mode 100644 src/model/test/AirLoopHVACExhaustSystem_GTest.cpp diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp new file mode 100644 index 0000000000..b07e31e01b --- /dev/null +++ b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp @@ -0,0 +1,89 @@ +/*********************************************************************************************************************** +* 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" + +// TODO: Check the following class names against object getters and setters. +#include "../../model/ZoneMixers.hpp" +#include "../../model/ZoneMixers_Impl.hpp" + +#include "../../model/FansSystemModel.hpp" +#include "../../model/FansSystemModel_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); + // If it doesn't have a name, or if you aren't sure you are going to want to return it + // IdfObject idfObject(openstudio::IddObjectType::AirLoopHVAC_ExhaustSystem); + // m_idfObjects.push_back(idfObject); + + // TODO: Note JM 2018-10-17 + // You are responsible for implementing any additional logic based on choice fields, etc. + // The ForwardTranslator generator script is meant to facilitate your work, not get you 100% of the way + + // TODO: If you keep createRegisterAndNameIdfObject above, you don't need this. + // But in some cases, you'll want to handle failure without pushing to the map + // Name + idfObject.setName(modelObject.nameString()); + + // Zone Mixer Name: Required Object + ZoneMixers zoneMixer = modelObject.zoneMixer(); + if (boost::optional wo_ = translateAndMapModelObject(zoneMixer)) { + idfObject.setString(AirLoopHVAC_ExhaustSystemFields::ZoneMixerName, wo_->nameString()); + } + + // Fan Object Type: Required String + const std::string fanObjectType = modelObject.fanObjectType(); + idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanObjectType, fanObjectType); + + + // Fan Name: Required Object + FansSystemModel fan = modelObject.fan(); + if (boost::optional wo_ = translateAndMapModelObject(fan)) { + idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanName, 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..b0f0eba25d --- /dev/null +++ b/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp @@ -0,0 +1,83 @@ +/*********************************************************************************************************************** +* 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 "../ReverseTranslator.hpp" + +#include "../../model/AirLoopHVACExhaustSystem.hpp" +#include "../../model/AirLoopHVACExhaustSystem_Impl.hpp" +// TODO: Check the following class names against object getters and setters. +#include "../../model/ZoneMixers.hpp" +#include "../../model/ZoneMixers_Impl.hpp" +#include "../../model/FansSystemModel.hpp" +#include "../../model/FansSystemModel_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; + // TODO: Check regular Ctor arguments + AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m); + // TODO: Or if a UniqueModelObject (and make sure _Impl is included) + // AirLoopHVACExhaustSystem airLoopHVACExhaustSystem = m.getUniqueModelObject(); + + airLoopHVACExhaustSystem.setName("My AirLoopHVACExhaustSystem"); + ZoneMixers zoneMixer(m); + EXPECT_TRUE(airLoopHVACExhaustSystem.setZoneMixer(zoneMixer)); + EXPECT_TRUE(airLoopHVACExhaustSystem.setFanObjectType("Fan:SystemModel")); + FansSystemModel fan(m); + EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan)); + + + // TODO: you're responsible for creating all other objects needed so this object actually gets ForwardTranslated + + 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(zoneMixer.nameString(), 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/model/AirLoopHVACExhaustSystem.cpp b/src/model/AirLoopHVACExhaustSystem.cpp new file mode 100644 index 0000000000..975b1f5ac5 --- /dev/null +++ b/src/model/AirLoopHVACExhaustSystem.cpp @@ -0,0 +1,177 @@ +/*********************************************************************************************************************** +* 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" + +// TODO: Check the following class names against object getters and setters. +#include "ZoneMixers.hpp" +#include "ZoneMixers_Impl.hpp" +#include "FansSystemModel.hpp" +#include "FansSystemModel_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) + : StraightComponent_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) + : StraightComponent_Impl(other, model, keepHandle) { + OS_ASSERT(other.iddObject().type() == AirLoopHVACExhaustSystem::iddObjectType()); + } + + AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const AirLoopHVACExhaustSystem_Impl& other, + Model_Impl* model, bool keepHandle) + : StraightComponent_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 { + // TODO + return ComponentType::None; + } + + std::vector AirLoopHVACExhaustSystem_Impl::coolingFuelTypes() const { + // TODO + return {}; + } + + std::vector AirLoopHVACExhaustSystem_Impl::heatingFuelTypes() const { + // TODO + return {}; + } + + std::vector AirLoopHVACExhaustSystem_Impl::appGHeatingFuelTypes() const { + + // TODO + return {}; + } + + ZoneMixers AirLoopHVACExhaustSystem_Impl::zoneMixer() const { + boost::optional value = optionalZoneMixer(); + if (!value) { + LOG_AND_THROW(briefDescription() << " does not have an Zone Mixer attached."); + } + return value.get(); + } + + FansSystemModel AirLoopHVACExhaustSystem_Impl::fan() const { + boost::optional value = optionalFan(); + if (!value) { + LOG_AND_THROW(briefDescription() << " does not have an Fan attached."); + } + return value.get(); + } + + bool AirLoopHVACExhaustSystem_Impl::setZoneMixer(const ZoneMixers& zoneMixers) { + const bool result = setPointer(OS_AirLoopHVAC_ExhaustSystemFields::ZoneMixerName, zoneMixers.handle()); + return result; + } + + bool AirLoopHVACExhaustSystem_Impl::setFan(const FansSystemModel& fansSystemModel) { + const bool result = setPointer(OS_AirLoopHVAC_ExhaustSystemFields::FanName, fansSystemModel.handle()); + return result; + } + + boost::optional AirLoopHVACExhaustSystem_Impl::optionalZoneMixer() const { + return getObject().getModelObjectTarget(OS_AirLoopHVAC_ExhaustSystemFields::ZoneMixerName); + } + + boost::optional AirLoopHVACExhaustSystem_Impl::optionalFan() const { + return getObject().getModelObjectTarget(OS_AirLoopHVAC_ExhaustSystemFields::FanName); + } + + } // namespace detail + + AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(const Model& model) + : StraightComponent(AirLoopHVACExhaustSystem::iddObjectType(), model) { + OS_ASSERT(getImpl()); + + // TODO: consider adding (overloaded or not) explicit ctors taking required objects as argument + + // TODO: Appropriately handle the following required object-list fields. + // OS_AirLoopHVAC_ExhaustSystemFields::ZoneMixerName + // OS_AirLoopHVAC_ExhaustSystemFields::FanName + bool ok = true; + // ok = setZoneMixer(); + OS_ASSERT(ok); + // ok = setFan(); + OS_ASSERT(ok); + } + + IddObjectType AirLoopHVACExhaustSystem::iddObjectType() { + return {IddObjectType::OS_AirLoopHVAC_ExhaustSystem}; + } + + ZoneMixers AirLoopHVACExhaustSystem::zoneMixer() const { + return getImpl()->zoneMixer(); + } + + FansSystemModel AirLoopHVACExhaustSystem::fan() const { + return getImpl()->fan(); + } + + bool AirLoopHVACExhaustSystem::setZoneMixer(const ZoneMixers& zoneMixers) { + return getImpl()->setZoneMixer(zoneMixers); + } + + bool AirLoopHVACExhaustSystem::setFan(const FansSystemModel& fansSystemModel) { + return getImpl()->setFan(fansSystemModel); + } + + /// @cond + AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem( + std::shared_ptr impl) + : StraightComponent(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..6dfa8ba0ad --- /dev/null +++ b/src/model/AirLoopHVACExhaustSystem.hpp @@ -0,0 +1,117 @@ +/*********************************************************************************************************************** +* 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 "StraightComponent.hpp" + +namespace openstudio { +namespace model { + + // TODO: Check the following class names against object getters and setters. + class ZoneMixers; + class FansSystemModel; + + namespace detail { + + class AirLoopHVACExhaustSystem_Impl; + + } // namespace detail + + /** AirLoopHVACExhaustSystem is a StraightComponent that wraps the OpenStudio IDD object 'OS:AirLoopHVAC:ExhaustSystem'. */ + class MODEL_API AirLoopHVACExhaustSystem : public StraightComponent + { + 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 */ + //@{ + + // TODO: Check return type. From object lists, some candidates are: ZoneMixers. + ZoneMixers zoneMixer() const; + + // TODO: Check return type. From object lists, some candidates are: FansSystemModel, FansComponentModel. + FansSystemModel fan() const; + + //@} + /** @name Setters */ + //@{ + + // TODO: Check argument type. From object lists, some candidates are: ZoneMixers. + bool setZoneMixer(const ZoneMixers& zoneMixers); + + // TODO: Check argument type. From object lists, some candidates are: FansSystemModel, FansComponentModel. + bool setFan(const FansSystemModel& fansSystemModel); + + //@} + /** @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..ce4703a848 --- /dev/null +++ b/src/model/AirLoopHVACExhaustSystem_Impl.hpp @@ -0,0 +1,121 @@ +/*********************************************************************************************************************** +* 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 "StraightComponent_Impl.hpp" + +namespace openstudio { +namespace model { + + // TODO: Check the following class names against object getters and setters. + class ZoneMixers; + class FansSystemModel; + + namespace detail { + + /** AirLoopHVACExhaustSystem_Impl is a StraightComponent_Impl that is the implementation class for AirLoopHVACExhaustSystem.*/ + class MODEL_API AirLoopHVACExhaustSystem_Impl : public StraightComponent_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 */ + //@{ + + // TODO: Check return type. From object lists, some candidates are: ZoneMixers. + ZoneMixers zoneMixer() const; + + // TODO: Check return type. From object lists, some candidates are: FansSystemModel, FansComponentModel. + FansSystemModel fan() const; + + //@} + /** @name Setters */ + //@{ + + // TODO: Check argument type. From object lists, some candidates are: ZoneMixers. + bool setZoneMixer(const ZoneMixers& zoneMixers); + + // TODO: Check argument type. From object lists, some candidates are: FansSystemModel, FansComponentModel. + bool setFan(const FansSystemModel& fansSystemModel); + + //@} + /** @name Other */ + //@{ + + //@} + protected: + private: + REGISTER_LOGGER("openstudio.model.AirLoopHVACExhaustSystem"); + + // TODO: Check the return types of these methods. + // Optional getters for use by methods like children() so can remove() if the constructor fails. + // There are other ways for the public versions of these getters to fail--perhaps all required + // objects should be returned as boost::optionals + boost::optional optionalZoneMixer() const; + boost::optional optionalFan() const; + }; + + } // namespace detail + +} // namespace model +} // namespace openstudio + +#endif // MODEL_AIRLOOPHVACEXHAUSTSYSTEM_IMPL_HPP diff --git a/src/model/test/AirLoopHVACExhaustSystem_GTest.cpp b/src/model/test/AirLoopHVACExhaustSystem_GTest.cpp new file mode 100644 index 0000000000..575c58c755 --- /dev/null +++ b/src/model/test/AirLoopHVACExhaustSystem_GTest.cpp @@ -0,0 +1,76 @@ +/*********************************************************************************************************************** +* 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" + +// TODO: Check the following class names against object getters and setters. +#include "../ZoneMixers.hpp" +#include "../ZoneMixers_Impl.hpp" + +#include "../FansSystemModel.hpp" +#include "../FansSystemModel_Impl.hpp" + +using namespace openstudio; +using namespace openstudio::model; + +TEST_F(ModelFixture, AirLoopHVACExhaustSystem_GettersSetters) { + Model m; + // TODO: Check regular Ctor arguments + AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m); + // TODO: Or if a UniqueModelObject (and make sure _Impl is included) + // AirLoopHVACExhaustSystem airLoopHVACExhaustSystem = m.getUniqueModelObject(); + + airLoopHVACExhaustSystem.setName("My AirLoopHVACExhaustSystem"); + + // Zone Mixer Name: Required Object + ZoneMixers zoneMixer(m); + EXPECT_TRUE(airLoopHVACExhaustSystem.setZoneMixer(zoneMixer)); + EXPECT_EQ(zoneMixer, airLoopHVACExhaustSystem.zoneMixer()); + + // Fan Name: Required Object + FansSystemModel fan(m); + EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan)); + EXPECT_EQ(fan, airLoopHVACExhaustSystem.fan()); + +} +TEST_F(ModelFixture, AirLoopHVACExhaustSystem_HeatCoolFuelTypes) { + Model m; + // TODO: Check regular Ctor arguments + AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m); + // TODO: Or if a UniqueModelObject (and make sure _Impl is included) + // AirLoopHVACExhaustSystem airLoopHVACExhaustSystem = m.getUniqueModelObject(); + + 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()); +} From 1ca7ead65625da8202f76a4eaf10d99f1b9218b9 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Wed, 15 Jan 2025 14:01:48 -0700 Subject: [PATCH 08/17] Formatting. --- ...rwardTranslateAirLoopHVACExhaustSystem.cpp | 7 +++---- .../Test/AirLoopHVACExhaustSystem_GTest.cpp | 7 +++---- src/model/AirLoopHVACExhaustSystem.cpp | 20 ++++++++----------- src/model/AirLoopHVACExhaustSystem_Impl.hpp | 16 +++++---------- .../test/AirLoopHVACExhaustSystem_GTest.cpp | 1 - 5 files changed, 19 insertions(+), 32 deletions(-) diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp index b07e31e01b..2e4cbf28fe 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp @@ -48,7 +48,7 @@ namespace openstudio { namespace energyplus { - boost::optional ForwardTranslator::translateAirLoopHVACExhaustSystem( model::AirLoopHVACExhaustSystem& modelObject ) { + 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); @@ -67,7 +67,7 @@ namespace energyplus { // Zone Mixer Name: Required Object ZoneMixers zoneMixer = modelObject.zoneMixer(); - if (boost::optional wo_ = translateAndMapModelObject(zoneMixer)) { + if (boost::optional wo_ = translateAndMapModelObject(zoneMixer)) { idfObject.setString(AirLoopHVAC_ExhaustSystemFields::ZoneMixerName, wo_->nameString()); } @@ -75,10 +75,9 @@ namespace energyplus { const std::string fanObjectType = modelObject.fanObjectType(); idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanObjectType, fanObjectType); - // Fan Name: Required Object FansSystemModel fan = modelObject.fan(); - if (boost::optional wo_ = translateAndMapModelObject(fan)) { + if (boost::optional wo_ = translateAndMapModelObject(fan)) { idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanName, wo_->nameString()); } diff --git a/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp b/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp index b0f0eba25d..8d59a183d6 100644 --- a/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp +++ b/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp @@ -69,7 +69,6 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_AirLoopHVACExhaustSystem) { FansSystemModel fan(m); EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan)); - // TODO: you're responsible for creating all other objects needed so this object actually gets ForwardTranslated const Workspace w = ft.translateModel(m); @@ -77,7 +76,7 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_AirLoopHVACExhaustSystem) { ASSERT_EQ(1u, idfObjs.size()); const auto& idfObject = idfObjs.front(); - EXPECT_EQ(zoneMixer.nameString(), 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()); - + EXPECT_EQ(zoneMixer.nameString(), 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/model/AirLoopHVACExhaustSystem.cpp b/src/model/AirLoopHVACExhaustSystem.cpp index 975b1f5ac5..23b7c2d18a 100644 --- a/src/model/AirLoopHVACExhaustSystem.cpp +++ b/src/model/AirLoopHVACExhaustSystem.cpp @@ -47,25 +47,23 @@ namespace model { namespace detail { - AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const IdfObject& idfObject, - Model_Impl* model, bool keepHandle) + AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) : StraightComponent_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) + AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, + bool keepHandle) : StraightComponent_Impl(other, model, keepHandle) { OS_ASSERT(other.iddObject().type() == AirLoopHVACExhaustSystem::iddObjectType()); } - AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const AirLoopHVACExhaustSystem_Impl& other, - Model_Impl* model, bool keepHandle) - : StraightComponent_Impl(other, model, keepHandle) {} + AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const AirLoopHVACExhaustSystem_Impl& other, Model_Impl* model, bool keepHandle) + : StraightComponent_Impl(other, model, keepHandle) {} const std::vector& AirLoopHVACExhaustSystem_Impl::outputVariableNames() const { static std::vector result; - if (result.empty()){ + if (result.empty()) { } return result; } @@ -131,8 +129,7 @@ namespace model { } // namespace detail - AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(const Model& model) - : StraightComponent(AirLoopHVACExhaustSystem::iddObjectType(), model) { + AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(const Model& model) : StraightComponent(AirLoopHVACExhaustSystem::iddObjectType(), model) { OS_ASSERT(getImpl()); // TODO: consider adding (overloaded or not) explicit ctors taking required objects as argument @@ -168,8 +165,7 @@ namespace model { } /// @cond - AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem( - std::shared_ptr impl) + AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(std::shared_ptr impl) : StraightComponent(std::move(impl)) {} /// @endcond diff --git a/src/model/AirLoopHVACExhaustSystem_Impl.hpp b/src/model/AirLoopHVACExhaustSystem_Impl.hpp index ce4703a848..14c75cc4a4 100644 --- a/src/model/AirLoopHVACExhaustSystem_Impl.hpp +++ b/src/model/AirLoopHVACExhaustSystem_Impl.hpp @@ -42,24 +42,18 @@ namespace model { namespace detail { - /** AirLoopHVACExhaustSystem_Impl is a StraightComponent_Impl that is the implementation class for AirLoopHVACExhaustSystem.*/ + /** AirLoopHVACExhaustSystem_Impl is a StraightComponent_Impl that is the implementation class for AirLoopHVACExhaustSystem.*/ class MODEL_API AirLoopHVACExhaustSystem_Impl : public StraightComponent_Impl { public: /** @name Constructors and Destructors */ //@{ - AirLoopHVACExhaustSystem_Impl(const IdfObject& idfObject, - Model_Impl* model, - bool keepHandle); + 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 openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle); - AirLoopHVACExhaustSystem_Impl(const AirLoopHVACExhaustSystem_Impl& other, - Model_Impl* model, - bool keepHandle); + AirLoopHVACExhaustSystem_Impl(const AirLoopHVACExhaustSystem_Impl& other, Model_Impl* model, bool keepHandle); virtual ~AirLoopHVACExhaustSystem_Impl() = default; @@ -104,7 +98,7 @@ namespace model { protected: private: REGISTER_LOGGER("openstudio.model.AirLoopHVACExhaustSystem"); - + // TODO: Check the return types of these methods. // Optional getters for use by methods like children() so can remove() if the constructor fails. // There are other ways for the public versions of these getters to fail--perhaps all required diff --git a/src/model/test/AirLoopHVACExhaustSystem_GTest.cpp b/src/model/test/AirLoopHVACExhaustSystem_GTest.cpp index 575c58c755..6acb3ffa74 100644 --- a/src/model/test/AirLoopHVACExhaustSystem_GTest.cpp +++ b/src/model/test/AirLoopHVACExhaustSystem_GTest.cpp @@ -60,7 +60,6 @@ TEST_F(ModelFixture, AirLoopHVACExhaustSystem_GettersSetters) { FansSystemModel fan(m); EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan)); EXPECT_EQ(fan, airLoopHVACExhaustSystem.fan()); - } TEST_F(ModelFixture, AirLoopHVACExhaustSystem_HeatCoolFuelTypes) { Model m; From 015682290741d826cee323194ec3735b8a9fdc6f Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Thu, 16 Jan 2025 11:49:11 -0700 Subject: [PATCH 09/17] Remove zone field from idd. --- resources/model/OpenStudio.idd | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/resources/model/OpenStudio.idd b/resources/model/OpenStudio.idd index c917162476..8fdc1d442e 100644 --- a/resources/model/OpenStudio.idd +++ b/resources/model/OpenStudio.idd @@ -29508,17 +29508,12 @@ OS:ZoneHVAC:ExhaustControl, \required-field \type object-list \object-list ScheduleNames - A4 , \field Zone Name - \required-field - \note Zone the exhaust inlet node is part of - \type object-list - \object-list ThermalZoneNames - A5 , \field Inlet Node Name + 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 - A6 , \field Outlet Node Name + A5 , \field Outlet Node Name \note Outlet node name for the exhaust \required-field \type object-list @@ -29528,32 +29523,32 @@ OS:ZoneHVAC:ExhaustControl, \units m3/s \minimum> 0 \required-field - A7 , \field Flow Control Type + A6 , \field Flow Control Type \note Control type of the zone exhaust flow \type choice \key Scheduled \key FollowSupply \required-field - A8 , \field Exhaust Flow Fraction Schedule Name + 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 - A9 , \field Supply Node or NodeList Name + A8 , \field Supply Node or NodeList Name \note Used only with FollowSupply control type. \type object-list \object-list ConnectionNames - A10, \field Minimum Zone Temperature Limit Schedule Name + 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 - A11, \field Minimum Exhaust Flow Fraction Schedule Name + 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 - A12; \field Balanced Exhaust Fraction Schedule Name + A11; \field Balanced Exhaust Fraction Schedule Name \note Schedule name of the Balanced Exhaust Fraction. \type object-list \object-list ScheduleNames From 5b956bfcddafc340c3c98131b6e5f17549ab5cf8 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Thu, 16 Jan 2025 11:49:23 -0700 Subject: [PATCH 10/17] First pass model files cleanup. --- ...rwardTranslateAirLoopHVACExhaustSystem.cpp | 31 +--- ...ForwardTranslateZoneHVACExhaustControl.cpp | 57 ++----- src/model/AirLoopHVACExhaustSystem.cpp | 63 ++----- src/model/AirLoopHVACExhaustSystem.hpp | 16 +- src/model/AirLoopHVACExhaustSystem_Impl.hpp | 23 +-- src/model/ZoneHVACExhaustControl.cpp | 159 ++++++------------ src/model/ZoneHVACExhaustControl.hpp | 44 +---- src/model/ZoneHVACExhaustControl_Impl.hpp | 63 ++----- 8 files changed, 107 insertions(+), 349 deletions(-) diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp index 2e4cbf28fe..2f9b664cf1 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp @@ -29,15 +29,10 @@ #include "../ForwardTranslator.hpp" #include "../../model/Model.hpp" - #include "../../model/AirLoopHVACExhaustSystem.hpp" - -// TODO: Check the following class names against object getters and setters. -#include "../../model/ZoneMixers.hpp" -#include "../../model/ZoneMixers_Impl.hpp" - -#include "../../model/FansSystemModel.hpp" -#include "../../model/FansSystemModel_Impl.hpp" +#include "../../model/AirLoopHVACExhaustSystem_Impl.hpp" +#include "../../model/HVACComponent.hpp" +#include "../../model/HVACComponent_Impl.hpp" #include #include @@ -52,31 +47,13 @@ namespace energyplus { // Instantiate an IdfObject of the class to store the values IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::AirLoopHVAC_ExhaustSystem, modelObject); - // If it doesn't have a name, or if you aren't sure you are going to want to return it - // IdfObject idfObject(openstudio::IddObjectType::AirLoopHVAC_ExhaustSystem); - // m_idfObjects.push_back(idfObject); - - // TODO: Note JM 2018-10-17 - // You are responsible for implementing any additional logic based on choice fields, etc. - // The ForwardTranslator generator script is meant to facilitate your work, not get you 100% of the way - - // TODO: If you keep createRegisterAndNameIdfObject above, you don't need this. - // But in some cases, you'll want to handle failure without pushing to the map - // Name - idfObject.setName(modelObject.nameString()); - - // Zone Mixer Name: Required Object - ZoneMixers zoneMixer = modelObject.zoneMixer(); - if (boost::optional wo_ = translateAndMapModelObject(zoneMixer)) { - idfObject.setString(AirLoopHVAC_ExhaustSystemFields::ZoneMixerName, wo_->nameString()); - } // Fan Object Type: Required String const std::string fanObjectType = modelObject.fanObjectType(); idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanObjectType, fanObjectType); // Fan Name: Required Object - FansSystemModel fan = modelObject.fan(); + HVACComponent fan = modelObject.fan(); if (boost::optional wo_ = translateAndMapModelObject(fan)) { idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanName, wo_->nameString()); } diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp index 5d87ec0044..7a8a0f7118 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp @@ -29,16 +29,12 @@ #include "../ForwardTranslator.hpp" #include "../../model/Model.hpp" - #include "../../model/ZoneHVACExhaustControl.hpp" - -// TODO: Check the following class names against object getters and setters. +#include "../../model/ZoneHVACExhaustControl_Impl.hpp" #include "../../model/Schedule.hpp" #include "../../model/Schedule_Impl.hpp" - -#include "../../model/Zone.hpp" -#include "../../model/Zone_Impl.hpp" - +#include "../../model/ThermalZone.hpp" +#include "../../model/ThermalZone_Impl.hpp" #include "../../model/Node.hpp" #include "../../model/Node_Impl.hpp" @@ -55,42 +51,27 @@ namespace energyplus { // Instantiate an IdfObject of the class to store the values IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::ZoneHVAC_ExhaustControl, modelObject); - // If it doesn't have a name, or if you aren't sure you are going to want to return it - // IdfObject idfObject(openstudio::IddObjectType::ZoneHVAC_ExhaustControl); - // m_idfObjects.push_back(idfObject); - - // TODO: Note JM 2018-10-17 - // You are responsible for implementing any additional logic based on choice fields, etc. - // The ForwardTranslator generator script is meant to facilitate your work, not get you 100% of the way - - // TODO: If you keep createRegisterAndNameIdfObject above, you don't need this. - // But in some cases, you'll want to handle failure without pushing to the map - // Name - idfObject.setName(modelObject.nameString()); - - // Availability Schedule Name: Optional Object - if (boost::optional availabilitySchedule_ = modelObject.availabilitySchedule()) { - if (boost::optional wo_ = translateAndMapModelObject(availabilitySchedule_.get())) { - idfObject.setString(ZoneHVAC_ExhaustControlFields::AvailabilityScheduleName, wo_->nameString()); - } + + // 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 - Zone zone = modelObject.zone(); - if (boost::optional wo_ = translateAndMapModelObject(zone)) { + ThermalZone thermalZone = modelObject.thermalZone(); + if (boost::optional wo_ = translateAndMapModelObject(thermalZone)) { idfObject.setString(ZoneHVAC_ExhaustControlFields::ZoneName, wo_->nameString()); } - // Inlet Node Name: Required Node - Node inletNodeName = modelObject.inletNodeName(); - if (boost::optional wo_ = translateAndMapModelObject(inletNodeName)) { - idfObject.setString(ZoneHVAC_ExhaustControlFields::InletNodeName, wo_->nameString()); + // InletNodeName + if (auto node = modelObject.inletNode()) { + idfObject.setString(ZoneHVAC_ExhaustControlFields::InletNodeName, node->name().get()); } - // Outlet Node Name: Required Node - Node outletNodeName = modelObject.outletNodeName(); - if (boost::optional wo_ = translateAndMapModelObject(outletNodeName)) { - idfObject.setString(ZoneHVAC_ExhaustControlFields::OutletNodeName, wo_->nameString()); + // OutletNodeName + if (auto node = modelObject.outletNode()) { + idfObject.setString(ZoneHVAC_ExhaustControlFields::OutletNodeName, node->name().get()); } if (modelObject.isDesignExhaustFlowRateAutosized()) { @@ -113,12 +94,6 @@ namespace energyplus { } } - // Supply Node or NodeList Name: Optional Node - Node supplyNodeorNodeListName = modelObject.supplyNodeorNodeListName(); - if (boost::optional wo_ = translateAndMapModelObject(supplyNodeorNodeListName)) { - idfObject.setString(ZoneHVAC_ExhaustControlFields::SupplyNodeorNodeListName, wo_->nameString()); - } - // Minimum Zone Temperature Limit Schedule Name: Optional Object if (boost::optional minimumZoneTemperatureLimitSchedule_ = modelObject.minimumZoneTemperatureLimitSchedule()) { if (boost::optional wo_ = translateAndMapModelObject(minimumZoneTemperatureLimitSchedule_.get())) { diff --git a/src/model/AirLoopHVACExhaustSystem.cpp b/src/model/AirLoopHVACExhaustSystem.cpp index 23b7c2d18a..86a3b271e2 100644 --- a/src/model/AirLoopHVACExhaustSystem.cpp +++ b/src/model/AirLoopHVACExhaustSystem.cpp @@ -30,11 +30,10 @@ #include "AirLoopHVACExhaustSystem.hpp" #include "AirLoopHVACExhaustSystem_Impl.hpp" -// TODO: Check the following class names against object getters and setters. -#include "ZoneMixers.hpp" -#include "ZoneMixers_Impl.hpp" -#include "FansSystemModel.hpp" -#include "FansSystemModel_Impl.hpp" +#include "Model.hpp" +#include "Model_Impl.hpp" +#include "HVACComponent.hpp" +#include "HVACComponent_Impl.hpp" #include "../utilities/core/Assert.hpp" #include "../utilities/data/DataEnums.hpp" @@ -73,58 +72,36 @@ namespace model { } ComponentType AirLoopHVACExhaustSystem_Impl::componentType() const { - // TODO return ComponentType::None; } std::vector AirLoopHVACExhaustSystem_Impl::coolingFuelTypes() const { - // TODO return {}; } std::vector AirLoopHVACExhaustSystem_Impl::heatingFuelTypes() const { - // TODO return {}; } std::vector AirLoopHVACExhaustSystem_Impl::appGHeatingFuelTypes() const { - - // TODO return {}; } - ZoneMixers AirLoopHVACExhaustSystem_Impl::zoneMixer() const { - boost::optional value = optionalZoneMixer(); - if (!value) { - LOG_AND_THROW(briefDescription() << " does not have an Zone Mixer attached."); - } - return value.get(); - } - - FansSystemModel AirLoopHVACExhaustSystem_Impl::fan() const { - boost::optional value = optionalFan(); + HVACComponent AirLoopHVACExhaustSystem_Impl::fan() const { + boost::optional value = optionalFan(); if (!value) { LOG_AND_THROW(briefDescription() << " does not have an Fan attached."); } return value.get(); } - bool AirLoopHVACExhaustSystem_Impl::setZoneMixer(const ZoneMixers& zoneMixers) { - const bool result = setPointer(OS_AirLoopHVAC_ExhaustSystemFields::ZoneMixerName, zoneMixers.handle()); - return result; - } - - bool AirLoopHVACExhaustSystem_Impl::setFan(const FansSystemModel& fansSystemModel) { - const bool result = setPointer(OS_AirLoopHVAC_ExhaustSystemFields::FanName, fansSystemModel.handle()); + bool AirLoopHVACExhaustSystem_Impl::setFan(const HVACComponent& fan) { + const bool result = setPointer(OS_AirLoopHVAC_ExhaustSystemFields::FanName, fan.handle()); return result; } - boost::optional AirLoopHVACExhaustSystem_Impl::optionalZoneMixer() const { - return getObject().getModelObjectTarget(OS_AirLoopHVAC_ExhaustSystemFields::ZoneMixerName); - } - - boost::optional AirLoopHVACExhaustSystem_Impl::optionalFan() const { - return getObject().getModelObjectTarget(OS_AirLoopHVAC_ExhaustSystemFields::FanName); + boost::optional AirLoopHVACExhaustSystem_Impl::optionalFan() const { + return getObject().getModelObjectTarget(OS_AirLoopHVAC_ExhaustSystemFields::FanName); } } // namespace detail @@ -132,14 +109,10 @@ namespace model { AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(const Model& model) : StraightComponent(AirLoopHVACExhaustSystem::iddObjectType(), model) { OS_ASSERT(getImpl()); - // TODO: consider adding (overloaded or not) explicit ctors taking required objects as argument - - // TODO: Appropriately handle the following required object-list fields. - // OS_AirLoopHVAC_ExhaustSystemFields::ZoneMixerName - // OS_AirLoopHVAC_ExhaustSystemFields::FanName bool ok = true; // ok = setZoneMixer(); OS_ASSERT(ok); + // ok = setFan(); OS_ASSERT(ok); } @@ -148,20 +121,12 @@ namespace model { return {IddObjectType::OS_AirLoopHVAC_ExhaustSystem}; } - ZoneMixers AirLoopHVACExhaustSystem::zoneMixer() const { - return getImpl()->zoneMixer(); - } - - FansSystemModel AirLoopHVACExhaustSystem::fan() const { + HVACComponent AirLoopHVACExhaustSystem::fan() const { return getImpl()->fan(); } - bool AirLoopHVACExhaustSystem::setZoneMixer(const ZoneMixers& zoneMixers) { - return getImpl()->setZoneMixer(zoneMixers); - } - - bool AirLoopHVACExhaustSystem::setFan(const FansSystemModel& fansSystemModel) { - return getImpl()->setFan(fansSystemModel); + bool AirLoopHVACExhaustSystem::setFan(const HVACComponent& fan) { + return getImpl()->setFan(fan); } /// @cond diff --git a/src/model/AirLoopHVACExhaustSystem.hpp b/src/model/AirLoopHVACExhaustSystem.hpp index 6dfa8ba0ad..4c39c2ba69 100644 --- a/src/model/AirLoopHVACExhaustSystem.hpp +++ b/src/model/AirLoopHVACExhaustSystem.hpp @@ -36,9 +36,7 @@ namespace openstudio { namespace model { - // TODO: Check the following class names against object getters and setters. - class ZoneMixers; - class FansSystemModel; + class HVACComponent; namespace detail { @@ -69,21 +67,13 @@ namespace model { /** @name Getters */ //@{ - // TODO: Check return type. From object lists, some candidates are: ZoneMixers. - ZoneMixers zoneMixer() const; - - // TODO: Check return type. From object lists, some candidates are: FansSystemModel, FansComponentModel. - FansSystemModel fan() const; + HVACComponent fan() const; //@} /** @name Setters */ //@{ - // TODO: Check argument type. From object lists, some candidates are: ZoneMixers. - bool setZoneMixer(const ZoneMixers& zoneMixers); - - // TODO: Check argument type. From object lists, some candidates are: FansSystemModel, FansComponentModel. - bool setFan(const FansSystemModel& fansSystemModel); + bool setFan(const HVACComponent& fan); //@} /** @name Other */ diff --git a/src/model/AirLoopHVACExhaustSystem_Impl.hpp b/src/model/AirLoopHVACExhaustSystem_Impl.hpp index 14c75cc4a4..0a1dbfdeea 100644 --- a/src/model/AirLoopHVACExhaustSystem_Impl.hpp +++ b/src/model/AirLoopHVACExhaustSystem_Impl.hpp @@ -36,9 +36,7 @@ namespace openstudio { namespace model { - // TODO: Check the following class names against object getters and setters. - class ZoneMixers; - class FansSystemModel; + class HVACComponent; namespace detail { @@ -74,21 +72,13 @@ namespace model { /** @name Getters */ //@{ - // TODO: Check return type. From object lists, some candidates are: ZoneMixers. - ZoneMixers zoneMixer() const; - - // TODO: Check return type. From object lists, some candidates are: FansSystemModel, FansComponentModel. - FansSystemModel fan() const; + HVACComponent fan() const; //@} /** @name Setters */ //@{ - // TODO: Check argument type. From object lists, some candidates are: ZoneMixers. - bool setZoneMixer(const ZoneMixers& zoneMixers); - - // TODO: Check argument type. From object lists, some candidates are: FansSystemModel, FansComponentModel. - bool setFan(const FansSystemModel& fansSystemModel); + bool setFan(const HVACComponent& fan); //@} /** @name Other */ @@ -99,12 +89,7 @@ namespace model { private: REGISTER_LOGGER("openstudio.model.AirLoopHVACExhaustSystem"); - // TODO: Check the return types of these methods. - // Optional getters for use by methods like children() so can remove() if the constructor fails. - // There are other ways for the public versions of these getters to fail--perhaps all required - // objects should be returned as boost::optionals - boost::optional optionalZoneMixer() const; - boost::optional optionalFan() const; + boost::optional optionalFan() const; }; } // namespace detail diff --git a/src/model/ZoneHVACExhaustControl.cpp b/src/model/ZoneHVACExhaustControl.cpp index aeb62f70bc..b79ea2628e 100644 --- a/src/model/ZoneHVACExhaustControl.cpp +++ b/src/model/ZoneHVACExhaustControl.cpp @@ -30,13 +30,12 @@ #include "ZoneHVACExhaustControl.hpp" #include "ZoneHVACExhaustControl_Impl.hpp" -// TODO: Check the following class names against object getters and setters. +#include "Model.hpp" +#include "Model_Impl.hpp" #include "Schedule.hpp" #include "Schedule_Impl.hpp" #include "ThermalZone.hpp" #include "ThermalZone_Impl.hpp" -#include "Connection.hpp" -#include "Connection_Impl.hpp" #include "ScheduleTypeLimits.hpp" #include "ScheduleTypeRegistry.hpp" @@ -103,24 +102,27 @@ namespace model { 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 { - // TODO return ComponentType::None; } std::vector ZoneHVACExhaustControl_Impl::coolingFuelTypes() const { - // TODO return {}; } std::vector ZoneHVACExhaustControl_Impl::heatingFuelTypes() const { - // TODO return {}; } std::vector ZoneHVACExhaustControl_Impl::appGHeatingFuelTypes() const { - - // TODO return {}; } @@ -132,28 +134,17 @@ namespace model { return value.get(); } - ThermalZone ZoneHVACExhaustControl_Impl::zone() const { - boost::optional value = optionalZone(); - if (!value) { - LOG_AND_THROW(briefDescription() << " does not have an Zone 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(); - Connection ZoneHVACExhaustControl_Impl::inletNode() const { - boost::optional value = optionalInletNode(); - if (!value) { - LOG_AND_THROW(briefDescription() << " does not have an Inlet Node attached."); - } - return value.get(); - } - - Connection ZoneHVACExhaustControl_Impl::outletNode() const { - boost::optional value = optionalOutletNode(); - if (!value) { - LOG_AND_THROW(briefDescription() << " does not have an Outlet Node attached."); + if (std::find(equipment.begin(), equipment.end(), thisObject) != equipment.end()) { + return thermalZone; + } } - return value.get(); + return boost::none; } boost::optional ZoneHVACExhaustControl_Impl::designExhaustFlowRate() const { @@ -183,10 +174,6 @@ namespace model { return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::ExhaustFlowFractionScheduleName); } - boost::optional ZoneHVACExhaustControl_Impl::supplyNodeorNodeList() const { - return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::SupplyNodeorNodeListName); - } - boost::optional ZoneHVACExhaustControl_Impl::minimumZoneTemperatureLimitSchedule() const { return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::MinimumZoneTemperatureLimitScheduleName); } @@ -204,19 +191,30 @@ namespace model { return result; } - bool ZoneHVACExhaustControl_Impl::setZone(const ThermalZone& thermalZone) { - const bool result = setPointer(OS_ZoneHVAC_ExhaustControlFields::ZoneName, thermalZone.handle()); - return result; - } + bool ZoneHVACExhaustControl_Impl::addToThermalZone(ThermalZone& thermalZone) { + Model m = this->model(); - bool ZoneHVACExhaustControl_Impl::setInletNode(const Connection& connection) { - const bool result = setPointer(OS_ZoneHVAC_ExhaustControlFields::InletNodeName, connection.handle()); - return result; + if (thermalZone.model() != m) { + return false; + } + + if (thermalZone.isPlenum()) { + return false; + } + + removeFromThermalZone(); + + thermalZone.setUseIdealAirLoads(false); + + thermalZone.addEquipment(this->getObject()); + + return true; } - bool ZoneHVACExhaustControl_Impl::setOutletNode(const Connection& connection) { - const bool result = setPointer(OS_ZoneHVAC_ExhaustControlFields::OutletNodeName, connection.handle()); - return result; + void ZoneHVACExhaustControl_Impl::removeFromThermalZone() { + if (boost::optional thermalZone = this->thermalZone()) { + thermalZone->removeEquipment(this->getObject()); + } } bool ZoneHVACExhaustControl_Impl::setDesignExhaustFlowRate(double designExhaustFlowRate) { @@ -245,16 +243,6 @@ namespace model { OS_ASSERT(result); } - bool ZoneHVACExhaustControl_Impl::setSupplyNodeorNodeList(const Connection& connection) { - const bool result = setPointer(OS_ZoneHVAC_ExhaustControlFields::SupplyNodeorNodeListName, connection.handle()); - return result; - } - - void ZoneHVACExhaustControl_Impl::resetSupplyNodeorNodeList() { - const bool result = setString(OS_ZoneHVAC_ExhaustControlFields::SupplyNodeorNodeListName, ""); - OS_ASSERT(result); - } - bool ZoneHVACExhaustControl_Impl::setMinimumZoneTemperatureLimitSchedule(Schedule& schedule) { const bool result = setSchedule(OS_ZoneHVAC_ExhaustControlFields::MinimumZoneTemperatureLimitScheduleName, "ZoneHVACExhaustControl", "Minimum Zone Temperature Limit", schedule); @@ -302,41 +290,22 @@ namespace model { return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::AvailabilityScheduleName); } - boost::optional ZoneHVACExhaustControl_Impl::optionalZone() const { - return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::ZoneName); - } - - boost::optional ZoneHVACExhaustControl_Impl::optionalInletNode() const { - return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::InletNodeName); - } - - boost::optional ZoneHVACExhaustControl_Impl::optionalOutletNode() const { - return getObject().getModelObjectTarget(OS_ZoneHVAC_ExhaustControlFields::OutletNodeName); - } - } // namespace detail ZoneHVACExhaustControl::ZoneHVACExhaustControl(const Model& model) : ZoneHVACComponent(ZoneHVACExhaustControl::iddObjectType(), model) { OS_ASSERT(getImpl()); - // TODO: consider adding (overloaded or not) explicit ctors taking required objects as argument - - // TODO: Appropriately handle the following required object-list fields. - // OS_ZoneHVAC_ExhaustControlFields::AvailabilityScheduleName - // OS_ZoneHVAC_ExhaustControlFields::ZoneName - // OS_ZoneHVAC_ExhaustControlFields::InletNodeName - // OS_ZoneHVAC_ExhaustControlFields::OutletNodeName bool ok = true; - // ok = setAvailabilitySchedule(); - OS_ASSERT(ok); - // ok = setZone(); - OS_ASSERT(ok); - // ok = setInletNode(); + auto alwaysOn = model.alwaysOnDiscreteSchedule(); + ok = setAvailabilitySchedule(alwaysOn); OS_ASSERT(ok); - // ok = setOutletNode(); + + // ok = setThermalZone(); OS_ASSERT(ok); + // ok = setDesignExhaustFlowRate(); OS_ASSERT(ok); + // ok = setFlowControlType(); OS_ASSERT(ok); } @@ -353,16 +322,8 @@ namespace model { return getImpl()->availabilitySchedule(); } - ThermalZone ZoneHVACExhaustControl::zone() const { - return getImpl()->zone(); - } - - Connection ZoneHVACExhaustControl::inletNode() const { - return getImpl()->inletNode(); - } - - Connection ZoneHVACExhaustControl::outletNode() const { - return getImpl()->outletNode(); + boost::optional ZoneHVACExhaustControl::thermalZone() const { + return getImpl()->thermalZone(); } boost::optional ZoneHVACExhaustControl::designExhaustFlowRate() const { @@ -385,10 +346,6 @@ namespace model { return getImpl()->exhaustFlowFractionSchedule(); } - boost::optional ZoneHVACExhaustControl::supplyNodeorNodeList() const { - return getImpl()->supplyNodeorNodeList(); - } - boost::optional ZoneHVACExhaustControl::minimumZoneTemperatureLimitSchedule() const { return getImpl()->minimumZoneTemperatureLimitSchedule(); } @@ -405,16 +362,12 @@ namespace model { return getImpl()->setAvailabilitySchedule(schedule); } - bool ZoneHVACExhaustControl::setZone(const ThermalZone& thermalZone) { - return getImpl()->setZone(thermalZone); - } - - bool ZoneHVACExhaustControl::setInletNode(const Connection& connection) { - return getImpl()->setInletNode(connection); + bool ZoneHVACExhaustControl::addToThermalZone(ThermalZone& thermalZone) { + return getImpl()->addToThermalZone(thermalZone); } - bool ZoneHVACExhaustControl::setOutletNode(const Connection& connection) { - return getImpl()->setOutletNode(connection); + void ZoneHVACExhaustControl::removeFromThermalZone() { + getImpl()->removeFromThermalZone(); } bool ZoneHVACExhaustControl::setDesignExhaustFlowRate(double designExhaustFlowRate) { @@ -437,14 +390,6 @@ namespace model { getImpl()->resetExhaustFlowFractionSchedule(); } - bool ZoneHVACExhaustControl::setSupplyNodeorNodeList(const Connection& connection) { - return getImpl()->setSupplyNodeorNodeList(connection); - } - - void ZoneHVACExhaustControl::resetSupplyNodeorNodeList() { - getImpl()->resetSupplyNodeorNodeList(); - } - bool ZoneHVACExhaustControl::setMinimumZoneTemperatureLimitSchedule(Schedule& schedule) { return getImpl()->setMinimumZoneTemperatureLimitSchedule(schedule); } diff --git a/src/model/ZoneHVACExhaustControl.hpp b/src/model/ZoneHVACExhaustControl.hpp index 0ebf9c42c5..b7b1401cdd 100644 --- a/src/model/ZoneHVACExhaustControl.hpp +++ b/src/model/ZoneHVACExhaustControl.hpp @@ -37,10 +37,7 @@ namespace openstudio { namespace model { - // TODO: Check the following class names against object getters and setters. class Schedule; - class ThermalZone; - class Connection; namespace detail { @@ -73,17 +70,9 @@ namespace model { /** @name Getters */ //@{ - // TODO: Check return type. From object lists, some candidates are: Schedule. Schedule availabilitySchedule() const; - // TODO: Check return type. From object lists, some candidates are: ThermalZone. - ThermalZone zone() const; - - // TODO: Check return type. From object lists, some candidates are: Connection. - Connection inletNode() const; - - // TODO: Check return type. From object lists, some candidates are: Connection. - Connection outletNode() const; + boost::optional thermalZone() const override; boost::optional designExhaustFlowRate() const; @@ -93,37 +82,23 @@ namespace model { std::string flowControlType() const; - // TODO: Check return type. From object lists, some candidates are: Schedule. boost::optional exhaustFlowFractionSchedule() const; - // TODO: Check return type. From object lists, some candidates are: Connection. - boost::optional supplyNodeorNodeList() const; - - // TODO: Check return type. From object lists, some candidates are: Schedule. boost::optional minimumZoneTemperatureLimitSchedule() const; - // TODO: Check return type. From object lists, some candidates are: Schedule. boost::optional minimumExhaustFlowFractionSchedule() const; - // TODO: Check return type. From object lists, some candidates are: Schedule. boost::optional balancedExhaustFractionSchedule() const; //@} /** @name Setters */ //@{ - // TODO: Check argument type. From object lists, some candidates are: Schedule. - // Note Schedules are passed by reference, not const reference. bool setAvailabilitySchedule(Schedule& schedule); - // TODO: Check argument type. From object lists, some candidates are: ThermalZone. - bool setZone(const ThermalZone& thermalZone); + bool addToThermalZone(ThermalZone& thermalZone); - // TODO: Check argument type. From object lists, some candidates are: Connection. - bool setInletNode(const Connection& connection); - - // TODO: Check argument type. From object lists, some candidates are: Connection. - bool setOutletNode(const Connection& connection); + void removeFromThermalZone(); bool setDesignExhaustFlowRate(double designExhaustFlowRate); @@ -131,31 +106,18 @@ namespace model { bool setFlowControlType(const std::string& flowControlType); - // TODO: Check argument type. From object lists, some candidates are: Schedule. - // Note Schedules are passed by reference, not const reference. bool setExhaustFlowFractionSchedule(Schedule& schedule); void resetExhaustFlowFractionSchedule(); - // TODO: Check argument type. From object lists, some candidates are: Connection. - bool setSupplyNodeorNodeList(const Connection& connection); - - void resetSupplyNodeorNodeList(); - - // TODO: Check argument type. From object lists, some candidates are: Schedule. - // Note Schedules are passed by reference, not const reference. bool setMinimumZoneTemperatureLimitSchedule(Schedule& schedule); void resetMinimumZoneTemperatureLimitSchedule(); - // TODO: Check argument type. From object lists, some candidates are: Schedule. - // Note Schedules are passed by reference, not const reference. bool setMinimumExhaustFlowFractionSchedule(Schedule& schedule); void resetMinimumExhaustFlowFractionSchedule(); - // TODO: Check argument type. From object lists, some candidates are: Schedule. - // Note Schedules are passed by reference, not const reference. bool setBalancedExhaustFractionSchedule(Schedule& schedule); void resetBalancedExhaustFractionSchedule(); diff --git a/src/model/ZoneHVACExhaustControl_Impl.hpp b/src/model/ZoneHVACExhaustControl_Impl.hpp index 0e3b2c8259..5a3dcbe4c4 100644 --- a/src/model/ZoneHVACExhaustControl_Impl.hpp +++ b/src/model/ZoneHVACExhaustControl_Impl.hpp @@ -36,10 +36,7 @@ namespace openstudio { namespace model { - // TODO: Check the following class names against object getters and setters. class Schedule; - class ThermalZone; - class Connection; namespace detail { @@ -68,6 +65,14 @@ namespace model { 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; @@ -77,17 +82,9 @@ namespace model { /** @name Getters */ //@{ - // TODO: Check return type. From object lists, some candidates are: Schedule. Schedule availabilitySchedule() const; - // TODO: Check return type. From object lists, some candidates are: ThermalZone. - ThermalZone zone() const; - - // TODO: Check return type. From object lists, some candidates are: Connection. - Connection inletNode() const; - - // TODO: Check return type. From object lists, some candidates are: Connection. - Connection outletNode() const; + boost::optional thermalZone() const override; boost::optional designExhaustFlowRate() const; @@ -97,37 +94,23 @@ namespace model { std::string flowControlType() const; - // TODO: Check return type. From object lists, some candidates are: Schedule. boost::optional exhaustFlowFractionSchedule() const; - // TODO: Check return type. From object lists, some candidates are: Connection. - boost::optional supplyNodeorNodeList() const; - - // TODO: Check return type. From object lists, some candidates are: Schedule. boost::optional minimumZoneTemperatureLimitSchedule() const; - // TODO: Check return type. From object lists, some candidates are: Schedule. boost::optional minimumExhaustFlowFractionSchedule() const; - // TODO: Check return type. From object lists, some candidates are: Schedule. boost::optional balancedExhaustFractionSchedule() const; //@} /** @name Setters */ //@{ - // TODO: Check argument type. From object lists, some candidates are: Schedule. - // Note Schedules are passed by reference, not const reference. bool setAvailabilitySchedule(Schedule& schedule); - // TODO: Check argument type. From object lists, some candidates are: ThermalZone. - bool setZone(const ThermalZone& thermalZone); - - // TODO: Check argument type. From object lists, some candidates are: Connection. - bool setInletNode(const Connection& connection); + bool addToThermalZone(ThermalZone& thermalZone) override; - // TODO: Check argument type. From object lists, some candidates are: Connection. - bool setOutletNode(const Connection& connection); + void removeFromThermalZone() override; bool setDesignExhaustFlowRate(double designExhaustFlowRate); @@ -135,39 +118,22 @@ namespace model { bool setFlowControlType(const std::string& flowControlType); - // TODO: Check argument type. From object lists, some candidates are: Schedule. - // Note Schedules are passed by reference, not const reference. bool setExhaustFlowFractionSchedule(Schedule& schedule); void resetExhaustFlowFractionSchedule(); - // TODO: Check argument type. From object lists, some candidates are: Connection. - bool setSupplyNodeorNodeList(const Connection& connection); - - void resetSupplyNodeorNodeList(); - - // TODO: Check argument type. From object lists, some candidates are: Schedule. - // Note Schedules are passed by reference, not const reference. bool setMinimumZoneTemperatureLimitSchedule(Schedule& schedule); void resetMinimumZoneTemperatureLimitSchedule(); - // TODO: Check argument type. From object lists, some candidates are: Schedule. - // Note Schedules are passed by reference, not const reference. bool setMinimumExhaustFlowFractionSchedule(Schedule& schedule); void resetMinimumExhaustFlowFractionSchedule(); - // TODO: Check argument type. From object lists, some candidates are: Schedule. - // Note Schedules are passed by reference, not const reference. bool setBalancedExhaustFractionSchedule(Schedule& schedule); void resetBalancedExhaustFractionSchedule(); - virtual void autosize() override; - - virtual void applySizingValues() override; - //@} /** @name Other */ //@{ @@ -177,14 +143,7 @@ namespace model { private: REGISTER_LOGGER("openstudio.model.ZoneHVACExhaustControl"); - // TODO: Check the return types of these methods. - // Optional getters for use by methods like children() so can remove() if the constructor fails. - // There are other ways for the public versions of these getters to fail--perhaps all required - // objects should be returned as boost::optionals boost::optional optionalAvailabilitySchedule() const; - boost::optional optionalZone() const; - boost::optional optionalInletNode() const; - boost::optional optionalOutletNode() const; }; } // namespace detail From f9c5aa53d9818ff2c5f4537d4ac5d5f05271d0fa Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Thu, 16 Jan 2025 12:57:58 -0700 Subject: [PATCH 11/17] Try exhaust system as hvaccomponent. --- src/model/AirLoopHVACExhaustSystem.cpp | 11 +++++------ src/model/AirLoopHVACExhaustSystem.hpp | 6 +++--- src/model/AirLoopHVACExhaustSystem_Impl.hpp | 6 +++--- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/model/AirLoopHVACExhaustSystem.cpp b/src/model/AirLoopHVACExhaustSystem.cpp index 86a3b271e2..5b52aefbf6 100644 --- a/src/model/AirLoopHVACExhaustSystem.cpp +++ b/src/model/AirLoopHVACExhaustSystem.cpp @@ -47,18 +47,18 @@ namespace model { namespace detail { AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) - : StraightComponent_Impl(idfObject, model, 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) - : StraightComponent_Impl(other, model, 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) - : StraightComponent_Impl(other, model, keepHandle) {} + : HVACComponent_Impl(other, model, keepHandle) {} const std::vector& AirLoopHVACExhaustSystem_Impl::outputVariableNames() const { static std::vector result; @@ -106,7 +106,7 @@ namespace model { } // namespace detail - AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(const Model& model) : StraightComponent(AirLoopHVACExhaustSystem::iddObjectType(), model) { + AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(const Model& model) : HVACComponent(AirLoopHVACExhaustSystem::iddObjectType(), model) { OS_ASSERT(getImpl()); bool ok = true; @@ -130,8 +130,7 @@ namespace model { } /// @cond - AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(std::shared_ptr impl) - : StraightComponent(std::move(impl)) {} + AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(std::shared_ptr impl) : HVACComponent(std::move(impl)) {} /// @endcond } // namespace model diff --git a/src/model/AirLoopHVACExhaustSystem.hpp b/src/model/AirLoopHVACExhaustSystem.hpp index 4c39c2ba69..8f43021e19 100644 --- a/src/model/AirLoopHVACExhaustSystem.hpp +++ b/src/model/AirLoopHVACExhaustSystem.hpp @@ -31,7 +31,7 @@ #define MODEL_AIRLOOPHVACEXHAUSTSYSTEM_HPP #include -#include "StraightComponent.hpp" +#include "HVACComponent.hpp" namespace openstudio { namespace model { @@ -44,8 +44,8 @@ namespace model { } // namespace detail - /** AirLoopHVACExhaustSystem is a StraightComponent that wraps the OpenStudio IDD object 'OS:AirLoopHVAC:ExhaustSystem'. */ - class MODEL_API AirLoopHVACExhaustSystem : public StraightComponent + /** AirLoopHVACExhaustSystem is a HVACComponent that wraps the OpenStudio IDD object 'OS:AirLoopHVAC:ExhaustSystem'. */ + class MODEL_API AirLoopHVACExhaustSystem : public HVACComponent { public: /** @name Constructors and Destructors */ diff --git a/src/model/AirLoopHVACExhaustSystem_Impl.hpp b/src/model/AirLoopHVACExhaustSystem_Impl.hpp index 0a1dbfdeea..f9f92401ce 100644 --- a/src/model/AirLoopHVACExhaustSystem_Impl.hpp +++ b/src/model/AirLoopHVACExhaustSystem_Impl.hpp @@ -31,7 +31,7 @@ #define MODEL_AIRLOOPHVACEXHAUSTSYSTEM_IMPL_HPP #include -#include "StraightComponent_Impl.hpp" +#include "HVACComponent_Impl.hpp" namespace openstudio { namespace model { @@ -40,8 +40,8 @@ namespace model { namespace detail { - /** AirLoopHVACExhaustSystem_Impl is a StraightComponent_Impl that is the implementation class for AirLoopHVACExhaustSystem.*/ - class MODEL_API AirLoopHVACExhaustSystem_Impl : public StraightComponent_Impl + /** 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 */ From 25c1bde0918df53ec9c1c17952ce6941f86ca497 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Thu, 16 Jan 2025 15:29:40 -0700 Subject: [PATCH 12/17] Typo. --- src/model/ZoneHVACExhaustControl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/model/ZoneHVACExhaustControl.cpp b/src/model/ZoneHVACExhaustControl.cpp index b79ea2628e..e62f13266f 100644 --- a/src/model/ZoneHVACExhaustControl.cpp +++ b/src/model/ZoneHVACExhaustControl.cpp @@ -282,7 +282,7 @@ namespace model { void ZoneHVACExhaustControl_Impl::applySizingValues() { if (boost::optional val_ = autosizedDesignExhaustFlowRate()) { - setDesignExhaustFlowRate(*val_)); + setDesignExhaustFlowRate(*val_); } } From ea8aa9ac54835a7011b6a668b9ca216925401b49 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Fri, 17 Jan 2025 09:49:13 -0700 Subject: [PATCH 13/17] Clean up for build. --- src/energyplus/CMakeLists.txt | 4 ++ src/energyplus/ForwardTranslator.cpp | 2 +- .../Test/AirLoopHVACExhaustSystem_GTest.cpp | 22 +++------ .../Test/ZoneHVACExhaustControl_GTest.cpp | 47 +++++------------- src/model/AirLoopHVACExhaustSystem.cpp | 9 ++-- src/model/ZoneHVACExhaustControl.cpp | 9 ++-- .../test/AirLoopHVACExhaustSystem_GTest.cpp | 24 ++------- .../test/ZoneHVACExhaustControl_GTest.cpp | 49 ++++--------------- 8 files changed, 46 insertions(+), 120 deletions(-) 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 59d751db0f..95cf8b0ecb 100644 --- a/src/energyplus/ForwardTranslator.cpp +++ b/src/energyplus/ForwardTranslator.cpp @@ -696,7 +696,7 @@ namespace energyplus { retVal = translateAirLoopHVAC(airLoopHVAC); break; } - case openstudio::IddObjectType::OS_AirLoop_ExhaustSystem: { + case openstudio::IddObjectType::OS_AirLoopHVAC_ExhaustSystem: { auto airLoopHVACExhaustSystem = modelObject.cast(); retVal = translateAirLoopHVACExhaustSystem(airLoopHVACExhaustSystem); break; diff --git a/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp b/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp index 8d59a183d6..1466de811a 100644 --- a/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp +++ b/src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp @@ -31,15 +31,11 @@ #include "EnergyPlusFixture.hpp" #include "../ForwardTranslator.hpp" -#include "../ReverseTranslator.hpp" #include "../../model/AirLoopHVACExhaustSystem.hpp" #include "../../model/AirLoopHVACExhaustSystem_Impl.hpp" -// TODO: Check the following class names against object getters and setters. -#include "../../model/ZoneMixers.hpp" -#include "../../model/ZoneMixers_Impl.hpp" -#include "../../model/FansSystemModel.hpp" -#include "../../model/FansSystemModel_Impl.hpp" +#include "../../model/FanSystemModel.hpp" +#include "../../model/FanSystemModel_Impl.hpp" #include "../../utilities/idf/Workspace.hpp" #include "../../utilities/idf/IdfObject.hpp" @@ -48,6 +44,7 @@ #include #include #include + using namespace openstudio::energyplus; using namespace openstudio::model; using namespace openstudio; @@ -57,26 +54,19 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_AirLoopHVACExhaustSystem) { ForwardTranslator ft; Model m; - // TODO: Check regular Ctor arguments + AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m); - // TODO: Or if a UniqueModelObject (and make sure _Impl is included) - // AirLoopHVACExhaustSystem airLoopHVACExhaustSystem = m.getUniqueModelObject(); airLoopHVACExhaustSystem.setName("My AirLoopHVACExhaustSystem"); - ZoneMixers zoneMixer(m); - EXPECT_TRUE(airLoopHVACExhaustSystem.setZoneMixer(zoneMixer)); - EXPECT_TRUE(airLoopHVACExhaustSystem.setFanObjectType("Fan:SystemModel")); - FansSystemModel fan(m); + FanSystemModel fan(m); EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan)); - // TODO: you're responsible for creating all other objects needed so this object actually gets ForwardTranslated - 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(zoneMixer.nameString(), idfObject.getString(AirLoopHVAC_ExhaustSystemFields::ZoneMixerName).get()); + 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 index 15a0476a58..679ff6eb13 100644 --- a/src/energyplus/Test/ZoneHVACExhaustControl_GTest.cpp +++ b/src/energyplus/Test/ZoneHVACExhaustControl_GTest.cpp @@ -31,23 +31,13 @@ #include "EnergyPlusFixture.hpp" #include "../ForwardTranslator.hpp" -#include "../ReverseTranslator.hpp" #include "../../model/ZoneHVACExhaustControl.hpp" #include "../../model/ZoneHVACExhaustControl_Impl.hpp" -// TODO: Check the following class names against object getters and setters. -#include "../../model/Schedule.hpp" -#include "../../model/Schedule_Impl.hpp" -#include "../../model/Zone.hpp" -#include "../../model/Zone_Impl.hpp" -#include "../../model/Schedule.hpp" -#include "../../model/Schedule_Impl.hpp" -#include "../../model/Schedule.hpp" -#include "../../model/Schedule_Impl.hpp" -#include "../../model/Schedule.hpp" -#include "../../model/Schedule_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" @@ -56,6 +46,7 @@ #include #include #include + using namespace openstudio::energyplus; using namespace openstudio::model; using namespace openstudio; @@ -65,37 +56,23 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_ZoneHVACExhaustControl) { ForwardTranslator ft; Model m; - // TODO: Check regular Ctor arguments + ZoneHVACExhaustControl zoneHVACExhaustControl(m); - // TODO: Or if a UniqueModelObject (and make sure _Impl is included) - // ZoneHVACExhaustControl zoneHVACExhaustControl = m.getUniqueModelObject(); zoneHVACExhaustControl.setName("My ZoneHVACExhaustControl"); - boost::optional availabilitySchedule(m); + Schedule availabilitySchedule = m.alwaysOnDiscreteSchedule(); EXPECT_TRUE(zoneHVACExhaustControl.setAvailabilitySchedule(availabilitySchedule)); - Zone zone(m); - EXPECT_TRUE(zoneHVACExhaustControl.setZone(zone)); - Node inletNodeName(m); - EXPECT_TRUE(zoneHVACExhaustControl.setInletNodeName(inletNodeName)); - Node outletNodeName(m); - EXPECT_TRUE(zoneHVACExhaustControl.setOutletNodeName(outletNodeName)); - // Autosize - // zoneHVACExhaustControl.autosizeDesignExhaustFlowRate(); EXPECT_TRUE(zoneHVACExhaustControl.setDesignExhaustFlowRate(0.6)); EXPECT_TRUE(zoneHVACExhaustControl.setFlowControlType("Scheduled")); - boost::optional exhaustFlowFractionSchedule(m); + ScheduleConstant exhaustFlowFractionSchedule(m); EXPECT_TRUE(zoneHVACExhaustControl.setExhaustFlowFractionSchedule(exhaustFlowFractionSchedule)); - Node supplyNodeorNodeListName(m); - EXPECT_TRUE(zoneHVACExhaustControl.setSupplyNodeorNodeListName(supplyNodeorNodeListName)); - boost::optional minimumZoneTemperatureLimitSchedule(m); + ScheduleConstant minimumZoneTemperatureLimitSchedule(m); EXPECT_TRUE(zoneHVACExhaustControl.setMinimumZoneTemperatureLimitSchedule(minimumZoneTemperatureLimitSchedule)); - boost::optional minimumExhaustFlowFractionSchedule(m); + ScheduleConstant minimumExhaustFlowFractionSchedule(m); EXPECT_TRUE(zoneHVACExhaustControl.setMinimumExhaustFlowFractionSchedule(minimumExhaustFlowFractionSchedule)); - boost::optional balancedExhaustFractionSchedule(m); + ScheduleConstant balancedExhaustFractionSchedule(m); EXPECT_TRUE(zoneHVACExhaustControl.setBalancedExhaustFractionSchedule(balancedExhaustFractionSchedule)); - // TODO: you're responsible for creating all other objects needed so this object actually gets ForwardTranslated - const Workspace w = ft.translateModel(m); const auto idfObjs = w.getObjectsByType(IddObjectType::ZoneHVAC_ExhaustControl); ASSERT_EQ(1u, idfObjs.size()); @@ -105,8 +82,10 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_ZoneHVACExhaustControl) { EXPECT_EQ(zone.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::ZoneName).get()); EXPECT_EQ(inletNodeName.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::InletNodeName).get()); EXPECT_EQ(outletNodeName.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::OutletNodeName).get()); - // EXPECT_EQ("Autosize", idfObject.getString(ZoneHVAC_ExhaustControlFields::DesignExhaustFlowRate).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(supplyNodeorNodeListName.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::SupplyNodeorNodeListName).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(), diff --git a/src/model/AirLoopHVACExhaustSystem.cpp b/src/model/AirLoopHVACExhaustSystem.cpp index 5b52aefbf6..fcf6629934 100644 --- a/src/model/AirLoopHVACExhaustSystem.cpp +++ b/src/model/AirLoopHVACExhaustSystem.cpp @@ -34,6 +34,8 @@ #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" @@ -90,7 +92,7 @@ namespace model { HVACComponent AirLoopHVACExhaustSystem_Impl::fan() const { boost::optional value = optionalFan(); if (!value) { - LOG_AND_THROW(briefDescription() << " does not have an Fan attached."); + LOG_AND_THROW(briefDescription() << " does not have a Fan attached."); } return value.get(); } @@ -110,10 +112,9 @@ namespace model { OS_ASSERT(getImpl()); bool ok = true; - // ok = setZoneMixer(); - OS_ASSERT(ok); - // ok = setFan(); + FanSystemModel fan(model); + ok = setFan(fan); OS_ASSERT(ok); } diff --git a/src/model/ZoneHVACExhaustControl.cpp b/src/model/ZoneHVACExhaustControl.cpp index e62f13266f..d1686a7053 100644 --- a/src/model/ZoneHVACExhaustControl.cpp +++ b/src/model/ZoneHVACExhaustControl.cpp @@ -296,17 +296,14 @@ namespace model { OS_ASSERT(getImpl()); bool ok = true; + auto alwaysOn = model.alwaysOnDiscreteSchedule(); ok = setAvailabilitySchedule(alwaysOn); OS_ASSERT(ok); - // ok = setThermalZone(); - OS_ASSERT(ok); - - // ok = setDesignExhaustFlowRate(); - OS_ASSERT(ok); + autosizeDesignExhaustFlowRate(); - // ok = setFlowControlType(); + ok = setFlowControlType("Scheduled"); OS_ASSERT(ok); } diff --git a/src/model/test/AirLoopHVACExhaustSystem_GTest.cpp b/src/model/test/AirLoopHVACExhaustSystem_GTest.cpp index 6acb3ffa74..a913ed302c 100644 --- a/src/model/test/AirLoopHVACExhaustSystem_GTest.cpp +++ b/src/model/test/AirLoopHVACExhaustSystem_GTest.cpp @@ -31,42 +31,28 @@ #include "../AirLoopHVACExhaustSystem.hpp" #include "../AirLoopHVACExhaustSystem_Impl.hpp" - -// TODO: Check the following class names against object getters and setters. -#include "../ZoneMixers.hpp" -#include "../ZoneMixers_Impl.hpp" - -#include "../FansSystemModel.hpp" -#include "../FansSystemModel_Impl.hpp" +#include "../FanSystemModel.hpp" +#include "../FanSystemModel_Impl.hpp" using namespace openstudio; using namespace openstudio::model; TEST_F(ModelFixture, AirLoopHVACExhaustSystem_GettersSetters) { Model m; - // TODO: Check regular Ctor arguments + AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m); - // TODO: Or if a UniqueModelObject (and make sure _Impl is included) - // AirLoopHVACExhaustSystem airLoopHVACExhaustSystem = m.getUniqueModelObject(); airLoopHVACExhaustSystem.setName("My AirLoopHVACExhaustSystem"); - // Zone Mixer Name: Required Object - ZoneMixers zoneMixer(m); - EXPECT_TRUE(airLoopHVACExhaustSystem.setZoneMixer(zoneMixer)); - EXPECT_EQ(zoneMixer, airLoopHVACExhaustSystem.zoneMixer()); - // Fan Name: Required Object - FansSystemModel fan(m); + FanSystemModel fan(m); EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan)); EXPECT_EQ(fan, airLoopHVACExhaustSystem.fan()); } TEST_F(ModelFixture, AirLoopHVACExhaustSystem_HeatCoolFuelTypes) { Model m; - // TODO: Check regular Ctor arguments + AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m); - // TODO: Or if a UniqueModelObject (and make sure _Impl is included) - // AirLoopHVACExhaustSystem airLoopHVACExhaustSystem = m.getUniqueModelObject(); EXPECT_EQ(ComponentType(ComponentType::Both), airLoopHVACExhaustSystem.componentType()); testFuelTypeEquality({FuelType::Electricity}, airLoopHVACExhaustSystem.coolingFuelTypes()); diff --git a/src/model/test/ZoneHVACExhaustControl_GTest.cpp b/src/model/test/ZoneHVACExhaustControl_GTest.cpp index 4f22f2e8b3..07e11da5be 100644 --- a/src/model/test/ZoneHVACExhaustControl_GTest.cpp +++ b/src/model/test/ZoneHVACExhaustControl_GTest.cpp @@ -31,49 +31,26 @@ #include "../ZoneHVACExhaustControl.hpp" #include "../ZoneHVACExhaustControl_Impl.hpp" - -// TODO: Check the following class names against object getters and setters. #include "../Schedule.hpp" #include "../Schedule_Impl.hpp" - -#include "../ThermalZone.hpp" -#include "../ThermalZone_Impl.hpp" - -#include "../Connection.hpp" -#include "../Connection_Impl.hpp" +#include "../ScheduleConstant.hpp" +#include "../ScheduleConstant_Impl.hpp" using namespace openstudio; using namespace openstudio::model; TEST_F(ModelFixture, ZoneHVACExhaustControl_GettersSetters) { Model m; - // TODO: Check regular Ctor arguments + ZoneHVACExhaustControl zoneHVACExhaustControl(m); - // TODO: Or if a UniqueModelObject (and make sure _Impl is included) - // ZoneHVACExhaustControl zoneHVACExhaustControl = m.getUniqueModelObject(); zoneHVACExhaustControl.setName("My ZoneHVACExhaustControl"); // Availability Schedule Name: Required Object - Schedule availabilitySchedule(m); + Schedule availabilitySchedule = m.alwaysOnDiscreteSchedule(); EXPECT_TRUE(zoneHVACExhaustControl.setAvailabilitySchedule(availabilitySchedule)); EXPECT_EQ(availabilitySchedule, zoneHVACExhaustControl.availabilitySchedule()); - // Zone Name: Required Object - ThermalZone zone(m); - EXPECT_TRUE(zoneHVACExhaustControl.setZone(zone)); - EXPECT_EQ(zone, zoneHVACExhaustControl.zone()); - - // Inlet Node Name: Required Object - Connection inletNode(m); - EXPECT_TRUE(zoneHVACExhaustControl.setInletNode(inletNode)); - EXPECT_EQ(inletNode, zoneHVACExhaustControl.inletNode()); - - // Outlet Node Name: Required Object - Connection outletNode(m); - EXPECT_TRUE(zoneHVACExhaustControl.setOutletNode(outletNode)); - EXPECT_EQ(outletNode, zoneHVACExhaustControl.outletNode()); - // Design Exhaust Flow Rate: Required Double // Autosize zoneHVACExhaustControl.autosizeDesignExhaustFlowRate(); @@ -96,41 +73,33 @@ TEST_F(ModelFixture, ZoneHVACExhaustControl_GettersSetters) { EXPECT_EQ("Scheduled", zoneHVACExhaustControl.flowControlType()); // Exhaust Flow Fraction Schedule Name: Optional Object - boost::optional exhaustFlowFractionSchedule(m); + ScheduleConstant exhaustFlowFractionSchedule(m); EXPECT_TRUE(zoneHVACExhaustControl.setExhaustFlowFractionSchedule(exhaustFlowFractionSchedule)); ASSERT_TRUE(zoneHVACExhaustControl.exhaustFlowFractionSchedule()); EXPECT_EQ(exhaustFlowFractionSchedule, zoneHVACExhaustControl.exhaustFlowFractionSchedule().get()); - // Supply Node or NodeList Name: Optional Object - boost::optional supplyNodeorNodeList(m); - EXPECT_TRUE(zoneHVACExhaustControl.setSupplyNodeorNodeList(supplyNodeorNodeList)); - ASSERT_TRUE(zoneHVACExhaustControl.supplyNodeorNodeList()); - EXPECT_EQ(supplyNodeorNodeList, zoneHVACExhaustControl.supplyNodeorNodeList().get()); - // Minimum Zone Temperature Limit Schedule Name: Optional Object - boost::optional minimumZoneTemperatureLimitSchedule(m); + 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 - boost::optional minimumExhaustFlowFractionSchedule(m); + 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 - boost::optional balancedExhaustFractionSchedule(m); + 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; - // TODO: Check regular Ctor arguments + ZoneHVACExhaustControl zoneHVACExhaustControl(m); - // TODO: Or if a UniqueModelObject (and make sure _Impl is included) - // ZoneHVACExhaustControl zoneHVACExhaustControl = m.getUniqueModelObject(); EXPECT_EQ(ComponentType(ComponentType::Both), zoneHVACExhaustControl.componentType()); testFuelTypeEquality({FuelType::Electricity}, zoneHVACExhaustControl.coolingFuelTypes()); From 388a25c1f5fd824cf4612bbeef89327d6a23fa52 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Fri, 17 Jan 2025 10:02:42 -0700 Subject: [PATCH 14/17] Fix fan in ft. --- .../ForwardTranslateAirLoopHVACExhaustSystem.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp index 2f9b664cf1..abc92f6224 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACExhaustSystem.cpp @@ -49,12 +49,10 @@ namespace energyplus { IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::AirLoopHVAC_ExhaustSystem, modelObject); // Fan Object Type: Required String - const std::string fanObjectType = modelObject.fanObjectType(); - idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanObjectType, fanObjectType); - // 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()); } From e4962be537f03789948351bac210d6fb88b48376 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Fri, 17 Jan 2025 10:38:32 -0700 Subject: [PATCH 15/17] FT zone similar to zonehvaclowlowtempradiantvarflow. --- .../ForwardTranslateZoneHVACExhaustControl.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp index 7a8a0f7118..812789d4f6 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp @@ -59,9 +59,13 @@ namespace energyplus { } // Zone Name: Required Object - ThermalZone thermalZone = modelObject.thermalZone(); - if (boost::optional wo_ = translateAndMapModelObject(thermalZone)) { - idfObject.setString(ZoneHVAC_ExhaustControlFields::ZoneName, wo_->nameString()); + boost::optional thermalZoneName; + if (boost::optional zone = modelObject.thermalZone()) { + if ((s = zone->name())) { + thermalZoneName = s; + + idfObject.setString(ZoneHVAC_ExhaustControlFields::ZoneName, thermalZoneName.get()); + } } // InletNodeName From 1a60a041b42b57c36391998c7fed41e200adc123 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Fri, 17 Jan 2025 11:31:57 -0700 Subject: [PATCH 16/17] Fix FT. --- .../ForwardTranslateZoneHVACExhaustControl.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp index 812789d4f6..6a84de45fd 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp @@ -59,11 +59,8 @@ namespace energyplus { } // Zone Name: Required Object - boost::optional thermalZoneName; if (boost::optional zone = modelObject.thermalZone()) { - if ((s = zone->name())) { - thermalZoneName = s; - + if ((boost::optional thermalZoneName = zone->name())) { idfObject.setString(ZoneHVAC_ExhaustControlFields::ZoneName, thermalZoneName.get()); } } From 577276d832e69eb0055896a279555b388f80eb5e Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Tue, 21 Jan 2025 11:32:22 -0700 Subject: [PATCH 17/17] Typos. --- .../ForwardTranslateZoneHVACExhaustControl.cpp | 2 +- src/energyplus/Test/ZoneHVACExhaustControl_GTest.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp index 6a84de45fd..4f353c5397 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACExhaustControl.cpp @@ -60,7 +60,7 @@ namespace energyplus { // Zone Name: Required Object if (boost::optional zone = modelObject.thermalZone()) { - if ((boost::optional thermalZoneName = zone->name())) { + if (boost::optional thermalZoneName = zone->name()) { idfObject.setString(ZoneHVAC_ExhaustControlFields::ZoneName, thermalZoneName.get()); } } diff --git a/src/energyplus/Test/ZoneHVACExhaustControl_GTest.cpp b/src/energyplus/Test/ZoneHVACExhaustControl_GTest.cpp index 679ff6eb13..39c40479fb 100644 --- a/src/energyplus/Test/ZoneHVACExhaustControl_GTest.cpp +++ b/src/energyplus/Test/ZoneHVACExhaustControl_GTest.cpp @@ -79,9 +79,9 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_ZoneHVACExhaustControl) { const auto& idfObject = idfObjs.front(); EXPECT_EQ(availabilitySchedule.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::AvailabilityScheduleName).get()); - EXPECT_EQ(zone.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::ZoneName).get()); - EXPECT_EQ(inletNodeName.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::InletNodeName).get()); - EXPECT_EQ(outletNodeName.nameString(), idfObject.getString(ZoneHVAC_ExhaustControlFields::OutletNodeName).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());