Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #4911 - Avoid extra warning message in ShadingControl #4914

Merged
merged 2 commits into from
Jun 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 11 additions & 23 deletions src/model/ShadingControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Comment on lines -270 to -277
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this block that was a TODO and issues an unnecessary Warn

}
return result;
}
Expand Down Expand Up @@ -406,7 +394,7 @@ namespace model {

void ShadingControl_Impl::resetSetpoint2() {
std::string shadingControlType = this->shadingControlType();
if (ShadingControl_Impl::isControlTypeValueNeedingSetpoint1(shadingControlType)) {
if (ShadingControl_Impl::isControlTypeValueNeedingSetpoint2(shadingControlType)) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a bug found by @brgix

LOG(Warn,
briefDescription() << " has a Shading Control Type '" << shadingControlType << "' which does require a Setpoint2, not resetting it");
} else {
Expand Down