From b72baf630d4fd49b4ee53bdb62a7cbf2b55ef633 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 11:37:24 +0100 Subject: [PATCH 1/7] Track companion branch 3783_ScheduleHolidays on NREL/OpenStudio --- openstudio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openstudio b/openstudio index 51a8b9428..b1d10fda0 160000 --- a/openstudio +++ b/openstudio @@ -1 +1 @@ -Subproject commit 51a8b94284e0ae6b10778379405aed7e5edb861a +Subproject commit b1d10fda081d31d38ae3dd67db244353ad3e199e From 4ef1955e3f8a60c67cd0700346a0b22a7bb41043 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 11:56:41 +0100 Subject: [PATCH 2/7] Implement the new ScheduleRuleset Holiday Special day in OS App (+ rename a few things since it's no longer sizing day specific) --- src/openstudio_lib/SchedulesTabController.cpp | 28 ++++ src/openstudio_lib/SchedulesTabController.hpp | 2 + src/openstudio_lib/SchedulesView.cpp | 127 +++++++++++++++--- src/openstudio_lib/SchedulesView.hpp | 26 ++-- 4 files changed, 158 insertions(+), 25 deletions(-) diff --git a/src/openstudio_lib/SchedulesTabController.cpp b/src/openstudio_lib/SchedulesTabController.cpp index 4bc3ff3c8..999ec9ec4 100644 --- a/src/openstudio_lib/SchedulesTabController.cpp +++ b/src/openstudio_lib/SchedulesTabController.cpp @@ -205,6 +205,34 @@ void SchedulesTabController::addWinterProfile(model::ScheduleRuleset & scheduleR } } +void SchedulesTabController::addHolidayProfile(model::ScheduleRuleset & scheduleRuleset, UUID scheduleDayHandle) +{ + boost::optional scheduleDay; + if (!scheduleDayHandle.isNull()){ + boost::optional scheduleDayToCopy = scheduleRuleset.model().getModelObject(scheduleDayHandle); + if (scheduleDayToCopy){ + scheduleDay = scheduleDayToCopy->clone().cast(); + } + } + if (!scheduleDay){ + scheduleDay = model::ScheduleDay(scheduleRuleset.model()); + boost::optional limits = scheduleRuleset.scheduleTypeLimits(); + if (limits) { + scheduleDay->setScheduleTypeLimits(*limits); + } + scheduleDay->addValue(Time(1, 0), defaultStartingValue(*scheduleDay)); + } + OS_ASSERT(scheduleDay); + + scheduleRuleset.setHolidaySchedule(*scheduleDay); + + scheduleDay->remove(); + + if (qobject_cast(m_currentView)) { + (qobject_cast(m_currentView))->showHolidayScheduleDay(scheduleRuleset); + } +} + void SchedulesTabController::onDayScheduleSceneChanged( DayScheduleScene * scene, double lowerLimitValue, double upperLimitValue ) { std::vector segments = scene->segments(); diff --git a/src/openstudio_lib/SchedulesTabController.hpp b/src/openstudio_lib/SchedulesTabController.hpp index 44c4d1bda..1a9cfe815 100644 --- a/src/openstudio_lib/SchedulesTabController.hpp +++ b/src/openstudio_lib/SchedulesTabController.hpp @@ -119,6 +119,8 @@ class SchedulesTabController : public MainTabController void addWinterProfile(model::ScheduleRuleset & scheduleRuleset, UUID scheduleDayHandle); + void addHolidayProfile(model::ScheduleRuleset & scheduleRuleset, UUID scheduleDayHandle); + void removeScheduleRule(model::ScheduleRule & scheduleRule); void onDayScheduleSceneChanged(DayScheduleScene * scene, double lowerLimitValue, double upperLimitValue); diff --git a/src/openstudio_lib/SchedulesView.cpp b/src/openstudio_lib/SchedulesView.cpp index ef9a1357f..c2575818c 100644 --- a/src/openstudio_lib/SchedulesView.cpp +++ b/src/openstudio_lib/SchedulesView.cpp @@ -524,9 +524,9 @@ void SchedulesView::showSummerScheduleDay(model::ScheduleRuleset schedule) if (!schedule.isSummerDesignDayScheduleDefaulted()) { - auto scheduleView = new SizingScheduleDayView(m_isIP, schedule, this, SizingScheduleDayView::SUMMER); + auto scheduleView = new SpecialScheduleDayView(m_isIP, schedule, this, SpecialScheduleDayView::SUMMER); - connect(this, &SchedulesView::toggleUnitsClicked, scheduleView, &SizingScheduleDayView::toggleUnitsClicked); + connect(this, &SchedulesView::toggleUnitsClicked, scheduleView, &SpecialScheduleDayView::toggleUnitsClicked); m_contentLayout->addWidget(scheduleView); @@ -560,9 +560,9 @@ void SchedulesView::showWinterScheduleDay(model::ScheduleRuleset schedule) if (!schedule.isWinterDesignDayScheduleDefaulted()) { - auto scheduleView = new SizingScheduleDayView(m_isIP, schedule, this, SizingScheduleDayView::WINTER); + auto scheduleView = new SpecialScheduleDayView(m_isIP, schedule, this, SpecialScheduleDayView::WINTER); - connect(this, &SchedulesView::toggleUnitsClicked, scheduleView, &SizingScheduleDayView::toggleUnitsClicked); + connect(this, &SchedulesView::toggleUnitsClicked, scheduleView, &SpecialScheduleDayView::toggleUnitsClicked); m_contentLayout->addWidget(scheduleView); @@ -582,6 +582,42 @@ void SchedulesView::showWinterScheduleDay(model::ScheduleRuleset schedule) setUpdatesEnabled(true); } +void SchedulesView::showHolidayScheduleDay(model::ScheduleRuleset schedule) +{ + setUpdatesEnabled(false); + + QLayoutItem *child; + while ((child = m_contentLayout->takeAt(0)) != nullptr) + { + delete child->widget(); + + delete child; + } + + if (!schedule.isHolidayScheduleDefaulted()) + { + auto scheduleView = new SpecialScheduleDayView(m_isIP, schedule, this, SpecialScheduleDayView::HOLIDAY); + + connect(this, &SchedulesView::toggleUnitsClicked, scheduleView, &SpecialScheduleDayView::toggleUnitsClicked); + + m_contentLayout->addWidget(scheduleView); + + scheduleView->show(); + + boost::optional mo = schedule.holidaySchedule(); + emit modelObjectSelected(mo, true); + } else { + auto newProfileView = new NewProfileView(schedule, this, NewProfileView::HOLIDAY); + + m_contentLayout->addWidget(newProfileView, 100); + + boost::optional mo; + emit modelObjectSelected(mo, true); + } + + setUpdatesEnabled(true); +} + void SchedulesView::showEmptyPage() { this->setUpdatesEnabled(false); @@ -944,8 +980,8 @@ ScheduleTabContent::ScheduleTabContent(ScheduleTab * scheduleTab, QWidget * pare mainVLayout->setSpacing(5); setLayout(mainVLayout); - QLabel * designDayLabel = new QLabel("Design Day Profiles"); - mainVLayout->addWidget(designDayLabel); + QLabel * specialDayLabel = new QLabel("Special Day Profiles"); + mainVLayout->addWidget(specialDayLabel); auto summerDesignDayLayout = new QHBoxLayout(); summerDesignDayLayout->setContentsMargins(0, 0, 0, 0); @@ -961,6 +997,13 @@ ScheduleTabContent::ScheduleTabContent(ScheduleTab * scheduleTab, QWidget * pare auto winterTab = new ScheduleTabDefault(m_scheduleTab, ScheduleTabDefault::WINTER); winterDesignDayLayout->addWidget(winterTab); + auto holidayLayout = new QHBoxLayout(); + holidayLayout->setContentsMargins(0, 0, 0, 0); + mainVLayout->addLayout(holidayLayout); + + auto holidayTab = new ScheduleTabDefault(m_scheduleTab, ScheduleTabDefault::HOLIDAY); + holidayLayout->addWidget(holidayTab); + auto runPeriodLayout = new QHBoxLayout(); runPeriodLayout->setContentsMargins(0, 0, 0, 0); mainVLayout->addLayout(runPeriodLayout); @@ -1204,9 +1247,11 @@ ScheduleTabDefault::ScheduleTabDefault(ScheduleTab * scheduleTab, ScheduleTabDef connect(this, &ScheduleTabDefault::defaultClicked, m_scheduleTab->schedulesView(), &SchedulesView::showDefaultScheduleDay); + connect(this, &ScheduleTabDefault::summerClicked, m_scheduleTab->schedulesView(), &SchedulesView::showSummerScheduleDay); + connect(this, &ScheduleTabDefault::winterClicked, m_scheduleTab->schedulesView(), &SchedulesView::showWinterScheduleDay); - connect(this, &ScheduleTabDefault::summerClicked, m_scheduleTab->schedulesView(), &SchedulesView::showSummerScheduleDay); + connect(this, &ScheduleTabDefault::holidayClicked, m_scheduleTab->schedulesView(), &SchedulesView::showHolidayScheduleDay); auto mainHLayout = new QHBoxLayout(); mainHLayout->setContentsMargins(10, 0, 0, 0); @@ -1217,13 +1262,17 @@ ScheduleTabDefault::ScheduleTabDefault(ScheduleTab * scheduleTab, ScheduleTabDef switch (m_type) { case SUMMER: - m_label = new QLabel("Summer"); + m_label = new QLabel("Summer Design Day"); setToolTip("Click to edit summer design day profile"); break; case WINTER: - m_label = new QLabel("Winter"); + m_label = new QLabel("Winter Design Day"); setToolTip("Click to edit winter design day profile"); break; + case HOLIDAY: + m_label = new QLabel("Holiday"); + setToolTip("Click to edit holiday profile"); + break; default: m_label = new QLabel("Default"); setToolTip("Click to edit default profile"); @@ -1253,7 +1302,7 @@ void ScheduleTabDefault::paintEvent(QPaintEvent * event) p.setPen(Qt::SolidLine); - // DLM: don't draw color squares for summer and winter design days + // DLM: don't draw color squares for special days (winter/summer design days and Holiday) if (m_type == DEFAULT) { p.setBrush(QBrush(m_scheduleTab->schedulesView()->colors[12])); @@ -1284,6 +1333,9 @@ void ScheduleTabDefault::mouseReleaseEvent(QMouseEvent * event) case WINTER: emit winterClicked(schedule); break; + case HOLIDAY: + emit holidayClicked(schedule); + break; } } @@ -1363,6 +1415,18 @@ NewProfileView::NewProfileView(const model::ScheduleRuleset & scheduleRuleset, S mainVLayout->addSpacing(10); break; } + case HOLIDAY: + { + auto label = new QLabel(); + QString text; + text.append("The holiday profile is not set, therefore the default run period profile will be used."); + text.append(" Create a new profile to override the default run period profile."); + label->setText(text); + label->setWordWrap(true); + mainVLayout->addWidget(label); + mainVLayout->addSpacing(10); + break; + } default: break; } @@ -1409,6 +1473,7 @@ NewProfileView::NewProfileView(const model::ScheduleRuleset & scheduleRuleset, S connect(this, &NewProfileView::addRuleClicked, schedulesView, &SchedulesView::addRuleClicked); connect(this, &NewProfileView::addSummerProfileClicked, schedulesView, &SchedulesView::addSummerProfileClicked); connect(this, &NewProfileView::addWinterProfileClicked, schedulesView, &SchedulesView::addWinterProfileClicked); + connect(this, &NewProfileView::addHolidayProfileClicked, schedulesView, &SchedulesView::addHolidayProfileClicked); innerVLayout->addStretch(); @@ -1428,6 +1493,9 @@ void NewProfileView::onAddClicked() case WINTER: emit addWinterProfileClicked(m_scheduleRuleset, handle); break; + case HOLIDAY: + emit addHolidayProfileClicked(m_scheduleRuleset, handle); + break; default: emit addRuleClicked(m_scheduleRuleset, handle); } @@ -1449,6 +1517,10 @@ void NewProfileView::populateComboBox(const model::ScheduleRuleset & scheduleRul m_scheduleRuleComboBox->addItem("Winter Design Day Schedule", toQString(scheduleRuleset.winterDesignDaySchedule().handle())); } + if (!scheduleRuleset.isHolidayScheduleDefaulted()){ + m_scheduleRuleComboBox->addItem("Holiday Design Day Schedule", toQString(scheduleRuleset.holidaySchedule().handle())); + } + for (const auto& rule : scheduleRuleset.scheduleRules()){ m_scheduleRuleComboBox->addItem(toQString(rule.name().get()), toQString(rule.daySchedule().handle())); } @@ -1531,13 +1603,13 @@ DefaultScheduleDayView::DefaultScheduleDayView(bool isIP, } /******************************************************************************/ -// SizingScheduleDayView +// SpecialScheduleDayView /******************************************************************************/ -SizingScheduleDayView::SizingScheduleDayView(bool isIP, +SpecialScheduleDayView::SpecialScheduleDayView(bool isIP, const model::ScheduleRuleset & scheduleRuleset, SchedulesView * schedulesView, - SizingScheduleDayType type) + SpecialScheduleDayType type) : QWidget(schedulesView), m_type(type) { @@ -1576,11 +1648,11 @@ SizingScheduleDayView::SizingScheduleDayView(bool isIP, auto scheduleDayView = new ScheduleDayView(isIP, scheduleDay, schedulesView); - connect(this, &SizingScheduleDayView::toggleUnitsClicked, scheduleDayView, &ScheduleDayView::toggleUnitsClicked); + connect(this, &SpecialScheduleDayView::toggleUnitsClicked, scheduleDayView, &ScheduleDayView::toggleUnitsClicked); mainVLayout->addWidget(scheduleDayView); } - } else + } else if (m_type == WINTER) { if (!scheduleRuleset.isWinterDesignDayScheduleDefaulted()) { @@ -1596,10 +1668,33 @@ SizingScheduleDayView::SizingScheduleDayView(bool isIP, auto scheduleDayView = new ScheduleDayView(isIP, scheduleDay, schedulesView); - connect(this, &SizingScheduleDayView::toggleUnitsClicked, scheduleDayView, &ScheduleDayView::toggleUnitsClicked); + connect(this, &SpecialScheduleDayView::toggleUnitsClicked, scheduleDayView, &ScheduleDayView::toggleUnitsClicked); mainVLayout->addWidget(scheduleDayView); } + } else if (m_type == HOLIDAY) + { + if (!scheduleRuleset.isHolidayScheduleDefaulted()) + { + QLabel * label = new QLabel("Holiday profile."); + label->setObjectName("H2"); + + auto hLayout = new QHBoxLayout(); + hLayout->setContentsMargins(60, 0, 0, 10); + hLayout->addWidget(label); + mainVLayout->addLayout(hLayout); + + model::ScheduleDay scheduleDay = scheduleRuleset.holidaySchedule(); + + auto scheduleDayView = new ScheduleDayView(isIP, scheduleDay, schedulesView); + + connect(this, &SpecialScheduleDayView::toggleUnitsClicked, scheduleDayView, &ScheduleDayView::toggleUnitsClicked); + + mainVLayout->addWidget(scheduleDayView); + } + } else { + // Shouldn't happen + OS_ASSERT(false); } } diff --git a/src/openstudio_lib/SchedulesView.hpp b/src/openstudio_lib/SchedulesView.hpp index b42706771..e3a38e697 100644 --- a/src/openstudio_lib/SchedulesView.hpp +++ b/src/openstudio_lib/SchedulesView.hpp @@ -157,6 +157,8 @@ class SchedulesView : public QWidget, public Nano::Observer void showWinterScheduleDay(model::ScheduleRuleset schedule); + void showHolidayScheduleDay(model::ScheduleRuleset schedule); + // DLM: might remove this void showScheduleRuleset(const model::ScheduleRuleset & schedule); @@ -186,6 +188,8 @@ class SchedulesView : public QWidget, public Nano::Observer void addWinterProfileClicked(model::ScheduleRuleset & scheduleRuleset, UUID dayScheduleHandle); + void addHolidayProfileClicked(model::ScheduleRuleset & scheduleRuleset, UUID dayScheduleHandle); + void dayScheduleSceneChanged( DayScheduleScene * scene, double lowerValue, double upperValue ); void startDateTimeChanged(model::ScheduleRule & scheduleRule, const QDateTime & newDate); @@ -472,7 +476,7 @@ class ScheduleTabDefault : public QWidget, public Nano::Observer public: - enum ScheduleTabDefaultType { DEFAULT, SUMMER, WINTER }; + enum ScheduleTabDefaultType { DEFAULT, SUMMER, WINTER, HOLIDAY }; ScheduleTabDefault(ScheduleTab * scheduleTab, ScheduleTabDefaultType type); @@ -486,6 +490,8 @@ class ScheduleTabDefault : public QWidget, public Nano::Observer void winterClicked(model::ScheduleRuleset scheduleRuleset); + void holidayClicked(model::ScheduleRuleset scheduleRuleset); + protected: void mouseReleaseEvent( QMouseEvent * event ) override; @@ -523,7 +529,7 @@ class NewProfileView : public QWidget, public Nano::Observer public: - enum NewProfileViewType { SCHEDULERULE, SUMMER, WINTER }; + enum NewProfileViewType { SCHEDULERULE, SUMMER, WINTER, HOLIDAY }; NewProfileView(const model::ScheduleRuleset & scheduleRuleset, SchedulesView * schedulesView, NewProfileViewType type); @@ -537,6 +543,8 @@ class NewProfileView : public QWidget, public Nano::Observer void addWinterProfileClicked(model::ScheduleRuleset & scheduleRuleset, UUID dayScheduleHandle); + void addHolidayProfileClicked(model::ScheduleRuleset & scheduleRuleset, UUID dayScheduleHandle); + private slots: void onAddClicked(); @@ -592,21 +600,21 @@ class DefaultScheduleDayView : public QWidget }; -// View a sizing day schedule of a schedule ruleset -class SizingScheduleDayView : public QWidget +// View a Special Day (sizing day or holiday) schedule of a schedule ruleset +class SpecialScheduleDayView : public QWidget { Q_OBJECT public: - enum SizingScheduleDayType { SUMMER, WINTER }; + enum SpecialScheduleDayType { SUMMER, WINTER, HOLIDAY }; - SizingScheduleDayView(bool isIP, + SpecialScheduleDayView(bool isIP, const model::ScheduleRuleset & scheduleRuleset, SchedulesView * schedulesView, - SizingScheduleDayType type); + SpecialScheduleDayType type); - virtual ~SizingScheduleDayView() {} + virtual ~SpecialScheduleDayView() {} signals: @@ -614,7 +622,7 @@ class SizingScheduleDayView : public QWidget private: - SizingScheduleDayType m_type; + SpecialScheduleDayType m_type; }; // View a schedule rule of a schedule ruleset From 5d7a0e5932fe6cf5e37be09a76fc8dbc0eb5e594 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 12:16:41 +0100 Subject: [PATCH 3/7] Update ref to submodule, plus fix unrelated include error --- openstudio | 2 +- src/openstudio_lib/IconLibrary.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openstudio b/openstudio index b1d10fda0..68a158f47 160000 --- a/openstudio +++ b/openstudio @@ -1 +1 @@ -Subproject commit b1d10fda081d31d38ae3dd67db244353ad3e199e +Subproject commit 68a158f4767c0c5d0d8e6f96796860e056fff7a0 diff --git a/src/openstudio_lib/IconLibrary.hpp b/src/openstudio_lib/IconLibrary.hpp index f721f17ef..ce95b9b6c 100644 --- a/src/openstudio_lib/IconLibrary.hpp +++ b/src/openstudio_lib/IconLibrary.hpp @@ -31,7 +31,7 @@ #define OPENSTUDIO_ICONLIBRARY_HPP #include "OpenStudioAPI.hpp" -#include "../utilities/core/Logger.hpp" +#include #include #include From e4c1a1e62d05036e067f3251ead93aa90ecc91a6 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 12:37:56 +0100 Subject: [PATCH 4/7] Missed one signal/slot connection --- src/openstudio_lib/SchedulesTabController.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/openstudio_lib/SchedulesTabController.cpp b/src/openstudio_lib/SchedulesTabController.cpp index 999ec9ec4..50a19550d 100644 --- a/src/openstudio_lib/SchedulesTabController.cpp +++ b/src/openstudio_lib/SchedulesTabController.cpp @@ -495,6 +495,7 @@ void SchedulesTabController::setSubTab(int index) disconnect(qobject_cast(m_currentView), &SchedulesView::addRuleClicked, this, &SchedulesTabController::addRule); disconnect(qobject_cast(m_currentView), &SchedulesView::addSummerProfileClicked, this, &SchedulesTabController::addSummerProfile); disconnect(qobject_cast(m_currentView), &SchedulesView::addWinterProfileClicked, this, &SchedulesTabController::addWinterProfile); + disconnect(qobject_cast(m_currentView), &SchedulesView::addHolidayProfileClicked, this, &SchedulesTabController::addHolidayProfile); disconnect(qobject_cast(m_currentView), &SchedulesView::dayScheduleSceneChanged, this, &SchedulesTabController::onDayScheduleSceneChanged); disconnect(qobject_cast(m_currentView), &SchedulesView::startDateTimeChanged, this, &SchedulesTabController::onStartDateTimeChanged); disconnect(qobject_cast(m_currentView), &SchedulesView::endDateTimeChanged, this, &SchedulesTabController::onEndDateTimeChanged); @@ -532,6 +533,7 @@ void SchedulesTabController::setSubTab(int index) connect(schedulesView, &SchedulesView::addRuleClicked, this, &SchedulesTabController::addRule); connect(schedulesView, &SchedulesView::addSummerProfileClicked, this, &SchedulesTabController::addSummerProfile); connect(schedulesView, &SchedulesView::addWinterProfileClicked, this, &SchedulesTabController::addWinterProfile); + connect(schedulesView, &SchedulesView::addHolidayProfileClicked, this, &SchedulesTabController::addHolidayProfile); connect(schedulesView, &SchedulesView::dayScheduleSceneChanged, this, &SchedulesTabController::onDayScheduleSceneChanged); connect(schedulesView, &SchedulesView::startDateTimeChanged, this, &SchedulesTabController::onStartDateTimeChanged); connect(schedulesView, &SchedulesView::endDateTimeChanged, this, &SchedulesTabController::onEndDateTimeChanged); From f59a2e74aa8b4824e5b77349a85a6b3da58f1af0 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 13:35:57 +0100 Subject: [PATCH 5/7] Update submodule --- openstudio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openstudio b/openstudio index 68a158f47..86be7ef38 160000 --- a/openstudio +++ b/openstudio @@ -1 +1 @@ -Subproject commit 68a158f4767c0c5d0d8e6f96796860e056fff7a0 +Subproject commit 86be7ef3820501f59e03d00380efb3dcd761470e From fed7db146a28e340897e4d12df42c91df729a350 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 15:43:54 +0100 Subject: [PATCH 6/7] Expose "Advanced" RunPeriod parameters in OS App, such as "Use Weather File Holidays and Special Days" --- src/openstudio_lib/SimSettingsView.cpp | 137 ++++++++++++++++++++++--- src/openstudio_lib/SimSettingsView.hpp | 20 ++-- 2 files changed, 135 insertions(+), 22 deletions(-) diff --git a/src/openstudio_lib/SimSettingsView.cpp b/src/openstudio_lib/SimSettingsView.cpp index 5ed854d1c..38c6334de 100644 --- a/src/openstudio_lib/SimSettingsView.cpp +++ b/src/openstudio_lib/SimSettingsView.cpp @@ -116,13 +116,19 @@ SimSettingsView::SimSettingsView(bool isIP, m_performZoneSizing(nullptr), m_performSystemSizing(nullptr), m_performPlantSizing(nullptr), - m_dateRangelabel(nullptr), - m_startDateEdit(nullptr), - m_endDateEdit(nullptr), m_runPeriodGroup(nullptr), m_radianceGroup(nullptr), m_runPeriodName(nullptr), m_isIP(isIP), + // Run Period + m_dateRangelabel(nullptr), + m_startDateEdit(nullptr), + m_endDateEdit(nullptr), + m_useWeatherFileHolidaysandSpecialDays(nullptr), + m_useWeatherFileDaylightSavingsPeriod(nullptr), + m_applyWeekendHolidayRule(nullptr), + m_useWeatherFileRainIndicators(nullptr), + m_useWeatherFileSnowIndicators(nullptr), // SimulationControl m_doZoneSizingCalculation(nullptr), m_doSystemSizingCalculation(nullptr), @@ -237,6 +243,9 @@ void SimSettingsView::createWidgets() //******************* OS:Timestep ******************* mainLayout->addWidget(createTimestepWidget()); + collapsibleInspector = new CollapsibleInspector("Advanced RunPeriod Parameters",createRunPeriodAdvancedWidget()); + mainLayout->addWidget(collapsibleInspector); + //******************* OS:RadianceParameters ******************* collapsibleInspector = new CollapsibleInspector("Radiance Parameters",createRadianceParametersWidget()); mainLayout->addWidget(collapsibleInspector); @@ -404,6 +413,55 @@ QWidget * SimSettingsView::createRunPeriodWidget() return widget; } +QWidget * SimSettingsView::createRunPeriodAdvancedWidget() +{ + // These are the "advanced" fields from the RunPeriod object + auto gridLayout = new QGridLayout(); + gridLayout->setContentsMargins(7,7,7,7); + gridLayout->setSpacing(GRID_LAYOUT_SPACING); + + // Number of times repeated isn't translated + + int row = 0; + int col = 0; + QSpacerItem * spacerItem = nullptr; + + addField(gridLayout,row,col,"Use Weather File Holidays and Special Days",m_useWeatherFileHolidaysandSpecialDays); + col++; + spacerItem = new QSpacerItem(SPACERITEM_WIDTH,1,QSizePolicy::Fixed,QSizePolicy::Fixed); + gridLayout->addItem(spacerItem,row,col++); + addField(gridLayout,row,col,"Use Weather File Daylight Savings Period",m_useWeatherFileDaylightSavingsPeriod); + + row = row + 2; + spacerItem = new QSpacerItem(1,SPACERITEM_HEIGHT,QSizePolicy::Fixed,QSizePolicy::Fixed); + gridLayout->addItem(spacerItem,row++,0); + col = 0; + + addField(gridLayout,row,col,"Use Weather File Rain Indicators",m_useWeatherFileRainIndicators); + col = col + 2; + addField(gridLayout,row,col,"Use Weather File Snow Indicators",m_useWeatherFileSnowIndicators); + + row = row + 2; + spacerItem = new QSpacerItem(1,SPACERITEM_HEIGHT,QSizePolicy::Fixed,QSizePolicy::Fixed); + gridLayout->addItem(spacerItem,row++,0); + col = 0; + + + addField(gridLayout,row,col,"Apply Weekend Holiday Rule",m_applyWeekendHolidayRule); + col = col + 2; + // Number of times repeated isn't translated + // addField(gridLayout,row,col,"Number of Times Runperiod to be Repeate", m_numberTimeRepeat); + + gridLayout->setRowStretch(100,100); + gridLayout->setColumnStretch(100,100); + + auto widget = new QWidget(); + widget->setLayout(gridLayout); + widget->hide(); + + return widget; +} + QWidget * SimSettingsView::createRunControlWidget() { auto mainLayout = new QVBoxLayout() ; @@ -1182,6 +1240,48 @@ void SimSettingsView::detachAll() void SimSettingsView::attachRunPeriod() { + m_runPeriod = m_model.getUniqueModelObject(); + + m_useWeatherFileHolidaysandSpecialDays->bind( + *m_runPeriod, + std::bind(&model::RunPeriod::getUseWeatherFileHolidays,m_runPeriod.get_ptr()), + boost::optional(std::bind(&model::RunPeriod::setUseWeatherFileHolidays,m_runPeriod.get_ptr(),std::placeholders::_1)), + boost::none, // reset + boost::none // isDefaulted + ); + + m_useWeatherFileDaylightSavingsPeriod->bind( + *m_runPeriod, + std::bind(&model::RunPeriod::getUseWeatherFileDaylightSavings,m_runPeriod.get_ptr()), + boost::optional(std::bind(&model::RunPeriod::setUseWeatherFileDaylightSavings,m_runPeriod.get_ptr(),std::placeholders::_1)), + boost::none, // reset + boost::none // isDefaulted + ); + + m_useWeatherFileRainIndicators->bind( + *m_runPeriod, + std::bind(&model::RunPeriod::getUseWeatherFileRainInd,m_runPeriod.get_ptr()), + boost::optional(std::bind(&model::RunPeriod::setUseWeatherFileRainInd,m_runPeriod.get_ptr(),std::placeholders::_1)), + boost::none, // reset + boost::none // isDefaulted + ); + + m_useWeatherFileSnowIndicators->bind( + *m_runPeriod, + std::bind(&model::RunPeriod::getUseWeatherFileSnowInd,m_runPeriod.get_ptr()), + boost::optional(std::bind(&model::RunPeriod::setUseWeatherFileSnowInd,m_runPeriod.get_ptr(),std::placeholders::_1)), + boost::none, // reset + boost::none // isDefaulted + ); + + m_applyWeekendHolidayRule->bind( + *m_runPeriod, + std::bind(&model::RunPeriod::getApplyWeekendHolidayRule,m_runPeriod.get_ptr()), + boost::optional(std::bind(&model::RunPeriod::setApplyWeekendHolidayRule,m_runPeriod.get_ptr(),std::placeholders::_1)), + boost::none, // reset + boost::none // isDefaulted + ); + } void SimSettingsView::attachRunPeriodControlDaylightSavingTime() @@ -1826,6 +1926,11 @@ void SimSettingsView::attachRadianceParameters() void SimSettingsView::detachRunPeriod() { + m_useWeatherFileHolidaysandSpecialDays->unbind(); + m_useWeatherFileDaylightSavingsPeriod->unbind(); + m_applyWeekendHolidayRule->unbind(); + m_useWeatherFileRainIndicators->unbind(); + m_useWeatherFileSnowIndicators->unbind(); } void SimSettingsView::detachRunPeriodControlDaylightSavingTime() @@ -2006,22 +2111,22 @@ void SimSettingsView::on_startDateChanged(const QDate & date) m_endDateEdit->blockSignals(false); } - model::RunPeriod mo = m_model.getUniqueModelObject(); + m_runPeriod = m_model.getUniqueModelObject(); - mo.setBeginMonth(m_startDateEdit->date().month()); - mo.setBeginDayOfMonth(m_startDateEdit->date().day()); + m_runPeriod->setBeginMonth(m_startDateEdit->date().month()); + m_runPeriod->setBeginDayOfMonth(m_startDateEdit->date().day()); - mo.setEndMonth(m_endDateEdit->date().month()); - mo.setEndDayOfMonth(m_endDateEdit->date().day()); + m_runPeriod->setEndMonth(m_endDateEdit->date().month()); + m_runPeriod->setEndDayOfMonth(m_endDateEdit->date().day()); } void SimSettingsView::initStartDateEdit() { // Note: QDateEdit bug workaround int year = m_startDateEdit->date().year(); - model::RunPeriod runPeriod = m_model.getUniqueModelObject(); + m_runPeriod = m_model.getUniqueModelObject(); m_startDateEdit->blockSignals(true); - m_startDateEdit->setDate(QDate(year, runPeriod.getBeginMonth(), runPeriod.getBeginDayOfMonth())); + m_startDateEdit->setDate(QDate(year, m_runPeriod->getBeginMonth(), m_runPeriod->getBeginDayOfMonth())); m_startDateEdit->blockSignals(false); } @@ -2033,13 +2138,13 @@ void SimSettingsView::on_endDateChanged(const QDate & date) m_startDateEdit->blockSignals(false); } - model::RunPeriod mo = m_model.getUniqueModelObject(); + m_runPeriod = m_model.getUniqueModelObject(); - mo.setBeginMonth(m_startDateEdit->date().month()); - mo.setBeginDayOfMonth(m_startDateEdit->date().day()); + m_runPeriod->setBeginMonth(m_startDateEdit->date().month()); + m_runPeriod->setBeginDayOfMonth(m_startDateEdit->date().day()); - mo.setEndMonth(m_endDateEdit->date().month()); - mo.setEndDayOfMonth(m_endDateEdit->date().day()); + m_runPeriod->setEndMonth(m_endDateEdit->date().month()); + m_runPeriod->setEndDayOfMonth(m_endDateEdit->date().day()); } void SimSettingsView::on_runSimWeatherFiles(int state) @@ -2090,4 +2195,4 @@ void SimSettingsView::updateYearDescription() m_endDateEdit->blockSignals(false); } -} // openstudio \ No newline at end of file +} // openstudio diff --git a/src/openstudio_lib/SimSettingsView.hpp b/src/openstudio_lib/SimSettingsView.hpp index 93ae9f7bf..317ccd5aa 100644 --- a/src/openstudio_lib/SimSettingsView.hpp +++ b/src/openstudio_lib/SimSettingsView.hpp @@ -36,6 +36,7 @@ #include #include #include +#include class QButtonGroup; class QCheckBox; @@ -75,6 +76,7 @@ class SimSettingsView : public QWidget, public Nano::Observer void enableRadianceParametersWidget(bool isEnabled); QWidget * createRunPeriodWidget(); + QWidget * createRunPeriodAdvancedWidget(); QWidget * createRunControlWidget(); QWidget * createSimulationControlWidget(); QWidget * createSizingParametersWidget(); @@ -194,11 +196,6 @@ class SimSettingsView : public QWidget, public Nano::Observer QCheckBox * m_performSystemSizing; QCheckBox * m_performPlantSizing; - QLabel * m_dateRangelabel; - - QDateEdit * m_startDateEdit; - QDateEdit * m_endDateEdit; - QButtonGroup * m_runPeriodGroup; QButtonGroup * m_radianceGroup; @@ -206,6 +203,17 @@ class SimSettingsView : public QWidget, public Nano::Observer bool m_isIP; + // Run Period + boost::optional m_runPeriod; + QLabel * m_dateRangelabel; + QDateEdit * m_startDateEdit; + QDateEdit * m_endDateEdit; + OSSwitch2 * m_useWeatherFileHolidaysandSpecialDays; + OSSwitch2 * m_useWeatherFileDaylightSavingsPeriod; + OSSwitch2 * m_applyWeekendHolidayRule; + OSSwitch2 * m_useWeatherFileRainIndicators; + OSSwitch2 * m_useWeatherFileSnowIndicators; + // SimulationControl OSSwitch2 * m_doZoneSizingCalculation; OSSwitch2 * m_doSystemSizingCalculation; @@ -337,4 +345,4 @@ private slots: } // openstudio -#endif // OPENSTUDIO_SIMSETTINGSVIEW_HPP \ No newline at end of file +#endif // OPENSTUDIO_SIMSETTINGSVIEW_HPP From 7719264926ba41816a8a9de28c8d008d1b840276 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 18:23:58 +0100 Subject: [PATCH 7/7] Update submodule --- openstudio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openstudio b/openstudio index 86be7ef38..eaddb100e 160000 --- a/openstudio +++ b/openstudio @@ -1 +1 @@ -Subproject commit 86be7ef3820501f59e03d00380efb3dcd761470e +Subproject commit eaddb100e2eb81b882684884baf86cb6d7272ad9