src/model/AirflowNetworkSpecifiedFlowRate.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 "AirflowNetworkSpecifiedFlowRate.hpp" | ||
| 7 | #include "AirflowNetworkSpecifiedFlowRate_Impl.hpp" | ||
| 8 | |||
| 9 | #include <utilities/idd/IddFactory.hxx> | ||
| 10 | |||
| 11 | #include <utilities/idd/OS_AirflowNetworkSpecifiedFlowRate_FieldEnums.hxx> | ||
| 12 | #include <utilities/idd/IddEnums.hxx> | ||
| 13 | |||
| 14 | #include "../utilities/units/Unit.hpp" | ||
| 15 | |||
| 16 | #include "../utilities/core/Assert.hpp" | ||
| 17 | |||
| 18 | namespace openstudio { | ||
| 19 | namespace model { | ||
| 20 | |||
| 21 | namespace detail { | ||
| 22 | |||
| 23 | 4 | AirflowNetworkSpecifiedFlowRate_Impl::AirflowNetworkSpecifiedFlowRate_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 24 | 4 | : AirflowNetworkComponent_Impl(idfObject, model, keepHandle) { | |
| 25 |
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() == AirflowNetworkSpecifiedFlowRate::iddObjectType()); |
| 26 | 4 | } | |
| 27 | |||
| 28 | ✗ | AirflowNetworkSpecifiedFlowRate_Impl::AirflowNetworkSpecifiedFlowRate_Impl(const openstudio::detail::WorkspaceObject_Impl& other, | |
| 29 | ✗ | Model_Impl* model, bool keepHandle) | |
| 30 | ✗ | : AirflowNetworkComponent_Impl(other, model, keepHandle) { | |
| 31 | ✗ | OS_ASSERT(other.iddObject().type() == AirflowNetworkSpecifiedFlowRate::iddObjectType()); | |
| 32 | ✗ | } | |
| 33 | |||
| 34 | 1 | AirflowNetworkSpecifiedFlowRate_Impl::AirflowNetworkSpecifiedFlowRate_Impl(const AirflowNetworkSpecifiedFlowRate_Impl& other, Model_Impl* model, | |
| 35 | 1 | bool keepHandle) | |
| 36 | 1 | : AirflowNetworkComponent_Impl(other, model, keepHandle) {} | |
| 37 | |||
| 38 | ✗ | const std::vector<std::string>& AirflowNetworkSpecifiedFlowRate_Impl::outputVariableNames() const { | |
| 39 | ✗ | static const std::vector<std::string> result; | |
| 40 | ✗ | return result; | |
| 41 | } | ||
| 42 | |||
| 43 | ✗ | IddObjectType AirflowNetworkSpecifiedFlowRate_Impl::iddObjectType() const { | |
| 44 | ✗ | return AirflowNetworkSpecifiedFlowRate::iddObjectType(); | |
| 45 | } | ||
| 46 | |||
| 47 | 5 | double AirflowNetworkSpecifiedFlowRate_Impl::airFlowValue() const { | |
| 48 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> value = getDouble(OS_AirflowNetworkSpecifiedFlowRateFields::AirFlowValue, true); |
| 49 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(value); |
| 50 |
1/1✓ Branch 1 taken 5 times.
|
10 | return value.get(); |
| 51 | } | ||
| 52 | |||
| 53 | 5 | std::string AirflowNetworkSpecifiedFlowRate_Impl::airFlowUnits() const { | |
| 54 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<std::string> value = getString(OS_AirflowNetworkSpecifiedFlowRateFields::AirFlowUnits, true); |
| 55 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(value); |
| 56 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
10 | return value.get(); |
| 57 | 5 | } | |
| 58 | |||
| 59 | 5 | bool AirflowNetworkSpecifiedFlowRate_Impl::isAirFlowUnitsDefaulted() const { | |
| 60 | 5 | return isEmpty(OS_AirflowNetworkSpecifiedFlowRateFields::AirFlowUnits); | |
| 61 | } | ||
| 62 | |||
| 63 | 5 | bool AirflowNetworkSpecifiedFlowRate_Impl::setAirFlowValue(double airFlowValue) { | |
| 64 | 5 | bool result = setDouble(OS_AirflowNetworkSpecifiedFlowRateFields::AirFlowValue, airFlowValue); | |
| 65 | 5 | return result; | |
| 66 | } | ||
| 67 | |||
| 68 | 1 | bool AirflowNetworkSpecifiedFlowRate_Impl::setAirFlowUnits(const std::string& airFlowUnits) { | |
| 69 | 1 | bool result = setString(OS_AirflowNetworkSpecifiedFlowRateFields::AirFlowUnits, airFlowUnits); | |
| 70 | 1 | return result; | |
| 71 | } | ||
| 72 | |||
| 73 | 1 | void AirflowNetworkSpecifiedFlowRate_Impl::resetAirFlowUnits() { | |
| 74 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_AirflowNetworkSpecifiedFlowRateFields::AirFlowUnits, ""); |
| 75 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 76 | 1 | } | |
| 77 | |||
| 78 | } // namespace detail | ||
| 79 | |||
| 80 | 1 | AirflowNetworkSpecifiedFlowRate::AirflowNetworkSpecifiedFlowRate(const Model& model) | |
| 81 | 1 | : AirflowNetworkComponent(AirflowNetworkSpecifiedFlowRate::iddObjectType(), model) { | |
| 82 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 5 not taken.
|
1 | OS_ASSERT(getImpl<detail::AirflowNetworkSpecifiedFlowRate_Impl>()); |
| 83 | |||
| 84 |
1/1✓ Branch 1 taken 1 time.
|
1 | bool ok = setAirFlowValue(0); |
| 85 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
|
1 | OS_ASSERT(ok); |
| 86 | 1 | } | |
| 87 | |||
| 88 | 3 | AirflowNetworkSpecifiedFlowRate::AirflowNetworkSpecifiedFlowRate(const Model& model, double airFlowValue) | |
| 89 | 3 | : AirflowNetworkComponent(AirflowNetworkSpecifiedFlowRate::iddObjectType(), model) { | |
| 90 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 5 not taken.
|
3 | OS_ASSERT(getImpl<detail::AirflowNetworkSpecifiedFlowRate_Impl>()); |
| 91 | |||
| 92 |
1/1✓ Branch 1 taken 3 times.
|
3 | bool ok = setAirFlowValue(airFlowValue); |
| 93 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
|
3 | OS_ASSERT(ok); |
| 94 | 3 | } | |
| 95 | |||
| 96 | 8495 | IddObjectType AirflowNetworkSpecifiedFlowRate::iddObjectType() { | |
| 97 |
1/1✓ Branch 1 taken 8495 times.
|
8495 | return {IddObjectType::OS_AirflowNetworkSpecifiedFlowRate}; |
| 98 | } | ||
| 99 | |||
| 100 | ✗ | std::vector<std::string> AirflowNetworkSpecifiedFlowRate::airFlowUnitsValues() { | |
| 101 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_AirflowNetworkSpecifiedFlowRateFields::AirFlowUnits); | |
| 102 | } | ||
| 103 | |||
| 104 | ✗ | std::vector<std::string> AirflowNetworkSpecifiedFlowRate::validAirFlowUnitsValues() { | |
| 105 | ✗ | return airFlowUnitsValues(); | |
| 106 | } | ||
| 107 | |||
| 108 | 5 | double AirflowNetworkSpecifiedFlowRate::airFlowValue() const { | |
| 109 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::AirflowNetworkSpecifiedFlowRate_Impl>()->airFlowValue(); |
| 110 | } | ||
| 111 | |||
| 112 | 5 | std::string AirflowNetworkSpecifiedFlowRate::airFlowUnits() const { | |
| 113 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::AirflowNetworkSpecifiedFlowRate_Impl>()->airFlowUnits(); |
| 114 | } | ||
| 115 | |||
| 116 | 5 | bool AirflowNetworkSpecifiedFlowRate::isAirFlowUnitsDefaulted() const { | |
| 117 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::AirflowNetworkSpecifiedFlowRate_Impl>()->isAirFlowUnitsDefaulted(); |
| 118 | } | ||
| 119 | |||
| 120 | 5 | bool AirflowNetworkSpecifiedFlowRate::setAirFlowValue(double airFlowValue) { | |
| 121 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::AirflowNetworkSpecifiedFlowRate_Impl>()->setAirFlowValue(airFlowValue); |
| 122 | } | ||
| 123 | |||
| 124 | 1 | bool AirflowNetworkSpecifiedFlowRate::setAirFlowUnits(const std::string& airFlowUnits) { | |
| 125 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::AirflowNetworkSpecifiedFlowRate_Impl>()->setAirFlowUnits(airFlowUnits); |
| 126 | } | ||
| 127 | |||
| 128 | 1 | void AirflowNetworkSpecifiedFlowRate::resetAirFlowUnits() { | |
| 129 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::AirflowNetworkSpecifiedFlowRate_Impl>()->resetAirFlowUnits(); |
| 130 | } | ||
| 131 | |||
| 132 | /// @cond | ||
| 133 | 1 | AirflowNetworkSpecifiedFlowRate::AirflowNetworkSpecifiedFlowRate(std::shared_ptr<detail::AirflowNetworkSpecifiedFlowRate_Impl> impl) | |
| 134 |
1/1✓ Branch 2 taken 1 time.
|
1 | : AirflowNetworkComponent(impl) {} |
| 135 | /// @endcond | ||
| 136 | |||
| 137 | } // namespace model | ||
| 138 | } // namespace openstudio | ||
| 139 |