src/model/HotWaterEquipmentDefinition.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 "HotWaterEquipmentDefinition.hpp" | ||
| 7 | #include "HotWaterEquipmentDefinition_Impl.hpp" | ||
| 8 | |||
| 9 | #include <utilities/idd/IddFactory.hxx> | ||
| 10 | |||
| 11 | #include <utilities/idd/OS_HotWaterEquipment_Definition_FieldEnums.hxx> | ||
| 12 | #include <utilities/idd/IddEnums.hxx> | ||
| 13 | |||
| 14 | #include "../utilities/math/FloatCompare.hpp" | ||
| 15 | |||
| 16 | #include "../utilities/core/Assert.hpp" | ||
| 17 | |||
| 18 | namespace openstudio { | ||
| 19 | namespace model { | ||
| 20 | |||
| 21 | namespace detail { | ||
| 22 | |||
| 23 | 7 | HotWaterEquipmentDefinition_Impl::HotWaterEquipmentDefinition_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 24 | 7 | : SpaceLoadDefinition_Impl(idfObject, model, keepHandle) { | |
| 25 |
4/6✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 7 times.
✗ Branch 13 not taken.
|
7 | OS_ASSERT(idfObject.iddObject().type() == HotWaterEquipmentDefinition::iddObjectType()); |
| 26 | 7 | } | |
| 27 | |||
| 28 | ✗ | HotWaterEquipmentDefinition_Impl::HotWaterEquipmentDefinition_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, | |
| 29 | ✗ | bool keepHandle) | |
| 30 | ✗ | : SpaceLoadDefinition_Impl(other, model, keepHandle) { | |
| 31 | ✗ | OS_ASSERT(other.iddObject().type() == HotWaterEquipmentDefinition::iddObjectType()); | |
| 32 | ✗ | } | |
| 33 | |||
| 34 | 3 | HotWaterEquipmentDefinition_Impl::HotWaterEquipmentDefinition_Impl(const HotWaterEquipmentDefinition_Impl& other, Model_Impl* model, | |
| 35 | 3 | bool keepHandle) | |
| 36 | 3 | : SpaceLoadDefinition_Impl(other, model, keepHandle) {} | |
| 37 | |||
| 38 | // TODO: remove | ||
| 39 | ✗ | const std::vector<std::string>& HotWaterEquipmentDefinition_Impl::outputVariableNames() const { | |
| 40 | ✗ | static const std::vector<std::string> result; | |
| 41 | // Not appropriate: output is listed in HotWaterEquipment instead | ||
| 42 | ✗ | return result; | |
| 43 | } | ||
| 44 | |||
| 45 | ✗ | IddObjectType HotWaterEquipmentDefinition_Impl::iddObjectType() const { | |
| 46 | ✗ | return HotWaterEquipmentDefinition::iddObjectType(); | |
| 47 | } | ||
| 48 | |||
| 49 | 102 | std::string HotWaterEquipmentDefinition_Impl::designLevelCalculationMethod() const { | |
| 50 |
1/1✓ Branch 1 taken 102 times.
|
102 | boost::optional<std::string> value = getString(OS_HotWaterEquipment_DefinitionFields::DesignLevelCalculationMethod, true); |
| 51 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 102 times.
✗ Branch 4 not taken.
|
102 | OS_ASSERT(value); |
| 52 |
2/2✓ Branch 1 taken 102 times.
✓ Branch 4 taken 102 times.
|
204 | return value.get(); |
| 53 | 102 | } | |
| 54 | |||
| 55 | 12 | boost::optional<double> HotWaterEquipmentDefinition_Impl::designLevel() const { | |
| 56 | 12 | boost::optional<double> result; | |
| 57 |
4/5✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✓ Branch 11 taken 12 times.
✗ Branch 12 not taken.
|
36 | if (istringEqual("EquipmentLevel", this->designLevelCalculationMethod())) { |
| 58 |
1/1✓ Branch 1 taken 12 times.
|
12 | result = getDouble(OS_HotWaterEquipment_DefinitionFields::DesignLevel, true); |
| 59 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
✗ Branch 4 not taken.
|
12 | OS_ASSERT(result); |
| 60 | } | ||
| 61 | 12 | return result; | |
| 62 | } | ||
| 63 | |||
| 64 | 39 | boost::optional<double> HotWaterEquipmentDefinition_Impl::wattsperSpaceFloorArea() const { | |
| 65 | 39 | boost::optional<double> result; | |
| 66 |
5/5✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
✓ Branch 7 taken 39 times.
✓ Branch 11 taken 36 times.
✓ Branch 12 taken 3 times.
|
117 | if (istringEqual("Watts/Area", this->designLevelCalculationMethod())) { |
| 67 |
1/1✓ Branch 1 taken 36 times.
|
36 | result = getDouble(OS_HotWaterEquipment_DefinitionFields::WattsperSpaceFloorArea, true); |
| 68 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
✗ Branch 4 not taken.
|
36 | OS_ASSERT(result); |
| 69 | } | ||
| 70 | 39 | return result; | |
| 71 | } | ||
| 72 | |||
| 73 | 3 | boost::optional<double> HotWaterEquipmentDefinition_Impl::wattsperPerson() const { | |
| 74 | 3 | boost::optional<double> result; | |
| 75 |
4/5✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 3 times.
|
9 | if (istringEqual("Watts/Person", this->designLevelCalculationMethod())) { |
| 76 | ✗ | result = getDouble(OS_HotWaterEquipment_DefinitionFields::WattsperPerson, true); | |
| 77 | ✗ | OS_ASSERT(result); | |
| 78 | } | ||
| 79 | 3 | return result; | |
| 80 | } | ||
| 81 | |||
| 82 | 6 | double HotWaterEquipmentDefinition_Impl::fractionLatent() const { | |
| 83 |
1/1✓ Branch 1 taken 6 times.
|
6 | boost::optional<double> value = getDouble(OS_HotWaterEquipment_DefinitionFields::FractionLatent, true); |
| 84 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
|
6 | OS_ASSERT(value); |
| 85 |
1/1✓ Branch 1 taken 6 times.
|
12 | return value.get(); |
| 86 | } | ||
| 87 | |||
| 88 | 3 | bool HotWaterEquipmentDefinition_Impl::isFractionLatentDefaulted() const { | |
| 89 | 3 | return isEmpty(OS_HotWaterEquipment_DefinitionFields::FractionLatent); | |
| 90 | } | ||
| 91 | |||
| 92 | 6 | double HotWaterEquipmentDefinition_Impl::fractionRadiant() const { | |
| 93 |
1/1✓ Branch 1 taken 6 times.
|
6 | boost::optional<double> value = getDouble(OS_HotWaterEquipment_DefinitionFields::FractionRadiant, true); |
| 94 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
|
6 | OS_ASSERT(value); |
| 95 |
1/1✓ Branch 1 taken 6 times.
|
12 | return value.get(); |
| 96 | } | ||
| 97 | |||
| 98 | 3 | bool HotWaterEquipmentDefinition_Impl::isFractionRadiantDefaulted() const { | |
| 99 | 3 | return isEmpty(OS_HotWaterEquipment_DefinitionFields::FractionRadiant); | |
| 100 | } | ||
| 101 | |||
| 102 | 7 | double HotWaterEquipmentDefinition_Impl::fractionLost() const { | |
| 103 |
1/1✓ Branch 1 taken 7 times.
|
7 | boost::optional<double> value = getDouble(OS_HotWaterEquipment_DefinitionFields::FractionLost, true); |
| 104 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 4 not taken.
|
7 | OS_ASSERT(value); |
| 105 |
1/1✓ Branch 1 taken 7 times.
|
14 | return value.get(); |
| 106 | } | ||
| 107 | |||
| 108 | 3 | bool HotWaterEquipmentDefinition_Impl::isFractionLostDefaulted() const { | |
| 109 | 3 | return isEmpty(OS_HotWaterEquipment_DefinitionFields::FractionLost); | |
| 110 | } | ||
| 111 | |||
| 112 | 11 | bool HotWaterEquipmentDefinition_Impl::setDesignLevel(boost::optional<double> designLevel) { | |
| 113 | 11 | bool result = true; | |
| 114 |
1/2✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
|
11 | if (designLevel) { |
| 115 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 11 times.
|
11 | if (*designLevel < 0) { |
| 116 | ✗ | result = false; | |
| 117 | } else { | ||
| 118 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
22 | result = setString(OS_HotWaterEquipment_DefinitionFields::DesignLevelCalculationMethod, "EquipmentLevel"); |
| 119 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
|
11 | OS_ASSERT(result); |
| 120 | 11 | result = setDouble(OS_HotWaterEquipment_DefinitionFields::DesignLevel, designLevel.get()); | |
| 121 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
|
11 | OS_ASSERT(result); |
| 122 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
22 | result = setString(OS_HotWaterEquipment_DefinitionFields::WattsperSpaceFloorArea, ""); |
| 123 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
|
11 | OS_ASSERT(result); |
| 124 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
22 | result = setString(OS_HotWaterEquipment_DefinitionFields::WattsperPerson, ""); |
| 125 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
|
11 | OS_ASSERT(result); |
| 126 | } | ||
| 127 | } else { | ||
| 128 | ✗ | if (istringEqual("EquipmentLevel", this->designLevelCalculationMethod())) { | |
| 129 | ✗ | result = setDouble(OS_HotWaterEquipment_DefinitionFields::DesignLevel, 0.0); | |
| 130 | } | ||
| 131 | } | ||
| 132 | 11 | return result; | |
| 133 | } | ||
| 134 | |||
| 135 | 1 | bool HotWaterEquipmentDefinition_Impl::setWattsperSpaceFloorArea(boost::optional<double> wattsperSpaceFloorArea) { | |
| 136 | 1 | bool result = true; | |
| 137 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (wattsperSpaceFloorArea) { |
| 138 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
|
1 | if (*wattsperSpaceFloorArea < 0) { |
| 139 | ✗ | result = false; | |
| 140 | } else { | ||
| 141 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | result = setString(OS_HotWaterEquipment_DefinitionFields::DesignLevelCalculationMethod, "Watts/Area"); |
| 142 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 143 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | result = setString(OS_HotWaterEquipment_DefinitionFields::DesignLevel, ""); |
| 144 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 145 | 1 | result = setDouble(OS_HotWaterEquipment_DefinitionFields::WattsperSpaceFloorArea, wattsperSpaceFloorArea.get()); | |
| 146 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 147 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | result = setString(OS_HotWaterEquipment_DefinitionFields::WattsperPerson, ""); |
| 148 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 149 | } | ||
| 150 | } else { | ||
| 151 | ✗ | if (istringEqual("Watts/Area", this->designLevelCalculationMethod())) { | |
| 152 | ✗ | result = setDouble(OS_HotWaterEquipment_DefinitionFields::WattsperSpaceFloorArea, 0.0); | |
| 153 | } | ||
| 154 | } | ||
| 155 | 1 | return result; | |
| 156 | } | ||
| 157 | |||
| 158 | ✗ | bool HotWaterEquipmentDefinition_Impl::setWattsperPerson(boost::optional<double> wattsperPerson) { | |
| 159 | ✗ | bool result = true; | |
| 160 | ✗ | if (wattsperPerson) { | |
| 161 | ✗ | if (*wattsperPerson < 0) { | |
| 162 | ✗ | result = false; | |
| 163 | } else { | ||
| 164 | ✗ | result = setString(OS_HotWaterEquipment_DefinitionFields::DesignLevelCalculationMethod, "Watts/Person"); | |
| 165 | ✗ | OS_ASSERT(result); | |
| 166 | ✗ | result = setString(OS_HotWaterEquipment_DefinitionFields::DesignLevel, ""); | |
| 167 | ✗ | OS_ASSERT(result); | |
| 168 | ✗ | result = setString(OS_HotWaterEquipment_DefinitionFields::WattsperSpaceFloorArea, ""); | |
| 169 | ✗ | OS_ASSERT(result); | |
| 170 | ✗ | result = setDouble(OS_HotWaterEquipment_DefinitionFields::WattsperPerson, wattsperPerson.get()); | |
| 171 | ✗ | OS_ASSERT(result); | |
| 172 | } | ||
| 173 | } else { | ||
| 174 | ✗ | if (istringEqual("Watts/Person", this->designLevelCalculationMethod())) { | |
| 175 | ✗ | result = setDouble(OS_HotWaterEquipment_DefinitionFields::WattsperPerson, 0.0); | |
| 176 | } | ||
| 177 | } | ||
| 178 | ✗ | return result; | |
| 179 | } | ||
| 180 | |||
| 181 | 3 | bool HotWaterEquipmentDefinition_Impl::setFractionLatent(double fractionLatent) { | |
| 182 | |||
| 183 | 3 | double fractionRadiantAndLost = fractionRadiant() + fractionLost(); | |
| 184 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 2 times.
|
3 | if ((fractionLatent + fractionRadiantAndLost) > 1.0) { |
| 185 |
9/9✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
|
1 | LOG(Error, "Radiant Fraction and Lost Fraction sum to " << fractionRadiantAndLost << " and you supplied a Latent Fraction of " |
| 186 | << fractionLatent << " which would result in a sum greater than 1.0"); | ||
| 187 | 1 | return false; | |
| 188 | } | ||
| 189 | 2 | bool result = setDouble(OS_HotWaterEquipment_DefinitionFields::FractionLatent, fractionLatent); | |
| 190 | 2 | return result; | |
| 191 | } | ||
| 192 | |||
| 193 | ✗ | void HotWaterEquipmentDefinition_Impl::resetFractionLatent() { | |
| 194 | ✗ | bool result = setString(OS_HotWaterEquipment_DefinitionFields::FractionLatent, ""); | |
| 195 | ✗ | OS_ASSERT(result); | |
| 196 | ✗ | } | |
| 197 | |||
| 198 | 3 | bool HotWaterEquipmentDefinition_Impl::setFractionRadiant(double fractionRadiant) { | |
| 199 | |||
| 200 | 3 | double fractionLatentAndLost = fractionLatent() + fractionLost(); | |
| 201 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 2 times.
|
3 | if ((fractionRadiant + fractionLatentAndLost) > 1.0) { |
| 202 |
9/9✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
|
1 | LOG(Error, "Latent Fraction and Lost Fraction sum to " << fractionLatentAndLost << " and you supplied a Radiant Fraction of " |
| 203 | << fractionRadiant << " which would result in a sum greater than 1.0"); | ||
| 204 | 1 | return false; | |
| 205 | } | ||
| 206 | 2 | bool result = setDouble(OS_HotWaterEquipment_DefinitionFields::FractionRadiant, fractionRadiant); | |
| 207 | 2 | return result; | |
| 208 | } | ||
| 209 | |||
| 210 | ✗ | void HotWaterEquipmentDefinition_Impl::resetFractionRadiant() { | |
| 211 | ✗ | bool result = setString(OS_HotWaterEquipment_DefinitionFields::FractionRadiant, ""); | |
| 212 | ✗ | OS_ASSERT(result); | |
| 213 | ✗ | } | |
| 214 | |||
| 215 | 2 | bool HotWaterEquipmentDefinition_Impl::setFractionLost(double fractionLost) { | |
| 216 | |||
| 217 | 2 | double fractionLatentAndRadiant = fractionLatent() + fractionRadiant(); | |
| 218 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
|
2 | if ((fractionLost + fractionLatentAndRadiant) > 1.0) { |
| 219 |
9/9✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
|
1 | LOG(Error, "Latent Fraction and Radiant Fraction sum to " << fractionLatentAndRadiant << " and you supplied a Lost Fraction of " |
| 220 | << fractionLost << " which would result in a sum greater than 1.0"); | ||
| 221 | 1 | return false; | |
| 222 | } | ||
| 223 | 1 | bool result = setDouble(OS_HotWaterEquipment_DefinitionFields::FractionLost, fractionLost); | |
| 224 | 1 | return result; | |
| 225 | } | ||
| 226 | |||
| 227 | ✗ | void HotWaterEquipmentDefinition_Impl::resetFractionLost() { | |
| 228 | ✗ | bool result = setString(OS_HotWaterEquipment_DefinitionFields::FractionLost, ""); | |
| 229 | ✗ | OS_ASSERT(result); | |
| 230 | ✗ | } | |
| 231 | |||
| 232 | 35 | double HotWaterEquipmentDefinition_Impl::getDesignLevel(double floorArea, double numPeople) const { | |
| 233 |
1/1✓ Branch 1 taken 35 times.
|
35 | std::string method = designLevelCalculationMethod(); |
| 234 | |||
| 235 |
3/3✓ Branch 1 taken 35 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 28 times.
|
35 | if (method == "EquipmentLevel") { |
| 236 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | return designLevel().get(); |
| 237 |
2/3✓ Branch 1 taken 28 times.
✓ Branch 3 taken 28 times.
✗ Branch 4 not taken.
|
28 | } else if (method == "Watts/Area") { |
| 238 |
2/2✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
|
28 | return wattsperSpaceFloorArea().get() * floorArea; |
| 239 | ✗ | } else if (method == "Watts/Person") { | |
| 240 | ✗ | return wattsperPerson().get() * numPeople; | |
| 241 | } | ||
| 242 | |||
| 243 | ✗ | OS_ASSERT(false); | |
| 244 | ✗ | return 0.0; | |
| 245 | 35 | } | |
| 246 | |||
| 247 | 5 | double HotWaterEquipmentDefinition_Impl::getPowerPerFloorArea(double floorArea, double numPeople) const { | |
| 248 |
1/1✓ Branch 1 taken 5 times.
|
5 | std::string method = designLevelCalculationMethod(); |
| 249 | |||
| 250 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 4 times.
|
5 | if (method == "EquipmentLevel") { |
| 251 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
|
1 | if (equal(floorArea, 0.0)) { |
| 252 | ✗ | LOG_AND_THROW("Calculation would require division by zero."); | |
| 253 | } | ||
| 254 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | return designLevel().get() / floorArea; |
| 255 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
4 | } else if (method == "Watts/Area") { |
| 256 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | return wattsperSpaceFloorArea().get(); |
| 257 | ✗ | } else if (method == "Watts/Person") { | |
| 258 | ✗ | if (equal(floorArea, 0.0)) { | |
| 259 | ✗ | LOG_AND_THROW("Calculation would require division by zero."); | |
| 260 | } | ||
| 261 | ✗ | return wattsperPerson().get() * numPeople / floorArea; | |
| 262 | } | ||
| 263 | |||
| 264 | ✗ | OS_ASSERT(false); | |
| 265 | ✗ | return 0.0; | |
| 266 | 5 | } | |
| 267 | |||
| 268 | 5 | double HotWaterEquipmentDefinition_Impl::getPowerPerPerson(double floorArea, double numPeople) const { | |
| 269 |
1/1✓ Branch 1 taken 5 times.
|
5 | std::string method = designLevelCalculationMethod(); |
| 270 | |||
| 271 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 4 times.
|
5 | if (method == "EquipmentLevel") { |
| 272 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
|
1 | if (equal(numPeople, 0.0)) { |
| 273 | ✗ | LOG_AND_THROW("Calculation would require division by zero."); | |
| 274 | } | ||
| 275 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | return designLevel().get() / numPeople; |
| 276 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
4 | } else if (method == "Watts/Area") { |
| 277 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
|
4 | if (equal(numPeople, 0.0)) { |
| 278 | ✗ | LOG_AND_THROW("Calculation would require division by zero."); | |
| 279 | } | ||
| 280 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | return wattsperSpaceFloorArea().get() * floorArea / numPeople; |
| 281 | ✗ | } else if (method == "Watts/Person") { | |
| 282 | ✗ | return wattsperPerson().get(); | |
| 283 | } | ||
| 284 | |||
| 285 | ✗ | OS_ASSERT(false); | |
| 286 | ✗ | return 0.0; | |
| 287 | 5 | } | |
| 288 | |||
| 289 | ✗ | bool HotWaterEquipmentDefinition_Impl::setDesignLevelCalculationMethod(const std::string& method, double floorArea, double numPeople) { | |
| 290 | ✗ | std::string wmethod(method); | |
| 291 | ✗ | boost::to_lower(wmethod); | |
| 292 | |||
| 293 | ✗ | if (wmethod == "equipmentlevel") { | |
| 294 | ✗ | return setDesignLevel(getDesignLevel(floorArea, numPeople)); | |
| 295 | ✗ | } else if (wmethod == "watts/area") { | |
| 296 | ✗ | return setWattsperSpaceFloorArea(getPowerPerFloorArea(floorArea, numPeople)); | |
| 297 | ✗ | } else if (wmethod == "watts/person") { | |
| 298 | ✗ | return setWattsperPerson(getPowerPerPerson(floorArea, numPeople)); | |
| 299 | } | ||
| 300 | |||
| 301 | ✗ | return false; | |
| 302 | ✗ | } | |
| 303 | |||
| 304 | ✗ | std::vector<EMSActuatorNames> HotWaterEquipmentDefinition_Impl::emsActuatorNames() const { | |
| 305 | ✗ | std::vector<EMSActuatorNames> actuators{{"HotWaterEquipment", "District Heating Power Level"}}; | |
| 306 | ✗ | return actuators; | |
| 307 | ✗ | } | |
| 308 | |||
| 309 | ✗ | std::vector<std::string> HotWaterEquipmentDefinition_Impl::emsInternalVariableNames() const { | |
| 310 | ✗ | std::vector<std::string> types{"Process District Heat Design Level"}; | |
| 311 | ✗ | return types; | |
| 312 | ✗ | } | |
| 313 | |||
| 314 | } // namespace detail | ||
| 315 | |||
| 316 | 7 | HotWaterEquipmentDefinition::HotWaterEquipmentDefinition(const Model& model) | |
| 317 | 7 | : SpaceLoadDefinition(HotWaterEquipmentDefinition::iddObjectType(), model) { | |
| 318 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
✗ Branch 5 not taken.
|
7 | OS_ASSERT(getImpl<detail::HotWaterEquipmentDefinition_Impl>()); |
| 319 |
1/1✓ Branch 1 taken 7 times.
|
7 | bool test = this->setDesignLevel(0.0); |
| 320 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 3 not taken.
|
7 | OS_ASSERT(test); |
| 321 | 7 | } | |
| 322 | |||
| 323 | 7742 | IddObjectType HotWaterEquipmentDefinition::iddObjectType() { | |
| 324 |
1/1✓ Branch 1 taken 7742 times.
|
7742 | IddObjectType result(IddObjectType::OS_HotWaterEquipment_Definition); |
| 325 | 7742 | return result; | |
| 326 | } | ||
| 327 | |||
| 328 | ✗ | std::vector<std::string> HotWaterEquipmentDefinition::validDesignLevelCalculationMethodValues() { | |
| 329 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), | |
| 330 | ✗ | OS_HotWaterEquipment_DefinitionFields::DesignLevelCalculationMethod); | |
| 331 | } | ||
| 332 | |||
| 333 | 3 | std::string HotWaterEquipmentDefinition::designLevelCalculationMethod() const { | |
| 334 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->designLevelCalculationMethod(); |
| 335 | } | ||
| 336 | |||
| 337 | 3 | boost::optional<double> HotWaterEquipmentDefinition::designLevel() const { | |
| 338 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->designLevel(); |
| 339 | } | ||
| 340 | |||
| 341 | 3 | boost::optional<double> HotWaterEquipmentDefinition::wattsperSpaceFloorArea() const { | |
| 342 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->wattsperSpaceFloorArea(); |
| 343 | } | ||
| 344 | |||
| 345 | 3 | boost::optional<double> HotWaterEquipmentDefinition::wattsperPerson() const { | |
| 346 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->wattsperPerson(); |
| 347 | } | ||
| 348 | |||
| 349 | 1 | double HotWaterEquipmentDefinition::fractionLatent() const { | |
| 350 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->fractionLatent(); |
| 351 | } | ||
| 352 | |||
| 353 | 3 | bool HotWaterEquipmentDefinition::isFractionLatentDefaulted() const { | |
| 354 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->isFractionLatentDefaulted(); |
| 355 | } | ||
| 356 | |||
| 357 | 1 | double HotWaterEquipmentDefinition::fractionRadiant() const { | |
| 358 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->fractionRadiant(); |
| 359 | } | ||
| 360 | |||
| 361 | 3 | bool HotWaterEquipmentDefinition::isFractionRadiantDefaulted() const { | |
| 362 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->isFractionRadiantDefaulted(); |
| 363 | } | ||
| 364 | |||
| 365 | 1 | double HotWaterEquipmentDefinition::fractionLost() const { | |
| 366 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->fractionLost(); |
| 367 | } | ||
| 368 | |||
| 369 | 3 | bool HotWaterEquipmentDefinition::isFractionLostDefaulted() const { | |
| 370 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->isFractionLostDefaulted(); |
| 371 | } | ||
| 372 | |||
| 373 | 11 | bool HotWaterEquipmentDefinition::setDesignLevel(double designLevel) { | |
| 374 |
2/2✓ Branch 3 taken 11 times.
✓ Branch 6 taken 11 times.
|
11 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->setDesignLevel(designLevel); |
| 375 | } | ||
| 376 | |||
| 377 | 1 | bool HotWaterEquipmentDefinition::setWattsperSpaceFloorArea(double wattsperSpaceFloorArea) { | |
| 378 |
2/2✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
|
1 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->setWattsperSpaceFloorArea(wattsperSpaceFloorArea); |
| 379 | } | ||
| 380 | |||
| 381 | ✗ | bool HotWaterEquipmentDefinition::setWattsperPerson(double wattsperPerson) { | |
| 382 | ✗ | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->setWattsperPerson(wattsperPerson); | |
| 383 | } | ||
| 384 | |||
| 385 | 3 | bool HotWaterEquipmentDefinition::setFractionLatent(double fractionLatent) { | |
| 386 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->setFractionLatent(fractionLatent); |
| 387 | } | ||
| 388 | |||
| 389 | ✗ | void HotWaterEquipmentDefinition::resetFractionLatent() { | |
| 390 | ✗ | getImpl<detail::HotWaterEquipmentDefinition_Impl>()->resetFractionLatent(); | |
| 391 | ✗ | } | |
| 392 | |||
| 393 | 3 | bool HotWaterEquipmentDefinition::setFractionRadiant(double fractionRadiant) { | |
| 394 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->setFractionRadiant(fractionRadiant); |
| 395 | } | ||
| 396 | |||
| 397 | ✗ | void HotWaterEquipmentDefinition::resetFractionRadiant() { | |
| 398 | ✗ | getImpl<detail::HotWaterEquipmentDefinition_Impl>()->resetFractionRadiant(); | |
| 399 | ✗ | } | |
| 400 | |||
| 401 | 2 | bool HotWaterEquipmentDefinition::setFractionLost(double fractionLost) { | |
| 402 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->setFractionLost(fractionLost); |
| 403 | } | ||
| 404 | |||
| 405 | ✗ | void HotWaterEquipmentDefinition::resetFractionLost() { | |
| 406 | ✗ | getImpl<detail::HotWaterEquipmentDefinition_Impl>()->resetFractionLost(); | |
| 407 | ✗ | } | |
| 408 | |||
| 409 | 35 | double HotWaterEquipmentDefinition::getDesignLevel(double floorArea, double numPeople) const { | |
| 410 |
1/1✓ Branch 3 taken 35 times.
|
35 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->getDesignLevel(floorArea, numPeople); |
| 411 | } | ||
| 412 | |||
| 413 | 5 | double HotWaterEquipmentDefinition::getPowerPerFloorArea(double floorArea, double numPeople) const { | |
| 414 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->getPowerPerFloorArea(floorArea, numPeople); |
| 415 | } | ||
| 416 | |||
| 417 | 5 | double HotWaterEquipmentDefinition::getPowerPerPerson(double floorArea, double numPeople) const { | |
| 418 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->getPowerPerPerson(floorArea, numPeople); |
| 419 | } | ||
| 420 | |||
| 421 | ✗ | bool HotWaterEquipmentDefinition::setDesignLevelCalculationMethod(const std::string& method, double floorArea, double numPeople) { | |
| 422 | ✗ | return getImpl<detail::HotWaterEquipmentDefinition_Impl>()->setDesignLevelCalculationMethod(method, floorArea, numPeople); | |
| 423 | } | ||
| 424 | |||
| 425 | /// @cond | ||
| 426 | 51 | HotWaterEquipmentDefinition::HotWaterEquipmentDefinition(std::shared_ptr<detail::HotWaterEquipmentDefinition_Impl> impl) | |
| 427 |
1/1✓ Branch 3 taken 51 times.
|
51 | : SpaceLoadDefinition(std::move(impl)) {} |
| 428 | /// @endcond | ||
| 429 | |||
| 430 | } // namespace model | ||
| 431 | } // namespace openstudio | ||
| 432 |