Skip to content

Commit

Permalink
Add ZoneHVACEvaporativeCoolerUnit to all Fan's `containingZoneHVACCom…
Browse files Browse the repository at this point in the history
…ponent`

#5326 (comment)
  • Loading branch information
jmarrec committed Jan 9, 2025
1 parent 33a57ff commit 3d15a25
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 19 deletions.
36 changes: 17 additions & 19 deletions src/model/FanComponentModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
#include "AirTerminalSingleDuctSeriesPIUReheat_Impl.hpp"

// containing ZoneHVAC Component
// #include "ZoneHVACEvaporativeCoolerUnit.hpp"
// #include "ZoneHVACEvaporativeCoolerUnit_Impl.hpp"
#include "ZoneHVACEvaporativeCoolerUnit.hpp"
#include "ZoneHVACEvaporativeCoolerUnit_Impl.hpp"

#include <utilities/idd/IddFactory.hxx>
#include <utilities/idd/IddEnums.hxx>
Expand Down Expand Up @@ -386,23 +386,21 @@ namespace model {

boost::optional<ZoneHVACComponent> FanComponentModel_Impl::containingZoneHVACComponent() const {

// Note JM 2021-01-26: Only ZoneHVAC:EvaporativeCoolerUnit apparently, which isn't wrapped in the OS SDK currently

//std::vector<ZoneHVACComponent> zoneHVACComponent = this->model().getModelObjects<ZoneHVACComponent>();
//for (const auto& elem : zoneHVACComponent) {
//switch (elem.iddObject().type().value()) {

//// ZoneHVAC:EvaporativeCoolerUnit: not wrapped
//case openstudio::IddObjectType::OS_ZoneHVAC_EvaporativeCoolerUnit: {
//ZoneHVACEnergyRecoveryVentilator component = elem.cast<ZoneHVACEvaporativeCoolerUnit>();
//if (component.supplyAirFan().handle() == this->handle()) return elem;
//break;
//}
//default: {
//break;
//}
//}
//}
std::vector<ZoneHVACComponent> zoneHVACComponent = this->model().getModelObjects<ZoneHVACComponent>();
for (const auto& elem : zoneHVACComponent) {
switch (elem.iddObject().type().value()) {
case openstudio::IddObjectType::OS_ZoneHVAC_EvaporativeCoolerUnit: {
auto component = elem.cast<ZoneHVACEvaporativeCoolerUnit>();
if (component.supplyAirFan().handle() == this->handle()) {
return elem;
}
break;
}
default: {
break;
}
}
}
return boost::none;
}

Expand Down
15 changes: 15 additions & 0 deletions src/model/FanConstantVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include "ZoneHVACUnitHeater_Impl.hpp"
#include "ZoneHVACUnitVentilator.hpp"
#include "ZoneHVACUnitVentilator_Impl.hpp"
#include "ZoneHVACEvaporativeCoolerUnit.hpp"
#include "ZoneHVACEvaporativeCoolerUnit_Impl.hpp"
#include "AirLoopHVACOutdoorAirSystem.hpp"
#include "AirLoopHVACOutdoorAirSystem_Impl.hpp"
#include "AirTerminalSingleDuctParallelPIUReheat.hpp"
Expand Down Expand Up @@ -344,6 +346,19 @@ namespace model {
}
}

// ZoneHVACEvaporativeCoolerUnit
std::vector<ZoneHVACEvaporativeCoolerUnit> zoneHVACEvaporativeCoolerUnit;

zoneHVACEvaporativeCoolerUnit = this->model().getConcreteModelObjects<ZoneHVACEvaporativeCoolerUnit>();

for (const auto& elem : zoneHVACEvaporativeCoolerUnit) {
if (boost::optional<HVACComponent> fan = elem.supplyAirFan()) {
if (fan->handle() == this->handle()) {
return elem;
}
}
}

return boost::none;
}

Expand Down
9 changes: 9 additions & 0 deletions src/model/FanOnOff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#include "ZoneHVACUnitHeater_Impl.hpp"
#include "ZoneHVACUnitVentilator.hpp"
#include "ZoneHVACUnitVentilator_Impl.hpp"
#include "ZoneHVACEvaporativeCoolerUnit.hpp"
#include "ZoneHVACEvaporativeCoolerUnit_Impl.hpp"
#include "AirLoopHVACUnitaryHeatPumpAirToAir.hpp"
#include "AirLoopHVACUnitaryHeatPumpAirToAir_Impl.hpp"
#include "AirLoopHVACUnitarySystem.hpp"
Expand Down Expand Up @@ -424,6 +426,13 @@ namespace model {
}
break;
}
case openstudio::IddObjectType::OS_ZoneHVAC_EvaporativeCoolerUnit: {
auto component = elem.cast<ZoneHVACEvaporativeCoolerUnit>();
if (component.supplyAirFan().handle() == this->handle()) {
return elem;
}
break;
}
default: {
break;
}
Expand Down
9 changes: 9 additions & 0 deletions src/model/FanSystemModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
#include "ZoneHVACUnitHeater_Impl.hpp"
#include "ZoneHVACUnitVentilator.hpp"
#include "ZoneHVACUnitVentilator_Impl.hpp"
#include "ZoneHVACEvaporativeCoolerUnit.hpp"
#include "ZoneHVACEvaporativeCoolerUnit_Impl.hpp"
#include "ZoneHVACWaterToAirHeatPump.hpp"
#include "ZoneHVACWaterToAirHeatPump_Impl.hpp"
// These are supposed to be ZoneHVACComponents
Expand Down Expand Up @@ -484,6 +486,13 @@ namespace model {
}
break;
}
case openstudio::IddObjectType::OS_ZoneHVAC_EvaporativeCoolerUnit: {
auto component = elem.cast<ZoneHVACEvaporativeCoolerUnit>();
if (component.supplyAirFan().handle() == this->handle()) {
return elem;
}
break;
}
case openstudio::IddObjectType::OS_ZoneHVAC_WaterToAirHeatPump: {
auto component = elem.cast<ZoneHVACWaterToAirHeatPump>();
if (component.supplyAirFan().handle() == this->handle()) {
Expand Down
15 changes: 15 additions & 0 deletions src/model/FanVariableVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "ZoneHVACUnitHeater_Impl.hpp"
#include "ZoneHVACUnitVentilator.hpp"
#include "ZoneHVACUnitVentilator_Impl.hpp"
#include "ZoneHVACEvaporativeCoolerUnit.hpp"
#include "ZoneHVACEvaporativeCoolerUnit_Impl.hpp"
#include "AirLoopHVACUnitarySystem.hpp"
#include "AirLoopHVACUnitarySystem_Impl.hpp"
#include "SetpointManagerMixedAir.hpp"
Expand Down Expand Up @@ -492,6 +494,19 @@ namespace model {
}
}

// ZoneHVACEvaporativeCoolerUnit
std::vector<ZoneHVACEvaporativeCoolerUnit> zoneHVACEvaporativeCoolerUnit;

zoneHVACEvaporativeCoolerUnit = this->model().getConcreteModelObjects<ZoneHVACEvaporativeCoolerUnit>();

for (const auto& elem : zoneHVACEvaporativeCoolerUnit) {
if (boost::optional<HVACComponent> fan = elem.supplyAirFan()) {
if (fan->handle() == this->handle()) {
return elem;
}
}
}

return boost::none;
}

Expand Down

0 comments on commit 3d15a25

Please sign in to comment.