From e1fbcfdf6fa5125bef42dfca501a2b797579488d Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 11:31:14 +0100 Subject: [PATCH 01/15] Proposed Modification of IDD: move Holiday schedule to ScheduleRuleset, delete applyHoliday from Schedule:Rule --- resources/model/OpenStudio.idd | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/resources/model/OpenStudio.idd b/resources/model/OpenStudio.idd index 3d28b02da85..90624ac364b 100644 --- a/resources/model/OpenStudio.idd +++ b/resources/model/OpenStudio.idd @@ -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 \type object-list \object-list DayScheduleNames From 3b7e1a9da1057a2722f004ae0502912675d0762f Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 11:32:14 +0100 Subject: [PATCH 02/15] Write VT for new IDD --- src/osversion/VersionTranslator.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/osversion/VersionTranslator.cpp b/src/osversion/VersionTranslator.cpp index 21a2c2a0140..d6f6013c8c0 100644 --- a/src/osversion/VersionTranslator.cpp +++ b/src/osversion/VersionTranslator.cpp @@ -4861,6 +4861,27 @@ std::string VersionTranslator::update_2_9_0_to_3_0_0(const IdfFile& idf_2_9_0, c m_refactored.push_back(RefactoredObjectData(object, newObject)); ss << newObject; + } else if (iddname == "OS:Schedule:Rule") { + auto iddObject = idd_3_0_0.getObject(iddname); + IdfObject newObject(iddObject.get()); + + // Removed field 12: Apply Holiday + for (size_t i = 0; i < object.numFields(); ++i) { + if ((value = object.getString(i))) { + if (i < 12) { + newObject.setString(i, value.get()); + } else if (i > 12) { + newObject.setString(i-1, value.get()); + } // i == 12: skip + } + } + + m_refactored.push_back(RefactoredObjectData(object, newObject)); + ss << newObject; + + // Note: OS:ScheduleRuleset got a new optional field at the end, so no-op + // } else if (iddname == "OS:Schedule:Ruleset") { + // No-op } else { ss << object; From f49a98ea932125cb3bf6f2677f8469f66362228e Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 11:32:38 +0100 Subject: [PATCH 03/15] Model API: delete commented methods from Schedule:Rule --- src/model/ScheduleRule.cpp | 41 --------------------------------- src/model/ScheduleRule.hpp | 12 ++++------ src/model/ScheduleRule_Impl.hpp | 4 +--- 3 files changed, 5 insertions(+), 52 deletions(-) diff --git a/src/model/ScheduleRule.cpp b/src/model/ScheduleRule.cpp index 4e275cc18a0..2064fb7ec1f 100644 --- a/src/model/ScheduleRule.cpp +++ b/src/model/ScheduleRule.cpp @@ -199,13 +199,6 @@ namespace detail { OS_ASSERT(value); return openstudio::istringEqual(value.get(), "Yes"); } -/* - bool ScheduleRule_Impl::applyHoliday() const { - boost::optional value = getString(OS_Schedule_RuleFields::ApplyHoliday,true); - OS_ASSERT(value); - return openstudio::istringEqual(value.get(), "Yes"); - } -*/ std::string ScheduleRule_Impl::dateSpecificationType() const { boost::optional value = getString(OS_Schedule_RuleFields::DateSpecificationType,true); @@ -346,23 +339,6 @@ namespace detail { OS_ASSERT(result); return result; } -/* - 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"); @@ -689,11 +665,6 @@ bool ScheduleRule::applyFriday() const { bool ScheduleRule::applySaturday() const { return getImpl()->applySaturday(); } -/* -bool ScheduleRule::applyHoliday() const { - return getImpl()->applyHoliday(); -} -*/ boost::optional ScheduleRule::startDate() const { @@ -781,26 +752,14 @@ void ScheduleRule::setApplySaturdayNoFail(bool applySaturday) { OS_ASSERT(result); } -/* -bool ScheduleRule::setApplyHoliday(bool applyHoliday) { - return getImpl()->setApplyHoliday(applyHoliday); -} - -void ScheduleRule::setApplyHolidayNoFail(bool applyHoliday) { - bool result = getImpl()->setApplyHoliday(applyHoliday); -} -*/ - bool ScheduleRule::setStartDate(const openstudio::Date& date) { return getImpl()->setStartDate(date); } - bool ScheduleRule::setEndDate(const openstudio::Date& date) { return getImpl()->setEndDate(date); } - bool ScheduleRule::addSpecificDate(const openstudio::Date& date) { return getImpl()->addSpecificDate(date); } diff --git a/src/model/ScheduleRule.hpp b/src/model/ScheduleRule.hpp index 5fd5fbedc69..94518b29567 100644 --- a/src/model/ScheduleRule.hpp +++ b/src/model/ScheduleRule.hpp @@ -85,16 +85,16 @@ class MODEL_API ScheduleRule : public ParentObject { bool applyMonday() const; bool applyTuesday() const; - + bool applyWednesday() const; bool applyThursday() const; - + bool applyFriday() const; bool applySaturday() const; - //bool applyHoliday() const; + // Note: there is no applyHoliday, instead that's implemented at the ScheduleRule's level std::string dateSpecificationType() const; @@ -141,11 +141,7 @@ class MODEL_API ScheduleRule : public ParentObject { void setApplySaturdayNoFail(bool applySaturday); - //bool setApplyHoliday(bool applyHoliday); - - //void setApplyHolidayNoFail(bool applyHoliday); - - /// Sets the start date of the date range, will delete any specific dates specified. +/// Sets the start date of the date range, will delete any specific dates specified. /// A start date > end date indicates that the range wraps around the year. bool setStartDate(const openstudio::Date& date); diff --git a/src/model/ScheduleRule_Impl.hpp b/src/model/ScheduleRule_Impl.hpp index 12802b1a5cc..8e14a32d6ee 100644 --- a/src/model/ScheduleRule_Impl.hpp +++ b/src/model/ScheduleRule_Impl.hpp @@ -105,7 +105,7 @@ namespace detail { bool applySaturday() const; - //bool applyHoliday() const; + // Note: there is no applyHoliday, instead that's implemented at the ScheduleRule's level std::string dateSpecificationType() const; @@ -140,8 +140,6 @@ namespace detail { bool setApplySaturday(bool applySaturday); - //bool setApplyHoliday(bool applyHoliday); - /// Sets the start date of the date range, will delete any specific dates specified. /// A start date > end date indicates that the range wraps around the year. bool setStartDate(const openstudio::Date& date); From f72e9fd4edc5591bba303109eb756f5c5680d237 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 11:33:12 +0100 Subject: [PATCH 04/15] Model API: Implement Holiday Schedule in Schedule:Ruleset, similar to Winter/Summer Design Day --- src/model/ScheduleRuleset.cpp | 92 ++++++++++++++++++++++++++++++ src/model/ScheduleRuleset.hpp | 14 +++++ src/model/ScheduleRuleset_Impl.hpp | 12 ++++ 3 files changed, 118 insertions(+) diff --git a/src/model/ScheduleRuleset.cpp b/src/model/ScheduleRuleset.cpp index 2e1e0967966..9c6099af695 100644 --- a/src/model/ScheduleRuleset.cpp +++ b/src/model/ScheduleRuleset.cpp @@ -93,6 +93,12 @@ namespace detail { OS_ASSERT(test); } + if (!isHolidayScheduleDefaulted()) { + ModelObject newHolidaySchedule = holidaySchedule().clone(model); + test = newScheduleRuleset.setPointer(OS_Schedule_RulesetFields::HolidayScheduleName,newHolidaySchedule.handle()); + OS_ASSERT(test); + } + for (ScheduleRule scheduleRule : scheduleRules()) { ModelObject newScheduleRule = scheduleRule.clone(model); test = newScheduleRule.setParent(newScheduleRuleset); @@ -112,6 +118,9 @@ namespace detail { if (!isWinterDesignDayScheduleDefaulted()) { daySchedules.push_back(winterDesignDaySchedule()); } + if (!isHolidayScheduleDefaulted()) { + daySchedules.push_back(holidaySchedule()); + } auto it = result.begin(); while (it != result.end()) { auto jit = std::find(daySchedules.begin(),daySchedules.end(),*it); @@ -143,6 +152,10 @@ namespace detail { result.push_back(this->winterDesignDaySchedule()); } + if (!this->isHolidayScheduleDefaulted()){ + result.push_back(this->holidaySchedule()); + } + for (ScheduleRule scheduleRule : this->scheduleRules()){ result.push_back(scheduleRule); } @@ -189,6 +202,10 @@ namespace detail { result = winterDesignDaySchedule().setScheduleTypeLimits(scheduleTypeLimits); OS_ASSERT(result); } + if (!isHolidayScheduleDefaulted()) { + result = holidaySchedule().setScheduleTypeLimits(scheduleTypeLimits); + OS_ASSERT(result); + } ScheduleRuleVector rules = scheduleRules(); for (const ScheduleRule& rule : rules) { result = rule.daySchedule().setScheduleTypeLimits(scheduleTypeLimits); @@ -213,6 +230,10 @@ namespace detail { result = winterDesignDaySchedule().resetScheduleTypeLimits(); OS_ASSERT(result); } + if (!isHolidayScheduleDefaulted()) { + result = holidaySchedule().resetScheduleTypeLimits(); + OS_ASSERT(result); + } ScheduleRuleVector rules = scheduleRules(); for (ScheduleRule& rule : rules) { result = rule.daySchedule().resetScheduleTypeLimits(); @@ -260,6 +281,20 @@ namespace detail { return this->isEmpty(OS_Schedule_RulesetFields::WinterDesignDayScheduleName); } + ScheduleDay ScheduleRuleset_Impl::holidaySchedule() const + { + OptionalScheduleDay result = getObject().getModelObjectTarget(OS_Schedule_RulesetFields::HolidayScheduleName); + if (result){ + return *result; + } + return this->defaultDaySchedule(); + } + + bool ScheduleRuleset_Impl::isHolidayScheduleDefaulted() const + { + return this->isEmpty(OS_Schedule_RulesetFields::HolidayScheduleName); + } + bool ScheduleRuleset_Impl::setSummerDesignDaySchedule(const ScheduleDay& schedule) { if (OptionalScheduleTypeLimits candidateLimits = schedule.scheduleTypeLimits()) { @@ -334,6 +369,43 @@ namespace detail { OS_ASSERT(test); } + bool ScheduleRuleset_Impl::setHolidaySchedule(const ScheduleDay& schedule) + { + if (OptionalScheduleTypeLimits candidateLimits = schedule.scheduleTypeLimits()) { + if (OptionalScheduleTypeLimits parentLimits = scheduleTypeLimits()) { + if (!isCompatible(*parentLimits,*candidateLimits)) { + return false; + } + } + else { + return false; + } + } + + if (!this->isHolidayScheduleDefaulted()){ + ScheduleDay holidaySchedule = this->holidaySchedule(); + holidaySchedule.remove(); + } + ModelObject clone = schedule.clone(); + bool result = setPointer(OS_Schedule_RulesetFields::HolidayScheduleName, clone.handle()); + OS_ASSERT(result); + if (OptionalScheduleTypeLimits limits = scheduleTypeLimits()) { + result = holidaySchedule().setScheduleTypeLimits(*limits); + OS_ASSERT(result); + } + return result; + } + + void ScheduleRuleset_Impl::resetHolidaySchedule() + { + if (!this->isHolidayScheduleDefaulted()){ + ScheduleDay holidaySchedule = this->holidaySchedule(); + holidaySchedule.remove(); + } + bool test = this->setString(OS_Schedule_RulesetFields::HolidayScheduleName, ""); + OS_ASSERT(test); + } + struct ScheduleRuleIndexCompare { bool operator()(const ScheduleRule& left, const ScheduleRule& right) const { return (left.ruleIndex() < right.ruleIndex()); @@ -546,6 +618,16 @@ bool ScheduleRuleset::isWinterDesignDayScheduleDefaulted() const return getImpl()->isWinterDesignDayScheduleDefaulted(); } +ScheduleDay ScheduleRuleset::holidaySchedule() const +{ + return getImpl()->holidaySchedule(); +} + +bool ScheduleRuleset::isHolidayScheduleDefaulted() const +{ + return getImpl()->isHolidayScheduleDefaulted(); +} + bool ScheduleRuleset::setSummerDesignDaySchedule(const ScheduleDay& schedule) { return getImpl()->setSummerDesignDaySchedule(schedule); @@ -566,6 +648,16 @@ void ScheduleRuleset::resetWinterDesignDaySchedule() return getImpl()->resetWinterDesignDaySchedule(); } +bool ScheduleRuleset::setHolidaySchedule(const ScheduleDay& schedule) +{ + return getImpl()->setHolidaySchedule(schedule); +} + +void ScheduleRuleset::resetHolidaySchedule() +{ + return getImpl()->resetHolidaySchedule(); +} + std::vector ScheduleRuleset::scheduleRules() const { return getImpl()->scheduleRules(); diff --git a/src/model/ScheduleRuleset.hpp b/src/model/ScheduleRuleset.hpp index 83455c07a65..6f4a5fe54ca 100644 --- a/src/model/ScheduleRuleset.hpp +++ b/src/model/ScheduleRuleset.hpp @@ -91,6 +91,12 @@ class MODEL_API ScheduleRuleset : public Schedule { /// Returns true if the winter design day is defaulted; false if it is explicitly set. bool isWinterDesignDayScheduleDefaulted() const; + /// Returns the holiday schedule, which may be the same ScheduleDay as defaultDaySchedule(). + ScheduleDay holidaySchedule() const; + + /// Returns true if the holiday schedule is defaulted; false if it is explicitly set. + bool isHolidayScheduleDefaulted() const; + //@} /** @name Setters */ //@{ @@ -113,6 +119,14 @@ class MODEL_API ScheduleRuleset : public Schedule { /// design day schedule. void resetWinterDesignDaySchedule(); + /// Sets the holiday schedule if ScheduleTypeLimits are compatible. Calls remove + /// on any existing non-default holiday schedule. Clones schedule and parents the + /// clone, but does not call remove on the original schedule. + bool setHolidaySchedule(const ScheduleDay& schedule); + + /// Resets the holiday schedule. Calls remove on any existing non-default holiday schedule. + void resetHolidaySchedule(); + //@} /** @name Other */ //@{ diff --git a/src/model/ScheduleRuleset_Impl.hpp b/src/model/ScheduleRuleset_Impl.hpp index bbf8a3a5b2a..bdacf97fd66 100644 --- a/src/model/ScheduleRuleset_Impl.hpp +++ b/src/model/ScheduleRuleset_Impl.hpp @@ -106,6 +106,12 @@ namespace detail { /// Returns true if the winter design day is defaulted. bool isWinterDesignDayScheduleDefaulted() const; + /// Returns the holiday schedule. + ScheduleDay holidaySchedule() const; + + /// Returns true if the holiday schedule is defaulted. + bool isHolidayScheduleDefaulted() const; + //@} /** @name Setters */ //@{ @@ -122,6 +128,12 @@ namespace detail { /// Resets the winter design day schedule. void resetWinterDesignDaySchedule(); + /// Sets the holiday schedule. + bool setHolidaySchedule(const ScheduleDay& schedule); + + /// Resets the holiday schedule. + void resetHolidaySchedule(); + //@} /** @name Other */ //@{ From b1d10fda081d31d38ae3dd67db244353ad3e199e Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 11:35:34 +0100 Subject: [PATCH 05/15] ForwardTranslate the ScheduleRuleset Holiday Schedule --- .../ForwardTranslator/ForwardTranslateScheduleRuleset.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateScheduleRuleset.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateScheduleRuleset.cpp index 87a63825753..9eaef90bbb2 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateScheduleRuleset.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateScheduleRuleset.cpp @@ -148,6 +148,8 @@ boost::optional ForwardTranslator::translateScheduleRuleset( Schedule ScheduleDay defaultDaySchedule = modelObject.defaultDaySchedule(); ScheduleDay summerDesignDaySchedule = modelObject.summerDesignDaySchedule(); ScheduleDay winterDesignDaySchedule = modelObject.winterDesignDaySchedule(); + // ScheduleRuleset is the one carrying the Holiday Schedule + ScheduleDay holidayDaySchedule = modelObject.holidaySchedule(); // initialize day of week schedules ScheduleDay sundaySchedule = defaultDaySchedule; @@ -159,7 +161,6 @@ boost::optional ForwardTranslator::translateScheduleRuleset( Schedule ScheduleDay saturdaySchedule = defaultDaySchedule; // these are not yet exposed - ScheduleDay holidayDaySchedule = defaultDaySchedule; ScheduleDay customDay1Schedule = defaultDaySchedule; ScheduleDay customDay2Schedule = defaultDaySchedule; @@ -230,9 +231,11 @@ boost::optional ForwardTranslator::translateScheduleRuleset( Schedule weekSchedule->thursdaySchedule = thursdaySchedule.name().get(); weekSchedule->fridaySchedule = fridaySchedule.name().get(); weekSchedule->saturdaySchedule = saturdaySchedule.name().get(); + // from Schedule:Ruleset weekSchedule->holidayDaySchedule = holidayDaySchedule.name().get(); weekSchedule->summerDesignDaySchedule = summerDesignDaySchedule.name().get(); weekSchedule->winterDesignDaySchedule = winterDesignDaySchedule.name().get(); + // Not exposed yet weekSchedule->customDay1Schedule = customDay1Schedule.name().get(); weekSchedule->customDay2Schedule = customDay2Schedule.name().get(); @@ -396,10 +399,12 @@ boost::optional ForwardTranslator::translateScheduleRuleset( Schedule ScheduleDay defaultDaySchedule = modelObject.defaultDaySchedule(); ScheduleDay summerDesignDaySchedule = modelObject.summerDesignDaySchedule(); ScheduleDay winterDesignDaySchedule = modelObject.winterDesignDaySchedule(); + ScheduleDay holidayDaySchedule = modelObject.holidaySchedule(); translateAndMapModelObject(defaultDaySchedule); translateAndMapModelObject(summerDesignDaySchedule); translateAndMapModelObject(winterDesignDaySchedule); + translateAndMapModelObject(holidayDaySchedule); // translate schedule rules, these are returned in order for (ScheduleRule scheduleRule : modelObject.scheduleRules()){ From 9008d547e2cdac56d04e19b03dbaa5fbf6579c16 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 12:12:46 +0100 Subject: [PATCH 06/15] Add Missing static methods to get valid choice values for RunPeriodControlSpecialDays ('Special Day Type" field) --- src/model/RunPeriodControlSpecialDays.cpp | 10 ++++++++++ src/model/RunPeriodControlSpecialDays.hpp | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/src/model/RunPeriodControlSpecialDays.cpp b/src/model/RunPeriodControlSpecialDays.cpp index 2e56ba80cec..59a6dcf05c6 100644 --- a/src/model/RunPeriodControlSpecialDays.cpp +++ b/src/model/RunPeriodControlSpecialDays.cpp @@ -36,6 +36,7 @@ #include #include +#include #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 RunPeriodControlSpecialDays::specialDayTypeValues() { + return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), + OS_RunPeriodControl_SpecialDaysFields::SpecialDayType); +} + +std::vector RunPeriodControlSpecialDays::validSpecialDayTypeValues() { + return specialDayTypeValues(); +} + Date RunPeriodControlSpecialDays::startDate() const { return getImpl()->startDate(); diff --git a/src/model/RunPeriodControlSpecialDays.hpp b/src/model/RunPeriodControlSpecialDays.hpp index 3cde95bcb78..04ef9c13901 100644 --- a/src/model/RunPeriodControlSpecialDays.hpp +++ b/src/model/RunPeriodControlSpecialDays.hpp @@ -66,6 +66,15 @@ class MODEL_API RunPeriodControlSpecialDays : public ModelObject { virtual ~RunPeriodControlSpecialDays() {} + /** @name Static Methods */ + //@{ + + static std::vector specialDayTypeValues(); + + // Forwards to specialDayTypeValues() + static std::vector validSpecialDayTypeValues(); + + //@} /** @name Getters */ //@{ From 68a158f4767c0c5d0d8e6f96796860e056fff7a0 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 12:14:05 +0100 Subject: [PATCH 07/15] Add a TODO: currently RunPeriodControlSpecialDays aren't FT'ed unless you use ft.setKeepRunControlSpecialDays(true) --- src/energyplus/ForwardTranslator.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/energyplus/ForwardTranslator.cpp b/src/energyplus/ForwardTranslator.cpp index e105f4a452f..e6511b8bc19 100644 --- a/src/energyplus/ForwardTranslator.cpp +++ b/src/energyplus/ForwardTranslator.cpp @@ -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 From 164ed1ff9febfecd2ef115819a897d2d4b4b334a Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 13:34:52 +0100 Subject: [PATCH 08/15] Add Model tests --- src/model/test/ScheduleRuleset_GTest.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/model/test/ScheduleRuleset_GTest.cpp b/src/model/test/ScheduleRuleset_GTest.cpp index a4ff5e2e218..90612e4e23d 100644 --- a/src/model/test/ScheduleRuleset_GTest.cpp +++ b/src/model/test/ScheduleRuleset_GTest.cpp @@ -67,8 +67,10 @@ TEST_F(ModelFixture, ScheduleRuleset) ASSERT_NO_THROW(schedule.defaultDaySchedule()); ASSERT_NO_THROW(schedule.summerDesignDaySchedule()); ASSERT_NO_THROW(schedule.winterDesignDaySchedule()); + ASSERT_NO_THROW(schedule.holidaySchedule()); EXPECT_EQ(schedule.defaultDaySchedule().handle(), schedule.summerDesignDaySchedule().handle()); EXPECT_EQ(schedule.defaultDaySchedule().handle(), schedule.winterDesignDaySchedule().handle()); + EXPECT_EQ(schedule.defaultDaySchedule().handle(), schedule.holidaySchedule().handle()); // one default schedule created EXPECT_EQ(1u, model.getModelObjects().size()); @@ -809,7 +811,7 @@ TEST_F(ModelFixture, ScheduleRuleset_InsertObjects) EXPECT_FALSE(addedObjects.empty()); } -TEST_F(ModelFixture, ScheduleRuleset_DesignDays) +TEST_F(ModelFixture, ScheduleRuleset_SpecialDays) { Model model; ScheduleTypeLimits typeLimits(model); @@ -821,6 +823,7 @@ TEST_F(ModelFixture, ScheduleRuleset_DesignDays) EXPECT_EQ(1u, model.getConcreteModelObjects().size()); + // For each of these, the setter clones the original schedule ScheduleDay winterSchedule(model); schedule.setWinterDesignDaySchedule(winterSchedule); EXPECT_NE(winterSchedule.handle(), schedule.winterDesignDaySchedule().handle()); @@ -829,11 +832,16 @@ TEST_F(ModelFixture, ScheduleRuleset_DesignDays) schedule.setSummerDesignDaySchedule(summerSchedule); EXPECT_NE(summerSchedule.handle(), schedule.summerDesignDaySchedule().handle()); - EXPECT_EQ(5u, model.getConcreteModelObjects().size()); + ScheduleDay holidaySchedule(model); + schedule.setHolidaySchedule(holidaySchedule); + EXPECT_NE(holidaySchedule.handle(), schedule.holidaySchedule().handle()); + + // DefaultDay, the 3 schedules we created, and the 3 clones made by setters = 7 + EXPECT_EQ(7u, model.getConcreteModelObjects().size()); schedule.remove(); - EXPECT_EQ(2u, model.getConcreteModelObjects().size()); + EXPECT_EQ(3u, model.getConcreteModelObjects().size()); EXPECT_FALSE(winterSchedule.handle().isNull()); EXPECT_FALSE(summerSchedule.handle().isNull()); } From 86be7ef3820501f59e03d00380efb3dcd761470e Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 13:35:00 +0100 Subject: [PATCH 09/15] Add FT test --- src/energyplus/Test/ScheduleRuleset_GTest.cpp | 88 ++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) diff --git a/src/energyplus/Test/ScheduleRuleset_GTest.cpp b/src/energyplus/Test/ScheduleRuleset_GTest.cpp index 71f2e7c3305..d079e177f10 100644 --- a/src/energyplus/Test/ScheduleRuleset_GTest.cpp +++ b/src/energyplus/Test/ScheduleRuleset_GTest.cpp @@ -44,12 +44,14 @@ #include "../../model/ScheduleWeek_Impl.hpp" #include "../../model/ScheduleYear.hpp" #include "../../model/ScheduleYear_Impl.hpp" +#include "../../model/ScheduleDay.hpp" #include "../../model/YearDescription.hpp" #include "../../model/YearDescription_Impl.hpp" #include "../../utilities/idf/IdfExtensibleGroup.hpp" #include #include +#include #include #include @@ -268,4 +270,88 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_ScheduleWeek_Bug2322) //std::stringstream ss; //ss << workspace; //std::string s = ss.str(); -} \ No newline at end of file +} + +TEST_F(EnergyPlusFixture,ForwardTranslator_SpecialDays) +{ + + Model model; + model::YearDescription yd = model.getUniqueModelObject(); + EXPECT_TRUE(yd.setDayofWeekforStartDay("Sunday")); + + ScheduleRuleset scheduleRuleset(model); + scheduleRuleset.setName("Schedule Ruleset"); + ScheduleDay defaultDaySchedule = scheduleRuleset.defaultDaySchedule(); + defaultDaySchedule.setName("Default Day Schedule"); + + // Add Special Days schedules + scheduleRuleset.setSummerDesignDaySchedule(defaultDaySchedule); + ScheduleDay summerDesignDaySchedule = scheduleRuleset.summerDesignDaySchedule(); + summerDesignDaySchedule.setName("Summer Design Day Schedule"); + + scheduleRuleset.setWinterDesignDaySchedule(defaultDaySchedule); + ScheduleDay winterDesignDaySchedule = scheduleRuleset.winterDesignDaySchedule(); + winterDesignDaySchedule.setName("Winter Design Day Schedule"); + + scheduleRuleset.setHolidaySchedule(defaultDaySchedule); + ScheduleDay holidaySchedule = scheduleRuleset.holidaySchedule(); + holidaySchedule.setName("Holiday Schedule"); + + + // annual weekday rule + ScheduleRule weekdayRule(scheduleRuleset); + weekdayRule.setName("All Year Weekdays Rule"); + ScheduleDay weekdaySchedule = weekdayRule.daySchedule(); + weekdaySchedule.setName("Weekdays Schedule"); + weekdayRule.setApplySunday(false); + weekdayRule.setApplyMonday(true); + weekdayRule.setApplyTuesday(true); + weekdayRule.setApplyWednesday(true); + weekdayRule.setApplyThursday(true); + weekdayRule.setApplyFriday(true); + weekdayRule.setApplySaturday(false); + + // annual weekend rule + ScheduleRule weekendRule(scheduleRuleset); + weekendRule.setName("All Year Weekends Rule"); + ScheduleDay weekendSchedule = weekendRule.daySchedule(); + weekendSchedule.setName("Weekends Schedule"); + weekendRule.setApplyMonday(false); + weekendRule.setApplyTuesday(false); + weekendRule.setApplyWednesday(false); + weekendRule.setApplyThursday(false); + weekendRule.setApplyFriday(false); + weekendRule.setApplySaturday(true); + weekendRule.setApplySunday(true); + + ForwardTranslator ft; + Workspace workspace = ft.translateModel(model); + + std::vector scheduleYears = workspace.getObjectsByType(IddObjectType::Schedule_Year); + ASSERT_EQ(1u, scheduleYears.size()); + std::vector extensibleGroups = scheduleYears[0].extensibleGroups(); + ASSERT_EQ(1u, extensibleGroups.size()); + std::vector scheduleWeekDailys = workspace.getObjectsByType(IddObjectType::Schedule_Week_Daily); + ASSERT_EQ(1u, scheduleWeekDailys.size()); + WorkspaceObject scheduleWeekDaily(scheduleWeekDailys[0]); + + // Weekdays + EXPECT_EQ(weekdaySchedule.nameString(), scheduleWeekDaily.getString(Schedule_Week_DailyFields::MondaySchedule_DayName).get()); + EXPECT_EQ(weekdaySchedule.nameString(), scheduleWeekDaily.getString(Schedule_Week_DailyFields::TuesdaySchedule_DayName).get()); + EXPECT_EQ(weekdaySchedule.nameString(), scheduleWeekDaily.getString(Schedule_Week_DailyFields::WednesdaySchedule_DayName).get()); + EXPECT_EQ(weekdaySchedule.nameString(), scheduleWeekDaily.getString(Schedule_Week_DailyFields::ThursdaySchedule_DayName).get()); + EXPECT_EQ(weekdaySchedule.nameString(), scheduleWeekDaily.getString(Schedule_Week_DailyFields::FridaySchedule_DayName).get()); + + // Weekends + EXPECT_EQ(weekendSchedule.nameString(), scheduleWeekDaily.getString(Schedule_Week_DailyFields::SaturdaySchedule_DayName).get()); + EXPECT_EQ(weekendSchedule.nameString(), scheduleWeekDaily.getString(Schedule_Week_DailyFields::SundaySchedule_DayName).get()); + + // Special Days + EXPECT_EQ(holidaySchedule.nameString(), scheduleWeekDaily.getString(Schedule_Week_DailyFields::HolidaySchedule_DayName).get()); + EXPECT_EQ(summerDesignDaySchedule.nameString(), scheduleWeekDaily.getString(Schedule_Week_DailyFields::SummerDesignDaySchedule_DayName).get()); + EXPECT_EQ(winterDesignDaySchedule.nameString(), scheduleWeekDaily.getString(Schedule_Week_DailyFields::WinterDesignDaySchedule_DayName).get()); + // Not Exposed yet + EXPECT_EQ(defaultDaySchedule.nameString(), scheduleWeekDaily.getString(Schedule_Week_DailyFields::CustomDay1Schedule_DayName).get()); + EXPECT_EQ(defaultDaySchedule.nameString(), scheduleWeekDaily.getString(Schedule_Week_DailyFields::CustomDay2Schedule_DayName).get()); + +} From 3d8e5b805a3e18d2593745f9b40b1a5f5b84f053 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 17:23:04 +0100 Subject: [PATCH 10/15] Expand the parsing of Epw to include holiday and daylight savings --- src/utilities/filetypes/EpwFile.cpp | 133 ++++++++++++++++-- src/utilities/filetypes/EpwFile.hpp | 24 ++++ .../filetypes/test/EpwFile_GTest.cpp | 114 +++++++++++++++ 3 files changed, 263 insertions(+), 8 deletions(-) diff --git a/src/utilities/filetypes/EpwFile.cpp b/src/utilities/filetypes/EpwFile.cpp index e63fe63904e..5727257d35d 100644 --- a/src/utilities/filetypes/EpwFile.cpp +++ b/src/utilities/filetypes/EpwFile.cpp @@ -4267,23 +4267,24 @@ namespace openstudio{ } switch(i) { - case 0: + case 0: // LOCATION, result = result && parseLocation(line); break; - case 1: + case 1: // DESIGN CONDITIONS result = result && parseDesignConditions(line); break; - case 2: + case 2: // TYPICAL/EXTREME PERIODS break; - case 3: + case 3: // GROUND TEMPERATURES break; - case 4: + case 4: // HOLIDAYS/DAYLIGHT SAVINGS + result = result && parseHolidaysDaylightSavings(line); break; - case 5: + case 5: // COMMENTS 1 break; - case 6: + case 6: // COMMENTS 2 break; - case 7: + case 7: // DATA PERIODS result = result && parseDataPeriod(line); break; default: @@ -4529,6 +4530,122 @@ namespace openstudio{ return true; } + bool EpwFile::parseHolidaysDaylightSavings(const std::string& line) { + + // HOLIDAYS/DAYLIGHT SAVINGS,No, 4/29,10/28,9,Hol:001, 1/ 1,Hol:002, 2/19,Hol:003, 5/28,Hol:004, 7/ 4,Hol:005, 9/ 3,Hol:006,10/ 8,Hol:007,11/12,Hol:008,11/22,Hol:009,12/25 + // specified, leapYearObserved, daylightSavingStartDay, daylightSavingEndDay, numberOfHolidays, FieldSet: + + std::vector split = splitString(line, ','); + std::string specifier = split[0]; boost::trim(specifier); + if (!istringEqual(specifier, "HOLIDAYS/DAYLIGHT SAVINGS")) { + LOG(Error, "Missing 'HOLIDAYS/DAYLIGHT SAVINGS' specifier in EPW file '" << m_path << "'"); + return false; + } + + std::string leapYearObserved = split[1]; boost::trim(leapYearObserved); + if (istringEqual("Yes", leapYearObserved)) { + m_leapYearObserved = true; + } else { + m_leapYearObserved = false; + } + + std::string daylightSavingStartDay = split[2]; boost::trim(daylightSavingStartDay); + std::string daylightSavingEndDay = split[3]; boost::trim(daylightSavingEndDay); + + bool processDaylightDates = true; + if (daylightSavingStartDay == "0") { + LOG(Debug, "No Daylightings Saving start Date"); + processDaylightDates = false; + } else { + if (daylightSavingEndDay == "0") { + LOG(Error, "No Daylightings Saving End Date, skipping."); + processDaylightDates = false; + } else { + + try{ + // Parse start month and day, optional year + std::vector dateSplit = splitString(daylightSavingStartDay, '/'); + if(dateSplit.size() != 2 && dateSplit.size() != 3) { + LOG(Error, "Bad data Daylight Savings Start Day format '" << daylightSavingStartDay << "' in EPW file '" << m_path << "'"); + return false; + } + int month = std::stoi(dateSplit[0]); + int day = std::stoi(dateSplit[1]); + if(dateSplit.size() == 3) { + int year = std::stoi(dateSplit[1]); + m_daylightSavingStartDate = Date(monthOfYear(month), day, year); + } else { + m_daylightSavingStartDate = Date(monthOfYear(month), day); + } + } catch(...) { + LOG(Error, "Failed to parse Daylight Savings Start Day '" << daylightSavingStartDay << "' in EPW file '" << m_path << "'"); + return false; + } + } + } + + if (processDaylightDates) { + + try{ + // Parse end month and day, optional year + std::vector dateSplit = splitString(daylightSavingEndDay, '/'); + if(dateSplit.size() != 2 && dateSplit.size() != 3) { + LOG(Error, "Bad data Daylight Savings End Day format '" << daylightSavingEndDay << "' in EPW file '" << m_path << "'"); + return false; + } + int month = std::stoi(dateSplit[0]); + int day = std::stoi(dateSplit[1]); + if(dateSplit.size() == 3) { + int year = std::stoi(dateSplit[1]); + m_daylightSavingEndDate = Date(monthOfYear(month), day, year); + } else { + m_daylightSavingEndDate = Date(monthOfYear(month), day); + } + } catch(...) { + LOG(Error, "Failed to parse Daylight Savings End Day '" << daylightSavingEndDay << "' in EPW file '" << m_path << "'"); + return false; + } + + } + + std::string numberOfHolidays = split[4]; boost::trim(numberOfHolidays); + int nHolidays = 0; + try{ + nHolidays = std::stoi(numberOfHolidays); + } catch(...) { + LOG(Error, "Non-integral number of holidays in EPW file '" << m_path << "'"); + return false; + } + + for (int i = 5; i < 5 + (2*nHolidays); i += 2) { + std::string holidayName = split[i]; boost::trim(holidayName); + std::string holidayDay = split[i+1]; boost::trim(holidayDay); + // Need to parse the dates? + + if (holidayName.empty() || holidayDay.empty()) { + LOG(Error, "Empty Holiday Day or Day for entry " << i << ": (holidayName, holidayDay) = (" + << holidayName << ", " << holidayDay << "). Skipping."); + continue; + } + m_holidays.push_back(EpwHoliday(holidayName, holidayDay)); + } + + return true; + + } + + boost::optional EpwFile::daylightSavingStartDate() const { + return m_daylightSavingStartDate; + } + + boost::optional EpwFile::daylightSavingEndDate() const { + return m_daylightSavingEndDate; + } + + std::vector EpwFile::holidays() const { + return m_holidays; + } + bool EpwFile::parseDataPeriod(const std::string& line) { // DATA PERIODS,1,1,Data,Sunday, 1/ 1,12/31 diff --git a/src/utilities/filetypes/EpwFile.hpp b/src/utilities/filetypes/EpwFile.hpp index ea1c2acd313..1cf2ea9f478 100644 --- a/src/utilities/filetypes/EpwFile.hpp +++ b/src/utilities/filetypes/EpwFile.hpp @@ -475,6 +475,20 @@ class UTILITIES_API EpwDataPoint std::string m_liquidPrecipitationQuantity; // units hr, missing 99 }; +class UTILITIES_API EpwHoliday { + + public: + EpwHoliday(const std::string& holidayName, const std::string& holidayDateString) + : m_holidayName(holidayName), m_holidayDateString(holidayDateString) { }; + + std::string holidayName() const { return m_holidayName; }; + std::string holidayDateString() const { return m_holidayDateString; }; + + private: + std::string m_holidayName; + std::string m_holidayDateString; +}; + /** EpwDesignCondition is one line from the EPW file. All floating point numbers are stored as strings, * but are checked as numbers. */ @@ -935,6 +949,10 @@ class UTILITIES_API EpwFile{ /// Returns true if the data period "records per hour" input matches the data point values bool minutesMatch() const; + boost::optional daylightSavingStartDate() const; + boost::optional daylightSavingEndDate() const; + std::vector holidays() const; + private: EpwFile(); @@ -942,6 +960,7 @@ class UTILITIES_API EpwFile{ bool parseLocation(const std::string& line); bool parseDesignConditions(const std::string& line); bool parseDataPeriod(const std::string& line); + bool parseHolidaysDaylightSavings(const std::string& line); // configure logging REGISTER_LOGGER("openstudio.EpwFile"); @@ -966,6 +985,11 @@ class UTILITIES_API EpwFile{ std::vector m_data; std::vector m_designs; + bool m_leapYearObserved; + boost::optional m_daylightSavingStartDate; + boost::optional m_daylightSavingEndDate; + std::vector m_holidays; + bool m_isActual; // Error/warning flags to store how well the input matches what we think it should diff --git a/src/utilities/filetypes/test/EpwFile_GTest.cpp b/src/utilities/filetypes/test/EpwFile_GTest.cpp index f18349a2940..5b32c036688 100644 --- a/src/utilities/filetypes/test/EpwFile_GTest.cpp +++ b/src/utilities/filetypes/test/EpwFile_GTest.cpp @@ -764,3 +764,117 @@ TEST(Filetypes, EpwFile_DataPoint) ASSERT_TRUE(false); } } + +TEST(Filetypes, EpwFile_parseHolidaysDaylightSavings) +{ + + // I would construct an empty EpwFile to call parseDataPeriods but I can't since it's a private Ctor, and the method itself is private... + + // Typical: nothing included (that's the case for ALL weather files on EnergyPlus.net) + // HOLIDAYS/DAYLIGHT SAVINGS,No,0,0,0 + std::string epwFileStringNoHolidaysDaylightSavings = R"(LOCATION,Denver Centennial Golden Nr,CO,USA,TMY3,724666,39.74,-105.18,-7.0,1829.0 +DESIGN CONDITIONS,1,Climate Design Data 2009 ASHRAE Handbook,,Heating,12,-18.8,-15.5,-21.6,0.7,-10.9,-18.8,0.9,-7.5,12.2,3.9,10.9,3.8,3,340,Cooling,7,15.2,33,15.7,32,15.5,30.2,15.3,18.4,27.3,17.5,26.4,16.8,25.6,4.9,0,16.1,14.3,20.2,14.9,13.2,19.9,13.9,12.3,19.6,59.7,27.3,56.6,26.6,54,25.7,760,Extremes,11.1,9.5,8.4,22.9,-22.9,36.1,3.8,1.2,-25.7,37,-27.9,37.7,-30.1,38.3,-32.8,39.2 +TYPICAL/EXTREME PERIODS,6,Summer - Week Nearest Max Temperature For Period,Extreme,7/ 6,7/12,Summer - Week Nearest Average Temperature For Period,Typical,7/27,8/ 2,Winter - Week Nearest Min Temperature For Period,Extreme,12/15,12/21,Winter - Week Nearest Average Temperature For Period,Typical,12/ 1,12/ 7,Autumn - Week Nearest Average Temperature For Period,Typical,10/20,10/26,Spring - Week Nearest Average Temperature For Period,Typical,4/26,5/ 2 +GROUND TEMPERATURES,3,.5,,,,-0.60,1.34,5.12,8.69,15.46,19.02,20.00,18.20,14.02,8.83,3.71,0.32,2,,,,2.08,2.55,4.70,7.10,12.30,15.62,17.28,16.91,14.53,10.94,6.90,3.72,4,,,,4.84,4.51,5.45,6.81,10.25,12.82,14.49,14.90,13.86,11.74,9.00,6.53 +HOLIDAYS/DAYLIGHT SAVINGS,No,0,0,0 +COMMENTS 1,Custom/User Format -- WMO#724666; NREL TMY Data Set (2008); Period of Record 1973-2005 (Generally) +COMMENTS 2, -- Ground temps produced with a standard soil diffusivity of 2.3225760E-03 {m**2/day} +DATA PERIODS,1,1,Data,Sunday, 1/ 1,1/1 +1999,1,1,1,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-3.0,-4.0,92,80600,0,0,257,0,0,0,0,0,0,0,0,0.0,9,8,16.1,3300,9,999999999,89,0.0310,0,88,0.330,999.0,99.0 +2005,1,1,2,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-3.0,-6.0,77,80600,0,0,261,0,0,0,0,0,0,0,170,2.1,10,9,16.1,3000,9,999999999,89,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,3,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-4.0,-7.0,77,80700,0,0,251,0,0,0,0,0,0,0,250,1.5,9,8,16.1,3000,9,999999999,89,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,4,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-2.0,-5.0,78,80700,0,0,273,0,0,0,0,0,0,0,330,1.5,10,10,16.1,2700,9,999999999,89,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,5,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,-2.0,-4.0,85,80800,0,0,274,0,0,0,0,0,0,0,240,3.6,10,10,12.9,1080,9,999999999,100,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,6,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-1.0,-2.0,92,80900,0,0,280,0,0,0,0,0,0,0,0,0.0,10,10,1.2,150,9,999999999,89,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,7,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-1.0,-1.0,100,81000,0,0,281,0,0,0,0,0,0,0,270,2.6,10,10,1.6,480,9,999999999,89,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,8,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,-1.0,-1.0,100,81100,41,861,281,4,119,2,906,6725,559,79,260,2.1,10,10,1.6,480,9,999999999,89,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,9,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,0.0,-1.0,92,81300,242,1415,272,178,480,95,17449,32960,11774,1860,240,2.6,9,8,6.4,1500,9,999999999,89,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,10,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,2.0,-1.0,80,81500,429,1415,294,49,0,49,5871,0,5871,2108,280,2.6,10,10,16.1,1500,9,999999999,89,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,11,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,2.0,-1.0,80,81500,563,1415,294,431,654,169,44097,62425,19149,3410,10,4.6,10,10,16.1,1500,9,999999999,89,0.0310,0,88,0.330,0.0,6.0 +1999,1,1,12,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,1.0,-2.0,79,81500,635,1415,275,326,296,193,34655,30037,21116,4256,10,7.2,8,8,16.1,1500,9,999999999,80,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,13,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,3.0,-3.0,63,81600,640,1415,296,255,96,212,28023,9483,23716,5980,360,6.2,10,10,16.1,810,9,999999999,80,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,14,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,2.0,-4.0,62,81600,577,1415,291,160,12,155,18096,900,17727,5938,20,7.2,10,10,16.1,960,9,999999999,80,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,15,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,1.0,-4.0,67,81700,452,1415,287,59,0,59,7007,0,7007,2516,20,7.2,10,10,12.9,840,9,999999999,80,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,16,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,1.0,-4.0,67,81700,272,1415,287,51,0,51,5821,0,5821,1885,360,5.1,10,10,16.1,1020,9,999999999,80,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,17,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9,0.0,-3.9,72,81700,62,1073,283,18,170,12,2390,7964,1886,227,10,5.4,10,10,16.1,885,9,999999999,80,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,18,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,-1.0,-4.0,78,81800,0,0,278,0,0,0,0,0,0,0,10,5.7,10,10,12.9,750,9,999999999,80,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,19,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-2.0,-6.0,71,81800,0,0,272,0,0,0,0,0,0,0,360,5.1,10,10,14.5,750,9,999999999,69,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,20,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,-4.0,-8.0,71,81800,0,0,262,0,0,0,0,0,0,0,20,8.2,10,10,14.5,480,9,999999999,69,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,21,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,-5.0,-7.0,84,81800,0,0,260,0,0,0,0,0,0,0,10,5.1,10,10,2.8,330,9,999999999,69,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,22,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,-6.0,-6.0,100,81800,0,0,257,0,0,0,0,0,0,0,10,3.6,10,10,1.2,210,9,999999999,69,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,23,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-7.0,-9.0,84,81800,0,0,250,0,0,0,0,0,0,0,30,6.7,10,10,1.2,150,9,999999999,69,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,24,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-7.0,-9.0,84,81700,0,0,250,0,0,0,0,0,0,0,30,6.7,10,10,1.2,150,9,999999999,69,0.0310,0,88,0.330,999.0,99.0 +)"; + + boost::optional _epwFile = EpwFile::loadFromString(epwFileStringNoHolidaysDaylightSavings); + ASSERT_TRUE(_epwFile); + EXPECT_FALSE(_epwFile->daylightSavingStartDate()); + EXPECT_FALSE(_epwFile->daylightSavingEndDate()); + std::vector holidays = _epwFile->holidays(); + EXPECT_TRUE(holidays.empty()); + + + // Taken from NREL/EnergyPlus: weather/Drycold_blast.epw + // HOLIDAYS/DAYLIGHT SAVINGS,No, 4/29,10/28,9,Hol:001, 1/ 1,Hol:002, 2/19,Hol:003, 5/28,Hol:004, 7/ 4,Hol:005, 9/ 3,Hol:006,10/ 8,Hol:007,11/12,Hol:008,11/22,Hol:009,12/25 + std::string epwFileStringWithHolidaysDaylightSavings = R"(LOCATION,Denver Centennial Golden Nr,CO,USA,TMY3,724666,39.74,-105.18,-7.0,1829.0 +DESIGN CONDITIONS,1,Climate Design Data 2009 ASHRAE Handbook,,Heating,12,-18.8,-15.5,-21.6,0.7,-10.9,-18.8,0.9,-7.5,12.2,3.9,10.9,3.8,3,340,Cooling,7,15.2,33,15.7,32,15.5,30.2,15.3,18.4,27.3,17.5,26.4,16.8,25.6,4.9,0,16.1,14.3,20.2,14.9,13.2,19.9,13.9,12.3,19.6,59.7,27.3,56.6,26.6,54,25.7,760,Extremes,11.1,9.5,8.4,22.9,-22.9,36.1,3.8,1.2,-25.7,37,-27.9,37.7,-30.1,38.3,-32.8,39.2 +TYPICAL/EXTREME PERIODS,6,Summer - Week Nearest Max Temperature For Period,Extreme,7/ 6,7/12,Summer - Week Nearest Average Temperature For Period,Typical,7/27,8/ 2,Winter - Week Nearest Min Temperature For Period,Extreme,12/15,12/21,Winter - Week Nearest Average Temperature For Period,Typical,12/ 1,12/ 7,Autumn - Week Nearest Average Temperature For Period,Typical,10/20,10/26,Spring - Week Nearest Average Temperature For Period,Typical,4/26,5/ 2 +GROUND TEMPERATURES,3,.5,,,,-0.60,1.34,5.12,8.69,15.46,19.02,20.00,18.20,14.02,8.83,3.71,0.32,2,,,,2.08,2.55,4.70,7.10,12.30,15.62,17.28,16.91,14.53,10.94,6.90,3.72,4,,,,4.84,4.51,5.45,6.81,10.25,12.82,14.49,14.90,13.86,11.74,9.00,6.53 +HOLIDAYS/DAYLIGHT SAVINGS,No, 4/29,10/28,9,Hol:001, 1/ 1,Hol:002, 2/19,Hol:003, 5/28,Hol:004, 7/ 4,Hol:005, 9/ 3,Hol:006,10/ 8,Hol:007,11/12,Hol:008,11/22,Hol:009,12/25 +COMMENTS 1,Custom/User Format -- WMO#724666; NREL TMY Data Set (2008); Period of Record 1973-2005 (Generally) +COMMENTS 2, -- Ground temps produced with a standard soil diffusivity of 2.3225760E-03 {m**2/day} +DATA PERIODS,1,1,Data,Sunday, 1/ 1,1/1 +1999,1,1,1,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-3.0,-4.0,92,80600,0,0,257,0,0,0,0,0,0,0,0,0.0,9,8,16.1,3300,9,999999999,89,0.0310,0,88,0.330,999.0,99.0 +2005,1,1,2,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-3.0,-6.0,77,80600,0,0,261,0,0,0,0,0,0,0,170,2.1,10,9,16.1,3000,9,999999999,89,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,3,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-4.0,-7.0,77,80700,0,0,251,0,0,0,0,0,0,0,250,1.5,9,8,16.1,3000,9,999999999,89,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,4,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-2.0,-5.0,78,80700,0,0,273,0,0,0,0,0,0,0,330,1.5,10,10,16.1,2700,9,999999999,89,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,5,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,-2.0,-4.0,85,80800,0,0,274,0,0,0,0,0,0,0,240,3.6,10,10,12.9,1080,9,999999999,100,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,6,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-1.0,-2.0,92,80900,0,0,280,0,0,0,0,0,0,0,0,0.0,10,10,1.2,150,9,999999999,89,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,7,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-1.0,-1.0,100,81000,0,0,281,0,0,0,0,0,0,0,270,2.6,10,10,1.6,480,9,999999999,89,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,8,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,-1.0,-1.0,100,81100,41,861,281,4,119,2,906,6725,559,79,260,2.1,10,10,1.6,480,9,999999999,89,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,9,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,0.0,-1.0,92,81300,242,1415,272,178,480,95,17449,32960,11774,1860,240,2.6,9,8,6.4,1500,9,999999999,89,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,10,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,2.0,-1.0,80,81500,429,1415,294,49,0,49,5871,0,5871,2108,280,2.6,10,10,16.1,1500,9,999999999,89,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,11,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,2.0,-1.0,80,81500,563,1415,294,431,654,169,44097,62425,19149,3410,10,4.6,10,10,16.1,1500,9,999999999,89,0.0310,0,88,0.330,0.0,6.0 +1999,1,1,12,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,1.0,-2.0,79,81500,635,1415,275,326,296,193,34655,30037,21116,4256,10,7.2,8,8,16.1,1500,9,999999999,80,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,13,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,3.0,-3.0,63,81600,640,1415,296,255,96,212,28023,9483,23716,5980,360,6.2,10,10,16.1,810,9,999999999,80,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,14,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,2.0,-4.0,62,81600,577,1415,291,160,12,155,18096,900,17727,5938,20,7.2,10,10,16.1,960,9,999999999,80,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,15,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,1.0,-4.0,67,81700,452,1415,287,59,0,59,7007,0,7007,2516,20,7.2,10,10,12.9,840,9,999999999,80,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,16,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,1.0,-4.0,67,81700,272,1415,287,51,0,51,5821,0,5821,1885,360,5.1,10,10,16.1,1020,9,999999999,80,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,17,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9,0.0,-3.9,72,81700,62,1073,283,18,170,12,2390,7964,1886,227,10,5.4,10,10,16.1,885,9,999999999,80,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,18,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,-1.0,-4.0,78,81800,0,0,278,0,0,0,0,0,0,0,10,5.7,10,10,12.9,750,9,999999999,80,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,19,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-2.0,-6.0,71,81800,0,0,272,0,0,0,0,0,0,0,360,5.1,10,10,14.5,750,9,999999999,69,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,20,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,-4.0,-8.0,71,81800,0,0,262,0,0,0,0,0,0,0,20,8.2,10,10,14.5,480,9,999999999,69,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,21,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,-5.0,-7.0,84,81800,0,0,260,0,0,0,0,0,0,0,10,5.1,10,10,2.8,330,9,999999999,69,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,22,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9,-6.0,-6.0,100,81800,0,0,257,0,0,0,0,0,0,0,10,3.6,10,10,1.2,210,9,999999999,69,0.0310,0,88,0.330,0.0,1.0 +1999,1,1,23,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-7.0,-9.0,84,81800,0,0,250,0,0,0,0,0,0,0,30,6.7,10,10,1.2,150,9,999999999,69,0.0310,0,88,0.330,999.0,99.0 +1999,1,1,24,0,?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9*9*9,-7.0,-9.0,84,81700,0,0,250,0,0,0,0,0,0,0,30,6.7,10,10,1.2,150,9,999999999,69,0.0310,0,88,0.330,999.0,99.0 +)"; + + _epwFile = EpwFile::loadFromString(epwFileStringWithHolidaysDaylightSavings); + ASSERT_TRUE(_epwFile); + EXPECT_FALSE(_epwFile->daylightSavingStartDate()); + EXPECT_FALSE(_epwFile->daylightSavingEndDate()); + holidays = _epwFile->holidays(); + EXPECT_FALSE(holidays.empty()); + EXPECT_EQ(9u, holidays.size()); + + + std::vector > expectedResult = { + {"Hol:001", "1/ 1"}, + {"Hol:002", "2/19"}, + {"Hol:003", "5/28"}, + {"Hol:004", "7/ 4"}, + {"Hol:005", "9/ 3"}, + {"Hol:006", "10/ 8"}, + {"Hol:007", "11/12"}, + {"Hol:008", "11/22"}, + {"Hol:009", "12/25"}, + }; + + int i = 0; + for (const EpwHoliday& holiday: holidays) { + EXPECT_EQ(expectedResult[i].first, holiday.holidayName()); + EXPECT_EQ(expectedResult[i].second, holiday.holidayDateString()); + } + +} From 251096b8e8505635022a11c91aac370a81841ff6 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 17:36:19 +0100 Subject: [PATCH 11/15] Forgot increment --- src/utilities/filetypes/test/EpwFile_GTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utilities/filetypes/test/EpwFile_GTest.cpp b/src/utilities/filetypes/test/EpwFile_GTest.cpp index 5b32c036688..843068335b8 100644 --- a/src/utilities/filetypes/test/EpwFile_GTest.cpp +++ b/src/utilities/filetypes/test/EpwFile_GTest.cpp @@ -875,6 +875,7 @@ DATA PERIODS,1,1,Data,Sunday, 1/ 1,1/1 for (const EpwHoliday& holiday: holidays) { EXPECT_EQ(expectedResult[i].first, holiday.holidayName()); EXPECT_EQ(expectedResult[i].second, holiday.holidayDateString()); + ++i; } } From eaddb100e2eb81b882684884baf86cb6d7272ad9 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 11 Dec 2019 17:53:38 +0100 Subject: [PATCH 12/15] test wasn't finished properly --- src/utilities/filetypes/test/EpwFile_GTest.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/utilities/filetypes/test/EpwFile_GTest.cpp b/src/utilities/filetypes/test/EpwFile_GTest.cpp index 843068335b8..050586385ff 100644 --- a/src/utilities/filetypes/test/EpwFile_GTest.cpp +++ b/src/utilities/filetypes/test/EpwFile_GTest.cpp @@ -852,8 +852,14 @@ DATA PERIODS,1,1,Data,Sunday, 1/ 1,1/1 _epwFile = EpwFile::loadFromString(epwFileStringWithHolidaysDaylightSavings); ASSERT_TRUE(_epwFile); - EXPECT_FALSE(_epwFile->daylightSavingStartDate()); - EXPECT_FALSE(_epwFile->daylightSavingEndDate()); + // Daylight: 4/29,10/28 + ASSERT_TRUE(_epwFile->daylightSavingStartDate()); + Date expectedStartDate(openstudio::monthOfYear(4), 29); + EXPECT_EQ(expectedStartDate, _epwFile->daylightSavingStartDate().get()); + ASSERT_TRUE(_epwFile->daylightSavingEndDate()); + Date expectedEndDate(openstudio::monthOfYear(10), 28); + EXPECT_EQ(expectedEndDate, _epwFile->daylightSavingEndDate().get()); + holidays = _epwFile->holidays(); EXPECT_FALSE(holidays.empty()); EXPECT_EQ(9u, holidays.size()); From 82c4721de89e413cc584cc87251d347523e90d4b Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 12 Dec 2019 11:09:12 +0100 Subject: [PATCH 13/15] Replace `holidayDaySchedule` by `holidaySchedule` --- .../ForwardTranslateScheduleRuleset.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateScheduleRuleset.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateScheduleRuleset.cpp index 9eaef90bbb2..71860e405fd 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateScheduleRuleset.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateScheduleRuleset.cpp @@ -71,7 +71,7 @@ struct WeekScheduleStruct{ std::string thursdaySchedule; std::string fridaySchedule; std::string saturdaySchedule; - std::string holidayDaySchedule; + std::string holidaySchedule; std::string summerDesignDaySchedule; std::string winterDesignDaySchedule; std::string customDay1Schedule; @@ -99,7 +99,7 @@ struct WeekScheduleStruct{ thursdaySchedule == other.thursdaySchedule && fridaySchedule == other.fridaySchedule && saturdaySchedule == other.saturdaySchedule && - holidayDaySchedule == other.holidayDaySchedule && + holidaySchedule == other.holidaySchedule && summerDesignDaySchedule == other.summerDesignDaySchedule && winterDesignDaySchedule == other.winterDesignDaySchedule && customDay1Schedule == other.customDay1Schedule && @@ -117,7 +117,7 @@ struct WeekScheduleStruct{ weekSchedule.setString(Schedule_Week_DailyFields::ThursdaySchedule_DayName, thursdaySchedule); weekSchedule.setString(Schedule_Week_DailyFields::FridaySchedule_DayName, fridaySchedule); weekSchedule.setString(Schedule_Week_DailyFields::SaturdaySchedule_DayName, saturdaySchedule); - weekSchedule.setString(Schedule_Week_DailyFields::HolidaySchedule_DayName, holidayDaySchedule); + weekSchedule.setString(Schedule_Week_DailyFields::HolidaySchedule_DayName, holidaySchedule); weekSchedule.setString(Schedule_Week_DailyFields::SummerDesignDaySchedule_DayName, summerDesignDaySchedule); weekSchedule.setString(Schedule_Week_DailyFields::WinterDesignDaySchedule_DayName, winterDesignDaySchedule); weekSchedule.setString(Schedule_Week_DailyFields::CustomDay1Schedule_DayName, customDay1Schedule); @@ -149,7 +149,7 @@ boost::optional ForwardTranslator::translateScheduleRuleset( Schedule ScheduleDay summerDesignDaySchedule = modelObject.summerDesignDaySchedule(); ScheduleDay winterDesignDaySchedule = modelObject.winterDesignDaySchedule(); // ScheduleRuleset is the one carrying the Holiday Schedule - ScheduleDay holidayDaySchedule = modelObject.holidaySchedule(); + ScheduleDay holidaySchedule = modelObject.holidaySchedule(); // initialize day of week schedules ScheduleDay sundaySchedule = defaultDaySchedule; @@ -232,7 +232,7 @@ boost::optional ForwardTranslator::translateScheduleRuleset( Schedule weekSchedule->fridaySchedule = fridaySchedule.name().get(); weekSchedule->saturdaySchedule = saturdaySchedule.name().get(); // from Schedule:Ruleset - weekSchedule->holidayDaySchedule = holidayDaySchedule.name().get(); + weekSchedule->holidaySchedule = holidaySchedule.name().get(); weekSchedule->summerDesignDaySchedule = summerDesignDaySchedule.name().get(); weekSchedule->winterDesignDaySchedule = winterDesignDaySchedule.name().get(); // Not exposed yet @@ -299,7 +299,7 @@ boost::optional ForwardTranslator::translateScheduleRuleset( Schedule weekSchedule->thursdaySchedule = thursdaySchedule.name().get(); weekSchedule->fridaySchedule = fridaySchedule.name().get(); weekSchedule->saturdaySchedule = saturdaySchedule.name().get(); - weekSchedule->holidayDaySchedule = holidayDaySchedule.name().get(); + weekSchedule->holidaySchedule = holidaySchedule.name().get(); weekSchedule->summerDesignDaySchedule = summerDesignDaySchedule.name().get(); weekSchedule->winterDesignDaySchedule = winterDesignDaySchedule.name().get(); weekSchedule->customDay1Schedule = customDay1Schedule.name().get(); @@ -399,12 +399,12 @@ boost::optional ForwardTranslator::translateScheduleRuleset( Schedule ScheduleDay defaultDaySchedule = modelObject.defaultDaySchedule(); ScheduleDay summerDesignDaySchedule = modelObject.summerDesignDaySchedule(); ScheduleDay winterDesignDaySchedule = modelObject.winterDesignDaySchedule(); - ScheduleDay holidayDaySchedule = modelObject.holidaySchedule(); + ScheduleDay holidaySchedule = modelObject.holidaySchedule(); translateAndMapModelObject(defaultDaySchedule); translateAndMapModelObject(summerDesignDaySchedule); translateAndMapModelObject(winterDesignDaySchedule); - translateAndMapModelObject(holidayDaySchedule); + translateAndMapModelObject(holidaySchedule); // translate schedule rules, these are returned in order for (ScheduleRule scheduleRule : modelObject.scheduleRules()){ From bbf6fbf1069315a706162bd3ee51e28d7c6bf0b7 Mon Sep 17 00:00:00 2001 From: tijcolem Date: Thu, 2 Jan 2020 13:46:22 -0700 Subject: [PATCH 14/15] removing develop3 jenkinsfile --- Jenkinsfile_develop3 | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 Jenkinsfile_develop3 diff --git a/Jenkinsfile_develop3 b/Jenkinsfile_develop3 deleted file mode 100644 index f7bf5dfecad..00000000000 --- a/Jenkinsfile_develop3 +++ /dev/null @@ -1,10 +0,0 @@ -//Jenkins pipelines are stored in shared libaries. Please see: https://github.com/tijcolem/nrel_cbci_jenkins_libs - -@Library('cbci_shared_libs') _ - -// Build for PR to develop branch only. -if ((env.CHANGE_ID) && (env.CHANGE_TARGET) ) { - - openstudio_incremental_develop3() - -} From c8668d589120606a417793a585db63b9ee878df6 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 16 Jan 2020 22:20:21 +0100 Subject: [PATCH 15/15] Move VT into the 291 to 300 --- src/osversion/VersionTranslator.cpp | 42 ++++++++++++++--------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/osversion/VersionTranslator.cpp b/src/osversion/VersionTranslator.cpp index a023469a2db..22d15e22dbd 100644 --- a/src/osversion/VersionTranslator.cpp +++ b/src/osversion/VersionTranslator.cpp @@ -4864,27 +4864,6 @@ std::string VersionTranslator::update_2_9_0_to_2_9_1(const IdfFile& idf_2_9_0, c m_refactored.push_back(RefactoredObjectData(object, newObject)); ss << newObject; - } else if (iddname == "OS:Schedule:Rule") { - auto iddObject = idd_3_0_0.getObject(iddname); - IdfObject newObject(iddObject.get()); - - // Removed field 12: Apply Holiday - for (size_t i = 0; i < object.numFields(); ++i) { - if ((value = object.getString(i))) { - if (i < 12) { - newObject.setString(i, value.get()); - } else if (i > 12) { - newObject.setString(i-1, value.get()); - } // i == 12: skip - } - } - - m_refactored.push_back(RefactoredObjectData(object, newObject)); - ss << newObject; - - // Note: OS:ScheduleRuleset got a new optional field at the end, so no-op - // } else if (iddname == "OS:Schedule:Ruleset") { - // No-op } else { ss << object; @@ -4938,6 +4917,27 @@ std::string VersionTranslator::update_2_9_1_to_3_0_0(const IdfFile& idf_2_9_1, c m_refactored.push_back(RefactoredObjectData(object, newObject)); ss << newObject; + } else if (iddname == "OS:Schedule:Rule") { + auto iddObject = idd_3_0_0.getObject(iddname); + IdfObject newObject(iddObject.get()); + + // Removed field 12: Apply Holiday + for (size_t i = 0; i < object.numFields(); ++i) { + if ((value = object.getString(i))) { + if (i < 12) { + newObject.setString(i, value.get()); + } else if (i > 12) { + newObject.setString(i-1, value.get()); + } // i == 12: skip + } + } + + m_refactored.push_back(RefactoredObjectData(object, newObject)); + ss << newObject; + + // Note: OS:ScheduleRuleset got a new optional field at the end, so no-op + // } else if (iddname == "OS:Schedule:Ruleset") { + // No-op } else { ss << object;