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

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Jun 12, 2023

Pull request overview

FYI @brgix

Pull Request Author

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified

@jmarrec jmarrec added component - Model Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. labels Jun 12, 2023
@jmarrec jmarrec self-assigned this Jun 12, 2023
@@ -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

Comment on lines -270 to -277
// 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();
}
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

@jmarrec
Copy link
Collaborator Author

jmarrec commented Jun 12, 2023

Testing the code from the #4911 with this branch. First test code, warning is removed

[1] OS-build-release(main)> model = OpenStudio::Model::Model.new
=> #<OpenStudio::Model::Model:0x000055d047110f40 @__swigtype__="_p_openstudio__model__Model">
[2] OS-build-release(main)> shd = OpenStudio::Model::Shade.new(model)
=> #<OpenStudio::Model::Shade:0x000055d04708b1d8 @__swigtype__="_p_openstudio__model__Shade">
[3] OS-build-release(main)> ctl = OpenStudio::Model::ShadingControl.new(shd)
=> #<OpenStudio::Model::ShadingControl:0x000055d047019f88 @__swigtype__="_p_openstudio__model__ShadingControl">
[4] OS-build-release(main)> ctl.setSetpoint(18)
=> true
[5] OS-build-release(main)> ctl.setShadingControlType("OnIfHighOutdoorAirTempAndHighSolarOnWindow")
=> true

Here you still get the warning that tells you you are setting a Setpoint2 when it's not needed. Which I think is fine IMHO.

[7] OS-build-release(main)> model = OpenStudio::Model::Model.new
=> #<OpenStudio::Model::Model:0x000055d046e2a308 @__swigtype__="_p_openstudio__model__Model">
[8] OS-build-release(main)> shd = OpenStudio::Model::Shade.new(model)
=> #<OpenStudio::Model::Shade:0x000055d046da9140 @__swigtype__="_p_openstudio__model__Shade">
[9] OS-build-release(main)> ctl = OpenStudio::Model::ShadingControl.new(shd)
=> #<OpenStudio::Model::ShadingControl:0x000055d046d23ef0 @__swigtype__="_p_openstudio__model__ShadingControl">
[10] OS-build-release(main)> ctl.setSetpoint(18)
=> true
[11] OS-build-release(main)> ctl.setSetpoint2(100)
[openstudio.model.ShadingControl] <0> Object of type 'OS:ShadingControl' and named 'Shading Control 1' has a Shading Control Type 'OnIfHighSolarOnWindow' which does not require a Setpoint2
=> false
[12] OS-build-release(main)> ctl.setShadingControlType("OnIfHighOutdoorAirTempAndHighSolarOnWindow")
=> true
Test 1
-[openstudio.model.ShadingControl] <0> Object of type 'OS:ShadingControl' and named 'Shading Control 1' has a Shading Control Type 'OnIfHighOutdoorAirTempAndHighSolarOnWindow' which does require a Setpoint, not resetting it


Test 2
[openstudio.model.ShadingControl] <0> Object of type 'OS:ShadingControl' and named 'Shading Control 1' has a Shading Control Type 'OnIfHighSolarOnWindow' which does not require a Setpoint2
-[openstudio.model.ShadingControl] <0> Object of type 'OS:ShadingControl' and named 'Shading Control 1' has a Shading Control Type 'OnIfHighOutdoorAirTempAndHighSolarOnWindow' which does require a Setpoint, not resetting it

@jmarrec jmarrec merged commit 9daf524 into develop Jun 29, 2023
@jmarrec jmarrec deleted the 4911_ShadingControl branch June 29, 2023 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component - Model Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Systematic warnings with setShadingControlType + setSetpoint(s)
2 participants