GCC Code Coverage Report


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

src/model/ScheduleDay_Impl.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_IMPL_HPP
7 #define MODEL_SCHEDULEDAY_IMPL_HPP
8
9 #include "ModelAPI.hpp"
10 #include "ScheduleBase_Impl.hpp"
11
12 #include "../utilities/time/Time.hpp"
13 #include "../utilities/data/TimeSeries.hpp"
14
15 namespace openstudio {
16
17 class TimeSeries;
18
19 namespace model {
20
21 class ScheduleTypeLimits;
22
23 namespace detail {
24
25 class Timestep_Impl;
26
27 /** ScheduleDay_Impl is a ResourceObject_Impl that is the implementation class for ScheduleDay.*/
28 class MODEL_API ScheduleDay_Impl : public ScheduleBase_Impl
29 {
30
31 public:
32 /** @name Constructors and Destructors */
33 //@{
34
35 ScheduleDay_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle);
36
37 ScheduleDay_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle);
38
39 ScheduleDay_Impl(const ScheduleDay_Impl& other, Model_Impl* model, bool keepHandle);
40
41 27723 virtual ~ScheduleDay_Impl() override = default;
42
43 //@}
44 /** @name Virtual Methods */
45 //@{
46
47 virtual std::vector<IdfObject> remove() override;
48
49 virtual boost::optional<ParentObject> parent() const override;
50
51 virtual bool setParent(ParentObject& newParent) override;
52
53 virtual const std::vector<std::string>& outputVariableNames() const override;
54
55 virtual IddObjectType iddObjectType() const override;
56
57 //@}
58 /** @name Getters */
59 //@{
60
61 virtual boost::optional<ScheduleTypeLimits> scheduleTypeLimits() const override;
62
63 bool isScheduleTypeLimitsDefaulted() const;
64
65 std::string interpolatetoTimestep() const;
66
67 bool isInterpolatetoTimestepDefaulted() const;
68
69 /// Returns a vector of times marking the end value intervals.
70 /// These times will be in order and have the same number of elements as values.
71 /// All times will be less than or equal to 1 day.
72 std::vector<openstudio::Time> times() const;
73
74 /// Returns a vector of values in the same order and with the same number of elements as times.
75 virtual std::vector<double> values() const override;
76
77 /// Returns the value in effect at the given time.
78 /// If time is less than 0 days or greater than 1 day, 0 is returned.
79 double getValue(const openstudio::Time& time) const;
80
81 /// Returns the timeseries corresponding to simulation timestep and chosen interpolation method.
82 openstudio::TimeSeries timeSeries() const;
83
84 //@}
85 /** @name Setters */
86 //@{
87
88 virtual bool setScheduleTypeLimits(const ScheduleTypeLimits& scheduleTypeLimits) override;
89
90 virtual bool resetScheduleTypeLimits() override;
91
92 bool setInterpolatetoTimestep(const std::string& interpolatetoTimestep);
93
94 void resetInterpolatetoTimestep();
95
96 /// Sets the given week schedule to be in effect until (inclusive) the date given starting the day after the
97 /// previous date marker or January 1st if no previous date marker exists.
98 /// Returns false if time is less than 0 days or greater than 1 day. Replaces existing value
99 /// for same time if it exists.
100 bool addValue(const openstudio::Time& untilTime, double value);
101
102 boost::optional<double> removeValue(const openstudio::Time& time);
103
104 /// Clear all values from this schedule.
105 void clearValues();
106
107 // ensure that this object does not contain the date 2/29
108 virtual void ensureNoLeapDays() override;
109
110 //@}
111 protected:
112 virtual bool candidateIsCompatibleWithCurrentUse(const ScheduleTypeLimits& candidate) const override;
113
114 virtual bool okToResetScheduleTypeLimits() const override;
115
116 friend class Timestep_Impl;
117 void clearCachedTimeSeries();
118
119 //private slots:
120 private:
121 void clearCachedVariables();
122
123 private:
124 − REGISTER_LOGGER("openstudio.model.ScheduleDay");
125
126 mutable boost::optional<std::vector<openstudio::Time>> m_cachedTimes;
127 mutable boost::optional<std::vector<double>> m_cachedValues;
128 mutable boost::optional<openstudio::TimeSeries> m_cachedTimeSeries;
129 };
130
131 } // namespace detail
132
133 } // namespace model
134 } // namespace openstudio
135
136 #endif // MODEL_SCHEDULEDAY_IMPL_HPP
137