Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVAC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,20 +277,17 @@ namespace energyplus {
controller = supplyComponent.cast<CoilHeatingWater>().controllerWaterCoil();
break;
}
case openstudio::IddObjectType::OS_CoilSystem_Cooling_Water: {
auto coolingCoil = supplyComponent.cast<CoilSystemCoolingWater>().coolingCoil();
if (auto coilCoolingWater = coolingCoil.optionalCast<CoilCoolingWater>()) {
controller = coilCoolingWater->controllerWaterCoil();
}
break;
}
case openstudio::IddObjectType::OS_CoilSystem_Cooling_Water_HeatExchangerAssisted: {
auto coolingCoil = supplyComponent.cast<CoilSystemCoolingWaterHeatExchangerAssisted>().coolingCoil();
if (auto coilCoolingWater = coolingCoil.optionalCast<CoilCoolingWater>()) {
controller = coilCoolingWater->controllerWaterCoil();
}
break;
}
// case openstudio::IddObjectType::OS_CoilSystem_Cooling_Water: {
// // No-op: this has its own controller
// break;
// }
default: {
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,36 +74,32 @@ namespace energyplus {
idf->setString(Coil_Cooling_WaterFields::AirInletNodeName, airInletNodeName);
idf->setString(Coil_Cooling_WaterFields::AirOutletNodeName, airOutletNodeName);
// Add IddObjectType::Coil_Cooling_Water_DetailedGeometry if implemented
} else if (idf->iddObject().type() == IddObjectType::CoilSystem_Cooling_Water_HeatExchangerAssisted) {
// The logic is built in the translateCoilSystemCoolingWaterHeatExchangerAssisted method
// Essentially it's the same as getting the HX (CoilSystem_Cooling_Water_HeatExchangerAssistedFields::HeatExchangerName)
// and setting HeatExchanger_AirToAir_SensibleAndLatentFields::SupplyAirInletNodeName & ExhaustAirOutletNodeName
Comment on lines +77 to +80
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We gotta handle the CoilSystem_Cooling_Water_HeatExchangerAssisted case. I'm not doing it here because it's too complicated/awkward because we work with IdfObject, not WorkspaceObject, so theree isn't a getTarget available to set the HX Nodes

} else {
// Shouldn't happen, accepts only Coil:Cooling:Water or Coil:Cooling:Water:DetailedGeometry
// Shouldn't happen, accepts only Coil:Cooling:DX:SingleSpeed or Coil:Cooling:DX:VariableSpeed
LOG(Fatal, modelObject.briefDescription()
<< " appears to have a cooling coil that shouldn't have been accepted: " << coolingCoil.briefDescription());
OS_ASSERT(false);
}
}
if (auto coilCoolingWater = coolingCoil.optionalCast<CoilCoolingWater>()) {
if (auto controller = coilCoolingWater->controllerWaterCoil()) {
if (auto idf = translateAndMapModelObject(controller.get())) {
idf->setString(Controller_WaterCoilFields::SensorNodeName, airOutletNodeName);
}
// Shouldn't happen, accepts only Coil:Cooling:Water CoilSystem:Cooling:Water:HeatExchangerAssisted (or Coil:Cooling:Water:DetailedGeometry, not wrapped)
LOG_AND_THROW(modelObject.briefDescription()
<< " appears to have a cooling coil that shouldn't have been accepted: " << coolingCoil.briefDescription());
}
}

// Need a SPM:MixedAir on the Coil:Cooling:Water outlet node (that we **created** just above in IDF directly, so it won't get picked up by the
// TODO: is that true?!
// Need a SPM:MixedAir on the outlet node (that we **created** just above in IDF directly, so it won't get picked up by the
Comment on lines +88 to +89
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joseph-robertson not sure if that's just copy pasted fromCoilSystem_Cooling_Water_HeatExchangerAssisted or actually required.

