Skip to content

Commit

Permalink
Fix #4064 - RunPeriodControlSpecialDays are not Forward Translated
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarrec committed Sep 11, 2020
1 parent 59de597 commit 05b11c2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
10 changes: 2 additions & 8 deletions src/energyplus/ForwardTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ ForwardTranslator::ForwardTranslator()
m_logSink.setThreadId(std::this_thread::get_id());
createFluidPropertiesMap();

// temp code
m_keepRunControlSpecialDays = false;
m_keepRunControlSpecialDays = true; // At 3.1.0 this was changed to true.
m_ipTabularOutput = false;
m_excludeLCCObjects = false;
m_excludeSQliteOutputReport = false;
Expand Down Expand Up @@ -161,7 +160,6 @@ std::vector<LogMessage> ForwardTranslator::errors() const
return result;
}

// temp code
void ForwardTranslator::setKeepRunControlSpecialDays(bool keepRunControlSpecialDays)
{
m_keepRunControlSpecialDays = keepRunControlSpecialDays;
Expand Down Expand Up @@ -498,12 +496,8 @@ 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
// we will not warn users because these objects are not exposed in the GUI
LOG(Warn, "You have manually choosen to not translate the RunPeriodControlSpecialDays, ignoring them.");
for (model::RunPeriodControlSpecialDays holiday : model.getConcreteModelObjects<model::RunPeriodControlSpecialDays>()){
holiday.remove();
}
Expand Down
3 changes: 1 addition & 2 deletions src/energyplus/ForwardTranslator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ class ENERGYPLUS_API ForwardTranslator {
*/
std::vector<LogMessage> errors() const;

/** Temporary code, use to preserve holidays in the model.
/** keepRunControlSpecialDays is enabled by default. You can use this method to NOT translate the holidays in the model.
*/
void setKeepRunControlSpecialDays(bool keepRunControlSpecialDays);

Expand Down Expand Up @@ -1483,7 +1483,6 @@ class ENERGYPLUS_API ForwardTranslator {

ProgressBar* m_progressBar;

// temp code
bool m_keepRunControlSpecialDays;
bool m_ipTabularOutput;
bool m_excludeLCCObjects;
Expand Down
11 changes: 6 additions & 5 deletions src/model/RunPeriodControlSpecialDays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,22 @@ namespace detail {
bool RunPeriodControlSpecialDays_Impl::setStartDate(const openstudio::NthDayOfWeekInMonth& nth, const openstudio::DayOfWeek& dayOfWeek, const openstudio::MonthOfYear& monthOfYear)
{
std::stringstream ss;
// Note: MonthOfYear::Jul => valueName() is "Jul", valueDescription is "July"
switch (nth.value()){
case NthDayOfWeekInMonth::first:
ss << "1st " << dayOfWeek.valueName() << " in " << monthOfYear.valueName();
ss << "1st " << dayOfWeek.valueName() << " in " << monthOfYear.valueDescription();
break;
case NthDayOfWeekInMonth::second:
ss << "2nd " << dayOfWeek.valueName() << " in " << monthOfYear.valueName();
ss << "2nd " << dayOfWeek.valueName() << " in " << monthOfYear.valueDescription();
break;
case NthDayOfWeekInMonth::third:
ss << "3rd " << dayOfWeek.valueName() << " in " << monthOfYear.valueName();
ss << "3rd " << dayOfWeek.valueName() << " in " << monthOfYear.valueDescription();
break;
case NthDayOfWeekInMonth::fourth:
ss << "4th " << dayOfWeek.valueName() << " in " << monthOfYear.valueName();
ss << "4th " << dayOfWeek.valueName() << " in " << monthOfYear.valueDescription();
break;
case NthDayOfWeekInMonth::fifth:
ss << "5th " << dayOfWeek.valueName() << " in " << monthOfYear.valueName();
ss << "5th " << dayOfWeek.valueName() << " in " << monthOfYear.valueDescription();
break;
default:
OS_ASSERT(false);
Expand Down

0 comments on commit 05b11c2

Please sign in to comment.