-
Notifications
You must be signed in to change notification settings - Fork 197
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
Multiple shading controls referenced by a single subsurface #4066
Conversation
@joseph-robertson I'll take a deeper look on monday. Mostly I think I need to look up how the E+ objects interact exactly... but I have a couple of naive comments that perhaps you can clear out today:
|
I think we're setting up a many-to-many relationship. You can have:
The second bullet was already supported. I'm thinking we wouldn't have to break API to support the first bullet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joseph-robertson I missed the many-to-many relationship aspect, this makes sense now, thanks for the clarification!
A couple more comments for discussion. The relationship between these two objects in E+ is quite awkward, and I'm still unsure how we would deal with the "Shading Control Sequence Number" in particular.
src/model/SubSurface_Impl.hpp
Outdated
@@ -152,6 +152,12 @@ namespace detail { | |||
|
|||
boost::optional<ShadingControl> shadingControl() const; | |||
|
|||
std::vector<ShadingControl> shadingControls(); | |||
|
|||
ShadingControl getShadingControl(unsigned shadingControlIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That may be a bit weird. The order here is kinda undefined isn't it? Unlike ShadingControl which has an ordered list via its extensible groups, here it will depend on the order of the objects in the model (the shadingControls()
is fine though, as this doesn't make any promises in terms of order)
src/model/SubSurface_Impl.hpp
Outdated
@@ -186,6 +192,14 @@ namespace detail { | |||
|
|||
void resetShadingControl(); | |||
|
|||
bool setShadingControls(const std::vector<ShadingControl> &shadingControls); | |||
|
|||
bool insertShadingControl(unsigned shadingControlIndex, const ShadingControl &shadingControl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about order as above. I am not sure it's appropriate or even wanted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the idea to tie into the field "Shading Control Sequence Number" on the ShadingControl object? That field is a bit weird...
OpenStudio/src/energyplus/ForwardTranslator/ForwardTranslateShadingControl.cpp
Lines 114 to 119 in fa9a77b
boost::optional<int> sequenceNumber = modelObject.additionalProperties().getFeatureAsInteger("Shading Control Sequence Number"); | |
if (sequenceNumber) { | |
idfObject.setInt(WindowShadingControlFields::ShadingControlSequenceNumber, *sequenceNumber); | |
} else { | |
LOG(Error, modelObject.briefDescription() << " has unknown Shading Control Sequence Number"); | |
} |
src/model/SubSurface.cpp
Outdated
@@ -487,7 +487,36 @@ namespace detail { | |||
|
|||
boost::optional<ShadingControl> SubSurface_Impl::shadingControl() const | |||
{ | |||
return getObject<SubSurface>().getModelObjectTarget<ShadingControl>(OS_SubSurfaceFields::ShadingControlName); | |||
if (numberofShadingControls() > 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would warn that there are more than 1, then return the first found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cna also do that on the public side only, and remove the ShadingControl() method from Impl altogether.
EXPECT_EQ(2, shadingControl.numberofSubSurfaces()); | ||
shadingControl.removeAllSubSurfaces(); | ||
EXPECT_EQ(0, shadingControl.numberofSubSurfaces()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expand the test. Assign subSurface1 and subSurface2, then subSurface2.remove() => what happens to the numberOfSurbSurfaces.
Add a clone test too: are the extensible groups cleared? (do we want them to be?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmarrec I added tests for these two scenarios. They both fail. For the first, shadingControl.numberofSubSurfaces
remains at what it was before. For the second, cloning the shadingControl object throws an error.
…hen we are mutating it. m
8902811
to
3118db0
Compare
…ing a crude change for build to keep going @joseph-robertson
3118db0
to
6619cbf
Compare
…dule all the time. Left A TODO
Found it while investigating #4062
…o into multiple-shading-controls
3448990
to
7bea01b
Compare
CI Results for e454bfa:
|
@joseph-robertson did we restrict the SubSurfaces to be part of the same ThermalZOne? I think we perhaps should? |
I don't agree with this. See #3380 for example. EDIT: So note that there is a warning for this case. |
@jmarrec Why do you think we should? |
I think I misread the doc for the field https://bigladdersoftware.com/epx/docs/9-3/input-output-reference/group-thermal-zone-description-geometry.html#shading-control-sequence-number (I read that they should be in the same zone) as I had just read the comment in the ForwardTranslator just before it. Now I see it's not a problem to span across zones
Well then it goes back to the action item I added: Does the logic in the ForwardTrnaslator.cpp need to be updated? OpenStudio/src/energyplus/ForwardTranslator.cpp Lines 448 to 450 in aa61fc9
|
I have merged this into #4073 and will go ahead and merge the combined work which will close #4066 and #4073. Lets just please pay close attention to the regression tests, and @joseph-robertson consider adding a regression test to demonstrate the multiple shading surfaces. |
Here is a new test (shadingcontrol_multizone.rb) related to this: NREL/OpenStudio-resources#147. From what I can tell, the idf contains shading controls with sub surfaces from different zones. However, the "Window Control" table in eplustbl.htm shows only a single shading control object for each sub surface. In fact, when I look at eplustbl.htm for shadingcontrol_singlezone.rb I see a similar thing. So I'm not sure if this is working. Shouldn't we see multiple shading control objects for the same sub surface? |
Pull request overview
SubSurface
boost::optional<ShadingControl> shadingControl() const
(OS_DEPRECATED; only returns if there is 1 shading control)std::vector<ShadingControl> shadingControls() const
(NEW)unsigned int numberofShadingControls() const
(NEW)bool setShadingControl(const ShadingControl& shadingControl)
(OS_DEPRECATED; will remove any existing shading controls and then add the one shading control)void resetShadingControl()
(OS_DEPRECATED; will remove any existing shading controls)bool addShadingControl(const ShadingControl& shadingControl)
(NEW)bool addShadingControls(const std::vector<ShadingControl> &shadingControls)
(NEW)void removeShadingControl(const ShadingControl& shadingControl)
(NEW)void removeAllShadingControls()
(NEW)ShadingControl
unsigned int numberofSubSurfaces() const
(NEW)bool addSubSurface(const SubSurface& subSurface)
(NEW)bool addSubSurfaces(const std::vector<SubSurface> &subSurfaces)
(NEW)void removeSubSurface(const SubSurface& subSurface)
(NEW)void removeAllSubSurfaces()
(NEW)bool glareControlIsActivate() const
(NEW)std::string typeofSlatAngleControlforBlinds() const
(NEW)bool isTypeofSlatAngleControlforBlindsDefault() const
(NEW)boost::optional<Schedule> slatAngleSchedule() const
(NEW)std::string multipleSurfaceControlType() const
(NEW)bool setGlareControlIsActive(bool glareControlIsActive)
(NEW)void resetGlareControlIsActive()
(NEW)bool setTypeofSlatAngleControlforBlinds(const std::string& typeofSlatAngleControlforBlinds)
(NEW)void resetTypeofSlatAngleControlforBlinds()
(NEW)bool setSlatAngleSchedule(const Schedule& slatAngleSchedule)
(NEW)void resetSlatAngleSchedule()
(NEW)bool setMultipleSurfaceControlType(const std::string& multipleSurfaceControlType)
(NEW)Please read OpenStudio Pull Requests to better understand the OpenStudio Pull Request protocol.
Pull Request Author
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
src/model/test
)src/energyplus/Test
)src/osversion/VersionTranslator.cpp
)src/openstudio_lib/library/OpenStudioPolicy.xml
)Labels:
IDDChange
APIChange
Pull Request - Ready for CI
so that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.