// ForwardTranslateAirLoopHVAC method)
if (boost::optional<AirLoopHVAC> airLoop_ = modelObject.airLoopHVAC()) {
std::vector<StraightComponent> fans;
std::vector<ModelObject> supplyComponents = airLoop_->supplyComponents();

for (auto it = supplyComponents.begin(); it != supplyComponents.end(); ++it) {
if (auto fan_ = it->optionalCast<FanVariableVolume>()) {
for (auto& supplyComponent : supplyComponents) {
if (auto fan_ = supplyComponent.optionalCast<FanVariableVolume>()) {
fans.insert(fans.begin(), std::move(*fan_));
} else if (auto fan_ = it->optionalCast<FanConstantVolume>()) {
} else if (auto fan_ = supplyComponent.optionalCast<FanConstantVolume>()) {
fans.insert(fans.begin(), std::move(*fan_));
} else if (auto fan_ = it->optionalCast<FanSystemModel>()) {
} else if (auto fan_ = supplyComponent.optionalCast<FanSystemModel>()) {
fans.insert(fans.begin(), std::move(*fan_));
} else if (auto fan_ = it->optionalCast<FanOnOff>()) {
} else if (auto fan_ = supplyComponent.optionalCast<FanOnOff>()) {
fans.insert(fans.begin(), std::move(*fan_));
}
}
Expand Down Expand Up @@ -177,20 +173,21 @@ namespace energyplus {
idfObject.setDouble(CoilSystem_Cooling_WaterFields::MinimumWaterLoopTemperatureForHeatRecovery, minimumWaterLoopTemperatureForHeatRecovery);

// Companion Coil Used For Heat Recovery: Optional Object
if (boost::optional<WaterToAirComponent> companionCoilUsedForHeatRecovery_ = modelObject.companionCoilUsedForHeatRecovery()) {
if (boost::optional<IdfObject> wo_ = translateAndMapModelObject(companionCoilUsedForHeatRecovery_.get())) {
idfObject.setString(CoilSystem_Cooling_WaterFields::CompanionCoilUsedForHeatRecovery, wo_->nameString());
if (wo_->iddObject().type() == IddObjectType::Coil_Cooling_Water) {
wo_->setString(Coil_Cooling_WaterFields::AirInletNodeName, modelObject.airLoopHVACOutdoorAirSystem()->reliefAirModelObject()->nameString());
wo_->setString(Coil_Cooling_WaterFields::AirOutletNodeName, wo_->nameString() + " Exhaust Outlet Node"); // FIXME
// Add IddObjectType::Coil_Cooling_Water_DetailedGeometry if implemented
if (boost::optional<HVACComponent> companionCoilUsedForHeatRecovery_ = modelObject.companionCoilUsedForHeatRecovery()) {
if (auto comp_ = companionCoilUsedForHeatRecovery_->optionalCast<CoilCoolingWater>()) {
if (comp_->airInletModelObject()) {
if (boost::optional<IdfObject> idf_ = translateAndMapModelObject(companionCoilUsedForHeatRecovery_.get())) {
idfObject.setString(CoilSystem_Cooling_WaterFields::CompanionCoilUsedForHeatRecovery, idf_->nameString());
}
} else {
// Shouldn't happen, accepts only Coil:Cooling:Water or Coil:Cooling:Water:DetailedGeometry
// Shouldn't happen, accepts only Coil:Cooling:DX:SingleSpeed or Coil:Cooling:DX:VariableSpeed
LOG(Fatal, modelObject.briefDescription() << " appears to have a companion coil used for heat recovery that shouldn't have been accepted: "
<< companionCoilUsedForHeatRecovery_.get().briefDescription());
OS_ASSERT(false);
LOG(Warn, modelObject.briefDescription()
<< " has a companion coil used for heat recovery that is not connected to an AirLoopHVAC / AirLoopHVACOutdoorAirSystem"
<< " and will not be translated:" << comp_->briefDescription());
}
} else {
// Shouldn't happen, accepts only Coil:Cooling:Water
LOG_AND_THROW(modelObject.briefDescription() << " appears to have a companion coil used for heat recovery that shouldn't have been accepted: "
<< companionCoilUsedForHeatRecovery_.get().briefDescription());
Comment on lines +176 to +190
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No translating the companion coil if it's not connected by itself on an AirLoopHVAC/AirLoopHVACOutdoorAIrSystem

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "../../model/CoilCoolingWater_Impl.hpp"
#include "../../model/ControllerWaterCoil.hpp"
#include "../../model/ControllerWaterCoil_Impl.hpp"
#include "../../model/CoilSystemCoolingWater.hpp"
#include "../../model/CoilSystemCoolingWater_Impl.hpp"

#include "../../model/AirLoopHVAC.hpp"
#include "../../model/FanVariableVolume.hpp"
Expand Down Expand Up @@ -47,18 +49,30 @@ namespace energyplus {
IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::CoilSystem_Cooling_Water_HeatExchangerAssisted, modelObject);

std::string hxSupplyAirInletNodeName;
std::string hxExhaustAirOutletNodeName;
// InletNodeName
if (auto mo = modelObject.inletModelObject()) {
if (auto node = mo->optionalCast<Node>()) {
hxSupplyAirInletNodeName = node->nameString();
}
}

std::string hxExhaustAirOutletNodeName;
// OutletNodeName
if (auto mo = modelObject.outletModelObject()) {
if (auto node = mo->optionalCast<Node>()) {
hxExhaustAirOutletNodeName = node->nameString();
// OutletNodeName
if (auto mo = modelObject.outletModelObject()) {
if (auto node = mo->optionalCast<Node>()) {
hxExhaustAirOutletNodeName = node->nameString();
}
}
} else if (auto comp_ = modelObject.containingHVACComponent()) {
if (auto coilSystem_ = comp_->optionalCast<CoilSystemCoolingWater>()) {
if (auto mo = coilSystem_->inletModelObject()) {
if (auto node = mo->optionalCast<Node>()) {
hxSupplyAirInletNodeName = node->nameString();
}
}
if (auto mo = coilSystem_->outletModelObject()) {
if (auto node = mo->optionalCast<Node>()) {
hxExhaustAirOutletNodeName = node->nameString();
}
}
Comment on lines +52 to +75
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CoilSystem_Cooling_Water_HeatExchangerAssisted: when translating it, we check if there's a inletModelobject, in which case this is directly added onto an AirLoopHVAC.

Otherwise, get the inlet/outlet air nodes from the parent CoilSystemCoolingWater object if any

}
}

Expand Down
Loading