src/model/SimpleGlazing.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 "SimpleGlazing.hpp" | ||
| 7 | #include "SimpleGlazing_Impl.hpp" | ||
| 8 | |||
| 9 | #include <utilities/idd/OS_WindowMaterial_SimpleGlazingSystem_FieldEnums.hxx> | ||
| 10 | #include <utilities/idd/IddEnums.hxx> | ||
| 11 | |||
| 12 | #include "../utilities/core/Assert.hpp" | ||
| 13 | |||
| 14 | namespace openstudio { | ||
| 15 | namespace model { | ||
| 16 | |||
| 17 | namespace detail { | ||
| 18 | |||
| 19 | 265 | SimpleGlazing_Impl::SimpleGlazing_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 20 | 265 | : Glazing_Impl(idfObject, model, keepHandle) { | |
| 21 |
4/6✓ Branch 1 taken 265 times.
✓ Branch 4 taken 265 times.
✓ Branch 7 taken 265 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 265 times.
✗ Branch 13 not taken.
|
265 | OS_ASSERT(idfObject.iddObject().type() == SimpleGlazing::iddObjectType()); |
| 22 | 265 | } | |
| 23 | |||
| 24 | 56 | SimpleGlazing_Impl::SimpleGlazing_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 25 | 56 | : Glazing_Impl(other, model, keepHandle) { | |
| 26 |
4/6✓ Branch 1 taken 56 times.
✓ Branch 4 taken 56 times.
✓ Branch 7 taken 56 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 56 times.
✗ Branch 13 not taken.
|
56 | OS_ASSERT(other.iddObject().type() == SimpleGlazing::iddObjectType()); |
| 27 | 56 | } | |
| 28 | |||
| 29 | 143 | SimpleGlazing_Impl::SimpleGlazing_Impl(const SimpleGlazing_Impl& other, Model_Impl* model, bool keepHandle) | |
| 30 | 143 | : Glazing_Impl(other, model, keepHandle) {} | |
| 31 | |||
| 32 | 1 | const std::vector<std::string>& SimpleGlazing_Impl::outputVariableNames() const { | |
| 33 |
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; |
| 34 | 1 | return result; | |
| 35 | } | ||
| 36 | |||
| 37 | 2 | IddObjectType SimpleGlazing_Impl::iddObjectType() const { | |
| 38 | 2 | return SimpleGlazing::iddObjectType(); | |
| 39 | } | ||
| 40 | |||
| 41 | 6 | boost::optional<double> SimpleGlazing_Impl::getVisibleTransmittance() const { | |
| 42 | 6 | return visibleTransmittance(); | |
| 43 | } | ||
| 44 | |||
| 45 | 81 | double SimpleGlazing_Impl::uFactor() const { | |
| 46 |
1/1✓ Branch 1 taken 81 times.
|
81 | boost::optional<double> value = getDouble(OS_WindowMaterial_SimpleGlazingSystemFields::UFactor, true); |
| 47 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 81 times.
✗ Branch 4 not taken.
|
81 | OS_ASSERT(value); |
| 48 |
1/1✓ Branch 1 taken 81 times.
|
162 | return value.get(); |
| 49 | } | ||
| 50 | |||
| 51 | 81 | double SimpleGlazing_Impl::solarHeatGainCoefficient() const { | |
| 52 |
1/1✓ Branch 1 taken 81 times.
|
81 | boost::optional<double> value = getDouble(OS_WindowMaterial_SimpleGlazingSystemFields::SolarHeatGainCoefficient, true); |
| 53 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 81 times.
✗ Branch 4 not taken.
|
81 | OS_ASSERT(value); |
| 54 |
1/1✓ Branch 1 taken 81 times.
|
162 | return value.get(); |
| 55 | } | ||
| 56 | |||
| 57 | 89 | boost::optional<double> SimpleGlazing_Impl::visibleTransmittance() const { | |
| 58 | 89 | return getDouble(OS_WindowMaterial_SimpleGlazingSystemFields::VisibleTransmittance, true); | |
| 59 | } | ||
| 60 | |||
| 61 | 409 | bool SimpleGlazing_Impl::setUFactor(double uFactor) { | |
| 62 | 409 | bool result = setDouble(OS_WindowMaterial_SimpleGlazingSystemFields::UFactor, uFactor); | |
| 63 | 409 | return result; | |
| 64 | } | ||
| 65 | |||
| 66 | 409 | bool SimpleGlazing_Impl::setSolarHeatGainCoefficient(double solarHeatGainCoefficient) { | |
| 67 | 409 | bool result = setDouble(OS_WindowMaterial_SimpleGlazingSystemFields::SolarHeatGainCoefficient, solarHeatGainCoefficient); | |
| 68 | 409 | return result; | |
| 69 | } | ||
| 70 | |||
| 71 | 199 | bool SimpleGlazing_Impl::setVisibleTransmittance(boost::optional<double> visibleTransmittance) { | |
| 72 | 199 | bool result(false); | |
| 73 |
1/2✓ Branch 0 taken 199 times.
✗ Branch 1 not taken.
|
199 | if (visibleTransmittance) { |
| 74 | 199 | result = setDouble(OS_WindowMaterial_SimpleGlazingSystemFields::VisibleTransmittance, visibleTransmittance.get()); | |
| 75 | } else { | ||
| 76 | ✗ | resetVisibleTransmittance(); | |
| 77 | ✗ | result = true; | |
| 78 | } | ||
| 79 | 199 | return result; | |
| 80 | } | ||
| 81 | |||
| 82 | 1 | void SimpleGlazing_Impl::resetVisibleTransmittance() { | |
| 83 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_WindowMaterial_SimpleGlazingSystemFields::VisibleTransmittance, ""); |
| 84 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 85 | 1 | } | |
| 86 | |||
| 87 | } // namespace detail | ||
| 88 | |||
| 89 | 208 | SimpleGlazing::SimpleGlazing(const Model& model, double uFactor, double solarHeatGainCoefficient) : Glazing(SimpleGlazing::iddObjectType(), model) { | |
| 90 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 208 times.
✗ Branch 5 not taken.
|
208 | OS_ASSERT(getImpl<detail::SimpleGlazing_Impl>()); |
| 91 | |||
| 92 | 208 | bool ok = true; | |
| 93 |
1/1✓ Branch 1 taken 208 times.
|
208 | ok = setUFactor(uFactor); |
| 94 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 208 times.
✗ Branch 3 not taken.
|
208 | OS_ASSERT(ok); |
| 95 |
1/1✓ Branch 1 taken 208 times.
|
208 | ok = setSolarHeatGainCoefficient(solarHeatGainCoefficient); |
| 96 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 208 times.
✗ Branch 3 not taken.
|
208 | OS_ASSERT(ok); |
| 97 | 208 | } | |
| 98 | |||
| 99 | 8261 | IddObjectType SimpleGlazing::iddObjectType() { | |
| 100 |
1/1✓ Branch 1 taken 8261 times.
|
8261 | return {IddObjectType::OS_WindowMaterial_SimpleGlazingSystem}; |
| 101 | } | ||
| 102 | |||
| 103 | 81 | double SimpleGlazing::uFactor() const { | |
| 104 |
1/1✓ Branch 3 taken 81 times.
|
81 | return getImpl<detail::SimpleGlazing_Impl>()->uFactor(); |
| 105 | } | ||
| 106 | |||
| 107 | 81 | double SimpleGlazing::solarHeatGainCoefficient() const { | |
| 108 |
1/1✓ Branch 3 taken 81 times.
|
81 | return getImpl<detail::SimpleGlazing_Impl>()->solarHeatGainCoefficient(); |
| 109 | } | ||
| 110 | |||
| 111 | 83 | boost::optional<double> SimpleGlazing::visibleTransmittance() const { | |
| 112 |
1/1✓ Branch 3 taken 83 times.
|
83 | return getImpl<detail::SimpleGlazing_Impl>()->visibleTransmittance(); |
| 113 | } | ||
| 114 | |||
| 115 | 409 | bool SimpleGlazing::setUFactor(double uFactor) { | |
| 116 |
1/1✓ Branch 3 taken 409 times.
|
409 | return getImpl<detail::SimpleGlazing_Impl>()->setUFactor(uFactor); |
| 117 | } | ||
| 118 | |||
| 119 | 409 | bool SimpleGlazing::setSolarHeatGainCoefficient(double solarHeatGainCoefficient) { | |
| 120 |
1/1✓ Branch 3 taken 409 times.
|
409 | return getImpl<detail::SimpleGlazing_Impl>()->setSolarHeatGainCoefficient(solarHeatGainCoefficient); |
| 121 | } | ||
| 122 | |||
| 123 | 199 | bool SimpleGlazing::setVisibleTransmittance(double visibleTransmittance) { | |
| 124 |
2/2✓ Branch 3 taken 199 times.
✓ Branch 6 taken 199 times.
|
199 | return getImpl<detail::SimpleGlazing_Impl>()->setVisibleTransmittance(visibleTransmittance); |
| 125 | } | ||
| 126 | |||
| 127 | 1 | void SimpleGlazing::resetVisibleTransmittance() { | |
| 128 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::SimpleGlazing_Impl>()->resetVisibleTransmittance(); |
| 129 | 1 | } | |
| 130 | |||
| 131 | /// @cond | ||
| 132 |
1/1✓ Branch 3 taken 114 times.
|
114 | SimpleGlazing::SimpleGlazing(std::shared_ptr<detail::SimpleGlazing_Impl> impl) : Glazing(std::move(impl)) {} |
| 133 | /// @endcond | ||
| 134 | |||
| 135 | } // namespace model | ||
| 136 | } // namespace openstudio | ||
| 137 |