| 192 | } |
| 193 | |
| 194 | int YearDescription_Impl::assumedYear() const { |
| 195 | boost::optional<int> calendarYear = this->calendarYear(); |
| 196 | if (calendarYear) { |
| 197 | return *calendarYear; |
| 198 | } |
| 199 | |
| 200 | openstudio::YearDescription yd; |
| 201 | |
| 202 | yd.isLeapYear = this->isLeapYear(); |
| 203 | |
| 204 | std::string dayofWeekforStartDay = this->dayofWeekforStartDay(); |
| 205 | if (!dayofWeekforStartDay.empty()) { |
| 206 | if (istringEqual(dayofWeekforStartDay, "UseWeatherFile")) { |
| 207 | if (auto weatherFile_ = this->model().weatherFile()) { |
| 208 | if (auto epwStartYear = weatherFile_->startDateActualYear()) { |
| 209 | LOG(Info, "YearDescription::assumedYear: using the WeatherFile startDateActualYear = " << epwStartYear.get()); |
| 210 | return epwStartYear.get(); |
| 211 | } else if (boost::optional<openstudio::DayOfWeek> dow_ = weatherFile_->startDayOfWeek()) { |
| 212 | auto dow = dow_.get(); |
| 213 | LOG(Info, "assumedYear: using the WeatherFile startDayOfWeek = " << dow); |
| 214 | yd.yearStartsOnDayOfWeek = dow; |
| 215 | } else { |
| 216 | LOG(Error, "'UseWeatherFile' is selected in YearDescription" |
| 217 | << " but the WeatherFile has neither an actual start year nor a Start Day of Week"); |
| 218 | } |
| 219 | } else { |
| 220 | LOG(Error, "'UseWeatherFile' is selected in YearDescription, but there are no weather file set for the model."); |
| 221 | } |
| 222 | } else { |
| 223 | openstudio::DayOfWeek dow(dayofWeekforStartDay); |
| 224 | yd.yearStartsOnDayOfWeek = dow; |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | return yd.assumedYear(); |
| 229 | } |
| 230 | |
| 231 | openstudio::Date YearDescription_Impl::makeDate(openstudio::MonthOfYear monthOfYear, unsigned dayOfMonth) { |
| 232 | boost::optional<int> year = this->calendarYear(); |
no test coverage detected