src/model/ZoneHVACUnitHeater.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 "ZoneHVACUnitHeater.hpp" | ||
| 7 | #include "ZoneHVACUnitHeater_Impl.hpp" | ||
| 8 | |||
| 9 | #include "Schedule.hpp" | ||
| 10 | #include "Schedule_Impl.hpp" | ||
| 11 | #include "HVACComponent.hpp" | ||
| 12 | #include "HVACComponent_Impl.hpp" | ||
| 13 | #include "CoilHeatingWater.hpp" | ||
| 14 | #include "CoilHeatingWater_Impl.hpp" | ||
| 15 | #include "ScheduleTypeLimits.hpp" | ||
| 16 | #include "ScheduleTypeRegistry.hpp" | ||
| 17 | #include "Model.hpp" | ||
| 18 | #include "Model_Impl.hpp" | ||
| 19 | |||
| 20 | #include <utilities/idd/IddFactory.hxx> | ||
| 21 | |||
| 22 | #include <utilities/idd/OS_ZoneHVAC_UnitHeater_FieldEnums.hxx> | ||
| 23 | #include <utilities/idd/IddEnums.hxx> | ||
| 24 | |||
| 25 | #include "../utilities/core/Assert.hpp" | ||
| 26 | #include "../utilities/data/DataEnums.hpp" | ||
| 27 | |||
| 28 | namespace openstudio { | ||
| 29 | namespace model { | ||
| 30 | |||
| 31 | namespace detail { | ||
| 32 | |||
| 33 | 13 | ZoneHVACUnitHeater_Impl::ZoneHVACUnitHeater_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 34 | 13 | : ZoneHVACComponent_Impl(idfObject, model, keepHandle) { | |
| 35 |
4/6✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 7 taken 13 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 13 times.
✗ Branch 13 not taken.
|
13 | OS_ASSERT(idfObject.iddObject().type() == ZoneHVACUnitHeater::iddObjectType()); |
| 36 | 13 | } | |
| 37 | |||
| 38 | ✗ | ZoneHVACUnitHeater_Impl::ZoneHVACUnitHeater_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 39 | ✗ | : ZoneHVACComponent_Impl(other, model, keepHandle) { | |
| 40 | ✗ | OS_ASSERT(other.iddObject().type() == ZoneHVACUnitHeater::iddObjectType()); | |
| 41 | ✗ | } | |
| 42 | |||
| 43 | 9 | ZoneHVACUnitHeater_Impl::ZoneHVACUnitHeater_Impl(const ZoneHVACUnitHeater_Impl& other, Model_Impl* model, bool keepHandle) | |
| 44 | 9 | : ZoneHVACComponent_Impl(other, model, keepHandle) {} | |
| 45 | |||
| 46 | 2 | ModelObject ZoneHVACUnitHeater_Impl::clone(Model model) const { | |
| 47 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | auto unitHeaterClone = ZoneHVACComponent_Impl::clone(model).cast<ZoneHVACUnitHeater>(); |
| 48 | |||
| 49 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | auto supplyFanClone = this->supplyAirFan().clone(model).cast<HVACComponent>(); |
| 50 | |||
| 51 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto t_heatingCoil = heatingCoil(); |
| 52 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | auto heatingCoilClone = t_heatingCoil.clone(model).cast<HVACComponent>(); |
| 53 | |||
| 54 |
1/1✓ Branch 1 taken 2 times.
|
2 | unitHeaterClone.setSupplyAirFan(supplyFanClone); |
| 55 | |||
| 56 |
1/1✓ Branch 1 taken 2 times.
|
2 | unitHeaterClone.setHeatingCoil(heatingCoilClone); |
| 57 | |||
| 58 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
|
2 | if (model == this->model()) { |
| 59 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (auto waterToAirComponent = t_heatingCoil.optionalCast<WaterToAirComponent>()) { |
| 60 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
|
4 | if (auto plant = waterToAirComponent->plantLoop()) { |
| 61 | ✗ | plant->addDemandBranchForComponent(heatingCoilClone); | |
| 62 | 2 | } | |
| 63 | 2 | } | |
| 64 | } | ||
| 65 | |||
| 66 | 4 | return std::move(unitHeaterClone); | |
| 67 | 2 | } | |
| 68 | |||
| 69 | ✗ | std::vector<IdfObject> ZoneHVACUnitHeater_Impl::remove() { | |
| 70 | ✗ | if (boost::optional<CoilHeatingWater> waterHeatingCoil = heatingCoil().optionalCast<CoilHeatingWater>()) { | |
| 71 | ✗ | if (boost::optional<PlantLoop> plantLoop = waterHeatingCoil->plantLoop()) { | |
| 72 | ✗ | plantLoop->removeDemandBranchWithComponent(waterHeatingCoil.get()); | |
| 73 | ✗ | } | |
| 74 | ✗ | } | |
| 75 | ✗ | return ZoneHVACComponent_Impl::remove(); | |
| 76 | } | ||
| 77 | |||
| 78 | ✗ | const std::vector<std::string>& ZoneHVACUnitHeater_Impl::outputVariableNames() const { | |
| 79 | static const std::vector<std::string> result{ | ||
| 80 | "Zone Unit Heater Heating Rate", "Zone Unit Heater Heating Energy", "Zone Unit Heater Fan Electricity Rate", | ||
| 81 | ✗ | "Zone Unit Heater Fan Electricity Energy", "Zone Unit Heater Fan Availability Status", "Zone Unit Heater Fan Part Load Ratio"}; | |
| 82 | ✗ | return result; | |
| 83 | ✗ | } | |
| 84 | |||
| 85 | 16 | IddObjectType ZoneHVACUnitHeater_Impl::iddObjectType() const { | |
| 86 | 16 | return ZoneHVACUnitHeater::iddObjectType(); | |
| 87 | } | ||
| 88 | |||
| 89 | ✗ | std::vector<ScheduleTypeKey> ZoneHVACUnitHeater_Impl::getScheduleTypeKeys(const Schedule& schedule) const { | |
| 90 | ✗ | std::vector<ScheduleTypeKey> result; | |
| 91 | ✗ | UnsignedVector fieldIndices = getSourceIndices(schedule.handle()); | |
| 92 | ✗ | UnsignedVector::const_iterator b(fieldIndices.begin()); | |
| 93 | ✗ | UnsignedVector::const_iterator e(fieldIndices.end()); | |
| 94 | |||
| 95 | ✗ | if (std::find(b, e, OS_ZoneHVAC_UnitHeaterFields::AvailabilityScheduleName) != e) { | |
| 96 | ✗ | result.push_back(ScheduleTypeKey("ZoneHVACUnitHeater", "Availability")); | |
| 97 | } | ||
| 98 | ✗ | return result; | |
| 99 | ✗ | } | |
| 100 | |||
| 101 | 4 | std::vector<ModelObject> ZoneHVACUnitHeater_Impl::children() const { | |
| 102 | 4 | std::vector<ModelObject> result; | |
| 103 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (OptionalHVACComponent intermediate = optionalSupplyAirFan()) { |
| 104 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | result.push_back(*intermediate); |
| 105 | 4 | } | |
| 106 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (OptionalHVACComponent intermediate = optionalHeatingCoil()) { |
| 107 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | result.push_back(*intermediate); |
| 108 | 4 | } | |
| 109 | 4 | return result; | |
| 110 | ✗ | } | |
| 111 | |||
| 112 | 51 | unsigned ZoneHVACUnitHeater_Impl::inletPort() const { | |
| 113 | 51 | return OS_ZoneHVAC_UnitHeaterFields::AirInletNodeName; | |
| 114 | } | ||
| 115 | |||
| 116 | 38 | unsigned ZoneHVACUnitHeater_Impl::outletPort() const { | |
| 117 | 38 | return OS_ZoneHVAC_UnitHeaterFields::AirOutletNodeName; | |
| 118 | } | ||
| 119 | |||
| 120 | 9 | Schedule ZoneHVACUnitHeater_Impl::availabilitySchedule() const { | |
| 121 |
1/1✓ Branch 1 taken 9 times.
|
9 | boost::optional<Schedule> value = optionalAvailabilitySchedule(); |
| 122 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
|
9 | if (!value) { |
| 123 | ✗ | LOG_AND_THROW(briefDescription() << " does not have an Availability Schedule attached."); | |
| 124 | } | ||
| 125 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
18 | return value.get(); |
| 126 | 9 | } | |
| 127 | |||
| 128 | 17 | HVACComponent ZoneHVACUnitHeater_Impl::supplyAirFan() const { | |
| 129 |
1/1✓ Branch 1 taken 17 times.
|
17 | boost::optional<HVACComponent> value = optionalSupplyAirFan(); |
| 130 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
|
17 | if (!value) { |
| 131 | ✗ | LOG_AND_THROW(briefDescription() << " does not have an Supply Air Fan attached."); | |
| 132 | } | ||
| 133 |
2/2✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
|
34 | return value.get(); |
| 134 | 17 | } | |
| 135 | |||
| 136 | 5 | boost::optional<double> ZoneHVACUnitHeater_Impl::maximumSupplyAirFlowRate() const { | |
| 137 | 5 | return getDouble(OS_ZoneHVAC_UnitHeaterFields::MaximumSupplyAirFlowRate, true); | |
| 138 | } | ||
| 139 | |||
| 140 | 6 | bool ZoneHVACUnitHeater_Impl::isMaximumSupplyAirFlowRateAutosized() const { | |
| 141 | |||
| 142 | 6 | bool result = false; | |
| 143 |
1/1✓ Branch 1 taken 6 times.
|
6 | boost::optional<std::string> value = getString(OS_ZoneHVAC_UnitHeaterFields::MaximumSupplyAirFlowRate, true); |
| 144 | |||
| 145 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if (value) { |
| 146 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
12 | result = openstudio::istringEqual(value.get(), "autosize"); |
| 147 | } | ||
| 148 | 6 | return result; | |
| 149 | 6 | } | |
| 150 | |||
| 151 | 5 | std::string ZoneHVACUnitHeater_Impl::fanControlType() const { | |
| 152 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<std::string> value = getString(OS_ZoneHVAC_UnitHeaterFields::FanControlType, true); |
| 153 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(value); |
| 154 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
10 | return value.get(); |
| 155 | 5 | } | |
| 156 | |||
| 157 | 15 | HVACComponent ZoneHVACUnitHeater_Impl::heatingCoil() const { | |
| 158 |
1/1✓ Branch 1 taken 15 times.
|
15 | boost::optional<HVACComponent> value = optionalHeatingCoil(); |
| 159 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
|
15 | if (!value) { |
| 160 | ✗ | LOG_AND_THROW(briefDescription() << " does not have an Heating Coil attached."); | |
| 161 | } | ||
| 162 |
2/2✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
|
30 | return value.get(); |
| 163 | 15 | } | |
| 164 | |||
| 165 | 6 | boost::optional<double> ZoneHVACUnitHeater_Impl::maximumHotWaterFlowRate() const { | |
| 166 | 6 | return getDouble(OS_ZoneHVAC_UnitHeaterFields::MaximumHotWaterFlowRate, true); | |
| 167 | } | ||
| 168 | |||
| 169 | 6 | bool ZoneHVACUnitHeater_Impl::isMaximumHotWaterFlowRateAutosized() const { | |
| 170 | 6 | bool result = false; | |
| 171 |
1/1✓ Branch 1 taken 6 times.
|
6 | boost::optional<std::string> value = getString(OS_ZoneHVAC_UnitHeaterFields::MaximumHotWaterFlowRate, true); |
| 172 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if (value) { |
| 173 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
12 | result = openstudio::istringEqual(value.get(), "autosize"); |
| 174 | } | ||
| 175 | 6 | return result; | |
| 176 | 6 | } | |
| 177 | |||
| 178 | 6 | double ZoneHVACUnitHeater_Impl::minimumHotWaterFlowRate() const { | |
| 179 |
1/1✓ Branch 1 taken 6 times.
|
6 | boost::optional<double> value = getDouble(OS_ZoneHVAC_UnitHeaterFields::MinimumHotWaterFlowRate, true); |
| 180 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
|
6 | OS_ASSERT(value); |
| 181 |
1/1✓ Branch 1 taken 6 times.
|
12 | return value.get(); |
| 182 | } | ||
| 183 | |||
| 184 | 2 | bool ZoneHVACUnitHeater_Impl::isMinimumHotWaterFlowRateDefaulted() const { | |
| 185 | 2 | return isEmpty(OS_ZoneHVAC_UnitHeaterFields::MinimumHotWaterFlowRate); | |
| 186 | } | ||
| 187 | |||
| 188 | 6 | double ZoneHVACUnitHeater_Impl::heatingConvergenceTolerance() const { | |
| 189 |
1/1✓ Branch 1 taken 6 times.
|
6 | boost::optional<double> value = getDouble(OS_ZoneHVAC_UnitHeaterFields::HeatingConvergenceTolerance, true); |
| 190 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
|
6 | OS_ASSERT(value); |
| 191 |
1/1✓ Branch 1 taken 6 times.
|
12 | return value.get(); |
| 192 | } | ||
| 193 | |||
| 194 | 2 | bool ZoneHVACUnitHeater_Impl::isHeatingConvergenceToleranceDefaulted() const { | |
| 195 | 2 | return isEmpty(OS_ZoneHVAC_UnitHeaterFields::HeatingConvergenceTolerance); | |
| 196 | } | ||
| 197 | |||
| 198 | 14 | bool ZoneHVACUnitHeater_Impl::setAvailabilitySchedule(Schedule& schedule) { | |
| 199 |
3/3✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
|
56 | bool result = setSchedule(OS_ZoneHVAC_UnitHeaterFields::AvailabilityScheduleName, "ZoneHVACUnitHeater", "Availability", schedule); |
| 200 | 14 | return result; | |
| 201 | } | ||
| 202 | |||
| 203 | 16 | bool ZoneHVACUnitHeater_Impl::setSupplyAirFan(const HVACComponent& HVACComponent) { | |
| 204 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | bool result = setPointer(OS_ZoneHVAC_UnitHeaterFields::SupplyAirFanName, HVACComponent.handle()); |
| 205 | 16 | return result; | |
| 206 | } | ||
| 207 | |||
| 208 | 5 | bool ZoneHVACUnitHeater_Impl::setMaximumSupplyAirFlowRate(boost::optional<double> maximumSupplyAirFlowRate) { | |
| 209 | 5 | bool result(false); | |
| 210 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (maximumSupplyAirFlowRate) { |
| 211 | 5 | result = setDouble(OS_ZoneHVAC_UnitHeaterFields::MaximumSupplyAirFlowRate, maximumSupplyAirFlowRate.get()); | |
| 212 | } | ||
| 213 | |||
| 214 | 5 | return result; | |
| 215 | } | ||
| 216 | |||
| 217 | 14 | void ZoneHVACUnitHeater_Impl::autosizeMaximumSupplyAirFlowRate() { | |
| 218 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
28 | bool result = setString(OS_ZoneHVAC_UnitHeaterFields::MaximumSupplyAirFlowRate, "autosize"); |
| 219 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | OS_ASSERT(result); |
| 220 | 14 | } | |
| 221 | |||
| 222 | 20 | bool ZoneHVACUnitHeater_Impl::setFanControlType(const std::string& fanControlType) { | |
| 223 | 20 | bool result = setString(OS_ZoneHVAC_UnitHeaterFields::FanControlType, fanControlType); | |
| 224 | 20 | return result; | |
| 225 | } | ||
| 226 | |||
| 227 | 16 | bool ZoneHVACUnitHeater_Impl::setHeatingCoil(const HVACComponent& heatingCoil) { | |
| 228 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | bool result = setPointer(OS_ZoneHVAC_UnitHeaterFields::HeatingCoilName, heatingCoil.handle()); |
| 229 | 16 | return result; | |
| 230 | } | ||
| 231 | |||
| 232 | 5 | bool ZoneHVACUnitHeater_Impl::setMaximumHotWaterFlowRate(boost::optional<double> maximumHotWaterFlowRate) { | |
| 233 | 5 | bool result(false); | |
| 234 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (maximumHotWaterFlowRate) { |
| 235 | 5 | result = setDouble(OS_ZoneHVAC_UnitHeaterFields::MaximumHotWaterFlowRate, maximumHotWaterFlowRate.get()); | |
| 236 | } else { | ||
| 237 | ✗ | resetMaximumHotWaterFlowRate(); | |
| 238 | ✗ | result = true; | |
| 239 | } | ||
| 240 | |||
| 241 | 5 | return result; | |
| 242 | } | ||
| 243 | |||
| 244 | 1 | void ZoneHVACUnitHeater_Impl::resetMaximumHotWaterFlowRate() { | |
| 245 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_ZoneHVAC_UnitHeaterFields::MaximumHotWaterFlowRate, ""); |
| 246 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 247 | 1 | } | |
| 248 | |||
| 249 | 14 | void ZoneHVACUnitHeater_Impl::autosizeMaximumHotWaterFlowRate() { | |
| 250 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
28 | bool result = setString(OS_ZoneHVAC_UnitHeaterFields::MaximumHotWaterFlowRate, "autosize"); |
| 251 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | OS_ASSERT(result); |
| 252 | 14 | } | |
| 253 | |||
| 254 | 18 | bool ZoneHVACUnitHeater_Impl::setMinimumHotWaterFlowRate(double minimumHotWaterFlowRate) { | |
| 255 | 18 | bool result = setDouble(OS_ZoneHVAC_UnitHeaterFields::MinimumHotWaterFlowRate, minimumHotWaterFlowRate); | |
| 256 | 18 | return result; | |
| 257 | } | ||
| 258 | |||
| 259 | 1 | void ZoneHVACUnitHeater_Impl::resetMinimumHotWaterFlowRate() { | |
| 260 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_ZoneHVAC_UnitHeaterFields::MinimumHotWaterFlowRate, ""); |
| 261 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 262 | 1 | } | |
| 263 | |||
| 264 | 18 | bool ZoneHVACUnitHeater_Impl::setHeatingConvergenceTolerance(double heatingConvergenceTolerance) { | |
| 265 | 18 | bool result = setDouble(OS_ZoneHVAC_UnitHeaterFields::HeatingConvergenceTolerance, heatingConvergenceTolerance); | |
| 266 | 18 | return result; | |
| 267 | } | ||
| 268 | |||
| 269 | 1 | void ZoneHVACUnitHeater_Impl::resetHeatingConvergenceTolerance() { | |
| 270 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_ZoneHVAC_UnitHeaterFields::HeatingConvergenceTolerance, ""); |
| 271 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 272 | 1 | } | |
| 273 | |||
| 274 | 9 | boost::optional<Schedule> ZoneHVACUnitHeater_Impl::optionalAvailabilitySchedule() const { | |
| 275 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
9 | return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_ZoneHVAC_UnitHeaterFields::AvailabilityScheduleName); |
| 276 | } | ||
| 277 | |||
| 278 | 21 | boost::optional<HVACComponent> ZoneHVACUnitHeater_Impl::optionalSupplyAirFan() const { | |
| 279 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | return getObject<ModelObject>().getModelObjectTarget<HVACComponent>(OS_ZoneHVAC_UnitHeaterFields::SupplyAirFanName); |
| 280 | } | ||
| 281 | |||
| 282 | 19 | boost::optional<HVACComponent> ZoneHVACUnitHeater_Impl::optionalHeatingCoil() const { | |
| 283 |
2/2✓ Branch 1 taken 19 times.
✓ Branch 4 taken 19 times.
|
19 | return getObject<ModelObject>().getModelObjectTarget<HVACComponent>(OS_ZoneHVAC_UnitHeaterFields::HeatingCoilName); |
| 284 | } | ||
| 285 | |||
| 286 | ✗ | std::vector<std::string> ZoneHVACUnitHeater_Impl::fanControlTypeValues() const { | |
| 287 | ✗ | return ZoneHVACUnitHeater::fanControlTypeValues(); | |
| 288 | } | ||
| 289 | |||
| 290 | ✗ | boost::optional<ModelObject> ZoneHVACUnitHeater_Impl::availabilityScheduleAsModelObject() const { | |
| 291 | ✗ | OptionalModelObject result = availabilitySchedule(); | |
| 292 | ✗ | return result; | |
| 293 | } | ||
| 294 | |||
| 295 | ✗ | boost::optional<ModelObject> ZoneHVACUnitHeater_Impl::supplyAirFanAsModelObject() const { | |
| 296 | ✗ | OptionalModelObject result = supplyAirFan(); | |
| 297 | ✗ | return result; | |
| 298 | } | ||
| 299 | |||
| 300 | ✗ | boost::optional<ModelObject> ZoneHVACUnitHeater_Impl::heatingCoilAsModelObject() const { | |
| 301 | ✗ | OptionalModelObject result = heatingCoil(); | |
| 302 | ✗ | return result; | |
| 303 | } | ||
| 304 | |||
| 305 | ✗ | bool ZoneHVACUnitHeater_Impl::setAvailabilityScheduleAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 306 | ✗ | if (modelObject) { | |
| 307 | ✗ | OptionalSchedule intermediate = modelObject->optionalCast<Schedule>(); | |
| 308 | |||
| 309 | ✗ | if (intermediate) { | |
| 310 | ✗ | Schedule schedule(*intermediate); | |
| 311 | ✗ | return setAvailabilitySchedule(schedule); | |
| 312 | ✗ | } | |
| 313 | ✗ | } | |
| 314 | ✗ | return false; | |
| 315 | } | ||
| 316 | |||
| 317 | ✗ | bool ZoneHVACUnitHeater_Impl::setSupplyAirFanAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 318 | ✗ | if (modelObject) { | |
| 319 | ✗ | OptionalHVACComponent intermediate = modelObject->optionalCast<HVACComponent>(); | |
| 320 | ✗ | if (intermediate) { | |
| 321 | ✗ | HVACComponent HVACComponent(*intermediate); | |
| 322 | ✗ | return setSupplyAirFan(HVACComponent); | |
| 323 | ✗ | } | |
| 324 | ✗ | } | |
| 325 | ✗ | return false; | |
| 326 | } | ||
| 327 | |||
| 328 | ✗ | bool ZoneHVACUnitHeater_Impl::setHeatingCoilAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 329 | ✗ | if (modelObject) { | |
| 330 | ✗ | OptionalHVACComponent intermediate = modelObject->optionalCast<HVACComponent>(); | |
| 331 | ✗ | if (intermediate) { | |
| 332 | ✗ | setHeatingCoil(*intermediate); | |
| 333 | ✗ | return true; | |
| 334 | } | ||
| 335 | ✗ | } | |
| 336 | ✗ | return false; | |
| 337 | } | ||
| 338 | ✗ | boost::optional<double> ZoneHVACUnitHeater_Impl::autosizedMaximumSupplyAirFlowRate() const { | |
| 339 | ✗ | return getAutosizedValue("Design Size Maximum Supply Air Flow Rate", "m3/s"); | |
| 340 | } | ||
| 341 | |||
| 342 | ✗ | boost::optional<double> ZoneHVACUnitHeater_Impl::autosizedMaximumHotWaterFlowRate() const { | |
| 343 | ✗ | return getAutosizedValue("Design Size Maximum Hot Water Flow Rate", "m3/s"); | |
| 344 | } | ||
| 345 | |||
| 346 | ✗ | void ZoneHVACUnitHeater_Impl::autosize() { | |
| 347 | ✗ | autosizeMaximumSupplyAirFlowRate(); | |
| 348 | ✗ | autosizeMaximumHotWaterFlowRate(); | |
| 349 | ✗ | } | |
| 350 | |||
| 351 | ✗ | void ZoneHVACUnitHeater_Impl::applySizingValues() { | |
| 352 | ✗ | boost::optional<double> val; | |
| 353 | ✗ | val = autosizedMaximumSupplyAirFlowRate(); | |
| 354 | ✗ | if (val) { | |
| 355 | ✗ | setMaximumSupplyAirFlowRate(val.get()); | |
| 356 | } | ||
| 357 | |||
| 358 | ✗ | val = autosizedMaximumHotWaterFlowRate(); | |
| 359 | ✗ | if (val) { | |
| 360 | ✗ | setMaximumHotWaterFlowRate(val.get()); | |
| 361 | } | ||
| 362 | ✗ | } | |
| 363 | |||
| 364 | ✗ | ComponentType ZoneHVACUnitHeater_Impl::componentType() const { | |
| 365 | ✗ | return ComponentType::Heating; | |
| 366 | } | ||
| 367 | |||
| 368 | ✗ | std::vector<FuelType> ZoneHVACUnitHeater_Impl::coolingFuelTypes() const { | |
| 369 | ✗ | return {}; | |
| 370 | } | ||
| 371 | |||
| 372 | ✗ | std::vector<FuelType> ZoneHVACUnitHeater_Impl::heatingFuelTypes() const { | |
| 373 | ✗ | return heatingCoil().heatingFuelTypes(); | |
| 374 | } | ||
| 375 | |||
| 376 | ✗ | std::vector<AppGFuelType> ZoneHVACUnitHeater_Impl::appGHeatingFuelTypes() const { | |
| 377 | ✗ | return heatingCoil().appGHeatingFuelTypes(); | |
| 378 | } | ||
| 379 | |||
| 380 | } // namespace detail | ||
| 381 | |||
| 382 | 13 | ZoneHVACUnitHeater::ZoneHVACUnitHeater(const Model& model, Schedule& availabilitySchedule, HVACComponent& supplyAirFan, HVACComponent& heatingCoil) | |
| 383 | 13 | : ZoneHVACComponent(ZoneHVACUnitHeater::iddObjectType(), model) { | |
| 384 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 13 times.
✗ Branch 5 not taken.
|
13 | OS_ASSERT(getImpl<detail::ZoneHVACUnitHeater_Impl>()); |
| 385 | |||
| 386 |
1/1✓ Branch 1 taken 13 times.
|
13 | bool ok = setAvailabilitySchedule(availabilitySchedule); |
| 387 | |||
| 388 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if (!ok) { |
| 389 | ✗ | remove(); | |
| 390 | ✗ | LOG_AND_THROW("Unable to set " << briefDescription() << "'s availability schedule to " << availabilitySchedule.briefDescription() << "."); | |
| 391 | } | ||
| 392 | |||
| 393 |
1/1✓ Branch 1 taken 13 times.
|
13 | ok = setSupplyAirFan(supplyAirFan); |
| 394 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if (!ok) { |
| 395 | ✗ | remove(); | |
| 396 | ✗ | LOG_AND_THROW("Unable to set " << briefDescription() << "'s Supply Air Fan to " << supplyAirFan.briefDescription() << "."); | |
| 397 | } | ||
| 398 | |||
| 399 |
1/1✓ Branch 1 taken 13 times.
|
13 | ok = setHeatingCoil(heatingCoil); |
| 400 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if (!ok) { |
| 401 | ✗ | remove(); | |
| 402 | ✗ | LOG_AND_THROW("Unable to set " << briefDescription() << "'s Heating Coil to " << supplyAirFan.briefDescription() << "."); | |
| 403 | } | ||
| 404 | |||
| 405 |
1/1✓ Branch 1 taken 13 times.
|
13 | autosizeMaximumSupplyAirFlowRate(); |
| 406 | |||
| 407 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | ok = setFanControlType("OnOff"); |
| 408 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
✗ Branch 3 not taken.
|
13 | OS_ASSERT(ok); |
| 409 | |||
| 410 |
1/1✓ Branch 1 taken 13 times.
|
13 | autosizeMaximumHotWaterFlowRate(); |
| 411 | |||
| 412 |
1/1✓ Branch 1 taken 13 times.
|
13 | ok = setMinimumHotWaterFlowRate(0.0); |
| 413 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
✗ Branch 3 not taken.
|
13 | OS_ASSERT(ok); |
| 414 | |||
| 415 |
1/1✓ Branch 1 taken 13 times.
|
13 | ok = setHeatingConvergenceTolerance(0.001); |
| 416 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
✗ Branch 3 not taken.
|
13 | OS_ASSERT(ok); |
| 417 | |||
| 418 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
26 | setString(OS_ZoneHVAC_UnitHeaterFields::AvailabilityManagerListName, ""); |
| 419 | 13 | } | |
| 420 | |||
| 421 | 7778 | IddObjectType ZoneHVACUnitHeater::iddObjectType() { | |
| 422 |
1/1✓ Branch 1 taken 7778 times.
|
7778 | return {IddObjectType::OS_ZoneHVAC_UnitHeater}; |
| 423 | } | ||
| 424 | |||
| 425 | ✗ | std::vector<std::string> ZoneHVACUnitHeater::fanControlTypeValues() { | |
| 426 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ZoneHVAC_UnitHeaterFields::FanControlType); | |
| 427 | } | ||
| 428 | |||
| 429 | 9 | Schedule ZoneHVACUnitHeater::availabilitySchedule() const { | |
| 430 |
1/1✓ Branch 3 taken 9 times.
|
9 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->availabilitySchedule(); |
| 431 | } | ||
| 432 | |||
| 433 | 15 | HVACComponent ZoneHVACUnitHeater::supplyAirFan() const { | |
| 434 |
1/1✓ Branch 3 taken 15 times.
|
15 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->supplyAirFan(); |
| 435 | } | ||
| 436 | |||
| 437 | 5 | boost::optional<double> ZoneHVACUnitHeater::maximumSupplyAirFlowRate() const { | |
| 438 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->maximumSupplyAirFlowRate(); |
| 439 | } | ||
| 440 | |||
| 441 | 6 | bool ZoneHVACUnitHeater::isMaximumSupplyAirFlowRateAutosized() const { | |
| 442 |
1/1✓ Branch 3 taken 6 times.
|
6 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->isMaximumSupplyAirFlowRateAutosized(); |
| 443 | } | ||
| 444 | |||
| 445 | 5 | std::string ZoneHVACUnitHeater::fanControlType() const { | |
| 446 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->fanControlType(); |
| 447 | } | ||
| 448 | |||
| 449 | 13 | HVACComponent ZoneHVACUnitHeater::heatingCoil() const { | |
| 450 |
1/1✓ Branch 3 taken 13 times.
|
13 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->heatingCoil(); |
| 451 | } | ||
| 452 | |||
| 453 | 6 | boost::optional<double> ZoneHVACUnitHeater::maximumHotWaterFlowRate() const { | |
| 454 |
1/1✓ Branch 3 taken 6 times.
|
6 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->maximumHotWaterFlowRate(); |
| 455 | } | ||
| 456 | |||
| 457 | 6 | bool ZoneHVACUnitHeater::isMaximumHotWaterFlowRateAutosized() const { | |
| 458 |
1/1✓ Branch 3 taken 6 times.
|
6 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->isMaximumHotWaterFlowRateAutosized(); |
| 459 | } | ||
| 460 | |||
| 461 | 6 | double ZoneHVACUnitHeater::minimumHotWaterFlowRate() const { | |
| 462 |
1/1✓ Branch 3 taken 6 times.
|
6 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->minimumHotWaterFlowRate(); |
| 463 | } | ||
| 464 | |||
| 465 | 2 | bool ZoneHVACUnitHeater::isMinimumHotWaterFlowRateDefaulted() const { | |
| 466 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->isMinimumHotWaterFlowRateDefaulted(); |
| 467 | } | ||
| 468 | |||
| 469 | 6 | double ZoneHVACUnitHeater::heatingConvergenceTolerance() const { | |
| 470 |
1/1✓ Branch 3 taken 6 times.
|
6 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->heatingConvergenceTolerance(); |
| 471 | } | ||
| 472 | |||
| 473 | 2 | bool ZoneHVACUnitHeater::isHeatingConvergenceToleranceDefaulted() const { | |
| 474 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->isHeatingConvergenceToleranceDefaulted(); |
| 475 | } | ||
| 476 | |||
| 477 | 14 | bool ZoneHVACUnitHeater::setAvailabilitySchedule(Schedule& schedule) { | |
| 478 |
1/1✓ Branch 3 taken 14 times.
|
14 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->setAvailabilitySchedule(schedule); |
| 479 | } | ||
| 480 | |||
| 481 | 16 | bool ZoneHVACUnitHeater::setSupplyAirFan(const HVACComponent& HVACComponent) { | |
| 482 |
1/1✓ Branch 3 taken 16 times.
|
16 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->setSupplyAirFan(HVACComponent); |
| 483 | } | ||
| 484 | |||
| 485 | 5 | bool ZoneHVACUnitHeater::setMaximumSupplyAirFlowRate(double maximumSupplyAirFlowRate) { | |
| 486 |
2/2✓ Branch 3 taken 5 times.
✓ Branch 6 taken 5 times.
|
5 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->setMaximumSupplyAirFlowRate(maximumSupplyAirFlowRate); |
| 487 | } | ||
| 488 | |||
| 489 | 14 | void ZoneHVACUnitHeater::autosizeMaximumSupplyAirFlowRate() { | |
| 490 |
1/1✓ Branch 3 taken 14 times.
|
14 | getImpl<detail::ZoneHVACUnitHeater_Impl>()->autosizeMaximumSupplyAirFlowRate(); |
| 491 | 14 | } | |
| 492 | |||
| 493 | 20 | bool ZoneHVACUnitHeater::setFanControlType(const std::string& fanControlType) { | |
| 494 |
1/1✓ Branch 3 taken 20 times.
|
20 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->setFanControlType(fanControlType); |
| 495 | } | ||
| 496 | |||
| 497 | 16 | bool ZoneHVACUnitHeater::setHeatingCoil(const HVACComponent& heatingCoil) { | |
| 498 |
1/1✓ Branch 3 taken 16 times.
|
16 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->setHeatingCoil(heatingCoil); |
| 499 | } | ||
| 500 | |||
| 501 | 5 | bool ZoneHVACUnitHeater::setMaximumHotWaterFlowRate(double maximumHotWaterFlowRate) { | |
| 502 |
2/2✓ Branch 3 taken 5 times.
✓ Branch 6 taken 5 times.
|
5 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->setMaximumHotWaterFlowRate(maximumHotWaterFlowRate); |
| 503 | } | ||
| 504 | |||
| 505 | 1 | void ZoneHVACUnitHeater::resetMaximumHotWaterFlowRate() { | |
| 506 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::ZoneHVACUnitHeater_Impl>()->resetMaximumHotWaterFlowRate(); |
| 507 | 1 | } | |
| 508 | |||
| 509 | 14 | void ZoneHVACUnitHeater::autosizeMaximumHotWaterFlowRate() { | |
| 510 |
1/1✓ Branch 3 taken 14 times.
|
14 | getImpl<detail::ZoneHVACUnitHeater_Impl>()->autosizeMaximumHotWaterFlowRate(); |
| 511 | 14 | } | |
| 512 | |||
| 513 | 18 | bool ZoneHVACUnitHeater::setMinimumHotWaterFlowRate(double minimumHotWaterFlowRate) { | |
| 514 |
1/1✓ Branch 3 taken 18 times.
|
18 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->setMinimumHotWaterFlowRate(minimumHotWaterFlowRate); |
| 515 | } | ||
| 516 | |||
| 517 | 1 | void ZoneHVACUnitHeater::resetMinimumHotWaterFlowRate() { | |
| 518 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::ZoneHVACUnitHeater_Impl>()->resetMinimumHotWaterFlowRate(); |
| 519 | 1 | } | |
| 520 | |||
| 521 | 18 | bool ZoneHVACUnitHeater::setHeatingConvergenceTolerance(double heatingConvergenceTolerance) { | |
| 522 |
1/1✓ Branch 3 taken 18 times.
|
18 | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->setHeatingConvergenceTolerance(heatingConvergenceTolerance); |
| 523 | } | ||
| 524 | |||
| 525 | 1 | void ZoneHVACUnitHeater::resetHeatingConvergenceTolerance() { | |
| 526 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::ZoneHVACUnitHeater_Impl>()->resetHeatingConvergenceTolerance(); |
| 527 | 1 | } | |
| 528 | |||
| 529 |
1/1✓ Branch 3 taken 8 times.
|
8 | ZoneHVACUnitHeater::ZoneHVACUnitHeater(std::shared_ptr<detail::ZoneHVACUnitHeater_Impl> impl) : ZoneHVACComponent(std::move(impl)) {} |
| 530 | |||
| 531 | ✗ | boost::optional<double> ZoneHVACUnitHeater::autosizedMaximumSupplyAirFlowRate() const { | |
| 532 | ✗ | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->autosizedMaximumSupplyAirFlowRate(); | |
| 533 | } | ||
| 534 | |||
| 535 | ✗ | boost::optional<double> ZoneHVACUnitHeater::autosizedMaximumHotWaterFlowRate() const { | |
| 536 | ✗ | return getImpl<detail::ZoneHVACUnitHeater_Impl>()->autosizedMaximumHotWaterFlowRate(); | |
| 537 | } | ||
| 538 | |||
| 539 | } // namespace model | ||
| 540 | } // namespace openstudio | ||
| 541 |