From 8fff062c802103949f8b208356a624002528a9b2 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 12 Jun 2023 10:54:22 +0200 Subject: [PATCH 1/2] #4911 - Small bug for warning --- src/model/ShadingControl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/model/ShadingControl.cpp b/src/model/ShadingControl.cpp index a43a458009a..5da87bdae5f 100644 --- a/src/model/ShadingControl.cpp +++ b/src/model/ShadingControl.cpp @@ -406,7 +406,7 @@ namespace model { void ShadingControl_Impl::resetSetpoint2() { std::string shadingControlType = this->shadingControlType(); - if (ShadingControl_Impl::isControlTypeValueNeedingSetpoint1(shadingControlType)) { + if (ShadingControl_Impl::isControlTypeValueNeedingSetpoint2(shadingControlType)) { LOG(Warn, briefDescription() << " has a Shading Control Type '" << shadingControlType << "' which does require a Setpoint2, not resetting it"); } else { From c92ab5fe794e71ebcf8fbbecfe2763ce23f079e0 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 12 Jun 2023 10:54:52 +0200 Subject: [PATCH 2/2] Fix #4911 - Avoid extra warning message in ShadingControl --- src/model/ShadingControl.cpp | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/src/model/ShadingControl.cpp b/src/model/ShadingControl.cpp index 5da87bdae5f..5bf5a311558 100644 --- a/src/model/ShadingControl.cpp +++ b/src/model/ShadingControl.cpp @@ -239,42 +239,30 @@ namespace model { } bool ShadingControl_Impl::setShadingControlType(const std::string& shadingControlType) { - std::string oldControlType = this->shadingControlType(); - bool result = setString(OS_ShadingControlFields::ShadingControlType, shadingControlType); + const bool result = setString(OS_ShadingControlFields::ShadingControlType, shadingControlType); if (result) { if (!ShadingControl_Impl::isControlTypeValueNeedingSetpoint1(shadingControlType)) { - // Not calling reset to avoid double check on whether it's required - // resetSetpoint(); - LOG(Info, - briefDescription() << " Shading Control Type was changed to '" << shadingControlType << " which does not require a Setpoint, reseting"); - bool test = setString(OS_ShadingControlFields::Setpoint, ""); + // Not calling resetSetpoint to avoid double check on whether it's required + LOG(Info, briefDescription() << " Shading Control Type was changed to '" << shadingControlType + << " which does not require a Setpoint, resetting it."); + const bool test = setString(OS_ShadingControlFields::Setpoint, ""); OS_ASSERT(test); } if (!ShadingControl_Impl::isControlTypeValueNeedingSetpoint2(shadingControlType)) { - // Not calling reset to avoid double check on whether it's required - // resetSetpoint2(); + // Not calling resetSetpoint2 to avoid double check on whether it's required LOG(Info, briefDescription() << " Shading Control Type was changed to '" << shadingControlType - << " which does not require a Setpoint2, reseting"); - bool test = setString(OS_ShadingControlFields::Setpoint2, ""); + << " which does not require a Setpoint2, resetting it."); + const bool test = setString(OS_ShadingControlFields::Setpoint2, ""); OS_ASSERT(test); } if (!ShadingControl_Impl::isControlTypeValueAllowingSchedule(shadingControlType)) { - LOG(Info, - briefDescription() << " Shading Control Type was changed to '" << shadingControlType << " which does not allow a Schedule, reseting"); + LOG(Info, briefDescription() << " Shading Control Type was changed to '" << shadingControlType + << " which does not allow a Schedule, resetting it."); bool test = setString(OS_ShadingControlFields::ScheduleName, ""); OS_ASSERT(test); test = setString(OS_ShadingControlFields::ShadingControlIsScheduled, "No"); OS_ASSERT(test); } - - // TODO: do we want to force remove this stuff like it did resetSetpoint before? Units/quantity might be oranges and apples when switching - // types, but they could be compatible, and it may be very confusing at least for interface users that are playing with a dropdown to see - // schedulesand setpoints disapear - if (!openstudio::istringEqual(oldControlType, shadingControlType)) { - resetSetpoint(); // For backward compatibility - // resetSetpoint2(); - // resetSchedule(); - } } return result; }