src/model/RefrigerationSubcoolerLiquidSuction.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 "RefrigerationSubcoolerLiquidSuction.hpp" | ||
| 7 | #include "RefrigerationSubcoolerLiquidSuction_Impl.hpp" | ||
| 8 | |||
| 9 | #include "RefrigerationSystem.hpp" | ||
| 10 | #include "RefrigerationSystem_Impl.hpp" | ||
| 11 | |||
| 12 | #include <utilities/idd/OS_Refrigeration_Subcooler_LiquidSuction_FieldEnums.hxx> | ||
| 13 | #include <utilities/idd/IddEnums.hxx> | ||
| 14 | |||
| 15 | #include "../utilities/units/Unit.hpp" | ||
| 16 | |||
| 17 | #include "../utilities/core/Assert.hpp" | ||
| 18 | |||
| 19 | namespace openstudio { | ||
| 20 | namespace model { | ||
| 21 | |||
| 22 | namespace detail { | ||
| 23 | |||
| 24 | 13 | RefrigerationSubcoolerLiquidSuction_Impl::RefrigerationSubcoolerLiquidSuction_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 25 | 13 | : ModelObject_Impl(idfObject, model, keepHandle) { | |
| 26 |
4/6✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 7 taken 13 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 13 times.
✗ Branch 13 not taken.
|
13 | OS_ASSERT(idfObject.iddObject().type() == RefrigerationSubcoolerLiquidSuction::iddObjectType()); |
| 27 | 13 | } | |
| 28 | |||
| 29 | ✗ | RefrigerationSubcoolerLiquidSuction_Impl::RefrigerationSubcoolerLiquidSuction_Impl(const openstudio::detail::WorkspaceObject_Impl& other, | |
| 30 | ✗ | Model_Impl* model, bool keepHandle) | |
| 31 | ✗ | : ModelObject_Impl(other, model, keepHandle) { | |
| 32 | ✗ | OS_ASSERT(other.iddObject().type() == RefrigerationSubcoolerLiquidSuction::iddObjectType()); | |
| 33 | ✗ | } | |
| 34 | |||
| 35 | 14 | RefrigerationSubcoolerLiquidSuction_Impl::RefrigerationSubcoolerLiquidSuction_Impl(const RefrigerationSubcoolerLiquidSuction_Impl& other, | |
| 36 | 14 | Model_Impl* model, bool keepHandle) | |
| 37 | 14 | : ModelObject_Impl(other, model, keepHandle) {} | |
| 38 | |||
| 39 | ✗ | const std::vector<std::string>& RefrigerationSubcoolerLiquidSuction_Impl::outputVariableNames() const { | |
| 40 | static const std::vector<std::string> result{// TODO: implement checks | ||
| 41 | // FOR SUBCOOLERS ON SYSTEMS SERVING CASES AND/OR WALKINS: | ||
| 42 | "Refrigeration System Liquid Suction Subcooler Heat Transfer Rate", | ||
| 43 | "Refrigeration System Liquid Suction Subcooler Heat Transfer Energy", | ||
| 44 | // FOR SUBCOOLERS ON SYSTEMS SERVING AIR CHILLERS: | ||
| 45 | "Refrigeration Air Chiller System Liquid Suction Subcooler Heat Transfer Rate", | ||
| 46 | ✗ | "Refrigeration Air Chiller System Liquid Suction Subcooler Heat Transfer Energy"}; | |
| 47 | ✗ | return result; | |
| 48 | ✗ | } | |
| 49 | |||
| 50 | ✗ | IddObjectType RefrigerationSubcoolerLiquidSuction_Impl::iddObjectType() const { | |
| 51 | ✗ | return RefrigerationSubcoolerLiquidSuction::iddObjectType(); | |
| 52 | } | ||
| 53 | |||
| 54 | 5 | boost::optional<double> RefrigerationSubcoolerLiquidSuction_Impl::liquidSuctionDesignSubcoolingTemperatureDifference() const { | |
| 55 | 5 | return getDouble(OS_Refrigeration_Subcooler_LiquidSuctionFields::LiquidSuctionDesignSubcoolingTemperatureDifference, true); | |
| 56 | } | ||
| 57 | |||
| 58 | 5 | boost::optional<double> RefrigerationSubcoolerLiquidSuction_Impl::designLiquidInletTemperature() const { | |
| 59 | 5 | return getDouble(OS_Refrigeration_Subcooler_LiquidSuctionFields::DesignLiquidInletTemperature, true); | |
| 60 | } | ||
| 61 | |||
| 62 | 5 | boost::optional<double> RefrigerationSubcoolerLiquidSuction_Impl::designVaporInletTemperature() const { | |
| 63 | 5 | return getDouble(OS_Refrigeration_Subcooler_LiquidSuctionFields::DesignVaporInletTemperature, true); | |
| 64 | } | ||
| 65 | |||
| 66 | 16 | bool RefrigerationSubcoolerLiquidSuction_Impl::setLiquidSuctionDesignSubcoolingTemperatureDifference( | |
| 67 | boost::optional<double> liquidSuctionDesignSubcoolingTemperatureDifference) { | ||
| 68 | 16 | bool result(false); | |
| 69 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (liquidSuctionDesignSubcoolingTemperatureDifference) { |
| 70 | 16 | result = setDouble(OS_Refrigeration_Subcooler_LiquidSuctionFields::LiquidSuctionDesignSubcoolingTemperatureDifference, | |
| 71 | 16 | liquidSuctionDesignSubcoolingTemperatureDifference.get()); | |
| 72 | } else { | ||
| 73 | ✗ | resetLiquidSuctionDesignSubcoolingTemperatureDifference(); | |
| 74 | ✗ | result = true; | |
| 75 | } | ||
| 76 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | OS_ASSERT(result); |
| 77 | 16 | return result; | |
| 78 | } | ||
| 79 | |||
| 80 | ✗ | void RefrigerationSubcoolerLiquidSuction_Impl::resetLiquidSuctionDesignSubcoolingTemperatureDifference() { | |
| 81 | ✗ | bool result = setString(OS_Refrigeration_Subcooler_LiquidSuctionFields::LiquidSuctionDesignSubcoolingTemperatureDifference, ""); | |
| 82 | ✗ | OS_ASSERT(result); | |
| 83 | ✗ | } | |
| 84 | |||
| 85 | 16 | bool RefrigerationSubcoolerLiquidSuction_Impl::setDesignLiquidInletTemperature(boost::optional<double> designLiquidInletTemperature) { | |
| 86 | 16 | bool result(false); | |
| 87 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (designLiquidInletTemperature) { |
| 88 | 16 | result = setDouble(OS_Refrigeration_Subcooler_LiquidSuctionFields::DesignLiquidInletTemperature, designLiquidInletTemperature.get()); | |
| 89 | } else { | ||
| 90 | ✗ | resetDesignLiquidInletTemperature(); | |
| 91 | ✗ | result = true; | |
| 92 | } | ||
| 93 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | OS_ASSERT(result); |
| 94 | 16 | return result; | |
| 95 | } | ||
| 96 | |||
| 97 | ✗ | void RefrigerationSubcoolerLiquidSuction_Impl::resetDesignLiquidInletTemperature() { | |
| 98 | ✗ | bool result = setString(OS_Refrigeration_Subcooler_LiquidSuctionFields::DesignLiquidInletTemperature, ""); | |
| 99 | ✗ | OS_ASSERT(result); | |
| 100 | ✗ | } | |
| 101 | |||
| 102 | 16 | bool RefrigerationSubcoolerLiquidSuction_Impl::setDesignVaporInletTemperature(boost::optional<double> designVaporInletTemperature) { | |
| 103 | 16 | bool result(false); | |
| 104 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (designVaporInletTemperature) { |
| 105 | 16 | result = setDouble(OS_Refrigeration_Subcooler_LiquidSuctionFields::DesignVaporInletTemperature, designVaporInletTemperature.get()); | |
| 106 | } else { | ||
| 107 | ✗ | resetDesignVaporInletTemperature(); | |
| 108 | ✗ | result = true; | |
| 109 | } | ||
| 110 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | OS_ASSERT(result); |
| 111 | 16 | return result; | |
| 112 | } | ||
| 113 | |||
| 114 | ✗ | void RefrigerationSubcoolerLiquidSuction_Impl::resetDesignVaporInletTemperature() { | |
| 115 | ✗ | bool result = setString(OS_Refrigeration_Subcooler_LiquidSuctionFields::DesignVaporInletTemperature, ""); | |
| 116 | ✗ | OS_ASSERT(result); | |
| 117 | ✗ | } | |
| 118 | |||
| 119 | 16 | boost::optional<RefrigerationSystem> RefrigerationSubcoolerLiquidSuction_Impl::system() const { | |
| 120 | |||
| 121 | 16 | boost::optional<RefrigerationSystem> system; | |
| 122 | // We use getModelObjectSources to check if more than one | ||
| 123 | std::vector<RefrigerationSystem> systems = | ||
| 124 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | getObject<ModelObject>().getModelObjectSources<RefrigerationSystem>(RefrigerationSystem::iddObjectType()); |
| 125 | |||
| 126 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 2 taken 11 times.
|
16 | if (!systems.empty()) { |
| 127 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
|
5 | if (systems.size() > 1u) { |
| 128 | ✗ | LOG(Error, briefDescription() << " is referenced by more than one RefrigerationSystem, returning the first"); | |
| 129 | } | ||
| 130 |
1/1✓ Branch 2 taken 5 times.
|
5 | system = systems[0]; |
| 131 | } | ||
| 132 | 32 | return system; | |
| 133 | 16 | } | |
| 134 | |||
| 135 | } // namespace detail | ||
| 136 | |||
| 137 | 13 | RefrigerationSubcoolerLiquidSuction::RefrigerationSubcoolerLiquidSuction(const Model& model) | |
| 138 | 13 | : ModelObject(RefrigerationSubcoolerLiquidSuction::iddObjectType(), model) { | |
| 139 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 13 times.
✗ Branch 5 not taken.
|
13 | OS_ASSERT(getImpl<detail::RefrigerationSubcoolerLiquidSuction_Impl>()); |
| 140 | |||
| 141 | // Brian's values | ||
| 142 |
1/1✓ Branch 1 taken 13 times.
|
13 | setLiquidSuctionDesignSubcoolingTemperatureDifference(6.0); |
| 143 | |||
| 144 | // Brian's values | ||
| 145 |
1/1✓ Branch 1 taken 13 times.
|
13 | setDesignLiquidInletTemperature(16.0); |
| 146 | |||
| 147 | // Brian's values | ||
| 148 |
1/1✓ Branch 1 taken 13 times.
|
13 | setDesignVaporInletTemperature(0.0); |
| 149 | 13 | } | |
| 150 | |||
| 151 | 7637 | IddObjectType RefrigerationSubcoolerLiquidSuction::iddObjectType() { | |
| 152 |
1/1✓ Branch 1 taken 7637 times.
|
7637 | return {IddObjectType::OS_Refrigeration_Subcooler_LiquidSuction}; |
| 153 | } | ||
| 154 | |||
| 155 | 5 | boost::optional<double> RefrigerationSubcoolerLiquidSuction::liquidSuctionDesignSubcoolingTemperatureDifference() const { | |
| 156 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::RefrigerationSubcoolerLiquidSuction_Impl>()->liquidSuctionDesignSubcoolingTemperatureDifference(); |
| 157 | } | ||
| 158 | |||
| 159 | 5 | boost::optional<double> RefrigerationSubcoolerLiquidSuction::designLiquidInletTemperature() const { | |
| 160 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::RefrigerationSubcoolerLiquidSuction_Impl>()->designLiquidInletTemperature(); |
| 161 | } | ||
| 162 | |||
| 163 | 5 | boost::optional<double> RefrigerationSubcoolerLiquidSuction::designVaporInletTemperature() const { | |
| 164 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::RefrigerationSubcoolerLiquidSuction_Impl>()->designVaporInletTemperature(); |
| 165 | } | ||
| 166 | |||
| 167 | 16 | bool RefrigerationSubcoolerLiquidSuction::setLiquidSuctionDesignSubcoolingTemperatureDifference( | |
| 168 | double liquidSuctionDesignSubcoolingTemperatureDifference) { | ||
| 169 |
2/2✓ Branch 3 taken 16 times.
✓ Branch 6 taken 16 times.
|
32 | return getImpl<detail::RefrigerationSubcoolerLiquidSuction_Impl>()->setLiquidSuctionDesignSubcoolingTemperatureDifference( |
| 170 | 32 | liquidSuctionDesignSubcoolingTemperatureDifference); | |
| 171 | } | ||
| 172 | |||
| 173 | ✗ | void RefrigerationSubcoolerLiquidSuction::resetLiquidSuctionDesignSubcoolingTemperatureDifference() { | |
| 174 | ✗ | getImpl<detail::RefrigerationSubcoolerLiquidSuction_Impl>()->resetLiquidSuctionDesignSubcoolingTemperatureDifference(); | |
| 175 | ✗ | } | |
| 176 | |||
| 177 | 16 | bool RefrigerationSubcoolerLiquidSuction::setDesignLiquidInletTemperature(double designLiquidInletTemperature) { | |
| 178 |
2/2✓ Branch 3 taken 16 times.
✓ Branch 6 taken 16 times.
|
16 | return getImpl<detail::RefrigerationSubcoolerLiquidSuction_Impl>()->setDesignLiquidInletTemperature(designLiquidInletTemperature); |
| 179 | } | ||
| 180 | |||
| 181 | ✗ | void RefrigerationSubcoolerLiquidSuction::resetDesignLiquidInletTemperature() { | |
| 182 | ✗ | getImpl<detail::RefrigerationSubcoolerLiquidSuction_Impl>()->resetDesignLiquidInletTemperature(); | |
| 183 | ✗ | } | |
| 184 | |||
| 185 | 16 | bool RefrigerationSubcoolerLiquidSuction::setDesignVaporInletTemperature(double designVaporInletTemperature) { | |
| 186 |
2/2✓ Branch 3 taken 16 times.
✓ Branch 6 taken 16 times.
|
16 | return getImpl<detail::RefrigerationSubcoolerLiquidSuction_Impl>()->setDesignVaporInletTemperature(designVaporInletTemperature); |
| 187 | } | ||
| 188 | |||
| 189 | ✗ | void RefrigerationSubcoolerLiquidSuction::resetDesignVaporInletTemperature() { | |
| 190 | ✗ | getImpl<detail::RefrigerationSubcoolerLiquidSuction_Impl>()->resetDesignVaporInletTemperature(); | |
| 191 | ✗ | } | |
| 192 | |||
| 193 | 16 | boost::optional<RefrigerationSystem> RefrigerationSubcoolerLiquidSuction::system() const { | |
| 194 |
1/1✓ Branch 3 taken 16 times.
|
16 | return getImpl<detail::RefrigerationSubcoolerLiquidSuction_Impl>()->system(); |
| 195 | } | ||
| 196 | |||
| 197 | /// @cond | ||
| 198 | 35 | RefrigerationSubcoolerLiquidSuction::RefrigerationSubcoolerLiquidSuction(std::shared_ptr<detail::RefrigerationSubcoolerLiquidSuction_Impl> impl) | |
| 199 |
1/1✓ Branch 3 taken 35 times.
|
35 | : ModelObject(std::move(impl)) {} |
| 200 | /// @endcond | ||
| 201 | |||
| 202 | } // namespace model | ||
| 203 | } // namespace openstudio | ||
| 204 |