src/model/AirflowNetworkExternalNode.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 "AirflowNetworkExternalNode.hpp" | ||
| 7 | #include "AirflowNetworkExternalNode_Impl.hpp" | ||
| 8 | |||
| 9 | // TODO: Check the following class names against object getters and setters. | ||
| 10 | #include "Curve.hpp" | ||
| 11 | #include "Curve_Impl.hpp" | ||
| 12 | #include "CurveLinear.hpp" | ||
| 13 | #include "CurveLinear_Impl.hpp" | ||
| 14 | |||
| 15 | #include <utilities/idd/IddFactory.hxx> | ||
| 16 | #include <utilities/idd/IddEnums.hxx> | ||
| 17 | #include <utilities/idd/OS_AirflowNetworkExternalNode_FieldEnums.hxx> | ||
| 18 | |||
| 19 | #include "../utilities/units/Unit.hpp" | ||
| 20 | |||
| 21 | #include "../utilities/core/Assert.hpp" | ||
| 22 | |||
| 23 | namespace openstudio { | ||
| 24 | namespace model { | ||
| 25 | |||
| 26 | namespace detail { | ||
| 27 | |||
| 28 | 4 | AirflowNetworkExternalNode_Impl::AirflowNetworkExternalNode_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 29 | 4 | : AirflowNetworkNode_Impl(idfObject, model, keepHandle) { | |
| 30 |
4/6✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 13 not taken.
|
4 | OS_ASSERT(idfObject.iddObject().type() == AirflowNetworkExternalNode::iddObjectType()); |
| 31 | 4 | } | |
| 32 | |||
| 33 | ✗ | AirflowNetworkExternalNode_Impl::AirflowNetworkExternalNode_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, | |
| 34 | ✗ | bool keepHandle) | |
| 35 | ✗ | : AirflowNetworkNode_Impl(other, model, keepHandle) { | |
| 36 | ✗ | OS_ASSERT(other.iddObject().type() == AirflowNetworkExternalNode::iddObjectType()); | |
| 37 | ✗ | } | |
| 38 | |||
| 39 | ✗ | AirflowNetworkExternalNode_Impl::AirflowNetworkExternalNode_Impl(const AirflowNetworkExternalNode_Impl& other, Model_Impl* model, bool keepHandle) | |
| 40 | ✗ | : AirflowNetworkNode_Impl(other, model, keepHandle) {} | |
| 41 | |||
| 42 | ✗ | const std::vector<std::string>& AirflowNetworkExternalNode_Impl::outputVariableNames() const { | |
| 43 | ✗ | static const std::vector<std::string> result; | |
| 44 | ✗ | return result; | |
| 45 | } | ||
| 46 | |||
| 47 | ✗ | IddObjectType AirflowNetworkExternalNode_Impl::iddObjectType() const { | |
| 48 | ✗ | return AirflowNetworkExternalNode::iddObjectType(); | |
| 49 | } | ||
| 50 | |||
| 51 | ✗ | double AirflowNetworkExternalNode_Impl::externalNodeHeight() const { | |
| 52 | ✗ | boost::optional<double> value = getDouble(OS_AirflowNetworkExternalNodeFields::ExternalNodeHeight, true); | |
| 53 | ✗ | OS_ASSERT(value); | |
| 54 | ✗ | return value.get(); | |
| 55 | } | ||
| 56 | |||
| 57 | 1 | bool AirflowNetworkExternalNode_Impl::isExternalNodeHeightDefaulted() const { | |
| 58 | 1 | return isEmpty(OS_AirflowNetworkExternalNodeFields::ExternalNodeHeight); | |
| 59 | } | ||
| 60 | |||
| 61 | 3 | Curve AirflowNetworkExternalNode_Impl::windPressureCoefficientCurve() const { | |
| 62 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<Curve> value = optionalWindPressureCoefficientCurve(); |
| 63 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
|
3 | if (!value) { |
| 64 | ✗ | LOG_AND_THROW(briefDescription() << " does not have an Wind Pressure Coefficient Curve attached."); | |
| 65 | } | ||
| 66 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
6 | return value.get(); |
| 67 | 3 | } | |
| 68 | |||
| 69 | ✗ | bool AirflowNetworkExternalNode_Impl::symmetricWindPressureCoefficientCurve() const { | |
| 70 | ✗ | boost::optional<std::string> value = getString(OS_AirflowNetworkExternalNodeFields::SymmetricWindPressureCoefficientCurve, true); | |
| 71 | ✗ | OS_ASSERT(value); | |
| 72 | ✗ | return openstudio::istringEqual(value.get(), "Yes"); | |
| 73 | ✗ | } | |
| 74 | |||
| 75 | 1 | bool AirflowNetworkExternalNode_Impl::isSymmetricWindPressureCoefficientCurveDefaulted() const { | |
| 76 | 1 | return isEmpty(OS_AirflowNetworkExternalNodeFields::SymmetricWindPressureCoefficientCurve); | |
| 77 | } | ||
| 78 | |||
| 79 | 2 | std::string AirflowNetworkExternalNode_Impl::windAngleType() const { | |
| 80 |
1/1✓ Branch 1 taken 2 times.
|
2 | boost::optional<std::string> value = getString(OS_AirflowNetworkExternalNodeFields::WindAngleType, true); |
| 81 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
|
2 | OS_ASSERT(value); |
| 82 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | return value.get(); |
| 83 | 2 | } | |
| 84 | |||
| 85 | 2 | bool AirflowNetworkExternalNode_Impl::isWindAngleTypeDefaulted() const { | |
| 86 | 2 | return isEmpty(OS_AirflowNetworkExternalNodeFields::WindAngleType); | |
| 87 | } | ||
| 88 | |||
| 89 | ✗ | void AirflowNetworkExternalNode_Impl::setExternalNodeHeight(double externalNodeHeight) { | |
| 90 | ✗ | bool result = setDouble(OS_AirflowNetworkExternalNodeFields::ExternalNodeHeight, externalNodeHeight); | |
| 91 | ✗ | OS_ASSERT(result); | |
| 92 | ✗ | } | |
| 93 | |||
| 94 | ✗ | void AirflowNetworkExternalNode_Impl::resetExternalNodeHeight() { | |
| 95 | ✗ | bool result = setString(OS_AirflowNetworkExternalNodeFields::ExternalNodeHeight, ""); | |
| 96 | ✗ | OS_ASSERT(result); | |
| 97 | ✗ | } | |
| 98 | |||
| 99 | 5 | bool AirflowNetworkExternalNode_Impl::setWindPressureCoefficientCurve(const Curve& wPCValue) { | |
| 100 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | bool result = setPointer(OS_AirflowNetworkExternalNodeFields::WindPressureCoefficientCurveName, wPCValue.handle()); |
| 101 | 5 | return result; | |
| 102 | } | ||
| 103 | |||
| 104 | ✗ | void AirflowNetworkExternalNode_Impl::setSymmetricWindPressureCoefficientCurve(bool symmetricWindPressureCoefficientCurve) { | |
| 105 | ✗ | bool result = false; | |
| 106 | ✗ | if (symmetricWindPressureCoefficientCurve) { | |
| 107 | ✗ | result = setString(OS_AirflowNetworkExternalNodeFields::SymmetricWindPressureCoefficientCurve, "Yes"); | |
| 108 | } else { | ||
| 109 | ✗ | result = setString(OS_AirflowNetworkExternalNodeFields::SymmetricWindPressureCoefficientCurve, "No"); | |
| 110 | } | ||
| 111 | ✗ | OS_ASSERT(result); | |
| 112 | ✗ | } | |
| 113 | |||
| 114 | ✗ | void AirflowNetworkExternalNode_Impl::resetSymmetricWindPressureCoefficientCurve() { | |
| 115 | ✗ | bool result = setString(OS_AirflowNetworkExternalNodeFields::SymmetricWindPressureCoefficientCurve, ""); | |
| 116 | ✗ | OS_ASSERT(result); | |
| 117 | ✗ | } | |
| 118 | |||
| 119 | 1 | bool AirflowNetworkExternalNode_Impl::setWindAngleType(const std::string& windAngleType) { | |
| 120 | 1 | bool result = setString(OS_AirflowNetworkExternalNodeFields::WindAngleType, windAngleType); | |
| 121 | 1 | return result; | |
| 122 | } | ||
| 123 | |||
| 124 | ✗ | void AirflowNetworkExternalNode_Impl::resetWindAngleType() { | |
| 125 | ✗ | bool result = setString(OS_AirflowNetworkExternalNodeFields::WindAngleType, ""); | |
| 126 | ✗ | OS_ASSERT(result); | |
| 127 | ✗ | } | |
| 128 | |||
| 129 | 3 | boost::optional<Curve> AirflowNetworkExternalNode_Impl::optionalWindPressureCoefficientCurve() const { | |
| 130 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | return getObject<ModelObject>().getModelObjectTarget<Curve>(OS_AirflowNetworkExternalNodeFields::WindPressureCoefficientCurveName); |
| 131 | } | ||
| 132 | |||
| 133 | } // namespace detail | ||
| 134 | |||
| 135 | 3 | AirflowNetworkExternalNode::AirflowNetworkExternalNode(const Model& model) | |
| 136 | 3 | : AirflowNetworkNode(AirflowNetworkExternalNode::iddObjectType(), model) { | |
| 137 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 5 not taken.
|
3 | OS_ASSERT(getImpl<detail::AirflowNetworkExternalNode_Impl>()); |
| 138 | // Set up a default unity-valued curve | ||
| 139 |
1/1✓ Branch 1 taken 3 times.
|
3 | CurveLinear curve(model); |
| 140 |
1/1✓ Branch 1 taken 3 times.
|
3 | curve.setCoefficient1Constant(1.0); |
| 141 |
1/1✓ Branch 1 taken 3 times.
|
3 | curve.setCoefficient2x(0.0); |
| 142 |
1/1✓ Branch 1 taken 3 times.
|
3 | curve.setMinimumValueofx(0.0); |
| 143 |
1/1✓ Branch 1 taken 3 times.
|
3 | curve.setMaximumValueofx(360.0); |
| 144 |
1/1✓ Branch 1 taken 3 times.
|
3 | bool ok = setWindPressureCoefficientCurve(curve); |
| 145 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
|
3 | OS_ASSERT(ok); |
| 146 | 3 | } | |
| 147 | |||
| 148 | 1 | AirflowNetworkExternalNode::AirflowNetworkExternalNode(const Model& model, const Curve& curve) | |
| 149 | 1 | : AirflowNetworkNode(AirflowNetworkExternalNode::iddObjectType(), model) { | |
| 150 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 5 not taken.
|
1 | OS_ASSERT(getImpl<detail::AirflowNetworkExternalNode_Impl>()); |
| 151 |
1/1✓ Branch 1 taken 1 time.
|
1 | bool ok = setWindPressureCoefficientCurve(curve); |
| 152 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
|
1 | OS_ASSERT(ok); |
| 153 | 1 | } | |
| 154 | |||
| 155 | 8495 | IddObjectType AirflowNetworkExternalNode::iddObjectType() { | |
| 156 |
1/1✓ Branch 1 taken 8495 times.
|
8495 | return {IddObjectType::OS_AirflowNetworkExternalNode}; |
| 157 | } | ||
| 158 | |||
| 159 | ✗ | std::vector<std::string> AirflowNetworkExternalNode::windAngleTypeValues() { | |
| 160 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_AirflowNetworkExternalNodeFields::WindAngleType); | |
| 161 | } | ||
| 162 | |||
| 163 | ✗ | double AirflowNetworkExternalNode::externalNodeHeight() const { | |
| 164 | ✗ | return getImpl<detail::AirflowNetworkExternalNode_Impl>()->externalNodeHeight(); | |
| 165 | } | ||
| 166 | |||
| 167 | 1 | bool AirflowNetworkExternalNode::isExternalNodeHeightDefaulted() const { | |
| 168 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::AirflowNetworkExternalNode_Impl>()->isExternalNodeHeightDefaulted(); |
| 169 | } | ||
| 170 | |||
| 171 | 3 | Curve AirflowNetworkExternalNode::windPressureCoefficientCurve() const { | |
| 172 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::AirflowNetworkExternalNode_Impl>()->windPressureCoefficientCurve(); |
| 173 | } | ||
| 174 | |||
| 175 | ✗ | bool AirflowNetworkExternalNode::symmetricWindPressureCoefficientCurve() const { | |
| 176 | ✗ | return getImpl<detail::AirflowNetworkExternalNode_Impl>()->symmetricWindPressureCoefficientCurve(); | |
| 177 | } | ||
| 178 | |||
| 179 | 1 | bool AirflowNetworkExternalNode::isSymmetricWindPressureCoefficientCurveDefaulted() const { | |
| 180 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::AirflowNetworkExternalNode_Impl>()->isSymmetricWindPressureCoefficientCurveDefaulted(); |
| 181 | } | ||
| 182 | |||
| 183 | 2 | std::string AirflowNetworkExternalNode::windAngleType() const { | |
| 184 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::AirflowNetworkExternalNode_Impl>()->windAngleType(); |
| 185 | } | ||
| 186 | |||
| 187 | 2 | bool AirflowNetworkExternalNode::isWindAngleTypeDefaulted() const { | |
| 188 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::AirflowNetworkExternalNode_Impl>()->isWindAngleTypeDefaulted(); |
| 189 | } | ||
| 190 | |||
| 191 | ✗ | void AirflowNetworkExternalNode::setExternalNodeHeight(double externalNodeHeight) { | |
| 192 | ✗ | getImpl<detail::AirflowNetworkExternalNode_Impl>()->setExternalNodeHeight(externalNodeHeight); | |
| 193 | ✗ | } | |
| 194 | |||
| 195 | ✗ | void AirflowNetworkExternalNode::resetExternalNodeHeight() { | |
| 196 | ✗ | getImpl<detail::AirflowNetworkExternalNode_Impl>()->resetExternalNodeHeight(); | |
| 197 | ✗ | } | |
| 198 | |||
| 199 | 5 | bool AirflowNetworkExternalNode::setWindPressureCoefficientCurve(const Curve& wPCValue) { | |
| 200 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::AirflowNetworkExternalNode_Impl>()->setWindPressureCoefficientCurve(wPCValue); |
| 201 | } | ||
| 202 | |||
| 203 | ✗ | void AirflowNetworkExternalNode::setSymmetricWindPressureCoefficientCurve(bool symmetricWindPressureCoefficientCurve) { | |
| 204 | ✗ | getImpl<detail::AirflowNetworkExternalNode_Impl>()->setSymmetricWindPressureCoefficientCurve(symmetricWindPressureCoefficientCurve); | |
| 205 | ✗ | } | |
| 206 | |||
| 207 | ✗ | void AirflowNetworkExternalNode::resetSymmetricWindPressureCoefficientCurve() { | |
| 208 | ✗ | getImpl<detail::AirflowNetworkExternalNode_Impl>()->resetSymmetricWindPressureCoefficientCurve(); | |
| 209 | ✗ | } | |
| 210 | |||
| 211 | 1 | bool AirflowNetworkExternalNode::setWindAngleType(const std::string& windAngleType) { | |
| 212 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::AirflowNetworkExternalNode_Impl>()->setWindAngleType(windAngleType); |
| 213 | } | ||
| 214 | |||
| 215 | ✗ | void AirflowNetworkExternalNode::resetWindAngleType() { | |
| 216 | ✗ | getImpl<detail::AirflowNetworkExternalNode_Impl>()->resetWindAngleType(); | |
| 217 | ✗ | } | |
| 218 | |||
| 219 | /// @cond | ||
| 220 |
1/1✓ Branch 2 taken 2 times.
|
2 | AirflowNetworkExternalNode::AirflowNetworkExternalNode(std::shared_ptr<detail::AirflowNetworkExternalNode_Impl> impl) : AirflowNetworkNode(impl) {} |
| 221 | /// @endcond | ||
| 222 | |||
| 223 | } // namespace model | ||
| 224 | } // namespace openstudio | ||
| 225 |