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