src/model/AirflowNetworkSimpleOpening.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 "AirflowNetworkSimpleOpening.hpp" | ||
| 7 | #include "AirflowNetworkSimpleOpening_Impl.hpp" | ||
| 8 | |||
| 9 | #include <utilities/idd/IddEnums.hxx> | ||
| 10 | #include <utilities/idd/OS_AirflowNetworkSimpleOpening_FieldEnums.hxx> | ||
| 11 | |||
| 12 | #include "../utilities/units/Unit.hpp" | ||
| 13 | |||
| 14 | #include "../utilities/core/Assert.hpp" | ||
| 15 | |||
| 16 | namespace openstudio { | ||
| 17 | namespace model { | ||
| 18 | |||
| 19 | namespace detail { | ||
| 20 | |||
| 21 | 3 | AirflowNetworkSimpleOpening_Impl::AirflowNetworkSimpleOpening_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 22 | 3 | : AirflowNetworkComponent_Impl(idfObject, model, keepHandle) { | |
| 23 |
4/6✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 3 times.
✗ Branch 13 not taken.
|
3 | OS_ASSERT(idfObject.iddObject().type() == AirflowNetworkSimpleOpening::iddObjectType()); |
| 24 | 3 | } | |
| 25 | |||
| 26 | ✗ | AirflowNetworkSimpleOpening_Impl::AirflowNetworkSimpleOpening_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, | |
| 27 | ✗ | bool keepHandle) | |
| 28 | ✗ | : AirflowNetworkComponent_Impl(other, model, keepHandle) { | |
| 29 | ✗ | OS_ASSERT(other.iddObject().type() == AirflowNetworkSimpleOpening::iddObjectType()); | |
| 30 | ✗ | } | |
| 31 | |||
| 32 | 1 | AirflowNetworkSimpleOpening_Impl::AirflowNetworkSimpleOpening_Impl(const AirflowNetworkSimpleOpening_Impl& other, Model_Impl* model, | |
| 33 | 1 | bool keepHandle) | |
| 34 | 1 | : AirflowNetworkComponent_Impl(other, model, keepHandle) {} | |
| 35 | |||
| 36 | ✗ | const std::vector<std::string>& AirflowNetworkSimpleOpening_Impl::outputVariableNames() const { | |
| 37 | ✗ | static const std::vector<std::string> result; | |
| 38 | ✗ | return result; | |
| 39 | } | ||
| 40 | |||
| 41 | ✗ | IddObjectType AirflowNetworkSimpleOpening_Impl::iddObjectType() const { | |
| 42 | ✗ | return AirflowNetworkSimpleOpening::iddObjectType(); | |
| 43 | } | ||
| 44 | |||
| 45 | 3 | double AirflowNetworkSimpleOpening_Impl::airMassFlowCoefficientWhenOpeningisClosed() const { | |
| 46 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> value = getDouble(OS_AirflowNetworkSimpleOpeningFields::AirMassFlowCoefficientWhenOpeningisClosed, true); |
| 47 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(value); |
| 48 |
1/1✓ Branch 1 taken 3 times.
|
6 | return value.get(); |
| 49 | } | ||
| 50 | |||
| 51 | 3 | double AirflowNetworkSimpleOpening_Impl::airMassFlowExponentWhenOpeningisClosed() const { | |
| 52 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> value = getDouble(OS_AirflowNetworkSimpleOpeningFields::AirMassFlowExponentWhenOpeningisClosed, true); |
| 53 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(value); |
| 54 |
1/1✓ Branch 1 taken 3 times.
|
6 | return value.get(); |
| 55 | } | ||
| 56 | |||
| 57 | ✗ | bool AirflowNetworkSimpleOpening_Impl::isAirMassFlowExponentWhenOpeningisClosedDefaulted() const { | |
| 58 | ✗ | return isEmpty(OS_AirflowNetworkSimpleOpeningFields::AirMassFlowExponentWhenOpeningisClosed); | |
| 59 | } | ||
| 60 | |||
| 61 | 3 | double AirflowNetworkSimpleOpening_Impl::minimumDensityDifferenceforTwoWayFlow() const { | |
| 62 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> value = getDouble(OS_AirflowNetworkSimpleOpeningFields::MinimumDensityDifferenceforTwoWayFlow, true); |
| 63 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(value); |
| 64 |
1/1✓ Branch 1 taken 3 times.
|
6 | return value.get(); |
| 65 | } | ||
| 66 | |||
| 67 | 3 | double AirflowNetworkSimpleOpening_Impl::dischargeCoefficient() const { | |
| 68 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> value = getDouble(OS_AirflowNetworkSimpleOpeningFields::DischargeCoefficient, true); |
| 69 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(value); |
| 70 |
1/1✓ Branch 1 taken 3 times.
|
6 | return value.get(); |
| 71 | } | ||
| 72 | |||
| 73 | 3 | bool AirflowNetworkSimpleOpening_Impl::setAirMassFlowCoefficientWhenOpeningisClosed(double airMassFlowCoefficientWhenOpeningisClosed) { | |
| 74 | 3 | return setDouble(OS_AirflowNetworkSimpleOpeningFields::AirMassFlowCoefficientWhenOpeningisClosed, airMassFlowCoefficientWhenOpeningisClosed); | |
| 75 | } | ||
| 76 | |||
| 77 | 1 | bool AirflowNetworkSimpleOpening_Impl::setAirMassFlowExponentWhenOpeningisClosed(double airMassFlowExponentWhenOpeningisClosed) { | |
| 78 | 1 | return setDouble(OS_AirflowNetworkSimpleOpeningFields::AirMassFlowExponentWhenOpeningisClosed, airMassFlowExponentWhenOpeningisClosed); | |
| 79 | } | ||
| 80 | |||
| 81 | ✗ | void AirflowNetworkSimpleOpening_Impl::resetAirMassFlowExponentWhenOpeningisClosed() { | |
| 82 | ✗ | bool result = setString(OS_AirflowNetworkSimpleOpeningFields::AirMassFlowExponentWhenOpeningisClosed, ""); | |
| 83 | ✗ | OS_ASSERT(result); | |
| 84 | ✗ | } | |
| 85 | |||
| 86 | 3 | bool AirflowNetworkSimpleOpening_Impl::setMinimumDensityDifferenceforTwoWayFlow(double minimumDensityDifferenceforTwoWayFlow) { | |
| 87 | 3 | return setDouble(OS_AirflowNetworkSimpleOpeningFields::MinimumDensityDifferenceforTwoWayFlow, minimumDensityDifferenceforTwoWayFlow); | |
| 88 | } | ||
| 89 | |||
| 90 | 3 | bool AirflowNetworkSimpleOpening_Impl::setDischargeCoefficient(double dischargeCoefficient) { | |
| 91 | 3 | bool result = setDouble(OS_AirflowNetworkSimpleOpeningFields::DischargeCoefficient, dischargeCoefficient); | |
| 92 | 3 | return result; | |
| 93 | } | ||
| 94 | |||
| 95 | } // namespace detail | ||
| 96 | |||
| 97 | 2 | AirflowNetworkSimpleOpening::AirflowNetworkSimpleOpening(const Model& model, double massFlowCoefficientWhenOpeningisClosed, | |
| 98 | 2 | double minimumDensityDifferenceforTwoWayFlow, double dischargeCoefficient) | |
| 99 | 2 | : AirflowNetworkComponent(AirflowNetworkSimpleOpening::iddObjectType(), model) { | |
| 100 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 5 not taken.
|
2 | OS_ASSERT(getImpl<detail::AirflowNetworkSimpleOpening_Impl>()); |
| 101 | |||
| 102 |
1/1✓ Branch 1 taken 2 times.
|
2 | bool ok = setAirMassFlowCoefficientWhenOpeningisClosed(massFlowCoefficientWhenOpeningisClosed); |
| 103 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
|
2 | OS_ASSERT(ok); |
| 104 |
1/1✓ Branch 1 taken 2 times.
|
2 | ok = setMinimumDensityDifferenceforTwoWayFlow(minimumDensityDifferenceforTwoWayFlow); |
| 105 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
|
2 | OS_ASSERT(ok); |
| 106 |
1/1✓ Branch 1 taken 2 times.
|
2 | ok = setDischargeCoefficient(dischargeCoefficient); |
| 107 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
|
2 | OS_ASSERT(ok); |
| 108 | 2 | } | |
| 109 | |||
| 110 | 1 | AirflowNetworkSimpleOpening::AirflowNetworkSimpleOpening(const Model& model, double massFlowCoefficientWhenOpeningisClosed, | |
| 111 | double massFlowExponentWhenOpeningisClosed, double minimumDensityDifferenceforTwoWayFlow, | ||
| 112 | 1 | double dischargeCoefficient) | |
| 113 | 1 | : AirflowNetworkComponent(AirflowNetworkSimpleOpening::iddObjectType(), model) { | |
| 114 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 5 not taken.
|
1 | OS_ASSERT(getImpl<detail::AirflowNetworkSimpleOpening_Impl>()); |
| 115 | |||
| 116 |
1/1✓ Branch 1 taken 1 time.
|
1 | bool ok = setAirMassFlowCoefficientWhenOpeningisClosed(massFlowCoefficientWhenOpeningisClosed); |
| 117 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
|
1 | OS_ASSERT(ok); |
| 118 |
1/1✓ Branch 1 taken 1 time.
|
1 | ok = setAirMassFlowExponentWhenOpeningisClosed(massFlowExponentWhenOpeningisClosed); |
| 119 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
|
1 | OS_ASSERT(ok); |
| 120 |
1/1✓ Branch 1 taken 1 time.
|
1 | ok = setMinimumDensityDifferenceforTwoWayFlow(minimumDensityDifferenceforTwoWayFlow); |
| 121 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
|
1 | OS_ASSERT(ok); |
| 122 |
1/1✓ Branch 1 taken 1 time.
|
1 | ok = setDischargeCoefficient(dischargeCoefficient); |
| 123 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
|
1 | OS_ASSERT(ok); |
| 124 | 1 | } | |
| 125 | |||
| 126 | 8637 | IddObjectType AirflowNetworkSimpleOpening::iddObjectType() { | |
| 127 |
1/1✓ Branch 1 taken 8637 times.
|
8637 | return {IddObjectType::OS_AirflowNetworkSimpleOpening}; |
| 128 | } | ||
| 129 | |||
| 130 | 3 | double AirflowNetworkSimpleOpening::airMassFlowCoefficientWhenOpeningisClosed() const { | |
| 131 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::AirflowNetworkSimpleOpening_Impl>()->airMassFlowCoefficientWhenOpeningisClosed(); |
| 132 | } | ||
| 133 | |||
| 134 | 3 | double AirflowNetworkSimpleOpening::airMassFlowExponentWhenOpeningisClosed() const { | |
| 135 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::AirflowNetworkSimpleOpening_Impl>()->airMassFlowExponentWhenOpeningisClosed(); |
| 136 | } | ||
| 137 | |||
| 138 | ✗ | bool AirflowNetworkSimpleOpening::isAirMassFlowExponentWhenOpeningisClosedDefaulted() const { | |
| 139 | ✗ | return getImpl<detail::AirflowNetworkSimpleOpening_Impl>()->isAirMassFlowExponentWhenOpeningisClosedDefaulted(); | |
| 140 | } | ||
| 141 | |||
| 142 | 3 | double AirflowNetworkSimpleOpening::minimumDensityDifferenceforTwoWayFlow() const { | |
| 143 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::AirflowNetworkSimpleOpening_Impl>()->minimumDensityDifferenceforTwoWayFlow(); |
| 144 | } | ||
| 145 | |||
| 146 | 3 | double AirflowNetworkSimpleOpening::dischargeCoefficient() const { | |
| 147 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::AirflowNetworkSimpleOpening_Impl>()->dischargeCoefficient(); |
| 148 | } | ||
| 149 | |||
| 150 | 3 | bool AirflowNetworkSimpleOpening::setAirMassFlowCoefficientWhenOpeningisClosed(double airMassFlowCoefficientWhenOpeningisClosed) { | |
| 151 |
1/1✓ Branch 3 taken 3 times.
|
6 | return getImpl<detail::AirflowNetworkSimpleOpening_Impl>()->setAirMassFlowCoefficientWhenOpeningisClosed( |
| 152 | 6 | airMassFlowCoefficientWhenOpeningisClosed); | |
| 153 | } | ||
| 154 | |||
| 155 | 1 | bool AirflowNetworkSimpleOpening::setAirMassFlowExponentWhenOpeningisClosed(double airMassFlowExponentWhenOpeningisClosed) { | |
| 156 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::AirflowNetworkSimpleOpening_Impl>()->setAirMassFlowExponentWhenOpeningisClosed(airMassFlowExponentWhenOpeningisClosed); |
| 157 | } | ||
| 158 | |||
| 159 | ✗ | void AirflowNetworkSimpleOpening::resetAirMassFlowExponentWhenOpeningisClosed() { | |
| 160 | ✗ | getImpl<detail::AirflowNetworkSimpleOpening_Impl>()->resetAirMassFlowExponentWhenOpeningisClosed(); | |
| 161 | ✗ | } | |
| 162 | |||
| 163 | 3 | bool AirflowNetworkSimpleOpening::setMinimumDensityDifferenceforTwoWayFlow(double minimumDensityDifferenceforTwoWayFlow) { | |
| 164 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::AirflowNetworkSimpleOpening_Impl>()->setMinimumDensityDifferenceforTwoWayFlow(minimumDensityDifferenceforTwoWayFlow); |
| 165 | } | ||
| 166 | |||
| 167 | 3 | bool AirflowNetworkSimpleOpening::setDischargeCoefficient(double dischargeCoefficient) { | |
| 168 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::AirflowNetworkSimpleOpening_Impl>()->setDischargeCoefficient(dischargeCoefficient); |
| 169 | } | ||
| 170 | |||
| 171 | /// @cond | ||
| 172 | 1 | AirflowNetworkSimpleOpening::AirflowNetworkSimpleOpening(std::shared_ptr<detail::AirflowNetworkSimpleOpening_Impl> impl) | |
| 173 |
1/1✓ Branch 2 taken 1 time.
|
1 | : AirflowNetworkComponent(impl) {} |
| 174 | /// @endcond | ||
| 175 | |||
| 176 | } // namespace model | ||
| 177 | } // namespace openstudio | ||
| 178 |