src/model/YearDescription.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 "YearDescription.hpp" | ||
| 7 | #include "YearDescription_Impl.hpp" | ||
| 8 | #include "RunPeriod.hpp" | ||
| 9 | #include "RunPeriod_Impl.hpp" | ||
| 10 | #include "RunPeriodControlDaylightSavingTime.hpp" | ||
| 11 | #include "RunPeriodControlDaylightSavingTime_Impl.hpp" | ||
| 12 | #include "RunPeriodControlSpecialDays.hpp" | ||
| 13 | #include "RunPeriodControlSpecialDays_Impl.hpp" | ||
| 14 | #include "SizingPeriod.hpp" | ||
| 15 | #include "SizingPeriod_Impl.hpp" | ||
| 16 | #include "ScheduleBase.hpp" | ||
| 17 | #include "ScheduleBase_Impl.hpp" | ||
| 18 | #include "ScheduleRule.hpp" | ||
| 19 | #include "ScheduleRule_Impl.hpp" | ||
| 20 | #include "LightingDesignDay.hpp" | ||
| 21 | #include "LightingDesignDay_Impl.hpp" | ||
| 22 | #include "Model.hpp" | ||
| 23 | #include "Model_Impl.hpp" | ||
| 24 | |||
| 25 | #include <utilities/idd/IddFactory.hxx> | ||
| 26 | |||
| 27 | #include <utilities/idd/OS_YearDescription_FieldEnums.hxx> | ||
| 28 | #include <utilities/idd/IddEnums.hxx> | ||
| 29 | |||
| 30 | #include "../utilities/time/Date.hpp" | ||
| 31 | |||
| 32 | #include "../utilities/core/Assert.hpp" | ||
| 33 | |||
| 34 | namespace openstudio { | ||
| 35 | namespace model { | ||
| 36 | |||
| 37 | namespace detail { | ||
| 38 | |||
| 39 | 949 | YearDescription_Impl::YearDescription_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 40 | 949 | : ParentObject_Impl(idfObject, model, keepHandle) { | |
| 41 |
4/6✓ Branch 1 taken 949 times.
✓ Branch 4 taken 949 times.
✓ Branch 7 taken 949 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 949 times.
✗ Branch 13 not taken.
|
949 | OS_ASSERT(idfObject.iddObject().type() == YearDescription::iddObjectType()); |
| 42 | 949 | } | |
| 43 | |||
| 44 | 32 | YearDescription_Impl::YearDescription_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 45 | 32 | : ParentObject_Impl(other, model, keepHandle) { | |
| 46 |
4/6✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
✓ Branch 7 taken 32 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 32 times.
✗ Branch 13 not taken.
|
32 | OS_ASSERT(other.iddObject().type() == YearDescription::iddObjectType()); |
| 47 | 32 | } | |
| 48 | |||
| 49 | 57 | YearDescription_Impl::YearDescription_Impl(const YearDescription_Impl& other, Model_Impl* model, bool keepHandle) | |
| 50 | 57 | : ParentObject_Impl(other, model, keepHandle) {} | |
| 51 | |||
| 52 | ✗ | const std::vector<std::string>& YearDescription_Impl::outputVariableNames() const { | |
| 53 | ✗ | static const std::vector<std::string> result; | |
| 54 | ✗ | return result; | |
| 55 | } | ||
| 56 | |||
| 57 | 7 | IddObjectType YearDescription_Impl::iddObjectType() const { | |
| 58 | 7 | return YearDescription::iddObjectType(); | |
| 59 | } | ||
| 60 | |||
| 61 | ✗ | std::vector<ModelObject> YearDescription_Impl::children() const { | |
| 62 | ✗ | std::vector<ModelObject> result; | |
| 63 | ✗ | Model model = this->model(); | |
| 64 | |||
| 65 | ✗ | boost::optional<RunPeriodControlDaylightSavingTime> dst = model.getOptionalUniqueModelObject<RunPeriodControlDaylightSavingTime>(); | |
| 66 | ✗ | if (dst) { | |
| 67 | ✗ | result.push_back(*dst); | |
| 68 | } | ||
| 69 | |||
| 70 | ✗ | auto specialDays = model.getConcreteModelObjects<RunPeriodControlSpecialDays>(); | |
| 71 | ✗ | result.insert(result.end(), specialDays.begin(), specialDays.end()); | |
| 72 | |||
| 73 | ✗ | return result; | |
| 74 | ✗ | } | |
| 75 | |||
| 76 | ✗ | std::vector<IddObjectType> YearDescription_Impl::allowableChildTypes() const { | |
| 77 | return IddObjectTypeVector{ | ||
| 78 | ✗ | RunPeriodControlDaylightSavingTime::iddObjectType(), | |
| 79 | ✗ | RunPeriodControlSpecialDays::iddObjectType(), | |
| 80 | ✗ | }; | |
| 81 | } | ||
| 82 | |||
| 83 | 14667 | boost::optional<int> YearDescription_Impl::calendarYear() const { | |
| 84 | 14667 | return getInt(OS_YearDescriptionFields::CalendarYear, true); | |
| 85 | } | ||
| 86 | |||
| 87 | 3214 | std::string YearDescription_Impl::dayofWeekforStartDay() const { | |
| 88 | |||
| 89 |
1/1✓ Branch 1 taken 3214 times.
|
3214 | boost::optional<int> calendarYear = this->calendarYear(); |
| 90 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 3208 times.
|
3214 | if (calendarYear) { |
| 91 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | openstudio::Date jan1(MonthOfYear::Jan, 1, *calendarYear); |
| 92 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | std::string result = jan1.dayOfWeek().valueName(); |
| 93 | 6 | return result; | |
| 94 | 6 | } | |
| 95 | |||
| 96 |
1/1✓ Branch 1 taken 3208 times.
|
3208 | boost::optional<std::string> value = getString(OS_YearDescriptionFields::DayofWeekforStartDay, true); |
| 97 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3208 times.
✗ Branch 4 not taken.
|
3208 | OS_ASSERT(value); |
| 98 |
2/2✓ Branch 1 taken 3208 times.
✓ Branch 4 taken 3208 times.
|
3208 | return value.get(); |
| 99 | 3208 | } | |
| 100 | |||
| 101 | 6 | bool YearDescription_Impl::isDayofWeekforStartDayDefaulted() const { | |
| 102 | 6 | return isEmpty(OS_YearDescriptionFields::DayofWeekforStartDay); | |
| 103 | } | ||
| 104 | |||
| 105 | 3574 | bool YearDescription_Impl::isLeapYear() const { | |
| 106 | |||
| 107 |
1/1✓ Branch 1 taken 3574 times.
|
3574 | boost::optional<int> calendarYear = this->calendarYear(); |
| 108 |
2/2✓ Branch 0 taken 310 times.
✓ Branch 1 taken 3264 times.
|
3574 | if (calendarYear) { |
| 109 |
3/3✓ Branch 1 taken 310 times.
✓ Branch 4 taken 310 times.
✓ Branch 7 taken 310 times.
|
310 | openstudio::Date jan1(MonthOfYear::Jan, 1, *calendarYear); |
| 110 |
1/1✓ Branch 1 taken 310 times.
|
310 | bool result = jan1.isLeapYear(); |
| 111 | 310 | return result; | |
| 112 | } | ||
| 113 | |||
| 114 |
1/1✓ Branch 1 taken 3264 times.
|
3264 | boost::optional<std::string> value = getString(OS_YearDescriptionFields::IsLeapYear, true); |
| 115 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3264 times.
✗ Branch 4 not taken.
|
3264 | OS_ASSERT(value); |
| 116 |
3/3✓ Branch 1 taken 3264 times.
✓ Branch 4 taken 3264 times.
✓ Branch 7 taken 3264 times.
|
3264 | return openstudio::istringEqual(value.get(), "Yes"); |
| 117 | 3264 | } | |
| 118 | |||
| 119 | 6 | bool YearDescription_Impl::isIsLeapYearDefaulted() const { | |
| 120 | 6 | return isEmpty(OS_YearDescriptionFields::IsLeapYear); | |
| 121 | } | ||
| 122 | |||
| 123 | 89 | bool YearDescription_Impl::setCalendarYear(boost::optional<int> calendarYear) { | |
| 124 | 89 | bool wasLeapYear = this->isLeapYear(); | |
| 125 | |||
| 126 | 89 | bool result = false; | |
| 127 |
1/2✓ Branch 0 taken 89 times.
✗ Branch 1 not taken.
|
89 | if (calendarYear) { |
| 128 | 89 | result = setInt(OS_YearDescriptionFields::CalendarYear, calendarYear.get()); | |
| 129 | 89 | this->resetDayofWeekforStartDay(); | |
| 130 | 89 | this->resetIsLeapYear(); | |
| 131 | } else { | ||
| 132 | ✗ | result = setString(OS_YearDescriptionFields::CalendarYear, ""); | |
| 133 | } | ||
| 134 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 89 times.
|
89 | OS_ASSERT(result); |
| 135 | |||
| 136 | 89 | bool isLeapYear = this->isLeapYear(); | |
| 137 | // TODO: should really capture the output of updateModelLeapYear here... | ||
| 138 | 89 | updateModelLeapYear(wasLeapYear, isLeapYear); | |
| 139 | 89 | return result; | |
| 140 | } | ||
| 141 | |||
| 142 | 1 | void YearDescription_Impl::resetCalendarYear() { | |
| 143 | 1 | bool wasLeapYear = this->isLeapYear(); | |
| 144 | |||
| 145 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_YearDescriptionFields::CalendarYear, ""); |
| 146 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 147 | |||
| 148 | 1 | bool isLeapYear = this->isLeapYear(); | |
| 149 | 1 | updateModelLeapYear(wasLeapYear, isLeapYear); | |
| 150 | 1 | } | |
| 151 | |||
| 152 | 47 | bool YearDescription_Impl::setDayofWeekforStartDay(const std::string& dayofWeekforStartDay) { | |
| 153 | 47 | bool result = false; | |
| 154 |
3/3✓ Branch 1 taken 47 times.
✓ Branch 4 taken 46 times.
✓ Branch 5 taken 1 time.
|
47 | if (!this->calendarYear()) { |
| 155 | 46 | result = setString(OS_YearDescriptionFields::DayofWeekforStartDay, dayofWeekforStartDay); | |
| 156 | } | ||
| 157 | 47 | return result; | |
| 158 | } | ||
| 159 | |||
| 160 | 89 | void YearDescription_Impl::resetDayofWeekforStartDay() { | |
| 161 |
2/2✓ Branch 1 taken 89 times.
✓ Branch 4 taken 89 times.
|
178 | bool result = setString(OS_YearDescriptionFields::DayofWeekforStartDay, ""); |
| 162 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 89 times.
|
89 | OS_ASSERT(result); |
| 163 | 89 | } | |
| 164 | |||
| 165 | 2 | bool YearDescription_Impl::setIsLeapYear(bool isLeapYear) { | |
| 166 | 2 | bool result = false; | |
| 167 | 2 | bool wasLeapYear = this->isLeapYear(); | |
| 168 | |||
| 169 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 1 time.
✓ Branch 5 taken 1 time.
|
2 | if (!this->calendarYear()) { |
| 170 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (isLeapYear) { |
| 171 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
3 | result = setString(OS_YearDescriptionFields::IsLeapYear, "Yes"); |
| 172 | } else { | ||
| 173 | ✗ | result = setString(OS_YearDescriptionFields::IsLeapYear, "No"); | |
| 174 | } | ||
| 175 | } | ||
| 176 | |||
| 177 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
|
2 | if (result) { |
| 178 | 1 | updateModelLeapYear(wasLeapYear, isLeapYear); | |
| 179 | } | ||
| 180 | |||
| 181 | 2 | return result; | |
| 182 | } | ||
| 183 | |||
| 184 | 89 | void YearDescription_Impl::resetIsLeapYear() { | |
| 185 | 89 | bool wasLeapYear = this->isLeapYear(); | |
| 186 | |||
| 187 |
2/2✓ Branch 1 taken 89 times.
✓ Branch 4 taken 89 times.
|
178 | bool result = setString(OS_YearDescriptionFields::IsLeapYear, ""); |
| 188 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 89 times.
|
89 | OS_ASSERT(result); |
| 189 | |||
| 190 | 89 | bool isLeapYear = this->isLeapYear(); | |
| 191 | 89 | updateModelLeapYear(wasLeapYear, isLeapYear); | |
| 192 | 89 | } | |
| 193 | |||
| 194 | 3328 | int YearDescription_Impl::assumedYear() const { | |
| 195 |
1/1✓ Branch 1 taken 3328 times.
|
3328 | boost::optional<int> calendarYear = this->calendarYear(); |
| 196 |
2/2✓ Branch 0 taken 123 times.
✓ Branch 1 taken 3205 times.
|
3328 | if (calendarYear) { |
| 197 |
1/1✓ Branch 1 taken 123 times.
|
123 | return *calendarYear; |
| 198 | } | ||
| 199 | |||
| 200 |
1/1✓ Branch 1 taken 3205 times.
|
3205 | openstudio::YearDescription yd; |
| 201 | |||
| 202 |
1/1✓ Branch 1 taken 3205 times.
|
3205 | yd.isLeapYear = this->isLeapYear(); |
| 203 | |||
| 204 |
1/1✓ Branch 1 taken 3205 times.
|
3205 | std::string dayofWeekforStartDay = this->dayofWeekforStartDay(); |
| 205 |
1/2✓ Branch 1 taken 3205 times.
✗ Branch 2 not taken.
|
3205 | if (!dayofWeekforStartDay.empty()) { |
| 206 |
4/4✓ Branch 1 taken 3205 times.
✓ Branch 4 taken 3205 times.
✓ Branch 7 taken 3140 times.
✓ Branch 8 taken 65 times.
|
6410 | if (istringEqual(dayofWeekforStartDay, "UseWeatherFile")) { |
| 207 |
4/4✓ Branch 1 taken 3140 times.
✓ Branch 4 taken 3140 times.
✓ Branch 8 taken 209 times.
✓ Branch 9 taken 2931 times.
|
6280 | if (auto weatherFile_ = this->model().weatherFile()) { |
| 208 |
4/4✓ Branch 1 taken 209 times.
✓ Branch 4 taken 209 times.
✓ Branch 6 taken 1 time.
✓ Branch 7 taken 208 times.
|
418 | if (auto epwStartYear = weatherFile_->startDateActualYear()) { |
| 209 |
7/7✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
|
1 | LOG(Info, "YearDescription::assumedYear: using the WeatherFile startDateActualYear = " << epwStartYear.get()); |
| 210 |
1/1✓ Branch 1 taken 1 time.
|
1 | return epwStartYear.get(); |
| 211 |
4/4✓ Branch 1 taken 208 times.
✓ Branch 4 taken 208 times.
✓ Branch 6 taken 206 times.
✓ Branch 7 taken 2 times.
|
416 | } else if (boost::optional<openstudio::DayOfWeek> dow_ = weatherFile_->startDayOfWeek()) { |
| 212 |
1/1✓ Branch 1 taken 206 times.
|
206 | auto dow = dow_.get(); |
| 213 |
6/6✓ Branch 1 taken 206 times.
✓ Branch 4 taken 206 times.
✓ Branch 7 taken 206 times.
✓ Branch 10 taken 206 times.
✓ Branch 13 taken 206 times.
✓ Branch 16 taken 206 times.
|
206 | LOG(Info, "assumedYear: using the WeatherFile startDayOfWeek = " << dow); |
| 214 |
1/1✓ Branch 1 taken 206 times.
|
206 | yd.yearStartsOnDayOfWeek = dow; |
| 215 | } else { | ||
| 216 |
6/6✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
|
2 | LOG(Error, "'UseWeatherFile' is selected in YearDescription" |
| 217 | << " but the WeatherFile has neither an actual start year nor a Start Day of Week"); | ||
| 218 | 208 | } | |
| 219 | } else { | ||
| 220 |
5/5✓ Branch 1 taken 2931 times.
✓ Branch 4 taken 2931 times.
✓ Branch 7 taken 2931 times.
✓ Branch 10 taken 2931 times.
✓ Branch 13 taken 2931 times.
|
2931 | LOG(Error, "'UseWeatherFile' is selected in YearDescription, but there are no weather file set for the model."); |
| 221 | 3140 | } | |
| 222 | } else { | ||
| 223 |
1/1✓ Branch 1 taken 65 times.
|
65 | openstudio::DayOfWeek dow(dayofWeekforStartDay); |
| 224 |
1/1✓ Branch 1 taken 65 times.
|
65 | yd.yearStartsOnDayOfWeek = dow; |
| 225 | } | ||
| 226 | } | ||
| 227 | |||
| 228 |
1/1✓ Branch 1 taken 3204 times.
|
3204 | return yd.assumedYear(); |
| 229 | 3205 | } | |
| 230 | |||
| 231 | 3566 | openstudio::Date YearDescription_Impl::makeDate(openstudio::MonthOfYear monthOfYear, unsigned dayOfMonth) { | |
| 232 |
1/1✓ Branch 1 taken 3566 times.
|
3566 | boost::optional<int> year = this->calendarYear(); |
| 233 |
2/2✓ Branch 1 taken 3065 times.
✓ Branch 2 taken 501 times.
|
3566 | if (!year) { |
| 234 |
2/2✓ Branch 1 taken 3065 times.
✓ Branch 4 taken 3065 times.
|
3065 | year = this->assumedYear(); |
| 235 | } | ||
| 236 | |||
| 237 |
2/2✓ Branch 1 taken 3566 times.
✓ Branch 4 taken 3566 times.
|
7132 | return {monthOfYear, dayOfMonth, *year}; |
| 238 | } | ||
| 239 | |||
| 240 | 2156 | openstudio::Date YearDescription_Impl::makeDate(unsigned monthOfYear, unsigned dayOfMonth) { | |
| 241 |
2/2✓ Branch 1 taken 2156 times.
✓ Branch 4 taken 2156 times.
|
2156 | return makeDate(openstudio::MonthOfYear(monthOfYear), dayOfMonth); |
| 242 | } | ||
| 243 | |||
| 244 | 90 | openstudio::Date YearDescription_Impl::makeDate(openstudio::NthDayOfWeekInMonth n, openstudio::DayOfWeek dayOfWeek, | |
| 245 | openstudio::MonthOfYear monthOfYear) { | ||
| 246 |
1/1✓ Branch 1 taken 90 times.
|
90 | boost::optional<int> year = this->calendarYear(); |
| 247 |
2/2✓ Branch 1 taken 70 times.
✓ Branch 2 taken 20 times.
|
90 | if (!year) { |
| 248 |
2/2✓ Branch 1 taken 70 times.
✓ Branch 4 taken 70 times.
|
70 | year = this->assumedYear(); |
| 249 | } | ||
| 250 | |||
| 251 |
2/2✓ Branch 1 taken 90 times.
✓ Branch 4 taken 90 times.
|
180 | return openstudio::Date::fromNthDayOfMonth(n, dayOfWeek, monthOfYear, *year); |
| 252 | } | ||
| 253 | |||
| 254 | 730 | openstudio::Date YearDescription_Impl::makeDate(unsigned dayOfYear) { | |
| 255 |
1/1✓ Branch 1 taken 730 times.
|
730 | boost::optional<int> year = this->calendarYear(); |
| 256 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 730 times.
|
730 | if (!year) { |
| 257 | ✗ | year = this->assumedYear(); | |
| 258 | } | ||
| 259 | |||
| 260 |
2/2✓ Branch 1 taken 730 times.
✓ Branch 4 taken 730 times.
|
1460 | return openstudio::Date::fromDayOfYear(dayOfYear, *year); |
| 261 | } | ||
| 262 | |||
| 263 | 180 | void YearDescription_Impl::updateModelLeapYear(bool wasLeapYear, bool isLeapYear) { | |
| 264 |
2/2✓ Branch 0 taken 174 times.
✓ Branch 1 taken 6 times.
|
180 | if (wasLeapYear == isLeapYear) { |
| 265 | 178 | return; | |
| 266 | } | ||
| 267 | |||
| 268 |
3/4✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
6 | if (!wasLeapYear && isLeapYear) { |
| 269 | 4 | return; | |
| 270 | } | ||
| 271 | |||
| 272 |
1/1✓ Branch 1 taken 2 times.
|
2 | model::Model model = this->model(); |
| 273 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | if (wasLeapYear && !isLeapYear) { |
| 274 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
|
2 | for (RunPeriod& runPeriod : model.getConcreteModelObjects<RunPeriod>()) { |
| 275 | ✗ | runPeriod.ensureNoLeapDays(); | |
| 276 | 2 | } | |
| 277 | |||
| 278 | 2 | for (RunPeriodControlDaylightSavingTime& runPeriodControlDaylightSavingTime : | |
| 279 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
|
4 | model.getConcreteModelObjects<RunPeriodControlDaylightSavingTime>()) { |
| 280 | ✗ | runPeriodControlDaylightSavingTime.ensureNoLeapDays(); | |
| 281 | 2 | } | |
| 282 | |||
| 283 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
|
2 | for (RunPeriodControlSpecialDays& runPeriodControlSpecialDays : model.getConcreteModelObjects<RunPeriodControlSpecialDays>()) { |
| 284 | ✗ | runPeriodControlSpecialDays.ensureNoLeapDays(); | |
| 285 | 2 | } | |
| 286 | |||
| 287 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
|
2 | for (SizingPeriod& sizingPeriod : model.getModelObjects<SizingPeriod>()) { |
| 288 | ✗ | sizingPeriod.ensureNoLeapDays(); | |
| 289 | 2 | } | |
| 290 | |||
| 291 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
|
2 | for (ScheduleBase& scheduleBase : model.getModelObjects<ScheduleBase>()) { |
| 292 | ✗ | scheduleBase.ensureNoLeapDays(); | |
| 293 | 2 | } | |
| 294 | |||
| 295 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
|
2 | for (ScheduleRule& scheduleRule : model.getConcreteModelObjects<ScheduleRule>()) { |
| 296 | ✗ | scheduleRule.ensureNoLeapDays(); | |
| 297 | 2 | } | |
| 298 | |||
| 299 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
|
2 | for (LightingDesignDay& lightingDesignDay : model.getConcreteModelObjects<LightingDesignDay>()) { |
| 300 | ✗ | lightingDesignDay.ensureNoLeapDays(); | |
| 301 | 2 | } | |
| 302 | } | ||
| 303 | 2 | } | |
| 304 | |||
| 305 | } // namespace detail | ||
| 306 | |||
| 307 | 10633 | IddObjectType YearDescription::iddObjectType() { | |
| 308 |
1/1✓ Branch 1 taken 10633 times.
|
10633 | IddObjectType result(IddObjectType::OS_YearDescription); |
| 309 | 10633 | return result; | |
| 310 | } | ||
| 311 | |||
| 312 | ✗ | std::vector<std::string> YearDescription::validDayofWeekforStartDayValues() { | |
| 313 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_YearDescriptionFields::DayofWeekforStartDay); | |
| 314 | } | ||
| 315 | |||
| 316 | 116 | boost::optional<int> YearDescription::calendarYear() const { | |
| 317 |
1/1✓ Branch 3 taken 116 times.
|
116 | return getImpl<detail::YearDescription_Impl>()->calendarYear(); |
| 318 | } | ||
| 319 | |||
| 320 | 9 | std::string YearDescription::dayofWeekforStartDay() const { | |
| 321 |
1/1✓ Branch 3 taken 9 times.
|
9 | return getImpl<detail::YearDescription_Impl>()->dayofWeekforStartDay(); |
| 322 | } | ||
| 323 | |||
| 324 | 6 | bool YearDescription::isDayofWeekforStartDayDefaulted() const { | |
| 325 |
1/1✓ Branch 3 taken 6 times.
|
6 | return getImpl<detail::YearDescription_Impl>()->isDayofWeekforStartDayDefaulted(); |
| 326 | } | ||
| 327 | |||
| 328 | 9 | bool YearDescription::isLeapYear() const { | |
| 329 |
1/1✓ Branch 3 taken 9 times.
|
9 | return getImpl<detail::YearDescription_Impl>()->isLeapYear(); |
| 330 | } | ||
| 331 | |||
| 332 | 6 | bool YearDescription::isIsLeapYearDefaulted() const { | |
| 333 |
1/1✓ Branch 3 taken 6 times.
|
6 | return getImpl<detail::YearDescription_Impl>()->isIsLeapYearDefaulted(); |
| 334 | } | ||
| 335 | |||
| 336 | 89 | bool YearDescription::setCalendarYear(int calendarYear) { | |
| 337 |
2/2✓ Branch 3 taken 89 times.
✓ Branch 6 taken 89 times.
|
89 | return getImpl<detail::YearDescription_Impl>()->setCalendarYear(calendarYear); |
| 338 | } | ||
| 339 | |||
| 340 | 1 | void YearDescription::resetCalendarYear() { | |
| 341 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::YearDescription_Impl>()->resetCalendarYear(); |
| 342 | 1 | } | |
| 343 | |||
| 344 | 47 | bool YearDescription::setDayofWeekforStartDay(const std::string& dayofWeekforStartDay) { | |
| 345 |
1/1✓ Branch 3 taken 47 times.
|
47 | return getImpl<detail::YearDescription_Impl>()->setDayofWeekforStartDay(dayofWeekforStartDay); |
| 346 | } | ||
| 347 | |||
| 348 | ✗ | void YearDescription::resetDayofWeekforStartDay() { | |
| 349 | ✗ | getImpl<detail::YearDescription_Impl>()->resetDayofWeekforStartDay(); | |
| 350 | ✗ | } | |
| 351 | |||
| 352 | 2 | bool YearDescription::setIsLeapYear(bool isLeapYear) { | |
| 353 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::YearDescription_Impl>()->setIsLeapYear(isLeapYear); |
| 354 | } | ||
| 355 | |||
| 356 | ✗ | void YearDescription::resetIsLeapYear() { | |
| 357 | ✗ | getImpl<detail::YearDescription_Impl>()->resetIsLeapYear(); | |
| 358 | ✗ | } | |
| 359 | |||
| 360 | 193 | int YearDescription::assumedYear() const { | |
| 361 |
1/1✓ Branch 3 taken 193 times.
|
193 | return getImpl<detail::YearDescription_Impl>()->assumedYear(); |
| 362 | } | ||
| 363 | |||
| 364 | 1410 | openstudio::Date YearDescription::makeDate(openstudio::MonthOfYear monthOfYear, unsigned dayOfMonth) { | |
| 365 |
1/1✓ Branch 3 taken 1410 times.
|
1410 | return getImpl<detail::YearDescription_Impl>()->makeDate(monthOfYear, dayOfMonth); |
| 366 | } | ||
| 367 | |||
| 368 | 2156 | openstudio::Date YearDescription::makeDate(unsigned monthOfYear, unsigned dayOfMonth) { | |
| 369 |
1/1✓ Branch 3 taken 2156 times.
|
2156 | return getImpl<detail::YearDescription_Impl>()->makeDate(monthOfYear, dayOfMonth); |
| 370 | } | ||
| 371 | |||
| 372 | 90 | openstudio::Date YearDescription::makeDate(openstudio::NthDayOfWeekInMonth n, openstudio::DayOfWeek dayOfWeek, | |
| 373 | openstudio::MonthOfYear monthOfYear) { | ||
| 374 |
1/1✓ Branch 3 taken 90 times.
|
90 | return getImpl<detail::YearDescription_Impl>()->makeDate(n, dayOfWeek, monthOfYear); |
| 375 | } | ||
| 376 | |||
| 377 | 730 | openstudio::Date YearDescription::makeDate(unsigned dayOfYear) { | |
| 378 |
1/1✓ Branch 3 taken 730 times.
|
730 | return getImpl<detail::YearDescription_Impl>()->makeDate(dayOfYear); |
| 379 | } | ||
| 380 | |||
| 381 | /// @cond | ||
| 382 |
1/1✓ Branch 3 taken 167 times.
|
167 | YearDescription::YearDescription(std::shared_ptr<detail::YearDescription_Impl> impl) : ParentObject(std::move(impl)) {} |
| 383 | 917 | YearDescription::YearDescription(Model& model) : ParentObject(YearDescription::iddObjectType(), model) {} | |
| 384 | |||
| 385 | /// @endcond | ||
| 386 | |||
| 387 | } // namespace model | ||
| 388 | } // namespace openstudio | ||
| 389 |