GCC Code Coverage Report


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

src/model/ScheduleDay.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_SCHEDULEDAY_HPP
7 #define MODEL_SCHEDULEDAY_HPP
8
9 #include "ModelAPI.hpp"
10 #include "ScheduleBase.hpp"
11
12 namespace openstudio {
13
14 class Time;
15
16 namespace model {
17
18 class ScheduleTypeLimits;
19
20 namespace detail {
21
22 class ScheduleDay_Impl;
23
24 } // namespace detail
25
26 /** ScheduleDay is a ScheduleBase that wraps the OpenStudio IDD object 'OS_Schedule_Day'. */
27 class MODEL_API ScheduleDay : public ScheduleBase
28 {
29 public:
30 /** @name Constructors and Destructors */
31 //@{
32
33 /** Initializes the schedule to a value of 0.0 until 24:00. */
34 explicit ScheduleDay(const Model& model);
35
36 /** Initializes the schedule to value until 24:00. */
37 ScheduleDay(const Model& model, double value);
38
39 177299 virtual ~ScheduleDay() override = default;
40 // Default the copy and move operators because the virtual dtor is explicit
41 35953 ScheduleDay(const ScheduleDay& other) = default;
42 78561 ScheduleDay(ScheduleDay&& other) = default;
43 ✗ ScheduleDay& operator=(const ScheduleDay&) = default;
44 118 ScheduleDay& operator=(ScheduleDay&&) = default;
45
46 //@}
47
48 static IddObjectType iddObjectType();
49
50 /** @name Getters */
51 //@{
52
53 /** Returns true if this object does not specify a ScheduleTypeLimits directly, but rather
54 * inherits one from a Schedule. */
55 bool isScheduleTypeLimitsDefaulted() const;
56
57 std::string interpolatetoTimestep() const;
58
59 bool isInterpolatetoTimestepDefaulted() const;
60
61 /// Returns a vector of times marking the end value intervals.
62 /// These times will be in order and have the same number of elements as values.
63 /// All times will be less than or equal to 1 day.
64 std::vector<openstudio::Time> times() const;
65
66 /// Returns a vector of values in the same order and with the same number of elements as times.
67 std::vector<double> values() const;
68
69 /// Returns the value in effect at the given time.
70 /// If time is less than 0 days or greater than 1 day, 0 is returned.
71 double getValue(const openstudio::Time& time) const;
72
73 /// Returns the timeseries corresponding to simulation timestep and chosen interpolation method.
74 openstudio::TimeSeries timeSeries() const;
75
76 //@}
77 /** @name Setters */
78 //@{
79
80 bool setInterpolatetoTimestep(const std::string& interpolatetoTimestep);
81
82 void resetInterpolatetoTimestep();
83
84 /** Returns false if time is less than 0 days or greater than 1 day. Replaces existing value
85 * for same time. */
86 bool addValue(const openstudio::Time& untilTime, double value);
87
88 /** Remove a value added by addValue at the exact time. Returns the removed
89 * value if there was one. */
90 boost::optional<double> removeValue(const openstudio::Time& time);
91
92 /// Clear all values from this schedule.
93 void clearValues();
94
95 //@}
96 protected:
97 /// @cond
98 using ImplType = detail::ScheduleDay_Impl;
99
100 friend class Model;
101 friend class openstudio::IdfObject;
102 friend class openstudio::detail::IdfObject_Impl;
103 friend class detail::ScheduleDay_Impl;
104
105 explicit ScheduleDay(std::shared_ptr<detail::ScheduleDay_Impl> impl);
106
107 /// @endcond
108 private:
109 REGISTER_LOGGER("openstudio.model.ScheduleDay");
110 };
111
112 /** \relates ScheduleDay*/
113 using OptionalScheduleDay = boost::optional<ScheduleDay>;
114
115 /** \relates ScheduleDay*/
116 using ScheduleDayVector = std::vector<ScheduleDay>;
117
118 } // namespace model
119 } // namespace openstudio
120
121 #endif // MODEL_SCHEDULEDAY_HPP
122