src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACUnitVentilator.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #include "../ForwardTranslator.hpp" | ||
| 7 | #include "../../model/Model.hpp" | ||
| 8 | #include "../../model/Schedule.hpp" | ||
| 9 | #include "../../model/Schedule_Impl.hpp" | ||
| 10 | #include "../../model/Node.hpp" | ||
| 11 | #include "../../model/Node_Impl.hpp" | ||
| 12 | #include "../../model/ZoneHVACUnitVentilator.hpp" | ||
| 13 | #include "../../model/ZoneHVACUnitVentilator_Impl.hpp" | ||
| 14 | #include "../../model/ThermalZone.hpp" | ||
| 15 | #include "../../model/ThermalZone_Impl.hpp" | ||
| 16 | #include <utilities/idd/Coil_Cooling_Water_FieldEnums.hxx> | ||
| 17 | #include <utilities/idd/Coil_Heating_Electric_FieldEnums.hxx> | ||
| 18 | #include <utilities/idd/Coil_Heating_Fuel_FieldEnums.hxx> | ||
| 19 | #include <utilities/idd/Coil_Heating_Water_FieldEnums.hxx> | ||
| 20 | #include <utilities/idd/Fan_ConstantVolume_FieldEnums.hxx> | ||
| 21 | #include <utilities/idd/Fan_OnOff_FieldEnums.hxx> | ||
| 22 | #include <utilities/idd/Fan_VariableVolume_FieldEnums.hxx> | ||
| 23 | #include <utilities/idd/Fan_SystemModel_FieldEnums.hxx> | ||
| 24 | #include <utilities/idd/ZoneHVAC_UnitVentilator_FieldEnums.hxx> | ||
| 25 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 26 | #include <utilities/idd/IddEnums.hxx> | ||
| 27 | #include <utilities/idd/IddFactory.hxx> | ||
| 28 | |||
| 29 | using namespace openstudio::model; | ||
| 30 | |||
| 31 | namespace openstudio { | ||
| 32 | |||
| 33 | namespace energyplus { | ||
| 34 | |||
| 35 | ✗ | boost::optional<IdfObject> ForwardTranslator::translateZoneHVACUnitVentilator(ZoneHVACUnitVentilator& modelObject) { | |
| 36 | ✗ | boost::optional<std::string> s; | |
| 37 | ✗ | boost::optional<double> value; | |
| 38 | ✗ | boost::optional<ModelObject> temp; | |
| 39 | |||
| 40 | // Model Name | ||
| 41 | ✗ | std::string const baseName = modelObject.name().get(); | |
| 42 | // Node Names | ||
| 43 | ✗ | std::string const mixedAirNodeName = baseName + " Mixed Air Node"; | |
| 44 | ✗ | std::string const fanOutletNodeName = baseName + " Fan Outlet Node"; | |
| 45 | ✗ | std::string const coolingCoilOutletNodeName = baseName + " Cooling Coil Outlet Node"; | |
| 46 | ✗ | std::string const reliefAirNodeName = baseName + " Relief Air Node"; | |
| 47 | ✗ | std::string const exhaustAirNodeName = baseName + " Exhaust Air Node"; | |
| 48 | ✗ | std::string const oaNodeName = baseName + " OA Node"; | |
| 49 | |||
| 50 | // Name | ||
| 51 | ✗ | IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::ZoneHVAC_UnitVentilator, modelObject); | |
| 52 | |||
| 53 | // AvailabilityScheduleName | ||
| 54 | { | ||
| 55 | ✗ | auto schedule = modelObject.availabilitySchedule(); | |
| 56 | ✗ | if (auto _schedule = translateAndMapModelObject(schedule)) { | |
| 57 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::AvailabilityScheduleName, _schedule->name().get()); | |
| 58 | ✗ | } | |
| 59 | ✗ | } | |
| 60 | |||
| 61 | // MaximumSupplyAirFlowRate | ||
| 62 | ✗ | if (modelObject.isMaximumSupplyAirFlowRateAutosized()) { | |
| 63 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::MaximumSupplyAirFlowRate, "AutoSize"); | |
| 64 | ✗ | } else if ((value = modelObject.maximumSupplyAirFlowRate())) { | |
| 65 | ✗ | idfObject.setDouble(ZoneHVAC_UnitVentilatorFields::MaximumSupplyAirFlowRate, value.get()); | |
| 66 | } | ||
| 67 | |||
| 68 | // OutdoorAirControlType | ||
| 69 | ✗ | if ((s = modelObject.outdoorAirControlType())) { | |
| 70 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::OutdoorAirControlType, s.get()); | |
| 71 | } | ||
| 72 | |||
| 73 | // MinimumOutdoorAirFlowRate | ||
| 74 | ✗ | if (modelObject.isMinimumOutdoorAirFlowRateAutosized()) { | |
| 75 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::MinimumOutdoorAirFlowRate, "AutoSize"); | |
| 76 | ✗ | } else if ((value = modelObject.minimumOutdoorAirFlowRate())) { | |
| 77 | ✗ | idfObject.setDouble(ZoneHVAC_UnitVentilatorFields::MinimumOutdoorAirFlowRate, value.get()); | |
| 78 | } | ||
| 79 | |||
| 80 | // MinimumOutdoorAirScheduleName | ||
| 81 | { | ||
| 82 | ✗ | auto schedule = modelObject.minimumOutdoorAirSchedule(); | |
| 83 | ✗ | if (auto _schedule = translateAndMapModelObject(schedule)) { | |
| 84 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::MinimumOutdoorAirScheduleName, _schedule->name().get()); | |
| 85 | ✗ | } | |
| 86 | ✗ | } | |
| 87 | |||
| 88 | // MaximumOutdoorAirFlowRate | ||
| 89 | ✗ | if (modelObject.isMaximumOutdoorAirFlowRateAutosized()) { | |
| 90 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::MaximumOutdoorAirFlowRate, "AutoSize"); | |
| 91 | ✗ | } else if ((value = modelObject.maximumOutdoorAirFlowRate())) { | |
| 92 | ✗ | idfObject.setDouble(ZoneHVAC_UnitVentilatorFields::MaximumOutdoorAirFlowRate, value.get()); | |
| 93 | } | ||
| 94 | |||
| 95 | // MaximumOutdoorAirFractionorTemperatureScheduleName | ||
| 96 | { | ||
| 97 | ✗ | auto schedule = modelObject.maximumOutdoorAirFractionorTemperatureSchedule(); | |
| 98 | ✗ | if (auto _schedule = translateAndMapModelObject(schedule)) { | |
| 99 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::MaximumOutdoorAirFractionorTemperatureScheduleName, _schedule->name().get()); | |
| 100 | ✗ | } | |
| 101 | ✗ | } | |
| 102 | |||
| 103 | // AirInletNodeName | ||
| 104 | ✗ | auto airInletNode = modelObject.inletNode(); | |
| 105 | ✗ | if (airInletNode) { | |
| 106 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::AirInletNodeName, airInletNode->name().get()); | |
| 107 | } | ||
| 108 | |||
| 109 | // AirOutletNodeName | ||
| 110 | ✗ | auto airOutletNode = modelObject.outletNode(); | |
| 111 | ✗ | if (airOutletNode) { | |
| 112 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::AirOutletNodeName, airOutletNode->name().get()); | |
| 113 | } | ||
| 114 | |||
| 115 | // OutdoorAirNodeName | ||
| 116 | // ExhaustAirNodeName | ||
| 117 | // MixedAirNodeName | ||
| 118 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::MixedAirNodeName, mixedAirNodeName); | |
| 119 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::OutdoorAirNodeName, oaNodeName); | |
| 120 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::ExhaustAirNodeName, exhaustAirNodeName); | |
| 121 | ✗ | IdfObject _oaNodeList(openstudio::IddObjectType::OutdoorAir_NodeList); | |
| 122 | ✗ | _oaNodeList.setString(0, oaNodeName); | |
| 123 | ✗ | m_idfObjects.push_back(_oaNodeList); | |
| 124 | |||
| 125 | // Supply Air Fan | ||
| 126 | { | ||
| 127 | ✗ | auto supplyAirFan = modelObject.supplyAirFan(); | |
| 128 | ✗ | if (auto _supplyAirFan = translateAndMapModelObject(supplyAirFan)) { | |
| 129 | // SupplyAirFanObjectType | ||
| 130 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::SupplyAirFanObjectType, _supplyAirFan->iddObject().name()); | |
| 131 | |||
| 132 | // SupplyAirFanName | ||
| 133 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::SupplyAirFanName, _supplyAirFan->name().get()); | |
| 134 | // Supply Air Fan Inlet and Outlet Nodes | ||
| 135 | ✗ | if (_supplyAirFan->iddObject().type() == IddObjectType::Fan_ConstantVolume) { | |
| 136 | ✗ | _supplyAirFan->setString(Fan_ConstantVolumeFields::AirInletNodeName, mixedAirNodeName); | |
| 137 | ✗ | _supplyAirFan->setString(Fan_ConstantVolumeFields::AirOutletNodeName, fanOutletNodeName); | |
| 138 | ✗ | } else if (_supplyAirFan->iddObject().type() == IddObjectType::Fan_OnOff) { | |
| 139 | |||
| 140 | ✗ | _supplyAirFan->setString(Fan_OnOffFields::AirInletNodeName, mixedAirNodeName); | |
| 141 | ✗ | _supplyAirFan->setString(Fan_OnOffFields::AirOutletNodeName, fanOutletNodeName); | |
| 142 | ✗ | } else if (_supplyAirFan->iddObject().type() == IddObjectType::Fan_VariableVolume) { | |
| 143 | ✗ | _supplyAirFan->setString(Fan_VariableVolumeFields::AirInletNodeName, mixedAirNodeName); | |
| 144 | ✗ | _supplyAirFan->setString(Fan_VariableVolumeFields::AirOutletNodeName, fanOutletNodeName); | |
| 145 | ✗ | } else if (_supplyAirFan->iddObject().type() == IddObjectType::Fan_SystemModel) { | |
| 146 | |||
| 147 | ✗ | _supplyAirFan->setString(Fan_SystemModelFields::AirInletNodeName, mixedAirNodeName); | |
| 148 | ✗ | _supplyAirFan->setString(Fan_SystemModelFields::AirOutletNodeName, fanOutletNodeName); | |
| 149 | } | ||
| 150 | ✗ | } | |
| 151 | ✗ | } | |
| 152 | |||
| 153 | // CoilOption | ||
| 154 | ✗ | auto heatingCoil = modelObject.heatingCoil(); | |
| 155 | ✗ | auto coolingCoil = modelObject.coolingCoil(); | |
| 156 | |||
| 157 | // Cooling Coil | ||
| 158 | { | ||
| 159 | ✗ | if (coolingCoil && airOutletNode) { | |
| 160 | ✗ | if (auto _coolingCoil = translateAndMapModelObject(coolingCoil.get())) { | |
| 161 | // CoolingCoilObjectType | ||
| 162 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::CoolingCoilObjectType, _coolingCoil->iddObject().name()); | |
| 163 | // CoolingCoilName | ||
| 164 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::CoolingCoilName, _coolingCoil->name().get()); | |
| 165 | // Cooling Coil Inlet and Outlet Nodes | ||
| 166 | ✗ | auto coolingCoilOutletName = heatingCoil ? coolingCoilOutletNodeName : airOutletNode->name().get(); | |
| 167 | |||
| 168 | ✗ | if (_coolingCoil->iddObject().type() == IddObjectType::Coil_Cooling_Water) { | |
| 169 | ✗ | _coolingCoil->setString(Coil_Cooling_WaterFields::AirInletNodeName, fanOutletNodeName); | |
| 170 | ✗ | _coolingCoil->setString(Coil_Cooling_WaterFields::AirOutletNodeName, coolingCoilOutletName); | |
| 171 | } | ||
| 172 | ✗ | } | |
| 173 | } | ||
| 174 | } | ||
| 175 | |||
| 176 | // Heating Coil | ||
| 177 | { | ||
| 178 | ✗ | if (heatingCoil && airOutletNode) { | |
| 179 | ✗ | if (auto _heatingCoil = translateAndMapModelObject(heatingCoil.get())) { | |
| 180 | // HeatingCoilObjectType | ||
| 181 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::HeatingCoilObjectType, _heatingCoil->iddObject().name()); | |
| 182 | // HeatingCoilName | ||
| 183 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::HeatingCoilName, _heatingCoil->name().get()); | |
| 184 | // Heating Coil Inlet and Outlet Nodes | ||
| 185 | ✗ | auto heatingCoilOutletName = coolingCoil ? coolingCoilOutletNodeName : fanOutletNodeName; | |
| 186 | |||
| 187 | ✗ | if (_heatingCoil->iddObject().type() == IddObjectType::Coil_Heating_Electric) { | |
| 188 | ✗ | _heatingCoil->setString(Coil_Heating_ElectricFields::AirInletNodeName, heatingCoilOutletName); | |
| 189 | ✗ | _heatingCoil->setString(Coil_Heating_ElectricFields::AirOutletNodeName, airOutletNode->name().get()); | |
| 190 | ✗ | } else if (_heatingCoil->iddObject().type() == IddObjectType::Coil_Heating_Fuel) { | |
| 191 | ✗ | _heatingCoil->setString(Coil_Heating_FuelFields::AirInletNodeName, heatingCoilOutletName); | |
| 192 | ✗ | _heatingCoil->setString(Coil_Heating_FuelFields::AirOutletNodeName, airOutletNode->name().get()); | |
| 193 | ✗ | } else if (_heatingCoil->iddObject().type() == IddObjectType::Coil_Heating_Water) { | |
| 194 | ✗ | _heatingCoil->setString(Coil_Heating_WaterFields::AirInletNodeName, heatingCoilOutletName); | |
| 195 | ✗ | _heatingCoil->setString(Coil_Heating_WaterFields::AirOutletNodeName, airOutletNode->name().get()); | |
| 196 | } | ||
| 197 | ✗ | } | |
| 198 | } | ||
| 199 | } | ||
| 200 | |||
| 201 | ✗ | if (heatingCoil && coolingCoil) { | |
| 202 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::CoilOption, "HeatingAndCooling"); | |
| 203 | ✗ | } else if (heatingCoil) { | |
| 204 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::CoilOption, "Heating"); | |
| 205 | ✗ | } else if (coolingCoil) { | |
| 206 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::CoilOption, "Cooling"); | |
| 207 | } else { | ||
| 208 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::CoilOption, "None"); | |
| 209 | } | ||
| 210 | |||
| 211 | // SupplyAirFanOperatingModeScheduleName | ||
| 212 | ✗ | if ((temp = modelObject.supplyAirFanOperatingModeSchedule())) { | |
| 213 | ✗ | if (auto _schedule = translateAndMapModelObject(temp.get())) { | |
| 214 | ✗ | idfObject.setString(ZoneHVAC_UnitVentilatorFields::SupplyAirFanOperatingModeScheduleName, _schedule->name().get()); | |
| 215 | ✗ | } | |
| 216 | } | ||
| 217 | |||
| 218 | // HeatingConvergenceTolerance | ||
| 219 | ✗ | if ((value = modelObject.heatingConvergenceTolerance())) { | |
| 220 | ✗ | idfObject.setDouble(ZoneHVAC_UnitVentilatorFields::HeatingConvergenceTolerance, value.get()); | |
| 221 | } | ||
| 222 | |||
| 223 | // CoolingConvergenceTolerance | ||
| 224 | ✗ | if ((value = modelObject.coolingConvergenceTolerance())) { | |
| 225 | ✗ | idfObject.setDouble(ZoneHVAC_UnitVentilatorFields::CoolingConvergenceTolerance, value.get()); | |
| 226 | } | ||
| 227 | |||
| 228 | // AvailabilityManagerListName | ||
| 229 | // DesignSpecificationZoneHVACSizingObjectName | ||
| 230 | |||
| 231 | ✗ | return idfObject; | |
| 232 | ✗ | } | |
| 233 | |||
| 234 | } // namespace energyplus | ||
| 235 | |||
| 236 | } // namespace openstudio | ||
| 237 |