Skip to content

Commit

Permalink
CBECC: Add support to connect ZoneHVAC to inlet side mixer
Browse files Browse the repository at this point in the history
  • Loading branch information
kbenne committed Mar 29, 2019
1 parent 4252588 commit 3f99e76
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions openstudiocore/src/sdd/MapHVAC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@
#include "../model/AirTerminalSingleDuctParallelPIUReheat_Impl.hpp"
#include "../model/AirTerminalSingleDuctSeriesPIUReheat.hpp"
#include "../model/AirTerminalSingleDuctSeriesPIUReheat_Impl.hpp"
#include "../model/AirTerminalSingleDuctInletSideMixer.hpp"
#include "../model/AirTerminalSingleDuctInletSideMixer_Impl.hpp"
#include "../model/ThermostatSetpointDualSetpoint.hpp"
#include "../model/ThermostatSetpointDualSetpoint_Impl.hpp"
#include "../model/Schedule.hpp"
Expand Down Expand Up @@ -4774,6 +4776,44 @@ boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateTher
translateSystemForZone(sysInfo);
}

auto createInletSideMixerForZoneSys = [&](const SysInfo & sysInfo) {
if( sysInfo.ModelObject ) {
auto elements = thermalZoneElement.elementsByTagName("VentByPriAirCondgSys");
for (int i = 0; i < elements.count(); i++) {
const auto & element = elements.at(i).toElement();
bool ok = false;
auto index = element.attribute("index").toInt(&ok);
if( ok ) {
if( index == sysInfo.Index ) {
auto flag = element.text().toInt(&ok);
if (flag == 1) {
auto zoneHVAC = sysInfo.ModelObject->optionalCast<model::ZoneHVACComponent>();
if (zoneHVAC) {
auto tz = zoneHVAC->thermalZone();
if (tz) {
auto loop = tz->airLoopHVAC();
if (loop) {
zoneHVAC->removeFromThermalZone();
loop->removeBranchForZone(tz.get());
model::AirTerminalSingleDuctInletSideMixer inletSideMixer(model);
loop->addBranchForZone(tz.get(), inletSideMixer);
auto node = inletSideMixer.outletModelObject()->cast<model::Node>();
zoneHVAC->addToNode(node);
break;
}
}
}
}
}
}
}
}
};

for( auto & sysInfo : priAirCondInfo ) {
createInletSideMixerForZoneSys(sysInfo);
}

// Set priority
auto setPriority = [&](const SysInfo & sysInfo, const QString & priorityElement) {
if( sysInfo.ModelObject ) {
Expand Down

0 comments on commit 3f99e76

Please sign in to comment.