src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACUnitHeater.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/ZoneHVACUnitHeater.hpp" | ||
| 13 | #include "../../model/ZoneHVACUnitHeater_Impl.hpp" | ||
| 14 | #include "../../model/ThermalZone.hpp" | ||
| 15 | #include "../../model/ThermalZone_Impl.hpp" | ||
| 16 | #include "../../model/CoilHeatingWater.hpp" | ||
| 17 | #include "../../model/CoilHeatingWater_Impl.hpp" | ||
| 18 | #include <utilities/idd/ZoneHVAC_UnitHeater_FieldEnums.hxx> | ||
| 19 | #include <utilities/idd/Fan_OnOff_FieldEnums.hxx> | ||
| 20 | #include <utilities/idd/Fan_ConstantVolume_FieldEnums.hxx> | ||
| 21 | #include <utilities/idd/Fan_VariableVolume_FieldEnums.hxx> | ||
| 22 | #include <utilities/idd/Fan_SystemModel_FieldEnums.hxx> | ||
| 23 | #include <utilities/idd/Coil_Heating_Water_FieldEnums.hxx> | ||
| 24 | #include <utilities/idd/Coil_Heating_Fuel_FieldEnums.hxx> | ||
| 25 | #include <utilities/idd/Coil_Heating_Electric_FieldEnums.hxx> | ||
| 26 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 27 | #include <utilities/idd/IddEnums.hxx> | ||
| 28 | #include <utilities/idd/IddFactory.hxx> | ||
| 29 | |||
| 30 | using namespace openstudio::model; | ||
| 31 | |||
| 32 | namespace openstudio { | ||
| 33 | |||
| 34 | namespace energyplus { | ||
| 35 | |||
| 36 | 4 | boost::optional<IdfObject> ForwardTranslator::translateZoneHVACUnitHeater(ZoneHVACUnitHeater& modelObject) { | |
| 37 | // Make sure the modelObject gets ut into the map, and the new idfObject gets put into the final file. | ||
| 38 | // Also sets the idfObjects name | ||
| 39 | |||
| 40 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | IdfObject idfObject = createRegisterAndNameIdfObject(IddObjectType::ZoneHVAC_UnitHeater, modelObject); |
| 41 | |||
| 42 | 4 | boost::optional<std::string> s; | |
| 43 | 4 | boost::optional<double> value; | |
| 44 | 4 | boost::optional<Node> node; | |
| 45 | |||
| 46 | // Get model object name and define node names for future use | ||
| 47 | |||
| 48 | // Model Name | ||
| 49 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | std::string baseName = modelObject.name().get(); |
| 50 | |||
| 51 | // Node Names | ||
| 52 |
1/1✓ Branch 1 taken 4 times.
|
4 | std::string fanOutletNodeName = baseName + " Fan Outlet Node"; |
| 53 | |||
| 54 | // Field: Availability Schedule Name | ||
| 55 | |||
| 56 |
1/1✓ Branch 1 taken 4 times.
|
4 | Schedule availabilitySchedule = modelObject.availabilitySchedule(); |
| 57 |
1/1✓ Branch 1 taken 4 times.
|
4 | translateAndMapModelObject(availabilitySchedule); |
| 58 | |||
| 59 |
1/1✓ Branch 1 taken 4 times.
|
4 | s = availabilitySchedule.name(); |
| 60 | |||
| 61 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (s) { |
| 62 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setString(ZoneHVAC_UnitHeaterFields::AvailabilityScheduleName, *s); |
| 63 | } | ||
| 64 | |||
| 65 | // Field: Air Inlet Node Name | ||
| 66 | |||
| 67 |
1/1✓ Branch 1 taken 4 times.
|
4 | node = modelObject.inletNode(); |
| 68 | |||
| 69 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (node) { |
| 70 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | s = node->name(); |
| 71 | |||
| 72 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (s) { |
| 73 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setString(ZoneHVAC_UnitHeaterFields::AirInletNodeName, *s); |
| 74 | } | ||
| 75 | } | ||
| 76 | |||
| 77 | // Field: Air Outlet Node Name | ||
| 78 | |||
| 79 |
1/1✓ Branch 1 taken 4 times.
|
4 | node = modelObject.outletNode(); |
| 80 | |||
| 81 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (node) { |
| 82 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | s = node->name(); |
| 83 | |||
| 84 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (s) { |
| 85 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setString(ZoneHVAC_UnitHeaterFields::AirOutletNodeName, *s); |
| 86 | } | ||
| 87 | } | ||
| 88 | |||
| 89 | //Field: Supply Air Fan Object Type | ||
| 90 | |||
| 91 |
1/1✓ Branch 1 taken 4 times.
|
4 | HVACComponent supplyAirFan = modelObject.supplyAirFan(); |
| 92 | |||
| 93 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (boost::optional<IdfObject> _supplyAirFan = translateAndMapModelObject(supplyAirFan)) { |
| 94 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
4 | idfObject.setString(ZoneHVAC_UnitHeaterFields::SupplyAirFanObjectType, _supplyAirFan->iddObject().name()); |
| 95 | 4 | } | |
| 96 | |||
| 97 | // Field: Supply Air Fan Name | ||
| 98 | |||
| 99 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | s = modelObject.supplyAirFan().name(); |
| 100 | |||
| 101 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (s) |
| 102 | |||
| 103 | { | ||
| 104 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setString(ZoneHVAC_UnitHeaterFields::SupplyAirFanName, *s); |
| 105 | } | ||
| 106 | |||
| 107 | // Supply Air Fan Inlet and Outlet Nodes | ||
| 108 | |||
| 109 |
1/1✓ Branch 1 taken 4 times.
|
4 | node = modelObject.inletNode(); |
| 110 | |||
| 111 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (boost::optional<IdfObject> _supplyAirFan = translateAndMapModelObject(supplyAirFan)) { |
| 112 | |||
| 113 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (node) { |
| 114 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | s = node->name(); |
| 115 | |||
| 116 |
6/6✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 14 taken 1 time.
✓ Branch 15 taken 3 times.
|
4 | if (_supplyAirFan->iddObject().type() == IddObjectType::Fan_ConstantVolume) { |
| 117 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | _supplyAirFan->setString(Fan_ConstantVolumeFields::AirInletNodeName, *s); |
| 118 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | _supplyAirFan->setString(Fan_ConstantVolumeFields::AirOutletNodeName, fanOutletNodeName); |
| 119 |
6/6✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 14 taken 1 time.
✓ Branch 15 taken 2 times.
|
3 | } else if (_supplyAirFan->iddObject().type() == IddObjectType::Fan_VariableVolume) { |
| 120 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | _supplyAirFan->setString(Fan_VariableVolumeFields::AirInletNodeName, *s); |
| 121 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | _supplyAirFan->setString(Fan_VariableVolumeFields::AirOutletNodeName, fanOutletNodeName); |
| 122 |
6/6✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 14 taken 1 time.
✓ Branch 15 taken 1 time.
|
2 | } else if (_supplyAirFan->iddObject().type() == IddObjectType::Fan_SystemModel) { |
| 123 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | _supplyAirFan->setString(Fan_SystemModelFields::AirInletNodeName, *s); |
| 124 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | _supplyAirFan->setString(Fan_SystemModelFields::AirOutletNodeName, fanOutletNodeName); |
| 125 |
5/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 14 taken 1 time.
✗ Branch 15 not taken.
|
1 | } else if (_supplyAirFan->iddObject().type() == IddObjectType::Fan_OnOff) { |
| 126 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | _supplyAirFan->setString(Fan_OnOffFields::AirInletNodeName, *s); |
| 127 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | _supplyAirFan->setString(Fan_OnOffFields::AirOutletNodeName, fanOutletNodeName); |
| 128 | } else { | ||
| 129 | ✗ | OS_ASSERT(false); // We're missing a fan type! | |
| 130 | } | ||
| 131 | } | ||
| 132 | 4 | } | |
| 133 | |||
| 134 | // Field Maximum Supply Air Flow Rate | ||
| 135 | |||
| 136 |
2/3✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
|
4 | if (modelObject.isMaximumSupplyAirFlowRateAutosized()) { |
| 137 | ✗ | idfObject.setString(ZoneHVAC_UnitHeaterFields::MaximumSupplyAirFlowRate, "Autosize"); | |
| 138 | } | ||
| 139 | |||
| 140 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | else if ((value = modelObject.maximumSupplyAirFlowRate())) { |
| 141 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(ZoneHVAC_UnitHeaterFields::MaximumSupplyAirFlowRate, *value); |
| 142 | } | ||
| 143 | |||
| 144 | // Field: Fan Control Type | ||
| 145 | // Maps to "Supply Air Fan Operation During No Heating" in 8.2.0 and above. | ||
| 146 | |||
| 147 |
4/5✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
|
8 | if (istringEqual(modelObject.fanControlType(), "ONOFF")) { |
| 148 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
8 | idfObject.setString(ZoneHVAC_UnitHeaterFields::SupplyAirFanOperationDuringNoHeating, "No"); |
| 149 | } else { | ||
| 150 | ✗ | idfObject.setString(ZoneHVAC_UnitHeaterFields::SupplyAirFanOperationDuringNoHeating, "Yes"); | |
| 151 | } | ||
| 152 | |||
| 153 | // Field: Heating Coil Object Type | ||
| 154 | |||
| 155 |
1/1✓ Branch 1 taken 4 times.
|
4 | HVACComponent heatingCoil = modelObject.heatingCoil(); |
| 156 | |||
| 157 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (boost::optional<IdfObject> _heatingCoil = translateAndMapModelObject(heatingCoil)) { |
| 158 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
4 | idfObject.setString(ZoneHVAC_UnitHeaterFields::HeatingCoilObjectType, _heatingCoil->iddObject().name()); |
| 159 | 4 | } | |
| 160 | |||
| 161 | // Field: Heating Coil Name | ||
| 162 | |||
| 163 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | s = modelObject.heatingCoil().name(); |
| 164 | |||
| 165 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (s) { |
| 166 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setString(ZoneHVAC_UnitHeaterFields::HeatingCoilName, *s); |
| 167 | } | ||
| 168 | |||
| 169 | // Heating coil inlet and outlet node names | ||
| 170 | |||
| 171 |
1/1✓ Branch 1 taken 4 times.
|
4 | node = modelObject.outletNode(); |
| 172 | |||
| 173 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (boost::optional<IdfObject> _heatingCoil = translateAndMapModelObject(heatingCoil)) { |
| 174 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (node) { |
| 175 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | s = node->name(); |
| 176 | |||
| 177 |
6/6✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 14 taken 2 times.
✓ Branch 15 taken 2 times.
|
4 | if (_heatingCoil->iddObject().type() == IddObjectType::Coil_Heating_Electric) { |
| 178 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | _heatingCoil->setString(Coil_Heating_ElectricFields::AirInletNodeName, fanOutletNodeName); |
| 179 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | _heatingCoil->setString(Coil_Heating_ElectricFields::AirOutletNodeName, *s); |
| 180 |
6/6✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 14 taken 1 time.
✓ Branch 15 taken 1 time.
|
2 | } else if (_heatingCoil->iddObject().type() == IddObjectType::Coil_Heating_Fuel) { |
| 181 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | _heatingCoil->setString(Coil_Heating_FuelFields::AirInletNodeName, fanOutletNodeName); |
| 182 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | _heatingCoil->setString(Coil_Heating_FuelFields::AirOutletNodeName, *s); |
| 183 |
5/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 14 taken 1 time.
✗ Branch 15 not taken.
|
1 | } else if (_heatingCoil->iddObject().type() == IddObjectType::Coil_Heating_Water) { |
| 184 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | _heatingCoil->setString(Coil_Heating_WaterFields::AirInletNodeName, fanOutletNodeName); |
| 185 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | _heatingCoil->setString(Coil_Heating_WaterFields::AirOutletNodeName, *s); |
| 186 | } else { | ||
| 187 | ✗ | OS_ASSERT(false); // We're missing a coil type! | |
| 188 | } | ||
| 189 | } | ||
| 190 | 4 | } | |
| 191 | |||
| 192 | // Field Maximum Hot Water [or Steam] Flow Rate | ||
| 193 | |||
| 194 |
2/3✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
|
4 | if (modelObject.isMaximumHotWaterFlowRateAutosized()) |
| 195 | |||
| 196 | { | ||
| 197 | ✗ | idfObject.setString(ZoneHVAC_UnitHeaterFields::MaximumHotWaterorSteamFlowRate, "Autosize"); | |
| 198 | } | ||
| 199 | |||
| 200 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | else if ((value = modelObject.maximumHotWaterFlowRate())) { |
| 201 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(ZoneHVAC_UnitHeaterFields::MaximumHotWaterorSteamFlowRate, *value); |
| 202 | } | ||
| 203 | |||
| 204 | // Field: Minimum Hot Water [or Steam] Flow Rate | ||
| 205 | |||
| 206 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(ZoneHVAC_UnitHeaterFields::MinimumHotWaterorSteamFlowRate, modelObject.minimumHotWaterFlowRate()); |
| 207 | |||
| 208 | // Field: Heating Convergence Tolerance | ||
| 209 | |||
| 210 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(ZoneHVAC_UnitHeaterFields::HeatingConvergenceTolerance, modelObject.heatingConvergenceTolerance()); |
| 211 | |||
| 212 | // Field: Availability Manager List Name: Ignored? | ||
| 213 | |||
| 214 |
1/1✓ Branch 1 taken 4 times.
|
8 | return idfObject; |
| 215 | 4 | } | |
| 216 | |||
| 217 | } // namespace energyplus | ||
| 218 | |||
| 219 | } // namespace openstudio | ||
| 220 |