diff --git a/resources/model/OpenStudio.idd b/resources/model/OpenStudio.idd index 460614fae1..c44237a3db 100644 --- a/resources/model/OpenStudio.idd +++ b/resources/model/OpenStudio.idd @@ -31186,7 +31186,7 @@ OS:ZoneHVAC:CoolingPanel:RadiantConvective:Water, OS:ZoneHVAC:EvaporativeCoolerUnit, \memo Zone evaporative cooler. Forced-convection cooling-only unit with supply fan, \memo 100% outdoor air supply. Optional relief exhaust node - \min-fields 16 + \min-fields 17 A1, \field Handle \type handle \required-field @@ -31254,7 +31254,7 @@ OS:ZoneHVAC:EvaporativeCoolerUnit, \required-field \type object-list \object-list EvapCoolerNames - A12, \field Second Evaporative Cooler Name + A12, \field Second Evaporative Cooler \note optional, used for direct/indirect configurations \type object-list \object-list EvapCoolerNames diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACEvaporativeCoolerUnit.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACEvaporativeCoolerUnit.cpp index cf9c44a8a3..970f107edb 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACEvaporativeCoolerUnit.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACEvaporativeCoolerUnit.cpp @@ -29,29 +29,21 @@ #include "../ForwardTranslator.hpp" #include "../../model/Model.hpp" - #include "../../model/ZoneHVACEvaporativeCoolerUnit.hpp" - -// TODO: Check the following class names against object getters and setters. +#include "../../model/ZoneHVACEvaporativeCoolerUnit_Impl.hpp" #include "../../model/Schedule.hpp" #include "../../model/Schedule_Impl.hpp" - -#include "../../model/SystemAvailabilityManagerLists.hpp" -#include "../../model/SystemAvailabilityManagerLists_Impl.hpp" - #include "../../model/Node.hpp" #include "../../model/Node_Impl.hpp" -#include "../../model/Fans.hpp" -#include "../../model/Fans_Impl.hpp" - -#include "../../model/EvapCooler.hpp" -#include "../../model/EvapCooler_Impl.hpp" - -#include "../../model/DesignSpecificationZoneHVACSizingName.hpp" -#include "../../model/DesignSpecificationZoneHVACSizingName_Impl.hpp" - #include +#include +#include +#include +#include +#include +#include +#include #include using namespace openstudio::model; @@ -72,39 +64,31 @@ namespace energyplus { } } - // Availability Manager List Name: Optional Object - if (boost::optional availabilityManagerList_ = modelObject.availabilityManagerList()) { - if (boost::optional wo_ = translateAndMapModelObject(availabilityManagerList_.get())) { - idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::AvailabilityManagerListName, wo_->nameString()); - } - } + boost::optional outdoorAirInletNodeName; + boost::optional coolerOutletNodeName; // Outdoor Air Inlet Node Name: Required Node - Node outdoorAirInletNodeName = modelObject.inletNode(); - if (boost::optional wo_ = translateAndMapModelObject(outdoorAirInletNodeName)) { - idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::OutdoorAirInletNodeName, wo_->nameString()); + if (boost::optional node = modelObject.inletNode()) { + outdoorAirInletNodeName = node->name().get(); + idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::OutdoorAirInletNodeName, node->name().get()); } // Cooler Outlet Node Name: Required Node - Node coolerOutletNodeName = modelObject.outletNode(); - if (boost::optional wo_ = translateAndMapModelObject(coolerOutletNodeName)) { - idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::CoolerOutletNodeName, wo_->nameString()); - } - - // Zone Relief Air Node Name: Optional Node - Node zoneReliefAirNodeName = modelObject.zoneReliefAirNodeName(); - if (boost::optional wo_ = translateAndMapModelObject(zoneReliefAirNodeName)) { - idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::ZoneReliefAirNodeName, wo_->nameString()); + if (boost::optional node = modelObject.outletNode()) { + coolerOutletNodeName = node->name().get(); + idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::CoolerOutletNodeName, node->name().get()); } - // Supply Air Fan Object Type: Required String - const std::string supplyAirFanObjectType = modelObject.supplyAirFanObjectType(); - idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::SupplyAirFanObjectType, supplyAirFanObjectType); + // Supply Air Fan Object Type + // Supply Air Fan Name + boost::optional fan_; + if (boost::optional supplyAirFan = modelObject.supplyAirFan()) { + fan_ = translateAndMapModelObject(supplyAirFan.get()); - // Supply Air Fan Name: Required Object - Fans supplyAirFan = modelObject.supplyAirFan(); - if (boost::optional wo_ = translateAndMapModelObject(supplyAirFan)) { - idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::SupplyAirFanName, wo_->nameString()); + if (fan_ && fan_->name()) { + idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::SupplyAirFanObjectType, fan_->iddObject().name()); + idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::SupplyAirFanName, fan_->name().get()); + } } if (modelObject.isDesignSupplyAirFlowRateAutosized()) { @@ -134,32 +118,120 @@ namespace energyplus { coolingLoadControlThresholdHeatTransferRate); // First Evaporative Cooler Object Type: Required String - const std::string firstEvaporativeCoolerObjectType = modelObject.firstEvaporativeCoolerObjectType(); - idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::FirstEvaporativeCoolerObjectType, firstEvaporativeCoolerObjectType); - // First Evaporative Cooler Object Name: Required Object - EvapCooler firstEvaporativeCoolerObject = modelObject.firstEvaporativeCoolerObject(); - if (boost::optional wo_ = translateAndMapModelObject(firstEvaporativeCoolerObject)) { - idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::FirstEvaporativeCoolerObjectName, wo_->nameString()); + HVACComponent firstEvaporativeCooler = modelObject.firstEvaporativeCooler(); + boost::optional firstEvaporativeCooler_ = translateAndMapModelObject(firstEvaporativeCooler); + if (firstEvaporativeCooler_) { + idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::FirstEvaporativeCoolerObjectType, firstEvaporativeCooler_->iddObject().name()); + idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::FirstEvaporativeCoolerObjectName, firstEvaporativeCooler_->nameString()); } // Second Evaporative Cooler Object Type: boost::optional - if (boost::optional secondEvaporativeCoolerObjectType_ = modelObject.secondEvaporativeCoolerObjectType()) { - idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::SecondEvaporativeCoolerObjectType, secondEvaporativeCoolerObjectType_.get()); + // Second Evaporative Cooler Name: Optional Object + boost::optional _secondEvaporativeCooler = modelObject.secondEvaporativeCooler(); + boost::optional secondEvaporativeCooler_; + if (_secondEvaporativeCooler) { + secondEvaporativeCooler_ = translateAndMapModelObject(_secondEvaporativeCooler.get()); + if (secondEvaporativeCooler_) { + idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::SecondEvaporativeCoolerObjectType, secondEvaporativeCooler_->iddObject().name()); + idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::SecondEvaporativeCoolerName, secondEvaporativeCooler_->nameString()); + } } - // Second Evaporative Cooler Name: Optional Object - if (boost::optional secondEvaporativeCooler_ = modelObject.secondEvaporativeCooler()) { - if (boost::optional wo_ = translateAndMapModelObject(secondEvaporativeCooler_.get())) { - idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::SecondEvaporativeCoolerName, wo_->nameString()); + // If BlowThrough: o---- Fan ---- E1 ---- E2 ----o + // If DrawThrough: o---- E1 ---- E2 ---- Fan ----o + std::string baseName = modelObject.name().get(); + if (fan_) { + std::string outletNodeName; + std::string inletNodeName = outdoorAirInletNodeName.get(); + if (istringEqual(fanPlacement, "BlowThrough")) { + if (firstEvaporativeCooler_) { + outletNodeName = baseName + " Fan - First Evaporative Cooler Node"; + } else if (secondEvaporativeCooler_) { + outletNodeName = baseName + " Fan - Second Evaporative Cooler Node"; + } else { + outletNodeName = coolerOutletNodeName.get(); + } + } else { + if (secondEvaporativeCooler_) { + inletNodeName = baseName + " Second Evaporative Cooler - Fan Node"; + } else { + inletNodeName = baseName + " First Evaporative Cooler - Fan Node"; + } + outletNodeName = coolerOutletNodeName.get(); + } + + if (fan_->iddObject().type() == IddObjectType::Fan_ConstantVolume) { + fan_->setString(Fan_ConstantVolumeFields::AirInletNodeName, inletNodeName); + fan_->setString(Fan_ConstantVolumeFields::AirOutletNodeName, outletNodeName); + } else if (fan_->iddObject().type() == IddObjectType::Fan_VariableVolume) { + fan_->setString(Fan_VariableVolumeFields::AirInletNodeName, inletNodeName); + fan_->setString(Fan_VariableVolumeFields::AirOutletNodeName, outletNodeName); + } else if (fan_->iddObject().type() == IddObjectType::Fan_OnOff) { + fan_->setString(Fan_OnOffFields::AirInletNodeName, inletNodeName); + fan_->setString(Fan_OnOffFields::AirOutletNodeName, outletNodeName); + } else if (fan_->iddObject().type() == IddObjectType::Fan_SystemModel) { + fan_->setString(Fan_SystemModelFields::AirInletNodeName, inletNodeName); + fan_->setString(Fan_SystemModelFields::AirOutletNodeName, outletNodeName); + } else if (fan_->iddObject().type() == IddObjectType::Fan_ComponentModel) { + fan_->setString(Fan_ComponentModelFields::AirInletNodeName, inletNodeName); + fan_->setString(Fan_ComponentModelFields::AirOutletNodeName, outletNodeName); + } + } + + if (firstEvaporativeCooler_) { + std::string outletNodeName; + std::string inletNodeName; + if (istringEqual(fanPlacement, "BlowThrough") && fan_) { + inletNodeName = baseName + " Fan - First Evaporative Cooler Node"; + } else { + inletNodeName = outdoorAirInletNodeName.get(); + } + + if (secondEvaporativeCooler_) { + outletNodeName = baseName + " First Evaporative Cooler - Second Evaporative Cooler Node"; + } else if (istringEqual(fanPlacement, "BlowThrough")) { + outletNodeName = coolerOutletNodeName.get(); + } else { + outletNodeName = baseName + " First Evaporative Cooler - Fan Node"; + } + + if (firstEvaporativeCooler_->iddObject().type() == IddObjectType::EvaporativeCooler_Direct_ResearchSpecial) { + firstEvaporativeCooler_->setString(EvaporativeCooler_Direct_ResearchSpecialFields::AirInletNodeName, inletNodeName); + firstEvaporativeCooler_->setString(EvaporativeCooler_Direct_ResearchSpecialFields::AirOutletNodeName, outletNodeName); + } else if (firstEvaporativeCooler.iddObject().type() == IddObjectType::EvaporativeCooler_Indirect_ResearchSpecial) { + firstEvaporativeCooler_->setString(EvaporativeCooler_Indirect_ResearchSpecialFields::PrimaryAirInletNodeName, inletNodeName); + firstEvaporativeCooler_->setString(EvaporativeCooler_Indirect_ResearchSpecialFields::PrimaryAirOutletNodeName, outletNodeName); + } else { + LOG(Warn, modelObject.briefDescription() << ": Contains an unsupported type " << firstEvaporativeCooler_->iddObject().type() << "."); } } - // Design Specification ZoneHVAC Sizing Object Name: Optional Object - if (boost::optional designSpecificationZoneHVACSizingObject_ = - modelObject.designSpecificationZoneHVACSizingObject()) { - if (boost::optional wo_ = translateAndMapModelObject(designSpecificationZoneHVACSizingObject_.get())) { - idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::DesignSpecificationZoneHVACSizingObjectName, wo_->nameString()); + if (secondEvaporativeCooler_) { + std::string outletNodeName; + std::string inletNodeName; + if (firstEvaporativeCooler_) { + inletNodeName = baseName + " First Evaporative Cooler - Second Evaporative Cooler Node"; + } else if (istringEqual(fanPlacement, "BlowThrough") && fan_) { + inletNodeName = baseName + " Fan - Second Evaporative Cooler Node"; + } else { + inletNodeName = outdoorAirInletNodeName.get(); + } + + if (fan_) { + outletNodeName = baseName + " Second Evaporative Cooler - Fan Node"; + } else { + outletNodeName = outdoorAirInletNodeName.get(); + } + + if (secondEvaporativeCooler_->iddObject().type() == IddObjectType::EvaporativeCooler_Direct_ResearchSpecial) { + secondEvaporativeCooler_->setString(EvaporativeCooler_Direct_ResearchSpecialFields::AirInletNodeName, inletNodeName); + secondEvaporativeCooler_->setString(EvaporativeCooler_Direct_ResearchSpecialFields::AirOutletNodeName, outletNodeName); + } else if (firstEvaporativeCooler.iddObject().type() == IddObjectType::EvaporativeCooler_Indirect_ResearchSpecial) { + secondEvaporativeCooler_->setString(EvaporativeCooler_Indirect_ResearchSpecialFields::PrimaryAirInletNodeName, inletNodeName); + secondEvaporativeCooler_->setString(EvaporativeCooler_Indirect_ResearchSpecialFields::PrimaryAirOutletNodeName, outletNodeName); + } else { + LOG(Warn, modelObject.briefDescription() << ": Contains an unsupported type " << secondEvaporativeCooler_->iddObject().type() << "."); } } diff --git a/src/energyplus/Test/ZoneHVACEvaporativeCoolerUnit_GTest.cpp b/src/energyplus/Test/ZoneHVACEvaporativeCoolerUnit_GTest.cpp index 84ef665c88..bc2403f886 100644 --- a/src/energyplus/Test/ZoneHVACEvaporativeCoolerUnit_GTest.cpp +++ b/src/energyplus/Test/ZoneHVACEvaporativeCoolerUnit_GTest.cpp @@ -31,23 +31,19 @@ #include "EnergyPlusFixture.hpp" #include "../ForwardTranslator.hpp" -#include "../ReverseTranslator.hpp" #include "../../model/ZoneHVACEvaporativeCoolerUnit.hpp" #include "../../model/ZoneHVACEvaporativeCoolerUnit_Impl.hpp" -// TODO: Check the following class names against object getters and setters. #include "../../model/Schedule.hpp" #include "../../model/Schedule_Impl.hpp" -#include "../../model/SystemAvailabilityManagerLists.hpp" -#include "../../model/SystemAvailabilityManagerLists_Impl.hpp" -#include "../../model/Fans.hpp" -#include "../../model/Fans_Impl.hpp" -#include "../../model/EvapCooler.hpp" -#include "../../model/EvapCooler_Impl.hpp" -#include "../../model/EvapCooler.hpp" -#include "../../model/EvapCooler_Impl.hpp" -#include "../../model/DesignSpecificationZoneHVACSizingName.hpp" -#include "../../model/DesignSpecificationZoneHVACSizingName_Impl.hpp" +#include "../../model/FanComponentModel.hpp" +#include "../../model/FanComponentModel_Impl.hpp" +#include "../../model/EvaporativeCoolerDirectResearchSpecial.hpp" +#include "../../model/EvaporativeCoolerDirectResearchSpecial_Impl.hpp" +#include "../../model/EvaporativeCoolerIndirectResearchSpecial.hpp" +#include "../../model/EvaporativeCoolerIndirectResearchSpecial_Impl.hpp" +#include "../../model/ThermalZone.hpp" +#include "../../model/Space.hpp" #include "../../utilities/idf/Workspace.hpp" #include "../../utilities/idf/IdfObject.hpp" @@ -56,6 +52,7 @@ #include #include #include + using namespace openstudio::energyplus; using namespace openstudio::model; using namespace openstudio; @@ -65,60 +62,55 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_ZoneHVACEvaporativeCoolerUnit) { ForwardTranslator ft; Model m; - // TODO: Check regular Ctor arguments + ZoneHVACEvaporativeCoolerUnit zoneHVACEvaporativeCoolerUnit(m); - // TODO: Or if a UniqueModelObject (and make sure _Impl is included) - // ZoneHVACEvaporativeCoolerUnit zoneHVACEvaporativeCoolerUnit = m.getUniqueModelObject(); zoneHVACEvaporativeCoolerUnit.setName("My ZoneHVACEvaporativeCoolerUnit"); - boost::optional availabilitySchedule(m); + Schedule availabilitySchedule = m.alwaysOnDiscreteSchedule(); EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setAvailabilitySchedule(availabilitySchedule)); - boost::optional availabilityManagerList(m); - EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setAvailabilityManagerList(availabilityManagerList)); - Node outdoorAirInletNodeName(m); - EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setOutdoorAirInletNodeName(outdoorAirInletNodeName)); - Node coolerOutletNodeName(m); - EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setCoolerOutletNodeName(coolerOutletNodeName)); - Node zoneReliefAirNodeName(m); - EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setZoneReliefAirNodeName(zoneReliefAirNodeName)); - EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setSupplyAirFanObjectType("Fan:SystemModel")); - Fans supplyAirFan(m); + FanComponentModel supplyAirFan(m); EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setSupplyAirFan(supplyAirFan)); - // Autosize - // zoneHVACEvaporativeCoolerUnit.autosizeDesignSupplyAirFlowRate(); EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setDesignSupplyAirFlowRate(0.9)); EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setFanPlacement("BlowThrough")); EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setCoolerUnitControlMethod("ZoneTemperatureDeadbandOnOffCycling")); EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setThrottlingRangeTemperatureDifference(1.2)); EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setCoolingLoadControlThresholdHeatTransferRate(1.3)); - EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setFirstEvaporativeCoolerObjectType("EvaporativeCooler:Direct:CelDekPad")); - EvapCooler firstEvaporativeCoolerObject(m); - EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setFirstEvaporativeCoolerObject(firstEvaporativeCoolerObject)); - EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setSecondEvaporativeCoolerObjectType("EvaporativeCooler:Direct:CelDekPad")); - boost::optional secondEvaporativeCooler(m); + EvaporativeCoolerDirectResearchSpecial firstEvaporativeCooler(m, availabilitySchedule); + EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setFirstEvaporativeCooler(firstEvaporativeCooler)); + EvaporativeCoolerIndirectResearchSpecial secondEvaporativeCooler(m); EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setSecondEvaporativeCooler(secondEvaporativeCooler)); - boost::optional designSpecificationZoneHVACSizingObject(m); - EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setDesignSpecificationZoneHVACSizingObject(designSpecificationZoneHVACSizingObject)); EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setShutOffRelativeHumidity(95.0)); - // TODO: you're responsible for creating all other objects needed so this object actually gets ForwardTranslated + // Need to be in a thermal zone to be translated, with at least one space + ThermalZone z(m); + zoneHVACEvaporativeCoolerUnit.addToThermalZone(z); + Space s(m); + s.setThermalZone(z); const Workspace w = ft.translateModel(m); const auto idfObjs = w.getObjectsByType(IddObjectType::ZoneHVAC_EvaporativeCoolerUnit); ASSERT_EQ(1u, idfObjs.size()); - const auto& idfObject = idfObjs.front(); + + EXPECT_EQ(zoneHVACEvaporativeCoolerUnit.nameString(), idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::Name).get()); EXPECT_EQ(availabilitySchedule.nameString(), idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::AvailabilityScheduleName).get()); - EXPECT_EQ(availabilityManagerList.nameString(), idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::AvailabilityManagerListName).get()); - EXPECT_EQ(outdoorAirInletNodeName.nameString(), idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::OutdoorAirInletNodeName).get()); - EXPECT_EQ(coolerOutletNodeName.nameString(), idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::CoolerOutletNodeName).get()); - EXPECT_EQ(zoneReliefAirNodeName.nameString(), idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::ZoneReliefAirNodeName).get()); - EXPECT_EQ("Fan:SystemModel", idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::SupplyAirFanObjectType).get()); + EXPECT_EQ("", idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::AvailabilityManagerListName).get()); + EXPECT_EQ("", idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::OutdoorAirInletNodeName).get()); + EXPECT_EQ("", idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::CoolerOutletNodeName).get()); + EXPECT_EQ("", idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::ZoneReliefAirNodeName).get()); + EXPECT_EQ("Fan:ComponentModel", idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::SupplyAirFanObjectType).get()); EXPECT_EQ(supplyAirFan.nameString(), idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::SupplyAirFanName).get()); - // EXPECT_EQ("Autosize", idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::DesignSupplyAirFlowRate).get()); EXPECT_EQ(0.9, idfObject.getDouble(ZoneHVAC_EvaporativeCoolerUnitFields::DesignSupplyAirFlowRate).get()); EXPECT_EQ("BlowThrough", idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::FanPlacement).get()); EXPECT_EQ("ZoneTemperatureDeadbandOnOffCycling", idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::CoolerUnitControlMethod).get()); EXPECT_EQ(1.2, idfObject.getDouble(ZoneHVAC_EvaporativeCoolerUnitFields::ThrottlingRangeTemperatureDifference).get()); EXPECT_EQ(1.3, idfObject.getDouble(ZoneHVAC_EvaporativeCoolerUnitFields::CoolingLoadControlThresholdHeatTransferRate).get()); EXPECT_EQ("EvaporativeCooler:Direct:CelDekPad", idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::FirstEvaporativeCoolerObjectType).get()); EXPECT_EQ(firstEvaporativeCoolerObject.nameString(), idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::FirstEvaporativeCoolerObjectName).get()); - EXPECT_EQ("EvaporativeCooler:Direct:CelDekPad", idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::SecondEvaporativeCoolerObjectType).get()); + EXPECT_EQ(0.9, idfObject.getDouble(ZoneHVAC_EvaporativeCoolerUnitFields::DesignSupplyAirFlowRate).get()); + EXPECT_EQ("BlowThrough", idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::FanPlacement).get()); + EXPECT_EQ("ZoneTemperatureDeadbandOnOffCycling", idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::CoolerUnitControlMethod).get()); + EXPECT_EQ(1.2, idfObject.getDouble(ZoneHVAC_EvaporativeCoolerUnitFields::ThrottlingRangeTemperatureDifference).get()); + EXPECT_EQ(1.3, idfObject.getDouble(ZoneHVAC_EvaporativeCoolerUnitFields::CoolingLoadControlThresholdHeatTransferRate).get()); + EXPECT_EQ("EvaporativeCooler:Direct:ResearchSpecial", + idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::FirstEvaporativeCoolerObjectType).get()); + EXPECT_EQ(firstEvaporativeCooler.nameString(), idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::FirstEvaporativeCoolerObjectName).get()); + EXPECT_EQ("EvaporativeCooler:Indirect:ResearchSpecial", + idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::SecondEvaporativeCoolerObjectType).get()); EXPECT_EQ(secondEvaporativeCooler.nameString(), idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::SecondEvaporativeCoolerName).get()); - EXPECT_EQ(designSpecificationZoneHVACSizingObject.nameString(), - idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::DesignSpecificationZoneHVACSizingObjectName).get()); + EXPECT_EQ("", idfObject.getString(ZoneHVAC_EvaporativeCoolerUnitFields::DesignSpecificationZoneHVACSizingObjectName).get()); EXPECT_EQ(95.0, idfObject.getDouble(ZoneHVAC_EvaporativeCoolerUnitFields::ShutOffRelativeHumidity).get()); } diff --git a/src/model/ConcreteModelObjects.hpp b/src/model/ConcreteModelObjects.hpp index 9d36231578..3ea8d92cf8 100644 --- a/src/model/ConcreteModelObjects.hpp +++ b/src/model/ConcreteModelObjects.hpp @@ -542,6 +542,7 @@ #include "ZoneHVACEnergyRecoveryVentilator.hpp" #include "ZoneHVACEnergyRecoveryVentilatorController.hpp" #include "ZoneHVACEquipmentList.hpp" +#include "ZoneHVACEvaporativeCoolerUnit.hpp" #include "ZoneHVACFourPipeFanCoil.hpp" #include "ZoneHVACHighTemperatureRadiant.hpp" #include "ZoneHVACIdealLoadsAirSystem.hpp" @@ -1096,6 +1097,7 @@ #include "ZoneHVACEnergyRecoveryVentilator_Impl.hpp" #include "ZoneHVACEnergyRecoveryVentilatorController_Impl.hpp" #include "ZoneHVACEquipmentList_Impl.hpp" +#include "ZoneHVACEvaporativeCoolerUnit_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 bfe9fd1cb2..38a56fb71d 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/ZoneHVACEvaporativeCoolerUnit.cpp b/src/model/ZoneHVACEvaporativeCoolerUnit.cpp index 554cf0903f..97b920a1e9 100644 --- a/src/model/ZoneHVACEvaporativeCoolerUnit.cpp +++ b/src/model/ZoneHVACEvaporativeCoolerUnit.cpp @@ -30,21 +30,18 @@ #include "ZoneHVACEvaporativeCoolerUnit.hpp" #include "ZoneHVACEvaporativeCoolerUnit_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 "SystemAvailabilityManagerLists.hpp" -#include "SystemAvailabilityManagerLists_Impl.hpp" -#include "Connection.hpp" -#include "Connection_Impl.hpp" -#include "Fans.hpp" -#include "Fans_Impl.hpp" -#include "EvapCooler.hpp" -#include "EvapCooler_Impl.hpp" -#include "DesignSpecificationZoneHVACSizingName.hpp" -#include "DesignSpecificationZoneHVACSizingName_Impl.hpp" +#include "HVACComponent.hpp" +#include "HVACComponent_Impl.hpp" #include "ScheduleTypeLimits.hpp" #include "ScheduleTypeRegistry.hpp" +#include "FanComponentModel.hpp" +#include "FanComponentModel_Impl.hpp" +#include "EvaporativeCoolerDirectResearchSpecial.hpp" +#include "EvaporativeCoolerDirectResearchSpecial_Impl.hpp" #include "../utilities/core/Assert.hpp" #include "../utilities/data/DataEnums.hpp" @@ -85,7 +82,6 @@ namespace model { } std::vector ZoneHVACEvaporativeCoolerUnit_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_EvaporativeCoolerUnitFields::AvailabilityScheduleName) @@ -95,24 +91,27 @@ namespace model { return result; } + unsigned ZoneHVACEvaporativeCoolerUnit_Impl::inletPort() const { + return OS_ZoneHVAC_EvaporativeCoolerUnitFields::OutdoorAirInletNodeName; + } + + unsigned ZoneHVACEvaporativeCoolerUnit_Impl::outletPort() const { + return OS_ZoneHVAC_EvaporativeCoolerUnitFields::CoolerOutletNodeName; + } + ComponentType ZoneHVACEvaporativeCoolerUnit_Impl::componentType() const { - // TODO return ComponentType::None; } std::vector ZoneHVACEvaporativeCoolerUnit_Impl::coolingFuelTypes() const { - // TODO return {}; } std::vector ZoneHVACEvaporativeCoolerUnit_Impl::heatingFuelTypes() const { - // TODO return {}; } std::vector ZoneHVACEvaporativeCoolerUnit_Impl::appGHeatingFuelTypes() const { - - // TODO return {}; } @@ -124,33 +123,8 @@ namespace model { return value.get(); } - boost::optional ZoneHVACEvaporativeCoolerUnit_Impl::availabilityManagerList() const { - return getObject().getModelObjectTarget( - OS_ZoneHVAC_EvaporativeCoolerUnitFields::AvailabilityManagerListName); - } - - Connection ZoneHVACEvaporativeCoolerUnit_Impl::outdoorAirInletNode() const { - boost::optional value = optionalOutdoorAirInletNode(); - if (!value) { - LOG_AND_THROW(briefDescription() << " does not have an Outdoor Air Inlet Node attached."); - } - return value.get(); - } - - Connection ZoneHVACEvaporativeCoolerUnit_Impl::coolerOutletNode() const { - boost::optional value = optionalCoolerOutletNode(); - if (!value) { - LOG_AND_THROW(briefDescription() << " does not have an Cooler Outlet Node attached."); - } - return value.get(); - } - - boost::optional ZoneHVACEvaporativeCoolerUnit_Impl::zoneReliefAirNode() const { - return getObject().getModelObjectTarget(OS_ZoneHVAC_EvaporativeCoolerUnitFields::ZoneReliefAirNodeName); - } - - Fans ZoneHVACEvaporativeCoolerUnit_Impl::supplyAirFan() const { - boost::optional value = optionalSupplyAirFan(); + HVACComponent ZoneHVACEvaporativeCoolerUnit_Impl::supplyAirFan() const { + boost::optional value = optionalSupplyAirFan(); if (!value) { LOG_AND_THROW(briefDescription() << " does not have an Supply Air Fan attached."); } @@ -198,21 +172,16 @@ namespace model { return value.get(); } - EvapCooler ZoneHVACEvaporativeCoolerUnit_Impl::firstEvaporativeCooler() const { - boost::optional value = optionalFirstEvaporativeCooler(); + HVACComponent ZoneHVACEvaporativeCoolerUnit_Impl::firstEvaporativeCooler() const { + boost::optional value = optionalFirstEvaporativeCooler(); if (!value) { LOG_AND_THROW(briefDescription() << " does not have an First Evaporative Cooler attached."); } return value.get(); } - boost::optional ZoneHVACEvaporativeCoolerUnit_Impl::secondEvaporativeCooler() const { - return getObject().getModelObjectTarget(OS_ZoneHVAC_EvaporativeCoolerUnitFields::SecondEvaporativeCoolerName); - } - - boost::optional ZoneHVACEvaporativeCoolerUnit_Impl::designSpecificationZoneHVACSizing() const { - return getObject().getModelObjectTarget( - OS_ZoneHVAC_EvaporativeCoolerUnitFields::DesignSpecificationZoneHVACSizing); + boost::optional ZoneHVACEvaporativeCoolerUnit_Impl::secondEvaporativeCooler() const { + return getObject().getModelObjectTarget(OS_ZoneHVAC_EvaporativeCoolerUnitFields::SecondEvaporativeCooler); } double ZoneHVACEvaporativeCoolerUnit_Impl::shutOffRelativeHumidity() const { @@ -227,38 +196,8 @@ namespace model { return result; } - bool ZoneHVACEvaporativeCoolerUnit_Impl::setAvailabilityManagerList(const SystemAvailabilityManagerLists& systemAvailabilityManagerLists) { - const bool result = setPointer(OS_ZoneHVAC_EvaporativeCoolerUnitFields::AvailabilityManagerListName, systemAvailabilityManagerLists.handle()); - return result; - } - - void ZoneHVACEvaporativeCoolerUnit_Impl::resetAvailabilityManagerList() { - const bool result = setString(OS_ZoneHVAC_EvaporativeCoolerUnitFields::AvailabilityManagerListName, ""); - OS_ASSERT(result); - } - - bool ZoneHVACEvaporativeCoolerUnit_Impl::setOutdoorAirInletNode(const Connection& connection) { - const bool result = setPointer(OS_ZoneHVAC_EvaporativeCoolerUnitFields::OutdoorAirInletNodeName, connection.handle()); - return result; - } - - bool ZoneHVACEvaporativeCoolerUnit_Impl::setCoolerOutletNode(const Connection& connection) { - const bool result = setPointer(OS_ZoneHVAC_EvaporativeCoolerUnitFields::CoolerOutletNodeName, connection.handle()); - return result; - } - - bool ZoneHVACEvaporativeCoolerUnit_Impl::setZoneReliefAirNode(const Connection& connection) { - const bool result = setPointer(OS_ZoneHVAC_EvaporativeCoolerUnitFields::ZoneReliefAirNodeName, connection.handle()); - return result; - } - - void ZoneHVACEvaporativeCoolerUnit_Impl::resetZoneReliefAirNode() { - const bool result = setString(OS_ZoneHVAC_EvaporativeCoolerUnitFields::ZoneReliefAirNodeName, ""); - OS_ASSERT(result); - } - - bool ZoneHVACEvaporativeCoolerUnit_Impl::setSupplyAirFan(const Fans& fans) { - const bool result = setPointer(OS_ZoneHVAC_EvaporativeCoolerUnitFields::SupplyAirFanName, fans.handle()); + bool ZoneHVACEvaporativeCoolerUnit_Impl::setSupplyAirFan(const HVACComponent& hvacComponent) { + const bool result = setPointer(OS_ZoneHVAC_EvaporativeCoolerUnitFields::SupplyAirFanName, hvacComponent.handle()); return result; } @@ -294,30 +233,18 @@ namespace model { return result; } - bool ZoneHVACEvaporativeCoolerUnit_Impl::setFirstEvaporativeCooler(const EvapCooler& evapCooler) { - const bool result = setPointer(OS_ZoneHVAC_EvaporativeCoolerUnitFields::FirstEvaporativeCooler, evapCooler.handle()); + bool ZoneHVACEvaporativeCoolerUnit_Impl::setFirstEvaporativeCooler(const HVACComponent& hvacComponent) { + const bool result = setPointer(OS_ZoneHVAC_EvaporativeCoolerUnitFields::FirstEvaporativeCooler, hvacComponent.handle()); return result; } - bool ZoneHVACEvaporativeCoolerUnit_Impl::setSecondEvaporativeCooler(const EvapCooler& evapCooler) { - const bool result = setPointer(OS_ZoneHVAC_EvaporativeCoolerUnitFields::SecondEvaporativeCoolerName, evapCooler.handle()); + bool ZoneHVACEvaporativeCoolerUnit_Impl::setSecondEvaporativeCooler(const HVACComponent& hvacComponent) { + const bool result = setPointer(OS_ZoneHVAC_EvaporativeCoolerUnitFields::SecondEvaporativeCooler, hvacComponent.handle()); return result; } void ZoneHVACEvaporativeCoolerUnit_Impl::resetSecondEvaporativeCooler() { - const bool result = setString(OS_ZoneHVAC_EvaporativeCoolerUnitFields::SecondEvaporativeCoolerName, ""); - OS_ASSERT(result); - } - - bool ZoneHVACEvaporativeCoolerUnit_Impl::setDesignSpecificationZoneHVACSizing( - const DesignSpecificationZoneHVACSizingName& designSpecificationZoneHVACSizingName) { - const bool result = - setPointer(OS_ZoneHVAC_EvaporativeCoolerUnitFields::DesignSpecificationZoneHVACSizing, designSpecificationZoneHVACSizingName.handle()); - return result; - } - - void ZoneHVACEvaporativeCoolerUnit_Impl::resetDesignSpecificationZoneHVACSizing() { - const bool result = setString(OS_ZoneHVAC_EvaporativeCoolerUnitFields::DesignSpecificationZoneHVACSizing, ""); + const bool result = setString(OS_ZoneHVAC_EvaporativeCoolerUnitFields::SecondEvaporativeCooler, ""); OS_ASSERT(result); } @@ -332,7 +259,7 @@ namespace model { void ZoneHVACEvaporativeCoolerUnit_Impl::applySizingValues() { if (boost::optional val_ = autosizedDesignSupplyAirFlowRate()) { - setDesignSupplyAirFlowRate(*val_)); + setDesignSupplyAirFlowRate(*val_); } } @@ -340,20 +267,12 @@ namespace model { return getObject().getModelObjectTarget(OS_ZoneHVAC_EvaporativeCoolerUnitFields::AvailabilityScheduleName); } - boost::optional ZoneHVACEvaporativeCoolerUnit_Impl::optionalOutdoorAirInletNode() const { - return getObject().getModelObjectTarget(OS_ZoneHVAC_EvaporativeCoolerUnitFields::OutdoorAirInletNodeName); + boost::optional ZoneHVACEvaporativeCoolerUnit_Impl::optionalSupplyAirFan() const { + return getObject().getModelObjectTarget(OS_ZoneHVAC_EvaporativeCoolerUnitFields::SupplyAirFanName); } - boost::optional ZoneHVACEvaporativeCoolerUnit_Impl::optionalCoolerOutletNode() const { - return getObject().getModelObjectTarget(OS_ZoneHVAC_EvaporativeCoolerUnitFields::CoolerOutletNodeName); - } - - boost::optional ZoneHVACEvaporativeCoolerUnit_Impl::optionalSupplyAirFan() const { - return getObject().getModelObjectTarget(OS_ZoneHVAC_EvaporativeCoolerUnitFields::SupplyAirFanName); - } - - boost::optional ZoneHVACEvaporativeCoolerUnit_Impl::optionalFirstEvaporativeCooler() const { - return getObject().getModelObjectTarget(OS_ZoneHVAC_EvaporativeCoolerUnitFields::FirstEvaporativeCooler); + boost::optional ZoneHVACEvaporativeCoolerUnit_Impl::optionalFirstEvaporativeCooler() const { + return getObject().getModelObjectTarget(OS_ZoneHVAC_EvaporativeCoolerUnitFields::FirstEvaporativeCooler); } } // namespace detail @@ -366,12 +285,11 @@ namespace model { auto alwaysOn = model.alwaysOnDiscreteSchedule(); ok = setAvailabilitySchedule(alwaysOn); OS_ASSERT(ok); - // ok = setOutdoorAirInletNode(); - OS_ASSERT(ok); - // ok = setCoolerOutletNode(); - OS_ASSERT(ok); - // ok = setSupplyAirFan(); + + FanComponentModel supplyAirFan(model); // StripMallZoneEvapCooler.idf + ok = setSupplyAirFan(supplyAirFan); OS_ASSERT(ok); + autosizeDesignSupplyAirFlowRate(); ok = setFanPlacement("BlowThrough"); OS_ASSERT(ok); @@ -381,8 +299,11 @@ namespace model { OS_ASSERT(ok); ok = setCoolingLoadControlThresholdHeatTransferRate(100.0); OS_ASSERT(ok); - // ok = setFirstEvaporativeCooler(); + + EvaporativeCoolerDirectResearchSpecial firstEvaporativeCooler(model, alwaysOn); + ok = setFirstEvaporativeCooler(firstEvaporativeCooler); // StripMallZoneEvapCooler.idf OS_ASSERT(ok); + ok = setShutOffRelativeHumidity(100.0); OS_ASSERT(ok); } @@ -395,10 +316,6 @@ namespace model { bool ok = true; ok = setAvailabilitySchedule(availabilitySchedule); OS_ASSERT(ok); - // ok = setOutdoorAirInletNode(); - OS_ASSERT(ok); - // ok = setCoolerOutletNode(); - OS_ASSERT(ok); ok = setSupplyAirFan(supplyAirFan); OS_ASSERT(ok); autosizeDesignSupplyAirFlowRate(); @@ -432,23 +349,7 @@ namespace model { return getImpl()->availabilitySchedule(); } - boost::optional ZoneHVACEvaporativeCoolerUnit::availabilityManagerList() const { - return getImpl()->availabilityManagerList(); - } - - Connection ZoneHVACEvaporativeCoolerUnit::outdoorAirInletNode() const { - return getImpl()->outdoorAirInletNode(); - } - - Connection ZoneHVACEvaporativeCoolerUnit::coolerOutletNode() const { - return getImpl()->coolerOutletNode(); - } - - boost::optional ZoneHVACEvaporativeCoolerUnit::zoneReliefAirNode() const { - return getImpl()->zoneReliefAirNode(); - } - - Fans ZoneHVACEvaporativeCoolerUnit::supplyAirFan() const { + HVACComponent ZoneHVACEvaporativeCoolerUnit::supplyAirFan() const { return getImpl()->supplyAirFan(); } @@ -480,18 +381,14 @@ namespace model { return getImpl()->coolingLoadControlThresholdHeatTransferRate(); } - EvapCooler ZoneHVACEvaporativeCoolerUnit::firstEvaporativeCooler() const { + HVACComponent ZoneHVACEvaporativeCoolerUnit::firstEvaporativeCooler() const { return getImpl()->firstEvaporativeCooler(); } - boost::optional ZoneHVACEvaporativeCoolerUnit::secondEvaporativeCooler() const { + boost::optional ZoneHVACEvaporativeCoolerUnit::secondEvaporativeCooler() const { return getImpl()->secondEvaporativeCooler(); } - boost::optional ZoneHVACEvaporativeCoolerUnit::designSpecificationZoneHVACSizing() const { - return getImpl()->designSpecificationZoneHVACSizing(); - } - double ZoneHVACEvaporativeCoolerUnit::shutOffRelativeHumidity() const { return getImpl()->shutOffRelativeHumidity(); } @@ -500,32 +397,8 @@ namespace model { return getImpl()->setAvailabilitySchedule(schedule); } - bool ZoneHVACEvaporativeCoolerUnit::setAvailabilityManagerList(const SystemAvailabilityManagerLists& systemAvailabilityManagerLists) { - return getImpl()->setAvailabilityManagerList(systemAvailabilityManagerLists); - } - - void ZoneHVACEvaporativeCoolerUnit::resetAvailabilityManagerList() { - getImpl()->resetAvailabilityManagerList(); - } - - bool ZoneHVACEvaporativeCoolerUnit::setOutdoorAirInletNode(const Connection& connection) { - return getImpl()->setOutdoorAirInletNode(connection); - } - - bool ZoneHVACEvaporativeCoolerUnit::setCoolerOutletNode(const Connection& connection) { - return getImpl()->setCoolerOutletNode(connection); - } - - bool ZoneHVACEvaporativeCoolerUnit::setZoneReliefAirNode(const Connection& connection) { - return getImpl()->setZoneReliefAirNode(connection); - } - - void ZoneHVACEvaporativeCoolerUnit::resetZoneReliefAirNode() { - getImpl()->resetZoneReliefAirNode(); - } - - bool ZoneHVACEvaporativeCoolerUnit::setSupplyAirFan(const Fans& fans) { - return getImpl()->setSupplyAirFan(fans); + bool ZoneHVACEvaporativeCoolerUnit::setSupplyAirFan(const HVACComponent& hvacComponent) { + return getImpl()->setSupplyAirFan(hvacComponent); } bool ZoneHVACEvaporativeCoolerUnit::setDesignSupplyAirFlowRate(double designSupplyAirFlowRate) { @@ -553,27 +426,18 @@ namespace model { coolingLoadControlThresholdHeatTransferRate); } - bool ZoneHVACEvaporativeCoolerUnit::setFirstEvaporativeCooler(const EvapCooler& evapCooler) { - return getImpl()->setFirstEvaporativeCooler(evapCooler); + bool ZoneHVACEvaporativeCoolerUnit::setFirstEvaporativeCooler(const HVACComponent& hvacComponent) { + return getImpl()->setFirstEvaporativeCooler(hvacComponent); } - bool ZoneHVACEvaporativeCoolerUnit::setSecondEvaporativeCooler(const EvapCooler& evapCooler) { - return getImpl()->setSecondEvaporativeCooler(evapCooler); + bool ZoneHVACEvaporativeCoolerUnit::setSecondEvaporativeCooler(const HVACComponent& hvacComponent) { + return getImpl()->setSecondEvaporativeCooler(hvacComponent); } void ZoneHVACEvaporativeCoolerUnit::resetSecondEvaporativeCooler() { getImpl()->resetSecondEvaporativeCooler(); } - bool ZoneHVACEvaporativeCoolerUnit::setDesignSpecificationZoneHVACSizing( - const DesignSpecificationZoneHVACSizingName& designSpecificationZoneHVACSizingName) { - return getImpl()->setDesignSpecificationZoneHVACSizing(designSpecificationZoneHVACSizingName); - } - - void ZoneHVACEvaporativeCoolerUnit::resetDesignSpecificationZoneHVACSizing() { - getImpl()->resetDesignSpecificationZoneHVACSizing(); - } - bool ZoneHVACEvaporativeCoolerUnit::setShutOffRelativeHumidity(double shutOffRelativeHumidity) { return getImpl()->setShutOffRelativeHumidity(shutOffRelativeHumidity); } diff --git a/src/model/ZoneHVACEvaporativeCoolerUnit.hpp b/src/model/ZoneHVACEvaporativeCoolerUnit.hpp index e7fefe42a9..2d428b998a 100644 --- a/src/model/ZoneHVACEvaporativeCoolerUnit.hpp +++ b/src/model/ZoneHVACEvaporativeCoolerUnit.hpp @@ -37,13 +37,8 @@ namespace openstudio { namespace model { - // TODO: Check the following class names against object getters and setters. class Schedule; - class SystemAvailabilityManagerLists; - class Connection; - class Fans; - class EvapCooler; - class DesignSpecificationZoneHVACSizingName; + class HVACComponent; namespace detail { @@ -81,23 +76,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: SystemAvailabilityManagerLists. - boost::optional availabilityManagerList() const; - - // TODO: Check return type. From object lists, some candidates are: Connection. - Connection outdoorAirInletNode() const; - - // TODO: Check return type. From object lists, some candidates are: Connection. - Connection coolerOutletNode() const; - - // TODO: Check return type. From object lists, some candidates are: Connection. - boost::optional zoneReliefAirNode() const; - - // TODO: Check return type. From object lists, some candidates are: Fans. - Fans supplyAirFan() const; + HVACComponent supplyAirFan() const; boost::optional designSupplyAirFlowRate() const; @@ -113,14 +94,9 @@ namespace model { double coolingLoadControlThresholdHeatTransferRate() const; - // TODO: Check return type. From object lists, some candidates are: EvapCooler. - EvapCooler firstEvaporativeCooler() const; + HVACComponent firstEvaporativeCooler() const; - // TODO: Check return type. From object lists, some candidates are: EvapCooler. - boost::optional secondEvaporativeCooler() const; - - // TODO: Check return type. From object lists, some candidates are: DesignSpecificationZoneHVACSizingName. - boost::optional designSpecificationZoneHVACSizing() const; + boost::optional secondEvaporativeCooler() const; double shutOffRelativeHumidity() const; @@ -128,28 +104,9 @@ namespace model { /** @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: SystemAvailabilityManagerLists. - bool setAvailabilityManagerList(const SystemAvailabilityManagerLists& systemAvailabilityManagerLists); - - void resetAvailabilityManagerList(); - - // TODO: Check argument type. From object lists, some candidates are: Connection. - bool setOutdoorAirInletNode(const Connection& connection); - - // TODO: Check argument type. From object lists, some candidates are: Connection. - bool setCoolerOutletNode(const Connection& connection); - - // TODO: Check argument type. From object lists, some candidates are: Connection. - bool setZoneReliefAirNode(const Connection& connection); - - void resetZoneReliefAirNode(); - - // TODO: Check argument type. From object lists, some candidates are: Fans. - bool setSupplyAirFan(const Fans& fans); + bool setSupplyAirFan(const HVACComponent& hvacComponent); bool setDesignSupplyAirFlowRate(double designSupplyAirFlowRate); @@ -163,19 +120,12 @@ namespace model { bool setCoolingLoadControlThresholdHeatTransferRate(double coolingLoadControlThresholdHeatTransferRate); - // TODO: Check argument type. From object lists, some candidates are: EvapCooler. - bool setFirstEvaporativeCooler(const EvapCooler& evapCooler); + bool setFirstEvaporativeCooler(const HVACComponent& hvacComponent); - // TODO: Check argument type. From object lists, some candidates are: EvapCooler. - bool setSecondEvaporativeCooler(const EvapCooler& evapCooler); + bool setSecondEvaporativeCooler(const HVACComponent& hvacComponent); void resetSecondEvaporativeCooler(); - // TODO: Check argument type. From object lists, some candidates are: DesignSpecificationZoneHVACSizingName. - bool setDesignSpecificationZoneHVACSizing(const DesignSpecificationZoneHVACSizingName& designSpecificationZoneHVACSizingName); - - void resetDesignSpecificationZoneHVACSizing(); - bool setShutOffRelativeHumidity(double shutOffRelativeHumidity); //@} diff --git a/src/model/ZoneHVACEvaporativeCoolerUnit_Impl.hpp b/src/model/ZoneHVACEvaporativeCoolerUnit_Impl.hpp index 003ffcc419..eb891a3fe1 100644 --- a/src/model/ZoneHVACEvaporativeCoolerUnit_Impl.hpp +++ b/src/model/ZoneHVACEvaporativeCoolerUnit_Impl.hpp @@ -36,13 +36,8 @@ namespace openstudio { namespace model { - // TODO: Check the following class names against object getters and setters. class Schedule; - class SystemAvailabilityManagerLists; - class Connection; - class Fans; - class EvapCooler; - class DesignSpecificationZoneHVACSizingName; + class HVACComponent; namespace detail { @@ -71,6 +66,10 @@ namespace model { virtual std::vector getScheduleTypeKeys(const Schedule& schedule) const override; + virtual unsigned inletPort() const override; + + virtual unsigned outletPort() const override; + virtual ComponentType componentType() const override; virtual std::vector coolingFuelTypes() const override; virtual std::vector heatingFuelTypes() const override; @@ -80,23 +79,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: SystemAvailabilityManagerLists. - boost::optional availabilityManagerList() const; - - // TODO: Check return type. From object lists, some candidates are: Connection. - Connection outdoorAirInletNode() const; - - // TODO: Check return type. From object lists, some candidates are: Connection. - Connection coolerOutletNode() const; - - // TODO: Check return type. From object lists, some candidates are: Connection. - boost::optional zoneReliefAirNode() const; - - // TODO: Check return type. From object lists, some candidates are: Fans. - Fans supplyAirFan() const; + HVACComponent supplyAirFan() const; boost::optional designSupplyAirFlowRate() const; @@ -112,14 +97,9 @@ namespace model { double coolingLoadControlThresholdHeatTransferRate() const; - // TODO: Check return type. From object lists, some candidates are: EvapCooler. - EvapCooler firstEvaporativeCooler() const; + HVACComponent firstEvaporativeCooler() const; - // TODO: Check return type. From object lists, some candidates are: EvapCooler. - boost::optional secondEvaporativeCooler() const; - - // TODO: Check return type. From object lists, some candidates are: DesignSpecificationZoneHVACSizingName. - boost::optional designSpecificationZoneHVACSizing() const; + boost::optional secondEvaporativeCooler() const; double shutOffRelativeHumidity() const; @@ -127,28 +107,9 @@ namespace model { /** @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: SystemAvailabilityManagerLists. - bool setAvailabilityManagerList(const SystemAvailabilityManagerLists& systemAvailabilityManagerLists); - - void resetAvailabilityManagerList(); - - // TODO: Check argument type. From object lists, some candidates are: Connection. - bool setOutdoorAirInletNode(const Connection& connection); - - // TODO: Check argument type. From object lists, some candidates are: Connection. - bool setCoolerOutletNode(const Connection& connection); - - // TODO: Check argument type. From object lists, some candidates are: Connection. - bool setZoneReliefAirNode(const Connection& connection); - - void resetZoneReliefAirNode(); - - // TODO: Check argument type. From object lists, some candidates are: Fans. - bool setSupplyAirFan(const Fans& fans); + bool setSupplyAirFan(const HVACComponent& hvacComponent); bool setDesignSupplyAirFlowRate(double designSupplyAirFlowRate); @@ -162,19 +123,12 @@ namespace model { bool setCoolingLoadControlThresholdHeatTransferRate(double coolingLoadControlThresholdHeatTransferRate); - // TODO: Check argument type. From object lists, some candidates are: EvapCooler. - bool setFirstEvaporativeCooler(const EvapCooler& evapCooler); + bool setFirstEvaporativeCooler(const HVACComponent& hvacComponent); - // TODO: Check argument type. From object lists, some candidates are: EvapCooler. - bool setSecondEvaporativeCooler(const EvapCooler& evapCooler); + bool setSecondEvaporativeCooler(const HVACComponent& hvacComponent); void resetSecondEvaporativeCooler(); - // TODO: Check argument type. From object lists, some candidates are: DesignSpecificationZoneHVACSizingName. - bool setDesignSpecificationZoneHVACSizing(const DesignSpecificationZoneHVACSizingName& designSpecificationZoneHVACSizingName); - - void resetDesignSpecificationZoneHVACSizing(); - bool setShutOffRelativeHumidity(double shutOffRelativeHumidity); virtual void autosize() override; @@ -190,15 +144,9 @@ namespace model { private: REGISTER_LOGGER("openstudio.model.ZoneHVACEvaporativeCoolerUnit"); - // 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 optionalOutdoorAirInletNode() const; - boost::optional optionalCoolerOutletNode() const; - boost::optional optionalSupplyAirFan() const; - boost::optional optionalFirstEvaporativeCooler() const; + boost::optional optionalSupplyAirFan() const; + boost::optional optionalFirstEvaporativeCooler() const; }; } // namespace detail diff --git a/src/model/test/ZoneHVACEvaporativeCoolerUnit_GTest.cpp b/src/model/test/ZoneHVACEvaporativeCoolerUnit_GTest.cpp index ff0d3f6ae8..65c8b75f0a 100644 --- a/src/model/test/ZoneHVACEvaporativeCoolerUnit_GTest.cpp +++ b/src/model/test/ZoneHVACEvaporativeCoolerUnit_GTest.cpp @@ -31,67 +31,32 @@ #include "../ZoneHVACEvaporativeCoolerUnit.hpp" #include "../ZoneHVACEvaporativeCoolerUnit_Impl.hpp" - -// TODO: Check the following class names against object getters and setters. #include "../Schedule.hpp" #include "../Schedule_Impl.hpp" - -#include "../SystemAvailabilityManagerLists.hpp" -#include "../SystemAvailabilityManagerLists_Impl.hpp" - -#include "../Connection.hpp" -#include "../Connection_Impl.hpp" - -#include "../Fans.hpp" -#include "../Fans_Impl.hpp" - -#include "../EvapCooler.hpp" -#include "../EvapCooler_Impl.hpp" - -#include "../DesignSpecificationZoneHVACSizingName.hpp" -#include "../DesignSpecificationZoneHVACSizingName_Impl.hpp" +#include "../FanComponentModel.hpp" +#include "../FanComponentModel_Impl.hpp" +#include "../EvaporativeCoolerDirectResearchSpecial.hpp" +#include "../EvaporativeCoolerDirectResearchSpecial_Impl.hpp" +#include "../EvaporativeCoolerIndirectResearchSpecial.hpp" +#include "../EvaporativeCoolerIndirectResearchSpecial_Impl.hpp" using namespace openstudio; using namespace openstudio::model; TEST_F(ModelFixture, ZoneHVACEvaporativeCoolerUnit_GettersSetters) { Model m; - // TODO: Check regular Ctor arguments + ZoneHVACEvaporativeCoolerUnit zoneHVACEvaporativeCoolerUnit(m); - // TODO: Or if a UniqueModelObject (and make sure _Impl is included) - // ZoneHVACEvaporativeCoolerUnit zoneHVACEvaporativeCoolerUnit = m.getUniqueModelObject(); zoneHVACEvaporativeCoolerUnit.setName("My ZoneHVACEvaporativeCoolerUnit"); // Availability Schedule Name: Required Object - Schedule availabilitySchedule(m); + Schedule availabilitySchedule = m.alwaysOnDiscreteSchedule(); EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setAvailabilitySchedule(availabilitySchedule)); EXPECT_EQ(availabilitySchedule, zoneHVACEvaporativeCoolerUnit.availabilitySchedule()); - // Availability Manager List Name: Optional Object - boost::optional availabilityManagerList(m); - EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setAvailabilityManagerList(availabilityManagerList)); - ASSERT_TRUE(zoneHVACEvaporativeCoolerUnit.availabilityManagerList()); - EXPECT_EQ(availabilityManagerList, zoneHVACEvaporativeCoolerUnit.availabilityManagerList().get()); - - // Outdoor Air Inlet Node Name: Required Object - Connection outdoorAirInletNode(m); - EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setOutdoorAirInletNode(outdoorAirInletNode)); - EXPECT_EQ(outdoorAirInletNode, zoneHVACEvaporativeCoolerUnit.outdoorAirInletNode()); - - // Cooler Outlet Node Name: Required Object - Connection coolerOutletNode(m); - EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setCoolerOutletNode(coolerOutletNode)); - EXPECT_EQ(coolerOutletNode, zoneHVACEvaporativeCoolerUnit.coolerOutletNode()); - - // Zone Relief Air Node Name: Optional Object - boost::optional zoneReliefAirNode(m); - EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setZoneReliefAirNode(zoneReliefAirNode)); - ASSERT_TRUE(zoneHVACEvaporativeCoolerUnit.zoneReliefAirNode()); - EXPECT_EQ(zoneReliefAirNode, zoneHVACEvaporativeCoolerUnit.zoneReliefAirNode().get()); - // Supply Air Fan Name: Required Object - Fans supplyAirFan(m); + FanComponentModel supplyAirFan(m); EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setSupplyAirFan(supplyAirFan)); EXPECT_EQ(supplyAirFan, zoneHVACEvaporativeCoolerUnit.supplyAirFan()); @@ -138,22 +103,17 @@ TEST_F(ModelFixture, ZoneHVACEvaporativeCoolerUnit_GettersSetters) { EXPECT_EQ(1.3, zoneHVACEvaporativeCoolerUnit.coolingLoadControlThresholdHeatTransferRate()); // First Evaporative Cooler: Required Object - EvapCooler firstEvaporativeCooler(m); + EvaporativeCoolerDirectResearchSpecial firstEvaporativeCooler(m, availabilitySchedule); EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setFirstEvaporativeCooler(firstEvaporativeCooler)); EXPECT_EQ(firstEvaporativeCooler, zoneHVACEvaporativeCoolerUnit.firstEvaporativeCooler()); // Second Evaporative Cooler Name: Optional Object - boost::optional secondEvaporativeCooler(m); + EXPECT_FALSE(zoneHVACEvaporativeCoolerUnit.secondEvaporativeCooler()); + EvaporativeCoolerIndirectResearchSpecial secondEvaporativeCooler(m); EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setSecondEvaporativeCooler(secondEvaporativeCooler)); ASSERT_TRUE(zoneHVACEvaporativeCoolerUnit.secondEvaporativeCooler()); EXPECT_EQ(secondEvaporativeCooler, zoneHVACEvaporativeCoolerUnit.secondEvaporativeCooler().get()); - // Design Specification ZoneHVAC Sizing: Optional Object - boost::optional designSpecificationZoneHVACSizing(m); - EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setDesignSpecificationZoneHVACSizing(designSpecificationZoneHVACSizing)); - ASSERT_TRUE(zoneHVACEvaporativeCoolerUnit.designSpecificationZoneHVACSizing()); - EXPECT_EQ(designSpecificationZoneHVACSizing, zoneHVACEvaporativeCoolerUnit.designSpecificationZoneHVACSizing().get()); - // Shut Off Relative Humidity: Required Double EXPECT_TRUE(zoneHVACEvaporativeCoolerUnit.setShutOffRelativeHumidity(94.444)); EXPECT_EQ(94.444, zoneHVACEvaporativeCoolerUnit.shutOffRelativeHumidity()); @@ -161,12 +121,11 @@ TEST_F(ModelFixture, ZoneHVACEvaporativeCoolerUnit_GettersSetters) { EXPECT_FALSE(zoneHVACEvaporativeCoolerUnit.setShutOffRelativeHumidity(-10.0)); EXPECT_EQ(94.444, zoneHVACEvaporativeCoolerUnit.shutOffRelativeHumidity()); } + TEST_F(ModelFixture, ZoneHVACEvaporativeCoolerUnit_HeatCoolFuelTypes) { Model m; - // TODO: Check regular Ctor arguments + ZoneHVACEvaporativeCoolerUnit zoneHVACEvaporativeCoolerUnit(m); - // TODO: Or if a UniqueModelObject (and make sure _Impl is included) - // ZoneHVACEvaporativeCoolerUnit zoneHVACEvaporativeCoolerUnit = m.getUniqueModelObject(); EXPECT_EQ(ComponentType(ComponentType::Both), zoneHVACEvaporativeCoolerUnit.componentType()); testFuelTypeEquality({FuelType::Electricity}, zoneHVACEvaporativeCoolerUnit.coolingFuelTypes());