src/model/RefrigerationCompressor.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 "RefrigerationCompressor.hpp" | ||
| 7 | #include "RefrigerationCompressor_Impl.hpp" | ||
| 8 | |||
| 9 | #include "CurveBicubic.hpp" | ||
| 10 | #include "CurveBicubic_Impl.hpp" | ||
| 11 | #include "Model.hpp" | ||
| 12 | #include "Model_Impl.hpp" | ||
| 13 | #include "RefrigerationSystem.hpp" | ||
| 14 | #include "RefrigerationSystem_Impl.hpp" | ||
| 15 | |||
| 16 | #include <utilities/idd/IddFactory.hxx> | ||
| 17 | |||
| 18 | #include <utilities/idd/OS_Refrigeration_Compressor_FieldEnums.hxx> | ||
| 19 | #include <utilities/idd/IddEnums.hxx> | ||
| 20 | |||
| 21 | #include "../utilities/units/Unit.hpp" | ||
| 22 | |||
| 23 | #include "../utilities/core/Assert.hpp" | ||
| 24 | |||
| 25 | namespace openstudio { | ||
| 26 | namespace model { | ||
| 27 | |||
| 28 | namespace detail { | ||
| 29 | |||
| 30 | 39 | RefrigerationCompressor_Impl::RefrigerationCompressor_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 31 | 39 | : ParentObject_Impl(idfObject, model, keepHandle) { | |
| 32 |
4/6✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
✓ Branch 7 taken 39 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 39 times.
✗ Branch 13 not taken.
|
39 | OS_ASSERT(idfObject.iddObject().type() == RefrigerationCompressor::iddObjectType()); |
| 33 | 39 | } | |
| 34 | |||
| 35 | ✗ | RefrigerationCompressor_Impl::RefrigerationCompressor_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, | |
| 36 | ✗ | bool keepHandle) | |
| 37 | ✗ | : ParentObject_Impl(other, model, keepHandle) { | |
| 38 | ✗ | OS_ASSERT(other.iddObject().type() == RefrigerationCompressor::iddObjectType()); | |
| 39 | ✗ | } | |
| 40 | |||
| 41 | 34 | RefrigerationCompressor_Impl::RefrigerationCompressor_Impl(const RefrigerationCompressor_Impl& other, Model_Impl* model, bool keepHandle) | |
| 42 | 34 | : ParentObject_Impl(other, model, keepHandle) {} | |
| 43 | |||
| 44 | ✗ | const std::vector<std::string>& RefrigerationCompressor_Impl::outputVariableNames() const { | |
| 45 | static const std::vector<std::string> result{ | ||
| 46 | // TODO: Implement checks | ||
| 47 | // THE FOLLOWING OUTPUTS ARE AVAILABLE FOR SYSTEMS THAT SERVE CASES AND/OR WALKINS: | ||
| 48 | "Refrigeration Compressor Electricity Rate", "Refrigeration Compressor Electricity Energy", "Refrigeration Compressor Heat Transfer Rate", | ||
| 49 | "Refrigeration Compressor Heat Transfer Energy", "Refrigeration Compressor Run Time Fraction", | ||
| 50 | // THE FOLLOWING OUTPUTS ARE AVAILABLE FOR SYSTEMS THAT SERVE AIR CHILLERS: | ||
| 51 | "Refrigeration Air Chiller System Compressor Electricity Rate", "Refrigeration Air Chiller System Compressor Electricity Energy", | ||
| 52 | "Refrigeration Air Chiller System Compressor Heat Transfer Rate", "Refrigeration Air Chiller System Compressor Heat Transfer Energy", | ||
| 53 | ✗ | "Refrigeration Chiller Compressor Run TimeFraction"}; | |
| 54 | ✗ | return result; | |
| 55 | ✗ | } | |
| 56 | |||
| 57 | ✗ | IddObjectType RefrigerationCompressor_Impl::iddObjectType() const { | |
| 58 | ✗ | return RefrigerationCompressor::iddObjectType(); | |
| 59 | } | ||
| 60 | |||
| 61 | 17 | ModelObject RefrigerationCompressor_Impl::clone(Model model) const { | |
| 62 |
3/3✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
|
17 | auto modelObjectClone = ModelObject_Impl::clone(model).cast<RefrigerationCompressor>(); |
| 63 | |||
| 64 | 34 | return std::move(modelObjectClone); | |
| 65 | 17 | } | |
| 66 | |||
| 67 | 7 | std::vector<IdfObject> RefrigerationCompressor_Impl::remove() { | |
| 68 | // Remove from ModelObjectList(s) in RefrigerationSystem(s) if needed | ||
| 69 | 7 | this->removeFromSystem(); | |
| 70 | |||
| 71 | 7 | return ParentObject_Impl::remove(); | |
| 72 | } | ||
| 73 | |||
| 74 | ✗ | std::vector<IddObjectType> RefrigerationCompressor_Impl::allowableChildTypes() const { | |
| 75 | ✗ | std::vector<IddObjectType> result; | |
| 76 | ✗ | result.push_back(IddObjectType::OS_Curve_Bicubic); | |
| 77 | ✗ | return result; | |
| 78 | ✗ | } | |
| 79 | |||
| 80 | 7 | std::vector<ModelObject> RefrigerationCompressor_Impl::children() const { | |
| 81 | 7 | std::vector<ModelObject> result; | |
| 82 | 7 | boost::optional<CurveBicubic> intermediate; | |
| 83 |
3/4✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 8 taken 7 times.
✗ Branch 9 not taken.
|
14 | if ((intermediate = refrigerationCompressorPowerCurve())) { |
| 84 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | result.push_back(*intermediate); |
| 85 | } | ||
| 86 |
3/4✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 8 taken 7 times.
✗ Branch 9 not taken.
|
14 | if ((intermediate = refrigerationCompressorCapacityCurve())) { |
| 87 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | result.push_back(*intermediate); |
| 88 | } | ||
| 89 |
2/3✓ Branch 1 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7 times.
|
14 | if ((intermediate = transcriticalCompressorPowerCurve())) { |
| 90 | ✗ | result.push_back(*intermediate); | |
| 91 | } | ||
| 92 |
2/3✓ Branch 1 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7 times.
|
14 | if ((intermediate = transcriticalCompressorCapacityCurve())) { |
| 93 | ✗ | result.push_back(*intermediate); | |
| 94 | } | ||
| 95 | 14 | return result; | |
| 96 | 7 | } | |
| 97 | |||
| 98 | 14 | CurveBicubic RefrigerationCompressor_Impl::refrigerationCompressorPowerCurve() const { | |
| 99 |
1/1✓ Branch 1 taken 14 times.
|
14 | boost::optional<CurveBicubic> value = optionalRefrigerationCompressorPowerCurve(); |
| 100 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
|
14 | if (!value) { |
| 101 | ✗ | LOG_AND_THROW(briefDescription() << " does not have an Refrigeration Compressor Power Curve attached."); | |
| 102 | } | ||
| 103 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
28 | return value.get(); |
| 104 | 14 | } | |
| 105 | |||
| 106 | 14 | CurveBicubic RefrigerationCompressor_Impl::refrigerationCompressorCapacityCurve() const { | |
| 107 |
1/1✓ Branch 1 taken 14 times.
|
14 | boost::optional<CurveBicubic> value = optionalRefrigerationCompressorCapacityCurve(); |
| 108 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
|
14 | if (!value) { |
| 109 | ✗ | LOG_AND_THROW(briefDescription() << " does not have an Refrigeration Compressor Capacity Curve attached."); | |
| 110 | } | ||
| 111 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
28 | return value.get(); |
| 112 | 14 | } | |
| 113 | |||
| 114 | ✗ | boost::optional<double> RefrigerationCompressor_Impl::ratedSuperheat() const { | |
| 115 | ✗ | return getDouble(OS_Refrigeration_CompressorFields::RatedSuperheat, true); | |
| 116 | } | ||
| 117 | |||
| 118 | 3 | boost::optional<double> RefrigerationCompressor_Impl::ratedReturnGasTemperature() const { | |
| 119 | 3 | return getDouble(OS_Refrigeration_CompressorFields::RatedReturnGasTemperature, true); | |
| 120 | } | ||
| 121 | |||
| 122 | ✗ | boost::optional<double> RefrigerationCompressor_Impl::ratedLiquidTemperature() const { | |
| 123 | ✗ | return getDouble(OS_Refrigeration_CompressorFields::RatedLiquidTemperature, true); | |
| 124 | } | ||
| 125 | |||
| 126 | 3 | boost::optional<double> RefrigerationCompressor_Impl::ratedSubcooling() const { | |
| 127 | 3 | return getDouble(OS_Refrigeration_CompressorFields::RatedSubcooling, true); | |
| 128 | } | ||
| 129 | |||
| 130 | ✗ | std::string RefrigerationCompressor_Impl::endUseSubcategory() const { | |
| 131 | ✗ | boost::optional<std::string> value = getString(OS_Refrigeration_CompressorFields::EndUseSubcategory, true); | |
| 132 | ✗ | OS_ASSERT(value); | |
| 133 | ✗ | return value.get(); | |
| 134 | ✗ | } | |
| 135 | |||
| 136 | ✗ | bool RefrigerationCompressor_Impl::isEndUseSubcategoryDefaulted() const { | |
| 137 | ✗ | return isEmpty(OS_Refrigeration_CompressorFields::EndUseSubcategory); | |
| 138 | } | ||
| 139 | |||
| 140 | 4 | std::string RefrigerationCompressor_Impl::modeofOperation() const { | |
| 141 |
10/16✓ Branch 1 taken 4 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 2 times.
✓ Branch 19 taken 2 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
|
10 | if (transcriticalCompressorPowerCurve() && transcriticalCompressorCapacityCurve()) { |
| 142 |
1/1✓ Branch 1 taken 2 times.
|
4 | return "Transcritical"; |
| 143 | } else { | ||
| 144 |
1/1✓ Branch 1 taken 2 times.
|
4 | return "Subcritical"; |
| 145 | } | ||
| 146 | // boost::optional<std::string> value = getString(OS_Refrigeration_CompressorFields::ModeofOperation,true); | ||
| 147 | // OS_ASSERT(value); | ||
| 148 | // return value.get(); | ||
| 149 | } | ||
| 150 | |||
| 151 | // bool RefrigerationCompressor_Impl::isModeofOperationDefaulted() const { | ||
| 152 | // return isEmpty(OS_Refrigeration_CompressorFields::ModeofOperation); | ||
| 153 | // } | ||
| 154 | |||
| 155 | 12 | boost::optional<CurveBicubic> RefrigerationCompressor_Impl::transcriticalCompressorPowerCurve() const { | |
| 156 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | return getObject<ModelObject>().getModelObjectTarget<CurveBicubic>(OS_Refrigeration_CompressorFields::TranscriticalCompressorPowerCurveName); |
| 157 | } | ||
| 158 | |||
| 159 | 10 | boost::optional<CurveBicubic> RefrigerationCompressor_Impl::transcriticalCompressorCapacityCurve() const { | |
| 160 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | return getObject<ModelObject>().getModelObjectTarget<CurveBicubic>(OS_Refrigeration_CompressorFields::TranscriticalCompressorCapacityCurveName); |
| 161 | } | ||
| 162 | |||
| 163 | 40 | bool RefrigerationCompressor_Impl::setRefrigerationCompressorPowerCurve(const CurveBicubic& curveBicubic) { | |
| 164 |
2/2✓ Branch 1 taken 40 times.
✓ Branch 4 taken 40 times.
|
40 | bool result = setPointer(OS_Refrigeration_CompressorFields::RefrigerationCompressorPowerCurveName, curveBicubic.handle()); |
| 165 | 40 | return result; | |
| 166 | } | ||
| 167 | |||
| 168 | 40 | bool RefrigerationCompressor_Impl::setRefrigerationCompressorCapacityCurve(const CurveBicubic& curveBicubic) { | |
| 169 |
2/2✓ Branch 1 taken 40 times.
✓ Branch 4 taken 40 times.
|
40 | bool result = setPointer(OS_Refrigeration_CompressorFields::RefrigerationCompressorCapacityCurveName, curveBicubic.handle()); |
| 170 | 40 | return result; | |
| 171 | } | ||
| 172 | |||
| 173 | ✗ | bool RefrigerationCompressor_Impl::setRatedSuperheat(boost::optional<double> ratedSuperheat) { | |
| 174 | ✗ | bool result(false); | |
| 175 | ✗ | if (ratedSuperheat) { | |
| 176 | ✗ | result = setDouble(OS_Refrigeration_CompressorFields::RatedSuperheat, ratedSuperheat.get()); | |
| 177 | ✗ | resetRatedReturnGasTemperature(); | |
| 178 | } else { | ||
| 179 | ✗ | resetRatedSuperheat(); | |
| 180 | ✗ | result = true; | |
| 181 | } | ||
| 182 | ✗ | OS_ASSERT(result); | |
| 183 | ✗ | return result; | |
| 184 | } | ||
| 185 | |||
| 186 | 40 | void RefrigerationCompressor_Impl::resetRatedSuperheat() { | |
| 187 |
2/2✓ Branch 1 taken 40 times.
✓ Branch 4 taken 40 times.
|
80 | bool result = setString(OS_Refrigeration_CompressorFields::RatedSuperheat, ""); |
| 188 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | OS_ASSERT(result); |
| 189 | 40 | } | |
| 190 | |||
| 191 | 40 | bool RefrigerationCompressor_Impl::setRatedReturnGasTemperature(boost::optional<double> ratedReturnGasTemperature) { | |
| 192 | 40 | bool result(false); | |
| 193 |
1/2✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
|
40 | if (ratedReturnGasTemperature) { |
| 194 | 40 | result = setDouble(OS_Refrigeration_CompressorFields::RatedReturnGasTemperature, ratedReturnGasTemperature.get()); | |
| 195 | 40 | resetRatedSuperheat(); | |
| 196 | } else { | ||
| 197 | ✗ | resetRatedReturnGasTemperature(); | |
| 198 | ✗ | result = true; | |
| 199 | } | ||
| 200 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | OS_ASSERT(result); |
| 201 | 40 | return result; | |
| 202 | } | ||
| 203 | |||
| 204 | ✗ | void RefrigerationCompressor_Impl::resetRatedReturnGasTemperature() { | |
| 205 | ✗ | bool result = setString(OS_Refrigeration_CompressorFields::RatedReturnGasTemperature, ""); | |
| 206 | ✗ | OS_ASSERT(result); | |
| 207 | ✗ | } | |
| 208 | |||
| 209 | ✗ | bool RefrigerationCompressor_Impl::setRatedLiquidTemperature(boost::optional<double> ratedLiquidTemperature) { | |
| 210 | ✗ | bool result(false); | |
| 211 | ✗ | if (ratedLiquidTemperature) { | |
| 212 | ✗ | result = setDouble(OS_Refrigeration_CompressorFields::RatedLiquidTemperature, ratedLiquidTemperature.get()); | |
| 213 | ✗ | resetRatedSubcooling(); | |
| 214 | } else { | ||
| 215 | ✗ | resetRatedLiquidTemperature(); | |
| 216 | ✗ | result = true; | |
| 217 | } | ||
| 218 | ✗ | OS_ASSERT(result); | |
| 219 | ✗ | return result; | |
| 220 | } | ||
| 221 | |||
| 222 | 40 | void RefrigerationCompressor_Impl::resetRatedLiquidTemperature() { | |
| 223 |
2/2✓ Branch 1 taken 40 times.
✓ Branch 4 taken 40 times.
|
80 | bool result = setString(OS_Refrigeration_CompressorFields::RatedLiquidTemperature, ""); |
| 224 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | OS_ASSERT(result); |
| 225 | 40 | } | |
| 226 | |||
| 227 | 40 | bool RefrigerationCompressor_Impl::setRatedSubcooling(boost::optional<double> ratedSubcooling) { | |
| 228 | 40 | bool result(false); | |
| 229 |
1/2✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
|
40 | if (ratedSubcooling) { |
| 230 | 40 | result = setDouble(OS_Refrigeration_CompressorFields::RatedSubcooling, ratedSubcooling.get()); | |
| 231 | 40 | resetRatedLiquidTemperature(); | |
| 232 | } else { | ||
| 233 | ✗ | resetRatedSubcooling(); | |
| 234 | ✗ | result = true; | |
| 235 | } | ||
| 236 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | OS_ASSERT(result); |
| 237 | 40 | return result; | |
| 238 | } | ||
| 239 | |||
| 240 | ✗ | void RefrigerationCompressor_Impl::resetRatedSubcooling() { | |
| 241 | ✗ | bool result = setString(OS_Refrigeration_CompressorFields::RatedSubcooling, ""); | |
| 242 | ✗ | OS_ASSERT(result); | |
| 243 | ✗ | } | |
| 244 | |||
| 245 | ✗ | bool RefrigerationCompressor_Impl::setEndUseSubcategory(const std::string& endUseSubcategory) { | |
| 246 | ✗ | bool result = setString(OS_Refrigeration_CompressorFields::EndUseSubcategory, endUseSubcategory); | |
| 247 | ✗ | OS_ASSERT(result); | |
| 248 | ✗ | return result; | |
| 249 | } | ||
| 250 | |||
| 251 | ✗ | void RefrigerationCompressor_Impl::resetEndUseSubcategory() { | |
| 252 | ✗ | bool result = setString(OS_Refrigeration_CompressorFields::EndUseSubcategory, ""); | |
| 253 | ✗ | OS_ASSERT(result); | |
| 254 | ✗ | } | |
| 255 | |||
| 256 | // bool RefrigerationCompressor_Impl::setModeofOperation(const std::string& modeofOperation) { | ||
| 257 | // bool result = setString(OS_Refrigeration_CompressorFields::ModeofOperation, modeofOperation); | ||
| 258 | // return result; | ||
| 259 | // } | ||
| 260 | |||
| 261 | // void RefrigerationCompressor_Impl::resetModeofOperation() { | ||
| 262 | // bool result = setString(OS_Refrigeration_CompressorFields::ModeofOperation, ""); | ||
| 263 | // OS_ASSERT(result); | ||
| 264 | // } | ||
| 265 | |||
| 266 | 1 | bool RefrigerationCompressor_Impl::setTranscriticalCompressorPowerCurve(const boost::optional<CurveBicubic>& curveBicubic) { | |
| 267 | 1 | bool result(false); | |
| 268 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (curveBicubic) { |
| 269 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | result = setPointer(OS_Refrigeration_CompressorFields::TranscriticalCompressorPowerCurveName, curveBicubic.get().handle()); |
| 270 | } else { | ||
| 271 | ✗ | resetTranscriticalCompressorPowerCurve(); | |
| 272 | ✗ | result = true; | |
| 273 | } | ||
| 274 | 1 | return result; | |
| 275 | } | ||
| 276 | |||
| 277 | ✗ | void RefrigerationCompressor_Impl::resetTranscriticalCompressorPowerCurve() { | |
| 278 | ✗ | bool result = setString(OS_Refrigeration_CompressorFields::TranscriticalCompressorPowerCurveName, ""); | |
| 279 | ✗ | OS_ASSERT(result); | |
| 280 | ✗ | } | |
| 281 | |||
| 282 | 1 | bool RefrigerationCompressor_Impl::setTranscriticalCompressorCapacityCurve(const boost::optional<CurveBicubic>& curveBicubic) { | |
| 283 | 1 | bool result(false); | |
| 284 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (curveBicubic) { |
| 285 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | result = setPointer(OS_Refrigeration_CompressorFields::TranscriticalCompressorCapacityCurveName, curveBicubic.get().handle()); |
| 286 | } else { | ||
| 287 | ✗ | resetTranscriticalCompressorCapacityCurve(); | |
| 288 | ✗ | result = true; | |
| 289 | } | ||
| 290 | 1 | return result; | |
| 291 | } | ||
| 292 | |||
| 293 | ✗ | void RefrigerationCompressor_Impl::resetTranscriticalCompressorCapacityCurve() { | |
| 294 | ✗ | bool result = setString(OS_Refrigeration_CompressorFields::TranscriticalCompressorCapacityCurveName, ""); | |
| 295 | ✗ | OS_ASSERT(result); | |
| 296 | ✗ | } | |
| 297 | |||
| 298 | 14 | boost::optional<CurveBicubic> RefrigerationCompressor_Impl::optionalRefrigerationCompressorPowerCurve() const { | |
| 299 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | return getObject<ModelObject>().getModelObjectTarget<CurveBicubic>(OS_Refrigeration_CompressorFields::RefrigerationCompressorPowerCurveName); |
| 300 | } | ||
| 301 | |||
| 302 | 14 | boost::optional<CurveBicubic> RefrigerationCompressor_Impl::optionalRefrigerationCompressorCapacityCurve() const { | |
| 303 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | return getObject<ModelObject>().getModelObjectTarget<CurveBicubic>(OS_Refrigeration_CompressorFields::RefrigerationCompressorCapacityCurveName); |
| 304 | } | ||
| 305 | |||
| 306 | 26 | boost::optional<RefrigerationSystem> RefrigerationCompressor_Impl::system() const { | |
| 307 | 26 | boost::optional<RefrigerationSystem> result; | |
| 308 | |||
| 309 |
1/1✓ Branch 1 taken 26 times.
|
26 | auto refrigerationCompressor = this->getObject<RefrigerationCompressor>(); |
| 310 |
4/4✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 12 taken 22 times.
✓ Branch 13 taken 21 times.
|
43 | for (const RefrigerationSystem& refrigerationSystem : this->model().getConcreteModelObjects<RefrigerationSystem>()) { |
| 311 |
1/1✓ Branch 1 taken 22 times.
|
22 | RefrigerationCompressorVector refrigerationCompressors = refrigerationSystem.compressors(); |
| 312 | 22 | if (!refrigerationCompressors.empty() | |
| 313 |
3/3✓ Branch 0 taken 7 times.
✓ Branch 1 taken 15 times.
✓ Branch 5 taken 7 times.
|
36 | && std::find(refrigerationCompressors.begin(), refrigerationCompressors.end(), refrigerationCompressor) |
| 314 |
4/4✓ Branch 2 taken 3 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 19 times.
|
36 | != refrigerationCompressors.end()) { |
| 315 |
1/1✓ Branch 1 taken 3 times.
|
3 | result = refrigerationSystem; |
| 316 | 3 | break; | |
| 317 | } else { | ||
| 318 |
1/1✓ Branch 1 taken 19 times.
|
19 | RefrigerationCompressorVector refrigerationHighStageCompressors = refrigerationSystem.highStageCompressors(); |
| 319 | 19 | if (!refrigerationHighStageCompressors.empty() | |
| 320 |
3/3✓ Branch 0 taken 4 times.
✓ Branch 1 taken 15 times.
✓ Branch 5 taken 4 times.
|
27 | && std::find(refrigerationHighStageCompressors.begin(), refrigerationHighStageCompressors.end(), refrigerationCompressor) |
| 321 |
4/4✓ Branch 2 taken 2 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 17 times.
|
27 | != refrigerationHighStageCompressors.end()) { |
| 322 |
1/1✓ Branch 1 taken 2 times.
|
2 | result = refrigerationSystem; |
| 323 | 2 | break; | |
| 324 | } | ||
| 325 | 19 | } | |
| 326 | 48 | } | |
| 327 | |||
| 328 | 52 | return result; | |
| 329 | 26 | } | |
| 330 | |||
| 331 | 7 | void RefrigerationCompressor_Impl::removeFromSystem() { | |
| 332 |
3/3✓ Branch 1 taken 7 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 4 times.
|
14 | if (boost::optional<RefrigerationSystem> refrigerationSystem = this->system()) { |
| 333 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto refrigerationCompressor = this->getObject<RefrigerationCompressor>(); |
| 334 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | refrigerationSystem->removeCompressor(refrigerationCompressor); |
| 335 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | refrigerationSystem->removeHighStageCompressor(refrigerationCompressor); |
| 336 | 10 | } | |
| 337 | 7 | } | |
| 338 | |||
| 339 | } // namespace detail | ||
| 340 | |||
| 341 | 39 | RefrigerationCompressor::RefrigerationCompressor(const Model& model) : ParentObject(RefrigerationCompressor::iddObjectType(), model) { | |
| 342 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 39 times.
✗ Branch 5 not taken.
|
39 | OS_ASSERT(getImpl<detail::RefrigerationCompressor_Impl>()); |
| 343 | |||
| 344 |
1/1✓ Branch 1 taken 39 times.
|
39 | CurveBicubic powerCurve = CurveBicubic(model); |
| 345 |
2/2✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
|
39 | powerCurve.setName("Refrigeration Compressor Power Curve"); |
| 346 |
1/1✓ Branch 1 taken 39 times.
|
39 | powerCurve.setCoefficient1Constant(4451.46); |
| 347 |
1/1✓ Branch 1 taken 39 times.
|
39 | powerCurve.setCoefficient2x(-166.108); |
| 348 |
1/1✓ Branch 1 taken 39 times.
|
39 | powerCurve.setCoefficient3xPOW2(-5.35664); |
| 349 |
1/1✓ Branch 1 taken 39 times.
|
39 | powerCurve.setCoefficient4y(263.553); |
| 350 |
1/1✓ Branch 1 taken 39 times.
|
39 | powerCurve.setCoefficient5yPOW2(-0.958849); |
| 351 |
1/1✓ Branch 1 taken 39 times.
|
39 | powerCurve.setCoefficient6xTIMESY(8.09252); |
| 352 |
1/1✓ Branch 1 taken 39 times.
|
39 | powerCurve.setCoefficient7xPOW3(-0.0239354); |
| 353 |
1/1✓ Branch 1 taken 39 times.
|
39 | powerCurve.setCoefficient8yPOW3(0.000633306); |
| 354 |
1/1✓ Branch 1 taken 39 times.
|
39 | powerCurve.setCoefficient9xPOW2TIMESY(0.0778798); |
| 355 |
1/1✓ Branch 1 taken 39 times.
|
39 | powerCurve.setCoefficient10xTIMESYPOW2(-0.0167386); |
| 356 |
1/1✓ Branch 1 taken 39 times.
|
39 | powerCurve.setMinimumValueofx(-23.3); |
| 357 |
1/1✓ Branch 1 taken 39 times.
|
39 | powerCurve.setMaximumValueofx(7.2); |
| 358 |
1/1✓ Branch 1 taken 39 times.
|
39 | powerCurve.setMinimumValueofy(10.0); |
| 359 |
1/1✓ Branch 1 taken 39 times.
|
39 | powerCurve.setMaximumValueofy(60.0); |
| 360 |
2/2✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
|
78 | powerCurve.setInputUnitTypeforX("Temperature"); |
| 361 |
2/2✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
|
78 | powerCurve.setInputUnitTypeforY("Temperature"); |
| 362 |
2/2✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
|
39 | powerCurve.setOutputUnitType("Power"); |
| 363 | |||
| 364 |
1/1✓ Branch 1 taken 39 times.
|
39 | bool ok = setRefrigerationCompressorPowerCurve(powerCurve); |
| 365 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 39 times.
✗ Branch 3 not taken.
|
39 | OS_ASSERT(ok); |
| 366 | |||
| 367 |
1/1✓ Branch 1 taken 39 times.
|
39 | CurveBicubic capacityCurve = CurveBicubic(model); |
| 368 |
2/2✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
|
39 | capacityCurve.setName("Refrigeration Compressor Capacity Curve"); |
| 369 |
1/1✓ Branch 1 taken 39 times.
|
39 | capacityCurve.setCoefficient1Constant(83249.9); |
| 370 |
1/1✓ Branch 1 taken 39 times.
|
39 | capacityCurve.setCoefficient2x(3147.96); |
| 371 |
1/1✓ Branch 1 taken 39 times.
|
39 | capacityCurve.setCoefficient3xPOW2(44.9276); |
| 372 |
1/1✓ Branch 1 taken 39 times.
|
39 | capacityCurve.setCoefficient4y(-1035.51); |
| 373 |
1/1✓ Branch 1 taken 39 times.
|
39 | capacityCurve.setCoefficient5yPOW2(3.74692); |
| 374 |
1/1✓ Branch 1 taken 39 times.
|
39 | capacityCurve.setCoefficient6xTIMESY(-37.3907); |
| 375 |
1/1✓ Branch 1 taken 39 times.
|
39 | capacityCurve.setCoefficient7xPOW3(0.179897); |
| 376 |
1/1✓ Branch 1 taken 39 times.
|
39 | capacityCurve.setCoefficient8yPOW3(-0.0199971); |
| 377 |
1/1✓ Branch 1 taken 39 times.
|
39 | capacityCurve.setCoefficient9xPOW2TIMESY(-0.481641); |
| 378 |
1/1✓ Branch 1 taken 39 times.
|
39 | capacityCurve.setCoefficient10xTIMESYPOW2(0.0428673); |
| 379 |
1/1✓ Branch 1 taken 39 times.
|
39 | capacityCurve.setMinimumValueofx(-23.3); |
| 380 |
1/1✓ Branch 1 taken 39 times.
|
39 | capacityCurve.setMaximumValueofx(7.2); |
| 381 |
1/1✓ Branch 1 taken 39 times.
|
39 | capacityCurve.setMinimumValueofy(10.0); |
| 382 |
1/1✓ Branch 1 taken 39 times.
|
39 | capacityCurve.setMaximumValueofy(60.0); |
| 383 |
2/2✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
|
78 | capacityCurve.setInputUnitTypeforX("Temperature"); |
| 384 |
2/2✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
|
78 | capacityCurve.setInputUnitTypeforY("Temperature"); |
| 385 |
2/2✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
|
39 | capacityCurve.setOutputUnitType("Capacity"); |
| 386 | |||
| 387 |
1/1✓ Branch 1 taken 39 times.
|
39 | ok = setRefrigerationCompressorCapacityCurve(capacityCurve); |
| 388 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 39 times.
✗ Branch 3 not taken.
|
39 | OS_ASSERT(ok); |
| 389 | |||
| 390 |
1/1✓ Branch 1 taken 39 times.
|
39 | setRatedReturnGasTemperature(18.3); |
| 391 |
1/1✓ Branch 1 taken 39 times.
|
39 | setRatedSubcooling(0.0); |
| 392 | 39 | } | |
| 393 | |||
| 394 | 7702 | IddObjectType RefrigerationCompressor::iddObjectType() { | |
| 395 |
1/1✓ Branch 1 taken 7702 times.
|
7702 | return {IddObjectType::OS_Refrigeration_Compressor}; |
| 396 | } | ||
| 397 | |||
| 398 | ✗ | std::vector<std::string> RefrigerationCompressor::modeofOperationValues() { | |
| 399 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Refrigeration_CompressorFields::ModeofOperation); | |
| 400 | } | ||
| 401 | |||
| 402 | 7 | CurveBicubic RefrigerationCompressor::refrigerationCompressorPowerCurve() const { | |
| 403 |
1/1✓ Branch 3 taken 7 times.
|
7 | return getImpl<detail::RefrigerationCompressor_Impl>()->refrigerationCompressorPowerCurve(); |
| 404 | } | ||
| 405 | |||
| 406 | 7 | CurveBicubic RefrigerationCompressor::refrigerationCompressorCapacityCurve() const { | |
| 407 |
1/1✓ Branch 3 taken 7 times.
|
7 | return getImpl<detail::RefrigerationCompressor_Impl>()->refrigerationCompressorCapacityCurve(); |
| 408 | } | ||
| 409 | |||
| 410 | ✗ | boost::optional<double> RefrigerationCompressor::ratedSuperheat() const { | |
| 411 | ✗ | return getImpl<detail::RefrigerationCompressor_Impl>()->ratedSuperheat(); | |
| 412 | } | ||
| 413 | |||
| 414 | 3 | boost::optional<double> RefrigerationCompressor::ratedReturnGasTemperature() const { | |
| 415 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::RefrigerationCompressor_Impl>()->ratedReturnGasTemperature(); |
| 416 | } | ||
| 417 | |||
| 418 | ✗ | boost::optional<double> RefrigerationCompressor::ratedLiquidTemperature() const { | |
| 419 | ✗ | return getImpl<detail::RefrigerationCompressor_Impl>()->ratedLiquidTemperature(); | |
| 420 | } | ||
| 421 | |||
| 422 | 3 | boost::optional<double> RefrigerationCompressor::ratedSubcooling() const { | |
| 423 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::RefrigerationCompressor_Impl>()->ratedSubcooling(); |
| 424 | } | ||
| 425 | |||
| 426 | ✗ | std::string RefrigerationCompressor::endUseSubcategory() const { | |
| 427 | ✗ | return getImpl<detail::RefrigerationCompressor_Impl>()->endUseSubcategory(); | |
| 428 | } | ||
| 429 | |||
| 430 | ✗ | bool RefrigerationCompressor::isEndUseSubcategoryDefaulted() const { | |
| 431 | ✗ | return getImpl<detail::RefrigerationCompressor_Impl>()->isEndUseSubcategoryDefaulted(); | |
| 432 | } | ||
| 433 | |||
| 434 | 4 | std::string RefrigerationCompressor::modeofOperation() const { | |
| 435 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::RefrigerationCompressor_Impl>()->modeofOperation(); |
| 436 | } | ||
| 437 | |||
| 438 | // bool RefrigerationCompressor::isModeofOperationDefaulted() const { | ||
| 439 | // return getImpl<detail::RefrigerationCompressor_Impl>()->isModeofOperationDefaulted(); | ||
| 440 | // } | ||
| 441 | |||
| 442 | 1 | boost::optional<CurveBicubic> RefrigerationCompressor::transcriticalCompressorPowerCurve() const { | |
| 443 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::RefrigerationCompressor_Impl>()->transcriticalCompressorPowerCurve(); |
| 444 | } | ||
| 445 | |||
| 446 | 1 | boost::optional<CurveBicubic> RefrigerationCompressor::transcriticalCompressorCapacityCurve() const { | |
| 447 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::RefrigerationCompressor_Impl>()->transcriticalCompressorCapacityCurve(); |
| 448 | } | ||
| 449 | |||
| 450 | 40 | bool RefrigerationCompressor::setRefrigerationCompressorPowerCurve(const CurveBicubic& curveBicubic) { | |
| 451 |
1/1✓ Branch 3 taken 40 times.
|
40 | return getImpl<detail::RefrigerationCompressor_Impl>()->setRefrigerationCompressorPowerCurve(curveBicubic); |
| 452 | } | ||
| 453 | |||
| 454 | 40 | bool RefrigerationCompressor::setRefrigerationCompressorCapacityCurve(const CurveBicubic& curveBicubic) { | |
| 455 |
1/1✓ Branch 3 taken 40 times.
|
40 | return getImpl<detail::RefrigerationCompressor_Impl>()->setRefrigerationCompressorCapacityCurve(curveBicubic); |
| 456 | } | ||
| 457 | |||
| 458 | ✗ | bool RefrigerationCompressor::setRatedSuperheat(double ratedSuperheat) { | |
| 459 | ✗ | return getImpl<detail::RefrigerationCompressor_Impl>()->setRatedSuperheat(ratedSuperheat); | |
| 460 | } | ||
| 461 | |||
| 462 | ✗ | void RefrigerationCompressor::resetRatedSuperheat() { | |
| 463 | ✗ | getImpl<detail::RefrigerationCompressor_Impl>()->resetRatedSuperheat(); | |
| 464 | ✗ | } | |
| 465 | |||
| 466 | 40 | bool RefrigerationCompressor::setRatedReturnGasTemperature(double ratedReturnGasTemperature) { | |
| 467 |
2/2✓ Branch 3 taken 40 times.
✓ Branch 6 taken 40 times.
|
40 | return getImpl<detail::RefrigerationCompressor_Impl>()->setRatedReturnGasTemperature(ratedReturnGasTemperature); |
| 468 | } | ||
| 469 | |||
| 470 | ✗ | void RefrigerationCompressor::resetRatedReturnGasTemperature() { | |
| 471 | ✗ | getImpl<detail::RefrigerationCompressor_Impl>()->resetRatedReturnGasTemperature(); | |
| 472 | ✗ | } | |
| 473 | |||
| 474 | ✗ | bool RefrigerationCompressor::setRatedLiquidTemperature(double ratedLiquidTemperature) { | |
| 475 | ✗ | return getImpl<detail::RefrigerationCompressor_Impl>()->setRatedLiquidTemperature(ratedLiquidTemperature); | |
| 476 | } | ||
| 477 | |||
| 478 | ✗ | void RefrigerationCompressor::resetRatedLiquidTemperature() { | |
| 479 | ✗ | getImpl<detail::RefrigerationCompressor_Impl>()->resetRatedLiquidTemperature(); | |
| 480 | ✗ | } | |
| 481 | |||
| 482 | 40 | bool RefrigerationCompressor::setRatedSubcooling(double ratedSubcooling) { | |
| 483 |
2/2✓ Branch 3 taken 40 times.
✓ Branch 6 taken 40 times.
|
40 | return getImpl<detail::RefrigerationCompressor_Impl>()->setRatedSubcooling(ratedSubcooling); |
| 484 | } | ||
| 485 | |||
| 486 | ✗ | void RefrigerationCompressor::resetRatedSubcooling() { | |
| 487 | ✗ | getImpl<detail::RefrigerationCompressor_Impl>()->resetRatedSubcooling(); | |
| 488 | ✗ | } | |
| 489 | |||
| 490 | ✗ | bool RefrigerationCompressor::setEndUseSubcategory(const std::string& endUseSubcategory) { | |
| 491 | ✗ | return getImpl<detail::RefrigerationCompressor_Impl>()->setEndUseSubcategory(endUseSubcategory); | |
| 492 | } | ||
| 493 | |||
| 494 | ✗ | void RefrigerationCompressor::resetEndUseSubcategory() { | |
| 495 | ✗ | getImpl<detail::RefrigerationCompressor_Impl>()->resetEndUseSubcategory(); | |
| 496 | ✗ | } | |
| 497 | |||
| 498 | // bool RefrigerationCompressor::setModeofOperation(const std::string& modeofOperation) { | ||
| 499 | // return getImpl<detail::RefrigerationCompressor_Impl>()->setModeofOperation(modeofOperation); | ||
| 500 | // } | ||
| 501 | |||
| 502 | // void RefrigerationCompressor::resetModeofOperation() { | ||
| 503 | // getImpl<detail::RefrigerationCompressor_Impl>()->resetModeofOperation(); | ||
| 504 | // } | ||
| 505 | |||
| 506 | 1 | bool RefrigerationCompressor::setTranscriticalCompressorPowerCurve(const CurveBicubic& curveBicubic) { | |
| 507 |
2/2✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
|
1 | return getImpl<detail::RefrigerationCompressor_Impl>()->setTranscriticalCompressorPowerCurve(curveBicubic); |
| 508 | } | ||
| 509 | |||
| 510 | ✗ | void RefrigerationCompressor::resetTranscriticalCompressorPowerCurve() { | |
| 511 | ✗ | getImpl<detail::RefrigerationCompressor_Impl>()->resetTranscriticalCompressorPowerCurve(); | |
| 512 | ✗ | } | |
| 513 | |||
| 514 | 1 | bool RefrigerationCompressor::setTranscriticalCompressorCapacityCurve(const CurveBicubic& curveBicubic) { | |
| 515 |
2/2✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
|
1 | return getImpl<detail::RefrigerationCompressor_Impl>()->setTranscriticalCompressorCapacityCurve(curveBicubic); |
| 516 | } | ||
| 517 | |||
| 518 | ✗ | void RefrigerationCompressor::resetTranscriticalCompressorCapacityCurve() { | |
| 519 | ✗ | getImpl<detail::RefrigerationCompressor_Impl>()->resetTranscriticalCompressorCapacityCurve(); | |
| 520 | ✗ | } | |
| 521 | |||
| 522 | 19 | boost::optional<RefrigerationSystem> RefrigerationCompressor::system() const { | |
| 523 |
1/1✓ Branch 3 taken 19 times.
|
19 | return getImpl<detail::RefrigerationCompressor_Impl>()->system(); |
| 524 | } | ||
| 525 | |||
| 526 | ✗ | void RefrigerationCompressor::removeFromSystem() { | |
| 527 | ✗ | getImpl<detail::RefrigerationCompressor_Impl>()->removeFromSystem(); | |
| 528 | ✗ | } | |
| 529 | |||
| 530 | /// @cond | ||
| 531 |
1/1✓ Branch 3 taken 132 times.
|
132 | RefrigerationCompressor::RefrigerationCompressor(std::shared_ptr<detail::RefrigerationCompressor_Impl> impl) : ParentObject(std::move(impl)) {} |
| 532 | /// @endcond | ||
| 533 | |||
| 534 | } // namespace model | ||
| 535 | } // namespace openstudio | ||
| 536 |