GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 67.4% 60 / 0 / 89
Functions: 75.0% 18 / 0 / 24
Branches: 41.1% 58 / 0 / 141

src/model/SurfacePropertyIncidentSolarMultiplier.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 "SurfacePropertyIncidentSolarMultiplier.hpp"
7 #include "SurfacePropertyIncidentSolarMultiplier_Impl.hpp"
8
9 #include "Model.hpp"
10 #include "SubSurface.hpp"
11 #include "SubSurface_Impl.hpp"
12 #include "Schedule.hpp"
13 #include "Schedule_Impl.hpp"
14 #include "ScheduleTypeLimits.hpp"
15 #include "ScheduleTypeRegistry.hpp"
16
17 #include <utilities/idd/IddEnums.hxx>
18 #include <utilities/idd/OS_SurfaceProperty_IncidentSolarMultiplier_FieldEnums.hxx>
19
20 #include "../utilities/units/Unit.hpp"
21
22 #include "../utilities/core/Assert.hpp"
23
24 namespace openstudio {
25 namespace model {
26
27 namespace detail {
28
29 3 SurfacePropertyIncidentSolarMultiplier_Impl::SurfacePropertyIncidentSolarMultiplier_Impl(const IdfObject& idfObject, Model_Impl* model,
30 3 bool keepHandle)
31 3 : ModelObject_Impl(idfObject, model, keepHandle) {
32
4/6
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 3 times.
✗ Branch 13 not taken.
3 OS_ASSERT(idfObject.iddObject().type() == SurfacePropertyIncidentSolarMultiplier::iddObjectType());
33 3 }
34
35 ✗ SurfacePropertyIncidentSolarMultiplier_Impl::SurfacePropertyIncidentSolarMultiplier_Impl(const openstudio::detail::WorkspaceObject_Impl& other,
36 ✗ Model_Impl* model, bool keepHandle)
37 ✗ : ModelObject_Impl(other, model, keepHandle) {
38 ✗ OS_ASSERT(other.iddObject().type() == SurfacePropertyIncidentSolarMultiplier::iddObjectType());
39 ✗ }
40
41 1 SurfacePropertyIncidentSolarMultiplier_Impl::SurfacePropertyIncidentSolarMultiplier_Impl(const SurfacePropertyIncidentSolarMultiplier_Impl& other,
42 1 Model_Impl* model, bool keepHandle)
43 1 : ModelObject_Impl(other, model, keepHandle) {}
44
45 ✗ const std::vector<std::string>& SurfacePropertyIncidentSolarMultiplier_Impl::outputVariableNames() const {
46 ✗ static std::vector<std::string> result;
47 ✗ if (result.empty()) {
48 }
49 ✗ return result;
50 }
51
52 ✗ IddObjectType SurfacePropertyIncidentSolarMultiplier_Impl::iddObjectType() const {
53 ✗ return SurfacePropertyIncidentSolarMultiplier::iddObjectType();
54 }
55
56 ✗ std::vector<ScheduleTypeKey> SurfacePropertyIncidentSolarMultiplier_Impl::getScheduleTypeKeys(const Schedule& schedule) const {
57 ✗ std::vector<ScheduleTypeKey> result;
58 ✗ UnsignedVector fieldIndices = getSourceIndices(schedule.handle());
59 ✗ UnsignedVector::const_iterator b(fieldIndices.begin());
60 ✗ UnsignedVector::const_iterator e(fieldIndices.end());
61 ✗ if (std::find(b, e, OS_SurfaceProperty_IncidentSolarMultiplierFields::IncidentSolarMultiplierScheduleName) != e) {
62 ✗ result.emplace_back("SurfacePropertyIncidentSolarMultiplier", "Incident Solar Multiplier");
63 }
64 ✗ return result;
65 ✗ }
66
67 7 SubSurface SurfacePropertyIncidentSolarMultiplier_Impl::subSurface() const {
68
1/1
✓ Branch 1 taken 7 times.
7 boost::optional<SubSurface> value = optionalSubSurface();
69
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
7 if (!value) {
70 ✗ LOG_AND_THROW(briefDescription() << " does not have an Surface attached.");
71 }
72
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
14 return value.get();
73 7 }
74
75 6 double SurfacePropertyIncidentSolarMultiplier_Impl::incidentSolarMultiplier() const {
76
1/1
✓ Branch 1 taken 6 times.
6 boost::optional<double> value = getDouble(OS_SurfaceProperty_IncidentSolarMultiplierFields::IncidentSolarMultiplier, true);
77
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
6 OS_ASSERT(value);
78
1/1
✓ Branch 1 taken 6 times.
12 return value.get();
79 }
80
81 6 boost::optional<Schedule> SurfacePropertyIncidentSolarMultiplier_Impl::incidentSolarMultiplierSchedule() const {
82
1/1
✓ Branch 1 taken 6 times.
12 return getObject<ModelObject>().getModelObjectTarget<Schedule>(
83
1/1
✓ Branch 1 taken 6 times.
12 OS_SurfaceProperty_IncidentSolarMultiplierFields::IncidentSolarMultiplierScheduleName);
84 }
85
86 4 bool SurfacePropertyIncidentSolarMultiplier_Impl::setSubSurface(const SubSurface& subSurface) {
87
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 bool result = setPointer(OS_SurfaceProperty_IncidentSolarMultiplierFields::SurfaceName, subSurface.handle());
88 4 return result;
89 }
90
91 7 bool SurfacePropertyIncidentSolarMultiplier_Impl::setIncidentSolarMultiplier(double incidentSolarMultiplier) {
92 7 bool result = setDouble(OS_SurfaceProperty_IncidentSolarMultiplierFields::IncidentSolarMultiplier, incidentSolarMultiplier);
93 7 return result;
94 }
95
96 3 bool SurfacePropertyIncidentSolarMultiplier_Impl::setIncidentSolarMultiplierSchedule(Schedule& schedule) {
97
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
12 bool result = setSchedule(OS_SurfaceProperty_IncidentSolarMultiplierFields::IncidentSolarMultiplierScheduleName,
98 "SurfacePropertyIncidentSolarMultiplier", "Incident Solar Multiplier", schedule);
99 3 return result;
100 }
101
102 ✗ void SurfacePropertyIncidentSolarMultiplier_Impl::resetIncidentSolarMultiplierSchedule() {
103 ✗ bool result = setString(OS_SurfaceProperty_IncidentSolarMultiplierFields::IncidentSolarMultiplierScheduleName, "");
104 ✗ OS_ASSERT(result);
105 ✗ }
106
107 7 boost::optional<SubSurface> SurfacePropertyIncidentSolarMultiplier_Impl::optionalSubSurface() const {
108
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 return getObject<ModelObject>().getModelObjectTarget<SubSurface>(OS_SurfaceProperty_IncidentSolarMultiplierFields::SurfaceName);
109 }
110
111 } // namespace detail
112
113 3 SurfacePropertyIncidentSolarMultiplier::SurfacePropertyIncidentSolarMultiplier(const SubSurface& subSurface)
114
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 : ModelObject(SurfacePropertyIncidentSolarMultiplier::iddObjectType(), subSurface.model()) {
115
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 5 not taken.
3 OS_ASSERT(getImpl<detail::SurfacePropertyIncidentSolarMultiplier_Impl>());
116
117
1/1
✓ Branch 1 taken 3 times.
3 auto subSurfaceType = subSurface.subSurfaceType();
118
12/24
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 6 taken 1 time.
✓ Branch 7 taken 2 times.
✓ Branch 9 taken 1 time.
✓ Branch 12 taken 1 time.
✓ Branch 14 taken 1 time.
✗ Branch 15 not taken.
✓ Branch 17 taken 1 time.
✓ Branch 18 taken 2 times.
✓ Branch 19 taken 3 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 3 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 25 taken 3 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
15 if (!(istringEqual("FixedWindow", subSurfaceType) || istringEqual("OperableWindow", subSurfaceType)
119
9/14
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 9 taken 2 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 2 times.
✓ Branch 13 taken 1 time.
✓ Branch 14 taken 2 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
5 || istringEqual("Skylight", subSurfaceType))) {
120 ✗ LOG_AND_THROW("Wrong SubSurface Type: only accepts windows, was passed " << subSurface.briefDescription());
121 }
122 3 bool ok = true;
123
1/1
✓ Branch 1 taken 3 times.
3 ok = setSubSurface(subSurface);
124
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
3 OS_ASSERT(ok);
125
126 // TODO: default to alwaysOnContinous? Or leave as optional?
127 // {
128 // auto schedule = subSurface.model().alwaysOnContinuousSchedule();
129 // ok = setIncidentSolarMultiplierSchedule(schedule);
130 // OS_ASSERT(ok);
131 // }
132
133
1/1
✓ Branch 1 taken 3 times.
3 ok = setIncidentSolarMultiplier(1.0);
134
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
3 OS_ASSERT(ok);
135 3 }
136
137 8001 IddObjectType SurfacePropertyIncidentSolarMultiplier::iddObjectType() {
138
1/1
✓ Branch 1 taken 8001 times.
8001 return {IddObjectType::OS_SurfaceProperty_IncidentSolarMultiplier};
139 }
140
141 7 SubSurface SurfacePropertyIncidentSolarMultiplier::subSurface() const {
142
1/1
✓ Branch 3 taken 7 times.
7 return getImpl<detail::SurfacePropertyIncidentSolarMultiplier_Impl>()->subSurface();
143 }
144
145 6 double SurfacePropertyIncidentSolarMultiplier::incidentSolarMultiplier() const {
146
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::SurfacePropertyIncidentSolarMultiplier_Impl>()->incidentSolarMultiplier();
147 }
148
149 6 boost::optional<Schedule> SurfacePropertyIncidentSolarMultiplier::incidentSolarMultiplierSchedule() const {
150
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::SurfacePropertyIncidentSolarMultiplier_Impl>()->incidentSolarMultiplierSchedule();
151 }
152
153 4 bool SurfacePropertyIncidentSolarMultiplier::setSubSurface(const SubSurface& subSurface) {
154
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::SurfacePropertyIncidentSolarMultiplier_Impl>()->setSubSurface(subSurface);
155 }
156
157 7 bool SurfacePropertyIncidentSolarMultiplier::setIncidentSolarMultiplier(double incidentSolarMultiplier) {
158
1/1
✓ Branch 3 taken 7 times.
7 return getImpl<detail::SurfacePropertyIncidentSolarMultiplier_Impl>()->setIncidentSolarMultiplier(incidentSolarMultiplier);
159 }
160
161 3 bool SurfacePropertyIncidentSolarMultiplier::setIncidentSolarMultiplierSchedule(Schedule& schedule) {
162
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::SurfacePropertyIncidentSolarMultiplier_Impl>()->setIncidentSolarMultiplierSchedule(schedule);
163 }
164
165 ✗ void SurfacePropertyIncidentSolarMultiplier::resetIncidentSolarMultiplierSchedule() {
166 ✗ getImpl<detail::SurfacePropertyIncidentSolarMultiplier_Impl>()->resetIncidentSolarMultiplierSchedule();
167 ✗ }
168
169 /// @cond
170 5 SurfacePropertyIncidentSolarMultiplier::SurfacePropertyIncidentSolarMultiplier(
171 5 std::shared_ptr<detail::SurfacePropertyIncidentSolarMultiplier_Impl> impl)
172
1/1
✓ Branch 3 taken 5 times.
5 : ModelObject(std::move(impl)) {}
173 /// @endcond
174
175 } // namespace model
176 } // namespace openstudio
177