GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 56.4% 44 / 0 / 78
Functions: 65.2% 15 / 0 / 23
Branches: 47.4% 36 / 0 / 76

src/model/ZoneControlHumidistat.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 "ZoneControlHumidistat.hpp"
7 #include "ZoneControlHumidistat_Impl.hpp"
8
9 #include "Model.hpp"
10 #include "Model_Impl.hpp"
11 #include "Schedule.hpp"
12 #include "Schedule_Impl.hpp"
13 #include "ScheduleTypeLimits.hpp"
14 #include "ScheduleTypeRegistry.hpp"
15 #include "ThermalZone.hpp"
16 #include "ThermalZone_Impl.hpp"
17
18 #include <utilities/idd/OS_ZoneControl_Humidistat_FieldEnums.hxx>
19 #include <utilities/idd/IddEnums.hxx>
20
21 #include "../utilities/core/Assert.hpp"
22
23 namespace openstudio {
24 namespace model {
25
26 namespace detail {
27
28 4 ZoneControlHumidistat_Impl::ZoneControlHumidistat_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
29 4 : ModelObject_Impl(idfObject, model, keepHandle) {
30
4/6
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 13 not taken.
4 OS_ASSERT(idfObject.iddObject().type() == ZoneControlHumidistat::iddObjectType());
31 4 }
32
33 ✗ ZoneControlHumidistat_Impl::ZoneControlHumidistat_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
34 ✗ : ModelObject_Impl(other, model, keepHandle) {
35 ✗ OS_ASSERT(other.iddObject().type() == ZoneControlHumidistat::iddObjectType());
36 ✗ }
37
38 6 ZoneControlHumidistat_Impl::ZoneControlHumidistat_Impl(const ZoneControlHumidistat_Impl& other, Model_Impl* model, bool keepHandle)
39 6 : ModelObject_Impl(other, model, keepHandle) {}
40
41 ✗ const std::vector<std::string>& ZoneControlHumidistat_Impl::outputVariableNames() const {
42 ✗ static const std::vector<std::string> result;
43 ✗ return result;
44 }
45
46 ✗ IddObjectType ZoneControlHumidistat_Impl::iddObjectType() const {
47 ✗ return ZoneControlHumidistat::iddObjectType();
48 }
49
50 ✗ std::vector<ScheduleTypeKey> ZoneControlHumidistat_Impl::getScheduleTypeKeys(const Schedule& schedule) const {
51 ✗ std::vector<ScheduleTypeKey> result;
52 ✗ UnsignedVector fieldIndices = getSourceIndices(schedule.handle());
53 ✗ UnsignedVector::const_iterator b(fieldIndices.begin());
54 ✗ UnsignedVector::const_iterator e(fieldIndices.end());
55 ✗ if (std::find(b, e, OS_ZoneControl_HumidistatFields::HumidifyingRelativeHumiditySetpointScheduleName) != e) {
56 ✗ result.push_back(ScheduleTypeKey("ZoneControlHumidistat", "Humidifying Relative Humidity Setpoint"));
57 }
58 ✗ if (std::find(b, e, OS_ZoneControl_HumidistatFields::DehumidifyingRelativeHumiditySetpointScheduleName) != e) {
59 ✗ result.push_back(ScheduleTypeKey("ZoneControlHumidistat", "Dehumidifying Relative Humidity Setpoint"));
60 }
61 ✗ return result;
62 ✗ }
63
64 1 boost::optional<Schedule> ZoneControlHumidistat_Impl::humidifyingRelativeHumiditySetpointSchedule() const {
65
1/1
✓ Branch 1 taken 1 time.
2 return getObject<ModelObject>().getModelObjectTarget<Schedule>(
66
1/1
✓ Branch 1 taken 1 time.
2 OS_ZoneControl_HumidistatFields::HumidifyingRelativeHumiditySetpointScheduleName);
67 }
68
69 1 boost::optional<Schedule> ZoneControlHumidistat_Impl::dehumidifyingRelativeHumiditySetpointSchedule() const {
70
1/1
✓ Branch 1 taken 1 time.
2 return getObject<ModelObject>().getModelObjectTarget<Schedule>(
71
1/1
✓ Branch 1 taken 1 time.
2 OS_ZoneControl_HumidistatFields::DehumidifyingRelativeHumiditySetpointScheduleName);
72 }
73
74 1 bool ZoneControlHumidistat_Impl::setHumidifyingRelativeHumiditySetpointSchedule(Schedule& schedule) {
75
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
4 bool result = setSchedule(OS_ZoneControl_HumidistatFields::HumidifyingRelativeHumiditySetpointScheduleName, "ZoneControlHumidistat",
76 "Humidifying Relative Humidity Setpoint", schedule);
77 1 return result;
78 }
79
80 1 bool ZoneControlHumidistat_Impl::setDehumidifyingRelativeHumiditySetpointSchedule(Schedule& schedule) {
81
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
4 bool result = setSchedule(OS_ZoneControl_HumidistatFields::DehumidifyingRelativeHumiditySetpointScheduleName, "ZoneControlHumidistat",
82 "Dehumidifying Relative Humidity Setpoint", schedule);
83 1 return result;
84 }
85
86 ✗ void ZoneControlHumidistat_Impl::resetHumidifyingRelativeHumiditySetpointSchedule() {
87 ✗ bool result = setString(OS_ZoneControl_HumidistatFields::HumidifyingRelativeHumiditySetpointScheduleName, "");
88 ✗ OS_ASSERT(result);
89 ✗ }
90
91 ✗ void ZoneControlHumidistat_Impl::resetDehumidifyingRelativeHumiditySetpointSchedule() {
92 ✗ bool result = setString(OS_ZoneControl_HumidistatFields::DehumidifyingRelativeHumiditySetpointScheduleName, "");
93 ✗ OS_ASSERT(result);
94 ✗ }
95
96 10 boost::optional<ThermalZone> ZoneControlHumidistat_Impl::controlledZone() const {
97
1/1
✓ Branch 1 taken 10 times.
10 Handle h = handle();
98
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 auto zones = model().getConcreteModelObjects<model::ThermalZone>();
99
2/2
✓ Branch 5 taken 14 times.
✓ Branch 6 taken 6 times.
20 for (const auto& zone : zones) {
100
3/3
✓ Branch 1 taken 14 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 6 times.
28 if (auto humidistat = zone.zoneControlHumidistat()) {
101
5/5
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✓ Branch 9 taken 4 times.
✓ Branch 10 taken 4 times.
8 if (humidistat->handle() == h) {
102
1/1
✓ Branch 1 taken 4 times.
4 return zone;
103 }
104 14 }
105 }
106 6 return boost::none;
107 10 }
108
109 } // namespace detail
110
111 4 ZoneControlHumidistat::ZoneControlHumidistat(const Model& model) : ModelObject(ZoneControlHumidistat::iddObjectType(), model) {
112
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 5 not taken.
4 OS_ASSERT(getImpl<detail::ZoneControlHumidistat_Impl>());
113 4 }
114
115 7739 IddObjectType ZoneControlHumidistat::iddObjectType() {
116
1/1
✓ Branch 1 taken 7739 times.
7739 return {IddObjectType::OS_ZoneControl_Humidistat};
117 }
118
119 1 boost::optional<Schedule> ZoneControlHumidistat::humidifyingRelativeHumiditySetpointSchedule() const {
120
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ZoneControlHumidistat_Impl>()->humidifyingRelativeHumiditySetpointSchedule();
121 }
122
123 1 boost::optional<Schedule> ZoneControlHumidistat::dehumidifyingRelativeHumiditySetpointSchedule() const {
124
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ZoneControlHumidistat_Impl>()->dehumidifyingRelativeHumiditySetpointSchedule();
125 }
126
127 1 bool ZoneControlHumidistat::setHumidifyingRelativeHumiditySetpointSchedule(Schedule& schedule) {
128
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ZoneControlHumidistat_Impl>()->setHumidifyingRelativeHumiditySetpointSchedule(schedule);
129 }
130
131 1 bool ZoneControlHumidistat::setDehumidifyingRelativeHumiditySetpointSchedule(Schedule& schedule) {
132
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ZoneControlHumidistat_Impl>()->setDehumidifyingRelativeHumiditySetpointSchedule(schedule);
133 }
134
135 ✗ void ZoneControlHumidistat::resetHumidifyingRelativeHumiditySetpointSchedule() {
136 ✗ getImpl<detail::ZoneControlHumidistat_Impl>()->resetHumidifyingRelativeHumiditySetpointSchedule();
137 ✗ }
138
139 ✗ void ZoneControlHumidistat::resetDehumidifyingRelativeHumiditySetpointSchedule() {
140 ✗ getImpl<detail::ZoneControlHumidistat_Impl>()->resetDehumidifyingRelativeHumiditySetpointSchedule();
141 ✗ }
142
143 10 boost::optional<ThermalZone> ZoneControlHumidistat::controlledZone() const {
144
1/1
✓ Branch 3 taken 10 times.
10 return getImpl<detail::ZoneControlHumidistat_Impl>()->controlledZone();
145 }
146
147 /// @cond
148
1/1
✓ Branch 3 taken 29 times.
29 ZoneControlHumidistat::ZoneControlHumidistat(std::shared_ptr<detail::ZoneControlHumidistat_Impl> impl) : ModelObject(std::move(impl)) {}
149 /// @endcond
150
151 } // namespace model
152 } // namespace openstudio
153