src/model/HeatBalanceAlgorithm.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 "HeatBalanceAlgorithm.hpp" | ||
| 7 | #include "HeatBalanceAlgorithm_Impl.hpp" | ||
| 8 | #include "SimulationControl.hpp" | ||
| 9 | #include "SimulationControl_Impl.hpp" | ||
| 10 | #include "Model.hpp" | ||
| 11 | #include "Model_Impl.hpp" | ||
| 12 | |||
| 13 | #include "../utilities/core/Assert.hpp" | ||
| 14 | |||
| 15 | #include <utilities/idd/IddFactory.hxx> | ||
| 16 | |||
| 17 | #include <utilities/idd/OS_HeatBalanceAlgorithm_FieldEnums.hxx> | ||
| 18 | #include <utilities/idd/IddEnums.hxx> | ||
| 19 | |||
| 20 | namespace openstudio { | ||
| 21 | namespace model { | ||
| 22 | |||
| 23 | namespace detail { | ||
| 24 | |||
| 25 | 313 | HeatBalanceAlgorithm_Impl::HeatBalanceAlgorithm_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 26 | 313 | : ModelObject_Impl(idfObject, model, keepHandle) { | |
| 27 |
4/6✓ Branch 1 taken 313 times.
✓ Branch 4 taken 313 times.
✓ Branch 7 taken 313 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 313 times.
✗ Branch 13 not taken.
|
313 | OS_ASSERT(idfObject.iddObject().type() == HeatBalanceAlgorithm::iddObjectType()); |
| 28 | 313 | } | |
| 29 | |||
| 30 | 58 | HeatBalanceAlgorithm_Impl::HeatBalanceAlgorithm_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 31 | 58 | : ModelObject_Impl(other, model, keepHandle) { | |
| 32 |
4/6✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
✓ Branch 7 taken 58 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 58 times.
✗ Branch 13 not taken.
|
58 | OS_ASSERT(other.iddObject().type() == HeatBalanceAlgorithm::iddObjectType()); |
| 33 | 58 | } | |
| 34 | |||
| 35 | 119 | HeatBalanceAlgorithm_Impl::HeatBalanceAlgorithm_Impl(const HeatBalanceAlgorithm_Impl& other, Model_Impl* model, bool keepHandle) | |
| 36 | 119 | : ModelObject_Impl(other, model, keepHandle) {} | |
| 37 | |||
| 38 | // return the parent object in the hierarchy | ||
| 39 | 1 | boost::optional<ParentObject> HeatBalanceAlgorithm_Impl::parent() const { | |
| 40 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | boost::optional<ParentObject> result(model().getUniqueModelObject<SimulationControl>()); |
| 41 | 1 | return result; | |
| 42 | } | ||
| 43 | |||
| 44 | // set the parent, child may have to call methods on the parent | ||
| 45 | ✗ | bool HeatBalanceAlgorithm_Impl::setParent(ParentObject& newParent) { | |
| 46 | ✗ | if (newParent.optionalCast<SimulationControl>() && (newParent.model() == model())) { | |
| 47 | ✗ | return true; | |
| 48 | } | ||
| 49 | ✗ | return false; | |
| 50 | } | ||
| 51 | |||
| 52 | // Get all output variable names that could be associated with this object. | ||
| 53 | 1 | const std::vector<std::string>& HeatBalanceAlgorithm_Impl::outputVariableNames() const { | |
| 54 |
2/4✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | static const std::vector<std::string> result; |
| 55 | 1 | return result; | |
| 56 | } | ||
| 57 | |||
| 58 | 1 | IddObjectType HeatBalanceAlgorithm_Impl::iddObjectType() const { | |
| 59 | 1 | return HeatBalanceAlgorithm::iddObjectType(); | |
| 60 | } | ||
| 61 | |||
| 62 | 46 | std::string HeatBalanceAlgorithm_Impl::algorithm() const { | |
| 63 |
1/1✓ Branch 1 taken 46 times.
|
46 | boost::optional<std::string> value = getString(OS_HeatBalanceAlgorithmFields::Algorithm, true); |
| 64 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 46 times.
✗ Branch 4 not taken.
|
46 | OS_ASSERT(value); |
| 65 |
2/2✓ Branch 1 taken 46 times.
✓ Branch 4 taken 46 times.
|
92 | return value.get(); |
| 66 | 46 | } | |
| 67 | |||
| 68 | ✗ | bool HeatBalanceAlgorithm_Impl::isAlgorithmDefaulted() const { | |
| 69 | ✗ | return isEmpty(OS_HeatBalanceAlgorithmFields::Algorithm); | |
| 70 | } | ||
| 71 | |||
| 72 | 46 | double HeatBalanceAlgorithm_Impl::surfaceTemperatureUpperLimit() const { | |
| 73 |
1/1✓ Branch 1 taken 46 times.
|
46 | boost::optional<double> value = getDouble(OS_HeatBalanceAlgorithmFields::SurfaceTemperatureUpperLimit, true); |
| 74 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 46 times.
✗ Branch 4 not taken.
|
46 | OS_ASSERT(value); |
| 75 |
1/1✓ Branch 1 taken 46 times.
|
92 | return value.get(); |
| 76 | } | ||
| 77 | |||
| 78 | ✗ | bool HeatBalanceAlgorithm_Impl::isSurfaceTemperatureUpperLimitDefaulted() const { | |
| 79 | ✗ | return isEmpty(OS_HeatBalanceAlgorithmFields::SurfaceTemperatureUpperLimit); | |
| 80 | } | ||
| 81 | |||
| 82 | ✗ | double HeatBalanceAlgorithm_Impl::minimumSurfaceConvectionHeatTransferCoefficientValue() const { | |
| 83 | ✗ | boost::optional<double> value = getDouble(OS_HeatBalanceAlgorithmFields::MinimumSurfaceConvectionHeatTransferCoefficientValue, true); | |
| 84 | ✗ | OS_ASSERT(value); | |
| 85 | ✗ | return value.get(); | |
| 86 | } | ||
| 87 | |||
| 88 | 46 | bool HeatBalanceAlgorithm_Impl::isMinimumSurfaceConvectionHeatTransferCoefficientValueDefaulted() const { | |
| 89 | 46 | return isEmpty(OS_HeatBalanceAlgorithmFields::MinimumSurfaceConvectionHeatTransferCoefficientValue); | |
| 90 | } | ||
| 91 | |||
| 92 | ✗ | double HeatBalanceAlgorithm_Impl::maximumSurfaceConvectionHeatTransferCoefficientValue() const { | |
| 93 | ✗ | boost::optional<double> value = getDouble(OS_HeatBalanceAlgorithmFields::MaximumSurfaceConvectionHeatTransferCoefficientValue, true); | |
| 94 | ✗ | OS_ASSERT(value); | |
| 95 | ✗ | return value.get(); | |
| 96 | } | ||
| 97 | |||
| 98 | 46 | bool HeatBalanceAlgorithm_Impl::isMaximumSurfaceConvectionHeatTransferCoefficientValueDefaulted() const { | |
| 99 | 46 | return isEmpty(OS_HeatBalanceAlgorithmFields::MaximumSurfaceConvectionHeatTransferCoefficientValue); | |
| 100 | } | ||
| 101 | |||
| 102 | 259 | bool HeatBalanceAlgorithm_Impl::setAlgorithm(const std::string& algorithm) { | |
| 103 | 259 | bool result = setString(OS_HeatBalanceAlgorithmFields::Algorithm, algorithm); | |
| 104 | 259 | return result; | |
| 105 | } | ||
| 106 | |||
| 107 | ✗ | void HeatBalanceAlgorithm_Impl::resetAlgorithm() { | |
| 108 | ✗ | bool result = setString(OS_HeatBalanceAlgorithmFields::Algorithm, ""); | |
| 109 | ✗ | OS_ASSERT(result); | |
| 110 | ✗ | } | |
| 111 | |||
| 112 | 257 | bool HeatBalanceAlgorithm_Impl::setSurfaceTemperatureUpperLimit(double surfaceTemperatureUpperLimit) { | |
| 113 | 257 | bool result = setDouble(OS_HeatBalanceAlgorithmFields::SurfaceTemperatureUpperLimit, surfaceTemperatureUpperLimit); | |
| 114 | 257 | return result; | |
| 115 | } | ||
| 116 | |||
| 117 | ✗ | void HeatBalanceAlgorithm_Impl::resetSurfaceTemperatureUpperLimit() { | |
| 118 | ✗ | bool result = setString(OS_HeatBalanceAlgorithmFields::SurfaceTemperatureUpperLimit, ""); | |
| 119 | ✗ | OS_ASSERT(result); | |
| 120 | ✗ | } | |
| 121 | |||
| 122 | ✗ | bool HeatBalanceAlgorithm_Impl::setMinimumSurfaceConvectionHeatTransferCoefficientValue( | |
| 123 | double minimumSurfaceConvectionHeatTransferCoefficientValue) { | ||
| 124 | ✗ | bool result = setDouble(OS_HeatBalanceAlgorithmFields::MinimumSurfaceConvectionHeatTransferCoefficientValue, | |
| 125 | minimumSurfaceConvectionHeatTransferCoefficientValue); | ||
| 126 | ✗ | return result; | |
| 127 | } | ||
| 128 | |||
| 129 | ✗ | void HeatBalanceAlgorithm_Impl::resetMinimumSurfaceConvectionHeatTransferCoefficientValue() { | |
| 130 | ✗ | bool result = setString(OS_HeatBalanceAlgorithmFields::MinimumSurfaceConvectionHeatTransferCoefficientValue, ""); | |
| 131 | ✗ | OS_ASSERT(result); | |
| 132 | ✗ | } | |
| 133 | |||
| 134 | ✗ | bool HeatBalanceAlgorithm_Impl::setMaximumSurfaceConvectionHeatTransferCoefficientValue( | |
| 135 | double maximumSurfaceConvectionHeatTransferCoefficientValue) { | ||
| 136 | ✗ | bool result = setDouble(OS_HeatBalanceAlgorithmFields::MaximumSurfaceConvectionHeatTransferCoefficientValue, | |
| 137 | maximumSurfaceConvectionHeatTransferCoefficientValue); | ||
| 138 | ✗ | return result; | |
| 139 | } | ||
| 140 | |||
| 141 | ✗ | void HeatBalanceAlgorithm_Impl::resetMaximumSurfaceConvectionHeatTransferCoefficientValue() { | |
| 142 | ✗ | bool result = setString(OS_HeatBalanceAlgorithmFields::MaximumSurfaceConvectionHeatTransferCoefficientValue, ""); | |
| 143 | ✗ | OS_ASSERT(result); | |
| 144 | ✗ | } | |
| 145 | |||
| 146 | ✗ | std::vector<std::string> HeatBalanceAlgorithm_Impl::algorithmValues() const { | |
| 147 | ✗ | return HeatBalanceAlgorithm::algorithmValues(); | |
| 148 | } | ||
| 149 | |||
| 150 | } // namespace detail | ||
| 151 | |||
| 152 | 9367 | IddObjectType HeatBalanceAlgorithm::iddObjectType() { | |
| 153 |
1/1✓ Branch 1 taken 9367 times.
|
9367 | return {IddObjectType::OS_HeatBalanceAlgorithm}; |
| 154 | } | ||
| 155 | |||
| 156 | ✗ | std::vector<std::string> HeatBalanceAlgorithm::algorithmValues() { | |
| 157 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_HeatBalanceAlgorithmFields::Algorithm); | |
| 158 | } | ||
| 159 | |||
| 160 | 46 | std::string HeatBalanceAlgorithm::algorithm() const { | |
| 161 |
1/1✓ Branch 3 taken 46 times.
|
46 | return getImpl<detail::HeatBalanceAlgorithm_Impl>()->algorithm(); |
| 162 | } | ||
| 163 | |||
| 164 | ✗ | bool HeatBalanceAlgorithm::isAlgorithmDefaulted() const { | |
| 165 | ✗ | return getImpl<detail::HeatBalanceAlgorithm_Impl>()->isAlgorithmDefaulted(); | |
| 166 | } | ||
| 167 | |||
| 168 | 46 | double HeatBalanceAlgorithm::surfaceTemperatureUpperLimit() const { | |
| 169 |
1/1✓ Branch 3 taken 46 times.
|
46 | return getImpl<detail::HeatBalanceAlgorithm_Impl>()->surfaceTemperatureUpperLimit(); |
| 170 | } | ||
| 171 | |||
| 172 | ✗ | bool HeatBalanceAlgorithm::isSurfaceTemperatureUpperLimitDefaulted() const { | |
| 173 | ✗ | return getImpl<detail::HeatBalanceAlgorithm_Impl>()->isSurfaceTemperatureUpperLimitDefaulted(); | |
| 174 | } | ||
| 175 | |||
| 176 | ✗ | double HeatBalanceAlgorithm::minimumSurfaceConvectionHeatTransferCoefficientValue() const { | |
| 177 | ✗ | return getImpl<detail::HeatBalanceAlgorithm_Impl>()->minimumSurfaceConvectionHeatTransferCoefficientValue(); | |
| 178 | } | ||
| 179 | |||
| 180 | 46 | bool HeatBalanceAlgorithm::isMinimumSurfaceConvectionHeatTransferCoefficientValueDefaulted() const { | |
| 181 |
1/1✓ Branch 3 taken 46 times.
|
46 | return getImpl<detail::HeatBalanceAlgorithm_Impl>()->isMinimumSurfaceConvectionHeatTransferCoefficientValueDefaulted(); |
| 182 | } | ||
| 183 | |||
| 184 | ✗ | double HeatBalanceAlgorithm::maximumSurfaceConvectionHeatTransferCoefficientValue() const { | |
| 185 | ✗ | return getImpl<detail::HeatBalanceAlgorithm_Impl>()->maximumSurfaceConvectionHeatTransferCoefficientValue(); | |
| 186 | } | ||
| 187 | |||
| 188 | 46 | bool HeatBalanceAlgorithm::isMaximumSurfaceConvectionHeatTransferCoefficientValueDefaulted() const { | |
| 189 |
1/1✓ Branch 3 taken 46 times.
|
46 | return getImpl<detail::HeatBalanceAlgorithm_Impl>()->isMaximumSurfaceConvectionHeatTransferCoefficientValueDefaulted(); |
| 190 | } | ||
| 191 | |||
| 192 | 259 | bool HeatBalanceAlgorithm::setAlgorithm(const std::string& algorithm) { | |
| 193 |
1/1✓ Branch 3 taken 259 times.
|
259 | return getImpl<detail::HeatBalanceAlgorithm_Impl>()->setAlgorithm(algorithm); |
| 194 | } | ||
| 195 | |||
| 196 | ✗ | void HeatBalanceAlgorithm::resetAlgorithm() { | |
| 197 | ✗ | getImpl<detail::HeatBalanceAlgorithm_Impl>()->resetAlgorithm(); | |
| 198 | ✗ | } | |
| 199 | |||
| 200 | 257 | bool HeatBalanceAlgorithm::setSurfaceTemperatureUpperLimit(double surfaceTemperatureUpperLimit) { | |
| 201 |
1/1✓ Branch 3 taken 257 times.
|
257 | return getImpl<detail::HeatBalanceAlgorithm_Impl>()->setSurfaceTemperatureUpperLimit(surfaceTemperatureUpperLimit); |
| 202 | } | ||
| 203 | |||
| 204 | ✗ | void HeatBalanceAlgorithm::resetSurfaceTemperatureUpperLimit() { | |
| 205 | ✗ | getImpl<detail::HeatBalanceAlgorithm_Impl>()->resetSurfaceTemperatureUpperLimit(); | |
| 206 | ✗ | } | |
| 207 | |||
| 208 | ✗ | bool HeatBalanceAlgorithm::setMinimumSurfaceConvectionHeatTransferCoefficientValue(double minimumSurfaceConvectionHeatTransferCoefficientValue) { | |
| 209 | ✗ | return getImpl<detail::HeatBalanceAlgorithm_Impl>()->setMinimumSurfaceConvectionHeatTransferCoefficientValue( | |
| 210 | ✗ | minimumSurfaceConvectionHeatTransferCoefficientValue); | |
| 211 | } | ||
| 212 | |||
| 213 | ✗ | void HeatBalanceAlgorithm::resetMinimumSurfaceConvectionHeatTransferCoefficientValue() { | |
| 214 | ✗ | getImpl<detail::HeatBalanceAlgorithm_Impl>()->resetMinimumSurfaceConvectionHeatTransferCoefficientValue(); | |
| 215 | ✗ | } | |
| 216 | |||
| 217 | ✗ | bool HeatBalanceAlgorithm::setMaximumSurfaceConvectionHeatTransferCoefficientValue(double maximumSurfaceConvectionHeatTransferCoefficientValue) { | |
| 218 | ✗ | return getImpl<detail::HeatBalanceAlgorithm_Impl>()->setMaximumSurfaceConvectionHeatTransferCoefficientValue( | |
| 219 | ✗ | maximumSurfaceConvectionHeatTransferCoefficientValue); | |
| 220 | } | ||
| 221 | |||
| 222 | ✗ | void HeatBalanceAlgorithm::resetMaximumSurfaceConvectionHeatTransferCoefficientValue() { | |
| 223 | ✗ | getImpl<detail::HeatBalanceAlgorithm_Impl>()->resetMaximumSurfaceConvectionHeatTransferCoefficientValue(); | |
| 224 | ✗ | } | |
| 225 | |||
| 226 | /// @cond | ||
| 227 | /// constructor | ||
| 228 |
1/1✓ Branch 3 taken 115 times.
|
115 | HeatBalanceAlgorithm::HeatBalanceAlgorithm(std::shared_ptr<detail::HeatBalanceAlgorithm_Impl> impl) : ModelObject(std::move(impl)) {} |
| 229 | |||
| 230 | /// constructor | ||
| 231 | 254 | HeatBalanceAlgorithm::HeatBalanceAlgorithm(Model& model) : ModelObject(HeatBalanceAlgorithm::iddObjectType(), model) { | |
| 232 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 254 times.
✗ Branch 5 not taken.
|
254 | OS_ASSERT(getImpl<detail::HeatBalanceAlgorithm_Impl>()); |
| 233 | |||
| 234 |
2/2✓ Branch 1 taken 254 times.
✓ Branch 4 taken 254 times.
|
254 | this->setAlgorithm("ConductionTransferFunction"); |
| 235 | |||
| 236 |
1/1✓ Branch 1 taken 254 times.
|
254 | this->setSurfaceTemperatureUpperLimit(200.0); |
| 237 | 254 | } | |
| 238 | |||
| 239 | /// @endcond | ||
| 240 | |||
| 241 | } // namespace model | ||
| 242 | } // namespace openstudio | ||
| 243 |