-
Notifications
You must be signed in to change notification settings - Fork 188
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
Wrap ZoneProperty:UserViewFactors:bySurfaceName object #3671
Conversation
|
@joseph-robertson I can work on this tomorrow morning. What in the RT isnt working? Is it not translating the object at all or it's failing? |
@jmarrec I got the RT working, so don't worry about that. This is ready for your review. |
…ip trailing spaces
…t have at least one view factor
…erty reference the same ThermalZone.
… allowing people to call direct Ctor for ZoneProp
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.
This is great work @joseph-robertson, very thorough. I've made a few changes that I explained in the code as comments (some might be considered pedantic probably!), hopefully they make sense. I clicked "Resolved" on the ones I did address directly, so you'll have to expand them.
The only thing worth considering anymore is in this comment: #3671 (diff), especially the naming convention part. I am fine you just say it's better this way (hence why I set the status to "Approve")
(Out of curiosity: I have been wondering one thing: why was this chosen to be placed at the ThermalZone
level and not the Space
level? I honestly didn't take the time to carefully evaluate both options, and I assume you guys have)
...rc/energyplus/ForwardTranslator/ForwardTranslateZonePropertyUserViewFactorsBySurfaceName.cpp
Outdated
Show resolved
Hide resolved
ViewFactor(const InternalMass& fromInternalMass, const Surface& toSurface, double viewFactor); | ||
ViewFactor(const InternalMass& fromInternalMass, const SubSurface& toSubSurface, double viewFactor); | ||
|
||
boost::optional<Surface> fromSurface() const; |
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.
- Perhaps we should also add a
ModelObject toSurfaceAsModelObject() const
and aModelObject fromSurfaceAsModelObject() const
. You could then use that in the ostream overload to avoid testing all cases too, as well as in theaddViewFactor(const ViewFactor&)
and make your code dryer.
You'd probably also change the logic though, and use a singleModelObject m_fromSurface
andModelObject m_toSurface
as members of the ViewFactor class.
(I do not feel very strongly about either design choice)
- The naming conventions do not match the similar object
SurfacePropertyConvectionCoefficients
which uses:
ModelObject surfaceAsModelObject() const;
boost::optional<Surface> surfaceAsSurface() const;
boost::optional<SubSurface> surfaceAsSubSurface() const;
boost::optional<InternalMass> surfaceAsInternalMass() const;
I think it might be beneficial to match this naming convention so our API is more predictable.
@joseph-robertson @shorowit Thoughts?
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 agree with #2.
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.
So we want
boost::optional<Surface> fromSurfaceAsSurface() const;
boost::optional<SubSurface> fromSurfaceAsSubSurface() const;
boost::optional<Surface> toSurfaceAsSurface() const;
boost::optional<SubSurface> toSurfaceAsSubSurface() const;
etc?
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.
Works for me.
openstudiocore/src/model/ZonePropertyUserViewFactorsBySurfaceName.cpp
Outdated
Show resolved
Hide resolved
...rc/energyplus/ForwardTranslator/ForwardTranslateZonePropertyUserViewFactorsBySurfaceName.cpp
Outdated
Show resolved
Hide resolved
...rc/energyplus/ReverseTranslator/ReverseTranslateZonePropertyUserViewFactorsBySurfaceName.cpp
Outdated
Show resolved
Hide resolved
openstudiocore/src/model/ZonePropertyUserViewFactorsBySurfaceName.hpp
Outdated
Show resolved
Hide resolved
@@ -135,6 +135,15 @@ class ExteriorLoadInstance; | |||
} | |||
}; | |||
|
|||
%extend openstudio::model::ViewFactor { | |||
// Use the overloaded operator<< for string representation |
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.
👍
In EnergyPlus, ultimately every combination of surfaces in a thermal zone needs a view factor. If you set view factors on a space level, you wouldn't be able to define view factors between two surfaces of different spaces within a given thermal zone. Granted these view factors would probably often be zero, but I'd hate to make OpenStudio more constrained than EnergyPlus for situations where the extra flexibility is desired. |
That was one thing I noticed, right now there's no checks whatsoever that are done to ensure that the to/from objects are actually part of the thermal zone referenced. I didn't bring it up because it's probably not going to be used much by lambda users. |
That really ought to be added -- checks in the |
Are there checks if someone adds two view factors for the same combination of surfaces? |
Sure aren't. I'll see if I can add. |
…dd ALL combinations (numSurfaces^2) Follow up #79
Closing this PR as superseded by #3675 (we diverged at some point and I wanted to avoid force pushing) |
Addresses #3664.
Design doc: https://docs.google.com/document/d/1P8O6GRQAZda5kK_2Qu2CJRkBGUxTIhJwvJ0-JNpTU1A/edit#heading=h.c285d1mdhew5
TODO: