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