GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 80.0% 4 / 1 / 6
Functions: 80.0% 4 / 1 / 6
Branches: -% 0 / 1 / 1

src/model/ShadingControl.hpp
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 #ifndef MODEL_SHADINGCONTROL_HPP
7 #define MODEL_SHADINGCONTROL_HPP
8
9 #include "ModelAPI.hpp"
10 #include "ResourceObject.hpp"
11
12 namespace openstudio {
13
14 namespace model {
15
16 class Construction;
17 class ShadingMaterial;
18 class Schedule;
19 class SubSurface;
20
21 namespace detail {
22
23 class ShadingControl_Impl;
24
25 } // namespace detail
26
27 /** ShadingControl is a ResourceObject that wraps the OpenStudio IDD object 'OS:ShadingControl'. */
28 class MODEL_API ShadingControl : public ResourceObject
29 {
30 public:
31 /** @name Constructors and Destructors */
32 //@{
33
34 /// Create a ShadingControl object which references the passed in construction for the shaded state.
35 /// This constructor should be used to model switchable glazing only at this time, other configurations
36 /// will not be supported by the Radiance ForwardTranslator. Note that changes to the construction made
37 /// after this constructor will not be reflected in this ShadingControl object. If changes to the construction
38 /// are made a new ShadingControl object should be constructed.
39 explicit ShadingControl(const Construction& construction);
40
41 /// Create a ShadingControl object which references the passed in material for the shading layer.
42 /// This constructor is preferred for all configurations other than switchable glazing.
43 explicit ShadingControl(const ShadingMaterial& shadingMaterial);
44
45 302 virtual ~ShadingControl() override = default;
46 // Default the copy and move operators because the virtual dtor is explicit
47 87 ShadingControl(const ShadingControl& other) = default;
48 57 ShadingControl(ShadingControl&& other) = default;
49 ✗ ShadingControl& operator=(const ShadingControl&) = default;
50 2 ShadingControl& operator=(ShadingControl&&) = default;
51
52 //@}
53
54 static IddObjectType iddObjectType();
55
56 static std::vector<std::string> shadingTypeValues();
57
58 static std::vector<std::string> shadingControlTypeValues();
59
60 static std::vector<std::string> typeofSlatAngleControlforBlindsValues();
61
62 static std::vector<std::string> multipleSurfaceControlTypeValues();
63
64 /** @name Getters */
65 //@{
66
67 std::string shadingType() const;
68
69 boost::optional<Construction> construction() const;
70
71 boost::optional<ShadingMaterial> shadingMaterial() const;
72
73 std::string shadingControlType() const;
74
75 bool isShadingControlTypeDefaulted() const;
76
77 boost::optional<Schedule> schedule() const;
78
79 boost::optional<double> setpoint() const;
80
81 bool isSetpointDefaulted()
82 const; // TODO: This makes little sense. Based on the shadingControlType, it's basically required. There's a default harcoded only for OnIfHighSolarOnWindow
83
84 bool glareControlIsActive() const;
85
86 std::string typeofSlatAngleControlforBlinds() const;
87
88 bool isTypeofSlatAngleControlforBlindsDefaulted() const;
89
90 boost::optional<Schedule> slatAngleSchedule() const;
91
92 boost::optional<double> setpoint2() const;
93
94 std::string multipleSurfaceControlType() const;
95
96 //@}
97 /** @name Setters */
98 //@{
99
100 // DLM: should this be removed?
101 /// Sets the shading type field. There is no error checking to ensure that shadingType is correct
102 /// given the shaded construction or shading material.
103 bool setShadingType(const std::string& shadingType);
104
105 bool setShadingControlType(const std::string& shadingControlType);
106
107 void resetShadingControlType();
108
109 bool setSchedule(const Schedule& schedule);
110
111 void resetSchedule();
112
113 bool setSetpoint(double setpoint);
114
115 void resetSetpoint(); // TODO: makes little sense like isSetpointDefaulted
116
117 bool setGlareControlIsActive(bool glareControlIsActive);
118
119 void resetGlareControlIsActive();
120
121 bool setTypeofSlatAngleControlforBlinds(const std::string& typeofSlatAngleControlforBlinds);
122
123 void resetTypeofSlatAngleControlforBlinds();
124
125 bool setSlatAngleSchedule(const Schedule& slatAngleSchedule);
126
127 void resetSlatAngleSchedule();
128
129 bool setSetpoint2(double setpoint2);
130
131 bool setMultipleSurfaceControlType(const std::string& multipleSurfaceControlType);
132
133 //@}
134 /** @name Other */
135 //@{
136
137 // Check if the current ShadingControlType requires Setpoint(1)
138 bool isControlTypeValueNeedingSetpoint1();
139 // Check if the current ShadingControlType requires Setpoint(2)
140 bool isControlTypeValueNeedingSetpoint2();
141
142 // Check if the current ShadingControlType allows a Schedule
143 bool isControlTypeValueAllowingSchedule();
144 // Check if the current ShadingControlType requires a Schedule
145 bool isControlTypeValueRequiringSchedule();
146
147 // Check if the current ShadingType allows a Slat Angle Control
148 bool isTypeValueAllowingSlatAngleControl();
149
150 // Extensible: Surfaces
151 std::vector<SubSurface> subSurfaces() const;
152 unsigned int numberofSubSurfaces() const;
153
154 /*
155 * Get the index of a given SubSurface (1-indexed)
156 */
157 boost::optional<unsigned> subSurfaceIndex(const SubSurface& subSurface) const;
158
159 /*
160 * Add a new SubSurface at the end of all of the existing SubSurfaces
161 */
162 bool addSubSurface(const SubSurface& subSurface);
163
164 /*
165 * Add a new SubSurface to the list which a given index (1 to x).
166 * Internally calls addSubSurface then setSubSurfaceIndex, see remarks there
167 */
168 bool addSubSurface(const SubSurface& subSurface, unsigned index);
169
170 /*
171 * You can shuffle the priority of a given SubSurface after having added it
172 * If index is below 1, it's reset to 1.
173 * If index is greater than the number of SubSurfaces, will reset to last
174 */
175 bool setSubSurfaceIndex(const SubSurface& subSurface, unsigned index);
176
177 /*
178 * Remove the given SubSurface from this object's subsurfaces
179 */
180 bool removeSubSurface(const SubSurface& subSurface);
181
182 /*
183 * Remove the SubSurface at the given index (1-indexed)
184 */
185 bool removeSubSurface(unsigned index);
186
187 // Bulk operations
188
189 /**
190 * Does not clear any subSurfaces already added, just calls calls addSubSurface for each
191 * It will return the global status, but will continue trying if there are problems
192 * (eg: if you make or a vector that has a subSurface from another model, the valid subSurfaces will be
193 * added indeed, but it'll eventually return false)
194 */
195
196 bool addSubSurfaces(const std::vector<SubSurface>& subSurfaces);
197
198 /*
199 * Set all SubSurfaces using a vector of SubSurface
200 * Internally calls removeAllSubSurfaces(), then addSubSurfaces
201 * It will return the global status, but will continue trying if there are problems
202 * (eg: if you make or a vector that has a subSurface from another model, the valid subSurface will be
203 * added indeed, but it'll eventually return false)
204 */
205 bool setSubSurfaces(const std::vector<SubSurface>& subSurfaces);
206
207 /*
208 * Removes all SubSurfaces in this object
209 */
210 void removeAllSubSurfaces();
211
212 //@}
213 protected:
214 /// @cond
215 using ImplType = detail::ShadingControl_Impl;
216
217 explicit ShadingControl(std::shared_ptr<detail::ShadingControl_Impl> impl);
218
219 friend class detail::ShadingControl_Impl;
220 friend class Model;
221 friend class IdfObject;
222 friend class openstudio::detail::IdfObject_Impl;
223
224 /// @endcond
225 private:
226 − REGISTER_LOGGER("openstudio.model.ShadingControl");
227 };
228
229 /** \relates ShadingControl*/
230 using OptionalShadingControl = boost::optional<ShadingControl>;
231
232 /** \relates ShadingControl*/
233 using ShadingControlVector = std::vector<ShadingControl>;
234
235 } // namespace model
236 } // namespace openstudio
237
238 #endif // MODEL_SHADINGCONTROL_HPP
239