GCC Code Coverage Report


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

src/airflow/contam/PrjSubobjects.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 AIRFLOW_CONTAM_PRJSUBOBJECTS_HPP
7 #define AIRFLOW_CONTAM_PRJSUBOBJECTS_HPP
8
9 #include "PrjDefines.hpp"
10 #include "PrjReader.hpp"
11 #include "../AirflowAPI.hpp"
12
13 namespace openstudio {
14 namespace contam {
15
16 class Reader;
17 namespace detail {
18 class WeatherDataImpl;
19 class IconImpl;
20 } // namespace detail
21
22 /** WeatherData objects contain the simplified weather data associated with a CONTAM model. */
23 class AIRFLOW_API WeatherData
24 {
25 public:
26 /** @name Constructors and Destructors */
27 //@{
28
29 /** Create a new object with default values */
30 WeatherData();
31 /** Create a new object */
32 WeatherData(std::string Tambt, std::string barpres, std::string windspd, std::string winddir, std::string relhum, int daytyp, int uTa, int ubP,
33 int uws, int uwd);
34 /** Create a new object */
35 WeatherData(double Tambt, double barpres, double windspd, double winddir, double relhum, int daytyp, int uTa, int ubP, int uws, int uwd);
36 /** Create a new object from another object */
37 WeatherData(const WeatherData& other);
38 /** Destroy the object */
39 16 ~WeatherData() = default;
40
41 //@}
42 /** @name Operators */
43 //@{
44
45 /** Copy operator */
46 WeatherData& operator=(const WeatherData& other);
47 /** Equality operator */
48 bool operator==(const WeatherData& other) const;
49 /** Inequality operator */
50 bool operator!=(const WeatherData& other) const;
51
52 //@}
53 /** @name Input and Output */
54 //@{
55
56 /** Read an object from a Reader */
57 void read(Reader& input);
58 /** Write the object to a string */
59 std::string write();
60
61 //@}
62 /** @name Getters and Setters */
63 //@{
64
65 /** Returns the ambient temperature [K] */
66 double Tambt() const;
67 /** Sets the ambient temperature [K] */
68 bool setTambt(const double Tambt);
69 /** Sets the ambient temperature [K] */
70 bool setTambt(const std::string& Tambt);
71 /** Returns the barometric pressure [Pa] NOT corrected to sea level */
72 double barpres() const;
73 /** Sets the barometric pressure [Pa] NOT corrected to sea level */
74 bool setBarpres(const double barpres);
75 /** Sets the barometric pressure [Pa] NOT corrected to sea level */
76 bool setBarpres(const std::string& barpres);
77 /** Returns the wind speed [m/s] */
78 double windspd() const;
79 /** Sets the wind speed [m/s] */
80 bool setWindspd(const double windspd);
81 /** Sets the wind speed [m/s] */
82 bool setWindspd(const std::string& windspd);
83 /** Returns the wind direction: 0 = N, 90 = E, 180 = S, ... */
84 double winddir() const;
85 /** Sets the wind direction: 0 = N, 90 = E, 180 = S, ... */
86 bool setWinddir(const double winddir);
87 /** Sets the wind direction: 0 = N, 90 = E, 180 = S, ... */
88 bool setWinddir(const std::string& winddir);
89 /** Returns the relative humidity: 0.0 to 1.0 */
90 double relhum() const;
91 /** Sets the relative humidity: 0.0 to 1.0 */
92 bool setRelhum(const double relhum);
93 /** Sets the relative humidity: 0.0 to 1.0 */
94 bool setRelhum(const std::string& relhum);
95 /** Returns the type of day (1-12) */
96 int daytyp() const;
97 /** Sets the type of day (1-12) */
98 void setDaytyp(const int daytyp);
99 /** Returns the units for Tambt */
100 int uTa() const;
101 /** Sets the units for Tambt */
102 void setUTa(const int uTa);
103 /** Returns the units for barometric pressure */
104 int ubP() const;
105 /** Sets the units for barometric pressure */
106 void setUbP(const int ubP);
107 /** Returns the units for wind speed */
108 int uws() const;
109 /** Sets the units for wind speed */
110 void setUws(const int uws);
111 /** Returns the units for wind direction */
112 int uwd() const;
113 /** Sets the units for wind speed */
114 void setUwd(const int uwd);
115 //@}
116
117 private:
118 std::shared_ptr<detail::WeatherDataImpl> m_impl;
119 };
120
121 /** The Icon object contains basic information about sketchpad icons. This object
122 * is not strictly necessary for creating CONTAM models, but is needed to read
123 * models created in ContamW. */
124 class AIRFLOW_API Icon
125 {
126 public:
127 /** @name Constructors and Destructors */
128 //@{
129
130 /** Create a new object with default values. */
131 Icon();
132 /** Create a new object. */
133 Icon(int icon, int col, int row, int nr);
134 /** Create a new object from another object. */
135 Icon(const Icon& other);
136 /** Destroy the object. */
137 ✗ ~Icon() = default;
138
139 //@}
140 /** @name Operators */
141 //@{
142
143 /** Copy operator */
144 Icon& operator=(const Icon& other);
145 /** Equality operator */
146 bool operator==(const Icon& other) const;
147 /** Inequality operator */
148 bool operator!=(const Icon& other) const;
149
150 //@}
151 /** @name Input and Output */
152 //@{
153
154 /** Read an object from a Reader. */
155 void read(Reader& input);
156 /** Write the object to a string. */
157 std::string write();
158
159 //@}
160 /** @name Getters and Setters */
161 //@{
162
163 /** Returns the icon type - see 'special symbols' in contam.h. */
164 int icon() const;
165 /** Sets the icon type - see 'special symbols' in contam.h. */
166 void setIcon(const int icon);
167 /** Returns the icon's column position on the SketchPad. */
168 int col() const;
169 /** Sets the icon's column position on the SketchPad. */
170 void setCol(const int col);
171 /** Returns the icon's row position on the SketchPad. */
172 int row() const;
173 /** Sets the icon's row position on the SketchPad. */
174 void setRow(const int row);
175 /** Returns the icon's zone, path, duct, etc., number. */
176 int nr() const;
177 /** Sets the icon's zone, path, duct, etc., number. */
178 void setNr(const int nr);
179
180 //@}
181 /** @name Miscellaneous Functions */
182 //@{
183
184 /** Returns true if the icon is a wall icon. */
185 bool isWall();
186
187 //@}
188
189 private:
190 std::shared_ptr<detail::IconImpl> m_impl;
191 };
192
193 /** FanDataPoint is an object for defining fan characteristics. It contains a single
194 * pressure and flow rate data point. */
195 class AIRFLOW_API FanDataPoint
196 {
197 public:
198 /** @name Constructors */
199 //@{
200 /** Create a new object with default values. */
201 FanDataPoint();
202 /** Create a new object. */
203 FanDataPoint(double mF, int u_mF, double dP, int u_dP, double rP, int u_rP);
204 /** Create a new object. */
205 FanDataPoint(std::string mF, int u_mF, std::string dP, int u_dP, std::string rP, int u_rP);
206
207 //@}
208 /** @name Input and Output */
209 //@{
210
211 /** Read an object from a Reader. */
212 void read(Reader& reader);
213 /** Write the object to a string. */
214 std::string write();
215
216 //@}
217 /** @name Getters and Setters */
218 //@{
219
220 /** Returns the measured flow rate [kg/s]. */
221 double mF() const;
222 /** Sets the measured flow rate [kg/s]. */
223 bool setMF(const double mF);
224 /** Sets the measured flow rate [kg/s]. */
225 bool setMF(const std::string& mF);
226 /** Returns the measured flow rate display units. */
227 int u_mF() const;
228 /** Sets the measured flow rate display units. */
229 void setU_mF(const int u_mF);
230 /** Returns the measured pressure rise [Pa]. */
231 double dP() const;
232 /** Sets the measured pressure rise [Pa]. */
233 bool setDP(const double dP);
234 /** Sets the measured pressure rise [Pa]. */
235 bool setDP(const std::string& dP);
236 /** Returns the measured pressure rise display units. */
237 int u_dP() const;
238 /** Sets the measured pressure rise display units. */
239 void setU_dP(const int u_dP);
240 /** Returns the revised pressure rise [Pa]. */
241 double rP() const;
242 /** Sets the revised pressure rise [Pa]. */
243 bool setRP(const double rP);
244 /** Sets the revised pressure rise [Pa]. */
245 bool setRP(const std::string& rP);
246 /** Returns the revised pressure rise display units. */
247 int u_rP() const;
248 /** Sets the revised pressure rise display units. */
249 void setU_rP(const int u_rP);
250 //@}
251 private:
252 void setDefaults();
253
254 PRJFLOAT m_mF; // measured flow rates [kg/s] (R4) {W}
255 int m_u_mF; // units of measured flows (I2) {W}
256 PRJFLOAT m_dP; // measured pressure rises [Pa] (R4) {W}
257 int m_u_dP; // units of pressure rises (I2) {W}
258 PRJFLOAT m_rP; // revised pressure rises [Pa] (R4) {W}
259 int m_u_rP; // units of revised pressures (I2) {W}
260 };
261
262 /** The XyDataPoint object is used by a number of the airflow element objects to
263 * store data specific to the element. */
264 class AIRFLOW_API XyDataPoint
265 {
266 public:
267 /** @name Constructors */
268 //@{
269
270 /** Create a new object with default values. */
271 XyDataPoint();
272 /** Create a new object. */
273 XyDataPoint(double x, double y);
274 /** Create a new object. */
275 XyDataPoint(std::string x, std::string y);
276
277 //@}
278 /** @name Input and Output */
279 //@{
280
281 /** Read an object from a Reader. */
282 void read(Reader& reader);
283 /** Write the object to a string. */
284 std::string write();
285
286 //@}
287 /** @name Getters and Setters */
288 //@{
289
290 /** Returns the value of independent variable. */
291 double x() const;
292 /** Sets the value of independent variable. */
293 bool setX(const double x);
294 /** Sets the value of independent variable. */
295 bool setX(const std::string& x);
296 /** Returns the value of dependent variable. */
297 double y() const;
298 /** Sets the value of dependent variable. */
299 bool setY(const double y);
300 /** Sets the value of dependent variable. */
301 bool setY(const std::string& y);
302 //@}
303 private:
304 void setDefaults();
305
306 PRJFLOAT m_x; // value of independent variable (R4)
307 PRJFLOAT m_y; // value of dependent variable (R4)
308 };
309
310 /** The AirflowSubelementData object stores specific details for an
311 * airflow element that is part of a super element. */
312 class AIRFLOW_API AirflowSubelementData
313 {
314 public:
315 /** @name Constructors */
316 //@{
317
318 /** Create a new object with default values. */
319 AirflowSubelementData();
320 /** Create a new object. */
321 AirflowSubelementData(int nr, double relHt, int filt);
322 /** Create a new object. */
323 AirflowSubelementData(int nr, std::string relHt, int filt);
324
325 //@}
326 /** @name Input and Output */
327 //@{
328
329 /** Read an object from a Reader. */
330 void read(Reader& reader);
331 /** Write the object to a string. */
332 std::string write();
333
334 //@}
335 /** @name Getters and Setters */
336 //@{
337
338 /** Returns the sub-element number. */
339 int nr() const;
340 /** Sets the sub-element number. */
341 void setNr(const int nr);
342 /** Returns the relative height of the sub-element. */
343 double relHt() const;
344 /** Sets the relative height of the sub-element. */
345 bool setRelHt(const double relHt);
346 /** Sets the relative height of the sub-element. */
347 bool setRelHt(const std::string& relHt);
348 /** Returns the filtering flag: (1=filtered, 0=not). */
349 int filt() const;
350 /** Sets the filtering flag (1=filtered, 0=not). */
351 void setFilt(const int filt);
352 //@}
353 private:
354 void setDefaults();
355
356 int m_nr; // sub-element number (IX)
357 PRJFLOAT m_relHt; // relative height of sub-element (R4)
358 int m_filt; // 1= filtered, 0= not (I2)
359 };
360
361 /** The PressureCoefficientPoint object contains a single wind pressure coefficient
362 * data point. The azimuthal angle is stored in degrees from north with the
363 * corresponding pressure coefficient. */
364 class AIRFLOW_API PressureCoefficientPoint
365 {
366 public:
367 /** @name Constructors */
368 //@{
369
370 /** Create a new object with default values. */
371 PressureCoefficientPoint();
372 /** Create a new object. */
373 PressureCoefficientPoint(double azm, double coef);
374 /** Create a new object. */
375 PressureCoefficientPoint(std::string azm, std::string coef);
376
377 //@}
378 /** @name Input and Output */
379 //@{
380
381 /** Read an object from a Reader. */
382 void read(Reader& reader);
383 /** Write the object to a string. */
384 std::string write();
385
386 //@}
387 /** @name Getters and Setters */
388 //@{
389
390 /** Returns the wind azimuth value [degrees]. */
391 double azm() const;
392 /** Sets the wind azimuth value [degrees]. */
393 bool setAzm(const double azm);
394 /** Sets the wind azimuth value [degrees]. */
395 bool setAzm(const std::string& azm);
396 /** Returns the normalized wind pressure coefficient. */
397 double coef() const;
398 /** Sets the normalized wind pressure coefficient. */
399 bool setCoef(const double coef);
400 /** Sets the normalized wind pressure coefficient. */
401 bool setCoef(const std::string& coef);
402 //@}
403 private:
404 void setDefaults();
405
406 PRJFLOAT m_azm; // wind azimuth value {R4} [degrees]
407 PRJFLOAT m_coef; // normalized wind pressure coefficients {R4} [-]
408 };
409
410 /** SchedulePoint stores the time (in hh:mm:ss format) and control value for
411 * a day schedule data point. */
412 class AIRFLOW_API SchedulePoint
413 {
414 public:
415 /** @name Constructors */
416 //@{
417
418 /** Create a new object with default values. */
419 SchedulePoint();
420 /** Create a new object. */
421 SchedulePoint(std::string time, double ctrl);
422 /** Create a new object. */
423 SchedulePoint(std::string time, std::string ctrl);
424
425 //@}
426 /** @name Input and Output */
427 //@{
428
429 /** Read an object from a Reader. */
430 void read(Reader& reader);
431 /** Write the object to a string. */
432 std::string write();
433
434 //@}
435 /** @name Getters and Setters */
436 //@{
437
438 /** Returns the time-of-day (hh:mm:ss). */
439 std::string time() const;
440 /** Sets the time-of-day (hh:mm:ss). */
441 void setTime(const std::string& time);
442 /** Returns the control value. */
443 double ctrl() const;
444 /** Sets the control value. */
445 bool setCtrl(const double ctrl);
446 /** Sets the control value. */
447 bool setCtrl(const std::string& ctrl);
448 //@}
449 private:
450 void setDefaults();
451
452 std::string m_time; // time-of-day [s] (hh:mm:ss)
453 PRJFLOAT m_ctrl; // corresponding control value (R4) [-]
454 };
455
456 } // namespace contam
457 } // namespace openstudio
458
459 #endif // AIRFLOW_CONTAM_PRJSUBOBJECTS_HPP
460