src/model/DaylightingDeviceLightWell.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 "DaylightingDeviceLightWell.hpp" | ||
| 7 | #include "DaylightingDeviceLightWell_Impl.hpp" | ||
| 8 | |||
| 9 | #include "Model.hpp" | ||
| 10 | #include "Model_Impl.hpp" | ||
| 11 | #include "Space.hpp" | ||
| 12 | #include "Space_Impl.hpp" | ||
| 13 | #include "SubSurface.hpp" | ||
| 14 | #include "SubSurface_Impl.hpp" | ||
| 15 | #include "InteriorPartitionSurface.hpp" | ||
| 16 | #include "InteriorPartitionSurface_Impl.hpp" | ||
| 17 | #include "ShadingSurface.hpp" | ||
| 18 | #include "ShadingSurface_Impl.hpp" | ||
| 19 | |||
| 20 | #include <utilities/idd/OS_DaylightingDevice_LightWell_FieldEnums.hxx> | ||
| 21 | #include <utilities/idd/IddEnums.hxx> | ||
| 22 | |||
| 23 | #include "../utilities/core/Assert.hpp" | ||
| 24 | |||
| 25 | namespace openstudio { | ||
| 26 | namespace model { | ||
| 27 | |||
| 28 | namespace detail { | ||
| 29 | |||
| 30 | 10 | DaylightingDeviceLightWell_Impl::DaylightingDeviceLightWell_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 31 | 10 | : ModelObject_Impl(idfObject, model, keepHandle) { | |
| 32 |
4/6✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 10 times.
✗ Branch 13 not taken.
|
10 | OS_ASSERT(idfObject.iddObject().type() == DaylightingDeviceLightWell::iddObjectType()); |
| 33 | 10 | } | |
| 34 | |||
| 35 | ✗ | DaylightingDeviceLightWell_Impl::DaylightingDeviceLightWell_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, | |
| 36 | ✗ | bool keepHandle) | |
| 37 | ✗ | : ModelObject_Impl(other, model, keepHandle) { | |
| 38 | ✗ | OS_ASSERT(other.iddObject().type() == DaylightingDeviceLightWell::iddObjectType()); | |
| 39 | ✗ | } | |
| 40 | |||
| 41 | 1 | DaylightingDeviceLightWell_Impl::DaylightingDeviceLightWell_Impl(const DaylightingDeviceLightWell_Impl& other, Model_Impl* model, bool keepHandle) | |
| 42 | 1 | : ModelObject_Impl(other, model, keepHandle) {} | |
| 43 | |||
| 44 | ✗ | const std::vector<std::string>& DaylightingDeviceLightWell_Impl::outputVariableNames() const { | |
| 45 | ✗ | static const std::vector<std::string> result; | |
| 46 | ✗ | return result; | |
| 47 | } | ||
| 48 | |||
| 49 | ✗ | IddObjectType DaylightingDeviceLightWell_Impl::iddObjectType() const { | |
| 50 | ✗ | return DaylightingDeviceLightWell::iddObjectType(); | |
| 51 | } | ||
| 52 | |||
| 53 | 3 | SubSurface DaylightingDeviceLightWell_Impl::subSurface() const { | |
| 54 | OptionalSubSurface subSurface = | ||
| 55 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | getObject<ModelObject>().getModelObjectTarget<SubSurface>(OS_DaylightingDevice_LightWellFields::ExteriorWindowName); |
| 56 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(subSurface); |
| 57 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
6 | return subSurface.get(); |
| 58 | 3 | } | |
| 59 | |||
| 60 | 3 | double DaylightingDeviceLightWell_Impl::heightofWell() const { | |
| 61 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> value = getDouble(OS_DaylightingDevice_LightWellFields::HeightofWell, true); |
| 62 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(value); |
| 63 |
1/1✓ Branch 1 taken 3 times.
|
6 | return value.get(); |
| 64 | } | ||
| 65 | |||
| 66 | 3 | double DaylightingDeviceLightWell_Impl::perimeterofBottomofWell() const { | |
| 67 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> value = getDouble(OS_DaylightingDevice_LightWellFields::PerimeterofBottomofWell, true); |
| 68 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(value); |
| 69 |
1/1✓ Branch 1 taken 3 times.
|
6 | return value.get(); |
| 70 | } | ||
| 71 | |||
| 72 | 3 | double DaylightingDeviceLightWell_Impl::areaofBottomofWell() const { | |
| 73 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> value = getDouble(OS_DaylightingDevice_LightWellFields::AreaofBottomofWell, true); |
| 74 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(value); |
| 75 |
1/1✓ Branch 1 taken 3 times.
|
6 | return value.get(); |
| 76 | } | ||
| 77 | |||
| 78 | 3 | double DaylightingDeviceLightWell_Impl::visibleReflectanceofWellWalls() const { | |
| 79 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> value = getDouble(OS_DaylightingDevice_LightWellFields::VisibleReflectanceofWellWalls, true); |
| 80 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(value); |
| 81 |
1/1✓ Branch 1 taken 3 times.
|
6 | return value.get(); |
| 82 | } | ||
| 83 | |||
| 84 | 7 | bool DaylightingDeviceLightWell_Impl::setHeightofWell(double heightofWell) { | |
| 85 | 7 | bool result = setDouble(OS_DaylightingDevice_LightWellFields::HeightofWell, heightofWell); | |
| 86 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | OS_ASSERT(result); |
| 87 | 7 | return result; | |
| 88 | } | ||
| 89 | |||
| 90 | 7 | bool DaylightingDeviceLightWell_Impl::setPerimeterofBottomofWell(double perimeterofBottomofWell) { | |
| 91 | 7 | bool result = setDouble(OS_DaylightingDevice_LightWellFields::PerimeterofBottomofWell, perimeterofBottomofWell); | |
| 92 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | OS_ASSERT(result); |
| 93 | 7 | return result; | |
| 94 | } | ||
| 95 | |||
| 96 | 7 | bool DaylightingDeviceLightWell_Impl::setAreaofBottomofWell(double areaofBottomofWell) { | |
| 97 | 7 | bool result = setDouble(OS_DaylightingDevice_LightWellFields::AreaofBottomofWell, areaofBottomofWell); | |
| 98 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | OS_ASSERT(result); |
| 99 | 7 | return result; | |
| 100 | } | ||
| 101 | |||
| 102 | 7 | bool DaylightingDeviceLightWell_Impl::setVisibleReflectanceofWellWalls(double visibleReflectanceofWellWalls) { | |
| 103 | 7 | bool result = setDouble(OS_DaylightingDevice_LightWellFields::VisibleReflectanceofWellWalls, visibleReflectanceofWellWalls); | |
| 104 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | OS_ASSERT(result); |
| 105 | 7 | return result; | |
| 106 | } | ||
| 107 | |||
| 108 | } // namespace detail | ||
| 109 | |||
| 110 | 2 | DaylightingDeviceLightWell::DaylightingDeviceLightWell(const SubSurface& subSurface, double heightofWell, double perimeterofBottomofWell, | |
| 111 | 2 | double areaofBottomofWell, double visibleReflectanceofWellWalls) | |
| 112 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | : ModelObject(DaylightingDeviceLightWell::iddObjectType(), subSurface.model()) { |
| 113 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 5 not taken.
|
2 | OS_ASSERT(getImpl<detail::DaylightingDeviceLightWell_Impl>()); |
| 114 | |||
| 115 | 2 | bool subSurfaceOk = false; | |
| 116 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | if (subSurface.allowDaylightingDeviceLightWell()) { |
| 117 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
2 | if (!subSurface.daylightingDeviceLightWell()) { |
| 118 | 2 | subSurfaceOk = true; | |
| 119 | } | ||
| 120 | } | ||
| 121 | |||
| 122 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!subSurfaceOk) { |
| 123 | ✗ | this->remove(); | |
| 124 | ✗ | LOG_AND_THROW("Cannot create DaylightingDeviceLightWell for SubSurface '" << subSurface.name().get() << "'"); | |
| 125 | } | ||
| 126 | |||
| 127 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | bool test = setPointer(OS_DaylightingDevice_LightWellFields::ExteriorWindowName, subSurface.handle()); |
| 128 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
|
2 | OS_ASSERT(test); |
| 129 | |||
| 130 |
1/1✓ Branch 1 taken 2 times.
|
2 | setHeightofWell(heightofWell); |
| 131 | |||
| 132 |
1/1✓ Branch 1 taken 2 times.
|
2 | setPerimeterofBottomofWell(perimeterofBottomofWell); |
| 133 | |||
| 134 |
1/1✓ Branch 1 taken 2 times.
|
2 | setAreaofBottomofWell(areaofBottomofWell); |
| 135 | |||
| 136 |
1/1✓ Branch 1 taken 2 times.
|
2 | setVisibleReflectanceofWellWalls(visibleReflectanceofWellWalls); |
| 137 | 2 | } | |
| 138 | |||
| 139 | 8 | DaylightingDeviceLightWell::DaylightingDeviceLightWell(const SubSurface& subSurface) | |
| 140 |
3/3✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
|
8 | : ModelObject(DaylightingDeviceLightWell::iddObjectType(), subSurface.model()) { |
| 141 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
✗ Branch 5 not taken.
|
8 | OS_ASSERT(getImpl<detail::DaylightingDeviceLightWell_Impl>()); |
| 142 | |||
| 143 | 8 | bool subSurfaceOk = false; | |
| 144 |
3/3✓ Branch 1 taken 8 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 2 times.
|
8 | if (subSurface.allowDaylightingDeviceLightWell()) { |
| 145 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 2 times.
|
6 | if (!subSurface.daylightingDeviceLightWell()) { |
| 146 | 4 | subSurfaceOk = true; | |
| 147 | } | ||
| 148 | } | ||
| 149 | |||
| 150 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
|
8 | if (!subSurfaceOk) { |
| 151 |
1/1✓ Branch 1 taken 4 times.
|
4 | this->remove(); |
| 152 |
21/21✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 13 taken 4 times.
✓ Branch 16 taken 4 times.
✓ Branch 20 taken 4 times.
✓ Branch 23 taken 4 times.
✓ Branch 26 taken 4 times.
✓ Branch 32 taken 4 times.
✓ Branch 35 taken 4 times.
✓ Branch 38 taken 4 times.
✓ Branch 41 taken 4 times.
✓ Branch 44 taken 4 times.
✓ Branch 47 taken 4 times.
✓ Branch 50 taken 4 times.
✓ Branch 53 taken 4 times.
✓ Branch 56 taken 4 times.
✓ Branch 59 taken 4 times.
✓ Branch 64 taken 4 times.
✓ Branch 67 taken 4 times.
|
4 | LOG_AND_THROW("Cannot create DaylightingDeviceLightWell for SubSurface '" << subSurface.name().get() << "'"); |
| 153 | } | ||
| 154 | |||
| 155 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | bool test = setPointer(OS_DaylightingDevice_LightWellFields::ExteriorWindowName, subSurface.handle()); |
| 156 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
|
4 | OS_ASSERT(test); |
| 157 | |||
| 158 |
1/1✓ Branch 1 taken 4 times.
|
4 | setHeightofWell(1.2); // GeometryTest.idf |
| 159 | |||
| 160 |
1/1✓ Branch 1 taken 4 times.
|
4 | setPerimeterofBottomofWell(12.0); // GeometryTest.idf |
| 161 | |||
| 162 |
1/1✓ Branch 1 taken 4 times.
|
4 | setAreaofBottomofWell(9.0); // GeometryTest.idf |
| 163 | |||
| 164 |
1/1✓ Branch 1 taken 4 times.
|
4 | setVisibleReflectanceofWellWalls(0.7); // GeometryTest.idf |
| 165 | 8 | } | |
| 166 | |||
| 167 | 11896 | IddObjectType DaylightingDeviceLightWell::iddObjectType() { | |
| 168 |
1/1✓ Branch 1 taken 11896 times.
|
11896 | IddObjectType result(IddObjectType::OS_DaylightingDevice_LightWell); |
| 169 | 11896 | return result; | |
| 170 | } | ||
| 171 | |||
| 172 | 3 | SubSurface DaylightingDeviceLightWell::subSurface() const { | |
| 173 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::DaylightingDeviceLightWell_Impl>()->subSurface(); |
| 174 | } | ||
| 175 | |||
| 176 | 3 | double DaylightingDeviceLightWell::heightofWell() const { | |
| 177 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::DaylightingDeviceLightWell_Impl>()->heightofWell(); |
| 178 | } | ||
| 179 | |||
| 180 | 3 | double DaylightingDeviceLightWell::perimeterofBottomofWell() const { | |
| 181 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::DaylightingDeviceLightWell_Impl>()->perimeterofBottomofWell(); |
| 182 | } | ||
| 183 | |||
| 184 | 3 | double DaylightingDeviceLightWell::areaofBottomofWell() const { | |
| 185 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::DaylightingDeviceLightWell_Impl>()->areaofBottomofWell(); |
| 186 | } | ||
| 187 | |||
| 188 | 3 | double DaylightingDeviceLightWell::visibleReflectanceofWellWalls() const { | |
| 189 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::DaylightingDeviceLightWell_Impl>()->visibleReflectanceofWellWalls(); |
| 190 | } | ||
| 191 | |||
| 192 | 7 | bool DaylightingDeviceLightWell::setHeightofWell(double heightofWell) { | |
| 193 |
1/1✓ Branch 3 taken 7 times.
|
7 | return getImpl<detail::DaylightingDeviceLightWell_Impl>()->setHeightofWell(heightofWell); |
| 194 | } | ||
| 195 | |||
| 196 | 7 | bool DaylightingDeviceLightWell::setPerimeterofBottomofWell(double perimeterofBottomofWell) { | |
| 197 |
1/1✓ Branch 3 taken 7 times.
|
7 | return getImpl<detail::DaylightingDeviceLightWell_Impl>()->setPerimeterofBottomofWell(perimeterofBottomofWell); |
| 198 | } | ||
| 199 | |||
| 200 | 7 | bool DaylightingDeviceLightWell::setAreaofBottomofWell(double areaofBottomofWell) { | |
| 201 |
1/1✓ Branch 3 taken 7 times.
|
7 | return getImpl<detail::DaylightingDeviceLightWell_Impl>()->setAreaofBottomofWell(areaofBottomofWell); |
| 202 | } | ||
| 203 | |||
| 204 | 7 | bool DaylightingDeviceLightWell::setVisibleReflectanceofWellWalls(double visibleReflectanceofWellWalls) { | |
| 205 |
1/1✓ Branch 3 taken 7 times.
|
7 | return getImpl<detail::DaylightingDeviceLightWell_Impl>()->setVisibleReflectanceofWellWalls(visibleReflectanceofWellWalls); |
| 206 | } | ||
| 207 | |||
| 208 | /// @cond | ||
| 209 | 29 | DaylightingDeviceLightWell::DaylightingDeviceLightWell(std::shared_ptr<detail::DaylightingDeviceLightWell_Impl> impl) | |
| 210 |
1/1✓ Branch 3 taken 29 times.
|
29 | : ModelObject(std::move(impl)) {} |
| 211 | /// @endcond | ||
| 212 | |||
| 213 | } // namespace model | ||
| 214 | } // namespace openstudio | ||
| 215 |