-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to create Holiday Schedules in ScheduleRuleset #3814
Changes from all commits
e1fbcfd
3b7e1a9
f49a98e
f72e9fd
b1d10fd
9008d54
68a158f
164ed1f
86be7ef
3d8e5b8
251096b
eaddb10
82c4721
bbf6fbf
35dff59
d5ad350
c8668d5
0ae5947
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4742,12 +4742,7 @@ OS:Schedule:Rule, | |
\default No | ||
\key Yes | ||
\key No | ||
A12, \field Apply Holiday | ||
\type choice | ||
\default No | ||
\key Yes | ||
\key No | ||
A13, \field Date Specification Type | ||
A12, \field Date Specification Type | ||
\type choice | ||
\default DateRange | ||
\key DateRange | ||
|
@@ -4804,7 +4799,10 @@ OS:Schedule:Ruleset, | |
A5, \field Summer Design Day Schedule Name | ||
\type object-list | ||
\object-list DayScheduleNames | ||
A6; \field Winter Design Day Schedule Name | ||
A6, \field Winter Design Day Schedule Name | ||
\type object-list | ||
\object-list DayScheduleNames | ||
A7; \field Holiday Schedule Name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New field on Schedule:Ruleset |
||
\type object-list | ||
\object-list DayScheduleNames | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -499,6 +499,7 @@ Workspace ForwardTranslator::translateModelPrivate( model::Model & model, bool f | |
} | ||
|
||
|
||
// TODO: is it time to uncomment that? | ||
// temp code | ||
if (!m_keepRunControlSpecialDays){ | ||
// DLM: we will not translate these objects until we support holidays in the GUI | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's time to uncomment that. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ | |
|
||
#include <utilities/idd/OS_RunPeriodControl_SpecialDays_FieldEnums.hxx> | ||
#include <utilities/idd/IddEnums.hxx> | ||
#include <utilities/idd/IddFactory.hxx> | ||
|
||
#include "../utilities/time/Date.hpp" | ||
#include "../utilities/core/Assert.hpp" | ||
|
@@ -261,6 +262,15 @@ RunPeriodControlSpecialDays::RunPeriodControlSpecialDays(const openstudio::NthDa | |
Date test = this->startDate(); | ||
} | ||
|
||
std::vector<std::string> RunPeriodControlSpecialDays::specialDayTypeValues() { | ||
return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), | ||
OS_RunPeriodControl_SpecialDaysFields::SpecialDayType); | ||
} | ||
|
||
std::vector<std::string> RunPeriodControlSpecialDays::validSpecialDayTypeValues() { | ||
return specialDayTypeValues(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Somewhat unrelated, but I realized this didn't exist, so adding it (this object can be used to define new Special Day Type "Holiday", so it matters) |
||
} | ||
|
||
Date RunPeriodControlSpecialDays::startDate() const | ||
{ | ||
return getImpl<detail::RunPeriodControlSpecialDays_Impl>()->startDate(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,13 +199,6 @@ namespace detail { | |
OS_ASSERT(value); | ||
return openstudio::istringEqual(value.get(), "Yes"); | ||
} | ||
/* | ||
bool ScheduleRule_Impl::applyHoliday() const { | ||
boost::optional<std::string> value = getString(OS_Schedule_RuleFields::ApplyHoliday,true); | ||
OS_ASSERT(value); | ||
return openstudio::istringEqual(value.get(), "Yes"); | ||
} | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deleting all already-commented-out regarding Apply Holiday in Schedule:Rule now that the IDD doesn't bear the field => No API change |
||
|
||
std::string ScheduleRule_Impl::dateSpecificationType() const { | ||
boost::optional<std::string> value = getString(OS_Schedule_RuleFields::DateSpecificationType,true); | ||
|
@@ -347,49 +340,6 @@ namespace detail { | |
return result; | ||
} | ||
|
||
bool ScheduleRule_Impl::applyWeekdays() const { | ||
return (this->applyMonday() && this->applyTuesday() && this-applyWednesday() && this->applyThursday() && this->applyFriday()); | ||
} | ||
|
||
bool ScheduleRule_Impl::applyWeekends() const { | ||
return (this->applySaturday() && this->applySunday()); | ||
} | ||
|
||
bool ScheduleRule_Impl::applyAllDays() const { | ||
return (this->applyWeekdays() && this->applyWeekends()); | ||
} | ||
|
||
bool ScheduleRule_Impl::setApplyWeekdays(bool applyWeekdays) { | ||
return (this->setApplyMonday(applyWeekdays) && this->setApplyTuesday(applyWeekdays) && | ||
this-setApplyWednesday(applyWeekdays) && this->setApplyThursday(applyWeekdays) && this->setApplyFriday(applyWeekdays)); | ||
} | ||
|
||
bool ScheduleRule_Impl::setApplyWeekends(bool applyWeekends) { | ||
return (this->setApplySaturday(applyWeekends) && this->setApplySunday(applyWeekends)); | ||
} | ||
|
||
bool ScheduleRule_Impl::setApplyAllDays(bool applyAllDays) { | ||
return (this->setApplyWeekdays(applyAllDays) && this->setApplyWeekends(applyAllDays)); | ||
} | ||
|
||
/* | ||
bool ScheduleRule_Impl::setApplyHoliday(bool applyHoliday) { | ||
bool result = false; | ||
if (applyHoliday) { | ||
result = setString(OS_Schedule_RuleFields::ApplyHoliday, "Yes"); | ||
} else { | ||
result = setString(OS_Schedule_RuleFields::ApplyHoliday, "No"); | ||
} | ||
OS_ASSERT(result); | ||
return result; | ||
} | ||
|
||
bool ScheduleRule_Impl::setDateSpecificationType(std::string dateSpecificationType) { | ||
bool result = setString(OS_Schedule_RuleFields::DateSpecificationType, dateSpecificationType); | ||
return result; | ||
} | ||
*/ | ||
|
||
bool ScheduleRule_Impl::setStartDate(const openstudio::Date& date) { | ||
bool result = setString(OS_Schedule_RuleFields::DateSpecificationType, "DateRange"); | ||
OS_ASSERT(result); | ||
|
@@ -715,11 +665,6 @@ bool ScheduleRule::applyFriday() const { | |
bool ScheduleRule::applySaturday() const { | ||
return getImpl<detail::ScheduleRule_Impl>()->applySaturday(); | ||
} | ||
/* | ||
bool ScheduleRule::applyHoliday() const { | ||
return getImpl<detail::ScheduleRule_Impl>()->applyHoliday(); | ||
} | ||
*/ | ||
|
||
boost::optional<openstudio::Date> ScheduleRule::startDate() const | ||
{ | ||
|
@@ -807,47 +752,14 @@ void ScheduleRule::setApplySaturdayNoFail(bool applySaturday) { | |
OS_ASSERT(result); | ||
} | ||
|
||
bool ScheduleRule::applyWeekdays() const { | ||
return getImpl<detail::ScheduleRule_Impl>()->applyWeekdays(); | ||
} | ||
bool ScheduleRule::setApplyWeekdays(bool applyWeekdays) { | ||
return getImpl<detail::ScheduleRule_Impl>()->setApplyWeekdays(applyWeekdays); | ||
} | ||
|
||
bool ScheduleRule::applyWeekends() const { | ||
return getImpl<detail::ScheduleRule_Impl>()->applyWeekends(); | ||
} | ||
bool ScheduleRule::setApplyWeekends(bool applyWeekends) { | ||
return getImpl<detail::ScheduleRule_Impl>()->setApplyWeekends(applyWeekends); | ||
} | ||
|
||
bool ScheduleRule::applyAllDays() const { | ||
return getImpl<detail::ScheduleRule_Impl>()->applyAllDays(); | ||
} | ||
bool ScheduleRule::setApplyAllDays(bool applyAllDays) { | ||
return getImpl<detail::ScheduleRule_Impl>()->setApplyAllDays(applyAllDays); | ||
} | ||
|
||
/* | ||
bool ScheduleRule::setApplyHoliday(bool applyHoliday) { | ||
return getImpl<detail::ScheduleRule_Impl>()->setApplyHoliday(applyHoliday); | ||
} | ||
|
||
void ScheduleRule::setApplyHolidayNoFail(bool applyHoliday) { | ||
bool result = getImpl<detail::ScheduleRule_Impl>()->setApplyHoliday(applyHoliday); | ||
} | ||
*/ | ||
|
||
bool ScheduleRule::setStartDate(const openstudio::Date& date) { | ||
return getImpl<detail::ScheduleRule_Impl>()->setStartDate(date); | ||
} | ||
|
||
|
||
bool ScheduleRule::setEndDate(const openstudio::Date& date) { | ||
return getImpl<detail::ScheduleRule_Impl>()->setEndDate(date); | ||
} | ||
|
||
|
||
bool ScheduleRule::addSpecificDate(const openstudio::Date& date) { | ||
return getImpl<detail::ScheduleRule_Impl>()->addSpecificDate(date); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this (currently unused) field from
Schedule:Rule
. Handled in Version Translation.